This is a migrated thread and some comments may be shown as answers.

Click event on Stacked Bar

7 Answers 123 Views
Chart
This is a migrated thread and some comments may be shown as answers.
avinash
Top achievements
Rank 1
avinash asked on 14 Jun 2011, 08:12 AM
Hi,

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

Sort by
0
Evgenia
Telerik team
answered on 15 Jun 2011, 02:56 PM
Hi avinash,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
avinash
Top achievements
Rank 1
answered on 16 Jun 2011, 05:26 AM
Hi Evgenia,

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
0
Evgenia
Telerik team
answered on 16 Jun 2011, 01:15 PM
Hello avinash,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Shaun
Top achievements
Rank 1
answered on 28 Mar 2013, 09:37 PM
Evgenia,

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?
0
Evgenia
Telerik team
answered on 03 Apr 2013, 07:40 AM
Hello Shaun,

 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.

0
Shaun
Top achievements
Rank 1
answered on 03 Apr 2013, 08:09 PM
Hi Evgenia,

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.

0
Evgenia
Telerik team
answered on 08 Apr 2013, 01:04 PM
Hello Shaun,

 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.

Tags
Chart
Asked by
avinash
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
avinash
Top achievements
Rank 1
Shaun
Top achievements
Rank 1
Share this question
or