private NumericalAxisOhlcPlotInfo CreateAxisOhlcPlotInfo(double delta, Ohlc value)
        {
            NumericalAxisOhlcPlotInfo plotInfo;
            double normalizedHigh, normalizedLow, normalizedOpen, normalizedClose;

            if (delta == 0)
            {
                normalizedHigh  = 0;
                normalizedLow   = 0;
                normalizedOpen  = 0;
                normalizedClose = 0;
            }
            else
            {
                normalizedHigh  = (value.High - this.actualRange.minimum) / delta;
                normalizedLow   = (value.Low - this.actualRange.minimum) / delta;
                normalizedOpen  = (value.Open - this.actualRange.minimum) / delta;
                normalizedClose = (value.Close - this.actualRange.minimum) / delta;
            }

            plotInfo = NumericalAxisOhlcPlotInfo.Create(this, this.normalizedOrigin, normalizedHigh, normalizedLow, normalizedOpen, normalizedClose, this.normalizedOrigin);
            plotInfo.SnapTickIndex      = this.GetSnapTickIndex(value.High);
            plotInfo.SnapBaseTickIndex  = this.GetSnapTickIndex(value.Low);
            plotInfo.SnapOpenTickIndex  = this.GetSnapTickIndex(value.Open);
            plotInfo.SnapCloseTickIndex = this.GetSnapTickIndex(value.Close);

            return(plotInfo);
        }
        private void PlotNormal(IEnumerable <ChartSeriesModel> series)
        {
            double delta = this.actualRange.maximum - this.actualRange.minimum;
            object value, transformedValue;
            NumericalAxisPlotInfoBase plotInfo;

            // update points values
            foreach (ChartSeriesModel model in series)
            {
                if (!model.presenter.IsVisible)
                {
                    continue;
                }

                foreach (DataPoint point in model.DataPointsInternal)
                {
                    if (point.isEmpty)
                    {
                        continue;
                    }

                    value            = point.GetValueForAxis(this);
                    transformedValue = this.TransformValue(value);

                    if (transformedValue is double)
                    {
                        double doubleValue = (double)transformedValue;

                        // TODO: Remove insignificant datapoints from drawing stack.
                        if (double.IsNaN(doubleValue))
                        {
                            plotInfo = null;
                        }
                        else
                        {
                            plotInfo = this.CreateAxisPlotInfo(delta, doubleValue);
                        }
                    }
                    else if (transformedValue is Ohlc)
                    {
                        Ohlc ohlcValue = (Ohlc)transformedValue;
                        plotInfo = this.CreateAxisOhlcPlotInfo(delta, ohlcValue);
                    }
                    else if (transformedValue is Range)
                    {
                        Range rangeValue = (Range)transformedValue;
                        plotInfo = this.CreateAxisRangePlotInfo(delta, rangeValue);
                    }
                    else
                    {
                        continue;
                    }

                    point.SetValueFromAxis(this, plotInfo);
                }
            }
        }
        internal override Ohlc TransformValue(Ohlc value)
        {
            Ohlc result = new Ohlc();

            result.High  = this.TransformValue(value.High);
            result.Low   = this.TransformValue(value.Low);
            result.Open  = this.TransformValue(value.Open);
            result.Close = this.TransformValue(value.Close);

            return(result);
        }
        private static ValueRange <double> AdjustRange(Ohlc value, ValueRange <double> range)
        {
            double high = value.High;
            double low  = value.Low;

            if (high > range.maximum)
            {
                range.maximum = high;
            }
            if (low < range.minimum)
            {
                range.minimum = low;
            }

            return(range);
        }
 internal virtual Ohlc TransformValue(Ohlc value)
 {
     return(value);
 }