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

bar style is not getting changed

1 Answer 16 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Kinnar
Top achievements
Rank 1
Kinnar asked on 10 Oct 2012, 07:44 PM
Hi,

We are using rad chart which shows data in the form of "Month-to-Month". This is basically stacked bar chart. The months will be shown as  Jan-12,Feb-12,Mar-12 etc. on Axis-X Labels. Each month will have 4 different Y-Series bind to them namely y1,y2,y3,y4. The requirement is that when user clicks  one of the y-series for particular month, then all other y-series for that month and all other months should be grayed out and y-series clicked by user should be highlighted.We are using BuildCustomItemStyle() method to gray out and hightlight y-series.

The issue is our logic works perfectly fine for all months except for the 1st month. Suppose we have data plotted from Jan-12 to Dec-12. Now, if user selects any of the y-series for "May-12" , then our requirement mentioned above works fine. But if user select any of the y-series for "Jan-12", then other y-series for  "Jan-12" month and all y-series for other months are not grayed out correctly..

Our BuildCustomItemStyle() method look like below way :

 private Style BuildCustomItemStyle(Control item, Style style, DataPoint point, DataSeries dataSeries)
  {
if (item is BaseChartItem)
            {
                BaseChartItem baseChartItem = item as BaseChartItem;
                DataPoint dataPoint = dataSeries[baseChartItem.CurrentIndex];
        DataItem dataItem= dataPoint.DataItem as DataItem ;
;
               if (!dataItem.Selected)
                {
                    if (dataSeries.Definition.SeriesName == "YSeries1")
                    {
                        style = yseries1Style;
                    }
                    else if (dataSeries.Definition.SeriesName == "YSeries2")
                    {
                        style = yseries2Style;
                    }
                    else if (dataSeries.Definition.SeriesName == "YSeries3")
                    {
                        style = yseries3Style;
                    }
                    else if(dataSeries.Definition.SeriesName == "YSeries4")
                    {
                        style = yseries4Style;
;                    }
}
}
return style;
}

Let us know your view on this ASAP as we are stopped on this.

Regards,
Kinnar



1 Answer, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 15 Oct 2012, 03:49 PM
Hi Kinnar,

Unfortunately based on the information you have provided, it is not clear how exactly you are graying out the not-selected items, and highlighting the selected one.

I have attached an example project. I also enabled the Hover Interactivity Setting, which I believe produces the result you need (only except that it is activated on hover, and not on click). 

It would be helpful, if you could:
1. Confirm if this is the effect you need
2. Provide a modified version of this project, demonstrating your custom coloring logic
 
Regards,
Petar Kirov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Chart
Asked by
Kinnar
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Share this question
or