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 |
@@ -0,0 +1,39 | |||||
|
1 | /*! | |||
|
2 | \example examples/horizontalbarchart | |||
|
3 | \title HorizontalBarChart Example | |||
|
4 | \subtitle | |||
|
5 | ||||
|
6 | The example shows how to create a horizontal bar chart. HorizontalBarChart shows the data in sets as separate bars, which are grouped in categories. | |||
|
7 | ||||
|
8 | \image examples_horizontalbarchart.png | |||
|
9 | ||||
|
10 | Data that barchart visualizes, is defined by QBarSet instances. Here we create the sets and append data | |||
|
11 | to them. | |||
|
12 | ||||
|
13 | \snippet ../examples/horizontalbarchart/main.cpp 1 | |||
|
14 | ||||
|
15 | We create the series and append the sets to it. The horizontalbarseries groups the data from sets to categories. | |||
|
16 | First value of each set are gropuped together at first category second value to second category and so on. | |||
|
17 | ||||
|
18 | \snippet ../examples/horizontalbarchart/main.cpp 2 | |||
|
19 | ||||
|
20 | Then we create a chart and add the series to it. | |||
|
21 | ||||
|
22 | \snippet ../examples/horizontalbarchart/main.cpp 3 | |||
|
23 | ||||
|
24 | We define the categories here and add them to QCategoriesAxis which we then set to be the x-axis of the chart. | |||
|
25 | ||||
|
26 | \snippet ../examples/horizontalbarchart/main.cpp 4 | |||
|
27 | ||||
|
28 | And we also want to show the legend. | |||
|
29 | ||||
|
30 | \snippet ../examples/horizontalbarchart/main.cpp 5 | |||
|
31 | ||||
|
32 | Finally we add the chart onto a view. | |||
|
33 | ||||
|
34 | \snippet ../examples/horizontalbarchart/main.cpp 6 | |||
|
35 | ||||
|
36 | And it is ready to be shown in a window. | |||
|
37 | ||||
|
38 | \snippet ../examples/horizontalbarchart/main.cpp 7 | |||
|
39 | */ |
@@ -0,0 +1,17 | |||||
|
1 | /*! | |||
|
2 | \example examples/horizontalpercentbarchart | |||
|
3 | \title HorizontalPercentBarChart Example | |||
|
4 | \subtitle | |||
|
5 | ||||
|
6 | The example shows how to create simple horizontal percent bar chart. Horizontal percent bar chart shows the data in set as percentage of | |||
|
7 | all sets, per category. | |||
|
8 | ||||
|
9 | \image examples_horizontalpercentbarchart.png | |||
|
10 | ||||
|
11 | Creating horizontal percent bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a | |||
|
12 | horizontal percent bar chart, we use QHorizontalPercentBarSeries api instead of QBarSeries. Also, in the | |||
|
13 | \l {BarChart Example} {bar chart} we used nice numbers algorithm to make the y axis numbering look better. With | |||
|
14 | percent bar chart there is no need for that, because the maximum y-axis value is always 100. | |||
|
15 | ||||
|
16 | \snippet ../examples/horizontalpercentbarchart/main.cpp 3 | |||
|
17 | */ |
@@ -0,0 +1,15 | |||||
|
1 | /*! | |||
|
2 | \example examples/horizontalstackedbarchart | |||
|
3 | \title HorizontalStackedBarChart Example | |||
|
4 | \subtitle | |||
|
5 | ||||
|
6 | The example shows how to create simple stacked horizontal bar chart. Stacked bar chart shows the data in sets as bars that are | |||
|
7 | stacked on top of each other. The stacking is done per category. | |||
|
8 | ||||
|
9 | \image examples_horizontalstackedbarchart.png | |||
|
10 | ||||
|
11 | Creating stacked horizontal bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a | |||
|
12 | stacked horizontal bar chart, we use QHorizontalStackedBarSeries api instead of QBarSeries. | |||
|
13 | ||||
|
14 | \snippet ../examples/horizontalstackedbarchart/main.cpp 3 | |||
|
15 | */ |
@@ -1,86 +1,89 | |||||
1 | /*! |
|
1 | /*! | |
2 | \page classes.html |
|
2 | \page classes.html | |
3 | \title QtCommercial Charts API |
|
3 | \title QtCommercial Charts API | |
4 | \keyword All Classes |
|
4 | \keyword All Classes | |
5 |
|
5 | |||
6 | Charts API is build on top of Qt Graphics View Framework. Charts can be displayed as QGraphicsWidget using QChart class. However |
|
6 | Charts API is build on top of Qt Graphics View Framework. Charts can be displayed as QGraphicsWidget using QChart class. However | |
7 | there is also convenience class QChartView which is QWidget based. These lets quickly use QCharts as normal Qt widget. |
|
7 | there is also convenience class QChartView which is QWidget based. These lets quickly use QCharts as normal Qt widget. | |
8 |
|
8 | |||
9 | Each chart type is represented by QAbstractSeries derived class. To create given chart type users have to use instance of related series class and add it to QChart instance. |
|
9 | Each chart type is represented by QAbstractSeries derived class. To create given chart type users have to use instance of related series class and add it to QChart instance. | |
10 | \code |
|
10 | \code | |
11 | QLineSeries* series = new QLineSeries(); |
|
11 | QLineSeries* series = new QLineSeries(); | |
12 | series->add(0, 6); |
|
12 | series->add(0, 6); | |
13 | series->add(2, 4); |
|
13 | series->add(2, 4); | |
14 | ... |
|
14 | ... | |
15 | chartView->chart()->addSeries(series); |
|
15 | chartView->chart()->addSeries(series); | |
16 | chartView->chart()->createDefaultAxes(); |
|
16 | chartView->chart()->createDefaultAxes(); | |
17 | \endcode |
|
17 | \endcode | |
18 |
|
18 | |||
19 | \raw HTML |
|
19 | \raw HTML | |
20 | <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable"> |
|
20 | <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable"> | |
21 | <tr> |
|
21 | <tr> | |
22 | <th class="titleheader" width="25%"> |
|
22 | <th class="titleheader" width="25%"> | |
23 | Common and global |
|
23 | Common and global | |
24 | </th> |
|
24 | </th> | |
25 | <th class="titleheader" width="25%"> |
|
25 | <th class="titleheader" width="25%"> | |
26 | XY chart |
|
26 | XY chart | |
27 | </th> |
|
27 | </th> | |
28 | </tr> |
|
28 | </tr> | |
29 | <tr> |
|
29 | <tr> | |
30 | <td valign="top"> |
|
30 | <td valign="top"> | |
31 | <ul> |
|
31 | <ul> | |
32 | <li><a href="qchart.html">QChart</a></li> |
|
32 | <li><a href="qchart.html">QChart</a></li> | |
33 | <li><a href="qchartview.html">QChartView</a></li> |
|
33 | <li><a href="qchartview.html">QChartView</a></li> | |
34 | <li><a href="qabstractaxis.html">QAbstractAxis</a></li> |
|
34 | <li><a href="qabstractaxis.html">QAbstractAxis</a></li> | |
35 | <li><a href="qvaluesaxis.html">QValuesAxis</a></li> |
|
35 | <li><a href="qvaluesaxis.html">QValuesAxis</a></li> | |
36 | <li><a href="qbarcategoriesaxis.html">QBarCategoriesAxis</a></li> |
|
36 | <li><a href="qbarcategoriesaxis.html">QBarCategoriesAxis</a></li> | |
37 | <li><a href="qlegend.html">QLegend</a></li> |
|
37 | <li><a href="qlegend.html">QLegend</a></li> | |
38 | <li><a href="qabstractseries.html">QAbstractSeries</a></li> |
|
38 | <li><a href="qabstractseries.html">QAbstractSeries</a></li> | |
39 | <li><a href="qchartglobal.html">QChartGlobal</a></li> |
|
39 | <li><a href="qchartglobal.html">QChartGlobal</a></li> | |
40 | </ul> |
|
40 | </ul> | |
41 | </td> |
|
41 | </td> | |
42 | <td valign="top"> |
|
42 | <td valign="top"> | |
43 | <ul> |
|
43 | <ul> | |
44 | <li><a href="qxyseries.html">QXYSeries</a></li> |
|
44 | <li><a href="qxyseries.html">QXYSeries</a></li> | |
45 | <li><a href="qlineseries.html">QLineSeries</a></li> |
|
45 | <li><a href="qlineseries.html">QLineSeries</a></li> | |
46 | <li><a href="qareaseries.html">QAreaSeries</a></li> |
|
46 | <li><a href="qareaseries.html">QAreaSeries</a></li> | |
47 | <li><a href="qscatterseries.html">QScatterSeries</a></li> |
|
47 | <li><a href="qscatterseries.html">QScatterSeries</a></li> | |
48 | <li><a href="qsplineseries.html">QSplineSeries</a></li> |
|
48 | <li><a href="qsplineseries.html">QSplineSeries</a></li> | |
49 | <li><a href="qhxymodelmapper.html">QHXYModelMapper</a></li> |
|
49 | <li><a href="qhxymodelmapper.html">QHXYModelMapper</a></li> | |
50 | <li><a href="qvxymodelmapper.html">QVXYModelMapper</a></li> |
|
50 | <li><a href="qvxymodelmapper.html">QVXYModelMapper</a></li> | |
51 | </ul> |
|
51 | </ul> | |
52 | </td> |
|
52 | </td> | |
53 | </tr> |
|
53 | </tr> | |
54 | </table> |
|
54 | </table> | |
55 | <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable"> |
|
55 | <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable"> | |
56 | <tr> |
|
56 | <tr> | |
57 | <th class="titleheader" width="25%"> |
|
57 | <th class="titleheader" width="25%"> | |
58 | Pie chart |
|
58 | Pie chart | |
59 | </th> |
|
59 | </th> | |
60 | <th class="titleheader" width="25%"> |
|
60 | <th class="titleheader" width="25%"> | |
61 | Bar chart |
|
61 | Bar chart | |
62 | </th> |
|
62 | </th> | |
63 | <tr> |
|
63 | <tr> | |
64 | <td valign="top"> |
|
64 | <td valign="top"> | |
65 | <ul> |
|
65 | <ul> | |
66 | <li><a href="qpieseries.html">QPieSeries</a></li> |
|
66 | <li><a href="qpieseries.html">QPieSeries</a></li> | |
67 | <li><a href="qpieslice.html">QPieSlice</a></li> |
|
67 | <li><a href="qpieslice.html">QPieSlice</a></li> | |
68 | <li><a href="qhpiemodelmapper.html">QHPieModelMapper</a></li> |
|
68 | <li><a href="qhpiemodelmapper.html">QHPieModelMapper</a></li> | |
69 | <li><a href="qvpiemodelmapper.html">QVPieModelMapper</a></li> |
|
69 | <li><a href="qvpiemodelmapper.html">QVPieModelMapper</a></li> | |
70 | </ul> |
|
70 | </ul> | |
71 | </td> |
|
71 | </td> | |
72 | <td valign="top"> |
|
72 | <td valign="top"> | |
73 | <ul> |
|
73 | <ul> | |
74 | <li><a href="qbarseries.html">QBarSeries</a></li> |
|
74 | <li><a href="qbarseries.html">QBarSeries</a></li> | |
75 | <li><a href="qbarset.html">QBarSet</a></li> |
|
75 | <li><a href="qbarset.html">QBarSet</a></li> | |
76 | <li><a href="qpercentbarseries.html">QPercentBarSeries</a></li> |
|
76 | <li><a href="qpercentbarseries.html">QPercentBarSeries</a></li> | |
77 | <li><a href="qstackedbarseries.html">QStackedBarSeries</a></li> |
|
77 | <li><a href="qstackedbarseries.html">QStackedBarSeries</a></li> | |
78 | <li><a href="qhbarmodelmapper.html">QHBarModelMapper</a></li> |
|
78 | <li><a href="qhbarmodelmapper.html">QHBarModelMapper</a></li> | |
79 | <li><a href="qvbarmodelmapper.html">QVBarModelMapper</a></li> |
|
79 | <li><a href="qvbarmodelmapper.html">QVBarModelMapper</a></li> | |
|
80 | <li><a href="qhorizontalbarseries.html">QHorizontalBarSeries</a></li> | |||
|
81 | <li><a href="qhorizontalstackedbarseries.html">QHorizontalStackedBarSeries</a></li> | |||
|
82 | <li><a href="qhorizontalpercentbarseries.html">QHorizontalPercentBarSeries</a></li> | |||
80 | </ul> |
|
83 | </ul> | |
81 | </td> |
|
84 | </td> | |
82 | </tr> |
|
85 | </tr> | |
83 | </table> |
|
86 | </table> | |
84 | \endraw |
|
87 | \endraw | |
85 |
|
88 | |||
86 | */ |
|
89 | */ |
@@ -1,39 +1,42 | |||||
1 | /*! |
|
1 | /*! | |
2 | \page examples.html |
|
2 | \page examples.html | |
3 | \title Examples |
|
3 | \title Examples | |
4 | \keyword Examples |
|
4 | \keyword Examples | |
5 |
|
5 | |||
6 | \raw HTML |
|
6 | \raw HTML | |
7 | <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable"> |
|
7 | <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable"> | |
8 | <tr> |
|
8 | <tr> | |
9 | <th class="titleheader" width="33%"> |
|
9 | <th class="titleheader" width="33%"> | |
10 | List of examples |
|
10 | List of examples | |
11 | </th> |
|
11 | </th> | |
12 | </tr> |
|
12 | </tr> | |
13 | <tr> |
|
13 | <tr> | |
14 | <td valign="top"> |
|
14 | <td valign="top"> | |
15 | <ul> |
|
15 | <ul> | |
16 | <li><a href="examples-areachart.html">Area chart</a></li> |
|
16 | <li><a href="examples-areachart.html">Area chart</a></li> | |
17 | <li><a href="examples-barchart.html">Bar chart</a></li> |
|
17 | <li><a href="examples-barchart.html">Bar chart</a></li> | |
18 | <li><a href="examples-customchart.html">Custom chart</a></li> |
|
18 | <li><a href="examples-customchart.html">Custom chart</a></li> | |
|
19 | <li><a href="examples-horizontalbarchart.html">Horizontal bar chart</a></li> | |||
|
20 | <li><a href="examples-horizontalstackedbarchart.html">Horizontal stacked bar chart</a></li> | |||
|
21 | <li><a href="examples-horizontalpercentbarchart.html">Horizontal percent bar chart</a></li> | |||
19 | <li><a href="examples-legend.html">Legend</a></li> |
|
22 | <li><a href="examples-legend.html">Legend</a></li> | |
20 | <li><a href="examples-linechart.html">Line chart</a></li> |
|
23 | <li><a href="examples-linechart.html">Line chart</a></li> | |
21 | <li><a href="examples-lineandbar.html">Line and barchart</a></li> |
|
24 | <li><a href="examples-lineandbar.html">Line and barchart</a></li> | |
22 | <li><a href="examples-modeldata.html">Model data</a></li> |
|
25 | <li><a href="examples-modeldata.html">Model data</a></li> | |
23 | <li><a href="examples-barmodelmapper.html">Bar chart from model</a></li> |
|
26 | <li><a href="examples-barmodelmapper.html">Bar chart from model</a></li> | |
24 | <li><a href="examples-percentbarchart.html">Percent bar chart</a></li> |
|
27 | <li><a href="examples-percentbarchart.html">Percent bar chart</a></li> | |
25 | <li><a href="examples-piechart.html">Pie chart</a></li> |
|
28 | <li><a href="examples-piechart.html">Pie chart</a></li> | |
26 | <li><a href="examples-piechartdrilldown.html">Pie chart drilldown</a></li> |
|
29 | <li><a href="examples-piechartdrilldown.html">Pie chart drilldown</a></li> | |
27 | <li><a href="examples-presenterchart.html">Presenter chart</a></li> |
|
30 | <li><a href="examples-presenterchart.html">Presenter chart</a></li> | |
28 | <li><a href="examples-scatterchart.html">Scatter chart</a></li> |
|
31 | <li><a href="examples-scatterchart.html">Scatter chart</a></li> | |
29 | <li><a href="examples-scatterinteractions.html">Scatter interactions</a></li> |
|
32 | <li><a href="examples-scatterinteractions.html">Scatter interactions</a></li> | |
30 | <li><a href="examples-splinechart.html">Spline chart</a></li> |
|
33 | <li><a href="examples-splinechart.html">Spline chart</a></li> | |
31 | <li><a href="examples-stackedbarchart.html">Stacked bar chart</a></li> |
|
34 | <li><a href="examples-stackedbarchart.html">Stacked bar chart</a></li> | |
32 | <li><a href="examples-stackedbarchartdrilldown.html">Stacked bar chart drilldown</a></li> |
|
35 | <li><a href="examples-stackedbarchartdrilldown.html">Stacked bar chart drilldown</a></li> | |
33 | <li><a href="examples-zoomlinechart.html">Zoom line</a></li> |
|
36 | <li><a href="examples-zoomlinechart.html">Zoom line</a></li> | |
34 | </ul> |
|
37 | </ul> | |
35 | </td> |
|
38 | </td> | |
36 | </tr> |
|
39 | </tr> | |
37 | </table> |
|
40 | </table> | |
38 | \endraw |
|
41 | \endraw | |
39 | */ |
|
42 | */ |
@@ -1,82 +1,111 | |||||
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 "qbarcategoriesaxis.h" |
|
25 | #include "qbarcategoriesaxis.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 | /*! | |||
|
34 | \class QHorizontalBarSeries | |||
|
35 | \brief Series for creating horizontal bar chart | |||
|
36 | \mainclass | |||
|
37 | ||||
|
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 | |||
|
40 | from sets to categories, which are defined by a QStringList. | |||
|
41 | ||||
|
42 | See the \l {HorizontalBarChart Example} {horizontal bar chart example} to learn how to create a horizontal bar chart. | |||
|
43 | \image examples_horizontalbarchart.png | |||
|
44 | ||||
|
45 | \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalStackedBarSeries, QHorizontalPercentBarSeries | |||
|
46 | */ | |||
|
47 | /* | |||
|
48 | // TODO: | |||
|
49 | \qmlclass Horizontal QHorizontalBarSeries | |||
|
50 | \inherits AbstractBarSeries | |||
|
51 | ||||
|
52 | The following QML shows how to create a simple grouped bar chart: | |||
|
53 | \snippet ../demos/qmlchart/qml/qmlchart/View6.qml 1 | |||
|
54 | \beginfloatleft | |||
|
55 | \image demos_qmlchart6.png | |||
|
56 | \endfloat | |||
|
57 | \clearfloat | |||
|
58 | */ | |||
|
59 | ||||
|
60 | ||||
|
61 | ||||
33 | QHorizontalBarSeries::QHorizontalBarSeries(QObject *parent) : |
|
62 | QHorizontalBarSeries::QHorizontalBarSeries(QObject *parent) : | |
34 | QAbstractBarSeries(*new QHorizontalBarSeriesPrivate(this), parent) |
|
63 | QAbstractBarSeries(*new QHorizontalBarSeriesPrivate(this), parent) | |
35 | { |
|
64 | { | |
36 | } |
|
65 | } | |
37 |
|
66 | |||
38 | QAbstractSeries::SeriesType QHorizontalBarSeries::type() const |
|
67 | QAbstractSeries::SeriesType QHorizontalBarSeries::type() const | |
39 | { |
|
68 | { | |
40 | return QAbstractSeries::SeriesTypeHorizontalBar; |
|
69 | return QAbstractSeries::SeriesTypeHorizontalBar; | |
41 | } |
|
70 | } | |
42 |
|
71 | |||
43 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
72 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
44 |
|
73 | |||
45 | QHorizontalBarSeriesPrivate::QHorizontalBarSeriesPrivate(QHorizontalBarSeries *q) : QAbstractBarSeriesPrivate(q) |
|
74 | QHorizontalBarSeriesPrivate::QHorizontalBarSeriesPrivate(QHorizontalBarSeries *q) : QAbstractBarSeriesPrivate(q) | |
46 | { |
|
75 | { | |
47 |
|
76 | |||
48 | } |
|
77 | } | |
49 |
|
78 | |||
50 | void QHorizontalBarSeriesPrivate::scaleDomain(Domain& domain) |
|
79 | void QHorizontalBarSeriesPrivate::scaleDomain(Domain& domain) | |
51 | { |
|
80 | { | |
52 | qreal minX(domain.minX()); |
|
81 | qreal minX(domain.minX()); | |
53 | qreal minY(domain.minY()); |
|
82 | qreal minY(domain.minY()); | |
54 | qreal maxX(domain.maxX()); |
|
83 | qreal maxX(domain.maxX()); | |
55 | qreal maxY(domain.maxY()); |
|
84 | qreal maxY(domain.maxY()); | |
56 |
|
85 | |||
57 | qreal y = categoryCount(); |
|
86 | qreal y = categoryCount(); | |
58 | qreal x = max(); |
|
87 | qreal x = max(); | |
59 | minX = qMin(minX, x); |
|
88 | minX = qMin(minX, x); | |
60 | minY = qMin(minY, - (qreal)0.5); |
|
89 | minY = qMin(minY, - (qreal)0.5); | |
61 | maxX = qMax(maxX, x); |
|
90 | maxX = qMax(maxX, x); | |
62 | maxY = qMax(maxY, y - (qreal)0.5); |
|
91 | maxY = qMax(maxY, y - (qreal)0.5); | |
63 |
|
92 | |||
64 | domain.setRange(minX,maxX,minY,maxY); |
|
93 | domain.setRange(minX,maxX,minY,maxY); | |
65 | } |
|
94 | } | |
66 |
|
95 | |||
67 | Chart* QHorizontalBarSeriesPrivate::createGraphics(ChartPresenter* presenter) |
|
96 | Chart* QHorizontalBarSeriesPrivate::createGraphics(ChartPresenter* presenter) | |
68 | { |
|
97 | { | |
69 | Q_Q(QHorizontalBarSeries); |
|
98 | Q_Q(QHorizontalBarSeries); | |
70 |
|
99 | |||
71 | HorizontalBarChartItem* bar = new HorizontalBarChartItem(q,presenter); |
|
100 | HorizontalBarChartItem* bar = new HorizontalBarChartItem(q,presenter); | |
72 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { |
|
101 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { | |
73 | bar->setAnimator(presenter->animator()); |
|
102 | bar->setAnimator(presenter->animator()); | |
74 | bar->setAnimation(new HorizontalBarAnimation(bar)); |
|
103 | bar->setAnimation(new HorizontalBarAnimation(bar)); | |
75 | } |
|
104 | } | |
76 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); |
|
105 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); | |
77 | return bar; |
|
106 | return bar; | |
78 | } |
|
107 | } | |
79 |
|
108 | |||
80 | #include "moc_qhorizontalbarseries.cpp" |
|
109 | #include "moc_qhorizontalbarseries.cpp" | |
81 |
|
110 | |||
82 | QTCOMMERCIALCHART_END_NAMESPACE |
|
111 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,62 +1,61 | |||||
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 | QHorizontalPercentBarSeries::QHorizontalPercentBarSeries(QObject *parent) : |
|
11 | QHorizontalPercentBarSeries::QHorizontalPercentBarSeries(QObject *parent) : | |
12 | QAbstractBarSeries(*new QHorizontalPercentBarSeriesPrivate(this), parent) |
|
12 | QAbstractBarSeries(*new QHorizontalPercentBarSeriesPrivate(this), parent) | |
13 | { |
|
13 | { | |
14 | } |
|
14 | } | |
15 |
|
15 | |||
16 | QAbstractSeries::SeriesType QHorizontalPercentBarSeries::type() const |
|
16 | QAbstractSeries::SeriesType QHorizontalPercentBarSeries::type() const | |
17 | { |
|
17 | { | |
18 | return QAbstractSeries::SeriesTypeHorizontalPercentBar; |
|
18 | return QAbstractSeries::SeriesTypeHorizontalPercentBar; | |
19 | } |
|
19 | } | |
20 |
|
20 | |||
21 |
|
21 | |||
22 |
|
22 | |||
23 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
23 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
24 |
|
24 | |||
25 | QHorizontalPercentBarSeriesPrivate::QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries *q) : QAbstractBarSeriesPrivate(q) |
|
25 | QHorizontalPercentBarSeriesPrivate::QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries *q) : QAbstractBarSeriesPrivate(q) | |
26 | { |
|
26 | { | |
27 |
|
27 | |||
28 | } |
|
28 | } | |
29 |
|
29 | |||
30 | void QHorizontalPercentBarSeriesPrivate::scaleDomain(Domain& domain) |
|
30 | void QHorizontalPercentBarSeriesPrivate::scaleDomain(Domain& domain) | |
31 | { |
|
31 | { | |
32 | qreal minX(domain.minX()); |
|
32 | qreal minX(domain.minX()); | |
33 | qreal minY(domain.minY()); |
|
33 | qreal minY(domain.minY()); | |
34 | qreal maxX(domain.maxX()); |
|
34 | qreal maxX(domain.maxX()); | |
35 | qreal maxY(domain.maxY()); |
|
35 | qreal maxY(domain.maxY()); | |
36 |
|
36 | |||
37 | qreal y = categoryCount(); |
|
37 | qreal y = categoryCount(); | |
38 | minX = 0; |
|
38 | minX = 0; | |
39 | maxX = 100; |
|
39 | maxX = 100; | |
40 | minY = qMin(minY, - (qreal)0.5); |
|
40 | minY = qMin(minY, - (qreal)0.5); | |
41 | maxY = qMax(maxY, y - (qreal)0.5); |
|
41 | maxY = qMax(maxY, y - (qreal)0.5); | |
42 |
|
42 | |||
43 | domain.setRange(minX,maxX,minY,maxY); |
|
43 | domain.setRange(minX,maxX,minY,maxY); | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | Chart* QHorizontalPercentBarSeriesPrivate::createGraphics(ChartPresenter* presenter) |
|
46 | Chart* QHorizontalPercentBarSeriesPrivate::createGraphics(ChartPresenter* presenter) | |
47 | { |
|
47 | { | |
48 | Q_Q(QHorizontalPercentBarSeries); |
|
48 | Q_Q(QHorizontalPercentBarSeries); | |
49 |
|
49 | |||
50 | HorizontalPercentBarChartItem* bar = new HorizontalPercentBarChartItem(q,presenter); |
|
50 | HorizontalPercentBarChartItem* bar = new HorizontalPercentBarChartItem(q,presenter); | |
51 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { |
|
51 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { | |
52 | bar->setAnimator(presenter->animator()); |
|
52 | bar->setAnimator(presenter->animator()); | |
53 | bar->setAnimation(new HorizontalPercentBarAnimation(bar)); |
|
53 | bar->setAnimation(new HorizontalPercentBarAnimation(bar)); | |
54 | } |
|
54 | } | |
55 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); |
|
55 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); | |
56 | return bar; |
|
56 | return bar; | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 |
|
||||
60 | #include "moc_qhorizontalpercentbarseries.cpp" |
|
59 | #include "moc_qhorizontalpercentbarseries.cpp" | |
61 |
|
60 | |||
62 | QTCOMMERCIALCHART_END_NAMESPACE |
|
61 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,101 +1,101 | |||||
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 | // W A R N I N G |
|
21 | // W A R N I N G | |
22 | // ------------- |
|
22 | // ------------- | |
23 | // |
|
23 | // | |
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
25 | // implementation detail. This header file may change from version to |
|
25 | // implementation detail. This header file may change from version to | |
26 | // version without notice, or even be removed. |
|
26 | // version without notice, or even be removed. | |
27 | // |
|
27 | // | |
28 | // We mean it. |
|
28 | // We mean it. | |
29 |
|
29 | |||
30 | #ifndef QABSTRACTBARSERIES_P_H |
|
30 | #ifndef QABSTRACTBARSERIES_P_H | |
31 | #define QABSTRACTBARSERIES_P_H |
|
31 | #define QABSTRACTBARSERIES_P_H | |
32 |
|
32 | |||
33 | #include "qabstractbarseries.h" |
|
33 | #include "qabstractbarseries.h" | |
34 | #include "qabstractseries_p.h" |
|
34 | #include "qabstractseries_p.h" | |
35 | #include <QStringList> |
|
35 | #include <QStringList> | |
36 | #include <QAbstractSeries> |
|
36 | #include <QAbstractSeries> | |
37 |
|
37 | |||
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
39 |
|
39 | |||
40 | class QBarModelMapper; |
|
40 | class QBarModelMapper; | |
41 | class QBarCategoriesAxis; |
|
41 | class QBarCategoriesAxis; | |
42 |
|
42 | |||
43 | class QAbstractBarSeriesPrivate : public QAbstractSeriesPrivate |
|
43 | class QAbstractBarSeriesPrivate : public QAbstractSeriesPrivate | |
44 | { |
|
44 | { | |
45 | Q_OBJECT |
|
45 | Q_OBJECT | |
46 | public: |
|
46 | public: | |
47 | QAbstractBarSeriesPrivate(QAbstractBarSeries *parent); |
|
47 | QAbstractBarSeriesPrivate(QAbstractBarSeries *parent); | |
48 | int categoryCount() const; |
|
48 | int categoryCount() const; | |
49 |
|
49 | |||
50 | void setBarWidth(qreal width); |
|
50 | void setBarWidth(qreal width); | |
51 | qreal barWidth() const; |
|
51 | qreal barWidth() const; | |
52 |
|
52 | |||
53 | void setVisible(bool visible); |
|
53 | void setVisible(bool visible); | |
54 | void setLabelsVisible(bool visible); |
|
54 | void setLabelsVisible(bool visible); | |
55 |
|
55 | |||
56 | void scaleDomain(Domain& domain); |
|
56 | void scaleDomain(Domain& domain); | |
57 | Chart* createGraphics(ChartPresenter* presenter); |
|
57 | Chart* createGraphics(ChartPresenter* presenter); | |
58 | QList<LegendMarker*> createLegendMarker(QLegend* legend); |
|
58 | QList<LegendMarker*> createLegendMarker(QLegend* legend); | |
59 |
|
59 | |||
60 | void initializeAxis(QAbstractAxis* axis); |
|
60 | void initializeAxis(QAbstractAxis* axis); | |
61 | QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const; |
|
61 | virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const; | |
62 |
|
62 | |||
63 | bool append(QBarSet *set); |
|
63 | bool append(QBarSet *set); | |
64 | bool remove(QBarSet *set); |
|
64 | bool remove(QBarSet *set); | |
65 | bool append(QList<QBarSet* > sets); |
|
65 | bool append(QList<QBarSet* > sets); | |
66 | bool remove(QList<QBarSet* > sets); |
|
66 | bool remove(QList<QBarSet* > sets); | |
67 | bool insert(int index, QBarSet *set); |
|
67 | bool insert(int index, QBarSet *set); | |
68 |
|
68 | |||
69 | QBarSet* barsetAt(int index); |
|
69 | QBarSet* barsetAt(int index); | |
70 | qreal min(); |
|
70 | qreal min(); | |
71 | qreal max(); |
|
71 | qreal max(); | |
72 | qreal valueAt(int set, int category); |
|
72 | qreal valueAt(int set, int category); | |
73 | qreal percentageAt(int set, int category); |
|
73 | qreal percentageAt(int set, int category); | |
74 | qreal categorySum(int category); |
|
74 | qreal categorySum(int category); | |
75 | qreal absoluteCategorySum(int category); |
|
75 | qreal absoluteCategorySum(int category); | |
76 | qreal maxCategorySum(); |
|
76 | qreal maxCategorySum(); | |
77 | qreal minX(); |
|
77 | qreal minX(); | |
78 | qreal maxX(); |
|
78 | qreal maxX(); | |
79 |
|
79 | |||
80 | Q_SIGNALS: |
|
80 | Q_SIGNALS: | |
81 | void clicked(int index, QBarSet *barset); |
|
81 | void clicked(int index, QBarSet *barset); | |
82 | void updatedBars(); |
|
82 | void updatedBars(); | |
83 | void restructuredBars(); |
|
83 | void restructuredBars(); | |
84 | void labelsVisibleChanged(bool visible); |
|
84 | void labelsVisibleChanged(bool visible); | |
85 |
|
85 | |||
86 | private: |
|
86 | private: | |
87 | void populateCategories(QBarCategoriesAxis* axis); |
|
87 | void populateCategories(QBarCategoriesAxis* axis); | |
88 |
|
88 | |||
89 | protected: |
|
89 | protected: | |
90 | QList<QBarSet *> m_barSets; |
|
90 | QList<QBarSet *> m_barSets; | |
91 | qreal m_barWidth; |
|
91 | qreal m_barWidth; | |
92 | bool m_labelsVisible; |
|
92 | bool m_labelsVisible; | |
93 | bool m_visible; |
|
93 | bool m_visible; | |
94 |
|
94 | |||
95 | private: |
|
95 | private: | |
96 | Q_DECLARE_PUBLIC(QAbstractBarSeries) |
|
96 | Q_DECLARE_PUBLIC(QAbstractBarSeries) | |
97 | }; |
|
97 | }; | |
98 |
|
98 | |||
99 | QTCOMMERCIALCHART_END_NAMESPACE |
|
99 | QTCOMMERCIALCHART_END_NAMESPACE | |
100 |
|
100 | |||
101 | #endif // QABSTRACTBARSERIES_P_H |
|
101 | #endif // QABSTRACTBARSERIES_P_H |
@@ -1,206 +1,209 | |||||
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 "qabstractseries.h" |
|
21 | #include "qabstractseries.h" | |
22 | #include "qabstractseries_p.h" |
|
22 | #include "qabstractseries_p.h" | |
23 | #include "chartdataset_p.h" |
|
23 | #include "chartdataset_p.h" | |
24 |
|
24 | |||
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
26 |
|
26 | |||
27 | /*! |
|
27 | /*! | |
28 | \class QAbstractSeries |
|
28 | \class QAbstractSeries | |
29 | \brief Base class for all QtCommercial Chart series. |
|
29 | \brief Base class for all QtCommercial Chart series. | |
30 | \mainclass |
|
30 | \mainclass | |
31 |
|
31 | |||
32 | Usually you use the series type specific inherited classes instead of the base class. |
|
32 | Usually you use the series type specific inherited classes instead of the base class. | |
33 | \sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QStackedBarSeries, |
|
33 | \sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QStackedBarSeries, | |
34 | QPercentBarSeries, QPieSeries |
|
34 | QPercentBarSeries, QPieSeries | |
35 | */ |
|
35 | */ | |
36 | /*! |
|
36 | /*! | |
37 | \qmlclass AbstractSeries |
|
37 | \qmlclass AbstractSeries | |
38 | AbstractSeries is the base class for all series. |
|
38 | AbstractSeries is the base class for all series. | |
39 | The class cannot be instantiated by the user. |
|
39 | The class cannot be instantiated by the user. | |
40 | */ |
|
40 | */ | |
41 |
|
41 | |||
42 | /*! |
|
42 | /*! | |
43 | \enum QAbstractSeries::SeriesType |
|
43 | \enum QAbstractSeries::SeriesType | |
44 |
|
44 | |||
45 | The type of the series object. |
|
45 | The type of the series object. | |
46 |
|
46 | |||
47 | \value SeriesTypeLine |
|
47 | \value SeriesTypeLine | |
48 | \value SeriesTypeArea |
|
48 | \value SeriesTypeArea | |
49 | \value SeriesTypeBar |
|
49 | \value SeriesTypeBar | |
50 | \value SeriesTypeStackedBar |
|
50 | \value SeriesTypeStackedBar | |
51 | \value SeriesTypePercentBar |
|
51 | \value SeriesTypePercentBar | |
52 | \value SeriesTypePie |
|
52 | \value SeriesTypePie | |
53 | \value SeriesTypeScatter |
|
53 | \value SeriesTypeScatter | |
54 | \value SeriesTypeSpline |
|
54 | \value SeriesTypeSpline | |
|
55 | \value SeriesTypeHorizontalBar | |||
|
56 | \value SeriesTypeHorizontalStackedBar | |||
|
57 | \value SeriesTypeHorizontalPercentBar | |||
55 | */ |
|
58 | */ | |
56 |
|
59 | |||
57 | /*! |
|
60 | /*! | |
58 | \property QAbstractSeries::type |
|
61 | \property QAbstractSeries::type | |
59 | The type of the series. |
|
62 | The type of the series. | |
60 | */ |
|
63 | */ | |
61 | /*! |
|
64 | /*! | |
62 | \qmlproperty ChartView.SeriesType AbstractSeries::type |
|
65 | \qmlproperty ChartView.SeriesType AbstractSeries::type | |
63 | The type of the series. |
|
66 | The type of the series. | |
64 | */ |
|
67 | */ | |
65 |
|
68 | |||
66 | /*! |
|
69 | /*! | |
67 | \property QAbstractSeries::name |
|
70 | \property QAbstractSeries::name | |
68 | \brief name of the series property. The name is shown in legend for QXYSeries. |
|
71 | \brief name of the series property. The name is shown in legend for QXYSeries. | |
69 | */ |
|
72 | */ | |
70 | /*! |
|
73 | /*! | |
71 | \qmlproperty string AbstractSeries::name |
|
74 | \qmlproperty string AbstractSeries::name | |
72 | Name of the series. The name is shown in legend for QXYSeries. |
|
75 | Name of the series. The name is shown in legend for QXYSeries. | |
73 | */ |
|
76 | */ | |
74 |
|
77 | |||
75 | /*! |
|
78 | /*! | |
76 | \fn void QAbstractSeries::nameChanged() |
|
79 | \fn void QAbstractSeries::nameChanged() | |
77 | This signal is emitted when the series name changes. |
|
80 | This signal is emitted when the series name changes. | |
78 | */ |
|
81 | */ | |
79 | /*! |
|
82 | /*! | |
80 | \qmlsignal AbstractSeries::onNameChanged() |
|
83 | \qmlsignal AbstractSeries::onNameChanged() | |
81 | This signal is emitted when the series name changes. |
|
84 | This signal is emitted when the series name changes. | |
82 | */ |
|
85 | */ | |
83 |
|
86 | |||
84 | /*! |
|
87 | /*! | |
85 | \property QAbstractSeries::visible |
|
88 | \property QAbstractSeries::visible | |
86 | \brief whether the series is visible or not; true by default. |
|
89 | \brief whether the series is visible or not; true by default. | |
87 | */ |
|
90 | */ | |
88 | /*! |
|
91 | /*! | |
89 | \qmlproperty void AbstractSeries::visible |
|
92 | \qmlproperty void AbstractSeries::visible | |
90 | Visibility of the series. True by default. |
|
93 | Visibility of the series. True by default. | |
91 | */ |
|
94 | */ | |
92 |
|
95 | |||
93 | /*! |
|
96 | /*! | |
94 | \fn void QAbstractSeries::visibleChanged() |
|
97 | \fn void QAbstractSeries::visibleChanged() | |
95 | Emitted when the series visibility changes. |
|
98 | Emitted when the series visibility changes. | |
96 | */ |
|
99 | */ | |
97 | /*! |
|
100 | /*! | |
98 | \qmlsignal AbstractSeries::onVisibleChanged() |
|
101 | \qmlsignal AbstractSeries::onVisibleChanged() | |
99 | Emitted when the series visibility changes. |
|
102 | Emitted when the series visibility changes. | |
100 | */ |
|
103 | */ | |
101 | /*! |
|
104 | /*! | |
102 | \internal |
|
105 | \internal | |
103 | \brief Constructs ChartSeries object with \a parent. |
|
106 | \brief Constructs ChartSeries object with \a parent. | |
104 | */ |
|
107 | */ | |
105 | QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) : |
|
108 | QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) : | |
106 | QObject(parent), |
|
109 | QObject(parent), | |
107 | d_ptr(&d) |
|
110 | d_ptr(&d) | |
108 | { |
|
111 | { | |
109 | } |
|
112 | } | |
110 |
|
113 | |||
111 | /*! |
|
114 | /*! | |
112 | \brief Virtual destructor for the chart series. |
|
115 | \brief Virtual destructor for the chart series. | |
113 | */ |
|
116 | */ | |
114 | QAbstractSeries::~QAbstractSeries() |
|
117 | QAbstractSeries::~QAbstractSeries() | |
115 | { |
|
118 | { | |
116 | if(d_ptr->m_dataset) qFatal("Still binded series detected !"); |
|
119 | if(d_ptr->m_dataset) qFatal("Still binded series detected !"); | |
117 | } |
|
120 | } | |
118 |
|
121 | |||
119 | void QAbstractSeries::setName(const QString& name) |
|
122 | void QAbstractSeries::setName(const QString& name) | |
120 | { |
|
123 | { | |
121 | if (name != d_ptr->m_name) { |
|
124 | if (name != d_ptr->m_name) { | |
122 | d_ptr->m_name = name; |
|
125 | d_ptr->m_name = name; | |
123 | emit nameChanged(); |
|
126 | emit nameChanged(); | |
124 | } |
|
127 | } | |
125 | } |
|
128 | } | |
126 |
|
129 | |||
127 | QString QAbstractSeries::name() const |
|
130 | QString QAbstractSeries::name() const | |
128 | { |
|
131 | { | |
129 | return d_ptr->m_name; |
|
132 | return d_ptr->m_name; | |
130 | } |
|
133 | } | |
131 |
|
134 | |||
132 | /*! |
|
135 | /*! | |
133 | Sets the visibility of series to \a visible |
|
136 | Sets the visibility of series to \a visible | |
134 | */ |
|
137 | */ | |
135 | void QAbstractSeries::setVisible(bool visible) |
|
138 | void QAbstractSeries::setVisible(bool visible) | |
136 | { |
|
139 | { | |
137 | if (visible != d_ptr->m_visible) { |
|
140 | if (visible != d_ptr->m_visible) { | |
138 | d_ptr->m_visible = visible; |
|
141 | d_ptr->m_visible = visible; | |
139 | emit visibleChanged(); |
|
142 | emit visibleChanged(); | |
140 | } |
|
143 | } | |
141 | } |
|
144 | } | |
142 |
|
145 | |||
143 | /*! |
|
146 | /*! | |
144 | Returns the visibility of series |
|
147 | Returns the visibility of series | |
145 | */ |
|
148 | */ | |
146 | bool QAbstractSeries::isVisible() const |
|
149 | bool QAbstractSeries::isVisible() const | |
147 | { |
|
150 | { | |
148 | return d_ptr->m_visible; |
|
151 | return d_ptr->m_visible; | |
149 | } |
|
152 | } | |
150 |
|
153 | |||
151 | /*! |
|
154 | /*! | |
152 | \brief Returns the chart where series belongs to. |
|
155 | \brief Returns the chart where series belongs to. | |
153 |
|
156 | |||
154 | Set automatically when the series is added to the chart |
|
157 | Set automatically when the series is added to the chart | |
155 | and unset when the series is removed from the chart. |
|
158 | and unset when the series is removed from the chart. | |
156 | */ |
|
159 | */ | |
157 | QChart* QAbstractSeries::chart() const |
|
160 | QChart* QAbstractSeries::chart() const | |
158 | { |
|
161 | { | |
159 | return d_ptr->m_chart; |
|
162 | return d_ptr->m_chart; | |
160 | } |
|
163 | } | |
161 |
|
164 | |||
162 | //void QAbstractSeries::adjustView() |
|
165 | //void QAbstractSeries::adjustView() | |
163 | //{ |
|
166 | //{ | |
164 | // //TODO: |
|
167 | // //TODO: | |
165 | //} |
|
168 | //} | |
166 |
|
169 | |||
167 | /*! |
|
170 | /*! | |
168 | \brief Sets the visibility of the series to true |
|
171 | \brief Sets the visibility of the series to true | |
169 |
|
172 | |||
170 | \sa setVisible(), isVisible() |
|
173 | \sa setVisible(), isVisible() | |
171 | */ |
|
174 | */ | |
172 | void QAbstractSeries::show() |
|
175 | void QAbstractSeries::show() | |
173 | { |
|
176 | { | |
174 | setVisible(true); |
|
177 | setVisible(true); | |
175 | } |
|
178 | } | |
176 |
|
179 | |||
177 | /*! |
|
180 | /*! | |
178 | \brief Sets the visibility of the series to false |
|
181 | \brief Sets the visibility of the series to false | |
179 |
|
182 | |||
180 | \sa setVisible(), isVisible() |
|
183 | \sa setVisible(), isVisible() | |
181 | */ |
|
184 | */ | |
182 | void QAbstractSeries::hide() |
|
185 | void QAbstractSeries::hide() | |
183 | { |
|
186 | { | |
184 | setVisible(false); |
|
187 | setVisible(false); | |
185 | } |
|
188 | } | |
186 |
|
189 | |||
187 | /////////////////////////////////////////////////////////////////////////////////////////////////// |
|
190 | /////////////////////////////////////////////////////////////////////////////////////////////////// | |
188 |
|
191 | |||
189 | QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries* q): |
|
192 | QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries* q): | |
190 | q_ptr(q), |
|
193 | q_ptr(q), | |
191 | m_chart(0), |
|
194 | m_chart(0), | |
192 | m_dataset(0), |
|
195 | m_dataset(0), | |
193 | m_visible(true) |
|
196 | m_visible(true) | |
194 | { |
|
197 | { | |
195 | } |
|
198 | } | |
196 |
|
199 | |||
197 | QAbstractSeriesPrivate::~QAbstractSeriesPrivate() |
|
200 | QAbstractSeriesPrivate::~QAbstractSeriesPrivate() | |
198 | { |
|
201 | { | |
199 | } |
|
202 | } | |
200 |
|
203 | |||
201 | #include "moc_qabstractseries.cpp" |
|
204 | #include "moc_qabstractseries.cpp" | |
202 | #include "moc_qabstractseries_p.cpp" |
|
205 | #include "moc_qabstractseries_p.cpp" | |
203 |
|
206 | |||
204 | QTCOMMERCIALCHART_END_NAMESPACE |
|
207 | QTCOMMERCIALCHART_END_NAMESPACE | |
205 |
|
208 | |||
206 |
|
209 |
General Comments 0
You need to be logged in to leave comments.
Login now