Skip to content

restyle textposition produces javascript error #2688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kochelmonster opened this issue Jun 1, 2018 · 4 comments · Fixed by #2689
Closed

restyle textposition produces javascript error #2688

kochelmonster opened this issue Jun 1, 2018 · 4 comments · Fixed by #2689
Labels
bug something broken regression this used to work

Comments

@kochelmonster
Copy link

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>
@alexcjohnson
Copy link
Collaborator

Thanks @kochelmonster - there's another bug if you delete the text array:

Plotly.restyle(gd, {text: null})

The text doesn't disappear, and gets stuck in place if you pan/zoom on the plot:
screen shot 2018-06-01 at 5 02 05 pm

@alexcjohnson alexcjohnson added the bug something broken label Jun 1, 2018
@alexcjohnson
Copy link
Collaborator

@etpinard seems like these came in with some of the 🐎 optimizations between 1.36 and 1.37 https://codepen.io/alexcjohnson/pen/jKbmmV

@alexcjohnson alexcjohnson added the regression this used to work label Jun 1, 2018
@etpinard
Copy link
Contributor

etpinard commented Jun 1, 2018

optimizations between 1.36 and 1.37

Ok. On it!

@etpinard
Copy link
Contributor

etpinard commented Jun 1, 2018

It's from #2574, where we 🔪 that ugly selectAll('.trace') on each Cartesian.plot call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken regression this used to work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants