@@ -25,14 +25,14 | |||
|
25 | 25 | |
|
26 | 26 | First line of the code below creates new grouped bar series. Variables firstRow and rowCount are used to define a custom model mapping. |
|
27 | 27 | 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. |
|
28 |
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 |
|
|
28 | 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 with indexes from 1 to 4(inclusive). | |
|
29 | 29 | To create a connection between the series and the model we set both of those objects to QVBarModelMapper. |
|
30 | 30 | |
|
31 | 31 | Finally the series is added to the chart. |
|
32 | 32 | |
|
33 | 33 | \snippet ../examples/barmodelmapper/tablewidget.cpp 4 |
|
34 | 34 | |
|
35 |
To show in QTableView which data coresponds with which |
|
|
35 | To show in QTableView which data coresponds with which bar set this example uses table coloring. | |
|
36 | 36 | When series is added to the chart it is assigned a color beased on the currently selected theme. |
|
37 | 37 | Code below extracts that color from the series and uses it to create colored QTableView. |
|
38 | 38 | Coloring of the view is not a part of the QChart functionality. |
@@ -65,7 +65,7 TableWidget::TableWidget(QWidget *parent) | |||
|
65 | 65 | QVBarModelMapper *mapper = new QVBarModelMapper(this); |
|
66 | 66 | mapper->setFirstBarSetColumn(1); |
|
67 | 67 | mapper->setLastBarSetColumn(4); |
|
68 |
mapper->setFirst( |
|
|
68 | mapper->setFirst(first); | |
|
69 | 69 | mapper->setCount(count); |
|
70 | 70 | mapper->setSeries(series); |
|
71 | 71 | mapper->setModel(model); |
General Comments 0
You need to be logged in to leave comments.
Login now