简体   繁体   English

如何摆脱 Highcharts 警告

[英]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.

相关问题 如何摆脱这个警告:“警告:validateDOMNesting(...)”? - How to get rid of the this warning: "Warning: validateDOMNesting(...)"? 如何摆脱 angular 中的 highcharts 13 错误? - How to get rid of highcharts 13 error in angular? 如何摆脱这个 Facebook 像素警告? - How to get rid of this Facebook Pixel Warning? 如何摆脱有关缺少依赖项的警告 - How to get rid of warning about missing dependency 如何在Ionic / Cordova Emulator中摆脱Facebook警告? - How to get rid of Facebook warning in Ionic/Cordova Emulator? 如何在 React 应用程序中摆脱“函数作为 React 子项无效”警告 - How to get rid of "Functions are not valid as a React child" warning in React app 如何在IE中呈现MathJax时摆脱警告 - How to get rid of the warning while rendering MathJax in IE 如何摆脱警告“类型……不可分配给类型”打字稿 - How to get rid of warning 'Type … is not assignable to type' typescript 我的控制台中的此警告是什么以及如何摆脱此消息? - What is this warning in my console & how to get rid of this message? 如何摆脱控制台警告:不推荐使用 expo-app-loading 以支持 expo-splash-screen? - How to I get rid of Console Warning: expo-app-loading is deprecated in favour of expo-splash-screen?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM