/// <summary> /// The plotOptions is a wrapper object for config objects for each series type. The config objects for each series /// can also be overridden for each series item as given in the series array. /// Configuration options for the series are given in three levels. Options for all series in a chart are given in /// the plotOptions.series object. Then options for all series of a specific type are given in the plotOptions of /// that type, for example plotOptions.line. Next, options for one single series are given in the series array. /// </summary> /// <param name="plotOptions"></param> /// <returns></returns> public Highcharts SetPlotOptions(PlotOptions plotOptions) { _PlotOptions = plotOptions; return this; }
private DotNet.Highcharts.Highcharts GetChart(Series[] series, DataEnum data) { Chart chart = null; XAxis xAxis = null; PlotOptions options = null; switch (data) { case DataEnum.random_points: xAxis = new XAxis { Categories = new[] { "50", "100", "500", "1k", "5k", "10k", "50k", "100k", "500k", "1M", "2M", "3M", "4M", "5M" } }; options = new PlotOptions(); chart = new Chart(); break; case DataEnum.countries: xAxis = new XAxis { Categories = series.Select(t => t.Name).ToArray() }; options = new PlotOptions { Column = new PlotOptionsColumn { Stacking = Stackings.Normal } }; chart = new Chart { DefaultSeriesType = ChartTypes.Column }; // ReSharper disable once PossibleNullReferenceException var results = new object[series.Length]; for (int i = 0; i < series.Length; i++) results[i] = series.FirstOrDefault(x => x.Name.Equals(series[i].Name)).Data.ArrayData[0]; series = new[]{ new Series{ Name = data.ToString(), Data = new Data(results)} }; break; } return new DotNet.Highcharts.Highcharts("chart") .InitChart(chart) .SetTitle(new Title{ Text = "Comparison result" }) .SetXAxis(xAxis) .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Time (ms)" }, }) .SetSeries(series) .SetPlotOptions(options); }