Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have to display the independent values in the tooltip along with dependent values in pie chart but when i add the code mentioned below the background color gets changed to a single color. I want to display the piechart without effecting the default background color.

What I have tried:

<chartingToolkit:Chart  Name="PieChart1" Title="Department" Width="425" VerticalAlignment="Top" Margin="521,317,0,0" Height="262" HorizontalAlignment="Left">
               <chartingToolkit:PieSeries DependentValuePath="Value" IndependentValuePath="Key" ItemsSource="{Binding}" IsSelectionEnabled="True">
                   <chartingToolkit:PieSeries.DataPointStyle>
                       <Style TargetType="chartingToolkit:PieDataPoint">
                           <Setter Property="Template">
                               <Setter.Value>
                                   <ControlTemplate TargetType="chartingToolkit:PieDataPoint">
                                       <Grid>
                                           <Path Data="{TemplateBinding Geometry}"  Stroke="{TemplateBinding BorderBrush}"  StrokeMiterLimit="1" Fill="{TemplateBinding Background}">
                                               <ToolTipService.ToolTip>
                                                   <StackPanel>
                                                       <ContentControl Content="{Binding Key}"/>
                                                       <ContentControl Content="{TemplateBinding FormattedDependentValue}"/>
                                                       <ContentControl Content="{TemplateBinding FormattedRatio}"/>
                                                   </StackPanel>
                                               </ToolTipService.ToolTip>
                                           </Path>
                                       </Grid>
                                   </ControlTemplate>
                               </Setter.Value>
                           </Setter>
                       </Style>
                   </chartingToolkit:PieSeries.DataPointStyle>
               </chartingToolkit:PieSeries>
           </chartingToolkit:Chart>
Posted
Updated 20-Sep-17 19:12pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900