Ejemplo n.º 1
0
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                Graphic graph = new Graphic();
                graph.Show();

                GraphPane pane = graph.zedGraphControl1.GraphPane;
                pane.CurveList.Clear();
                pane.Title.Text = "Гистограмма бланка НДС";
                pane.YAxis.Title.Text = "Обсяги постачання";
                pane.XAxis.Title.Text = "Сума податку на  додану вартість";
                Random rnd = new Random(100);

                double[] data = new double[] { Convert.ToInt32(textBox135.Text), Convert.ToInt32(textBox122.Text)};
                double[] data1 = new double[] { Convert.ToInt32(textBox175.Text), Convert.ToInt32(textBox158.Text) };
                double[] data2 = new double[] { Convert.ToInt32(textBox175.Text), Convert.ToInt32(textBox158.Text) };

                double[] xvalues = new double[data.Length];
                double[] xvalues1 = new double[data1.Length];
                double[] xvalues2 = new double[data2.Length];
                double[] yvalues = new double[data.Length];
                double[] yvalues1 = new double[data1.Length];
                double[] yvalues2 = new double[data2.Length];

                for (int i = 0; i < data.Length; i++)
                {
                    // Значения по оси X
                    xvalues[i] = data[i];
                    // Высота столбиков
                    yvalues[i] = rnd.NextDouble();
                }
                for (int j = 0; j < data1.Length; j++)
                {
                    xvalues1[j] = data1[j];
                    yvalues1[j] = rnd.NextDouble();
                }
                for (int j = 0; j < data1.Length; j++)
                {
                    xvalues2[j] = data2[j];
                    yvalues2[j] = rnd.NextDouble();
                }
                BarItem curve = pane.AddBar("", xvalues, yvalues, Color.Blue);
                BarItem curve1 = pane.AddBar("", xvalues1, yvalues1, Color.Red);
                BarItem curve2 = pane.AddBar("", xvalues2, yvalues2, Color.Green);

                pane.BarSettings.MinClusterGap = 0.0f;

                graph.zedGraphControl1.AxisChange();
                graph.zedGraphControl1.Invalidate();
            }

            catch
            {
                MessageBox.Show(@"Возможно заполнены не все поля", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                Graphic graph = new Graphic();
                graph.Show();

                GraphPane pane = graph.zedGraphControl1.GraphPane;
                pane.CurveList.Clear();
                pane.Title.Text = "Гистограмма бланка баланса";
                pane.YAxis.Title.Text = "За звітній період";
                pane.XAxis.Title.Text = "За аналогіч.  період попереднього року";
                Random rnd = new Random(100);

                double[] data = new double[] { Convert.ToInt32(textBox101.Text), Convert.ToInt32(textBox96.Text), Convert.ToInt32(textBox83.Text), Convert.ToInt32(textBox82.Text) };
                double[] data1 = new double[] { Convert.ToInt32(textBox78.Text), Convert.ToInt32(textBox73.Text), Convert.ToInt32(textBox60.Text), Convert.ToInt32(textBox59.Text) };

                double[] xvalues = new double[data.Length];
                double[] xvalues1 = new double[data1.Length];
                double[] yvalues = new double[data.Length];
                double[] yvalues1 = new double[data1.Length];

                for (int i = 0; i < data.Length; i++)
                {
                    // Значения по оси X
                    xvalues[i] = data[i];
                    // Высота столбиков
                    yvalues[i] = rnd.NextDouble();
                }
                for (int j = 0; j < data1.Length; j++)
                {
                    xvalues1[j] = data1[j];
                    yvalues1[j] = rnd.NextDouble();
                }

                BarItem curve = pane.AddBar("", xvalues, yvalues, Color.Red);
                BarItem curve1 = pane.AddBar("", xvalues1, yvalues1, Color.Green);

                //pane.BarSettings.MinClusterGap = 0.0f;

                graph.zedGraphControl1.AxisChange();
                graph.zedGraphControl1.Invalidate();
            }

            catch
            {
                MessageBox.Show(@"Возможно заполнены не все поля", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }