How to Refresh SharpPlot with new Data ?
3 posts
• Page 1 of 1
How to Refresh SharpPlot with new Data ?
If I do the following:
I get a plot as expected. Now I would like to 'Refresh' this plot with some new data like:
But the plot stays the same. What is the method to change the X and Y values of a plot in an existing opened window ?
Thanks in advance.
⎕USING∪←',sharpplot.dll' ',system.drawing.dll'
sp1←⎕NEW Causeway.SharpPlot
sp1.DrawLineGraph(,⊂⍳10)(⍳10)
vw1←⎕NEW Causeway.SharpPlotViewer sp1
vw1.Show ⍬
I get a plot as expected. Now I would like to 'Refresh' this plot with some new data like:
sp1.DrawLineGraph(,⊂⍳20)(⍳20) ⍝ I want to redraw the plot with that new X and Y
vw1.Refresh ⍝ Does not work
vw1.Update ⍝ Does not work
But the plot stays the same. What is the method to change the X and Y values of a plot in an existing opened window ?
Thanks in advance.
-
PGilbert - Posts: 436
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
Re: How to Refresh SharpPlot with new Data ?
SharpPlot is a state machine. So if you call DrawLineGraph for a second time, it will draw a second chart on top of the first.
The philosophy behind this is the ability to create arbitrarily complex charts. The behaviour that you were expecting would mean that SharpPlot can only draw a single chart.
If you ever want to "undo" something, you have to start it all over again.
Similarly, to update the viewer, you need to reassign the SharpPlot instance
The philosophy behind this is the ability to create arbitrarily complex charts. The behaviour that you were expecting would mean that SharpPlot can only draw a single chart.
If you ever want to "undo" something, you have to start it all over again.
Similarly, to update the viewer, you need to reassign the SharpPlot instance
⎕USING∪←',sharpplot.dll' ',system.drawing.dll'
sp1←⎕NEW Causeway.SharpPlot
sp1.DrawLineGraph(,⊂⍳10)(⍳10)
vw1←⎕NEW Causeway.SharpPlotViewer sp1
vw1.Show ⍬
sp1.DrawLineGraph(,⊂0.5×⍳10)(⍳10) ⍝ draw a second line graph
vw1.SharpPlot←sp1 ⍝ update viewer
sp2←⎕NEW Causeway.SharpPlot ⍝ create a new SharpPlot instance
sp2.DrawLineGraph(,⊂0.5×⍳10)(⍳10)
vw1.SharpPlot←sp2
- Nicolas|Dyalog
- Posts: 17
- Joined: Wed Sep 10, 2008 9:39 am
Re: How to Refresh SharpPlot with new Data ?
Merci Nicolas, cela réponds bien à ma question.
-
PGilbert - Posts: 436
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group