I have a stacked bar chart. When user clicks on chart area, I want to check, which color user clicked? Example. I have RED, GREEN, Blue colored series in stacked bar. If user clicks on RED series how can i get the color name.
Regards,
Avi
7 Answers, 1 is accepted
You can use PaletteBrushes to define the custom colors for your Series (Red, Green and Blue). The PaletteBrushes collection is made so that the Series will be colored in the same order the Brushes were added to it. There is no way out-of-the-box to get the corresponding color of the Series by clicking on them. However you can find the Index of the series clicked and retrieve the corresponding brush in the PaletteBrushes collection.
Best wishes,
Evgenia
the Telerik team
Thanks for ure kind reply.
I got the solution. In ChartArea_ItemClick we can get selected color.
e.DataPoint.DataSeries.LegendLabel.
Not so out-of-the-box. But, it worked.... :):):)
Regards,
Avi
I'm glad that you managed to find a solution on your own. Let us know if there is anything else we can assist you with.
Greetings,
Evgenia
the Telerik team
In my case, the PaletteBrushes collection is empty. Is this because I'm just using the brushes provided by my theme? Anyway to access that collection?
Can you provide more details on your specific issue? Since you say that you are using "your" theme, It will be best if you open a formal support thread and send us a sample runnable project that we can inspect locally and support you further.
Regards,Evgenia
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I just meant that I'm using the default theme. In other words, I'm not using any particular theme.
I.e.: radChart.PalletBrushes is an empty collection.
Unfortunately, there is no way to extract the colors of the visual series due to the way our theming mechanism works. Here's what I'm suggesting you:
You can create Custom Palette for your chart populated with the default colors from the theme, so that you'll know exactly which color corresponds to which series.
Here are the default colors for "Office Black" theme:
<
telerikChart:RadChart
x:Name
=
"RadChart1"
>
<
telerikChart:RadChart.PaletteBrushes
>
<
SolidColorBrush
Color
=
"#FF74C0D3"
/>
<
SolidColorBrush
Color
=
"#FFE36375"
/>
<
SolidColorBrush
Color
=
"#FFECB62E"
/>
<
SolidColorBrush
Color
=
"#FF78C179"
/>
<
SolidColorBrush
Color
=
"#FFDD692A"
/>
<
SolidColorBrush
Color
=
"#FFC12A2A"
/>
<
SolidColorBrush
Color
=
"#FF3FC7CC"
/>
<
SolidColorBrush
Color
=
"#FFB4BF20"
/>
<
SolidColorBrush
Color
=
"#FF5A6378"
/>
<
SolidColorBrush
Color
=
"#FFC1C1C1"
/>
</
telerikChart:RadChart.PaletteBrushes
>
</
telerikChart:RadChart
>
Regards,
Evgenia
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.