plotter
是一个DynamicDataDisplay.ChatterPlot
变量。它添加了如下几行:
LineGraph lgChA = plotter.AddLineGraph(dsChA, Colors.Red, 1, "Data");
LineGraph lgChB = plotter.AddLineGraph(dsChB, Colors.Green, 1, "Data");
图表是实时更新的,所以我只更新数据源,如下所示:
if (_dataXChA != null && _dataXChA.Length > 1)
{
EnumerableDataSource<double> xChA = new EnumerableDataSource<double>(_dataXChA);
xChA.SetXMapping(xVal => xVal);
if (_dataYChA != null && _dataYChA.Length == _dataXChA.Length)
{
EnumerableDataSource<double> yChA = new EnumerableDataSource<double>(_dataYChA);
yChA.SetYMapping(yVal => yVal);
CompositeDataSource dsChA = new CompositeDataSource(xChA, yChA);
//((LineGraph)plotter.brus = dsChA;
((LineGraph)plotter.Children.ElementAt(startIndex)).DataSource = dsChA;
plotter.FitToView();
}
}
if (_dataXChB != null && _dataXChB.Length > 1)
{
EnumerableDataSource<double> xChB = new EnumerableDataSource<double>(_dataXChB);
xChB.SetXMapping(xVal => xVal);
if (_dataYChB != null && _dataYChB.Length == _dataXChB.Length)
{
EnumerableDataSource<double> yChB = new EnumerableDataSource<double>(_dataYChB);
yChB.SetYMapping(yVal => yVal);
CompositeDataSource dsChB = new CompositeDataSource(xChB, yChB);
((LineGraph)plotter.Children.ElementAt(startIndex + 1)).DataSource = dsChB;
plotter.FitToView();
}
}
但我想知道,除了更新数据点之外,我是否也可以更改LineGraph
变量的画笔颜色?我想应该在像 plotter.XXX.color 这样的地方?