Click here to Skip to main content
15,887,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to pick a colorset for the colorsets to use in a graph, so that everygraph would have a different color. any help would be appreciated, and maybe an alternative solution to it.

this is the code:
C#
ColorSet ct = new ColorSet();
                          ct.Id = "MyColorSet";
                          ct.Brushes.Add(new SolidColorBrush(Colors.Blue));

                          ColorSet ct2 = new ColorSet();
                          ct.Id = "MyColorSet2";
                          ct2.Brushes.Add(new SolidColorBrush(Colors.Brown));

                          ColorSet ct3 = new ColorSet();
                          ct.Id = "MyColorSet3";
                          ct3.Brushes.Add(new SolidColorBrush(Colors.Cyan));

                          ColorSet ct4 = new ColorSet();
                          ct.Id = "MyColorSet4";
                          ct4.Brushes.Add(new SolidColorBrush(Colors.DarkGray));

                          ColorSet ct5 = new ColorSet();
                          ct.Id = "MyColorSet5";
                          ct5.Brushes.Add(new SolidColorBrush(Colors.Gray));

                          ColorSet ct6 = new ColorSet();
                          ct.Id = "MyColorSet6";
                          ct6.Brushes.Add(new SolidColorBrush(Colors.Green));

                          // Create new instance of ColorSets class
                          chart.ColorSets = new ColorSets();

                          // Add ColorSet to ColorSets collection
                          chart.ColorSets.Add(ct);
                          chart.ColorSets.Add(ct2);
                          chart.ColorSets.Add(ct3);
                          chart.ColorSets.Add(ct4);
                          chart.ColorSets.Add(ct5);
                          chart.ColorSets.Add(ct6);


                          // Set ColorSet to chart
                          chart.ColorSet = "MyColorSet";
Posted

1 solution

Hi,

Another solution you can try: WPF - ColorSet

Kind regards,
 
Share this answer
 

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