Conditionally Show Series Based on Report Parameter

1 Answer 76 Views
Conditional Formatting Report Parameters
Tim
Top achievements
Rank 2
Iron
Iron
Iron
Tim asked on 11 Feb 2022, 04:17 PM

I have a line chart with two series. I would like to show or hide each series based on whether they are checked in a report parameter.

For example, if Ongoing is unchecked in the list below, the red line should disappear from the chart and legend. Is this possible?

If so, what property on the graph should be toggled and how can a particular checkbox value be determined in an expression?

For testing purposes I have hard-coded the data in the data source like this:

SELECT '2021-1' YearMonth, 1 AS New, 2 AS Ongoing
UNION ALL
SELECT '2021-2' YearMonth, 2 AS New, 3 AS Ongoing
UNION ALL
SELECT '2021-3' YearMonth, 4 AS New, 1 AS Ongoing

Thanks,

Tim

1 Answer, 1 is accepted

Sort by
0
Tim
Top achievements
Rank 2
Iron
Iron
Iron
answered on 14 Feb 2022, 11:47 PM

I got this to work by adding a conditional formatting rule to each series where the Style had Layout Visible = false. This removed the corresponding line from the graph, but the label still appeared in the legend. So I added an expression to the Series LegendItem Value. It works, but I would like to know if there's an easier solution.

Thanks

Neli
Telerik team
commented on 15 Feb 2022, 05:59 AM

Hi TIm,

Indeed, using ConditionalFormatting is the correct approach. One of its Usages is setting the visibility of an item based on a value or other condition and a lot more.

Tim
Top achievements
Rank 2
Iron
Iron
Iron
commented on 15 Feb 2022, 12:40 PM

Thanks for your reply.
Tags
Conditional Formatting Report Parameters
Asked by
Tim
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Tim
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or