Class PopulationPyramidChart
- All Implemented Interfaces:
DataDescriptorCallback
,ClickableChartData<PopulationPyramidChart>
,DualSeriesChart<PopulationPyramidChart,
,BarSeries> SupportBrush<PopulationPyramidChart>
,SupportLasso<PopulationPyramidChart>
,SupportZoom<PopulationPyramidChart>
A population pyramid is a chart that enables you to compare two different data sets. Consequently, the chart must have two data series. Data series are displayed as horizontal bars. A population pyramid is a horizontal chart with a vertical X axis and a horizontal Y axis. The X axis is displayed in the center of the chart, with the data series’ bars extending to the left and right. Series colors are automatically determined. Also, you can modify these colors to obtain the desired color scheme.
You can modify the tooltip type or create a custom tooltip using any JBStrap component. By default, a population pyramid chart
uses three different tooltip types, each one displaying data points differently. You can use the following tooltip types on a population pyramid:
DOT
, LINE
and SIMPLE
. By default, the simple tooltip is displayed on the chart. If you want to display a different tooltip type,
you need to create it on your own using ChartTooltipRenderer
. You only need to implement one method
which returns the tooltip as a component. In order to do this, you can reuse any JBStrap component.
It is possible to display a button, a list or even another chart on the tooltip.
The chart also supports click events. This means that you can implement server-side business logic for the event that is triggered when a user clicks on
a data point. This is when a ChartClick
event is triggered. This event provides you information on where and which chart
the user clicked on. This can be reused in various ways, e.g. to update a list.
The chart also supports the lasso feature. This function is disabled by default. If enabled, the user is allowed to select one or more
data points. You can select a data point by circling the data points on the chart. You can make a selection on multiple charts or series
at the same time. If a user selects multiple data points on the chart, a Lasso
event is triggered on the server side. This event is associated with
every selection. If a user selects a data point on a chart, the event is triggered on every
chart. The lasso event contains information on the selected chart and series. This piece of information can be then
used in any business logic, e.g. to group data points or conduct further analysis.
The chart also supports the zoom feature. This function is disabled by default. If you enable it, the user is allowed to zoom in on a chart area by using the mouse scroll wheel, thereby allowing a closer look at the details. If a user zooms in on the chart while the lasso feature is disabled, it is possible to horizontally move the chart by keeping the mouse button pressed. If the lasso feature is enabled, users are not allowed to move the chart as the lasso feature is active when keeping the mouse button pressed.
This chart supports the brush feature which works with the zoom feature. This function is disabled by default. If you enable it, a miniature version of the chart appears below the chart. Users can zoom in on the chart, but in this case the miniature version of the chart is not zoomed. Instead, a small dark area indicates the area of the chart currently displayed on the normal size chart. Users can move this darker area, at the same time moving the zoomed area on the normal size chart. If you use this feature alongside the lasso feature, users are able to use all functionalities of these features on the chart.
- Since:
- 4.0
- Author:
- JBStrap
- See Also:
-
Field Summary
Fields inherited from class com.jbstrap.ui.components.charts.AxesBasedChart
FONT_COLOR, FORMAT, HORIZONTAL, MAX_VALUE, MIN_VALUE, POSTFIX, PREFIX, SHOW, SHOW_GRID, SHOW_LINE, SHOW_TICKS, SHOW_VALUE_LABEL, STRIPED, STRIPED_START, SUPPORTED_TOOLTIP_TYPES, TICK_TEXT_ROTATE, TITLE, X_AXIS, Y_AXIS
Fields inherited from class com.jbstrap.ui.components.charts.SeriesBasedChart
categoryColumn, dataDescriptor, defaultFilterCriteria, filterCriteria, series
Fields inherited from class com.jbstrap.ui.components.charts.BaseChart
brushable, canvas, defaultTooltipType, handlers, NAME, params, supportedTooltipTypes, tooltipContent, tooltipType, zoomable
Fields inherited from interface com.jbstrap.ui.components.charts.SupportLasso
LASSO
-
Constructor Summary
ConstructorDescriptionPopulationPyramidChart
(String name) Creates the population pyramid.PopulationPyramidChart
(String name, DataDescriptor dataDescriptor, String categoryColumnName) Creates a population pyramid and sets the associated DataDescriptor and the name of the column containing Y axis values. -
Method Summary
Modifier and TypeMethodDescriptionAdds a series to the chart.protected void
init()
Chart initialization.protected boolean
isLeftSeries
(Series series) Checks if the series specified in the parameter is the series on the left side of the chart.void
The method is invoked, if the async data handling operation was successful.Methods inherited from class com.jbstrap.ui.components.charts.AxesBasedChart
getXAxis, getXAxisDateFormat, getXAxisFontColor, getXAxisStripedStrart, getXAxisTickTextRotate, getXAxisTitle, getXAxisType, getXAxisValuePostfix, getXAxisValuePrefix, getYAxis, getYAxisFontColor, getYAxisMaxValue, getYAxisMinValue, getYAxisStripedStrart, getYAxisTitle, getYAxisValuePostfix, getYAxisValuePrefix, isXAxisShow, isXAxisShowGrid, isXAxisShowLine, isXAxisShowTicks, isXAxisShowValueLabel, isXAxisStriped, isYAxisShow, isYAxisShowGrid, isYAxisShowLine, isYAxisShowTicks, isYAxisShowValueLabel, isYAxisStriped, setXAxisDateFormat, setXAxisFontColor, setXAxisShow, setXAxisShowGrid, setXAxisShowLine, setXAxisShowTicks, setXAxisShowValueLabel, setXAxisStriped, setXAxisStripedStart, setXAxisTickTextRotate, setXAxisTitle, setXAxisType, setXAxisValuePostfix, setXAxisValuePrefix, setYAxisFontColor, setYAxisMaxValue, setYAxisMinValue, setYAxisShow, setYAxisShowGrid, setYAxisShowLine, setYAxisShowTicks, setYAxisShowValueLabel, setYAxisStriped, setYAxisStripedStart, setYAxisTitle, setYAxisValuePostfix, setYAxisValuePrefix
Methods inherited from class com.jbstrap.ui.components.charts.SeriesBasedChart
_addSeries, _getSeries, _getSeriesNames, clear, fetchData, generateJSON, getCategoryColumnName, getDataColumnBySeriesName, getDataDescriptor, getDefaultFilterCriteria, getFilterCriteria, onError, refreshData, registerDataColumn, removeSeries, setDataDescriptor, setDefaultFilterCriteria, setFilterCriteria
Methods inherited from class com.jbstrap.ui.components.charts.BaseChart
getCanvas, getDefaultTooltipType, getHandlers, getName, getSupportedTooltipTypes, runJs, setParent
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jbstrap.ui.components.charts.ClickableChartData
addClickHandler
Methods inherited from interface com.jbstrap.ui.components.charts.DualSeriesChart
getSeries, getSeriesNames
Methods inherited from interface com.jbstrap.ui.components.charts.SupportBrush
isBrushable, setBrushable
Methods inherited from interface com.jbstrap.ui.components.charts.SupportLasso
addLassoHandler, isLassoEnabled, setLassoEnabled
Methods inherited from interface com.jbstrap.ui.components.charts.SupportZoom
isZoomable, setZoomable
-
Constructor Details
-
PopulationPyramidChart
Creates the population pyramid.- Parameters:
name
- Chart name It is mandatory to specify the chart name and it must be unique within theChartCanvas
. Later on, you can reference the chart with the name specified here.- Throws:
NullPointerException
- Thrown if the specified name isnull
or it is an empty string
-
PopulationPyramidChart
public PopulationPyramidChart(String name, DataDescriptor dataDescriptor, String categoryColumnName) Creates a population pyramid and sets the associated DataDescriptor and the name of the column containing Y axis values.- Parameters:
name
- Chart name It is mandatory to specify the chart name and it must be unique within theChartCanvas
. Later on, you can reference the chart with the name specified here.dataDescriptor
- The DataDescriptor that contains the chart datacategoryColumnName
- The name of the DataDescriptor containing X axis data If not specified, ornull
is specified, the framework starts looking for the “CATEGORY” column.- Throws:
NullPointerException
- Thrown if the specified name isnull
or it is an empty stringIllegalArgumentException
- Thrown if the column specified in the categoryColumnName parameter is not found in the DataDescriptor or if the categoryColumnName parameter is not specified and no “CATEGORY” column is found in theDataDescriptor.
-
-
Method Details
-
init
protected void init()Description copied from class:BaseChart
Chart initialization.- Overrides:
init
in classAxesBasedChart<PopulationPyramidChart>
-
addSeries
Adds a series to the chart.- Specified by:
addSeries
in interfaceDualSeriesChart<PopulationPyramidChart,
BarSeries> - Parameters:
series
- Series instance to be added- Returns:
- Chart
-
onSuccess
Description copied from interface:DataDescriptorCallback
The method is invoked, if the async data handling operation was successful.- Specified by:
onSuccess
in interfaceDataDescriptorCallback
- Overrides:
onSuccess
in classSeriesBasedChart<PopulationPyramidChart>
- Parameters:
data
- The list of records that are returned. In the cause of a query, the query results. In the case of a save, the saved records.
-
isLeftSeries
Checks if the series specified in the parameter is the series on the left side of the chart.- Parameters:
series
- Series object- Returns:
- If
true
, the specified series object is on the left side of the chart, otherwisefalse
-