Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automating Graph
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00614775
Message ID:
00615132
Views:
22
Dear Marcia
I read the article here in the FAQ section, about using do (_GENGRAPH) command with some parameters, wich creates the graph cursor with the general field. I then just droped the field in the details band of the report, and it works great. The only thing i cannot find anywhere, is the list of charts types and subtypes. For instance, in your code, you use the following:
IF NOT INLIST( .ChartType, xl3DPie, xlPie, xlPieOfPie, xlPieExploded, xl3DPieExploded, xlBarOfPie )
Where are these constants defined?
Of course, in the current case what i have to do is quite straightforward, and dropping the field into a report did the job, but i will use your way when i'll have to manipulate the graph object.

Thanks for your help
Jaime

>
>I would like to give my users the option to print either data or graph, either to preview or to printer. Is it possible to implement this in a straightforward manner? I was thinking about creating an XLS file with the result cursor for my report in case of a graph output and then try to automate an Excel application object to preview or print the graph.
>
>The following code should be enough to get you started. What I do is have a single "seed" graph in a general field in a cursor. I then use the APPEND GENERAL command with the DATA clause to udate the graph in an OLEBound control on the form. This is the code in my UpdateGraph() method which assumes that the cursor with the graph data is csrResults and the cursor with the general field is csrGraph:
>
>
>LOCAL lcGraphData, lnFld, lnFieldCount
>
>*** Make the oleBoundControl invisible
>*** and unbind it so we can update the general field
>Thisform.LockScreen = .T.
>Thisform.oGraph.ControlSource = ''
>	
>*** Now build the string we need to update the graph
>*** in the general field
>lcGraphData = ""
>	
>SELECT csrResults
>lnFieldCount = FCOUNT()
>	
>*** Build tab-delimited string of field names:
>FOR lnFld = 1 TO lnFieldCount
>  lcGraphData = lcGraphData + FIELD( lnFld ) ;
>     + IIF( lnFld < lnFieldCount, CHR( 9 ), CHR( 13 ) + CHR( 10 ) )
>ENDFOR
>
>*** Concatenate the data, converting numeric fields to character:
>SCAN
>  FOR lnFld = 1 TO lnFieldCount
>    lcGraphData = lcGraphData + TRANSFORM( EVALUATE( FIELD( lnFld ) ) ) + ;
>       + IIF( lnFld < lnFieldCount, CHR( 9 ), CHR( 13 )  + CHR( 10 ) )
>  ENDFOR
>ENDSCAN
>
>GO TOP IN csrResults
>
>*** OK, ready to update the graph
>SELECT csrGraph
>APPEND GENERAL oleGraph CLASS "MsGraph.Chart" DATA lcGraphData
>
>WITH Thisform.oGraph
>  *** Reset the controlSource of the OleBound control
>  .ControlSource = "csrGRaph.oleGraph"
>
>  *** Set the chart type
>  .object.ChartType = Thisform.cboGraphType.Value
>
>  *** Set the data to graph the columns as the series
>  *** Unless, of course, this is a pie chart
>  IF NOT INLIST( .ChartType, xl3DPie, xlPie, xlPieOfPie, xlPieExploded, xl3DPieExploded, xlBarOfPie )
>    .Object.Application.PlotBy = xlColumns
>  ELSE
>    .Object.Application.PlotBy = xlRows
>  ENDIF
>ENDWITH
>
>Thisform.LockScreen = .F.
>
>
>The MsGraph object model is just a cut-down version of Excel's graphing engine. So the easiest thing to do if use VbaGrp9.chm to find the PEMs you are interested in and then look them up in the Excel documentation.
Why do programs stop working correctly as soon as you leave the Fox?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform