@@ -665,8 +665,8 @@ describe("SHAPE BAR", () => {
665665
666666 it ( "check the bar radius" , ( ) => {
667667 const path = [
668- "M228.91666666666669,331.55555555555554V380.5833333333333 a10, 10 1 0 0 10,10H233.91666666666669 a10, 10 1 0 0 10,-10V331.55555555555554z" ,
669- "M246.91666666666669,331.55555555555554V223.5 a10, 10 0 0 1 10,-10H251.91666666666669 a10, 10 0 0 1 10,10V331.55555555555554z"
668+ "M228.91666666666669,331.55555555555554V380.5833333333333 a10 10 1 0 0 10,10H233.91666666666669 a10 10 1 0 0 10,-10V331.55555555555554z" ,
669+ "M246.91666666666669,331.55555555555554V223.5 a10 10 0 0 1 10,-10H251.91666666666669 a10 10 0 0 1 10,10V331.55555555555554z"
670670 ] ;
671671
672672 checkRadius ( path ) ;
@@ -678,8 +678,8 @@ describe("SHAPE BAR", () => {
678678
679679 it ( "check the rotated axis bar radius" , ( ) => {
680680 checkRadius ( [
681- "M131.11111111111111,161.16666666666669H59.166666666666664 a10, 10 1 0 0 -10,10V166.16666666666669 a10, 10 1 0 0 10,10H131.11111111111111z" ,
682- "M131.11111111111111,179.16666666666669H285 a10, 10 0 0 1 10,10V184.16666666666669 a10, 10 0 0 1 -10,10H131.11111111111111z"
681+ "M131.11111111111111,161.16666666666669H59.166666666666664 a10 10 1 0 0 -10,10V166.16666666666669 a10 10 1 0 0 10,10H131.11111111111111z" ,
682+ "M131.11111111111111,179.16666666666669H285 a10 10 0 0 1 10,10V184.16666666666669 a10 10 0 0 1 -10,10H131.11111111111111z"
683683 ] ) ;
684684 } ) ;
685685
@@ -690,8 +690,8 @@ describe("SHAPE BAR", () => {
690690
691691 it ( "check the axis bar radius in ratio" , ( ) => {
692692 const path = [
693- "M228.91666666666669,331.55555555555554V383.0833333333333 a7.5, 7.5 1 0 0 7.5,7.5H236.41666666666669 a7.5, 7.5 1 0 0 7.5,-7.5V331.55555555555554z" ,
694- "M246.91666666666669,331.55555555555554V221 a7.5, 7.5 0 0 1 7.5,-7.5H254.41666666666669 a7.5, 7.5 0 0 1 7.5,7.5V331.55555555555554z"
693+ "M228.91666666666669,331.55555555555554V383.0833333333333 a7.5 7.5 1 0 0 7.5,7.5H236.41666666666669 a7.5 7.5 1 0 0 7.5,-7.5V331.55555555555554z" ,
694+ "M246.91666666666669,331.55555555555554V221 a7.5 7.5 0 0 1 7.5,-7.5H254.41666666666669 a7.5 7.5 0 0 1 7.5,7.5V331.55555555555554z"
695695 ] ;
696696
697697 checkRadius ( path ) ;
@@ -957,7 +957,7 @@ describe("SHAPE BAR", () => {
957957 ] ;
958958
959959 chart . $ . bar . bars . each ( function ( d ) {
960- const hasRadius = ! / a 0 , 0 / . test ( this . getAttribute ( "d" ) ) ;
960+ const hasRadius = ! / a 0 0 / . test ( this . getAttribute ( "d" ) ) ;
961961
962962 if ( hasRadius ) {
963963 const found = expected [ d . index ] . some ( v => v . id === d . id && v . value === d . value ) ;
@@ -1026,8 +1026,8 @@ describe("SHAPE BAR", () => {
10261026
10271027 it ( "radius should be rendered correclty on rotated axis" , ( ) => {
10281028 const expected = [
1029- 'M295,85.80000000000001H477.23333333333323 a63.599999999999994, 63.599999999999994 0 0 1 63.599999999999994,63.599999999999994V149.4 a63.599999999999994, 63.599999999999994 0 0 1 -63.599999999999994,63.599999999999994H295z' ,
1030- 'M295,213H112.76666666666665 a63.599999999999994, 63.599999999999994 1 0 0 -63.599999999999994,63.599999999999994V276.6 a63.599999999999994, 63.599999999999994 1 0 0 63.599999999999994,63.599999999999994H295z'
1029+ 'M295,85.80000000000001H477.23333333333323 a63.599999999999994 63.599999999999994 0 0 1 63.599999999999994,63.599999999999994V149.4 a63.599999999999994 63.599999999999994 0 0 1 -63.599999999999994,63.599999999999994H295z' ,
1030+ 'M295,213H112.76666666666665 a63.599999999999994 63.599999999999994 1 0 0 -63.599999999999994,63.599999999999994V276.6 a63.599999999999994 63.599999999999994 1 0 0 63.599999999999994,63.599999999999994H295z'
10311031 ] ;
10321032
10331033 chart . $ . bar . bars . each ( function ( ) {
@@ -1043,8 +1043,8 @@ describe("SHAPE BAR", () => {
10431043
10441044 it ( "radius should be rendered correclty on rotated & inverted axis" , ( ) => {
10451045 const expected = [
1046- 'M295,85.80000000000001H112.76666666666668 a63.599999999999994, 63.599999999999994 1 0 0 -63.599999999999994,63.599999999999994V149.4 a63.599999999999994, 63.599999999999994 1 0 0 63.599999999999994,63.599999999999994H295z' ,
1047- 'M295,213H477.23333333333323 a63.599999999999994, 63.599999999999994 0 0 1 63.599999999999994,63.599999999999994V276.6 a63.599999999999994, 63.599999999999994 0 0 1 -63.599999999999994,63.599999999999994H295z'
1046+ 'M295,85.80000000000001H112.76666666666668 a63.599999999999994 63.599999999999994 1 0 0 -63.599999999999994,63.599999999999994V149.4 a63.599999999999994 63.599999999999994 1 0 0 63.599999999999994,63.599999999999994H295z' ,
1047+ 'M295,213H477.23333333333323 a63.599999999999994 63.599999999999994 0 0 1 63.599999999999994,63.599999999999994V276.6 a63.599999999999994 63.599999999999994 0 0 1 -63.599999999999994,63.599999999999994H295z'
10481048 ] ;
10491049
10501050 chart . $ . bar . bars . each ( function ( ) {
@@ -1053,6 +1053,104 @@ describe("SHAPE BAR", () => {
10531053 } ) ;
10541054 } ) ;
10551055
1056+ describe ( "bar radius surpassing condition" , ( ) => {
1057+ beforeAll ( ( ) => {
1058+ args = {
1059+ data : {
1060+ type : "bar" ,
1061+ columns :[
1062+ [ "data" , - 10289158423 , - 204482173 , 3075954443 ]
1063+ ]
1064+ } ,
1065+ axis : {
1066+ y : {
1067+ "min" :- 50000000000 ,
1068+ "max" :50000000000 ,
1069+ "tick" :{
1070+ "show" :false ,
1071+ "outer" :false ,
1072+ "text" :{
1073+ "position" :{
1074+ "x" :- 20
1075+ }
1076+ } ,
1077+ "stepSize" : 25000000000
1078+ } , "padding" :0
1079+ }
1080+ } ,
1081+ bar : {
1082+ radius : 2 ,
1083+ width : 10 ,
1084+ padding : 2
1085+ }
1086+ } ;
1087+ } ) ;
1088+
1089+ it ( "should negative value set clip-path" , ( ) => {
1090+ chart . $ . bar . bars . each ( function ( d , i ) {
1091+ if ( i === 1 ) {
1092+ const d = this . getAttribute ( "d" ) ;
1093+ const value = [ d . match ( / , ( [ ^ V ] * ) / ) [ 1 ] , d . match ( / V ( [ ^ \s ] * ) / ) [ 1 ] ] . reduce ( ( a , c ) => + a - + c ) ;
1094+
1095+ expect ( + this . style . clipPath . match ( / \( ( [ ^ p x ] * ) / ) [ 1 ] ) . to . be . closeTo ( value , 1 ) ;
1096+ } else {
1097+ expect ( this . style . clipPath ) . to . be . equal ( "" ) ;
1098+ }
1099+ } ) ;
1100+ } ) ;
1101+
1102+ it ( "set options: set positive data value" , ( ) => {
1103+ args . data . columns [ 0 ] [ 2 ] = 204482173 ;
1104+ } ) ;
1105+
1106+ it ( "should positive value set clip-path" , ( ) => {
1107+ chart . $ . bar . bars . each ( function ( d , i ) {
1108+ if ( i === 1 ) {
1109+ const d = this . getAttribute ( "d" ) ;
1110+ const value = [ d . match ( / , ( [ ^ V ] * ) / ) [ 1 ] , d . match ( / V ( [ ^ \s ] * ) / ) [ 1 ] ] . reduce ( ( a , c ) => + c - + a ) ;
1111+
1112+ expect ( + this . style . clipPath . match ( / \s ( [ ^ p x ] * ) p x \) $ / ) [ 1 ] ) . to . be . closeTo ( value , 1 ) ;
1113+ } else {
1114+ expect ( this . style . clipPath ) . to . be . equal ( "" ) ;
1115+ }
1116+ } ) ;
1117+ } ) ;
1118+
1119+ it ( "set options: axis.rotated=true" , ( ) => {
1120+ args . axis . rotated = true ;
1121+ } ) ;
1122+
1123+ it ( "should positive value set clip-path for rotated axis" , ( ) => {
1124+ chart . $ . bar . bars . each ( function ( d , i ) {
1125+ if ( i === 1 ) {
1126+ const d = this . getAttribute ( "d" ) ;
1127+ const value = [ d . match ( / M ( [ ^ , ] * ) / ) [ 1 ] , d . match ( / H ( [ ^ \s ] * ) / ) [ 1 ] ] . reduce ( ( a , c ) => + a - + c ) ;
1128+
1129+ expect ( + this . style . clipPath . match ( / \s ( [ ^ p x ] * ) p x \) $ / ) [ 1 ] ) . to . be . closeTo ( value , 1 ) ;
1130+ } else {
1131+ expect ( this . style . clipPath ) . to . be . equal ( "" ) ;
1132+ }
1133+ } ) ;
1134+ } ) ;
1135+
1136+ it ( "set options: set negative data value" , ( ) => {
1137+ args . data . columns [ 0 ] [ 2 ] = - 204482173 ;
1138+ } ) ;
1139+
1140+ it ( "should negative value set clip-path for rotated axis" , ( ) => {
1141+ chart . $ . bar . bars . each ( function ( d , i ) {
1142+ if ( i === 1 ) {
1143+ const d = this . getAttribute ( "d" ) ;
1144+ const value = [ d . match ( / M ( [ ^ , ] * ) / ) [ 1 ] , d . match ( / H ( [ ^ \s ] * ) / ) [ 1 ] ] . reduce ( ( a , c ) => + c - + a ) ;
1145+
1146+ expect ( + this . style . clipPath . match ( / p x \s ( [ ^ p x ] * ) / ) [ 1 ] ) . to . be . closeTo ( value , 1 ) ;
1147+ } else {
1148+ expect ( this . style . clipPath ) . to . be . equal ( "" ) ;
1149+ }
1150+ } ) ;
1151+ } ) ;
1152+ } ) ;
1153+
10561154 describe ( "bar linear gradient" , ( ) => {
10571155 beforeAll ( ( ) => {
10581156 args = {
0 commit comments