在Web应用程序使用Highcharts的JavaScript应用程序、Web、JavaScript、Highcharts

2023-09-04 06:03:59 作者:西风泪

我跟Highcharts在我的.NET应用试验。

I am experimenting with Highcharts in my .Net application.

我有我需要包括一些数据,但似乎无法找出其中添加它。

I have some data that I need to include, but can't seem to figure out where to add it.

     /*X axis coordinates*/
     List<int> lstXaxis = new List<int>();
     lstXaxis.Add(2007);
     lstXaxis.Add(2008);
     lstXaxis.Add(2009);
     lstXaxis.Add(2010);

我需要设置公共属性,使我的as​​px页面可以访问它。

I need to setup public properties so that my aspx page can access it.

我是否包括在后面的aspx页面的C#code这两个命令?

Do I include these two commands in the C# code behind the aspx page?

      public string Series1 { get; set; }
      public string Xaxis { get; set; }

和使用该访问于x轴的数据转换?

And use the accessors to convert the x-axis data?

      JavaScriptSerializer oSerializer = new JavaScriptSerializer();
      Xaxis= oSerializer.Serialize(lstXaxis);

我引用下面的网站作为一个启动点: http://deebujacob.blogspot.com/2011/05/aspnet-and -highcharts.html

I am referencing the following site as a startup point: http://deebujacob.blogspot.com/2011/05/aspnet-and-highcharts.html

推荐答案

我发现了另一种更简单的在.NET中生成图表。想象一下,生成图表像这样;

I found another simpler for generating charts in .NET. Imagine generating charts like this;



DataTable tbl; //your datatable with chart info.. 

//the series you would like to draw, first value corresponds to the name of the column, 2nd value to the title you would to use for that chart
string[] serieslist = { "allorders,All orders", "shippedorders, Shipped orders", "rejectedorders,Rejected orders" };

//getting the chart string
string chartString = chart.DrawChart(tbl, serieslist, "yearly-report", "date", "Yearly sales report", "my subtitle", "column", false);

绘制图表3行!

Drawing a chart in 3 lines!

看这个博客输入更多信息。 http://www.phronesisweb.com/blog/using-highcharts-with-net-without-any-extra-control-generating-a-highchart-chart-in-just-one-method/

Look at this blog enter for more info. http://www.phronesisweb.com/blog/using-highcharts-with-net-without-any-extra-control-generating-a-highchart-chart-in-just-one-method/