diff --git a/demos/qmlchart/qml/qmlchart/View10.qml b/demos/qmlchart/qml/qmlchart/View10.qml new file mode 100644 index 0000000..4e23106 --- /dev/null +++ b/demos/qmlchart/qml/qmlchart/View10.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the Qt Commercial Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtCommercial.Chart 1.0 + +Rectangle { + anchors.fill: parent + + //![1] + ChartView { + title: "Horizontal Stacked Bar series" + anchors.fill: parent + legend.alignment: Qt.AlignBottom + BarCategoriesAxis { + id: myAxis; + categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] + } + HorizontalStackedBarSeries { + id: mySeries; + BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } + BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } + BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } + } + Component.onCompleted: { + createDefaultAxes(); + setAxisY(myAxis,mySeries); + } + } + //![1] +} diff --git a/demos/qmlchart/qml/qmlchart/View11.qml b/demos/qmlchart/qml/qmlchart/View11.qml new file mode 100644 index 0000000..63d1e41 --- /dev/null +++ b/demos/qmlchart/qml/qmlchart/View11.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the Qt Commercial Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtCommercial.Chart 1.0 + +Rectangle { + anchors.fill: parent + + //![1] + ChartView { + title: "Horizontal Percent Bar series" + anchors.fill: parent + legend.alignment: Qt.AlignBottom + BarCategoriesAxis { + id: myAxis + categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] + } + HorizontalPercentBarSeries { + id: mySeries + BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } + BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } + BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } + } + Component.onCompleted: { + createDefaultAxes(); + setAxisY(myAxis,mySeries); + } + } + //![1] +} + diff --git a/demos/qmlchart/qml/qmlchart/View9.qml b/demos/qmlchart/qml/qmlchart/View9.qml new file mode 100644 index 0000000..2c350b8 --- /dev/null +++ b/demos/qmlchart/qml/qmlchart/View9.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the Qt Commercial Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtCommercial.Chart 1.0 + +Rectangle { + anchors.fill: parent + + //![1] + ChartView { + title: "Horizontal Bar series" + anchors.fill: parent + legend.alignment: Qt.AlignBottom + BarCategoriesAxis { + id: myAxis + categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] + } + HorizontalBarSeries { + id: mySeries + BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } + BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } + BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } + } + Component.onCompleted: { + createDefaultAxes(); + setAxisY(myAxis,mySeries); + } + } + //![1] +} + diff --git a/demos/qmlchart/qml/qmlchart/main.qml b/demos/qmlchart/qml/qmlchart/main.qml index 4017db2..26b1687 100644 --- a/demos/qmlchart/qml/qmlchart/main.qml +++ b/demos/qmlchart/qml/qmlchart/main.qml @@ -74,7 +74,7 @@ Rectangle { function nextView() { var i = viewNumber + 1; - if (i > 8) + if (i > 11) viewNumber = 1; else viewNumber = i; @@ -83,7 +83,7 @@ Rectangle { function previousView() { var i = viewNumber - 1; if (i <= 0) - viewNumber = 8; + viewNumber = 11; else viewNumber = i; } diff --git a/demos/qmlchart/resources.qrc b/demos/qmlchart/resources.qrc index bf03f1b..d717688 100644 --- a/demos/qmlchart/resources.qrc +++ b/demos/qmlchart/resources.qrc @@ -10,5 +10,8 @@ qml/qmlchart/View6.qml qml/qmlchart/View7.qml qml/qmlchart/View8.qml + qml/qmlchart/View9.qml + qml/qmlchart/View10.qml + qml/qmlchart/View11.qml diff --git a/plugins/declarative/declarativechart.cpp b/plugins/declarative/declarativechart.cpp index 4d46e8c..10787a5 100644 --- a/plugins/declarative/declarativechart.cpp +++ b/plugins/declarative/declarativechart.cpp @@ -478,6 +478,15 @@ QAbstractSeries *DeclarativeChart::createSeries(DeclarativeChart::SeriesType typ case DeclarativeChart::SeriesTypeBar: series = new DeclarativeBarSeries(); break; + case DeclarativeChart::SeriesTypeHorizontalBar: + series = new DeclarativeHorizontalBarSeries(); + break; + case DeclarativeChart::SeriesTypeHorizontalPercentBar: + series = new DeclarativeHorizontalPercentBarSeries(); + break; + case DeclarativeChart::SeriesTypeHorizontalStackedBar: + series = new DeclarativeHorizontalStackedBarSeries(); + break; case DeclarativeChart::SeriesTypePie: series = new DeclarativePieSeries(); break; diff --git a/plugins/declarative/declarativechart.h b/plugins/declarative/declarativechart.h index c8481b8..4af7a57 100644 --- a/plugins/declarative/declarativechart.h +++ b/plugins/declarative/declarativechart.h @@ -77,7 +77,10 @@ public: SeriesTypePercentBar, SeriesTypePie, SeriesTypeScatter, - SeriesTypeSpline + SeriesTypeSpline, + SeriesTypeHorizontalBar, + SeriesTypeHorizontalStackedBar, + SeriesTypeHorizontalPercentBar }; public: diff --git a/plugins/declarative/plugin.cpp b/plugins/declarative/plugin.cpp index 9569e98..dedf835 100644 --- a/plugins/declarative/plugin.cpp +++ b/plugins/declarative/plugin.cpp @@ -59,6 +59,9 @@ public: qmlRegisterType(uri, 1, 0, "BarSeries"); qmlRegisterType(uri, 1, 0, "StackedBarSeries"); qmlRegisterType(uri, 1, 0, "PercentBarSeries"); + qmlRegisterType(uri, 1, 0, "HorizontalBarSeries"); + qmlRegisterType(uri, 1, 0, "HorizontalStackedBarSeries"); + qmlRegisterType(uri, 1, 0, "HorizontalPercentBarSeries"); qmlRegisterType(uri, 1, 0, "PieSeries"); qmlRegisterType(uri, 1, 0, "PieSlice"); qmlRegisterType(uri, 1, 0, "BarSet");