Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamically Updating a Graph
Message
From
11/09/2002 07:04:07
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
10/09/2002 11:01:21
Angela Haws
Seminole County Tax Collector
Debary, Florida, United States
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00698813
Message ID:
00699247
Views:
16
>Hi everyone. I have a table that changes according to criteria selected. (It gets zapped each time). I want to be able to show the data in a graph when the user presses a button captioned "Show Updated Graph".
>
>The graph is actually on another form.
>How would dynamically change the data set for the graph? Or I should say, how do I refresh the graph? Also, where do I do this...in the init of the form, the interactive change event, etc?
>
>Please if anyone has any suggestions, all is appreciated.
>
>Thanks
>Angie

Angela,
Depends on what you're using for graphing. If that's MSGraph then what you change is MSGraph object's DataSheet. ie:
with thisform.myGraph.object.application.datasheet
  .Cells.Clear
  FOR ix=1 TO fcount() && Headers
    .Cells(1,ix).Value = field(ix)
  ENDFOR
  scan
    FOR ix=1 TO fcount() && Data
      .Cells(recno(),ix).Value = evaluate(field(ix))
    ENDFOR
  endscan
endwith
However setting cell values this way is slow (OTOH MSGraph itself is slow too). Alternately you might add-remove an OleBoundControl object each time you need to change data. That way you could copy to a tab delimited file, append header at top, filetostr() and do something like :

create cursor tempgen (grph g)
append blank
append general grph class "msgraph.chart" ;
data FileToStr('myTabProcessed.txt')

oForm.addobject("myGraph","OleBoundControl")
oForm.myGraph.controlsource = 'tempgen.grph'

If what you're using is MSChart2.0 activex (I suggest for its speed), then what you change its properties like columncount, rowcount, data, datagrid.
For a sample on this check Message #570338

For creating-modifying data of graph I think ideal place is the button click itself.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform