+ Start a Discussion
Edoardo SpanoEdoardo Spano 

Dynamic number of lineSeries in Visualforce Chart

Hi all,

I have to create a Visualforce page that shows a line chart, with on top a filter that the user can change.
This chart must be dynamic, because the number of lines depends on the selected filter value.

For a <apex:chart> I have to define in the page code a <apex:lineSeries> for each line that I want show.
How can I generate the <apex:lineSeries> tags dynamically?

Thanks in advance.
ShashankShashank (Salesforce Developers) 
You can try using the apex:repeat component to dynamically repeat the apex:lineseries components.

http://www.salesforce.com/docs/developer/pages/Content/pages_compref_repeat.htm
Edoardo SpanoEdoardo Spano
Hi Shashank, the apex:repeat is not supported on the apex:chart, because the apex:lineSeries must be a direct child. I've already tried this solution. Thanks anyway. Edoardo
Dibyalisha MaharanaDibyalisha Maharana
@ Edoardo

Please let me know how you were able to acheive it. I have the similar requirement.

Thanks in advance.