I have not used Highchart, but you can download examples from the codeplex page. It seems that both of your requirements can be easily achieved.
Remove the Snittbetyg Button
Disable legend:
.SetLegend(new Legend { Enabled = false });
Add colors
For ordinary data, use only numbers instead of numbers:
Data data = new Data(new[] { new Point { Y = 1, Color = System.Drawing.Color.Red }, new Point { Y = 8, Color = System.Drawing.Color.Blue }, new Point { Y = 9, Color = System.Drawing.Color.Green }, new Point { Y = 6, Color = System.Drawing.Color.Black } }); Highcharts chart1 = new Highcharts("chart1") .SetXAxis(new XAxis { Categories = new[] { "Ödmjukhet", "Engagemang", "Kompetens", "Lönsamhet" } }) .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Betygskalan" } }) .SetSeries(new Series { Data = data, Name = "Snittbetyg" }) .SetTitle(new Title { Text = "Örebro Statistik" }) .InitChart(new Chart { DefaultSeriesType = ChartTypes.Column }) .SetLegend(new Legend { Enabled = false });
There seems to be no built-in way to make highchart automatically color the panel based on the y value. I believe that you will need to choose a color yourself, for example:
private System.Drawing.Color GetBarColour(int value) { if (value < 5) return System.Drawing.Color.Red; if (value > 7) return System.Drawing.Color.Green; return System.Drawing.Color.Orange; } public ActionResult OfficeStatistic() { { var dataItems = new[] {1, 8, 9, 6}; Data data = new Data( dataItems.Select(y => new Point {Color = GetBarColour(y), Y = y}).ToArray() ); Highcharts chart1 = new Highcharts("chart1") .SetXAxis(new XAxis { Categories = new[] { "Ödmjukhet", "Engagemang", "Kompetens", "Lönsamhet" } }) .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Betygskalan" } }) .SetSeries(new Series { Data = data, Name = "Snittbetyg" }) .SetTitle(new Title { Text = "Örebro Statistik" }) .InitChart(new Chart { DefaultSeriesType = ChartTypes.Column }) .SetLegend(new Legend { Enabled = false });
pjumble
source share