salsergey / QCustomPlot-PyQt

Bindings for graphics lib QCustomPlot for PyQt5 and PyQt6
MIT License
9 stars 1 forks source link

AttributeError: 'QCPAxis' object has no attribute 'setAutoTickStep' #5

Closed Yecgaa1 closed 1 year ago

Yecgaa1 commented 1 year ago
  File "D:/test.py", line 58, in __init__
    self.Plot.xAxis.setAutoTickStep(False)
AttributeError: 'QCPAxis' object has no attribute 'setAutoTickStep'

Regarding xAxis, only these two runs of code are wrong (i.e. the xAxis object is indeed available)

        self.Plot.xAxis.setAutoTickStep(False)
        self.Plot.xAxis.setTickStep(86400)

Here is the contextual code

        graph0 = self.Plot.addGraph()
        graph0.setPen(QPen(Qt.blue))
        graph0.setBrush(QBrush(QColor(0, 0, 255, 20)))
        self.Plot.xAxis.setRange(beginS, beginS + 1440 * 60 * 9)
        self.Plot.xAxis.setTickLabelRotation(40)
        self.Plot.xAxis.setAutoTickStep(False)
        self.Plot.xAxis.setTickStep(86400)
        self.Plot.yAxis.setRange(0, 1200)
        graph0.setData(x, y)

I would be grateful if you could tell me how to fix it

salsergey commented 1 year ago

Are you sure that there should be a method called setAutoTickStep? There is no such method in the documentation. The method setTickStep is available in QCPAxisTickerFixed class.

Yecgaa1 commented 1 year ago

Oh you are right, maybe I looked up the old version of the write up