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

Storing a graph to a General field

Status
Not open for further replies.

SuperGrover

Programmer
Oct 29, 2002
5
US
I am learning to create reuseable graphs, following an article (
The following steps are listed. I have done steps 1-3, but can't figure out how to do 4.

1. Create your graph template table: CREATE TABLE GRPHTMPL (NAME C(20), TEMPLATE G)
2. Open the table to be graphed, or create the cursor to be graphed
3. Invoke the graph wizard with "DO (_GENGRAPH)"
4. After going through the steps, save your graph in the grphtmpl table. It'll automatically be in a newly appended record.
5. Browse the grphtmpl table. Add a name to the new graph.
6. Open the graph's general field, then double-click on the graph to edit it in MS Graph. Pretty it up, then close it to save your changes.

Thanks
 
SuperGrover

Take a look at APPEND GENERAL :

APPEND general TEMPLATE class "msgraph.chart" DATA m.cGData

Or something like that for your particular situation.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
When I "Do (_gengraph)" I follow the steps. When I click on "Finish" I am presented with a form in design mode with the graph on the form. I can run the form and see the graph in a window. Where does m.cGData come from?

Thanks, Martin
 
SuperGrover

I may be misunderstanding what you are trying to do, or what you are using. Here is part of the code I use to generate a graph using msGraph, but I don't use "Do (_gengraph)". All I end up with is a graph on a form based on m.cGData:
Code:
CASE THISFORMSET.QUARTER = 5
		m.Title1 = lnYear+" Invoices Full Year"
		cGData = ""+TAB+JANUARY_LOC +TAB+FEBRUARY_LOC +TAB+MARCH_LOC+TAB+APRIL_LOC+TAB+MAY_LOC+TAB+JUNE_LOC+TAB+JULY_LOC+TAB+AUGUST_LOC+TAB+SEPTEMBER_LOC+TAB+OCTOBER_LOC+TAB+NOVEMBER_LOC+TAB+DECEMBER_LOC +CRLF+;
			lnYear+TAB+allt(str(SUB3,12,2))+TAB+allt(str(SUB6,12,2))+TAB+allt(str(SUB9,12,2))+TAB+allt(str(SUB12,12,2))+TAB+allt(str(SUB15,12,2))+TAB+allt(str(SUB18,12,2))+TAB+allt(str(SUB21,12,2))+TAB+allt(str(SUB24,12,2));
			+TAB+allt(str(SUB27,12,2))+TAB+allt(str(SUB30,12,2))+TAB+allt(str(SUB33,12,2))+TAB+allt(str(SUB36,12,2))
ENDCASE
thisformset.FORM1.LockScreen = .T.
APPEND general gen1 class "msgraph.chart" DATA m.cGData
thisformset.FORM1.OleBoundControl1.ControlSource = "Gen1"
thisformset.FORM1.OleBoundControl1.HasLegend = .F.
IF THISFORMSET.QUARTER = 5
	thisformset.FORM1.OleBoundControl1.autoformat(bartype,1)
ELSE
	thisformset.FORM1.OleBoundControl1.autoformat(bartype1,1)
ENDIF
THISFORMSET.REFRESH()
thisformset.FORM1.LockScreen = .F.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
"All I end up with is a graph on a form." Yes, that's exactly my problem. The article implies that the graph generated by the Graph Wizard is he starting point for my graph, but you seem to be saying this won't work and I have to generate the graph using code. Do you know a good source for learning this? I want to include graphs in a report.

I opened the table generated by the Graph Wizard (use graph.scx) hoping I could find the code. It's there in the OLE field for the olechart control, but not in ASCII form, so it's all gibberish.

Thanks for you help, Martin
 
It's there in the OLE field for the olechart control

Yes.Miscrosoft Graph chart. And that is where the reference to it in my code:
thisformset.FORM1.OleBoundControl1.ControlSource = "Gen1"

Do you know a good source for learning this?
Yes. There is an example in the "Solutions" that came with VFP6.0. Under Activex->Automation->Refresh a graph in a form. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top