|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Image
org.zkoss.zul.Imagemap
org.zkoss.zul.Chart
public class Chart
The generic chart component. Developers set proper chart type, data model, and the threeD (3D) attribute to draw proper chart.
Chart requires an implementation of an engine (ChartEngine
).
The default engine is based on JFreeChart and available in ZK PE and ZK EE.
The model and type must match to each other; or the result is unpredictable. The 3D chart is not supported on all chart type.
type | model | 3D |
---|---|---|
area | CategoryModel or XYModel | No |
bar | CategoryModel | Yes |
bubble | XYZModel | No |
candlestick | HiLoModel | No |
dial | @{link DialModel} | No |
gantt | GanttModel | No |
highlow | HiLoModel | No |
histogram | XYModel | No |
line | CategoryModel or XYModel | Yes |
pie | PieModel | Yes |
polar | XYModel | No |
ring | PieModel | No |
scatter | XYModel | No |
stacked_bar | CategoryModel | Yes |
stacked_area | CategoryModel or XYModel | No |
step | XYModel | No |
step_area | XYModel | No |
time_series | XYModel | No |
wafermap | WaferMapModel | No |
waterfall | CategoryModel | No |
wind | XYZModel | No |
ChartEngine
,
ChartModel
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class org.zkoss.zul.Image |
---|
Image.ExtraCtrl |
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent |
---|
AbstractComponent.Children |
Field Summary | |
---|---|
static java.lang.String |
AREA
|
static java.lang.String |
BAR
|
static java.lang.String |
BUBBLE
|
static java.lang.String |
CANDLESTICK
|
static java.lang.String |
DAY
|
static java.lang.String |
DIAL
|
static java.lang.String |
GANTT
|
static java.lang.String |
HIGHLOW
|
static java.lang.String |
HISTOGRAM
|
static java.lang.String |
HOUR
|
static java.lang.String |
LINE
|
static java.lang.String |
MILLISECOND
|
static java.lang.String |
MINUTE
|
static java.lang.String |
MONTH
|
static java.lang.String |
PIE
|
static java.lang.String |
POLAR
|
static java.lang.String |
QUARTER
|
static java.lang.String |
RING
|
static java.lang.String |
SCATTER
|
static java.lang.String |
SECOND
|
static java.lang.String |
STACKED_AREA
|
static java.lang.String |
STACKED_BAR
|
static java.lang.String |
STEP
|
static java.lang.String |
STEP_AREA
|
static java.lang.String |
TIME_SERIES
|
static java.lang.String |
WAFERMAP
|
static java.lang.String |
WATERFALL
|
static java.lang.String |
WEEK
|
static java.lang.String |
WIND
|
static java.lang.String |
YEAR
|
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
---|
_height, _left, _top, _width, _zclass |
Fields inherited from class org.zkoss.zk.ui.AbstractComponent |
---|
_visible |
Fields inherited from interface org.zkoss.zk.ui.Component |
---|
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE |
Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl |
---|
CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE |
Constructor Summary | |
---|---|
Chart()
|
Method Summary | |
---|---|
boolean |
addEventListener(java.lang.String evtnm,
EventListener listener)
Adds an event listener to specified event for this component. |
java.lang.Object |
clone()
Clones the component. |
ChartAreaListener |
getAreaListener()
Returns the renderer to render each area, or null if the default renderer is used. |
int |
getBgAlpha()
Get the background alpha (transparency, 0 ~ 255, opacue). |
java.lang.String |
getBgColor()
Get the background color of the chart (in string as #RRGGBB). |
int[] |
getBgRGB()
Get the background color in int array (0: red, 1: green, 2:blue). |
java.lang.String |
getDateFormat()
Returns the date format used by date related Chart. |
ChartEngine |
getEngine()
Returns the implemetation chart engine. |
int |
getFgAlpha()
Get the foreground alpha (transparency, 0 ~ 255, opacue). |
int |
getIntHeight()
Get the chart int width in pixel; to be used by the derived subclass. |
int |
getIntWidth()
Get the chart int width in pixel; to be used by the derived subclass. |
java.awt.Font |
getLegendFont()
Returns the legend font of this chart. |
ChartModel |
getModel()
Returns the chart model associated with this chart, or null if this chart is not associated with any chart data model. |
java.lang.String |
getOrient()
Get the chart orientation (vertical or horizontal) |
int |
getPaneAlpha()
Get the pane alpha (transparency, 0 ~ 255, opacue). |
java.lang.String |
getPaneColor()
Get the pane color of the chart (in string as #RRGGBB). |
int[] |
getPaneRGB()
Get the pane color in int array (0: red, 1: green, 2:blue). |
java.lang.String |
getPeriod()
Returns the period used in Time Series Chart. |
java.util.TimeZone |
getTimeZone()
Returns the time zone that this Time Series Chart belongs to, or null if the default time zone is used. |
java.lang.String |
getTitle()
Get the chart's title. |
java.awt.Font |
getTitleFont()
Returns the title font of this chart. |
java.lang.String |
getType()
Get the chart's type. |
java.lang.String |
getXAxis()
Get the label in xAxis. |
java.awt.Font |
getXAxisFont()
Returns the label font of x axis of this chart. |
java.awt.Font |
getXAxisTickFont()
Returns the tick number font of x axis of this chart. |
java.lang.String |
getYAxis()
Get the label in yAxis. |
java.awt.Font |
getYAxisFont()
Returns the label font of y axis of this chart. |
java.awt.Font |
getYAxisTickFont()
Returns the tick number font of y axis of this chart. |
boolean |
isShowLegend()
Check whether show the legend of the chart. |
boolean |
isShowTooltiptext()
Check whether show the tooltiptext. |
boolean |
isThreeD()
Whether a 3d chart. |
protected ChartEngine |
newChartEngine()
Instantiates the default chart engine. |
void |
setAreaListener(ChartAreaListener listener)
Sets the renderer which is used to render each area. |
void |
setAreaListener(java.lang.String clsnm)
Sets the renderer by use of a class name. |
void |
setBgAlpha(int alpha)
Set the background alpha (transparency, 0 ~ 255). |
void |
setBgColor(java.lang.String color)
Set the background color of the chart. |
void |
setDateFormat(java.lang.String format)
Sets the date format used by date related Chart. |
void |
setEngine(ChartEngine engine)
Sets the chart engine. |
void |
setEngine(java.lang.String clsnm)
Sets the chart engine by use of a class name. |
void |
setFgAlpha(int alpha)
Set the foreground alpha (transparency, 0 ~ 255). |
void |
setHeight(java.lang.String h)
Override super class to prepare the int height. |
void |
setLegendFont(java.awt.Font font)
Sets the legend font of this chart. |
void |
setModel(ChartModel model)
Sets the chart model associated with this chart. |
void |
setModel(java.lang.String clsnm)
Sets the model by use of a class name. |
void |
setOrient(java.lang.String orient)
Set the chart orientation. |
void |
setPaneAlpha(int alpha)
Set the pane alpha (transparency, 0 ~ 255). |
void |
setPaneColor(java.lang.String color)
Set the pane color of the chart. |
void |
setPeriod(java.lang.String period)
Sets the period used in Time Series Chart. |
void |
setShowLegend(boolean showLegend)
whether show the chart's legend. |
void |
setShowTooltiptext(boolean showTooltiptext)
whether show the chart's tooltip. |
void |
setThreeD(boolean b)
Set true to show three dimensional graph (If a type of chart got no 3d peer, this is ignored). |
void |
setTimeZone(java.util.TimeZone tzone)
Sets the time zone that this Time Series Chart belongs to, or null if the default time zone is used. |
void |
setTitle(java.lang.String title)
Set the chart's title. |
void |
setTitleFont(java.awt.Font font)
Sets the title font of this chart. |
void |
setType(java.lang.String type)
Set the chart's type (Chart.PIE, Chart.BAR, Chart.LINE, etc.). |
void |
setWidth(java.lang.String w)
Override super class to prepare the int width. |
void |
setXAxis(java.lang.String label)
Set the label in xAxis. |
void |
setXAxisFont(java.awt.Font axisFont)
Sets the label font of x axis of this chart. |
void |
setXAxisTickFont(java.awt.Font axisTickFont)
Sets the tick number font of x axis of this chart. |
void |
setYAxis(java.lang.String label)
Set the label in yAxis. |
void |
setYAxisFont(java.awt.Font axisFont)
Sets the label font of y axis of this chart. |
void |
setYAxisTickFont(java.awt.Font axisTickFont)
Sets the tick number font of y axis of this chart. |
protected void |
smartDrawChart()
mark a draw flag to inform that this Chart needs update. |
Methods inherited from class org.zkoss.zul.Imagemap |
---|
beforeChildAdded, isChildable |
Methods inherited from class org.zkoss.zul.Image |
---|
getAlign, getBorder, getContent, getHover, getHspace, getSrc, getVspace, newExtraCtrl, renderProperties, setAlign, setBorder, setContent, setContent, setHover, setHoverContent, setHoverContent, setHspace, setSrc, setVspace |
Methods inherited from class org.zkoss.zul.impl.XulElement |
---|
getAction, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
---|
focus, getDraggable, getDroppable, getHeight, getHflex, getLeft, getSclass, getStyle, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, service, setClass, setDraggable, setDroppable, setFocus, setHflex, setLeft, setSclass, setStyle, setTooltiptext, setTop, setVflex, setZclass, setZindex, setZIndex |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.zkoss.zul.api.Image |
---|
getAlign, getBorder, getContent, getHover, getHspace, getSrc, getVspace, setAlign, setBorder, setContent, setContent, setHover, setHoverContent, setHoverContent, setHspace, setSrc, setVspace |
Methods inherited from interface org.zkoss.zul.impl.api.XulElement |
---|
getAction, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent |
---|
focus, getHeight, getLeft, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZclass, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setLeft, setSclass, setStyle, setTooltiptext, setTop, setZclass, setZindex, setZIndex |
Methods inherited from interface org.zkoss.zk.ui.ext.Scope |
---|
addScopeListener, getAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute |
Field Detail |
---|
public static final java.lang.String PIE
public static final java.lang.String RING
public static final java.lang.String BAR
public static final java.lang.String LINE
public static final java.lang.String AREA
public static final java.lang.String STACKED_BAR
public static final java.lang.String STACKED_AREA
public static final java.lang.String WATERFALL
public static final java.lang.String POLAR
public static final java.lang.String SCATTER
public static final java.lang.String TIME_SERIES
public static final java.lang.String STEP
public static final java.lang.String STEP_AREA
public static final java.lang.String HISTOGRAM
public static final java.lang.String CANDLESTICK
public static final java.lang.String HIGHLOW
public static final java.lang.String BUBBLE
public static final java.lang.String WAFERMAP
public static final java.lang.String GANTT
public static final java.lang.String WIND
public static final java.lang.String DIAL
public static final java.lang.String YEAR
public static final java.lang.String QUARTER
public static final java.lang.String MONTH
public static final java.lang.String WEEK
public static final java.lang.String DAY
public static final java.lang.String HOUR
public static final java.lang.String MINUTE
public static final java.lang.String SECOND
public static final java.lang.String MILLISECOND
Constructor Detail |
---|
public Chart()
Method Detail |
---|
public void setType(java.lang.String type)
Default: pie.
setType
in interface Chart
public java.lang.String getType()
getType
in interface Chart
public void setThreeD(boolean b)
setThreeD
in interface Chart
public boolean isThreeD()
isThreeD
in interface Chart
public void setTitle(java.lang.String title)
setTitle
in interface Chart
title
- the chart's title.public java.lang.String getTitle()
getTitle
in interface Chart
public void setWidth(java.lang.String w)
setWidth
in interface HtmlBasedComponent
setWidth
in class HtmlBasedComponent
public int getIntWidth()
getIntWidth
in interface Chart
public void setHeight(java.lang.String h)
setHeight
in interface HtmlBasedComponent
setHeight
in class HtmlBasedComponent
public int getIntHeight()
getIntHeight
in interface Chart
public void setXAxis(java.lang.String label)
setXAxis
in interface Chart
label
- label in xAxis.public java.lang.String getXAxis()
getXAxis
in interface Chart
public void setYAxis(java.lang.String label)
setYAxis
in interface Chart
label
- label in yAxis.public java.lang.String getYAxis()
getYAxis
in interface Chart
public void setShowLegend(boolean showLegend)
setShowLegend
in interface Chart
showLegend
- true if want to show the legend (default to true).public boolean isShowLegend()
isShowLegend
in interface Chart
public void setShowTooltiptext(boolean showTooltiptext)
setShowTooltiptext
in interface Chart
showTooltiptext
- true if want to pop the tooltiptext (default to true).public boolean isShowTooltiptext()
isShowTooltiptext
in interface Chart
public void setPaneAlpha(int alpha)
setPaneAlpha
in interface Chart
alpha
- the transparency of pane color (0 ~ 255, default to 255 opaque).public int getPaneAlpha()
getPaneAlpha
in interface Chart
public void setPaneColor(java.lang.String color)
setPaneColor
in interface Chart
color
- in #RRGGBB format (hexdecimal).public java.lang.String getPaneColor()
getPaneColor
in interface Chart
public int[] getPaneRGB()
getPaneRGB
in interface Chart
public void setFgAlpha(int alpha)
setFgAlpha
in interface Chart
alpha
- the transparency of foreground color (0 ~ 255, default to 255 opaque).public int getFgAlpha()
getFgAlpha
in interface Chart
public void setBgAlpha(int alpha)
setBgAlpha
in interface Chart
alpha
- the transparency of background color (0 ~ 255, default to 255 opaque).public int getBgAlpha()
getBgAlpha
in interface Chart
public void setBgColor(java.lang.String color)
setBgColor
in interface Chart
color
- in #RRGGBB format (hexdecimal).public java.lang.String getBgColor()
getBgColor
in interface Chart
public int[] getBgRGB()
getBgRGB
in interface Chart
public void setOrient(java.lang.String orient)
setOrient
in interface Chart
orient
- vertical or horizontal (default to vertical)public java.lang.String getOrient()
getOrient
in interface Chart
public java.util.TimeZone getTimeZone()
The default time zone is determined by TimeZones.getCurrent()
.
getTimeZone
in interface Chart
public void setTimeZone(java.util.TimeZone tzone)
The default time zone is determined by TimeZones.getCurrent()
.
setTimeZone
in interface Chart
public java.lang.String getPeriod()
getPeriod
in interface Chart
public void setPeriod(java.lang.String period)
setPeriod
in interface Chart
public java.lang.String getDateFormat()
getDateFormat
in interface Chart
public void setDateFormat(java.lang.String format)
setDateFormat
in interface Chart
format
- public ChartModel getModel()
getModel
in interface Chart
public void setModel(ChartModel model)
setModel
in interface Chart
model
- the chart model to associate, or null to dis-associate
any previous model.
UiException
- if failed to initialize with the modelpublic java.awt.Font getTitleFont()
public void setTitleFont(java.awt.Font font)
font
- the title font of this chartpublic java.awt.Font getLegendFont()
public void setLegendFont(java.awt.Font font)
font
- the legend font of this chartpublic java.awt.Font getXAxisTickFont()
public void setXAxisTickFont(java.awt.Font axisTickFont)
axisTickFont
- the tick number font of x axis of this chartpublic java.awt.Font getXAxisFont()
public void setXAxisFont(java.awt.Font axisFont)
axisFont
- the label font of x axis of this chartpublic java.awt.Font getYAxisTickFont()
public void setYAxisTickFont(java.awt.Font axisTickFont)
axisTickFont
- the tick number font of y axis of this chartpublic java.awt.Font getYAxisFont()
public void setYAxisFont(java.awt.Font axisFont)
axisFont
- the tick number font of y axis of this chartpublic void setModel(java.lang.String clsnm) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException
setModel
in interface Chart
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
public ChartEngine getEngine() throws UiException
getEngine
in interface Chart
UiException
- if failed to load the engine.protected ChartEngine newChartEngine() throws UiException
setEngine(org.zkoss.zul.impl.ChartEngine)
is not called with non-null
engine.
By default, it looks up the component attribute called
chart-engine. If found, the value is assumed to be the class
or the class name of the default engine (it must implement
ChartEngine
).
If not found, UiException
is thrown.
Derived class might override this method to provide your own default class.
UiException
- if failed to instantiate the enginepublic void setEngine(ChartEngine engine)
setEngine
in interface Chart
public void setEngine(java.lang.String clsnm) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException
setEngine
in interface Chart
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
public ChartAreaListener getAreaListener()
getAreaListener
in interface Chart
public void setAreaListener(ChartAreaListener listener)
Note: changing a render will not cause the chart to re-render. If you want it to re-render, you could call smartDraw.
setAreaListener
in interface Chart
listener
- the area listener, or null to ignore it.
UiException
- if failed to initialize.public void setAreaListener(java.lang.String clsnm) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException
setAreaListener
in interface Chart
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
protected void smartDrawChart()
public boolean addEventListener(java.lang.String evtnm, EventListener listener)
Component
You could register listener to all components in the same page
by use of Page.addEventListener(java.lang.String, org.zkoss.zk.ui.event.EventListener)
.
addEventListener
in interface Component
addEventListener
in class AbstractComponent
evtnm
- what event to listen (never null)
Page.addEventListener(java.lang.String, org.zkoss.zk.ui.event.EventListener)
public java.lang.Object clone()
Component
clone
in interface Component
clone
in class AbstractComponent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |