summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTitta Heikkala <titta.heikkala@digia.com>2014-05-22 13:55:02 +0300
committerTitta Heikkala <titta.heikkala@digia.com>2014-05-27 08:32:02 +0300
commitdb3eff743f503c292f0a0ec639ccc2ac4182c731 (patch)
treee141c399238e3445a5cf45d36b81be484828e7ab /tests
parentbdd8266c9c7d99dbf28a092185506e321e96e8a8 (diff)
Added possibility to show series value
For line, spline and scatter series it is possible to show the point values above the point. The format, color and the font of the label can be set. For bar series the format and position of the value label can be set. Task-number: QTRD-2808 Change-Id: I0488d98c4d9060eaa8331e5b3c97dc83d86aeb0c Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qbarseries/tst_qbarseries.cpp58
-rw-r--r--tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp58
-rw-r--r--tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp58
-rw-r--r--tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp58
-rw-r--r--tests/auto/qlineseries/tst_qlineseries.cpp5
-rw-r--r--tests/auto/qml-qtquicktest/tst_barseries.qml12
-rw-r--r--tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp58
-rw-r--r--tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp58
-rw-r--r--tests/auto/qxyseries/tst_qxyseries.cpp72
-rw-r--r--tests/auto/qxyseries/tst_qxyseries.h4
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml12
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml26
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml12
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/BarEditor.qml13
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/HorizontalBarChart.qml14
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/HorizontalPercentBarChart.qml15
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/HorizontalStackedBarChart.qml16
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/LineChart.qml12
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml26
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml14
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml12
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml26
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml12
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml14
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/AreaChart.qml12
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/AreaEditor.qml26
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/BarChart.qml12
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml13
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/HorizontalBarChart.qml14
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml16
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml16
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml12
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml26
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/PercentBarChart.qml14
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ScatterChart.qml12
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml26
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/SplineChart.qml12
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml14
38 files changed, 870 insertions, 20 deletions
diff --git a/tests/auto/qbarseries/tst_qbarseries.cpp b/tests/auto/qbarseries/tst_qbarseries.cpp
index 3dcc30d3..f2c056a0 100644
--- a/tests/auto/qbarseries/tst_qbarseries.cpp
+++ b/tests/auto/qbarseries/tst_qbarseries.cpp
@@ -29,6 +29,7 @@ QTCOMMERCIALCHART_USE_NAMESPACE
Q_DECLARE_METATYPE(QBarSet*)
Q_DECLARE_METATYPE(QList<QBarSet*>)
+Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition)
class tst_QBarSeries : public QObject
{
@@ -59,6 +60,8 @@ private slots:
void barSets();
void setLabelsVisible_data();
void setLabelsVisible();
+ void setLabelsFormat();
+ void setLabelsPosition();
void opacity();
void mouseclicked_data();
void mouseclicked();
@@ -79,6 +82,7 @@ void tst_QBarSeries::initTestCase()
{
qRegisterMetaType<QBarSet*>("QBarSet*");
qRegisterMetaType<QList<QBarSet*> >("QList<QBarSet*>");
+ qRegisterMetaType<QAbstractBarSeries::LabelsPosition>("QAbstractBarSeries::LabelsPosition");
}
void tst_QBarSeries::cleanupTestCase()
@@ -343,6 +347,60 @@ void tst_QBarSeries::setLabelsVisible()
QVERIFY(m_barseries_with_sets->isLabelsVisible() == true);
}
+void tst_QBarSeries::setLabelsFormat()
+{
+ QSignalSpy labelsFormatSpy(m_barseries, SIGNAL(labelsFormatChanged(QString)));
+ QCOMPARE(m_barseries->labelsFormat(), QString());
+
+ QString format("(@value)");
+ m_barseries->setLabelsFormat(format);
+ TRY_COMPARE(labelsFormatSpy.count(), 1);
+ QList<QVariant> arguments = labelsFormatSpy.takeFirst();
+ QVERIFY(arguments.at(0).toString() == format);
+ QCOMPARE(m_barseries->labelsFormat(), format);
+
+ m_barseries->setLabelsFormat(QString());
+ TRY_COMPARE(labelsFormatSpy.count(), 1);
+ arguments = labelsFormatSpy.takeFirst();
+ QVERIFY(arguments.at(0).toString() == QString());
+ QCOMPARE(m_barseries->labelsFormat(), QString());
+}
+
+void tst_QBarSeries::setLabelsPosition()
+{
+ QSignalSpy labelsPositionSpy(m_barseries,
+ SIGNAL(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)));
+ QCOMPARE(m_barseries->labelsPosition(), QBarSeries::LabelsCenter);
+
+ m_barseries->setLabelsPosition(QBarSeries::LabelsInsideEnd);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ QList<QVariant> arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QBarSeries::LabelsInsideEnd);
+ QCOMPARE(m_barseries->labelsPosition(), QBarSeries::LabelsInsideEnd);
+
+ m_barseries->setLabelsPosition(QBarSeries::LabelsInsideBase);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QBarSeries::LabelsInsideBase);
+ QCOMPARE(m_barseries->labelsPosition(), QBarSeries::LabelsInsideBase);
+
+ m_barseries->setLabelsPosition(QBarSeries::LabelsOutsideEnd);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QBarSeries::LabelsOutsideEnd);
+ QCOMPARE(m_barseries->labelsPosition(), QBarSeries::LabelsOutsideEnd);
+
+ m_barseries->setLabelsPosition(QBarSeries::LabelsCenter);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QBarSeries::LabelsCenter);
+ QCOMPARE(m_barseries->labelsPosition(), QBarSeries::LabelsCenter);
+}
+
void tst_QBarSeries::opacity()
{
QSignalSpy opacitySpy(m_barseries, SIGNAL(opacityChanged()));
diff --git a/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp b/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp
index fc6c4977..de5b868f 100644
--- a/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp
+++ b/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp
@@ -28,6 +28,7 @@
QTCOMMERCIALCHART_USE_NAMESPACE
Q_DECLARE_METATYPE(QBarSet*)
+Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition)
class tst_QHorizontalBarSeries : public QObject
{
@@ -56,6 +57,8 @@ private slots:
void barSets();
void setLabelsVisible_data();
void setLabelsVisible();
+ void setLabelsFormat();
+ void setLabelsPosition();
void mouseclicked_data();
void mouseclicked();
void mousehovered_data();
@@ -73,6 +76,7 @@ private:
void tst_QHorizontalBarSeries::initTestCase()
{
qRegisterMetaType<QBarSet*>("QBarSet*");
+ qRegisterMetaType<QAbstractBarSeries::LabelsPosition>("QAbstractBarSeries::LabelsPosition");
}
void tst_QHorizontalBarSeries::cleanupTestCase()
@@ -308,6 +312,60 @@ void tst_QHorizontalBarSeries::setLabelsVisible()
QVERIFY(m_barseries_with_sets->isLabelsVisible() == true);
}
+void tst_QHorizontalBarSeries::setLabelsFormat()
+{
+ QSignalSpy labelsFormatSpy(m_barseries, SIGNAL(labelsFormatChanged(QString)));
+ QCOMPARE(m_barseries->labelsFormat(), QString());
+
+ QString format("(@value)");
+ m_barseries->setLabelsFormat(format);
+ TRY_COMPARE(labelsFormatSpy.count(), 1);
+ QList<QVariant> arguments = labelsFormatSpy.takeFirst();
+ QVERIFY(arguments.at(0).toString() == format);
+ QCOMPARE(m_barseries->labelsFormat(), format);
+
+ m_barseries->setLabelsFormat(QString());
+ TRY_COMPARE(labelsFormatSpy.count(), 1);
+ arguments = labelsFormatSpy.takeFirst();
+ QVERIFY(arguments.at(0).toString() == QString());
+ QCOMPARE(m_barseries->labelsFormat(), QString());
+}
+
+void tst_QHorizontalBarSeries::setLabelsPosition()
+{
+ QSignalSpy labelsPositionSpy(m_barseries,
+ SIGNAL(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)));
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalBarSeries::LabelsCenter);
+
+ m_barseries->setLabelsPosition(QHorizontalBarSeries::LabelsInsideEnd);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ QList<QVariant> arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QHorizontalBarSeries::LabelsInsideEnd);
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalBarSeries::LabelsInsideEnd);
+
+ m_barseries->setLabelsPosition(QHorizontalBarSeries::LabelsInsideBase);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QHorizontalBarSeries::LabelsInsideBase);
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalBarSeries::LabelsInsideBase);
+
+ m_barseries->setLabelsPosition(QHorizontalBarSeries::LabelsOutsideEnd);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QHorizontalBarSeries::LabelsOutsideEnd);
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalBarSeries::LabelsOutsideEnd);
+
+ m_barseries->setLabelsPosition(QHorizontalBarSeries::LabelsCenter);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QHorizontalBarSeries::LabelsCenter);
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalBarSeries::LabelsCenter);
+}
+
void tst_QHorizontalBarSeries::mouseclicked_data()
{
diff --git a/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp b/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp
index 1812196d..7ff2181a 100644
--- a/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp
+++ b/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp
@@ -28,6 +28,7 @@
QTCOMMERCIALCHART_USE_NAMESPACE
Q_DECLARE_METATYPE(QBarSet*)
+Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition)
class tst_QHorizontalPercentBarSeries : public QObject
{
@@ -44,6 +45,8 @@ private slots:
void qhorizontalpercentbarseries();
void type_data();
void type();
+ void setLabelsFormat();
+ void setLabelsPosition();
void mouseclicked_data();
void mouseclicked();
void mousehovered_data();
@@ -56,6 +59,7 @@ private:
void tst_QHorizontalPercentBarSeries::initTestCase()
{
qRegisterMetaType<QBarSet*>("QBarSet*");
+ qRegisterMetaType<QAbstractBarSeries::LabelsPosition>("QAbstractBarSeries::LabelsPosition");
}
void tst_QHorizontalPercentBarSeries::cleanupTestCase()
@@ -93,6 +97,60 @@ void tst_QHorizontalPercentBarSeries::type()
QVERIFY(m_barseries->type() == QAbstractSeries::SeriesTypeHorizontalPercentBar);
}
+void tst_QHorizontalPercentBarSeries::setLabelsFormat()
+{
+ QSignalSpy labelsFormatSpy(m_barseries, SIGNAL(labelsFormatChanged(QString)));
+ QCOMPARE(m_barseries->labelsFormat(), QString());
+
+ QString format("(@value)");
+ m_barseries->setLabelsFormat(format);
+ TRY_COMPARE(labelsFormatSpy.count(), 1);
+ QList<QVariant> arguments = labelsFormatSpy.takeFirst();
+ QVERIFY(arguments.at(0).toString() == format);
+ QCOMPARE(m_barseries->labelsFormat(), format);
+
+ m_barseries->setLabelsFormat(QString());
+ TRY_COMPARE(labelsFormatSpy.count(), 1);
+ arguments = labelsFormatSpy.takeFirst();
+ QVERIFY(arguments.at(0).toString() == QString());
+ QCOMPARE(m_barseries->labelsFormat(), QString());
+}
+
+void tst_QHorizontalPercentBarSeries::setLabelsPosition()
+{
+ QSignalSpy labelsPositionSpy(m_barseries,
+ SIGNAL(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)));
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalPercentBarSeries::LabelsCenter);
+
+ m_barseries->setLabelsPosition(QHorizontalPercentBarSeries::LabelsInsideEnd);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ QList<QVariant> arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QHorizontalPercentBarSeries::LabelsInsideEnd);
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalPercentBarSeries::LabelsInsideEnd);
+
+ m_barseries->setLabelsPosition(QHorizontalPercentBarSeries::LabelsInsideBase);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QHorizontalPercentBarSeries::LabelsInsideBase);
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalPercentBarSeries::LabelsInsideBase);
+
+ m_barseries->setLabelsPosition(QHorizontalPercentBarSeries::LabelsOutsideEnd);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QHorizontalPercentBarSeries::LabelsOutsideEnd);
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalPercentBarSeries::LabelsOutsideEnd);
+
+ m_barseries->setLabelsPosition(QHorizontalPercentBarSeries::LabelsCenter);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QHorizontalPercentBarSeries::LabelsCenter);
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalPercentBarSeries::LabelsCenter);
+}
+
void tst_QHorizontalPercentBarSeries::mouseclicked_data()
{
diff --git a/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp b/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp
index f1940c6d..b25df764 100644
--- a/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp
+++ b/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp
@@ -28,6 +28,7 @@
QTCOMMERCIALCHART_USE_NAMESPACE
Q_DECLARE_METATYPE(QBarSet*)
+Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition)
class tst_QHorizontalStackedBarSeries : public QObject
{
@@ -44,6 +45,8 @@ private slots:
void qhorizontalstackedbarseries();
void type_data();
void type();
+ void setLabelsFormat();
+ void setLabelsPosition();
void mouseclicked_data();
void mouseclicked();
void mousehovered_data();
@@ -56,6 +59,7 @@ private:
void tst_QHorizontalStackedBarSeries::initTestCase()
{
qRegisterMetaType<QBarSet*>("QBarSet*");
+ qRegisterMetaType<QAbstractBarSeries::LabelsPosition>("QAbstractBarSeries::LabelsPosition");
}
void tst_QHorizontalStackedBarSeries::cleanupTestCase()
@@ -93,6 +97,60 @@ void tst_QHorizontalStackedBarSeries::type()
QVERIFY(m_barseries->type() == QAbstractSeries::SeriesTypeHorizontalStackedBar);
}
+void tst_QHorizontalStackedBarSeries::setLabelsFormat()
+{
+ QSignalSpy labelsFormatSpy(m_barseries, SIGNAL(labelsFormatChanged(QString)));
+ QCOMPARE(m_barseries->labelsFormat(), QString());
+
+ QString format("(@value)");
+ m_barseries->setLabelsFormat(format);
+ TRY_COMPARE(labelsFormatSpy.count(), 1);
+ QList<QVariant> arguments = labelsFormatSpy.takeFirst();
+ QVERIFY(arguments.at(0).toString() == format);
+ QCOMPARE(m_barseries->labelsFormat(), format);
+
+ m_barseries->setLabelsFormat(QString());
+ TRY_COMPARE(labelsFormatSpy.count(), 1);
+ arguments = labelsFormatSpy.takeFirst();
+ QVERIFY(arguments.at(0).toString() == QString());
+ QCOMPARE(m_barseries->labelsFormat(), QString());
+}
+
+void tst_QHorizontalStackedBarSeries::setLabelsPosition()
+{
+ QSignalSpy labelsPositionSpy(m_barseries,
+ SIGNAL(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)));
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalStackedBarSeries::LabelsCenter);
+
+ m_barseries->setLabelsPosition(QHorizontalStackedBarSeries::LabelsInsideEnd);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ QList<QVariant> arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QHorizontalStackedBarSeries::LabelsInsideEnd);
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalStackedBarSeries::LabelsInsideEnd);
+
+ m_barseries->setLabelsPosition(QHorizontalStackedBarSeries::LabelsInsideBase);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QHorizontalStackedBarSeries::LabelsInsideBase);
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalStackedBarSeries::LabelsInsideBase);
+
+ m_barseries->setLabelsPosition(QHorizontalStackedBarSeries::LabelsOutsideEnd);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QHorizontalStackedBarSeries::LabelsOutsideEnd);
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalStackedBarSeries::LabelsOutsideEnd);
+
+ m_barseries->setLabelsPosition(QHorizontalStackedBarSeries::LabelsCenter);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QHorizontalStackedBarSeries::LabelsCenter);
+ QCOMPARE(m_barseries->labelsPosition(), QHorizontalStackedBarSeries::LabelsCenter);
+}
+
void tst_QHorizontalStackedBarSeries::mouseclicked_data()
{
diff --git a/tests/auto/qlineseries/tst_qlineseries.cpp b/tests/auto/qlineseries/tst_qlineseries.cpp
index 0781932c..4d270619 100644
--- a/tests/auto/qlineseries/tst_qlineseries.cpp
+++ b/tests/auto/qlineseries/tst_qlineseries.cpp
@@ -75,6 +75,8 @@ void tst_QLineSeries::qlineseries()
QCOMPARE(series.points(), QList<QPointF>());
QCOMPARE(series.pen(), QPen());
QCOMPARE(series.pointsVisible(), false);
+ QCOMPARE(series.pointLabelsVisible(), false);
+ QCOMPARE(series.pointLabelsFormat(), QLatin1String("@xPoint, @yPoint"));
series.append(QList<QPointF>());
series.append(0.0,0.0);
@@ -91,6 +93,9 @@ void tst_QLineSeries::qlineseries()
series.setPen(QPen());
series.setPointsVisible(false);
+ series.setPointLabelsVisible(false);
+ series.setPointLabelsFormat(QString());
+
m_chart->addSeries(&series);
m_view->show();
QTest::qWaitForWindowShown(m_view);
diff --git a/tests/auto/qml-qtquicktest/tst_barseries.qml b/tests/auto/qml-qtquicktest/tst_barseries.qml
index 169a749f..c5a5cfb7 100644
--- a/tests/auto/qml-qtquicktest/tst_barseries.qml
+++ b/tests/auto/qml-qtquicktest/tst_barseries.qml
@@ -34,6 +34,7 @@ Rectangle {
function test_properties() {
compare(barSeries.barWidth, 0.5);
compare(barSeries.labelsVisible, false);
+ compare(barSeries.labelsPosition, BarSeries.LabelsCenter);
}
function test_setproperties() {
@@ -92,6 +93,12 @@ Rectangle {
compare(barSeries.count, 0);
}
+ function test_signals() {
+ labelsPositionSpy.clear();
+ barSeries.labelsPosition = BarSeries.LabelsOutsideEnd;
+ compare(labelsPositionSpy.count, 1, "onLabelsPositionChanged")
+ }
+
function test_remove() {
var setCount = 5;
var valueCount = 50;
@@ -136,6 +143,11 @@ Rectangle {
target: barSeries
signalName: "barsetsRemoved"
}
+ SignalSpy {
+ id: labelsPositionSpy
+ target: barSeries
+ signalName: "labelsPositionChanged"
+ }
}
StackedBarSeries {
diff --git a/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp b/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp
index 569e72e1..2d0cef96 100644
--- a/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp
+++ b/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp
@@ -28,6 +28,7 @@
QTCOMMERCIALCHART_USE_NAMESPACE
Q_DECLARE_METATYPE(QBarSet*)
+Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition)
class tst_QPercentBarSeries : public QObject
{
@@ -44,6 +45,8 @@ private slots:
void qpercentbarseries();
void type_data();
void type();
+ void setLabelsFormat();
+ void setLabelsPosition();
void mouseclicked_data();
void mouseclicked();
void mousehovered_data();
@@ -56,6 +59,7 @@ private:
void tst_QPercentBarSeries::initTestCase()
{
qRegisterMetaType<QBarSet*>("QBarSet*");
+ qRegisterMetaType<QAbstractBarSeries::LabelsPosition>("QAbstractBarSeries::LabelsPosition");
}
void tst_QPercentBarSeries::cleanupTestCase()
@@ -98,6 +102,60 @@ void tst_QPercentBarSeries::mouseclicked_data()
}
+void tst_QPercentBarSeries::setLabelsFormat()
+{
+ QSignalSpy labelsFormatSpy(m_barseries, SIGNAL(labelsFormatChanged(QString)));
+ QCOMPARE(m_barseries->labelsFormat(), QString());
+
+ QString format("(@value)");
+ m_barseries->setLabelsFormat(format);
+ TRY_COMPARE(labelsFormatSpy.count(), 1);
+ QList<QVariant> arguments = labelsFormatSpy.takeFirst();
+ QVERIFY(arguments.at(0).toString() == format);
+ QCOMPARE(m_barseries->labelsFormat(), format);
+
+ m_barseries->setLabelsFormat(QString());
+ TRY_COMPARE(labelsFormatSpy.count(), 1);
+ arguments = labelsFormatSpy.takeFirst();
+ QVERIFY(arguments.at(0).toString() == QString());
+ QCOMPARE(m_barseries->labelsFormat(), QString());
+}
+
+void tst_QPercentBarSeries::setLabelsPosition()
+{
+ QSignalSpy labelsPositionSpy(m_barseries,
+ SIGNAL(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)));
+ QCOMPARE(m_barseries->labelsPosition(), QPercentBarSeries::LabelsCenter);
+
+ m_barseries->setLabelsPosition(QPercentBarSeries::LabelsInsideEnd);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ QList<QVariant> arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QPercentBarSeries::LabelsInsideEnd);
+ QCOMPARE(m_barseries->labelsPosition(), QPercentBarSeries::LabelsInsideEnd);
+
+ m_barseries->setLabelsPosition(QPercentBarSeries::LabelsInsideBase);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QPercentBarSeries::LabelsInsideBase);
+ QCOMPARE(m_barseries->labelsPosition(), QPercentBarSeries::LabelsInsideBase);
+
+ m_barseries->setLabelsPosition(QPercentBarSeries::LabelsOutsideEnd);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QPercentBarSeries::LabelsOutsideEnd);
+ QCOMPARE(m_barseries->labelsPosition(), QPercentBarSeries::LabelsOutsideEnd);
+
+ m_barseries->setLabelsPosition(QPercentBarSeries::LabelsCenter);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QPercentBarSeries::LabelsCenter);
+ QCOMPARE(m_barseries->labelsPosition(), QPercentBarSeries::LabelsCenter);
+}
+
void tst_QPercentBarSeries::mouseclicked()
{
SKIP_IF_CANNOT_TEST_MOUSE_EVENTS();
diff --git a/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp b/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp
index 6e848a24..6285aaa1 100644
--- a/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp
+++ b/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp
@@ -28,6 +28,7 @@
QTCOMMERCIALCHART_USE_NAMESPACE
Q_DECLARE_METATYPE(QBarSet*)
+Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition)
class tst_QStackedBarSeries : public QObject
{
@@ -44,6 +45,8 @@ private slots:
void qstackedbarseries();
void type_data();
void type();
+ void setLabelsFormat();
+ void setLabelsPosition();
void mouseclicked_data();
void mouseclicked();
void mousehovered_data();
@@ -56,6 +59,7 @@ private:
void tst_QStackedBarSeries::initTestCase()
{
qRegisterMetaType<QBarSet*>("QBarSet*");
+ qRegisterMetaType<QAbstractBarSeries::LabelsPosition>("QAbstractBarSeries::LabelsPosition");
}
void tst_QStackedBarSeries::cleanupTestCase()
@@ -93,6 +97,60 @@ void tst_QStackedBarSeries::type()
QVERIFY(m_barseries->type() == QAbstractSeries::SeriesTypeStackedBar);
}
+void tst_QStackedBarSeries::setLabelsFormat()
+{
+ QSignalSpy labelsFormatSpy(m_barseries, SIGNAL(labelsFormatChanged(QString)));
+ QCOMPARE(m_barseries->labelsFormat(), QString());
+
+ QString format("(@value)");
+ m_barseries->setLabelsFormat(format);
+ TRY_COMPARE(labelsFormatSpy.count(), 1);
+ QList<QVariant> arguments = labelsFormatSpy.takeFirst();
+ QVERIFY(arguments.at(0).toString() == format);
+ QCOMPARE(m_barseries->labelsFormat(), format);
+
+ m_barseries->setLabelsFormat(QString());
+ TRY_COMPARE(labelsFormatSpy.count(), 1);
+ arguments = labelsFormatSpy.takeFirst();
+ QVERIFY(arguments.at(0).toString() == QString());
+ QCOMPARE(m_barseries->labelsFormat(), QString());
+}
+
+void tst_QStackedBarSeries::setLabelsPosition()
+{
+ QSignalSpy labelsPositionSpy(m_barseries,
+ SIGNAL(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)));
+ QCOMPARE(m_barseries->labelsPosition(), QStackedBarSeries::LabelsCenter);
+
+ m_barseries->setLabelsPosition(QStackedBarSeries::LabelsInsideEnd);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ QList<QVariant> arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QStackedBarSeries::LabelsInsideEnd);
+ QCOMPARE(m_barseries->labelsPosition(), QStackedBarSeries::LabelsInsideEnd);
+
+ m_barseries->setLabelsPosition(QStackedBarSeries::LabelsInsideBase);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QStackedBarSeries::LabelsInsideBase);
+ QCOMPARE(m_barseries->labelsPosition(), QStackedBarSeries::LabelsInsideBase);
+
+ m_barseries->setLabelsPosition(QStackedBarSeries::LabelsOutsideEnd);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QStackedBarSeries::LabelsOutsideEnd);
+ QCOMPARE(m_barseries->labelsPosition(), QStackedBarSeries::LabelsOutsideEnd);
+
+ m_barseries->setLabelsPosition(QStackedBarSeries::LabelsCenter);
+ TRY_COMPARE(labelsPositionSpy.count(), 1);
+ arguments = labelsPositionSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QAbstractBarSeries::LabelsPosition>()
+ == QStackedBarSeries::LabelsCenter);
+ QCOMPARE(m_barseries->labelsPosition(), QStackedBarSeries::LabelsCenter);
+}
+
void tst_QStackedBarSeries::mouseclicked_data()
{
diff --git a/tests/auto/qxyseries/tst_qxyseries.cpp b/tests/auto/qxyseries/tst_qxyseries.cpp
index 34c4f5fe..c0721a35 100644
--- a/tests/auto/qxyseries/tst_qxyseries.cpp
+++ b/tests/auto/qxyseries/tst_qxyseries.cpp
@@ -81,6 +81,78 @@ void tst_QXYSeries::seriesOpacity()
QCOMPARE(opacitySpy.count(), 3);
}
+void tst_QXYSeries::pointLabelsFormat()
+{
+ QSignalSpy labelsFormatSpy(m_series, SIGNAL(pointLabelsFormatChanged(QString)));
+ QCOMPARE(m_series->pointLabelsFormat(), QLatin1String("@xPoint, @yPoint"));
+
+ QString format("@yPoint");
+ m_series->setPointLabelsFormat(format);
+ TRY_COMPARE(labelsFormatSpy.count(), 1);
+ QList<QVariant> arguments = labelsFormatSpy.takeFirst();
+ QVERIFY(arguments.at(0).toString() == format);
+
+ m_series->setPointLabelsFormat(QString());
+ TRY_COMPARE(labelsFormatSpy.count(), 1);
+ arguments = labelsFormatSpy.takeFirst();
+ QVERIFY(arguments.at(0).toString() == QString());
+
+}
+
+void tst_QXYSeries::pointLabelsVisible()
+{
+ QSignalSpy labelsVisibleSpy(m_series, SIGNAL(pointLabelsVisibilityChanged(bool)));
+ QCOMPARE(m_series->pointLabelsVisible(), false);
+
+ m_series->setPointLabelsVisible();
+ QCOMPARE(m_series->pointLabelsVisible(), true);
+ TRY_COMPARE(labelsVisibleSpy.count(), 1);
+ QList<QVariant> arguments = labelsVisibleSpy.takeFirst();
+ QVERIFY(arguments.at(0).toBool() == true);
+
+ m_series->setPointLabelsVisible(false);
+ QCOMPARE(m_series->pointLabelsVisible(), false);
+ TRY_COMPARE(labelsVisibleSpy.count(), 1);
+ arguments = labelsVisibleSpy.takeFirst();
+ QVERIFY(arguments.at(0).toBool() == false);
+}
+
+void tst_QXYSeries::pointLabelsFont()
+{
+ QFont defaultFont(m_series->pointLabelsFont());
+ QSignalSpy labelsFontSpy(m_series, SIGNAL(pointLabelsFontChanged(QFont)));
+
+ QFont font("Times", 10);
+ m_series->setPointLabelsFont(font);
+ TRY_COMPARE(labelsFontSpy.count(), 1);
+ QList<QVariant> arguments = labelsFontSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QFont>() == font);
+
+ m_series->setPointLabelsFont(defaultFont);
+ TRY_COMPARE(labelsFontSpy.count(), 1);
+ arguments = labelsFontSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QFont>() == defaultFont);
+
+}
+
+void tst_QXYSeries::pointLabelsColor()
+{
+ QColor defaultColor(QPen().color());
+ QSignalSpy labelsColorSpy(m_series, SIGNAL(pointLabelsColorChanged(QColor)));
+ QCOMPARE(m_series->pointLabelsColor(), defaultColor);
+
+ QColor color(Qt::blue);
+ m_series->setPointLabelsColor(color);
+ TRY_COMPARE(labelsColorSpy.count(), 1);
+ QList<QVariant> arguments = labelsColorSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QColor>() == color);
+
+ m_series->setPointLabelsColor(defaultColor);
+ TRY_COMPARE(labelsColorSpy.count(), 1);
+ arguments = labelsColorSpy.takeFirst();
+ QVERIFY(arguments.at(0).value<QColor>() == defaultColor);
+}
+
void tst_QXYSeries::append_data()
{
QTest::addColumn< QList<QPointF> >("points");
diff --git a/tests/auto/qxyseries/tst_qxyseries.h b/tests/auto/qxyseries/tst_qxyseries.h
index 701f6829..0fad782c 100644
--- a/tests/auto/qxyseries/tst_qxyseries.h
+++ b/tests/auto/qxyseries/tst_qxyseries.h
@@ -42,6 +42,10 @@ public slots:
private slots:
void seriesName();
void seriesVisible();
+ void pointLabelsFormat();
+ void pointLabelsVisible();
+ void pointLabelsFont();
+ void pointLabelsColor();
void seriesOpacity();
void oper_data();
void oper();
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml
index 51c37caa..46959f7d 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "area series"
@@ -61,6 +61,8 @@ ChartView {
XYPoint { x: 11; y: 0 }
}
+ pointLabelsFormat: "@xPoint, @yPoint";
+
onNameChanged: console.log(name + ".onNameChanged: " + name);
onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible);
onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
@@ -71,6 +73,14 @@ ChartView {
onBorderWidthChanged: console.log(name + ".onBorderChanged: " + borderWidth);
// onCountChanged: console.log(name + ".onCountChanged: " + count);
onHovered: console.log("lineSeries.onHovered:" + point.x + "," + point.y + " " + state);
+ onPointLabelsVisibilityChanged: console.log(name + ".onPointLabelsVisibilityChanged: "
+ + visible);
+ onPointLabelsFormatChanged: console.log(name + ".onPointLabelsFormatChanged: "
+ + format);
+ onPointLabelsFontChanged: console.log(name + ".onPointLabelsFontChanged: "
+ + font.family);
+ onPointLabelsColorChanged: console.log(name + ".onPointLabelsColorChanged: "
+ + color);
}
AreaSeries {
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml
index d7b34787..69b2761a 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml
@@ -55,6 +55,32 @@ Flow {
onClicked: series.borderWidth -= 0.5;
}
Button {
+ text: "point labels visible"
+ onClicked: series.pointLabelsVisible = !series.pointLabelsVisible;
+ }
+ Button {
+ text: "point labels format"
+ onClicked: {
+ if (series.pointLabelsFormat === "@xPoint, @yPoint")
+ series.pointLabelsFormat = "(@xPoint)"
+ else
+ series.pointLabelsFormat = "@xPoint, @yPoint"
+ }
+ }
+ Button {
+ text: "point labels font"
+ onClicked: {
+ if (series.pointLabelsFont.family === "Times")
+ series.pointLabelsFont.family = "Courier";
+ else
+ series.pointLabelsFont.family = "Times";
+ }
+ }
+ Button {
+ text: "point labels color"
+ onClicked: series.pointLabelsColor = main.nextColor();
+ }
+ Button {
id: upperButton
text: "upper series"
unpressedColor: "#79bd8f"
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml
index a7fc4895..d0e34326 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "Bar series"
@@ -34,6 +34,7 @@ ChartView {
BarSeries {
id: mySeries
name: "bar"
+ labelsFormat: "@value";
axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
onClicked: console.log("barset.onClicked: " + index);
@@ -62,5 +63,14 @@ ChartView {
+ " " + index);
onLabelsVisibleChanged: console.log("barSeries.onLabelsVisibleChanged: " + series.labelsVisible);
onCountChanged: console.log("barSeries.onCountChanged: " + count);
+ onLabelsFormatChanged: console.log("barSeries.onLabelsFormatChanged: " + format);
+ onLabelsPositionChanged: console.log("barSeries.onLabelsPositionChanged: " + series.labelsPosition);
+
+ function changeLabelsPosition() {
+ if (labelsPosition === BarSeries.LabelsCenter)
+ labelsPosition = BarSeries.LabelsInsideEnd;
+ else
+ labelsPosition = BarSeries.LabelsCenter;
+ }
}
}
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/BarEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/BarEditor.qml
index 1a4cad6c..439d7f9e 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/BarEditor.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/BarEditor.qml
@@ -172,6 +172,19 @@ Row {
onClicked: series.labelsVisible = !series.labelsVisible;
}
Button {
+ text: "labels format"
+ onClicked: {
+ if (series.labelsFormat === "@value")
+ series.labelsFormat = "@value%"
+ else
+ series.labelsFormat = "@value"
+ }
+ }
+ Button {
+ text: "labels position"
+ onClicked: series.changeLabelsPosition();
+ }
+ Button {
text: "set 1 label color"
onClicked: series.at(0).labelColor = main.nextColor();
}
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalBarChart.qml
index 7ceaa96d..7d24d2e6 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalBarChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalBarChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "Bar series"
@@ -33,6 +33,7 @@ ChartView {
HorizontalBarSeries {
id: mySeries
name: "bar"
+ labelsFormat: "@value";
axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
onClicked: console.log("barset.onClicked: " + index);
@@ -61,5 +62,16 @@ ChartView {
+ status + " " + index);
onLabelsVisibleChanged: console.log("horizontalBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
onCountChanged: console.log("horizontalBarSeries.onCountChanged: " + count);
+ onLabelsFormatChanged: console.log("horizontalBarSeries.onLabelsFormatChanged: "
+ + format);
+ onLabelsPositionChanged: console.log("horizontalBarSeries.onLabelsPositionChanged: "
+ + series.labelsPosition);
+
+ function changeLabelsPosition() {
+ if (labelsPosition === BarSeries.LabelsCenter)
+ labelsPosition = BarSeries.LabelsInsideEnd;
+ else
+ labelsPosition = BarSeries.LabelsCenter;
+ }
}
}
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalPercentBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalPercentBarChart.qml
index 2ea99639..70324888 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalPercentBarChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalPercentBarChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "Percent bar series"
@@ -61,5 +61,18 @@ ChartView {
+ " " + status + " " + index);
onLabelsVisibleChanged: console.log("horizontalPercentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
onCountChanged: console.log("horizontalPercentBarSeries.onCountChanged: " + count);
+ onLabelsFormatChanged: console.log(
+ "horizontalPercentBarSeries.onLabelsFormatChanged: "
+ + format);
+ onLabelsPositionChanged: console.log(
+ "horizontalPercentBarSeries.onLabelsPositionChanged: "
+ + series.labelsPosition);
+
+ function changeLabelsPosition() {
+ if (labelsPosition === BarSeries.LabelsCenter)
+ labelsPosition = BarSeries.LabelsInsideEnd;
+ else
+ labelsPosition = BarSeries.LabelsCenter;
+ }
}
}
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalStackedBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalStackedBarChart.qml
index fc651866..0367037b 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalStackedBarChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalStackedBarChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "Stacked bar series"
@@ -33,6 +33,7 @@ ChartView {
HorizontalStackedBarSeries {
id: mySeries
name: "bar"
+ labelsFormat: "@value";
axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
onClicked: console.log("barset.onClicked: " + index);
@@ -61,5 +62,18 @@ ChartView {
+ " " + status + " " + index);
onLabelsVisibleChanged: console.log("horizontalStackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
onCountChanged: console.log("horizontalStackedBarSeries.onCountChanged: " + count);
+ onLabelsFormatChanged: console.log(
+ "horizontalStackedBarSeries.onLabelsFormatChanged: "
+ + format);
+ onLabelsPositionChanged: console.log(
+ "horizontalStackedBarSeries.onLabelsPositionChanged: "
+ + series.labelsPosition);
+
+ function changeLabelsPosition() {
+ if (labelsPosition === BarSeries.LabelsCenter)
+ labelsPosition = BarSeries.LabelsInsideEnd;
+ else
+ labelsPosition = BarSeries.LabelsCenter;
+ }
}
}
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/LineChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/LineChart.qml
index 0402498a..dedeebcb 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/LineChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/LineChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
property variant series: lineSeries
@@ -39,6 +39,8 @@ ChartView {
XYPoint { x: 3.4; y: 3.0 }
XYPoint { x: 4.1; y: 3.3 }
+ pointLabelsFormat: "@xPoint, @yPoint";
+
onNameChanged: console.log("lineSeries.onNameChanged: " + name);
onVisibleChanged: console.log("lineSeries.onVisibleChanged: " + visible);
onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
@@ -52,6 +54,14 @@ ChartView {
onCapStyleChanged: console.log("lineSeries.onCapStyleChanged: " + capStyle);
onCountChanged: console.log("lineSeries.onCountChanged: " + count);
onHovered: console.log("lineSeries.onHovered:" + point.x + "," + point.y + " " + state);
+ onPointLabelsVisibilityChanged: console.log("lineSeries.onPointLabelsVisibilityChanged: "
+ + visible);
+ onPointLabelsFormatChanged: console.log("lineSeries.onPointLabelsFormatChanged: "
+ + format);
+ onPointLabelsFontChanged: console.log("lineSeries.onPointLabelsFontChanged: "
+ + font.family);
+ onPointLabelsColorChanged: console.log("lineSeries.onPointLabelsColorChanged: "
+ + color);
}
LineSeries {
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml
index 526bffc7..f49dddcc 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml
@@ -72,6 +72,32 @@ Flow {
onClicked: series.pointsVisible = !series.pointsVisible;
}
Button {
+ text: "point labels visible"
+ onClicked: series.pointLabelsVisible = !series.pointLabelsVisible;
+ }
+ Button {
+ text: "point labels format"
+ onClicked: {
+ if (series.pointLabelsFormat === "@xPoint, @yPoint")
+ series.pointLabelsFormat = "(@xPoint)"
+ else
+ series.pointLabelsFormat = "@xPoint, @yPoint"
+ }
+ }
+ Button {
+ text: "point labels font"
+ onClicked: {
+ if (series.pointLabelsFont.family === "Times")
+ series.pointLabelsFont.family = "Courier";
+ else
+ series.pointLabelsFont.family = "Times";
+ }
+ }
+ Button {
+ text: "point labels color"
+ onClicked: series.pointLabelsColor = main.nextColor();
+ }
+ Button {
text: "append point"
onClicked: series.append(series.count - 1, series.count - 1);
}
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml
index ce138c3a..a9879c59 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "Percent bar series"
@@ -33,6 +33,7 @@ ChartView {
PercentBarSeries {
id: mySeries
name: "bar"
+ labelsFormat: "@value";
axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
@@ -62,5 +63,16 @@ ChartView {
+ " " + status + " " + index);
onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
onCountChanged: console.log("percentBarSeries.onCountChanged: " + count);
+ onLabelsFormatChanged: console.log("percentBarSeries.onLabelsFormatChanged: "
+ + format);
+ onLabelsPositionChanged: console.log("percentBarSeries.onLabelsPositionChanged: "
+ + series.labelsPosition);
+
+ function changeLabelsPosition() {
+ if (labelsPosition === BarSeries.LabelsCenter)
+ labelsPosition = BarSeries.LabelsInsideEnd;
+ else
+ labelsPosition = BarSeries.LabelsCenter;
+ }
}
}
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml
index ebb34066..cd898914 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "scatter series"
@@ -37,6 +37,8 @@ ChartView {
XYPoint { x: 2.1; y: 1.3 }
XYPoint { x: 2.5; y: 2.1 }
+ pointLabelsFormat: "@xPoint, @yPoint";
+
onNameChanged: console.log("scatterSeries.onNameChanged: " + name);
onVisibleChanged: console.log("scatterSeries.onVisibleChanged: " + visible);
onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
@@ -48,6 +50,14 @@ ChartView {
onBorderColorChanged: console.log("scatterSeries.onBorderColorChanged: " + borderColor);
onBorderWidthChanged: console.log("scatterSeries.onBorderChanged: " + borderWidth);
onCountChanged: console.log("scatterSeries.onCountChanged: " + count);
+ onPointLabelsVisibilityChanged: console.log("lineSeries.onPointLabelsVisibilityChanged: "
+ + visible);
+ onPointLabelsFormatChanged: console.log("lineSeries.onPointLabelsFormatChanged: "
+ + format);
+ onPointLabelsFontChanged: console.log("lineSeries.onPointLabelsFontChanged: "
+ + font.family);
+ onPointLabelsColorChanged: console.log("lineSeries.onPointLabelsColorChanged: "
+ + color);
}
ScatterSeries {
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml
index 75ae9465..753ab197 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml
@@ -67,6 +67,32 @@ Flow {
onClicked: series.markerShape = ((series.markerShape + 1) % 2);
}
Button {
+ text: "point labels visible"
+ onClicked: series.pointLabelsVisible = !series.pointLabelsVisible;
+ }
+ Button {
+ text: "point labels format"
+ onClicked: {
+ if (series.pointLabelsFormat === "@xPoint, @yPoint")
+ series.pointLabelsFormat = "(@xPoint)"
+ else
+ series.pointLabelsFormat = "@xPoint, @yPoint"
+ }
+ }
+ Button {
+ text: "point labels font"
+ onClicked: {
+ if (series.pointLabelsFont.family === "Times")
+ series.pointLabelsFont.family = "Courier";
+ else
+ series.pointLabelsFont.family = "Times";
+ }
+ }
+ Button {
+ text: "point labels color"
+ onClicked: series.pointLabelsColor = main.nextColor();
+ }
+ Button {
text: "append point"
onClicked: series.append(series.count - 1, series.count - 1);
}
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml
index 87d6fb55..5f534b97 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "spline series"
@@ -38,6 +38,8 @@ ChartView {
XYPoint { x: 3.4; y: 3.0 }
XYPoint { x: 4.1; y: 3.3 }
+ pointLabelsFormat: "@xPoint, @yPoint";
+
onNameChanged: console.log("splineSeries.onNameChanged: " + name);
onVisibleChanged: console.log("splineSeries.onVisibleChanged: " + visible);
onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
@@ -50,6 +52,14 @@ ChartView {
onStyleChanged: console.log("splineSeries.onStyleChanged: " + style);
onCapStyleChanged: console.log("splineSeries.onCapStyleChanged: " + capStyle);
onCountChanged: console.log("splineSeries.onCountChanged: " + count);
+ onPointLabelsVisibilityChanged: console.log("splineSeries.onPointLabelsVisibilityChanged: "
+ + visible);
+ onPointLabelsFormatChanged: console.log("splineSeries.onPointLabelsFormatChanged: "
+ + format);
+ onPointLabelsFontChanged: console.log("splineSeries.onPointLabelsFontChanged: "
+ + font.family);
+ onPointLabelsColorChanged: console.log("splineSeries.onPointLabelsColorChanged: "
+ + color);
}
SplineSeries {
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml
index 26d156b2..5757a95c 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "Stacked bar series"
@@ -33,6 +33,7 @@ ChartView {
StackedBarSeries {
id: mySeries
name: "bar"
+ labelsFormat: "@value";
axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
onClicked: console.log("barset.onClicked: " + index);
@@ -61,5 +62,16 @@ ChartView {
+ " " + status + " " + index);
onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
onCountChanged: console.log("stackedBarSeries.onCountChanged: " + count);
+ onLabelsFormatChanged: console.log("stackedBarSeries.onLabelsFormatChanged: "
+ + format);
+ onLabelsPositionChanged: console.log("stackedBarSeries.onLabelsPositionChanged: "
+ + series.labelsPosition);
+
+ function changeLabelsPosition() {
+ if (labelsPosition === BarSeries.LabelsCenter)
+ labelsPosition = BarSeries.LabelsInsideEnd;
+ else
+ labelsPosition = BarSeries.LabelsCenter;
+ }
}
}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/AreaChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/AreaChart.qml
index f502fe80..c942b288 100644
--- a/tests/quick2chartproperties/qml/quick2chartproperties/AreaChart.qml
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/AreaChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "area series"
@@ -61,6 +61,8 @@ ChartView {
XYPoint { x: 11; y: 0 }
}
+ pointLabelsFormat: "@xPoint, @yPoint";
+
onNameChanged: console.log(name + ".onNameChanged: " + name);
onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible);
onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
@@ -71,6 +73,14 @@ ChartView {
onBorderWidthChanged: console.log(name + ".onBorderChanged: " + borderWidth);
// onCountChanged: console.log(name + ".onCountChanged: " + count);
onHovered: console.log("lineSeries.onHovered:" + point.x + "," + point.y + " " + state);
+ onPointLabelsVisibilityChanged: console.log(name + ".onPointLabelsVisibilityChanged: "
+ + visible);
+ onPointLabelsFormatChanged: console.log(name + ".onPointLabelsFormatChanged: "
+ + format);
+ onPointLabelsFontChanged: console.log(name + ".onPointLabelsFontChanged: "
+ + font.family);
+ onPointLabelsColorChanged: console.log(name + ".onPointLabelsColorChanged: "
+ + color);
}
AreaSeries {
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/AreaEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/AreaEditor.qml
index 249c7c28..168dc957 100644
--- a/tests/quick2chartproperties/qml/quick2chartproperties/AreaEditor.qml
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/AreaEditor.qml
@@ -55,6 +55,32 @@ Flow {
onClicked: series.borderWidth -= 0.5;
}
Button {
+ text: "point labels visible"
+ onClicked: series.pointLabelsVisible = !series.pointLabelsVisible;
+ }
+ Button {
+ text: "point labels format"
+ onClicked: {
+ if (series.pointLabelsFormat === "@xPoint, @yPoint")
+ series.pointLabelsFormat = "(@xPoint)"
+ else
+ series.pointLabelsFormat = "@xPoint, @yPoint"
+ }
+ }
+ Button {
+ text: "point labels font"
+ onClicked: {
+ if (series.pointLabelsFont.family === "Times")
+ series.pointLabelsFont.family = "Courier";
+ else
+ series.pointLabelsFont.family = "Times";
+ }
+ }
+ Button {
+ text: "point labels color"
+ onClicked: series.pointLabelsColor = main.nextColor();
+ }
+ Button {
id: upperButton
text: "upper series"
unpressedColor: "#79bd8f"
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/BarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/BarChart.qml
index 1774ef41..8a91cdb8 100644
--- a/tests/quick2chartproperties/qml/quick2chartproperties/BarChart.qml
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/BarChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "Bar series"
@@ -34,6 +34,7 @@ ChartView {
BarSeries {
id: mySeries
name: "bar"
+ labelsFormat: "@value";
axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
onClicked: console.log("barset.onClicked: " + index);
@@ -62,5 +63,14 @@ ChartView {
+ " " + index);
onLabelsVisibleChanged: console.log("barSeries.onLabelsVisibleChanged: " + series.labelsVisible);
onCountChanged: console.log("barSeries.onCountChanged: " + count);
+ onLabelsFormatChanged: console.log("barSeries.onLabelsFormatChanged: " + format);
+ onLabelsPositionChanged: console.log("barSeries.onLabelsPositionChanged: " + series.labelsPosition);
+
+ function changeLabelsPosition() {
+ if (labelsPosition === BarSeries.LabelsCenter)
+ labelsPosition = BarSeries.LabelsInsideEnd;
+ else
+ labelsPosition = BarSeries.LabelsCenter;
+ }
}
}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml
index 38b2e4b3..cdd847a5 100644
--- a/tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml
@@ -172,6 +172,19 @@ Row {
onClicked: series.labelsVisible = !series.labelsVisible;
}
Button {
+ text: "labels format"
+ onClicked: {
+ if (series.labelsFormat === "@value")
+ series.labelsFormat = "@value%"
+ else
+ series.labelsFormat = "@value"
+ }
+ }
+ Button {
+ text: "labels position"
+ onClicked: series.changeLabelsPosition();
+ }
+ Button {
text: "set 1 label color"
onClicked: series.at(0).labelColor = main.nextColor();
}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalBarChart.qml
index 42ba0c88..342995cf 100644
--- a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalBarChart.qml
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalBarChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "Bar series"
@@ -33,6 +33,7 @@ ChartView {
HorizontalBarSeries {
id: mySeries
name: "bar"
+ labelsFormat: "@value";
axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
onClicked: console.log("barset.onClicked: " + index);
@@ -61,5 +62,16 @@ ChartView {
+ status + " " + index);
onLabelsVisibleChanged: console.log("horizontalBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
onCountChanged: console.log("horizontalBarSeries.onCountChanged: " + count);
+ onLabelsFormatChanged: console.log("horizontalBarSeries.onLabelsFormatChanged: "
+ + format);
+ onLabelsPositionChanged: console.log("horizontalBarSeries.onLabelsPositionChanged: "
+ + series.labelsPosition);
+
+ function changeLabelsPosition() {
+ if (labelsPosition === BarSeries.LabelsCenter)
+ labelsPosition = BarSeries.LabelsInsideEnd;
+ else
+ labelsPosition = BarSeries.LabelsCenter;
+ }
}
}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml
index 8d00b762..0ef7e17a 100644
--- a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "Percent bar series"
@@ -33,6 +33,7 @@ ChartView {
HorizontalPercentBarSeries {
id: mySeries
name: "bar"
+ labelsFormat: "@value";
axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
onClicked: console.log("barset.onClicked: " + index);
@@ -61,5 +62,18 @@ ChartView {
+ " " + status + " " + index);
onLabelsVisibleChanged: console.log("horizontalPercentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
onCountChanged: console.log("horizontalPercentBarSeries.onCountChanged: " + count);
+ onLabelsFormatChanged: console.log(
+ "horizontalPercentBarSeries.onLabelsFormatChanged: "
+ + format);
+ onLabelsPositionChanged: console.log(
+ "horizontalPercentBarSeries.onLabelsPositionChanged: "
+ + series.labelsPosition);
+
+ function changeLabelsPosition() {
+ if (labelsPosition === BarSeries.LabelsCenter)
+ labelsPosition = BarSeries.LabelsInsideEnd;
+ else
+ labelsPosition = BarSeries.LabelsCenter;
+ }
}
}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml
index e468259d..c1ef51b8 100644
--- a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "Stacked bar series"
@@ -33,6 +33,7 @@ ChartView {
HorizontalStackedBarSeries {
id: mySeries
name: "bar"
+ labelsFormat: "@value";
axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
onClicked: console.log("barset.onClicked: " + index);
@@ -61,5 +62,18 @@ ChartView {
+ " " + status + " " + index);
onLabelsVisibleChanged: console.log("horizontalStackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
onCountChanged: console.log("horizontalStackedBarSeries.onCountChanged: " + count);
+ onLabelsFormatChanged: console.log(
+ "horizontalStackedBarSeries.onLabelsFormatChanged: "
+ + format);
+ onLabelsPositionChanged: console.log(
+ "horizontalStackedBarSeries.onLabelsPositionChanged: "
+ + series.labelsPosition);
+
+ function changeLabelsPosition() {
+ if (labelsPosition === BarSeries.LabelsCenter)
+ labelsPosition = BarSeries.LabelsInsideEnd;
+ else
+ labelsPosition = BarSeries.LabelsCenter;
+ }
}
}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml
index 3545c66b..3190ac35 100644
--- a/tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
property variant series: lineSeries
@@ -39,6 +39,8 @@ ChartView {
XYPoint { x: 3.4; y: 3.0 }
XYPoint { x: 4.1; y: 3.3 }
+ pointLabelsFormat: "@xPoint, @yPoint";
+
onNameChanged: console.log("lineSeries.onNameChanged: " + name);
onVisibleChanged: console.log("lineSeries.onVisibleChanged: " + visible);
onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
@@ -52,6 +54,14 @@ ChartView {
onCapStyleChanged: console.log("lineSeries.onCapStyleChanged: " + capStyle);
onCountChanged: console.log("lineSeries.onCountChanged: " + count);
onHovered: console.log("lineSeries.onHovered:" + point.x + "," + point.y + " " + state);
+ onPointLabelsVisibilityChanged: console.log("lineSeries.onPointLabelsVisibilityChanged: "
+ + visible);
+ onPointLabelsFormatChanged: console.log("lineSeries.onPointLabelsFormatChanged: "
+ + format);
+ onPointLabelsFontChanged: console.log("lineSeries.onPointLabelsFontChanged: "
+ + font.family);
+ onPointLabelsColorChanged: console.log("lineSeries.onPointLabelsColorChanged: "
+ + color);
}
LineSeries {
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml
index f9eafed6..7960b4a1 100644
--- a/tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml
@@ -72,6 +72,32 @@ Flow {
onClicked: series.pointsVisible = !series.pointsVisible;
}
Button {
+ text: "point labels visible"
+ onClicked: series.pointLabelsVisible = !series.pointLabelsVisible;
+ }
+ Button {
+ text: "point labels format"
+ onClicked: {
+ if (series.pointLabelsFormat === "@xPoint, @yPoint")
+ series.pointLabelsFormat = "(@xPoint)"
+ else
+ series.pointLabelsFormat = "@xPoint, @yPoint"
+ }
+ }
+ Button {
+ text: "point labels font"
+ onClicked: {
+ if (series.pointLabelsFont.family === "Times")
+ series.pointLabelsFont.family = "Courier";
+ else
+ series.pointLabelsFont.family = "Times";
+ }
+ }
+ Button {
+ text: "point labels color"
+ onClicked: series.pointLabelsColor = main.nextColor();
+ }
+ Button {
text: "append point"
onClicked: series.append(series.count - 1, series.count - 1);
}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/PercentBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/PercentBarChart.qml
index d2aa8812..822a1839 100644
--- a/tests/quick2chartproperties/qml/quick2chartproperties/PercentBarChart.qml
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/PercentBarChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "Percent bar series"
@@ -33,6 +33,7 @@ ChartView {
PercentBarSeries {
id: mySeries
name: "bar"
+ labelsFormat: "@value";
axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
@@ -62,5 +63,16 @@ ChartView {
+ " " + status + " " + index);
onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
onCountChanged: console.log("percentBarSeries.onCountChanged: " + count);
+ onLabelsFormatChanged: console.log("percentBarSeries.onLabelsFormatChanged: "
+ + format);
+ onLabelsPositionChanged: console.log("percentBarSeries.onLabelsPositionChanged: "
+ + series.labelsPosition);
+
+ function changeLabelsPosition() {
+ if (labelsPosition === BarSeries.LabelsCenter)
+ labelsPosition = BarSeries.LabelsInsideEnd;
+ else
+ labelsPosition = BarSeries.LabelsCenter;
+ }
}
}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ScatterChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ScatterChart.qml
index cd39a5c3..64785d2b 100644
--- a/tests/quick2chartproperties/qml/quick2chartproperties/ScatterChart.qml
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/ScatterChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "scatter series"
@@ -37,6 +37,8 @@ ChartView {
XYPoint { x: 2.1; y: 1.3 }
XYPoint { x: 2.5; y: 2.1 }
+ pointLabelsFormat: "@xPoint, @yPoint";
+
onNameChanged: console.log("scatterSeries.onNameChanged: " + name);
onVisibleChanged: console.log("scatterSeries.onVisibleChanged: " + visible);
onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
@@ -49,6 +51,14 @@ ChartView {
onBorderColorChanged: console.log("scatterSeries.onBorderColorChanged: " + borderColor);
onBorderWidthChanged: console.log("scatterSeries.onBorderChanged: " + borderWidth);
onCountChanged: console.log("scatterSeries.onCountChanged: " + count);
+ onPointLabelsVisibilityChanged: console.log("lineSeries.onPointLabelsVisibilityChanged: "
+ + visible);
+ onPointLabelsFormatChanged: console.log("lineSeries.onPointLabelsFormatChanged: "
+ + format);
+ onPointLabelsFontChanged: console.log("lineSeries.onPointLabelsFontChanged: "
+ + font.family);
+ onPointLabelsColorChanged: console.log("lineSeries.onPointLabelsColorChanged: "
+ + color);
}
ScatterSeries {
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml
index 23690c1c..23afdb75 100644
--- a/tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml
@@ -67,6 +67,32 @@ Flow {
onClicked: series.markerShape = ((series.markerShape + 1) % 2);
}
Button {
+ text: "point labels visible"
+ onClicked: series.pointLabelsVisible = !series.pointLabelsVisible;
+ }
+ Button {
+ text: "point labels format"
+ onClicked: {
+ if (series.pointLabelsFormat === "@xPoint, @yPoint")
+ series.pointLabelsFormat = "(@xPoint)"
+ else
+ series.pointLabelsFormat = "@xPoint, @yPoint"
+ }
+ }
+ Button {
+ text: "point labels font"
+ onClicked: {
+ if (series.pointLabelsFont.family === "Times")
+ series.pointLabelsFont.family = "Courier";
+ else
+ series.pointLabelsFont.family = "Times";
+ }
+ }
+ Button {
+ text: "point labels color"
+ onClicked: series.pointLabelsColor = main.nextColor();
+ }
+ Button {
text: "append point"
onClicked: series.append(series.count - 1, series.count - 1);
}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/SplineChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/SplineChart.qml
index 840055bc..e7c8793d 100644
--- a/tests/quick2chartproperties/qml/quick2chartproperties/SplineChart.qml
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/SplineChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "spline series"
@@ -38,6 +38,8 @@ ChartView {
XYPoint { x: 3.4; y: 3.0 }
XYPoint { x: 4.1; y: 3.3 }
+ pointLabelsFormat: "@xPoint, @yPoint";
+
onNameChanged: console.log("splineSeries.onNameChanged: " + name);
onVisibleChanged: console.log("splineSeries.onVisibleChanged: " + visible);
onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
@@ -51,6 +53,14 @@ ChartView {
onStyleChanged: console.log("splineSeries.onStyleChanged: " + style);
onCapStyleChanged: console.log("splineSeries.onCapStyleChanged: " + capStyle);
onCountChanged: console.log("splineSeries.onCountChanged: " + count);
+ onPointLabelsVisibilityChanged: console.log("splineSeries.onPointLabelsVisibilityChanged: "
+ + visible);
+ onPointLabelsFormatChanged: console.log("splineSeries.onPointLabelsFormatChanged: "
+ + format);
+ onPointLabelsFontChanged: console.log("splineSeries.onPointLabelsFontChanged: "
+ + font.family);
+ onPointLabelsColorChanged: console.log("splineSeries.onPointLabelsColorChanged: "
+ + color);
}
SplineSeries {
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml
index 50adedad..0890884c 100644
--- a/tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml
@@ -19,7 +19,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtCommercial.Chart 1.1
+import QtCommercial.Chart 1.4
ChartView {
title: "Stacked bar series"
@@ -33,6 +33,7 @@ ChartView {
StackedBarSeries {
id: mySeries
name: "bar"
+ labelsFormat: "@value";
axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
onClicked: console.log("barset.onClicked: " + index);
@@ -61,5 +62,16 @@ ChartView {
+ " " + status + " " + index);
onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
onCountChanged: console.log("stackedBarSeries.onCountChanged: " + count);
+ onLabelsFormatChanged: console.log("stackedBarSeries.onLabelsFormatChanged: "
+ + format);
+ onLabelsPositionChanged: console.log("stackedBarSeries.onLabelsPositionChanged: "
+ + series.labelsPosition);
+
+ function changeLabelsPosition() {
+ if (labelsPosition === BarSeries.LabelsCenter)
+ labelsPosition = BarSeries.LabelsInsideEnd;
+ else
+ labelsPosition = BarSeries.LabelsCenter;
+ }
}
}