com.vaadin.flow.component.charts.model.
Class ChartModel
- java.lang.Object
-
- com.vaadin.flow.component.charts.model.AbstractConfigurationObject
-
- com.vaadin.flow.component.charts.model.ChartModel
-
All Implemented Interfaces:
public class ChartModel extends AbstractConfigurationObject
Options regarding the chart area and plot area as well as general chart options.
See Also:
-
-
Constructor Summary
Constructors Constructor and Description ChartModel()
-
Method Summary
All Methods Modifier and Type Method and Description Boolean
getAlignTicks()
Boolean
getAnimation()
Color
getBackgroundColor()
Color
getBorderColor()
Number
getBorderRadius()
Number
getBorderWidth()
String
getClassName()
Number
getColorCount()
String
getDescription()
String
getHeight()
Boolean
getIgnoreHiddenSeries()
Boolean
getInverted()
Number[]
getMargin()
Number
getMarginBottom()
Number
getMarginLeft()
Number
getMarginRight()
Number
getMarginTop()
Options3d
getOptions3d()
PanKey
getPanKey()
Boolean
getPanning()
Dimension
getPinchType()
Color
getPlotBackgroundColor()
String
getPlotBackgroundImage()
Color
getPlotBorderColor()
Number
getPlotBorderWidth()
Boolean
getPlotShadow()
Boolean
getPolar()
Boolean
getReflow()
ResetZoomButton
getResetZoomButton()
Color
getSelectionMarkerFill()
Boolean
getShadow()
Boolean
getShowAxes()
Number[]
getSpacing()
Number
getSpacingBottom()
Number
getSpacingLeft()
Number
getSpacingRight()
Number
getSpacingTop()
Style
getStyle()
Boolean
getStyledMode()
ChartType
getType()
String
getTypeDescription()
Number
getWidth()
Dimension
getZoomType()
void
setAlignTicks(Boolean alignTicks)
When using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or axes with the least ticks, as if
tickAmount
were specified.void
setAnimation(Boolean animation)
Set the overall animation for all chart updating.
void
setBackgroundColor(Color backgroundColor)
The background color or gradient for the outer chart area.
void
setBorderColor(Color borderColor)
The color of the outer chart border.
void
setBorderRadius(Number borderRadius)
The corner radius of the outer chart border.
void
setBorderWidth(Number borderWidth)
The pixel width of the outer chart border.
void
setClassName(String className)
A CSS class name to apply to the charts container
div
, allowing unique CSS styling for each chart.void
setColorCount(Number colorCount)
In styled mode, this sets how many colors the class names should rotate between.
void
setDescription(String description)
A text description of the chart.
void
setHeight(String height)
An explicit height for the chart.
void
setIgnoreHiddenSeries(Boolean ignoreHiddenSeries)
If true, the axes will scale to the remaining visible series once one series is hidden.
void
setInverted(Boolean inverted)
Whether to invert the axes so that the x axis is vertical and y axis is horizontal.
void
setMargin(Number margin)
Sets all margins to the same value
void
setMargin(Number vertical, Number horizontal)
Sets the vertical margin for top and bottom and the horizontal margin for the right and left margin
void
setMargin(Number top, Number right, Number bottom, Number left)
Set all margins in one call
void
setMarginBottom(Number marginBottom)
The margin between the bottom outer edge of the chart and the plot area.
void
setMarginLeft(Number marginLeft)
The margin between the left outer edge of the chart and the plot area.
void
setMarginRight(Number marginRight)
The margin between the right outer edge of the chart and the plot area.
void
setMarginTop(Number marginTop)
The margin between the top outer edge of the chart and the plot area.
void
setOptions3d(Options3d options3d)
Options to render charts in 3 dimensions.
void
setPanKey(PanKey panKey)
Allows setting a key to switch between zooming and panning.
void
setPanning(Boolean panning)
Allow panning in a chart.
void
setPinchType(Dimension pinchType)
Equivalent to zoomType, but for multitouch gestures only.
void
setPlotBackgroundColor(Color plotBackgroundColor)
The background color or gradient for the plot area.
void
setPlotBackgroundImage(String plotBackgroundImage)
The URL for an image to use as the plot background.
void
setPlotBorderColor(Color plotBorderColor)
The color of the inner chart or plot area border.
void
setPlotBorderWidth(Number plotBorderWidth)
The pixel width of the plot area border.
void
setPlotShadow(Boolean plotShadow)
Whether to apply a drop shadow to the plot area.
void
setPolar(Boolean polar)
When true, cartesian charts like line, spline, area and column are transformed into the polar coordinate system.
void
setReflow(Boolean reflow)
Whether to reflow the chart to fit the width of the container div on resizing the window.
void
setResetZoomButton(ResetZoomButton resetZoomButton)
The button that appears after a selection zoom, allowing the user to reset zoom.
void
setSelectionMarkerFill(Color selectionMarkerFill)
The background color of the marker square when selecting (zooming in on) an area of the chart.
void
setShadow(Boolean shadow)
Whether to apply a drop shadow to the outer chart area.
void
setShowAxes(Boolean showAxes)
Whether to show the axes initially.
void
setSpacing(Number[] spacing)
The distance between the outer edge of the chart and the content, like title or legend, or axis title or labels if present.
void
setSpacingBottom(Number spacingBottom)
The space between the bottom edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).
void
setSpacingLeft(Number spacingLeft)
The space between the left edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).
void
setSpacingRight(Number spacingRight)
The space between the right edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).
void
setSpacingTop(Number spacingTop)
The space between the top edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).
void
setStyle(Style style)
Additional CSS styles to apply inline to the container
div
.void
setStyledMode(Boolean styledMode)
Whether to apply styled mode.
void
setType(ChartType type)
The default series type for the chart.
void
setTypeDescription(String typeDescription)
A text description of the chart type.
void
setWidth(Number width)
An explicit width for the chart.
void
setZoomType(Dimension zoomType)
Decides in what dimensions the user can zoom by dragging the mouse.
-
-
-
Method Detail
-
getAlignTicks
public Boolean getAlignTicks()
See Also:
-
setAlignTicks
public void setAlignTicks(Boolean alignTicks)
When using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or axes with the least ticks, as if
tickAmount
were specified.This can be prevented by setting
alignTicks
to false. If the grid lines look messy, it's a good idea to hide them for the secondary axis by settinggridLineWidth
to 0.Defaults to: true
-
getAnimation
public Boolean getAnimation()
See Also:
-
setAnimation
public void setAnimation(Boolean animation)
Set the overall animation for all chart updating. Animation can be disabled throughout the chart by setting it to false here. It can be overridden for each individual API method as a function parameter. The only animation not affected by this option is the initial series animation, see plotOptions.series.animation.
The animation can either be set as a boolean or a configuration object. If
true
, it will use the 'swing' jQuery easing and a duration of 500 ms. If used as a configuration object, the following properties are supported:- duration
- The duration of the animation in milliseconds.
- easing
- A string reference to an easing function set on the
Math
object. See the easing demo.
Defaults to: true
-
getBackgroundColor
public Color getBackgroundColor()
See Also:
-
setBackgroundColor
public void setBackgroundColor(Color backgroundColor)
The background color or gradient for the outer chart area.
Defaults to: #FFFFFF
-
getBorderColor
public Color getBorderColor()
See Also:
-
setBorderColor
public void setBorderColor(Color borderColor)
The color of the outer chart border.
Defaults to: #335cad
-
getBorderRadius
public Number getBorderRadius()
See Also:
-
setBorderRadius
public void setBorderRadius(Number borderRadius)
The corner radius of the outer chart border.
Defaults to: 0
-
getBorderWidth
public Number getBorderWidth()
See Also:
-
setBorderWidth
public void setBorderWidth(Number borderWidth)
The pixel width of the outer chart border.
Defaults to: 0
-
getClassName
public String getClassName()
See Also:
-
setClassName
public void setClassName(String className)
A CSS class name to apply to the charts container
div
, allowing unique CSS styling for each chart.
-
getColorCount
public Number getColorCount()
See Also:
-
setColorCount
public void setColorCount(Number colorCount)
In styled mode, this sets how many colors the class names should rotate between. With ten colors, series (or points) are given class names like
highcharts-color-0
,highcharts-color-0
[...]highcharts-color-9
. The equivalent in non-styled mode is to set colors using the colors setting.Defaults to: 10
-
getDescription
public String getDescription()
See Also:
-
setDescription
public void setDescription(String description)
A text description of the chart.
If the Accessibility module is loaded, this is included by default as a long description of the chart and its contents in the hidden screen reader information region.
Defaults to: undefined
-
getHeight
public String getHeight()
See Also:
-
setHeight
public void setHeight(String height)
An explicit height for the chart. If a number, the height is given in pixels. If given a percentage string (for example
'56%'
), the height is given as the percentage of the actual chart width. This allows for preserving the aspect ratio across responsive sizes.By default (when
null
) the height is calculated from the offset height of the containing element, or 400 pixels if the containing element's height is 0.Defaults to: null
-
getIgnoreHiddenSeries
public Boolean getIgnoreHiddenSeries()
See Also:
-
setIgnoreHiddenSeries
public void setIgnoreHiddenSeries(Boolean ignoreHiddenSeries)
If true, the axes will scale to the remaining visible series once one series is hidden. If false, hiding and showing a series will not affect the axes or the other series. For stacks, once one series within the stack is hidden, the rest of the stack will close in around it even if the axis is not affected.
Defaults to: true
-
getInverted
public Boolean getInverted()
See Also:
-
setInverted
public void setInverted(Boolean inverted)
Whether to invert the axes so that the x axis is vertical and y axis is horizontal. When true, the x axis is reversed by default. If a bar series is present in the chart, it will be inverted automatically.
Inverting the chart doesn't have an effect if there are no cartesian series in the chart, or if the chart is polar.
Defaults to: false
-
getMargin
public Number[] getMargin()
-
getMarginBottom
public Number getMarginBottom()
See Also:
-
setMarginBottom
public void setMarginBottom(Number marginBottom)
The margin between the bottom outer edge of the chart and the plot area. Use this to set a fixed pixel value for the margin as opposed to the default dynamic margin. See also
spacingBottom
.
-
getMarginLeft
public Number getMarginLeft()
See Also:
-
setMarginLeft
public void setMarginLeft(Number marginLeft)
The margin between the left outer edge of the chart and the plot area. Use this to set a fixed pixel value for the margin as opposed to the default dynamic margin. See also
spacingLeft
.
-
getMarginRight
public Number getMarginRight()
See Also:
-
setMarginRight
public void setMarginRight(Number marginRight)
The margin between the right outer edge of the chart and the plot area. Use this to set a fixed pixel value for the margin as opposed to the default dynamic margin. See also
spacingRight
.
-
getMarginTop
public Number getMarginTop()
See Also:
-
setMarginTop
public void setMarginTop(Number marginTop)
The margin between the top outer edge of the chart and the plot area. Use this to set a fixed pixel value for the margin as opposed to the default dynamic margin. See also
spacingTop
.
-
getOptions3d
public Options3d getOptions3d()
See Also:
-
setOptions3d
public void setOptions3d(Options3d options3d)
Options to render charts in 3 dimensions. This feature requires
highcharts-3d.js
, found in the download package or online at code.highcharts.com/ highcharts-3d.js.
-
getPanKey
public PanKey getPanKey()
See Also:
-
setPanKey
public void setPanKey(PanKey panKey)
Allows setting a key to switch between zooming and panning. Can be one of
alt
,ctrl
,meta
(the command key on Mac and Windows key on Windows) orshift
. The keys are mapped directly to the key properties of the click event argument (event.altKey
,event.ctrlKey
,event.metaKey
andevent.shiftKey
).
-
getPanning
public Boolean getPanning()
See Also:
-
setPanning
public void setPanning(Boolean panning)
Allow panning in a chart. Best used with panKey to combine zooming and panning.
On touch devices, when the tooltip.followTouchMove option is
true
(default), panning requires two fingers. To allow panning with one finger, setfollowTouchMove
tofalse
.Defaults to: false
-
getPinchType
public Dimension getPinchType()
See Also:
-
setPinchType
public void setPinchType(Dimension pinchType)
Equivalent to zoomType, but for multitouch gestures only. By default, the
pinchType
is the same as thezoomType
setting. However, pinching can be enabled separately in some cases, for example in stock charts where a mouse drag pans the chart, while pinching is enabled. When tooltip.followTouchMove is true, pinchType only applies to two-finger touches.Defaults to: null
-
getPlotBackgroundColor
public Color getPlotBackgroundColor()
See Also:
-
setPlotBackgroundColor
public void setPlotBackgroundColor(Color plotBackgroundColor)
The background color or gradient for the plot area.
-
getPlotBackgroundImage
public String getPlotBackgroundImage()
See Also:
-
setPlotBackgroundImage
public void setPlotBackgroundImage(String plotBackgroundImage)
The URL for an image to use as the plot background. To set an image as the background for the entire chart, set a CSS background image to the container element. Note that for the image to be applied to exported charts, its URL needs to be accessible by the export server.
-
getPlotBorderColor
public Color getPlotBorderColor()
See Also:
-
setPlotBorderColor
public void setPlotBorderColor(Color plotBorderColor)
The color of the inner chart or plot area border.
Defaults to: #cccccc
-
getPlotBorderWidth
public Number getPlotBorderWidth()
See Also:
-
setPlotBorderWidth
public void setPlotBorderWidth(Number plotBorderWidth)
The pixel width of the plot area border.
Defaults to: 0
-
getPlotShadow
public Boolean getPlotShadow()
See Also:
-
setPlotShadow
public void setPlotShadow(Boolean plotShadow)
Whether to apply a drop shadow to the plot area. Requires that plotBackgroundColor be set. The shadow can be an object configuration containing
color
,offsetX
,offsetY
,opacity
andwidth
.Defaults to: false
-
getPolar
public Boolean getPolar()
See Also:
-
setPolar
public void setPolar(Boolean polar)
When true, cartesian charts like line, spline, area and column are transformed into the polar coordinate system. Requires
highcharts-more.js
.Defaults to: false
-
getReflow
public Boolean getReflow()
See Also:
-
setReflow
public void setReflow(Boolean reflow)
Whether to reflow the chart to fit the width of the container div on resizing the window.
Defaults to: true
-
getResetZoomButton
public ResetZoomButton getResetZoomButton()
See Also:
-
setResetZoomButton
public void setResetZoomButton(ResetZoomButton resetZoomButton)
The button that appears after a selection zoom, allowing the user to reset zoom.
-
getSelectionMarkerFill
public Color getSelectionMarkerFill()
See Also:
-
setSelectionMarkerFill
public void setSelectionMarkerFill(Color selectionMarkerFill)
The background color of the marker square when selecting (zooming in on) an area of the chart.
Defaults to: rgba(51,92,173,0.25)
-
getShadow
public Boolean getShadow()
See Also:
-
setShadow
public void setShadow(Boolean shadow)
Whether to apply a drop shadow to the outer chart area. Requires that backgroundColor be set. The shadow can be an object configuration containing
color
,offsetX
,offsetY
,opacity
andwidth
.Defaults to: false
-
getShowAxes
public Boolean getShowAxes()
See Also:
-
setShowAxes
public void setShowAxes(Boolean showAxes)
Whether to show the axes initially. This only applies to empty charts where series are added dynamically, as axes are automatically added to cartesian series.
Defaults to: false
-
getSpacing
public Number[] getSpacing()
See Also:
-
setSpacing
public void setSpacing(Number[] spacing)
The distance between the outer edge of the chart and the content, like title or legend, or axis title or labels if present. The numbers in the array designate top, right, bottom and left respectively. Use the options spacingTop, spacingRight, spacingBottom and spacingLeft options for shorthand setting of one option.
Defaults to: [10, 10, 15, 10]
-
getSpacingBottom
public Number getSpacingBottom()
See Also:
-
setSpacingBottom
public void setSpacingBottom(Number spacingBottom)
The space between the bottom edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).
Defaults to: 15
-
getSpacingLeft
public Number getSpacingLeft()
See Also:
-
setSpacingLeft
public void setSpacingLeft(Number spacingLeft)
The space between the left edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).
Defaults to: 10
-
getSpacingRight
public Number getSpacingRight()
See Also:
-
setSpacingRight
public void setSpacingRight(Number spacingRight)
The space between the right edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).
Defaults to: 10
-
getSpacingTop
public Number getSpacingTop()
See Also:
-
setSpacingTop
public void setSpacingTop(Number spacingTop)
The space between the top edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).
Defaults to: 10
-
getStyle
public Style getStyle()
See Also:
-
setStyle
public void setStyle(Style style)
Additional CSS styles to apply inline to the container
div
. Note that since the default font styles are applied in the renderer, it is ignorant of the individual chart options and must be set globally.Defaults to: {"fontFamily": "\"Lucida Grande\", \"Lucida Sans Unicode\", Verdana, Arial, Helvetica, sans-serif" ,"fontSize":"12px"}
-
getType
public ChartType getType()
See Also:
-
setType
public void setType(ChartType type)
The default series type for the chart. Can be any of the chart types listed under plotOptions.
Defaults to: line
-
getTypeDescription
public String getTypeDescription()
See Also:
-
setTypeDescription
public void setTypeDescription(String typeDescription)
A text description of the chart type.
If the Accessibility module is loaded, this will be included in the description of the chart in the screen reader information region.
Highcharts will by default attempt to guess the chart type, but for more complex charts it is recommended to specify this property for clarity.
Defaults to: undefined
-
getWidth
public Number getWidth()
See Also:
-
setWidth
public void setWidth(Number width)
An explicit width for the chart. By default (when
null
) the width is calculated from the offset width of the containing element.Defaults to: null
-
getZoomType
public Dimension getZoomType()
See Also:
-
setZoomType
public void setZoomType(Dimension zoomType)
Decides in what dimensions the user can zoom by dragging the mouse. Can be one of
x
,y
orxy
.
-
setMargin
public void setMargin(Number margin)
Sets all margins to the same value
-
setMargin
public void setMargin(Number vertical, Number horizontal)
Sets the vertical margin for top and bottom and the horizontal margin for the right and left margin
-
setMargin
public void setMargin(Number top, Number right, Number bottom, Number left)
Set all margins in one call
-
getStyledMode
public Boolean getStyledMode()
-
setStyledMode
public void setStyledMode(Boolean styledMode)
Whether to apply styled mode. When in styled mode, no presentational attributes or CSS are applied to the chart SVG. Instead, CSS rules are required to style the chart. The default style sheet is available from https://code.highcharts.com/css/highcharts.css.
-
-