如何使用Highcharts DotNet C#绘制水平线

时间:2013-05-06 15:35:18

标签: c# asp.net charts highcharts dotnethighcharts

我想知道如何使用Highcharts框架绘制一条实线水平线。
目的:这些行的目的是我希望在某个值上有约束 额外信息:

  1. 技术:ASP.NET MVC3,Highcharts DotNet C#Framework
  2. 我正在使用的框架:http://dotnethighcharts.codeplex.com/
  3. 示例:
    enter image description here

    这是我想要的一个例子,除了红线和绿线是控制线。我不希望红线和绿线有点,但要成为一条实线。

    我生成上图的当前代码

            Highcharts chart = new Highcharts("chart");
            chart.SetXAxis(new XAxis
            {
                Categories = new[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }
            });
            chart.SetSeries(new[]{
                new Series
                {
                    Data = new Data(new object[] { 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4 })
                },
                new Series
                {
                    Data = new Data(new object[] { 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250 })
                },
                new Series
                {
                    Data = new Data(new object[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })
                }
    
            });
    

    感谢您的帮助,如果对此问题有任何误解,请告诉我。

1 个答案:

答案 0 :(得分:1)

你正在寻找的是名为plot-line的地方,这是它的例子

http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/stock/demo/yaxis-plotlines/

.SetYAxis(new YAxis
                  {
                      Title = new XAxisTitle { Text = "" },
                      PlotLines = new[]
                                  {
                      new XAxisPlotLines
                       {
                        value : 0,
                        color : 'green',
                        dashStyle : 'shortdash',
                        width : 2,
                        label : {
                        text : ''
                                 }
                          }
                       new XAxisPlotLines
                                      {
                        value : 250,
                        color : 'red',
                        dashStyle : 'shortdash',
                        width : 2,
                        label : {
                         text : ''
                                       }
                                      }
                                  }
                  })