简体   繁体   中英

How to get rid of Highcharts warning

I'm getting this really annoying warning in the webconsole when running my app.

Highcharts warning: Consider including the "accessibility.js" module to make your chart more usable for people with disabilities. Set the "accessibility.enabled" option to false to remove this warning. See https://www.highcharts.com/docs/accessibility/accessibility-module.

I'm running the chartkick gem, importing it like this:

import "chartkick/highcharts";

I can't seem to figure out how to rid myself of this warning. Read Highchart and Chartkick documentation, but alas!

You need to set the accessibility option in Highcharts to false.

Using Chartkick, you normally have to use that to pass the options to the underlying charting library.

You will need to do something like:

# You can pass options directly to the charting library with:

<%= line_chart data, library: {accessibility: {enabled: false}} %>

Or after load, but this would suppress the warning on the page load.

var chart = Chartkick.charts["chart-id"]

const newOptions = {accessibility: {enabled: false}
chart.setOptions(newOptions)

I haven't tested either of these as we use Chart.js but this is how we pass params to the charting library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM