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 example/percentbarchart | |||
|
3 | \title PercentBarChart Example | |||
|
4 | \subtitle | |||
|
5 | ||||
|
6 | The example shows how to create simple percent bar chart. Percent bar chart shows the data in set as percentage of all sets, per category. | |||
|
7 | ||||
|
8 | \image percentbarchart.png | |||
|
9 | ||||
|
10 | First we define categories. | |||
|
11 | ||||
|
12 | \snippet ../example/percentbarchart/main.cpp 1 | |||
|
13 | ||||
|
14 | Data that barchart visualizes, is defined by QBarSet instances. Here we create some sets and append data | |||
|
15 | we want to visulaize to them. | |||
|
16 | ||||
|
17 | \snippet ../example/percentbarchart/main.cpp 2 | |||
|
18 | ||||
|
19 | To combine the sets and categories to a chart, we need to create QBarSeries instance. When creating | |||
|
20 | the QBarSeries, the categories must be known. Sets can be added later. For example purposes the sets | |||
|
21 | are added to series here. | |||
|
22 | ||||
|
23 | \snippet ../example/percentbarchart/main.cpp 3 | |||
|
24 | ||||
|
25 | We want our barchart to behave so, that when mouse is hovered over bar, the name of set which the bar | |||
|
26 | represents is shown as tooltip. | |||
|
27 | Also when we click the bar, floating values for the set are toggled. Floating values are the data values | |||
|
28 | that are drawn on top of bars. | |||
|
29 | ||||
|
30 | \snippet ../example/percentbarchart/main.cpp 4 | |||
|
31 | ||||
|
32 | Here we create the view and add our series to it. Also we set the title and theme we want our chart to use | |||
|
33 | ||||
|
34 | \snippet ../example/percentbarchart/main.cpp 5 | |||
|
35 | ||||
|
36 | For barchart, we don't need X-axis to be visible, so it can be disabled. | |||
|
37 | ||||
|
38 | \snippet ../example/percentbarchart/main.cpp 6 | |||
|
39 | */ No newline at end of file |
@@ -0,0 +1,39 | |||||
|
1 | /*! | |||
|
2 | \example example/stackedbarchart | |||
|
3 | \title StackedBarChart Example | |||
|
4 | \subtitle | |||
|
5 | ||||
|
6 | The example shows how to create simple stacked bar chart. Stacked bar chart shows the data in sets as bars that are stacked on top of each other. The stacking is done per category. | |||
|
7 | ||||
|
8 | \image stackedbarchart.png | |||
|
9 | ||||
|
10 | First we define categories. | |||
|
11 | ||||
|
12 | \snippet ../example/stackedbarchart/main.cpp 1 | |||
|
13 | ||||
|
14 | Data that barchart visualizes, is defined by QBarSet instances. Here we create some sets and append data | |||
|
15 | we want to visulaize to them. | |||
|
16 | ||||
|
17 | \snippet ../example/stackedbarchart/main.cpp 2 | |||
|
18 | ||||
|
19 | To combine the sets and categories to a chart, we need to create QBarSeries instance. When creating | |||
|
20 | the QBarSeries, the categories must be known. Sets can be added later. For example purposes the sets | |||
|
21 | are added to series here. | |||
|
22 | ||||
|
23 | \snippet ../example/stackedbarchart/main.cpp 3 | |||
|
24 | ||||
|
25 | We want our barchart to behave so, that when mouse is hovered over bar, the name of set which the bar | |||
|
26 | represents is shown as tooltip. | |||
|
27 | Also when we click the bar, floating values for the set are toggled. Floating values are the data values | |||
|
28 | that are drawn on top of bars. | |||
|
29 | ||||
|
30 | \snippet ../example/stackedbarchart/main.cpp 4 | |||
|
31 | ||||
|
32 | Here we create the view and add our series to it. Also we set the title and theme we want our chart to use | |||
|
33 | ||||
|
34 | \snippet ../example/stackedbarchart/main.cpp 5 | |||
|
35 | ||||
|
36 | For barchart, we don't need X-axis to be visible, so it can be disabled. | |||
|
37 | ||||
|
38 | \snippet ../example/stackedbarchart/main.cpp 6 | |||
|
39 | */ No newline at end of file |
@@ -1,9 +1,39 | |||||
1 | /*! |
|
1 | /*! | |
2 |
|
|
2 | \example example/barchart | |
3 |
|
|
3 | \title BarChart Example | |
4 |
|
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to create simple bar chart. |
|
6 | The example shows how to create simple bar chart. Barchart shows the data in sets as separate bars, which are grouped in categories. | |
7 |
|
7 | |||
8 | ... |
|
8 | \image barchart.png | |
|
9 | ||||
|
10 | First we define categories. | |||
|
11 | ||||
|
12 | \snippet ../example/barchart/main.cpp 1 | |||
|
13 | ||||
|
14 | Data that barchart visualizes, is defined by QBarSet instances. Here we create some sets and append data | |||
|
15 | we want to visulaize to them. | |||
|
16 | ||||
|
17 | \snippet ../example/barchart/main.cpp 2 | |||
|
18 | ||||
|
19 | To combine the sets and categories to a chart, we need to create QBarSeries instance. When creating | |||
|
20 | the QBarSeries, the categories must be known. Sets can be added later. For example purposes the sets | |||
|
21 | are added to series here. | |||
|
22 | ||||
|
23 | \snippet ../example/barchart/main.cpp 3 | |||
|
24 | ||||
|
25 | We want our barchart to behave so, that when mouse is hovered over bar, the name of set which the bar | |||
|
26 | represents is shown as tooltip. | |||
|
27 | Also when we click the bar, floating values for the set are toggled. Floating values are the data values | |||
|
28 | that are drawn on top of bars. | |||
|
29 | ||||
|
30 | \snippet ../example/barchart/main.cpp 4 | |||
|
31 | ||||
|
32 | Here we create the view and add our series to it. Also we set the title and theme we want our chart to use | |||
|
33 | ||||
|
34 | \snippet ../example/barchart/main.cpp 5 | |||
|
35 | ||||
|
36 | For barchart, we don't need X-axis to be visible, so it can be disabled. | |||
|
37 | ||||
|
38 | \snippet ../example/barchart/main.cpp 6 | |||
9 | */ No newline at end of file |
|
39 | */ |
@@ -14,6 +14,8 | |||||
14 | <td valign="top"> |
|
14 | <td valign="top"> | |
15 | <ul> |
|
15 | <ul> | |
16 | <li><a href="example-barchart.html">Bar Chart example</a></li> |
|
16 | <li><a href="example-barchart.html">Bar Chart example</a></li> | |
|
17 | <li><a href="example-stackedbarchart.html">Stacked Bar Chart example</a></li> | |||
|
18 | <li><a href="example-percentbarchart.html">Percent Bar Chart example</a></li> | |||
17 | <li><a href="example-linechart.html">Line Chart example</a></li> |
|
19 | <li><a href="example-linechart.html">Line Chart example</a></li> | |
18 | <li><a href="example-piechart.html">Pie Chart example</a></li> |
|
20 | <li><a href="example-piechart.html">Pie Chart example</a></li> | |
19 | </ul> |
|
21 | </ul> |
@@ -3,6 +3,7 | |||||
3 | #include <qchartview.h> |
|
3 | #include <qchartview.h> | |
4 | #include <qbarseries.h> |
|
4 | #include <qbarseries.h> | |
5 | #include <qbarset.h> |
|
5 | #include <qbarset.h> | |
|
6 | #include <qchartaxis.h> | |||
6 | #include <QStringList> |
|
7 | #include <QStringList> | |
7 |
|
8 | |||
8 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
9 | QTCOMMERCIALCHART_USE_NAMESPACE | |
@@ -14,8 +15,8 int main(int argc, char *argv[]) | |||||
14 |
|
15 | |||
15 | //! [1] |
|
16 | //! [1] | |
16 | // Define categories |
|
17 | // Define categories | |
17 |
QStringList cate |
|
18 | QStringList categories; | |
18 |
cate |
|
19 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; | |
19 | //! [1] |
|
20 | //! [1] | |
20 |
|
21 | |||
21 | //! [2] |
|
22 | //! [2] | |
@@ -27,16 +28,16 int main(int argc, char *argv[]) | |||||
27 | QBarSet *set3 = new QBarSet("Larry"); |
|
28 | QBarSet *set3 = new QBarSet("Larry"); | |
28 | QBarSet *set4 = new QBarSet("Zak"); |
|
29 | QBarSet *set4 = new QBarSet("Zak"); | |
29 |
|
30 | |||
30 |
*set0 << 1 << 2 << 3 << 4 << 5 << 6 |
|
31 | *set0 << 1 << 2 << 3 << 4 << 5 << 6; | |
31 |
*set1 << 5 << 0 << 0 << 4 << 0 << 7 |
|
32 | *set1 << 5 << 0 << 0 << 4 << 0 << 7; | |
32 |
*set2 << 3 << 5 << 8 << 13 << 8 << 5 |
|
33 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; | |
33 |
*set3 << 5 << 6 << 7 << 3 << 4 << 5 |
|
34 | *set3 << 5 << 6 << 7 << 3 << 4 << 5; | |
34 |
*set4 << 9 << 7 << 5 << 3 << 1 << 2 |
|
35 | *set4 << 9 << 7 << 5 << 3 << 1 << 2; | |
35 | //! [2] |
|
36 | //! [2] | |
36 |
|
37 | |||
37 | //! [3] |
|
38 | //! [3] | |
38 | // Create series and add sets to it |
|
39 | // Create series and add sets to it | |
39 |
QBarSeries* series= new QBarSeries(cate |
|
40 | QBarSeries* series= new QBarSeries(categories); | |
40 |
|
41 | |||
41 | series->addBarSet(set0); |
|
42 | series->addBarSet(set0); | |
42 | series->addBarSet(set1); |
|
43 | series->addBarSet(set1); | |
@@ -60,8 +61,14 int main(int argc, char *argv[]) | |||||
60 | chartView->setChartTheme(QChart::ChartThemeIcy); |
|
61 | chartView->setChartTheme(QChart::ChartThemeIcy); | |
61 | //! [5] |
|
62 | //! [5] | |
62 |
|
63 | |||
|
64 | //! [6] | |||
|
65 | chartView->axisX()->setAxisVisible(false); | |||
|
66 | chartView->axisX()->setGridVisible(false); | |||
|
67 | chartView->axisX()->setLabelsVisible(false); | |||
|
68 | //! [6] | |||
|
69 | ||||
63 | window.setCentralWidget(chartView); |
|
70 | window.setCentralWidget(chartView); | |
64 |
window.resize( |
|
71 | window.resize(400, 300); | |
65 | window.show(); |
|
72 | window.show(); | |
66 |
|
73 | |||
67 | return a.exec(); |
|
74 | return a.exec(); |
@@ -4,6 +4,7 | |||||
4 | #include <qpercentbarseries.h> |
|
4 | #include <qpercentbarseries.h> | |
5 | #include <qchartview.h> |
|
5 | #include <qchartview.h> | |
6 | #include <qbarset.h> |
|
6 | #include <qbarset.h> | |
|
7 | #include <qchartaxis.h> | |||
7 | #include <QStringList> |
|
8 | #include <QStringList> | |
8 |
|
9 | |||
9 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
10 | QTCOMMERCIALCHART_USE_NAMESPACE | |
@@ -16,7 +17,7 int main(int argc, char *argv[]) | |||||
16 | //! [1] |
|
17 | //! [1] | |
17 | // Define categories |
|
18 | // Define categories | |
18 | QStringList categories; |
|
19 | QStringList categories; | |
19 |
categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun |
|
20 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; | |
20 | //! [1] |
|
21 | //! [1] | |
21 |
|
22 | |||
22 | //! [2] |
|
23 | //! [2] | |
@@ -27,11 +28,11 int main(int argc, char *argv[]) | |||||
27 | QBarSet *set3 = new QBarSet("Larry"); |
|
28 | QBarSet *set3 = new QBarSet("Larry"); | |
28 | QBarSet *set4 = new QBarSet("Zak"); |
|
29 | QBarSet *set4 = new QBarSet("Zak"); | |
29 |
|
30 | |||
30 |
*set0 << 1 << 2 << 3 << 4 << 5 << 6 |
|
31 | *set0 << 1 << 2 << 3 << 4 << 5 << 6; | |
31 |
*set1 << 5 << 0 << 0 << 4 << 0 << 7 |
|
32 | *set1 << 5 << 0 << 0 << 4 << 0 << 7; | |
32 |
*set2 << 3 << 5 << 8 << 13 << 8 << 5 |
|
33 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; | |
33 |
*set3 << 5 << 6 << 7 << 3 << 4 << 5 |
|
34 | *set3 << 5 << 6 << 7 << 3 << 4 << 5; | |
34 |
*set4 << 9 << 7 << 5 << 3 << 1 << 2 |
|
35 | *set4 << 9 << 7 << 5 << 3 << 1 << 2; | |
35 | //! [2] |
|
36 | //! [2] | |
36 |
|
37 | |||
37 | //! [3] |
|
38 | //! [3] | |
@@ -60,6 +61,12 int main(int argc, char *argv[]) | |||||
60 | chartView->setChartTheme(QChart::ChartThemeIcy); |
|
61 | chartView->setChartTheme(QChart::ChartThemeIcy); | |
61 | //! [5] |
|
62 | //! [5] | |
62 |
|
63 | |||
|
64 | //! [6] | |||
|
65 | chartView->axisX()->setAxisVisible(false); | |||
|
66 | chartView->axisX()->setGridVisible(false); | |||
|
67 | chartView->axisX()->setLabelsVisible(false); | |||
|
68 | //! [6] | |||
|
69 | ||||
63 | window.setCentralWidget(chartView); |
|
70 | window.setCentralWidget(chartView); | |
64 | window.resize(400, 300); |
|
71 | window.resize(400, 300); | |
65 | window.show(); |
|
72 | window.show(); |
@@ -3,6 +3,7 | |||||
3 | #include <qchartview.h> |
|
3 | #include <qchartview.h> | |
4 | #include <qstackedbarseries.h> |
|
4 | #include <qstackedbarseries.h> | |
5 | #include <qbarset.h> |
|
5 | #include <qbarset.h> | |
|
6 | #include <qchartaxis.h> | |||
6 | #include <QStringList> |
|
7 | #include <QStringList> | |
7 |
|
8 | |||
8 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
9 | QTCOMMERCIALCHART_USE_NAMESPACE | |
@@ -14,8 +15,8 int main(int argc, char *argv[]) | |||||
14 |
|
15 | |||
15 | //! [1] |
|
16 | //! [1] | |
16 | // Define categories |
|
17 | // Define categories | |
17 |
QStringList cate |
|
18 | QStringList categories; | |
18 |
cate |
|
19 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; | |
19 | //! [1] |
|
20 | //! [1] | |
20 |
|
21 | |||
21 | //! [2] |
|
22 | //! [2] | |
@@ -26,16 +27,16 int main(int argc, char *argv[]) | |||||
26 | QBarSet *set3 = new QBarSet("Larry"); |
|
27 | QBarSet *set3 = new QBarSet("Larry"); | |
27 | QBarSet *set4 = new QBarSet("Zak"); |
|
28 | QBarSet *set4 = new QBarSet("Zak"); | |
28 |
|
29 | |||
29 |
*set0 << 1 << 2 << 3 << 4 << 5 << 6 |
|
30 | *set0 << 1 << 2 << 3 << 4 << 5 << 6; | |
30 |
*set1 << 5 << 0 << 0 << 4 << 0 << 7 |
|
31 | *set1 << 5 << 0 << 0 << 4 << 0 << 7; | |
31 |
*set2 << 3 << 5 << 8 << 13 << 8 << 5 |
|
32 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; | |
32 |
*set3 << 5 << 6 << 7 << 3 << 4 << 5 |
|
33 | *set3 << 5 << 6 << 7 << 3 << 4 << 5; | |
33 |
*set4 << 9 << 7 << 5 << 3 << 1 << 2 |
|
34 | *set4 << 9 << 7 << 5 << 3 << 1 << 2; | |
34 | //! [2] |
|
35 | //! [2] | |
35 |
|
36 | |||
36 | //! [3] |
|
37 | //! [3] | |
37 | // Create series and add sets to it |
|
38 | // Create series and add sets to it | |
38 |
QStackedBarSeries* series = new QStackedBarSeries(cate |
|
39 | QStackedBarSeries* series = new QStackedBarSeries(categories); | |
39 |
|
40 | |||
40 | series->addBarSet(set0); |
|
41 | series->addBarSet(set0); | |
41 | series->addBarSet(set1); |
|
42 | series->addBarSet(set1); | |
@@ -59,6 +60,12 int main(int argc, char *argv[]) | |||||
59 | chartView->setChartTheme(QChart::ChartThemeIcy); |
|
60 | chartView->setChartTheme(QChart::ChartThemeIcy); | |
60 | //! [5] |
|
61 | //! [5] | |
61 |
|
62 | |||
|
63 | //! [6] | |||
|
64 | chartView->axisX()->setAxisVisible(false); | |||
|
65 | chartView->axisX()->setGridVisible(false); | |||
|
66 | chartView->axisX()->setLabelsVisible(false); | |||
|
67 | //! [6] | |||
|
68 | ||||
62 | window.setCentralWidget(chartView); |
|
69 | window.setCentralWidget(chartView); | |
63 | window.resize(400, 300); |
|
70 | window.resize(400, 300); | |
64 | window.show(); |
|
71 | window.show(); |
@@ -52,28 +52,14 QList<QSeries::Legend> BarChartModel::legend() | |||||
52 | return legend; |
|
52 | return legend; | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 |
int BarChartModel:: |
|
55 | int BarChartModel::barsetCount() | |
56 | { |
|
56 | { | |
57 | return mDataModel.count(); |
|
57 | return mDataModel.count(); | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 |
int BarChartModel::c |
|
60 | int BarChartModel::categoryCount() | |
61 | { |
|
61 | { | |
62 |
|
|
62 | return mCategory.count(); | |
63 | for (int i=0; i<mDataModel.count(); i++){ |
|
|||
64 | // TODO: can we assume that all series have same number of values? If not. then which values are empty? |
|
|||
65 | int temp = mDataModel.at(i)->count(); |
|
|||
66 | if (temp > count) { |
|
|||
67 | count = temp; |
|
|||
68 | } |
|
|||
69 | } |
|
|||
70 | return count; |
|
|||
71 | } |
|
|||
72 |
|
||||
73 | int BarChartModel::countTotalItems() |
|
|||
74 | { |
|
|||
75 | int total = mDataModel.count() * countCategories(); |
|
|||
76 | return total; |
|
|||
77 | } |
|
63 | } | |
78 |
|
64 | |||
79 | qreal BarChartModel::min() |
|
65 | qreal BarChartModel::min() | |
@@ -165,7 +151,7 qreal BarChartModel::categorySum(int category) | |||||
165 | qreal BarChartModel::maxCategorySum() |
|
151 | qreal BarChartModel::maxCategorySum() | |
166 | { |
|
152 | { | |
167 | qreal max = INT_MIN; |
|
153 | qreal max = INT_MIN; | |
168 |
int count = c |
|
154 | int count = categoryCount(); | |
169 |
|
155 | |||
170 | for (int col=0; col<count; col++) { |
|
156 | for (int col=0; col<count; col++) { | |
171 | qreal sum = categorySum(col); |
|
157 | qreal sum = categorySum(col); |
@@ -27,9 +27,8 public: | |||||
27 |
|
27 | |||
28 | QList<QSeries::Legend> legend(); |
|
28 | QList<QSeries::Legend> legend(); | |
29 |
|
29 | |||
30 |
int |
|
30 | int barsetCount(); // Number of sets in model | |
31 |
int c |
|
31 | int categoryCount(); // Number of categories | |
32 | int countTotalItems(); // Total items in all sets. Includes empty items. |
|
|||
33 |
|
32 | |||
34 | qreal max(); // Maximum value of all sets |
|
33 | qreal max(); // Maximum value of all sets | |
35 | qreal min(); // Minimum value of all sets |
|
34 | qreal min(); // Minimum value of all sets |
@@ -10,7 +10,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
10 | BarPresenter::BarPresenter(QBarSeries *series, QGraphicsItem *parent) : |
|
10 | BarPresenter::BarPresenter(QBarSeries *series, QGraphicsItem *parent) : | |
11 | BarPresenterBase(series, parent) |
|
11 | BarPresenterBase(series, parent) | |
12 | { |
|
12 | { | |
13 |
mBarDefaultWidth = |
|
13 | mBarDefaultWidth = 5; | |
14 | } |
|
14 | } | |
15 |
|
15 | |||
16 | void BarPresenter::layoutChanged() |
|
16 | void BarPresenter::layoutChanged() |
@@ -52,8 +52,10 bool BarValue::belongsToSet(QBarSet *set) | |||||
52 |
|
52 | |||
53 | void BarValue::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
53 | void BarValue::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | |
54 | { |
|
54 | { | |
55 | painter->setPen(mPen); |
|
55 | if (isVisible()) { | |
56 | painter->drawText(boundingRect(),mValueString); |
|
56 | painter->setPen(mPen); | |
|
57 | painter->drawText(boundingRect(),mValueString); | |||
|
58 | } | |||
57 | } |
|
59 | } | |
58 |
|
60 | |||
59 | QRectF BarValue::boundingRect() const |
|
61 | QRectF BarValue::boundingRect() const |
@@ -46,7 +46,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
46 | */ |
|
46 | */ | |
47 |
|
47 | |||
48 | /*! |
|
48 | /*! | |
49 |
Constructs empty QBarSeries. Parameter \a categor |
|
49 | Constructs empty QBarSeries. Parameter \a categories defines the categories for chart. | |
50 | QBarSeries is QObject which is a child of a \a parent. |
|
50 | QBarSeries is QObject which is a child of a \a parent. | |
51 | */ |
|
51 | */ | |
52 | QBarSeries::QBarSeries(QStringList categories, QObject *parent) |
|
52 | QBarSeries::QBarSeries(QStringList categories, QObject *parent) | |
@@ -76,7 +76,7 void QBarSeries::removeBarSet(QBarSet *set) | |||||
76 | */ |
|
76 | */ | |
77 | int QBarSeries::barsetCount() |
|
77 | int QBarSeries::barsetCount() | |
78 | { |
|
78 | { | |
79 |
return mModel-> |
|
79 | return mModel->barsetCount(); | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 | /*! |
|
82 | /*! | |
@@ -84,7 +84,7 int QBarSeries::barsetCount() | |||||
84 | */ |
|
84 | */ | |
85 | int QBarSeries::categoryCount() |
|
85 | int QBarSeries::categoryCount() | |
86 | { |
|
86 | { | |
87 |
return mModel->c |
|
87 | return mModel->categoryCount(); | |
88 | } |
|
88 | } | |
89 |
|
89 | |||
90 | /*! |
|
90 | /*! | |
@@ -127,12 +127,12 QString QBarSeries::label(int category) | |||||
127 | void QBarSeries::setFloatingValuesEnabled(bool enabled) |
|
127 | void QBarSeries::setFloatingValuesEnabled(bool enabled) | |
128 | { |
|
128 | { | |
129 | if (enabled) { |
|
129 | if (enabled) { | |
130 |
for (int i=0; i<mModel-> |
|
130 | for (int i=0; i<mModel->barsetCount(); i++) { | |
131 | QBarSet *set = mModel->setAt(i); |
|
131 | QBarSet *set = mModel->setAt(i); | |
132 | connect(set,SIGNAL(clicked()),set,SIGNAL(toggleFloatingValues())); |
|
132 | connect(set,SIGNAL(clicked()),set,SIGNAL(toggleFloatingValues())); | |
133 | } |
|
133 | } | |
134 | } else { |
|
134 | } else { | |
135 |
for (int i=0; i<mModel-> |
|
135 | for (int i=0; i<mModel->barsetCount(); i++) { | |
136 | QBarSet *set = mModel->setAt(i); |
|
136 | QBarSet *set = mModel->setAt(i); | |
137 | disconnect(set,SIGNAL(clicked()),set,SIGNAL(toggleFloatingValues())); |
|
137 | disconnect(set,SIGNAL(clicked()),set,SIGNAL(toggleFloatingValues())); | |
138 | } |
|
138 | } | |
@@ -147,12 +147,12 void QBarSeries::setFloatingValuesEnabled(bool enabled) | |||||
147 | void QBarSeries::setToolTipEnabled(bool enabled) |
|
147 | void QBarSeries::setToolTipEnabled(bool enabled) | |
148 | { |
|
148 | { | |
149 | if (enabled) { |
|
149 | if (enabled) { | |
150 |
for (int i=0; i<mModel-> |
|
150 | for (int i=0; i<mModel->barsetCount(); i++) { | |
151 | QBarSet *set = mModel->setAt(i); |
|
151 | QBarSet *set = mModel->setAt(i); | |
152 | connect(set,SIGNAL(showToolTip(QPoint,QString)),this,SIGNAL(showToolTip(QPoint,QString))); |
|
152 | connect(set,SIGNAL(showToolTip(QPoint,QString)),this,SIGNAL(showToolTip(QPoint,QString))); | |
153 | } |
|
153 | } | |
154 | } else { |
|
154 | } else { | |
155 |
for (int i=0; i<mModel-> |
|
155 | for (int i=0; i<mModel->barsetCount(); i++) { | |
156 | QBarSet *set = mModel->setAt(i); |
|
156 | QBarSet *set = mModel->setAt(i); | |
157 | disconnect(set,SIGNAL(showToolTip(QPoint,QString)),this,SIGNAL(showToolTip(QPoint,QString))); |
|
157 | disconnect(set,SIGNAL(showToolTip(QPoint,QString)),this,SIGNAL(showToolTip(QPoint,QString))); | |
158 | } |
|
158 | } |
@@ -22,7 +22,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
22 | */ |
|
22 | */ | |
23 |
|
23 | |||
24 | /*! |
|
24 | /*! | |
25 |
Constructs empty QPercentBarSeries. Parameter \a categor |
|
25 | Constructs empty QPercentBarSeries. Parameter \a categories defines the categories for chart. | |
26 | QPercentBarSeries is QObject which is a child of a \a parent. |
|
26 | QPercentBarSeries is QObject which is a child of a \a parent. | |
27 | */ |
|
27 | */ | |
28 | QPercentBarSeries::QPercentBarSeries(QStringList categories, QObject *parent) |
|
28 | QPercentBarSeries::QPercentBarSeries(QStringList categories, QObject *parent) |
@@ -22,7 +22,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
22 | */ |
|
22 | */ | |
23 |
|
23 | |||
24 | /*! |
|
24 | /*! | |
25 |
Constructs empty QStackedBarSeries. Parameter \a categor |
|
25 | Constructs empty QStackedBarSeries. Parameter \a categories defines the categories for chart. | |
26 | QStackedBarSeries is QObject which is a child of a \a parent. |
|
26 | QStackedBarSeries is QObject which is a child of a \a parent. | |
27 | */ |
|
27 | */ | |
28 | QStackedBarSeries::QStackedBarSeries(QStringList categories, QObject *parent) |
|
28 | QStackedBarSeries::QStackedBarSeries(QStringList categories, QObject *parent) |
@@ -47,6 +47,11 | |||||
47 | used by the series. Returns true if the model is valid for the series. |
|
47 | used by the series. Returns true if the model is valid for the series. | |
48 | */ |
|
48 | */ | |
49 |
|
49 | |||
|
50 | /*! | |||
|
51 | \fn QList<QSeries::Legend> legend() | |||
|
52 | \brief Returns the legend of the series. If series is empty, empty list is returned. | |||
|
53 | */ | |||
|
54 | ||||
50 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
55 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
51 | #include "moc_qseries.cpp" |
|
56 | #include "moc_qseries.cpp" | |
52 | QTCOMMERCIALCHART_END_NAMESPACE |
|
57 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -24,7 +24,7 public: | |||||
24 | }; |
|
24 | }; | |
25 |
|
25 | |||
26 | // Helper class to contain legend and color for it |
|
26 | // Helper class to contain legend and color for it | |
27 | // TODO: This as private class? |
|
27 | // TODO: This as private class? Or should we expose this to user of API | |
28 | class Legend { |
|
28 | class Legend { | |
29 | public: |
|
29 | public: | |
30 | QString mName; |
|
30 | QString mName; | |
@@ -40,6 +40,7 public: | |||||
40 | // TODO |
|
40 | // TODO | |
41 | virtual bool setModel(QAbstractItemModel* /*model*/) { return false; } |
|
41 | virtual bool setModel(QAbstractItemModel* /*model*/) { return false; } | |
42 |
|
42 | |||
|
43 | // TODO: should this be internal? | |||
43 | virtual QList<QSeries::Legend> legend() { QList<QSeries::Legend> l; return l; } |
|
44 | virtual QList<QSeries::Legend> legend() { QList<QSeries::Legend> l; return l; } | |
44 | }; |
|
45 | }; | |
45 |
|
46 |
General Comments 0
You need to be logged in to leave comments.
Login now