private ContainerVisual CreateOhlcStick(ContainerVisual parentSpriteVisual, OhlcDataPoint ohlcDataPoint)
        {
            int thickness     = 2;
            var numericalPlot = ohlcDataPoint.numericalPlot;

            var boxHeight = ohlcDataPoint.layoutSlot.Height;
            var boxWidth  = ohlcDataPoint.layoutSlot.Width;

            double leftTickValue  = numericalPlot.PhysicalOpen;
            double rightTickValue = numericalPlot.PhysicalClose;
            double halfBoxWidth   = (int)(0.5 * boxWidth);

            if (parentSpriteVisual.Children.Count == 0)
            {
                this.GenerateContainerVisualChildren(parentSpriteVisual, 3);
            }

            var opacity = ohlcDataPoint.IsFalling ? 0.5 : 1;

            this.ohlcBrush.Opacity = opacity;

            this.PositionOhlcDataPointVisual(parentSpriteVisual, 0, new Vector3((float)halfBoxWidth, 0, 0), new Vector2(thickness, (float)boxHeight), this.ohlcBrush);
            this.PositionOhlcDataPointVisual(parentSpriteVisual, 1, new Vector3(0, (float)leftTickValue, 0), new Vector2((float)halfBoxWidth, thickness), this.ohlcBrush);
            this.PositionOhlcDataPointVisual(parentSpriteVisual, 2, new Vector3((float)halfBoxWidth, (float)rightTickValue, 0), new Vector2((float)halfBoxWidth, thickness), this.ohlcBrush);

            return(parentSpriteVisual);
        }
        protected override void InitializeBinding(DataPointBindingEntry binding)
        {
            OhlcDataPoint dataPoint = binding.DataPoint as OhlcDataPoint;

            if (this.highBinding != null)
            {
                object value = this.highBinding.GetValue(binding.DataItem);
                double doubleValue;
                if (NumericConverter.TryConvertToDouble(value, out doubleValue))
                {
                    dataPoint.High = doubleValue;
                }
            }

            if (this.lowBinding != null)
            {
                object value = this.lowBinding.GetValue(binding.DataItem);
                double doubleValue;
                if (NumericConverter.TryConvertToDouble(value, out doubleValue))
                {
                    dataPoint.Low = doubleValue;
                }
            }

            if (this.openBinding != null)
            {
                object value = this.openBinding.GetValue(binding.DataItem);
                double doubleValue;
                if (NumericConverter.TryConvertToDouble(value, out doubleValue))
                {
                    dataPoint.Open = doubleValue;
                }
            }

            if (this.closeBinding != null)
            {
                object value = this.closeBinding.GetValue(binding.DataItem);
                double doubleValue;
                if (NumericConverter.TryConvertToDouble(value, out doubleValue))
                {
                    dataPoint.Close = doubleValue;
                }
            }

            base.InitializeBinding(binding);
        }
        private ContainerVisual CreateCandleStick(ContainerVisual parentSpriteVisual, OhlcDataPoint ohlcDataPoint)
        {
            int thickness     = 2;
            var numericalPlot = ohlcDataPoint.numericalPlot;

            var boxHeight = ohlcDataPoint.layoutSlot.Height;
            var boxWidth  = ohlcDataPoint.layoutSlot.Width;

            double upperShadowMinValue = Math.Min(numericalPlot.PhysicalOpen, numericalPlot.PhysicalClose);
            double lowerShadowMaxValue = Math.Max(numericalPlot.PhysicalOpen, numericalPlot.PhysicalClose);
            double halfBoxWidth        = (int)(0.5 * boxWidth);

            if (parentSpriteVisual.Children.Count == 0)
            {
                this.GenerateContainerVisualChildren(parentSpriteVisual, 8);
            }

            this.PositionOhlcDataPointVisual(parentSpriteVisual, 0, new Vector3((float)halfBoxWidth, (float)upperShadowMinValue, 0), new Vector2((float)(halfBoxWidth + thickness), thickness), this.ohlcBrush);
            this.PositionOhlcDataPointVisual(parentSpriteVisual, 1, new Vector3((float)boxWidth, (float)upperShadowMinValue, 0), new Vector2(thickness, (float)(lowerShadowMaxValue - upperShadowMinValue)), this.ohlcBrush);
            this.PositionOhlcDataPointVisual(parentSpriteVisual, 2, new Vector3((float)boxWidth, (float)lowerShadowMaxValue, 0), new Vector2((float)boxWidth, thickness), this.ohlcBrush, 180);
            this.PositionOhlcDataPointVisual(parentSpriteVisual, 3, new Vector3(0, (float)lowerShadowMaxValue, 0), new Vector2(thickness, (float)(lowerShadowMaxValue - upperShadowMinValue)), this.ohlcBrush, 180);
            this.PositionOhlcDataPointVisual(parentSpriteVisual, 4, new Vector3(0, (float)upperShadowMinValue, 0), new Vector2((float)halfBoxWidth, 2), this.ohlcBrush);
            this.PositionOhlcDataPointVisual(parentSpriteVisual, 5, new Vector3((float)halfBoxWidth, 0, 0), new Vector2(thickness, (float)upperShadowMinValue), this.ohlcBrush);
            this.PositionOhlcDataPointVisual(parentSpriteVisual, 6, new Vector3((float)halfBoxWidth, (float)lowerShadowMaxValue, 0), new Vector2(thickness, (float)boxHeight - (float)lowerShadowMaxValue), this.ohlcBrush);

            var fillBrush = ohlcDataPoint.IsFalling
                ? new SolidColorBrush(Color.FromArgb(0x00, 0xFF, 0xFF, 0xFF))
                : this.telerikChartStrokeBrush;

            this.PositionOhlcDataPointVisual(parentSpriteVisual, 7, new Vector3(0, (float)upperShadowMinValue + thickness, 0), new Vector2((float)boxWidth, (float)(lowerShadowMaxValue - upperShadowMinValue - 4)), fillBrush);

            return(parentSpriteVisual);
        }