@@ -96,6 +96,8 public: | |||
|
96 | 96 | void move(double dx, double dy, bool forward = true); |
|
97 | 97 | void transform(const DateTimeRangeTransformation& tranformation, bool forward = true); |
|
98 | 98 | |
|
99 | void toggle_y_log_scale(); | |
|
100 | ||
|
99 | 101 | // IVisualizationWidget interface |
|
100 | 102 | void accept(IVisualizationWidgetVisitor* visitor) override; |
|
101 | 103 | bool canDrop(Variable2& variable) const override; |
@@ -417,6 +417,21 struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate | |||
|
417 | 417 | setRange(axis->range()); |
|
418 | 418 | m_plot->replot(QCustomPlot::rpQueuedReplot); |
|
419 | 419 | } |
|
420 | void toggle_y_log_scale() | |
|
421 | { | |
|
422 | if(m_plot->yAxis->scaleType()==QCPAxis::stLinear) | |
|
423 | { | |
|
424 | m_plot->yAxis->setScaleType(QCPAxis::stLogarithmic); | |
|
425 | QSharedPointer<QCPAxisTickerLog> logTicker(new QCPAxisTickerLog); | |
|
426 | m_plot->yAxis->setTicker(logTicker); | |
|
427 | } | |
|
428 | else | |
|
429 | { | |
|
430 | m_plot->yAxis->setScaleType(QCPAxis::stLinear); | |
|
431 | QSharedPointer<QCPAxisTicker> ticker(new QCPAxisTicker); | |
|
432 | m_plot->yAxis->setTicker(ticker); | |
|
433 | } | |
|
434 | } | |
|
420 | 435 | }; |
|
421 | 436 | |
|
422 | 437 | VisualizationGraphWidget::VisualizationGraphWidget(const QString& name, QWidget* parent) |
@@ -679,6 +694,11 void VisualizationGraphWidget::transform( | |||
|
679 | 694 | emit this->setrange_sig(this->graphRange(), true, false); |
|
680 | 695 | } |
|
681 | 696 | |
|
697 | void VisualizationGraphWidget::toggle_y_log_scale() | |
|
698 | { | |
|
699 | impl->toggle_y_log_scale(); | |
|
700 | } | |
|
701 | ||
|
682 | 702 | void VisualizationGraphWidget::accept(IVisualizationWidgetVisitor* visitor) |
|
683 | 703 | { |
|
684 | 704 | if (visitor) |
@@ -1140,6 +1160,9 void VisualizationGraphWidget::keyPressEvent(QKeyEvent* event) | |||
|
1140 | 1160 | zoom(2, this->height() / 2, Qt::Vertical); |
|
1141 | 1161 | } |
|
1142 | 1162 | break; |
|
1163 | case Qt::Key_L: | |
|
1164 | toggle_y_log_scale(); | |
|
1165 | break; | |
|
1143 | 1166 | default: |
|
1144 | 1167 | QWidget::keyPressEvent(event); |
|
1145 | 1168 | break; |
General Comments 0
You need to be logged in to leave comments.
Login now