示例#1
0
        public void AdjustCurve(int position, NumericUpDownDirectionType direction)
        {
            // Configure
            const int changeFullSize  = 47;                        // Spread of values affected
            const int changeSideSize  = 23;                        // Number of values either side of centre
            const int changeMagnitude = 100;                       // The change in size of the peak/trough from the centre
            var       lowerIndex      = position - changeSideSize; // Lower index
            var       higherIndex     = position + changeSideSize; // Higher index

            // Calculate changes to apply to curve
            var curveValues = GenerateCurve(changeMagnitude, changeFullSize);

            // Apply change in curve to hidden series
            var hiddenSeries = _chart.Series.FindByName("Hidden");

            for (var i = lowerIndex; i < higherIndex; i++)
            {
                if ((i >= 0) && (i < 120))
                {
                    switch (direction)
                    {
                    case NumericUpDownDirectionType.Up:
                        hiddenSeries.Points[i].YValues[0] += curveValues[i - lowerIndex];
                        break;

                    case NumericUpDownDirectionType.Down:
                        hiddenSeries.Points[i].YValues[0] -= curveValues[i - lowerIndex];
                        break;
                    }

                    // Ensure value is kept within bounds
                    hiddenSeries.Points[i].YValues[0] = CorrectValueIfOutsideBounds(hiddenSeries.Points[i].YValues[0]);
                }
            }

            GenerateProposedSeriesFromHiddenSeries();
        }
示例#2
0
 public void PerformanceCurveChart_AdjustCurve(int position, NumericUpDownDirectionType direction)
 {
     _performanceCurveChart.AdjustCurve(position, direction);
 }