summaryrefslogtreecommitdiffstats
path: root/examples/datavisualization/qmlbars/doc
diff options
context:
space:
mode:
Diffstat (limited to 'examples/datavisualization/qmlbars/doc')
-rw-r--r--examples/datavisualization/qmlbars/doc/src/qmlbars.qdoc17
1 files changed, 13 insertions, 4 deletions
diff --git a/examples/datavisualization/qmlbars/doc/src/qmlbars.qdoc b/examples/datavisualization/qmlbars/doc/src/qmlbars.qdoc
index d3da5e6a..f2a0f8b0 100644
--- a/examples/datavisualization/qmlbars/doc/src/qmlbars.qdoc
+++ b/examples/datavisualization/qmlbars/doc/src/qmlbars.qdoc
@@ -39,9 +39,9 @@
\snippet qmlbars/qml/qmlbars/Data.qml 0
\dots
- Each data item has four roles: year, month, income, and expenses. Years and months are natural to
- map to rows and columns of a bar chart, but we can only show either income or expenses as the
- value.
+ Each data item has three roles: timestamp, income, and expenses. The timestamp value is in
+ format: \c{<four digit year>-<two digit month>}. Years and months are natural to map to rows and
+ columns of a bar chart, but we can only show either income or expenses as the value.
Now we need to add the data to the Bars3D graph. We will create two Bar3DSeries inside it,
starting with a series for the income:
@@ -50,7 +50,16 @@
\dots
The data is attached to the \c itemModel property of the ItemModelBarDataProxy inside the
- series.
+ series. For \c valueRole we simply specify the \c income field, as it contains the value we
+ want, but getting the years and months is a bit more complicated, since they are both found
+ in the same field. To extract those values, we specify the \c timestamp field for both
+ \c rowRole and \c columnRole, and additionally specify a search pattern and a replace rule
+ for those roles to extract the correct portion of the field contents for each role.
+ The search pattern is a normal JavaScript regular expression and the replace rule specifies
+ what the field content that matches the regular expression is replaced with.
+ In this case we want to replace the entire field content with just the year or the month.
+ For more information how the replace using regular expressions works, see
+ QString::replace(const QRegExp &rx, const QString &after) function documentation.
Then we add another series for the expenses: