I coded like below. All other items in the list shows perfectly. But Other Category doesn't shows on the XamPieChart. Actually I don't know what's the problem.
I need to know what problem I am doing. And how to show other category with 'Label' as text mentioned in the OtherCategoryText and 'Value' as calculation of the all items stored in the other category.
This is my code:
<igD:XamDock> <ig:ItemLegend x:Name="Legend" igD:XamDock.Edge="OutsideRight" igD:XamDock.VerticalDockAlignment="Center"/> <ig:XamPieChart Name="pieChart" Grid.Row="2" ItemsSource="{StaticResource data}" LabelMemberPath="Label" ValueMemberPath="Value" OthersCategoryType="Percent" OthersCategoryText="Other" OthersCategoryThreshold="20" Legend="{Binding ElementName=Legend}" > <ig:XamPieChart.LegendItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <ContentPresenter Content="{Binding}" ContentTemplate="{Binding Series.LegendItemBadgeTemplate}"/> <TextBlock Text="{Binding Item.Label}"/> <TextBlock Text="{Binding Item.Value}"/> </StackPanel> </DataTemplate> </ig:XamPieChart.LegendItemTemplate> </ig:XamPieChart> </igD:XamDock>
Hello Mohamed,
I'm putting together a sample to try and reproduce your issue. This is going to involve setting up an environment which I can use for creating a Windows Phone application. I'm expecting to have the environment all setup tomorrow so I will provide you with an update tomorrow.
Hello Rob,
Thank you so much for the reply. I'm looking forward.
I am unable to reproduce the issue which you have described. When using your XAML to create the pie chart and given data that meets the threshold at which the 'Other' category would appear, I am able to see it in the pie chart. I have attached my Windows Phone sample demonstrating this.
Are you sure that you provided data to the pie chart which meets the threshold defined? Right now you have it set to 20. This means that any data that falls below 20 will be placed into the 'Other' category. Any data that is higher than 20 will get it's own slice.
Even me too did the same. See the output of my code and your code which is same.
I set here Threshold as type as Number and value as 50. So, the slice which has value below than 50 will fall in other category. Here in this app, we have three slices. The value of those slice were, bravo - 55, charlie - 19, alpha - 21.
value of the bravo passes the minimum threshold. so it is presented as itself in the piechart. but other two category falls in other category. Piechart correctly shows the values. but the output of the legend fails here.
Expected output of the legend is,
bravo55
other40
it only shows bravo which is not in other category and doesn't showing the other category. this is my problem.
I need to know how to overcome this issue.!
That's controlled by the LegendItemTemplate you provided the pie chart with. The template is binding to Item.Label but when the legend item is supposed to be the Others category the Item property in the PieSliceDataContext is not a DataPoint object. You should actually see some binding errors in the output window of Visual Studio.
Instead of binding to Item.Label you should bind to the ItemLabel property in the PieSliceDataContext. Since you set the LabelMemberPath, the ItemLabel property is going to use your label whenever possible and then for the Others category it will say "Others".
<ig:XamPieChart.LegendItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <ContentPresenter Content="{Binding}" ContentTemplate="{Binding Series.LegendItemBadgeTemplate}"/> <TextBlock Text="{Binding ItemLabel}"/> <TextBlock Text="{Binding Item.Value}"/> </StackPanel> </DataTemplate> </ig:XamPieChart.LegendItemTemplate>
Let me know if you have any further questions on this matter.