Beispiel #1
0
        private void InitializeCurve()
        {
            this.chartControlCurve.Clear();
            this.chartControlCurve.AddCurve(new Curve
            {
                Id       = this.id,
                Points   = CopyUtil.DeepCopyBaseOnJSon(this.Curve.Data.Points),
                DisColor = this.id == PWR_CURVE_ID ? Color.Red: Color.Blue,
                Pattern  = this.Curve.Data.Pattern
            });

            string xLegend = null;
            string yLegend = null;
            double xMax    = 0;
            double yMax    = 0;

            bool showAbs = this.Curve.ShowAbs;

            if (showAbs)
            {
                string str1 = this.Curve.SpeedUnit.GetDescription();
                xLegend      = $"Speed({str1})";
                yLegend      = this.id == PWR_CURVE_ID ? "Power(W)" : "Frequency(Hz)";
                xMax         = double.Parse(SpeedUnitConverter.Convert(this.Curve.Speed));
                yMax         = Constants.MaxPower * this.Curve.PowerPercentage / 100.0;
                this.xSuffix = str1;
                this.ySuffix = this.id == PWR_CURVE_ID ? "W" : "Hz";
            }
            else
            {
                xLegend      = "Speed(%)";
                yLegend      = this.id == PWR_CURVE_ID ? "Power(%)" : "Frequency(%)";
                xMax         = 100;
                yMax         = 100;
                this.xSuffix = "%";
                this.ySuffix = "%";
            }

            this.chartControlCurve.XLengend = xLegend;
            this.chartControlCurve.YLengend = yLegend;
            this.chartControlCurve.XMax     = xMax;
            this.chartControlCurve.YMax     = yMax;

            this.UpdateDGV();
            this.checkAbs.Checked            = showAbs;
            this.cmbPatternPwr.SelectedIndex = (int)this.Curve.Data.Pattern;

            if (this.id == PWR_CURVE_ID)
            {
                this.dgvCurve.Columns[1].HeaderText = "Power";
            }
            else
            {
                this.dgvCurve.Columns[1].HeaderText = "Frequency";
            }
        }
Beispiel #2
0
        private void btnCopy_Click(object sender, EventArgs e)
        {
            int index = this.tabControlEditor.SelectedTabPageIndex;

            if (index == 0)
            {
                this.FreqData.Data.Points = CopyUtil.DeepCopyBaseOnJSon(this.PwrData.Data.Points);
                this.freComponent?.UpdateCurveData(this.FreqData);
            }
            else
            {
                this.PwrData.Data.Points = CopyUtil.DeepCopyBaseOnJSon(this.FreqData.Data.Points);
                this.pwrComponent?.UpdateCurveData(this.PwrData);
            }
        }