03-20-2018 03:46 PM
Hello, everyone, I have a piece of code in my while loop which handles the plot and writes to file. Can anyone tell what's the function of this code? Does it means every loop execution, it re-scale my waveform chart to have a one-hour interval for X-axis? Thank you.
03-20-2018 04:07 PM - edited 03-20-2018 04:08 PM
We cannot see what is in the other case, but the scale is only set if the case is TRUE. That happens if the current scalefit property is zero (i.e. do not autoscale) AND it was >0 (i.e. autoscale once or always) at the immediately previous iteration, OR if this is the first iteration (i=0). In all other cases, the FALSE case executes and all bets are off what's in it. 😄
03-20-2018 04:15 PM
Thanks for the reply, it's empty in the false case. So, force the scale at 0-3600 at first iteration, does it necessary for the chart if in the chart properties I already uncheck autoscale and set the scale 0-3600? Thank you.
03-20-2018 04:26 PM
You never said that this is a chart.
If this is a chart, it might be easier to set the history length to 1 hour worth of data and set t0 at program start. Now everything will be mostly automatic. It is difficult to give more specific advice from a truncated code picture. Is the user allowed to zoom the x-axis at run time?
03-20-2018 05:14 PM
Sorry I forgot to mention that. It's a waveform chart, X-scale is absolute time, I need one-hour window but large chart history buffer in order to view historical data with x scroller bar. No zoom x-axis at runtime. Thank you.
03-20-2018 05:15 PM
03-20-2018 05:27 PM
The update rate is 1Hz, I set a 12-hour buffer which 43,200, can be reduced if it dramatically slows down the program.