File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ function viewModel(model) {
176
176
viewModel . dimensions = dimensions . filter ( visible ) . map ( function ( dimension , i ) {
177
177
var domainToUnit = domainToUnitScale ( dimension ) ;
178
178
var foundKey = uniqueKeys [ dimension . label ] ;
179
- uniqueKeys [ dimension . label ] = ( foundKey ? 0 : foundKey ) + 1 ;
179
+ uniqueKeys [ dimension . label ] = ( foundKey || 0 ) + 1 ;
180
180
var key = dimension . label + ( foundKey ? '__' + foundKey : '' ) ;
181
181
return {
182
182
key : key ,
Original file line number Diff line number Diff line change @@ -288,6 +288,23 @@ describe('parcoords', function() {
288
288
} ) ;
289
289
} ) ;
290
290
291
+ it ( 'Works with duplicate dimension labels' , function ( done ) {
292
+
293
+ var mockCopy = Lib . extendDeep ( { } , mock2 ) ;
294
+
295
+ mockCopy . layout . width = 320 ;
296
+ mockCopy . data [ 0 ] . dimensions [ 1 ] . label = mockCopy . data [ 0 ] . dimensions [ 0 ] . label ;
297
+
298
+ var gd = createGraphDiv ( ) ;
299
+ Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
300
+
301
+ expect ( gd . data . length ) . toEqual ( 1 ) ;
302
+ expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 2 ) ;
303
+ expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 2 ) ;
304
+ done ( ) ;
305
+ } ) ;
306
+ } ) ;
307
+
291
308
it ( 'Works with a single line; also, use a longer color array than the number of lines' , function ( done ) {
292
309
293
310
var mockCopy = Lib . extendDeep ( { } , mock2 ) ;
You can’t perform that action at this time.
0 commit comments