-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[WIP] Table view #1834
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
Changes from 3 commits
6144a5d
53727ab
bfbc222
1e7e91f
5647b44
fea8944
ae93445
b8d1a47
dac8a62
1c4509c
0a78d3a
1e48b34
5d20556
80e9933
a424fc1
7246536
0566c21
72ee5d5
81fda3e
06474df
0c29e2a
19efe5f
c8be760
f546eb2
f84905f
364e5a1
778ae6d
faea3cb
d8aa184
ee33431
83f0b15
271f518
648d50a
09138d2
952174c
8bf532b
897c74e
51f3d69
1d72175
a530aea
7bf3b6d
6971915
c7ef24d
9869336
cd6d859
7de8930
6a6b876
027cd3a
6811b1c
e1b2d0a
1acad4f
8cf39a3
5add9c9
4b31251
8b7540b
3e028d6
3c02331
9e291db
7a12fb8
6928176
a3d2e81
99f37d4
18c8948
497d2db
e0e11f6
bf23fb2
115f132
479f120
4fe4ec9
fe248b5
c77cab9
5840273
29b4c33
8960249
51199fb
93eb842
c8bd557
bd4375b
13676a1
b9e33f5
f8045d6
1208048
6756d6c
ee89704
7427e6e
b73cd33
953fd72
07e2856
9683f45
b912564
d53bbe8
4c303be
31e0a9f
a3ad749
aac68d0
da33f83
8830381
2f39a4e
1f17d93
a76be54
1daf7d5
413fe2b
382c9fd
129796d
e9fe02d
576c1d0
d3f2d49
5d9bf13
75ace9f
54bef00
b5151c0
635ec61
fbc1fb9
05cbab9
16497ad
cb0d8f6
d4aca80
99f1444
12c638a
131ce57
d902c49
ac7998a
ed5219f
4d34468
66043b2
5b966c7
8c3354b
f112032
3b6e903
bc47890
1a2c5b0
c66a69b
36c3d23
840955e
6b2055d
7ea4faa
c0918a3
f341860
c506cca
4bdf092
b7cacfe
53a8316
1e0aa12
481b193
ac9dc08
11180ad
ec17fb2
9e8b31b
1762d9e
8542a38
cce1816
ae594dd
cdaf961
b39188d
91b67e4
7af8966
998e61a
769654b
ff67893
cfbcb21
1cf037e
fa2a2a7
5b10f8f
59a6108
38f5c9f
1ab9af5
5766916
9831e55
6ae80f2
e5ba612
f18e729
56699e9
0755456
4f70c4f
ac7c2b1
16eaee9
5039a81
48ca142
840c064
78a8ac7
126e93d
1ce53dc
b0ecdb4
88ce78a
cea9200
46ae792
1ef0050
8246109
2533b85
e19b6e7
9603cb1
32b5aa6
92e35eb
eb8c110
00815ba
b37a8a2
be8fc72
282dd0a
940a41d
c252e17
d50216e
213e9c3
5800a34
3045336
fbba640
01bfa79
2dbcc7f
473b3df
0230f03
b7a2ed5
4df9fd4
10cf058
d7fc0a4
7a4a21e
9328dff
4e5bcf6
89e1984
efc388d
6292da7
45ae343
f85beb6
bd10e57
8037a25
a33d979
3f27ea1
51be19d
bfa5968
cb5dec8
ae10de6
4067084
d3dffc0
a04fd84
2c87828
9179e84
3309f28
b7d140e
54b319f
c32141f
74ac3bc
a13accb
303ba17
0f6fe97
9f27d60
7c180e4
64f39d8
e7d279b
7f7e377
22a0a97
26b6100
dd1c221
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.' | ||
}, | ||
|
||
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.' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the same description as in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also other There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, I'll need to revise descriptions in general. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remember
which I guess is coming from the browserify transform that strips out descriptions. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had two missing |
||
}, | ||
|
||
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, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need to set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was done just for emphasis; now removed There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
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: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I'll switch to |
||
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.' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not just numbers... There was a problem hiding this comment. Choose a reason for hiding this commentThe 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' | ||
} | ||
} | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. duplicate? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks, now removed |
||
oldFullLayout._glimages.selectAll('*').remove(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thank you, leftover from |
||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [{}]; | ||
}; |
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 feel like I asked this already but I don't see it...
labels
/labelfont
are gone, right? replaced byheader
?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, thanks for the reminder, I left it in but served no function, removed (w/ the next squashed push)