public class Chart extends Imagemap
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 FormImage.ExtraCtrl
Modifier and Type | Field and Description |
---|---|
static String |
AREA |
static String |
BAR |
static String |
BUBBLE |
static String |
CANDLESTICK |
static String |
COMBINATION |
static String |
DAY |
static String |
DIAL |
static String |
FUNNEL |
static String |
GANTT |
static String |
HIGHLOW |
static String |
HISTOGRAM |
static String |
HOUR |
static String |
LINE |
static String |
MILLISECOND |
static String |
MINUTE |
static String |
MONTH |
static String |
PIE |
static String |
POLAR |
static String |
QUARTER |
static String |
RING |
static String |
SCATTER |
static String |
SECOND |
static String |
STACKED_AREA |
static String |
STACKED_BAR |
static String |
STEP |
static String |
STEP_AREA |
static String |
TIME_SERIES |
static String |
WAFERMAP |
static String |
WATERFALL |
static String |
WEEK |
static String |
WIND |
static String |
YEAR |
Constructor and Description |
---|
Chart() |
Modifier and Type | Method and Description |
---|---|
boolean |
addEventListener(String evtnm,
org.zkoss.zk.ui.event.EventListener<? extends org.zkoss.zk.ui.event.Event> listener) |
Object |
clone() |
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, opaque).
|
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).
|
String |
getDateFormat()
Returns the date format used by date related Chart.
|
ChartEngine |
getEngine()
Returns the implementation chart engine.
|
int |
getFgAlpha()
Get the foreground alpha (transparency, 0 ~ 255, opaque).
|
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.
|
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.
|
String |
getOrient()
Get the chart orientation (vertical or horizontal)
|
int |
getPaneAlpha()
Get the pane alpha (transparency, 0 ~ 255, opacue).
|
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).
|
String |
getPeriod()
Returns the period used in Time Series Chart.
|
TimeZone |
getTimeZone()
Returns the time zone that this Time Series Chart belongs to, or null if
the default time zone is used.
|
String |
getTitle()
Get the chart's title.
|
Font |
getTitleFont()
Returns the title font of this chart.
|
String |
getType()
Get the chart's type.
|
String |
getXAxis()
Get the label in xAxis.
|
Font |
getXAxisFont()
Returns the label font of x axis of this chart.
|
Font |
getXAxisTickFont()
Returns the tick number font of x axis of this chart.
|
String |
getYAxis()
Get the label in yAxis.
|
Font |
getYAxisFont()
Returns the label font of y axis of this chart.
|
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 |
onPageAttached(org.zkoss.zk.ui.Page newpage,
org.zkoss.zk.ui.Page oldpage) |
void |
onPageDetached(org.zkoss.zk.ui.Page page) |
void |
setAreaListener(ChartAreaListener listener)
Sets the renderer which is used to render each area.
|
void |
setAreaListener(String clsnm)
Sets the renderer by use of a class name.
|
void |
setBgAlpha(int alpha)
Set the background alpha (transparency, 0 ~ 255).
|
void |
setBgColor(String color)
Set the background color of the chart.
|
void |
setDateFormat(String format)
Sets the date format used by date related Chart.
|
void |
setEngine(ChartEngine engine)
Sets the chart engine.
|
void |
setEngine(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(String h)
Override super class to prepare the int height.
|
void |
setHflex(String flex)
Overrides the method in HtmlBasedComponent, not to check using hflex and width at the same time
|
void |
setLegendFont(Font font)
Sets the legend font of this chart.
|
void |
setModel(ChartModel model)
Sets the chart model associated with this chart.
|
void |
setModel(String clsnm)
Sets the model by use of a class name.
|
void |
setOrient(String orient)
Set the chart orientation.
|
void |
setPaneAlpha(int alpha)
Set the pane alpha (transparency, 0 ~ 255).
|
void |
setPaneColor(String color)
Set the pane color of the chart.
|
void |
setPeriod(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(TimeZone tzone)
Sets the time zone that this Time Series Chart belongs to, or null if
the default time zone is used.
|
void |
setTitle(String title)
Set the chart's title.
|
void |
setTitleFont(Font font)
Sets the title font of this chart.
|
void |
setType(String type)
Set the chart's type (Chart.PIE, Chart.BAR, Chart.LINE, etc.).
|
void |
setVflex(String flex)
Overrides the method in HtmlBasedComponent, not to check using vflex and height at the same time
|
void |
setWidth(String w)
Override super class to prepare the int width.
|
void |
setXAxis(String label)
Set the label in xAxis.
|
void |
setXAxisFont(Font axisFont)
Sets the label font of x axis of this chart.
|
void |
setXAxisTickFont(Font axisTickFont)
Sets the tick number font of x axis of this chart.
|
void |
setYAxis(String label)
Set the label in yAxis.
|
void |
setYAxisFont(Font axisFont)
Sets the label font of y axis of this chart.
|
void |
setYAxisTickFont(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.
|
beforeChildAdded, isChildable
getAlign, getBorder, getContent, getExtraCtrl, getHover, getHspace, getSrc, getVspace, renderProperties, setAlign, setBorder, setContent, setContent, setHover, setHoverContent, setHoverContent, setHspace, setSrc, setVspace
getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
addSclass, evalCSSFlex, focus, getAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, service, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight0, setHeightDirectly, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex0, setVflexDirectly, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidate, invalidatePartial, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
public static final String PIE
public static final String FUNNEL
public static final String RING
public static final String BAR
public static final String LINE
public static final String AREA
public static final String STACKED_BAR
public static final String COMBINATION
public static final String STACKED_AREA
public static final String WATERFALL
public static final String POLAR
public static final String SCATTER
public static final String TIME_SERIES
public static final String STEP
public static final String STEP_AREA
public static final String HISTOGRAM
public static final String CANDLESTICK
public static final String HIGHLOW
public static final String BUBBLE
public static final String WAFERMAP
public static final String GANTT
public static final String WIND
public static final String DIAL
public static final String YEAR
public static final String QUARTER
public static final String MONTH
public static final String WEEK
public static final String DAY
public static final String HOUR
public static final String MINUTE
public static final String SECOND
public static final String MILLISECOND
public void setType(String type)
Default: pie.
public String getType()
public void setThreeD(boolean b)
public boolean isThreeD()
public void setTitle(String title)
title
- the chart's title.public String getTitle()
public void setWidth(String w)
setWidth
in class org.zkoss.zk.ui.HtmlBasedComponent
public void setHflex(String flex)
setHflex
in class org.zkoss.zk.ui.HtmlBasedComponent
public int getIntWidth()
public void setHeight(String h)
setHeight
in class org.zkoss.zk.ui.HtmlBasedComponent
public void setVflex(String flex)
setVflex
in class org.zkoss.zk.ui.HtmlBasedComponent
public int getIntHeight()
public void setXAxis(String label)
label
- label in xAxis.public String getXAxis()
public void setYAxis(String label)
label
- label in yAxis.public String getYAxis()
public void setShowLegend(boolean showLegend)
showLegend
- true if want to show the legend (default to true).public boolean isShowLegend()
public void setShowTooltiptext(boolean showTooltiptext)
showTooltiptext
- true if want to pop the tooltiptext (default to true).public boolean isShowTooltiptext()
public void setPaneAlpha(int alpha)
alpha
- the transparency of pane color (0 ~ 255, default to 255 opaque).public int getPaneAlpha()
public void setPaneColor(String color)
color
- in #RRGGBB format (hexadecimal).public String getPaneColor()
public int[] getPaneRGB()
public void setFgAlpha(int alpha)
alpha
- the transparency of foreground color (0 ~ 255, default to 255 opaque).public int getFgAlpha()
public void setBgAlpha(int alpha)
alpha
- the transparency of background color (0 ~ 255, default to 255 opaque).public int getBgAlpha()
public void setBgColor(String color)
color
- in #RRGGBB format (hexadecimal).public String getBgColor()
public int[] getBgRGB()
public void setOrient(String orient)
orient
- vertical or horizontal (default to vertical)public String getOrient()
public TimeZone getTimeZone()
The default time zone is determined by TimeZones.getCurrent()
.
public void setTimeZone(TimeZone tzone)
The default time zone is determined by TimeZones.getCurrent()
.
public String getPeriod()
public void setPeriod(String period)
public String getDateFormat()
public void setDateFormat(String format)
format
- public ChartModel getModel()
public void setModel(ChartModel model)
model
- the chart model to associate, or null to dissociate
any previous model.org.zkoss.zk.ui.UiException
- if failed to initialize with the modelpublic void setModel(String clsnm) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException
public Font getTitleFont()
public void setTitleFont(Font font)
font
- the title font of this chartpublic Font getLegendFont()
public void setLegendFont(Font font)
font
- the legend font of this chartpublic Font getXAxisTickFont()
public void setXAxisTickFont(Font axisTickFont)
axisTickFont
- the tick number font of x axis of this chartpublic Font getXAxisFont()
public void setXAxisFont(Font axisFont)
axisFont
- the label font of x axis of this chartpublic Font getYAxisTickFont()
public void setYAxisTickFont(Font axisTickFont)
axisTickFont
- the tick number font of y axis of this chartpublic Font getYAxisFont()
public void setYAxisFont(Font axisFont)
axisFont
- the tick number font of y axis of this chartpublic ChartEngine getEngine() throws org.zkoss.zk.ui.UiException
org.zkoss.zk.ui.UiException
- if failed to load the engine.protected ChartEngine newChartEngine() throws org.zkoss.zk.ui.UiException
setEngine(org.zkoss.zul.impl.ChartEngine)
is not called with non-null
engine.
By default, it looks up the library property called
org.zkoss.zul.chart.engine.class.
If found, the value is assumed to be
the class name of the chart engine (it must implement
ChartEngine
).
If not found, UiException
is thrown.
Derived class might override this method to provide your own default class.
org.zkoss.zk.ui.UiException
- if failed to instantiate the enginepublic void setEngine(ChartEngine engine)
public void setEngine(String clsnm) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException
public ChartAreaListener getAreaListener()
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.
listener
- the area listener, or null to ignore it.org.zkoss.zk.ui.UiException
- if failed to initialize.public void setAreaListener(String clsnm) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException
protected void smartDrawChart()
public boolean addEventListener(String evtnm, org.zkoss.zk.ui.event.EventListener<? extends org.zkoss.zk.ui.event.Event> listener)
addEventListener
in interface org.zkoss.zk.ui.Component
addEventListener
in class org.zkoss.zk.ui.AbstractComponent
public Object clone()
clone
in interface org.zkoss.zk.ui.Component
clone
in class XulElement
public void onPageAttached(org.zkoss.zk.ui.Page newpage, org.zkoss.zk.ui.Page oldpage)
onPageAttached
in interface org.zkoss.zk.ui.sys.ComponentCtrl
onPageAttached
in class org.zkoss.zk.ui.AbstractComponent
public void onPageDetached(org.zkoss.zk.ui.Page page)
onPageDetached
in interface org.zkoss.zk.ui.sys.ComponentCtrl
onPageDetached
in class org.zkoss.zk.ui.AbstractComponent
Copyright © 2019. All rights reserved.