diff --git a/doc/src/example-linechart.qdoc b/doc/src/example-linechart.qdoc index c426653..3fac9dc 100644 --- a/doc/src/example-linechart.qdoc +++ b/doc/src/example-linechart.qdoc @@ -11,7 +11,7 @@ \snippet ../example/linechart/main.cpp 1 - We add data to be shown to both series. + We add data to be shown to both series. We can use add() member function or use stream operator. \snippet ../example/linechart/main.cpp 2 diff --git a/example/linechart/main.cpp b/example/linechart/main.cpp index 6f279bc..9485d9e 100644 --- a/example/linechart/main.cpp +++ b/example/linechart/main.cpp @@ -31,11 +31,7 @@ int main(int argc, char *argv[]) series0->add(7, 4); series0->add(10,5); - series1->add(1, 1); - series1->add(3, 3); - series1->add(7, 6); - series1->add(8, 3); - series1->add(10,2); + *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10,2); //![2] //![3] QMainWindow window; diff --git a/src/linechart/qlineseries.cpp b/src/linechart/qlineseries.cpp index 4d32bbe..0b0cab1 100644 --- a/src/linechart/qlineseries.cpp +++ b/src/linechart/qlineseries.cpp @@ -68,6 +68,7 @@ QLineSeries::~QLineSeries() */ void QLineSeries::add(qreal x,qreal y) { + Q_ASSERT(m_x.size() == m_y.size()); m_x<