##// END OF EJS Templates
Some spline fixes
Marek Rosa -
r455:49ff5e3c0df2
parent child
Show More
@@ -25,6 +25,7 void SplinePresenter::applyGeometry(QVector<QPointF>& points)
25 {
25 {
26 if(points.size()==0) return;
26 if(points.size()==0) return;
27
27
28 qDebug() << "Kueku";
28 QPainterPath splinePath;
29 QPainterPath splinePath;
29 const QPointF& point = points.at(0);
30 const QPointF& point = points.at(0);
30 splinePath.moveTo(point);
31 splinePath.moveTo(point);
@@ -20,12 +20,7 public:
20
20
21 QPointF calculateGeometryControlPoint(int index) const;
21 QPointF calculateGeometryControlPoint(int index) const;
22
22
23 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
23 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
24
25 signals:
26
27 public slots:
28
29 };
24 };
30
25
31 QTCOMMERCIALCHART_END_NAMESPACE
26 QTCOMMERCIALCHART_END_NAMESPACE
@@ -3,6 +3,7
3 #include "qpieseries.h"
3 #include "qpieseries.h"
4 #include "qscatterseries.h"
4 #include "qscatterseries.h"
5 #include <qlineseries.h>
5 #include <qlineseries.h>
6 #include "qsplineseries.h"
6 #include <qbarset.h>
7 #include <qbarset.h>
7 #include <qbarseries.h>
8 #include <qbarseries.h>
8 #include <qstackedbarseries.h>
9 #include <qstackedbarseries.h>
@@ -200,7 +201,7 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
200 QList<RealList> data = generateTestData(columnCount, rowCount, dataCharacteristics);
201 QList<RealList> data = generateTestData(columnCount, rowCount, dataCharacteristics);
201
202
202 // Line series and scatter series use similar data
203 // Line series and scatter series use similar data
203 if (seriesName.contains("line", Qt::CaseInsensitive)) {
204 if (seriesName.contains("qline", Qt::CaseInsensitive)) {
204 for (int j(0); j < data.count(); j ++) {
205 for (int j(0); j < data.count(); j ++) {
205 QList<qreal> column = data.at(j);
206 QList<qreal> column = data.at(j);
206 QLineSeries *series = new QLineSeries();
207 QLineSeries *series = new QLineSeries();
@@ -215,7 +216,7 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
215 QList<qreal> column = data.at(j);
216 QList<qreal> column = data.at(j);
216 QScatterSeries *series = new QScatterSeries();
217 QScatterSeries *series = new QScatterSeries();
217 for (int i(0); i < column.count(); i++) {
218 for (int i(0); i < column.count(); i++) {
218 (*series) << QPointF(i, column.at(i));
219 (*series) << QPointF(i, column.at(i));
219 }
220 }
220 m_chartView->addSeries(series);
221 m_chartView->addSeries(series);
221 setCurrentSeries(series);
222 setCurrentSeries(series);
@@ -254,6 +255,7 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
254 }
255 }
255 series->addBarSet(set);
256 series->addBarSet(set);
256 }
257 }
258
257 // TODO: new implementation of setFloatingValuesEnabled with signals
259 // TODO: new implementation of setFloatingValuesEnabled with signals
258 //series->setFloatingValuesEnabled(true);
260 //series->setFloatingValuesEnabled(true);
259 series->setToolTipEnabled(true);
261 series->setToolTipEnabled(true);
@@ -261,8 +263,19 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
261 m_chartView->addSeries(series);
263 m_chartView->addSeries(series);
262 setCurrentSeries(series);
264 setCurrentSeries(series);
263 }
265 }
266 else if (seriesName.contains("spline", Qt::CaseInsensitive)) {
267 for (int j(0); j < data.count(); j ++) {
268 QList<qreal> column = data.at(j);
269 QSplineSeries *series = new QSplineSeries();
270 for (int i(0); i < column.count(); i++) {
271 series->add(i, column.at(i));
272 }
273 m_chartView->addSeries(series);
274 setCurrentSeries(series);
275 }
264
276
265 // TODO: spline and area
277 // TODO: area
278 }
266 }
279 }
267
280
268 void MainWidget::setCurrentSeries(QSeries *series)
281 void MainWidget::setCurrentSeries(QSeries *series)
@@ -285,6 +298,8 void MainWidget::setCurrentSeries(QSeries *series)
285 case QSeries::SeriesTypePercentBar:
298 case QSeries::SeriesTypePercentBar:
286 qDebug() << "setCurrentSeries (Percentbar)";
299 qDebug() << "setCurrentSeries (Percentbar)";
287 break;
300 break;
301 case QSeries::SeriesTypeSpline:
302 break;
288 default:
303 default:
289 Q_ASSERT(false);
304 Q_ASSERT(false);
290 break;
305 break;
General Comments 0
You need to be logged in to leave comments. Login now