I need to update a plot periodically using FreeBasic and DPLOT JR. I am using the example FreeBasic code to make the x-y plot. Each time I make the call it creates a new plot, rather than updating the old plot. I have spent some time with the documentation; the closest I can get is erasing the old data then replotting. That gives me two additional plots; one blank, and one with the new data.
How do I get rid of the first plot, or simply modify that one, rather than creating a whole new plot each time I make the system call?
How to update an existing plot?
- DPlotAdmin
- Posts: 2312
- Joined: Tue Jun 24, 2003 9:34 pm
- Location: Vicksburg, Mississippi
- Contact:
David,
DPlot_Command(docnum,"[SelectCurve(1)][EditErase()]")
DPlot_Command(docnum,"[XYXY(...)]") ' or whatever you're doing to send the data
or this:
DPlot_Command(docnum,"[EditEraseData(1)]")
DPlot_Command(docnum,"[XYXY(...)]")
should do what you want. If not, please copy the relevant part of your code and send it to me - or paste it here if you like.
This should not be, if you erased the curve before plotting your new data. Either this:I have spent some time with the documentation; the closest I can get is erasing the old data then replotting. That gives me two additional plots; one blank, and one with the new data.
DPlot_Command(docnum,"[SelectCurve(1)][EditErase()]")
DPlot_Command(docnum,"[XYXY(...)]") ' or whatever you're doing to send the data
or this:
DPlot_Command(docnum,"[EditEraseData(1)]")
DPlot_Command(docnum,"[XYXY(...)]")
should do what you want. If not, please copy the relevant part of your code and send it to me - or paste it here if you like.
Visualize Your Data
support@dplot.com
support@dplot.com
-
- Posts: 3
- Joined: Tue Sep 30, 2008 2:51 pm
Success
Thanks for the help. I am now able to generate a plot and update the data at will. One other bump I had to overcome was selection of the plot to be updated. If the Select and Update commands were issued separately all data went to the first curve. If the commands were concatentated in the same command the data went to the intended curve. In short, curve selection did not appear to be "sticky". This was not a big problem, and it had the side benefit of making me more familiar with the command set.
- DPlotAdmin
- Posts: 2312
- Joined: Tue Jun 24, 2003 9:34 pm
- Location: Vicksburg, Mississippi
- Contact:
David,
That's spelled out in the documentation but I probably need to make it more clear somehow . Each call to DPlot_Command (or any other DPLOTLIB function) results in a new DDE transaction. For each new transaction, DPlot initializes several variables, including but not limited to the currently-selected curve. So this:
DPlot_Command(docnum,"[SelectCurve(3)][EditErase()]")
will delete the third curve, but this:
DPlotCommand(docnum,"[SelectCurve(3)]")
DPlotCommand(docnum,"[EditErase()]")
will delete the first (default) curve.
In any case, glad you got things working. Let me know if you have any other problems.
That's spelled out in the documentation but I probably need to make it more clear somehow . Each call to DPlot_Command (or any other DPLOTLIB function) results in a new DDE transaction. For each new transaction, DPlot initializes several variables, including but not limited to the currently-selected curve. So this:
DPlot_Command(docnum,"[SelectCurve(3)][EditErase()]")
will delete the third curve, but this:
DPlotCommand(docnum,"[SelectCurve(3)]")
DPlotCommand(docnum,"[EditErase()]")
will delete the first (default) curve.
In any case, glad you got things working. Let me know if you have any other problems.
Visualize Your Data
support@dplot.com
support@dplot.com