Click event on Stacked Bar

8 posts, 0 answers
  1. avinash
    avinash avatar
    12 posts
    Member since:
    Feb 2011

    Posted 14 Jun 2011 Link to this post

    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
  2. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 15 Jun 2011 Link to this post

    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
  3. DevCraft banner
  4. avinash
    avinash avatar
    12 posts
    Member since:
    Feb 2011

    Posted 16 Jun 2011 Link to this post

    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
  5. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 16 Jun 2011 Link to this post

    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
  6. Shaun
    Shaun avatar
    16 posts
    Member since:
    Jul 2012

    Posted 28 Mar 2013 Link to this post

    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?
  7. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 03 Apr 2013 Link to this post

    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.

  8. Shaun
    Shaun avatar
    16 posts
    Member since:
    Jul 2012

    Posted 03 Apr 2013 Link to this post

    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.

  9. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 08 Apr 2013 Link to this post

    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.

Back to Top
DevCraft banner