private Highcharts BasicLineMultipleStation(string chartHeading, PairModel station1, PairModel station2, PairModel station3, PairModel station4, string[] categories)
 {
     Highcharts chart = new Highcharts("chart")
         .InitChart(new Chart
         {
             DefaultSeriesType = ChartTypes.Line,
             MarginRight = 130,
             MarginBottom = 25,
             ClassName = "chart"
         })
         .SetTitle(new Title
         {
             Text = chartHeading,
             X = -20
         })
         .SetSubtitle(new Subtitle
         {
             Text = "Source: Dummy Data",
             X = -20
         })
         .SetXAxis(new XAxis { Categories = categories })
         .SetYAxis(new YAxis
         {
             Title = new XAxisTitle { Text = "Temperature (°C)" },
             PlotLines = new[]
                                   {
                                       new XAxisPlotLines
                                       {
                                           Value = 0,
                                           Width = 1,
                                           Color = ColorTranslator.FromHtml("#808080")
                                       }
                                   }
         })
         .SetTooltip(new Tooltip
         {
             Formatter = @"function() {
                                 return '<b>'+ this.series.name +'</b><br/>'+
                             this.x +': '+ this.y +'°C';
                         }"
         })
         .SetLegend(new Legend
         {
             Layout = Layouts.Vertical,
             Align = HorizontalAligns.Right,
             VerticalAlign = VerticalAligns.Top,
             X = -10,
             Y = 100,
             BorderWidth = 0
         })
         .SetSeries(new[]
                    {
                        new Series {Name = station1.Key.ToString(), Data= (Data)station1.Value},
                        new Series {Name = station2.Key.ToString(), Data= (Data)station2.Value},
                        new Series {Name = station3.Key.ToString(), Data= (Data)station3.Value},
                        new Series {Name = station4.Key.ToString(), Data= (Data)station4.Value},
                    }
         );
     return chart;
 }
Пример #2
0
 private Highcharts DataLabels(string label, string[] categories, PairModel station1, PairModel station2, PairModel station3, PairModel station4)
 {
     Highcharts chart = new Highcharts("chart")
         .InitChart(new Chart { DefaultSeriesType = ChartTypes.Line })
         .SetTitle(new Title { Text = label })
         .SetSubtitle(new Subtitle { Text = "Source: Dummy Data" })
         .SetXAxis(new XAxis { Categories = categories })
         .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Temperature (°C)" } })
         .SetTooltip(new Tooltip { Enabled = true, Formatter = @"function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y +'°C'; }" })
         .SetPlotOptions(new PlotOptions
         {
             Line = new PlotOptionsLine
             {
                 DataLabels = new PlotOptionsLineDataLabels
                 {
                     Enabled = true
                 },
                 EnableMouseTracking = false
             }
         })
         .SetSeries(new[]
                    {
                        new Series { Name = station1.Key.ToString(), Data = (Data)station1.Value },
                        new Series { Name = station2.Key.ToString(), Data = (Data)station2.Value  },
                        new Series { Name = station3.Key.ToString(), Data = (Data)station3.Value  },
                        new Series { Name = station4.Key.ToString(), Data = (Data)station3.Value  }
                    });
     return chart;
 }