コード例 #1
0
        public void AddCurve(FlyParameter parameter, List<float> data)
        {
            this.Parameter = parameter;
            this.mdata = data;

            CtrCurve curve = this.ctrCurve1;
            curve.GetParameterObject = this;
            curve.Height = 200;
            curve.Dock = DockStyle.Top;
            NPlot.LineList lineList = new NPlot.LineList(parameter, data);
            curve.SuspendLayout();
            curve.InitCurve();
            curve.DrawCurve(lineList, 0, lineList.EndNum);
            curve.Parameters.Add(parameter);
            curve.ResumeLayout();
            curve.BringToFront();
        }
コード例 #2
0
 private void mnuAddCurve_Click(object sender, EventArgs e)
 {
     List<IParameter> parameters = GetParameterObject.GetParameterDef();
     frmAddCurve frmaddCurve = new frmAddCurve(parameters);
     
     DialogResult dr = frmaddCurve.ShowDialog();
     if (dr == DialogResult.OK)
     {
         if (GetParameterObject != null)
         {
             this.Parameters.Add(frmaddCurve.SelectedParameter);
             List<float> data = GetParameterObject.GetParameterData(frmaddCurve.SelectedParameter);
             LineList lineList = new LineList(frmaddCurve.SelectedParameter, data);
             lineList.LineUnit = frmaddCurve.SelectedParameter.Unit;
             lineList.LineName = frmaddCurve.SelectedParameter.Caption;
             DrawCurve(lineList, startNum, endNum);
             this.Refresh();
         }
     }
     
 }
コード例 #3
0
        private void mnuReplaceCurve_Click(object sender, EventArgs e)
        {
            frmReplaceCurve frm = new frmReplaceCurve(this.GetParameterObject.GetParameterDef(), this.Parameters);
            DialogResult dr = frm.ShowDialog();
            if (dr == DialogResult.OK)
            {
                if (GetParameterObject != null)
                {
                    //删除要替换的曲线
                    int index = this.Parameters.IndexOf(frm.OldParameter);
                    this.Parameters.RemoveAt(index);
                    this.LineListSets.RemoveAt(index);

                    //添加新曲线
                    List<float> data = GetParameterObject.GetParameterData(frm.NewParameter);
                    LineList lineList = new LineList(frm.NewParameter, data);
                    lineList.LineUnit = frm.NewParameter.Unit;
                    lineList.LineName = frm.NewParameter.Caption;
                    this.LineListSets.Add(lineList);
                    this.Parameters.Add(frm.NewParameter);

                    ReDrawCurve();
                }
            }
        }
コード例 #4
0
        public void DrawCurve(LineList lineList, int startNum, int endNum)
        {
            this.LineListSets.Add(lineList);

            this.startNum = startNum;
            this.endNum = endNum;

            string YAxisLable = string.Empty;

            LinePlot linePlot = new LinePlot();

            linePlot.OrdinateData = lineList.Y;//高度-时间曲线纵坐标
            linePlot.AbscissaData = lineList.X;//高度-时间曲线横坐标
            linePlot.Label = lineList.LineName;

            switch (this.LineListSets.Count)
            {
                case 1:
                    linePlot.Color = Color.Blue;
                    break;
                case 2:
                    linePlot.Color = Color.Black;
                    break;
                case 3:
                    linePlot.Color = Color.Purple;
                    break;
                case 4:
                    linePlot.Color = Color.Green;
                    break;
                default:
                    linePlot.Color = Color.Brown;
                    break;
            }

            linePlot.Pen.Width = 2.0f;
            linePlot.Shadow = true;//画线时加阴影

            //YAxisLable = (lineList.LineName + "(" + lineList.LineUnit + ")");

            plotSurface2D1.Add(linePlot);

            plotSurface2D1.XAxis1.Color = Color.Black;

            plotSurface2D1.YAxis1.Color = Color.Black;

            plotSurface2D1.XAxis1.Label = "绝对时间(s)";
            plotSurface2D1.XAxis1.LabelOffset = 0;//轴注释与轴间距

            plotSurface2D1.YAxis1.LabelOffset = 0;
            plotSurface2D1.YAxis1.Label += YAxisLable;

            this.lineCount = this.LineListSets.Count;
        }
コード例 #5
0
        /// <summary>
        /// 动态增加图表控件
        /// </summary>
        /// <param name="parameter"></param>
        /// <param name="data"></param>
        private void AddCurve(FlyParameter parameter, List<float> data, List<int> happenTimes,int duration)
        {
            CtrCurve curve = new CtrCurve();
            curve.GetParameterObject = this;
            curve.Height = 200;
            curve.Dock = DockStyle.Top;
            NPlot.LineList lineList = new NPlot.LineList(parameter, data);
            curve.SuspendLayout();
            curve.InitCurve();
            curve.DrawCurve(lineList, 0, lineList.EndNum);
            curve.Parameters.Add(parameter);

            //添加红线(故障的发生时间)
            List<VerticalLine> vlines = GetVerticalLines(happenTimes, duration);
            if (vlines != null)
            {
                curve.AddVerticalLines(vlines);
            }

            this.pnlContainer.Controls.Add(curve);
            curve.ResumeLayout();
            curve.BringToFront();

            curve.CtrCurveClick += new CtrCurveClickEvent(curve_CtrCurveClick);
            //curve.CurveInteractionOccured += new NPlot.Windows.PlotSurface2D.InteractionHandler(curve_CurveInteractionOccured);
            curve.RestoreStatusClick += new EventHandler(curve_RestoreStatusClick);

            this.mCtrCurves.Add(curve);
        }