网站开发文档下载,前端开发和后端开发哪个好,网站加入站长统计,公众号搭建第三方平台大数据量导致曲线绘制卡顿问题 这里提供一个思路在跟踪源码中发现底层卡顿在vector的resize() 此处扩容中
所以尽量使用下面的接口
/*! \overloadAdds the provided data point as \a key and \a value to the current data.Alternatively, you can also access and modify t…大数据量导致曲线绘制卡顿问题 这里提供一个思路在跟踪源码中发现底层卡顿在vector的resize() 此处扩容中
所以尽量使用下面的接口
/*! \overloadAdds the provided data point as \a key and \a value to the current data.Alternatively, you can also access and modify the data directly via the \ref data method, whichreturns a pointer to the internal data container.
*/
void QCPGraph::addData(double key, double value)
{mDataContainer-add(QCPGraphData(key, value));
}而不是使用addData这个接口还有setData这个接口
/*! \overloadAdds the provided points in \a keys and \a values to the current data. The provided vectorsshould have equal length. Else, the number of added points will be the size of the smallestvector.If you can guarantee that the passed data points are sorted by \a keys in ascending order, youcan set \a alreadySorted to true, to improve performance by saving a sorting run.Alternatively, you can also access and modify the data directly via the \ref data method, whichreturns a pointer to the internal data container.
*/
void QCPGraph::addData(const QVectordouble keys, const QVectordouble values, bool alreadySorted)
{if (keys.size() ! values.size())qDebug() Q_FUNC_INFO keys and values have different sizes: keys.size() values.size();const int n qMin(keys.size(), values.size());QVectorQCPGraphData tempData(n);QVectorQCPGraphData::iterator it tempData.begin();const QVectorQCPGraphData::iterator itEnd tempData.end();int i 0;while (it ! itEnd){it-key keys[i];it-value values[i];it;i;}mDataContainer-add(tempData, alreadySorted); // dont modify tempData beyond this to prevent copy on write
}