com.vaadin.flow.component.charts.model.
Class Axis
All Implemented Interfaces:
See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
addCategory
(String category) Adds category to the categories array
abstract void
addPlotBand
(PlotBand plotBand) Adds plotBand to the plotBands array
abstract void
addPlotLine
(PlotLine plotLine) Adds plotLine to the plotLines array
abstract void
addUnit
(TimeUnitMultiples unit) Adds unit to the units array
abstract Boolean
abstract Color
protected Integer
abstract String[]
abstract Number
abstract String
Returns the configuration this axis is bound to.
abstract Crosshair
abstract DateTimeLabelFormats
abstract String
abstract Boolean
abstract Number
getFloor()
abstract Number
abstract String
getId()
abstract Labels
abstract Color
abstract Number
abstract Number
getMax()
abstract Number
getMin()
abstract String
abstract Number
abstract TickPosition
abstract Number
abstract Number
abstract Number
abstract Number
abstract Boolean
abstract PlotBand[]
abstract PlotLine[]
abstract Boolean
abstract Boolean
abstract Boolean
abstract Boolean
abstract Number
abstract Number
abstract Number
abstract Boolean
abstract Number
abstract Color
abstract Number
abstract Number
abstract TickmarkPlacement
abstract Number
abstract TickPosition
abstract Number[]
abstract AxisTitle
getTitle()
abstract AxisType
getType()
abstract Boolean
abstract TimeUnitMultiples[]
getUnits()
abstract Boolean
abstract void
removeCategory
(String category) Removes first occurrence of category in categories array
abstract void
removePlotBand
(PlotBand plotBand) Removes first occurrence of plotBand in plotBands array
abstract void
removePlotLine
(PlotLine plotLine) Removes first occurrence of plotLine in plotLines array
abstract void
removeUnit
(TimeUnitMultiples unit) Removes first occurrence of unit in units array
abstract void
setAllowDecimals
(Boolean allowDecimals) Whether to allow decimals in this axis' ticks.
abstract void
setAlternateGridColor
(Color alternateGridColor) When using an alternate grid color, a band is painted across the plot area between every other grid line.
void
setAxisIndex
(int i) abstract void
setCategories
(String... categories) If categories are present for the axis, names are used instead of numbers for that axis.
abstract void
setCeiling
(Number ceiling) The highest allowed value for automatically computed axis extremes.
abstract void
setClassName
(String className) A class name that opens for styling the axis by CSS.
void
setConfiguration
(ChartConfiguration configuration) Sets the configuration this axis is bound to.
abstract void
setCrosshair
(Crosshair crosshair) Configure a crosshair that follows either the mouse pointer or the hovered point.
abstract void
setDateTimeLabelFormats
(DateTimeLabelFormats dateTimeLabelFormats) For a datetime axis, the scale will automatically adjust to the appropriate unit.
abstract void
setDescription
(String description) Description of the axis to screen reader users.
abstract void
setEndOnTick
(Boolean endOnTick) Whether to force the axis to end on a tick.
void
setExtremes
(Number min, Number max) Sets the minimum and maximum of the axes after rendering has finished.
void
setExtremes
(Number min, Number max, boolean redraw) Sets the extremes at runtime.
void
setExtremes
(Number minimum, Number maximum, boolean redraw, boolean animate) Run-time modification of the axis extremes.
void
setExtremes
(Date min, Date max) The minimum and maximum value of the axis as Date.
void
setExtremes
(Date min, Date max, boolean redraw) The minimum and maximum value of the axis as Date.
void
setExtremes
(Date minimum, Date maximum, boolean redraw, boolean animate) The minimum and maximum value of the axis as Date.
abstract void
The lowest allowed value for automatically computed axis extremes.
abstract void
setGridZIndex
(Number gridZIndex) The Z index of the grid lines.
abstract void
An id for the axis.
abstract void
The axis labels show the number or category for each tick.
abstract void
setLineColor
(Color lineColor) The color of the line marking the axis itself.
abstract void
setLineWidth
(Number lineWidth) The width of the line marking the axis itself.
abstract void
setLinkedTo
(Number linkedTo) Index of another axis that this axis is linked to.
void
The maximum value of the axis.
void
The maximum value of the axis as Instant.
void
Deprecated.
use setMax(Instant) insteadabstract void
setMaxPadding
(Number maxPadding) Padding of the max value relative to the length of the axis.
void
The minimum value of the axis.
void
The minimum value of the axis as Instant.
void
Deprecated.
use setMin(Instant) insteadabstract void
setMinorTickInterval
(String minorTickInterval) Tick interval in scale units for the minor ticks.
abstract void
setMinorTickLength
(Number minorTickLength) The pixel length of the minor tick marks.
abstract void
setMinorTickPosition
(TickPosition minorTickPosition) The position of the minor tick marks relative to the axis line.
abstract void
setMinPadding
(Number minPadding) Padding of the min value relative to the length of the axis.
abstract void
setMinRange
(Number minRange) The minimum range to display on this axis.
abstract void
setMinTickInterval
(Number minTickInterval) The minimum tick interval allowed in axis values.
abstract void
The distance in pixels from the plot area to the axis line.
abstract void
setOpposite
(Boolean opposite) Whether to display the axis on the opposite side of the normal.
abstract void
setPlotBands
(PlotBand... plotBands) An array of colored bands stretching across the plot area marking an interval on the axis.
abstract void
setPlotLines
(PlotLine... plotLines) An array of lines stretching across the plot area, marking a specific value on one of the axes.
abstract void
setReversed
(Boolean reversed) Whether to reverse the axis so that the highest number is closest to the origin.
abstract void
setShowEmpty
(Boolean showEmpty) Whether to show the axis line and title when the axis has no data.
abstract void
setShowFirstLabel
(Boolean showFirstLabel) Whether to show the first tick label.
abstract void
setShowLastLabel
(Boolean showLastLabel) Whether to show the last tick label.
abstract void
setSoftMax
(Number softMax) A soft maximum for the axis.
abstract void
setSoftMin
(Number softMin) A soft minimum for the axis.
abstract void
setStartOfWeek
(Number startOfWeek) For datetime axes, this decides where to put the tick between weeks.
abstract void
setStartOnTick
(Boolean startOnTick) Whether to force the axis to start on a tick.
abstract void
setTickAmount
(Number tickAmount) The amount of ticks to draw on the axis.
abstract void
setTickColor
(Color tickColor) Color for the main tick marks.
abstract void
setTickInterval
(Number tickInterval) The interval of the tick marks in axis units.
abstract void
setTickLength
(Number tickLength) The pixel length of the main tick marks.
abstract void
setTickmarkPlacement
(TickmarkPlacement tickmarkPlacement) For categorized axes only.
abstract void
setTickPixelInterval
(Number tickPixelInterval) If tickInterval is
null
this option sets the approximate pixel interval of the tick marks.abstract void
setTickPosition
(TickPosition tickPosition) The position of the major tick marks relative to the axis line.
abstract void
setTickPositions
(Number[] tickPositions) An array defining where the ticks are laid out on the axis.
abstract void
The axis title, showing next to the axis line.
abstract void
abstract void
The type of axis.
abstract void
setUniqueNames
(Boolean uniqueNames) Applies only when the axis
type
iscategory
.abstract void
setUnits
(TimeUnitMultiples... units) Datetime axis only.
abstract void
setVisible
(Boolean visible) Whether axis, including axis title, line, ticks and labels, should be visible.
-
Field Details
-
MINOR_TICK_INTERVAL_AUTO
See Also:
-
min
-
max
-
-
Constructor Details
-
Axis
public Axis()
-
-
Method Details
-
setAxisIndex
public void setAxisIndex(int i) -
getAxisIndex
-
getMin
Returns:
the minimum value of the axis or null
See Also:
-
setMin
The minimum value of the axis. If null the min value is automatically calculated. If the startOnTick option is true, the min value might be rounded down.
Parameters:
min
- -
setMin
Deprecated.use setMin(Instant) insteadThe minimum value of the axis as Date.
Parameters:
min
-See Also:
-
setMin
The minimum value of the axis as Instant.
Parameters:
min
-See Also:
-
getMax
Returns:
Maximum value of axis or null
See Also:
-
setMax
The maximum value of the axis. If null, the max value is automatically calculated. If the endOnTick option is true, the max value might be rounded up. The actual maximum value is also influenced by chart.alignTicks.
Parameters:
max
- -
setMax
Deprecated.use setMax(Instant) insteadThe maximum value of the axis as Date.
Parameters:
max
-See Also:
-
setMax
The maximum value of the axis as Instant.
Parameters:
max
-See Also:
-
setExtremes
Sets the minimum and maximum of the axes after rendering has finished. If the startOnTick and endOnTick options are true, the minimum and maximum values are rounded off to the nearest tick. To prevent this, these options can be set to false before calling setExtremes.
Parameters:
min
- The new minimum valuemax
- The new maximum value -
setExtremes
The minimum and maximum value of the axis as Date.
See Also:
-
setExtremes
Sets the extremes at runtime.
Parameters:
min
- Minimum.max
- Maximum.redraw
- Whether or not to redraw the chart. -
setExtremes
The minimum and maximum value of the axis as Date.
See Also:
-
setExtremes
Run-time modification of the axis extremes.
Parameters:
minimum
- New minimum value.maximum
- New maximum value.redraw
- Whether or not to redraw the chart.animate
- Whether or not to animate the rescaling. -
setExtremes
The minimum and maximum value of the axis as Date.
-
getConfiguration
Returns the configuration this axis is bound to.
Returns:
The configuration.
-
setConfiguration
Sets the configuration this axis is bound to. This method is automatically called by configuration, when the axis is added to it.
Parameters:
configuration
- Configuration this object is linked to. -
getAllowDecimals
See Also:
-
setAllowDecimals
Whether to allow decimals in this axis' ticks. When counting integers, like persons or hits on a web page, decimals must be avoided in the axis tick labels.
-
getAlternateGridColor
See Also:
-
setAlternateGridColor
When using an alternate grid color, a band is painted across the plot area between every other grid line.
-
getCategories
See Also:
-
setCategories
If categories are present for the axis, names are used instead of numbers for that axis. Since Highcharts 3.0, categories can also be extracted by giving each point a
name
and setting axis type tocategory
. However, if you have multiple series, best practice remains defining thecategories
array.Example:
categories: ['Apples', 'Bananas', 'Oranges']
-
addCategory
Adds category to the categories array
Parameters:
category
- to addSee Also:
-
removeCategory
Removes first occurrence of category in categories array
Parameters:
category
- to removeSee Also:
-
getCeiling
See Also:
-
setCeiling
The highest allowed value for automatically computed axis extremes.
-
getClassName
See Also:
-
setClassName
A class name that opens for styling the axis by CSS.
-
getCrosshair
See Also:
-
setCrosshair
Configure a crosshair that follows either the mouse pointer or the hovered point.
-
getDateTimeLabelFormats
-
setDateTimeLabelFormats
For a datetime axis, the scale will automatically adjust to the appropriate unit. This member gives the default string representations used for each unit. For an overview of the replacement codes, see dateFormat.
-
getDescription
See Also:
-
setDescription
Description of the axis to screen reader users.
-
getEndOnTick
See Also:
-
setEndOnTick
Whether to force the axis to end on a tick. Use this option with the
maxPadding
option to control the axis end. -
getFloor
See Also:
-
setFloor
The lowest allowed value for automatically computed axis extremes.
-
getGridZIndex
See Also:
-
setGridZIndex
The Z index of the grid lines.
-
getId
See Also:
-
setId
An id for the axis. This can be used after render time to get a pointer to the axis object through
chart.get()
. -
getLabels
See Also:
-
setLabels
The axis labels show the number or category for each tick.
-
getLineColor
See Also:
-
setLineColor
The color of the line marking the axis itself.
-
getLineWidth
See Also:
-
setLineWidth
The width of the line marking the axis itself.
-
getLinkedTo
See Also:
-
setLinkedTo
Index of another axis that this axis is linked to. When an axis is linked to a master axis, it will take the same extremes as the master, but as assigned by min or max or by setExtremes. It can be used to show additional info, or to ease reading the chart by duplicating the scales.
-
getMaxPadding
See Also:
-
setMaxPadding
Padding of the max value relative to the length of the axis. A padding of 0.05 will make a 100px axis 5px longer. This is useful when you don't want the highest data value to appear on the edge of the plot area. When the axis'
max
option is set or a max extreme is set usingaxis.setExtremes()
, the maxPadding will be ignored. -
getMinPadding
See Also:
-
setMinPadding
Padding of the min value relative to the length of the axis. A padding of 0.05 will make a 100px axis 5px longer. This is useful when you don't want the lowest data value to appear on the edge of the plot area. When the axis'
min
option is set or a min extreme is set usingaxis.setExtremes()
, the minPadding will be ignored. -
getMinRange
See Also:
-
setMinRange
The minimum range to display on this axis. The entire axis will not be allowed to span over a smaller interval than this. For example, for a datetime axis the main unit is milliseconds. If minRange is set to 3600000, you can't zoom in more than to one hour.
The default minRange for the x axis is five times the smallest interval between any of the data points.
On a logarithmic axis, the unit for the minimum range is the power. So a minRange of 1 means that the axis can be zoomed to 10-100, 100-1000, 1000-10000 etc.
Note that the
minPadding
,maxPadding
,startOnTick
andendOnTick
settings also affect how the extremes of the axis are computed. -
getMinTickInterval
See Also:
-
setMinTickInterval
The minimum tick interval allowed in axis values. For example on zooming in on an axis with daily data, this can be used to prevent the axis from showing hours.
-
getMinorTickInterval
See Also:
-
setMinorTickInterval
Tick interval in scale units for the minor ticks. On a linear axis, if
"auto"
, the minor tick interval is calculated as a fifth of the tickInterval. Ifnull
, minor ticks are not shown.On logarithmic axes, the unit is the power of the value. For example, setting the minorTickInterval to 1 puts one tick on each of 0.1, 1, 10, 100 etc. Setting the minorTickInterval to 0.1 produces 9 ticks between 1 and 10, 10 and 100 etc. A minorTickInterval of "auto" on a log axis results in a best guess, attempting to enter approximately 5 minor ticks between each major tick.
If user settings dictate minor ticks to become too dense, they don't make sense, and will be ignored to prevent performance problems.
On axes using
categories
, minor ticks are not supported. -
getMinorTickLength
See Also:
-
setMinorTickLength
The pixel length of the minor tick marks.
-
getMinorTickPosition
See Also:
-
setMinorTickPosition
The position of the minor tick marks relative to the axis line. Can be one of
inside
andoutside
. -
getOffset
See Also:
-
setOffset
The distance in pixels from the plot area to the axis line. A positive offset moves the axis with it's line, labels and ticks away from the plot area. This is typically used when two or more axes are displayed on the same side of the plot.
-
getOpposite
See Also:
-
setOpposite
Whether to display the axis on the opposite side of the normal. The normal is on the left side for vertical axes and bottom for horizontal, so the opposite sides will be right and top respectively. This is typically used with dual or multiple axes.
-
getPlotBands
See Also:
-
setPlotBands
An array of colored bands stretching across the plot area marking an interval on the axis.
-
addPlotBand
Adds plotBand to the plotBands array
Parameters:
plotBand
- to addSee Also:
-
removePlotBand
Removes first occurrence of plotBand in plotBands array
Parameters:
plotBand
- to removeSee Also:
-
getPlotLines
See Also:
-
setPlotLines
An array of lines stretching across the plot area, marking a specific value on one of the axes.
-
addPlotLine
Adds plotLine to the plotLines array
Parameters:
plotLine
- to addSee Also:
-
removePlotLine
Removes first occurrence of plotLine in plotLines array
Parameters:
plotLine
- to removeSee Also:
-
getReversed
See Also:
-
setReversed
Whether to reverse the axis so that the highest number is closest to the origin.
-
getShowEmpty
See Also:
-
setShowEmpty
Whether to show the axis line and title when the axis has no data.
-
getShowFirstLabel
See Also:
-
setShowFirstLabel
Whether to show the first tick label.
-
getShowLastLabel
See Also:
-
setShowLastLabel
Whether to show the last tick label.
-
getSoftMax
See Also:
-
setSoftMax
A soft maximum for the axis. If the series data maximum is less than this, the axis will stay at this maximum, but if the series data maximum is higher, the axis will flex to show all data.
-
getSoftMin
See Also:
-
setSoftMin
A soft minimum for the axis. If the series data minimum is greater than this, the axis will stay at this minimum, but if the series data minimum is lower, the axis will flex to show all data.
-
getStartOfWeek
See Also:
-
setStartOfWeek
For datetime axes, this decides where to put the tick between weeks. 0 = Sunday, 1 = Monday.
-
getStartOnTick
See Also:
-
setStartOnTick
Whether to force the axis to start on a tick. Use this option with the
minPadding
option to control the axis start. -
getTickAmount
See Also:
-
setTickAmount
The amount of ticks to draw on the axis. This opens up for aligning the ticks of multiple charts or panes within a chart. This option overrides the
tickPixelInterval
option.This option only has an effect on linear axes. Datetime, logarithmic or category axes are not affected.
-
getTickColor
See Also:
-
setTickColor
Color for the main tick marks.
-
getTickInterval
See Also:
-
setTickInterval
The interval of the tick marks in axis units. When
null
, the tick interval is computed to approximately follow thetickPixelInterval
on linear and datetime axes. On categorized axes, anull
tickInterval will default to 1, one category. Note that datetime axes are based on milliseconds, so for example an interval of one day is expressed as24 * 3600 * 1000
.On logarithmic axes, the tickInterval is based on powers, so a tickInterval of 1 means one tick on each of 0.1, 1, 10, 100 etc. A tickInterval of 2 means a tick of 0.1, 10, 1000 etc. A tickInterval of 0.2 puts a tick on 0.1, 0.2, 0.4, 0.6, 0.8, 1, 2, 4, 6, 8, 10, 20, 40 etc.
If the tickInterval is too dense for labels to be drawn, Highcharts may remove ticks.
-
getTickLength
See Also:
-
setTickLength
The pixel length of the main tick marks.
-
getTickPixelInterval
See Also:
-
setTickPixelInterval
If tickInterval is
null
this option sets the approximate pixel interval of the tick marks. Not applicable to categorized axis. -
getTickPosition
See Also:
-
setTickPosition
The position of the major tick marks relative to the axis line. Can be one of
inside
andoutside
. -
getTickPositions
See Also:
-
setTickPositions
An array defining where the ticks are laid out on the axis. This overrides the default behaviour of
tickPixelInterval
andtickInterval
. -
getTickmarkPlacement
See Also:
-
setTickmarkPlacement
For categorized axes only. If
on
the tick mark is placed in the center of the category, ifbetween
the tick mark is placed between categories. The default isbetween
if thetickInterval
is 1, elseon
. -
getTitle
See Also:
-
setTitle
The axis title, showing next to the axis line.
-
getType
See Also:
-
setType
The type of axis. Can be one of
"linear"
,"logarithmic"
,"datetime"
or"category"
. In a datetime axis, the numbers are given in milliseconds, and tick marks are placed on appropriate values like full hours or days. In a category axis, the point names of the chart's series are used for categories, if not a categories array is defined. -
getUniqueNames
See Also:
-
setUniqueNames
Applies only when the axis
type
iscategory
. WhenuniqueNames
is true, points are placed on the X axis according to their names. If the same point name is repeated in the same or another series, the point is placed on the same X position as other points of the same name. WhenuniqueNames
is false, the points are laid out in increasing X positions regardless of their names, and the X axis category will take the name of the last point in each position. -
getUnits
See Also:
-
setUnits
Datetime axis only. An array determining what time intervals the ticks are allowed to fall on. Each array item is an array where the first value is the time unit and the second value another array of allowed multiples.
-
addUnit
Adds unit to the units array
Parameters:
unit
- to addSee Also:
-
removeUnit
Removes first occurrence of unit in units array
Parameters:
unit
- to removeSee Also:
-
getVisible
See Also:
-
setVisible
Whether axis, including axis title, line, ticks and labels, should be visible.
-
setTitle
-