StuperUser
StuperUser

Reputation: 10850

Can Kendo UI chart legend automatically remove empty series?

I have Kendo UI chart (defined in a razor view).

I haven't been able to find anything in the documentation, is it possible to setup the legend to ignore empty series from the chart data or am I forced to add only the relevant series to the chart data?

Upvotes: 5

Views: 2773

Answers (1)

StuperUser
StuperUser

Reputation: 10850

While not an option in the legend, there is an option in the series objects: visibleInLegend, this can be set dynamically against a collection or another logical test, e.g.:

new {
    category = "Some Category",
    value = Model.SomeCollection.Count,
    color = "#FF9900", //Amber
    visibleInLegend = Model.SomeCollection.Count > 0
}, 

Upvotes: 6

Related Questions