@@ -942,6 +942,64 @@ describe('Chart State utils', () => {
942942 expect ( geometries . geometriesCounts . lines ) . toBe ( 0 ) ;
943943 expect ( geometries . geometriesCounts . areas ) . toBe ( 0 ) ;
944944 } ) ;
945+ test ( 'can compute the bar offset in mixed charts' , ( ) => {
946+ const line1 : LineSeriesSpec = {
947+ id : getSpecId ( 'line1' ) ,
948+ groupId : getGroupId ( 'group2' ) ,
949+ seriesType : 'line' ,
950+ yScaleType : ScaleType . Log ,
951+ xScaleType : ScaleType . Linear ,
952+ xAccessor : 'x' ,
953+ yAccessors : [ 'y' ] ,
954+ splitSeriesAccessors : [ 'g' ] ,
955+ yScaleToDataExtent : false ,
956+ data : BARCHART_1Y1G ,
957+ } ;
958+
959+ const bar1 : BarSeriesSpec = {
960+ id : getSpecId ( 'line3' ) ,
961+ groupId : getGroupId ( 'group2' ) ,
962+ seriesType : 'bar' ,
963+ yScaleType : ScaleType . Log ,
964+ xScaleType : ScaleType . Linear ,
965+ xAccessor : 'x' ,
966+ yAccessors : [ 'y' ] ,
967+ splitSeriesAccessors : [ 'g' ] ,
968+ yScaleToDataExtent : false ,
969+ data : BARCHART_1Y1G ,
970+ } ;
971+ const seriesSpecs = new Map < SpecId , BasicSeriesSpec > ( [ [ line1 . id , line1 ] , [ bar1 . id , bar1 ] ] ) ;
972+ const axesSpecs = new Map < AxisId , AxisSpec > ( ) ;
973+ const chartRotation = 0 ;
974+ const chartDimensions = { width : 100 , height : 100 , top : 0 , left : 0 } ;
975+ const chartColors = {
976+ vizColors : [ 'violet' , 'green' , 'blue' ] ,
977+ defaultVizColor : 'red' ,
978+ } ;
979+ const chartTheme = {
980+ ...LIGHT_THEME ,
981+ scales : {
982+ barsPadding : 0 ,
983+ histogramPadding : 0 ,
984+ } ,
985+ } ;
986+ const domainsByGroupId = mergeYCustomDomainsByGroupId ( axesSpecs , chartRotation ) ;
987+ const seriesDomains = computeSeriesDomains ( seriesSpecs , domainsByGroupId ) ;
988+ const seriesColorMap = getSeriesColorMap ( seriesDomains . seriesColors , chartColors , new Map ( ) ) ;
989+ const geometries = computeSeriesGeometries (
990+ seriesSpecs ,
991+ seriesDomains . xDomain ,
992+ seriesDomains . yDomain ,
993+ seriesDomains . formattedDataSeries ,
994+ seriesColorMap ,
995+ chartTheme ,
996+ chartDimensions ,
997+ chartRotation ,
998+ axesSpecs ,
999+ false ,
1000+ ) ;
1001+ expect ( geometries . geometries . bars [ 0 ] . x ) . toBe ( 0 ) ;
1002+ } ) ;
9451003 } ) ;
9461004 test ( 'can merge geometry indexes' , ( ) => {
9471005 const map1 = new Map < string , IndexedGeometry [ ] > ( ) ;
0 commit comments