3 Answers, 1 is accepted
Hello Yasir,
Thank you for the question.
You can take a look at this article from our online documentation that demonstrates how to create a custom palette. By default the palette applies on a per series basis.
If you use BarSeries and you want to apply a palette on a per data point basis, you have to set the BarSeries.PaletteMode property to DataPoint.
You may also use the PaletteIndex property of the ChartSeries to further customize the way the colors of the palette apply to the series. This property specifies the index of the color in the palette that will be used by the series.
I hope this was useful and do not hesitate to contact us if you have further questions.
Regards,Rositsa Topchiyska
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Hi Yasir,
In addition to my previous answer I have two more suggestions:
-
If you have point type series:
Through the Style property of the generated series you can set the PointTemplate property and via a value converter you can generate a color that depends on the specific data point and series. In the converter you will receive a CategoricalDataPoint/ScatterDataPoint/OhlcDataPoint as a context depending on the series type. Here is an example:<telerikChart:ChartSeriesProvider.SeriesDescrtiptors><telerikChart:CategoricalSeriesDescriptorValuePath="Value"CategoryPath="Category"><telerikChart:CategoricalSeriesDescriptor.Style><StyleTargetType="telerikChart:BarSeries"><SetterProperty="CombineMode"Value="Cluster"/><SetterProperty="PointTemplate"><Setter.Value><DataTemplate><RectangleFill="{Binding Converter={StaticResource converter}}"Margin="2,0,2,0"/></DataTemplate></Setter.Value></Setter></Style></telerikChart:CategoricalSeriesDescriptor.Style></telerikChart:CategoricalSeriesDescriptor></telerikChart:ChartSeriesProvider.SeriesDescriptors> - If all previous suggestions do not fulfill your requirements, you can implement a custom series descriptor that inherits from the CategoricalSeriesDescriptor class and overrides the CreateInstanceCore method where you can set a style to the generated series. I have attached a sample project that demonstrates how to do that.
Regards,
Rositsa Topchiyska
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.