线条和标记<;MarkerPointsGraph>;具有DataSource

本文关键字:MarkerPointsGraph gt 具有 DataSource lt | 更新日期: 2023-09-27 17:59:30

我正在使用DynamicDataDisplay绘制实时信号。我希望在我的图表上同时显示标记和线条,所以我认为我应该使用LineAndMarker<MarkerPointsGraph>;当x-y数据更新时,我的逻辑是只更新日期源,而不是添加更多的图线。在这种情况下,如果数据很大并且更新很快,我仍然可以获得性能。我的问题是:我没有看到LineAndMarker<MarkerPointsGraph>的DataSource域,所以我不知道如何更新数据?这里是一个例子,其中我使用了LineGraph而不是LineAndMarker<MarkerPointsGraph>;但LineGraph似乎不能处理标记。

for (int i = 0; i < _nColorChannels; i++)
{
    if (_dataX[i].Length == _dataY[i].Length)
    {
        EnumerableDataSource<int> xOneCh = new EnumerableDataSource<int>(_dataX[i]);
        xOneCh.SetXMapping(xVal => xVal);
        EnumerableDataSource<int> yOneCh = new EnumerableDataSource<int>(_dataY[i]);
        yOneCh.SetYMapping(yVal => yVal);
        CompositeDataSource ds = new CompositeDataSource(xOneCh, yOneCh);
        Action UpdateData = delegate()
        {
            ((LineGraph)plotter.Children.ElementAt(startIndex + i)).DataSource = ds;
        };
        this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal,
                               UpdateData);
    }
}

欢迎提出任何建议。非常感谢。Nick

小更新:看起来MarkerPointsGraph有DataSource,但我如何创建可以AddLineGraph()MarkerPointsGraph实例?类似于LineGraph版本的创建方式:

LineGraph lg = new LineGraph();
lg = plotter.AddLineGraph(dsOneCh, _lineprofileColor[i], marker, "Data");

线条和标记<;MarkerPointsGraph>;具有DataSource

类似这样的东西:

if (_dataX[i].Length == _dataY[i].Length)
                    {
                        EnumerableDataSource<int> xOneCh = new EnumerableDataSource<int>(_dataX[i]);
                        xOneCh.SetXMapping(xVal => xVal);
                        EnumerableDataSource<int> yOneCh = new EnumerableDataSource<int>(_dataY[i]);
                        yOneCh.SetYMapping(yVal => yVal);
                        CompositeDataSource ds = new CompositeDataSource(xOneCh, yOneCh);
                        Action UpdateData = delegate()
                        {
                            ((PointsGraphBase)plotter.Children.ElementAt(startIndex + i + 1)).DataSource = ds; 
                        };
                    this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, UpdateData);
                }

将其投射到PointsGraphBase