@@ -1112,28 +1112,6 @@ describe('A bar plot', function() {
11121112 } ;
11131113 }
11141114
1115- checkTextTemplate ( [ {
1116- type : 'bar' ,
1117- y : [ 1 , 5 , 3 , 2 ] ,
1118- text : [ 'A' , 'B' , 'C' , 'D' ] ,
1119- textposition : 'inside' ,
1120- hovertemplate : '%{text}'
1121- } ] , 'text.bartext' , [
1122- [ '%{text} - %{value}' , [ 'A - 1' , 'B - 5' , 'C - 3' , 'D - 2' ] ] ,
1123- [ [ '%{y}' , '%{value}' , '%{text}' ] , [ '1' , '5' , 'C' ] ]
1124- ] ) ;
1125-
1126- checkTextTemplate ( [ {
1127- type : 'bar' ,
1128- textposition : 'outside' ,
1129- x : [ '2019-01-01' , '2019-02-01' ] ,
1130- y : [ 1 , 2 ] ,
1131- hovertemplate : '%{x}' ,
1132- texttemplate : '%{x}'
1133- } ] , 'text.bartext' , [
1134- [ '%{x}' , [ '2019-01-01' , '2019-02-01' ] ]
1135- ] ) ;
1136-
11371115 it ( 'should show bar texts (inside case)' , function ( done ) {
11381116 var data = [ {
11391117 y : [ 10 , 20 , 30 ] ,
@@ -2496,6 +2474,30 @@ describe('bar hover', function() {
24962474 } ) ;
24972475} ) ;
24982476
2477+ describe ( 'Text templates on bar traces:' , function ( ) {
2478+ checkTextTemplate ( [ {
2479+ type : 'bar' ,
2480+ y : [ 1 , 5 , 3 , 2 ] ,
2481+ text : [ 'A' , 'B' , 'C' , 'D' ] ,
2482+ textposition : 'inside' ,
2483+ hovertemplate : '%{text}'
2484+ } ] , 'text.bartext' , [
2485+ [ '%{text} - %{value}' , [ 'A - 1' , 'B - 5' , 'C - 3' , 'D - 2' ] ] ,
2486+ [ [ '%{y}' , '%{value}' , '%{text}' ] , [ '1' , '5' , 'C' ] ]
2487+ ] ) ;
2488+
2489+ checkTextTemplate ( [ {
2490+ type : 'bar' ,
2491+ textposition : 'outside' ,
2492+ x : [ '2019-01-01' , '2019-02-01' ] ,
2493+ y : [ 1 , 2 ] ,
2494+ hovertemplate : '%{x}' ,
2495+ texttemplate : '%{x}'
2496+ } ] , 'text.bartext' , [
2497+ [ '%{x}' , [ '2019-01-01' , '2019-02-01' ] ]
2498+ ] ) ;
2499+ } ) ;
2500+
24992501describe ( 'event data' , function ( ) {
25002502 var mock = require ( '@mocks/stacked_bar' ) ;
25012503 checkEventData ( mock , 216 , 309 , constants . eventDataKeys ) ;
0 commit comments