Line chart problems with xAxis values

UI Components for JSF
Post Reply
inetwork
Posts: 25
Joined: 30 Apr 2010, 21:18

04 Jun 2010, 00:00

Hi,

I am trying to use the line chart component where my xAxis will always have 24 hour period. And the yAxis value does not necessarily available for each hour of the day. Having an Arraylist of String for the hours (12am, 1am, 2am....,12om, 1pm...23pm) and long for the yAxis values where the yAxis value are not available for every single hour of the day. Can anyone suggest how I can accomplish this.

Thanks.

inetwork
Posts: 25
Joined: 30 Apr 2010, 21:18

04 Jun 2010, 05:33

So referring the example from the line chart docs for the following code:

Code: Select all

births = new ArrayList<Birth>();
births.add(new Birth(2004, 120, 52));
births.add(new Birth(2005, 100, 60));
births.add(new Birth(2006, 44, 110));
births.add(new Birth(2007, 150, 135));
births.add(new Birth(2008, 125, 120));

<p:lineChart value="#{chartBean.births}" var="birth" xfield="#{birth.year}">
<p:chartSeries label="Boys" value="#{birth.boys}" />
<p:chartSeries label="Girls" value="#{birth.girls}" /> </p:lineChart>

Now, what if don't have any data for the year of 2007 for example but we still would like to have that (year 2007) on the xAxis (as part of the xfield). How can we do that?

Thanks for the help.

inetwork
Posts: 25
Joined: 30 Apr 2010, 21:18

05 Jun 2010, 06:08

How can I send back NULL values for the yAxis data points? For ex. in the previous code sample from the documentation, how I can pass back NULL or totally get rid of same values of a series. Let's say, I would either want to put NULL or have no value at all in the places of 44, 110 for year 2006. How can I do that without getting any line renderer error?

Thanks.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 67 guests