Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2k
[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
Uh oh!
There was an error while loading. Please reload this page.
[WIP] Table view #1834
Changes from all commits
6144a5d53727abbfbc2221e7e91f5647b44fea8944ae93445b8d1a47dac8a621c4509c0a78d3a1e48b345d2055680e9933a424fc172465360566c2172ee5d581fda3e06474df0c29e2a19efe5fc8be760f546eb2f84905f364e5a1778ae6dfaea3cbd8aa184ee3343183f0b15271f518648d50a09138d2952174c8bf532b897c74e51f3d691d72175a530aea7bf3b6d6971915c7ef24d9869336cd6d8597de89306a6b876027cd3a6811b1ce1b2d0a1acad4f8cf39a35add9c94b312518b7540b3e028d63c023319e291db7a12fb86928176a3d2e8199f37d418c8948497d2dbe0e11f6bf23fb2115f132479f1204fe4ec9fe248b5c77cab9584027329b4c33896024951199fb93eb842c8bd557bd4375b13676a1b9e33f5f8045d612080486756d6cee897047427e6eb73cd33953fd7207e28569683f45b912564d53bbe84c303be31e0a9fa3ad749aac68d0da33f8388303812f39a4e1f17d93a76be541daf7d5413fe2b382c9fd129796de9fe02d576c1d0d3f2d495d9bf1375ace9f54bef00b5151c0635ec61fbc1fb905cbab916497adcb0d8f6d4aca8099f144412c638a131ce57d902c49ac7998aed5219f4d3446866043b25b966c78c3354bf1120323b6e903bc478901a2c5b0c66a69b36c3d23840955e6b2055d7ea4faac0918a3f341860c506cca4bdf092b7cacfe53a83161e0aa12481b193ac9dc0811180adec17fb29e8b31b1762d9e8542a38cce1816ae594ddcdaf961b39188d91b67e47af8966998e61a769654bff67893cfbcb211cf037efa2a2a75b10f8f59a610838f5c9f1ab9af557669169831e556ae80f2e5ba612f18e72956699e907554564f70c4fac7c2b116eaee95039a8148ca142840c06478a8ac7126e93d1ce53dcb0ecdb488ce78acea920046ae7921ef005082461092533b85e19b6e79603cb132b5aa692e35ebeb8c11000815bab37a8a2be8fc72282dd0a940a41dc252e17d50216e213e9c35800a343045336fbba64001bfa792dbcc7f473b3df0230f03b7a2ed54df9fd410cf058d7fc0a47a4a21e9328dff4e5bcf689e1984efc388d6292da745ae343f85beb6bd10e578037a25a33d9793f27ea151be19dbfa5968cb5dec8ae10de64067084d3dffc0a04fd842c878289179e843309f28b7d140e54b319fc32141f74ac3bca13accb303ba170f6fe979f27d607c180e464f39d8e7d279b7f7e37722a0a9726b6100dd1c221File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
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' | ||
Collaborator 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 ContributorAuthor 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: { | ||
Collaborator 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 ContributorAuthor 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.' | ||
Collaborator 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... ContributorAuthor 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' | ||
| } | ||
| } | ||
| } | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.
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.valuesthat describes the options for dimensionality? And as to the otherarrayOkattributes inheader, would they need to match that dimensionality, or can they be 1D ifvaluesis 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_arrayitems we typically have not provided adfltat 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