Example #1
0
        public void PlotWaveform()
        {
            ICFunction[] cft = ComplexFunctions;
            if (cft == null)
            {
                return;
            }
            int nPlots = 0;

            foreach (ICFunction icf in cft)
            {
                if (icf.Name.Equals("Plot"))
                {
                    nPlots++;
                }
            }
            double[][]        x       = new double[nPlots][];
            double[][]        y       = new double[nPlots][];
            Color[]           colors  = new Color[nPlots];
            ZedGraph.Symbol[] symbols = new ZedGraph.Symbol[nPlots];
            string[]          labels  = new string[nPlots];
            nPlots = 0;
            for (int i = 0; i < cft.Length; i++)
            {
                CDoubleArray cd = cft[i].Eval();
                if (cft[i].GetType().Name.Equals("Plot"))
                {
                    Plot plot = cft[i] as Plot;
                    if (cd != null)
                    {
                        x[nPlots]       = cd.Real;
                        y[nPlots]       = cd.Imag;
                        labels[nPlots]  = plot.Legend;
                        symbols[nPlots] = GraphSymbol.GetSymbol(plot.SymbolString, plot.LineColor);
                        colors[nPlots]  = plot.LineColor;
                    }
                    nPlots++;
                }
            }
            base.PlotWaveform(x, y, labels.ToArray(), colors, symbols);
        }
Example #2
0
        public void HighlightIndex(int index, int curveIndex, Color color)
        {
            if (curveIndex >= mCurveList.Count)
            {
                return;
            }
            CurveItem curve         = mCurveList[curveIndex];
            int       selectedIndex = index / decimation;

            if (selectedIndex >= curve.Points.Count)
            {
                return;
            }
            PointPair p = curve.Points[selectedIndex];

            LineItem li = new LineItem("", new double[] { p.X }, new double[] { p.Y }, color, SymbolType.UserDefined, 1);

            li.Symbol = GraphSymbol.GetSymbol("Highlight", color);
            highlightList.Clear();
            highlightList.Add(li);
            DisplayCurves();
        }