Esempio n. 1
0
        /// <summary>
        /// Prepares the population complexity graph for use
        /// </summary>
        private void InitializePopComplexityGraph()
        {
            ZedGraph.GraphPane pane = new ZedGraph.GraphPane(
                new Rectangle(0, 0, graphPopulationComplexity.Width, graphPopulationComplexity.Height),
                "Population Complexity",
                "Generation",
                "Complexity (Node Count)");

            graphPopulationComplexity.GraphPane            = pane;
            graphPopulationComplexity.GraphPane.Fill       = graphFitness.GraphPane.Fill;
            graphPopulationComplexity.GraphPane.Chart.Fill = graphFitness.GraphPane.Chart.Fill;

            m_ptListComplexityMin    = new ZedGraph.PointPairList();
            m_ptListComplexityMax    = new ZedGraph.PointPairList();
            m_ptListComplexityAve    = new ZedGraph.PointPairList();
            m_ptListComplexityBestOf = new ZedGraph.PointPairList();
            ZedGraph.CurveItem CurveMin  = graphPopulationComplexity.GraphPane.AddCurve("Min", m_ptListComplexityMin, Color.Red);
            ZedGraph.CurveItem CurveMax  = graphPopulationComplexity.GraphPane.AddCurve("Max", m_ptListComplexityMax, Color.Green);
            ZedGraph.CurveItem CurveAve  = graphPopulationComplexity.GraphPane.AddCurve("Ave", m_ptListComplexityAve, Color.Blue);
            ZedGraph.CurveItem CurveBest = graphPopulationComplexity.GraphPane.AddCurve("Best Of", m_ptListComplexityBestOf, Color.Black);

            ((ZedGraph.LineItem)CurveMin).Symbol.Size  = 4;
            ((ZedGraph.LineItem)CurveMax).Symbol.Size  = 4;
            ((ZedGraph.LineItem)CurveAve).Symbol.Size  = 4;
            ((ZedGraph.LineItem)CurveBest).Symbol.Size = 4;
        }
        /// <summary>
        /// Draws the graph to the form
        /// </summary>
        /// <param name="o"></param>
        /// <param name="e"></param>
        public void PaintGraph(object o, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            // Create a new graph with topLeft at (40,40) and size 600x400
            myPane = new ZedGraph.GraphPane(new Rectangle(this.Location.X, this.Location.Y + 210, 450, 325),
                                            "Allele Frequency\n",
                                            "Generations",
                                            "Frequency of A");

            myPane.XAxis.Max = 100;            //this.generation.Value;
            myPane.XAxis.Min = 0;

            myPane.YAxis.Max = 1;
            myPane.YAxis.Min = 0;

            ZedGraph.LineItem myCurve = myPane.AddCurve("1",
                                                        list1, Color.Red, ZedGraph.SymbolType.None);

            ZedGraph.LineItem myCurve2 = myPane.AddCurve("2",
                                                         list2, Color.Blue, ZedGraph.SymbolType.None);

            ZedGraph.LineItem myCurve3 = myPane.AddCurve("3",
                                                         list3, Color.LimeGreen, ZedGraph.SymbolType.None);

            ZedGraph.LineItem myCurve4 = myPane.AddCurve("4",
                                                         list4, Color.Black, ZedGraph.SymbolType.None);

            myPane.AxisChange(this.CreateGraphics());

            myPane.Draw(e.Graphics);
        }
Esempio n. 3
0
        /// <summary>
        /// Prepares the population fitness graph for use
        /// </summary>
        private void InitializePopFitnessGraph()
        {
            ZedGraph.GraphPane pane = new ZedGraph.GraphPane(
                new Rectangle(0, 0, graphPopulationFitness.Width, graphPopulationFitness.Height),
                "Population Fitness",
                "Generation",
                graphFitness.GraphPane.YAxis.Title.Text);

            graphPopulationFitness.GraphPane            = pane;
            graphPopulationFitness.GraphPane.Fill       = graphFitness.GraphPane.Fill;
            graphPopulationFitness.GraphPane.Chart.Fill = graphFitness.GraphPane.Chart.Fill;

            //
            // Prepare the plotting curves
            m_ptListPopFitnessMin = new ZedGraph.PointPairList();
            m_ptListPopFitnessMax = new ZedGraph.PointPairList();
            m_ptListPopFitnessAve = new ZedGraph.PointPairList();
            ZedGraph.CurveItem CurveMin = graphPopulationFitness.GraphPane.AddCurve("Min", m_ptListPopFitnessMin, Color.Red);
            ZedGraph.CurveItem CurveMax = graphPopulationFitness.GraphPane.AddCurve("Max", m_ptListPopFitnessMax, Color.Green);
            ZedGraph.CurveItem CurveAve = graphPopulationFitness.GraphPane.AddCurve("Ave", m_ptListPopFitnessAve, Color.Blue);

            ((ZedGraph.LineItem)CurveMin).Symbol.Size = 4;
            ((ZedGraph.LineItem)CurveMax).Symbol.Size = 4;
            ((ZedGraph.LineItem)CurveAve).Symbol.Size = 4;
        }
Esempio n. 4
0
        /* triple wave building codesnippet
         *
         * int length = (int)(SampleRate * BlockAlign * duration);
         * byte[] buffer = new byte[length];
         *
         * double A = frequency * 2 * Math.PI / (double)SampleRate;
         * for (int i = 0; i < length; i++)
         * {
         *  if (i > 1) buffer[i] = (byte)(2 * Math.Cos(A) * buffer[i - 1] - buffer[i - 2]);
         *  else if (i > 0) buffer[i] = (byte)(2 * Math.Cos(A) * buffer[i - 1] - (Math.Cos(A)));
         *  else buffer[i] = (byte)(2 * Math.Cos(A) * Math.Cos(A) - Math.Cos(2 * A));
         * }
         *
         * public double CalculateGoertzel(byte[] sample, double frequency, int samplerate)
         * {
         * double Skn, Skn1, Skn2;
         * Skn = Skn1 = Skn2 = 0;
         * for (int i = 0; i < sample.Length; i++)
         * {
         *  Skn2 = Skn1;
         *  Skn1 = Skn;
         *  Skn = 2 * Math.Cos(2 * Math.PI * frequency / samplerate) * Skn1 - Skn2 + sample[i];
         * }
         *
         * double WNk = Math.Exp(-2 * Math.PI * frequency / samplerate);
         *
         * return 20 * Math.Log10(Math.Abs((Skn - WNk * Skn1)));
         * }
         *
         * public int TestGoertzel(int frequency, byte[] sample, int samplerate)
         * {
         * int stepsize = frequency / 5;
         * Dictionary<int, double> res = new Dictionary<int, double>();
         * for (int i = 0; i < 10; i++)
         * {
         *  int freq = stepsize * i;
         *  res.Add(freq, CalculateGoertzel(sample, freq, samplerate));
         * }
         * }
         */
        private void BuildDiagram(ZedGraph.ZedGraphControl zg, byte[] _data)
        {
            ZedGraph.GraphPane myPane = zg.GraphPane;
            ZedGraph.LineItem  curve  = null;

            if (myPane.CurveList.Count >= 1)
            {
                curve = myPane.CurveList[0] as ZedGraph.LineItem;
                curve.Clear();
            }
            else
            {
                curve = new ZedGraph.LineItem("SPS");
            }

            // Make sure that the curvelist has at least one curve
            for (int i = 0; i < _data.Length; i++)
            {
                curve.AddPoint(i, _data[i]);
            }

            ZedGraph.IPointList list = curve.Points as ZedGraph.IPointList;

            if (myPane.CurveList.Count == 0)
            {
                myPane.AddCurve("Wave", list, Color.DimGray, ZedGraph.SymbolType.None);
            }

            zg.AxisChange();
            zg.Invalidate();
        }
Esempio n. 5
0
        void Draw(ref ZedGraph.PointPairList f_list, double xmax = 1.0)  // построение графиков
        {
            if (countCurves == 15)
            {
                graph.GraphPane.CurveList.Clear();
                countCurves = 0;
            }

            string name;

            if (countCurves % 2 == 0)
            {
                name = "exact" + (countCurves / 2).ToString();
            }
            else
            {
                name = "num" + (countCurves / 2).ToString();
            }

            ZedGraph.GraphPane panel = graph.GraphPane;
            ZedGraph.LineItem  Curve = panel.AddCurve(name, f_list, colors[countCurves], ZedGraph.SymbolType.None);
            if (countCurves == 0)
            {
                panel.XAxis.Min = -0.1;
                panel.XAxis.Max = xmax + 0.1;
                panel.YAxis.Min = -1;
            }
            countCurves++;
            graph.AxisChange();
            graph.Invalidate();
        }
Esempio n. 6
0
        private void график3ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ZedGraph.GraphPane     graphPane  = zedGraphControl1.GraphPane;
            ZedGraph.PointPairList pointPairs = new ZedGraph.PointPairList();

            graphPane.CurveList.Clear();
            graphPane.Title.Text = "График 3";

            for (double x = 0; x <= 1; x += 0.01)
            {
                if (x >= 0 && x < 0.07)
                {
                    pointPairs.Add(x, 0.95);
                }
                else if (x >= 0.07 && x < 0.13)
                {
                    pointPairs.Add(x, -30 * Math.Pow(x - 0.068, 2) + 0.95);
                }
                else if (x >= 0.13 && x <= 1)
                {
                    pointPairs.Add(x, 2 / (100 * x - 10) + 0.05);
                }
                else
                {
                    MessageBox.Show($"Missing {x}");
                }
            }

            ZedGraph.LineItem lineItemResult = graphPane.AddCurve("График 3", pointPairs, Color.Red, ZedGraph.SymbolType.None);


            zedGraphControl1.AxisChange();
            zedGraphControl1.Invalidate();
        }
Esempio n. 7
0
        /// <summary>
        /// Prepare the graph to accept the plotted data
        /// </summary>
        /// <param name="gpData"></param>
        private void InitialzeDataGraph(GPModelingData gpData)
        {
            ZedGraph.GraphPane pane = new ZedGraph.GraphPane(
                new Rectangle(0, 0, graphData.Width, graphData.Height),
                "Modeling Data",
                cbXAxis.Items[cbXAxis.SelectedIndex].ToString(),
                gpData.Header[m_gpData.Header.Length - 1]);

            pane.Fill       = new ZedGraph.Fill(Color.AliceBlue, Color.WhiteSmoke, 0F);
            pane.Chart.Fill = new ZedGraph.Fill(Color.Silver, Color.White, 45.0f);


            //
            // IF this is a time series, the x-axis is NOT whatever the combo box is
            // it is just a count
            if (gpData.TimeSeries)
            {
                pane.XAxis.Title.Text = "Count";
            }

            //
            // No need for a legend here
            pane.Legend.IsVisible = false;

            //
            // If we are in Bar plot mode, set up accordingly
            if (rdChartTypeBar.Checked)
            {
                //
                // Use a value or count bar axis
                string[] XLabels = new string[gpData.Rows];
                if (chkCount.Checked)
                {
                    //
                    // Build a set of lables using a row count
                    for (int nRow = 0; nRow < gpData.Rows; nRow++)
                    {
                        XLabels[nRow] = ((int)(nRow + 1)).ToString();
                    }
                    pane.XAxis.Title.Text = "Count";
                }
                else
                {
                    //
                    // Build a set of labels from the common X-Axis
                    for (int nRow = 0; nRow < gpData.Rows; nRow++)
                    {
                        XLabels[nRow] = gpData[nRow, 0].ToString();
                    }
                }

                pane.XAxis.Type                     = ZedGraph.AxisType.Text;
                pane.XAxis.Scale.TextLabels         = XLabels;
                pane.XAxis.MajorTic.IsBetweenLabels = true;
            }

            graphData.GraphPane = pane;
        }
 void Draw(ref ZedGraph.PointPairList f_list, string name, Color clr, double xmax = 1.0)  // построение графиков
 {
     ZedGraph.GraphPane panel = zedGraph.GraphPane;
     ZedGraph.LineItem  Curve = panel.AddCurve(name, f_list, clr, ZedGraph.SymbolType.None);
     panel.XAxis.Min = -0.1;
     panel.XAxis.Max = xmax + 0.1;
     panel.YAxis.Min = -1;
     zedGraph.AxisChange();
     zedGraph.Invalidate();
 }
Esempio n. 9
0
 string XAxis_ScaleFormatEvent(ZedGraph.GraphPane pane, ZedGraph.Axis axis, double val, int index)
 {
     try {
         int num = Convert.ToInt32(val);
         return(EPADB.GetDate(num).ToString());
     }
     catch {
         return("");
     }
 }
Esempio n. 10
0
        private void zedGraphControl1_Resize(object sender, EventArgs e)
        {
            ZedGraph.GraphPane pane = zedGraphControl1.GraphPane;
            int bins = (int)pane.CalcChartRect(zedGraphControl1.CreateGraphics()).Width;

            foreach (ZedGraph.CurveItem curve in pane.CurveList)
            {
                (curve.Points as SeemsPointList).SetScale(bins, pane.XAxis.Scale.Min, pane.XAxis.Scale.Max);
            }
            SetDataLabelsVisible(true);
        }
Esempio n. 11
0
        void updateGraph(Item useritem)
        {
            var sitems = mvv.Glassmodels.Where(o => o.Name.ToLower().StartsWith(useritem.Name.ToLower()));

            sitems.ForEach(o =>
            {
                o.MBE = (useritem.Ottv - o.Ottv) / useritem.Ottv;
            });

            mvv.ImgSource = null;

            var ch = new ZedGraph.GraphPane(); // zedGraphControl1.GraphPane;

            ch.Title.Text       = $"OTTV Analysis";
            ch.XAxis.Title.Text = "Glass Types Proposal";
            ch.YAxis.Title.Text = "MBE impact";

            ch.Y2Axis.IsVisible = false;
            ch.X2Axis.IsVisible = false;

            ch.XAxis.Scale.MinAuto       = false;
            ch.XAxis.Scale.Max           = sitems.Count() + 1;
            ch.XAxis.Scale.MajorStepAuto = false;
            ch.XAxis.Scale.MajorStep     = 1;
            ch.XAxis.Scale.Min           = 0;
            ch.XAxis.Scale.MinorStepAuto = false;
            ch.XAxis.Scale.MinorStep     = 0.1;
            ch.XAxis.MinorTic.Size       = 0;
            ch.XAxis.MajorTic.Size       = 0;

            ch.YAxis.Scale.Format        = "00.00";
            ch.YAxis.MinorTic.Size       = 0;
            ch.YAxis.MajorGrid.Color     = System.Drawing.Color.DimGray;
            ch.YAxis.MajorGrid.PenWidth  = 1;
            ch.YAxis.MajorGrid.DashOn    = 6;
            ch.YAxis.MajorGrid.IsVisible = true;

            var bar = ch.AddCurve("MBE Value", null, sitems.Select(o => o.MBE).Cast <double>().ToArray(), System.Drawing.Color.DarkBlue);

            //bar.c.Fill.Type = ZedGraph.FillType.Solid;
            bar.Line.Width    = 5f;
            bar.Line.IsSmooth = false;

            ch.XAxis.Scale.TextLabels = sitems.Select(o => o.Name).ToArray();
            ch.XAxis.Type             = ZedGraph.AxisType.Text;

            ch.XAxis.Scale.FontSpec.Angle = 90;

            ch.AxisChange();

            mvv.ImgSource = Utility.IO.ImageIO.ConvertFromImage(ch.GetImage((int)Width, (int)Height, 150, true));
        }
Esempio n. 12
0
        public void SetRanColor()
        {
            ZedGraph.GraphPane pane = zedGraphControl1.GraphPane;
            int Red   = 0;
            int Green = 0;
            int Blue  = 0;

            for (int i = 0; i < pane.CurveList.Count; i++)
            {
                pane.CurveList[i].Color = Color.FromArgb(Red, Green, Blue);
                ChangeColor(ref Red, ref Green, ref Blue);
            }
        }
Esempio n. 13
0
        private void testToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ZedGraph.GraphPane     graphPane1 = zedGraphControl1.GraphPane;
            ZedGraph.PointPairList pointPairs = new ZedGraph.PointPairList();

            pointPairs.Add(0.5, 0);
            pointPairs.Add(0.5, Function1(0.5));
            pointPairs.Add(0, Function1(0.5));

            ZedGraph.LineItem lineItemResult1 = graphPane1.AddCurve("Альтернатива 1", pointPairs, Color.Blue, ZedGraph.SymbolType.None);

            zedGraphControl1.Invalidate();
        }
Esempio n. 14
0
        private void zedGraphControl1_ZoomEvent(ZedGraph.ZedGraphControl sender, ZedGraph.ZoomState oldState, ZedGraph.ZoomState newState)
        {
            ZedGraph.GraphPane pane = zedGraphControl1.GraphPane;
            int bins = (int)pane.CalcChartRect(zedGraphControl1.CreateGraphics()).Width;

            foreach (ZedGraph.CurveItem curve in pane.CurveList)
            {
                (curve.Points as SeemsPointList).SetScale(bins, pane.XAxis.Scale.Min, pane.XAxis.Scale.Max);
            }
            pane.AxisChange();
            SetDataLabelsVisible(true);
            Refresh();
        }
Esempio n. 15
0
 private static void AddlabelToBars(ZedGraph.GraphPane myPn, double[] X, double[] Y)
 {
     for (int i = 0; i < Y.Length; i++)
     {
         ZedGraph.TextObj item = new ZedGraph.TextObj(Y[i].ToString("F1"), (double)((float)X[i]), (double)(((Y[i] < 0.0) ? ((float)0.0) : ((float)Y[i])) + 1f));
         item.Location.CoordinateFrame  = ZedGraph.CoordType.AxisXYScale;
         item.Location.AlignH           = ZedGraph.AlignH.Left;
         item.Location.AlignV           = ZedGraph.AlignV.Center;
         item.FontSpec.Border.IsVisible = false;
         item.FontSpec.Fill.IsVisible   = false;
         item.FontSpec.Angle            = 90f;
         myPn.GraphObjList.Add(item);
     }
 }
Esempio n. 16
0
        private void BuildSubPerVerGraph()
        {
            ZedGraph.ZedGraphControl zg1 = new ZedGraph.ZedGraphControl();
            zg1.Dock              = DockStyle.Fill;
            zg1.IsEnableZoom      = false;
            zg1.IsShowPointValues = false;

            ZedGraph.GraphPane pane = zg1.GraphPane;

            pane.Fill       = new ZedGraph.Fill(Color.Azure, Color.FromArgb(230, 220, 250), 90);
            pane.Chart.Fill = new ZedGraph.Fill(Color.FromArgb(225, 220, 245), Color.LightCyan, -90);

            pane.Title.Text               = "Submission per Verdict";
            pane.Title.FontSpec.Size      = 18;
            pane.Title.FontSpec.FontColor = Color.Maroon;
            pane.Title.FontSpec.Family    = "Segoe UI Semibold";
            pane.Title.FontSpec.IsBold    = false;

            pane.Legend.IsVisible = false;

            double[] yval   = new double[] { _acCount, _waCount, _tleCount, _reCount, _peCount, _ceCount, _oleCount, _subeCount, _mleCount };
            string[] labels = new string[] { "AC", "WA", "TLE", "RE", "PE", "CE", "OLE", "SUBE", "MLE" };
            for (int i = 0; i < yval.Length; ++i)
            {
                labels[i] += string.Format("\n({0})", yval[i].ToString());
            }

            pane.XAxis.Title.Text               = "Verdicts";
            pane.XAxis.Title.FontSpec.Family    = "Courier New";
            pane.XAxis.Title.FontSpec.FontColor = Color.Maroon;
            pane.XAxis.Title.FontSpec.IsBold    = false;
            pane.XAxis.Scale.TextLabels         = labels;
            pane.XAxis.Type = ZedGraph.AxisType.Text;

            pane.YAxis.Title.Text               = "Submissions";
            pane.YAxis.Title.FontSpec.Family    = "Courier New";
            pane.YAxis.Title.FontSpec.FontColor = Color.Navy;
            pane.YAxis.Title.FontSpec.IsBold    = false;

            // Generate a bar chart
            ZedGraph.BarItem bar = pane.AddBar("Verdicts", null, yval, Color.DarkTurquoise);
            bar.Label.IsVisible = true;

            pane.AxisChange();

            this.subPerVerTab.Controls.Clear();
            this.subPerVerTab.Controls.Add(zg1);
        }
Esempio n. 17
0
        public MainForm()
        {
            InitializeComponent();

            pane = zedGraphControl1.GraphPane;

            pane.Title.Text = "Kaggle (RMSE)";
            pane.XAxis.Title.Text = "Iterations";
            pane.YAxis.Title.Text = "RMSE";

            zedTrain = new ZedGraph.PointPairList();
            zedTest = new ZedGraph.PointPairList();

            pane.AddCurve("train", zedTrain, Color.Green);
            pane.AddCurve("test", zedTest, Color.Red);
        }
Esempio n. 18
0
        public MainForm()
        {
            InitializeComponent();

            pane = zedGraphControl1.GraphPane;

            pane.Title.Text       = "Kaggle (RMSE)";
            pane.XAxis.Title.Text = "Iterations";
            pane.YAxis.Title.Text = "RMSE";

            zedTrain = new ZedGraph.PointPairList();
            zedTest  = new ZedGraph.PointPairList();

            pane.AddCurve("train", zedTrain, Color.Green);
            pane.AddCurve("test", zedTest, Color.Red);
        }
Esempio n. 19
0
        private void SaveFromConsoleApplication()
        {
            // simulate plotting from a console application
            var pane   = new ZedGraph.GraphPane();
            var curve1 = pane.AddCurve(
                label: "demo",
                x: new double[] { 1, 2, 3, 4, 5 },
                y: new double[] { 1, 4, 9, 16, 25 },
                color: Color.Blue);

            curve1.Line.IsAntiAlias = true;
            pane.AxisChange();
            Bitmap bmp = pane.GetImage(400, 300, dpi: 100, isAntiAlias: true);

            bmp.Save("zedgraph-console-quickstart.png", ImageFormat.Png);
        }
Esempio n. 20
0
        /// <summary>
        /// Prepares the fitness graph for use
        /// </summary>
        private void InitializeFitnessGraph()
        {
            //
            // Decide on a title
            String Y1Title = "Fitness";

            //
            // The try-catch block is to handle the initialization case with no modeling
            // profile yet defined.
            if (m_ModelProfile != null)
            {
                Y1Title = "Fitness Error : " + GPDatabaseUtils.FieldValue(m_ModelProfile.FitnessFunctionID, "tblFitnessFunction", "Name");
            }

            ZedGraph.GraphPane pane = new ZedGraph.GraphPane(
                new Rectangle(0, 0, graphFitness.Width, graphFitness.Height),
                "Best Program Fitness",
                "Generation",
                Y1Title);

            graphFitness.GraphPane = pane;

            //
            // Need a second Y-Axis for the hit counts
            graphFitness.GraphPane.AddY2Axis("# Hits");
            graphFitness.GraphPane.Y2Axis.Title.Text = "# Hits";
            graphFitness.GraphPane.Y2Axis.IsVisible  = true;

            graphFitness.GraphPane.YAxis.Title.FontSpec.FontColor  = Color.Blue;
            graphFitness.GraphPane.YAxis.Scale.FontSpec.FontColor  = Color.Blue;
            graphFitness.GraphPane.Y2Axis.Title.FontSpec.FontColor = Color.Maroon;
            graphFitness.GraphPane.Y2Axis.Scale.FontSpec.FontColor = Color.Maroon;

            graphFitness.GraphPane.Fill       = new ZedGraph.Fill(Color.AliceBlue, Color.WhiteSmoke, 0F);
            graphFitness.GraphPane.Chart.Fill = new ZedGraph.Fill(Color.Silver, Color.White, 45.0f);

            //
            // Prepare the plotting curve
            m_ptListFitness = new ZedGraph.PointPairList();
            m_ptListHits    = new ZedGraph.PointPairList();
            ZedGraph.CurveItem CurveFitness = graphFitness.GraphPane.AddCurve("Fitness", m_ptListFitness, Color.Blue);
            ZedGraph.CurveItem CurveHits    = graphFitness.GraphPane.AddCurve("Hits", m_ptListHits, Color.Maroon);
            CurveHits.IsY2Axis = true;

            ((ZedGraph.LineItem)CurveFitness).Symbol.Size = 4;
            ((ZedGraph.LineItem)CurveHits).Symbol.Size    = 4;
        }
Esempio n. 21
0
        private void button1_Click(object sender, EventArgs e)
        {
            double x0 = Double.Parse(textBox1.Text);//Начальное значение x
            double y0 = Double.Parse(textBox2.Text);//конечное значение x
            int n = Int32.Parse(textBox3.Text);//количество шагов
            //double _h = Double.Parse(textBox4.Text);

            double k1, k2, k3, k4, l1, l2, l3, l4, _h = 0.02, y1, y2, x1, x2;

            zedGraphControl1.MasterPane.PaneList.Clear();
            ZedGraph.GraphPane pane = new ZedGraph.GraphPane();
            pane.CurveList.Clear();
            ZedGraph.PointPairList list = new ZedGraph.PointPairList();

            do
            {
                y0 = y0 + _h;

                k1 = _h * fvx(y0, x0);
                l1 = _h * fvy(y0, x0);
                k2 = _h * fvx(y0 + l1 / 2, x0 + k1 / 2);
                l2 = _h * fvy(y0 + l1 / 2, x0 + k1 / 2);

                x1 = x0 + (k1 + k2) / 2;
                y1 = y0 + (l1 + l2) / 2;
                x0 = x1; y0 = y1;

                listBox1.Items.Add(x1);
                listBox1.Items.Add(y1);
                list.Add(x1, y1);
                //i++;
                //printf("\n %lf", x1);
                //printf("\n %lf", y1);
            }

            while (y0 > 0.02); // ((y0 > -0.00001));//(x1 <= n);
            ZedGraph.LineItem MyCurve = pane.AddCurve("func", list, Color.Blue);
            zedGraphControl1.MasterPane.Add(pane);
            using (Graphics g = CreateGraphics())
            {
                zedGraphControl1.MasterPane.SetLayout(g, ZedGraph.PaneLayout.ExplicitCol12);
            }
            zedGraphControl1.AxisChange();
            zedGraphControl1.Invalidate();
        }
Esempio n. 22
0
        private void button1_Click(object sender, EventArgs e)
        {
            double x0 = Double.Parse(textBox1.Text); //Начальное значение x
            double y0 = Double.Parse(textBox2.Text); //конечное значение x
            int    n  = Int32.Parse(textBox3.Text);  //количество шагов
            //double _h = Double.Parse(textBox4.Text);

            double k1, k2, k3, k4, l1, l2, l3, l4, _h = 0.02, y1, y2, x1, x2;

            zedGraphControl1.MasterPane.PaneList.Clear();
            ZedGraph.GraphPane pane = new ZedGraph.GraphPane();
            pane.CurveList.Clear();
            ZedGraph.PointPairList list = new ZedGraph.PointPairList();

            do
            {
                y0 = y0 + _h;

                k1 = _h * fvx(y0, x0);
                l1 = _h * fvy(y0, x0);
                k2 = _h * fvx(y0 + l1 / 2, x0 + k1 / 2);
                l2 = _h * fvy(y0 + l1 / 2, x0 + k1 / 2);


                x1 = x0 + (k1 + k2) / 2;
                y1 = y0 + (l1 + l2) / 2;
                x0 = x1; y0 = y1;

                listBox1.Items.Add(x1);
                listBox1.Items.Add(y1);
                list.Add(x1, y1);
                //i++;
                //printf("\n %lf", x1);
                //printf("\n %lf", y1);
            }while (y0 > 0.02); // ((y0 > -0.00001));//(x1 <= n);
            ZedGraph.LineItem MyCurve = pane.AddCurve("func", list, Color.Blue);
            zedGraphControl1.MasterPane.Add(pane);
            using (Graphics g = CreateGraphics())
            {
                zedGraphControl1.MasterPane.SetLayout(g, ZedGraph.PaneLayout.ExplicitCol12);
            }
            zedGraphControl1.AxisChange();
            zedGraphControl1.Invalidate();
        }
Esempio n. 23
0
        private void graphControl_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            double x, y, y2;
            int    i;

            ZedGraph.GraphPane pane = graphControl.GraphPane;
            pane.ReverseTransform(new PointF(e.Y, e.X), out x, out y, out y2);
            i = (int)Math.Round(x) - 1;
            if (i >= 0 && i < pane.XAxis.TextLabels.Length)
            {
                string s = string.Format("Comments\nReceived from {0}: {1}\nGiven to {0}: {2}",
                                         pane.XAxis.TextLabels[i], pane.CurveList[0].Y[i], pane.CurveList[1].Y[i]);
                if (toolTipText != s)
                {
                    toolTipText = s;
                    toolTip.SetToolTip(graphControl, s);
                }
            }
        }
Esempio n. 24
0
        private void BuildSubPerLangGraph()
        {
            ZedGraph.ZedGraphControl zg1 = new ZedGraph.ZedGraphControl();
            zg1.Dock              = DockStyle.Fill;
            zg1.IsEnableZoom      = false;
            zg1.IsShowPointValues = false;

            ZedGraph.GraphPane pane = zg1.GraphPane;

            pane.Fill       = new ZedGraph.Fill(Color.Azure, Color.FromArgb(245, 220, 250), 90);
            pane.Chart.Fill = new ZedGraph.Fill(Color.Snow, Color.FromArgb(225, 240, 250), -90);

            pane.Title.Text               = "Submission per Language";
            pane.Title.FontSpec.Size      = 18;
            pane.Title.FontSpec.FontColor = Color.Navy;
            pane.Title.FontSpec.Family    = "Segoe UI Semibold";
            pane.Title.FontSpec.IsBold    = false;

            pane.Legend.FontSpec.Size       = 12;
            pane.Legend.IsShowLegendSymbols = true;
            pane.Legend.Position            = ZedGraph.LegendPos.TopCenter;

            double[] value  = { _subInCPP, _subInJava, _subInAnsiC, _subInCPP11, _subInPascal };
            string[] label  = { "C++", "Java", "ANSI C", "C++11", "Pascal" };
            Color[]  color1 = { Color.Lime, Color.Blue, Color.Red, Color.Green, Color.Yellow };
            Color[]  color2 = { Color.DarkOrange, Color.DarkBlue, Color.DarkRed, Color.DarkGreen, Color.YellowGreen };

            for (int i = 0; i < value.Length; ++i)
            {
                ZedGraph.PieItem pie = pane.AddPieSlice(value[i], color2[i], color1[i], 0, 0.04, label[i]);
                pie.LabelType = ZedGraph.PieLabelType.Name_Value;
                pie.LabelDetail.FontSpec.Border.IsVisible = false;
                pie.LabelDetail.FontSpec.Family           = "Segoe UI Semibold";
                pie.LabelDetail.FontSpec.Size             = 12;
                pie.LabelDetail.FontSpec.IsAntiAlias      = false;
                pie.IsSelectable = true;
            }

            pane.AxisChange();

            this.subPerLanTab.Controls.Clear();
            this.subPerLanTab.Controls.Add(zg1);
        }
Esempio n. 25
0
        private void BuildSubPerDateGraph()
        {
            ZedGraph.ZedGraphControl zg1 = new ZedGraph.ZedGraphControl();
            zg1.Dock = DockStyle.Fill;
            zg1.IsShowPointValues = true;

            ZedGraph.GraphPane pane = zg1.GraphPane;

            pane.Fill       = new ZedGraph.Fill(Color.MintCream, Color.FromArgb(245, 250, 210), -90);
            pane.Chart.Fill = new ZedGraph.Fill(Color.Snow, Color.FromArgb(245, 250, 230), 90);

            pane.Title.Text               = "Submission and Accepted over Time";
            pane.Title.FontSpec.Size      = 18;
            pane.Title.FontSpec.FontColor = Color.Navy;
            pane.Title.FontSpec.Family    = "Segoe UI Semibold";
            pane.Title.FontSpec.IsBold    = false;

            pane.Legend.FontSpec.Size = 12;
            pane.Legend.Position      = ZedGraph.LegendPos.TopCenter;

            pane.XAxis.Title.Text               = "Date-Time";
            pane.XAxis.Title.FontSpec.Family    = "Courier New";
            pane.XAxis.Title.FontSpec.FontColor = Color.Maroon;
            pane.XAxis.Title.FontSpec.IsBold    = false;
            pane.XAxis.Type = ZedGraph.AxisType.Date;

            pane.YAxis.Title.Text               = "Submissions";
            pane.YAxis.Title.FontSpec.Family    = "Courier New";
            pane.YAxis.Title.FontSpec.FontColor = Color.Navy;
            pane.YAxis.Title.FontSpec.IsBold    = false;

            // Generate a red curve
            var a = pane.AddCurve("Submissions / Time", _subOverTime, Color.DarkGoldenrod, ZedGraph.SymbolType.VDash);
            var b = pane.AddCurve("Accepted / Time", _acOverTime, Color.Navy, ZedGraph.SymbolType.VDash);

            a.Symbol.Size = 2;
            b.Symbol.Size = 2;

            pane.AxisChange();
            this.subPerDateTab.Controls.Clear();
            this.subPerDateTab.Controls.Add(zg1);
        }
Esempio n. 26
0
        private void BuildRankCloud()
        {
            ZedGraph.ZedGraphControl zg1 = new ZedGraph.ZedGraphControl();
            zg1.Dock = DockStyle.Fill;
            zg1.IsShowPointValues = true;

            ZedGraph.GraphPane pane = zg1.GraphPane;

            pane.Fill       = new ZedGraph.Fill(Color.Azure, Color.FromArgb(230, 220, 250), 90);
            pane.Chart.Fill = new ZedGraph.Fill(Color.FromArgb(225, 220, 245), Color.LightCyan, -90);

            pane.Title.Text               = "Rank Cloud";
            pane.Title.FontSpec.Size      = 18;
            pane.Title.FontSpec.FontColor = Color.Maroon;
            pane.Title.FontSpec.Family    = "Segoe UI Semibold";
            pane.Title.FontSpec.IsBold    = false;

            pane.Legend.IsVisible = false;

            pane.XAxis.Title.Text               = "Ranks";
            pane.XAxis.Title.FontSpec.Family    = "Courier New";
            pane.XAxis.Title.FontSpec.FontColor = Color.Maroon;
            pane.XAxis.Title.FontSpec.IsBold    = false;

            pane.YAxis.Title.Text               = "Problems";
            pane.YAxis.Title.FontSpec.Family    = "Courier New";
            pane.YAxis.Title.FontSpec.FontColor = Color.Navy;
            pane.YAxis.Title.FontSpec.IsBold    = false;
            pane.YAxis.Type = ZedGraph.AxisType.Linear;

            ZedGraph.LineItem curve = pane.AddCurve("Ranks", _RankCount, Color.Black, ZedGraph.SymbolType.Circle);
            curve.Symbol.Fill             = new ZedGraph.Fill(Color.LightCyan, Color.DarkTurquoise);
            curve.Symbol.Border.IsVisible = true;
            curve.Symbol.Size             = 5;
            curve.Line.IsVisible          = false;

            pane.AxisChange();

            this.rankCloudTab.Controls.Clear();
            this.rankCloudTab.Controls.Add(zg1);
        }
        public plotGenerator()
        {
            zgTimeSeriesPlot.Size = new System.Drawing.Size(1600, 800);
            //1. set the Graph Pane, graphics object
            gPane = zgTimeSeriesPlot.GraphPane;
            //Single Variable Plots
            foreach (string var in Properties.Settings.Default.VariableCode_Bounds)
            {
                string variable = parseVarBoundsSingle(var);
                SeriesCatalog sc = db.getSC(variable);

                //day
                DateTime st = DateTime.Now.AddDays(-2);
                DateTime end = DateTime.Now.AddDays(-1);
                PlotTimeSeries(sc, new DateTime(st.Year, st.Month, st.Day, 12, 0, 0), new DateTime(end.Year, end.Month, end.Day, 12, 0, 0));//, sc.EndDateTime.Value.Subtract(new TimeSpan(1, 0, 0, 0)), sc.EndDateTime.Value);
                //week
                PlotTimeSeries(sc, sc.EndDateTime.Value.Subtract(new TimeSpan(7, 0, 0, 0)), sc.EndDateTime.Value);
                //year
                PlotTimeSeries(sc, new DateTime(sc.EndDateTime.Value.Year, 01, 01), sc.EndDateTime.Value);

            }
            //Double Variable Plots
            foreach (string var in Properties.Settings.Default.MultVarVariable_Bounds)
            {
                List<string> series = parseVarBoundsDouble(var);
                SeriesCatalog sc1 = db.getSC(series[0]);
                SeriesCatalog sc2 = db.getSC(series[1]);

                //day
                DateTime st = DateTime.Now.AddDays(-2);
                DateTime end = DateTime.Now.AddDays(-1);
                PlotTimeSeries(sc1, sc2, new DateTime(st.Year, st.Month, st.Day, 12, 0, 0), new DateTime(end.Year, end.Month, end.Day, 12, 0, 0));//, sc.EndDateTime.Value.Subtract(new TimeSpan(1, 0, 0, 0)), sc.EndDateTime.Value);
                //week
                PlotTimeSeries(sc1, sc2, sc1.EndDateTime.Value.Subtract(new TimeSpan(7, 0, 0, 0)), sc1.EndDateTime.Value);
                //year
                PlotTimeSeries(sc1, sc2, new DateTime(sc1.EndDateTime.Value.Year, 01, 01), sc1.EndDateTime.Value);

            }
        }
Esempio n. 28
0
        /// <summary>
        /// Configures and displays the graph for the last-run report.
        /// </summary>
        /// <param name="_data">The data table that contains the report data.  Only reads two columns.</param>
        private void ConfigureReportGraph(DataTable _data)
        {
            ZedGraph.GraphPane gp = zed_R_Chart.GraphPane;
            gp.CurveList.Clear();
            gp.XAxis.Title.Text = cb_R_GroupBy.Items[cb_R_GroupBy.SelectedIndex].ToString();
            gp.YAxis.Title.Text = cb_R_ReportSource.Items[cb_R_ReportSource.SelectedIndex].ToString();

            List <string> labels = new List <string>();
            List <double> counts = new List <double>();

            gp.XAxis.Type = ZedGraph.AxisType.Text;

            //Loop through each row and add the values to the lists
            foreach (DataRow dr in _data.Rows)
            {
                labels.Add(dr[0].ToString());
                counts.Add(Convert.ToDouble(dr[1]));
            }
            gp.XAxis.Scale.TextLabels = labels.ToArray();
            gp.AddBar(null, null, counts.ToArray(), Color.Red);

            zed_R_Chart.AxisChange();
            zed_R_Chart.Refresh();
        }
 public void SetData(ZedGraph.ZedGraphControl zedControl, ZedGraph.GraphPane pane)
 {
     this.zedControl = zedControl;
     this.pane = pane;
 }
Esempio n. 30
0
        private void Draw()
        {
            if (DataConvertationClass.IsUndefinedElement(_dataAr))
            {
                MessageBox.Show(Text + ". Існують не визначені елементи!");
                return;
            }
            dataGridView1.ColumnCount = _degree + 2;
            dataGridView1.RowCount    = 2;
            dataGridView1[0, 0].Value = "Автокореляції";
            dataGridView1[0, 1].Value = "ЧАКФ";
            double[] ACArray  = Statistical.ACF(_dataAr, _degree);
            double[] PACArray = Statistical.PACF(_dataAr, _degree);
            double[] XList    = new double[_degree + 1];
            for (int i = 1; i < dataGridView1.ColumnCount; i++)
            {
                dataGridView1.Columns[i].Name = (i - 1).ToString();
                dataGridView1[i, 0].Value     = ACArray[i - 1].ToString("F6");
                if (Math.Abs(ACArray[i - 1]) >= level)
                {
                    dataGridView1[i, 0].Style.ForeColor = Color.Red;
                }
                else
                {
                    dataGridView1[i, 0].Style.ForeColor = Color.Black;
                }
                dataGridView1[i, 1].Value = PACArray[i - 1].ToString("F6");
                if (Math.Abs(PACArray[i - 1]) >= level)
                {
                    dataGridView1[i, 1].Style.ForeColor = Color.Red;
                }
                else
                {
                    dataGridView1[i, 1].Style.ForeColor = Color.Black;
                }
                XList[i - 1] = i - 1;
            }
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

            ZedGraph.LineObj levelLine1 = new ZedGraph.LineObj(Color.Red, -1, level, _degree + 1, level);
            levelLine1.Line.Width = 2;
            ZedGraph.LineObj levelLine2 = new ZedGraph.LineObj(Color.Red, -1, -level, _degree + 1, -level);
            levelLine2.Line.Width = 2;

            ZedGraph.GraphPane ACpane = ACzedGraphControl.GraphPane;
            ACpane.CurveList.Clear();
            ACpane.GraphObjList.Clear();
            ACpane.Title.Text                = "Автокореляція";
            ACpane.XAxis.Title.IsVisible     = false;
            ACpane.XAxis.MajorGrid.IsVisible = true;
            ACpane.XAxis.MajorGrid.DashOn    = 1;
            ACpane.XAxis.MajorGrid.DashOff   = 1;
            ACpane.XAxis.Scale.Min           = 0;
            ACpane.XAxis.Scale.Max           = ACArray.Length;
            ACpane.YAxis.Title.IsVisible     = false;
            ACpane.YAxis.MajorGrid.IsVisible = true;
            ACpane.YAxis.MajorGrid.DashOn    = 1;
            ACpane.YAxis.MajorGrid.DashOff   = 1;
            ACpane.YAxis.Scale.Min           = -2;
            ACpane.YAxis.Scale.Max           = 2;
            ZedGraph.PointPairList ACList = new ZedGraph.PointPairList(XList, ACArray);
            ACpane.AddBar("", ACList, Color.BlanchedAlmond);
            ACpane.GraphObjList.Add(levelLine1);
            ACpane.GraphObjList.Add(levelLine2);
            ACzedGraphControl.Refresh();

            ZedGraph.GraphPane PACpane = PACzedGraphControl.GraphPane;
            PACpane.CurveList.Clear();
            PACpane.GraphObjList.Clear();
            PACpane.Title.Text                = "ЧАКФ";
            PACpane.XAxis.Title.IsVisible     = false;
            PACpane.XAxis.MajorGrid.IsVisible = true;
            PACpane.XAxis.MajorGrid.DashOn    = 1;
            PACpane.XAxis.MajorGrid.DashOff   = 1;
            PACpane.XAxis.Scale.Min           = 0;
            PACpane.XAxis.Scale.Max           = ACArray.Length;
            PACpane.YAxis.Title.IsVisible     = false;
            PACpane.YAxis.MajorGrid.IsVisible = true;
            PACpane.YAxis.MajorGrid.DashOn    = 1;
            PACpane.YAxis.MajorGrid.DashOff   = 1;
            PACpane.YAxis.Scale.Min           = -2;
            PACpane.YAxis.Scale.Max           = 2;
            ZedGraph.PointPairList PACList = new ZedGraph.PointPairList(XList, PACArray);
            PACpane.AddBar("", PACList, Color.BlanchedAlmond);
            PACpane.GraphObjList.Add(levelLine1);
            PACpane.GraphObjList.Add(levelLine2);
            PACzedGraphControl.Refresh();
        }
Esempio n. 31
0
        public static Image GetAnnotatedImage(string argPeptide, MSScan argScan, List<MSPoint> argPeaks, GlycanStructure argStructure)
        {
            float MaxX = argStructure.Root.FetchAllGlycanNode().OrderByDescending(o => o.IDMass).ToList()[0].IDMass;
            if (MaxX + 100 > 2000.0)
            {
                MaxX = 2000.0f;
            }
            else
            {
                MaxX = MaxX + 100;
            }
            ZedGraph.GraphPane Pane = new ZedGraph.GraphPane(new RectangleF(0.0f, 0.0f, 2000.0f, 1500.0f), argScan.ScanNo.ToString(), "Mass", "Intensity");
            //ZedGraph.MasterPane Pane = new ZedGraph.MasterPane(argTitle,new RectangleF(0.0f, 0.0f, 2400.0f, 1800.0f) );
            Pane.XAxis.MajorTic.IsInside = false;
            Pane.XAxis.MinorTic.IsInside = false;
            Pane.Legend.IsVisible = false;
            ZedGraph.PointPairList Peaks = new ZedGraph.PointPairList();

            double MaxIntensity = 0.0;
            /////////////////
            //Peaks
            ////////////////
            foreach (MSPoint p in argPeaks)
            {
                if (p.Intensity > MaxIntensity && p.Mass<=MaxX)
                {
                    MaxIntensity = p.Intensity;
                }
            }
            foreach (MSPoint p in argPeaks)
            {
                if (p.Mass <= MaxX)
                {
                    Peaks.Add(p.Mass, (p.Intensity/MaxIntensity)*100.0);
                }
            }
            Pane.AddStick("Peaks", Peaks, Color.Red);

            //////////////////
            //Y1 text object
            //////////////////
            /* ZedGraph.TextObj txtY1 = new ZedGraph.TextObj("Y1", argStructure.Y1.MZ, 102);
             txtY1.FontSpec.Size = txtY1.FontSpe.cSize*0.5f;
             txtY1.FontSpec.Border.IsVisible = false;
             Pane.GraphObjList.Insert(0, txtY1);*/

            /////////////////
            //Structure
            ////////////////
            GlycansDrawer GS;
            double previousBoundary = 0;

            foreach (GlycanTreeNode t in argStructure.Root.FetchAllGlycanNode().OrderBy(o => o.IDMass).ToList())
            {

                GS = new GlycansDrawer(t.IUPACFromRoot, false);
                double glycopeptideMZ = t.IDMass;
                //double glycopeptideMZ =argStructure.Y1.Mass - GlycanMass.GetGlycanMasswithCharge(Glycan.Type.HexNAc, FGS.Charge);
                //glycopeptideMZ = glycopeptideMZ +
                //                 FGS.NoOfHexNac * GlycanMass.GetGlycanAVGMasswithCharge(Glycan.Type.HexNAc, FGS.Charge);
                //glycopeptideMZ = glycopeptideMZ +
                //                 FGS.NoOfHex*GlycanMass.GetGlycanAVGMasswithCharge(Glycan.Type.Hex, FGS.Charge);
                //glycopeptideMZ = glycopeptideMZ +
                //                 FGS.NoOfDeHex * GlycanMass.GetGlycanAVGMasswithCharge(Glycan.Type.DeHex, FGS.Charge);
                //glycopeptideMZ = glycopeptideMZ +
                //                 FGS.NoOfNeuAc * GlycanMass.GetGlycanAVGMasswithCharge(Glycan.Type.NeuAc, FGS.Charge);
                //glycopeptideMZ = glycopeptideMZ +
                //                 FGS.NoOfNeuGc * GlycanMass.GetGlycanAVGMasswithCharge(Glycan.Type.NeuGc, FGS.Charge);
                Image imgStructure = GlycanImage.RotateImage(GS.GetImage(), 270);

                ZedGraph.TextObj txtGlycanMz = new ZedGraph.TextObj(glycopeptideMZ.ToString("0.000"), 100, 131);

                double PositionX = glycopeptideMZ;

                if (previousBoundary >= PositionX)
                {
                    PositionX = previousBoundary + 20;
                }

                if (imgStructure.Width > txtGlycanMz.Location.Width)
                {
                    previousBoundary = imgStructure.Width + PositionX;
                }
                else
                {
                    previousBoundary = (float)txtGlycanMz.Location.Width + PositionX;
                }
                ZedGraph.ImageObj glycan = new ZedGraph.ImageObj(imgStructure, PositionX, 130, imgStructure.Width + 20, imgStructure.Height);

                glycan.IsScaled = false;
                glycan.Location.AlignV = ZedGraph.AlignV.Bottom;

                txtGlycanMz.Location.X = glycan.Location.X + (float)glycan.Image.Width / 2 - (float)txtGlycanMz.Location.Width / 2;
                txtGlycanMz.FontSpec.Size = txtGlycanMz.FontSpec.Size * 0.3f;
                txtGlycanMz.FontSpec.Border.IsVisible = false;

                Pane.GraphObjList.Add(txtGlycanMz);
                Pane.GraphObjList.Add(glycan);

                double interval = 100000;
                int idx = 0;
                for (int i = 0; i < Peaks.Count; i++)
                {
                    if (Math.Abs(Peaks[i].X - glycopeptideMZ) < interval)
                    {
                        interval = Math.Abs((float)Peaks[i].X - glycopeptideMZ);
                        idx = i;
                    }
                }
                string mzLabelwPPM = Peaks[idx].X.ToString("0.000");// + "\n(" + Math.Abs(glycopeptideMZ - (float)Peaks[idx].X).ToString("0") + "da)";
                ZedGraph.TextObj PeakLabel = new ZedGraph.TextObj(mzLabelwPPM, Peaks[idx].X, Peaks[idx].Y + 3.0);
                PeakLabel.FontSpec.Size = PeakLabel.FontSpec.Size * 0.3f;
                PeakLabel.FontSpec.Border.IsVisible = false;
                PeakLabel.FontSpec.Fill.IsVisible = false;
                Pane.GraphObjList.Add(PeakLabel);
            }
            Pane.AxisChange();

            Pane.YAxis.Scale.Max = 145;
            Pane.XAxis.Scale.Min = Convert.ToInt32(argStructure.Y1.Mass - 100);
            Pane.XAxis.Scale.Max = Peaks[Peaks.Count - 1].X + 100;
            ////////////
            //Glycan Structure
            ////////////
            GS = new GlycansDrawer(argStructure.IUPACString, false);
            Image imgStruc = RotateImage( GS.GetImage() ,180);
            ZedGraph.ImageObj fullStructure = new ZedGraph.ImageObj(imgStruc, Pane.XAxis.Scale.Min + 20, 140, imgStruc.Width + 20, imgStruc.Height);
            fullStructure.IsScaled = false;
            Pane.GraphObjList.Add(fullStructure);
            ///////////////
            //Glycan M/Z
            //////////////
            double glycopeptidemz = GlycanMass.GetGlycanMasswithCharge(argStructure.Root.GlycanType,argStructure.Charge) + argStructure.Y1.Mass - GlycanMass.GetGlycanMasswithCharge(Glycan.Type.HexNAc, argStructure.Charge);
            ZedGraph.TextObj txtGlycanMZ = new ZedGraph.TextObj("\n              Precursor:" + argScan.ParentMZ.ToString("0.000")+"(" +argScan.ParentCharge.ToString()+")"+
                                                                                                                "\nPeptide Sequence:" + argPeptide
                    , Pane.GraphObjList[Pane.GraphObjList.Count - 1].Location.X2, 140);
            txtGlycanMZ.FontSpec.Size = txtGlycanMZ.FontSpec.Size * 0.3f;
            txtGlycanMZ.FontSpec.Border.IsVisible = false;
            txtGlycanMZ.FontSpec.Fill.IsVisible = false;
            Pane.GraphObjList.Add(txtGlycanMZ);
            Image tmp = (Image)Pane.GetImage();

            return tmp;
        }
Esempio n. 32
0
 string XAxis_ScaleFormatEvent(ZedGraph.GraphPane pane, ZedGraph.Axis axis, double val, int index)
 {
     return(DateTime.FromOADate(val).ToString("dd/MM/yyyy"));
 }
Esempio n. 33
0
 public chaos_frm()
 {
     InitializeComponent();
     simupdate = new d_updatetexts(simupdater);
     gpane = graph.GraphPane;
 }
Esempio n. 34
0
        /// <summary>
        /// EEG ZedGraph init
        /// </summary>
        private void EEGGraphInit()
        {
            System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
            eegZedGraph = new ZedGraph.ZedGraphControl();
            eegZedGraph.IsEnableZoom = false;
            // http://goorman.free.fr/ZedGraph/zedgraph.org/wiki/indexa9f9.html?title=Edit_Points_by_Dragging_the_Mouse
            //zedGraph.MouseDownEvent += zedGraph_MouseDownEvent;
            host.Child = eegZedGraph;
            EEGGrid.Children.Add(host);

            eegGraph = new BasicDSP.Graph(eegZedGraph.CreateGraphics(), eegZedGraph);

            zedGraphPane = eegZedGraph.GraphPane;
            eegLine = new ZedGraph.LineObj(System.Drawing.Color.Red, graphLineXPosition, zedGraphPane.YAxis.Scale.Min, graphLineXPosition, zedGraphPane.YAxis.Scale.Max);
            eegLine.Line.Width = 1f;
            zedGraphPane.GraphObjList.Add(eegLine);

            EEGZedGraphRefresh();
        }
Esempio n. 35
0
        /// <summary>
        /// Emotion ZedGraph init
        /// </summary>
        private void EmotionGraphInit()
        {
            System.Windows.Forms.Integration.WindowsFormsHost emotionHost = new System.Windows.Forms.Integration.WindowsFormsHost();
            emotionZedGraph = new ZedGraph.ZedGraphControl();
            emotionZedGraph.IsEnableZoom = false;
            emotionHost.Child = emotionZedGraph;
            EmotionGrid.Children.Add(emotionHost);

            emotionGraph = new BasicDSP.Graph(emotionZedGraph.CreateGraphics(), emotionZedGraph);

            emotionGraphPane = emotionZedGraph.GraphPane;
            emotionLine = new ZedGraph.LineObj(System.Drawing.Color.Red, graphLineXPosition, emotionGraphPane.YAxis.Scale.Min, graphLineXPosition, emotionGraphPane.YAxis.Scale.Max);
            emotionLine.Line.Width = 1f;
            emotionGraphPane.GraphObjList.Add(emotionLine);

            EmotionZedGraphRefresh();
        }
Esempio n. 36
0
        /// <summary>
        /// Activity ZedGraph init
        /// </summary>
        private void ActivityGraphInit()
        {
            System.Windows.Forms.Integration.WindowsFormsHost activityHost = new System.Windows.Forms.Integration.WindowsFormsHost();
            activityZedGraph = new ZedGraph.ZedGraphControl();
            activityZedGraph.IsEnableZoom = false;
            activityHost.Child = activityZedGraph;
            ActivityGrid.Children.Add(activityHost);

            activityGraph = new BasicDSP.Graph(activityZedGraph.CreateGraphics(), activityZedGraph);

            activityGraphPane = activityZedGraph.GraphPane;
            activityLine = new ZedGraph.LineObj(System.Drawing.Color.Red, graphLineXPosition, activityGraphPane.YAxis.Scale.Min, graphLineXPosition, activityGraphPane.YAxis.Scale.Max);
            activityLine.Line.Width = 1f;
            activityGraphPane.GraphObjList.Add(activityLine);

            ActivityZedGraphRefresh();
        }
Esempio n. 37
0
        /// <summary>
        /// Init spectrum ZedGraph
        /// </summary>
        private void SpectrumGraphInit()
        {
            System.Windows.Forms.Integration.WindowsFormsHost spectrumZedGraphHost = new System.Windows.Forms.Integration.WindowsFormsHost();
            spectrumZedGraph = new ZedGraph.ZedGraphControl();
            spectrumZedGraph.IsEnableZoom = false;
            spectrumZedGraphHost.Child = spectrumZedGraph;
            SpectrumGrid.Children.Add(spectrumZedGraphHost);

            spectrumGraph = new BasicDSP.Graph(spectrumZedGraph.CreateGraphics(), spectrumZedGraph);

            spectrumGraphPane = spectrumZedGraph.GraphPane;

            SpectrumZedGraphRefresh();
        }
Esempio n. 38
0
        private void btnDaySummary_Click(object sender, EventArgs e)
        {
            Random    rnd = new Random();
            DataTable t   = GetDateTbl();

            if (t != null)
            {
                if (frmPie != null && !frmPie.IsDisposed)
                {
                    frmPie.Dispose();
                }

                frmPie = new frmChart();

                ZedGraph.GraphPane Pane = frmPie.zedGraph.GraphPane;

                //Titulos
                frmPie.Text              = lblTimeSpent.Text + ": " + lblDay.Text + " " + dTP.Value.Date.ToString().Split()[0];
                Pane.Title.Text          = frmPie.Text;
                Pane.Title.FontSpec.Size = 24f;
                //Pane.Title.FontSpec.IsItalic = true;

                Pane.Fill            = new ZedGraph.Fill(Color.White, Color.LightYellow, 45f);
                Pane.Chart.Fill.Type = ZedGraph.FillType.None;

                //fonte da legenda
                Pane.Legend.FontSpec.Size = 11f;

                //Slices
                int tempoTot = 0;
                foreach (DataRow r in t.Rows)
                {
                    int tempo = (int)r["colElapTimeInSeconds"];
                    tempoTot += tempo;
                    Color            cor = Color.FromArgb(rnd.Next(240), rnd.Next(240), rnd.Next(240));
                    ZedGraph.PieItem p   = Pane.AddPieSlice(Math.Round((double)tempo / 3600, 2), cor, Color.White, 45f, 0.1, r["colTask"].ToString());

                    //Menu pie slices removal feature
                    ToolStripMenuItem m = new ToolStripMenuItem(r["colTask"].ToString());
                    m.Checked = true;
                    frmPie.itemsMenu.DropDownItems.Add(m);
                    m.Click += new EventHandler(m_Click);
                    frmPie.vals.Add((double)tempo / 3600);
                }

                //Sets menu text
                frmPie.itemsMenu.Text = lblTask.Text;


                TimeSpan tsp = new TimeSpan(0, 0, tempoTot);

                //Total label
                txt = new ZedGraph.TextObj(lblTotTime.Text + "\n" + Math.Round(tsp.TotalHours, 2).ToString() + " h", 0.88f, 0.3f, ZedGraph.CoordType.PaneFraction);
                Pane.GraphObjList.Add(txt);
                txt.FontSpec.Fill = new ZedGraph.Fill(Color.White, Color.Yellow, 45f);
                //shadow
                ZedGraph.TextObj txt2 = new ZedGraph.TextObj(txt);
                txt2.FontSpec.Fill = new ZedGraph.Fill(Color.Black);
                txt2.Location.X   += 0.006f;
                txt2.Location.Y   += 0.008f;
                Pane.GraphObjList.Add(txt2);

                frmPie.zedGraph.AxisChange();

                frmPie.Show();
            }
        }
Esempio n. 39
0
        private void btnMonthEffort_Click(object sender, EventArgs e)
        {
            string mes = dTP.Value.Month.ToString();

            List <string> _tasks = new List <string>();
            List <double> _times = new List <double>();

            foreach (DataTable tbl in PBData.Tables)
            {
                //checks if month is in selected day
                string[] s = tbl.TableName.Split(':');
                if (s.Length > 1)
                {
                    s = s[1].Split('-');
                }
                if (s.Length > 1 && s[1] == mes)
                {
                    //adds each task
                    foreach (DataRow r in tbl.Rows)
                    {
                        //position
                        int i = _tasks.IndexOf(r["colTask"].ToString());
                        if (i < 0)
                        {
                            i = _tasks.Count;
                            _tasks.Add(r["colTask"].ToString());
                            _times.Add(0);
                        }

                        //time count
                        _times[i] += (double)((int)r["colElapTimeInSeconds"]);
                    }
                }
            }

            Random rnd = new Random();
            //zedGraph Pie Chart

            DataTable t      = GetDateTbl();
            frmChart  frmBar = new frmChart();

            frmBar.itemsMenu.Visible = false;

            ZedGraph.GraphPane Pane = frmBar.zedGraph.GraphPane;

            //Titulos
            frmBar.Text = btnMonthEffort.Text + ": " + lblMonth.Text + " " +
                          System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames[dTP.Value.Month - 1] + "/" + dTP.Value.Year.ToString();

            Pane.Title.Text          = frmBar.Text;
            Pane.Title.FontSpec.Size = 24f;
            //Pane.Title.FontSpec.IsItalic = true;

            Pane.Fill            = new ZedGraph.Fill(Color.White, Color.LightYellow, 45f);
            Pane.Chart.Fill.Type = ZedGraph.FillType.None;

            //fonte da legenda
            Pane.Legend.FontSpec.Size = 11f;

            Pane.BarSettings.Base = ZedGraph.BarBase.Y;

            //Bars
            double[] yy = new double[_tasks.Count];
            double[] xx = new double[_tasks.Count];
            for (int j = 0; j < _tasks.Count; j++)
            {
                yy[j] = (double)(j + 1);
                xx[j] = Math.Round(_times[j] / 3600, 2);
            }

            Color cor = Color.FromArgb(rnd.Next(240), rnd.Next(240), rnd.Next(240));

            ZedGraph.BarItem p = Pane.AddBar("", xx, yy, Color.White);
            p.Bar.Fill = new ZedGraph.Fill(cor, Color.White, cor);

            Pane.YAxis.Scale.TextLabels         = _tasks.ToArray();
            Pane.YAxis.Type                     = ZedGraph.AxisType.Text;
            Pane.YAxis.MajorTic.IsBetweenLabels = true;

            Pane.XAxis.Title.Text = lblTotalTH.Text;
            Pane.YAxis.Title.Text = lblTask.Text;

            frmBar.zedGraph.AxisChange();

            frmBar.Show();
        }
Esempio n. 40
0
        private void btnMonthSummary_Click(object sender, EventArgs e)
        {
            string mes = dTP.Value.Month.ToString();

            List <string> _tasks = new List <string>();
            List <double> _times = new List <double>();

            foreach (DataTable tbl in PBData.Tables)
            {
                //checks if month is in selected day
                string[] s = tbl.TableName.Split(':');
                if (s.Length > 1)
                {
                    s = s[1].Split('-');
                }
                if (s.Length > 1 && s[1] == mes)
                {
                    //adds each task
                    foreach (DataRow r in tbl.Rows)
                    {
                        //position
                        int i = _tasks.IndexOf(r["colTask"].ToString());
                        if (i < 0)
                        {
                            i = _tasks.Count;
                            _tasks.Add(r["colTask"].ToString());
                            _times.Add(0);
                        }

                        //time count
                        _times[i] += (double)((int)r["colElapTimeInSeconds"]);
                    }
                }
            }

            Random rnd = new Random();
            //zedGraph Pie Chart

            DataTable t = GetDateTbl();

            if (frmPie != null && !frmPie.IsDisposed)
            {
                frmPie.Dispose();
            }

            frmPie = new frmChart();

            ZedGraph.GraphPane Pane = frmPie.zedGraph.GraphPane;

            //Titulos
            frmPie.Text = lblTimeSpent.Text + ": " + lblMonth.Text + " " +
                          System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames[dTP.Value.Month - 1] + "/" + dTP.Value.Year.ToString();

            Pane.Title.Text          = frmPie.Text;
            Pane.Title.FontSpec.Size = 24f;
            //Pane.Title.FontSpec.IsItalic = true;

            Pane.Fill            = new ZedGraph.Fill(Color.White, Color.LightYellow, 45f);
            Pane.Chart.Fill.Type = ZedGraph.FillType.None;

            //fonte da legenda
            Pane.Legend.FontSpec.Size = 11f;

            //Slices
            TimeSpan tspTot = new TimeSpan(0, 0, 0);

            for (int j = 0; j < _tasks.Count; j++)
            {
                TimeSpan tsp = new TimeSpan(0, 0, (int)_times[j]);
                tspTot += tsp;

                Color            cor = Color.FromArgb(rnd.Next(240), rnd.Next(240), rnd.Next(240));
                ZedGraph.PieItem p   = Pane.AddPieSlice(Math.Round(_times[j] / 3600, 2), cor, Color.White, 45f, 0.1, _tasks[j]);

                //Menu pie slices removal feature
                ToolStripMenuItem m = new ToolStripMenuItem(_tasks[j]);
                m.Checked = true;
                frmPie.itemsMenu.DropDownItems.Add(m);
                m.Click += new EventHandler(m_Click);
                frmPie.vals.Add(_times[j] / 3600);
            }
            //Sets menu text
            frmPie.itemsMenu.Text = lblTask.Text;

            //Total label
            txt = new ZedGraph.TextObj(lblTotTime.Text + "\n" + Math.Round(tspTot.TotalHours, 1).ToString() + " h", 0.9f, 0.17f, ZedGraph.CoordType.PaneFraction);
            Pane.GraphObjList.Add(txt);
            txt.FontSpec.Fill = new ZedGraph.Fill(Color.White, Color.Yellow, 45f);
            //shadow
            ZedGraph.TextObj txt2 = new ZedGraph.TextObj(txt);
            txt2.FontSpec.Fill = new ZedGraph.Fill(Color.Black);
            txt2.Location.X   += 0.006f;
            txt2.Location.Y   += 0.008f;
            Pane.GraphObjList.Add(txt2);

            frmPie.zedGraph.AxisChange();

            frmPie.Show();
        }