Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
XamPieChart Brushes being chosen randomly?
posted

I'm instantiating multiple XamPieCharts with identical data, and different colors get assigned seemingly at random.  How do I specify that I want a certain value pair assigned to a certain brush in the Brushes collection?  I really need to control the colors ....

Casey

 

Parents
No Data
Reply
  • 28407
    posted

    HI Casey,

     You can define the colors of the slices in the Brushes collection.

     Here is a code snippet

    <ig:XamPieChart Name="pieChart"
                            Grid.Row="2"
                            ItemsSource="{Binding PieData }"
                            LabelMemberPath="Label"
                            ValueMemberPath="Value"
                            ToolTip="{}{Label}"
                          
                            Legend="{Binding ElementName=Legend}">
                <ig:XamPieChart.Brushes>
                    <ig:BrushCollection>
                  <SolidColorBrush>Red</SolidColorBrush>
                    <SolidColorBrush>Yellow</SolidColorBrush>
                    <SolidColorBrush>blue</SolidColorBrush>
                    <SolidColorBrush>Green</SolidColorBrush>
                    <SolidColorBrush>Orange</SolidColorBrush>
                    <SolidColorBrush>Violet</SolidColorBrush>
                    </ig:BrushCollection>
                </ig:XamPieChart.Brushe

     Sincerely,
     Matt
     Developer Support Engineer

Children