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
Table view - squashed#2052
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.
Table view - squashed #2052
Changes from all commits
c4244db865e4442648e51192272130cbaa0aa0c116c0ac213732bd4622e23e39571be3345b027ff3c8f6b9c8de6c1d19b4f8e76477186527e96c3c453367256f21697f3f1a5d95740995a59e04dd5841d9b60156309c8bb78cb5ecb14f6c62be591faddb85bc2f251f3cab51dfa84c68465b45b0fa1cc8cd0578da6c49350ad1a0c1254c9fe38b7cf94338f46288559154ab249402020d4f0ed7File 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; | ||
| var overrideAll = require('../../plot_api/edit_types').overrideAll; | ||
| module.exports = overrideAll({ | ||
| 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: [ | ||
| 'Header cell values. `values[m][n]` represents the value of the `n`th point in column `m`,', | ||
| 'therefore the `values[m]` vector length for all columns must be the same (longer vectors', | ||
| 'will be truncated). Each value must be a finite number or a string.' | ||
| ].join(' ') | ||
| }, | ||
| format: { | ||
| valType: 'data_array', | ||
Contributor 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. Maybe this should be an | ||
| 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: 28, | ||
Contributor 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. Interesting number. How did you come up with that? 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. | ||
| role: 'style', | ||
| description: 'The height of cells.' | ||
| }, | ||
| align: extendFlat({}, annAttrs.align, {arrayOk: true}), | ||
| line: { | ||
| width: { | ||
| valType: 'number', | ||
| arrayOk: true, | ||
| role: 'style' | ||
| }, | ||
| color: { | ||
| valType: 'color', | ||
| arrayOk: true, | ||
| role: 'style' | ||
| } | ||
| }, | ||
| fill: { | ||
| color: { | ||
| valType: 'color', | ||
| arrayOk: true, | ||
| dflt: 'white', | ||
| role: 'style', | ||
| description: [ | ||
| 'Sets the cell fill color. It accepts either a specific color', | ||
| ' or an array of colors.' | ||
| ].join('') | ||
| } | ||
| }, | ||
| font: { | ||
Contributor 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. | ||
| 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: [ | ||
| 'Cell values. `values[m][n]` represents the value of the `n`th point in column `m`,', | ||
| 'therefore the `values[m]` vector length for all columns must be the same (longer vectors', | ||
| 'will be truncated). Each value must be a finite number or a string.' | ||
| ].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}), | ||
| line: { | ||
| width: { | ||
| valType: 'number', | ||
| arrayOk: true, | ||
| role: 'style' | ||
| }, | ||
| color: { | ||
| valType: 'color', | ||
| arrayOk: true, | ||
| role: 'style' | ||
| } | ||
| }, | ||
| fill: { | ||
| color: { | ||
| valType: 'color', | ||
| arrayOk: true, | ||
| role: 'style', | ||
| dflt: 'white', | ||
| 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' | ||
| } | ||
| } | ||
| } | ||
| }, 'calc', 'from-root'); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /** | ||
| * 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 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(); | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /** | ||
| * 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 wrap = require('../../lib/gup').wrap; | ||
| module.exports = function calc(gd, trace) { | ||
| return wrap(trace); | ||
| }; |
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.
I like this. Thanks @monfera 🎉
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.
Would you mind reusing this in
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.
Added note to #2058