Package com.day.cq.wcm.foundation
Class Chart
- java.lang.Object
-
- com.day.cq.wcm.foundation.Chart
-
public class Chart extends java.lang.Object
Provides convenience methods for displaying charts.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BAR_CHART_TYPE
value of the bar chart typestatic java.awt.Color
DEFAULT_DATA_COLOR
Default data colorstatic java.lang.String
LINE_CHART_TYPE
value of the line chart typestatic java.lang.String
PIE_CHART_TYPE
value of the pie chart typestatic java.lang.String
PN_ALT
name of the alt name propertystatic java.lang.String
PN_BC_BAR_SPACING
name of the bar spacing property for bar chartsstatic java.lang.String
PN_BC_BAR_WIDTH
name of the bar width property for bar chartsstatic java.lang.String
PN_BG_COLOR
name of the background color propertystatic java.lang.String
PN_CHART_TYPE
name of the chart type propertystatic java.lang.String
PN_DATA
name of the data propertystatic java.lang.String
PN_DATA_COLORS
name of the data color propertystatic java.lang.String
PN_HEIGHT
name of the width propertystatic java.lang.String
PN_LABEL_COLOR
name of the label color propertystatic java.lang.String
PN_LC_LINE_WIDTH
name of the line width property for line chartsstatic java.lang.String
PN_LINE_COLOR
name of the line color propertystatic java.lang.String
PN_PC_START_ANGLE
name of the start angle property for pie chartsstatic java.lang.String
PN_TITLE
name of the title propertystatic java.lang.String
PN_WIDTH
name of the width property
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
get(java.lang.String name)
Get a property either from the overlaid map or the underlying properties.java.lang.String
getAlt()
Returns the chart alt name as defined by "chartAlt"Layer
getChartLayer()
Returns the chart layer of this chart.java.awt.Color
getColor(java.lang.String name)
Get a color either from the overlaid map or the underlying properties.java.lang.Double
getDouble(java.lang.String name)
Get a double property either from the overlaid map or the underlying properties.java.lang.Float
getFloat(java.lang.String name)
Get a float property either from the overlaid map or the underlying properties.java.lang.Integer
getInt(java.lang.String name)
Get a integer property either from the overlaid map or the underlying properties.Layer
getLegendLayer()
Returns the legend layer of this chart.java.lang.String
getString(java.lang.String name)
Get a string property either from the overlaid map or the underlying properties.boolean
hasData()
Checks if this chart has contentvoid
loadStyleData(Style style)
Loads several definitions from style.
-
-
-
Field Detail
-
PIE_CHART_TYPE
public static final java.lang.String PIE_CHART_TYPE
value of the pie chart type- See Also:
- Constant Field Values
-
BAR_CHART_TYPE
public static final java.lang.String BAR_CHART_TYPE
value of the bar chart type- See Also:
- Constant Field Values
-
LINE_CHART_TYPE
public static final java.lang.String LINE_CHART_TYPE
value of the line chart type- See Also:
- Constant Field Values
-
PN_TITLE
public static final java.lang.String PN_TITLE
name of the title property- See Also:
- Constant Field Values
-
PN_CHART_TYPE
public static final java.lang.String PN_CHART_TYPE
name of the chart type property- See Also:
- Constant Field Values
-
PN_ALT
public static final java.lang.String PN_ALT
name of the alt name property- See Also:
- Constant Field Values
-
PN_DATA
public static final java.lang.String PN_DATA
name of the data property- See Also:
- Constant Field Values
-
PN_WIDTH
public static final java.lang.String PN_WIDTH
name of the width property- See Also:
- Constant Field Values
-
PN_HEIGHT
public static final java.lang.String PN_HEIGHT
name of the width property- See Also:
- Constant Field Values
-
PN_PC_START_ANGLE
public static final java.lang.String PN_PC_START_ANGLE
name of the start angle property for pie charts- See Also:
- Constant Field Values
-
PN_LC_LINE_WIDTH
public static final java.lang.String PN_LC_LINE_WIDTH
name of the line width property for line charts- See Also:
- Constant Field Values
-
PN_BC_BAR_WIDTH
public static final java.lang.String PN_BC_BAR_WIDTH
name of the bar width property for bar charts- See Also:
- Constant Field Values
-
PN_BC_BAR_SPACING
public static final java.lang.String PN_BC_BAR_SPACING
name of the bar spacing property for bar charts- See Also:
- Constant Field Values
-
PN_BG_COLOR
public static final java.lang.String PN_BG_COLOR
name of the background color property- See Also:
- Constant Field Values
-
PN_LABEL_COLOR
public static final java.lang.String PN_LABEL_COLOR
name of the label color property- See Also:
- Constant Field Values
-
PN_LINE_COLOR
public static final java.lang.String PN_LINE_COLOR
name of the line color property- See Also:
- Constant Field Values
-
PN_DATA_COLORS
public static final java.lang.String PN_DATA_COLORS
name of the data color property- See Also:
- Constant Field Values
-
DEFAULT_DATA_COLOR
public static final java.awt.Color DEFAULT_DATA_COLOR
Default data color
-
-
Constructor Detail
-
Chart
public Chart(Resource resource)
Creates a new chart based on the given resource.- Parameters:
resource
- resource of the chart- Throws:
java.lang.IllegalArgumentException
- if the given resource is not adaptable to node.
-
-
Method Detail
-
hasData
public boolean hasData()
Checks if this chart has content- Returns:
true
if this chart has content
-
getAlt
public java.lang.String getAlt()
Returns the chart alt name as defined by "chartAlt"- Returns:
- the alt name
- See Also:
PN_ALT
-
get
public java.lang.Object get(java.lang.String name)
Get a property either from the overlaid map or the underlying properties.- Parameters:
name
- name of the property- Returns:
- value of the property or null
-
getString
public java.lang.String getString(java.lang.String name)
Get a string property either from the overlaid map or the underlying properties.- Parameters:
name
- name of the property- Returns:
- string value of the property or null
-
getInt
public java.lang.Integer getInt(java.lang.String name)
Get a integer property either from the overlaid map or the underlying properties.- Parameters:
name
- name of the property- Returns:
- integer value of the property or null
-
getDouble
public java.lang.Double getDouble(java.lang.String name)
Get a double property either from the overlaid map or the underlying properties.- Parameters:
name
- name of the property- Returns:
- double value of the property or null
-
getFloat
public java.lang.Float getFloat(java.lang.String name)
Get a float property either from the overlaid map or the underlying properties.- Parameters:
name
- name of the property- Returns:
- double value of the property or null
-
getColor
public java.awt.Color getColor(java.lang.String name)
Get a color either from the overlaid map or the underlying properties.- Parameters:
name
- name of the property- Returns:
- Color color of the property or null
-
loadStyleData
public void loadStyleData(Style style)
Loads several definitions from style.- Parameters:
style
- style to load definitions from
-
getChartLayer
public Layer getChartLayer() throws java.io.IOException, RepositoryException
Returns the chart layer of this chart.- Returns:
- the layer
- Throws:
java.io.IOException
- if an I/O error occurs.RepositoryException
- if a repository error occurs.
-
getLegendLayer
public Layer getLegendLayer() throws java.io.IOException, RepositoryException
Returns the legend layer of this chart.- Returns:
- the layer
- Throws:
java.io.IOException
- if an I/O error occurs.RepositoryException
- if a repository error occurs.
-
-