Class 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
    • Constructor Detail

      • Accessibility

        public Accessibility()
    • 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 or caption 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 or caption 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.

      • 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.
      • 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.