Skip to content

Commit 69b20fd

Browse files
committed
doc(chart-core): explain why passing rtl-adjusted axes is needed
1 parent fbe5c04 commit 69b20fd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/chart-core.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,12 @@ export function InternalCoreChart({
160160
// The Highcharts options takes all provided Highcharts options and custom properties and merges them together, so that
161161
// the Cloudscape features and custom Highcharts extensions co-exist.
162162
// For certain options we provide Cloudscape styling, but in all cases this can be explicitly overridden.
163+
// We use the rtl adjusted axes (instead of the original options.xAxis/yAxis) to ensure the chart renders
164+
// with the correct axis orientation for RTL layouts, matching what was used for legend positioning above.
163165
const highchartsOptions: Highcharts.Options = {
164166
...options,
167+
xAxis: rtlAdjustedOptions.xAxis,
168+
yAxis: rtlAdjustedOptions.yAxis,
165169
// Hide credits by default.
166170
credits: options.credits ?? { enabled: false },
167171
// Hide chart title by default.
@@ -296,8 +300,6 @@ export function InternalCoreChart({
296300
dataLabels: { ...Styles.pieSeriesDataLabels, ...options.plotOptions?.pie?.dataLabels },
297301
},
298302
},
299-
xAxis: rtlAdjustedOptions.xAxis,
300-
yAxis: rtlAdjustedOptions.yAxis,
301303
// We don't use Highcharts tooltip, but certain tooltip options such as tooltip.snap or tooltip.shared
302304
// affect the hovering behavior of Highcharts. That is only the case when the tooltip is not disabled,
303305
// so we render it, but hide with styles.

0 commit comments

Comments
 (0)