Qt World Summit: Register Today!

QChart Yaxis quits adjusting with small numbers

  • I use a QChart to render analog data and I have implemented
    axisY->setRange(_YAxisMinValue, _YAxisMaxValue);
    to adjust the vertical Y axis.
    Everything seems to work until the analog values get really small. Somewhere below values of e-12 the axis no longer changes. I have test data that I need to be able to render where the values for min and max really are 3.471e-14 & 5.45e-14. But since the Y Axis doesn't respond, I can't see any lines on the chart.
    After setting the chart values, I can even use gets for min and max
    axisY->min() ;
    And the values match what I've set them to but the chart axis doesn't respond.
    For other data that is > e-14, ie; 3.471e-12 & 5.45e-12, the chart axis adjusts as desired.

    Any suggestions would be much appreciated.

  • @mmikeinsantarosa said in QChart Yaxis quits adjusting with small numbers:

    Any suggestions would be much appreciated.

    I don't use QCharts and you may get a much better suggestion from someone else. But if you don't....

    These are very small numbers. If, for whatever reason (e.g. limits of float/double number precision at this level??), there is a problem and these values are not going to show, multiply your values and consequently the axis values) up by some order of magnitude to avoid the problem? You can presumably still specify any axis markers via labels to show the real values being plotted? I assume when you're showing such small values which should be distinguishable, you are not at the same time showing very large values....

    You asked for a suggestion, and that's what comes to my mind if faced with your situation....

  • Thanks JonB for the comment. I though of multiplying the values up to something that would get the chart to start changing again but the added complexity to pull this off is something I was trying to avoid.

    I think it's a defect in the QChart object. How do I communicate with the of this code?

  • As a workaround, it seems you can setRange(0,1) then add the axis to the chart, then call setRange(realMin,realMax) and the chart is drawn properly.

Log in to reply