@@ -533,3 +533,77 @@ describe('legend visibility', () => {
533533 ] ) ;
534534 } ) ;
535535} ) ;
536+
537+ it ( 'handles axes min and max properly' , ( ) => {
538+ const xaxis = chartTestUtils . makeAxis ( {
539+ label : 'x1' ,
540+ type : dh . plot . AxisType . X ,
541+ position : dh . plot . AxisPosition . BOTTOM ,
542+ minRange : 0 ,
543+ maxRange : 100 ,
544+ } ) ;
545+
546+ const xaxis2 = chartTestUtils . makeAxis ( {
547+ label : 'x1' ,
548+ type : dh . plot . AxisType . X ,
549+ position : dh . plot . AxisPosition . BOTTOM ,
550+ log : true ,
551+ minRange : 100 ,
552+ maxRange : 1000 ,
553+ } ) ;
554+
555+ const yaxis1 = chartTestUtils . makeAxis ( {
556+ label : 'y1' ,
557+ type : dh . plot . AxisType . Y ,
558+ position : dh . plot . AxisPosition . LEFT ,
559+ maxRange : 200 ,
560+ } ) ;
561+
562+ const yaxis2 = chartTestUtils . makeAxis ( {
563+ label : 'y2' ,
564+ type : dh . plot . AxisType . Y ,
565+ position : dh . plot . AxisPosition . RIGHT ,
566+ minRange : - 10 ,
567+ } ) ;
568+
569+ const axes = [ xaxis , xaxis2 , yaxis1 , yaxis2 ] ;
570+
571+ const chart = chartTestUtils . makeChart ( { axes } ) ;
572+ const figure = chartTestUtils . makeFigure ( { charts : [ chart ] } ) ;
573+ const model = new FigureChartModel ( dh , figure ) ;
574+
575+ const layout = model . getLayout ( ) ;
576+
577+ expect ( ( layout . xaxis as any ) . autorangeoptions . minallowed ) . toEqual (
578+ 0
579+ ) ;
580+
581+ expect ( ( layout . xaxis as any ) . autorangeoptions . maxallowed ) . toEqual (
582+ 100
583+ ) ;
584+
585+ expect ( ( layout . xaxis2 as any ) . autorangeoptions . minallowed ) . toEqual (
586+ 2
587+ ) ;
588+
589+ expect ( ( layout . xaxis2 as any ) . autorangeoptions . maxallowed ) . toEqual (
590+ 3
591+ ) ;
592+
593+ expect ( ( layout . yaxis as any ) . autorangeoptions . minallowed ) . toEqual (
594+ undefined
595+ ) ;
596+
597+ expect ( ( layout . yaxis as any ) . autorangeoptions . maxallowed ) . toEqual (
598+ 200
599+ ) ;
600+
601+ expect ( ( layout . yaxis2 as any ) . autorangeoptions . minallowed ) . toEqual (
602+ - 10
603+ ) ;
604+
605+ expect ( ( layout . yaxis2 as any ) . autorangeoptions . maxallowed ) . toEqual (
606+ undefined
607+ ) ;
608+
609+ } ) ;
0 commit comments