diff --git a/src/javascript/components/single/BarChartView.jsx b/src/javascript/components/single/BarChartView.jsx index 052044b..1b12162 100644 --- a/src/javascript/components/single/BarChartView.jsx +++ b/src/javascript/components/single/BarChartView.jsx @@ -24,6 +24,9 @@ export default class BarChartView extends React.Component { render() { const { dataSet, dataMax } = this.props; + const { paramNames } = dataSet; + + const domainMax = dataMax && dataMax > 0 ? Math.round(dataMax) : 'auto'; const chartHeight = 100 + dataSet.data.length * dataSet.barGroups.length * 36; const maxMethodNameLength = dataSet.data.map((element) => element.name.length).reduce((previous, current) => Math.max(previous, current), 32); @@ -50,21 +53,32 @@ export default class BarChartView extends React.Component { }); return ( - - - - - - } cursor={ { stroke: green, strokeWidth: 2 } } wrapperStyle={ { backgroundColor: tooltipBackground, opacity: 0.95 } } /> - - { bars } - - +
+ + + + + + } + cursor={ { stroke: green, strokeWidth: 2 } } + wrapperStyle={ { backgroundColor: tooltipBackground, opacity: 0.95 } } + paramNames={ paramNames } + /> + + { bars } + + + { paramNames.length > 0 && +
Parameter Names: { paramNames.join(':') }

+ } +
); } } diff --git a/src/javascript/components/single/BarDataSet.js b/src/javascript/components/single/BarDataSet.js index cf69c2f..dd803d4 100644 --- a/src/javascript/components/single/BarDataSet.js +++ b/src/javascript/components/single/BarDataSet.js @@ -10,6 +10,7 @@ export default class BarDataSet { this.data = options.data; this.dataMax = options.dataMax; this.roundScores = options.roundScores; + this.paramNames = options.paramNames; } } @@ -32,28 +33,28 @@ export function createDataSetFromBenchmarks(runName, benchmarkBundle, metricExtr if (!params) { //case 0 - return createBarDataSet(id, benchmarkMethods, metricExtractor, (method) => method.name, () => `${metricType} ${scoreUnit}`); + return createBarDataSet(id, benchmarkMethods, metricExtractor, (method) => method.name, () => `${metricType} ${scoreUnit}`, []); } else { // all other cases const paramNames = params.map(param => param[0]); if (paramNames.length == 1) { if (methodCount == 1) { // case 1 - return createBarDataSet(id, benchmarkMethods, metricExtractor, (method) => method.params[0][0] + '=' + method.params[0][1], () => `${metricType} ${scoreUnit}`); + return createBarDataSet(id, benchmarkMethods, metricExtractor, (method) => `${method.params[0][0]} = ${method.params[0][1]}`, () => `${metricType} ${scoreUnit}`, []); } else { // case 2 - return createBarDataSet(id, benchmarkMethods, metricExtractor, (method) => method.name, (method) => method.params[0][1]); + return createBarDataSet(id, benchmarkMethods, metricExtractor, (method) => method.name, (method) => method.params[0][1], paramNames); } } else if (paramNames.length == 2 && methodCount == 1) { // case 3 - return createBarDataSet(id, benchmarkMethods, metricExtractor, (method) => method.params[0][1], (method) => method.params[1][1]); + return createBarDataSet(id, benchmarkMethods, metricExtractor, (method) => `${method.params[0][0]} = ${method.params[0][1]}`, (method) => method.params[1][1], [paramNames[1]]); } else { if (methodCount > 1) { // case 4 - return createBarDataSet(id, benchmarkMethods, metricExtractor, (method) => method.name, (method) => method.params.map(param => param[1]).join(':')); + return createBarDataSet(id, benchmarkMethods, metricExtractor, (method) => method.name, (method) => method.params.map(param => param[1]).join(':'), paramNames); } else { // case 5 const barName = paramNames.join(':'); - return createBarDataSet(id, benchmarkMethods, metricExtractor, (method) => method.params.map(param => param[1]).join(':'), () => barName); + return createBarDataSet(id, benchmarkMethods, metricExtractor, (method) => method.params.map(param => param[1]).join(':'), () => barName, []); } } } @@ -61,7 +62,7 @@ export function createDataSetFromBenchmarks(runName, benchmarkBundle, metricExtr //Each benchmark can have multiple bar's attached -function createBarDataSet(id, benchmarkMethods, metricExtractor, groupFunction, barGroupFunction) { +function createBarDataSet(id, benchmarkMethods, metricExtractor, groupFunction, barGroupFunction, paramNames) { var dataMax = 0; var scoreUnit; const shouldRoundScores = shouldRound(benchmarkMethods, metricExtractor); @@ -112,6 +113,7 @@ function createBarDataSet(id, benchmarkMethods, metricExtractor, groupFunction, barGroups: [...barGroups], data: data, dataMax: dataMax, - roundScores: shouldRoundScores + roundScores: shouldRoundScores, + paramNames: paramNames }); } \ No newline at end of file diff --git a/src/javascript/components/single/SingleRunChartTooltip.jsx b/src/javascript/components/single/SingleRunChartTooltip.jsx index 9592d50..2cc75e4 100644 --- a/src/javascript/components/single/SingleRunChartTooltip.jsx +++ b/src/javascript/components/single/SingleRunChartTooltip.jsx @@ -13,6 +13,7 @@ export default class SingleRunChartTooltip extends Component { static propTypes = { label: PropTypes.any, + paramNames: PropTypes.array, scoreUnit: PropTypes.string, roundScores: PropTypes.bool, payload: PropTypes.arrayOf(PropTypes.shape({ @@ -24,7 +25,7 @@ export default class SingleRunChartTooltip extends Component { }; render() { - const { label, payload, scoreUnit, roundScores } = this.props; + const { label, payload, scoreUnit, roundScores, paramNames } = this.props; if (!payload || payload.length == 0) { return null; } @@ -33,8 +34,8 @@ export default class SingleRunChartTooltip extends Component { const tableHeaders = []; if (payload.length > 1) { tableHeaders.push( - Run - ); + { paramNames.join(':') } + ); } tableHeaders.push( Score