Highcharts的可访问性模块会影响数据点标记的启用与否
当包含无障碍模块时。如果你在数据点层级将markers启用设置为true,例如:
{x:1, y:1.61, marker: {enabled: false}}
那么,该值将对除系列1之外的所有系列存储为true。初始显示会正确,但更新后就会变成错误。
我做了一个JSFiddle示例。这个示例包含两条系列。第一条系列有一些数据点启用了标记,第二条系列的markers.enabled设置为false。
在图例中加载并切换系列1,以强制重新绘制。现在第二条系列将显示数据点标记。
如果移除无障碍模块,则会正常工作
解决方案
This behavior is likely caused by the Highcharts accessibility module overriding or modifying certain series options to improve usability for assistive technologies.
When the accessibility module is enabled, Highcharts may adjust visual elements like markers to ensure better visibility or interaction (for example, for keyboard navigation or screen readers). As a result, your marker.enabled setting may not behave exactly as expected.
A few things you can try:
- Explicitly set marker options inside the series:
series: [{
marker: {
enabled: true,
states: {
hover: {
enabled: true
}
}
}
}]
- Check if accessibility options are affecting interaction:
accessibility: {
enabled: true
}
Try temporarily disabling it to confirm the cause:
accessibility: {
enabled: false
}
- If the issue disappears when accessibility is disabled, then the module is indeed modifying the behavior. In that case, you may need to customize accessibility settings instead of relying on default behavior。
In general, the accessibility module can override default visuals to ensure better interaction, so some manual configuration may be required to keep your desired appearance。