LiveCharts-从列表绘制x& y [英] LiveCharts - plotting x&y from lists

查看:440
本文介绍了LiveCharts-从列表绘制x& y的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有四个列表(x1List,y1List,x2List,y2List),每个列表拥有1000个值,我想将这些列表绘制为x&使用LiveCharts的y值。

I have four lists (x1List, y1List, x2List, y2List) which hold 1000 values each, i want to plot these lists as x & y values using LiveCharts.

我了解如何绘制y值;

i understand how to plot the y values using;

            new LineSeries
            {
                Title = "Series1",
                Values = y1List.AsChartValues(),
                PointGeometry = null
            },

            new LineSeries
            {
                Title = "Series2",
                Values = y2List.AsChartValues(),
                PointGeometry = null
            },

我不明白如何将x值应用于各自的序列。

I don't understand how to apply the x values to their respective series.

我是C#的新手,所以很抱歉,如果我忽略了这很简单。

I'm new to c# so apologies if this is something simple i am overlooking.

推荐答案

您可以使用 ObserablePoint 对象,用于存储X和Y值。然后,您可以创建一个 ChartValues< ObservablePoint> ,它会绘制出我想看到的内容。确保包含LiveCharts.Defualts命名空间的语句;

You can use an ObserablePoint object to store an X and Y value. Then you can create a ChartValues<ObservablePoint> that will plot what I'm thinking you want to see. Make sure to include the statement for LiveCharts.Defualts namespace;

using LiveCharts.Defaults;

ChartValues<ObservablePoint> List1Points = new ChartValues<ObservablePoint>();

For(int i = x1List, i < x1List.Count, i++)
{
    List1Points.Add(new ObservablePoint 
    { 
        X=x1List[i], 
        Y=y1List[i]
    });
}

希望这样的方法对您有用。

Hopefully something like that will work for you.

这篇关于LiveCharts-从列表绘制x&amp; y的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆