Skip to content

Commit 92a3df9

Browse files
committed
chore: bump to 1.5.3 and update build
1 parent 25122f9 commit 92a3df9

9 files changed

+22
-10
lines changed

dist/frappe-charts.esm.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,16 @@ function isValidNumber(candidate, nonNegative=false) {
377377
else return true;
378378
}
379379

380+
/**
381+
* Round a number to the closes precision, max max precision 4
382+
* @param {Number} d Any Number
383+
*/
384+
function round(d) {
385+
// https://floating-point-gui.de/
386+
// https://www.jacklmoore.com/notes/rounding-in-javascript/
387+
return Number(Math.round(d + 'e4') + 'e-4');
388+
}
389+
380390
function getBarHeightAndYAttr(yTop, zeroLine) {
381391
let height, y;
382392
if (yTop <= zeroLine) {
@@ -1811,6 +1821,7 @@ class AggregationChart extends BaseChart {
18111821
configure(args) {
18121822
super.configure(args);
18131823

1824+
this.config.formatTooltipY = args.tooltipOptions.formatTooltipY;
18141825
this.config.maxSlices = args.maxSlices || 20;
18151826
this.config.maxLegendPoints = args.maxLegendPoints || 20;
18161827
}
@@ -1844,7 +1855,7 @@ class AggregationChart extends BaseChart {
18441855

18451856
s.labels = [];
18461857
totals.map(d => {
1847-
s.sliceTotals.push(d[0]);
1858+
s.sliceTotals.push(round(d[0]));
18481859
s.labels.push(d[1]);
18491860
});
18501861

@@ -1877,12 +1888,13 @@ class AggregationChart extends BaseChart {
18771888
}
18781889
let x = barWidth * count + 5;
18791890
let label = this.config.truncateLegends ? truncateString(s.labels[i], barWidth/10) : s.labels[i];
1891+
let formatted = this.config.formatTooltipY ? this.config.formatTooltipY(d) : d;
18801892
let dot = legendDot(
18811893
x,
18821894
y,
18831895
5,
18841896
this.colors[i],
1885-
`${label}: ${d}`,
1897+
`${label}: ${formatted}`,
18861898
false
18871899
);
18881900
this.legendArea.appendChild(dot);

dist/frappe-charts.min.cjs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/frappe-charts.min.cjs.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/frappe-charts.min.esm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/frappe-charts.min.esm.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/frappe-charts.min.iife.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/frappe-charts.min.iife.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frappe-charts",
3-
"version": "1.5.2",
3+
"version": "1.5.3",
44
"description": "https://frappe.github.io/charts",
55
"main": "dist/frappe-charts.min.cjs.js",
66
"module": "dist/frappe-charts.min.esm.js",

src/js/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as Charts from './chart';
33
let frappe = { };
44

55
frappe.NAME = 'Frappe Charts';
6-
frappe.VERSION = '1.5.2';
6+
frappe.VERSION = '1.5.3';
77

88
frappe = Object.assign({ }, frappe, Charts);
99

0 commit comments

Comments
 (0)