##// END OF EJS Templates
Fixed Qt5 specific issue with ChartView.createSeries series types
Tero Ahola -
r2389:eeb090abac42
parent child
Show More
@@ -81,16 +81,16 ChartView {
81 // but the series have their own y-axes to make it possible to control the y-offset
81 // but the series have their own y-axes to make it possible to control the y-offset
82 // of the "signal sources".
82 // of the "signal sources".
83 if (type == "line") {
83 if (type == "line") {
84 scopeView.createSeries(ChartView.SeriesTypeLine, "signal 1", axisX, axisY1);
84 chartView.createSeries(ChartView.SeriesTypeLine, "signal 1", axisX, axisY1);
85 scopeView.createSeries(ChartView.SeriesTypeLine, "signal 2", axisX, axisY2);
85 chartView.createSeries(ChartView.SeriesTypeLine, "signal 2", axisX, axisY2);
86 } else if (type == "spline") {
86 } else if (type == "spline") {
87 scopeView.createSeries(ChartView.SeriesTypeSpline, "signal 1", axisX, axisY1);
87 chartView.createSeries(ChartView.SeriesTypeSpline, "signal 1", axisX, axisY1);
88 scopeView.createSeries(ChartView.SeriesTypeSpline, "signal 2", axisX, axisY2);
88 chartView.createSeries(ChartView.SeriesTypeSpline, "signal 2", axisX, axisY2);
89 } else {
89 } else {
90 var series1 = scopeView.createSeries(ChartView.SeriesTypeScatter, "signal 1", axisX, axisY1);
90 var series1 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 1", axisX, axisY1);
91 series1.markerSize = 3;
91 series1.markerSize = 3;
92 series1.borderColor = "transparent";
92 series1.borderColor = "transparent";
93 var series2 = scopeView.createSeries(ChartView.SeriesTypeScatter, "signal 2", axisX, axisY2);
93 var series2 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 2", axisX, axisY2);
94 series2.markerSize = 3;
94 series2.markerSize = 3;
95 series2.borderColor = "transparent";
95 series2.borderColor = "transparent";
96 }
96 }
@@ -105,9 +105,9 ChartView {
105
105
106 function setAnimations(enabled) {
106 function setAnimations(enabled) {
107 if (enabled)
107 if (enabled)
108 scopeView.animationOptions = ChartView.SeriesAnimations;
108 chartView.animationOptions = ChartView.SeriesAnimations;
109 else
109 else
110 scopeView.animationOptions = ChartView.NoAnimation;
110 chartView.animationOptions = ChartView.NoAnimation;
111 }
111 }
112
112
113 function changeRefreshRate(rate) {
113 function changeRefreshRate(rate) {
@@ -590,12 +590,7 QAbstractSeries *DeclarativeChart::series(QString seriesName)
590 return 0;
590 return 0;
591 }
591 }
592
592
593 QAbstractSeries *DeclarativeChart::createSeries(DeclarativeChart::SeriesType type, QString name)
593 QAbstractSeries *DeclarativeChart::createSeries(int type, QString name, QAbstractAxis *axisX, QAbstractAxis *axisY)
594 {
595 return createSeries(type, name, 0, 0);
596 }
597
598 QAbstractSeries *DeclarativeChart::createSeries(DeclarativeChart::SeriesType type, QString name, QAbstractAxis *axisX, QAbstractAxis *axisY)
599 {
594 {
600 QAbstractSeries *series = 0;
595 QAbstractSeries *series = 0;
601
596
@@ -137,8 +137,7 public:
137 public:
137 public:
138 Q_INVOKABLE QAbstractSeries *series(int index);
138 Q_INVOKABLE QAbstractSeries *series(int index);
139 Q_INVOKABLE QAbstractSeries *series(QString seriesName);
139 Q_INVOKABLE QAbstractSeries *series(QString seriesName);
140 Q_INVOKABLE QAbstractSeries *createSeries(DeclarativeChart::SeriesType type, QString name = "");
140 Q_INVOKABLE QAbstractSeries *createSeries(int type, QString name = "", QAbstractAxis *axisX = 0, QAbstractAxis *axisY = 0);
141 Q_INVOKABLE QAbstractSeries *createSeries(DeclarativeChart::SeriesType type, QString name, QAbstractAxis *axisX, QAbstractAxis *axisY);
142 Q_INVOKABLE void removeSeries(QAbstractSeries *series);
141 Q_INVOKABLE void removeSeries(QAbstractSeries *series);
143 Q_INVOKABLE void removeAllSeries() { m_chart->removeAllSeries(); }
142 Q_INVOKABLE void removeAllSeries() { m_chart->removeAllSeries(); }
144 Q_INVOKABLE void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0);
143 Q_INVOKABLE void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0);
@@ -61,7 +61,7 Q_DECLARE_METATYPE(QList<QAbstractAxis *>)
61 // NOTE: Hackish fixes for Qt5 (beta2).
61 // NOTE: Hackish fixes for Qt5 (beta2).
62 // These should not be needed or at least they are not needed in Qt4.
62 // These should not be needed or at least they are not needed in Qt4.
63
63
64 Q_DECLARE_METATYPE(DeclarativeChart::SeriesType)
64 Q_DECLARE_METATYPE(DeclarativeChart *)
65 Q_DECLARE_METATYPE(DeclarativeMargins *)
65 Q_DECLARE_METATYPE(DeclarativeMargins *)
66 Q_DECLARE_METATYPE(DeclarativeAreaSeries *)
66 Q_DECLARE_METATYPE(DeclarativeAreaSeries *)
67 Q_DECLARE_METATYPE(DeclarativeBarSeries *)
67 Q_DECLARE_METATYPE(DeclarativeBarSeries *)
@@ -130,9 +130,6 public:
130 qRegisterMetaType<QList<QPieSlice *> >();
130 qRegisterMetaType<QList<QPieSlice *> >();
131 qRegisterMetaType<QList<QBarSet *> >();
131 qRegisterMetaType<QList<QBarSet *> >();
132 qRegisterMetaType<QList<QAbstractAxis *> >();
132 qRegisterMetaType<QList<QAbstractAxis *> >();
133 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
134 qRegisterMetaType<DeclarativeChart::SeriesType>();
135 #endif
136
133
137 // QtCommercial.Chart 1.0
134 // QtCommercial.Chart 1.0
138 qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView");
135 qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView");
General Comments 0
You need to be logged in to leave comments. Login now