Articles in this section
Category / Section

How to define the fill color for each datapoint in WPF Chart (SfChart)?

1 min read

Description

 

The WPF SfChart provides an option to assign custom fill colors to each data point in a chart series in a specified order using the ColorModel property. You can define your own custom color palette for the series by setting the CustomBrushes collection as shown in the below code example.

C#

Viewmodel view = new Viewmodel();
ColumnSeries columnSeries = new ColumnSeries();
columnSeries.ItemsSource = view.SneakersDetail;
columnSeries.XBindingPath = "Brand";
columnSeries.YBindingPath = "No_Of_Items";
columnSeries.Palette = ChartColorPalette.Custom;
//Adding colorModel to the series 
ChartColorModel colorModel = new ChartColorModel();
foreach (var item in view.SneakersDetail)
    view.SeriesColor.Add(item.SegmentColor);
colorModel.CustomBrushes = view.SeriesColor;
columnSeries.ColorModel = colorModel;

Output


WPF Chart with Custom Palette Color


Conclusion

I hope you enjoyed learning about how to vary the custom shapes in WPF Chart.

You can refer to our WPF Chart feature tour page to know about its other groundbreaking feature representations. You can also explore our WPF Chart documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied