Guest User

Untitled

a guest
Dec 12th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. public ActionResult GraficoTecnicos()
  2. {
  3. var objData = getDataGrafico1();
  4. int i = 0;
  5. string[] categorias = new string[objData.Count];
  6. object[] data = new object[objData.Count];
  7. foreach (ZonaGraficos item in objData)
  8. {
  9. categorias[i] = item.zona;
  10. data[i] = item.total;
  11. i++;
  12. };
  13.  
  14. Highcharts columnChart = new Highcharts("piechart");
  15. columnChart.InitChart(new Chart()
  16. {
  17. Type = ChartTypes.Column,
  18. BackgroundColor = new BackColorOrGradient(Color.WhiteSmoke),
  19. Style = "fontWeight: 'bold', fontSize: '17px'",
  20. BorderColor = Color.LightBlue,
  21. BorderRadius = 0,
  22. BorderWidth = 2
  23.  
  24.  
  25. });
  26.  
  27. columnChart.SetTitle(new Title()
  28. {
  29. Text = "Desempeño"
  30. });
  31.  
  32. columnChart.SetSubtitle(new Subtitle()
  33. {
  34. Text = "Incidencias por Zonas en el período"
  35. });
  36.  
  37. columnChart.SetXAxis(new XAxis()
  38. {
  39. Type = AxisTypes.Category,
  40. Title = new XAxisTitle() { Text = "Zonas", Style = "fontWeight: 'bold', fontSize: '17px'" },
  41. Categories = categorias
  42.  
  43. //Categories = new[] { "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012" }
  44. });
  45.  
  46. columnChart.SetYAxis(new YAxis()
  47. {
  48. Title = new YAxisTitle()
  49. {
  50. Text = "Incidencias",
  51. Style = "fontWeight: 'bold', fontSize: '17px'"
  52.  
  53.  
  54. },
  55.  
  56. ShowFirstLabel = true,
  57. ShowLastLabel = true,
  58. Min = 0
  59. });
  60.  
  61. columnChart.SetLegend(new Legend
  62. {
  63. Enabled = true,
  64. BorderColor = Color.CornflowerBlue,
  65. BorderRadius = 6,
  66. BackgroundColor = new BackColorOrGradient(ColorTranslator.FromHtml("#FFADD8E6"))
  67. });
  68.  
  69. Data _data = new Data(data);
  70. Color[] _color = { Color.AntiqueWhite, Color.Black, Color.Blue, Color.DarkBlue, Color.DarkGray };
  71. PlotOptionsSeries _ploos = new PlotOptionsSeries();
  72. columnChart.SetSeries(new Series[]
  73. {new Series{Color = Color.BlueViolet,Name = "Incidencias",Data = _data}});
  74. return View(columnChart);
  75. }
Add Comment
Please, Sign In to add comment