feat:完成通过数据通信模块产生模拟数据驱动实时曲线绘制
This commit is contained in:
parent
59faca3046
commit
6810b9ec3e
|
|
@ -232,7 +232,7 @@ void dpLineChart::setDateTime(const QDateTime& dateTime)
|
|||
if(m_updateData)
|
||||
{
|
||||
//模拟数据展示
|
||||
static double min = 0, max = 10.0, marginFactor = 1.0;
|
||||
/*static double min = 0, max = 10.0, marginFactor = 1.0;
|
||||
for(auto it = m_graphs.begin(); it != m_graphs.end(); ++it)
|
||||
{
|
||||
double randomFloat = min + QRandomGenerator::global()->generateDouble() * (max - min);
|
||||
|
|
@ -249,10 +249,10 @@ void dpLineChart::setDateTime(const QDateTime& dateTime)
|
|||
it.value().qGraph->valueAxis()->setRangeLower(lower);
|
||||
}
|
||||
it.value().qGraph->addData(timeValue, randomFloat);
|
||||
}
|
||||
}*/
|
||||
|
||||
// for(auto it = m_graphs.begin(); it != m_graphs.end(); ++it)
|
||||
// DataManager::instance()->requestData(it.key(), this);
|
||||
for(auto it = m_graphs.begin(); it != m_graphs.end(); ++it)
|
||||
DataManager::instance()->requestData(it.key(), this);
|
||||
}
|
||||
|
||||
m_pCustomPlot->xAxis->setRange(timeValue, m_timeRange / 1000.0, Qt::AlignRight);
|
||||
|
|
@ -457,6 +457,11 @@ void dpLineChart::synchronizeConfigData(const configurationResults& cfg)
|
|||
}
|
||||
graph.qGraph = newGraph;
|
||||
m_graphs.insert(graphID, graph);
|
||||
DataManager::instance()->registerDataSource(graphID, [](){
|
||||
static double min = 0, max = 10.0;
|
||||
double randomFloat = min + QRandomGenerator::global()->generateDouble() * (max - min);
|
||||
return QVariant::fromValue(randomFloat);
|
||||
});
|
||||
}
|
||||
}
|
||||
else //更新数据
|
||||
|
|
|
|||
Loading…
Reference in New Issue