1. General description |
This component acts you to create a Bar Chart 3D image for your html page
|
2. Installation |
To use the Bar Chart 3D component you can choose to install the entire
jenia4faces
library or to install only the jar file containing the chart family components.
In the second case you need to download two separate jar, the
commons component library and the chart
component library.
After downloading, you must copy downloaded file/files in your WEB-INF/lib directory.
If you have already installed some jenia4faces component you didn't
need anything other, followings are jenia4faces commons installation
step.
The last installation step is to modify the web.xml file of your web
application and add a new servlet.
The new servlet must be associated with the
org.jenia.faces.util.Servlet java class and must be mapped with this
pattern : /jenia4faces/*
This is an example of the new configurations :
<servlet>
<servlet-name>Jenia internal servlet</servlet-name>
<servlet-class>org.jenia.faces.util.Servlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jenia internal servlet</servlet-name>
<url-pattern>/jenia4faces/*</url-pattern>
</servlet-mapping>
Now you have correctly installed the dataTools component. Enjoy your
development.
Requirements:
jfreechart
we have tested the library using:
jfreechart-1.0.0-rc1.jar
jcommon-1.0.0-rc1.jar
batik 1.6
use only:
batik.jar
batik-svggen.jar
batik-ext.jar
batik-awt-util.jar
batik-util.jar
batik-dom.jar
batik-xml.jar
|
3. Simple usage |
This is a simple example of how to use the Bar Chart 3D component :
<%@ taglib uri="http://www.jenia.org/jsf/chart" prefix="jd" %>
...
<jd:barChart3d dataset="#{TestBean.barDataset}" width="450" height="300" fileExt="png"
chartTitle="Line Chart" includeLegend="true" axisXLabel="x axis desc" axisYLabel="y axis desc"
formatter="#{TestBean.formatter}" type="Line" />
...
public class TestBean {
private CategoryDataset barDataset;
private NumberFormat formatter = new DecimalFormat("#,##0.00");
...
public CategoryDataset getBarDataset() {
DefaultCategoryDataset barDataset = new DefaultCategoryDataset();
barDataset.addValue(10.1, "New York", "2005");
barDataset.addValue(15.2, "New York", "2006");
barDataset.addValue(20.3, "New York", "2007");
barDataset.addValue(-5.6, "New York", "2008");
barDataset.addValue(-5.7, "New York", "2009");
barDataset.addValue(-5.6, "New York", "2010");
barDataset.addValue(-8.6, "New York", "2011");
barDataset.addValue(20.6, "Hong Kong", "2005");
barDataset.addValue(15.5, "Hong Kong", "2006");
barDataset.addValue(10.6, "Hong Kong", "2007");
barDataset.addValue(12.5, "Hong Kong", "2008");
barDataset.addValue(12.3, "Hong Kong", "2009");
barDataset.addValue(12.5, "Hong Kong", "2010");
barDataset.addValue(19.5, "Hong Kong", "2011");
barDataset.addValue(-3.6, "London", "2005");
barDataset.addValue(15.5, "London", "2006");
barDataset.addValue(10.6, "London", "2007");
barDataset.addValue(9.6, "London", "2008");
barDataset.addValue(2.2, "London", "2009");
barDataset.addValue(9.6, "London", "2010");
barDataset.addValue(11.6,"London", "2011");
return barDataset;
}
public NumberFormat getFormatter() {
return formatter;
}
...
}
|
4. Component reference |
In the counter text component you can also use these attributes :
id
The component identifier for this component. This value must be unique
within the closest parent component that is a naming container.
See general jsf documentation.
rendered
Flag indicating whether or not this component should be rendered
(during Render Response Phase), or processed on any subsequent form
submit.
See general jsf documentation.
binding
The value binding expression linking this component to a property in a
backing bean
See general jsf documentation.
style
CSS style(s) to be applied when this component is rendered
styleClass
Space-separated list of CSS style class(es) to be applied when this element is
rendered.
This value must be passed throughas the "class" attribute on generated markup.
title
Advisory title information about markup elements generated for this component.
chartTitle
Set the title of the chart that you want to render
dataset
The class CategoryDatasetis the container of the data of your graph
color
Set the background color of your chart (default is #FFFFFF)
width
Set the width of the generated image
height
Set the height of the generated image
fileExt
Choose the format of the generated image (png, jpg, svg)
axisXLabel
Set the label of X-Axis
axisYLabel
Set the label of Y-Axis
plotColor
Set the color of your chart
formatter
Set the formatter of your range axis
upperMargin
set the Margin of your graph
labelAngle
Set the angle of your label (default Math.PI*2)
includeZero
Make the possibility to include zero on your plot
labelVibility
Set the visibility of your label
basicStroke
Defines a basic set of rendering attributes for the outlines of graphics primitives
includeLegend
Set the visibility of legend
includeTooltips
Set the visibility of tooltips
includeUrls
Set the visibility of url
orientation
Set the orientation of your graph (default PlotOrientation.VERTICAL)
type
with this attribute you can choose to render your graph like a
Bar, StackedBar, Line, BarChart2D or Area chart(Deafualt Bar)
trasparency
Float parameter that indicates the trasparency of your Bar Graph
plotColor
Set the color of your chart
labelXOrientation
Specify if you need to reneder X-Axis label vertical setting
this attribute with the flag "vertical"
tickUnit
Sets the tick unit for the axis
paint
Define a Paint array to change the color of chart element
|
5. Known limitations |
If you use Tomcat on Linux without an XServer you must say this to your JDK so:
export CATALINA_OPTS="-Djava.awt.headless=true"
is the solution to avoid any problem.
|
|