Skip to content

Commit

Permalink
feat: Issue 241 - add support for labelFontColor as update() parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
deezone committed Nov 17, 2019
1 parent 0bcafb4 commit 4d04998
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions justgage.js
Original file line number Diff line number Diff line change
Expand Up @@ -1003,23 +1003,19 @@
* @param val {Number|String} val The value to be assigned to the option
*
* Alternative signature
* @param options (Array) options name and value
* @param options {String|Object} options name and value
*/
JustGage.prototype.update = function (options, val) {
const obj = this;

// support options as array of key values
if (options instanceof Array) {
// options as an object of option/val values
if (options instanceof Object) {
for (var option in options) {
val = options[option];

console.log(`option: ${option}`);
console.log(`val: ${val}`);

updateProp(obj, option, val);
}

// support options as single option / val pair
// options as single option/val
} else {
updateProp(obj, options, val);
}
Expand All @@ -1044,6 +1040,25 @@
'fill': val
});
break;

case 'labelFontColor':
if (!isHexNumber(val)) {
console.log('* justgage: the updated labelFontColor value is not a valid hex value');
break;
}

obj.txtMin.attr({
"fill": val,
});
obj.txtMax.attr({
"fill": val,
});
obj.txtLabel.attr({
"fill": val,
});

break;

default:
console.log(`* justgage: "${option}" is not a supported update setting`);
}
Expand All @@ -1063,7 +1078,6 @@
this.events = {}
};


/**
* Generate Shadow
*
Expand Down

0 comments on commit 4d04998

Please sign in to comment.