View previous topic :: View next topic |
Author |
Message |
markyland
Joined: 06 Jan 2005 Posts: 4
|
Posted: Thu Jan 06, 2005 3:52 pm Post subject: Y2 axis data not updating w/Dplot_AddData |
|
|
Hello,
Bad news about the forum trouble . Last month I posted a question about enabling the second Y axis, to which you suggested code like:
Code: | DPlot_Command glDocNum, "[ManualScale(0,0,.05,1,0,400)][SelectCurve(3)][MultipleYAxes(2,2,0)]" |
Works well, the second Y axis appears on the right side of the DPlotJr window. The trouble is that data for Curve 3 (assigned above) isn't updating in real time with the DplotLib.dll function "DPlot_AddData". Data for Curve 1 updates ok. If I force a redraw of the window using the "ViewRedraw()" command then the Curve is updated to that point, but no new data is displayed. I thought of using the ViewRedraw() command after every data point, but that results in too much flicker.
Here's how I'm creating the DplotJr window (using PowerBASIC):
Code: |
ghDPlot = DPlot_Start(0, DPlotWasActive)
' Get the screen work area, for positioning the DPlot window
SystemParametersInfo %SPI_GETWORKAREA, 0, rcWork, 0
' Move DPlot to lower right corner of screen
GetWindowRect(ghDlg, rc)
cx = 550
cy = 425
SetWindowPos ghDPlot, %HWND_TOPMOST, rcWork.nRight - cx, rcWork.nBottom - cy, cx, cy, %SWP_HIDEWINDOW
' Use MsgBox to report errors
DPlot_SetErrorMethod(2)
' Create a new document
glDocNum = DPlot_Command(0, "[FileNew()]")
' Instruct DPLOT to allocate space for 3 curves, 2 hour's worth of data each
DPlot_Command glDocNum, "[FileArrays(3,7200)]"
' Set a few plot parameters: .03" line width, solid line
DPlot_Command glDocNum, "[LineWidth(1,30)][LineWidth(2,30)][LineWidth(3,30)]"
DPlot_Command glDocNum, "[LineType(1,1)][LineType(2,1)][LineType(3,1)]"
' Curve colors
DPlot_Command glDocNum, "[Color(1,255,0,0)][Color(2,0,0,255)][Color(3,0,255,0)]"
DPlot_Command glDocNum, "[ManualScale(0,0,.05,1,0,400)][AutoSize()]" & _
"[SelectCurve(3)][MultipleYAxes(2,2,0)]" & _
"[NumTicks(1,12,10)]" & "[NumberFormat(0,5)][TimeFormat(" & $DQ & "mm:ss" & $DQ & ")]"
' Set labels, titles, fonts
DPlot_Command glDocNum, "[XAxisLabel(" & $DQ & "Time" & $DQ & ")]" & _
"[YAxisLabel(" & $DQ & "l/min" & $DQ & ")]" & _
"[Y2AxisLabel(" & $DQ & "kPa" & $DQ & ")]" & _
"[FontPoints(1,10)][FontPoints(2,12)][FontPoints(4,12)][FontPoints(6,10)]" & _
"[Caption(" & $DQ & "VFC Tools" & $DQ & ")]"
' Legend config
DPlot_Command glDocNum, "[LegendParams(0.25,3,1,1,.05,.05)]" & _
"[Legend(1," & $DQ & "Curve 1" & $DQ & ")][Legend(2," & $DQ & "Curve 2" & $DQ & ")]" & _
"[Legend(3," & $DQ & "Curve 3" & $DQ & ")]"
' Hide menus & such
DPlot_Command glDocNum, "[MenuUpdates(0)]"
DPlot_Command glDocNum, "[ViewToolBar(0,0)]"
DPlot_Command glDocNum, "[MenuHide()]"
DPlot_Command glDocNum, "[ViewStatusBar(0)]"
' And to add the data for curves 1 and 3:
DPlot_AddData glDocNum, %DATA_XYXY, 1, 1, fTimeData, fYdata
DPlot_AddData glDocNum, %DATA_XYXY, 1, 3, fTimeData, fY2Data
|
Any ideas?
Thanks,
Mark _________________ Mark Newman |
|
Back to top |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2310 Location: Vicksburg, Mississippi
|
Posted: Thu Jan 06, 2005 6:14 pm Post subject: |
|
|
Oops. Your points are being scaled to the first axis, not the second. My guess is they're outside the range 0-1 and so aren't shown. There's nothing you can do about this at your end; I'll have this fixed in the next update. _________________ Visualize Your Data
support@dplot.com |
|
Back to top |
|
|
markyland
Joined: 06 Jan 2005 Posts: 4
|
Posted: Fri Jan 07, 2005 7:35 am Post subject: |
|
|
Thanks for the reply. Just so I'm clear on this, forcing a full plot redraw causes the data to be scaled correctly against the Y2 axis, but the runtime addition of data using Dplot_AddData() doesn't?
I just rescaled my Y-axis from 0-1000 and presto, the Y2 data appears and updates normally. However it is scaled correctly against the *Y2* axis and not the Y axis.
Hmmm, what to do? The issue I'm facing is that both the Y and Y2 axis scaling can vary quite a bit (depending on the units of measure the user selected), with the Y axis scaling often smaller than the Y2 axis.
Would it be possible to get an updated version, by say, um, today? (Don't you just hate it when people ask for immediate changes to free software?!) I'd happily accept a beta version, as my software is also at a beta level, but it's due on Monday! (Gads, why did I commit to that date? ) Anyway, to show I'm no ingrate, I'd happily buy a copy of DPlot in appreciation.
Thanks! _________________ Mark Newman |
|
Back to top |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2310 Location: Vicksburg, Mississippi
|
Posted: Fri Jan 07, 2005 9:04 am Post subject: |
|
|
I didn't state the problem quite correctly and yeah, the values are scaled correctly. The points are simply ignored if they're outside the extents, but the code was checking against the wrong extents. This is fixed. I have a few other issues to work out before uploading a beta version late tonight. I'll let you know when it's available by e-mail. _________________ Visualize Your Data
support@dplot.com |
|
Back to top |
|
|
markyland
Joined: 06 Jan 2005 Posts: 4
|
Posted: Fri Jan 07, 2005 9:45 am Post subject: |
|
|
Good to hear!
Just FYI, I was able to use the ViewRedraw command to redraw the plot by bracketing it with the LockWindowUpdate API call:
Code: | LockWindowUpdate ghDPlot
DPlot_Command glDocNum, "[ViewRedraw()]"
LockWindowUpdate ByVal %NULL |
There's still an occasional "flick" but it's certainly good enough for my beta needs, so don't kill yourself trying to get a beta out tonight.
Thanks! _________________ Mark Newman |
|
Back to top |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2310 Location: Vicksburg, Mississippi
|
|
Back to top |
|
|
markyland
Joined: 06 Jan 2005 Posts: 4
|
Posted: Thu Jan 13, 2005 1:55 pm Post subject: |
|
|
Many thanks! _________________ Mark Newman |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|