-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Table view - squashed #2052
Table view - squashed #2052
Conversation
@etpinard Bird mock is now added, I'll need to replace the other tech test mocks too (they have JS etc.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a first review. My comments are mostly pointing at ways to reuse existing code especially components Drawing
and Color
. I caught a few typos in there too.
I'm a little disappointing that the new text-wrapping code is embedded deep inside table/plot.js
. How hard would it be to factor it out and place it in svg_text_utils.js
?
}, | ||
|
||
format: { | ||
valType: 'data_array', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be an arrayOk
valType: 'string'
, to format all values to same way more easily?
|
||
height: { | ||
valType: 'number', | ||
dflt: 28, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting number. How did you come up with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
}, | ||
|
||
font: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/traces/table/attributes.js
Outdated
role: 'info', | ||
dflt: [], | ||
description: [ | ||
'Dimension values. `values[n]` represents the value of the `n`th point in the dataset,', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't values
be 2D? That is, values[n][m]
represents the value of ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/traces/table/attributes.js
Outdated
} | ||
} | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to add editType
declarations to these attributes.
See #1999
src/traces/table/plot.js
Outdated
function conditionalPanelRerender(gd, tableControlView, cellsColumnBlock, pages, prevPages, d, revolverIndex) { | ||
var shouldComponentUpdate = pages[revolverIndex] !== prevPages[revolverIndex]; | ||
if(shouldComponentUpdate) { | ||
window.clearTimeout(d.currentRepaint[revolverIndex]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to spell out window
when using setTimeout
and clearTimeout
// this code block is only invoked for items where d.cellHeightMayIncrease is truthy | ||
var element = this; | ||
var columnCellElement = element.parentNode; | ||
var box = columnCellElement.getBoundingClientRect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid these getBoundingClientRect
calls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key test here (which I assume will fail given the getBoundingClientRect
call) is to call Plotly.newPlot
into an element that's not in the DOM, and insert it in the DOM afterward - ala https://codepen.io/anon/pen/XjakQy
If you really do need a getBoundingClientRect
result, use Drawing.bBox
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that #2053 should address it. I added a 'core' line now to express this. Here, the difference between parent and child bounding box top matters. What do people, or we, do with detached nodes? I'm trying to minimize open points for this specific PR, unless of course users would run into serious issues with it otherwise.
src/traces/table/plot.js
Outdated
}); | ||
|
||
// MathJax styling has to be killed for HTML DOM color specifications to seep through | ||
cellTextHolder.selectAll('svg').selectAll('*') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks hacky. Can we do better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in regular convertToTspans
MathJax gets colored here based on the color that was already applied to the text it was converted from - does that not apply here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check your link, maybe it solves the need for the current hack, I wasn't happy it drew in black when fill
was white but thought maybe there's a better way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably just an order-of-operations issue, we assume the text is fully styled before being converted to MathJax. It would probably be good for us to break this out like we did with positionText
so it can be applied either before or after conversion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks for the lead!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexcjohnson @etpinard Fully agree w/ the order of operations (LaTeX coloring), a quick initial look didn't lead to a 5-minute solution, plan to do it tomorrow. Other tasks are,
- ensuring
table
works fine withPlotly.restyle
, and - more
default
ing should happens (eg. now the user always needs to specify column order)
which seem more pressing than internal changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Please add item to #2056
test/jasmine/tests/table_test.js
Outdated
|
||
it('\'dimension\' specification should have a default of an empty array', function() { | ||
var fullTrace = _supply({}); | ||
expect(fullTrace.dimensions).toEqual([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this? A copy from parcoords
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, vestigial. I'll read through the code before the next round.
test/jasmine/tests/table_test.js
Outdated
}); | ||
}); | ||
|
||
describe('@noCI table', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why @noCI
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically I didn't intend to check in table_test.js
😃
A few (opinionated) comments from https://codepen.io/monfera/pen/ZXXMLo?editors=1010#0
Is there an easy way to reduce the recoil action on drag-end?
|
|
||
"cells": { | ||
|
||
"values": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. So here the values[i]
represent columns - which I think is fair for table
. But this means that cells.values
is the transpose of the z
attribute in heatmap
traces. Which at the very least write this down in the table/index.js
module description.
thinking ahead to |
@alexcjohnson That's true. The only caveat is that high-frequency updates like scroll position shouldn't go through controlled update cycles or even So in summary, it updates the plotly attr so the current scroll position is reproduced correctly, but after that it can only be set via the UI. Glad to hear other thoughts on the matter, but that's what I think needs to happen. |
@etpinard I can taper down the bouncy column drag to less or non-bouncy easing. |
@alexcjohnson @rreusser is it decided that plot state will be fully specified? That'd include things like zoom level, pan position, the use of a selection box or even the contours of a lasso. Not suggesting it's not a desired thing at all though! @rreusser I'm not sure if it adds to or questions anything you said, but wanted to mention that controlling scroll position might be desirable. For example, some journal incorporates a |
@monfera That's valid. I was wondering about that. I guess the key part is that we somehow avoid feeding UI scrolling from feeding back into controlled UI updates. |
Yes. Specify all the things.
We can certainly throttle these events (wooo we have a util for that 🎉 ) but we definitely want users to be able to watch the scroll state, and for example highlight points on a separate plot corresponding to the visible rows, and vice versa - click a point and scroll to that row in the table (hmm, those are a little more involved, as they require not only the pixel scroll, which is required to fully specify the state, but also some way to translate that bidirectionally to row numbers). Anyway my more immediate concern is other edits not resetting the table scroll - like the issues @etpinard fixed for geo plots in #2030. @monfera edit here, as we don't have threading and topic locality is nice: added the need for full representation as an item to the follow-up issue #2056 |
Looks to me like |
8ad24bf
to
2be591f
Compare
45b6843
to
addb85b
Compare
…t-hoc LaTeX styling workaround
85fdc93
to
c2f251f
Compare
…into table-squashed
… setting via Drawing.*
…into table-squashed
This sums up this PR. A very nice looking and performant trace type. 👏 to @monfera for his very user-first approach. But, unfortunately, not much work was put in reusability for our other components. I hope @monfera will have time to make a followup PR knocking out a few items in #2056 in the next few days and adding jasmine tests along the way. Factoring out the text wrap logic ( #2053 ) we'll make a bunch of folks happy, I hope this happens soon. Items #2057 and #2054 are less important to me in the short-term. Let's get this thing in |
Thanks @etpinard and @alexcjohnson for the numerous review points! |
Squashed version of #1834
Before starting review, I'd push proper mocks, also as codepen examples. I'll also need to recheck attributes and add jasmine tests.