fix bug with fieldNames not updating in time for calculating column size

pull/3039/head
Iris Scholten 2018-03-23 12:40:31 -07:00
parent 2e42347dd3
commit e81eb752cb
3 changed files with 15 additions and 18 deletions

View File

@ -140,8 +140,6 @@ export class TableOptions extends PureComponent<Props, {}> {
return tableOptionsDifferent || dataLabelsDifferent
}
public handleToggleTextWrapping = () => {}
public render() {
const {
tableOptions: {timeFormat, fieldNames, verticalTimeAxis, fixFirstColumn},

View File

@ -122,7 +122,7 @@ class LineGraph extends Component {
staticLegend={staticLegend}
isGraphFilled={showSingleStat ? false : isGraphFilled}
>
{showSingleStat && (
{showSingleStat &&
<SingleStat
prefix={prefix}
suffix={suffix}
@ -130,27 +130,24 @@ class LineGraph extends Component {
lineGraph={true}
colors={colors}
cellHeight={cellHeight}
/>
)}
/>}
</Dygraph>
</div>
)
}
}
const GraphLoadingDots = () => (
const GraphLoadingDots = () =>
<div className="graph-panel__refreshing">
<div />
<div />
<div />
</div>
)
const GraphSpinner = () => (
const GraphSpinner = () =>
<div className="graph-fetching">
<div className="graph-spinner" />
</div>
)
const {array, arrayOf, bool, func, number, shape, string} = PropTypes

View File

@ -195,10 +195,14 @@ class TableGraph extends Component {
calculateColumnWidth = columnSizerWidth => column => {
const {index} = column
const {tableOptions: {verticalTimeAxis, fieldNames}} = this.props
const {timeColumnWidth} = this.state
const {timeColumnWidth, processedData} = this.state
if (fieldNames.length > 0) {
return verticalTimeAxis && fieldNames[index].internalName === 'time'
const labels = verticalTimeAxis
? _.unzip(processedData)[0]
: processedData[0]
if (labels.length > 0) {
return verticalTimeAxis && labels[index] === 'time'
? timeColumnWidth
: columnSizerWidth
}
@ -342,14 +346,14 @@ class TableGraph extends Component {
ref={gridContainer => (this.gridContainer = gridContainer)}
onMouseOut={this.handleMouseOut}
>
{rowCount > 0 && (
{rowCount > 0 &&
<ColumnSizer
columnCount={columnCount}
columnMaxWidth={COLUMN_MAX_WIDTH}
columnMinWidth={COLUMN_MIN_WIDTH}
width={tableWidth}
>
{({getColumnWidth, registerChild}) => (
{({getColumnWidth, registerChild}) =>
<MultiGrid
ref={registerChild}
columnCount={columnCount}
@ -373,10 +377,8 @@ class TableGraph extends Component {
colors={colors}
tableOptions={tableOptions}
classNameBottomRightGrid="table-graph--scroll-window"
/>
)}
</ColumnSizer>
)}
/>}
</ColumnSizer>}
</div>
)
}