Improve graphs
This commit is contained in:
parent
c9b0e7a50d
commit
bd95d0d51b
|
@ -67,11 +67,15 @@ const colours = [
|
||||||
borderColor: '#4bc0c0',
|
borderColor: '#4bc0c0',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const renderChart = async (file, cfg) => {
|
const renderChart = async (file, title, cfg) => {
|
||||||
const chart = new chartjs(450, 300);
|
const chart = new chartjs(435, 320);
|
||||||
await chart.drawChart({
|
await chart.drawChart({
|
||||||
...cfg,
|
...cfg,
|
||||||
options: {
|
options: {
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: title,
|
||||||
|
},
|
||||||
scales: {
|
scales: {
|
||||||
xAxes: [{
|
xAxes: [{
|
||||||
barPercentage: 0.5,
|
barPercentage: 0.5,
|
||||||
|
@ -144,7 +148,7 @@ suite
|
||||||
count: b.count,
|
count: b.count,
|
||||||
ops: b.hz,
|
ops: b.hz,
|
||||||
})).sort((a, b) => a.hz - b.hz);
|
})).sort((a, b) => a.hz - b.hz);
|
||||||
await renderChart('speed', {
|
await renderChart('speed', 'Minification speed', {
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: {
|
data: {
|
||||||
labels: speedResults.map(r => r.name),
|
labels: speedResults.map(r => r.name),
|
||||||
|
@ -158,7 +162,7 @@ suite
|
||||||
|
|
||||||
const testNames = Object.keys(sizes);
|
const testNames = Object.keys(sizes);
|
||||||
const programNames = Object.keys(programs);
|
const programNames = Object.keys(programs);
|
||||||
await renderChart('minification', {
|
await renderChart('minification', 'Relative minified HTML file size', {
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
scaleFontColor: 'red',
|
scaleFontColor: 'red',
|
||||||
data: {
|
data: {
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 30 KiB |
BIN
bench/speed.png
BIN
bench/speed.png
Binary file not shown.
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 9.9 KiB |
Loading…
Reference in New Issue