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
80
Change brushes of children in HierarchicalRingSeries
posted

Hello,

i am using a xamDoughnutChart with HierarchicalRingSeries. I've got 4 'parent' items (1,1,2 and 5 childs)

I managed to change the Brushes of the four parent items but I cannot change the brushes of the child items. They always keep the same colour as their parent.

XAML:

<ig:XamDoughnutChart x:Name="doughnutChart" CenterData="{Binding DoughnutTitle}" InnerExtent="35" SliceClick="DoughnutChart_SliceClick" HorizontalAlignment="Left" Margin="200,30,0,0" VerticalAlignment="Top" Height="550" Width="550" AllowSliceExplosion="True">
            <ig:XamDoughnutChart.Series>
                <ig:HierarchicalRingSeries x:Name="ringSeries"
                    ItemsSource="{Binding doughnutData, UpdateSourceTrigger=PropertyChanged, IsAsync=true}"
                    LabelMemberPath="Name"
                    ValueMemberPath="Anteil"
                    ChildrenMemberPath="Children"
                    Legend="{Binding ElementName=legende}"
                    LabelsPosition="BestFit"
                    ToolTip="{}{Name}"
                    LabelExtent="20"
                    OthersCategoryThreshold="1" Loaded="ringSeries_Loaded"
                    />
            </ig:XamDoughnutChart.Series>
        </ig:XamDoughnutChart>

Code behind

public class Category
    {
         public string Name { get; set; }
         public double Anteil { get; set; }
    }

    public class HierarchicalCategory : Category
    {
        public HierarchicalCategory()
        {
            this.Children = new Collection<HierarchicalCategory>();
        }

        public Collection<HierarchicalCategory> Children { get; private set; }
    }

doughnutData = new BindingList<HierarchicalCategory>()
            {
                new HierarchicalCategory { Name = "Item1" , Anteil = 10},
                new HierarchicalCategory { Name = "Item2", Anteil = 0 },
                new HierarchicalCategory { Name = "Item3", Anteil = 10 },
                new HierarchicalCategory { Name = "Item4", Anteil = 80 },
            };
            doughnutData[0].Children.Add(new HierarchicalCategory { Name = "Stopped", Anteil = 100 });

            doughnutData[1].Children.Add(new HierarchicalCategory { Name = "Stopped", Anteil = 100 });

            doughnutData[2].Children.Add(new HierarchicalCategory { Name = "Stopped", Anteil = 50 });
            doughnutData[2].Children.Add(new HierarchicalCategory { Name = "Error", Anteil = 50 });

            doughnutData[3].Children.Add(new HierarchicalCategory { Name = "Test1", Anteil = 10 });
            doughnutData[3].Children.Add(new HierarchicalCategory { Name = "Test2", Anteil = 70 });
            doughnutData[3].Children.Add(new HierarchicalCategory { Name = "Test3", Anteil = 10 });
            doughnutData[3].Children.Add(new HierarchicalCategory { Name = "Test4", Anteil = 10 });
            doughnutData[3].Children.Add(new HierarchicalCategory { Name = "Test5", Anteil = 5 });

         private void UpdateColors()
        {
            var items = doughnutData;

            if (items == null) return;

            var brushes = new BrushCollection();
            
            foreach (var item in items)
            {
                    brush = ...
                //Do some stuff to determine colour and ignore items with value < threshold
                    brush = ...
                    
                brushes.Add(brush);                
            }
             ringSeries.Brushes = brushes;
             OnPropertyChanged("doughnutData");
        }

The first 4 Brushes added match to the 4 parent items. Brushes 5-13 don't have any effect.

Thanks for your support

Parents
No Data
Reply
  • 460
    Offline posted

    Hello,

    After investigating your inquiry further and doing some research, this has been determined to be a new product idea. You can suggest new product ideas for future versions (or vote for existing ones) at http://ideas.infragistics.com.
    Submitting your idea will allow you to communicate directly with our product management team, track the progress of your idea at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
    Remember when submitting your idea to explain the context in which a feature would be used and why it is needed as well as anything that would prevent you from accomplishing this today. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it.  You can also link back to this thread for additional details.
    Thank you in advance to submitting your product idea.

    You may have a look at this blog post that describes how to achieve your requirements using the RingSeries:
    http://ko.infragistics.com/community/blogs/marina_stoyanova/archive/2013/10/24/how-to-build-xaml-doughnut-chart.aspx

    Hope that helps!


    Best Regards,
    Nelly Tacheva
    Infragistics, Inc.

Children
No Data