mirror of
https://github.com/samsonjs/spirit-tracker.git
synced 2026-03-25 09:25:51 +00:00
UX Improvements
This commit is contained in:
parent
372f69f99d
commit
12c1c87433
1 changed files with 9 additions and 6 deletions
|
|
@ -452,6 +452,9 @@ function computeYBounds(seriesByStore, minSpan = 6, pad = 1) {
|
||||||
|
|
||||||
if (mn === Infinity) return { min: -minSpan / 2, max: minSpan / 2 };
|
if (mn === Infinity) return { min: -minSpan / 2, max: minSpan / 2 };
|
||||||
|
|
||||||
|
mn = Math.min(mn, 0);
|
||||||
|
mx = Math.max(mx, 0);
|
||||||
|
|
||||||
// pad a bit so lines aren't glued to edges
|
// pad a bit so lines aren't glued to edges
|
||||||
mn = Math.floor(mn - pad);
|
mn = Math.floor(mn - pad);
|
||||||
mx = Math.ceil(mx + pad);
|
mx = Math.ceil(mx + pad);
|
||||||
|
|
@ -785,17 +788,17 @@ export async function renderStats($app) {
|
||||||
|
|
||||||
ticks: {
|
ticks: {
|
||||||
stepSize: 1,
|
stepSize: 1,
|
||||||
|
precision: 0,
|
||||||
|
autoSkip: false, // <- don't skip integer ticks
|
||||||
callback: (v) => `${Number(v).toFixed(0)}%`,
|
callback: (v) => `${Number(v).toFixed(0)}%`,
|
||||||
maxTicksLimit: 12,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
grid: {
|
grid: {
|
||||||
drawBorder: false,
|
drawBorder: false,
|
||||||
color: (ctx) => {
|
color: (ctx) =>
|
||||||
// Only draw for integer % values
|
ctx.tick.value === 0
|
||||||
if (!Number.isInteger(ctx.tick.value)) return "transparent";
|
? "rgba(154,166,178,0.35)"
|
||||||
return ctx.tick.value === 0 ? "rgba(154,166,178,0.35)" : "rgba(154,166,178,0.18)";
|
: "rgba(154,166,178,0.18)",
|
||||||
},
|
|
||||||
lineWidth: 1,
|
lineWidth: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue