plotwidget_base.cpp
Go to the documentation of this file.
1 /*
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5  */
6 
8 #include "timeseries_qwt.h"
9 
10 #include "plotmagnifier.h"
11 #include "plotzoomer.h"
12 #include "plotlegend.h"
13 
14 #include "qwt_axis.h"
15 #include "qwt_legend.h"
16 #include "qwt_plot.h"
17 #include "qwt_plot_curve.h"
18 #include "qwt_plot_grid.h"
19 #include "qwt_plot_canvas.h"
20 #include "qwt_plot_curve.h"
21 #include "qwt_plot_opengl_canvas.h"
22 #include "qwt_plot_rescaler.h"
23 #include "qwt_plot_legenditem.h"
24 #include "qwt_plot_marker.h"
25 #include "qwt_plot_layout.h"
26 #include "qwt_scale_engine.h"
27 #include "qwt_scale_map.h"
28 #include "qwt_scale_draw.h"
29 #include "qwt_scale_widget.h"
30 #include "qwt_symbol.h"
31 #include "qwt_text.h"
32 
33 #include <QBoxLayout>
34 #include <QMessageBox>
35 #include <QSettings>
36 #include <QDebug>
37 #include <QDragEnterEvent>
38 #include <QDropEvent>
39 #include <QHBoxLayout>
40 
41 #include "plotpanner.h"
42 
43 static int _global_color_index_ = 0;
44 
46 {
47 public:
53  std::function<void(const QRectF&)> resized_callback;
54  std::function<void(QEvent*)> event_callback;
56 
57  QwtPlotPimpl(PlotWidgetBase* parentObject, QWidget* canvas,
58  std::function<void(const QRectF&)> resizedViewCallback,
59  std::function<void(QEvent*)> eventCallback)
60  : QwtPlot(nullptr)
61  , resized_callback(resizedViewCallback)
62  , event_callback(eventCallback)
63  , parent(parentObject)
64  {
65  this->setCanvas(canvas);
66 
67  legend = new PlotLegend(this);
68  magnifier = new PlotMagnifier(this->canvas());
69  panner1 = new PlotPanner(this->canvas());
70  panner2 = new PlotPanner(this->canvas());
71  zoomer = new PlotZoomer(this->canvas());
72 
73  zoomer->setRubberBandPen(QColor(Qt::red, 1, Qt::DotLine));
74  zoomer->setTrackerPen(QColor(Qt::green, 1, Qt::DotLine));
76  Qt::NoModifier);
77 
80 
81  magnifier->setZoomInKey(Qt::Key_Plus, Qt::ControlModifier);
82  magnifier->setZoomOutKey(Qt::Key_Minus, Qt::ControlModifier);
83 
84  // disable right button. keep mouse wheel
85  magnifier->setMouseButton(Qt::NoButton);
86 
87  panner1->setMouseButton(Qt::LeftButton, Qt::ControlModifier);
88  panner2->setMouseButton(Qt::MiddleButton, Qt::NoModifier);
89 
90  connect(zoomer, &PlotZoomer::zoomed, this,
91  [this](const QRectF& r) { resized_callback(r); });
92 
93  connect(magnifier, &PlotMagnifier::rescaled, this, [this](const QRectF& r) {
95  replot();
96  });
97 
98  connect(panner1, &PlotPanner::rescaled, this,
99  [this](QRectF r) { resized_callback(r); });
100 
101  connect(panner2, &PlotPanner::rescaled, this,
102  [this](QRectF r) { resized_callback(r); });
103 
106 
107  bottomAxis->installEventFilter(parent);
108  leftAxis->installEventFilter(parent);
109  this->canvas()->installEventFilter(parent);
110  }
111 
112  ~QwtPlotPimpl() override
113  {
116 
117  bottomAxis->installEventFilter(parent);
118  leftAxis->removeEventFilter(parent);
119  canvas()->removeEventFilter(parent);
120 
121  setCanvas(nullptr);
122  }
123 
124  QRectF canvasBoundingRect() const
125  {
126  QRectF rect;
127  rect.setBottom(canvasMap(QwtPlot::yLeft).s1());
128  rect.setTop(canvasMap(QwtPlot::yLeft).s2());
129  rect.setLeft(canvasMap(QwtPlot::xBottom).s1());
130  rect.setRight(canvasMap(QwtPlot::xBottom).s2());
131  return rect;
132  }
133 
134  virtual void resizeEvent(QResizeEvent* ev) override
135  {
138  emit parent->widgetResized();
139  }
140 
141  std::list<CurveInfo> curve_list;
142 
143  CurveStyle curve_style = LINES;
144 
145  bool zoom_enabled = true;
146 
147  void dragEnterEvent(QDragEnterEvent* event) override
148  {
150  }
151 
152  void dragLeaveEvent(QDragLeaveEvent* event) override
153  {
155  }
156 
157  void dropEvent(QDropEvent* event) override
158  {
160  }
161 };
162 
163 namespace PJ
164 {
166 {
167  return p;
168 }
169 
170 const QwtPlot* PlotWidgetBase::qwtPlot() const
171 {
172  return p;
173 }
174 
176 {
178  QRectF rect = maxZoomRect();
179 
180  qwtPlot()->setAxisScale(QwtPlot::yLeft, std::min(rect.bottom(), rect.top()),
181  std::max(rect.bottom(), rect.top()));
182  qwtPlot()->setAxisScale(QwtPlot::xBottom, std::min(rect.left(), rect.right()),
183  std::max(rect.left(), rect.right()));
184  qwtPlot()->updateAxes();
185 
186  replot();
187 }
188 
190 {
191  double left = std::numeric_limits<double>::max();
192  double right = std::numeric_limits<double>::lowest();
193 
194  for (auto& it : curveList())
195  {
196  if (!it.curve->isVisible())
197  {
198  continue;
199  }
200 
201  auto series = dynamic_cast<QwtSeriesWrapper*>(it.curve->data());
202  const auto max_range_X = series->getVisualizationRangeX();
203  if (!max_range_X)
204  {
205  continue;
206  }
207 
208  left = std::min(max_range_X->min, left);
209  right = std::max(max_range_X->max, right);
210  }
211 
212  if (left > right)
213  {
214  left = 0;
215  right = 0;
216  }
217 
218  double margin = 0.0;
219  if (fabs(right - left) > std::numeric_limits<double>::epsilon())
220  {
221  margin = isXYPlot() ? ((right - left) * 0.025) : 0.0;
222  }
223  right = right + margin;
224  left = left - margin;
225 
226  return Range({ left, right });
227 }
228 
230 {
231  double top = std::numeric_limits<double>::lowest();
232  double bottom = std::numeric_limits<double>::max();
233 
234  for (auto& it : curveList())
235  {
236  if (!it.curve->isVisible())
237  {
238  continue;
239  }
240 
241  auto series = dynamic_cast<QwtSeriesWrapper*>(it.curve->data());
242 
243  auto max_range_X = series->getVisualizationRangeX();
244  if (!max_range_X)
245  {
246  continue;
247  }
248 
249  double left = std::max(max_range_X->min, range_X.min);
250  double right = std::min(max_range_X->max, range_X.max);
251  left = std::nextafter(left, right);
252  right = std::nextafter(right, left);
253 
254  auto range_Y = series->getVisualizationRangeY({ left, right });
255  if (!range_Y)
256  {
257  qDebug() << " invalid range_Y in PlotWidget::maximumRangeY";
258  continue;
259  }
260  if (top < range_Y->max)
261  {
262  top = range_Y->max;
263  }
264  if (bottom > range_Y->min)
265  {
266  bottom = range_Y->min;
267  }
268  }
269 
270  double margin = 0.1;
271 
272  if (bottom > top)
273  {
274  bottom = 0;
275  top = 0;
276  }
277 
278  if (top - bottom > std::numeric_limits<double>::epsilon())
279  {
280  margin = (top - bottom) * 0.025;
281  }
282 
283  top += margin;
284  bottom -= margin;
285 
286  return Range({ bottom, top });
287 }
288 
290 {
291  return _xy_mode;
292 }
293 
295 {
296  return p->canvasBoundingRect();
297 }
298 
300 {
301  return _max_zoom_rect;
302 }
303 
305 {
306  _xy_mode = enable;
307 }
308 
310  : _xy_mode(false), _keep_aspect_ratio(false)
311 {
312  auto onViewResized = [this](const QRectF& r) { emit viewResized(r); };
313 
314  auto onEvent = [this](QEvent* event) {
315  if (auto ev = dynamic_cast<QDragEnterEvent*>(event))
316  {
317  emit dragEnterSignal(ev);
318  }
319  else if (auto ev = dynamic_cast<QDragLeaveEvent*>(event))
320  {
321  emit dragLeaveSignal(ev);
322  }
323  else if (auto ev = dynamic_cast<QDropEvent*>(event))
324  {
325  emit dropSignal(ev);
326  }
327  };
328 
329  QSettings settings;
330  bool use_opengl = settings.value("Preferences::use_opengl", true).toBool();
331 
332  QWidget* abs_canvas;
333  if (use_opengl)
334  {
335  auto canvas = new QwtPlotOpenGLCanvas();
336  canvas->setFrameStyle(QFrame::NoFrame);
337  canvas->setFrameStyle(QFrame::Box | QFrame::Plain);
338  canvas->setLineWidth(1);
339  canvas->setPalette(Qt::white);
340  abs_canvas = canvas;
341  }
342  else
343  {
344  auto canvas = new QwtPlotCanvas();
345  canvas->setFrameStyle(QFrame::NoFrame);
346  canvas->setFrameStyle(QFrame::Box | QFrame::Plain);
347  canvas->setLineWidth(1);
348  canvas->setPalette(Qt::white);
349  canvas->setPaintAttribute(QwtPlotCanvas::BackingStore, true);
350  abs_canvas = canvas;
351  }
352  abs_canvas->setObjectName("qwtCanvas");
353 
354  p = new QwtPlotPimpl(this, abs_canvas, onViewResized, onEvent);
355 
356  auto layout = new QHBoxLayout(this);
357  layout->setMargin(0);
358  this->setLayout(layout);
359  layout->addWidget(p);
360 
361  qwtPlot()->setMinimumWidth(100);
362  qwtPlot()->setMinimumHeight(100);
363 
364  qwtPlot()->sizePolicy().setHorizontalPolicy(QSizePolicy::Expanding);
365  qwtPlot()->sizePolicy().setVerticalPolicy(QSizePolicy::Expanding);
366 
367  qwtPlot()->canvas()->setMouseTracking(true);
368 
369  qwtPlot()->setCanvasBackground(Qt::white);
372 
373  qwtPlot()
377 
378  qwtPlot()->setAxisScale(QwtPlot::xBottom, 0.0, 1.0);
379  qwtPlot()->setAxisScale(QwtPlot::yLeft, 0.0, 1.0);
380 }
381 
383 {
384  if (p)
385  {
386  delete p;
387  p = nullptr;
388  }
389 }
390 
392  PlotDataXY& data, QColor color)
393 {
394  const auto qname = QString::fromStdString(name);
395 
396  // title is the same of src_name, unless a transform was applied
397  auto curve_it = curveFromTitle(qname);
398  if (curve_it)
399  {
400  return nullptr; // TODO FIXME
401  }
402 
403  auto curve = new QwtPlotCurve(qname);
404  try
405  {
406  QwtSeriesWrapper* plot_qwt = nullptr;
407  if (auto ts_data = dynamic_cast<const PlotData*>(&data))
408  {
409  plot_qwt = createTimeSeries(ts_data);
410  }
411  else
412  {
413  plot_qwt = new QwtSeriesWrapper(&data);
414  }
415 
416  curve->setPaintAttribute(QwtPlotCurve::ClipPolygons, true);
417  curve->setPaintAttribute(QwtPlotCurve::FilterPointsAggressive, true);
418  curve->setData(plot_qwt);
419  }
420  catch (std::exception& ex)
421  {
422  QMessageBox::warning(qwtPlot(), "Exception!", ex.what());
423  return nullptr;
424  }
425 
426  if (color == Qt::transparent)
427  {
428  color = getColorHint(&data);
429  }
430 
431  curve->setPen(color);
432  setStyle(curve, p->curve_style);
433 
434  curve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
435 
436  curve->attach(qwtPlot());
437 
438  auto marker = new QwtPlotMarker;
439  marker->attach(qwtPlot());
440  marker->setVisible(false);
441 
442  QwtSymbol* sym =
443  new QwtSymbol(QwtSymbol::Ellipse, Qt::red, QPen(Qt::black), QSize(8, 8));
444  marker->setSymbol(sym);
445 
446  CurveInfo curve_info;
447  curve_info.curve = curve;
448  curve_info.marker = marker;
449  curve_info.src_name = name;
450 
451  p->curve_list.push_back(curve_info);
452 
453  return &(p->curve_list.back());
454 }
455 
457 {
458  return p->curve_list.empty();
459 }
460 
461 void PlotWidgetBase::removeCurve(const QString& title)
462 {
463  auto it = std::find_if(p->curve_list.begin(), p->curve_list.end(),
464  [&title](const PlotWidgetBase::CurveInfo& info) {
465  return info.curve->title() == title;
466  });
467 
468  if (it != p->curve_list.end())
469  {
470  it->curve->detach();
471  delete it->curve;
472  it->marker->detach();
473  delete it->marker;
474  p->curve_list.erase(it);
475 
476  emit curveListChanged();
477  }
478 }
479 
480 const std::list<PlotWidgetBase::CurveInfo>& PlotWidgetBase::curveList() const
481 {
482  return p->curve_list;
483 }
484 
485 std::list<PlotWidgetBase::CurveInfo>& PlotWidgetBase::curveList()
486 {
487  return p->curve_list;
488 }
489 
491  const QString& transform_ID)
492 {
494  output->setTransform(transform_ID);
495  output->updateCache(true);
496  return output;
497 }
498 
500 {
501  return p->curve_style;
502 }
503 
505 {
506  return _keep_aspect_ratio;
507 }
508 
510 {
511  _keep_aspect_ratio = active;
512  if (isXYPlot() && active)
513  {
514  zoomer()->keepAspectRatio(true);
515  }
516  else
517  {
518  zoomer()->keepAspectRatio(false);
519  }
520 }
521 
523 {
524  qwtPlot()->setAcceptDrops(accept);
525 }
526 
527 bool PlotWidgetBase::eventFilter(QObject* obj, QEvent* event)
528 {
529  if (event->type() == QEvent::Destroy)
530  {
531  return false;
532  }
533 
536 
537  if (magnifier() && (obj == bottomAxis || obj == leftAxis) &&
538  !(isXYPlot() && keepRatioXY()))
539  {
540  if (event->type() == QEvent::Wheel)
541  {
542  auto wheel_event = dynamic_cast<QWheelEvent*>(event);
543  if (obj == bottomAxis)
544  {
546  }
547  else
548  {
550  }
551  magnifier()->widgetWheelEvent(wheel_event);
552  }
553  }
554  if (obj == qwtPlot()->canvas())
555  {
556  if (magnifier())
557  {
559  }
560  switch (event->type())
561  {
562  case QEvent::Wheel: {
563  auto mouse_event = dynamic_cast<QWheelEvent*>(event);
564 
565  bool ctrl_modifier = mouse_event->modifiers() == Qt::ControlModifier;
566  auto legend_rect = legend()->geometry(qwtPlot()->canvas()->rect());
567 
568  if (ctrl_modifier)
569  {
570  if (legend_rect.contains(mouse_event->pos()) && legend()->isVisible())
571  {
572  int prev_size = legend()->font().pointSize();
573  int new_size = prev_size;
574  if (mouse_event->angleDelta().y() > 0)
575  {
576  new_size = std::min(13, prev_size + 1);
577  }
578  if (mouse_event->angleDelta().y() < 0)
579  {
580  new_size = std::max(7, prev_size - 1);
581  }
582  if (new_size != prev_size)
583  {
584  setLegendSize(new_size);
585  emit legendSizeChanged(new_size);
586  }
587  return true;
588  }
589  }
590  return false;
591  }
592  //-------------------
593  case QEvent::MouseButtonPress: {
594  QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event);
595  if (mouse_event->button() == Qt::LeftButton &&
596  mouse_event->modifiers() == Qt::NoModifier)
597  {
598  auto clicked_item = legend()->processMousePressEvent(mouse_event);
599  if (clicked_item)
600  {
601  for (auto& it : curveList())
602  {
603  QSettings settings;
604  bool autozoom_visibility =
605  settings.value("Preferences::autozoom_visibility", true).toBool();
606  if (clicked_item == it.curve)
607  {
608  it.curve->setVisible(!it.curve->isVisible());
609  //_tracker->redraw();
610 
611  if (autozoom_visibility)
612  {
613  resetZoom();
614  }
615  replot();
616  return true;
617  }
618  }
619  }
620  }
621  }
622  }
623  }
624  return false;
625 }
626 
628 {
629  QSettings settings;
630  bool remember_color = settings.value("Preferences::remember_color", true).toBool();
631 
632  if (data)
633  {
634  auto colorHint = data->attribute(COLOR_HINT);
635  if (remember_color && colorHint.isValid())
636  {
637  return colorHint.value<QColor>();
638  }
639  }
640  QColor color;
641  bool use_plot_color_index =
642  settings.value("Preferences::use_plot_color_index", false).toBool();
643  int index = p->curve_list.size();
644 
645  if (!use_plot_color_index)
646  {
647  index = (_global_color_index_++);
648  }
649 
650  // https://matplotlib.org/3.1.1/users/dflt_style_changes.html
651  switch (index % 8)
652  {
653  case 0:
654  color = QColor("#1f77b4");
655  break;
656  case 1:
657  color = QColor("#d62728");
658  break;
659  case 2:
660  color = QColor("#1ac938");
661  break;
662  case 3:
663  color = QColor("#ff7f0e");
664  break;
665 
666  case 4:
667  color = QColor("#f14cc1");
668  break;
669  case 5:
670  color = QColor("#9467bd");
671  break;
672  case 6:
673  color = QColor("#17becf");
674  break;
675  case 7:
676  color = QColor("#bcbd22");
677  break;
678  }
679  if (data)
680  {
681  data->setAttribute(COLOR_HINT, color);
682  }
683 
684  return color;
685 }
686 
687 std::map<QString, QColor> PlotWidgetBase::getCurveColors() const
688 {
689  std::map<QString, QColor> color_by_name;
690 
691  for (auto& it : p->curve_list)
692  {
693  color_by_name.insert({ it.curve->title().text(), it.curve->pen().color() });
694  }
695  return color_by_name;
696 }
697 
699 {
700  curve->setPen(curve->pen().color(), (style == DOTS) ? 4.0 : 1.3);
701 
702  switch (style)
703  {
704  case LINES:
706  break;
707  case LINES_AND_DOTS:
709  break;
710  case DOTS:
712  break;
713  case STICKS:
715  break;
716  case STEPS:
719  break;
720  case STEPSINV:
723  break;
724  }
725 }
726 
728 {
729  p->curve_style = style;
730  for (auto& it : p->curve_list)
731  {
732  setStyle(it.curve, style);
733  }
734  replot();
735 }
736 
738 {
739  for (auto& info : p->curve_list)
740  {
741  if (info.curve->title() == title)
742  {
743  return &info;
744  }
745  if (info.src_name == title.toStdString())
746  {
747  return &info;
748  }
749  }
750  return nullptr;
751 }
752 
754 {
755  auto font = p->legend->font();
756  font.setPointSize(size);
757  p->legend->setFont(font);
758  replot();
759 }
760 
761 void PlotWidgetBase::setLegendAlignment(Qt::Alignment alignment)
762 {
763  p->legend->setAlignmentInCanvas(Qt::Alignment(Qt::AlignTop | alignment));
764 }
765 
767 {
768  p->zoom_enabled = enabled;
769  p->zoomer->setEnabled(enabled);
770  p->magnifier->setEnabled(enabled);
771  p->panner1->setEnabled(enabled);
772  p->panner2->setEnabled(enabled);
773 }
774 
776 {
777  return p->zoom_enabled;
778 }
779 
781 {
782  if (p->zoomer)
783  {
784  p->zoomer->setZoomBase(false);
785  }
786  qwtPlot()->replot();
787 }
788 
790 {
791  for (auto& it : curveList())
792  {
793  it.curve->detach();
794  delete it.curve;
795  it.marker->detach();
796  delete it.marker;
797  }
798 
799  curveList().clear();
800  emit curveListChanged();
801  replot();
802 }
803 
805 {
806  return p->legend;
807 }
809 {
810  return p->zoomer;
811 }
812 
814 {
815  return p->magnifier;
816 }
817 
819 {
820  QRectF max_rect;
821  auto rangeX = getVisualizationRangeX();
822  max_rect.setLeft(rangeX.min);
823  max_rect.setRight(rangeX.max);
824 
825  rangeX.min = std::numeric_limits<double>::lowest();
826  rangeX.max = std::numeric_limits<double>::max();
827  auto rangeY = getVisualizationRangeY(rangeX);
828  max_rect.setBottom(rangeY.min);
829  max_rect.setTop(rangeY.max);
830 
831  if (isXYPlot() && _keep_aspect_ratio)
832  {
833  const QRectF canvas_rect = p->canvas()->contentsRect();
834  const double canvas_ratio = fabs(canvas_rect.width() / canvas_rect.height());
835  const double data_ratio = fabs(max_rect.width() / max_rect.height());
836  if (data_ratio < canvas_ratio)
837  {
838  // height is negative!!!!
839  double new_width = fabs(max_rect.height() * canvas_ratio);
840  double increment = new_width - max_rect.width();
841  max_rect.setWidth(new_width);
842  max_rect.moveLeft(max_rect.left() - 0.5 * increment);
843  }
844  else
845  {
846  // height must be negative!!!!
847  double new_height = -(max_rect.width() / canvas_ratio);
848  double increment = fabs(new_height - max_rect.height());
849  max_rect.setHeight(new_height);
850  max_rect.moveTop(max_rect.top() + 0.5 * increment);
851  }
852  magnifier()->setAxisLimits(QwtPlot::xBottom, max_rect.left(), max_rect.right());
853  magnifier()->setAxisLimits(QwtPlot::yLeft, max_rect.bottom(), max_rect.top());
854  zoomer()->keepAspectRatio(true);
855  }
856  else
857  {
858  magnifier()->setAxisLimits(QwtPlot::xBottom, max_rect.left(), max_rect.right());
859  magnifier()->setAxisLimits(QwtPlot::yLeft, max_rect.bottom(), max_rect.top());
860  zoomer()->keepAspectRatio(false);
861  }
862  _max_zoom_rect = max_rect;
863 }
864 
865 } // namespace PJ
PlotWidgetBase::QwtPlotPimpl::curve_list
std::list< CurveInfo > curve_list
Definition: plotwidget_base.cpp:141
QwtPlotCurve::Inverted
@ Inverted
Definition: qwt_plot_curve.h:120
PJ::PlotWidgetBase::removeCurve
virtual void removeCurve(const QString &title)
Definition: plotwidget_base.cpp:461
PlotWidgetBase::QwtPlotPimpl::resized_callback
std::function< void(const QRectF &)> resized_callback
Definition: plotwidget_base.cpp:53
PJ::PlotWidgetBase::legendSizeChanged
void legendSizeChanged(int new_size)
color
color
Definition: color.h:16
left
lu_byte left
Definition: lparser.c:1226
PJ::PlotWidgetBase::CurveInfo::marker
QwtPlotMarker * marker
Definition: plotwidget_base.h:44
PJ::PlotWidgetBase::curveList
const std::list< CurveInfo > & curveList() const
Definition: plotwidget_base.cpp:480
sol::stack::top
int top(lua_State *L)
Definition: sol.hpp:11684
QwtScaleEngine::Floating
@ Floating
Definition: qwt_scale_engine.h:72
PJ::TimeseriesBase
Definition: timeseries.h:16
PJ::PlotWidgetBase::eventFilter
bool eventFilter(QObject *obj, QEvent *event)
Definition: plotwidget_base.cpp:527
PlotWidgetBase::QwtPlotPimpl
Definition: plotwidget_base.cpp:45
QwtMagnifier::setZoomOutKey
void setZoomOutKey(int key, Qt::KeyboardModifiers=Qt::NoModifier)
Definition: qwt_magnifier.cpp:280
QwtEventPattern::setMousePattern
void setMousePattern(MousePatternCode, Qt::MouseButton button, Qt::KeyboardModifiers=Qt::NoModifier)
Definition: qwt_event_pattern.cpp:108
PlotMagnifier::setAxisLimits
void setAxisLimits(int axis, double lower, double upper)
Definition: plotmagnifier.cpp:30
PlotZoomer
Definition: plotzoomer.h:15
QwtSeriesWrapper
Definition: timeseries_qwt.h:17
QwtPlotCurve::Dots
@ Dots
Definition: qwt_plot_curve.h:98
QwtPlot::event
virtual bool event(QEvent *) QWT_OVERRIDE
Adds handling of layout requests.
Definition: qwt_plot.cpp:237
PJ::PlotWidgetBase::setAcceptDrops
void setAcceptDrops(bool accept)
Definition: plotwidget_base.cpp:522
PJ::PlotWidgetBase::CurveInfo::src_name
std::string src_name
Definition: plotwidget_base.h:42
PlotWidgetBase::QwtPlotPimpl::parent
PlotWidgetBase * parent
Definition: plotwidget_base.cpp:55
QwtPlotCurve::FilterPointsAggressive
@ FilterPointsAggressive
Definition: qwt_plot_curve.h:233
PJ::PlotWidgetBase::CurveInfo
Definition: plotwidget_base.h:40
PJ::PlotWidgetBase::LINES_AND_DOTS
@ LINES_AND_DOTS
Definition: plotwidget_base.h:34
PlotWidgetBase::QwtPlotPimpl::canvasBoundingRect
QRectF canvasBoundingRect() const
Definition: plotwidget_base.cpp:124
PJ::PlotWidgetBase::p
QwtPlotPimpl * p
Definition: plotwidget_base.h:125
QwtPlotCurve::setPen
void setPen(const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine)
Definition: qwt_plot_curve.cpp:304
QwtPlotCurve::Lines
@ Lines
Definition: qwt_plot_curve.h:77
PJ::PlotWidgetBase::setZoomEnabled
void setZoomEnabled(bool enabled)
Definition: plotwidget_base.cpp:766
right
lu_byte right
Definition: lparser.c:1227
PJ::PlotWidgetBase::viewResized
void viewResized(const QRectF &)
QwtPicker::setTrackerPen
void setTrackerPen(const QPen &)
Definition: qwt_picker.cpp:436
QwtPlot
A 2-D plotting widget.
Definition: qwt_plot.h:78
PJ::PlotWidgetBase::~PlotWidgetBase
virtual ~PlotWidgetBase()
Definition: plotwidget_base.cpp:382
PlotPanner
Definition: plotpanner.h:6
QwtPlotCanvas::BackingStore
@ BackingStore
Paint double buffered reusing the content of the pixmap buffer when possible.
Definition: qwt_plot_canvas.h:57
PJ::PlotWidgetBase::removeAllCurves
virtual void removeAllCurves()
Definition: plotwidget_base.cpp:789
PJ::PlotWidgetBase::resetZoom
virtual void resetZoom()
Definition: plotwidget_base.cpp:175
QwtPlot::setAxisScale
void setAxisScale(QwtAxisId, double min, double max, double stepSize=0)
Disable autoscaling and specify a fixed scale for a selected axis.
Definition: qwt_plot_axis.cpp:477
QwtScaleEngine::setAttribute
void setAttribute(Attribute, bool on=true)
Definition: qwt_scale_engine.cpp:417
_global_color_index_
static int _global_color_index_
Definition: plotwidget_base.cpp:43
TransformedTimeseries
Definition: timeseries_qwt.h:74
PJ::PlotWidgetBase::curveStyle
CurveStyle curveStyle() const
Definition: plotwidget_base.cpp:499
PJ::PlotWidgetBase::getCurveColors
std::map< QString, QColor > getCurveColors() const
Definition: plotwidget_base.cpp:687
PJ::COLOR_HINT
@ COLOR_HINT
Definition: plotdatabase.h:55
PJ::PlotWidgetBase::_max_zoom_rect
QRectF _max_zoom_rect
Definition: plotwidget_base.h:143
PlotWidgetBase::QwtPlotPimpl::panner1
PlotPanner * panner1
Definition: plotwidget_base.cpp:50
qwt_symbol.h
QwtEventPattern::MouseSelect1
@ MouseSelect1
Definition: qwt_event_pattern.h:54
qwt_plot_legenditem.h
QwtPlotCurve::Steps
@ Steps
Definition: qwt_plot_curve.h:90
plotwidget_base.h
PJ::PlotWidgetBase::getVisualizationRangeY
virtual PJ::Range getVisualizationRangeY(PJ::Range range_X) const
Definition: plotwidget_base.cpp:229
PlotWidgetBase::QwtPlotPimpl::zoom_enabled
bool zoom_enabled
Definition: plotwidget_base.cpp:145
PlotWidgetBase::QwtPlotPimpl::magnifier
PlotMagnifier * magnifier
Definition: plotwidget_base.cpp:49
QwtPlot::resizeEvent
virtual void resizeEvent(QResizeEvent *) QWT_OVERRIDE
Definition: qwt_plot.cpp:530
QwtMagnifier::setMouseButton
void setMouseButton(Qt::MouseButton, Qt::KeyboardModifiers=Qt::NoModifier)
Definition: qwt_magnifier.cpp:202
QwtPlot::axisWidget
const QwtScaleWidget * axisWidget(QwtAxisId) const
Definition: qwt_plot_axis.cpp:141
PlotWidgetBase::QwtPlotPimpl::QwtPlotPimpl
QwtPlotPimpl(PlotWidgetBase *parentObject, QWidget *canvas, std::function< void(const QRectF &)> resizedViewCallback, std::function< void(QEvent *)> eventCallback)
Definition: plotwidget_base.cpp:57
PJ::PlotWidgetBase::dragEnterSignal
void dragEnterSignal(QDragEnterEvent *event)
PJ::PlotWidgetBase::keepRatioXY
bool keepRatioXY() const
Definition: plotwidget_base.cpp:504
PJ::PlotWidgetBase::getVisualizationRangeX
virtual PJ::Range getVisualizationRangeX() const
Definition: plotwidget_base.cpp:189
PJ::PlotWidgetBase::replot
void replot()
Definition: plotwidget_base.cpp:780
PJ::PlotWidgetBase::dragLeaveSignal
void dragLeaveSignal(QDragLeaveEvent *event)
nonstd::span_lite::size
span_constexpr std::size_t size(span< T, Extent > const &spn)
Definition: span.hpp:1554
QwtPlotCurve::ClipPolygons
@ ClipPolygons
Definition: qwt_plot_curve.h:185
PlotWidgetBase::QwtPlotPimpl::dropEvent
void dropEvent(QDropEvent *event) override
Definition: plotwidget_base.cpp:157
QwtPlotCurve::Sticks
@ Sticks
Definition: qwt_plot_curve.h:83
timeseries_qwt.h
PJ::PlotWidgetBase::addCurve
virtual CurveInfo * addCurve(const std::string &name, PlotDataXY &src_data, QColor color=Qt::transparent)
Definition: plotwidget_base.cpp:391
QwtPlot::setCanvasBackground
void setCanvasBackground(const QBrush &)
Change the background of the plotting area.
Definition: qwt_plot.cpp:873
PlotLegend
Definition: plotlegend.h:14
PJ::PlotWidgetBase::setStyle
static void setStyle(QwtPlotCurve *curve, CurveStyle style)
Definition: plotwidget_base.cpp:698
qwt_scale_map.h
output
static const char * output
Definition: luac.c:38
QwtSymbol
A class for drawing symbols.
Definition: qwt_symbol.h:31
PJ::PlotWidgetBase::curveFromTitle
CurveInfo * curveFromTitle(const QString &title)
Definition: plotwidget_base.cpp:737
PlotWidgetBase::QwtPlotPimpl::event_callback
std::function< void(QEvent *)> event_callback
Definition: plotwidget_base.cpp:54
QwtSeriesWrapper::getVisualizationRangeX
virtual RangeOpt getVisualizationRangeX()
Definition: timeseries_qwt.cpp:195
PJ::PlotWidgetBase::magnifier
PlotMagnifier * magnifier()
Definition: plotwidget_base.cpp:813
PlotLegend::processMousePressEvent
const QwtPlotItem * processMousePressEvent(QMouseEvent *mouse_event)
Definition: plotlegend.cpp:142
PJ::PlotWidgetBase::_keep_aspect_ratio
bool _keep_aspect_ratio
Definition: plotwidget_base.h:145
PJ::Range::max
double max
Definition: plotdatabase.h:27
QwtPlotCurve::setCurveAttribute
void setCurveAttribute(CurveAttribute, bool on=true)
Definition: qwt_plot_curve.cpp:837
qwt_scale_draw.h
QwtPlotCurve::setStyle
void setStyle(CurveStyle style)
Definition: qwt_plot_curve.cpp:238
PJ::PlotWidgetBase::STEPS
@ STEPS
Definition: plotwidget_base.h:36
qwt_plot_rescaler.h
qwt_plot_opengl_canvas.h
QwtPlot::yRight
@ yRight
Definition: qwt_plot.h:241
PJ::PlotWidgetBase::curveListChanged
void curveListChanged()
PJ::PlotWidgetBase::LINES
@ LINES
Definition: plotwidget_base.h:32
nlohmann::detail::void
j template void())
Definition: json.hpp:4061
plotlegend.h
QwtSymbol::Ellipse
@ Ellipse
Ellipse or circle.
Definition: qwt_symbol.h:44
sol::meta::enable
std::enable_if_t< all< Args... >::value, enable_t > enable
Definition: sol.hpp:2244
QwtPlotMagnifier::setAxisEnabled
void setAxisEnabled(QwtAxisId, bool on)
En/Disable an axis.
Definition: qwt_plot_magnifier.cpp:53
PlotMagnifier::Y_AXIS
@ Y_AXIS
Definition: plotmagnifier.h:29
QwtPlotCurve::pen
const QPen & pen() const
Definition: qwt_plot_curve.cpp:330
PJ::PlotWidgetBase::isZoomEnabled
bool isZoomEnabled() const
Definition: plotwidget_base.cpp:775
PlotMagnifier::X_AXIS
@ X_AXIS
Definition: plotmagnifier.h:28
qwt_legend.h
PlotWidgetBase::QwtPlotPimpl::curve_style
CurveStyle curve_style
Definition: plotwidget_base.cpp:143
PJ::Range
Definition: plotdatabase.h:24
QwtPlot::yLeft
@ yLeft
Definition: qwt_plot.h:240
PJ::PlotWidgetBase::dropSignal
void dropSignal(QDropEvent *event)
PJ::PlotWidgetBase::qwtPlot
QwtPlot * qwtPlot()
Definition: plotwidget_base.cpp:165
PJ::PlotWidgetBase::CurveStyle
CurveStyle
Definition: plotwidget_base.h:30
PlotWidgetBase::QwtPlotPimpl::panner2
PlotPanner * panner2
Definition: plotwidget_base.cpp:51
QwtPicker::setRubberBandPen
void setRubberBandPen(const QPen &)
Definition: qwt_picker.cpp:460
PJ::PlotWidgetBase::isEmpty
bool isEmpty() const
Definition: plotwidget_base.cpp:456
QwtPlot::xTop
@ xTop
Definition: qwt_plot.h:243
PlotWidgetBase::QwtPlotPimpl::legend
PlotLegend * legend
Definition: plotwidget_base.cpp:48
PlotWidgetBase::QwtPlotPimpl::resizeEvent
virtual void resizeEvent(QResizeEvent *ev) override
Definition: plotwidget_base.cpp:134
QwtMagnifier::setZoomInKey
void setZoomInKey(int key, Qt::KeyboardModifiers=Qt::NoModifier)
Definition: qwt_magnifier.cpp:250
qwt_scale_engine.h
QwtPlotZoomer::zoomed
void zoomed(const QRectF &rect)
QwtPlot::setAxisAutoScale
void setAxisAutoScale(QwtAxisId, bool on=true)
Enable autoscaling for a specified axis.
Definition: qwt_plot_axis.cpp:453
PlotWidgetBase
PJ::PlotWidgetBase::setLegendSize
void setLegendSize(int size)
Definition: plotwidget_base.cpp:753
PJ::PlotWidgetBase::setModeXY
virtual void setModeXY(bool enable)
Definition: plotwidget_base.cpp:304
PJ::PlotWidgetBase::STICKS
@ STICKS
Definition: plotwidget_base.h:35
PlotWidgetBase::QwtPlotPimpl::dragEnterEvent
void dragEnterEvent(QDragEnterEvent *event) override
Definition: plotwidget_base.cpp:147
PJ::PlotWidgetBase::CurveInfo::curve
QwtPlotCurve * curve
Definition: plotwidget_base.h:43
PJ::PlotWidgetBase::legend
PlotLegend * legend()
Definition: plotwidget_base.cpp:804
PJ::PlotWidgetBase::_xy_mode
bool _xy_mode
Definition: plotwidget_base.h:141
plotzoomer.h
qwt_plot_canvas.h
PJ::PlotWidgetBase::setKeepRatioXY
void setKeepRatioXY(bool active)
Definition: plotwidget_base.cpp:509
QwtPlot::replot
virtual void replot()
Redraw the plot.
Definition: qwt_plot.cpp:545
PJ::PlotWidgetBase::PlotWidgetBase
PlotWidgetBase(QWidget *parent)
Definition: plotwidget_base.cpp:309
PJ::PlotWidgetBase::maxZoomRect
QRectF maxZoomRect() const
Definition: plotwidget_base.cpp:299
QwtPlotCanvas
Canvas of a QwtPlot.
Definition: qwt_plot_canvas.h:29
PJ
Definition: dataloader_base.h:16
mqtt_test.data
dictionary data
Definition: mqtt_test.py:22
PlotMagnifier
Definition: plotmagnifier.h:15
PlotMagnifier::rescaled
void rescaled(QRectF new_size)
PJ::PlotWidgetBase::STEPSINV
@ STEPSINV
Definition: plotwidget_base.h:37
PJ::PlotWidgetBase::widgetResized
void widgetResized()
qwt_scale_widget.h
QwtPanner::setMouseButton
void setMouseButton(Qt::MouseButton, Qt::KeyboardModifiers=Qt::NoModifier)
Definition: qwt_panner.cpp:110
PlotMagnifier::setDefaultMode
void setDefaultMode(AxisMode mode)
Definition: plotmagnifier.h:38
plotmagnifier.h
qwt_plot_curve.h
PJ::PlotWidgetBase::setLegendAlignment
void setLegendAlignment(Qt::Alignment alignment)
Definition: plotwidget_base.cpp:761
QwtPlotMarker
A class for drawing markers.
Definition: qwt_plot_marker.h:45
PJ::PlotWidgetBase::createTimeSeries
virtual QwtSeriesWrapper * createTimeSeries(const PlotData *data, const QString &transform_ID={})
Definition: plotwidget_base.cpp:490
QwtPlot::canvas
QWidget * canvas()
Definition: qwt_plot.cpp:463
PJ::PlotWidgetBase::isXYPlot
bool isXYPlot() const
Definition: plotwidget_base.cpp:289
QwtPlot::xBottom
@ xBottom
Definition: qwt_plot.h:242
PJ::PlotWidgetBase::zoomer
PlotZoomer * zoomer()
Definition: plotwidget_base.cpp:808
plotpanner.h
QwtPlotItem::setVisible
virtual void setVisible(bool)
Definition: qwt_plot_item.cpp:457
PJ::PlotWidgetBase::updateMaximumZoomArea
void updateMaximumZoomArea()
Definition: plotwidget_base.cpp:818
qwt_axis.h
QwtPlotItem::attach
void attach(QwtPlot *plot)
Attach the item to a plot.
Definition: qwt_plot_item.cpp:98
PJ::PlotDataBase
Definition: plotdatabase.h:122
PlotWidgetBase::QwtPlotPimpl::zoomer
PlotZoomer * zoomer
Definition: plotwidget_base.cpp:52
QwtPlotLegendItem::geometry
virtual QRect geometry(const QRectF &canvasRect) const
Definition: qwt_plot_legenditem.cpp:650
qwt_text.h
QwtPlot::canvasMap
virtual QwtScaleMap canvasMap(QwtAxisId) const
Definition: qwt_plot.cpp:800
QwtPlotItem::RenderAntialiased
@ RenderAntialiased
Enable antialiasing.
Definition: qwt_plot_item.h:206
PJ::PlotWidgetBase::DOTS
@ DOTS
Definition: plotwidget_base.h:33
PJ::PlotWidgetBase::changeCurvesStyle
void changeCurvesStyle(CurveStyle style)
Definition: plotwidget_base.cpp:727
PlotWidgetBase::QwtPlotPimpl::~QwtPlotPimpl
~QwtPlotPimpl() override
Definition: plotwidget_base.cpp:112
PlotZoomer::keepAspectRatio
void keepAspectRatio(bool doKeep)
Definition: plotzoomer.h:24
qwt_plot_grid.h
PlotWidgetBase::QwtPlotPimpl::dragLeaveEvent
void dragLeaveEvent(QDragLeaveEvent *event) override
Definition: plotwidget_base.cpp:152
PlotMagnifier::widgetWheelEvent
virtual void widgetWheelEvent(QWheelEvent *event) override
Definition: plotmagnifier.cpp:152
QwtPlotLayout::setAlignCanvasToScales
void setAlignCanvasToScales(bool)
Set the align-canvas-to-axis-scales flag for all axes.
Definition: qwt_plot_layout.cpp:1103
PJ::PlotWidgetBase::getColorHint
QColor getColorHint(PlotDataXY *data)
Definition: plotwidget_base.cpp:627
PlotMagnifier::BOTH_AXES
@ BOTH_AXES
Definition: plotmagnifier.h:30
QwtPlotCurve::LinesAndDots
@ LinesAndDots
Definition: qwt_plot_curve.h:100
PJ::Range::min
double min
Definition: plotdatabase.h:26
QwtPlotLegendItem::font
QFont font() const
Definition: qwt_plot_legenditem.cpp:389
nullptr
#define nullptr
Definition: backward.hpp:386
QwtPlotCurve
A plot item, that represents a series of points.
Definition: qwt_plot_curve.h:56
qwt_plot.h
QwtPlot::axisScaleEngine
QwtScaleEngine * axisScaleEngine(QwtAxisId)
Definition: qwt_plot_axis.cpp:190
QwtPlotOpenGLCanvas
An alternative canvas for a QwtPlot derived from QOpenGLWidget.
Definition: qwt_plot_opengl_canvas.h:34
qwt_plot_layout.h
PJ::PlotWidgetBase::currentBoundingRect
QRectF currentBoundingRect() const
Definition: plotwidget_base.cpp:294
qwt_plot_marker.h
QwtScaleWidget
A Widget which contains a scale.
Definition: qwt_scale_widget.h:34
PlotPanner::rescaled
void rescaled(QRectF new_size)
QwtPlot::plotLayout
QwtPlotLayout * plotLayout()
Definition: qwt_plot.cpp:430
QwtPlot::updateAxes
void updateAxes()
Rebuild the axes scales.
Definition: qwt_plot_axis.cpp:670
QwtPlot::setCanvas
void setCanvas(QWidget *)
Set the drawing canvas of the plot widget.
Definition: qwt_plot.cpp:213


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45