1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
@@ -1,82 +1,85 | |||||
1 | /*! |
|
1 | /*! | |
2 | \page qml.html |
|
2 | \page qml.html | |
3 | \title QtCommercial Charts QML API |
|
3 | \title QtCommercial Charts QML API | |
4 | \keyword Charts QML API |
|
4 | \keyword Charts QML API | |
5 |
|
5 | |||
6 | QtCommercial Charts QML API is an intuitive and simple way to show charts in your QML |
|
6 | QtCommercial Charts QML API is an intuitive and simple way to show charts in your QML | |
7 | applications. The following QML shows you to create a simple pie chart: |
|
7 | applications. The following QML shows you to create a simple pie chart: | |
8 | \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 1 |
|
8 | \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 1 | |
9 | \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 2 |
|
9 | \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 2 | |
10 | \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 3 |
|
10 | \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 3 | |
11 |
|
11 | |||
12 | \raw HTML |
|
12 | \raw HTML | |
13 | <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable"> |
|
13 | <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable"> | |
14 | <tr> |
|
14 | <tr> | |
15 | <th class="titleheader" width="25%"> ChartView and it's properties </th> |
|
15 | <th class="titleheader" width="25%"> ChartView and it's properties </th> | |
16 | </tr> |
|
16 | </tr> | |
17 | <tr> |
|
17 | <tr> | |
18 | <td valign="top"> |
|
18 | <td valign="top"> | |
19 | <ul> |
|
19 | <ul> | |
20 | <li><a href="qml-chartview.html">ChartView</a></li> |
|
20 | <li><a href="qml-chartview.html">ChartView</a></li> | |
21 | <li><a href="qml-abstractaxis.html">AbstractAxis</a></li> |
|
21 | <li><a href="qml-abstractaxis.html">AbstractAxis</a></li> | |
22 | <li><a href="qml-valueaxis.html">ValueAxis</a></li> |
|
22 | <li><a href="qml-valueaxis.html">ValueAxis</a></li> | |
23 | <li><a href="qml-categoryaxis.html">CategoryAxis</a></li> |
|
23 | <li><a href="qml-categoryaxis.html">CategoryAxis</a></li> | |
24 | <li><a href="qml-categoryrange.html">CategoryRange</a></li> |
|
24 | <li><a href="qml-categoryrange.html">CategoryRange</a></li> | |
25 | <li><a href="qml-barcategoryaxis.html">BarCategoryAxis</a></li> |
|
25 | <li><a href="qml-barcategoryaxis.html">BarCategoryAxis</a></li> | |
26 | <li><a href="qml-legend.html">Legend</a></li> |
|
26 | <li><a href="qml-legend.html">Legend</a></li> | |
27 | <li><a href="qml-abstractseries.html">AbstractSeries</a></li> |
|
27 | <li><a href="qml-abstractseries.html">AbstractSeries</a></li> | |
28 | </ul> |
|
28 | </ul> | |
29 | </td> |
|
29 | </td> | |
30 | </tr> |
|
30 | </tr> | |
31 | </table> |
|
31 | </table> | |
32 | <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable"> |
|
32 | <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable"> | |
33 | <tr> |
|
33 | <tr> | |
34 | <th class="titleheader" width="25%"> XY chart </th> |
|
34 | <th class="titleheader" width="25%"> XY chart </th> | |
35 | </tr> |
|
35 | </tr> | |
36 | <tr> |
|
36 | <tr> | |
37 | <td valign="top"> |
|
37 | <td valign="top"> | |
38 | <ul> |
|
38 | <ul> | |
39 | <li><a href="qml-xyseries.html">XYSeries</a></li> |
|
39 | <li><a href="qml-xyseries.html">XYSeries</a></li> | |
40 | <li><a href="qml-lineseries.html">LineSeries</a></li> |
|
40 | <li><a href="qml-lineseries.html">LineSeries</a></li> | |
41 | <li><a href="qml-areaseries.html">AreaSeries</a></li> |
|
41 | <li><a href="qml-areaseries.html">AreaSeries</a></li> | |
42 | <li><a href="qml-scatterseries.html">ScatterSeries</a></li> |
|
42 | <li><a href="qml-scatterseries.html">ScatterSeries</a></li> | |
43 | <li><a href="qml-splineseries.html">SplineSeries</a></li> |
|
43 | <li><a href="qml-splineseries.html">SplineSeries</a></li> | |
44 | <li><a href="qml-xypoint.html">XYPoint</a></li> |
|
44 | <li><a href="qml-xypoint.html">XYPoint</a></li> | |
45 | <li><a href="qml-hxymodelmapper.html">HXYModelMapper</a></li> |
|
45 | <li><a href="qml-hxymodelmapper.html">HXYModelMapper</a></li> | |
46 | <li><a href="qml-vxymodelmapper.html">VXYModelMapper</a></li> |
|
46 | <li><a href="qml-vxymodelmapper.html">VXYModelMapper</a></li> | |
47 | </ul> |
|
47 | </ul> | |
48 | </td> |
|
48 | </td> | |
49 | </tr> |
|
49 | </tr> | |
50 | </table> |
|
50 | </table> | |
51 | <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable"> |
|
51 | <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable"> | |
52 | <tr> |
|
52 | <tr> | |
53 | <th class="titleheader" width="25%"> Pie chart </th> |
|
53 | <th class="titleheader" width="25%"> Pie chart </th> | |
54 | <tr> |
|
54 | <tr> | |
55 | <td valign="top"> |
|
55 | <td valign="top"> | |
56 | <ul> |
|
56 | <ul> | |
57 | <li><a href="qml-pieseries.html">PieSeries</a></li> |
|
57 | <li><a href="qml-pieseries.html">PieSeries</a></li> | |
58 | <li><a href="qml-pieslice.html">PieSlice</a></li> |
|
58 | <li><a href="qml-pieslice.html">PieSlice</a></li> | |
59 | <li><a href="qml-hpiemodelmapper.html">HPieModelMapper</a></li> |
|
59 | <li><a href="qml-hpiemodelmapper.html">HPieModelMapper</a></li> | |
60 | <li><a href="qml-vpiemodelmapper.html">VPieModelMapper</a></li> |
|
60 | <li><a href="qml-vpiemodelmapper.html">VPieModelMapper</a></li> | |
61 | </ul> |
|
61 | </ul> | |
62 | </td> |
|
62 | </td> | |
63 | </tr> |
|
63 | </tr> | |
64 | </table> |
|
64 | </table> | |
65 | <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable"> |
|
65 | <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable"> | |
66 | <tr> |
|
66 | <tr> | |
67 | <th class="titleheader" width="25%"> Bar chart </th> |
|
67 | <th class="titleheader" width="25%"> Bar chart </th> | |
68 | <tr> |
|
68 | <tr> | |
69 | <td valign="top"> |
|
69 | <td valign="top"> | |
70 | <ul> |
|
70 | <ul> | |
71 | <li><a href="qml-barseries.html">BarSeries</a></li> |
|
71 | <li><a href="qml-barseries.html">BarSeries</a></li> | |
72 | <li><a href="qml-stackedbarseries.html">StackedBarSeries</a></li> |
|
72 | <li><a href="qml-stackedbarseries.html">StackedBarSeries</a></li> | |
73 | <li><a href="qml-percentbarseries.html">PercentBarSeries</a></li> |
|
73 | <li><a href="qml-percentbarseries.html">PercentBarSeries</a></li> | |
|
74 | <li><a href="qml-horizontalbarseries.html">HorizontalBarSeries</a></li> | |||
|
75 | <li><a href="qml-horizontalstackedbarseries.html">HorizontalStackedBarSeries</a></li> | |||
|
76 | <li><a href="qml-horizontalpercentbarseries.html">HorizontalPercentBarSeries</a></li> | |||
74 | <li><a href="qml-barset.html">BarSet</a></li> |
|
77 | <li><a href="qml-barset.html">BarSet</a></li> | |
75 | <li><a href="qml-hbarmodelmapper.html">HBarModelMapper</a></li> |
|
78 | <li><a href="qml-hbarmodelmapper.html">HBarModelMapper</a></li> | |
76 | <li><a href="qml-vbarmodelmapper.html">VBarModelMapper</a></li> |
|
79 | <li><a href="qml-vbarmodelmapper.html">VBarModelMapper</a></li> | |
77 | </ul> |
|
80 | </ul> | |
78 | </td> |
|
81 | </td> | |
79 | </tr> |
|
82 | </tr> | |
80 | </table> |
|
83 | </table> | |
81 | \endraw |
|
84 | \endraw | |
82 | */ |
|
85 | */ |
@@ -1,127 +1,125 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "qhorizontalbarseries.h" |
|
21 | #include "qhorizontalbarseries.h" | |
22 | #include "qhorizontalbarseries_p.h" |
|
22 | #include "qhorizontalbarseries_p.h" | |
23 | #include "horizontalbarchartitem_p.h" |
|
23 | #include "horizontalbarchartitem_p.h" | |
24 | #include "horizontalbaranimation_p.h" |
|
24 | #include "horizontalbaranimation_p.h" | |
25 | #include "qbarcategoryaxis.h" |
|
25 | #include "qbarcategoryaxis.h" | |
26 |
|
26 | |||
27 | #include "chartdataset_p.h" |
|
27 | #include "chartdataset_p.h" | |
28 | #include "charttheme_p.h" |
|
28 | #include "charttheme_p.h" | |
29 |
|
29 | |||
30 |
|
30 | |||
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
32 |
|
32 | |||
33 | /*! |
|
33 | /*! | |
34 | \class QHorizontalBarSeries |
|
34 | \class QHorizontalBarSeries | |
35 | \brief Series for creating horizontal bar chart |
|
35 | \brief Series for creating horizontal bar chart | |
36 | \mainclass |
|
36 | \mainclass | |
37 |
|
37 | |||
38 | QHorizontalBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars |
|
38 | QHorizontalBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars | |
39 | as groups, where bars in same category are grouped next to each other. QHorizontalBarSeries groups the data |
|
39 | as groups, where bars in same category are grouped next to each other. QHorizontalBarSeries groups the data | |
40 | from sets to categories, which are defined by a QStringList. |
|
40 | from sets to categories, which are defined by a QStringList. | |
41 |
|
41 | |||
42 | See the \l {HorizontalBarChart Example} {horizontal bar chart example} to learn how to create a horizontal bar chart. |
|
42 | See the \l {HorizontalBarChart Example} {horizontal bar chart example} to learn how to create a horizontal bar chart. | |
43 | \image examples_horizontalbarchart.png |
|
43 | \image examples_horizontalbarchart.png | |
44 |
|
44 | |||
45 | \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalStackedBarSeries, QHorizontalPercentBarSeries |
|
45 | \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalStackedBarSeries, QHorizontalPercentBarSeries | |
46 | */ |
|
46 | */ | |
47 | /* |
|
47 | /*! | |
48 | // TODO: |
|
48 | \qmlclass HorizontalBarSeries QHorizontalBarSeries | |
49 | \qmlclass Horizontal QHorizontalBarSeries |
|
|||
50 | \inherits AbstractBarSeries |
|
49 | \inherits AbstractBarSeries | |
51 |
|
50 | |||
52 |
The following QML shows how to create a simple |
|
51 | The following QML shows how to create a simple horizontal bar chart: | |
53 |
\snippet ../demos/qmlchart/qml/qmlchart/View |
|
52 | \snippet ../demos/qmlchart/qml/qmlchart/View9.qml 1 | |
54 | \beginfloatleft |
|
53 | \beginfloatleft | |
55 |
\image demos_qmlchart |
|
54 | \image demos_qmlchart9.png | |
56 | \endfloat |
|
55 | \endfloat | |
57 | \clearfloat |
|
56 | \clearfloat | |
58 | */ |
|
57 | */ | |
59 |
|
58 | |||
60 |
|
||||
61 | /*! |
|
59 | /*! | |
62 | Constructs empty QHorizontalBarSeries. |
|
60 | Constructs empty QHorizontalBarSeries. | |
63 | QHorizontalBarSeries is QObject which is a child of a \a parent. |
|
61 | QHorizontalBarSeries is QObject which is a child of a \a parent. | |
64 | */ |
|
62 | */ | |
65 | QHorizontalBarSeries::QHorizontalBarSeries(QObject *parent) : |
|
63 | QHorizontalBarSeries::QHorizontalBarSeries(QObject *parent) : | |
66 | QAbstractBarSeries(*new QHorizontalBarSeriesPrivate(this), parent) |
|
64 | QAbstractBarSeries(*new QHorizontalBarSeriesPrivate(this), parent) | |
67 | { |
|
65 | { | |
68 | } |
|
66 | } | |
69 |
|
67 | |||
70 | /*! |
|
68 | /*! | |
71 | Destructor |
|
69 | Destructor | |
72 | Removes series from chart. |
|
70 | Removes series from chart. | |
73 | */ |
|
71 | */ | |
74 | QHorizontalBarSeries::~QHorizontalBarSeries() |
|
72 | QHorizontalBarSeries::~QHorizontalBarSeries() | |
75 | { |
|
73 | { | |
76 | Q_D(QHorizontalBarSeries); |
|
74 | Q_D(QHorizontalBarSeries); | |
77 | if(d->m_dataset) { |
|
75 | if(d->m_dataset) { | |
78 | d->m_dataset->removeSeries(this); |
|
76 | d->m_dataset->removeSeries(this); | |
79 | } |
|
77 | } | |
80 | } |
|
78 | } | |
81 |
|
79 | |||
82 | /*! |
|
80 | /*! | |
83 | Returns QChartSeries::SeriesTypeHorizontalBar. |
|
81 | Returns QChartSeries::SeriesTypeHorizontalBar. | |
84 | */ |
|
82 | */ | |
85 | QAbstractSeries::SeriesType QHorizontalBarSeries::type() const |
|
83 | QAbstractSeries::SeriesType QHorizontalBarSeries::type() const | |
86 | { |
|
84 | { | |
87 | return QAbstractSeries::SeriesTypeHorizontalBar; |
|
85 | return QAbstractSeries::SeriesTypeHorizontalBar; | |
88 | } |
|
86 | } | |
89 |
|
87 | |||
90 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
88 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
91 |
|
89 | |||
92 | QHorizontalBarSeriesPrivate::QHorizontalBarSeriesPrivate(QHorizontalBarSeries *q) : QAbstractBarSeriesPrivate(q) |
|
90 | QHorizontalBarSeriesPrivate::QHorizontalBarSeriesPrivate(QHorizontalBarSeries *q) : QAbstractBarSeriesPrivate(q) | |
93 | { |
|
91 | { | |
94 |
|
92 | |||
95 | } |
|
93 | } | |
96 |
|
94 | |||
97 | void QHorizontalBarSeriesPrivate::scaleDomain(Domain& domain) |
|
95 | void QHorizontalBarSeriesPrivate::scaleDomain(Domain& domain) | |
98 | { |
|
96 | { | |
99 | qreal minX(domain.minX()); |
|
97 | qreal minX(domain.minX()); | |
100 | qreal minY(domain.minY()); |
|
98 | qreal minY(domain.minY()); | |
101 | qreal maxX(domain.maxX()); |
|
99 | qreal maxX(domain.maxX()); | |
102 | qreal maxY(domain.maxY()); |
|
100 | qreal maxY(domain.maxY()); | |
103 |
|
101 | |||
104 | qreal y = categoryCount(); |
|
102 | qreal y = categoryCount(); | |
105 | minX = qMin(minX, min()); |
|
103 | minX = qMin(minX, min()); | |
106 | minY = qMin(minY, - (qreal)0.5); |
|
104 | minY = qMin(minY, - (qreal)0.5); | |
107 | maxX = qMax(maxX, max()); |
|
105 | maxX = qMax(maxX, max()); | |
108 | maxY = qMax(maxY, y - (qreal)0.5); |
|
106 | maxY = qMax(maxY, y - (qreal)0.5); | |
109 |
|
107 | |||
110 | domain.setRange(minX,maxX,minY,maxY); |
|
108 | domain.setRange(minX,maxX,minY,maxY); | |
111 | } |
|
109 | } | |
112 |
|
110 | |||
113 | ChartElement* QHorizontalBarSeriesPrivate::createGraphics(ChartPresenter* presenter) |
|
111 | ChartElement* QHorizontalBarSeriesPrivate::createGraphics(ChartPresenter* presenter) | |
114 | { |
|
112 | { | |
115 | Q_Q(QHorizontalBarSeries); |
|
113 | Q_Q(QHorizontalBarSeries); | |
116 |
|
114 | |||
117 | HorizontalBarChartItem* bar = new HorizontalBarChartItem(q,presenter); |
|
115 | HorizontalBarChartItem* bar = new HorizontalBarChartItem(q,presenter); | |
118 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { |
|
116 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { | |
119 | bar->setAnimation(new HorizontalBarAnimation(bar)); |
|
117 | bar->setAnimation(new HorizontalBarAnimation(bar)); | |
120 | } |
|
118 | } | |
121 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); |
|
119 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); | |
122 | return bar; |
|
120 | return bar; | |
123 | } |
|
121 | } | |
124 |
|
122 | |||
125 | #include "moc_qhorizontalbarseries.cpp" |
|
123 | #include "moc_qhorizontalbarseries.cpp" | |
126 |
|
124 | |||
127 | QTCOMMERCIALCHART_END_NAMESPACE |
|
125 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,92 +1,103 | |||||
1 | #include "qhorizontalpercentbarseries.h" |
|
1 | #include "qhorizontalpercentbarseries.h" | |
2 | #include "qhorizontalpercentbarseries_p.h" |
|
2 | #include "qhorizontalpercentbarseries_p.h" | |
3 | #include "horizontalpercentbarchartitem_p.h" |
|
3 | #include "horizontalpercentbarchartitem_p.h" | |
4 | #include "horizontalpercentbaranimation_p.h" |
|
4 | #include "horizontalpercentbaranimation_p.h" | |
5 |
|
5 | |||
6 | #include "chartdataset_p.h" |
|
6 | #include "chartdataset_p.h" | |
7 | #include "charttheme_p.h" |
|
7 | #include "charttheme_p.h" | |
8 |
|
8 | |||
9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
10 |
|
10 | |||
11 | /*! |
|
11 | /*! | |
12 | \class QHorizontalPercentBarSeries |
|
12 | \class QHorizontalPercentBarSeries | |
13 | \brief Series for creating horizontal percent bar chart |
|
13 | \brief Series for creating horizontal percent bar chart | |
14 | \mainclass |
|
14 | \mainclass | |
15 |
|
15 | |||
16 | QHorizontalPercentBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars |
|
16 | QHorizontalPercentBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars | |
17 | as groups, where bars in same category are grouped next to each other. QHorizontalPercentBarSeries groups the data |
|
17 | as groups, where bars in same category are grouped next to each other. QHorizontalPercentBarSeries groups the data | |
18 | from sets to categories, which are defined by a QStringList. |
|
18 | from sets to categories, which are defined by a QStringList. | |
19 |
|
19 | |||
20 | See the \l {HorizontalPercentBarChart Example} {horizontal percent bar chart example} to learn how to create a horizontal percent bar chart. |
|
20 | See the \l {HorizontalPercentBarChart Example} {horizontal percent bar chart example} to learn how to create a horizontal percent bar chart. | |
21 | \image examples_horizontalpercentbarchart.png |
|
21 | \image examples_horizontalpercentbarchart.png | |
22 |
|
22 | |||
23 | \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalStackedBarSeries, QHorizontalBarSeries |
|
23 | \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalStackedBarSeries, QHorizontalBarSeries | |
24 | */ |
|
24 | */ | |
|
25 | /*! | |||
|
26 | \qmlclass HorizontalPercentBarSeries QHorizontalPercentBarSeries | |||
|
27 | \inherits QAbstractBarSeries | |||
|
28 | ||||
|
29 | The following QML shows how to create a simple horizontal percent bar chart: | |||
|
30 | \snippet ../demos/qmlchart/qml/qmlchart/View11.qml 1 | |||
|
31 | \beginfloatleft | |||
|
32 | \image demos_qmlchart11.png | |||
|
33 | \endfloat | |||
|
34 | \clearfloat | |||
|
35 | */ | |||
25 |
|
36 | |||
26 | /*! |
|
37 | /*! | |
27 | Constructs empty QHorizontalPercentBarSeries. |
|
38 | Constructs empty QHorizontalPercentBarSeries. | |
28 | QHorizontalPercentBarSeries is QObject which is a child of a \a parent. |
|
39 | QHorizontalPercentBarSeries is QObject which is a child of a \a parent. | |
29 | */ |
|
40 | */ | |
30 | QHorizontalPercentBarSeries::QHorizontalPercentBarSeries(QObject *parent) : |
|
41 | QHorizontalPercentBarSeries::QHorizontalPercentBarSeries(QObject *parent) : | |
31 | QAbstractBarSeries(*new QHorizontalPercentBarSeriesPrivate(this), parent) |
|
42 | QAbstractBarSeries(*new QHorizontalPercentBarSeriesPrivate(this), parent) | |
32 | { |
|
43 | { | |
33 | } |
|
44 | } | |
34 |
|
45 | |||
35 | /*! |
|
46 | /*! | |
36 | Returns QChartSeries::SeriesTypeHorizontalPercentBar. |
|
47 | Returns QChartSeries::SeriesTypeHorizontalPercentBar. | |
37 | */ |
|
48 | */ | |
38 | QAbstractSeries::SeriesType QHorizontalPercentBarSeries::type() const |
|
49 | QAbstractSeries::SeriesType QHorizontalPercentBarSeries::type() const | |
39 | { |
|
50 | { | |
40 | return QAbstractSeries::SeriesTypeHorizontalPercentBar; |
|
51 | return QAbstractSeries::SeriesTypeHorizontalPercentBar; | |
41 | } |
|
52 | } | |
42 |
|
53 | |||
43 | /*! |
|
54 | /*! | |
44 | Destructor |
|
55 | Destructor | |
45 | Removes series from chart. |
|
56 | Removes series from chart. | |
46 | */ |
|
57 | */ | |
47 | QHorizontalPercentBarSeries::~QHorizontalPercentBarSeries() |
|
58 | QHorizontalPercentBarSeries::~QHorizontalPercentBarSeries() | |
48 | { |
|
59 | { | |
49 | Q_D(QHorizontalPercentBarSeries); |
|
60 | Q_D(QHorizontalPercentBarSeries); | |
50 | if(d->m_dataset) { |
|
61 | if(d->m_dataset) { | |
51 | d->m_dataset->removeSeries(this); |
|
62 | d->m_dataset->removeSeries(this); | |
52 | } |
|
63 | } | |
53 | } |
|
64 | } | |
54 |
|
65 | |||
55 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
66 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
56 |
|
67 | |||
57 | QHorizontalPercentBarSeriesPrivate::QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries *q) : QAbstractBarSeriesPrivate(q) |
|
68 | QHorizontalPercentBarSeriesPrivate::QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries *q) : QAbstractBarSeriesPrivate(q) | |
58 | { |
|
69 | { | |
59 |
|
70 | |||
60 | } |
|
71 | } | |
61 |
|
72 | |||
62 | void QHorizontalPercentBarSeriesPrivate::scaleDomain(Domain& domain) |
|
73 | void QHorizontalPercentBarSeriesPrivate::scaleDomain(Domain& domain) | |
63 | { |
|
74 | { | |
64 | qreal minX(domain.minX()); |
|
75 | qreal minX(domain.minX()); | |
65 | qreal minY(domain.minY()); |
|
76 | qreal minY(domain.minY()); | |
66 | qreal maxX(domain.maxX()); |
|
77 | qreal maxX(domain.maxX()); | |
67 | qreal maxY(domain.maxY()); |
|
78 | qreal maxY(domain.maxY()); | |
68 |
|
79 | |||
69 | qreal y = categoryCount(); |
|
80 | qreal y = categoryCount(); | |
70 | minX = 0; |
|
81 | minX = 0; | |
71 | maxX = 100; |
|
82 | maxX = 100; | |
72 | minY = qMin(minY, - (qreal)0.5); |
|
83 | minY = qMin(minY, - (qreal)0.5); | |
73 | maxY = qMax(maxY, y - (qreal)0.5); |
|
84 | maxY = qMax(maxY, y - (qreal)0.5); | |
74 |
|
85 | |||
75 | domain.setRange(minX,maxX,minY,maxY); |
|
86 | domain.setRange(minX,maxX,minY,maxY); | |
76 | } |
|
87 | } | |
77 |
|
88 | |||
78 | ChartElement* QHorizontalPercentBarSeriesPrivate::createGraphics(ChartPresenter* presenter) |
|
89 | ChartElement* QHorizontalPercentBarSeriesPrivate::createGraphics(ChartPresenter* presenter) | |
79 | { |
|
90 | { | |
80 | Q_Q(QHorizontalPercentBarSeries); |
|
91 | Q_Q(QHorizontalPercentBarSeries); | |
81 |
|
92 | |||
82 | HorizontalPercentBarChartItem* bar = new HorizontalPercentBarChartItem(q,presenter); |
|
93 | HorizontalPercentBarChartItem* bar = new HorizontalPercentBarChartItem(q,presenter); | |
83 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { |
|
94 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { | |
84 | bar->setAnimation(new HorizontalPercentBarAnimation(bar)); |
|
95 | bar->setAnimation(new HorizontalPercentBarAnimation(bar)); | |
85 | } |
|
96 | } | |
86 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); |
|
97 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); | |
87 | return bar; |
|
98 | return bar; | |
88 | } |
|
99 | } | |
89 |
|
100 | |||
90 | #include "moc_qhorizontalpercentbarseries.cpp" |
|
101 | #include "moc_qhorizontalpercentbarseries.cpp" | |
91 |
|
102 | |||
92 | QTCOMMERCIALCHART_END_NAMESPACE |
|
103 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,91 +1,102 | |||||
1 | #include "qhorizontalstackedbarseries.h" |
|
1 | #include "qhorizontalstackedbarseries.h" | |
2 | #include "qhorizontalstackedbarseries_p.h" |
|
2 | #include "qhorizontalstackedbarseries_p.h" | |
3 | #include "horizontalstackedbarchartitem_p.h" |
|
3 | #include "horizontalstackedbarchartitem_p.h" | |
4 | #include "horizontalstackedbaranimation_p.h" |
|
4 | #include "horizontalstackedbaranimation_p.h" | |
5 |
|
5 | |||
6 | #include "chartdataset_p.h" |
|
6 | #include "chartdataset_p.h" | |
7 | #include "charttheme_p.h" |
|
7 | #include "charttheme_p.h" | |
8 |
|
8 | |||
9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
10 | /*! |
|
10 | /*! | |
11 | \class QHorizontalStackedBarSeries |
|
11 | \class QHorizontalStackedBarSeries | |
12 | \brief Series for creating horizontal stacked bar chart |
|
12 | \brief Series for creating horizontal stacked bar chart | |
13 | \mainclass |
|
13 | \mainclass | |
14 |
|
14 | |||
15 | QHorizontalStackedBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars |
|
15 | QHorizontalStackedBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars | |
16 | as groups, where bars in same category are grouped next to each other. QHorizontalStackedBarSeries groups the data |
|
16 | as groups, where bars in same category are grouped next to each other. QHorizontalStackedBarSeries groups the data | |
17 | from sets to categories, which are defined by a QStringList. |
|
17 | from sets to categories, which are defined by a QStringList. | |
18 |
|
18 | |||
19 | See the \l {HorizontalStackedBarChart Example} {horizontal stacked bar chart example} to learn how to create a horizontal stacked bar chart. |
|
19 | See the \l {HorizontalStackedBarChart Example} {horizontal stacked bar chart example} to learn how to create a horizontal stacked bar chart. | |
20 | \image examples_horizontalstackedbarchart.png |
|
20 | \image examples_horizontalstackedbarchart.png | |
21 |
|
21 | |||
22 | \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalPercentBarSeries, QHorizontalBarSeries |
|
22 | \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalPercentBarSeries, QHorizontalBarSeries | |
23 | */ |
|
23 | */ | |
|
24 | /*! | |||
|
25 | \qmlclass HorizontalStackedBarSeries QHorizontalStackedBarSeries | |||
|
26 | \inherits QAbstractBarSeries | |||
|
27 | ||||
|
28 | The following QML shows how to create a simple horizontal stacked bar chart: | |||
|
29 | \snippet ../demos/qmlchart/qml/qmlchart/View10.qml 1 | |||
|
30 | \beginfloatleft | |||
|
31 | \image demos_qmlchart10.png | |||
|
32 | \endfloat | |||
|
33 | \clearfloat | |||
|
34 | */ | |||
24 |
|
35 | |||
25 | /*! |
|
36 | /*! | |
26 | Constructs empty QHorizontalStackedBarSeries. |
|
37 | Constructs empty QHorizontalStackedBarSeries. | |
27 | QHorizontalStackedBarSeries is QObject which is a child of a \a parent. |
|
38 | QHorizontalStackedBarSeries is QObject which is a child of a \a parent. | |
28 | */ |
|
39 | */ | |
29 | QHorizontalStackedBarSeries::QHorizontalStackedBarSeries(QObject *parent) : |
|
40 | QHorizontalStackedBarSeries::QHorizontalStackedBarSeries(QObject *parent) : | |
30 | QAbstractBarSeries(*new QHorizontalStackedBarSeriesPrivate(this), parent) |
|
41 | QAbstractBarSeries(*new QHorizontalStackedBarSeriesPrivate(this), parent) | |
31 | { |
|
42 | { | |
32 | } |
|
43 | } | |
33 |
|
44 | |||
34 | /*! |
|
45 | /*! | |
35 | Destructor |
|
46 | Destructor | |
36 | Removes series from chart. |
|
47 | Removes series from chart. | |
37 | */ |
|
48 | */ | |
38 | QHorizontalStackedBarSeries::~QHorizontalStackedBarSeries() |
|
49 | QHorizontalStackedBarSeries::~QHorizontalStackedBarSeries() | |
39 | { |
|
50 | { | |
40 | Q_D(QHorizontalStackedBarSeries); |
|
51 | Q_D(QHorizontalStackedBarSeries); | |
41 | if(d->m_dataset) { |
|
52 | if(d->m_dataset) { | |
42 | d->m_dataset->removeSeries(this); |
|
53 | d->m_dataset->removeSeries(this); | |
43 | } |
|
54 | } | |
44 | } |
|
55 | } | |
45 |
|
56 | |||
46 | /*! |
|
57 | /*! | |
47 | Returns QChartSeries::SeriesTypeHorizontalStackedBar. |
|
58 | Returns QChartSeries::SeriesTypeHorizontalStackedBar. | |
48 | */ |
|
59 | */ | |
49 | QAbstractSeries::SeriesType QHorizontalStackedBarSeries::type() const |
|
60 | QAbstractSeries::SeriesType QHorizontalStackedBarSeries::type() const | |
50 | { |
|
61 | { | |
51 | return QAbstractSeries::SeriesTypeHorizontalStackedBar; |
|
62 | return QAbstractSeries::SeriesTypeHorizontalStackedBar; | |
52 | } |
|
63 | } | |
53 |
|
64 | |||
54 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
65 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
55 |
|
66 | |||
56 | QHorizontalStackedBarSeriesPrivate::QHorizontalStackedBarSeriesPrivate(QHorizontalStackedBarSeries *q) : QAbstractBarSeriesPrivate(q) |
|
67 | QHorizontalStackedBarSeriesPrivate::QHorizontalStackedBarSeriesPrivate(QHorizontalStackedBarSeries *q) : QAbstractBarSeriesPrivate(q) | |
57 | { |
|
68 | { | |
58 |
|
69 | |||
59 | } |
|
70 | } | |
60 |
|
71 | |||
61 | void QHorizontalStackedBarSeriesPrivate::scaleDomain(Domain& domain) |
|
72 | void QHorizontalStackedBarSeriesPrivate::scaleDomain(Domain& domain) | |
62 | { |
|
73 | { | |
63 | qreal minX(domain.minX()); |
|
74 | qreal minX(domain.minX()); | |
64 | qreal minY(domain.minY()); |
|
75 | qreal minY(domain.minY()); | |
65 | qreal maxX(domain.maxX()); |
|
76 | qreal maxX(domain.maxX()); | |
66 | qreal maxY(domain.maxY()); |
|
77 | qreal maxY(domain.maxY()); | |
67 |
|
78 | |||
68 | qreal y = categoryCount(); |
|
79 | qreal y = categoryCount(); | |
69 | minX = qMin(minX, bottom()); |
|
80 | minX = qMin(minX, bottom()); | |
70 | minY = qMin(minY, - (qreal)0.5); |
|
81 | minY = qMin(minY, - (qreal)0.5); | |
71 | maxX = qMax(maxX, top()); |
|
82 | maxX = qMax(maxX, top()); | |
72 | maxY = qMax(maxY, y - (qreal)0.5); |
|
83 | maxY = qMax(maxY, y - (qreal)0.5); | |
73 |
|
84 | |||
74 | domain.setRange(minX,maxX,minY,maxY); |
|
85 | domain.setRange(minX,maxX,minY,maxY); | |
75 | } |
|
86 | } | |
76 |
|
87 | |||
77 | ChartElement* QHorizontalStackedBarSeriesPrivate::createGraphics(ChartPresenter* presenter) |
|
88 | ChartElement* QHorizontalStackedBarSeriesPrivate::createGraphics(ChartPresenter* presenter) | |
78 | { |
|
89 | { | |
79 | Q_Q(QHorizontalStackedBarSeries); |
|
90 | Q_Q(QHorizontalStackedBarSeries); | |
80 |
|
91 | |||
81 | HorizontalStackedBarChartItem* bar = new HorizontalStackedBarChartItem(q,presenter); |
|
92 | HorizontalStackedBarChartItem* bar = new HorizontalStackedBarChartItem(q,presenter); | |
82 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { |
|
93 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { | |
83 | bar->setAnimation(new HorizontalStackedBarAnimation(bar)); |
|
94 | bar->setAnimation(new HorizontalStackedBarAnimation(bar)); | |
84 | } |
|
95 | } | |
85 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); |
|
96 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); | |
86 | return bar; |
|
97 | return bar; | |
87 | } |
|
98 | } | |
88 |
|
99 | |||
89 | #include "moc_qhorizontalstackedbarseries.cpp" |
|
100 | #include "moc_qhorizontalstackedbarseries.cpp" | |
90 |
|
101 | |||
91 | QTCOMMERCIALCHART_END_NAMESPACE |
|
102 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now