From 4a5e3212ca8707a0e3e22c9fee09352ab82ee13d Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Tue, 10 Mar 2026 03:20:45 +0530 Subject: [PATCH] fix: bubble chart crash on window resize with named series in manual config When a manual config defines series with string keys (e.g. named series), override() permanently mutates chart.settings.series to a plain object. On resize, the numeric-index conversion incorrectly processed those string keys, producing a sparse array with length=0 that caused Google Charts to crash with "can't access property color, b is null". --- js/render-google.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/js/render-google.js b/js/render-google.js index 3cdcd475f..a81377417 100644 --- a/js/render-google.js +++ b/js/render-google.js @@ -31,12 +31,17 @@ var isResizeRequest = false; // remember, some charts do not support annotations so they should not be included in this. var no_annotation_charts = ['tabular', 'timeline', 'gauge', 'geo', 'bubble', 'candlestick']; if ( undefined !== chart.settings && undefined !== chart.settings.series && undefined === chart.settings.series.length ) { - var chartSeries = []; - var chartSeriesValue = Object.values( chart.settings.series ); - $.each( Object.keys( chart.settings.series ), function( index, element ) { - chartSeries[element] = chartSeriesValue[index]; - } ); - chart.settings.series = chartSeries; + var seriesKeys = Object.keys( chart.settings.series ); + // Only convert when keys are numeric indices (PHP JSON-encoded array). + // String keys (e.g. named series from manual config) must be left as-is. + if ( seriesKeys.every( function( k ) { return ! isNaN( k ); } ) ) { + var chartSeries = []; + var chartSeriesValue = Object.values( chart.settings.series ); + $.each( seriesKeys, function( index, element ) { + chartSeries[ element ] = chartSeriesValue[ index ]; + } ); + chart.settings.series = chartSeries; + } } if(id !== 'canvas' && typeof chart.series !== 'undefined' && typeof chart.settings.series !== 'undefined' && ! no_annotation_charts.includes(chart.type) ) { hasAnnotation = chart.series.length - chart.settings.series.length > 1;