File indexing completed on 2024-04-28 15:29:35

0001 /*
0002  * This file is part of KQuickCharts
0003  * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006  */
0007 
0008 #ifndef LINECHARTNODE_H
0009 #define LINECHARTNODE_H
0010 
0011 #include <QColor>
0012 #include <QSGNode>
0013 
0014 class QRectF;
0015 class LineChartMaterial;
0016 class LineSegmentNode;
0017 
0018 /**
0019  * @todo write docs
0020  */
0021 class LineChartNode : public QSGNode
0022 {
0023 public:
0024     LineChartNode();
0025 
0026     /**
0027      * Destructor
0028      */
0029     ~LineChartNode();
0030 
0031     void setRect(const QRectF &rect, qreal devicePixelRatio);
0032     void setLineWidth(float width);
0033     void setLineColor(const QColor &color);
0034     void setFillColor(const QColor &color);
0035     void setValues(const QVector<QVector2D> &values);
0036     void updatePoints();
0037 
0038 private:
0039     QRectF m_rect;
0040     float m_lineWidth = 0.0;
0041     float m_aspect = 1.0;
0042     float m_smoothing = 0.1;
0043     QColor m_lineColor;
0044     QColor m_fillColor;
0045     QVector<QVector2D> m_values;
0046 };
0047 
0048 #endif // LINECHARTNODE_H