Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#879 Inverted option for STEPS style #880

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions plotjuggler_app/plotwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,10 @@ QDomElement PlotWidget::xmlSaveState(QDomDocument& doc) const
{
plot_el.setAttribute("style", "Steps");
}
else if (curveStyle() == PlotWidgetBase::STEPSINV)
{
plot_el.setAttribute("style", "StepsInv");
}

for (auto& it : curveList())
{
Expand Down Expand Up @@ -877,6 +881,10 @@ bool PlotWidget::xmlLoadState(QDomElement& plot_widget, bool autozoom)
{
changeCurvesStyle(PlotWidgetBase::STEPS);
}
else if (style == "StepsInv")
{
changeCurvesStyle(PlotWidgetBase::STEPSINV);
}
}

QString bg_data = plot_widget.attribute("background_data");
Expand Down
12 changes: 12 additions & 0 deletions plotjuggler_app/plotwidget_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ PlotwidgetEditor::PlotwidgetEditor(PlotWidget* plotwidget, QWidget* parent)
{
ui->radioSteps->setChecked(true);
}
else if (_plotwidget->curveStyle() == PlotWidgetBase::STEPSINV)
{
ui->radioSteps->setChecked(true);
}
else
{
ui->radioBoth->setChecked(true);
Expand Down Expand Up @@ -320,6 +324,14 @@ void PlotwidgetEditor::on_radioSteps_toggled(bool checked)
}
}

void PlotwidgetEditor::on_radioStepsInv_toggled(bool checked)
{
if (checked)
{
_plotwidget->changeCurvesStyle(PlotWidgetBase::STEPSINV);
}
}

void PlotwidgetEditor::on_checkBoxMax_toggled(bool checked)
{
ui->lineLimitMax->setEnabled(checked);
Expand Down
2 changes: 2 additions & 0 deletions plotjuggler_app/plotwidget_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ private slots:

void on_radioSteps_toggled(bool checked);

void on_radioStepsInv_toggled(bool checked);

private:
Ui::PlotWidgetEditor* ui;

Expand Down
9 changes: 8 additions & 1 deletion plotjuggler_app/plotwidget_editor.ui
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,14 @@
<item>
<widget class="QRadioButton" name="radioSteps">
<property name="text">
<string>Steps</string>
<string>Steps (pre)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioStepsInv">
<property name="text">
<string>Step (post)</string>
</property>
</widget>
</item>
Expand Down
3 changes: 2 additions & 1 deletion plotjuggler_base/include/PlotJuggler/plotwidget_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class PlotWidgetBase : public QWidget
DOTS,
LINES_AND_DOTS,
STICKS,
STEPS
STEPS,
STEPSINV
};

struct CurveInfo
Expand Down
5 changes: 5 additions & 0 deletions plotjuggler_base/src/plotwidget_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,11 @@ void PlotWidgetBase::setStyle(QwtPlotCurve* curve, CurveStyle style)
break;
case STEPS:
curve->setStyle(QwtPlotCurve::Steps);
curve->setCurveAttribute(QwtPlotCurve::Inverted, false);
break;
case STEPSINV:
curve->setStyle(QwtPlotCurve::Steps);
curve->setCurveAttribute(QwtPlotCurve::Inverted, true);
break;
}
}
Expand Down
Loading