Skip to content

restyle textposition produces javascript error #2688

Closed
@kochelmonster

Description

@kochelmonster

Try out the following example and click on "No Text" link.

<head>
  <!-- Plotly.js -->
  <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>

<body>

  <div id="myDiv"><!-- Plotly chart will be drawn inside this DIV --></div>
  <script>
var xValue = ['Product A', 'Product B', 'Product C'];

var yValue = [20, 14, 23];

var trace1 = {
x: xValue,
y: yValue,
type: 'bar',
text: yValue,
textposition: 'auto',
hoverinfo: 'none',
marker: {
  color: 'rgb(158,202,225)',
  opacity: 0.6,
  line: {
    color: 'rbg(8,48,107)',
    width: 1.5
  }
}
};

var data = [trace1];

var layout = {
title: 'January 2013 Sales Report'
};

Plotly.newPlot('myDiv', data, layout);

function no_text() {
  Plotly.restyle('myDiv', {textposition: ['none']}, [0]);
}

  </script>

  <a href="javascript:no_text()">No Text</a>

</body>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething brokenregressionthis used to work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions