Skip to content

Commit

Permalink
Release 1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Oct 9, 2019
1 parent 22a5915 commit 04d4986
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 40 deletions.
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ 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.3.2](https://github.com/toorshia/justgage/compare/v1.3.1...v1.3.2)

> 9 October 2019
- [docs] Fixed examples [`585b0ff`](https://github.com/toorshia/justgage/commit/585b0ffdcde2186b6a5ff7507fe45ca65e729e69)
- [docs] Moved justgage.com in docs for github pages [`38400c3`](https://github.com/toorshia/justgage/commit/38400c3ab2cf34b2481508988f85d47d837d78a9)
- [docs] Added examples list to index [`1143a1d`](https://github.com/toorshia/justgage/commit/1143a1d9031f3316bb4dea7b9f36b88bd9c19808)
- [fix] Cleaner events management [`d0af184`](https://github.com/toorshia/justgage/commit/d0af184ad7c9671c9fbf5ff1b01363a0d2bf9af5)
- [docs] Added example with variable min max values [`22a5915`](https://github.com/toorshia/justgage/commit/22a591564305ce8b0f11d55bb40be2a64f467663)
- [refactor] Cleaner code with isUndefined function [`3ac69cf`](https://github.com/toorshia/justgage/commit/3ac69cfcd92cdc7c0f9d0229d34616d56463ae9f)
- [chore] Updated raphael and added map file to release [`9e41515`](https://github.com/toorshia/justgage/commit/9e415157aaa318498215c64b77cf7ca11a4ad06f)
- [docs] Readme links and better list of examples names [`b364a1b`](https://github.com/toorshia/justgage/commit/b364a1b5eb5f65b10c3f7e26aa5fa2715f2b7ab8)
- [fix] Moved level id to bindEvent function [`0a68463`](https://github.com/toorshia/justgage/commit/0a68463a82f837ee2745c14dcf3e6331a304fcf1)
- [docs] Fixed examples links and style [`878bdc4`](https://github.com/toorshia/justgage/commit/878bdc4f59b2af43f2a0ab0109017d163f2792c3)
- [fix] Bug when min is not 0 [`80960ca`](https://github.com/toorshia/justgage/commit/80960ca3614aa8e4a098aed3b478866d675ba62d)
- [docs] Updated readme [`b438b11`](https://github.com/toorshia/justgage/commit/b438b11c6ea8001300780ecb31a1dceba1a26976)
- [docs] Fixed typo [`1fa000f`](https://github.com/toorshia/justgage/commit/1fa000f61645478f1368ea34e3d87d809a8f826b)
- [docs] Typo on readme [`9de25b6`](https://github.com/toorshia/justgage/commit/9de25b6bbe15cf08f9d4a4e42276a8a5b08fc3cb)
- [docs] Fixed regex replace for examples name [`abc1d40`](https://github.com/toorshia/justgage/commit/abc1d4051286230fa81786e3d740121943d765e3)

#### [v1.3.1](https://github.com/toorshia/justgage/compare/v1.3.0...v1.3.1)

> 6 August 2019
Expand All @@ -15,6 +35,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- [docs] Display remaining example and docs [`5af3d23`](https://github.com/toorshia/justgage/commit/5af3d239945209fb50a683d19bb9fe241524a11b)
- [fix] Reverse example customSectors [`350a7db`](https://github.com/toorshia/justgage/commit/350a7db1b72ab1a16ded0a83558317e2029cc9de)
- [feat] Raphael 2.2.8 [`5debfd6`](https://github.com/toorshia/justgage/commit/5debfd6fe975ab78779bef0ce12671e9da88fc78)
- Release 1.3.1 [`d3615af`](https://github.com/toorshia/justgage/commit/d3615affe21c532a1d8e8df20b00c2569bd0c7de)
- [fix] Destroy event and example [`15f3c26`](https://github.com/toorshia/justgage/commit/15f3c269dd525cbd96c4a9a924df5e5bb6a6e7c5)
- [feat] Gruntfile for dist [`b6cd2cb`](https://github.com/toorshia/justgage/commit/b6cd2cb74afb2ee39efb762795bb7769a0c5080b)
- [docs] Methods section [`d6d28cf`](https://github.com/toorshia/justgage/commit/d6d28cf4294e0b62fbe87e5becca81433f8ba459)
Expand All @@ -23,8 +44,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- [feat] Refresh with min value support (back compatible fix) [`b51840c`](https://github.com/toorshia/justgage/commit/b51840c507e155d3982aa0a17b5b8e02b5687145)
- [refactor] Comments [`ca519ed`](https://github.com/toorshia/justgage/commit/ca519ed2461c9cce95b44b5917921dcb5e8f327d)
- [fix] Eve not defined [`81cff4c`](https://github.com/toorshia/justgage/commit/81cff4cd1ef3a57df5575421730b67a2aa3207de)
- [docs] Added label to refresh [`7d21cb9`](https://github.com/toorshia/justgage/commit/7d21cb9b80d60c93210e8ff5e8465cedbc7aabe2)
- [fix] Removed const [`2d1773a`](https://github.com/toorshia/justgage/commit/2d1773a92b508773bc5557fff78350a3fea9c3fe)
- [docs] Added label to refresh [`7d21cb9`](https://github.com/toorshia/justgage/commit/7d21cb9b80d60c93210e8ff5e8465cedbc7aabe2)

#### [v1.3.0](https://github.com/toorshia/justgage/compare/1.2.9...v1.3.0)

Expand Down
110 changes: 77 additions & 33 deletions dist/justgage.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
obj.events = {}

// Helps in case developer wants to debug it. unobtrusive
if (config === null || config === undefined) {
if (isUndefined(config)) {
console.log('* justgage: Make sure to pass options to the constructor!');
return false;
}

if (config.id !== null && config.id !== undefined) {
if (!isUndefined(config.id)) {
obj.node = document.getElementById(config.id);
if (!obj.node) {
console.log('* justgage: No element with id : %s found', config.id);
return false;
}
} else if (config.parentNode !== null && config.parentNode !== undefined) {
} else if (!isUndefined(config.parentNode)) {
obj.node = config.parentNode;
} else {
console.log('* justgage: Make sure to pass the existing element id or parentNode to the constructor.');
Expand All @@ -46,7 +46,7 @@
var dataset = obj.node.dataset ? obj.node.dataset : {};

// check for defaults
var defaults = (config.defaults !== null && config.defaults !== undefined) ? config.defaults : false;
var defaults = !isUndefined(config.defaults) ? config.defaults : false;
if (defaults !== false) {
config = extend({}, config, defaults);
delete config.defaults;
Expand Down Expand Up @@ -441,12 +441,12 @@

path = "M" + (Cx - Ri) + "," + Cy + " ";
path += "L" + (Cx - Ro) + "," + Cy + " ";
if (value > ((max - min) / 2)) {
if (value - min > ((max - min) / 2)) {
path += "A" + Ro + "," + Ro + " 0 0 1 " + (Cx + Ro) + "," + Cy + " ";
}
path += "A" + Ro + "," + Ro + " 0 0 1 " + Xo + "," + Yo + " ";
path += "L" + Xi + "," + Yi + " ";
if (value > ((max - min) / 2)) {
if (value - min > ((max - min) / 2)) {
path += "A" + Ri + "," + Ri + " 0 0 0 " + (Cx + Ri) + "," + Cy + " ";
}
path += "A" + Ri + "," + Ri + " 0 0 0 " + (Cx - Ri) + "," + Cy + " ";
Expand Down Expand Up @@ -614,10 +614,10 @@
if (obj.config.pointer) {
// needle
obj.needle = obj.canvas.path().attr({
"stroke": (obj.config.pointerOptions.stroke !== null && obj.config.pointerOptions.stroke !== undefined) ? obj.config.pointerOptions.stroke : "none",
"stroke-width": (obj.config.pointerOptions.stroke_width !== null && obj.config.pointerOptions.stroke_width !== undefined) ? obj.config.pointerOptions.stroke_width : 0,
"stroke-linecap": (obj.config.pointerOptions.stroke_linecap !== null && obj.config.pointerOptions.stroke_linecap !== undefined) ? obj.config.pointerOptions.stroke_linecap : "square",
"fill": (obj.config.pointerOptions.color !== null && obj.config.pointerOptions.color !== undefined) ? obj.config.pointerOptions.color : "#000000",
"stroke": !isUndefined(obj.config.pointerOptions.stroke) ? obj.config.pointerOptions.stroke : "none",
"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,
obj.config.min,
Expand Down Expand Up @@ -736,10 +736,7 @@

if (obj.config.counter === true) {
//on each animation frame
Raphael.eve.on("raphael.anim.frame." + (obj.level.id), function () {

if(!obj.events["raphael.anim.frame." + (obj.level.id)]) obj.events["raphael.anim.frame." + (obj.level.id)] = this

var onFrame = function () {
var currentValue = obj.level.attr("pki")[0];
if (obj.config.reverse) {
currentValue = (obj.config.max * 1) + (obj.config.min * 1) - (obj.level.attr("pki")[0] * 1);
Expand All @@ -757,28 +754,30 @@
}
setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY);
currentValue = null;
});
//on animation end
Raphael.eve.on("raphael.anim.finish." + (obj.level.id), function () {

if(!obj.events["raphael.anim.finish." + (obj.level.id)]) obj.events["raphael.anim.finish." + (obj.level.id)] = this
}

//on animation end
var onFinish = function () {
obj.txtValue.attr({
"text": obj.originalValue
});
setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY);
});
} else {
//on animation start
Raphael.eve.on("raphael.anim.start." + (obj.level.id), function () {
};

if(!obj.events["raphael.anim.start." + (obj.level.id)]) obj.events["raphael.anim.start." + (obj.level.id)] = this

this.bindEvent("raphael.anim.finish", onFinish)
this.bindEvent("raphael.anim.frame", onFrame)

} else {
//on animation start
var onStart = function () {
obj.txtValue.attr({
"text": obj.originalValue
});
setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY);
});
};

this.bindEvent("raphael.anim.start", onStart)
}

// animate gauge level, value & label
Expand Down Expand Up @@ -825,7 +824,35 @@
}, obj.config.startAnimationTime, obj.config.startAnimationType);
};

/** Refresh gauge level */

/**
* Bind a function to a Raphael eve event
*
* @param {String} eventName Raphael event name
* @param {Function} func The function to call on that event
*/
JustGage.prototype.bindEvent = function (eventName, func) {
// add the level id to the event
eventName += '.' + this.level.id

//check for existing bind events
if(this.events[eventName])
Raphael.eve.off(eventName, this.events[eventName])

Raphael.eve.on(eventName, func);

this.events[eventName] = func
}


/**
* Update Gauge values
*
* @param {Number} val The value
* @param {Number|String} max Max value
* @param {Number|String} min Min value
* @param {String} label The Label
*/
JustGage.prototype.refresh = function (val, max, min, label) {

var obj = this;
Expand Down Expand Up @@ -969,15 +996,28 @@
obj, displayVal, color, max, min = null;
};

/** Destroy gauge object */

/**
* Destroy the Gauge Object and unbind events
*
*/
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])
}

this.events = {}
};

/** Generate shadow */

/**
* Generate Shadow
*
* @param {Object} svg The Svg element Object
* @param {Object} defs The defs element Object
*/
JustGage.prototype.generateShadow = function (svg, defs) {

var obj = this;
Expand Down Expand Up @@ -1055,18 +1095,18 @@
function kvLookup(key, tablea, tableb, defval, datatype, delimiter) {
var val = defval;
var canConvert = false;
if (!(key === null || key === undefined)) {
if (tableb !== null && tableb !== undefined && typeof tableb === "object" && key in tableb) {
if (!isUndefined(key)) {
if (!isUndefined(tableb) && typeof tableb === "object" && key in tableb) {
val = tableb[key];
canConvert = true;
} else if (tablea !== null && tablea !== undefined && typeof tablea === "object" && key in tablea) {
} else if (!isUndefined(tablea) && typeof tablea === "object" && key in tablea) {
val = tablea[key];
canConvert = true;
} else {
val = defval;
}
if (canConvert === true) {
if (datatype !== null && datatype !== undefined) {
if (!isUndefined(datatype)) {
switch (datatype) {
case 'int':
val = parseInt(val, 10);
Expand All @@ -1083,6 +1123,10 @@
return val;
};

function isUndefined(v) {
return v === null || v === undefined
}

/** Get color for value */
function getColor(val, pct, col, noGradient, custSec) {

Expand Down
2 changes: 1 addition & 1 deletion dist/justgage.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/justgage.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/justgage.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,12 @@

path = "M" + (Cx - Ri) + "," + Cy + " ";
path += "L" + (Cx - Ro) + "," + Cy + " ";
if (value > ((max - min) / 2)) {
if (value - min > ((max - min) / 2)) {
path += "A" + Ro + "," + Ro + " 0 0 1 " + (Cx + Ro) + "," + Cy + " ";
}
path += "A" + Ro + "," + Ro + " 0 0 1 " + Xo + "," + Yo + " ";
path += "L" + Xi + "," + Yi + " ";
if (value > ((max - min) / 2)) {
if (value - min > ((max - min) / 2)) {
path += "A" + Ri + "," + Ri + " 0 0 0 " + (Cx + Ri) + "," + Cy + " ";
}
path += "A" + Ri + "," + Ri + " 0 0 0 " + (Cx - Ri) + "," + Cy + " ";
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "justgage",
"version": "1.3.1",
"version": "1.3.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": {
Expand Down

0 comments on commit 04d4986

Please sign in to comment.