Package org.pepstock.charba.client.geo
Class ChoroplethChart
- java.lang.Object
-
- org.pepstock.charba.client.events.HandlerManager
-
- org.pepstock.charba.client.AbstractChart
-
- org.pepstock.charba.client.geo.ChoroplethChart
-
- All Implemented Interfaces:
HasAxes
,IsChart
,IsDatasetCreator<ChoroplethDataset>
public final class ChoroplethChart extends AbstractChart
A choropleth chart is used to render maps with the area filled according to some numerical value.- Author:
- Andrea "Stock" Stocchero
-
-
Field Summary
Fields Modifier and Type Field Description static ControllerType
CONTROLLER_TYPE
Choropleth controller type.static String
TYPE
Name of chart type "choropleth"-
Fields inherited from class org.pepstock.charba.client.AbstractChart
datasetReferenceFactory
-
-
Constructor Summary
Constructors Constructor Description ChoroplethChart()
Builds the object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
applyConfiguration()
Called before any drawing or reconfiguration in order that the chart which implements it can override optionsvoid
checkAxes(Axis... axes)
Checks if axes, requested to be stored, are an acceptable type or amount.
If a axis type or the amount of axes are not consistent for the chart, aIllegalArgumentException
will be thrown.boolean
checkAxis(Axis axis)
Returnstrue
if the axis can be managed by a this chart type.protected boolean
checkDataset(Dataset dataset)
Returnstrue
if the dataset can be managed by a this chart type.protected int
getMaximumAxesCount()
Returns the maximum amount of axes that the chart can manage.protected int
getMaximumDatasetsCount()
Returns the maximum amount of datasets that the chart can manage.ChoroplethOptions
getOptions()
Returns the options of chart.ChoroplethDataset
newDataset(boolean hidden)
Creates a new dataset related to chart type.CoordinatesPoint
projection(double latitude, double longitude)
Translates latitude and longitude in coordinates of the canvas where the chart is drawn.CoordinatesPoint
projection(Coordinates coordinates)
Translates latitude and longitude in coordinates of the canvas where the chart is drawn.Coordinates
projectionInvert(double x, double y)
Translates X and Y coordinates of the canvas where the chart is drawn in latitude and longitude.Coordinates
projectionInvert(CoordinatesPoint point)
Translates X and Y coordinates of the canvas where the chart is drawn in latitude and longitude.static void
register()
Registers the CHOROPLETH controller in CHART.JS.-
Methods inherited from class org.pepstock.charba.client.AbstractChart
addHandler, checkDatasets, clear, createAndSetTimer, destroy, draw, getActiveElements, getBaseType, getCanvas, getChartElement, getData, getDatasetAtEvent, getDatasetItem, getDatasetReferenceFactory, getDefaultChartOptions, getDrawCount, getElementAtEvent, getElementAtEvent, getElementsAtEvent, getElementsAtEvent, getId, getInitialCursor, getNode, getPlugins, getSortedVisibleDatasetItems, getSource, getTimer, getTooltipActiveElements, getType, getVisibleDatasetCount, getWholeOptions, hide, hide, isChartAttached, isDatasetVisible, isDataVisible, isDestroyOnDetach, isDrawOnAttach, isInitialized, isPluginEnabled, onAttach, onDetach, reconfigure, reconfigure, reconfigure, removeCanvasPreventDefault, render, reset, resetActiveElements, resetTooltipActiveElements, resize, resize, setActiveElements, setActiveElements, setDatasetVisibility, setDestroyOnDetach, setDrawOnAttach, setTooltipActiveElements, setTooltipActiveElements, setTooltipActiveElements, setTooltipActiveElements, show, show, stop, toBase64Image, toggleDataVisibility, update, update, update
-
Methods inherited from class org.pepstock.charba.client.events.HandlerManager
fireEvent, getHandlerCount, isEventHandled
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pepstock.charba.client.IsChart
fireEvent, getHandlerCount, isEventHandled, toBase64Image, toBase64Image, toBase64Image
-
Methods inherited from interface org.pepstock.charba.client.IsDatasetCreator
newDataset
-
-
-
-
Field Detail
-
TYPE
public static final String TYPE
Name of chart type "choropleth"- See Also:
- Constant Field Values
-
CONTROLLER_TYPE
public static final ControllerType CONTROLLER_TYPE
Choropleth controller type.
-
-
Method Detail
-
getOptions
public ChoroplethOptions getOptions()
Description copied from interface:IsChart
Returns the options of chart.- Returns:
- the options of chart.
-
newDataset
public ChoroplethDataset newDataset(boolean hidden)
Description copied from interface:IsDatasetCreator
Creates a new dataset related to chart type.- Parameters:
hidden
- iftrue
, it will be initially hidden.- Returns:
- a new dataset related to chart type.
-
checkDataset
protected boolean checkDataset(Dataset dataset)
Description copied from class:AbstractChart
Returnstrue
if the dataset can be managed by a this chart type.- Specified by:
checkDataset
in classAbstractChart
- Parameters:
dataset
- dataset to check- Returns:
true
if the dataset can be managed by a this chart type
-
checkAxis
public boolean checkAxis(Axis axis)
Description copied from interface:HasAxes
Returnstrue
if the axis can be managed by a this chart type.- Parameters:
axis
- axis to check- Returns:
true
if the axis can be managed by a this chart type
-
checkAxes
public void checkAxes(Axis... axes)
Description copied from interface:IsChart
Checks if axes, requested to be stored, are an acceptable type or amount.
If a axis type or the amount of axes are not consistent for the chart, aIllegalArgumentException
will be thrown.- Specified by:
checkAxes
in interfaceIsChart
- Overrides:
checkAxes
in classAbstractChart
- Parameters:
axes
- list of axes to check.
-
register
public static void register()
Registers the CHOROPLETH controller in CHART.JS.
-
applyConfiguration
protected final void applyConfiguration()
Description copied from class:AbstractChart
Called before any drawing or reconfiguration in order that the chart which implements it can override options- Overrides:
applyConfiguration
in classAbstractChart
-
projection
public final CoordinatesPoint projection(double latitude, double longitude)
Translates latitude and longitude in coordinates of the canvas where the chart is drawn.- Parameters:
latitude
- latitude to use to get the Y pointlongitude
- longitude to use to get the X point- Returns:
- a
CoordinatesPoint
with X and Y, related to the passed latitude and longitude
-
projection
public final CoordinatesPoint projection(Coordinates coordinates)
Translates latitude and longitude in coordinates of the canvas where the chart is drawn.- Parameters:
coordinates
- contains latitude and longitude to translate- Returns:
- a
CoordinatesPoint
with X and Y, related to the passed latitude and longitude
-
projectionInvert
public final Coordinates projectionInvert(double x, double y)
Translates X and Y coordinates of the canvas where the chart is drawn in latitude and longitude.- Parameters:
x
- coordinate X of the canvas to translate in longitudey
- coordinate Y of the canvas to translate in latitude- Returns:
- a
Coordinates
with the latitude and longitude, related to the passed X and Y
-
projectionInvert
public final Coordinates projectionInvert(CoordinatesPoint point)
Translates X and Y coordinates of the canvas where the chart is drawn in latitude and longitude.- Parameters:
point
- contains X and Y coordinates to translate- Returns:
- a
Coordinates
with the latitude and longitude, related to the passed X and Y
-
getMaximumDatasetsCount
protected final int getMaximumDatasetsCount()
Description copied from class:AbstractChart
Returns the maximum amount of datasets that the chart can manage.- Overrides:
getMaximumDatasetsCount
in classAbstractChart
- Returns:
- the maximum amount of datasets that the chart can manage.
-
getMaximumAxesCount
protected final int getMaximumAxesCount()
Description copied from class:AbstractChart
Returns the maximum amount of axes that the chart can manage.- Overrides:
getMaximumAxesCount
in classAbstractChart
- Returns:
- the maximum amount of axes that the chart can manage.
-
-