ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Chart::NoValue and AutoScale Y axis
Posted by ian on Oct-27-2018 18:12
Hi,

I am plotting  a 'real-time' line graph with data collected from an instrument. Due to the way the software works, the real-time graph updates quicker than the data aquisition. Due to the way that the instrument works, the aquisition thread has to synchronise with the data flow from the instrument. This means that when the first data point is plotted you get a vertical line from 0 to the value of the first data point. I tried returning Chart::NoValue  from the instrument until a valid data point is available. I have auto-scaling set on the Y axis, but nothing is displayed which I'm assuming that the NoValue is being used in the auto-scale calculations. I am plotting data vs time. I have checked the content of the Y axis and the content does seem valid. Could you please confirm that you would expect the NoValue to be ignored during the autoscale operation of ChartDirector. Many thanks.

  Re: Chart::NoValue and AutoScale Y axis
Posted by Peter Kwan on Oct-30-2018 10:05
Hi ian,

I confirm NoValue is ignored in auto-scaling.

However, NoValue may not be ignore for plotting the chart. It depends on the chart type. If you are plotting a line chart, NoValue will result in a broken line. For example, if the data are { NoValue, 1, 2, NoValue, 9, 8 }, there will be a line segment from 1, 2 and a line segment from 9 to 8. By default, there will be no line joining 2 to 9. If the data are { NoValue, 1, NoValue, 2, NoValue, 3, NoValue }, there will be nothing drawn at all, because the 1, 2, 3 are single points, and you need at least 2 consecutive points to draw a line. You can use LineLayer.setGapColor to cause ChartDirector to join through the NoValue point(s). See:

https://www.advsofteng.com/doc/cdnet.htm#LineLayer.setGapColor.htm

For your case, if no real data are available, you can also try not to append anything to the data array or update the chart at that instance.

Regards
Peter Kwan

  Re: Chart::NoValue and AutoScale Y axis
Posted by ian on Oct-31-2018 22:29
Hi Peter

Many thanks for your response. I may have over complicated my implementation and the simple solution of just not filling the Y plotting array until a valid value is detected would have been a better solution.

I am currently displaying the room temperature and the Y axis is set to auto-range. The Y axis displayed a minimum of around 21 and a maximum value of around 23. By increasing the temperature on the probe the maximum value increased accordingly to accommadate the increase but the minimum temperature showed 0. I would have thought this would have remained around the 21 mark. Is this expected?

  Re: Chart::NoValue and AutoScale Y axis
Posted by Peter Kwan on Nov-01-2018 23:07
Hi Ian,

By default, ChartDirector will start an axis from 0, unless the data range is "very small", and by default, "very small" means the data range is less than 20% of the maximum value. This is configurable in Axis.setAutoScale.

https://www.advsofteng.com/doc/cdcpp.htm#Axis.setAutoScale.htm

If you do not want ChartDirector to prefer to start the axis from 0, you can set the "zeroAffinity" parameter to 0. For example:

c->yAxis()->setAutoScale(0.05, 0.05, 0);

Hope this can help.

Regards
Peter Kwan