@@ -59,6 +59,10 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
59 | QSplineSeries::QSplineSeries(QObject *parent) : |
|
59 | QSplineSeries::QSplineSeries(QObject *parent) : | |
60 | QLineSeries(*new QSplineSeriesPrivate(this),parent) |
|
60 | QLineSeries(*new QSplineSeriesPrivate(this),parent) | |
61 | { |
|
61 | { | |
|
62 | Q_D(QSplineSeries); | |||
|
63 | QObject::connect(this,SIGNAL(pointAdded(int)), d, SLOT(updateControlPoints())); | |||
|
64 | QObject::connect(this,SIGNAL(pointRemoved(int)), d, SLOT(updateControlPoints())); | |||
|
65 | QObject::connect(this,SIGNAL(pointReplaced(int)), d, SLOT(updateControlPoints())); | |||
62 | } |
|
66 | } | |
63 |
|
67 | |||
64 | QSplineSeries::~QSplineSeries() |
|
68 | QSplineSeries::~QSplineSeries() | |
@@ -78,9 +82,9 QAbstractSeries::SeriesType QSplineSeries::type() const | |||||
78 |
|
82 | |||
79 | QSplineSeriesPrivate::QSplineSeriesPrivate(QSplineSeries* q):QLineSeriesPrivate(q) |
|
83 | QSplineSeriesPrivate::QSplineSeriesPrivate(QSplineSeries* q):QLineSeriesPrivate(q) | |
80 | { |
|
84 | { | |
81 | QObject::connect(this,SIGNAL(pointAdded(int)), this, SLOT(updateControlPoints())); |
|
85 | // QObject::connect(this,SIGNAL(pointAdded(int)), this, SLOT(updateControlPoints())); | |
82 | QObject::connect(this,SIGNAL(pointRemoved(int)), this, SLOT(updateControlPoints())); |
|
86 | // QObject::connect(this,SIGNAL(pointRemoved(int)), this, SLOT(updateControlPoints())); | |
83 | QObject::connect(this,SIGNAL(pointReplaced(int)), this, SLOT(updateControlPoints())); |
|
87 | // QObject::connect(this,SIGNAL(pointReplaced(int)), this, SLOT(updateControlPoints())); | |
84 | }; |
|
88 | }; | |
85 |
|
89 | |||
86 | /*! |
|
90 | /*! |
@@ -210,7 +210,7 void TableWidget::updateChartType(bool toggle) | |||||
210 |
|
210 | |||
211 | if (m_lineRadioButton->isChecked()) |
|
211 | if (m_lineRadioButton->isChecked()) | |
212 | { |
|
212 | { | |
213 |
|
|
213 | m_chart->setAnimationOptions(QChart::NoAnimation); | |
214 |
|
214 | |||
215 | // series 1 |
|
215 | // series 1 | |
216 | m_series = new QLineSeries(this); |
|
216 | m_series = new QLineSeries(this); | |
@@ -221,7 +221,7 void TableWidget::updateChartType(bool toggle) | |||||
221 | mapper->setXColumn(0); |
|
221 | mapper->setXColumn(0); | |
222 | mapper->setYColumn(1); |
|
222 | mapper->setYColumn(1); | |
223 | mapper->setFirst(3); |
|
223 | mapper->setFirst(3); | |
224 |
|
|
224 | mapper->setCount(4); | |
225 |
|
225 | |||
226 | // m_series->setModelMapping(0,1, Qt::Vertical); |
|
226 | // m_series->setModelMapping(0,1, Qt::Vertical); | |
227 | // m_series->setModelMappingRange(3, 4); |
|
227 | // m_series->setModelMappingRange(3, 4); | |
@@ -262,23 +262,25 void TableWidget::updateChartType(bool toggle) | |||||
262 | } |
|
262 | } | |
263 | else if (m_splineRadioButton->isChecked()) |
|
263 | else if (m_splineRadioButton->isChecked()) | |
264 | { |
|
264 | { | |
265 |
|
|
265 | m_chart->setAnimationOptions(QChart::NoAnimation); | |
266 |
|
266 | |||
267 |
|
|
267 | // series 1 | |
268 |
|
|
268 | m_series = new QSplineSeries; | |
269 |
|
|
269 | // m_series->setModel(m_model); | |
270 |
|
270 | |||
271 |
|
|
271 | QVXYModelMapper *mapper = new QVXYModelMapper; | |
272 |
|
|
272 | mapper->setSeries(m_series); | |
273 |
|
|
273 | mapper->setModel(m_model); | |
274 |
|
|
274 | mapper->setXColumn(0); | |
275 |
|
|
275 | mapper->setYColumn(1); | |
|
276 | mapper->setFirst(0); | |||
|
277 | mapper->setCount(-1); | |||
276 |
|
278 | |||
277 |
|
|
279 | // m_series->setModelMapper(mapper); | |
278 |
|
280 | |||
279 |
|
|
281 | m_chart->addSeries(m_series); | |
280 |
|
|
282 | seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper(); | |
281 |
|
|
283 | m_model->addMapping(seriesColorHex, QRect(0, 0, 2, 1000)); | |
282 |
|
284 | |||
283 | // // series 2 |
|
285 | // // series 2 | |
284 | // m_series = new QSplineSeries; |
|
286 | // m_series = new QSplineSeries; | |
@@ -524,9 +526,9 void TableWidget::testPie3() | |||||
524 |
|
526 | |||
525 | void TableWidget::testXY() |
|
527 | void TableWidget::testXY() | |
526 | { |
|
528 | { | |
527 | // if (m_series->type() != QAbstractSeries::SeriesTypeLine) { |
|
529 | // if (m_series->type() != QAbstractSeries::SeriesTypeLine) { | |
528 | // m_series->append(QPointF(150, 75)); |
|
530 | // m_series->append(QPointF(150, 75)); | |
529 | // } |
|
531 | // } | |
530 |
|
532 | |||
531 | if (m_series->count() > 0) { |
|
533 | if (m_series->count() > 0) { | |
532 | m_series->remove(m_series->points().last()); |
|
534 | m_series->remove(m_series->points().last()); |
General Comments 0
You need to be logged in to leave comments.
Login now