Hide 0 on y axis

This commit is contained in:
George Lacey 2021-05-10 08:26:06 +01:00
parent 72d85618a3
commit c047fb77cf

View File

@ -31,8 +31,7 @@ function set_daily_graph(repoDict) {
tooltip: { tooltip: {
callbacks: { callbacks: {
label: function (context) { label: function (context) {
var label = context.dataset.label || ''; if (context.parsed.y !== null) {
if (context.parsed.y !== null && y_units !== null) {
return `${context.parsed.y} ${y_units}` return `${context.parsed.y} ${y_units}`
} else { } else {
return "" return ""
@ -43,11 +42,14 @@ function set_daily_graph(repoDict) {
}, },
scales: { scales: {
y: { y: {
ticks: {
display: true, display: true,
grid: false, min: 0,
source: "ticks",
ticks: {
callback: function (value, index, values) { callback: function (value, index, values) {
return value + " " + y_units; if (value !== 0) {
return `${value} ${y_units}`
}
} }
} }
} }
@ -60,3 +62,7 @@ function set_daily_graph(repoDict) {
config config
); );
} }
function getBaseLog(x, y) {
return Math.log(y) / Math.log(x);
}