Highcharts Accessibility模块导致数据点标记启用状态异常问题咨询
Hey there, let's break down this issue you're facing and walk through how to fix it:
The Problem
When you include Highcharts' Accessibility module, setting marker.enabled at the data point level (like {x:1, y:1.61, marker: {enabled: false}}) works fine on initial load—but after triggering a redraw (such as toggling Series 1's visibility in the legend), all series except Series 1 end up with their marker enabled state forced to true. Remove the Accessibility module, and everything behaves as expected.
What's Causing This?
This looks like a bug in the Accessibility module: during redraw operations, it incorrectly overwrites the marker.enabled property for non-first series, resetting it to true regardless of your original data point or series-level settings.
Workarounds & Fixes
Here are a few practical ways to resolve this:
Set Marker Disabled at the Series Level
If you don't need any markers for an entire series (like your Series 2), setmarker.enabled: falsedirectly on the series instead of just individual data points. This higher-level setting takes precedence and resists the module's interference:series: [ { name: 'Series 1', data: [ {x: 1, y: 1.61, marker: {enabled: false}}, {x: 2, y: 2.34, marker: {enabled: true}}, // Add your remaining data points ] }, { name: 'Series 2', marker: {enabled: false}, // Global series-level setting data: [/* Your series 2 data */] } ]Reapply Marker Settings on Redraw
If you need per-data-point control over markers, add aredrawevent listener to reapply your original settings after the Accessibility module messes them up:chart: { events: { redraw: function() { // Skip the first series, fix marker states for all others this.series.slice(1).forEach(series => { series.points.forEach(point => { // Check the original data's marker setting and restore it if (point.options.marker?.enabled === false) { point.update({marker: {enabled: false}}, false); } }); }); // Redraw without animation to avoid infinite loops this.redraw(false); } } }Check for Module Version Updates
This might be a version-specific bug. Head to Highcharts' official issue tracker to see if this has been reported and fixed in a newer version. Updating the Accessibility module could resolve the issue entirely. If you recently updated and started seeing this problem, trying a slightly older version might also work.
Testing the Fix
In your two-series test scenario:
- Series 1 retains its per-data-point marker settings
- Series 2 uses the series-level
marker.enabled: false
After toggling Series 1's legend visibility, Series 2 stays marker-free as expected.
内容的提问来源于stack exchange,提问作者user32573723

