Fix plot
This commit is contained in:
@@ -55,7 +55,7 @@ class MessageHistory extends React.Component<Props, State> {
|
|||||||
value: message.value,
|
value: message.value,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const numericMessages = history.filter(message => !isNaN(message.value))
|
const numericMessages = history.filter(message => !isNaN(parseFloat(message.value)))
|
||||||
const showPlot = numericMessages.length >= 2
|
const showPlot = numericMessages.length >= 2
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -65,7 +65,7 @@ class MessageHistory extends React.Component<Props, State> {
|
|||||||
contentTypeIndicator={showPlot ? <BarChart /> : null}
|
contentTypeIndicator={showPlot ? <BarChart /> : null}
|
||||||
onClick={this.displayMessage}
|
onClick={this.displayMessage}
|
||||||
>
|
>
|
||||||
{showPlot ? this.renderPlot(history) : null}
|
{showPlot ? this.renderPlot(numericMessages) : null}
|
||||||
</History>
|
</History>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ class PlotHistory extends React.Component<Props, Stats> {
|
|||||||
public render() {
|
public render() {
|
||||||
const data = this.props.messages.map((message) => {
|
const data = this.props.messages.map((message) => {
|
||||||
return {
|
return {
|
||||||
x: message.received,
|
x: message.received.getTime(),
|
||||||
y: message.value,
|
y: parseFloat(message.value),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user