@@ -0,0 +1,55 | |||||
|
1 | /*! | |||
|
2 | \example examples/barmodelmapper | |||
|
3 | \title BarModelMapper example | |||
|
4 | \subtitle | |||
|
5 | ||||
|
6 | This example shows how to use QAbstractItemModel derived model as the data for the bar series. | |||
|
7 | ||||
|
8 | Let's start by creating an instance of CustomTableModel class. | |||
|
9 | CustomTableModel class is derived from QAbstractTableModel and it was created for the purpose of this example. | |||
|
10 | The constructor of this class populates the internal data store of the model with the data that is good for our chart example. | |||
|
11 | ||||
|
12 | \snippet ../examples/barmodelmapper/tablewidget.cpp 1 | |||
|
13 | ||||
|
14 | We now have a model with data that we would like to display both on the chart and in a QTableView. | |||
|
15 | First, we create QTableView and tell it use the model as a data source. To make the data cells fill the table view we also change headers resize mode. | |||
|
16 | ||||
|
17 | \snippet ../examples/barmodelmapper/tablewidget.cpp 2 | |||
|
18 | ||||
|
19 | Now we need QChart instance to display the same data on the chart. | |||
|
20 | We also enable animations. It makes it easier to see how modifying the model's data affect the chart. | |||
|
21 | ||||
|
22 | \snippet ../examples/barmodelmapper/tablewidget.cpp 3 | |||
|
23 | ||||
|
24 | First line of the code below creates new grouped bar series. Variables firstRow and rowCount are used to define a custom model mapping. | |||
|
25 | Custom mapping allows to take only part of the data from the model. In this case data from 5 rows starting with the row with the index 3. | |||
|
26 | Following three lines create an instance of QVBarModelMapper class and specifie that data for the bar sets should be taken from the model's columns(Qt::Vertical) with indexes from 1 to 4(inclusive). | |||
|
27 | To create a connection between the series and the model we set both of those objects to QVBarModelMapper. | |||
|
28 | ||||
|
29 | Finally the series is added to the chart. | |||
|
30 | ||||
|
31 | \snippet ../examples/barmodelmapper/tablewidget.cpp 4 | |||
|
32 | ||||
|
33 | To show in QTableView which data coresponds with which series this example uses table coloring. | |||
|
34 | When series is added to the chart it is assigned a color beased on the currently selected theme. | |||
|
35 | Code below extracts that color from the series and uses it to create colored QTableView. | |||
|
36 | Coloring of the view is not a part of the QChart functionality. | |||
|
37 | ||||
|
38 | \snippet ../examples/barmodelmapper/tablewidget.cpp 5 | |||
|
39 | ||||
|
40 | We would like to have categories placed on the chart's axis that describe what the data means. | |||
|
41 | Next snippet shows how to do that. | |||
|
42 | ||||
|
43 | \snippet ../examples/barmodelmapper/tablewidget.cpp 6 | |||
|
44 | ||||
|
45 | To avoid setting up the QGraphicsScene we use QChartView class that does it for us. QChart object pointer is used as a parameter of the QChartView constructor. | |||
|
46 | To make the render look nicer Antialiasing is turned on and the minimum size of the chartView widget is set. | |||
|
47 | ||||
|
48 | \snippet ../examples/barmodelmapper/tablewidget.cpp 7 | |||
|
49 | ||||
|
50 | Finally we place both widgets in a layout and use the layout as the application layout. | |||
|
51 | ||||
|
52 | \snippet ../examples/barmodelmapper/tablewidget.cpp 8 | |||
|
53 | ||||
|
54 | Application is ready. Try modifying the data in the table view and see how it affects the chart. | |||
|
55 | */ |
@@ -1,38 +1,39 | |||||
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-groupedbarchart.html">Grouped bar chart</a></li> |
|
19 | <li><a href="examples-groupedbarchart.html">Grouped bar chart</a></li> | |
20 | <li><a href="examples-legend.html">Legend</a></li> |
|
20 | <li><a href="examples-legend.html">Legend</a></li> | |
21 | <li><a href="examples-linechart.html">Line chart</a></li> |
|
21 | <li><a href="examples-linechart.html">Line chart</a></li> | |
22 | <li><a href="examples-modeldata.html">Model data</a></li> |
|
22 | <li><a href="examples-modeldata.html">Model data</a></li> | |
|
23 | <li><a href="examples-barmodelmapper.html">Bar chart from model</a></li> | |||
23 | <li><a href="examples-percentbarchart.html">Percent bar chart</a></li> |
|
24 | <li><a href="examples-percentbarchart.html">Percent bar chart</a></li> | |
24 | <li><a href="examples-piechart.html">Pie chart</a></li> |
|
25 | <li><a href="examples-piechart.html">Pie chart</a></li> | |
25 | <li><a href="examples-piechartdrilldown.html">Pie chart drilldown</a></li> |
|
26 | <li><a href="examples-piechartdrilldown.html">Pie chart drilldown</a></li> | |
26 | <li><a href="examples-presenterchart.html">Presenter chart</a></li> |
|
27 | <li><a href="examples-presenterchart.html">Presenter chart</a></li> | |
27 | <li><a href="examples-scatterchart.html">Scatter chart</a></li> |
|
28 | <li><a href="examples-scatterchart.html">Scatter chart</a></li> | |
28 | <li><a href="examples-scatterinteractions.html">Scatter interactions</a></li> |
|
29 | <li><a href="examples-scatterinteractions.html">Scatter interactions</a></li> | |
29 | <li><a href="examples-splinechart.html">Spline chart</a></li> |
|
30 | <li><a href="examples-splinechart.html">Spline chart</a></li> | |
30 | <li><a href="examples-stackedbarchart.html">Stacked bar chart</a></li> |
|
31 | <li><a href="examples-stackedbarchart.html">Stacked bar chart</a></li> | |
31 | <li><a href="examples-stackedbarchartdrilldown.html">Stacked bar chart drilldown</a></li> |
|
32 | <li><a href="examples-stackedbarchartdrilldown.html">Stacked bar chart drilldown</a></li> | |
32 | <li><a href="examples-zoomlinechart.html">Zoom line</a></li> |
|
33 | <li><a href="examples-zoomlinechart.html">Zoom line</a></li> | |
33 | </ul> |
|
34 | </ul> | |
34 | </td> |
|
35 | </td> | |
35 | </tr> |
|
36 | </tr> | |
36 | </table> |
|
37 | </table> | |
37 | \endraw |
|
38 | \endraw | |
38 | */ |
|
39 | */ |
@@ -1,117 +1,117 | |||||
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 "customtablemodel.h" |
|
21 | #include "customtablemodel.h" | |
22 | #include <QVector> |
|
22 | #include <QVector> | |
23 | #include <QTime> |
|
23 | #include <QTime> | |
24 | #include <QRect> |
|
24 | #include <QRect> | |
25 | #include <QColor> |
|
25 | #include <QColor> | |
26 |
|
26 | |||
27 | CustomTableModel::CustomTableModel(QObject *parent) : |
|
27 | CustomTableModel::CustomTableModel(QObject *parent) : | |
28 | QAbstractTableModel(parent) |
|
28 | QAbstractTableModel(parent) | |
29 | { |
|
29 | { | |
30 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); |
|
30 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); | |
31 |
|
31 | |||
32 | m_columnCount = 6; |
|
32 | m_columnCount = 6; | |
33 |
m_rowCount = 1 |
|
33 | m_rowCount = 12; | |
34 |
|
34 | |||
35 | // m_data |
|
35 | // m_data | |
36 | for (int i = 0; i < m_rowCount; i++) |
|
36 | for (int i = 0; i < m_rowCount; i++) | |
37 | { |
|
37 | { | |
38 | QVector<qreal>* dataVec = new QVector<qreal>(m_columnCount); |
|
38 | QVector<qreal>* dataVec = new QVector<qreal>(m_columnCount); | |
39 | for (int k = 0; k < dataVec->size(); k++) |
|
39 | for (int k = 0; k < dataVec->size(); k++) | |
40 | { |
|
40 | { | |
41 | if (k%2 == 0) |
|
41 | if (k%2 == 0) | |
42 | dataVec->replace(k, i * 50 + qrand()%20); |
|
42 | dataVec->replace(k, i * 50 + qrand()%20); | |
43 | else |
|
43 | else | |
44 | dataVec->replace(k, qrand()%100); |
|
44 | dataVec->replace(k, qrand()%100); | |
45 | } |
|
45 | } | |
46 | m_data.append(dataVec); |
|
46 | m_data.append(dataVec); | |
47 | } |
|
47 | } | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | int CustomTableModel::rowCount(const QModelIndex & parent) const |
|
50 | int CustomTableModel::rowCount(const QModelIndex & parent) const | |
51 | { |
|
51 | { | |
52 | Q_UNUSED(parent) |
|
52 | Q_UNUSED(parent) | |
53 | return m_data.count(); |
|
53 | return m_data.count(); | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | int CustomTableModel::columnCount(const QModelIndex & parent) const |
|
56 | int CustomTableModel::columnCount(const QModelIndex & parent) const | |
57 | { |
|
57 | { | |
58 | Q_UNUSED(parent) |
|
58 | Q_UNUSED(parent) | |
59 | return m_columnCount; |
|
59 | return m_columnCount; | |
60 | } |
|
60 | } | |
61 |
|
61 | |||
62 | QVariant CustomTableModel::headerData (int section, Qt::Orientation orientation, int role ) const |
|
62 | QVariant CustomTableModel::headerData (int section, Qt::Orientation orientation, int role ) const | |
63 | { |
|
63 | { | |
64 | if (role != Qt::DisplayRole) |
|
64 | if (role != Qt::DisplayRole) | |
65 | return QVariant(); |
|
65 | return QVariant(); | |
66 |
|
66 | |||
67 | if (orientation == Qt::Horizontal) |
|
67 | if (orientation == Qt::Horizontal) | |
68 | { |
|
68 | { | |
69 | return QString("201%1").arg(section); |
|
69 | return QString("201%1").arg(section); | |
70 | } |
|
70 | } | |
71 | else |
|
71 | else | |
72 | return QString("%1").arg(section); |
|
72 | return QString("%1").arg(section + 1); | |
73 | } |
|
73 | } | |
74 |
|
74 | |||
75 | QVariant CustomTableModel::data(const QModelIndex & index, int role) const |
|
75 | QVariant CustomTableModel::data(const QModelIndex & index, int role) const | |
76 | { |
|
76 | { | |
77 | if (role == Qt::DisplayRole) |
|
77 | if (role == Qt::DisplayRole) | |
78 | { |
|
78 | { | |
79 | return m_data[index.row()]->at(index.column()); |
|
79 | return m_data[index.row()]->at(index.column()); | |
80 | } |
|
80 | } | |
81 | else if (role == Qt::EditRole) |
|
81 | else if (role == Qt::EditRole) | |
82 | { |
|
82 | { | |
83 | return m_data[index.row()]->at(index.column()); |
|
83 | return m_data[index.row()]->at(index.column()); | |
84 | } |
|
84 | } | |
85 | else if (role == Qt::BackgroundRole) |
|
85 | else if (role == Qt::BackgroundRole) | |
86 | { |
|
86 | { | |
87 | QRect rect; |
|
87 | QRect rect; | |
88 | foreach(rect, m_mapping) |
|
88 | foreach(rect, m_mapping) | |
89 | if(rect.contains(index.column(), index.row())) |
|
89 | if(rect.contains(index.column(), index.row())) | |
90 | return QColor(m_mapping.key(rect)); |
|
90 | return QColor(m_mapping.key(rect)); | |
91 |
|
91 | |||
92 | // cell not mapped return white color |
|
92 | // cell not mapped return white color | |
93 | return QColor(Qt::white); |
|
93 | return QColor(Qt::white); | |
94 | } |
|
94 | } | |
95 | return QVariant(); |
|
95 | return QVariant(); | |
96 | } |
|
96 | } | |
97 |
|
97 | |||
98 | bool CustomTableModel::setData ( const QModelIndex & index, const QVariant & value, int role) |
|
98 | bool CustomTableModel::setData ( const QModelIndex & index, const QVariant & value, int role) | |
99 | { |
|
99 | { | |
100 | if (index.isValid() && role == Qt::EditRole) |
|
100 | if (index.isValid() && role == Qt::EditRole) | |
101 | { |
|
101 | { | |
102 | m_data[index.row()]->replace(index.column(), value.toDouble()); |
|
102 | m_data[index.row()]->replace(index.column(), value.toDouble()); | |
103 | emit dataChanged(index, index); |
|
103 | emit dataChanged(index, index); | |
104 | return true; |
|
104 | return true; | |
105 | } |
|
105 | } | |
106 | return false; |
|
106 | return false; | |
107 | } |
|
107 | } | |
108 |
|
108 | |||
109 | Qt::ItemFlags CustomTableModel::flags ( const QModelIndex & index ) const |
|
109 | Qt::ItemFlags CustomTableModel::flags ( const QModelIndex & index ) const | |
110 | { |
|
110 | { | |
111 | return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; |
|
111 | return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; | |
112 | } |
|
112 | } | |
113 |
|
113 | |||
114 | void CustomTableModel::addMapping(QString color, QRect area) |
|
114 | void CustomTableModel::addMapping(QString color, QRect area) | |
115 | { |
|
115 | { | |
116 | m_mapping.insertMulti(color, area); |
|
116 | m_mapping.insertMulti(color, area); | |
117 | } |
|
117 | } |
@@ -1,106 +1,108 | |||||
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 "tablewidget.h" |
|
21 | #include "tablewidget.h" | |
22 | #include "customtablemodel.h" |
|
22 | #include "customtablemodel.h" | |
23 | #include <QGridLayout> |
|
23 | #include <QGridLayout> | |
24 | #include <QTableView> |
|
24 | #include <QTableView> | |
25 | #include <QChart> |
|
25 | #include <QChart> | |
26 | #include <QChartView> |
|
26 | #include <QChartView> | |
27 | #include <QLineSeries> |
|
27 | #include <QLineSeries> | |
28 | #include <QVXYModelMapper> |
|
28 | #include <QVXYModelMapper> | |
29 | #include <QGroupedBarSeries> |
|
29 | #include <QGroupedBarSeries> | |
30 | #include <QBarSet> |
|
30 | #include <QBarSet> | |
31 | #include <QVBarModelMapper> |
|
31 | #include <QVBarModelMapper> | |
32 | #include <QHeaderView> |
|
32 | #include <QHeaderView> | |
33 |
|
33 | |||
34 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
34 | QTCOMMERCIALCHART_USE_NAMESPACE | |
35 |
|
35 | |||
36 | TableWidget::TableWidget(QWidget *parent) |
|
36 | TableWidget::TableWidget(QWidget *parent) | |
37 | : QWidget(parent) |
|
37 | : QWidget(parent) | |
38 | { |
|
38 | { | |
39 | // create simple model for storing data |
|
39 | // create simple model for storing data | |
40 | // user's table data model |
|
40 | // user's table data model | |
41 | //! [1] |
|
41 | //! [1] | |
42 | CustomTableModel *model = new CustomTableModel; |
|
42 | CustomTableModel *model = new CustomTableModel; | |
43 | //! [1] |
|
43 | //! [1] | |
44 |
|
44 | |||
45 | //! [2] |
|
45 | //! [2] | |
46 | // create table view and add model to it |
|
46 | // create table view and add model to it | |
47 | QTableView *tableView = new QTableView; |
|
47 | QTableView *tableView = new QTableView; | |
48 | tableView->setModel(model); |
|
48 | tableView->setModel(model); | |
49 | tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch); |
|
49 | tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch); | |
50 |
|
|
50 | tableView->verticalHeader()->setResizeMode(QHeaderView::Stretch); | |
51 | //! [2] |
|
51 | //! [2] | |
52 |
|
52 | |||
53 | //! [3] |
|
53 | //! [3] | |
54 | QChart *chart = new QChart; |
|
54 | QChart *chart = new QChart; | |
55 | chart->setAnimationOptions(QChart::AllAnimations); |
|
55 | chart->setAnimationOptions(QChart::AllAnimations); | |
56 | //! [3] |
|
56 | //! [3] | |
57 |
|
57 | |||
58 | // series 1 |
|
58 | // series 1 | |
59 | //! [4] |
|
59 | //! [4] | |
60 | QGroupedBarSeries *series = new QGroupedBarSeries; |
|
60 | QGroupedBarSeries *series = new QGroupedBarSeries; | |
61 |
|
61 | |||
62 | int first = 3; |
|
62 | int first = 3; | |
63 | int count = 5; |
|
63 | int count = 5; | |
64 | QVBarModelMapper *mapper = new QVBarModelMapper(this); |
|
64 | QVBarModelMapper *mapper = new QVBarModelMapper(this); | |
65 | mapper->setFirstBarSetColumn(1); |
|
65 | mapper->setFirstBarSetColumn(1); | |
66 | mapper->setLastBarSetColumn(4); |
|
66 | mapper->setLastBarSetColumn(4); | |
67 | mapper->setFirst(3); |
|
67 | mapper->setFirst(3); | |
68 | mapper->setCount(count); |
|
68 | mapper->setCount(count); | |
69 | mapper->setSeries(series); |
|
69 | mapper->setSeries(series); | |
70 | mapper->setModel(model); |
|
70 | mapper->setModel(model); | |
71 | chart->addSeries(series); |
|
71 | chart->addSeries(series); | |
72 | //! [4] |
|
72 | //! [4] | |
73 |
|
73 | |||
74 | QStringList categories; |
|
|||
75 | categories << "June" << "July" << "August" << "September" << "October" << "November"; |
|
|||
76 |
|
||||
77 | chart->axisX()->categories()->insert(categories); |
|
|||
78 |
|
||||
79 | //! [5] |
|
74 | //! [5] | |
80 | // for storing color hex from the series |
|
75 | // for storing color hex from the series | |
81 | QString seriesColorHex = "#000000"; |
|
76 | QString seriesColorHex = "#000000"; | |
82 |
|
77 | |||
83 | // get the color of the series and use it for showing the mapped area |
|
78 | // get the color of the series and use it for showing the mapped area | |
84 | QList<QBarSet*> barsets = series->barSets(); |
|
79 | QList<QBarSet*> barsets = series->barSets(); | |
85 | for (int i = 0; i < barsets.count(); i++) { |
|
80 | for (int i = 0; i < barsets.count(); i++) { | |
86 | seriesColorHex = "#" + QString::number(barsets.at(i)->brush().color().rgb(), 16).right(6).toUpper(); |
|
81 | seriesColorHex = "#" + QString::number(barsets.at(i)->brush().color().rgb(), 16).right(6).toUpper(); | |
87 | model->addMapping(seriesColorHex, QRect(1 + i, first, 1, barsets.at(i)->count())); |
|
82 | model->addMapping(seriesColorHex, QRect(1 + i, first, 1, barsets.at(i)->count())); | |
88 | } |
|
83 | } | |
89 | //! [5] |
|
84 | //! [5] | |
90 |
|
85 | |||
91 |
//! [ |
|
86 | //! [6] | |
|
87 | QStringList categories; | |||
|
88 | categories << "April" << "May" << "June" << "July" << "August"; | |||
|
89 | ||||
|
90 | chart->axisX()->categories()->insert(categories); | |||
|
91 | //! [6] | |||
|
92 | ||||
|
93 | //! [7] | |||
92 | QChartView *chartView = new QChartView(chart); |
|
94 | QChartView *chartView = new QChartView(chart); | |
93 | chartView->setRenderHint(QPainter::Antialiasing); |
|
95 | chartView->setRenderHint(QPainter::Antialiasing); | |
94 | chartView->setMinimumSize(640, 480); |
|
96 | chartView->setMinimumSize(640, 480); | |
95 |
//! [ |
|
97 | //! [7] | |
96 |
|
98 | |||
97 |
//! [ |
|
99 | //! [8] | |
98 | // create main layout |
|
100 | // create main layout | |
99 | QGridLayout* mainLayout = new QGridLayout; |
|
101 | QGridLayout* mainLayout = new QGridLayout; | |
100 | mainLayout->addWidget(tableView, 1, 0); |
|
102 | mainLayout->addWidget(tableView, 1, 0); | |
101 | mainLayout->addWidget(chartView, 1, 1); |
|
103 | mainLayout->addWidget(chartView, 1, 1); | |
102 | mainLayout->setColumnStretch(1, 1); |
|
104 | mainLayout->setColumnStretch(1, 1); | |
103 | mainLayout->setColumnStretch(0, 0); |
|
105 | mainLayout->setColumnStretch(0, 0); | |
104 | setLayout(mainLayout); |
|
106 | setLayout(mainLayout); | |
105 |
//! [ |
|
107 | //! [8] | |
106 | } |
|
108 | } |
@@ -1,285 +1,291 | |||||
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 "qareaseries.h" |
|
21 | #include "qareaseries.h" | |
22 | #include "qareaseries_p.h" |
|
22 | #include "qareaseries_p.h" | |
23 | #include "qlineseries.h" |
|
23 | #include "qlineseries.h" | |
24 | #include "areachartitem_p.h" |
|
24 | #include "areachartitem_p.h" | |
25 | #include "legendmarker_p.h" |
|
25 | #include "legendmarker_p.h" | |
26 | #include "domain_p.h" |
|
26 | #include "domain_p.h" | |
27 | #include "chartdataset_p.h" |
|
27 | #include "chartdataset_p.h" | |
28 | #include "charttheme_p.h" |
|
28 | #include "charttheme_p.h" | |
29 | #include "chartanimator_p.h" |
|
29 | #include "chartanimator_p.h" | |
30 |
|
30 | |||
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
32 |
|
32 | |||
33 | /*! |
|
33 | /*! | |
34 | \class QAreaSeries |
|
34 | \class QAreaSeries | |
35 | \brief The QAreaSeries class is used for making area charts. |
|
35 | \brief The QAreaSeries class is used for making area charts. | |
36 |
|
36 | |||
37 | \mainclass |
|
37 | \mainclass | |
38 |
|
38 | |||
39 | An area chart is used to show quantitative data. It is based on line chart, in the way that area between axis and the line |
|
39 | An area chart is used to show quantitative data. It is based on line chart, in the way that area between axis and the line | |
40 | is emphasized with color. Since the area chart is based on line chart, QAreaSeries constructor needs QLineSeries instance, |
|
40 | is emphasized with color. Since the area chart is based on line chart, QAreaSeries constructor needs QLineSeries instance, | |
41 | which defines "upper" boundary of the area. "Lower" boundary is defined by default by axis X. Instead of axis X "lower" boundary can be specified by other line. |
|
41 | which defines "upper" boundary of the area. "Lower" boundary is defined by default by axis X. Instead of axis X "lower" boundary can be specified by other line. | |
42 | In that case QAreaSeries should be initiated with two QLineSerie instances. Please note terms "upper" and "lower" boundary can be misleading in cases |
|
42 | In that case QAreaSeries should be initiated with two QLineSerie instances. Please note terms "upper" and "lower" boundary can be misleading in cases | |
43 | where "lower" boundary had bigger values than the "upper" one, however the main point that area between these two boundary lines will be filled. |
|
43 | where "lower" boundary had bigger values than the "upper" one, however the main point that area between these two boundary lines will be filled. | |
44 |
|
44 | |||
45 | See the \l {AreaChart Example} {area chart example} to learn how to create a simple area chart. |
|
45 | See the \l {AreaChart Example} {area chart example} to learn how to create a simple area chart. | |
46 | \image examples_areachart.png |
|
46 | \image examples_areachart.png | |
47 | */ |
|
47 | */ | |
48 |
|
48 | |||
49 | /*! |
|
49 | /*! | |
50 | \fn QLineSeries* QAreaSeries::upperSeries() const |
|
50 | \fn QLineSeries* QAreaSeries::upperSeries() const | |
51 | \brief Returns upperSeries used to define one of area boundaries. |
|
51 | \brief Returns upperSeries used to define one of area boundaries. | |
52 | */ |
|
52 | */ | |
53 |
|
53 | |||
54 | /*! |
|
54 | /*! | |
55 | \fn QLineSeries* QAreaSeries::lowerSeries() const |
|
55 | \fn QLineSeries* QAreaSeries::lowerSeries() const | |
56 | \brief Returns lowerSeries used to define one of area boundaries. Note if QAreaSeries where counstucted wihtout a\ lowerSeries |
|
56 | \brief Returns lowerSeries used to define one of area boundaries. Note if QAreaSeries where counstucted wihtout a\ lowerSeries | |
57 | this function return Null pointer. |
|
57 | this function return Null pointer. | |
58 | */ |
|
58 | */ | |
59 |
|
59 | |||
60 | /*! |
|
60 | /*! | |
61 | \fn QPen QAreaSeries::pen() const |
|
61 | \fn QPen QAreaSeries::pen() const | |
62 | \brief Returns the pen used to draw line for this series. |
|
62 | \brief Returns the pen used to draw line for this series. | |
63 | \sa setPen() |
|
63 | \sa setPen() | |
64 | */ |
|
64 | */ | |
65 |
|
65 | |||
66 | /*! |
|
66 | /*! | |
67 | \fn QPen QAreaSeries::brush() const |
|
67 | \fn QPen QAreaSeries::brush() const | |
68 | \brief Returns the brush used to draw line for this series. |
|
68 | \brief Returns the brush used to draw line for this series. | |
69 | \sa setBrush() |
|
69 | \sa setBrush() | |
70 | */ |
|
70 | */ | |
71 |
|
71 | |||
72 | /*! |
|
72 | /*! | |
73 | \fn bool QAreaSeries::pointsVisible() const |
|
73 | \fn bool QAreaSeries::pointsVisible() const | |
74 | \brief Returns if the points are drawn for this series. |
|
74 | \brief Returns if the points are drawn for this series. | |
75 | \sa setPointsVisible() |
|
75 | \sa setPointsVisible() | |
76 | */ |
|
76 | */ | |
77 |
|
77 | |||
78 | /*! |
|
78 | /*! | |
79 | \fn void QAreaSeries::clicked(const QPointF& point) |
|
79 | \fn void QAreaSeries::clicked(const QPointF& point) | |
80 | \brief Signal is emitted when user clicks the \a point on area chart. |
|
80 | \brief Signal is emitted when user clicks the \a point on area chart. | |
81 | */ |
|
81 | */ | |
82 |
|
82 | |||
83 | /*! |
|
83 | /*! | |
84 | \fn void QAreaSeries::selected() |
|
84 | \fn void QAreaSeries::selected() | |
85 |
|
85 | |||
86 | The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be |
|
86 | The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be | |
87 | implemented by the user of QAreaSeries API. |
|
87 | implemented by the user of QAreaSeries API. | |
88 | */ |
|
88 | */ | |
89 |
|
89 | |||
90 | /*! |
|
90 | /*! | |
91 | \fn void QAreaSeriesPrivate::updated() |
|
91 | \fn void QAreaSeriesPrivate::updated() | |
92 | \brief \internal |
|
92 | \brief \internal | |
93 | */ |
|
93 | */ | |
94 |
|
94 | |||
95 | /*! |
|
95 | /*! | |
96 | Constructs area series object which is a child of \a upperSeries. Area will be spanned between \a |
|
96 | Constructs area series object which is a child of \a upperSeries. Area will be spanned between \a | |
97 | upperSeries line and \a lowerSeries line. If no \a lowerSeries is passed to constructor, area is specified by axis x (y=0) instead. |
|
97 | upperSeries line and \a lowerSeries line. If no \a lowerSeries is passed to constructor, area is specified by axis x (y=0) instead. | |
98 | When series object is added to QChartView or QChart instance ownerships is transferred. |
|
98 | When series object is added to QChartView or QChart instance ownerships is transferred. | |
99 | */ |
|
99 | */ | |
100 | QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries) |
|
100 | QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries) | |
101 | : QAbstractSeries(*new QAreaSeriesPrivate(upperSeries,lowerSeries,this),upperSeries) |
|
101 | : QAbstractSeries(*new QAreaSeriesPrivate(upperSeries,lowerSeries,this),upperSeries) | |
102 | { |
|
102 | { | |
103 | } |
|
103 | } | |
104 |
|
104 | |||
105 | /*! |
|
105 | /*! | |
106 | Constructs area series object without upper or lower series with \a parent object. |
|
106 | Constructs area series object without upper or lower series with \a parent object. | |
107 | */ |
|
107 | */ | |
108 | QAreaSeries::QAreaSeries(QObject *parent) |
|
108 | QAreaSeries::QAreaSeries(QObject *parent) | |
109 | : QAbstractSeries(*new QAreaSeriesPrivate(0, 0, this), parent) |
|
109 | : QAbstractSeries(*new QAreaSeriesPrivate(0, 0, this), parent) | |
110 | { |
|
110 | { | |
111 | } |
|
111 | } | |
112 |
|
112 | |||
113 | /*! |
|
113 | /*! | |
114 | Destroys the object. Series added to QChartView or QChart instances are owned by those, |
|
114 | Destroys the object. Series added to QChartView or QChart instances are owned by those, | |
115 | and are deleted when mentioned object are destroyed. |
|
115 | and are deleted when mentioned object are destroyed. | |
116 | */ |
|
116 | */ | |
117 | QAreaSeries::~QAreaSeries() |
|
117 | QAreaSeries::~QAreaSeries() | |
118 | { |
|
118 | { | |
119 | } |
|
119 | } | |
120 |
|
120 | |||
121 | /*! |
|
121 | /*! | |
122 | Returns QChartSeries::SeriesTypeArea. |
|
122 | Returns QChartSeries::SeriesTypeArea. | |
123 | */ |
|
123 | */ | |
124 | QAbstractSeries::SeriesType QAreaSeries::type() const |
|
124 | QAbstractSeries::SeriesType QAreaSeries::type() const | |
125 | { |
|
125 | { | |
126 | return QAbstractSeries::SeriesTypeArea; |
|
126 | return QAbstractSeries::SeriesTypeArea; | |
127 | } |
|
127 | } | |
128 |
|
128 | |||
|
129 | /*! | |||
|
130 | Sets the \a series that is to be used as the area chart upper series. | |||
|
131 | */ | |||
129 | void QAreaSeries::setUpperSeries(QLineSeries* series) |
|
132 | void QAreaSeries::setUpperSeries(QLineSeries* series) | |
130 | { |
|
133 | { | |
131 | Q_D(QAreaSeries); |
|
134 | Q_D(QAreaSeries); | |
132 | d->m_upperSeries = series; |
|
135 | d->m_upperSeries = series; | |
133 | } |
|
136 | } | |
134 |
|
137 | |||
135 | QLineSeries* QAreaSeries::upperSeries() const |
|
138 | QLineSeries* QAreaSeries::upperSeries() const | |
136 | { |
|
139 | { | |
137 | Q_D(const QAreaSeries); |
|
140 | Q_D(const QAreaSeries); | |
138 | return d->m_upperSeries; |
|
141 | return d->m_upperSeries; | |
139 | } |
|
142 | } | |
140 |
|
143 | |||
|
144 | /*! | |||
|
145 | Sets the \a series that is to be used as the area chart lower series. | |||
|
146 | */ | |||
141 | void QAreaSeries::setLowerSeries(QLineSeries* series) |
|
147 | void QAreaSeries::setLowerSeries(QLineSeries* series) | |
142 | { |
|
148 | { | |
143 | Q_D(QAreaSeries); |
|
149 | Q_D(QAreaSeries); | |
144 | d->m_lowerSeries = series; |
|
150 | d->m_lowerSeries = series; | |
145 | } |
|
151 | } | |
146 |
|
152 | |||
147 | QLineSeries* QAreaSeries::lowerSeries() const |
|
153 | QLineSeries* QAreaSeries::lowerSeries() const | |
148 | { |
|
154 | { | |
149 | Q_D(const QAreaSeries); |
|
155 | Q_D(const QAreaSeries); | |
150 | return d->m_lowerSeries; |
|
156 | return d->m_lowerSeries; | |
151 | } |
|
157 | } | |
152 |
|
158 | |||
153 | /*! |
|
159 | /*! | |
154 | Sets \a pen used for drawing area outline. |
|
160 | Sets \a pen used for drawing area outline. | |
155 | */ |
|
161 | */ | |
156 | void QAreaSeries::setPen(const QPen &pen) |
|
162 | void QAreaSeries::setPen(const QPen &pen) | |
157 | { |
|
163 | { | |
158 | Q_D(QAreaSeries); |
|
164 | Q_D(QAreaSeries); | |
159 | if (d->m_pen != pen) { |
|
165 | if (d->m_pen != pen) { | |
160 | d->m_pen = pen; |
|
166 | d->m_pen = pen; | |
161 | emit d->updated(); |
|
167 | emit d->updated(); | |
162 | } |
|
168 | } | |
163 | } |
|
169 | } | |
164 |
|
170 | |||
165 | QPen QAreaSeries::pen() const |
|
171 | QPen QAreaSeries::pen() const | |
166 | { |
|
172 | { | |
167 | Q_D(const QAreaSeries); |
|
173 | Q_D(const QAreaSeries); | |
168 | return d->m_pen; |
|
174 | return d->m_pen; | |
169 | } |
|
175 | } | |
170 |
|
176 | |||
171 | /*! |
|
177 | /*! | |
172 | Sets \a brush used for filling the area. |
|
178 | Sets \a brush used for filling the area. | |
173 | */ |
|
179 | */ | |
174 | void QAreaSeries::setBrush(const QBrush &brush) |
|
180 | void QAreaSeries::setBrush(const QBrush &brush) | |
175 | { |
|
181 | { | |
176 | Q_D(QAreaSeries); |
|
182 | Q_D(QAreaSeries); | |
177 | if (d->m_brush != brush) { |
|
183 | if (d->m_brush != brush) { | |
178 | d->m_brush = brush; |
|
184 | d->m_brush = brush; | |
179 | emit d->updated(); |
|
185 | emit d->updated(); | |
180 | } |
|
186 | } | |
181 | } |
|
187 | } | |
182 |
|
188 | |||
183 | QBrush QAreaSeries::brush() const |
|
189 | QBrush QAreaSeries::brush() const | |
184 | { |
|
190 | { | |
185 | Q_D(const QAreaSeries); |
|
191 | Q_D(const QAreaSeries); | |
186 | return d->m_brush; |
|
192 | return d->m_brush; | |
187 | } |
|
193 | } | |
188 | /*! |
|
194 | /*! | |
189 | Sets if data points are \a visible and should be drawn on line. |
|
195 | Sets if data points are \a visible and should be drawn on line. | |
190 | */ |
|
196 | */ | |
191 | void QAreaSeries::setPointsVisible(bool visible) |
|
197 | void QAreaSeries::setPointsVisible(bool visible) | |
192 | { |
|
198 | { | |
193 | Q_D(QAreaSeries); |
|
199 | Q_D(QAreaSeries); | |
194 | if (d->m_pointsVisible != visible) { |
|
200 | if (d->m_pointsVisible != visible) { | |
195 | d->m_pointsVisible = visible; |
|
201 | d->m_pointsVisible = visible; | |
196 | emit d->updated(); |
|
202 | emit d->updated(); | |
197 | } |
|
203 | } | |
198 | } |
|
204 | } | |
199 |
|
205 | |||
200 | bool QAreaSeries::pointsVisible() const |
|
206 | bool QAreaSeries::pointsVisible() const | |
201 | { |
|
207 | { | |
202 | Q_D(const QAreaSeries); |
|
208 | Q_D(const QAreaSeries); | |
203 | return d->m_pointsVisible; |
|
209 | return d->m_pointsVisible; | |
204 | } |
|
210 | } | |
205 |
|
211 | |||
206 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
212 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
207 |
|
213 | |||
208 | QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries,QAreaSeries* q) : |
|
214 | QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries,QAreaSeries* q) : | |
209 | QAbstractSeriesPrivate(q), |
|
215 | QAbstractSeriesPrivate(q), | |
210 | m_upperSeries(upperSeries), |
|
216 | m_upperSeries(upperSeries), | |
211 | m_lowerSeries(lowerSeries), |
|
217 | m_lowerSeries(lowerSeries), | |
212 | m_pointsVisible(false) |
|
218 | m_pointsVisible(false) | |
213 | { |
|
219 | { | |
214 | } |
|
220 | } | |
215 |
|
221 | |||
216 | void QAreaSeriesPrivate::scaleDomain(Domain& domain) |
|
222 | void QAreaSeriesPrivate::scaleDomain(Domain& domain) | |
217 | { |
|
223 | { | |
218 | Q_Q(QAreaSeries); |
|
224 | Q_Q(QAreaSeries); | |
219 |
|
225 | |||
220 | qreal minX(domain.minX()); |
|
226 | qreal minX(domain.minX()); | |
221 | qreal minY(domain.minY()); |
|
227 | qreal minY(domain.minY()); | |
222 | qreal maxX(domain.maxX()); |
|
228 | qreal maxX(domain.maxX()); | |
223 | qreal maxY(domain.maxY()); |
|
229 | qreal maxY(domain.maxY()); | |
224 | int tickXCount(domain.tickXCount()); |
|
230 | int tickXCount(domain.tickXCount()); | |
225 | int tickYCount(domain.tickYCount()); |
|
231 | int tickYCount(domain.tickYCount()); | |
226 |
|
232 | |||
227 | QLineSeries* upperSeries = q->upperSeries(); |
|
233 | QLineSeries* upperSeries = q->upperSeries(); | |
228 | QLineSeries* lowerSeries = q->lowerSeries(); |
|
234 | QLineSeries* lowerSeries = q->lowerSeries(); | |
229 |
|
235 | |||
230 | const QList<QPointF>& points = upperSeries->points(); |
|
236 | const QList<QPointF>& points = upperSeries->points(); | |
231 |
|
237 | |||
232 | for (int i = 0; i < points.count(); i++) |
|
238 | for (int i = 0; i < points.count(); i++) | |
233 | { |
|
239 | { | |
234 | qreal x = points[i].x(); |
|
240 | qreal x = points[i].x(); | |
235 | qreal y = points[i].y(); |
|
241 | qreal y = points[i].y(); | |
236 | minX = qMin(minX, x); |
|
242 | minX = qMin(minX, x); | |
237 | minY = qMin(minY, y); |
|
243 | minY = qMin(minY, y); | |
238 | maxX = qMax(maxX, x); |
|
244 | maxX = qMax(maxX, x); | |
239 | maxY = qMax(maxY, y); |
|
245 | maxY = qMax(maxY, y); | |
240 | } |
|
246 | } | |
241 | if(lowerSeries) { |
|
247 | if(lowerSeries) { | |
242 |
|
248 | |||
243 | const QList<QPointF>& points = lowerSeries->points(); |
|
249 | const QList<QPointF>& points = lowerSeries->points(); | |
244 |
|
250 | |||
245 | for (int i = 0; i < points.count(); i++) |
|
251 | for (int i = 0; i < points.count(); i++) | |
246 | { |
|
252 | { | |
247 | qreal x = points[i].x(); |
|
253 | qreal x = points[i].x(); | |
248 | qreal y = points[i].y(); |
|
254 | qreal y = points[i].y(); | |
249 | minX = qMin(minX, x); |
|
255 | minX = qMin(minX, x); | |
250 | minY = qMin(minY, y); |
|
256 | minY = qMin(minY, y); | |
251 | maxX = qMax(maxX, x); |
|
257 | maxX = qMax(maxX, x); | |
252 | maxY = qMax(maxY, y); |
|
258 | maxY = qMax(maxY, y); | |
253 | }} |
|
259 | }} | |
254 |
|
260 | |||
255 | domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount); |
|
261 | domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount); | |
256 | } |
|
262 | } | |
257 |
|
263 | |||
258 | Chart* QAreaSeriesPrivate::createGraphics(ChartPresenter* presenter) |
|
264 | Chart* QAreaSeriesPrivate::createGraphics(ChartPresenter* presenter) | |
259 | { |
|
265 | { | |
260 | Q_Q(QAreaSeries); |
|
266 | Q_Q(QAreaSeries); | |
261 |
|
267 | |||
262 | AreaChartItem* area = new AreaChartItem(q,presenter); |
|
268 | AreaChartItem* area = new AreaChartItem(q,presenter); | |
263 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { |
|
269 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { | |
264 | area->upperLineItem()->setAnimator(presenter->animator()); |
|
270 | area->upperLineItem()->setAnimator(presenter->animator()); | |
265 | area->upperLineItem()->setAnimation(new XYAnimation(area->upperLineItem())); |
|
271 | area->upperLineItem()->setAnimation(new XYAnimation(area->upperLineItem())); | |
266 | if(q->lowerSeries()) { |
|
272 | if(q->lowerSeries()) { | |
267 | area->lowerLineItem()->setAnimator(presenter->animator()); |
|
273 | area->lowerLineItem()->setAnimator(presenter->animator()); | |
268 | area->lowerLineItem()->setAnimation(new XYAnimation(area->lowerLineItem())); |
|
274 | area->lowerLineItem()->setAnimation(new XYAnimation(area->lowerLineItem())); | |
269 | } |
|
275 | } | |
270 | } |
|
276 | } | |
271 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); |
|
277 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); | |
272 | return area; |
|
278 | return area; | |
273 | } |
|
279 | } | |
274 |
|
280 | |||
275 | QList<LegendMarker*> QAreaSeriesPrivate::createLegendMarker(QLegend* legend) |
|
281 | QList<LegendMarker*> QAreaSeriesPrivate::createLegendMarker(QLegend* legend) | |
276 | { |
|
282 | { | |
277 | Q_Q(QAreaSeries); |
|
283 | Q_Q(QAreaSeries); | |
278 | QList<LegendMarker*> list; |
|
284 | QList<LegendMarker*> list; | |
279 | return list << new AreaLegendMarker(q,legend); |
|
285 | return list << new AreaLegendMarker(q,legend); | |
280 | } |
|
286 | } | |
281 |
|
287 | |||
282 | #include "moc_qareaseries.cpp" |
|
288 | #include "moc_qareaseries.cpp" | |
283 | #include "moc_qareaseries_p.cpp" |
|
289 | #include "moc_qareaseries_p.cpp" | |
284 |
|
290 | |||
285 | QTCOMMERCIALCHART_END_NAMESPACE |
|
291 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now