Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Graph help please
Message
 
To
07/04/2000 20:54:54
Glen Rostant
Cloud 9 Solutions, Inc.
Miami, Florida, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00357145
Message ID:
00357165
Views:
17
I am very happy with using the abilities inside VFP. Following is an example.

You will need a general field in the table and then you will store the graph in this general field, sort of like a memo is stored. Here is an example.

lcGeneralString = "" + Chr(9) + "18 to 24" + Chr(9) + "25 to 34" + Chr(9) + "35 to 44" + Chr(9) + "45 to 54" + Chr(9) + "55 to 64" + Chr(9) + "65 and over" + Chr(9) + "Unknown" + Chr(13) + Chr(10) + ;
"Age Range" + Chr(9) + AllTrim(Str(This.iAgeRange1)) + Chr(9) + AllTrim(Str(This.iAgeRange2)) + Chr(9) + AllTrim(Str(This.iAgeRange3)) + Chr(9) + AllTrim(Str(This.iAgeRange4)) + Chr(9) + AllTrim(Str(This.iAgeRange5)) + Chr(9) + AllTrim(Str(This.iAgeRange6)) + Chr(9) + AllTrim(Str(This.iTotalVoter - This.iAgeRange1 - This.iAgeRange2 - This.iAgeRange3 - This.iAgeRange4 - This.iAgeRange5 - This.iAgeRange6)) + Chr(13) + Chr(10)

Append General curGraphs.Age Class "MSGraph.Chart" Data lcGeneralString

Once you have this you can either double-click on the field and edit it to what you want or you can programatically format it as an olebound object on a form (hidden).

Setting the look you want is not difficult, but finding the values is. Here is a piece of the code I used to do a age pie chart.

With ThisForm.oleAgeGraph
.ControlSource = "curGraphs.Age"
.Type = 5
.ChartArea.Font.Name = "Arial"
.ChartArea.Font.Size = 8
.ChartArea.Font.Bold = .F.
.HasLegend = .T.
.Legend.Position = -4107
.Legend.Interior.ColorIndex = -4142
.Legend.Border.LineStyle = -4142
.SeriesCollection(1).Points(1).HasDataLabel = .T.
.SeriesCollection(1).Points(1).DataLabel.Type = 4
.SeriesCollection(1).Points(2).HasDataLabel = .T.
.SeriesCollection(1).Points(2).DataLabel.Type = 4
.SeriesCollection(1).Points(3).HasDataLabel = .T.
.SeriesCollection(1).Points(3).DataLabel.Type = 4
.SeriesCollection(1).Points(4).HasDataLabel = .T.
.SeriesCollection(1).Points(4).DataLabel.Type = 4
.SeriesCollection(1).Points(5).HasDataLabel = .T.
.SeriesCollection(1).Points(5).DataLabel.Type = 4
.SeriesCollection(1).Points(6).HasDataLabel = .T.
.SeriesCollection(1).Points(6).DataLabel.Type = 4
.SeriesCollection(1).Points(7).HasDataLabel = .T.
.SeriesCollection(1).Points(7).DataLabel.Type = 4
EndWith

A nice trick someone showed to me the other day is to start recording a macro in excel and format a graph the way you want there. Stop recording and edit the macro to get the needed values.

Sorry for the bad formatting but not much time today.

Good Luck
Previous
Reply
Map
View

Click here to load this message in the networking platform