/// <summary> /// Renderiza um gráfico de pizza da qtde de deputados por estado /// </summary> /// <returns>Parcial contendo o gráfico dos deputados por estado</returns> public ActionResult DeputadoPorEstado() { //Lista de UF IEnumerable <PibPorUF> listaUF = new PibBiz().GetAll(); //Array2d com nro de linhas igual ao count e 2 colunas string[,] dados = new DeputadosBiz().getCountByUF(listaUF.Select(i => i.uf).ToArray()); //objeto chart var chart = new Highcharts("chartEstado") //tipo do gráfico .InitChart(new Chart { DefaultSeriesType = ChartTypes.Pie, PlotShadow = false }) //titulo .SetTitle(new Title { Text = Resources.Literals.lbl_grafico1_titulo }) //subtitulo .SetSubtitle(new Subtitle { Text = Resources.Literals.lbl_grafico1_subtitulo }) //Setar o titulo do Y .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Número de Deputados" } }) .SetTooltip(new Tooltip { Formatter = "function() { return '<b>'+ this.point.name +'</b>: '+ this.y +' Deputados'; }" }) .SetPlotOptions(new PlotOptions { Pie = new PlotOptionsPie { AllowPointSelect = true, DataLabels = new PlotOptionsPieDataLabels { Formatter = "function() { return '<b>'+ this.point.name +'</b>: '+ this.y; }", Enabled = true }, EnableMouseTracking = true } }) //Carregar os valores do Y .SetSeries(new[] { new Series { Type = ChartTypes.Pie, Name = "Deputados por UF", Data = new DotNet.Highcharts.Helpers.Data(dados) } //Pode criar uma segunda linha usando o comando acima } ); return(PartialView("_DeputadoPorEstado", chart)); }
public JsonResult ListAnalysisPivot() { var list = new PibBiz().GetAllCotaPib().Take(10).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }