linechart possible to switch axes?

UI Components for JSF
Post Reply
gopower
Posts: 8
Joined: 08 Nov 2010, 13:36

17 Nov 2010, 17:04

Hi,
I've been looking at linecharts and all examples I've seen as well as the api suggest that only numerical data can be set on the y-axis while string data can be used on the x-axis.
Is it possible to set string based data on the y-axis and numerical data on the x-axis?
Something similar to barchart vs columnchart
Thanks
PrimeFaces 3.1.1, Tomcat 7.1, Hibernate 4.1.4 Final, Mac os x, Eclipse Indigo IDE

gopower
Posts: 8
Joined: 08 Nov 2010, 13:36

19 Nov 2010, 18:00

I've tried to get around this issue by using a labelfunction which outputs a string but again the function can only be passed a numerical based value specified in chartseries.
Can anyone suggest any possible solutions?
Thanks
PrimeFaces 3.1.1, Tomcat 7.1, Hibernate 4.1.4 Final, Mac os x, Eclipse Indigo IDE

gopower
Posts: 8
Joined: 08 Nov 2010, 13:36

24 Nov 2010, 12:17

Came up with a solution where a seperate javascript object is set on page load function with corresponding id:label pairings.
The linechart label function then retrieves the corresponding label for the the passed in id, returning that value

Code: Select all

var labels= new Object();

function getLabel(value) {
	return labels[value];
}

window.onload=function(){
	lables= #{backingBean.labelNames};
}
Last edited by gopower on 24 Nov 2010, 13:04, edited 1 time in total.
PrimeFaces 3.1.1, Tomcat 7.1, Hibernate 4.1.4 Final, Mac os x, Eclipse Indigo IDE

dovlex
Posts: 40
Joined: 26 Feb 2010, 06:38

24 Nov 2010, 13:00

Hey,

I made a crude patch to enable axis switching. See http://code.google.com/p/primefaces/iss ... ail?id=602 and do not forget to vote for this issue!!!

Regards,
Vladimir

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 71 guests