jsf - Used trinidad chart tag <tr:chart> in XHTML, but no output is coming -
below code facing issue, not getting output of graphs. kindly me.
my xhtml code
<?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:tr="http://myfaces.apache.org/trinidad"> <h:body> <h1>director screen</h1> <tr:document> <tr:form> <tr:chart value="#{chartbean}" type="pie" /> <tr:chart value="#{chartbean}" type="bar" /> <tr:chart value="#{chartbean}" type="circulargauge"> </tr:form> </tr:document> </h:body> </html>
java code
package com; import java.util.arraylist; import java.util.list; import javax.faces.bean.managedbean; import javax.faces.bean.sessionscoped; import org.apache.myfaces.trinidad.model.chartmodel; @managedbean(name = "chartbean") @sessionscoped public class chartbean extends chartmodel { @override public list<string> getgrouplabels() { list<string> grouplabels = new arraylist<string>(); grouplabels.add("java"); grouplabels.add("linux"); grouplabels.add(".net"); return grouplabels; } @override public list<string> getserieslabels() { list<string> serieslabels = new arraylist<string>(); serieslabels.add("love it"); serieslabels.add("hate it"); return serieslabels; } @override public list<list<double>> getyvalues() { list<list<double>> chartvalues = new arraylist<list<double>>(); // fill groups (int = 0; < getgrouplabels().size(); i++) { list<double> numbers = new arraylist<double>(); // fill series per group (int j = 0; j < getserieslabels().size(); j++) { numbers.add(100* math.random()); } chartvalues.add(numbers); } return chartvalues; } }
it's mandatory have <h:head>
in template right before <h:body>
. that's jsf 2.x scripts , stylesheets end in. won't surprised if <tr:chart>
has js/css dependencies.
Comments
Post a Comment