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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Foxcharts graphic form will not appear

Status
Not open for further replies.

taterday

Programmer
Jan 28, 2009
183
US
I can run the form outside the project and the pie graph will appear.
Looks fine. I have added the classes that are in the sample project to my project.
I have a messagebox in the init and it displays. I get an hour glass then nothing happens when I
do form pctsum except the messagebox() display.
I have the form attributes set to modal and always on top.

I created a table with one record for each slice of the pie.

Here is my code in the init.
MESSAGEBOX('HERE IN INIT',0) && i see this.

SELECT * FROM pctsum INTO CURSOR pctsum1

SELECT PCTSUM1 && with a brow here. I have data.

WITH this.foxcharts1 as FoxCharts of "FoxCharts.vcx"
.sourceAlias = "Pctsum1"
.chartscount=1
.charttype= 1 && pie chart
WITH .fields(1)
.fieldvalue = "Col1"
ENDWITH

.DrawChart()
ENDWITH
select sales

Please help.
 
Does this look like it would work? I still don't get anything. No error, no feedback at all.

I put the data in excel. You are right it would have to be in row. I redesigned by database to produce one row.

WITH THISform.FOXCHARTS1 AS FOXCHARTS OF "FoxCharts.vcx"
.SOURCEALIAS = "Pctsum1"
.CHARTSCOUNT = 12
.CHARTTYPE = 1 && pie chart
WITH .FIELDS(1)
.FIELDVALUE = "Jan"
ENDWITH
WITH .FIELDS(2)
.FIELDVALUE = 'Feb'
ENDWITH
WITH .FIELDS(3)
.FIELDVALUE = 'Mar'
ENDWITH
WITH .FIELDS(4)
.FIELDVALUE = 'Apr'
ENDWITH
WITH .FIELDS(5)
.FIELDVALUE = 'May'
ENDWITH
WITH .FIELDS(6)
.FIELDVALUE = 'Jun'
ENDWITH
WITH .FIELDS(7)
.FIELDVALUE = 'Jul'
ENDWITH
WITH .FIELDS(8)
.FIELDVALUE = 'Aug'
ENDWITH
WITH .FIELDS(9)
.FIELDVALUE = 'Sep'
ENDWITH
WITH .FIELDS(10)
.FIELDVALUE = 'Oct'
ENDWITH
WITH .FIELDS(11)
.FIELDVALUE = 'Nov'
ENDWITH
WITH .FIELDS(12)
.FIELDVALUE = 'Dec'
ENDWITH

.DRAWCHART()
ENDWITH
 
I can't say off-hand whether or not it will work, but all those WITH / ENDWITH constructs look awfully clumsy.

Rather than this:

Code:
WITH .FIELDS(1)
.FIELDVALUE = "Jan"
ENDWITH

It's much simpler to do this:

Code:
.FIELDS(1).FIELDVALUE = "Jan"

and so on until December.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
The way I have the with/endwith is the way the training video that was with the software.
Five minute introductory video for FoxCharts.wmv

another hint, please. I will try IT!
 
Well WITH can help abbreviate, but in this case for one line each you better not use it, instead do:

.FIELDS(1).FIELDVALUE = "Jan"
.FIELDS(2).FIELDVALUE = "Feb"
...

12 lines instead of 36. Isn't that much better?

Bye, Olaf.
 
Much better code there. Does anyone have any suggestion to make it run better, less confusing, etc? I will use each suggestion when I do line charts.

My problem was that the windowstate attribute was not set. I needed to change it from 0 and when I did I got the results I wanted. I haven't figured how to print or save but I working on it.

My database has individual records for each month and here is the code.

WITH this.foxcharts1 as FoxCharts of "FoxCharts.vcx"
.sourceAlias = "Pctsum1"
.chartscount=1
.charttype= 1 && pie chart
WITH .fields(1)
.fieldvalue = "Col1"
ENDWITH
.fieldlegend="Row1"
.showvaluesonshape=.t.

.DrawChart()

ENDWITH
I will be attempting to get this to print later but it is displaying now. One step at a time.

I knew it could be done because you guys did. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top