| 28 | |
| 29 | using namespace scopy; |
| 30 | PlotAxis::PlotAxis(int position, PlotWidget *p, QPen pen, QObject *parent) |
| 31 | : QObject(parent) |
| 32 | , m_plotWidget(p) |
| 33 | , m_plot(p->plot()) |
| 34 | , m_position(position) |
| 35 | , m_axisId(QwtAxisId(position)) |
| 36 | , m_units("") |
| 37 | { |
| 38 | m_min = -1; |
| 39 | m_max = 1; |
| 40 | m_divs = (isHorizontal()) ? 11.0 : 11.0; |
| 41 | |
| 42 | m_id = m_plotWidget->plotAxis(m_position).count(); |
| 43 | m_axisId = QwtAxisId(m_position, m_id); |
| 44 | m_plot->setAxesCount(position, m_id + 1); |
| 45 | |
| 46 | updateAxisScale(); |
| 47 | |
| 48 | m_formatter = new MetricPrefixFormatter(); |
| 49 | m_formatter->setTrimZeroes(true); |
| 50 | m_formatter->setTwoDecimalMode(false); |
| 51 | m_scaleDraw = new BasicScaleDraw(m_formatter, m_units); |
| 52 | |
| 53 | m_scaleDraw->setColor(pen.color()); |
| 54 | m_plot->setAxisScaleDraw(m_axisId, m_scaleDraw); |
| 55 | |
| 56 | m_scaleEngine = new OscScaleEngine(); |
| 57 | m_scaleEngine->setMajorTicksCount(m_divs); |
| 58 | m_plot->setAxisScaleEngine(m_axisId, (QwtScaleEngine *)m_scaleEngine); |
| 59 | |
| 60 | m_plotWidget->addPlotAxis(this); |
| 61 | |
| 62 | setupAxisScale(); |
| 63 | setVisible(false); |
| 64 | |
| 65 | connect(this, &PlotAxis::minChanged, this, &PlotAxis::updateAxisScale); |
| 66 | connect(this, &PlotAxis::maxChanged, this, &PlotAxis::updateAxisScale); |
| 67 | setUnitsVisible(false); |
| 68 | } |
| 69 | |
| 70 | PlotAxis::~PlotAxis() {} |
| 71 |
nothing calls this directly
no test coverage detected