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
|
return tableOptionsDifferent || dataLabelsDifferent
|
||||||
}
|
}
|
||||||
|
|
||||||
public handleToggleTextWrapping = () => {}
|
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const {
|
const {
|
||||||
tableOptions: {timeFormat, fieldNames, verticalTimeAxis, fixFirstColumn},
|
tableOptions: {timeFormat, fieldNames, verticalTimeAxis, fixFirstColumn},
|
||||||
|
|
|
@ -122,7 +122,7 @@ class LineGraph extends Component {
|
||||||
staticLegend={staticLegend}
|
staticLegend={staticLegend}
|
||||||
isGraphFilled={showSingleStat ? false : isGraphFilled}
|
isGraphFilled={showSingleStat ? false : isGraphFilled}
|
||||||
>
|
>
|
||||||
{showSingleStat && (
|
{showSingleStat &&
|
||||||
<SingleStat
|
<SingleStat
|
||||||
prefix={prefix}
|
prefix={prefix}
|
||||||
suffix={suffix}
|
suffix={suffix}
|
||||||
|
@ -130,27 +130,24 @@ class LineGraph extends Component {
|
||||||
lineGraph={true}
|
lineGraph={true}
|
||||||
colors={colors}
|
colors={colors}
|
||||||
cellHeight={cellHeight}
|
cellHeight={cellHeight}
|
||||||
/>
|
/>}
|
||||||
)}
|
|
||||||
</Dygraph>
|
</Dygraph>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const GraphLoadingDots = () => (
|
const GraphLoadingDots = () =>
|
||||||
<div className="graph-panel__refreshing">
|
<div className="graph-panel__refreshing">
|
||||||
<div />
|
<div />
|
||||||
<div />
|
<div />
|
||||||
<div />
|
<div />
|
||||||
</div>
|
</div>
|
||||||
)
|
|
||||||
|
|
||||||
const GraphSpinner = () => (
|
const GraphSpinner = () =>
|
||||||
<div className="graph-fetching">
|
<div className="graph-fetching">
|
||||||
<div className="graph-spinner" />
|
<div className="graph-spinner" />
|
||||||
</div>
|
</div>
|
||||||
)
|
|
||||||
|
|
||||||
const {array, arrayOf, bool, func, number, shape, string} = PropTypes
|
const {array, arrayOf, bool, func, number, shape, string} = PropTypes
|
||||||
|
|
||||||
|
|
|
@ -195,10 +195,14 @@ class TableGraph extends Component {
|
||||||
calculateColumnWidth = columnSizerWidth => column => {
|
calculateColumnWidth = columnSizerWidth => column => {
|
||||||
const {index} = column
|
const {index} = column
|
||||||
const {tableOptions: {verticalTimeAxis, fieldNames}} = this.props
|
const {tableOptions: {verticalTimeAxis, fieldNames}} = this.props
|
||||||
const {timeColumnWidth} = this.state
|
const {timeColumnWidth, processedData} = this.state
|
||||||
|
|
||||||
if (fieldNames.length > 0) {
|
const labels = verticalTimeAxis
|
||||||
return verticalTimeAxis && fieldNames[index].internalName === 'time'
|
? _.unzip(processedData)[0]
|
||||||
|
: processedData[0]
|
||||||
|
|
||||||
|
if (labels.length > 0) {
|
||||||
|
return verticalTimeAxis && labels[index] === 'time'
|
||||||
? timeColumnWidth
|
? timeColumnWidth
|
||||||
: columnSizerWidth
|
: columnSizerWidth
|
||||||
}
|
}
|
||||||
|
@ -342,14 +346,14 @@ class TableGraph extends Component {
|
||||||
ref={gridContainer => (this.gridContainer = gridContainer)}
|
ref={gridContainer => (this.gridContainer = gridContainer)}
|
||||||
onMouseOut={this.handleMouseOut}
|
onMouseOut={this.handleMouseOut}
|
||||||
>
|
>
|
||||||
{rowCount > 0 && (
|
{rowCount > 0 &&
|
||||||
<ColumnSizer
|
<ColumnSizer
|
||||||
columnCount={columnCount}
|
columnCount={columnCount}
|
||||||
columnMaxWidth={COLUMN_MAX_WIDTH}
|
columnMaxWidth={COLUMN_MAX_WIDTH}
|
||||||
columnMinWidth={COLUMN_MIN_WIDTH}
|
columnMinWidth={COLUMN_MIN_WIDTH}
|
||||||
width={tableWidth}
|
width={tableWidth}
|
||||||
>
|
>
|
||||||
{({getColumnWidth, registerChild}) => (
|
{({getColumnWidth, registerChild}) =>
|
||||||
<MultiGrid
|
<MultiGrid
|
||||||
ref={registerChild}
|
ref={registerChild}
|
||||||
columnCount={columnCount}
|
columnCount={columnCount}
|
||||||
|
@ -373,10 +377,8 @@ class TableGraph extends Component {
|
||||||
colors={colors}
|
colors={colors}
|
||||||
tableOptions={tableOptions}
|
tableOptions={tableOptions}
|
||||||
classNameBottomRightGrid="table-graph--scroll-window"
|
classNameBottomRightGrid="table-graph--scroll-window"
|
||||||
/>
|
/>}
|
||||||
)}
|
</ColumnSizer>}
|
||||||
</ColumnSizer>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue