@@ -667,8 +667,8 @@ describe("SHAPE BAR", () => {
667667
668668 it ( "check the bar radius" , ( ) => {
669669 const path = [
670- "M228.91666666666669,331.55555555555554V380.5833333333333 a10, 10 1 0 0 10,10H233.91666666666669 a10, 10 1 0 0 10,-10V331.55555555555554z" ,
671- "M246.91666666666669,331.55555555555554V223.5 a10, 10 0 0 1 10,-10H251.91666666666669 a10, 10 0 0 1 10,10V331.55555555555554z"
670+ "M228.91666666666669,331.55555555555554V380.5833333333333 a10 10 1 0 0 10,10H233.91666666666669 a10 10 1 0 0 10,-10V331.55555555555554z" ,
671+ "M246.91666666666669,331.55555555555554V223.5 a10 10 0 0 1 10,-10H251.91666666666669 a10 10 0 0 1 10,10V331.55555555555554z"
672672 ] ;
673673
674674 checkRadius ( path ) ;
@@ -680,8 +680,8 @@ describe("SHAPE BAR", () => {
680680
681681 it ( "check the rotated axis bar radius" , ( ) => {
682682 checkRadius ( [
683- "M131.11111111111111,161.16666666666669H59.166666666666664 a10, 10 1 0 0 -10,10V166.16666666666669 a10, 10 1 0 0 10,10H131.11111111111111z" ,
684- "M131.11111111111111,179.16666666666669H285 a10, 10 0 0 1 10,10V184.16666666666669 a10, 10 0 0 1 -10,10H131.11111111111111z"
683+ "M131.11111111111111,161.16666666666669H59.166666666666664 a10 10 1 0 0 -10,10V166.16666666666669 a10 10 1 0 0 10,10H131.11111111111111z" ,
684+ "M131.11111111111111,179.16666666666669H285 a10 10 0 0 1 10,10V184.16666666666669 a10 10 0 0 1 -10,10H131.11111111111111z"
685685 ] ) ;
686686 } ) ;
687687
@@ -692,8 +692,8 @@ describe("SHAPE BAR", () => {
692692
693693 it ( "check the axis bar radius in ratio" , ( ) => {
694694 const path = [
695- "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" ,
696- "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"
695+ "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" ,
696+ "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"
697697 ] ;
698698
699699 checkRadius ( path ) ;
@@ -959,7 +959,7 @@ describe("SHAPE BAR", () => {
959959 ] ;
960960
961961 chart . $ . bar . bars . each ( function ( d ) {
962- const hasRadius = ! / a 0 , 0 / . test ( this . getAttribute ( "d" ) ) ;
962+ const hasRadius = ! / a 0 0 / . test ( this . getAttribute ( "d" ) ) ;
963963
964964 if ( hasRadius ) {
965965 const found = expected [ d . index ] . some ( v => v . id === d . id && v . value === d . value ) ;
@@ -1028,8 +1028,8 @@ describe("SHAPE BAR", () => {
10281028
10291029 it ( "radius should be rendered correclty on rotated axis" , ( ) => {
10301030 const expected = [
1031- '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' ,
1032- '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'
1031+ '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' ,
1032+ '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'
10331033 ] ;
10341034
10351035 chart . $ . bar . bars . each ( function ( ) {
@@ -1045,8 +1045,8 @@ describe("SHAPE BAR", () => {
10451045
10461046 it ( "radius should be rendered correclty on rotated & inverted axis" , ( ) => {
10471047 const expected = [
1048- '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' ,
1049- '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'
1048+ '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' ,
1049+ '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'
10501050 ] ;
10511051
10521052 chart . $ . bar . bars . each ( function ( ) {
@@ -1055,6 +1055,104 @@ describe("SHAPE BAR", () => {
10551055 } ) ;
10561056 } ) ;
10571057
1058+ describe ( "bar radius surpassing condition" , ( ) => {
1059+ beforeAll ( ( ) => {
1060+ args = {
1061+ data : {
1062+ type : "bar" ,
1063+ columns :[
1064+ [ "data" , - 10289158423 , - 204482173 , 3075954443 ]
1065+ ]
1066+ } ,
1067+ axis : {
1068+ y : {
1069+ "min" :- 50000000000 ,
1070+ "max" :50000000000 ,
1071+ "tick" :{
1072+ "show" :false ,
1073+ "outer" :false ,
1074+ "text" :{
1075+ "position" :{
1076+ "x" :- 20
1077+ }
1078+ } ,
1079+ "stepSize" : 25000000000
1080+ } , "padding" :0
1081+ }
1082+ } ,
1083+ bar : {
1084+ radius : 2 ,
1085+ width : 10 ,
1086+ padding : 2
1087+ }
1088+ } ;
1089+ } ) ;
1090+
1091+ it ( "should negative value set clip-path" , ( ) => {
1092+ chart . $ . bar . bars . each ( function ( d , i ) {
1093+ if ( i === 1 ) {
1094+ const d = this . getAttribute ( "d" ) ;
1095+ const value = [ d . match ( / , ( [ ^ V ] * ) / ) [ 1 ] , d . match ( / V ( [ ^ \s ] * ) / ) [ 1 ] ] . reduce ( ( a , c ) => + a - + c ) ;
1096+
1097+ expect ( + this . style . clipPath . match ( / \( ( [ ^ p x ] * ) / ) [ 1 ] ) . to . be . closeTo ( value , 1 ) ;
1098+ } else {
1099+ expect ( this . style . clipPath ) . to . be . equal ( "" ) ;
1100+ }
1101+ } ) ;
1102+ } ) ;
1103+
1104+ it ( "set options: set positive data value" , ( ) => {
1105+ args . data . columns [ 0 ] [ 2 ] = 204482173 ;
1106+ } ) ;
1107+
1108+ it ( "should positive value set clip-path" , ( ) => {
1109+ chart . $ . bar . bars . each ( function ( d , i ) {
1110+ if ( i === 1 ) {
1111+ const d = this . getAttribute ( "d" ) ;
1112+ const value = [ d . match ( / , ( [ ^ V ] * ) / ) [ 1 ] , d . match ( / V ( [ ^ \s ] * ) / ) [ 1 ] ] . reduce ( ( a , c ) => + c - + a ) ;
1113+
1114+ expect ( + this . style . clipPath . match ( / \s ( [ ^ p x ] * ) p x \) $ / ) [ 1 ] ) . to . be . closeTo ( value , 1 ) ;
1115+ } else {
1116+ expect ( this . style . clipPath ) . to . be . equal ( "" ) ;
1117+ }
1118+ } ) ;
1119+ } ) ;
1120+
1121+ it ( "set options: axis.rotated=true" , ( ) => {
1122+ args . axis . rotated = true ;
1123+ } ) ;
1124+
1125+ it ( "should positive value set clip-path for rotated axis" , ( ) => {
1126+ chart . $ . bar . bars . each ( function ( d , i ) {
1127+ if ( i === 1 ) {
1128+ const d = this . getAttribute ( "d" ) ;
1129+ const value = [ d . match ( / M ( [ ^ , ] * ) / ) [ 1 ] , d . match ( / H ( [ ^ \s ] * ) / ) [ 1 ] ] . reduce ( ( a , c ) => + a - + c ) ;
1130+
1131+ expect ( + this . style . clipPath . match ( / \s ( [ ^ p x ] * ) p x \) $ / ) [ 1 ] ) . to . be . closeTo ( value , 1 ) ;
1132+ } else {
1133+ expect ( this . style . clipPath ) . to . be . equal ( "" ) ;
1134+ }
1135+ } ) ;
1136+ } ) ;
1137+
1138+ it ( "set options: set negative data value" , ( ) => {
1139+ args . data . columns [ 0 ] [ 2 ] = - 204482173 ;
1140+ } ) ;
1141+
1142+ it ( "should negative value set clip-path for rotated axis" , ( ) => {
1143+ chart . $ . bar . bars . each ( function ( d , i ) {
1144+ if ( i === 1 ) {
1145+ const d = this . getAttribute ( "d" ) ;
1146+ const value = [ d . match ( / M ( [ ^ , ] * ) / ) [ 1 ] , d . match ( / H ( [ ^ \s ] * ) / ) [ 1 ] ] . reduce ( ( a , c ) => + c - + a ) ;
1147+
1148+ expect ( + this . style . clipPath . match ( / p x \s ( [ ^ p x ] * ) / ) [ 1 ] ) . to . be . closeTo ( value , 1 ) ;
1149+ } else {
1150+ expect ( this . style . clipPath ) . to . be . equal ( "" ) ;
1151+ }
1152+ } ) ;
1153+ } ) ;
1154+ } ) ;
1155+
10581156 describe ( "bar linear gradient" , ( ) => {
10591157 beforeAll ( ( ) => {
10601158 args = {
0 commit comments