1234567891011121314151617181920212223242526272829303132333435 |
- #pragma once
- #include <QWidget>
- #include <QPaintEvent>
- #include <QPen>
- #include <QPainter>
- #include <vector>
- struct LineGraphSeries {
- std::vector<QPoint> data;
- double minX, maxX;
- double minY, maxY;
- double rangeX, rangeY;
- QColor color;
- };
- //bool compTest(QPoint a, QPoint b) {
- // return a.x() < b.x();
- //}
- class CustomLineGraph :public QWidget
- {
- Q_OBJECT
- public:
- CustomLineGraph(QWidget* parent);
- ~CustomLineGraph();
- void CustomLineGraph::paintEvent(QPaintEvent* event);
-
- private:
- std::vector<LineGraphSeries> seriesVec;
- QPen linePen, rectPen, axisPen;
- QPoint transformPoint(QPoint& point, LineGraphSeries& lgs, double stregth_factorX, double stregth_factorY);
- };
|