Skip to content

Commit

Permalink
fix: preprocess rect attributes before creating bar
Browse files Browse the repository at this point in the history
  • Loading branch information
scmmishra committed Jul 8, 2020
1 parent 773f93c commit 222cbb6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/js/utils/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,12 @@ export function datasetBar(x, yTop, width, color, label='', index=0, offset=0, m
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

0 comments on commit 222cbb6

Please sign in to comment.