加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 如何在livechart中逐一添加点到serie

发布时间:2020-12-15 22:50:19 所属栏目:百科 来源:网络整理
导读:public ChartValuesObservablePoint Series1 { get; set; }public void GeneratePlot(PlotInfo plotInfo){ DataContext = null; Series1 = new ChartValuesObservablePoint(); Series1.AddRange(plotInfo.SeriesIn); DataContext = this;} 如何添加第一个点
public ChartValues<ObservablePoint> Series1 { get; set; }

public void GeneratePlot(PlotInfo plotInfo)
{
    DataContext = null;

    Series1 = new ChartValues<ObservablePoint>();
    Series1.AddRange(plotInfo.SeriesIn);

    DataContext = this;
}

如何添加第一个点并等待200毫秒并顺利添加下一个点?

现在程序的UI停止几秒钟,并显示所有点.

解决方法

试试这个:

public async void GeneratePlot(PlotInfo plotInfo)
{
    Series1 = new ChartValues<ObservablePoint>();
    DataContext = this;

    foreach (var x in plotInfo.SeriesIn)
    {
        Series1.Add(x);
        await Task.Delay(200);
    }
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读