Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamically Updating a Graph
Message
De
11/09/2002 07:04:07
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
10/09/2002 11:01:21
Angela Haws
Seminole County Tax Collector
Debary, Floride, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00698813
Message ID:
00699247
Vues:
17
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform