Skip to content

Restyling table traces #2092

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
VeraZab opened this issue Oct 16, 2017 · 5 comments
Closed

Restyling table traces #2092

VeraZab opened this issue Oct 16, 2017 · 5 comments
Assignees
Labels
bug something broken

Comments

@VeraZab
Copy link

VeraZab commented Oct 16, 2017

is there something that I'm doing wrong here:
https://codepen.io/veraz/pen/XeydOX?editors=1010

can't seem to be able to use Plotly.restyle on table traces

cc @monfera

@monfera
Copy link
Contributor

monfera commented Oct 16, 2017

Table restyle needs a bit of work, on the list of the todo gh items, will look into it.

@VeraZab
Copy link
Author

VeraZab commented Oct 16, 2017

we need restyle to put this into the workspace..

@monfera
Copy link
Contributor

monfera commented Oct 19, 2017

I hastily assumed restyle doesn't work en bloc as table code was not tested (manually or otherwise) for restyle, in which case it's almost certain it'd have issues. Writing jasmine test cases, the couple of restyle things covered so far do work so I gave a shot to this one. It seems to be OK with the current build, and some slight changes to the codepen:

https://codepen.io/anon/pen/boZbRq?editors=1010

I'm carrying on with the test cases and manual tests as there may well be other restyle tests that'd still fail now.

PS. some restyle ops cause that the preexisting columns remain, I'll need to put in a D3 exit there, but at least it does something which may allow integration dev in the meantime.

@VeraZab
Copy link
Author

VeraZab commented Oct 20, 2017

oups, looked at your new pen, and can see from my old one that I was not using the plotly-latest.js bundle I was using:

<script src="https://rawgit.com/monfera/plotly.js/table-squashed/dist/plotly.min.js"></script>

Because I forked the pen from one of your old ones :)

But even when I changed to plotly-latest, and try to do a restyle call to columnwidth, same as you did in your codepen, my table doesn't update. The console shows: Plotly.version
"1.31.1" And when I go back to your codepen and play with changing columnwidth a few times, sometimes it works, sometimes it doesn't

my edited codepen: https://codepen.io/veraz/pen/XeydOX?editors=1010

maybe it's a codepen thing, but in our tests, can we try using restyle on the same property a few times, to see if it behaves as expected? thanks!

@monfera
Copy link
Contributor

monfera commented Oct 20, 2017

@VeraZab just a guess, the thing with columnWidth is that layout.width combined with data[n].domain actually determine the full table width; therefore columnWidth gets scaled. If you try it with either a smaller layout.width, or a smaller domain, you'll get narrower, equal-size columns. My example shows various column widths because columnWidth is supplied in an array of different numbers.

Hmm just looked the attributes, the doc for columnWidth doesn't say the above, so some kind of update is needed to bring user expectations and code in sync.

P.S. there had been table fixes even since the merge so using the ever current CDN version or even master or a feature branch is a good idea for dev purposes.

@VeraZab VeraZab closed this as completed Oct 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

3 participants