Line Graph dynamically generating number of lines based on input

Hi there,

I am trying to build a line graph that dynamically shows a number of lines for categories selected in a multiselectlistbox. I wrote the according sql query but can't quite find a way to loop through the rows while having the columns as x-Axis.
While I could in theory write a code for each line, I am missing the part where I don't show lines that have no data.

Any advise is highly appreciated!

Might be worth having a look at your sql and chart config but what I'd suggest is that you use a transformer to generate the data set that you want to chart and show/hide the datapoints in the transformer logic.
It'll probably be something like running a filter function on the query data to remove "no data" elements from the datapoints and them a map function to format these to what the chart requires.
The benefit of doing it this way would be that it'll automatically update when the multiselect component changes its value and this will in turn also update the chart.

1 Like