2013-05-06 66 views
0

我想知道如何使用Highcharts框架绘制一条坚实的水平线。
目的:这些行的目的是,我想有一定的限制。
额外的信息:如何绘制水平线使用Highcharts DotNet C#

  1. 技术:ASP.NET MVC3,Highcharts DOTNET的C#框架
  2. 框架我使用:http://dotnethighcharts.codeplex.com/

例子:
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

你要找的是所谓的情节线在这里是因为它

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 : '' 
             } 
             } 
            } 
        }) 
+0

谢谢你的回复的例子,是语法上的你的代码是正确的,我似乎得到大量的语法错误。 – AustinT 2013-05-06 15:54:01

+0

我不完全确定你的语法如何,但你不应该有任何问题转换js到C# – 2013-05-06 15:56:08

+0

好吧。谢谢。 – AustinT 2013-05-06 15:57:46