Package com.storedobject.svg.chart
Class Chart<C extends Chart<C>>
java.lang.Object
com.storedobject.svg.Node<C>
com.storedobject.svg.chart.Chart<C>
- Type Parameters:
C- Type of the chart itself.
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Bars,LinePlot,Pie,VerticalBars
Base class for all SVG charts.
- Author:
- Syam
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddValue(Values.Value value) Add a data value.Add a data value with a label.protected voidbuild()Build the chart.voidcolorize()Automatically assign colors to data points.protected final voidcompute()This method is invoked to perform any necessary computations just before the SVG content is generated.protected StringProvides additional content specific to the node.Get the data values.final booleanisBuilt()Check if the chart is built.voidsetLabelName(String labelName) Set the label name (typically used as X-axis name).voidSet the unit for values.voidsetValueName(String valueName) Set the value name (typically used as Y-axis name).protected Stringtag()Charts do not have a specific tag.Methods inherited from class com.storedobject.svg.Node
attributes, copy, createDocument, equals, escapeXml, flipHorizontally, flipHorizontallyAroundOrigin, flipVertically, flipVerticallyAroundOrigin, getCoordinates, getId, getMargin, getSvg, hashCode, id, ID, IDValue, innerContent, moveTo, moveTo, rotate, rotateAround, rotateAround, rotateAroundCenter, scale, scale, scaleHeightTo, scaleTo, scaleWidthTo, styles, toString, toString, transform, translate, translate
-
Field Details
-
values
Data values of the chart. -
svg
SVG representation of the chart.
-
-
Constructor Details
-
Chart
-
-
Method Details
-
getValues
-
addValue
Add a data value.- Parameters:
value- The value to add.- Returns:
- The added value object for convenience. However, it could be different from the input value if it needs to be modified to adjust its properties.
-
addValue
Add a data value with a label.- Parameters:
label- The label for the value.value- The value.- Returns:
- The added value object for convenience.
-
setLabelName
Set the label name (typically used as X-axis name).- Parameters:
labelName- Label name.
-
setValueName
Set the value name (typically used as Y-axis name).- Parameters:
valueName- Value name.
-
setUnit
-
colorize
public void colorize()Automatically assign colors to data points. -
tag
-
extraContent
Description copied from class:NodeProvides additional content specific to the node. This method is intended to be overridden by subclasses to define custom extra content specific to their implementation. By default, it returns null if no additional content is defined.Note: The extra content should be formatted as per SVG standards with appropriate tags. No validation is performed on the extra content.
- Overrides:
extraContentin classNode<C extends Chart<C>>- Returns:
- A string representing the extra content of the node, or null if no extra content is defined.
-
compute
-
build
-
isBuilt
public final boolean isBuilt()Check if the chart is built.- Returns:
- True if built.
-