コード例 #1
0
        // Yscale value calc
        private double Y_ScaleValueCalc(ExtremumValue _extremumValue, Size _sizeCharts)
        {
            double scale = _sizeCharts.Height;
            double delta = _extremumValue.Max - _extremumValue.Min;

            if (delta > 0)
            {
                scale = _sizeCharts.Height / delta;
            }
            return(scale);
        }
コード例 #2
0
        // min value calc
        private bool MinCalc(InitialValue _currentValue, ref ExtremumValue _extremumValue)
        {
            if (_extremumValue.Min == double.MaxValue)
            {
                _extremumValue.Min = _currentValue.Value;
            }
            else
            {
                if (_currentValue.Value < _extremumValue.Min)
                {
                    _extremumValue.Min = _currentValue.Value;
                    return(true);
                }
            }

            return(false);
        }
コード例 #3
0
        //----------------------------------------------------------

        // обрезаем данные по Х с перемасшбированием по 2-м осям
        private void TrimmingData_X(CollectionGraphicElementsChart _chartElements, InitialDataChartList _initialDataChartList, Size _sizeChart, Action <Rectangle, double> _setBottomAction, ref ScaleValue _scaleValue, ref ExtremumValue _extremumValue, ref double _countElement)
        {
            if (_countElement > SettingsCharts.maxCountValueCharts.Count)
            {
                dispatcher.Invoke(() =>
                {
                    for (int i = 0; i < SettingsCharts.countDelete.Count; i++)
                    {
                        _chartElements.RemoveAt(0);
                    }
                });

                _initialDataChartList.RemoveRange(0, SettingsCharts.countDelete.Count);

                _countElement = _chartElements.Count;

                //_extremumValue.Min = _initialDataChartList.Min(x => x.Value);
                //_extremumValue.Max = _initialDataChartList.Max(x => x.Value);

                _extremumValue = new ExtremumValue(_initialDataChartList.Min(x => x.Value), _initialDataChartList.Max(x => x.Value));

                _scaleValue.Y_scale = Y_ScaleValueCalc(_extremumValue, _sizeChart);

                double     countElem = _countElement;
                double     y_scl     = _scaleValue.Y_scale;
                double     minVal    = _extremumValue.Min;
                ScaleValue scalval   = _scaleValue;
                dispatcher.Invoke(() =>
                {
                    for (int i = 0; i < countElem; i++)
                    {
                        _setBottomAction(_chartElements[i], Y_Set(_initialDataChartList[i], minVal, y_scl));
                        Canvas.SetLeft(_chartElements[i], X_Set(i, scalval.X_scale));
                    }
                }, DispatcherPriority.Background);
            }
        }
コード例 #4
0
        //-------

        // автомасштабирование по оси У
        private void ScaleChart_Y(ChangeMinMax _changeMinMax, double _countValueChart, CollectionGraphicElementsChart _collectionGraphicElementsChart, InitialDataChartList _initialDataChartList, ExtremumValue _extremumValue, ScaleValue _scaleValue, Action <Rectangle, InitialValue, double, double> _scaleYTypeAction)
        {
            if (_changeMinMax.ChangeMin | _changeMinMax.ChangeMax)
            {
                dispatcher.Invoke(() =>
                {
                    for (int i = 0; i < _countValueChart; i++)
                    {
                        _scaleYTypeAction(_collectionGraphicElementsChart[i], _initialDataChartList[i], _extremumValue.Min, _scaleValue.Y_scale);
                    }
                });
            }
        }
コード例 #5
0
 // default  min/max price/position set
 private void DefaultMinMaxSet()
 {
     extremumInitialeValue = new ExtremumValue(double.MaxValue, double.MinValue);
 }