/* * * * (c) 2010-2020 Torstein Honsi * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ 'use strict'; import H from '../parts/Globals.js'; import U from '../parts/Utilities.js'; var addEvent = U.addEvent, isNumber = U.isNumber; var setOptions = H.setOptions; setOptions({ /** * @optionparent chart */ chart: { /** * Whether to display errors on the chart. When `false`, the errors will * be shown only in the console. * * @sample highcharts/chart/display-errors/ * Show errors on chart * * @since 7.0.0 * @requires modules/debugger */ displayErrors: true } }); /* eslint-disable no-invalid-this */ addEvent(H.Chart, 'displayError', function (e) { var chart = this, code = e.code, msg, options = chart.options.chart, renderer = chart.renderer, chartWidth, chartHeight; if (chart.errorElements) { (chart.errorElements).forEach(function (el) { if (el) { el.destroy(); } }); } if (options && options.displayErrors && renderer) { chart.errorElements = []; msg = isNumber(code) ? ('Highcharts error #' + code + ': ' + H.errorMessages[code].text) : code; chartWidth = chart.chartWidth; chartHeight = chart.chartHeight; // Format msg so SVGRenderer can handle it msg = msg .replace(/