mirror of
https://github.com/denoland/deno.git
synced 2025-01-18 11:53:59 -05:00
y label fix
This commit is contained in:
parent
f44ecdff97
commit
c0f70ea868
1 changed files with 46 additions and 29 deletions
|
@ -126,10 +126,34 @@ export function formatBytes(a, b) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} id The id of dom element
|
* @param {string} id The id of dom element
|
||||||
|
* @param {string[]} categories categories for x-axis values
|
||||||
* @param {any[][]} columns The columns data
|
* @param {any[][]} columns The columns data
|
||||||
* @param {string[]} categories The sha1 hashes (which work as x-axis values)
|
* @param {function} onclick action on clicking nodes of chart
|
||||||
|
* @param {string} yLabel label of y axis
|
||||||
|
* @param {function} yTickFormat formatter of y axis ticks
|
||||||
*/
|
*/
|
||||||
function gen2(id, categories, columns, onclick) {
|
function gen2(
|
||||||
|
id,
|
||||||
|
categories,
|
||||||
|
columns,
|
||||||
|
onclick,
|
||||||
|
yLabel = "",
|
||||||
|
yTickFormat = null
|
||||||
|
) {
|
||||||
|
const xFormat = {
|
||||||
|
type: "category",
|
||||||
|
show: false,
|
||||||
|
categories
|
||||||
|
};
|
||||||
|
const yFormat = {
|
||||||
|
label: yLabel
|
||||||
|
};
|
||||||
|
if (yTickFormat) {
|
||||||
|
yFormat.tick = {
|
||||||
|
format: yTickFormat
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
c3.generate({
|
c3.generate({
|
||||||
bindto: id,
|
bindto: id,
|
||||||
size: {
|
size: {
|
||||||
|
@ -141,14 +165,8 @@ function gen2(id, categories, columns, onclick) {
|
||||||
onclick
|
onclick
|
||||||
},
|
},
|
||||||
axis: {
|
axis: {
|
||||||
x: {
|
x: xFormat,
|
||||||
type: "category",
|
y: yFormat
|
||||||
show: false,
|
|
||||||
categories
|
|
||||||
},
|
|
||||||
y: {
|
|
||||||
label: "seconds"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -188,26 +206,23 @@ export async function drawChartsFromBenchmarkData(dataUrl) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function gen(id, columns) {
|
function gen(id, columns, yLabel = "", yTickFormat = null) {
|
||||||
gen2(id, sha1ShortList, columns, viewCommitOnClick(sha1List));
|
gen2(
|
||||||
|
id,
|
||||||
|
sha1ShortList,
|
||||||
|
columns,
|
||||||
|
viewCommitOnClick(sha1List),
|
||||||
|
yLabel,
|
||||||
|
yTickFormat
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
gen("#exec-time-chart", execTimeColumns);
|
gen("#exec-time-chart", execTimeColumns, "seconds");
|
||||||
gen("#throughput-chart", throughputColumns);
|
gen("#throughput-chart", throughputColumns, "seconds");
|
||||||
gen("#req-per-sec-chart", reqPerSecColumns);
|
gen("#req-per-sec-chart", reqPerSecColumns, "# req/sec");
|
||||||
|
gen("#binary-size-chart", binarySizeColumns, "size", formatBytes);
|
||||||
/* TODO
|
gen("#thread-count-chart", threadCountColumns, "# threads");
|
||||||
axis: {
|
gen("#syscall-count-chart", syscallCountColumns, "# syscalls");
|
||||||
y: {
|
|
||||||
tick: {
|
|
||||||
format: d => formatBytes(d)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
gen("#binary-size-chart", binarySizeColumns);
|
|
||||||
gen("#thread-count-chart", threadCountColumns);
|
|
||||||
gen("#syscall-count-chart", syscallCountColumns);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -228,6 +243,8 @@ export async function drawChartsFromTravisData() {
|
||||||
"#travis-compile-time-chart",
|
"#travis-compile-time-chart",
|
||||||
prNumberList,
|
prNumberList,
|
||||||
travisCompileTimeColumns,
|
travisCompileTimeColumns,
|
||||||
viewPullRequestOnClick(prNumberList)
|
viewPullRequestOnClick(prNumberList),
|
||||||
|
"time",
|
||||||
|
formatSeconds
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue