Package com.storedobject.chart
Class XRangeChart<X,Y>
java.lang.Object
com.storedobject.chart.XRangeChart<X,Y>
- Type Parameters:
X
- Type of data on the X-axis.Y
- Type of data on the Y-axis.
- All Implemented Interfaces:
ComponentGroup
X-range chart. X-range charts are used to visualize a range on the X-axis. It is plotted on a
RectangularCoordinate
system a range of values on the X-axis with corresponding Y-axis values.
Each X range-value is represented using a horizontal bar. Typically, X-values are of DataType.NUMBER
,
DataType.DATE
or DataType.TIME
and Y-values are of DataType.CATEGORY
. However, the
Y-values could be of other types too.
Note: This chart automatically creates its coordinate system and the required axes.
- Author:
- Syam
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a data value.void
Add a data value.void
addData
(X xLowerValue, X xUpperValue, Y yValue, Color color, double progressPercentage, String extraInfo) Add a data value.void
Add a data value.void
Add a data value.void
addData
(X xLowerValue, X xUpperValue, Y yValue, String label, Color color, double progressPercentage) Add a data value.void
addData
(X xLowerValue, X xUpperValue, Y yValue, String label, Color color, double progressPercentage, String extraInfo) Add a data value.void
Add a data value.void
Add parts of this group toSOChart
.void
Clear all data values.formatValue
(Object value) Format a value to show as part of the tooltip.formatXValue
(X value) Format an X-value to show as part of the tooltip.formatXValue
(X xLowerValue, X xUpperValue) Format the X-values to show as part of the tooltip.formatYValue
(Y value) Format a Y-value to show as part of the tooltip.Return the co-ordinate system used by this chart.getTooltipText
(X xLowerValue, X xUpperValue, Y yValue, String label, double progress, String extraInfo) Format a data point to show it as the tooltip.getXAxis()
Get the X-axis.getXZoom
(boolean create) Get the data zoom component for the X-axis.getYAxis()
Get the Y-axis.getYZoom
(boolean create) Get the data zoom component for the Y-axis.void
removeParts
(SOChart soChart) Remove parts of this group fromSOChart
.void
setYData
(CategoryDataProvider yData) Set data for the Y-Axis.void
showProgressBar
(boolean showProgress) Whether to render a progress bar or not.void
showProgressLabel
(boolean showProgressLabel) Whether to render a progress label or not.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.storedobject.chart.ComponentGroup
validate
-
Constructor Details
-
XRangeChart
public XRangeChart()
-
-
Method Details
-
addData
Add a data value.- Parameters:
xLowerValue
- Lower value of the X-range.xUpperValue
- Upper value of the X-range.yValue
- Y-value.label
- A label to be rendered on the bar. (Could be null or empty string if you don't want a label).color
- Color of the bar.
-
addData
public void addData(X xLowerValue, X xUpperValue, Y yValue, String label, Color color, String extraInfo) Add a data value.- Parameters:
xLowerValue
- Lower value of the X-range.xUpperValue
- Upper value of the X-range.yValue
- Y-value.label
- A label to be rendered on the bar. (Could be null or empty string if you don't want a label).color
- Color of the bar.extraInfo
- Extra information (Can be used to set the tooltip text for the bar).
-
addData
Add a data value.- Parameters:
xLowerValue
- Lower value of the X-range.xUpperValue
- Upper value of the X-range.yValue
- Y-value.color
- Color of the bar.progressPercentage
- Progress percentage. (Will be shown on the bar with a different color).
-
addData
public void addData(X xLowerValue, X xUpperValue, Y yValue, Color color, double progressPercentage, String extraInfo) Add a data value.- Parameters:
xLowerValue
- Lower value of the X-range.xUpperValue
- Upper value of the X-range.yValue
- Y-value.color
- Color of the bar.progressPercentage
- Progress percentage. (Will be shown on the bar with a different color).extraInfo
- Extra information (Can be used to set the tooltip text for the bar).
-
addData
-
addData
Add a data value.- Parameters:
xLowerValue
- Lower value of the X-range.xUpperValue
- Upper value of the X-range.yValue
- Y-value.color
- Color of the bar.extraInfo
- Extra information (Can be used to set the tooltip text for the bar).
-
addData
public void addData(X xLowerValue, X xUpperValue, Y yValue, String label, Color color, double progressPercentage) Add a data value.- Parameters:
xLowerValue
- Lower value of the X-range.xUpperValue
- Upper value of the X-range.yValue
- Y-value.label
- A label to be rendered on the bar. (Could be null or empty string if you don't want a label).color
- Color of the bar.progressPercentage
- Progress percentage. (Will be shown on the bar with a different color).
-
addData
public void addData(X xLowerValue, X xUpperValue, Y yValue, String label, Color color, double progressPercentage, String extraInfo) Add a data value.- Parameters:
xLowerValue
- Lower value of the X-range.xUpperValue
- Upper value of the X-range.yValue
- Y-value.label
- A label to be rendered on the bar. (Could be null or empty string if you don't want a label).color
- Color of the bar.progressPercentage
- Progress percentage. (Will be shown on the bar with a different color).extraInfo
- Extra information (Can be used to set the tooltip text for the bar).
-
clearData
public void clearData()Clear all data values. -
addParts
Description copied from interface:ComponentGroup
Add parts of this group toSOChart
. This will be invoked if the group was already added to theSOChart
, and it is about to be rendered.- Specified by:
addParts
in interfaceComponentGroup
- Parameters:
soChart
- Chart to which parts to be added.
-
removeParts
Description copied from interface:ComponentGroup
Remove parts of this group fromSOChart
. This will be invoked when the group is removed from theSOChart
. This method should make sure that all the parts are removed properly including their dependencies.- Specified by:
removeParts
in interfaceComponentGroup
- Parameters:
soChart
- Chart from which parts to be removed.
-
getXZoom
Get the data zoom component for the X-axis.- Parameters:
create
- Create if not already exists.- Returns:
- Zoom data.
-
getYZoom
Get the data zoom component for the Y-axis.- Parameters:
create
- Create if not already exists.- Returns:
- Zoom data.
-
showProgressBar
public void showProgressBar(boolean showProgress) Whether to render a progress bar or not.- Parameters:
showProgress
- True/false.
-
showProgressLabel
public void showProgressLabel(boolean showProgressLabel) Whether to render a progress label or not.- Parameters:
showProgressLabel
- True/false.
-
getXAxis
-
getYAxis
-
setYData
Set data for the Y-Axis. This may be required to render the Y-axis labels in proper order. However, it is not required unless the Y-axis is not ofDataType.CATEGORY
.- Parameters:
yData
- Y-data.
-
getCoordinateSystem
Return the co-ordinate system used by this chart. (It will be a rectangular co-ordinate system).- Returns:
- Rectangular co-ordinate system. (An instance of
RectangularCoordinate
).
-
formatValue
-
formatYValue
Format a Y-value to show as part of the tooltip. (A null may be returned to ignore the value). By default, it invokesformatValue(Object)
and adds a colon followed by a space.- Parameters:
value
- Value to format.- Returns:
- Formatted value.
-
formatXValue
Format an X-value to show as part of the tooltip. (A null may be returned to ignore the value). By default, it invokesformatValue(Object)
.- Parameters:
value
- Value to format.- Returns:
- Formatted value.
-
formatXValue
Format the X-values to show as part of the tooltip. (A null may be returned to ignore the value). By default, it invokesformatXValue(Object)
for each of the values and concatenate it with a dash (" - ") as the delimiter.- Parameters:
xLowerValue
- Lower value of the X-range.xUpperValue
- Upper value of the X-range.- Returns:
- Formatted value.
-
getTooltipText
public String getTooltipText(X xLowerValue, X xUpperValue, Y yValue, String label, double progress, String extraInfo) Format a data point to show it as the tooltip.- Parameters:
xLowerValue
- Lower value of the X-range.xUpperValue
- Upper value of the X-range.yValue
- Y-value.label
- Label.progress
- Progress percentage.extraInfo
- Extra information.- Returns:
- Formatted value.
-