File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ function viewModel(model) {
176176 viewModel . dimensions = dimensions . filter ( visible ) . map ( function ( dimension , i ) {
177177 var domainToUnit = domainToUnitScale ( dimension ) ;
178178 var foundKey = uniqueKeys [ dimension . label ] ;
179- uniqueKeys [ dimension . label ] = ( foundKey ? 0 : foundKey ) + 1 ;
179+ uniqueKeys [ dimension . label ] = ( foundKey || 0 ) + 1 ;
180180 var key = dimension . label + ( foundKey ? '__' + foundKey : '' ) ;
181181 return {
182182 key : key ,
Original file line number Diff line number Diff line change @@ -288,6 +288,23 @@ describe('parcoords', function() {
288288 } ) ;
289289 } ) ;
290290
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+
291308 it ( 'Works with a single line; also, use a longer color array than the number of lines' , function ( done ) {
292309
293310 var mockCopy = Lib . extendDeep ( { } , mock2 ) ;
You can’t perform that action at this time.
0 commit comments