private void MakeMalformation(Phenomenon index, CurvesDataManager data, int curveIndex) { const int Y_VALUES_INDEX = 0; Series series = data.ModifiedCurves[curveIndex]; int pointsNo = series.Points.Count; double valuesInterval = SeriesAssist.GetValuesInterval(series, Y_VALUES_INDEX); switch (index) { case Phenomenon.Peek: SeriesAssist.OverrideValue(series, Convert.ToInt32((1.0 / 4.0) * pointsNo), -(1.0 / 2.0) * valuesInterval, Y_VALUES_INDEX); SeriesAssist.OverrideValue(series, Convert.ToInt32((1.0 / 3.0) * pointsNo), (1.0 / 5.0) * valuesInterval, Y_VALUES_INDEX); SeriesAssist.OverrideValue(series, Convert.ToInt32((1.0 / 2.0) * pointsNo), (1.0 / 2.0) * valuesInterval, Y_VALUES_INDEX); SeriesAssist.OverrideValue(series, Convert.ToInt32((2.0 / 3.0) * pointsNo), -(1.0 / 5.0) * valuesInterval, Y_VALUES_INDEX); SeriesAssist.OverrideValue(series, Convert.ToInt32((3.0 / 4.0) * pointsNo), (1.0 / 2.0) * valuesInterval, Y_VALUES_INDEX); break; case Phenomenon.Saturation: int leftPoint = Convert.ToInt32((4.0 / 11.0) * pointsNo); int rightPoint = Convert.ToInt32((8.0 / 11.0) * pointsNo); SeriesAssist.OverrideValues(series, leftPoint, rightPoint, (3.0 / 11.0) * valuesInterval, Y_VALUES_INDEX); break; } data.AlterCurve(series, DataSetCurveType.Modified, curveIndex); }
private void OnSaveClick(object sender, EventArgs e) { IList <double> values = Lists.Cast <object, double>(GridAssist.GetColumnValues(uiGrid_db_grid, y.HeaderText)); if (!SeriesAssist.IsChartAcceptable(values)) { log.Info(MethodBase.GetCurrentMethod().Name + '(' + PanelStateInformation.OperationRevoked + ')'); UpdateUiByPanelStateInfo(PanelStateInformation.OperationRevoked); AppMessages.GridPreviewer.ErrorOfInvalidCurvePoints(); return; } SeriesAssist.OverrideValues(Curve, values); UpdateUiByPanelStateInfo(PanelStateInformation.ChangesSaved); log.Info(MethodBase.GetCurrentMethod().Name + '(' + PanelStateInformation.ChangesSaved + ')'); }