Skip to content

Commit

Permalink
chore: bump to 1.5.3 and update build
Browse files Browse the repository at this point in the history
  • Loading branch information
scmmishra committed Nov 5, 2020
1 parent 25122f9 commit 92a3df9
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 10 deletions.
16 changes: 14 additions & 2 deletions dist/frappe-charts.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,16 @@ function isValidNumber(candidate, nonNegative=false) {
else return true;
}

/**
* Round a number to the closes precision, max max precision 4
* @param {Number} d Any Number
*/
function round(d) {
// https://floating-point-gui.de/
// https://www.jacklmoore.com/notes/rounding-in-javascript/
return Number(Math.round(d + 'e4') + 'e-4');
}

function getBarHeightAndYAttr(yTop, zeroLine) {
let height, y;
if (yTop <= zeroLine) {
Expand Down Expand Up @@ -1811,6 +1821,7 @@ class AggregationChart extends BaseChart {
configure(args) {
super.configure(args);

this.config.formatTooltipY = args.tooltipOptions.formatTooltipY;
this.config.maxSlices = args.maxSlices || 20;
this.config.maxLegendPoints = args.maxLegendPoints || 20;
}
Expand Down Expand Up @@ -1844,7 +1855,7 @@ class AggregationChart extends BaseChart {

s.labels = [];
totals.map(d => {
s.sliceTotals.push(d[0]);
s.sliceTotals.push(round(d[0]));
s.labels.push(d[1]);
});

Expand Down Expand Up @@ -1877,12 +1888,13 @@ class AggregationChart extends BaseChart {
}
let x = barWidth * count + 5;
let label = this.config.truncateLegends ? truncateString(s.labels[i], barWidth/10) : s.labels[i];
let formatted = this.config.formatTooltipY ? this.config.formatTooltipY(d) : d;
let dot = legendDot(
x,
y,
5,
this.colors[i],
`${label}: ${d}`,
`${label}: ${formatted}`,
false
);
this.legendArea.appendChild(dot);
Expand Down
2 changes: 1 addition & 1 deletion dist/frappe-charts.min.cjs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/frappe-charts.min.cjs.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/frappe-charts.min.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/frappe-charts.min.esm.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/frappe-charts.min.iife.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/frappe-charts.min.iife.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frappe-charts",
"version": "1.5.2",
"version": "1.5.3",
"description": "https://frappe.github.io/charts",
"main": "dist/frappe-charts.min.cjs.js",
"module": "dist/frappe-charts.min.esm.js",
Expand Down
2 changes: 1 addition & 1 deletion src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as Charts from './chart';
let frappe = { };

frappe.NAME = 'Frappe Charts';
frappe.VERSION = '1.5.2';
frappe.VERSION = '1.5.3';

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

Expand Down

0 comments on commit 92a3df9

Please sign in to comment.