vmui: fixed yaxis labels (#2448)

This commit is contained in:
Dmytro Kozlov 2022-04-12 15:12:06 +03:00 committed by Aliaksandr Valialkin
parent 4197c61ef8
commit 46a1e28ed7
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -29,10 +29,7 @@ export const defaultOptions = {
}; };
export const formatTicks = (u: uPlot, ticks: number[], unit = ""): string[] => { export const formatTicks = (u: uPlot, ticks: number[], unit = ""): string[] => {
return ticks.map(v => { return ticks.map(v => `${v.toLocaleString()} ${unit}`);
const n = Math.abs(v);
return `${n > 1e-3 && n < 1e4 ? v.toString() : v.toExponential(1)} ${unit}`;
});
}; };
interface AxisExtend extends Axis { interface AxisExtend extends Axis {