My requirement is to display tables from database in Graph format and I am using fiji for the same. And on doing so I am encountering and exception, My jsp page is as follows.
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:fiji="http://exadel.com/fiji">
<fiji:columnChart id="columnChartOne" value="#{GraphBean.monthMap}" title="One-series Column Chart" barCaption="none"
barColors="#{GraphBean.colors}" captionX="Months" captionY="Amount" toolTipValue="{y} {name} are sold in {x}"
subtitle="Hardware sales per month" width="400" height="400">
<fiji:chartData type="name" value="#{GraphBean.names}" />
</fiji:columnChart>
</ui:composition>
My bean is as follows :
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Random;
public class GraphBean {
private Integer data;
private Map<String, Integer> monthMap = new LinkedHashMap<String,Integer>();
private ArrayList<String> names = new ArrayList<String>();
private ArrayList<String> colors = new ArrayList<String>();
Random rnd = new Random(new Date().getTime());
public GraphBean() {
super();
generateData();
}
private void generateData() {
monthMap.put("January", getData());
monthMap.put("February", getData());
monthMap.put("March", getData());
}
public Map<String, Integer> getMonthMap() {
return monthMap;
}
public ArrayList<String> getNames(){
names.add("Motherboards");
return names;
}
public ArrayList<String> getColors(){
colors.add("#5db2c2");
return colors;
}
public Integer getData() {
data = rnd.nextInt(50);
return data;
}
}
I have made entry for the bean in the faces-config.xml.