|
|
#ifndef CHARTTHEME_H
|
|
|
#define CHARTTHEME_H
|
|
|
|
|
|
#include "qchartglobal.h"
|
|
|
#include "qchart.h"
|
|
|
#include <QColor>
|
|
|
#include <QGradientStops>
|
|
|
|
|
|
QTCOMMERCIALCHART_BEGIN_NAMESPACE
|
|
|
|
|
|
class ChartItem;
|
|
|
class QSeries;
|
|
|
class LineChartItem;
|
|
|
class QLineSeries;
|
|
|
class BarPresenter;
|
|
|
class QBarSeries;
|
|
|
class StackedBarPresenter;
|
|
|
class QStackedBarSeries;
|
|
|
class QPercentBarSeries;
|
|
|
class PercentBarPresenter;
|
|
|
class QScatterSeries;
|
|
|
class ScatterChartItem;
|
|
|
class PieChartItem;
|
|
|
class QPieSeries;
|
|
|
class SplineChartItem;
|
|
|
class QSplineSeries;
|
|
|
class AreaChartItem;
|
|
|
class QAreaSeries;
|
|
|
|
|
|
class ChartTheme
|
|
|
{
|
|
|
public:
|
|
|
enum BackgroundShadesMode {
|
|
|
BackgroundShadesNone = 0,
|
|
|
BackgroundShadesVertical,
|
|
|
BackgroundShadesHorizontal,
|
|
|
BackgroundShadesBoth
|
|
|
};
|
|
|
|
|
|
protected:
|
|
|
explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeDefault);
|
|
|
public:
|
|
|
static ChartTheme* createTheme(QChart::ChartTheme theme);
|
|
|
QChart::ChartTheme id() const {return m_id;}
|
|
|
void decorate(QChart* chart);
|
|
|
void decorate(QLegend* legend);
|
|
|
//void decorate(ChartItem* item, QSeries* series,int index);
|
|
|
void decorate(QBarSeries* series, int index);
|
|
|
void decorate(QStackedBarSeries* series, int index);
|
|
|
void decorate(QPercentBarSeries* series, int index);
|
|
|
void decorate(QLineSeries* series, int index);
|
|
|
void decorate(QAreaSeries* series, int index);
|
|
|
void decorate(QScatterSeries* series, int index);
|
|
|
void decorate(QPieSeries* series, int index);
|
|
|
void decorate(QSplineSeries* series, int index);
|
|
|
void decorate(QChartAxis* axis, bool axisX);
|
|
|
|
|
|
public: // utils
|
|
|
void generateSeriesGradients();
|
|
|
static QColor colorAt(const QColor &start, const QColor &end, qreal pos);
|
|
|
static QColor colorAt(const QGradient &gradient, qreal pos);
|
|
|
|
|
|
protected:
|
|
|
QChart::ChartTheme m_id;
|
|
|
QList<QColor> m_seriesColors;
|
|
|
QList<QGradient> m_seriesGradients;
|
|
|
QLinearGradient m_chartBackgroundGradient;
|
|
|
|
|
|
QFont m_masterFont;
|
|
|
QBrush m_titleBrush;
|
|
|
QPen m_axisLinePen;
|
|
|
QBrush m_axisLabelBrush;
|
|
|
QPen m_backgroundShadesPen;
|
|
|
QBrush m_backgroundShadesBrush;
|
|
|
BackgroundShadesMode m_backgroundShades;
|
|
|
QPen m_gridLinePen;
|
|
|
};
|
|
|
|
|
|
QTCOMMERCIALCHART_END_NAMESPACE
|
|
|
|
|
|
#endif // CHARTTHEME_H
|
|
|
|