Exemplo n.º 1
0
        /// <summary>
        /// Apply shadow for PlotArea
        /// </summary>
        internal void ApplyShadow(Size plotAreaViewPortSize, Double plankOffset, Double plankDepth, Double plankThickness)
        {
            Chart._plotAreaShadowCanvas.Children.Clear();
            Chart._drawingCanvas.Children.Remove(InnerShadowGrid);
            Chart chart = Chart as Chart;
            Size clipSize;

            if (chart.PlotArea.ShadowEnabled)
            {
                if (chart.PlotDetails.ChartOrientation == ChartOrientationType.NoAxis)
                {
                    ShadowGrid = ExtendedGraphics.Get2DRectangleShadow(this, BorderElement.Width + Visifire.Charts.Chart.SHADOW_DEPTH
                    , BorderElement.Height + Visifire.Charts.Chart.SHADOW_DEPTH
                    , CornerRadius
                    , CornerRadius, 6);

                    clipSize = new Size(ShadowGrid.Width, ShadowGrid.Height);
                }
                else
                {
                    if (chart.View3D)
                    {
                        if (chart.PlotDetails.ChartOrientation == ChartOrientationType.Horizontal)
                        {
                            ShadowGrid = ExtendedGraphics.Get2DRectangleShadow(this, plotAreaViewPortSize.Width + Visifire.Charts.Chart.SHADOW_DEPTH - plankThickness - plankDepth - ChartArea.SCROLLVIEWER_OFFSET4HORIZONTAL_CHART
                            , plotAreaViewPortSize.Height - plankDepth + Visifire.Charts.Chart.SHADOW_DEPTH
                            , CornerRadius
                            , CornerRadius, 6);
                            clipSize = new Size(ShadowGrid.Width, ShadowGrid.Height + Visifire.Charts.Chart.SHADOW_DEPTH);

                            ShadowGrid.SetValue(Canvas.LeftProperty, plankOffset);

                            InnerShadowGrid = ExtendedGraphics.Get2DRectangleShadow(this, plotAreaViewPortSize.Width + Visifire.Charts.Chart.SHADOW_DEPTH - plankThickness - plankDepth - ChartArea.SCROLLVIEWER_OFFSET4HORIZONTAL_CHART
                           , BorderElement.Height + Visifire.Charts.Chart.SHADOW_DEPTH
                           , CornerRadius
                           , CornerRadius, 6);
                            InnerShadowGrid.Clip = GetShadowClip(new Size(InnerShadowGrid.Width + Visifire.Charts.Chart.SHADOW_DEPTH, InnerShadowGrid.Height));
                            InnerShadowGrid.SetValue(Canvas.LeftProperty, plankOffset);
                            Chart._drawingCanvas.Children.Add(InnerShadowGrid);
                        }
                        else
                        {
                            ShadowGrid = ExtendedGraphics.Get2DRectangleShadow(this, plotAreaViewPortSize.Width + Visifire.Charts.Chart.SHADOW_DEPTH - plankThickness - plankDepth
                                                   , plotAreaViewPortSize.Height + Visifire.Charts.Chart.SHADOW_DEPTH - plankOffset
                                                   , CornerRadius
                                                   , CornerRadius, 6);
                            clipSize = new Size(ShadowGrid.Width, ShadowGrid.Height);
                            ShadowGrid.SetValue(Canvas.LeftProperty, plankOffset);
                        }
                    }
                    else
                    {
                        ShadowGrid = ExtendedGraphics.Get2DRectangleShadow(this, plotAreaViewPortSize.Width + Charts.Chart.SHADOW_DEPTH
                            , plotAreaViewPortSize.Height - plankOffset + Visifire.Charts.Chart.SHADOW_DEPTH, CornerRadius
                            , CornerRadius
                            , 6);

                        clipSize = new Size(ShadowGrid.Width, ShadowGrid.Height);
                    }
                }

                ShadowGrid.Clip = GetShadowClip(clipSize);

                ShadowGrid.IsHitTestVisible = false;
                Chart._plotAreaShadowCanvas.Children.Add(ShadowGrid);
                ShadowGrid.UpdateLayout();
            }
        }