Important: Please read the Qt Code of Conduct -

Unable to remove axes from QChart

  • Hi,

    We have been using QTCharts for plotting purposes, our scenario is that we are plotting the data on user's input so whenever user says plot, we use the current window to re-plot the data (which can be different than previous plotted data).

    We are using QChart::createDefaultAxes() to create the axes for the chart & whenever we have to re-plot, we are removing the earlier axes by calling removeAxis on each of the QAbstractAxis associated with the instance of QChart but apparently removeAxis is not actually removing the axis from the QChart because we can see the new Axis being drawn on top of the older one.

    We have also tried calling QAbstractSeries::detachAxis using each & every Series that we are appending in the chart but even that doesn't do the trick. For now we are disabling the older axis by calling QAbstractAxis::setVisible(false) but this is a temporary solution, removing the axis altogether is what is desirable in this case.

    Any help in this matter is appreciated.