asp.net渲染折线图

Kin*_*gla 5 asp.net charts line

我一直在尝试使用基本的asp.net Chart类渲染折线图.无论我做什么,它总是呈现柱形图.这是我的代码,我将数据表绑定到图表.

var IEtable = (table as System.ComponentModel.IListSource).GetList();

var chart = new Chart(width: 1000, height: 1000)
    .AddSeries(chartType: "Line").AddLegend("Key")
    .AddTitle("Time Series Metric")
    .DataBindCrossTable(IEtable, "Key", "Date", "Value");
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?从现在开始超过12个小时,我一直在用这个东西搞砸了.

Dav*_*e R 0

我构建图表的方式略有不同 - 也许是因为我在 MVC 页面中构建图表?无论如何,我仍在使用 MS Chart 的东西 - http://msdn.microsoft.com/en-us/library/ee410579.ASPX

我创建我的图表:

var chart = new Chart();
chart.Width = 900;
chart.Height = 500;
...lots more options...
Run Code Online (Sandbox Code Playgroud)

然后一次添加我的系列......

chart.Series.Add(CreateDataSeries(id, "GI Lower", null, null, GetGILowerDataPoints));
chart.Series.Add(CreateDataSeries(id, "GI Upper", null, null, GetGIUpperDataPoints));
Run Code Online (Sandbox Code Playgroud)

其中 CreateDataSeries 设置图表类型,如下所示:

Series seriesDetail = new Series();
seriesDetail.ChartType = SeriesChartType.Spline;
...
return seriesDetail;
Run Code Online (Sandbox Code Playgroud)

这些帮助有用?