Example #1
0
        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);
        }
Example #2
0
        internal override void SetValueFromAxis(AxisModel axis, object value)
        {
            // ChartSeries labels rely on isPositive to flip alignment, so isPositive is set to true by default
            this.isPositive = true;

            if (axis is NumericalAxisModel)
            {
                this.numericalPlot      = value as NumericalAxisOhlcPlotInfo;
                this.isInNumericalRange = true;
            }
            else if (axis is CategoricalAxisModel || axis is DateTimeContinuousAxisModel)
            {
                this.categoricalPlot      = value as CategoricalAxisPlotInfo;
                this.isInCategoricalRange = true;
            }
        }