Class Chart
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.charts.Chart
-
- All Implemented Interfaces:
AttachNotifier
,DetachNotifier
,HasElement
,HasSize
,HasStyle
,HasTheme
,Serializable
@Tag("vaadin-chart") @NpmPackage(value="@vaadin/polymer-legacy-adapter",version="23.1.15") @NpmPackage(value="@vaadin/charts",version="23.1.15") @NpmPackage(value="@vaadin/vaadin-charts",version="23.1.15") @JsModule("@vaadin/polymer-legacy-adapter/style-modules.js") @JsModule("@vaadin/charts/src/vaadin-chart.js") public class Chart extends Component implements HasStyle, HasSize, HasTheme
Vaadin Charts is a feature-rich interactive charting library for Vaadin. It provides multiple different chart types for visualizing one- or two-dimensional tabular data, or scatter data with free X and Y values. You can configure all the chart elements with a powerful API as well as the visual style using CSS. The built-in functionalities allow the user to interact with the chart elements in various ways, and you can define custom interaction with events.The Chart is a regular Vaadin component, which you can add to any Vaadin layout.
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Registration
addChartAddSeriesListener(ComponentEventListener<ChartAddSeriesEvent> listener)
Adds a chart add series listener, which will be notified after a new series is added to the chartRegistration
addChartAfterPrintListener(ComponentEventListener<ChartAfterPrintEvent> listener)
Adds a chart after print listener, which will be notified after the chart is printed using the print menuRegistration
addChartBeforePrintListener(ComponentEventListener<ChartBeforePrintEvent> listener)
Adds a chart before print listener, which will be notified before the chart is printed using the print menuRegistration
addChartClickListener(ComponentEventListener<ChartClickEvent> listener)
Adds chart click listener, which will be notified of clicks on the chart areaRegistration
addChartDrillupAllListener(ComponentEventListener<ChartDrillupAllEvent> listener)
Adds chart drillupall listener, which will be notified after all the series have been drilled up in a chart with multiple drilldown series.Registration
addChartDrillupListener(ComponentEventListener<ChartDrillupEvent> listener)
Adds chart drillup listener, which will be notified of clicks on the 'Back to previous series' button.Registration
addChartLoadListener(ComponentEventListener<ChartLoadEvent> listener)
Adds a chart load listener, which will be notified after a chart is loadedRegistration
addChartRedrawListener(ComponentEventListener<ChartRedrawEvent> listener)
Adds a chart redraw listener, which will be notified after a chart is redrawnRegistration
addChartSelectionListener(ComponentEventListener<ChartSelectionEvent> listener)
Adds a chart selection listenerRegistration
addCheckBoxClickListener(ComponentEventListener<SeriesCheckboxClickEvent> listener)
Adds checkbox click listener, which will be notified when user has clicked a checkbox in the legendRegistration
addDrilldownListener(ComponentEventListener<DrilldownEvent> listener)
Sets the Chart drilldown handler that's responsible for returning the drilldown series for each drilldown callback when doing async drilldownRegistration
addPointClickListener(ComponentEventListener<PointClickEvent> listener)
Adds a point click listener, which will be notified of clicks on the points, bars or columns in the chartRegistration
addPointLegendItemClickListener(ComponentEventListener<PointLegendItemClickEvent> listener)
Adds a point legend item click listener, which will be notified of clicks on the legend's items corresponding to a PointRegistration
addPointMouseOutListener(ComponentEventListener<PointMouseOutEvent> listener)
Adds a point mouse out listener, which will be notified when the mouse exits the neighborhood of a data pointRegistration
addPointMouseOverListener(ComponentEventListener<PointMouseOverEvent> listener)
Adds a point mouse over listener, which will be notified when the mouse enters the neighborhood of a data pointRegistration
addPointRemoveListener(ComponentEventListener<PointRemoveEvent> listener)
Adds a point remove listener, which will be notified when a data point is removed.Registration
addPointSelectListener(ComponentEventListener<PointSelectEvent> listener)
Adds a point select listener, which will be notified when a data point is selected.Registration
addPointUnselectListener(ComponentEventListener<PointUnselectEvent> listener)
Adds a point unselect listener, which will be notified when a data point is unselected.Registration
addPointUpdateListener(ComponentEventListener<PointUpdateEvent> listener)
Adds a point update listener, which will be notified when a data point is updated.Registration
addSeriesAfterAnimateListener(ComponentEventListener<SeriesAfterAnimateEvent> listener)
Adds a series after animate listener, which will be notified after a series is animatedRegistration
addSeriesClickListener(ComponentEventListener<SeriesClickEvent> listener)
Adds a series click listener, which will be notified of clicks on the series in the chartRegistration
addSeriesHideListener(ComponentEventListener<SeriesHideEvent> listener)
Adds a series hide listener, which will be notified when a series is hiddenRegistration
addSeriesLegendItemClickListener(ComponentEventListener<SeriesLegendItemClickEvent> listener)
Adds a series legend item click listener, which will be notified of clicks on the legend's items corresponding to a SeriesRegistration
addSeriesMouseOutListener(ComponentEventListener<SeriesMouseOutEvent> listener)
Adds a point mouse out listener, which will be notified when the mouse exits the neighborhood of a seriesRegistration
addSeriesMouseOverListener(ComponentEventListener<SeriesMouseOverEvent> listener)
Adds a point mouse out listener, which will be notified when the mouse enters the neighborhood of a seriesRegistration
addSeriesShowListener(ComponentEventListener<SeriesShowEvent> listener)
Adds a series show listener, which will be notified when a series is shownvoid
addThemeVariants(ChartVariant... variants)
Adds theme variants to the component.Registration
addXAxesExtremesSetListener(ComponentEventListener<XAxesExtremesSetEvent> listener)
Adds a x axes extremes set listener, which will be notified when an x axis extremes are setRegistration
addYAxesExtremesSetListener(ComponentEventListener<YAxesExtremesSetEvent> listener)
Adds a y axes extremes set listener, which will be notified when an y axis extremes are setvoid
drawChart()
Draws a chart using the current configuration.void
drawChart(boolean resetConfiguration)
Draws a chart using the current configuration.Configuration
getConfiguration()
DrilldownCallback
getDrilldownCallback()
protected void
onAttach(AttachEvent attachEvent)
Called when the component is attached to a UI.void
removeThemeVariants(ChartVariant... variants)
Removes theme variants from the component.void
setConfiguration(Configuration configuration)
void
setDrilldownCallback(DrilldownCallback drilldownCallback)
void
setTimeline(Boolean timeline)
Determines if the chart is in timeline mode or in normal mode.void
setVisibilityTogglingDisabled(boolean disabled)
The series or point visibility is toggled by default if user clicks the legend item that corresponds to the series or point.-
Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, scrollIntoView, set, setElement, setId, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
-
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
-
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
-
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Methods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
-
-
-
-
Method Detail
-
onAttach
protected void onAttach(AttachEvent attachEvent)
Description copied from class:Component
Called when the component is attached to a UI.The default implementation does nothing.
This method is invoked before the
AttachEvent
is fired for the component.
-
drawChart
public void drawChart()
Draws a chart using the current configuration.- See Also:
drawChart(boolean)
-
drawChart
public void drawChart(boolean resetConfiguration)
Draws a chart using the current configuration.The chart takes the current configuration from
getConfiguration()
.Note that if you modify the underlying
Series
directly, the chart will automatically be updated.Note that you don't need to call this method if
Configuration
is ready before element is attached.- Parameters:
resetConfiguration
- defines whether the chart should be redrawn or not- See Also:
getConfiguration()
-
setTimeline
public void setTimeline(Boolean timeline)
Determines if the chart is in timeline mode or in normal mode. The following chart types do not support timeline mode:- ChartType.PIE
- ChartType.GAUGE
- ChartType.SOLIDGAUGE
- ChartType.PYRAMID
- ChartType.FUNNEL
- ChartType.ORGANIZATION
IllegalArgumentException
Note: for Timeline chart type see
ChartType.TIMELINE
andPlotOptionsTimeline
.- Parameters:
timeline
- true for timeline chart
-
setVisibilityTogglingDisabled
public void setVisibilityTogglingDisabled(boolean disabled)
The series or point visibility is toggled by default if user clicks the legend item that corresponds to the series or point. Calling setVisibilityTogglingDisabled(true
) will disable this behavior.- Parameters:
disabled
-
-
getConfiguration
public Configuration getConfiguration()
- Returns:
- the chart configuration that is used for this chart
-
setConfiguration
public void setConfiguration(Configuration configuration)
- Parameters:
configuration
- new configuration for this chart.
-
getDrilldownCallback
public DrilldownCallback getDrilldownCallback()
-
setDrilldownCallback
public void setDrilldownCallback(DrilldownCallback drilldownCallback)
-
addChartAddSeriesListener
public Registration addChartAddSeriesListener(ComponentEventListener<ChartAddSeriesEvent> listener)
Adds a chart add series listener, which will be notified after a new series is added to the chart- Parameters:
listener
-
-
addChartAfterPrintListener
public Registration addChartAfterPrintListener(ComponentEventListener<ChartAfterPrintEvent> listener)
Adds a chart after print listener, which will be notified after the chart is printed using the print menu- Parameters:
listener
-
-
addChartBeforePrintListener
public Registration addChartBeforePrintListener(ComponentEventListener<ChartBeforePrintEvent> listener)
Adds a chart before print listener, which will be notified before the chart is printed using the print menu- Parameters:
listener
-
-
addChartClickListener
public Registration addChartClickListener(ComponentEventListener<ChartClickEvent> listener)
Adds chart click listener, which will be notified of clicks on the chart area- Parameters:
listener
-
-
addChartDrillupListener
public Registration addChartDrillupListener(ComponentEventListener<ChartDrillupEvent> listener)
Adds chart drillup listener, which will be notified of clicks on the 'Back to previous series' button.- Parameters:
listener
-
-
addChartDrillupAllListener
public Registration addChartDrillupAllListener(ComponentEventListener<ChartDrillupAllEvent> listener)
Adds chart drillupall listener, which will be notified after all the series have been drilled up in a chart with multiple drilldown series.- Parameters:
listener
-
-
addChartLoadListener
public Registration addChartLoadListener(ComponentEventListener<ChartLoadEvent> listener)
Adds a chart load listener, which will be notified after a chart is loaded- Parameters:
listener
-
-
addChartRedrawListener
public Registration addChartRedrawListener(ComponentEventListener<ChartRedrawEvent> listener)
Adds a chart redraw listener, which will be notified after a chart is redrawn- Parameters:
listener
-
-
addCheckBoxClickListener
public Registration addCheckBoxClickListener(ComponentEventListener<SeriesCheckboxClickEvent> listener)
Adds checkbox click listener, which will be notified when user has clicked a checkbox in the legend- Parameters:
listener
-
-
addDrilldownListener
public Registration addDrilldownListener(ComponentEventListener<DrilldownEvent> listener)
Sets the Chart drilldown handler that's responsible for returning the drilldown series for each drilldown callback when doing async drilldown- Parameters:
listener
-- See Also:
addItemWithDrilldown to find out how to enable async drilldown
-
addChartSelectionListener
public Registration addChartSelectionListener(ComponentEventListener<ChartSelectionEvent> listener)
Adds a chart selection listenerNote that if a chart selection listener is set, default action for selection is prevented. Most commonly this means that client side zoom doesn't work and you are responsible for setting the zoom, etc in the listener implementation.
- Parameters:
listener
-
-
addSeriesLegendItemClickListener
public Registration addSeriesLegendItemClickListener(ComponentEventListener<SeriesLegendItemClickEvent> listener)
Adds a series legend item click listener, which will be notified of clicks on the legend's items corresponding to a SeriesNote that by default, clicking on a legend item toggles the visibility of its associated series. To disable this behavior call setVisibilityTogglingDisabled(
true
)- Parameters:
listener
-- See Also:
setVisibilityTogglingDisabled(boolean)
-
addPointLegendItemClickListener
public Registration addPointLegendItemClickListener(ComponentEventListener<PointLegendItemClickEvent> listener)
Adds a point legend item click listener, which will be notified of clicks on the legend's items corresponding to a PointNote that by default, clicking on a legend item toggles the visibility of its associated point. To disable this behavior call setVisibilityTogglingDisabled(
true
)- Parameters:
listener
-- See Also:
setVisibilityTogglingDisabled(boolean)
-
addSeriesAfterAnimateListener
public Registration addSeriesAfterAnimateListener(ComponentEventListener<SeriesAfterAnimateEvent> listener)
Adds a series after animate listener, which will be notified after a series is animated- Parameters:
listener
-
-
addSeriesClickListener
public Registration addSeriesClickListener(ComponentEventListener<SeriesClickEvent> listener)
Adds a series click listener, which will be notified of clicks on the series in the chart- Parameters:
listener
-
-
addSeriesHideListener
public Registration addSeriesHideListener(ComponentEventListener<SeriesHideEvent> listener)
Adds a series hide listener, which will be notified when a series is hidden- Parameters:
listener
-
-
addSeriesMouseOutListener
public Registration addSeriesMouseOutListener(ComponentEventListener<SeriesMouseOutEvent> listener)
Adds a point mouse out listener, which will be notified when the mouse exits the neighborhood of a series- Parameters:
listener
-
-
addSeriesMouseOverListener
public Registration addSeriesMouseOverListener(ComponentEventListener<SeriesMouseOverEvent> listener)
Adds a point mouse out listener, which will be notified when the mouse enters the neighborhood of a series- Parameters:
listener
-
-
addSeriesShowListener
public Registration addSeriesShowListener(ComponentEventListener<SeriesShowEvent> listener)
Adds a series show listener, which will be notified when a series is shown- Parameters:
listener
-
-
addPointClickListener
public Registration addPointClickListener(ComponentEventListener<PointClickEvent> listener)
Adds a point click listener, which will be notified of clicks on the points, bars or columns in the chart- Parameters:
listener
-
-
addPointMouseOutListener
public Registration addPointMouseOutListener(ComponentEventListener<PointMouseOutEvent> listener)
Adds a point mouse out listener, which will be notified when the mouse exits the neighborhood of a data point- Parameters:
listener
-
-
addPointMouseOverListener
public Registration addPointMouseOverListener(ComponentEventListener<PointMouseOverEvent> listener)
Adds a point mouse over listener, which will be notified when the mouse enters the neighborhood of a data point- Parameters:
listener
-
-
addPointRemoveListener
public Registration addPointRemoveListener(ComponentEventListener<PointRemoveEvent> listener)
Adds a point remove listener, which will be notified when a data point is removed.- Parameters:
listener
-
-
addPointSelectListener
public Registration addPointSelectListener(ComponentEventListener<PointSelectEvent> listener)
Adds a point select listener, which will be notified when a data point is selected.- Parameters:
listener
-
-
addPointUnselectListener
public Registration addPointUnselectListener(ComponentEventListener<PointUnselectEvent> listener)
Adds a point unselect listener, which will be notified when a data point is unselected.- Parameters:
listener
-
-
addPointUpdateListener
public Registration addPointUpdateListener(ComponentEventListener<PointUpdateEvent> listener)
Adds a point update listener, which will be notified when a data point is updated.- Parameters:
listener
-
-
addXAxesExtremesSetListener
public Registration addXAxesExtremesSetListener(ComponentEventListener<XAxesExtremesSetEvent> listener)
Adds a x axes extremes set listener, which will be notified when an x axis extremes are set- Parameters:
listener
-
-
addYAxesExtremesSetListener
public Registration addYAxesExtremesSetListener(ComponentEventListener<YAxesExtremesSetEvent> listener)
Adds a y axes extremes set listener, which will be notified when an y axis extremes are set- Parameters:
listener
-
-
addThemeVariants
public void addThemeVariants(ChartVariant... variants)
Adds theme variants to the component.- Parameters:
variants
- theme variants to add
-
removeThemeVariants
public void removeThemeVariants(ChartVariant... variants)
Removes theme variants from the component.- Parameters:
variants
- theme variants to remove
-
-