Skip to content

BUG: Figure breaks after animating a property of an array element #2228

Closed
@jonmmease

Description

@jonmmease

It seems that something goes wrong when using Plotly.animate to change a property of an array element. I hit this while working on a custom trace type, but it is reproducible on the Parallel Coordinate trace.

Note: I understand animated transitions are not supported for the Parallel Coordinates trace, but my expectation is that an animate command shouldn't cause an error and should behave like a relayout/restyle command.

Parallel Coordinate Example Pen: https://codepen.io/anon/pen/ZvKGxW

Summary:

  • Animating a change to line.color works fine
  • Restyling a change to dimensions[0].constraintrange works fine
  • Animating a change to dimensions[0].constraintrange breaks the plot (Nothing shows up afterward)

Example code for reference:

var trace = {
  type: 'parcoords',
  line: {
    color: 'blue'
  },
	
  dimensions: [{
    range: [1, 5],
    constraintrange: [1, 2],
    label: 'A',
    values: [1,4]
  }, {    
    range: [1,5],
    label: 'B',
    values: [3,1.5],
    tickvals: [1.5,3,4.5]
  }]
};

var data = [trace]

Plotly.plot('graphDiv', data).then(function() {
	// ## This animate command works as expected (line turns red) ##
	// Plotly.animate('graphDiv', 
	// 			{data: [{'line.color': 'red'}],
	// 			 traces: [0],
	// 			 layout: {}})
	
	// ## This restyle command works as expected (constraintrange extends to [1, 4]) ##
	// Plotly.restyle('graphDiv', {'dimensions[0].constraintrange': [[1, 4]]}, 0)
	
	// ## This animate command breaks things and the plot doesn't show up ##
	Plotly.animate('graphDiv', 
                                {data: [{'dimensions[0].constraintrange': [1, 4]}],
                                  traces: [0],
                                  layout: {}})
});

Metadata

Metadata

Assignees

Labels

bugsomething broken

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions