Skip to content

Commit

Permalink
Merge pull request #86 from matthew-t-smith/fix/tabular-data
Browse files Browse the repository at this point in the history
Fix: Update column width calculation
  • Loading branch information
diegostruk authored May 7, 2020
2 parents 919549d + 887c745 commit a8a4a1d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions back-end/pyworkflow/pyworkflow/node_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def flow_node(node_key, node_info):
def io_node(node_key, node_info):
if node_key == 'ReadCsvNode':
return ReadCsvNode(node_info)
elif node_key == 'TableCreatorNode':
return TableCreatorNode(node_info)
elif node_key == 'WriteCsvNode':
return WriteCsvNode(node_info)
else:
Expand Down
1 change: 1 addition & 0 deletions back-end/pyworkflow/pyworkflow/nodes/io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from .read_csv import ReadCsvNode
from .write_csv import WriteCsvNode
from .table_creator import TableCreatorNode
12 changes: 8 additions & 4 deletions front-end/src/components/CustomNode/GraphView.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class GraphView extends React.Component {
};

columnWidths = (index) => {
return 10 * this.state.widths[index];
return 12 * this.state.widths[index];
};

rowHeights = () => new Array(765)
Expand Down Expand Up @@ -56,11 +56,15 @@ export default class GraphView extends React.Component {
for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
const row = data[column][rowIndex.toString()];

if (row != null && row.length > widths[index]) {
widths[index] = row.length;
if (row != null) {
const rowContents = row.toString();

if (rowContents.length > widths[index]) {
widths[index] = rowContents.length;
}
}

maxWidth += widths[index] * 10;
maxWidth += widths[index] * 12;
}
}

Expand Down

0 comments on commit a8a4a1d

Please sign in to comment.