public class DataGrouping extends AbstractConfigurationObject
Data grouping is the concept of sampling the data values into larger blocks
in order to ease readability and increase performance of the JavaScript
charts. Highstock by default applies data grouping when the points become
closer than a certain pixel value, determined by the
groupPixelWidth option.
If data grouping is applied, the grouping information of grouped points can be read from the Point.dataGroup.
| Constructor and Description |
|---|
DataGrouping() |
DataGrouping(Boolean enabled) |
| Modifier and Type | Method and Description |
|---|---|
void |
addUnit(TimeUnitMultiples unit)
Adds unit to the units array
|
DateTimeLabelFormats |
getDateTimeLabelFormats() |
Boolean |
getEnabled() |
Boolean |
getForced() |
Number |
getGroupPixelWidth() |
Boolean |
getSmoothed() |
TimeUnitMultiples[] |
getUnits() |
void |
removeUnit(TimeUnitMultiples unit)
Removes first occurrence of unit in units array
|
void |
setDateTimeLabelFormats(DateTimeLabelFormats dateTimeLabelFormats)
Datetime formats for the header of the tooltip in a stock chart.
|
void |
setEnabled(Boolean enabled)
Enable or disable data grouping.
|
void |
setForced(Boolean forced)
When data grouping is forced, it runs no matter how small the intervals
are.
|
void |
setGroupPixelWidth(Number groupPixelWidth)
The approximate pixel width of each group.
|
void |
setSmoothed(Boolean smoothed)
Normally, a group is indexed by the start of that group, so for example
when 30 daily values are grouped into one month, that month's x value
will be the 1st of the month.
|
void |
setUnits(TimeUnitMultiples... units)
An array determining what time intervals the data is allowed to be
grouped to.
|
public DataGrouping()
public DataGrouping(Boolean enabled)
public DateTimeLabelFormats getDateTimeLabelFormats()
public void setDateTimeLabelFormats(DateTimeLabelFormats dateTimeLabelFormats)
Datetime formats for the header of the tooltip in a stock chart. The format can vary within a chart depending on the currently selected time range and the current data grouping.
The default formats are:
{
millisecond: ['%A, %b %e, %H:%M:%S.%L', '%A, %b %e, %H:%M:%S.%L', '-%H:%M:%S.%L'],
second: ['%A, %b %e, %H:%M:%S', '%A, %b %e, %H:%M:%S', '-%H:%M:%S'],
minute: ['%A, %b %e, %H:%M', '%A, %b %e, %H:%M', '-%H:%M'],
hour: ['%A, %b %e, %H:%M', '%A, %b %e, %H:%M', '-%H:%M'],
day: ['%A, %b %e, %Y', '%A, %b %e', '-%A, %b %e, %Y'],
week: ['Week from %A, %b %e, %Y', '%A, %b %e', '-%A, %b %e, %Y'],
month: ['%B %Y', '%B', '-%B %Y'],
year: ['%Y', '%Y', '-%Y']
}
For each of these array definitions, the first item is the format used when the active time span is one unit. For instance, if the current data applies to one week, the first item of the week array is used. The second and third items are used when the active time span is more than two units. For instance, if the current data applies to two weeks, the second and third item of the week array are used, and applied to the start and end date of the time span.
public Boolean getEnabled()
setEnabled(Boolean)public void setEnabled(Boolean enabled)
Defaults to: true
public Boolean getForced()
setForced(Boolean)public void setForced(Boolean forced)
Defaults to: false
public Number getGroupPixelWidth()
setGroupPixelWidth(Number)public void setGroupPixelWidth(Number groupPixelWidth)
Defaults to: 2
public Boolean getSmoothed()
setSmoothed(Boolean)public void setSmoothed(Boolean smoothed)
Defaults to: false
public TimeUnitMultiples[] getUnits()
setUnits(TimeUnitMultiples...)public void setUnits(TimeUnitMultiples... units)
units: [[
'millisecond', // unit name
[1, 2, 5, 10, 20, 25, 50, 100, 200, 500] // allowed multiples
], [
'second',
[1, 2, 5, 10, 15, 30]
], [
'minute',
[1, 2, 5, 10, 15, 30]
], [
'hour',
[1, 2, 3, 4, 6, 8, 12]
], [
'day',
[1]
], [
'week',
[1]
], [
'month',
[1, 3, 6]
], [
'year',
null
]]
public void addUnit(TimeUnitMultiples unit)
unit - to addsetUnits(TimeUnitMultiples...)public void removeUnit(TimeUnitMultiples unit)
unit - to removesetUnits(TimeUnitMultiples...)Copyright © 2025. All rights reserved.