Class FunnelChart
- All Implemented Interfaces:
DataDescriptorCallback
,ClickableChartData<FunnelChart>
,SimpleSeriesChart<FunnelChart,
Series>
A funnel chart displays one data series. A funnel contains several trapezoid shapes, denoting data points. Every trapezoid shape has a different color (automatically calculated, but can also be specified). The trapezoid denoting the highest value is placed on the top, while other data points are visualized as gradually smaller shapes. The overall outline of the chart has the shape of a funnel. Each trapezoid shape is shown in the legend, helping the user to find out what sort of data the shapes represent.
This chart is does not allow you to modify the tooltip, you can only use a DOT
. However, the chart
enables you to create custom tooltips using any JBStrap component. If you want to display a tooltip that is different from the default one,
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.
- Since:
- 4.0
- Author:
- JBStrap
- See Also:
-
Field Summary
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
-
Constructor Summary
ConstructorDescriptionFunnelChart
(String name) Creates a funnel chart component.FunnelChart
(String name, DataDescriptor dataDescriptor, String categoryColumnName) Creates a funnel chart component and sets the name of the DataDescriptor and that of the X axis column. -
Method Summary
Modifier and TypeMethodDescriptionGets the border color around each item.int
Gets the border width around each item.Gets the chart labels.protected void
init()
Chart initialization.setBorderColor
(String color) Sets the border color around each item.setBorderWidth
(int width) Sets the border width around each item.setDataLabels
(DataLabels labels) Sets the label for each circle item.Sets the series displayed on the chart.Methods inherited from class com.jbstrap.ui.components.charts.SeriesBasedChart
_addSeries, _getSeries, _getSeriesNames, clear, fetchData, generateJSON, getCategoryColumnName, getDataColumnBySeriesName, getDataDescriptor, getDefaultFilterCriteria, getFilterCriteria, onError, onSuccess, 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.SimpleSeriesChart
getSeries, getSeriesName
-
Field Details
-
DATA_LBELS
- See Also:
-
BORDER_COLOR
- See Also:
-
BORDER_WIDTH
- See Also:
-
-
Constructor Details
-
FunnelChart
Creates a funnel chart component.- 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
-
FunnelChart
Creates a funnel chart component and sets the name of the DataDescriptor and that of the X axis column.- 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 the DataDescriptor.
-
-
Method Details
-
init
protected void init()Description copied from class:BaseChart
Chart initialization.- Specified by:
init
in classBaseChart<FunnelChart>
-
setDataLabels
Sets the label for each circle item. By default, the label shows how much per cent a data point represents of the entire chart.- Parameters:
labels
- Label type Available types are listed in the enumDataLabels
. Ifnull
is specified, no label is displayed.- Returns:
- Chart instance
-
getDataLabels
Gets the chart labels.- Returns:
- Label type
-
setBorderColor
Sets the border color around each item. By default, each item is surrounded by a white border.- Parameters:
color
- Border color in the CSS3 format- Returns:
- Chart instance
-
getBorderColor
Gets the border color around each item.- Returns:
- Border color in CSS3 format
-
setBorderWidth
Sets the border width around each item. By default, items are surrounded by a 0 pixels thick border (no visible border).- Parameters:
width
- Border around the items in pixels If a number smaller than 0 is specified, border width is set to 0. No visible border is displayed.- Returns:
- Chart instance
-
getBorderWidth
public int getBorderWidth()Gets the border width around each item.- Returns:
- Border width
-
setSeries
Sets the series displayed on the chart.- Specified by:
setSeries
in interfaceSimpleSeriesChart<FunnelChart,
Series> - Parameters:
series
- Series instance displayed on the chart- Returns:
- Chart
-