Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#359 Method Refresh doesn't work with Value zero #360

Merged
merged 2 commits into from
Feb 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions dist/justgage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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);
}

Expand All @@ -974,7 +974,7 @@
updateProp(obj, option, val);
}

// options as single option/val
// options as single option/val
} else {
updateProp(obj, options, val);
}
Expand Down Expand Up @@ -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])
}

Expand Down Expand Up @@ -1333,5 +1333,9 @@
return out;
};

function isNumber(n) {
return n !== null && n !== undefined && !isNaN(n)
}

return JustGage
}));
Loading