Package com.day.cq.wcm.foundation
Class Chart
- java.lang.Object
-
- com.day.cq.wcm.foundation.Chart
-
public class Chart extends Object
Provides convenience methods for displaying charts.
-
-
Field Summary
Fields Modifier and Type Field Description static StringBAR_CHART_TYPEvalue of the bar chart typestatic ColorDEFAULT_DATA_COLORDefault data colorstatic StringLINE_CHART_TYPEvalue of the line chart typestatic StringPIE_CHART_TYPEvalue of the pie chart typestatic StringPN_ALTname of the alt name propertystatic StringPN_BC_BAR_SPACINGname of the bar spacing property for bar chartsstatic StringPN_BC_BAR_WIDTHname of the bar width property for bar chartsstatic StringPN_BG_COLORname of the background color propertystatic StringPN_CHART_TYPEname of the chart type propertystatic StringPN_DATAname of the data propertystatic StringPN_DATA_COLORSname of the data color propertystatic StringPN_HEIGHTname of the width propertystatic StringPN_LABEL_COLORname of the label color propertystatic StringPN_LC_LINE_WIDTHname of the line width property for line chartsstatic StringPN_LINE_COLORname of the line color propertystatic StringPN_PC_START_ANGLEname of the start angle property for pie chartsstatic StringPN_TITLEname of the title propertystatic StringPN_WIDTHname of the width property
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectget(String name)Get a property either from the overlaid map or the underlying properties.StringgetAlt()Returns the chart alt name as defined by "chartAlt"LayergetChartLayer()Returns the chart layer of this chart.ColorgetColor(String name)Get a color either from the overlaid map or the underlying properties.DoublegetDouble(String name)Get a double property either from the overlaid map or the underlying properties.FloatgetFloat(String name)Get a float property either from the overlaid map or the underlying properties.IntegergetInt(String name)Get a integer property either from the overlaid map or the underlying properties.LayergetLegendLayer()Returns the legend layer of this chart.StringgetString(String name)Get a string property either from the overlaid map or the underlying properties.booleanhasData()Checks if this chart has contentvoidloadStyleData(Style style)Loads several definitions from style.
-
-
-
Field Detail
-
PIE_CHART_TYPE
public static final String PIE_CHART_TYPE
value of the pie chart type- See Also:
- Constant Field Values
-
BAR_CHART_TYPE
public static final String BAR_CHART_TYPE
value of the bar chart type- See Also:
- Constant Field Values
-
LINE_CHART_TYPE
public static final String LINE_CHART_TYPE
value of the line chart type- See Also:
- Constant Field Values
-
PN_TITLE
public static final String PN_TITLE
name of the title property- See Also:
- Constant Field Values
-
PN_CHART_TYPE
public static final String PN_CHART_TYPE
name of the chart type property- See Also:
- Constant Field Values
-
PN_ALT
public static final String PN_ALT
name of the alt name property- See Also:
- Constant Field Values
-
PN_DATA
public static final String PN_DATA
name of the data property- See Also:
- Constant Field Values
-
PN_WIDTH
public static final String PN_WIDTH
name of the width property- See Also:
- Constant Field Values
-
PN_HEIGHT
public static final String PN_HEIGHT
name of the width property- See Also:
- Constant Field Values
-
PN_PC_START_ANGLE
public static final 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 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 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 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 String PN_BG_COLOR
name of the background color property- See Also:
- Constant Field Values
-
PN_LABEL_COLOR
public static final String PN_LABEL_COLOR
name of the label color property- See Also:
- Constant Field Values
-
PN_LINE_COLOR
public static final String PN_LINE_COLOR
name of the line color property- See Also:
- Constant Field Values
-
PN_DATA_COLORS
public static final String PN_DATA_COLORS
name of the data color property- See Also:
- Constant Field Values
-
DEFAULT_DATA_COLOR
public static final 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:
IllegalArgumentException- if the given resource is not adaptable to node.
-
-
Method Detail
-
hasData
public boolean hasData()
Checks if this chart has content- Returns:
trueif this chart has content
-
getAlt
public String getAlt()
Returns the chart alt name as defined by "chartAlt"- Returns:
- the alt name
- See Also:
PN_ALT
-
get
public Object get(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 String getString(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 Integer getInt(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 Double getDouble(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 Float getFloat(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 Color getColor(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 IOException, RepositoryException
Returns the chart layer of this chart.- Returns:
- the layer
- Throws:
IOException- if an I/O error occurs.RepositoryException- if a repository error occurs.
-
getLegendLayer
public Layer getLegendLayer() throws IOException, RepositoryException
Returns the legend layer of this chart.- Returns:
- the layer
- Throws:
IOException- if an I/O error occurs.RepositoryException- if a repository error occurs.
-
-