コード例 #1
0
        public void plotValues()
        {
            if (ZedgraphControl1.GraphPane.CurveList.Count > 0)
            {
                bool onePointAdded = false;
                int  curveIndex    = 0;
                int  firstIndex    = 0;
                foreach (CurveItem curve in ZedgraphControl1.GraphPane.CurveList)
                {
                    if (curve.Points.Count > 0)
                    {
                        firstIndex = plotParamReference[curveIndex].LatchTimes.FindIndex(x => x > curve.Points[curve.Points.Count - 1].X);
                    }
                    else
                    {
                        firstIndex = 0;
                    }

                    if (firstIndex > -1)
                    {
                        for (int i = firstIndex; i < plotParamReference[curveIndex].getLength(); i++)
                        {
                            curve.AddPoint(plotParamReference[curveIndex].LatchTimes[i], plotParamReference[curveIndex].ToPlotDouble((GUIValueLinks)curve.Tag, i));
                            onePointAdded = true;
                        }
                    }


                    if (curve.NPts > 0 && curveIndex == 0)
                    {
                        xMax = curve.Points[curve.Points.Count - 1].X;
                    }
                    else if (curve.NPts > 0)
                    {
                        xMax = Math.Max(xMax, curve.Points[curve.Points.Count - 1].X);
                    }
                    curveIndex++;
                }

                if (onePointAdded)
                {
                    if (xMax - plotWindow >= 0)
                    {
                        ZedgraphControl1.GraphPane.XAxis.Scale.Min = xMax - plotWindow;
                    }
                    else
                    {
                        ZedgraphControl1.GraphPane.XAxis.Scale.Min = 0;
                    }
                    ZedgraphControl1.GraphPane.XAxis.Scale.Max = xMax;


                    ZedgraphControl1.ScrollMinX = 0;
                    ZedgraphControl1.ScrollMaxX = xMax;
                    ZedgraphControl1.AxisChange();
                    ZedgraphControl1.Refresh();
                }
            }
        }
コード例 #2
0
        public void clearPlotValues()
        {
            foreach (CurveItem curve in ZedgraphControl1.GraphPane.CurveList)
            {
                curve.Clear();
            }

            ZedgraphControl1.AxisChange();
            ZedgraphControl1.Refresh();
        }
コード例 #3
0
        private void PlotPropsTreeView_MouseClick(object sender, MouseEventArgs e)
        {
            // the curve is tagged with the guivalue link
            // the node is tagged with the curve
            // the plotparameterreference it the value node linked by the guivalue link

            treeView1.SelectedNode = treeView1.GetNodeAt(e.X, e.Y);

            if (e.Button == MouseButtons.Right)
            {
                if (treeView1.SelectedNode.Parent != null && treeView1.SelectedNode != treeView1.Nodes[0].Nodes[0])
                {
                    if (!((CurveItem)treeView1.SelectedNode.Tag).IsY2Axis)// Y1 Axis
                    {
                        Y1Units.Remove(((GUIValueLinks)(((CurveItem)treeView1.SelectedNode.Tag).Tag)).UnitsString);
                    }
                    else// Y2 Axis
                    {
                        Y2Units.Remove(((GUIValueLinks)(((CurveItem)treeView1.SelectedNode.Tag).Tag)).UnitsString);
                    }

                    plotParamReference.Remove((((GUIValueLinks)(((CurveItem)treeView1.SelectedNode.Tag).Tag)).vNodeLink));
                    ZedgraphControl1.GraphPane.CurveList.Remove(((CurveItem)treeView1.SelectedNode.Tag));
                    treeView1.Nodes.Remove(treeView1.SelectedNode);

                    treeView1.ExpandAll();

                    // Update Y axis titles with units from serial parameters
                    updateAxisUnitsText();

                    ZedgraphControl1.Refresh();
                }
                //else if(treeView1.SelectedNode == treeView1.Nodes[0].Nodes[0])
                //{
                //    treeView1.SelectedNode.BeginEdit();

                //}
            }
            if (e.Button == MouseButtons.Left)
            {
                if (treeView1.SelectedNode.Parent != null && treeView1.SelectedNode != treeView1.Nodes[0].Nodes[0])
                {
                    foreach (LineItem curve in this.ZedgraphControl1.GraphPane.CurveList)
                    {
                        curve.Line.Width = 1.0F;
                    }
                    if (((LineItem)(treeView1.SelectedNode.Tag)) != null)
                    {
                        ((LineItem)(treeView1.SelectedNode.Tag)).Line.Width = 3.0F;
                    }
                }
            }
        }
コード例 #4
0
        public void ZedgraphControl1_DragDrop(object sender, DragEventArgs e)
        {
            GUIValueLinks GUIVLinkDropped = null;
            int           axisSelect      = 2;

            // Analyze drop location according to window geometry, and select Y1 vs Y2
            if (e == null && sender == null)
            {
                axisSelect = 1;
            }
            else if (e == null && sender != null)
            {
                axisSelect = 1;
            }
            else if (e.X == 0 && e.Y == 0)
            {
                axisSelect = 1;
            }
            else if (e.X == 1 && e.Y == 1)
            {
                axisSelect = 2;
            }
            else if (e.X <= ZedgraphControl1.ParentForm.Location.X + ZedgraphControl1.Parent.Location.X + ZedgraphControl1.Size.Width / 2)
            {
                axisSelect = 1;
            }
            else
            {
                axisSelect = 2;
            }

            if (((GUIValueLinks)e.Data.GetData(typeof(GUIValueLinks))) != null)
            {
                GUIVLinkDropped = ((GUIValueLinks)e.Data.GetData(typeof(GUIValueLinks)));
                DropGUIVLink(GUIVLinkDropped, axisSelect);
            }

            ZedgraphControl1.Refresh();
        }
コード例 #5
0
        public void ClearPlotSymbols()
        {
            clearPlotValues();
            Y1Units.Clear();
            Y2Units.Clear();

            plotParamReference.Clear();                   //.Remove(((SerialParameterData)(((CurveItem)treeView1.SelectedNode.Tag).Tag)));
            ZedgraphControl1.GraphPane.CurveList.Clear(); //.Remove(((CurveItem)treeView1.SelectedNode.Tag));

            if (treeView1.Nodes.Count > 2)
            {
                treeView1.Nodes[2].Nodes.Clear();
            }
            if (treeView1.Nodes.Count > 1)
            {
                treeView1.Nodes[1].Nodes.Clear();
            }

            treeView1.ExpandAll();

            updateAxisUnitsText();

            ZedgraphControl1.Refresh();
        }