public void CreateChart(ZedGraphControl zgc)
 {
     EventHandler method = null;
     this._myMainPane.Title.Text = this._reportTitle;
     this._myMainPane.XAxis.Title.Text = "TOW";
     this._myMainPane.YAxis.Title.Text = "Data";
     this._myMainPane.XAxis.IsVisible = true;
     this._myMainPane.XAxis.Type = AxisType.Linear;
     this._myMainPane.YAxis.MajorGrid.IsVisible = true;
     this._myMainPane.YAxis.MinorGrid.IsVisible = true;
     this._myMainPane.CurveList.Clear();
     this._myMainPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45f);
     if ((this._myMainXaxisData != null) && (this._myMainXaxisData.Length > 0))
     {
         this._myMainPane.AddCurve(this._curveLabel, this._myMainXaxisData, this._myMainYaxisData, this._curveColor, SymbolType.Diamond);
         this._myMainPane.AxisChange();
         if (method == null)
         {
             method = delegate {
                 zgc.Update();
                 zgc.Refresh();
             };
         }
         base.Invoke(method);
     }
     zgc.Size = new Size(base.ClientRectangle.Width - 0x19, base.ClientRectangle.Height - 40);
 }
Exemple #2
0
 public void CreateChart(ZedGraphControl zgc)
 {
     EventHandler method = null;
     this._myMainPane.YAxis.MajorGrid.IsVisible = true;
     this._myMainPane.YAxis.MinorGrid.IsVisible = true;
     this._myMainPane.CurveList.Clear();
     this._myMainPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45f);
     this._myMainPane.Title.Text = this._reportTitle;
     this._myMainPane.XAxis.Title.Text = "Data";
     this._myMainPane.YAxis.Title.Text = "Probability";
     this._myMainPane.YAxis.Scale.MaxAuto = false;
     this._myMainPane.YAxis.Scale.MinAuto = false;
     this._myMainPane.YAxis.Scale.Max = 1.0;
     this._myMainPane.YAxis.Scale.Min = 0.0;
     if ((this._myMainXaxisData != null) && (this._myMainXaxisData.Length > 0))
     {
         Stats stats = new Stats();
         double[] y = new double[this._myMainXaxisData.Length];
         for (int i = 0; i < this._myMainXaxisData.Length; i++)
         {
             y[i] = (i + 1) * (1.0 / ((double) this._myMainXaxisData.Length));
         }
         stats.SortArray(this._myMainXaxisData.Length, this._myMainXaxisData);
         this._myMainPane.AddCurve(this._curveLabel, this._myMainXaxisData, y, this._curveColor, SymbolType.Diamond);
         this._myMainPane.AxisChange();
         if (method == null)
         {
             method = delegate {
                 zgc.Update();
                 zgc.Refresh();
             };
         }
         base.Invoke(method);
     }
     zgc.Size = new Size(base.ClientRectangle.Width - 0x19, base.ClientRectangle.Height - 0x2d);
 }
        // Call this method from the Form_Load method, passing your ZedGraphControl
        public void CreateChart(ZedGraphControl zgc)
        {
            GraphPane myPane = new GraphPane();
            zgc.GraphPane = myPane;
            zgc.IsShowPointValues = true;

            // Set the titles and axis labels
            myPane.Title.Text = "Data for: " + cbVideo.SelectedItem.ToString();
            myPane.XAxis.Title.Text = "Time, Ticks (hover mouse over a point for date/time)";

            // Hide the legend
            // myPane.Legend.IsVisible = false;

            // Add a curve
            LineItem curve = myPane.AddCurve("Average Rating", ARdata, Color.Red, SymbolType.Circle);
            curve.Line.Width = 2.0F;
            curve.Line.IsAntiAlias = true;
            curve.Symbol.Fill = new Fill(Color.Blue);
            curve.Symbol.Size = 7;
            curve.IsY2Axis = true;

            // Add a curve
            curve = myPane.AddCurve("Average New Rating", ANRdata, Color.Green, SymbolType.Circle);
            curve.Line.Width = 2.0F;
            curve.Line.IsAntiAlias = true;
            curve.Symbol.Fill = new Fill(Color.Blue);
            curve.Symbol.Size = 7;
            curve.IsY2Axis = true;

            // Add a curve
            curve = myPane.AddCurve("Raters", Rdata, Color.Blue, SymbolType.Triangle);
            curve.Line.Width = 2.0F;
            curve.Line.IsAntiAlias = true;
            curve.Symbol.Fill = new Fill(Color.Red);
            curve.Symbol.Size = 7;
            // Add a curve
            curve = myPane.AddCurve("Views", Vdata, Color.Yellow, SymbolType.Triangle);
            curve.Line.Width = 2.0F;
            curve.Line.IsAntiAlias = true;
            curve.Symbol.Fill = new Fill(Color.Red);
            curve.Symbol.Size = 7;
            // Add a curve
            curve = myPane.AddCurve("Comments", Cdata, Color.Magenta, SymbolType.Triangle);
            curve.Line.Width = 2.0F;
            curve.Line.IsAntiAlias = true;
            curve.Symbol.Fill = new Fill(Color.Red);
            curve.Symbol.Size = 7;
            // Add a curve
            curve = myPane.AddCurve("Favorites", Fdata, Color.Black, SymbolType.Triangle);
            curve.Line.Width = 2.0F;
            curve.Line.IsAntiAlias = true;
            curve.Symbol.Fill = new Fill(Color.Red);
            curve.Symbol.Size = 7;

            // Fill the axis background with a gradient
            myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, Color.ForestGreen), 45.0F);

            // Make the Y axis scale red
            myPane.YAxis.Scale.FontSpec.FontColor = Color.Red;
            myPane.YAxis.Title.FontSpec.FontColor = Color.Red;
            myPane.YAxis.Title.Text = "Numbers (Views, Comments, Raters, Favs)";
            // turn off the opposite tics so the Y tics don't show up on the Y2 axis
            myPane.YAxis.MajorTic.IsOpposite = false;
            myPane.YAxis.MinorTic.IsOpposite = false;
            // Don't display the Y zero line
            myPane.YAxis.MajorGrid.IsZeroLine = false;
            // Align the Y axis labels so they are flush to the axis
            myPane.YAxis.Scale.Align = AlignP.Inside;

            // Enable the Y2 axis display
            myPane.Y2Axis.IsVisible = true;
            // Make the Y2 axis scale blue
            myPane.Y2Axis.Scale.FontSpec.FontColor = Color.Blue;
            myPane.Y2Axis.Title.FontSpec.FontColor = Color.Blue;
            myPane.Y2Axis.Title.Text = "Rating [1-5] (Avg, ANR)";
            // turn off the opposite tics so the Y2 tics don't show up on the Y axis
            myPane.Y2Axis.MajorTic.IsOpposite = false;
            myPane.Y2Axis.MinorTic.IsOpposite = false;
            // Display the Y2 axis grid lines
            myPane.Y2Axis.MajorGrid.IsVisible = true;
            // Align the Y2 axis labels so they are flush to the axis
            myPane.Y2Axis.Scale.Align = AlignP.Inside;
            myPane.Y2Axis.Scale.Min = 1;
            myPane.Y2Axis.Scale.Max = 5;

            // Calculate the Axis Scale Ranges
            zgc.AxisChange();
            zgc.Refresh();
            zgc.Update();
            this.Width = this.Width + 1;
            this.Width = this.Width - 1;
        }