diff options
Diffstat (limited to 'examples/qmlbars/qml/qmlbars')
-rw-r--r-- | examples/qmlbars/qml/qmlbars/data.qml | 18 | ||||
-rw-r--r-- | examples/qmlbars/qml/qmlbars/main.qml | 24 |
2 files changed, 14 insertions, 28 deletions
diff --git a/examples/qmlbars/qml/qmlbars/data.qml b/examples/qmlbars/qml/qmlbars/data.qml index 12ba171c..5a17bcd1 100644 --- a/examples/qmlbars/qml/qmlbars/data.qml +++ b/examples/qmlbars/qml/qmlbars/data.qml @@ -21,24 +21,6 @@ import QtDataVisualization 1.0 Item { property alias model: dataModel - property alias mapping: valueMapping - property alias secondaryMapping: secondaryMapping - - //! [1] - BarDataMapping { - id: valueMapping - rowRole: "year" - columnRole: "month" - valueRole: "income" - } - //! [1] - - BarDataMapping { - id: secondaryMapping - rowRole: "year" - columnRole: "month" - valueRole: "expenses" - } //! [0] ListModel { diff --git a/examples/qmlbars/qml/qmlbars/main.qml b/examples/qmlbars/qml/qmlbars/main.qml index 753859e5..c7ec4f71 100644 --- a/examples/qmlbars/qml/qmlbars/main.qml +++ b/examples/qmlbars/qml/qmlbars/main.qml @@ -94,8 +94,10 @@ Item { ItemModelBarDataProxy { id: modelProxy - activeMapping: graphData.mapping itemModel: graphData.model + rowRole: "year" + columnRole: "month" + valueRole: "income" } onSelectedBarChanged: handleSelectionChange(barSeries, position) @@ -108,8 +110,10 @@ Item { ItemModelBarDataProxy { id: secondaryProxy - activeMapping: graphData.secondaryMapping itemModel: graphData.model + rowRole: "year" + columnRole: "month" + valueRole: "expenses" } onSelectedBarChanged: handleSelectionChange(secondarySeries, position) @@ -170,16 +174,16 @@ Item { onClicked: { if (testGraph.rowAxis.max !== 6) { text = "Show 2010 - 2012" - graphData.mapping.autoRowCategories = true - graphData.secondaryMapping.autoRowCategories = true + modelProxy.autoRowCategories = true + secondaryProxy.autoRowCategories = true } else { text = "Show all years" // Explicitly defining row categories, since we do not want to show data for // all years in the model, just for the selected ones. - graphData.mapping.autoRowCategories = false - graphData.secondaryMapping.autoRowCategories = false - graphData.mapping.rowCategories = ["2010", "2011", "2012"] - graphData.secondaryMapping.rowCategories = ["2010", "2011", "2012"] + modelProxy.autoRowCategories = false + secondaryProxy.autoRowCategories = false + modelProxy.rowCategories = ["2010", "2011", "2012"] + secondaryProxy.rowCategories = ["2010", "2011", "2012"] } } //! [1] @@ -199,8 +203,8 @@ Item { //! [2] onCurrentRowChanged: { - var rowIndex = modelProxy.activeMapping.rowCategoryIndex(graphData.model.get(currentRow).year) - var colIndex = modelProxy.activeMapping.columnCategoryIndex(graphData.model.get(currentRow).month) + var rowIndex = modelProxy.rowCategoryIndex(graphData.model.get(currentRow).year) + var colIndex = modelProxy.columnCategoryIndex(graphData.model.get(currentRow).month) if (selectedSeries.visible) mainview.selectedSeries.selectedBar = Qt.point(rowIndex, colIndex) else if (barSeries.visible) |