Skip to content

Commit fc3ed6b

Browse files
committed
simpler chart options merginng
1 parent 74ea049 commit fc3ed6b

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/core/chart-core.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ export function InternalCoreChart({
120120
const highchartsOptions: Highcharts.Options = {
121121
...options,
122122
// Hide credits by default.
123-
credits: { enabled: false, ...options.credits },
123+
credits: options.credits ?? { enabled: false },
124124
// Hide chart title by default.
125-
title: { text: "", ...options.title },
125+
title: options.title ?? { text: "" },
126126
// Use Cloudscape color palette by default.
127127
// This cannot be reset to Highcharts' default from the outside, but it is possible to provide custom palette.
128128
colors: options.colors ?? Styles.colors,
@@ -143,7 +143,6 @@ export function InternalCoreChart({
143143
// if the Highcharts debugger module is loaded.
144144
displayErrors: options.chart?.displayErrors ?? isDevelopment,
145145
style: { ...Styles.chartPlotCss, ...options.chart?.style },
146-
backgroundColor: options.chart?.backgroundColor ?? Styles.chartPlotBackgroundColor,
147146
// We override certain chart events to inject additional behaviors, but it is still possible to define
148147
// custom callbacks. The Cloudscape behaviors can be disabled or altered via components API. For instance,
149148
// if no-data props are not provided - the related on-render computations will be skipped.
@@ -165,7 +164,7 @@ export function InternalCoreChart({
165164
},
166165
series: options.series,
167166
// Highcharts legend is disabled by default in favour of the custom Cloudscape legend.
168-
legend: { enabled: false, ...options.legend },
167+
legend: options.legend ?? { enabled: false },
169168
lang: {
170169
...options.lang,
171170
// The default chart title is disabled by default to prevent the default "Chart" in the screen-reader detail.
@@ -175,7 +174,7 @@ export function InternalCoreChart({
175174
description: ariaDescription,
176175
...options.accessibility,
177176
// Highcharts keyboard navigation is disabled by default in favour of the custom Cloudscape navigation.
178-
keyboardNavigation: { enabled: !keyboardNavigation, ...options.accessibility?.keyboardNavigation },
177+
keyboardNavigation: options.accessibility?.keyboardNavigation ?? { enabled: !keyboardNavigation },
179178
point: {
180179
// Point description formatter is overridden to respect custom axes value formatters.
181180
descriptionFormatter: getFormattedPointDescription,

src/core/styles.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const colors = [
4242

4343
export const chart: Highcharts.ChartOptions = {
4444
spacing: [10, 10, 0, 0],
45+
backgroundColor: "transparent",
4546
};
4647

4748
export const axisTitleCss: Highcharts.CSSObject = {
@@ -77,8 +78,6 @@ export const chartPlotCss: Highcharts.CSSObject = {
7778
fontSize: fontSizeBodyM,
7879
};
7980

80-
export const chartPlotBackgroundColor = "transparent";
81-
8281
export const seriesBorderColor = colorBackgroundContainerContent;
8382

8483
export const hiddenSeriesMarker = { enabled: false, radius: 3, symbol: "circle" };

0 commit comments

Comments
 (0)