File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -579,6 +579,8 @@ class Chart
579579 = 0;
580580 virtual void addPoint (double x, double y) = 0;
581581
582+ virtual void addVerticalMarker (double x, const Painter::Color& color) = 0;
583+
582584 protected:
583585 Chart () = default ;
584586};
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ class GuiChart : public Chart
3737 odb::Orientation2D orientation) override ;
3838 void addPoint (double x, double y) override ;
3939
40+ void addVerticalMarker (double x, const Painter::Color& color) override ;
41+
4042 private:
4143 QChart* chart_;
4244 QLineSeries* series_;
@@ -87,6 +89,22 @@ void GuiChart::addPoint(const double x, const double y)
8789 y_axis_->setMax (y_max_);
8890}
8991
92+ void GuiChart::addVerticalMarker (const double x, const Painter::Color& color)
93+ {
94+ QLineSeries* vline = new QLineSeries ();
95+ vline->append (x, y_axis_->min ());
96+ vline->append (x, y_axis_->max ());
97+
98+ QColor qt_color (color.r , color.g , color.b , color.a );
99+ vline->setPen (QPen (qt_color, 2 , Qt::DashLine));
100+
101+ chart_->addSeries (vline);
102+
103+ // link to same axes
104+ vline->attachAxis (x_axis_);
105+ vline->attachAxis (y_axis_);
106+ }
107+
90108// ////////////////////////////////////////////////
91109
92110ChartsWidget::ChartsWidget (QWidget* parent)
You can’t perform that action at this time.
0 commit comments