@@ -307,6 +307,18 @@ function renderXAxis(
307307
308308 let datasets = renderInfo . datasets ;
309309 let xDomain = d3 . extent ( datasets . getDates ( ) ) ;
310+ if ( chartInfo instanceof BarInfo && chartInfo . xAxisPadding !== null ) {
311+ let xAxisPaddingDuration = helper . parseDurationString (
312+ chartInfo . xAxisPadding
313+ ) ;
314+ if ( xAxisPaddingDuration !== null ) {
315+ xDomain = [
316+ xDomain [ 0 ] . clone ( ) . subtract ( xAxisPaddingDuration . asHours ( ) , 'hours' ) ,
317+ xDomain [ 1 ] . clone ( ) . add ( xAxisPaddingDuration . asHours ( ) , 'hours' ) ,
318+ ] ;
319+ }
320+ }
321+ // console.log(xDomain);
310322 let xScale = d3
311323 . scaleTime ( )
312324 . domain ( xDomain )
@@ -954,7 +966,7 @@ function renderBar(
954966 . enter ( )
955967 . append ( "rect" )
956968 . attr ( "x" , function ( p : DataPoint , i : number ) {
957- if ( i === 0 ) {
969+ if ( i === 0 && barInfo . xAxisPadding === null ) {
958970 let portionVisible = currentDiaplayInd + 1 - totalDiaplaySet / 2.0 ;
959971 if ( portionVisible < 1.0 ) {
960972 return (
@@ -975,15 +987,15 @@ function renderBar(
975987 return yScale ( Math . max ( p . value , 0 ) ) ;
976988 } )
977989 . attr ( "width" , function ( p : DataPoint , i : number ) {
978- if ( i === 0 ) {
990+ if ( i === 0 && barInfo . xAxisPadding === null ) {
979991 let portionVisible = currentDiaplayInd + 1 - totalDiaplaySet / 2.0 ;
980992 if ( portionVisible < 0.0 ) {
981993 return 0.0 ;
982994 } else if ( portionVisible < 1.0 ) {
983995 return barWidth * portionVisible ;
984996 }
985997 return barWidth ;
986- } else if ( i === dataset . getLength ( ) - 1 ) {
998+ } else if ( i === dataset . getLength ( ) - 1 && barInfo . xAxisPadding === null ) {
987999 let portionVisible =
9881000 1.0 - ( currentDiaplayInd + 1 - totalDiaplaySet / 2.0 ) ;
9891001 if ( portionVisible < 0.0 ) {
0 commit comments