Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.2
-
None
-
Qt Creator 4.9.0
Qt 5.12.2
Windows 10
Description
In this code snippet, I'm trying to display a graph with two series. For faster output, I delete, fill in the Series, and then add them back. The problem is that when you delete and add Series 2 at the same time is not displayed.
- Series 1(Red Line) — This is a normal random function.
- Series 2(Green Line) — level 0, for the test at the moment 400.
In this case, only Series1 will be displayed:
Series1->clear(); Series2->clear(); Chart1->removeSeries(Series1); Chart1->removeSeries(Series2); for(int i=0; i<dataArray.size()-1; i++) { Series1->append(i, dataArray[i]); Series2->append(i, 400); } axisX->setRange(firstCount, secondCount); axisY->setRange(minValueOfDataArray, maxValueOfDataArray); axisZero->setRange(minValueOfDataArray, maxValueOfDataArray); Chart1->addSeries(Series1); Chart1->addSeries(Series2);
If I delete only Series1, then everything will work correctly and Series2 will also appear, but the output will be very slow, and for big data the program will completely fall:
Series1->clear(); Series2->clear(); Chart1->removeSeries(Series1); //Chart1->removeSeries(Series2); for(int i=0; i<dataArray.size()-1; i++) { Series1->append(i, dataArray[i]); Series2->append(i, 400); } axisX->setRange(firstCount, secondCount); axisY->setRange(minValueOfDataArray, maxValueOfDataArray); axisZero->setRange(minValueOfDataArray, maxValueOfDataArray); Chart1->addSeries(Series1); //Chart1->addSeries(Series2);