Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data trend
Message
From
02/12/2000 01:53:56
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00448229
Message ID:
00448442
Views:
8
Hi Joe. I don't know if this is what you'r looking for, but I gave it a shot.
SET TALK OFF
CREATE TABLE trend_data (cost N(6))
FOR i = 1 TO 100
	APPEND BLANK
	nRand = RAND()*100
	REPLACE cost WITH nRand
ENDFOR

PUBLIC oForm
oForm = CREAT([TrendForm])
oForm.DRAWWIDTH = 2
oForm.FORECOLOR = RGB(255,0,0)


GO TOP
xStart = RECNO() * 100
FOR k = 1 TO 100
	x1 = xStart
	x2 = xStart + 4
	y1 = trend_data.cost + 175
	SKIP
	y2 = trend_data.cost + 175
	oForm.LINE(x1,y1,x2,y2)
	xStart = xStart + 4
ENDFOR

oForm.DRAWWIDTH = 3
oForm.FORECOLOR = RGB(0,0,255)
oForm.LINE(70,80,70,400)
oForm.LINE(70,400,550,400)

oForm.SHOW

DEFINE CLASS CostLable AS LABEL
	BACKSTYLE = 0
	CAPTION = [C O S T]
	FONTBOLD = .T.
	FONTSIZE = 14
	HEIGHT = 88
	LEFT = 30
	TOP = 190
	WIDTH = 15
	WORDWRAP = .T.
ENDDEFINE

DEFINE CLASS TimeLable AS LABEL
	BACKSTYLE = 0
	CAPTION = [TIME]
	FONTBOLD = .T.
	FONTSIZE = 14
	LEFT = 300
	TOP = 430
ENDDEFINE

DEFINE CLASS TrendForm AS FORM
	AUTOCENTER = .T.
	BACKCOLOR = RGB(255,255,255)
	BORDERSTYLE = 1
	CAPTION = []
	CLOSABLE = .F.
	CONTROLBOX = .F.
	HEIGHT = 480
	MAXBUTTON = .F.
	MINBUTTON = .F.
	MOVABLE = .F.
	WIDTH = 640
	ADD OBJECT cost AS CostLable
	ADD OBJECT TIME AS TimeLable
	PROCEDURE CLICK
	RELEASE THISFORM
ENDPROC
ENDDEFINE
Hope this helps.
Dave




>What would be a good way to take a look at trends in data? Take a numeric field "cost" and
>over time, (records) look at whether it's going up or down. It would basically be the slope of the linear trend line as
>the data is plotted.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform