比较简单,下面是示例代码,以添加最简单的List<Point>作为数据源来说明,
可以看到,给每个序列设置单独的数据源,以及Binding 和BindingX即可,即使两个数据源的X轴点不是一一对应的也是可以的
- flexChart1.Series.Add(new Series() { DataSource=GetData(5),Binding="Y",BindingX="X"});
- flexChart1.Series.Add(new Series() { DataSource = GetData2(5), Binding = "Y", BindingX = "X" });
复制代码
数据源生成函数
- private List<Point> GetData(int count) {
- List < Point > points = new List<Point>();
- Random random = new Random();
- for (int i = 0; i < count; i++)
- {
- points.Add(new Point() { X = i, Y = random.Next(1,count*10) });
- }
- return points;
- }
- private List<Point> GetData2(int count)
- {
- List<Point> points = new List<Point>();
- Random random = new Random();
- for (int i = 0; i < count; i++)
- {
- points.Add(new Point() { X = i*2, Y = random.Next(1,count*10) });
- }
- return points;
- }
复制代码 |