@@ -31,14 +31,7 @@ import { X_SCALE_DEFAULT, Y_SCALE_DEFAULT } from '../../scales/scale_defaults';
3131import { APIScale } from '../../scales/types' ;
3232import { isHorizontalAxis , isVerticalAxis } from '../../utils/axis_type_utils' ;
3333import { groupBy } from '../../utils/group_data_series' ;
34- import {
35- AxisSpec ,
36- BasicSeriesSpec ,
37- CustomXDomain ,
38- DEFAULT_GLOBAL_ID ,
39- XScaleType ,
40- YDomainRange ,
41- } from '../../utils/specs' ;
34+ import { AxisSpec , BasicSeriesSpec , CustomXDomain , XScaleType , YDomainRange } from '../../utils/specs' ;
4235import { isHorizontalRotation } from '../utils/common' ;
4336import { getAxisSpecsSelector , getSeriesSpecsSelector } from './get_specs' ;
4437import { mergeYCustomDomainsByGroupId } from './merge_y_custom_domains' ;
@@ -99,27 +92,20 @@ export function getAPIScaleConfigs(
9992 const customDomainByGroupId = mergeYCustomDomainsByGroupId ( axisSpecs , settingsSpec . rotation ) ;
10093
10194 const yAxes = axisSpecs . filter ( ( d ) => isHorizontalChart === isVerticalAxis ( d . position ) ) ;
102- const y = Object . keys ( scaleTypeByGroupId ) . reduce < APIScaleConfigs [ 'y' ] > (
103- ( acc , groupId ) => {
104- const axis = yAxes . find ( ( yAxis ) => yAxis . groupId === groupId ) ;
105- const ticks = axis ?. ticks ?? Y_SCALE_DEFAULT . ticks ;
106- const apiScale = scaleTypeByGroupId [ groupId ] ;
107- const customDomain = customDomainByGroupId . get ( groupId ) ;
108- if ( ! acc [ groupId ] ) {
109- acc [ groupId ] = {
110- customDomain,
111- ...apiScale ,
112- ticks,
113- } ;
114- }
115- acc [ groupId ] . ticks = Math . min ( acc [ groupId ] . ticks , ticks ) ;
116- acc [ groupId ] . customDomain = customDomain ;
117- return acc ;
118- } ,
119- {
120- [ DEFAULT_GLOBAL_ID ] : Y_SCALE_DEFAULT ,
121- } ,
122- ) ;
123-
95+ const y = Object . keys ( scaleTypeByGroupId ) . reduce < APIScaleConfigs [ 'y' ] > ( ( acc , groupId ) => {
96+ const axis = yAxes . find ( ( yAxis ) => yAxis . groupId === groupId ) ;
97+ const ticks = axis ?. ticks ?? Y_SCALE_DEFAULT . ticks ;
98+ const apiScale = scaleTypeByGroupId [ groupId ] ;
99+ const customDomain = customDomainByGroupId . get ( groupId ) ;
100+ if ( ! acc [ groupId ] ) {
101+ acc [ groupId ] = {
102+ customDomain,
103+ ...apiScale ,
104+ ticks,
105+ } ;
106+ }
107+ acc [ groupId ] . ticks = Math . min ( acc [ groupId ] . ticks , ticks ) ;
108+ return acc ;
109+ } , { } ) ;
124110 return { x, y } ;
125111}
0 commit comments