Dynamic chart

UI Components for JSF
Post Reply
DarkMarine
Posts: 3
Joined: 18 Apr 2009, 17:50

18 Apr 2009, 18:03

Hi,

I want to create a dynamic p:lineChart. So i need to create the nested p:chartSeries child elements dynamically. Basically i have the following data that i want to visualize in the chart.

Code: Select all

public class ChartData {
    private String time;
    private List<Integer> values;
}
The time should be displayed on the x-axis and the i have one ore more values for the y-axis. I tried something like

Code: Select all

<p:lineChart id="chart" value="#{chartBean.chartData}" var="data" xfield="#{data.time}">
   <p:chartSeries label="value" value="#{data.values[0]}" />
</p:lineChart>
But then the the chart is not displayed on the page.

Best regards

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

23 Apr 2009, 10:51

I think you need to use ui:repeat or c:forEach to dynamically add chartSeries.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 24 guests