@fishawack/lab-d3
Advanced tools
Comparing version 2.2.3 to 2.2.4
{ | ||
"name": "@fishawack/lab-d3", | ||
"version": "2.2.3", | ||
"version": "2.2.4", | ||
"description": "Abstract layer built on top of d3", | ||
@@ -5,0 +5,0 @@ "vars": { |
@@ -232,2 +232,5 @@ ## Background | ||
### v2.2.4 | ||
* Harvey ball reset bug fix | ||
### v2.2.3 | ||
@@ -234,0 +237,0 @@ * Fixed bug in callback reset where it doesn't check if there actually is an active state before resetting |
@@ -141,3 +141,3 @@ "use strict"; | ||
}, | ||
reset: function reset(sync) { | ||
reset: function reset() { | ||
var original = this.store.data; | ||
@@ -144,0 +144,0 @@ this.data([]).renderSync().att({ |
@@ -11,2 +11,4 @@ "use strict"; | ||
function Harveyball(selector) { | ||
var _this = this; | ||
if (!selector) { | ||
@@ -23,3 +25,19 @@ return null; | ||
this.store.chart.classed(this.store.name, true); | ||
Shared.extend(this.store, {}); | ||
var _modify = this.store.modify; | ||
Shared.extend(this.store, { | ||
modify: function modify(data) { | ||
var local = _this.store, | ||
att = local.att; // Add a slice that takes up the rest of the circle | ||
// If data array is empty that slice should be full totalCount | ||
if (data.length) { | ||
return _modify(data.concat([{ | ||
key: 'harveyball_remaining', | ||
value: att.totalCount - (local.data[0] != null ? local.data[0].value : att.totalCount) | ||
}])); | ||
} | ||
return _modify(data); | ||
} | ||
}); | ||
this.att({ | ||
@@ -39,14 +57,2 @@ innerRadiusFade: null | ||
Harveyball.prototype.data = function (value) { | ||
var local = this.store, | ||
att = local.att; | ||
Chart_Pie.prototype.data.call(this, value); | ||
local.data = local.data.slice(); | ||
local.data.push({ | ||
key: 'harveyball_remaining', | ||
value: att.totalCount - local.data[0].value | ||
}); | ||
return this; | ||
}; | ||
Harveyball.prototype._additionalSetup = function () { | ||
@@ -53,0 +59,0 @@ var local = this.store, |
558454
5385
530