LibEngsas
echartpie.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17  MA 02110-1301 USA.
18 */
19 
20 #ifndef ECHARTPIE_H
21 #define ECHARTPIE_H
22 
23 #include "echartbase.h"
24 #include "echarts.h"
25 
40 {
41  Q_OBJECT
42  Q_PROPERTY(bool percents READ percents WRITE setPercents)
43  public:
44  EChartPie(QWidget *parent = NULL);
45  void setPercents(bool percent);
46  inline bool percents() const { return arePercents; }
47 
48  void addPie(double value, const QString label, QColor color = QColor());
49 
50  protected:
54  void drawChart(QPainter *painter, QRect viewPort);
55 
56  private:
57  QString percentLabel(float percentage);
58 
60  double PI;
61 
62 };
63 
64 #endif // ECHARTPIE_H
65 
virtual void drawChart(QPainter *painter, QRect viewPort)=0
Function to draw the chart.
Base class for ECharts.To add values, call addDataSet(). How the values are treated or how many data ...
Definition: echartbase.h:56
Class to draw pie charts.Just add one data set per piece (with one x-value). The x-Values should be t...
Definition: echartpie.h:39
bool percents() const
Definition: echartpie.h:46
#define E_CHARTS_EXPORT
Definition: echarts.h:31
bool arePercents
Definition: echartpie.h:59
double PI
Definition: echartpie.h:60