Search code examples
wpftoolkit

DropShadow effect on pie chart


I want to do a pie chart with a DropShadow effect, so i've tried to put the effect on the PieDataPoint object but it didn't work - instead of heaving a shadow of the pie every slice of the pie draw its own shadow on its neighbors, as you can see in the image below:

enter image description here


Solution

  • Eventually I set the DropShadow effect on the EdgePanel inside the chart's template and it worked.

         <Charting:Chart.Template>
                <ControlTemplate  TargetType="Charting:Chart">
                    <Border>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
    
    
                                <chartingprimitives:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}">
                                <chartingprimitives:EdgePanel.Effect>
                                    <DropShadowEffect
                                        ShadowDepth = "5"
                                        Direction = "330"
                                        Color = "Gray"
                                        Opacity = "0.5"
                                        BlurRadius = "10">
                                    </DropShadowEffect>
                                </chartingprimitives:EdgePanel.Effect>
                            </chartingprimitives:EdgePanel>
    
                                <charting:Legend x:Name="Legend" BorderThickness="0" Grid.Row="1" HorizontalAlignment="Center"/>
    
                            </Grid>
                    </Border>
                </ControlTemplate>
            </Charting:Chart.Template>