diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-09-03 13:03:55 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-09-03 13:43:18 +0300 |
commit | 50ea34b642c43ab5bf0ff5db800d228effc486c1 (patch) | |
tree | 9e3197c8fbb2e6d91f2cf922938946a000df8124 /examples | |
parent | 69fbfffcd02f5deae8a96b3097b540cdbd6c2cf6 (diff) |
Improve qmlbarchart example
+ Fix building of surface example
+ Some warnings fixed
Task-number: QTRD-2239
Change-Id: If957d86fdd3499f8f81e283b06c79e547b6ba09c
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/qmlbarchart/qml/qmlbarchart/axes.qml | 2 | ||||
-rw-r--r-- | examples/qmlbarchart/qml/qmlbarchart/data.qml | 11 | ||||
-rw-r--r-- | examples/qmlbarchart/qml/qmlbarchart/main.qml | 19 | ||||
-rw-r--r-- | examples/surfacechart/surfacechart.pro | 2 |
4 files changed, 25 insertions, 9 deletions
diff --git a/examples/qmlbarchart/qml/qmlbarchart/axes.qml b/examples/qmlbarchart/qml/qmlbarchart/axes.qml index 6bbfef9e..8b97c52e 100644 --- a/examples/qmlbarchart/qml/qmlbarchart/axes.qml +++ b/examples/qmlbarchart/qml/qmlbarchart/axes.qml @@ -27,7 +27,7 @@ Item { CategoryAxis { id: rowAxis - categoryLabels: ["2000", "2001", "2002", "2003", "2004"] + categoryLabels: ["2000", "2001", "2002", "2003"] } CategoryAxis { id: columnAxis diff --git a/examples/qmlbarchart/qml/qmlbarchart/data.qml b/examples/qmlbarchart/qml/qmlbarchart/data.qml index da053734..f7fef334 100644 --- a/examples/qmlbarchart/qml/qmlbarchart/data.qml +++ b/examples/qmlbarchart/qml/qmlbarchart/data.qml @@ -28,7 +28,7 @@ Item { rowRole: "year" columnRole: "month" valueRole: "expenses" - rowCategories: ["2000", "2001", "2002", "2003", "2004"] + rowCategories: ["2000", "2001", "2002", "2003"] columnCategories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] } @@ -78,6 +78,13 @@ Item { ListElement{ year: "2003"; month: "Feb"; expenses: "4"; income: "8" } ListElement{ year: "2003"; month: "Mar"; expenses: "7"; income: "12" } ListElement{ year: "2003"; month: "Apr"; expenses: "9"; income: "15" } - // rest of 2003 missing on purpose, as well as whole of 2004 + ListElement{ year: "2003"; month: "May"; expenses: "7"; income: "19" } + ListElement{ year: "2003"; month: "Jun"; expenses: "9"; income: "18" } + ListElement{ year: "2003"; month: "Jul"; expenses: "13"; income: "17" } + ListElement{ year: "2003"; month: "Aug"; expenses: "5"; income: "9" } + ListElement{ year: "2003"; month: "Sep"; expenses: "3"; income: "8" } + ListElement{ year: "2003"; month: "Oct"; expenses: "13"; income: "15" } + ListElement{ year: "2003"; month: "Nov"; expenses: "8"; income: "17" } + ListElement{ year: "2003"; month: "Dec"; expenses: "7"; income: "10" } } } diff --git a/examples/qmlbarchart/qml/qmlbarchart/main.qml b/examples/qmlbarchart/qml/qmlbarchart/main.qml index 89e4198d..8de31903 100644 --- a/examples/qmlbarchart/qml/qmlbarchart/main.qml +++ b/examples/qmlbarchart/qml/qmlbarchart/main.qml @@ -23,8 +23,8 @@ import "." Item { id: mainview - width: 800 - height: 600 + width: 1280 + height: 1024 visible: true Data { @@ -52,7 +52,7 @@ Item { selectionMode: Bars3D.ModeItem labelTransparency: Bars3D.TransparencyNone theme: Bars3D.ThemeBrownSand - rows: 5 + rows: 4 columns: 12 mapping: chartData.mapping barThickness: 0.5 @@ -63,6 +63,7 @@ Item { columnAxis: chartAxes.column valueAxis: chartAxes.expenses itemLabelFormat: "@valueTitle for @colLabel, @rowLabel: @valueLabel" + backgroundVisible: true onDataResolved: { // Can't select a bar until data has been resolved from model to proxy @@ -79,13 +80,19 @@ Item { id: tableView x: 0 y: 0 - width: 300 + width: 298 height: parent.height - mappingToggle.height - shadowToggle.height TableViewColumn{ role: "year" ; title: "Year" ; width: 80 } TableViewColumn{ role: "month" ; title: "Month" ; width: 80 } - TableViewColumn{ role: "expenses" ; title: "Expenses" ; width: 70 } - TableViewColumn{ role: "income" ; title: "Income" ; width: 70 } + TableViewColumn{ role: "expenses" ; title: "Expenses" ; width: 60 } + TableViewColumn{ role: "income" ; title: "Income" ; width: 60 } model: chartData.model + + onClicked: { + var rowIndex = testchart.mapping.rowCategoryIndex(chartData.model.get(row).year) + var colIndex = testchart.mapping.columnCategoryIndex(chartData.model.get(row).month) + testchart.selectedBarPos = Qt.point(rowIndex, colIndex) + } } Button { diff --git a/examples/surfacechart/surfacechart.pro b/examples/surfacechart/surfacechart.pro index 69cc270e..6b3067ae 100644 --- a/examples/surfacechart/surfacechart.pro +++ b/examples/surfacechart/surfacechart.pro @@ -11,3 +11,5 @@ INSTALLS += target HEADERS += \ chartmodifier.h + +QT += widgets |