-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnightcharts.h
88 lines (75 loc) · 2.41 KB
/
nightcharts.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
* NightCharts
* Copyright (C) 2010 by Alexander A. Avdonin, Artem N. Ivanov / ITGears Co.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Please contact [email protected] with any questions on this license.
*/
#ifndef NIGHTCHARTS_H
#define NIGHTCHARTS_H
#define PerConst = 3.6;
#include <QObject>
#include <QPainter>
#include <QVector>
#include <QDebug>
#include <QLinearGradient>
#include <math.h>
class pieceNC
{
public:
explicit pieceNC();
void addName(QString name);
void setColor(Qt::GlobalColor);
void setColor(QColor color);
void setPerc(float Percentage);
QString pname;
QColor rgbColor;
float pPerc;
private:
};
class Nightcharts
{
public:
explicit Nightcharts();
~Nightcharts();
enum type { Histogramm , Pie, Dpie };
enum legend_type{ /*Horizontal,*/ Vertical, Round };
int addPiece(QString name,Qt::GlobalColor,float Percentage);
int addPiece(QString name,QColor, float Percentage);
int setCords(double x, double y, double w, double h);
int setLegendCords(double x, double y);
int setType(Nightcharts::type t);
int setLegendType(Nightcharts::legend_type t);
int setShadows(bool ok = true);
int setFont(QFont f);
int draw(QPainter *painter);
int drawLegend(QPainter *painter);
int pieceCount();
double palpha;
private:
double cX,cY,cW,cH,pW,lX,lY;
int nPiece;
bool shadows;
QVector<pieceNC> pieces;
int ctype, cltype;
QFont font;
//QPainter *cpainter;
QPointF GetPoint(double angle, double R1 = 0, double R2 = 0);
int GetQuater(double angle);
double Angle360(double angle);
signals:
public slots:
};
#endif // NIGHTCHARTS_H