This commit is contained in:
Thomas Nordquist
2019-01-20 19:05:33 +01:00
parent 1719876734
commit 9bf3973160
2 changed files with 4 additions and 4 deletions

View File

@@ -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>
) )

View File

@@ -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),
} }
}) })