Foxcharts - Launch multiple graphs from single form, 1 after another

Jul 1, 2010 at 10:50 PM
Edited Jul 1, 2010 at 10:55 PM

I'm sorry if this is a no brainer, but I'm new to forms. I can create a graph in foxcharts from the init method. I'm obviously doing somehting wrong, and I may need to create a second method, but I would like to create a "Quarter1" and "Quarter2" chart. The demos show how create multiple graphs without forms (creating .pngs) but I'd like to somehow create multiple charts using a form(s).

In other words, what do I need to do in order to create multiple charts with a form , not necessarily on the same page (as in the demo) or in tabs (as in the demo)?  I'd either like to launch one and then launch another after the first is closed, or launch both simultaneously.

SET TALK OFF
SET CONSOLE OFF
SET  STATUS off

* This is in INIT
* Visual Foxpro
CREATE CURSOR sales (Chart1 n(8,2), Legend c(30), Color i, Quarter c(3))

INSERT INTO sales VALUES ( 130,  "JAN", RGB(64,64,255),"1ST")
INSERT INTO sales VALUES (  80,  "FEB", RGB(32,160,64),"1ST")
INSERT INTO sales VALUES ( 100,  "MAR", RGB(255,160,60),"1ST")
INSERT INTO sales VALUES (  60,  "APR", RGB(0,164,128),"2ND")
INSERT INTO sales VALUES ( 155,  "MAY", RGB(64,32,128),"2ND")

SELECT * FROM sales where quarter = "1ST" INTO CURSOR Quarter1
SELECT * FROM sales where quarter = "2ND" INTO CURSOR Quarter2

WITH Thisform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"

					
	.ChartsCount = 1 &&  1st step is to tell the class how many columns with data will be used
	.ChartType = 1 && Type of chart: Doughnut
	.Depth = 15 && the 3D effect - 0 = plain chart
	.SourceAlias = "Sales" && name of our cursor
	.FieldAxis2  = "Legend" && name of the field
	.FieldColor = "Color" && name of the field - used when you choose custom colors
	.FieldLegend = "Legend" && name of the field
	.Fields(1).FieldValue = "Chart1"

	* Setting the captions for the other legends
	.Title.Caption = "Transactions Summary Chart from Quarter1"
	.Subtitle.Caption = "Quarter 1"
	.YAxis.Caption = "Quantities" && used in charts that contain axes, otherwise ignored
	.XAxis.Caption = "Month" && used in charts that contain axes, otherwise ignored

	* The backcolor
	.BackColor = RGB(255,255,255) && White
	
	* Setting the colors
	.ColorType = 2 && 0=basic, 1=custom, 2=Random colors

	.DrawChart() && update the chart with the current settings

	* Setting the captions for the other legends
	.SourceAlias = "Quarter2"
	.Title.Caption = "Transactions Summary Chart from Quarter2"

 	.DrawChart() && update the chart with the current settings
ENDWITH

 

I want to display chart 1, then chart 2. Without creating 2 forms, is this possible within a single form (and within a single method). I undertand I can create some form of tabbed chart display, or display both simultaneously, but what if I just want to display one after another, or both forms simultaneously?