Skip to content
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

[WIP] Table view #1834

Closed
wants to merge 282 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
282 commits
Select commit Hold shift + click to select a range
6144a5d
rowblocks everywhere
monfera Aug 30, 2017
53727ab
no anchorToRowBlock anymore
monfera Aug 30, 2017
bfbc222
fixed repeating increase of same thing
monfera Aug 30, 2017
1e7e91f
putting 2nd panel out of the view
monfera Aug 30, 2017
5647b44
1.,2. panels OK, rest and scrollback aren't
monfera Aug 30, 2017
fea8944
baseline for fixing extra gap
monfera Aug 31, 2017
ae93445
fixing extra gap
monfera Aug 31, 2017
b8d1a47
clean up 1
monfera Aug 31, 2017
dac8a62
clean up 2
monfera Aug 31, 2017
1c4509c
clean up 3
monfera Aug 31, 2017
0a78d3a
clean up 4 - killing carry
monfera Aug 31, 2017
1e48b34
clean up 5
monfera Aug 31, 2017
5d20556
no `stretch`; 50% fewer bbox measurements
monfera Aug 31, 2017
80e9933
pure shuffle
monfera Aug 31, 2017
a424fc1
mock chg
monfera Aug 31, 2017
7246536
one-cell mock
monfera Aug 31, 2017
0566c21
works with normal text (but not LaTeX yet - Y is wrong)
monfera Sep 3, 2017
72ee5d5
proper vertical positioning of MathJax
monfera Sep 3, 2017
81fda3e
tmp
monfera Sep 4, 2017
06474df
tmp2
monfera Sep 4, 2017
0c29e2a
baseline for fix
monfera Sep 4, 2017
19efe5f
looks wonderful for both regular and MathJax
monfera Sep 4, 2017
c8be760
looks wonderful for both regular and MathJax 2
monfera Sep 4, 2017
f546eb2
cleanup
monfera Sep 4, 2017
f84905f
awesome but doesn't handle header row increases yet
monfera Sep 4, 2017
364e5a1
preparing to bump height
monfera Sep 5, 2017
778ae6d
preparing for rippling through Y
monfera Sep 5, 2017
faea3cb
extracting out bumper
monfera Sep 5, 2017
d8aa184
push down possibly previously rendered cells
monfera Sep 5, 2017
ee33431
sparing bump - only do so if increase happened
monfera Sep 5, 2017
83f0b15
extracting out stuff and pre bumping block
monfera Sep 5, 2017
271f518
extracting out column y translate
monfera Sep 5, 2017
648d50a
bumping the block if need be
monfera Sep 5, 2017
09138d2
two columns
monfera Sep 5, 2017
952174c
bench for fixing 'gap'
monfera Sep 5, 2017
8bf532b
fixing column mismatch
monfera Sep 6, 2017
897c74e
bench
monfera Sep 6, 2017
51f3d69
works fine w/ revolving scroller
monfera Sep 6, 2017
1d72175
cleanup
monfera Sep 6, 2017
a530aea
remove parentElement 1
monfera Sep 6, 2017
7bf3b6d
remove parentElement 2
monfera Sep 6, 2017
6971915
removing parentNode crowd
monfera Sep 7, 2017
c7ef24d
simplify
monfera Sep 7, 2017
9869336
header rows look reasonable
monfera Sep 7, 2017
cd6d859
simplifying bumps
monfera Sep 7, 2017
7de8930
oversimplification
monfera Sep 7, 2017
6a6b876
avoid some work
monfera Sep 7, 2017
027cd3a
regrouping stuff as per conditional
monfera Sep 7, 2017
6811b1c
bench for header row thingie
monfera Sep 8, 2017
e1b2d0a
minimal bench
monfera Sep 8, 2017
1acad4f
minimal bench
monfera Sep 8, 2017
8cf39a3
fixed
monfera Sep 10, 2017
5add9c9
actually good for some reason (previous one wasn't)
monfera Sep 10, 2017
4b31251
minor simpl.
monfera Sep 10, 2017
8b7540b
fix baseline
monfera Sep 10, 2017
3e028d6
simpl.
monfera Sep 10, 2017
3c02331
bench
monfera Sep 10, 2017
9e291db
bench
monfera Sep 11, 2017
7a12fb8
candidate
monfera Sep 11, 2017
6928176
reopened multirow/column
monfera Sep 11, 2017
a3d2e81
mock update
monfera Sep 11, 2017
99f37d4
mock update
monfera Sep 11, 2017
18c8948
good header-first rendering
monfera Sep 11, 2017
497d2db
simplification
monfera Sep 11, 2017
e0e11f6
fix (anchorChanged); minor factoring out
monfera Sep 11, 2017
bf23fb2
abstracting out more functions
monfera Sep 11, 2017
115f132
even better fix - no occlusion even if cells rows have no async content
monfera Sep 11, 2017
479f120
remove console.log and debug lines
monfera Sep 11, 2017
4fe4ec9
remove unused vars
monfera Sep 11, 2017
fe248b5
minor simplifications
monfera Sep 11, 2017
c77cab9
well working case - no increases happening
monfera Sep 11, 2017
5840273
don't white flash async cells
monfera Sep 11, 2017
29b4c33
bench 0
monfera Sep 11, 2017
8960249
good but 1 column only
monfera Sep 11, 2017
51199fb
bench
monfera Sep 11, 2017
93eb842
disused
monfera Sep 11, 2017
c8bd557
bench pre doing away with some anchor stuff
monfera Sep 11, 2017
bd4375b
bench pre doing away with some anchor stuff
monfera Sep 11, 2017
13676a1
removed block totalHeight
monfera Sep 11, 2017
b9e33f5
loop stead of reduce
monfera Sep 12, 2017
f8045d6
got rid of rowAnchor
monfera Sep 12, 2017
1208048
pre removing firstRowAnchor
monfera Sep 12, 2017
6756d6c
partially removing firstRowAnchor
monfera Sep 12, 2017
ee89704
tentative
monfera Sep 12, 2017
7427e6e
phasing out yOffset
monfera Sep 12, 2017
b73cd33
eliminating bumpers
monfera Sep 12, 2017
953fd72
eliminating yOffset, scrollHeight
monfera Sep 12, 2017
07e2856
factor out util
monfera Sep 12, 2017
9683f45
factor out some utils
monfera Sep 12, 2017
b912564
factor out cancelTransition
monfera Sep 12, 2017
d53bbe8
rowBlockOffset removed
monfera Sep 12, 2017
4c303be
no need to extend row panels
monfera Sep 12, 2017
31e0a9f
comments removed
monfera Sep 12, 2017
a3ad749
regroup tricky parts
monfera Sep 12, 2017
aac68d0
regroup tricky parts 2
monfera Sep 12, 2017
da33f83
make column sorting possible even if column on edge is much thinner
monfera Sep 12, 2017
8830381
splitToCells extracted
monfera Sep 12, 2017
2f39a4e
note
monfera Sep 12, 2017
1f17d93
reordered tricky functions
monfera Sep 12, 2017
a76be54
synchronousHeightAndPosition
monfera Sep 12, 2017
1daf7d5
simpl.
monfera Sep 12, 2017
413fe2b
removed a translateY
monfera Sep 12, 2017
382c9fd
some function merge
monfera Sep 12, 2017
129796d
rename
monfera Sep 12, 2017
e9fe02d
shuffle
monfera Sep 12, 2017
576c1d0
obsolete
monfera Sep 12, 2017
d3f2d49
obsolete
monfera Sep 12, 2017
5d9bf13
simplifying firstRowAnchor
monfera Sep 12, 2017
75ace9f
simplifying getting anchor
monfera Sep 12, 2017
54bef00
simpler bottom calculation; renamings
monfera Sep 12, 2017
b5151c0
minor simpl.
monfera Sep 12, 2017
635ec61
minor
monfera Sep 12, 2017
fbc1fb9
get rid of a block translator
monfera Sep 12, 2017
05cbab9
tentative
monfera Sep 12, 2017
16497ad
tentative 2
monfera Sep 12, 2017
cb0d8f6
tentative 3
monfera Sep 12, 2017
d4aca80
tentative 4
monfera Sep 12, 2017
99f1444
tentative 5
monfera Sep 12, 2017
12c638a
tentative 6
monfera Sep 12, 2017
131ce57
prep for absolute panel layouting
monfera Sep 13, 2017
d902c49
deleted d.anchor
monfera Sep 13, 2017
ac7998a
shuffle
monfera Sep 13, 2017
ed5219f
calculate and output currently visible blocks
monfera Sep 13, 2017
4d34468
starting lifting
monfera Sep 13, 2017
66043b2
starting lifting 2
monfera Sep 13, 2017
5b966c7
starting lifting 3
monfera Sep 13, 2017
8c3354b
starting lifting 4
monfera Sep 13, 2017
f112032
starting lifting 5
monfera Sep 14, 2017
3b6e903
starting lifting 6
monfera Sep 14, 2017
bc47890
good but jumpy at the beginning; also, not conservative (panels don't…
monfera Sep 14, 2017
1a2c5b0
minor
monfera Sep 14, 2017
c66a69b
no more jumps, overshoots, looks perfect!
monfera Sep 14, 2017
36c3d23
efficiency improv
monfera Sep 14, 2017
840955e
fewer rerenders
monfera Sep 14, 2017
6b2055d
cleanup
monfera Sep 14, 2017
7ea4faa
cleanup 2
monfera Sep 14, 2017
c0918a3
cleanup 3
monfera Sep 14, 2017
f341860
cleanup 4; removing obsolete data
monfera Sep 14, 2017
c506cca
cleanup 5: removing obsolete data
monfera Sep 14, 2017
4bdf092
cleanup 6: shuffles, renames
monfera Sep 14, 2017
b7cacfe
adding mock; minor
monfera Sep 14, 2017
53a8316
baseline
monfera Sep 14, 2017
1e0aa12
baseline 2 for text wrapping
monfera Sep 14, 2017
481b193
doing something...
monfera Sep 14, 2017
ac9dc08
tmp
monfera Sep 15, 2017
11180ad
text wrapping works again
monfera Sep 15, 2017
ec17fb2
tmp
monfera Sep 19, 2017
9e8b31b
tmp
monfera Sep 21, 2017
1762d9e
wrapping such that preexisting `transform` is taken into account
monfera Sep 21, 2017
8542a38
properly pass on gd where needed
monfera Sep 21, 2017
cce1816
finally, Firefox renders
monfera Sep 22, 2017
ae594dd
restored header
monfera Sep 22, 2017
cdaf961
switching off clipView as it confuses FF
monfera Sep 22, 2017
b39188d
avoid spoofing for FF; break clippath link instead at the user DOM node
monfera Sep 22, 2017
91b67e4
baseline for multirow wrapping
monfera Sep 23, 2017
7af8966
avoid one unnecessary DOM subtree adjustment
monfera Sep 23, 2017
998e61a
baseline for fixing overshifting
monfera Sep 23, 2017
769654b
baseline for fixing overshifting 2
monfera Sep 23, 2017
ff67893
fixed multirow downshift problem
monfera Sep 23, 2017
cfbcb21
conditionalizing against markup with line breaks
monfera Sep 23, 2017
1cf037e
very good single-column
monfera Sep 23, 2017
fa2a2a7
numbers ok; baseline for the issue of not downshifting next panel
monfera Sep 23, 2017
5b10f8f
splitting viewModel and render for columnBlock
monfera Sep 23, 2017
59a6108
alternative take
monfera Sep 24, 2017
38f5c9f
alternative take 2
monfera Sep 24, 2017
1ab9af5
alternative take 3
monfera Sep 24, 2017
5766916
block bumping now works fine!
monfera Sep 24, 2017
9831e55
Merge branch 'table-wrap-2' into table
monfera Sep 24, 2017
6ae80f2
restoring clipping
monfera Sep 24, 2017
e5ba612
rename
monfera Sep 24, 2017
f18e729
tmp
monfera Sep 25, 2017
56699e9
optical test for OS X native like scrollbar
monfera Sep 25, 2017
0755456
baseline for making scrollbar reflect position and coverage
monfera Sep 25, 2017
4f70c4f
piping enough data through to enable scrollbar rerendering
monfera Sep 25, 2017
ac7c2b1
abstracting out data for scrollbar rerendering
monfera Sep 25, 2017
16eaee9
properly sized scrollbar even for a short row
monfera Sep 26, 2017
5039a81
perfect scroll bar in one direction
monfera Sep 26, 2017
48ca142
d.scrollbarState
monfera Sep 26, 2017
840c064
avoiding multiple calculations
monfera Sep 26, 2017
78a8ac7
baseline for making the scrollbar interactive
monfera Sep 26, 2017
126e93d
drag event logged
monfera Sep 26, 2017
1ce53dc
scrollbar starts to control
monfera Sep 26, 2017
b0ecdb4
proper scrollbar drag with mock multiplier
monfera Sep 26, 2017
88ce78a
plugging in real pixel to virtual document ratio
monfera Sep 26, 2017
cea9200
hover induces the scrollbar
monfera Sep 26, 2017
46ae792
cut copypasta
monfera Sep 26, 2017
1ef0050
tmp
monfera Sep 27, 2017
8246109
perfect scroll jump behavior
monfera Sep 27, 2017
2533b85
mousewheel
monfera Sep 28, 2017
e19b6e7
test case
monfera Sep 28, 2017
9603cb1
fixing revolver regression (flat selection, had 1x4 elements instead …
monfera Sep 28, 2017
32b5aa6
mock update
monfera Sep 28, 2017
92e35eb
minor fix - avoid scrollbar butt crop; minimum bar length for Fitts law
monfera Sep 28, 2017
eb8c110
performance baseline
monfera Sep 29, 2017
00815ba
manual inlining 1
monfera Sep 29, 2017
b37a8a2
manual inlining 2
monfera Sep 29, 2017
be8fc72
manual inlining 3
monfera Sep 29, 2017
282dd0a
manual inlining 3 - optimized (linear rather than quadratic)
monfera Sep 29, 2017
940a41d
halve the calculations in heavy
monfera Sep 29, 2017
c252e17
reshuffling
monfera Sep 29, 2017
d50216e
getting rid of expensive rowOffset
monfera Sep 29, 2017
213e9c3
deleted redundant function
monfera Sep 29, 2017
5800a34
mock with 1m rows
monfera Sep 29, 2017
3045336
reversing loop
monfera Sep 29, 2017
fbba640
caching allRowsHeight
monfera Sep 29, 2017
01bfa79
bypass wrappingNeeded if text contains no separating characters (space)
monfera Sep 29, 2017
2dbcc7f
baseline for avoiding getBoundingClientRect
monfera Sep 29, 2017
473b3df
avoid wrapping if not needed
monfera Sep 29, 2017
0230f03
baseline
monfera Sep 29, 2017
b7a2ed5
baseline 2
monfera Sep 30, 2017
4df9fd4
avoiding getBoundingClientRect; baseline for 'empty last row' issue
monfera Sep 30, 2017
10cf058
fixes:
monfera Sep 30, 2017
d7fc0a4
don't show scrollbars and north/south arrow if table is not tall enou…
monfera Sep 30, 2017
7a4a21e
restored 100 rows in mock
monfera Sep 30, 2017
9328dff
calling setCellHeightAndPositionY in bulk
monfera Sep 30, 2017
4e5bcf6
eschewing convertToTspans if not need (though: formatting is now lost)
monfera Sep 30, 2017
89e1984
baseline for renderColumnBlocks perf hotspot
monfera Sep 30, 2017
efc388d
broke up monolithic renderColumnBlock
monfera Sep 30, 2017
6292da7
removed unneeded font spec (there were two places setting font)
monfera Sep 30, 2017
45ae343
moved setCellHeightAndPositionY outside renderCellText (became peer)
monfera Sep 30, 2017
f85beb6
switching to direct calls (shows up better on perf profiling)
monfera Sep 30, 2017
bd10e57
rename
monfera Sep 30, 2017
8037a25
extracted out some functions
monfera Sep 30, 2017
a33d979
rename
monfera Sep 30, 2017
3f27ea1
extracted out more
monfera Sep 30, 2017
51be19d
fantastic speedup due to not having to exit cells, only update
monfera Oct 1, 2017
bfa5968
minor
monfera Oct 1, 2017
cb5dec8
baseline for fixing latex regression
monfera Oct 2, 2017
ae10de6
hmm doesn't reproduce
monfera Oct 2, 2017
4067084
minimal repro of issue
monfera Oct 2, 2017
d3dffc0
minor
monfera Oct 2, 2017
a04fd84
avoiding double render loop on 1st render
monfera Oct 2, 2017
2c87828
busting keys for async render calls
monfera Oct 2, 2017
9179e84
mock update; reactivating header column
monfera Oct 2, 2017
3309f28
mock update for latex: also showing an increased-height header
monfera Oct 2, 2017
b7d140e
mock update for linebroken: also showing an increased-height header
monfera Oct 2, 2017
54b319f
mock update for styled
monfera Oct 2, 2017
c32141f
just because it's wrapped, it may still need a height increase
monfera Oct 2, 2017
74ac3bc
added mock for text wrapping
monfera Oct 2, 2017
a13accb
added mock for mixed content
monfera Oct 2, 2017
303ba17
basic cell adjustment for cellPad
monfera Oct 2, 2017
0f6fe97
latex check
monfera Oct 2, 2017
9f27d60
xPosition extracted
monfera Oct 2, 2017
7c180e4
alignment works again for plain mode
monfera Oct 2, 2017
64f39d8
alignment works again for plain mode - optimized
monfera Oct 2, 2017
e7d279b
alignment works for styled mode
monfera Oct 2, 2017
7f7e377
bench for textwrap quickscroll test
monfera Oct 2, 2017
22a0a97
avoid running into unpainted lines
monfera Oct 2, 2017
26b6100
lint
monfera Oct 2, 2017
dd1c221
propagated gd to where it's needed
monfera Oct 2, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/index.js
Expand Up @@ -34,6 +34,7 @@ Plotly.register([
require('./pointcloud'),
require('./heatmapgl'),
require('./parcoords'),
require('./table'),

require('./scattermapbox'),

Expand Down
11 changes: 11 additions & 0 deletions lib/table.js
@@ -0,0 +1,11 @@
/**
* Copyright 2012-2017, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

module.exports = require('../src/traces/table');
2 changes: 1 addition & 1 deletion src/traces/parcoords/lines.js
Expand Up @@ -106,7 +106,7 @@ function palette(unitToColor, context, opacity) {
// but first it shifts the sample index by 0, 8 or 16 bits depending on rgbIndex [0..2]
// with the end result that each line will be of a unique color, making it possible for the pick handler
// to uniquely identify which line is hovered over (bijective mapping).
// The inverse, i.e. readPixel is invoked from 'parcoords.js'
// The inverse, i.e. readPixel is invoked from 'render.js'
function calcPickColor(j, rgbIndex) {
return (j >>> 8 * rgbIndex) % 256 / 255;
}
Expand Down
283 changes: 283 additions & 0 deletions src/traces/table/attributes.js
@@ -0,0 +1,283 @@
/**
* Copyright 2012-2017, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

var annAttrs = require('../../components/annotations/attributes');
var fontAttrs = require('../../plots/font_attributes');

var extendFlat = require('../../lib/extend').extendFlat;

module.exports = {

domain: {
x: {
valType: 'info_array',
role: 'info',
items: [
{valType: 'number', min: 0, max: 1},
{valType: 'number', min: 0, max: 1}
],
dflt: [0, 1],
description: [
'Sets the horizontal domain of this `table` trace',
'(in plot fraction).'
].join(' ')
},
y: {
valType: 'info_array',
role: 'info',
items: [
{valType: 'number', min: 0, max: 1},
{valType: 'number', min: 0, max: 1}
],
dflt: [0, 1],
description: [
'Sets the vertical domain of this `table` trace',
'(in plot fraction).'
].join(' ')
}
},

labelfont: extendFlat({}, fontAttrs, {
description: 'Sets the font for the `dimension` labels.'
}),

labels: {
valType: 'data_array',
role: 'info',
dflt: [],
description: 'The shown name of the columns.'
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like I asked this already but I don't see it... labels/labelfont are gone, right? replaced by header?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks for the reminder, I left it in but served no function, removed (w/ the next squashed push)


columnwidth: {
valType: 'number',
arrayOk: true,
dflt: null,
role: 'style',
description: 'The width of cells.'
},

header: {

values: {
valType: 'data_array',
role: 'info',
dflt: [],
description: [
'Dimension values. `values[n]` represents the value of the `n`th point in the dataset,',
'therefore the `values` vector for all dimensions must be the same (longer vectors',
'will be truncated). Each value must be a finite number.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the same description as in cells.values - can you make one specific to header.values that describes the options for dimensionality? And as to the other arrayOk attributes in header, would they need to match that dimensionality, or can they be 1D if values is 2D?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also other data_array items we typically have not provided a dflt at all - is it needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I'll need to revise descriptions in general.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... also, the description should explain how it works if a 1D array is specified, or a mixed 1D / 2D array (ie. an array whose elements include arrays as well as scalars), and also the truncation - if the array is shorter than the row / column count, then the last value is used, making it possible to easily format by column, by row and mixed

].join(' ')
},

format: {
valType: 'data_array',
role: 'info',
dflt: [],
description: [
'Sets the cell value formatting rule using d3 formatting mini-language',
'which is similar to those of Python. See',
'https://github.com/d3/d3-format/blob/master/README.md#locale_format'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

headers will mostly be strings, not numbers... does this just get ignored in that case? Actually same goes for cells.format. Which begs the question of dates too - axis.tickformat supports either number formatting or date formatting depending on the axis type - do we need a type field for headers and cells as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the implementation, most of the header cell and regular cell rendering is the same codepath (minor trivia: there are three columnBlocks, one for the header row (or header rows if we want to extend in the future), and one for each of the revolving scroller panels. So I thought without much thinking that the formatting options would be identical. Indeed numeric headers are rare, though date headers may be more common. I'll need to implement proper date formatting as you suggest.

]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remember .join(' ') (and in cells.format) - took me a while to figure out why I couldn't get the test dashboard to start, kept getting the error:

"SyntaxError: Unexpected token (99:9) while parsing file:
/Users/alex/plotly/plotlyjs/src/traces/table/attributes.js"

which I guess is coming from the browserify transform that strips out descriptions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, still not able to get it running, looks like a circular dep or something? I guess it's not ready for playing with, but I really wanted to see how the infinite scroller feels!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had two missing .join(' ')s due to omitting it in the copy/paste selection. It causes a problem with npm run build which I use less often than budo but had to fix it already for the crossfilter example (now relies on a dist js file), fix will be in the squashed commit.

},

prefix: {
valType: 'string',
arrayOk: true,
dflt: null,
role: 'style',
description: 'Prefix for cell values.'
},

suffix: {
valType: 'string',
arrayOk: true,
dflt: null,
role: 'style',
description: 'Suffix for cell values.'
},

height: {
valType: 'number',
arrayOk: false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand arrayOk: false for cells.height, but I could imagine it being useful for headers.

BTW @etpinard re: #1894 ALL of these headers arrays would need to be excluded if we ever call findArrayAttributes on tables.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't planning with heterogeneous cell heights for the header row for the time being, as it's a single-row header at least for the MVP. Cell merging would be useful for multiline headers in the future. Maybe I'm missing a short term use case of heterogeneous cell heights with the single-row header cells, so a link or drawing might help. It'd complicate things not just in the implementation but also in the design, e.g. the top would look jaggy and the uplift that happens when you start dragging a column would become ineffective.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't realize headers were limited to 1 row (saw the 2D values in table_large - still only one row but the structure is obviously there to support multiple rows) - that's fine, I was thinking height, if it were an array, would index the rows, not columns or individual cells, so at 1 row there's no reason this should be an array. Actually much more useful from my standpoint would be if headers (at least) would support pseudoHTML via svgTextUtils.convertToTspans.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to set arrayOk: false, by default all attributes are arrayOk: falsy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was done just for emphasis; now removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcjohnson the current push should build fine, the attribute documentation join type is fixed. The table_large.json is obsolete (will be reworked), but the table.json should be OK.

dflt: 28,
role: 'style',
description: 'The height of cells.'
},

align: extendFlat({}, annAttrs.align, {arrayOk: true}),
valign: extendFlat({}, annAttrs.valign, {arrayOk: true}),

line: {
width: {
valType: 'number',
arrayOk: true,
role: 'style'
},
color: {
valType: 'color',
arrayOk: true,
role: 'style'
}
},

fill: {
color: {
valType: 'color',
arrayOk: true,
role: 'style',
description: [
'Sets the cell fill color. It accepts either a specific color',
' or an array of colors.'
].join('')
}
},

font: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll switch to extendDeep.

family: {
valType: 'string',
arrayOk: true,
role: 'style',
noBlank: true,
strict: true,
description: [
'HTML font family - the typeface that will be applied by the web browser.',
'The web browser will only be able to apply a font if it is available on the system',
'which it operates. Provide multiple font families, separated by commas, to indicate',
'the preference in which to apply fonts if they aren\'t available on the system.',
'The plotly service (at https://plot.ly or on-premise) generates images on a server,',
'where only a select number of',
'fonts are installed and supported.',
'These include *Arial*, *Balto*, *Courier New*, *Droid Sans*,, *Droid Serif*,',
'*Droid Sans Mono*, *Gravitas One*, *Old Standard TT*, *Open Sans*, *Overpass*,',
'*PT Sans Narrow*, *Raleway*, *Times New Roman*.'
].join(' ')
},
size: {
valType: 'number',
arrayOk: true,
role: 'style'
},
color: {
valType: 'color',
arrayOk: true,
role: 'style'
}
}
},

cells: {

values: {
valType: 'data_array',
role: 'info',
dflt: [],
description: [
'Dimension values. `values[n]` represents the value of the `n`th point in the dataset,',
'therefore the `values` vector for all dimensions must be the same (longer vectors',
'will be truncated). Each value must be a finite number.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not just numbers...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and it's not dimensions, I'll revise the descriptions.

].join(' ')
},

format: {
valType: 'data_array',
role: 'info',
dflt: [],
description: [
'Sets the cell value formatting rule using d3 formatting mini-language',
'which is similar to those of Python. See',
'https://github.com/d3/d3-format/blob/master/README.md#locale_format'
]
},

prefix: {
valType: 'string',
arrayOk: true,
dflt: null,
role: 'style',
description: 'Prefix for cell values.'
},

suffix: {
valType: 'string',
arrayOk: true,
dflt: null,
role: 'style',
description: 'Suffix for cell values.'
},

height: {
valType: 'number',
arrayOk: false,
dflt: 20,
role: 'style',
description: 'The height of cells.'
},

align: extendFlat({}, annAttrs.align, {arrayOk: true}),
valign: extendFlat({}, annAttrs.valign, {arrayOk: true}),

line: {
width: {
valType: 'number',
arrayOk: true,
role: 'style'
},
color: {
valType: 'color',
arrayOk: true,
role: 'style'
}
},

fill: {
color: {
valType: 'color',
arrayOk: true,
role: 'style',
description: [
'Sets the cell fill color. It accepts either a specific color',
' or an array of colors.'
].join('')
}
},

font: {
family: {
valType: 'string',
arrayOk: true,
role: 'style',
noBlank: true,
strict: true,
description: [
'HTML font family - the typeface that will be applied by the web browser.',
'The web browser will only be able to apply a font if it is available on the system',
'which it operates. Provide multiple font families, separated by commas, to indicate',
'the preference in which to apply fonts if they aren\'t available on the system.',
'The plotly service (at https://plot.ly or on-premise) generates images on a server,',
'where only a select number of',
'fonts are installed and supported.',
'These include *Arial*, *Balto*, *Courier New*, *Droid Sans*,, *Droid Serif*,',
'*Droid Sans Mono*, *Gravitas One*, *Old Standard TT*, *Open Sans*, *Overpass*,',
'*PT Sans Narrow*, *Raleway*, *Times New Roman*.'
].join(' ')
},
size: {
valType: 'number',
arrayOk: true,
role: 'style'
},
color: {
valType: 'color',
arrayOk: true,
role: 'style'
}
}
}
};
33 changes: 33 additions & 0 deletions src/traces/table/base_plot.js
@@ -0,0 +1,33 @@
/**
* Copyright 2012-2017, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

var d3 = require('d3');
var Plots = require('../../plots/plots');
var tablePlot = require('./plot');

exports.name = 'table';

exports.attr = 'type';

exports.plot = function(gd) {
var calcData = Plots.getSubplotCalcData(gd.calcdata, 'table', 'table');
if(calcData.length) tablePlot(gd, calcData);
};

exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {
var hadTable = (oldFullLayout._has && oldFullLayout._has('table'));
var hasTable = (newFullLayout._has && newFullLayout._has('table'));

if(hadTable && !hasTable) {
oldFullLayout._paperdiv.selectAll('.table').remove();
oldFullLayout._paperdiv.selectAll('.table').remove();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, now removed

oldFullLayout._glimages.selectAll('*').remove();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you, leftover from parcoords, now removed

}
};
13 changes: 13 additions & 0 deletions src/traces/table/calc.js
@@ -0,0 +1,13 @@
/**
* Copyright 2012-2017, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

module.exports = function calc() {
return [{}];
};