Skip to content

Commit

Permalink
chore: bump to 1.5.2 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
scmmishra committed Jul 8, 2020
1 parent 222cbb6 commit 2572e31
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 11 deletions.
23 changes: 23 additions & 0 deletions dist/frappe-charts.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,19 @@ function getPositionByAngle(angle, radius) {
};
}

/**
* Check if a number is valid for svg attributes
* @param {object} candidate Candidate to test
* @param {Boolean} nonNegative flag to treat negative number as invalid
*/
function isValidNumber(candidate, nonNegative=false) {
if (Number.isNaN(candidate)) return false;
else if (candidate === undefined) return false;
else if (!Number.isFinite(candidate)) return false;
else if (nonNegative && candidate < 0) return false;
else return true;
}

function getBarHeightAndYAttr(yTop, zeroLine) {
let height, y;
if (yTop <= zeroLine) {
Expand Down Expand Up @@ -864,6 +877,8 @@ function makeHoriLine(y, label, x1, x2, options={}) {
}

function yLine(y, label, width, options={}) {
if (!isValidNumber(y)) y = 0;

if(!options.pos) options.pos = 'left';
if(!options.offset) options.offset = 0;
if(!options.mode) options.mode = 'span';
Expand Down Expand Up @@ -892,6 +907,8 @@ function yLine(y, label, width, options={}) {
}

function xLine(x, label, height, options={}) {
if (!isValidNumber(x)) x = 0;

if(!options.pos) options.pos = 'bottom';
if(!options.offset) options.offset = 0;
if(!options.mode) options.mode = 'span';
Expand Down Expand Up @@ -1002,6 +1019,12 @@ function datasetBar(x, yTop, width, color, label='', index=0, offset=0, meta={})
y -= meta.minHeight;
}

// Preprocess numbers to avoid svg building errors
if (!isValidNumber(x)) x = 0;
if (!isValidNumber(y)) y = 0;
if (!isValidNumber(height, true)) height = 0;
if (!isValidNumber(width, true)) width = 0;

let rect = createSVG('rect', {
className: `bar mini`,
style: `fill: ${color}`,
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 docs/assets/js/frappe-charts.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/js/frappe-charts.min.js.map

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions docs/assets/js/index.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/assets/js/index.min.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.1",
"version": "1.5.2",
"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.1';
frappe.VERSION = '1.5.2';

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

Expand Down

0 comments on commit 2572e31

Please sign in to comment.