/// <summary>
        /// ApplyOrRemoveShadow
        /// </summary>
        /// <param name="dataPoint">DataPoint</param>
        internal static void ApplyOrRemoveShadow(DataPoint dataPoint, Double dataPointWidth)
        {
            Canvas dataPointVisual = dataPoint.Faces.Visual as Canvas;

            if (!VisifireControl.IsMediaEffectsEnabled)
            {
                Faces     faces         = dataPoint.Faces;
                Rectangle openCloseRect = faces.VisualComponents[1] as Rectangle;

                dataPoint.Faces.ClearList(ref faces.ShadowElements);

                if ((Boolean)dataPoint.ShadowEnabled)
                {
                    // Shadow for line
                    Line highLowShadowLine = new Line()
                    {
                        IsHitTestVisible = false,
                        X1              = dataPointVisual.Width / 2 + _shadowDepth,
                        X2              = dataPointVisual.Width / 2 + _shadowDepth,
                        Y1              = 0,
                        Y2              = Math.Max(dataPointVisual.Height - _shadowDepth, 1),
                        Stroke          = _shadowColor,
                        StrokeThickness = GetStrokeThickness(dataPoint, dataPointWidth),
                        StrokeDashArray = Graphics.LineStyleToStrokeDashArray(dataPoint.BorderStyle.ToString())
                    };

                    highLowShadowLine.SetValue(Canvas.ZIndexProperty, -4);
                    highLowShadowLine.SetValue(Canvas.TopProperty, _shadowDepth);

                    // Shadow for Rectangle
                    Rectangle openCloseShadowRect = new Rectangle()
                    {
                        IsHitTestVisible = false,
                        Fill             = _shadowColor,
                        Width            = dataPointWidth,
                        Height           = openCloseRect.Height,
                        Stroke           = _shadowColor,
                        StrokeThickness  = dataPoint.BorderThickness.Left,
                        StrokeDashArray  = Graphics.LineStyleToStrokeDashArray(dataPoint.BorderStyle.ToString())
                    };

                    openCloseShadowRect.SetValue(Canvas.TopProperty, (Double)openCloseRect.GetValue(Canvas.TopProperty) + _shadowDepth);
                    openCloseShadowRect.SetValue(Canvas.LeftProperty, (Double)openCloseRect.GetValue(Canvas.LeftProperty) + _shadowDepth);
                    openCloseShadowRect.SetValue(Canvas.ZIndexProperty, -4);

                    // Add elements into the list of Shadow Elements
                    faces.ShadowElements.Add(highLowShadowLine);
                    faces.ShadowElements.Add(openCloseShadowRect);

                    // Added to DataPoint visual Canvas
                    dataPointVisual.Children.Add(openCloseShadowRect);
                    dataPointVisual.Children.Add(highLowShadowLine);
                }
            }
            else
            {
#if !WP
                if ((Boolean)dataPoint.ShadowEnabled)
                {
                    dataPointVisual.Effect = ExtendedGraphics.GetShadowEffect(315, 5, 0.95);
                }
                else
                {
                    dataPointVisual.Effect = null;
                }
#endif
            }
        }
Exemple #2
0
        private static void ApplyOrUpdateShadow(DataPoint dataPoint, Canvas dataPointVisual, Line highLow, Line openLine, Line closeLine, Double dataPointWidth)
        {
            #region Apply Shadow

            if (!VisifireControl.IsMediaEffectsEnabled)
            {
                Faces dpFaces = dataPoint.Faces;

                dpFaces.ClearList(ref dpFaces.ShadowElements);

                if (dataPoint.ShadowEnabled == true)
                {
                    // Create High and Low Line
                    Line highLowShadow = new Line()
                    {
                        IsHitTestVisible = false,
                        X1              = dataPointVisual.Width / 2 + CandleStick._shadowDepth,
                        X2              = dataPointVisual.Width / 2 + CandleStick._shadowDepth,
                        Y1              = 0 + CandleStick._shadowDepth,
                        Y2              = dataPointVisual.Height + CandleStick._shadowDepth,
                        Stroke          = CandleStick._shadowColor,
                        StrokeThickness = (Double)dataPoint.BorderThickness.Left,
                        StrokeDashArray = Graphics.LineStyleToStrokeDashArray(dataPoint.BorderStyle.ToString())
                    };

                    // Create Open Line
                    Line openShadowLine = new Line()
                    {
                        IsHitTestVisible = false,
                        X1              = openLine.X1 + CandleStick._shadowDepth,
                        X2              = openLine.X2 + CandleStick._shadowDepth,
                        Y1              = openLine.Y1 + CandleStick._shadowDepth,
                        Y2              = openLine.Y2 + CandleStick._shadowDepth,
                        Stroke          = CandleStick._shadowColor,
                        StrokeThickness = (Double)dataPoint.BorderThickness.Left,
                        StrokeDashArray = Graphics.LineStyleToStrokeDashArray(dataPoint.BorderStyle.ToString())
                    };

                    // Create Close Line
                    Line closeShadowLine = new Line()
                    {
                        IsHitTestVisible = false,
                        X1 = closeLine.X1 + CandleStick._shadowDepth,
                        X2 = closeLine.X2 + CandleStick._shadowDepth,
                        Y1 = closeLine.Y1 + CandleStick._shadowDepth,
                        Y2 = closeLine.Y2 + CandleStick._shadowDepth,

                        Stroke          = CandleStick._shadowColor,
                        StrokeThickness = (Double)dataPoint.BorderThickness.Left,
                        StrokeDashArray = Graphics.LineStyleToStrokeDashArray(dataPoint.BorderStyle.ToString())
                    };

                    // Add shadow elements to list of shadow elements
                    dpFaces.ShadowElements.Add(highLowShadow);
                    dpFaces.ShadowElements.Add(openShadowLine);
                    dpFaces.ShadowElements.Add(closeShadowLine);

                    // Add shadows
                    dataPointVisual.Children.Add(highLowShadow);
                    dataPointVisual.Children.Add(openShadowLine);
                    dataPointVisual.Children.Add(closeShadowLine);
                }
            }
            else
            {
#if !WP
                if ((Boolean)dataPoint.ShadowEnabled)
                {
                    dataPointVisual.Effect = ExtendedGraphics.GetShadowEffect(315, 4, 0.95);
                }
                else
                {
                    dataPointVisual.Effect = null;
                }
#endif
            }
            #endregion
        }