fix bug with fieldNames not updating in time for calculating column size
parent
2e42347dd3
commit
e81eb752cb
|
@ -140,8 +140,6 @@ export class TableOptions extends PureComponent<Props, {}> {
|
|||
return tableOptionsDifferent || dataLabelsDifferent
|
||||
}
|
||||
|
||||
public handleToggleTextWrapping = () => {}
|
||||
|
||||
public render() {
|
||||
const {
|
||||
tableOptions: {timeFormat, fieldNames, verticalTimeAxis, fixFirstColumn},
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue