This version brings the so asked "double Y axis" charts as the main change.
- Multicharts with negative values that were not being drawn correctly in some situations;
- Line charts are drawn much faster (5x faster) when drawing with line caps (with shapes in the chart intersections);
- Other small tweaks
Have a look at the sample "chartssample_builder_2y.scx" in the samples folder of FoxCharts.
Just some few but important comments:
- needs to use depth = 0 (max 2)
- preferrably 2 data lines, one using the left axis and the other for the 2nd
- set the legends to the top
Pay attention to the new properties:
- ChartType = 18 && the newest chart type
- Fields(n).AxisIndex = 2 && to what axis the data will correspond (1 = default)
- LegendPosition = 6 && top center
Having this, now you are able to create a chart like this, with no effort:
Here is a simple script showing how to achieve the chart below directly:
create cursor sales( ; chart1 i null, ; chart2 i null, ; legend c (30) NULL) insert into sales values (130, 0, "jan") insert into sales values (120, 25000, "feb") insert into sales values ( 45, 50000, "mar") insert into sales values ( 60, 75000, "apr") insert into sales values ( 75, 100000, "may") insert into sales values (110, 135000, "jun") set classlib to locfile("foxcharts.vcx") public oform as form oform = createobject("form") oform.newobject("ochart","foxcharts","foxcharts.vcx") local loChart as Foxcharts of "foxcharts.vcx" loChart = oForm.oChart with loChart .Backcolor = rgb(255,255,255) .BrushType = 2 .ChartsCount = 2 .ChartType = 18 .ColorType = 1 .Depth = 0 .FieldAxis2 = 'legend' .FieldLegend = 'legend' .FontName = 'verdana' .Height = 288 .LegendPosition = 6 .SourceAlias = 'sales' .Width = 732 with .subtitle .caption = 'chart subtitle' endwith with .title .caption = 'testing 2nd y axis' .forecolor = rgb(0,128,255) endwith with .fields(1) .axisindex = 1 .color = rgb(255,0,191) .fieldvalue = 'chart1' .legend = 'gr1' .shape = 5 endwith with .fields(2) .axisindex = 2 .color = rgb(0,142,146) .fieldvalue = 'chart2' .legend = 'gr2' .shape = 2 && 'vfpxicon.png' endwith loChart.DrawChart() loChart.Visible = .t. endwith oForm.Width = loChart.Width oForm.Height = loChart.Height oForm.Show()
Greet, it is possible at higher volume painted values on X axis place down scroll bar for better lucidity? Thank you. I'm sorry its English. Karel.
ReplyDelete