[英]How to get rid of Highcharts warning
I'm getting this really annoying warning in the webconsole when running my app.运行我的应用程序时,我在 web 控制台中收到了这个非常烦人的警告。
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:我正在运行 chartkick gem,像这样导入它:
import "chartkick/highcharts";
I can't seem to figure out how to rid myself of this warning.我似乎无法弄清楚如何摆脱这个警告。 Read Highchart and Chartkick documentation, but alas!阅读 Highchart 和 Chartkick 文档,但是,唉!
You need to set the accessibility option in Highcharts to false.您需要将 Highcharts 中的可访问性选项设置为 false。
Using Chartkick, you normally have to use that to pass the options to the underlying charting library.使用 Chartkick,您通常必须使用它来将选项传递给底层图表库。
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.因为我们使用 Chart.js,所以我还没有测试过这些,但这就是我们将参数传递给图表库的方式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.