Class JmixChart
java.lang.Object
com.vaadin.flow.component.Component
io.jmix.chartsflowui.kit.component.JmixChart
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,Serializable
- Direct Known Subclasses:
Chart
@Tag("jmix-chart")
@NpmPackage(value="echarts",
version="5.4.3")
@JsModule("./src/chart/jmix-chart.js")
public class JmixChart
extends com.vaadin.flow.component.Component
implements com.vaadin.flow.component.HasSize
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<DataSet,ChartIncrementalChanges<? extends DataItem>> protected com.vaadin.flow.data.provider.KeyMapper<Object>protected ChartOptionsprotected JmixChartSerializerprotected com.vaadin.flow.internal.StateTree.ExecutionRegistrationprotected com.vaadin.flow.internal.StateTree.ExecutionRegistrationprotected com.vaadin.flow.internal.StateTree.ExecutionRegistration -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T extends DataItem>
voidaddChangedDataItems(ChartItems.DataChangeOperation operation, Collection<T> items) com.vaadin.flow.shared.RegistrationaddClickEventListener(com.vaadin.flow.component.ComponentEventListener<ChartClickEvent> listener) voidaddColorToPalette(Color color) Adds a single color to the chart color palette.voidaddDataZoom(AbstractDataZoom<?> dataZoom) Adds aAbstractDataZoomcomponent witch used for zooming a specific area in the chart.com.vaadin.flow.shared.RegistrationaddDataZoomEventListener(com.vaadin.flow.component.ComponentEventListener<ChartDataZoomEvent> listener) com.vaadin.flow.shared.RegistrationaddDoubleClickEventListener(com.vaadin.flow.component.ComponentEventListener<ChartDoubleClickEvent> listener) com.vaadin.flow.shared.RegistrationaddFinishedEventListener(com.vaadin.flow.component.ComponentEventListener<ChartFinishedEvent> listener) com.vaadin.flow.shared.RegistrationaddGlobalCursorTakenEventListener(com.vaadin.flow.component.ComponentEventListener<ChartGlobalCursorTakenEvent> listener) com.vaadin.flow.shared.RegistrationaddGlobalOutEventListener(com.vaadin.flow.component.ComponentEventListener<ChartGlobalOutEvent> listener) voidAdds aGridto the chart options.com.vaadin.flow.shared.RegistrationaddLegendInverseSelectEventListener(com.vaadin.flow.component.ComponentEventListener<ChartLegendInverseSelectEvent> listener) com.vaadin.flow.shared.RegistrationaddLegendScrollEventListener(com.vaadin.flow.component.ComponentEventListener<ChartLegendScrollEvent> listener) com.vaadin.flow.shared.RegistrationaddLegendSelectAllEventListener(com.vaadin.flow.component.ComponentEventListener<ChartLegendSelectAllEvent> listener) com.vaadin.flow.shared.RegistrationaddLegendSelectChangedEventListener(com.vaadin.flow.component.ComponentEventListener<ChartLegendSelectChangedEvent> listener) com.vaadin.flow.shared.RegistrationaddMagicTypeChangedEventListener(com.vaadin.flow.component.ComponentEventListener<ChartMagicTypeChangedEvent> listener) com.vaadin.flow.shared.RegistrationaddMouseDownEventListener(com.vaadin.flow.component.ComponentEventListener<ChartMouseDownEvent> listener) com.vaadin.flow.shared.RegistrationaddMouseMoveEventListener(com.vaadin.flow.component.ComponentEventListener<ChartMouseMoveEvent> listener) com.vaadin.flow.shared.RegistrationaddMouseOutEventListener(com.vaadin.flow.component.ComponentEventListener<ChartMouseOutEvent> listener) com.vaadin.flow.shared.RegistrationaddMouseOverEventListener(com.vaadin.flow.component.ComponentEventListener<ChartMouseOverEvent> listener) com.vaadin.flow.shared.RegistrationaddMouseUpEventListener(com.vaadin.flow.component.ComponentEventListener<ChartMouseUpEvent> listener) com.vaadin.flow.shared.RegistrationaddRenderedEventListener(com.vaadin.flow.component.ComponentEventListener<ChartRenderedEvent> listener) com.vaadin.flow.shared.RegistrationaddRestoreEventListener(com.vaadin.flow.component.ComponentEventListener<ChartRestoreEvent> listener) voidaddSeries(AbstractSeries<?> series) Adds a series to the chart options.voidaddVisualMap(AbstractVisualMap<?> visualMap) Adds aAbstractVisualMapto the chart options.voidAdds aXAxisin cartesian(rectangular) coordinate to the chart options.voidAdds aYAxisin cartesian(rectangular) coordinate to the chart options.voidClears the chart color palette of all colors.protected ChartOptionsprotected JmixChartSerializergetAria()getBrush()getGrids()elemental.json.JsonValuegetPolar()getRadar()protected com.vaadin.flow.shared.RegistrationgetRemovalCallback(String eventName, Class<? extends com.vaadin.flow.component.ComponentEvent<?>> eventClass) List<AbstractSeries<?>><S extends AbstractSeries<S>>
S<S extends AbstractSeries<S>>
SgetSeriesOrNull(String seriesId) getTitle()getXAxes()getYAxes()protected voidprotected voidprotected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) protected voidprotected voidperformIncrementalUpdateChartDataSet(com.vaadin.flow.internal.ExecutionContext context) protected voidperformUpdateChartData(com.vaadin.flow.internal.ExecutionContext context) protected voidperformUpdateChartOptions(com.vaadin.flow.internal.ExecutionContext context) voidremoveAxis(XAxis axis) Removes an existingXAxisfrom the chart options.voidremoveDataZoom(AbstractDataZoom<?> dataZoom) Removes an existingAbstractDataZoomfrom the chart options.voidremoveGrid(Grid gird) Removes an existingGridfrom the chart options.voidremoveSeries(AbstractSeries<?> series) Removes an existing series from the chart options.voidremoveVisualMap(AbstractVisualMap<?> visualMap) Removes an existingAbstractVisualMapfrom the chart options.voidremoveYAxis(YAxis axis) Removes an existingYAxisfrom the chart options.protected <T extends DataItem>
voidprotected voidprotected voidvoidsetAngleAxis(AngleAxis axis) Sets aAngleAxisof polar coordinate to the chart options or replaces existing one.voidsetAnimation(Boolean animation) Sets the animation of the chart.voidsetAnimationDelay(Integer animationDelay) Sets a delay before updating the first draw animation.voidsetAnimationDelayUpdate(Integer animationDelayUpdate) Sets a delay before updating animation.voidsetAnimationDuration(Integer animationDuration) Sets a duration of the first draw animation.voidsetAnimationDurationUpdate(Integer animationDurationUpdate) Sets a time for animation to complete.voidsetAnimationEasing(String animationEasing) Sets an animation easing method used for the first draw animation.voidsetAnimationEasingUpdate(String animationEasingUpdate) Sets an animation easing method used for update animation.voidsetAnimationThreshold(Integer animationThreshold) Sets a graphic number threshold to animation.voidSets aAriato the chart options or replaces existing one.voidsetAxisPointer(AxisPointer axisPointer) Sets aAxisPointerto the chart options or replaces existing one.voidsetBackgroundColor(Color backgroundColor) Sets a background color for the chart or replaces existing one.voidsetBlendMode(ChartOptions.BlendMode blendMode) Sets the type of compositing operation to apply when drawing a new shape.voidSets aBrushto the chart options or replaces existing one.voidsetColorPalette(Color... palette) Sets a color list of palette for the chart.voidsetDataSet(DataSet dataSet) Sets aDataSetto the chart options or replaces existing one.voidsetHoverLayerThreshold(Integer hoverLayerThreshold) Sets the number of elements when exceeded, a separate hover layer is used to render hovered elements.voidsetLegend(AbstractLegend<?> legend) Sets aAbstractLegendto the chart options or replaces existing one.voidsetNativeJson(String json) Sets additional JSON options as a string.voidSets aPolarto the chart options or replaces existing one.voidSets aRadarto the chart options or replaces existing one.voidsetRadiusAxis(RadiusAxis axis) Sets aRadiusAxisof polar coordinate to the chart options or replaces existing one.voidsetStateAnimation(ChartOptions.StateAnimation stateAnimation) Sets aChartOptions.StateAnimationfor the chart.voidsetTextStyle(TextStyle textStyle) Sets a globalTextStylefor the chart or replaces existing one.voidSets aTitleto the chart options or replaces existing one.voidsetToolbox(Toolbox toolbox) Sets aToolboxto the chart options or replaces existing one.voidsetTooltip(Tooltip tooltip) Sets a globalTooltipoptions of the chart or replaces existing one.voidSets the use of UTC in display.Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods 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, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
options
-
serializer
-
synchronizeChartOptionsExecution
protected com.vaadin.flow.internal.StateTree.ExecutionRegistration synchronizeChartOptionsExecution -
synchronizeChartDataExecution
protected com.vaadin.flow.internal.StateTree.ExecutionRegistration synchronizeChartDataExecution -
synchronizeChartIncrementalUpdateDataExecution
protected com.vaadin.flow.internal.StateTree.ExecutionRegistration synchronizeChartIncrementalUpdateDataExecution -
eventRegistrations
-
changedItems
-
dataItemKeys
-
-
Constructor Details
-
JmixChart
public JmixChart()
-
-
Method Details
-
initComponent
protected void initComponent() -
setNativeJson
Sets additional JSON options as a string. This JSON can override options loaded from XML or from component Java API if they overlap.
Example of usingnativeJson:<charts:chart height="100%" width="100%"> <charts:title text="Title"/> <charts:nativeJson> <![CDATA[ { "title": { "subtext": 'Subtitle' } } ]]> </charts:nativeJson> </charts:chart>- Parameters:
json- additional JSON options
-
getNativeJson
public elemental.json.JsonValue getNativeJson()- Returns:
- additional JSON options as a
JsonValue
-
addSeries
Adds a series to the chart options.- Parameters:
series- series to add- See Also:
-
removeSeries
Removes an existing series from the chart options.- Parameters:
series- series to remove
-
getSeries
- Returns:
- immutable list of added series
-
getSeriesOrNull
- Type Parameters:
S- series class- Parameters:
seriesId- ID of the series to find- Returns:
- the series with the provided ID if it exists,
nullotherwise
-
getSeries
- Type Parameters:
S- series class- Parameters:
seriesId- ID of the series to find- Returns:
- the series with the provided ID
- Throws:
IllegalArgumentException- when chart doesn't contain a series with the provided ID
-
addXAxis
Adds aXAxisin cartesian(rectangular) coordinate to the chart options.- Parameters:
axis- axis to add
-
removeAxis
Removes an existingXAxisfrom the chart options.- Parameters:
axis- axis to remove
-
getXAxes
- Returns:
- immutable list of added XAxes
-
addYAxis
Adds aYAxisin cartesian(rectangular) coordinate to the chart options.- Parameters:
axis- axis to add
-
removeYAxis
Removes an existingYAxisfrom the chart options.- Parameters:
axis- axis to remove
-
getYAxes
- Returns:
- immutable list of added YAxes
-
setRadiusAxis
Sets aRadiusAxisof polar coordinate to the chart options or replaces existing one.- Parameters:
axis- axis to set
-
getRadiusAxis
- Returns:
- current
RadiusAxis
-
setAngleAxis
Sets aAngleAxisof polar coordinate to the chart options or replaces existing one.- Parameters:
axis- axis to set
-
getAngleAxis
- Returns:
- current
AngleAxis
-
addGrid
Adds aGridto the chart options. Grid options is used to draw a grid in rectangular coordinate. In a single grid, at most two X and Y axes each is allowed.LineSeries,BarSeries, andScatterSeries(EffectScatterSeries) can be drawn in the grid.- Parameters:
grid- grid to add
-
removeGrid
Removes an existingGridfrom the chart options.- Parameters:
gird- grid to remove
-
getGrids
- Returns:
- immutable list of added grids
-
getDataZoom
- Returns:
- immutable list of added data zooms
-
addDataZoom
Adds aAbstractDataZoomcomponent witch used for zooming a specific area in the chart.- Parameters:
dataZoom- data zoom to add- See Also:
-
removeDataZoom
Removes an existingAbstractDataZoomfrom the chart options.- Parameters:
dataZoom- data zoom to remove
-
getTitle
- Returns:
- title component of the chart
-
setTitle
Sets aTitleto the chart options or replaces existing one.- Parameters:
title- title to add
-
getLegend
- Returns:
- legend component of the chart
-
setLegend
Sets aAbstractLegendto the chart options or replaces existing one. Legend component shows symbol, color and name of different series. You can click legends to toggle displaying series in the chart.- Parameters:
legend- legend to add- See Also:
-
getTooltip
- Returns:
- global tooltip component of the chart
-
setTooltip
Sets a globalTooltipoptions of the chart or replaces existing one. Tooltip can be configured on different places.- Parameters:
tooltip- global tooltip to set- See Also:
-
getToolbox
- Returns:
- toolbox of the chart
-
setToolbox
Sets aToolboxto the chart options or replaces existing one. Toolbox is a group of utility tools, which includes different features.- Parameters:
toolbox- toolbox to set
-
getAxisPointer
- Returns:
- global axis pointer of the chart
-
setAxisPointer
Sets aAxisPointerto the chart options or replaces existing one. AxisPointer is a tool for displaying reference line and axis value under mouse pointer.- Parameters:
axisPointer- axis pointer to add
-
getPolar
- Returns:
- polar options of the chart
-
setPolar
Sets aPolarto the chart options or replaces existing one. Polar coordinate can be used inScatterSeriesandLineSeries. Every polar coordinate has anAngleAxisand aRadiusAxis.- Parameters:
polar- radar to add
-
getRadar
- Returns:
- radar options of the chart
-
setRadar
Sets aRadarto the chart options or replaces existing one. Radar chart coordinate is different from polar coordinate, in that every axis indicator of the radar chart coordinate is an individual dimension.Radar.Indicatorare required to be displayed.- Parameters:
radar- radar to set
-
getDataSet
- Returns:
- data set of the chart
-
setDataSet
Sets aDataSetto the chart options or replaces existing one. Data set is the main data provider for the chart. All series added to the chart will use the data set. The only series that requires its own data set is theGaugeSeries.- Parameters:
dataSet- data set to set
-
getAria
- Returns:
- aria of the chart
-
setAria
Sets aAriato the chart options or replaces existing one. Aria is options for the Accessible Rich Internet Applications Suite, which is dedicated to making web content and web applications accessible.- Parameters:
aria- aria to set
-
getBrush
- Returns:
- brush of the chart
-
setBrush
Sets aBrushto the chart options or replaces existing one. Brush is an area-selecting component, with which user can select part of data from a chart to display in detail.- Parameters:
brush- brush to set
-
getVisualMap
- Returns:
- immutable list of added visual maps
-
addVisualMap
Adds aAbstractVisualMapto the chart options. Visual map is a type of component for visual encoding, which maps the data to visual channels.- Parameters:
visualMap- visual map to add- See Also:
-
removeVisualMap
Removes an existingAbstractVisualMapfrom the chart options.- Parameters:
visualMap- visual map to remove
-
getColorPalette
- Returns:
- immutable list of colors in the charts color palette
-
clearColorPalette
public void clearColorPalette()Clears the chart color palette of all colors. -
getBackgroundColor
- Returns:
- background color of the chart
-
getTextStyle
- Returns:
- global font style of the chart
-
getAnimation
- Returns:
trueif animation if enabled,falseotherwise
-
setAnimation
Sets the animation of the chart. The animation is enabled by default.- Parameters:
animation- whether to enable the animation
-
getAnimationThreshold
- Returns:
- graphic number threshold to animation
-
setAnimationThreshold
Sets a graphic number threshold to animation. Animation will be disabled when graphic number is larger than threshold.- Parameters:
animationThreshold- number threshold to animation
-
getAnimationDuration
- Returns:
- duration of the first draw animation in milliseconds
-
setAnimationDuration
Sets a duration of the first draw animation.- Parameters:
animationDuration- animation duration to set in milliseconds
-
getAnimationEasing
- Returns:
- easing method used for the first draw animation
-
setAnimationEasing
Sets an animation easing method used for the first draw animation.- Parameters:
animationEasing- easing method to use- See Also:
-
getAnimationDelay
- Returns:
- delay before updating the first draw animation in milliseconds
-
setAnimationDelay
Sets a delay before updating the first draw animation.- Parameters:
animationDelay- delay to set in milliseconds
-
getAnimationDurationUpdate
- Returns:
- time for animation to complete in milliseconds
-
setAnimationDurationUpdate
Sets a time for animation to complete.- Parameters:
animationDurationUpdate- time to set in milliseconds
-
getAnimationEasingUpdate
- Returns:
- easing method used for update animation
-
setAnimationEasingUpdate
Sets an animation easing method used for update animation.- Parameters:
animationEasingUpdate- easing method to use- See Also:
-
getAnimationDelayUpdate
- Returns:
- delay before updating animation in milliseconds
-
setAnimationDelayUpdate
Sets a delay before updating animation.- Parameters:
animationDelayUpdate- delay to set in milliseconds
-
getStateAnimation
- Returns:
- state switching animation configurations
-
setStateAnimation
Sets aChartOptions.StateAnimationfor the chart.- Parameters:
stateAnimation- configuration to set
-
getBlendMode
- Returns:
- the type of compositing operation to apply when drawing a new shape
-
setBlendMode
Sets the type of compositing operation to apply when drawing a new shape. Blend mode issource-overby default.- Parameters:
blendMode- blend mode to set- See Also:
-
getHoverLayerThreshold
- Returns:
- the number of elements when exceeded, a separate hover layer is used to render hovered elements
-
setHoverLayerThreshold
Sets the number of elements when exceeded, a separate hover layer is used to render hovered elements.- Parameters:
hoverLayerThreshold- number of elements to set
-
getUseUtc
- Returns:
trueif UTC is used in display,falseotherwise
-
setUseUtc
Sets the use of UTC in display.-
true: whenaxis.typeis'time', ticks is determined according to UTC, andaxisLabelandtooltipuse UTC by default. -
false: whenaxis.typeis'time', ticks is determined according to local time, andaxisLabelandtooltipuse local time by default.
- Parameters:
useUtc- whether to use UTC in display
-
-
initChartOptionsChangeListener
protected void initChartOptionsChangeListener() -
onChartOptionsChange
-
requestUpdateChartOptions
protected void requestUpdateChartOptions() -
requestUpdateChartDataSet
protected void requestUpdateChartDataSet() -
requestIncrementalUpdateChartDataSet
protected <T extends DataItem> void requestIncrementalUpdateChartDataSet(ChartItems.ItemSetChangeEvent<T> event) -
performUpdateChartOptions
protected void performUpdateChartOptions(com.vaadin.flow.internal.ExecutionContext context) -
performUpdateChartData
protected void performUpdateChartData(com.vaadin.flow.internal.ExecutionContext context) -
performIncrementalUpdateChartDataSet
protected void performIncrementalUpdateChartDataSet(com.vaadin.flow.internal.ExecutionContext context) -
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
addChangedDataItems
protected <T extends DataItem> void addChangedDataItems(ChartItems.DataChangeOperation operation, Collection<T> items) -
addClickEventListener
public com.vaadin.flow.shared.Registration addClickEventListener(com.vaadin.flow.component.ComponentEventListener<ChartClickEvent> listener) -
addDoubleClickEventListener
public com.vaadin.flow.shared.Registration addDoubleClickEventListener(com.vaadin.flow.component.ComponentEventListener<ChartDoubleClickEvent> listener) -
addMouseDownEventListener
public com.vaadin.flow.shared.Registration addMouseDownEventListener(com.vaadin.flow.component.ComponentEventListener<ChartMouseDownEvent> listener) -
addMouseMoveEventListener
public com.vaadin.flow.shared.Registration addMouseMoveEventListener(com.vaadin.flow.component.ComponentEventListener<ChartMouseMoveEvent> listener) -
addMouseOutEventListener
public com.vaadin.flow.shared.Registration addMouseOutEventListener(com.vaadin.flow.component.ComponentEventListener<ChartMouseOutEvent> listener) -
addMouseOverEventListener
public com.vaadin.flow.shared.Registration addMouseOverEventListener(com.vaadin.flow.component.ComponentEventListener<ChartMouseOverEvent> listener) -
addMouseUpEventListener
public com.vaadin.flow.shared.Registration addMouseUpEventListener(com.vaadin.flow.component.ComponentEventListener<ChartMouseUpEvent> listener) -
addGlobalOutEventListener
public com.vaadin.flow.shared.Registration addGlobalOutEventListener(com.vaadin.flow.component.ComponentEventListener<ChartGlobalOutEvent> listener) -
addLegendSelectChangedEventListener
public com.vaadin.flow.shared.Registration addLegendSelectChangedEventListener(com.vaadin.flow.component.ComponentEventListener<ChartLegendSelectChangedEvent> listener) -
addLegendSelectAllEventListener
public com.vaadin.flow.shared.Registration addLegendSelectAllEventListener(com.vaadin.flow.component.ComponentEventListener<ChartLegendSelectAllEvent> listener) -
addLegendInverseSelectEventListener
public com.vaadin.flow.shared.Registration addLegendInverseSelectEventListener(com.vaadin.flow.component.ComponentEventListener<ChartLegendInverseSelectEvent> listener) -
addLegendScrollEventListener
public com.vaadin.flow.shared.Registration addLegendScrollEventListener(com.vaadin.flow.component.ComponentEventListener<ChartLegendScrollEvent> listener) -
addDataZoomEventListener
public com.vaadin.flow.shared.Registration addDataZoomEventListener(com.vaadin.flow.component.ComponentEventListener<ChartDataZoomEvent> listener) -
addRestoreEventListener
public com.vaadin.flow.shared.Registration addRestoreEventListener(com.vaadin.flow.component.ComponentEventListener<ChartRestoreEvent> listener) -
addMagicTypeChangedEventListener
public com.vaadin.flow.shared.Registration addMagicTypeChangedEventListener(com.vaadin.flow.component.ComponentEventListener<ChartMagicTypeChangedEvent> listener) -
addGlobalCursorTakenEventListener
public com.vaadin.flow.shared.Registration addGlobalCursorTakenEventListener(com.vaadin.flow.component.ComponentEventListener<ChartGlobalCursorTakenEvent> listener) -
addRenderedEventListener
public com.vaadin.flow.shared.Registration addRenderedEventListener(com.vaadin.flow.component.ComponentEventListener<ChartRenderedEvent> listener) -
addFinishedEventListener
public com.vaadin.flow.shared.Registration addFinishedEventListener(com.vaadin.flow.component.ComponentEventListener<ChartFinishedEvent> listener) -
getRemovalCallback
-
createChartOptions
-
createSerializer
-