We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Pie Chart Questions

Hi Syncfusion team,

 

I was wondering what would cause a Pie Chart to show as only a semi circle? It has only happened since upgrading to the 11.4.0.26 version. I've also copied the xaml out to a new project and that works perfectly, so I'm not sure what might be causing it.

 

Also, I was wondering if there is some way to bind the colours of the pie slices to something on the series itself? I'm hoping to use a few different controls using the same data and I would like the colours to line up per item (I want these colours to be chosen by the user per item so that they can tell just by colour what they are looking at).

 

Thanks for the help,

Regards,

Chris McHugh (@MagooChris)


3 Replies

MK Magesh Kumar Krishnan Syncfusion Team May 30, 2014 08:48 AM UTC

Hi MagooChris          

Thanks for using Syncfusion products.

Query 1: I was wondering what would cause a Pie Chart to show as only a semi circle? 

We have analyzed the reported issue and we are not able to reproduce issue. If possible can you share your sample or code snippet with screen shot of your sample with us, which would be much appreciable?

Query2: if there is some way to bind the colours of the pie slices to something on the series itself? 

You can achieve your requirement by using custom palette of Pie Chart series as shown in the below code snippet

Code snippet[Xaml]:

 <chart:PieSeries.ColorModel>
                    <chart:ChartColorModel>
                        <chart:ChartColorModel.CustomBrushes>
                            <SolidColorBrush Color="SkyBlue"></SolidColorBrush>
                            <SolidColorBrush Color="Gray"></SolidColorBrush>
                            <SolidColorBrush Color="Olive"></SolidColorBrush>
                            <SolidColorBrush Color="Violet"></SolidColorBrush>
                            <SolidColorBrush Color="Silver"></SolidColorBrush>
                            <SolidColorBrush Color="SaddleBrown"></SolidColorBrush>
                        </chart:ChartColorModel.CustomBrushes>
                    </chart:ChartColorModel>
                </chart:PieSeries.ColorModel> 

We have prepared the sample based on your requirement. Please find the  attached sample. 

Please let us know if you require further assistance on this.


Regards,

Magesh Kumar K


Attachment: Sample_707f9317.zip


MA MagooChris June 5, 2014 07:03 AM UTC

Hi Magesh Kumar K,

Thank you for the reply. I've copied my code outside of the app I'm working on and the pie chart seems to be fine there, I will do some more investigating, but it seems that it's something else on the page or maybe with my bindings that is causing the problem...

 

Also with Question 2, the code you have given here does not use bindings in any way. I need to be able to bind the colour of the pie chart segment to the data that it represents as the user will pick those colours and I will have no control in which order the data is placed in. Is there a way to do this with Data Binding to the item source not hard coded colour pallet?

 

Regards,

Chris McHugh



MA Mohammed Azarudeen Syncfusion Team June 6, 2014 11:48 AM UTC

Hi MagooChris,

 

We have analyzed your requirement and you  are  able to bind the colors value(custom brush colors) to ColorModel property of Pie series as shown the below code snippet.

 

CodeSnippet[C#]:

  

<chart:PieSeries  Palette="Custom"  x:Name="pieSeries" ColorModel="{Binding CustomBrush, Converter={StaticResource converter}}" ItemsSource="{Binding Data}"  XBindingPath="Country" YBindingPath="Count">

 

 

We have prepared a sample based on your requirement. Please find the sample under the following location

 

Regards,

Mohammed Azarudeen.


Attachment: PiechartColorBinding_c6043ff5.zip

Loader.
Live Chat Icon For mobile
Up arrow icon