how to display huge amount data in qml chartview LineSeries?
-
Hello all,
I am trying to display 10 LineSeries in qml chartview with DateTimeAxis,with C++ to update the data every 1 second.
The problem is that: when the data grow the qml UI get slowly, and the process crashed.top_Qt_5_14_0_MinGW_64_bit-Debug\dc_beta.exe crashed.
e.g. for 15days, the points will be 3600 * 24 * 15=1296000
the data saved in qml UI side(memory)?following code is to explain what I'm doing:
(1)//Mychartview.qml
ChartView {DateTimeAxis{
id:idX
...
}
ValueAxis{id:idY1}
LineSeries{id:lineCH1; axisX:idX; axisY:idY1;}Timer
{
//request data from C++ every 1 second
context.funUpdateDataFrom(chartView.series(0))
}(2)//my.cpp
funUpdateDataFrom(QAbstractSeries *series)
{
static int iTest;
QXYSeries *xySeries = static_cast<QXYSeries *>(series);
...xySeries->append(nowTime, iTest++); //maybe use replace(mPoints) function,but it need to define a big-size mPoints consuming huge memory.
}
-
This is not sustainable. Cache the data to disk and load n points from this cache. Give yourself the ability to scroll through the data that was collected. Maybe a date time lookup. I like to use sqlite databases for stuff like this and then I just do queries using the qdatabase classes.