-
-
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
[WIP] Table view #1834
[WIP] Table view #1834
Changes from all 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,34 @@ | ||
/** | ||
* 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 identity = require('./identity'); | ||
|
||
function wrap(d) {return [d];} | ||
|
||
module.exports = { | ||
|
||
// The D3 data binding concept and the General Update Pattern promotes the idea of | ||
// traversing into the scenegraph by using the `.data(fun, keyFun)` call. | ||
// The `fun` is most often a `repeat`, ie. the elements beneath a `<g>` element need | ||
// access to the same data, or a `descend`, which fans a scenegraph node into a bunch of | ||
// of elements, e.g. points, lines, rows, requiring an array as input. | ||
// The role of the `keyFun` is to identify what elements are being entered/exited/updated, | ||
// otherwise D3 reverts to using a plain index which would screw up `transition`s. | ||
keyFun: function(d) {return d.key;}, | ||
repeat: wrap, | ||
descend: identity, | ||
|
||
// Plotly.js uses a convention of storing the actual contents of the `calcData` as the | ||
// element zero of a container array. These helpers are just used for clarity as a | ||
// newcomer to the codebase may not know what the `[0]` is, and whether there can be further | ||
// elements (not atm). | ||
wrap: wrap, | ||
unwrap: function(d) {return d[0];} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,278 @@ | ||
/** | ||
* 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 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(' ') | ||
} | ||
}, | ||
|
||
columnwidth: { | ||
valType: 'number', | ||
arrayOk: true, | ||
dflt: null, | ||
role: 'style', | ||
description: 'The width of cells.' | ||
}, | ||
|
||
columnorder: { | ||
valType: 'data_array', | ||
role: 'info', | ||
description: [ | ||
'Specifies the rendered order of the data columns; for example, a value `2` at position `0`', | ||
'means that column index `0` in the data will be rendered as the', | ||
'third column, as columns have an index base of zero.' | ||
].join(' ') | ||
}, | ||
|
||
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.' | ||
].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 |
||
].join(' ') | ||
}, | ||
|
||
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', | ||
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' | ||
].join(' ') | ||
}, | ||
|
||
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', | ||
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' | ||
} | ||
} | ||
} | ||
}; |
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.
this is the same description as in
cells.values
- can you make one specific toheader.values
that describes the options for dimensionality? And as to the otherarrayOk
attributes inheader
, would they need to match that dimensionality, or can they be 1D ifvalues
is 2D?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.
Also other
data_array
items we typically have not provided adflt
at all - is it needed 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.
Indeed, I'll need to revise descriptions in general.
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.
... 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