Skip to content

Allow 1D header in table #2072

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

Merged
merged 2 commits into from
Oct 6, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/traces/table/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
Lib.coerceFont(coerce, 'cells.font', fontDflt);

coerce('header.values');
for(var i = 0; i < traceOut.header.values.length; i++) {
if(!Array.isArray(traceOut.header.values[i])) {
traceOut.header.values[i] = [traceOut.header.values[i]];
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

This makes me vaguely uneasy - having a different structure of the attribute in data vs _fullData. For example, the workspace looks at _fullData for what the current values are in order to construct controls, but then feeds control output back into data. It might be fine, but if there's a way to push this farther down, into data_preparation_helper perhaps, that would make me more comfortable.

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, will do!

coerce('header.format');
coerce('header.align');

Expand Down
2 changes: 1 addition & 1 deletion test/image/mocks/table_latex_multitrace.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"columnorder": [0, 1, 2],

"header": {
"values": [["<b>#</b>"], ["Half-angle form"], ["Equivalent"]],
"values": ["<b>#</b>", "Half-angle form", "Equivalent"],
"align": ["right", "center", "center"],
"line": {"width": 0.0},
"fill": {"color": ["dimgray", "grey"]},
Expand Down