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

Programmatically hide a chart column according to category

2 Answers 594 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 1
Veteran
Ron asked on 03 May 2016, 02:48 PM

Hi
We look for a way to programmatically hide a certain column from a chart according to its category value and user selection. For example look at the following basic columns chart dojo:
http://dojo.telerik.com/eyaFi

How can we hide from this chart the column of year 2005 programmatically?

Notice we look for a way to hide/show it programmatically and dynamically without manipulating the chard data

Thanks,

 

Ron

2 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 05 May 2016, 11:12 AM
Hi Ron,

Hiding / showing series points in Kendo UI Chart is not supported. What I would suggest as a workaround is following;
- Bind the chart to a dataSource and use the series.colorField option to set colors to each of the points; 
- Remove the series borders;
- Change a point color to transparent;
- Redraw the chart.
For your convenience here is a dojo which demonstrates the suggested approach in action.

Regards,
Iliana Nikolova
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Adrian
Top achievements
Rank 1
commented on 21 Aug 2021, 10:17 PM

I have to agree with Ron on this one Ilana,

Not only does it leave an awful looking UI hole, if the reason for hiding the series is because it skews the data (say including null, non-respondent or unknown category), just hiding the column is pointless as it reveals no additional detail about the smaller data.

If you could remove and hide a category in the same way the data is removed and hidden in a pie chart it would be usable.

In the mean time, the only way of solving this is with an additional round trip to the controller to rerender the view sans the data series in question. Sigh....

Georgi Denchev
Telerik team
commented on 24 Aug 2021, 12:48 PM

Hi, Adrian,

Unfortunately the Bar charts and Pie charts operate in a different way, that is why the "hidden" behavior is not the same. Making a request to the server in order to retrieve an updated version of the data or removing the specific item from the dataSource/series and categories, is the only way to not have an empty space.

https://dojo.telerik.com/@gdenchev/UlAGePoG 

0
Ron
Top achievements
Rank 1
Veteran
answered on 05 May 2016, 04:09 PM

Thanks Iliana Nikolova,
Unfortunately this results with a missing bar - the chart still presents the space of the hidden bar.
Since there is no support for this we will have to manipulate the data (which we hoped to avoid)

Regards,

 

Ron.

Tags
Charts
Asked by
Ron
Top achievements
Rank 1
Veteran
Answers by
Iliana Dyankova
Telerik team
Ron
Top achievements
Rank 1
Veteran
Share this question
or