File indexing completed on 2024-05-26 04:23:57
0001 /* 0002 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved. 0003 * 0004 * This file is part of the KD Chart library. 0005 * 0006 * SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef KCHARTRADARDIAGRAM_H 0010 #define KCHARTRADARDIAGRAM_H 0011 0012 0013 #include "KChartPosition.h" 0014 #include "KChartPolarDiagram.h" 0015 #include "KChartRadarCoordinatePlane.h" 0016 0017 QT_BEGIN_NAMESPACE 0018 class QPolygonF; 0019 QT_END_NAMESPACE 0020 0021 namespace KChart { 0022 0023 /** 0024 * @brief RadarDiagram defines a common radar diagram 0025 */ 0026 class KCHART_EXPORT RadarDiagram : public AbstractPolarDiagram 0027 { 0028 Q_OBJECT 0029 0030 Q_DISABLE_COPY( RadarDiagram ) 0031 KCHART_DECLARE_DERIVED_DIAGRAM( RadarDiagram, RadarCoordinatePlane ) 0032 0033 public: 0034 explicit RadarDiagram( 0035 QWidget* parent = nullptr, RadarCoordinatePlane* plane = nullptr ); 0036 ~RadarDiagram() override; 0037 0038 virtual void paint ( PaintContext* paintContext, 0039 bool calculateListAndReturnScale, 0040 qreal& newZoomX, qreal& newZoomY ); 0041 /** \reimpl */ 0042 void resize ( const QSizeF& area ) override; 0043 0044 /** \reimpl */ 0045 qreal valueTotals () const override; 0046 /** \reimpl */ 0047 qreal numberOfValuesPerDataset() const override; 0048 /** \reimpl */ 0049 qreal numberOfGridRings() const override; 0050 0051 /** 0052 * if val is true the diagram will mirror the diagram datapoints 0053 */ 0054 void setReverseData( bool val ); 0055 bool reverseData(); 0056 0057 /** 0058 * Creates an exact copy of this diagram. 0059 */ 0060 virtual RadarDiagram * clone() const; 0061 0062 /** 0063 * Close each of the data series by connecting the last point to its 0064 * respective start point 0065 */ 0066 void setCloseDatasets( bool closeDatasets ); 0067 bool closeDatasets() const; 0068 0069 /** 0070 * Fill the areas of the radar chart with there respective color defined 0071 * via KChart::DatasetBrushRole. The value defines the alpha of the 0072 * color to use. If set to 0.0 (the default) then the radar areas will 0073 * not be filled with any color. If set to 1.0 then the areas will be 0074 * solid filled and are not transparent. 0075 */ 0076 qreal fillAlpha() const; 0077 void setFillAlpha(qreal alphaF); 0078 0079 protected: 0080 /** \reimpl */ 0081 const QPair<QPointF, QPointF> calculateDataBoundaries() const override; 0082 void paintEvent ( QPaintEvent* ) override; 0083 void resizeEvent ( QResizeEvent* ) override; 0084 void paint ( PaintContext* paintContext ) override; 0085 0086 }; // End of class RadarDiagram 0087 0088 } 0089 0090 #endif // KCHARTRADARDIAGRAM_H