Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions src/EditorControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
shamefullyClearAxisTypes,
shamefullyAdjustAxisRef,
shamefullyAdjustGeo,
shamefullyAddTableColumns,
} from './shame';
import {EDITOR_ACTIONS} from './lib/constants';
import isNumeric from 'fast-isnumeric';
Expand Down Expand Up @@ -62,6 +63,7 @@ class EditorControls extends Component {

shamefullyClearAxisTypes(graphDiv, payload);
shamefullyAdjustAxisRef(graphDiv, payload);
shamefullyAddTableColumns(graphDiv, payload);

for (let i = 0; i < payload.traceIndexes.length; i++) {
for (const attr in payload.update) {
Expand Down
18 changes: 18 additions & 0 deletions src/shame.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,21 @@ export const shamefullyAdjustGeo = ({layout: {geo = {}}}, {update}) => {
update['geo.center'] = {};
}
};

export const shamefullyAddTableColumns = (graphDiv, {traceIndexes, update}) => {
if (
update['cells.values'] &&
(!graphDiv.data[traceIndexes[0]].header ||
!graphDiv.data[traceIndexes[0]].header.valuessrc)
) {
update['header.values'] = update['cells.valuessrc'];
} else if (update['header.values'] === null) {
update['header.values'] =
graphDiv.data[traceIndexes[0]].cells.valuessrc || null;
} else if (
update['cells.values'] === null &&
!graphDiv.data[traceIndexes[0]].header.valuessrc
Copy link
Contributor

Choose a reason for hiding this comment

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

@VeraZab do we need to use your special from/to functions here to extract an array of data source names?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be ok without any adjustments, as its the data selector itself that handles the from and to src conversions, everywhere else, the editor just uses its own format, its just in that component that we care about it, because that's where the fullValue is matched up to the dataSourceOptions

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, great, thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

it's actually going to show very weird names in strembed, like ~:100:1000, this does nothing to prettify names, its just 2 functions that allow for custom src formatting between the editor and another app.

And those 2 functions are only used in the DataSelector, because that's the only component that has to interface between dataSourceOptions, which can be in a very custom format, and the react-chart-editor's way of handling srcs: array based for multi columns, and string based otherwise.

But these functions won't make the names of srcs prettier..

) {
update['header.values'] = null;
}
};