.NET C#4.0中的折线图 [英] Line chart in .net c# 4.0
本文介绍了.NET C#4.0中的折线图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我有一个5 * 5的矩阵,试图通过它绘制线图.
我们如何才能访问所有系列(本例中为5个系列)?
Hi all,
I have a 5*5 matrix through which I am trying to draw a Line Plot.
How can we access all the series (say 5 series in this case)?
chart1.Series["Default"].Points.AddY(array[i]);
实际上,该行只能访问特定的系列.我想知道如何使用这些功能访问所有系列.如果可能,请向我显示代码段.
-预先感谢朋友-----
Actually this line can access only a particular series. I want to know how to access all the series using these features. If possible show me code snippet.
-- Thanks in advance friends -----
推荐答案
您应该将矩阵的每一行添加为附加序列.这是我前一段时间编写的应用程序中的代码:
You should add each row of your matrix as an additional series. Here is my code from an application I wrote a while back:
chart.ChartAreas.Add(new System.Windows.Forms.DataVisualization.Charting.ChartArea("BidAsk"));
chart.Series.Add(new System.Windows.Forms.DataVisualization.Charting.Series("Bid"));
chart.Series.Add(new System.Windows.Forms.DataVisualization.Charting.Series("Ask"));
chart.Series["Bid"].ChartType = SeriesChartType.StepLine;
chart.Series["Bid"].Points.DataBindXY(dView, "Timestamp", dView, "BidPrice");
chart.Series["Bid"].ChartArea = "BidAsk";
chart.Series["Ask"].ChartType = SeriesChartType.StepLine;
chart.Series["Ask"].Points.DataBindXY(dView, "Timestamp", dView, "AskPrice");
chart.Series["Ask"].ChartArea = "BidAsk";
您将在DataBindXY行中设置Y的值.您可能只使用DataBindY.
The DataBindXY line is where you will set the values for Y. You will probably just use DataBindY.
这篇关于.NET C#4.0中的折线图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文