Fix conversion mean - hz

This commit is contained in:
Alfred Melch 2019-08-05 14:05:06 +02:00
parent ba3813c1f4
commit 41c82cfe9b

View File

@ -37,16 +37,16 @@ class WasmVsJsChart extends React.Component {
values: 'mean'
}
}
convertDataToHz() {
let datasets = this.props.data.datasets
convertDataToHz(data) {
let datasets = data.datasets
for (let dataset of datasets.filter(d => d.label !== 'numberOfNodes')) {
dataset.data = dataset.data.map(mean => 1000 / mean)
}
}
render() {
let data = this.props.data
let data = JSON.parse(JSON.stringify(this.props.data)) // deep copy
let options = genOptions('Wasm vs. JavaScript', false, this.state.scaleY)
if (this.state.values === 'hz') this.convertDataToHz()
if (this.state.values === 'hz') this.convertDataToHz(data)
return (
<>
<Line height={400} width={400} data={data} options={options} />