@@ -73,6 +73,7 @@ interface Props {
7373 customLayers : CustomLayerDataType [ ] ;
7474 naLabel : string ;
7575 rtl : boolean ;
76+ targetLineThickness : number ;
7677}
7778
7879export function VerticalGraph ( props : Props ) {
@@ -118,6 +119,7 @@ export function VerticalGraph(props: Props) {
118119 precision,
119120 customLayers,
120121 naLabel,
122+ targetLineThickness,
121123 } = props ;
122124 const svgRef = useRef ( null ) ;
123125 const isInView = useInView ( svgRef , {
@@ -376,21 +378,21 @@ export function VerticalGraph(props: Props) {
376378 < motion . rect
377379 x = { 0 }
378380 width = { x . bandwidth ( ) }
379- style = { {
380- fill : targetColor ,
381- } }
382381 exit = { {
383382 height : 0 ,
384383 y : y ( 0 ) ,
384+ fill : targetColor ,
385385 transition : { duration : animate . duration } ,
386386 } }
387387 variants = { {
388388 initial : {
389389 height : 0 ,
390+ fill : targetColor ,
390391 y : y ( 0 ) ,
391392 } ,
392393 whileInView : {
393394 height : Math . abs ( y ( d . target ) - y ( 0 ) ) ,
395+ fill : targetColor ,
394396 y : d . target > 0 ? y ( d . target ) : y ( 0 ) ,
395397 transition : { duration : animate . duration } ,
396398 } ,
@@ -430,28 +432,28 @@ export function VerticalGraph(props: Props) {
430432 < motion . rect
431433 x = { 0 }
432434 width = { x . bandwidth ( ) }
433- style = { {
434- fill : targetColor ,
435- } }
436435 exit = { {
437436 y : y ( 0 ) ,
438437 opacity : 0 ,
438+ fill : targetColor ,
439439 transition : { duration : animate . duration } ,
440440 } }
441441 variants = { {
442442 initial : {
443443 y : y ( 0 ) ,
444444 opacity : 0 ,
445+ fill : targetColor ,
445446 } ,
446447 whileInView : {
447- y : y ( d . target ) - 1 ,
448+ y : y ( d . target ) - targetLineThickness / 2 ,
448449 opacity : 1 ,
450+ fill : targetColor ,
449451 transition : { duration : animate . duration } ,
450452 } ,
451453 } }
452454 initial = 'initial'
453455 animate = { isInView ? 'whileInView' : 'initial' }
454- height = { 2 }
456+ height = { targetLineThickness }
455457 />
456458 ) : null }
457459 { showLabels ? (
@@ -609,6 +611,7 @@ export function HorizontalGraph(props: Props) {
609611 precision,
610612 customLayers,
611613 naLabel,
614+ targetLineThickness,
612615 } = props ;
613616 const svgRef = useRef ( null ) ;
614617 const isInView = useInView ( svgRef , {
@@ -839,21 +842,21 @@ export function HorizontalGraph(props: Props) {
839842 y = { 0 }
840843 x = { d . target >= 0 ? x ( 0 ) : x ( d . target ) }
841844 height = { y . bandwidth ( ) }
842- style = { {
843- fill : targetColor ,
844- } }
845845 exit = { {
846846 width : 0 ,
847847 x : x ( 0 ) ,
848+ fill : targetColor ,
848849 transition : { duration : animate . duration } ,
849850 } }
850851 variants = { {
851852 initial : {
852853 x : x ( 0 ) ,
854+ fill : targetColor ,
853855 width : 0 ,
854856 } ,
855857 whileInView : {
856858 x : d . target >= 0 ? x ( 0 ) : x ( d . target ) ,
859+ fill : targetColor ,
857860 width : d . target >= 0 ? x ( d . target ) - x ( 0 ) : x ( 0 ) - x ( d . target ) ,
858861 transition : { duration : animate . duration } ,
859862 } ,
@@ -893,23 +896,23 @@ export function HorizontalGraph(props: Props) {
893896 < motion . rect
894897 y = { 0 }
895898 height = { y . bandwidth ( ) }
896- style = { {
897- fill : targetColor ,
898- } }
899- width = { 2 }
899+ width = { targetLineThickness }
900900 exit = { {
901901 opacity : 0 ,
902902 x : x ( 0 ) ,
903+ fill : targetColor ,
903904 transition : { duration : animate . duration } ,
904905 } }
905906 variants = { {
906907 initial : {
907908 x : x ( 0 ) ,
908909 opacity : 0 ,
910+ fill : targetColor ,
909911 } ,
910912 whileInView : {
911- x : x ( d . target ) - 1 ,
913+ x : x ( d . target ) - targetLineThickness / 2 ,
912914 opacity : 1 ,
915+ fill : targetColor ,
913916 transition : { duration : animate . duration } ,
914917 } ,
915918 } }
0 commit comments