项目:
图片附件: 游客没有浏览图片的权限,请
登录 或
注册
我的一个应用修改成的代码:
If Type('ca_len')='U'=.F.
&& 大写“U”
If ca_len>=1
* Create a new empty form
* Drom an instance of FoxCharts to it
* Put the following code in the Init() event of the form
* Make sure the form and foxcharts are big enough so that the chart
* will appear well
* Create main cursor
Create Cursor chart_1 (shuju N(8,2), x轴坐标 c(15))
* Populate cursor with data each column with the sales amount for each x轴坐标
* this will have 12 rows, one for each x轴坐标
For i=Min(ca_len,12) To 1 Step -1
ic=Alltrim(Str(i))
Insert Into chart_1 Values(ca&ic,Iif(i=1,"本周"+Iif(yxca&ic=0,Chr(13)+Chr(10)+"(月未卖)",''),Alltrim(Str(i-1))+"周前"+Iif(yxca&ic=0,Chr(13)+Chr(10)+"(月未卖)",'')))
Endfor
* Next step is to Setup FoxCharts
* Supposing you already dropped an instance of FoxCharts to any form
Local loChart
loChart = This
With loChart As FoxCharts Of FoxCharts.Vcx
.ChartType = 5 && Line
* Then, we need to tell the class that it will receive 3 fields of data
* Each field will represent one line
* Later you can try changing the value of the property "ChartType" with values from 1 to 14
* Be careful because we don't have Charttype #3 available yet :-)
.ChartsCount = 1
* Then we tell FoxCharts the name of the cursor that contains the data needed
.SourceAlias = "chart_1"
.FieldAxis2 = "x轴坐标"
* Next step is to populate the collection object that will receive the information from the cursor
* Start with the first column - shuju
.Fields(1).FieldValue = "shuju" && This is the name of the 1st column of the cursor
.Fields(1).Legend = ""
.Fields(1).Color
= Rgb(255,0,0) && Red
* Setting the title and subtitle
.Title.Caption = "“库存天数”走势图"
.SubTitle.Caption = ""
.FontName = "Tahoma"
* Setting the Chart Depth ( 3d effect )
.Depth = 0
* Set the backColor
.BackColor = Rgb(255,255,225)
* Set the captions for the axis
.XAxis.Caption = ""
.YAxis.Caption = ""
* Draw the chart
.DrawChart()
Endwith
Endi
Endi