diff --git a/benchmarking/src/components/chart.js b/benchmarking/src/components/chart.js index e1b7773..32f4b2b 100644 --- a/benchmarking/src/components/chart.js +++ b/benchmarking/src/components/chart.js @@ -47,7 +47,12 @@ class WasmVsJsChart extends React.Component { render() { let data = JSON.parse(JSON.stringify(this.props.data)) // deep copy - let options = genOptions('Wasm vs. JavaScript', false, this.state.scaleY) + let options = genOptions( + 'Wasm vs. JavaScript', + false, + this.state.scaleY, + this.state.values + ) if (this.state.values === 'hz') this.convertDataToHz(data) return ( <> diff --git a/benchmarking/src/components/chartOptions.js b/benchmarking/src/components/chartOptions.js index 193e052..910ef8b 100644 --- a/benchmarking/src/components/chartOptions.js +++ b/benchmarking/src/components/chartOptions.js @@ -26,11 +26,31 @@ export const datasetTemplates = { transformToObjectFormCase: genDataset('transformToObjectFormCase', 'green') } -export function genOptions(title, stacked = false, scaleY = 'linear') { +function genScaleLabel(label) { + return { + display: true, + labelString: label, + fontStyle: 'bold' + } +} + +export function genOptions( + title, + stacked = false, + scaleY = 'linear', + perfUnit = 'mean' +) { + const perfUnitText = { + mean: 'Milliseconds per operation (ms)', + hz: 'Operations per second (hz)' + } return { animation: { duration: 0 }, + legend: { + position: 'bottom' + }, title: { display: true, text: title @@ -46,7 +66,7 @@ export function genOptions(title, stacked = false, scaleY = 'linear') { scales: { xAxes: [ { - // type: scaleX, + scaleLabel: genScaleLabel('Tolerance (length)'), stacked } ], @@ -57,7 +77,8 @@ export function genOptions(title, stacked = false, scaleY = 'linear') { stacked, ticks: { min: 0 - } + }, + scaleLabel: genScaleLabel(`Performance - ${perfUnitText[perfUnit]}`) }, { id: 'nodes', @@ -68,7 +89,8 @@ export function genOptions(title, stacked = false, scaleY = 'linear') { }, ticks: { min: 0 - } + }, + scaleLabel: genScaleLabel('Number of positions in result (#)') } ] }