Feature/improve tick abbreviation function (#1828)

* Keep the value if value smaller than 1000

* Update changelog
This commit is contained in:
Thomas Kaul
2023-04-07 17:09:34 +02:00
committed by GitHub
parent 9bce57894e
commit 36298b217e
2 changed files with 8 additions and 1 deletions

View File

@@ -131,5 +131,11 @@ export function getVerticalHoverLinePlugin(
}
export function transformTickToAbbreviation(value: number) {
return value < 1000000 ? `${value / 1000}K` : `${value / 1000000}M`;
if (value >= -999 && value <= 999) {
return value.toString();
} else if (value >= -999999 && value <= 999999) {
return `${value / 1000}K`;
} else {
return `${value / 1000000}M`;
}
}