Package org.zkoss.chart.model
Class DefaultDialModel
- java.lang.Object
-
- org.zkoss.chart.model.AbstractChartsModel
-
- org.zkoss.chart.model.DefaultDialModel
-
- All Implemented Interfaces:
Serializable
,ChartsModel
,DialModel
public class DefaultDialModel extends AbstractChartsModel implements DialModel
A data model to be used with dial chart.- Author:
- jumperchen
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.zkoss.chart.model.AbstractChartsModel
_listeners
-
-
Constructor Summary
Constructors Constructor Description DefaultDialModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
clear the model.Object
clone()
protected void
fireEvent(int type, String propertyKey, Object data)
Fire the chart data event with the given property key.double
getCapRadius()
Return the radius percentage(0 ~ 1) of the meter's cap; default to 0.07.int
getFrameBgAlpha()
Get the background alpha of the dial frame (transparency, 0 ~ 255, opacue).String
getFrameBgColor()
Get the background color of the dial frame (in string as #RRGGBB).String
getFrameBgColor1()
Get the 1st background color of the dial frame (in string as #RRGGBB) for gradient starting color.String
getFrameBgColor2()
Get the 2nd background color of the dial frame (in string as #RRGGBB) for gradient ending color.int[]
getFrameBgRGB()
Get the background color of the dial frame in int array (0: red, 1: green, 2:blue).int[]
getFrameBgRGB1()
Get the 1st background color of the dial frame in int array (0: red, 1: green, 2:blue) for gradient starting color.int[]
getFrameBgRGB2()
Get the 2nd background color of the dial frame in int array (0: red, 1: green, 2:blue) for gradient ending color.String
getFrameFgColor()
Get the foreground color of the dial frame (in string as #RRGGBB).int[]
getFrameFgRGB()
Get the foreground color of the dial frame in int array (0: red, 1: green, 2:blue).String
getGradientDirection()
Returns the Frame background gradient color direction (from bgColor1 to bgColor2); center_horizontal, center_vertical, horizontal, vertical.DialModelScale
getScale(int index)
Returns theDialModelScale
of the specified index.double
getValue(int index)
Get value of the scale per the specified index.int
indexOf(DialModelScale entry)
Return the index of the specified model entry.DialModelScale
newScale()
new an instance of scale in this DialModel.DialModelScale
newScale(double lowerBound, double upperBound, double startAngle, double extent, double majorTickInterval, int minorTickCount)
new an instance of scale in this DialModel.void
removeScale(DialModelScale scale)
Remove the specified DialModelScale from this DialModel.void
setCapRadius(double radius)
Sets the radius percentage(0 ~ 1) of the meter's cap; default to 0.07.void
setFrameBgAlpha(int alpha)
Set the background alpha of the dial frame (transparency, 0 ~ 255).void
setFrameBgColor(String color)
Set the background color of the dial frame.void
setFrameBgColor1(String color)
Set the 1st background color of the dial frame (for gradient starting color).void
setFrameBgColor2(String color)
Set the 2nd background color of the dial frame (for gradient ending color).void
setFrameFgColor(String color)
Set the foreground color of the dial frame.void
setGradientDirection(String direction)
Set the Frame background gradient color direction (from bgColor1 to bgColor2); center_horizontal, center_vertical, horizontal, vertical.void
setValue(int index, double value)
add or update the value of a specified scale index.int
size()
Returns the number ofDialModelScale
s.-
Methods inherited from class org.zkoss.chart.model.AbstractChartsModel
addChartsDataListener, fireEvent, removeChartsDataListener
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.zkoss.chart.model.ChartsModel
addChartsDataListener, removeChartsDataListener
-
-
-
-
Method Detail
-
size
public int size()
Description copied from interface:DialModel
Returns the number ofDialModelScale
s.
-
newScale
public DialModelScale newScale()
Description copied from interface:DialModel
new an instance of scale in this DialModel.
-
newScale
public DialModelScale newScale(double lowerBound, double upperBound, double startAngle, double extent, double majorTickInterval, int minorTickCount)
Description copied from interface:DialModel
new an instance of scale in this DialModel.- Specified by:
newScale
in interfaceDialModel
- Parameters:
lowerBound
- lower bound of this scale.upperBound
- upper bound of this scale.startAngle
- starting angle in degree associated to the sclae's lower bound(0 degree point to east, counter-clockwise is positive).extent
- angles in degree extended from the starting angle (counter clockwise is positive).majorTickInterval
- the interval between major tick (in lower bound and upper bound).minorTickCount
- the number of minor ticks between major tick.
-
indexOf
public int indexOf(DialModelScale entry)
Description copied from interface:DialModel
Return the index of the specified model entry.
-
getScale
public DialModelScale getScale(int index)
Description copied from interface:DialModel
Returns theDialModelScale
of the specified index.
-
removeScale
public void removeScale(DialModelScale scale)
Description copied from interface:DialModel
Remove the specified DialModelScale from this DialModel.- Specified by:
removeScale
in interfaceDialModel
-
getValue
public double getValue(int index)
Description copied from interface:DialModel
Get value of the scale per the specified index.
-
setValue
public void setValue(int index, double value)
Description copied from interface:DialModel
add or update the value of a specified scale index.
-
clear
public void clear()
Description copied from interface:DialModel
clear the model.
-
setFrameBgAlpha
public void setFrameBgAlpha(int alpha)
Description copied from interface:DialModel
Set the background alpha of the dial frame (transparency, 0 ~ 255).- Specified by:
setFrameBgAlpha
in interfaceDialModel
- Parameters:
alpha
- the transparency of background color (0 ~ 255, default to 255 opaque).
-
getFrameBgAlpha
public int getFrameBgAlpha()
Description copied from interface:DialModel
Get the background alpha of the dial frame (transparency, 0 ~ 255, opacue).- Specified by:
getFrameBgAlpha
in interfaceDialModel
-
setFrameBgColor
public void setFrameBgColor(String color)
Description copied from interface:DialModel
Set the background color of the dial frame.- Specified by:
setFrameBgColor
in interfaceDialModel
- Parameters:
color
- in #RRGGBB format (hexadecimal).
-
getFrameBgColor
public String getFrameBgColor()
Description copied from interface:DialModel
Get the background color of the dial frame (in string as #RRGGBB). null means default.- Specified by:
getFrameBgColor
in interfaceDialModel
-
getFrameBgRGB
public int[] getFrameBgRGB()
Description copied from interface:DialModel
Get the background color of the dial frame in int array (0: red, 1: green, 2:blue). null means default.- Specified by:
getFrameBgRGB
in interfaceDialModel
-
setFrameFgColor
public void setFrameFgColor(String color)
Description copied from interface:DialModel
Set the foreground color of the dial frame.- Specified by:
setFrameFgColor
in interfaceDialModel
- Parameters:
color
- in #RRGGBB format (hexadecimal).
-
getFrameFgColor
public String getFrameFgColor()
Description copied from interface:DialModel
Get the foreground color of the dial frame (in string as #RRGGBB). null means default.- Specified by:
getFrameFgColor
in interfaceDialModel
-
getFrameFgRGB
public int[] getFrameFgRGB()
Description copied from interface:DialModel
Get the foreground color of the dial frame in int array (0: red, 1: green, 2:blue). null means default.- Specified by:
getFrameFgRGB
in interfaceDialModel
-
setFrameBgColor1
public void setFrameBgColor1(String color)
Description copied from interface:DialModel
Set the 1st background color of the dial frame (for gradient starting color).- Specified by:
setFrameBgColor1
in interfaceDialModel
- Parameters:
color
- in #RRGGBB format (hexadecimal).
-
getFrameBgColor1
public String getFrameBgColor1()
Description copied from interface:DialModel
Get the 1st background color of the dial frame (in string as #RRGGBB) for gradient starting color. null means use default.- Specified by:
getFrameBgColor1
in interfaceDialModel
-
getFrameBgRGB1
public int[] getFrameBgRGB1()
Description copied from interface:DialModel
Get the 1st background color of the dial frame in int array (0: red, 1: green, 2:blue) for gradient starting color. null means use default.- Specified by:
getFrameBgRGB1
in interfaceDialModel
-
setFrameBgColor2
public void setFrameBgColor2(String color)
Description copied from interface:DialModel
Set the 2nd background color of the dial frame (for gradient ending color).- Specified by:
setFrameBgColor2
in interfaceDialModel
- Parameters:
color
- in #RRGGBB format (hexadecimal).
-
getFrameBgColor2
public String getFrameBgColor2()
Description copied from interface:DialModel
Get the 2nd background color of the dial frame (in string as #RRGGBB) for gradient ending color. null means default.- Specified by:
getFrameBgColor2
in interfaceDialModel
-
getFrameBgRGB2
public int[] getFrameBgRGB2()
Description copied from interface:DialModel
Get the 2nd background color of the dial frame in int array (0: red, 1: green, 2:blue) for gradient ending color. null means default.- Specified by:
getFrameBgRGB2
in interfaceDialModel
-
setGradientDirection
public void setGradientDirection(String direction)
Description copied from interface:DialModel
Set the Frame background gradient color direction (from bgColor1 to bgColor2); center_horizontal, center_vertical, horizontal, vertical.- Specified by:
setGradientDirection
in interfaceDialModel
-
getGradientDirection
public String getGradientDirection()
Description copied from interface:DialModel
Returns the Frame background gradient color direction (from bgColor1 to bgColor2); center_horizontal, center_vertical, horizontal, vertical.- Specified by:
getGradientDirection
in interfaceDialModel
-
setCapRadius
public void setCapRadius(double radius)
Description copied from interface:DialModel
Sets the radius percentage(0 ~ 1) of the meter's cap; default to 0.07.- Specified by:
setCapRadius
in interfaceDialModel
- Parameters:
radius
- the radius percentage(0 ~ 1) of the meter's cap.
-
getCapRadius
public double getCapRadius()
Description copied from interface:DialModel
Return the radius percentage(0 ~ 1) of the meter's cap; default to 0.07.- Specified by:
getCapRadius
in interfaceDialModel
- Returns:
- the radius percentage(0 ~ 1) of the meter's cap.
-
fireEvent
protected void fireEvent(int type, String propertyKey, Object data)
Fire the chart data event with the given property key.- Parameters:
type
-propertyKey
-data
-
-
clone
public Object clone()
- Overrides:
clone
in classAbstractChartsModel
-
-