From b726f09a635ced002c62dde16a4bfae04f247db1 Mon Sep 17 00:00:00 2001 From: Anne-Siri <142512638+annesiri@users.noreply.github.com> Date: Thu, 13 Jun 2024 12:40:08 +0200 Subject: [PATCH] [MIM-1973] added custom responsive config to barNegativeConfig (#2796) added custom responsive config to barNegativeConfig --- .../lib/ssb/parts/highcharts/graph/config.ts | 4 +-- .../graph/graphBarNegativeConfig.ts | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/main/resources/lib/ssb/parts/highcharts/graph/config.ts b/src/main/resources/lib/ssb/parts/highcharts/graph/config.ts index 5d4632358..bbdfa91a5 100644 --- a/src/main/resources/lib/ssb/parts/highcharts/graph/config.ts +++ b/src/main/resources/lib/ssb/parts/highcharts/graph/config.ts @@ -315,7 +315,7 @@ export const createDefaultConfig = (highchartData, displayName, language) => ({ }, }, yAxis: [ - // overrides left y axis + // left y axis { labels: { align: 'right', @@ -329,7 +329,7 @@ export const createDefaultConfig = (highchartData, displayName, language) => ({ text: isEnabled('highcharts-y-axix-title-mobile', true, 'ssb') ? highchartData.yAxisTitle : '', }, }, - // overrides right y axis + // right y axis { labels: { align: 'left', diff --git a/src/main/resources/lib/ssb/parts/highcharts/graph/graphBarNegativeConfig.ts b/src/main/resources/lib/ssb/parts/highcharts/graph/graphBarNegativeConfig.ts index ea314a802..68835824f 100644 --- a/src/main/resources/lib/ssb/parts/highcharts/graph/graphBarNegativeConfig.ts +++ b/src/main/resources/lib/ssb/parts/highcharts/graph/graphBarNegativeConfig.ts @@ -45,6 +45,31 @@ export function barNegativeConfig(highchartContent, options) { description: options.xAxisLabel ? options.xAxisLabel : undefined, }, }, + responsive: { + rules: [ + { + chartOptions: { + chart: { + height: '120%', + }, + // NOTE: on negative bar chart, xAxis is vertical and yAxis is horizontal, don't ask why. + yAxis: { + labels: { + y: 20, + }, + }, + xAxis: { + labels: { + y: 7, + }, + }, + }, + condition: { + maxWidth: 450, + }, + }, + ], + }, } return mergeDeepRight(defaultConfig, customConfig) }