Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

foxcharts chartssample_dynamic form

Status
Not open for further replies.

Luikj

Technical User
Jul 23, 2019
5
US
Hi Experts; Learning foxcharts/gdiplusx. . .starting on samples. . .
Question regardng the following= "chartssample_dynamic". the following is the int
of that form in "help". It runs fine and displays a "blank" canvas.
I am missing something fundamental I believe.
*************************************************************************************
Thisform.Newobject("MyChart", "FoxCharts", LOCFILE("FoxCharts.vcx"))
loChart = ThisForm.MyChart
With loChart as FoxCharts of FoxCharts.vcx
.Move(0, 0, Thisform.Width, ThisForm.Height)
.Anchor = 15 && Resize width and Height
.SubTitle.CAPTION = ''
.BrushType = 2 && gradient brush
.ColorType = 2 && Random colors
.Depth = 30
.Legend1 = "Legend #1"
.ChartsCount = 2
.ShowSideLegend = .T.
* Execute the SQL for the chart.
OPEN DATABASE HOME(1) + 'Samples\Northwind\Northwind'
SELECT Categories.CategoryName, ;
SUM(OrderDetails.UnitPrice * OrderDetails.Quantity) AS Sales, ;
(SUM(OrderDetails.UnitPrice * OrderDetails.Quantity) / 2) AS Sales2 ;
FROM Products ;
JOIN Categories ON Products.CategoryID = Categories.CategoryID ;
JOIN OrderDetails ON Products.ProductID = OrderDetails.ProductID ;
GROUP BY 1 ;
INTO CURSOR ChartData
* Specify the data source for the chart.
.SourceAlias = 'ChartData'
.FieldAxis2 = 'CategoryName'
.FIELDS(1).FieldValue = "Sales"
.FIELDS(1).Legend = "Sales"
.FIELDS(2).FieldValue = "Sales2"
.FIELDS(2).Legend = "Half Sales"
.FieldLegend = .FieldAxis2
* Specify the chart type and chart and axis captions.
.TITLE.CAPTION = 'Sales by Product Category'
.XAxis.CAPTION = 'Product Category'
.YAxis.CAPTION = 'Total Sales'
.AxisLegend2.ROTATION = -45
.AxisLegend2.ALIGNMENT = 1 && Right
.ScaleLegend.FORMAT = '@$ 9,999,999.99'
.ChartType = 7 && Bar
.Visible = .T.
.DrawChart()
ENDWITH
***************************************************************************
browse && browse works good displaying the join.
. . .but the ".DrawChart()" opens the form and displays only the canvas.
Can you give me some direction on what I am missing? Lu
(. . .I am spoiled by Mike Lewis' simplechart from years back!!)
***************************************************************************
 
Luikj,

Check that you have all VFP updates installed. The sample is working fine as you uploaded it.
 
Hi,
You are not missing anything in this coding, it is coding as in the sample. What you are missing is the instantiation of loCharts in my opinion. Please run the project first.

1. Open the Foxcharts.pjx
2. Activate the demostart.prg
3. Now either use the Foxcharts Sample form:
1. Select a form sample from the grid, hightlight
2. Press the button Run
Or
Press the button Modify

Koen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top