@@ -119,26 +119,37 @@ export function InternalCoreChart({
119119
120120 const apiOptions = api . getOptions ( ) ;
121121 const inverted = ! ! options . chart ?. inverted ;
122- const isRtl = ( ) => getIsRtl ( rootRef ?. current ) ;
122+ const isRtl = getIsRtl ( rootRef ?. current ) ;
123123
124124 // Compute RTL-adjusted options that will be used for both legend positioning and chart rendering
125- const rtlAdjustedOptions : CoreChartProps . ChartOptions = {
125+ const rtlAdjustedOptions : Highcharts . Options = {
126126 ...options ,
127127 xAxis : castArray ( options . xAxis ) ?. map ( ( xAxisOptions ) => ( {
128+ ...Styles . xAxisOptions ,
128129 ...xAxisOptions ,
129130 // Depending on the chart.inverted the x-axis can be rendered as vertical, and needs to respect page direction.
130- reversed : ! inverted && isRtl ( ) ? ! xAxisOptions . reversed : xAxisOptions . reversed ,
131- opposite : inverted && isRtl ( ) ? ! xAxisOptions . opposite : xAxisOptions . opposite ,
131+ reversed : ! inverted && isRtl ? ! xAxisOptions . reversed : xAxisOptions . reversed ,
132+ opposite : inverted && isRtl ? ! xAxisOptions . opposite : xAxisOptions . opposite ,
133+ className : xAxisClassName ( inverted , xAxisOptions . className ) ,
134+ title : axisTitle ( xAxisOptions . title ?? { } , ! inverted || verticalAxisTitlePlacement === "side" ) ,
135+ labels : axisLabels ( xAxisOptions . labels ?? { } ) ,
132136 } ) ) ,
133137 yAxis : castArray ( options . yAxis ) ?. map ( ( yAxisOptions ) => ( {
138+ ...Styles . yAxisOptions ,
134139 ...yAxisOptions ,
135140 // Depending on the chart.inverted the y-axis can be rendered as vertical, and needs to respect page direction.
136- reversed : inverted && isRtl ( ) ? ! yAxisOptions . reversed : yAxisOptions . reversed ,
137- opposite : ! inverted && isRtl ( ) ? ! yAxisOptions . opposite : yAxisOptions . opposite ,
141+ reversed : inverted && isRtl ? ! yAxisOptions . reversed : yAxisOptions . reversed ,
142+ opposite : ! inverted && isRtl ? ! yAxisOptions . opposite : yAxisOptions . opposite ,
143+ className : yAxisClassName ( inverted , yAxisOptions . className ) ,
144+ title : axisTitle ( yAxisOptions . title ?? { } , inverted || verticalAxisTitlePlacement === "side" ) ,
145+ labels : axisLabels ( yAxisOptions . labels ?? { } ) ,
146+ plotLines : yAxisPlotLines ( yAxisOptions . plotLines , emphasizeBaseline ) ,
147+ // We use reversed stack by default so that the order of points in the tooltip and series in the legend
148+ // correspond the order of stacks.
149+ reversedStacks : yAxisOptions . reversedStacks ?? true ,
138150 } ) ) ,
139151 } ;
140152
141- // Get legend props using RTL-adjusted options so that legend positioning respects axis flipping
142153 const legendProps = getLegendsProps ( rtlAdjustedOptions , legendOptions ) ;
143154
144155 return (
@@ -285,24 +296,8 @@ export function InternalCoreChart({
285296 dataLabels : { ...Styles . pieSeriesDataLabels , ...options . plotOptions ?. pie ?. dataLabels } ,
286297 } ,
287298 } ,
288- xAxis : castArray ( rtlAdjustedOptions . xAxis ) ?. map ( ( xAxisOptions ) => ( {
289- ...Styles . xAxisOptions ,
290- ...xAxisOptions ,
291- className : xAxisClassName ( inverted , xAxisOptions . className ) ,
292- title : axisTitle ( xAxisOptions . title ?? { } , ! inverted || verticalAxisTitlePlacement === "side" ) ,
293- labels : axisLabels ( xAxisOptions . labels ?? { } ) ,
294- } ) ) ,
295- yAxis : castArray ( rtlAdjustedOptions . yAxis ) ?. map ( ( yAxisOptions ) => ( {
296- ...Styles . yAxisOptions ,
297- ...yAxisOptions ,
298- className : yAxisClassName ( inverted , yAxisOptions . className ) ,
299- title : axisTitle ( yAxisOptions . title ?? { } , inverted || verticalAxisTitlePlacement === "side" ) ,
300- labels : axisLabels ( yAxisOptions . labels ?? { } ) ,
301- plotLines : yAxisPlotLines ( yAxisOptions . plotLines , emphasizeBaseline ) ,
302- // We use reversed stack by default so that the order of points in the tooltip and series in the legend
303- // correspond the order of stacks.
304- reversedStacks : yAxisOptions . reversedStacks ?? true ,
305- } ) ) ,
299+ xAxis : rtlAdjustedOptions . xAxis ,
300+ yAxis : rtlAdjustedOptions . yAxis ,
306301 // We don't use Highcharts tooltip, but certain tooltip options such as tooltip.snap or tooltip.shared
307302 // affect the hovering behavior of Highcharts. That is only the case when the tooltip is not disabled,
308303 // so we render it, but hide with styles.
0 commit comments