@@ -25,7 +25,7 | |||||
25 | #include <QChart> |
|
25 | #include <QChart> | |
26 | #include <QChartView> |
|
26 | #include <QChartView> | |
27 | #include <QLineSeries> |
|
27 | #include <QLineSeries> | |
28 |
#include |
|
28 | #include <QVXYModelMapper> | |
29 | #include <QHeaderView> |
|
29 | #include <QHeaderView> | |
30 |
|
30 | |||
31 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
31 | QTCOMMERCIALCHART_USE_NAMESPACE | |
@@ -52,47 +52,44 TableWidget::TableWidget(QWidget *parent) | |||||
52 | chart->setAnimationOptions(QChart::AllAnimations); |
|
52 | chart->setAnimationOptions(QChart::AllAnimations); | |
53 | //! [3] |
|
53 | //! [3] | |
54 |
|
54 | |||
55 |
|
|
55 | // series 1 | |
56 |
|
|
56 | //! [4] | |
57 |
|
|
57 | QLineSeries *series = new QLineSeries; | |
58 | // series->setModel(model); |
|
58 | QVXYModelMapper *mapper = new QVXYModelMapper(this); | |
|
59 | mapper->setXColumn(0); | |||
|
60 | mapper->setYColumn(1); | |||
|
61 | mapper->setSeries(series); | |||
|
62 | mapper->setModel(model); | |||
|
63 | chart->addSeries(series); | |||
|
64 | //! [4] | |||
59 |
|
65 | |||
60 | // QXYModelMapper *mapper = new QXYModelMapper; |
|
66 | //! [5] | |
61 | // mapper->setMapX(0); |
|
67 | // for storing color hex from the series | |
62 | // mapper->setMapY(1); |
|
68 | QString seriesColorHex = "#000000"; | |
63 | // series->setModelMapper(mapper); |
|
|||
64 | //// series->setModelMapping(0, 1, Qt::Vertical); |
|
|||
65 | // chart->addSeries(series); |
|
|||
66 | // //! [4] |
|
|||
67 |
|
69 | |||
68 | // //! [5] |
|
70 | // get the color of the series and use it for showing the mapped area | |
69 | // // for storing color hex from the series |
|
71 | seriesColorHex = "#" + QString::number(series->pen().color().rgb(), 16).right(6).toUpper(); | |
70 | // QString seriesColorHex = "#000000"; |
|
72 | model->addMapping(seriesColorHex, QRect(0, 0, 2, model->rowCount())); | |
|
73 | //! [5] | |||
71 |
|
74 | |||
72 | // // get the color of the series and use it for showing the mapped area |
|
|||
73 | // seriesColorHex = "#" + QString::number(series->pen().color().rgb(), 16).right(6).toUpper(); |
|
|||
74 | // model->addMapping(seriesColorHex, QRect(0, 0, 2, model->rowCount())); |
|
|||
75 | // //! [5] |
|
|||
76 |
|
75 | |||
|
76 | // series 2 | |||
|
77 | //! [6] | |||
|
78 | series = new QLineSeries; | |||
77 |
|
79 | |||
78 | // // series 2 |
|
80 | mapper = new QVXYModelMapper(this); | |
79 | // //! [6] |
|
81 | mapper->setXColumn(2); | |
80 | // series = new QLineSeries; |
|
82 | mapper->setYColumn(3); | |
81 | // series->setModel(model); |
|
83 | mapper->setSeries(series); | |
|
84 | mapper->setModel(model); | |||
|
85 | chart->addSeries(series); | |||
|
86 | //! [6] | |||
82 |
|
87 | |||
83 | // mapper = new QXYModelMapper; |
|
88 | //! [7] | |
84 | // mapper->setMapX(2); |
|
89 | // get the color of the series and use it for showing the mapped area | |
85 | // mapper->setMapY(3); |
|
90 | seriesColorHex = "#" + QString::number(series->pen().color().rgb(), 16).right(6).toUpper(); | |
86 | // series->setModelMapper(mapper); |
|
91 | model->addMapping(seriesColorHex, QRect(2, 0, 2, model->rowCount())); | |
87 | //// series->setModelMapping(2,3, Qt::Vertical); |
|
92 | //! [7] | |
88 | // chart->addSeries(series); |
|
|||
89 | // //! [6] |
|
|||
90 |
|
||||
91 | // //! [7] |
|
|||
92 | // // get the color of the series and use it for showing the mapped area |
|
|||
93 | // seriesColorHex = "#" + QString::number(series->pen().color().rgb(), 16).right(6).toUpper(); |
|
|||
94 | // model->addMapping(seriesColorHex, QRect(2, 0, 2, model->rowCount())); |
|
|||
95 | // //! [7] |
|
|||
96 |
|
93 | |||
97 | //! [8] |
|
94 | //! [8] | |
98 | QChartView *chartView = new QChartView(chart); |
|
95 | QChartView *chartView = new QChartView(chart); |
General Comments 0
You need to be logged in to leave comments.
Login now