diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e3be76..76f78f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [v1.4.2](https://github.com/toorshia/justgage/compare/v1.4.1...v1.4.2) + +> 15 February 2021 + +- fix: refresh with min/max 0 [`#360`](https://github.com/toorshia/justgage/pull/360) +- fix: refresh with min/max 0 (#360) [`#359`](https://github.com/toorshia/justgage/issues/359) + #### [v1.4.1](https://github.com/toorshia/justgage/compare/v1.4.0...v1.4.1) > 10 February 2021 @@ -11,6 +18,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - feat: labelFontFamily [`#358`](https://github.com/toorshia/justgage/pull/358) - chore: bump ini from 1.3.5 to 1.3.7 [`#357`](https://github.com/toorshia/justgage/pull/357) - chore: bump lodash from 4.17.15 to 4.17.19 [`#353`](https://github.com/toorshia/justgage/pull/353) +- Release 1.4.1 [`9052a03`](https://github.com/toorshia/justgage/commit/9052a0385e2511e53cd083574a62438b60c40437) #### [v1.4.0](https://github.com/toorshia/justgage/compare/v1.3.5...v1.4.0) diff --git a/docs/justgage.js b/docs/justgage.js index dd31e0a..19d0d67 100644 --- a/docs/justgage.js +++ b/docs/justgage.js @@ -609,14 +609,14 @@ obj.gauge = obj.canvas.path().attr({ "stroke": "none", "fill": obj.config.gaugeColor, - pki: [ obj.config.max ] + pki: [obj.config.max] }); // level obj.level = obj.canvas.path().attr({ "stroke": "none", "fill": getColor(obj.config.value, (obj.config.value - obj.config.min) / (obj.config.max - obj.config.min), obj.config.levelColors, obj.config.noGradient, obj.config.customSectors), - pki: [ obj.config.min ] + pki: [obj.config.min] }); if (obj.config.donut) { obj.level.transform("r" + obj.config.donutStartAngle + ", " + (obj.params.widgetW / 2 + obj.params.dx) + ", " + (obj.params.widgetH / 2 + obj.params.dy)); @@ -629,7 +629,7 @@ "stroke-width": !isUndefined(obj.config.pointerOptions.stroke_width) ? obj.config.pointerOptions.stroke_width : 0, "stroke-linecap": !isUndefined(obj.config.pointerOptions.stroke_linecap) ? obj.config.pointerOptions.stroke_linecap : "square", "fill": !isUndefined(obj.config.pointerOptions.color) ? obj.config.pointerOptions.color : "#000000", - ndl: [ obj.config.min ] + ndl: [obj.config.min] }); if (obj.config.donut) { @@ -787,12 +787,12 @@ rvl = (obj.config.max * 1) + (obj.config.min * 1) - (obj.config.value * 1); } obj.level.animate({ - pki: [ rvl ] + pki: [rvl] }, obj.config.startAnimationTime, obj.config.startAnimationType, obj.config.onAnimationEnd); if (obj.config.pointer) { obj.needle.animate({ - ndl: [ rvl ] + ndl: [rvl] }, obj.config.startAnimationTime, obj.config.startAnimationType); } @@ -816,7 +816,7 @@ eventName += '.' + this.level.id //check for existing bind events - if(this.events[eventName]) + if (this.events[eventName]) Raphael.eve.off(eventName, this.events[eventName]) Raphael.eve.on(eventName, func); @@ -838,8 +838,8 @@ var obj = this; var displayVal, color; - max = max || null; - min = min || null; + max = isNumber(max) ? max : null + min = isNumber(min) ? min : null label = label || null; // set label min @@ -941,13 +941,13 @@ } obj.level.animate({ - pki: [ rvl ], + pki: [rvl], "fill": color }, obj.config.refreshAnimationTime, obj.config.refreshAnimationType, obj.config.onAnimationEnd); if (obj.config.pointer) { obj.needle.animate({ - ndl: [ rvl ] + ndl: [rvl] }, obj.config.refreshAnimationTime, obj.config.refreshAnimationType); } @@ -974,7 +974,7 @@ updateProp(obj, option, val); } - // options as single option/val + // options as single option/val } else { updateProp(obj, options, val); } @@ -1030,7 +1030,7 @@ JustGage.prototype.destroy = function () { if (this.node && this.node.parentNode) this.node.innerHTML = '' - for(var event in this.events) { + for (var event in this.events) { Raphael.eve.off(event, this.events[event]) } @@ -1333,5 +1333,9 @@ return out; }; + function isNumber(n) { + return n !== null && n !== undefined && !isNaN(n) + } + return JustGage })); diff --git a/package-lock.json b/package-lock.json index 7c367d2..969eee1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "justgage", - "version": "1.4.1", + "version": "1.4.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index cba81d9..669db54 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "justgage", - "version": "1.4.1", + "version": "1.4.2", "description": "JustGage is a handy JavaScript plugin for generating and animating nice & clean gauges. It is based on Raphaël library for vector drawing, so it’s completely resolution independent and self-adjusting.", "main": "index.js", "scripts": {