コード例 #1
0
        public void PreencherUltimos7Dias(BunifuDataViz bunifuDataViz1, Label lblservico)
        {
            DataPoint graficoArea, graficoLinha;

            graficoArea  = new DataPoint(BunifuDataViz._type.Bunifu_area);
            graficoLinha = new DataPoint(BunifuDataViz._type.Bunifu_line);
            var canvas = new Canvas();
            int qntServicosSemanais = 0;

            int[] qntServicos = { 0, 0, 0, 0, 0, 0, 0 };

            using (SqlConnection con = OpenConnection())
            {
                string        procedure = "ServicosUltimos7Dias";
                SqlDataReader dr;
                SqlCommand    cmd = new SqlCommand(procedure, con);
                cmd.CommandType = CommandType.StoredProcedure;

                dr = cmd.ExecuteReader();

                while (dr.Read())
                {
                    qntServicosSemanais += 1;
                    switch (dr.GetString(2))
                    {
                    case "Segunda-Feira":
                        qntServicos[0] = qntServicos[0] + 1;
                        break;

                    case "Terça-Feira":
                        qntServicos[1] = qntServicos[1] + 1;
                        break;

                    case "Quarta-Feira":
                        qntServicos[2] = qntServicos[2] + 1;
                        break;

                    case "Quinta-Feira":
                        qntServicos[3] = qntServicos[3] + 1;
                        break;

                    case "Sexta-Feira":
                        qntServicos[4] = qntServicos[4] + 1;
                        break;

                    case "Sábado":
                        qntServicos[5] = qntServicos[5] + 1;
                        break;

                    case "Domingo":
                        qntServicos[6] = qntServicos[6] + 1;
                        break;
                    }
                }

                lblservico.Text = Convert.ToString(qntServicosSemanais);

                graficoArea.addLabely("Segunda".ToUpper(), qntServicos[0]);
                graficoArea.addLabely("Terca".ToUpper(), qntServicos[1]);
                graficoArea.addLabely("Quarta".ToUpper(), qntServicos[2]);
                graficoArea.addLabely("Quinta".ToUpper(), qntServicos[3]);
                graficoArea.addLabely("Sexta".ToUpper(), qntServicos[4]);
                graficoArea.addLabely("Sabado".ToUpper(), qntServicos[5]);
                graficoArea.addLabely("Domingo".ToUpper(), qntServicos[6]);

                bunifuDataViz1.colorSet.Add(Color.FromArgb(0, 168, 235));
                bunifuDataViz1.colorSet.Add(Color.White);

                canvas.addData(graficoArea);

                //graficoLinha.addLabely(vetNomeDiaSemana[0].ToUpper(), vetDiaSemana[0]);
                graficoLinha.addLabely("Segunda".ToUpper(), qntServicos[0]);
                graficoLinha.addLabely("Terca".ToUpper(), qntServicos[1]);
                graficoLinha.addLabely("Quarta".ToUpper(), qntServicos[2]);
                graficoLinha.addLabely("Quinta".ToUpper(), qntServicos[3]);
                graficoLinha.addLabely("Sexta".ToUpper(), qntServicos[4]);
                graficoLinha.addLabely("Sabado".ToUpper(), qntServicos[5]);
                graficoLinha.addLabely("Domingo".ToUpper(), qntServicos[6]);
                canvas.addData(graficoLinha);

                bunifuDataViz1.Render(canvas);
                //lblQntServicosSemanais.Text = qntServicos.ToString();
            }
        }
コード例 #2
0
        public void Preencher(BunifuDataViz bunifuDataViz2, int _mes, Label lblQntServicosMensais)
        {
            int contadorServicosMes = 0;

            try
            {
                DataPoint graficoArea, graficoLinha;
                graficoArea  = new DataPoint(BunifuDataViz._type.Bunifu_area);
                graficoLinha = new DataPoint(BunifuDataViz._type.Bunifu_line);
                var   canvas         = new Canvas();
                int[] vetServicosMes = new int[12] {
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                };
                //string[] vetNomeMes = new string[12] { "JAN", "FEV", "MAR", "ABR", "MAI", "JUN", "JUL", "AGO", "SET", "OUT", "NOV", "DEZ" };
                string[] vetNomeMes = new string[12] {
                    "JANEIRO", "FEVEREIRO", "MARÇO", "ABRIL", "MAIO", "JUNHO", "JULHO", "AGOSTO", "SETEMBRO", "OUTUBRO", "NOVEMBRO", "DEZEMBRO"
                };

                using (SqlConnection con = OpenConnection())
                {
                    SqlDataReader dr;
                    SqlCommand    cmd = new SqlCommand("SelecionarIdData_Servicos", con);

                    cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.Add("@Mes", SqlDbType.Int).Value = _mes;
                    dr = cmd.ExecuteReader();

                    dr.Read();
                    do
                    {
                        //contadorServicosMes++;
                        DateTime dateValue = dr.GetDateTime(1);
                        string   mesNumero = dateValue.ToString("MM", new CultureInfo("en-US"));

                        //Somente vai mostrar no grafico, dados do ano atual
                        if (dateValue.Year == DateTime.Now.Year)
                        {
                            contadorServicosMes++;
                            switch (mesNumero)
                            {
                            case "01":     // Janeiro
                                vetServicosMes[0] += +1;
                                break;

                            case "02":     // Fevereiro
                                vetServicosMes[1] += +1;
                                break;

                            case "03":     // Marco
                                vetServicosMes[2] += +1;
                                break;

                            case "04":     // Abril
                                vetServicosMes[3] += +1;
                                break;

                            case "05":     // Maio
                                vetServicosMes[4] += +1;
                                break;

                            case "06":     // Junho
                                vetServicosMes[5] += +1;
                                break;

                            case "07":     // Julho
                                vetServicosMes[6] += +1;
                                break;

                            case "08":     // Agosto
                                vetServicosMes[7] += +1;
                                break;

                            case "09":     // Setembro
                                vetServicosMes[8] += +1;
                                break;

                            case "10":     // Outubro
                                vetServicosMes[9] += +1;
                                break;

                            case "11":     // Novembro
                                vetServicosMes[10] += +1;
                                break;

                            case "12":     // Dezembro
                                vetServicosMes[11] += +1;
                                break;
                            }
                        }
                    } while (dr.Read());

                    for (int i = 0; i < 12; i++)
                    {
                        graficoArea.addLabely(vetNomeMes[i].ToUpper(), vetServicosMes[i]);
                    }


                    //bunifuDataViz2.colorSet.Add(Color.FromArgb(0, 168, 235));
                    bunifuDataViz2.colorSet.Add(Color.FromArgb(0, 168, 235));
                    bunifuDataViz2.colorSet.Add(Color.White);

                    canvas.addData(graficoArea);

                    for (int i = 0; i < 12; i++)
                    {
                        graficoLinha.addLabely(vetNomeMes[i].ToUpper(), vetServicosMes[i]);
                    }

                    canvas.addData(graficoLinha);

                    lblQntServicosMensais.Text = contadorServicosMes.ToString();
                    bunifuDataViz2.Render(canvas);
                    //bunifuDataViz2.Render(canvas);
                    dr.Close();
                    //con.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERRO: Nao foi possivel carregar graficos pois nao existem dados! \n\n\n" + ex, "Sem Dados!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        } //procedure
コード例 #3
0
        public void Preencher(BunifuDataViz bunifuDataViz1, int lblAno, GunaLabel lblJan, GunaLabel lblFev, GunaLabel lblMar,
                              GunaLabel lblAbr, GunaLabel lblMai, GunaLabel lblJun, GunaLabel lblJul, GunaLabel lblAgo, GunaLabel lblSet, GunaLabel lblOut,
                              GunaLabel lblNov, GunaLabel lblDez, int[] corRgb)
        {
            SqlDataReader dr;
            DataPoint     graficoArea;

            //graficoArea = new DataPoint(BunifuDataViz._type.Bunifu_splineArea);
            //graficoLinha = new DataPoint(BunifuDataViz._type.Bunifu_spline);
            graficoArea = new DataPoint(BunifuDataViz._type.Bunifu_stackedColumn);
            //graficoLinha = new DataPoint(BunifuDataViz._type.Bunifu_spline);
            var canvas = new Canvas();

            //int qntServicosAnuais = 0;
            int[] qntServicosPorMes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

            using (SqlConnection con = OpenConnection())
            {
                string procedure = "ServicosUltimoAno";

                SqlCommand cmd = new SqlCommand(procedure, con);
                cmd.Parameters.AddWithValue("@Ano", lblAno);
                cmd.CommandType = CommandType.StoredProcedure;

                dr = cmd.ExecuteReader();

                while (dr.Read())
                {
                    //MessageBox.Show(""+dr.GetInt32(0) + " --- "+ dr.GetDateTime(1), "");
                    switch (dr.GetString(2))
                    {
                    case "Janeiro":
                        qntServicosPorMes[0] += 1;
                        break;

                    case "Fevereiro":
                        qntServicosPorMes[1] += 1;
                        break;

                    case "Março":
                        qntServicosPorMes[2] += 1;
                        break;

                    case "Abril":
                        qntServicosPorMes[3] += 1;
                        break;

                    case "Maio":
                        qntServicosPorMes[4] += 1;
                        break;

                    case "Junho":
                        qntServicosPorMes[5] += 1;
                        break;

                    case "Julho":
                        qntServicosPorMes[6] += 1;
                        break;

                    case "Agosto":
                        qntServicosPorMes[7] += 1;
                        break;

                    case "Setembro":
                        qntServicosPorMes[8] += 1;
                        break;

                    case "Outubro":
                        qntServicosPorMes[9] += 1;
                        break;

                    case "Novembro":
                        qntServicosPorMes[10] += 1;
                        break;

                    case "Dezembro":
                        qntServicosPorMes[11] += 1;
                        break;
                    }
                }

                if (dr.HasRows)
                {
                    lblJan.Visible = true;
                    lblFev.Visible = true;
                    lblMar.Visible = true;
                    lblAbr.Visible = true;
                    lblMai.Visible = true;
                    lblJun.Visible = true;
                    lblJul.Visible = true;
                    lblAgo.Visible = true;
                    lblSet.Visible = true;
                    lblOut.Visible = true;
                    lblNov.Visible = true;
                    lblDez.Visible = true;
                    lblJan.Text    = qntServicosPorMes[0].ToString();
                    lblFev.Text    = qntServicosPorMes[1].ToString();
                    lblMar.Text    = qntServicosPorMes[2].ToString();
                    lblAbr.Text    = qntServicosPorMes[3].ToString();
                    lblMai.Text    = qntServicosPorMes[4].ToString();
                    lblJun.Text    = qntServicosPorMes[5].ToString();
                    lblJul.Text    = qntServicosPorMes[6].ToString();
                    lblAgo.Text    = qntServicosPorMes[7].ToString();
                    lblSet.Text    = qntServicosPorMes[8].ToString();
                    lblOut.Text    = qntServicosPorMes[9].ToString();
                    lblNov.Text    = qntServicosPorMes[10].ToString();
                    lblDez.Text    = qntServicosPorMes[11].ToString();
                }
                else
                {
                    lblJan.Visible = false;
                    lblFev.Visible = false;
                    lblMar.Visible = false;
                    lblAbr.Visible = false;
                    lblMai.Visible = false;
                    lblJun.Visible = false;
                    lblJul.Visible = false;
                    lblAgo.Visible = false;
                    lblSet.Visible = false;
                    lblOut.Visible = false;
                    lblNov.Visible = false;
                    lblDez.Visible = false;
                }

                //Se liga na desgraca que voce aqui pvt
                //to ligado que voce ta vendo isso em dubai
                //mas voce era macacao pra porra pqp.
                graficoArea.addLabely("JAN".ToUpper(), qntServicosPorMes[0]);
                graficoArea.addLabely("FEV".ToUpper(), qntServicosPorMes[1]);
                graficoArea.addLabely("MAR".ToUpper(), qntServicosPorMes[2]);
                graficoArea.addLabely("ABR".ToUpper(), qntServicosPorMes[3]);
                graficoArea.addLabely("MAI".ToUpper(), qntServicosPorMes[4]);
                graficoArea.addLabely("JUN".ToUpper(), qntServicosPorMes[5]);
                graficoArea.addLabely("JUL".ToUpper(), qntServicosPorMes[6]);
                graficoArea.addLabely("AGO".ToUpper(), qntServicosPorMes[7]);
                graficoArea.addLabely("SET".ToUpper(), qntServicosPorMes[8]);
                graficoArea.addLabely("OUT".ToUpper(), qntServicosPorMes[9]);
                graficoArea.addLabely("NOV".ToUpper(), qntServicosPorMes[10]);
                graficoArea.addLabely("DEZ".ToUpper(), qntServicosPorMes[11]);


                //bunifuDataViz1.colorSet.Add(Color.FromArgb(0, 168, 235));
                bunifuDataViz1.colorSet.Add(Color.FromArgb(corRgb[0], corRgb[1], corRgb[2]));
                bunifuDataViz1.colorSet.Add(Color.White);
                canvas.addData(graficoArea);

                //graficoLinha.addLabely(vetNomeDiaSemana[0].ToUpper(), vetDiaSemana[0]);
                //graficoLinha.addLabely("JAN".ToUpper(), qntServicosPorMes[0]);
                //graficoLinha.addLabely("FEV".ToUpper(), qntServicosPorMes[1]);
                //graficoLinha.addLabely("MAR".ToUpper(), qntServicosPorMes[2]);
                //graficoLinha.addLabely("ABR".ToUpper(), qntServicosPorMes[3]);
                //graficoLinha.addLabely("MAI".ToUpper(), qntServicosPorMes[4]);
                //graficoLinha.addLabely("JUN".ToUpper(), qntServicosPorMes[5]);
                //graficoLinha.addLabely("JUL".ToUpper(), qntServicosPorMes[6]);
                //graficoLinha.addLabely("AGO".ToUpper(), qntServicosPorMes[7]);
                //graficoLinha.addLabely("SET".ToUpper(), qntServicosPorMes[8]);
                //graficoLinha.addLabely("OUT".ToUpper(), qntServicosPorMes[9]);
                //graficoLinha.addLabely("NOV".ToUpper(), qntServicosPorMes[10]);
                //graficoLinha.addLabely("DEZ".ToUpper(), qntServicosPorMes[11]);
                //canvas.addData(graficoLinha);

                bunifuDataViz1.Render(canvas);

                //bunifuDataViz1.Update();
            }
        }