Qt World Summit: Submit your Presentation

labels dissapear after calling setRange on the axis

  • My application has several QChartView graphs with realtime data flowing in. The range of the numbers in the input data can change why a lot so I want to change the range on the Y axis so that the curves fit nicely in the window. For example, sometimes the values are very small (between -0.5 and 0.5) and when the data source is active, they can be between -2000 and 2000.

    I can reset the range by calling setRange on the AxisY attached to the QChart. However, after I do this, I the graphs no longer fit inside the visual area of the QChartView. It looks bad, but the labels are right. I have found that I can solve that problem by calling createDefaultAxes() on the QChartView object after I do the setRange on the axis. That makes my curves fit perfectly in their windows and everything looks great except that now the labels are all replaced with ellipses (...). I don't want that. I want to actually see the numbers.

    Help! how do I dynamically change the ranges of my axes, keeps my graphs constrained to their windows, and still get to actually read the range? What am I doing wrong?

    Thanks very much for you help,
    Mitra Kelly

Log in to reply