Class Accessibility
- java.lang.Object
-
- org.zkoss.chart.Optionable
-
- org.zkoss.chart.Accessibility
-
- All Implemented Interfaces:
Serializable
,OptionDataListener
,org.zkoss.json.JSONAware
public class Accessibility extends Optionable
An options for configuring accessibility for the chart. Requires the accessibility module to be loaded. For example,Library.setProperty("org.zkoss.chart.modules.accessibility", "true");
- Since:
- 10.2.1.0
- Author:
- jumperchen
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.zkoss.chart.Optionable
NOT_NULL_VALUE, options
-
-
Constructor Summary
Constructors Constructor Description Accessibility()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnnounceNewData
getAnnounceNewData()
Returns an options for announcing new data to screen reader user, or create a new one.org.zkoss.json.JavaScriptValue
getCustomComponents()
Returns a hook for adding custom components to the accessibility module.String
getDescription()
Returns a text description of the chart.Map
getHighContrastTheme()
Returns the theme to apply to the chart when Windows High Contrast Mode is detected.KeyboardNavigation
getKeyboardNavigation()
Returns an options for keyboard navigation, or create a new one.String
getLandmarkVerbosity()
Returns the amount of landmarks/regions to create for screen reader users.String
getLinkedDescription()
Returns the linking of the chart to an HTML element describing the contents of the chart.AccessibilityPoint
getPoint()
Returns options for descriptions of individual data points, or create a new one.ScreenReaderSection
getScreenReaderSection()
Returns accessibility options for the screen reader information sections added before and after the chart, or create a new one.AccessibilitySeries
getSeries()
Returns accessibility options global to all data series.String
getTypeDescription()
Returns a text description of the chart type.boolean
isEnabled()
Returns whether to enable accessibility functionality for the chart.void
setAnnounceNewData(AnnounceNewData announceNewData)
Sets an options for announcing new data to screen reader user.void
setCustomComponents(org.zkoss.json.JavaScriptValue customComponents)
Sets a hook for adding custom components to the accessibility module.void
setDescription(String description)
Sets a text description of the chart.void
setEnabled(boolean enabled)
Sets whether to enable accessibility functionality for the chart.void
setHighContrastTheme(Map highContrastTheme)
Sets the theme to apply to the chart when Windows High Contrast Mode is detected.void
setKeyboardNavigation(KeyboardNavigation keyboardNavigation)
Sets an options for keyboard navigation, or create a new one.void
setLandmarkVerbosity(String landmarkVerbosity)
Sets the amount of landmarks/regions to create for screen reader users.void
setLinkedDescription(String linkedDescription)
Link the chart to an HTML element describing the contents of the chart.void
setPoint(AccessibilityPoint point)
Sets options for descriptions of individual data points.void
setScreenReaderSection(ScreenReaderSection screenReaderSection)
Sets accessibility options for the screen reader information sections added before and after the chart.void
setSeries(AccessibilitySeries series)
Sets accessibility options global to all data series.void
setTypeDescription(String typeDescription)
Sets a text description of the chart type.-
Methods inherited from class org.zkoss.chart.Optionable
addExtraAttr, addOptionDataListener, clearOptonDataListener, clone, containsKey, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, getAttr, getAttr, getClientState, getExtraAttr, merge, onChange, removeExtraAttr, removeKey, removeOptionDataListener, setAttr, setAttr, setAttr, setAttr, toJSONString, toString
-
-
-
-
Method Detail
-
getAnnounceNewData
public AnnounceNewData getAnnounceNewData()
Returns an options for announcing new data to screen reader user, or create a new one.Default: an instance of
AnnounceNewData
-
setAnnounceNewData
public void setAnnounceNewData(AnnounceNewData announceNewData)
Sets an options for announcing new data to screen reader user.
-
getCustomComponents
public org.zkoss.json.JavaScriptValue getCustomComponents()
Returns a hook for adding custom components to the accessibility module. Should be an object mapping component names to instances of classes inheriting from the Highcharts.AccessibilityComponent base class. Remember to add the component to the keyboardNavigation.order for the keyboard navigation to be usable.Default:
null
-
setCustomComponents
public void setCustomComponents(org.zkoss.json.JavaScriptValue customComponents)
Sets a hook for adding custom components to the accessibility module. Should be an object mapping component names to instances of classes inheriting from the Highcharts.AccessibilityComponent base class. Remember to add the component to the keyboardNavigation.order for the keyboard navigation to be usable.Default:
null
-
getDescription
public String getDescription()
Returns a text description of the chart.Note: Prefer using
linkedDescription
orcaption
instead.If the Accessibility module is loaded, this option is included by default as a long description of the chart in the hidden screen reader information region.
Note: Since Highcharts now supports captions and linked descriptions, it is preferred to define the description using those methods, as a visible
caption/description
benefits all users. If the accessibility.description option is defined, the linked description is ignored, and the caption is hidden from screen reader users.Default:
null
-
setDescription
public void setDescription(String description)
Sets a text description of the chart.Note: Prefer using
linkedDescription
orcaption
instead.If the Accessibility module is loaded, this option is included by default as a long description of the chart in the hidden screen reader information region.
Note: Since Highcharts now supports captions and linked descriptions, it is preferred to define the description using those methods, as a visible
caption/description
benefits all users. If the accessibility.description option is defined, the linked description is ignored, and the caption is hidden from screen reader users.Default:
null
-
isEnabled
public boolean isEnabled()
Returns whether to enable accessibility functionality for the chart. For more information on how to include these features, and why this is recommended, see Highcharts Accessibility.Highcharts will by default emit a warning to the console if the accessibility module is not loaded. Setting this option to false will override and silence the warning.
Once the module is loaded, setting this option to false will disable the module for this chart.
Default:
true
-
setEnabled
public void setEnabled(boolean enabled)
Sets whether to enable accessibility functionality for the chart. For more information on how to include these features, and why this is recommended, see Highcharts Accessibility.Highcharts will by default emit a warning to the console if the accessibility module is not loaded. Setting this option to false will override and silence the warning.
Once the module is loaded, setting this option to false will disable the module for this chart.
-
getHighContrastTheme
public Map getHighContrastTheme()
Returns the theme to apply to the chart when Windows High Contrast Mode is detected. By default, a high contrast theme matching the high contrast system system colors is used.Default:
null
-
setHighContrastTheme
public void setHighContrastTheme(Map highContrastTheme)
Sets the theme to apply to the chart when Windows High Contrast Mode is detected. By default, a high contrast theme matching the high contrast system system colors is used.Default:
null
-
getKeyboardNavigation
public KeyboardNavigation getKeyboardNavigation()
Returns an options for keyboard navigation, or create a new one.Default: an instance of
KeyboardNavigation
-
setKeyboardNavigation
public void setKeyboardNavigation(KeyboardNavigation keyboardNavigation)
Sets an options for keyboard navigation, or create a new one.
-
getLandmarkVerbosity
public String getLandmarkVerbosity()
Returns the amount of landmarks/regions to create for screen reader users. More landmarks can make navigation with screen readers easier, but can be distracting if there are lots of charts on the page.Three modes are available:
-
"all"
: Adds regions for all series, legend, information region. -
"one"
: Adds a single landmark per chart. -
"disabled"
: No landmarks are added.
Default: {@code "all").
-
-
setLandmarkVerbosity
public void setLandmarkVerbosity(String landmarkVerbosity)
Sets the amount of landmarks/regions to create for screen reader users. More landmarks can make navigation with screen readers easier, but can be distracting if there are lots of charts on the page.Three modes are available:
-
"all"
: Adds regions for all series, legend, information region. -
"one"
: Adds a single landmark per chart. -
"disabled"
: No landmarks are added.
Default: {@code "all").
-
-
getLinkedDescription
public String getLinkedDescription()
Returns the linking of the chart to an HTML element describing the contents of the chart.
-
setLinkedDescription
public void setLinkedDescription(String linkedDescription)
Link the chart to an HTML element describing the contents of the chart.It is always recommended to describe charts using visible text, to improve SEO as well as accessibility for users with disabilities. This option lets an HTML element with a description be linked to the chart, so that screen reader users can connect the two.
By setting this option to a string, Highcharts runs the string as an HTML selector query on the entire document. If there is only a single match, this element is linked to the chart. The content of the linked element will be included in the chart description for screen reader users.
By default, the chart looks for an adjacent sibling element with the highcharts-description class.
The feature can be disabled by setting the option to an empty string, or overridden by providing the
accessibility.description
option. Alternatively, the HTML element to link can be passed in directly as an HTML node.If you need the description to be part of the exported image, consider using the caption feature.
If you need the description to be hidden visually, use the
accessibility.description
option.Defaults to
*[data-highcharts-chart="{index}"] + .highcharts-description.
-
getPoint
public AccessibilityPoint getPoint()
Returns options for descriptions of individual data points, or create a new one.Default: an instance of
AccessibilityPoint
-
setPoint
public void setPoint(AccessibilityPoint point)
Sets options for descriptions of individual data points.
-
getScreenReaderSection
public ScreenReaderSection getScreenReaderSection()
Returns accessibility options for the screen reader information sections added before and after the chart, or create a new one.Default: an instance of
ScreenReaderSection
-
setScreenReaderSection
public void setScreenReaderSection(ScreenReaderSection screenReaderSection)
Sets accessibility options for the screen reader information sections added before and after the chart.
-
getSeries
public AccessibilitySeries getSeries()
Returns accessibility options global to all data series. Individual series can also have specificSeriesPlotOptions.getAccessibility()
set. If null, create a new one.Default: an instance of
AccessibilitySeries
-
setSeries
public void setSeries(AccessibilitySeries series)
Sets accessibility options global to all data series. Individual series can also have specificSeriesPlotOptions.getAccessibility()
set.
-
getTypeDescription
public String getTypeDescription()
Returns a text description of the chart type.Default:
null
-
setTypeDescription
public void setTypeDescription(String typeDescription)
Sets 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.
-
-