public void GetGraficoTest()
        {
            // Arrange
            DateTime inicial        = DateTime.Today.Date;
            DateTime final          = DateTime.Today.Date.AddDays(10);
            int      idEmpresa      = 2;
            int      idDepartamento = 0;
            int      idPgto         = 0;

            // Act
            var grafico = service.GetGrafico(inicial, final, idEmpresa, idDepartamento, idPgto);

            // Assert
            Assert.IsTrue(grafico.Count > 0);
        }
Exemple #2
0
        public Chart GetGrafico(int dias, int idDepartamento, int idPgto)
        {
            try
            {
                int      idEmpresa = login.GetUsuario(System.Web.HttpContext.Current.User.Identity.Name).IdEmpresa;
                DateTime inicial   = DateTime.Today.Date;
                DateTime final     = inicial.AddDays(dias);
                var      grafico   = service.GetGrafico(inicial, final, idEmpresa, idDepartamento, idPgto);

                StringBuilder t = new StringBuilder();
                t.Append("<Chart>")
                .Append("<ChartAreas>")
                .Append("<ChartArea Name='Default' _Template_='All'>")
                .Append("<AxisY>")
                .Append("<LabelStyle Font='Verdana, 12px' />")
                .Append("</AxisY>")
                .Append("<AxisX LineColor='64, 64, 64, 64' Interval='1'>")
                .Append("<LabelStyle Font='Verdana, 12px' />")
                .Append("</AxisX>")
                .Append("</ChartArea>")
                .Append("</ChartAreas>")
                .Append("</Chart>");

                Chart myChart = new Chart(800, 600, theme: t.ToString())
                                .AddSeries(
                    legend: "#VALX",
                    name: "Vencimentos",
                    xValue: grafico.Select(x => x.Dia).ToArray(),
                    yValues: grafico.Select(x => x.Valor).ToArray())
                                .SetXAxis("Dias")
                                .SetYAxis("Valores agendados")
                                .Write();

                return(myChart);
            }
            catch (Exception)
            {
                throw;
            }
        }