From b45246871f3f028fcee91dea76ab56aad1ddd6bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B0=D0=B5=D0=B2=20=D0=95=D0=B2=D0=B3=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9?= Date: Tue, 14 Mar 2023 19:40:47 +0300 Subject: [PATCH] fix(Highcharts): fix resetZoomButton styles --- .../highcharts/renderer/helpers/config/config.js | 14 ++++++++++++++ .../renderer/helpers/highcharts/highcharts.js | 8 ++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/plugins/highcharts/renderer/helpers/config/config.js b/src/plugins/highcharts/renderer/helpers/config/config.js index 773246d7..f20fa879 100644 --- a/src/plugins/highcharts/renderer/helpers/config/config.js +++ b/src/plugins/highcharts/renderer/helpers/config/config.js @@ -1753,6 +1753,20 @@ export function prepareConfig(data, options, isMobile, holidays) { return Highcharts.Axis.prototype.defaultLabelFormatter.call(this); }, }, + events: { + setExtremes: function () { + // There is no better way to align zoom button text + // Callback setExtremes used because of it obligatory invocation on every zoom event + // setTimeout used because of absence resetZoomButton node in dom on first zoom event + setTimeout(() => { + const text = this.chart.resetZoomButton?.text; + + if (text) { + text.translate(0, -6); + } + }, 0); + }, + }, }, yAxis: { crosshair: options.splitTooltip diff --git a/src/plugins/highcharts/renderer/helpers/highcharts/highcharts.js b/src/plugins/highcharts/renderer/helpers/highcharts/highcharts.js index e9aff3da..4c40ee2c 100644 --- a/src/plugins/highcharts/renderer/helpers/highcharts/highcharts.js +++ b/src/plugins/highcharts/renderer/helpers/highcharts/highcharts.js @@ -48,11 +48,15 @@ Highcharts.setOptions({ resetZoomButton: { relativeTo: 'chart', theme: { - width: 16, - height: 16, + r: 6, + width: 12, + height: 12, 'text-align': 'center', opacity: '0.8', cursor: 'pointer', + style: { + fontSize: '20px', + }, }, position: { y: 30,