offices-viewer
Version:
## Current Renderable File Types
5,836 lines • 302 kB
JavaScript
// src/drivers/chart/nv.d3.min.js
!function() {
var a = {};
a.dev = false, a.tooltip = a.tooltip || {}, a.utils = a.utils || {}, a.models = a.models || {}, a.charts = {}, a.logs = {}, a.dom = {}, a.dispatch = d3.dispatch("render_start", "render_end"), Function.prototype.bind || (Function.prototype.bind = function(a2) {
if ("function" != typeof this)
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
var b = Array.prototype.slice.call(arguments, 1), c = this, d = function() {
}, e = function() {
return c.apply(this instanceof d && a2 ? this : a2, b.concat(Array.prototype.slice.call(arguments)));
};
return d.prototype = this.prototype, e.prototype = new d(), e;
}), a.dev && (a.dispatch.on("render_start", function(b) {
a.logs.startTime = +/* @__PURE__ */ new Date();
}), a.dispatch.on("render_end", function(b) {
a.logs.endTime = +/* @__PURE__ */ new Date(), a.logs.totalTime = a.logs.endTime - a.logs.startTime, a.log("total", a.logs.totalTime);
})), a.log = function() {
if (a.dev && window.console && console.log && console.log.apply)
console.log.apply(console, arguments);
else if (a.dev && window.console && "function" == typeof console.log && Function.prototype.bind) {
var b = Function.prototype.bind.call(console.log, console);
b.apply(console, arguments);
}
return arguments[arguments.length - 1];
}, a.deprecated = function(a2, b) {
console && console.warn && console.warn("nvd3 warning: `" + a2 + "` has been deprecated. ", b || "");
}, a.render = function(b) {
b = b || 1, a.render.active = true, a.dispatch.render_start();
var c = function() {
for (var d, e, f = 0; b > f && (e = a.render.queue[f]); f++)
d = e.generate(), typeof e.callback == typeof Function && e.callback(d);
a.render.queue.splice(0, f), a.render.queue.length ? setTimeout(c) : (a.dispatch.render_end(), a.render.active = false);
};
setTimeout(c);
}, a.render.active = false, a.render.queue = [], a.addGraph = function(b) {
typeof arguments[0] == typeof Function && (b = { generate: arguments[0], callback: arguments[1] }), a.render.queue.push(b), a.render.active || a.render();
}, "undefined" != typeof module && "undefined" != typeof exports && (module.exports = a), "undefined" != typeof window && (window.nv = a), a.dom.write = function(a2) {
return void 0 !== window.fastdom ? fastdom.write(a2) : a2();
}, a.dom.read = function(a2) {
return void 0 !== window.fastdom ? fastdom.read(a2) : a2();
}, a.interactiveGuideline = function() {
"use strict";
function b(l) {
l.each(function(l2) {
function m() {
var a2 = d3.mouse(this), d2 = a2[0], e2 = a2[1], h2 = true, i2 = false;
if (k && (d2 = d3.event.offsetX, e2 = d3.event.offsetY, "svg" !== d3.event.target.tagName && (h2 = false), d3.event.target.className.baseVal.match("nv-legend") && (i2 = true)), h2 && (d2 -= c.left, e2 -= c.top), 0 > d2 || 0 > e2 || d2 > o || e2 > p || d3.event.relatedTarget && void 0 === d3.event.relatedTarget.ownerSVGElement || i2) {
if (k && d3.event.relatedTarget && void 0 === d3.event.relatedTarget.ownerSVGElement && (void 0 === d3.event.relatedTarget.className || d3.event.relatedTarget.className.match(j.nvPointerEventsClass)))
return;
return g.elementMouseout({ mouseX: d2, mouseY: e2 }), b.renderGuideLine(null), void j.hidden(true);
}
j.hidden(false);
var l3 = f.invert(d2);
g.elementMousemove({ mouseX: d2, mouseY: e2, pointXValue: l3 }), "dblclick" === d3.event.type && g.elementDblclick({ mouseX: d2, mouseY: e2, pointXValue: l3 }), "click" === d3.event.type && g.elementClick({ mouseX: d2, mouseY: e2, pointXValue: l3 }), "mousedown" === d3.event.type && g.elementMouseDown({ mouseX: d2, mouseY: e2, pointXValue: l3 }), "mouseup" === d3.event.type && g.elementMouseUp({ mouseX: d2, mouseY: e2, pointXValue: l3 });
}
var n = d3.select(this), o = d || 960, p = e || 400, q = n.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([l2]), r = q.enter().append("g").attr("class", " nv-wrap nv-interactiveLineLayer");
r.append("g").attr("class", "nv-interactiveGuideLine"), i && (i.on("touchmove", m).on("mousemove", m, true).on("mouseout", m, true).on("mousedown", m, true).on("mouseup", m, true).on("dblclick", m).on("click", m), b.guideLine = null, b.renderGuideLine = function(c2) {
h && (b.guideLine && b.guideLine.attr("x1") === c2 || a.dom.write(function() {
var b2 = q.select(".nv-interactiveGuideLine").selectAll("line").data(null != c2 ? [a.utils.NaNtoZero(c2)] : [], String);
b2.enter().append("line").attr("class", "nv-guideline").attr("x1", function(a2) {
return a2;
}).attr("x2", function(a2) {
return a2;
}).attr("y1", p).attr("y2", 0), b2.exit().remove();
}));
});
});
}
var c = { left: 0, top: 0 }, d = null, e = null, f = d3.scale.linear(), g = d3.dispatch("elementMousemove", "elementMouseout", "elementClick", "elementDblclick", "elementMouseDown", "elementMouseUp"), h = true, i = null, j = a.models.tooltip(), k = "ActiveXObject" in window;
return j.duration(0).hideDelay(0).hidden(false), b.dispatch = g, b.tooltip = j, b.margin = function(a2) {
return arguments.length ? (c.top = "undefined" != typeof a2.top ? a2.top : c.top, c.left = "undefined" != typeof a2.left ? a2.left : c.left, b) : c;
}, b.width = function(a2) {
return arguments.length ? (d = a2, b) : d;
}, b.height = function(a2) {
return arguments.length ? (e = a2, b) : e;
}, b.xScale = function(a2) {
return arguments.length ? (f = a2, b) : f;
}, b.showGuideLine = function(a2) {
return arguments.length ? (h = a2, b) : h;
}, b.svgContainer = function(a2) {
return arguments.length ? (i = a2, b) : i;
}, b;
}, a.interactiveBisect = function(a2, b, c) {
"use strict";
if (!(a2 instanceof Array))
return null;
var d;
d = "function" != typeof c ? function(a3) {
return a3.x;
} : c;
var e = function(a3, b2) {
return d(a3) - b2;
}, f = d3.bisector(e).left, g = d3.max([0, f(a2, b) - 1]), h = d(a2[g]);
if ("undefined" == typeof h && (h = g), h === b)
return g;
var i = d3.min([g + 1, a2.length - 1]), j = d(a2[i]);
return "undefined" == typeof j && (j = i), Math.abs(j - b) >= Math.abs(h - b) ? g : i;
}, a.nearestValueIndex = function(a2, b, c) {
"use strict";
var d = 1 / 0, e = null;
return a2.forEach(function(a3, f) {
var g = Math.abs(b - a3);
null != a3 && d >= g && c > g && (d = g, e = f);
}), e;
}, a.models.tooltip = function() {
"use strict";
function b() {
if (!m) {
var a2 = j ? j : document.body;
m = d3.select(a2).append("div").attr("class", "nvtooltip " + (i ? i : "xy-tooltip")).attr("id", d), m.style("top", 0).style("left", 0), m.style("opacity", 0), m.style("position", "fixed"), m.selectAll("div, table, td, tr").classed(r, true), m.classed(r, true);
}
}
function c() {
return o && x(e) ? (a.dom.write(function() {
b();
var a2 = w(e);
a2 && (m.node().innerHTML = a2), z();
}), c) : void 0;
}
var d = "nvtooltip-" + Math.floor(1e5 * Math.random()), e = null, f = "w", g = 25, h = 0, i = null, j = null, k = true, l = 200, m = null, n = { left: null, top: null }, o = true, p = 100, q = true, r = "nv-pointer-events-none", s = function() {
return { left: d3.event.clientX, top: d3.event.clientY };
}, t = function(a2, b2) {
return a2;
}, u = function(a2) {
return a2;
}, v = function(a2, b2) {
return a2;
}, w = function(a2) {
if (null === a2)
return "";
var b2 = d3.select(document.createElement("table"));
if (q) {
var c2 = b2.selectAll("thead").data([a2]).enter().append("thead");
c2.append("tr").append("td").attr("colspan", 3).append("strong").classed("x-value", true).html(u(a2.value));
}
var d2 = b2.selectAll("tbody").data([a2]).enter().append("tbody"), e2 = d2.selectAll("tr").data(function(a3) {
return a3.series;
}).enter().append("tr").classed("highlight", function(a3) {
return a3.highlight;
});
e2.append("td").classed("legend-color-guide", true).append("div").style("background-color", function(a3) {
return a3.color;
}), e2.append("td").classed("key", true).classed("total", function(a3) {
return !!a3.total;
}).html(function(a3, b3) {
return v(a3.key, b3);
}), e2.append("td").classed("value", true).html(function(a3, b3) {
return t(a3.value, b3);
}), e2.selectAll("td").each(function(a3) {
if (a3.highlight) {
var b3 = d3.scale.linear().domain([0, 1]).range(["#fff", a3.color]), c3 = 0.6;
d3.select(this).style("border-bottom-color", b3(c3)).style("border-top-color", b3(c3));
}
});
var f2 = b2.node().outerHTML;
return void 0 !== a2.footer && (f2 += "<div class='footer'>" + a2.footer + "</div>"), f2;
}, x = function(a2) {
if (a2 && a2.series) {
if (a2.series instanceof Array)
return !!a2.series.length;
if (a2.series instanceof Object)
return a2.series = [a2.series], true;
}
return false;
}, y = function(a2) {
var b2, c2, d2, e2 = m.node().offsetHeight, h2 = m.node().offsetWidth, i2 = document.documentElement.clientWidth, j2 = document.documentElement.clientHeight;
switch (f) {
case "e":
b2 = -h2 - g, c2 = -(e2 / 2), a2.left + b2 < 0 && (b2 = g), (d2 = a2.top + c2) < 0 && (c2 -= d2), (d2 = a2.top + c2 + e2) > j2 && (c2 -= d2 - j2);
break;
case "w":
b2 = g, c2 = -(e2 / 2), a2.left + b2 + h2 > i2 && (b2 = -h2 - g), (d2 = a2.top + c2) < 0 && (c2 -= d2), (d2 = a2.top + c2 + e2) > j2 && (c2 -= d2 - j2);
break;
case "n":
b2 = -(h2 / 2) - 5, c2 = g, a2.top + c2 + e2 > j2 && (c2 = -e2 - g), (d2 = a2.left + b2) < 0 && (b2 -= d2), (d2 = a2.left + b2 + h2) > i2 && (b2 -= d2 - i2);
break;
case "s":
b2 = -(h2 / 2), c2 = -e2 - g, a2.top + c2 < 0 && (c2 = g), (d2 = a2.left + b2) < 0 && (b2 -= d2), (d2 = a2.left + b2 + h2) > i2 && (b2 -= d2 - i2);
break;
case "center":
b2 = -(h2 / 2), c2 = -(e2 / 2);
break;
default:
b2 = 0, c2 = 0;
}
return { left: b2, top: c2 };
}, z = function() {
a.dom.read(function() {
var a2 = s(), b2 = y(a2), c2 = a2.left + b2.left, d2 = a2.top + b2.top;
if (k)
m.interrupt().transition().delay(l).duration(0).style("opacity", 0);
else {
var e2 = "translate(" + n.left + "px, " + n.top + "px)", f2 = "translate(" + c2 + "px, " + d2 + "px)", g2 = d3.interpolateString(e2, f2), h2 = m.style("opacity") < 0.1;
m.interrupt().transition().duration(h2 ? 0 : p).styleTween("transform", function(a3) {
return g2;
}, "important").styleTween("-webkit-transform", function(a3) {
return g2;
}).style("-ms-transform", f2).style("opacity", 1);
}
n.left = c2, n.top = d2;
});
};
return c.nvPointerEventsClass = r, c.options = a.utils.optionsFunc.bind(c), c._options = Object.create({}, { duration: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, gravity: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, distance: { get: function() {
return g;
}, set: function(a2) {
g = a2;
} }, snapDistance: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, classes: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, chartContainer: { get: function() {
return j;
}, set: function(a2) {
j = a2;
} }, enabled: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, hideDelay: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, contentGenerator: { get: function() {
return w;
}, set: function(a2) {
w = a2;
} }, valueFormatter: { get: function() {
return t;
}, set: function(a2) {
t = a2;
} }, headerFormatter: { get: function() {
return u;
}, set: function(a2) {
u = a2;
} }, keyFormatter: { get: function() {
return v;
}, set: function(a2) {
v = a2;
} }, headerEnabled: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, position: { get: function() {
return s;
}, set: function(a2) {
s = a2;
} }, hidden: { get: function() {
return k;
}, set: function(a2) {
k != a2 && (k = !!a2, c());
} }, data: { get: function() {
return e;
}, set: function(a2) {
a2.point && (a2.value = a2.point.x, a2.series = a2.series || {}, a2.series.value = a2.point.y, a2.series.color = a2.point.color || a2.series.color), e = a2;
} }, node: { get: function() {
return m.node();
}, set: function(a2) {
} }, id: { get: function() {
return d;
}, set: function(a2) {
} } }), a.utils.initOptions(c), c;
}, a.utils.windowSize = function() {
var a2 = { width: 640, height: 480 };
return window.innerWidth && window.innerHeight ? (a2.width = window.innerWidth, a2.height = window.innerHeight, a2) : "CSS1Compat" == document.compatMode && document.documentElement && document.documentElement.offsetWidth ? (a2.width = document.documentElement.offsetWidth, a2.height = document.documentElement.offsetHeight, a2) : document.body && document.body.offsetWidth ? (a2.width = document.body.offsetWidth, a2.height = document.body.offsetHeight, a2) : a2;
}, a.utils.windowResize = function(b) {
return window.addEventListener ? window.addEventListener("resize", b) : a.log("ERROR: Failed to bind to window.resize with: ", b), { callback: b, clear: function() {
window.removeEventListener("resize", b);
} };
}, a.utils.getColor = function(b) {
if (void 0 === b)
return a.utils.defaultColor();
if (Array.isArray(b)) {
var c = d3.scale.ordinal().range(b);
return function(a2, b2) {
var d = void 0 === b2 ? a2 : b2;
return a2.color || c(d);
};
}
return b;
}, a.utils.defaultColor = function() {
return a.utils.getColor(d3.scale.category20().range());
}, a.utils.customTheme = function(a2, b, c) {
b = b || function(a3) {
return a3.key;
}, c = c || d3.scale.category20().range();
var d = c.length;
return function(e, f) {
var g = b(e);
return "function" == typeof a2[g] ? a2[g]() : void 0 !== a2[g] ? a2[g] : (d || (d = c.length), d -= 1, c[d]);
};
}, a.utils.pjax = function(b, c) {
var d = function(d2) {
d3.html(d2, function(d4) {
var e = d3.select(c).node();
e.parentNode.replaceChild(d3.select(d4).select(c).node(), e), a.utils.pjax(b, c);
});
};
d3.selectAll(b).on("click", function() {
history.pushState(this.href, this.textContent, this.href), d(this.href), d3.event.preventDefault();
}), d3.select(window).on("popstate", function() {
d3.event.state && d(d3.event.state);
});
}, a.utils.calcApproxTextWidth = function(a2) {
if ("function" == typeof a2.style && "function" == typeof a2.text) {
var b = parseInt(a2.style("font-size").replace("px", ""), 10), c = a2.text().length;
return c * b * 0.5;
}
return 0;
}, a.utils.NaNtoZero = function(a2) {
return "number" != typeof a2 || isNaN(a2) || null === a2 || a2 === 1 / 0 || a2 === -(1 / 0) ? 0 : a2;
}, d3.selection.prototype.watchTransition = function(a2) {
var b = [this].concat([].slice.call(arguments, 1));
return a2.transition.apply(a2, b);
}, a.utils.renderWatch = function(b, c) {
if (!(this instanceof a.utils.renderWatch))
return new a.utils.renderWatch(b, c);
var d = void 0 !== c ? c : 250, e = [], f = this;
this.models = function(a2) {
return a2 = [].slice.call(arguments, 0), a2.forEach(function(a3) {
a3.__rendered = false, function(a4) {
a4.dispatch.on("renderEnd", function(b2) {
a4.__rendered = true, f.renderEnd("model");
});
}(a3), e.indexOf(a3) < 0 && e.push(a3);
}), this;
}, this.reset = function(a2) {
void 0 !== a2 && (d = a2), e = [];
}, this.transition = function(a2, b2, c2) {
if (b2 = arguments.length > 1 ? [].slice.call(arguments, 1) : [], c2 = b2.length > 1 ? b2.pop() : void 0 !== d ? d : 250, a2.__rendered = false, e.indexOf(a2) < 0 && e.push(a2), 0 === c2)
return a2.__rendered = true, a2.delay = function() {
return this;
}, a2.duration = function() {
return this;
}, a2;
0 === a2.length ? a2.__rendered = true : a2.every(function(a3) {
return !a3.length;
}) ? a2.__rendered = true : a2.__rendered = false;
var g = 0;
return a2.transition().duration(c2).each(function() {
++g;
}).each("end", function(c3, d2) {
0 === --g && (a2.__rendered = true, f.renderEnd.apply(this, b2));
});
}, this.renderEnd = function() {
e.every(function(a2) {
return a2.__rendered;
}) && (e.forEach(function(a2) {
a2.__rendered = false;
}), b.renderEnd.apply(this, arguments));
};
}, a.utils.deepExtend = function(b) {
var c = arguments.length > 1 ? [].slice.call(arguments, 1) : [];
c.forEach(function(c2) {
for (var d in c2) {
var e = b[d] instanceof Array, f = "object" == typeof b[d], g = "object" == typeof c2[d];
f && !e && g ? a.utils.deepExtend(b[d], c2[d]) : b[d] = c2[d];
}
});
}, a.utils.state = function() {
if (!(this instanceof a.utils.state))
return new a.utils.state();
var b = {}, c = function() {
}, d = function() {
return {};
}, e = null, f = null;
this.dispatch = d3.dispatch("change", "set"), this.dispatch.on("set", function(a2) {
c(a2, true);
}), this.getter = function(a2) {
return d = a2, this;
}, this.setter = function(a2, b2) {
return b2 || (b2 = function() {
}), c = function(c2, d2) {
a2(c2), d2 && b2();
}, this;
}, this.init = function(b2) {
e = e || {}, a.utils.deepExtend(e, b2);
};
var g = function() {
var a2 = d();
if (JSON.stringify(a2) === JSON.stringify(b))
return false;
for (var c2 in a2)
void 0 === b[c2] && (b[c2] = {}), b[c2] = a2[c2], f = true;
return true;
};
this.update = function() {
e && (c(e, false), e = null), g.call(this) && this.dispatch.change(b);
};
}, a.utils.optionsFunc = function(a2) {
return a2 && d3.map(a2).forEach(function(a3, b) {
"function" == typeof this[a3] && this[a3](b);
}.bind(this)), this;
}, a.utils.calcTicksX = function(b, c) {
var d = 1, e = 0;
for (e; e < c.length; e += 1) {
var f = c[e] && c[e].values ? c[e].values.length : 0;
d = f > d ? f : d;
}
return a.log("Requested number of ticks: ", b), a.log("Calculated max values to be: ", d), b = b > d ? b = d - 1 : b, b = 1 > b ? 1 : b, b = Math.floor(b), a.log("Calculating tick count as: ", b), b;
}, a.utils.calcTicksY = function(b, c) {
return a.utils.calcTicksX(b, c);
}, a.utils.initOption = function(a2, b) {
a2._calls && a2._calls[b] ? a2[b] = a2._calls[b] : (a2[b] = function(c) {
return arguments.length ? (a2._overrides[b] = true, a2._options[b] = c, a2) : a2._options[b];
}, a2["_" + b] = function(c) {
return arguments.length ? (a2._overrides[b] || (a2._options[b] = c), a2) : a2._options[b];
});
}, a.utils.initOptions = function(b) {
b._overrides = b._overrides || {};
var c = Object.getOwnPropertyNames(b._options || {}), d = Object.getOwnPropertyNames(b._calls || {});
c = c.concat(d);
for (var e in c)
a.utils.initOption(b, c[e]);
}, a.utils.inheritOptionsD3 = function(a2, b, c) {
a2._d3options = c.concat(a2._d3options || []), c.unshift(b), c.unshift(a2), d3.rebind.apply(this, c);
}, a.utils.arrayUnique = function(a2) {
return a2.sort().filter(function(b, c) {
return !c || b != a2[c - 1];
});
}, a.utils.symbolMap = d3.map(), a.utils.symbol = function() {
function b(b2, e) {
var f = c.call(this, b2, e), g = d.call(this, b2, e);
return -1 !== d3.svg.symbolTypes.indexOf(f) ? d3.svg.symbol().type(f).size(g)() : a.utils.symbolMap.get(f)(g);
}
var c, d = 64;
return b.type = function(a2) {
return arguments.length ? (c = d3.functor(a2), b) : c;
}, b.size = function(a2) {
return arguments.length ? (d = d3.functor(a2), b) : d;
}, b;
}, a.utils.inheritOptions = function(b, c) {
var d = Object.getOwnPropertyNames(c._options || {}), e = Object.getOwnPropertyNames(c._calls || {}), f = c._inherited || [], g = c._d3options || [], h = d.concat(e).concat(f).concat(g);
h.unshift(c), h.unshift(b), d3.rebind.apply(this, h), b._inherited = a.utils.arrayUnique(d.concat(e).concat(f).concat(d).concat(b._inherited || [])), b._d3options = a.utils.arrayUnique(g.concat(b._d3options || []));
}, a.utils.initSVG = function(a2) {
a2.classed({ "nvd3-svg": true });
}, a.utils.sanitizeHeight = function(a2, b) {
return a2 || parseInt(b.style("height"), 10) || 400;
}, a.utils.sanitizeWidth = function(a2, b) {
return a2 || parseInt(b.style("width"), 10) || 960;
}, a.utils.availableHeight = function(b, c, d) {
return a.utils.sanitizeHeight(b, c) - d.top - d.bottom;
}, a.utils.availableWidth = function(b, c, d) {
return a.utils.sanitizeWidth(b, c) - d.left - d.right;
}, a.utils.noData = function(b, c) {
var d = b.options(), e = d.margin(), f = d.noData(), g = null == f ? ["No Data Available."] : [f], h = a.utils.availableHeight(null, c, e), i = a.utils.availableWidth(null, c, e), j = e.left + i / 2, k = e.top + h / 2;
c.selectAll("g").remove();
var l = c.selectAll(".nv-noData").data(g);
l.enter().append("text").attr("class", "nvd3 nv-noData").attr("dy", "-.7em").style("text-anchor", "middle"), l.attr("x", j).attr("y", k).text(function(a2) {
return a2;
});
}, a.utils.wrapTicks = function(a2, b) {
a2.each(function() {
for (var a3, c = d3.select(this), d = c.text().split(/\s+/).reverse(), e = [], f = 0, g = 1.1, h = c.attr("y"), i = parseFloat(c.attr("dy")), j = c.text(null).append("tspan").attr("x", 0).attr("y", h).attr("dy", i + "em"); a3 = d.pop(); )
e.push(a3), j.text(e.join(" ")), j.node().getComputedTextLength() > b && (e.pop(), j.text(e.join(" ")), e = [a3], j = c.append("tspan").attr("x", 0).attr("y", h).attr("dy", ++f * g + i + "em").text(a3));
});
}, a.models.axis = function() {
"use strict";
function b(g2) {
return s.reset(), g2.each(function(b2) {
var g3 = d3.select(this);
a.utils.initSVG(g3);
var p2 = g3.selectAll("g.nv-wrap.nv-axis").data([b2]), q2 = p2.enter().append("g").attr("class", "nvd3 nv-wrap nv-axis"), t = (q2.append("g"), p2.select("g"));
null !== n ? c.ticks(n) : ("top" == c.orient() || "bottom" == c.orient()) && c.ticks(Math.abs(d.range()[1] - d.range()[0]) / 100), t.watchTransition(s, "axis").call(c), r = r || c.scale();
var u = c.tickFormat();
null == u && (u = r.tickFormat());
var v = t.selectAll("text.nv-axislabel").data([h || null]);
v.exit().remove();
var w, x, y;
switch (c.orient()) {
case "top":
v.enter().append("text").attr("class", "nv-axislabel"), y = 0, 1 === d.range().length ? y = m ? 2 * d.range()[0] + d.rangeBand() : 0 : 2 === d.range().length ? y = m ? d.range()[0] + d.range()[1] + d.rangeBand() : d.range()[1] : d.range().length > 2 && (y = d.range()[d.range().length - 1] + (d.range()[1] - d.range()[0])), v.attr("text-anchor", "middle").attr("y", 0).attr("x", y / 2), i && (x = p2.selectAll("g.nv-axisMaxMin").data(d.domain()), x.enter().append("g").attr("class", function(a2, b3) {
return ["nv-axisMaxMin", "nv-axisMaxMin-x", 0 == b3 ? "nv-axisMin-x" : "nv-axisMax-x"].join(" ");
}).append("text"), x.exit().remove(), x.attr("transform", function(b3, c2) {
return "translate(" + a.utils.NaNtoZero(d(b3)) + ",0)";
}).select("text").attr("dy", "-0.5em").attr("y", -c.tickPadding()).attr("text-anchor", "middle").text(function(a2, b3) {
var c2 = u(a2);
return ("" + c2).match("NaN") ? "" : c2;
}), x.watchTransition(s, "min-max top").attr("transform", function(b3, c2) {
return "translate(" + a.utils.NaNtoZero(d.range()[c2]) + ",0)";
}));
break;
case "bottom":
w = o + 36;
var z = 30, A = 0, B = t.selectAll("g").select("text"), C = "";
if (j % 360) {
B.each(function(a2, b3) {
var c2 = this.getBoundingClientRect(), d2 = c2.width;
A = c2.height, d2 > z && (z = d2);
}), C = "rotate(" + j + " 0," + (A / 2 + c.tickPadding()) + ")";
var D = Math.abs(Math.sin(j * Math.PI / 180));
w = (D ? D * z : z) + 30, B.attr("transform", C).style("text-anchor", j % 360 > 0 ? "start" : "end");
}
v.enter().append("text").attr("class", "nv-axislabel"), y = 0, 1 === d.range().length ? y = m ? 2 * d.range()[0] + d.rangeBand() : 0 : 2 === d.range().length ? y = m ? d.range()[0] + d.range()[1] + d.rangeBand() : d.range()[1] : d.range().length > 2 && (y = d.range()[d.range().length - 1] + (d.range()[1] - d.range()[0])), v.attr("text-anchor", "middle").attr("y", w).attr("x", y / 2), i && (x = p2.selectAll("g.nv-axisMaxMin").data([d.domain()[0], d.domain()[d.domain().length - 1]]), x.enter().append("g").attr("class", function(a2, b3) {
return ["nv-axisMaxMin", "nv-axisMaxMin-x", 0 == b3 ? "nv-axisMin-x" : "nv-axisMax-x"].join(" ");
}).append("text"), x.exit().remove(), x.attr("transform", function(b3, c2) {
return "translate(" + a.utils.NaNtoZero(d(b3) + (m ? d.rangeBand() / 2 : 0)) + ",0)";
}).select("text").attr("dy", ".71em").attr("y", c.tickPadding()).attr("transform", C).style("text-anchor", j ? j % 360 > 0 ? "start" : "end" : "middle").text(function(a2, b3) {
var c2 = u(a2);
return ("" + c2).match("NaN") ? "" : c2;
}), x.watchTransition(s, "min-max bottom").attr("transform", function(b3, c2) {
return "translate(" + a.utils.NaNtoZero(d(b3) + (m ? d.rangeBand() / 2 : 0)) + ",0)";
})), l && B.attr("transform", function(a2, b3) {
return "translate(0," + (b3 % 2 == 0 ? "0" : "12") + ")";
});
break;
case "right":
v.enter().append("text").attr("class", "nv-axislabel"), v.style("text-anchor", k ? "middle" : "begin").attr("transform", k ? "rotate(90)" : "").attr("y", k ? -Math.max(e.right, f) + 12 : -10).attr("x", k ? d3.max(d.range()) / 2 : c.tickPadding()), i && (x = p2.selectAll("g.nv-axisMaxMin").data(d.domain()), x.enter().append("g").attr("class", function(a2, b3) {
return ["nv-axisMaxMin", "nv-axisMaxMin-y", 0 == b3 ? "nv-axisMin-y" : "nv-axisMax-y"].join(" ");
}).append("text").style("opacity", 0), x.exit().remove(), x.attr("transform", function(b3, c2) {
return "translate(0," + a.utils.NaNtoZero(d(b3)) + ")";
}).select("text").attr("dy", ".32em").attr("y", 0).attr("x", c.tickPadding()).style("text-anchor", "start").text(function(a2, b3) {
var c2 = u(a2);
return ("" + c2).match("NaN") ? "" : c2;
}), x.watchTransition(s, "min-max right").attr("transform", function(b3, c2) {
return "translate(0," + a.utils.NaNtoZero(d.range()[c2]) + ")";
}).select("text").style("opacity", 1));
break;
case "left":
v.enter().append("text").attr("class", "nv-axislabel"), v.style("text-anchor", k ? "middle" : "end").attr("transform", k ? "rotate(-90)" : "").attr("y", k ? -Math.max(e.left, f) + 25 - (o || 0) : -10).attr("x", k ? -d3.max(d.range()) / 2 : -c.tickPadding()), i && (x = p2.selectAll("g.nv-axisMaxMin").data(d.domain()), x.enter().append("g").attr("class", function(a2, b3) {
return ["nv-axisMaxMin", "nv-axisMaxMin-y", 0 == b3 ? "nv-axisMin-y" : "nv-axisMax-y"].join(" ");
}).append("text").style("opacity", 0), x.exit().remove(), x.attr("transform", function(b3, c2) {
return "translate(0," + a.utils.NaNtoZero(r(b3)) + ")";
}).select("text").attr("dy", ".32em").attr("y", 0).attr("x", -c.tickPadding()).attr("text-anchor", "end").text(function(a2, b3) {
var c2 = u(a2);
return ("" + c2).match("NaN") ? "" : c2;
}), x.watchTransition(s, "min-max right").attr("transform", function(b3, c2) {
return "translate(0," + a.utils.NaNtoZero(d.range()[c2]) + ")";
}).select("text").style("opacity", 1));
}
if (v.text(function(a2) {
return a2;
}), !i || "left" !== c.orient() && "right" !== c.orient() || (t.selectAll("g").each(function(a2, b3) {
d3.select(this).select("text").attr("opacity", 1), (d(a2) < d.range()[1] + 10 || d(a2) > d.range()[0] - 10) && ((a2 > 1e-10 || -1e-10 > a2) && d3.select(this).attr("opacity", 0), d3.select(this).select("text").attr("opacity", 0));
}), d.domain()[0] == d.domain()[1] && 0 == d.domain()[0] && p2.selectAll("g.nv-axisMaxMin").style("opacity", function(a2, b3) {
return b3 ? 0 : 1;
})), i && ("top" === c.orient() || "bottom" === c.orient())) {
var E = [];
p2.selectAll("g.nv-axisMaxMin").each(function(a2, b3) {
try {
b3 ? E.push(d(a2) - this.getBoundingClientRect().width - 4) : E.push(d(a2) + this.getBoundingClientRect().width + 4);
} catch (c2) {
b3 ? E.push(d(a2) - 4) : E.push(d(a2) + 4);
}
}), t.selectAll("g").each(function(a2, b3) {
(d(a2) < E[0] || d(a2) > E[1]) && (a2 > 1e-10 || -1e-10 > a2 ? d3.select(this).remove() : d3.select(this).select("text").remove());
});
}
t.selectAll(".tick").filter(function(a2) {
return !parseFloat(Math.round(1e5 * a2) / 1e6) && void 0 !== a2;
}).classed("zero", true), r = d.copy();
}), s.renderEnd("axis immediate"), b;
}
var c = d3.svg.axis(), d = d3.scale.linear(), e = { top: 0, right: 0, bottom: 0, left: 0 }, f = 75, g = 60, h = null, i = true, j = 0, k = true, l = false, m = false, n = null, o = 0, p = 250, q = d3.dispatch("renderEnd");
c.scale(d).orient("bottom").tickFormat(function(a2) {
return a2;
});
var r, s = a.utils.renderWatch(q, p);
return b.axis = c, b.dispatch = q, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { axisLabelDistance: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, staggerLabels: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, rotateLabels: { get: function() {
return j;
}, set: function(a2) {
j = a2;
} }, rotateYLabel: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, showMaxMin: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, axisLabel: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, height: { get: function() {
return g;
}, set: function(a2) {
g = a2;
} }, ticks: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, width: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, margin: { get: function() {
return e;
}, set: function(a2) {
e.top = void 0 !== a2.top ? a2.top : e.top, e.right = void 0 !== a2.right ? a2.right : e.right, e.bottom = void 0 !== a2.bottom ? a2.bottom : e.bottom, e.left = void 0 !== a2.left ? a2.left : e.left;
} }, duration: { get: function() {
return p;
}, set: function(a2) {
p = a2, s.reset(p);
} }, scale: { get: function() {
return d;
}, set: function(e2) {
d = e2, c.scale(d), m = "function" == typeof d.rangeBands, a.utils.inheritOptionsD3(b, d, ["domain", "range", "rangeBand", "rangeBands"]);
} } }), a.utils.initOptions(b), a.utils.inheritOptionsD3(b, c, ["orient", "tickValues", "tickSubdivide", "tickSize", "tickPadding", "tickFormat"]), a.utils.inheritOptionsD3(b, d, ["domain", "range", "rangeBand", "rangeBands"]), b;
}, a.models.boxPlot = function() {
"use strict";
function b(l2) {
return v.reset(), l2.each(function(b2) {
var l3 = j - i.left - i.right, p2 = k - i.top - i.bottom;
r = d3.select(this), a.utils.initSVG(r), m.domain(c || b2.map(function(a2, b3) {
return o(a2, b3);
})).rangeBands(e || [0, l3], 0.1);
var w = [];
if (!d) {
var x = d3.min(b2.map(function(a2) {
var b3 = [];
return b3.push(a2.values.Q1), a2.values.hasOwnProperty("whisker_low") && null !== a2.values.whisker_low && b3.push(a2.values.whisker_low), a2.values.hasOwnProperty("outliers") && null !== a2.values.outliers && (b3 = b3.concat(a2.values.outliers)), d3.min(b3);
})), y = d3.max(b2.map(function(a2) {
var b3 = [];
return b3.push(a2.values.Q3), a2.values.hasOwnProperty("whisker_high") && null !== a2.values.whisker_high && b3.push(a2.values.whisker_high), a2.values.hasOwnProperty("outliers") && null !== a2.values.outliers && (b3 = b3.concat(a2.values.outliers)), d3.max(b3);
}));
w = [x, y];
}
n.domain(d || w), n.range(f || [p2, 0]), g = g || m, h = h || n.copy().range([n(0), n(0)]);
var z = r.selectAll("g.nv-wrap").data([b2]);
z.enter().append("g").attr("class", "nvd3 nv-wrap");
z.attr("transform", "translate(" + i.left + "," + i.top + ")");
var A = z.selectAll(".nv-boxplot").data(function(a2) {
return a2;
}), B = A.enter().append("g").style("stroke-opacity", 1e-6).style("fill-opacity", 1e-6);
A.attr("class", "nv-boxplot").attr("transform", function(a2, b3, c2) {
return "translate(" + (m(o(a2, b3)) + 0.05 * m.rangeBand()) + ", 0)";
}).classed("hover", function(a2) {
return a2.hover;
}), A.watchTransition(v, "nv-boxplot: boxplots").style("stroke-opacity", 1).style("fill-opacity", 0.75).delay(function(a2, c2) {
return c2 * t / b2.length;
}).attr("transform", function(a2, b3) {
return "translate(" + (m(o(a2, b3)) + 0.05 * m.rangeBand()) + ", 0)";
}), A.exit().remove(), B.each(function(a2, b3) {
var c2 = d3.select(this);
["low", "high"].forEach(function(d2) {
a2.values.hasOwnProperty("whisker_" + d2) && null !== a2.values["whisker_" + d2] && (c2.append("line").style("stroke", a2.color ? a2.color : q(a2, b3)).attr("class", "nv-boxplot-whisker nv-boxplot-" + d2), c2.append("line").style("stroke", a2.color ? a2.color : q(a2, b3)).attr("class", "nv-boxplot-tick nv-boxplot-" + d2));
});
});
var C = A.selectAll(".nv-boxplot-outlier").data(function(a2) {
return a2.values.hasOwnProperty("outliers") && null !== a2.values.outliers ? a2.values.outliers : [];
});
C.enter().append("circle").style("fill", function(a2, b3, c2) {
return q(a2, c2);
}).style("stroke", function(a2, b3, c2) {
return q(a2, c2);
}).on("mouseover", function(a2, b3, c2) {
d3.select(this).classed("hover", true), s.elementMouseover({ series: { key: a2, color: q(a2, c2) }, e: d3.event });
}).on("mouseout", function(a2, b3, c2) {
d3.select(this).classed("hover", false), s.elementMouseout({ series: { key: a2, color: q(a2, c2) }, e: d3.event });
}).on("mousemove", function(a2, b3) {
s.elementMousemove({ e: d3.event });
}), C.attr("class", "nv-boxplot-outlier"), C.watchTransition(v, "nv-boxplot: nv-boxplot-outlier").attr("cx", 0.45 * m.rangeBand()).attr("cy", function(a2, b3, c2) {
return n(a2);
}).attr("r", "3"), C.exit().remove();
var D = function() {
return null === u ? 0.9 * m.rangeBand() : Math.min(75, 0.9 * m.rangeBand());
}, E = function() {
return 0.45 * m.rangeBand() - D() / 2;
}, F = function() {
return 0.45 * m.rangeBand() + D() / 2;
};
["low", "high"].forEach(function(a2) {
var b3 = "low" === a2 ? "Q1" : "Q3";
A.select("line.nv-boxplot-whisker.nv-boxplot-" + a2).watchTransition(v, "nv-boxplot: boxplots").attr("x1", 0.45 * m.rangeBand()).attr("y1", function(b4, c2) {
return n(b4.values["whisker_" + a2]);
}).attr("x2", 0.45 * m.rangeBand()).attr("y2", function(a3, c2) {
return n(a3.values[b3]);
}), A.select("line.nv-boxplot-tick.nv-boxplot-" + a2).watchTransition(v, "nv-boxplot: boxplots").attr("x1", E).attr("y1", function(b4, c2) {
return n(b4.values["whisker_" + a2]);
}).attr("x2", F).attr("y2", function(b4, c2) {
return n(b4.values["whisker_" + a2]);
});
}), ["low", "high"].forEach(function(a2) {
B.selectAll(".nv-boxplot-" + a2).on("mouseover", function(b3, c2, d2) {
d3.select(this).classed("hover", true), s.elementMouseover({ series: { key: b3.values["whisker_" + a2], color: q(b3, d2) }, e: d3.event });
}).on("mouseout", function(b3, c2, d2) {
d3.select(this).classed("hover", false), s.elementMouseout({ series: { key: b3.values["whisker_" + a2], color: q(b3, d2) }, e: d3.event });
}).on("mousemove", function(a3, b3) {
s.elementMousemove({ e: d3.event });
});
}), B.append("rect").attr("class", "nv-boxplot-box").on("mouseover", function(a2, b3) {
d3.select(this).classed("hover", true), s.elementMouseover({ key: a2.label, value: a2.label, series: [{ key: "Q3", value: a2.values.Q3, color: a2.color || q(a2, b3) }, { key: "Q2", value: a2.values.Q2, color: a2.color || q(a2, b3) }, { key: "Q1", value: a2.values.Q1, color: a2.color || q(a2, b3) }], data: a2, index: b3, e: d3.event });
}).on("mouseout", function(a2, b3) {
d3.select(this).classed("hover", false), s.elementMouseout({ key: a2.label, value: a2.label, series: [{ key: "Q3", value: a2.values.Q3, color: a2.color || q(a2, b3) }, { key: "Q2", value: a2.values.Q2, color: a2.color || q(a2, b3) }, { key: "Q1", value: a2.values.Q1, color: a2.color || q(a2, b3) }], data: a2, index: b3, e: d3.event });
}).on("mousemove", function(a2, b3) {
s.elementMousemove({ e: d3.event });
}), A.select("rect.nv-boxplot-box").watchTransition(v, "nv-boxplot: boxes").attr("y", function(a2, b3) {
return n(a2.values.Q3);
}).attr("width", D).attr("x", E).attr("height", function(a2, b3) {
return Math.abs(n(a2.values.Q3) - n(a2.values.Q1)) || 1;
}).style("fill", function(a2, b3) {
return a2.color || q(a2, b3);
}).style("stroke", function(a2, b3) {
return a2.color || q(a2, b3);
}), B.append("line").attr("class", "nv-boxplot-median"), A.select("line.nv-boxplot-median").watchTransition(v, "nv-boxplot: boxplots line").attr("x1", E).attr("y1", function(a2, b3) {
return n(a2.values.Q2);
}).attr("x2", F).attr("y2", function(a2, b3) {
return n(a2.values.Q2);
}), g = m.copy(), h = n.copy();
}), v.renderEnd("nv-boxplot immediate"), b;
}
var c, d, e, f, g, h, i = { top: 0, right: 0, bottom: 0, left: 0 }, j = 960, k = 500, l = Math.floor(1e4 * Math.random()), m = d3.scale.ordinal(), n = d3.scale.linear(), o = function(a2) {
return a2.x;
}, p = function(a2) {
return a2.y;
}, q = a.utils.defaultColor(), r = null, s = d3.dispatch("elementMouseover", "elementMouseout", "elementMousemove", "renderEnd"), t = 250, u = null, v = a.utils.renderWatch(s, t);
return b.dispatch = s, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return j;
}, set: function(a2) {
j = a2;
} }, height: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, maxBoxWidth: { get: function() {
return u;
}, set: function(a2) {
u = a2;
} }, x: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, y: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, xScale: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, yScale: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, xDomain: { get: function() {
return c;
}, set: function(a2) {
c = a2;
} }, yDomain: { get: function() {
return d;
}, set: function(a2) {
d = a2;
} }, xRange: { get: function() {
return e;
}, set: function(a2) {
e = a2;
} }, yRange: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, id: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, margin: { get: function() {
return i;
}, set: function(a2) {
i.top = void 0 !== a2.top ? a2.top : i.top, i.right = void 0 !== a2.right ? a2.right : i.right, i.bottom = void 0 !== a2.bottom ? a2.bottom : i.bottom, i.left = void 0 !== a2.left ? a2.left : i.left;
} }, color: { get: function() {
return q;
}, set: function(b2) {
q = a.utils.getColor(b2);
} }, duration: { get: function() {
return t;
}, set: function(a2) {
t = a2, v.reset(t);
} } }), a.utils.initOptions(b), b;
}, a.models.boxPlotChart = function() {
"use strict";
function b(k2) {
return t.reset(), t.models(e), l && t.models(f), m && t.models(g), k2.each(function(k3) {
var p2 = d3.select(this);
a.utils.initSVG(p2);
var t2 = (i || parseInt(p2.style("width")) || 960) - h.left - h.right, u = (j || parseInt(p2.style("height")) || 400) - h.top - h.bottom;
if (b.update = function() {
r.beforeUpdate(), p2.transition().duration(s).call(b);
}, b.container = this, !(k3 && k3.length && k3.filter(function(a2) {
return a2.values.hasOwnProperty("Q1") && a2.values.hasOwnProperty("Q2") && a2.values.hasOwnProperty("Q3");
}).length)) {
var v = p2.selectAll(".nv-noData").data([q]);
return v.enter().append("text").attr("class", "nvd3 nv-noData").attr("dy", "-.7em").style("text-anchor", "middle"), v.attr("x", h.left + t2 / 2).attr("y", h.top + u / 2).text(function(a2) {
return a2;
}), b;
}
p2.selectAll(".nv-noData").remove(), c = e.xScale(), d = e.yScale().clamp(true);
var w = p2.selectAll("g.nv-wrap.nv-boxPlotWithAxes").data([k3]), x = w.enter().append("g").attr("class", "nvd3 nv-wrap nv-boxPlotWithAxes").append("g"), y = x.append("defs"), z = w.select("g");
x.append("g").attr("class", "nv-x nv-axis"), x.append("g").attr("class", "nv-y nv-axis").append("g").attr("class", "nv-zeroLine").append("line"), x.append("g").attr("class", "nv-barsWrap"), z.attr("transform", "translate(" + h.left + "," + h.top + ")"), n && z.select(".nv-y.nv-axis").attr("transform", "translate(" + t2 + ",0)"), e.width(t2).height(u);
var A = z.select(".nv-barsWrap").datum(k3.filter(function(a2) {
return !a2.disabled;
}));
if (A.transition().call(e), y.append("clipPath").attr("id", "nv-x-label-clip-" + e.id()).append("rect"), z.select("#nv-x-label-clip-" + e.id() + " rect").attr("width", c.rangeBand() * (o ? 2 : 1)).attr("height", 16).attr("x", -c.rangeBand() / (o ? 1 : 2)), l) {
f.scale(c).ticks(a.utils.calcTicksX(t2 / 100, k3)).tickSize(-u, 0), z.select(".nv-x.nv-axis").attr("transform", "translate(0," + d.range()[0] + ")"), z.select(".nv-x.nv-axis").call(f);
var B = z.select(".nv-x.nv-axis").selectAll("g");
o && B.selectAll("text").attr("transform", function(a2, b2, c2) {
return "translate(0," + (c2 % 2 == 0 ? "5" : "17") + ")";
});
}
m && (g.scale(d).ticks(Math.floor(u / 36)).tickSize(-t2, 0), z.select(".nv-y.nv-axis").call(g)), z.select(".nv-zeroLine line").attr("x1", 0).attr("x2", t2).attr("y1", d(0)).attr("y2", d(0));
}), t.renderEnd("nv-boxplot chart immediate"), b;
}
var c, d, e = a.models.boxPlot(), f = a.models.axis(), g = a.models.axis(), h = { top: 15, right: 10, bottom: 50, left: 60 }, i = null, j = null, k = a.utils.getColor(), l = true, m = true, n = false, o = false, p = a.models.tooltip(), q = "No Data Available.", r = d3.dispatch("beforeUpdate", "renderEnd"), s = 250;
f.orient("bottom").showMaxMin(false).tickFormat(function(a2) {
return a2;
}), g.orient(n ? "right" : "left").tickFormat(d3.format(",.1f")), p.duration(0);
var t = a.utils.renderWatch(r, s);
return e.dispatch.on("elementMouseover.tooltip", function(a2) {
p.data(a2).hidden(false);
}), e.dispatch.on("elementMouseout.tooltip", function(a2) {
p.data(a2).hidden(true);
}), e.dispatch.on("elementMousemove.tooltip", function(a2) {
p();
}), b.dispatch = r, b.boxplot = e, b.xAxis = f, b.yAxis = g, b.tooltip = p, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, height: { get: function() {
return j;
}, set: function(a2) {
j = a2;
} }, staggerLabels: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, showXAxis: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, showYAxis: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, tooltipContent: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, noData: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, margin: { get: function() {
return h;
}, set: function(a2) {
h.top = void 0 !== a2.top ? a2.top : h.top, h.right = void 0 !== a2.right ? a2.right : h.right, h.bottom = void 0 !== a2.bottom ? a2.bottom : h.bottom, h.left = void 0 !== a2.left ? a2.left : h.left;
} }, duration: { get: function() {
return s;
}, set: function(a2) {
s = a2, t.reset(s), e.duration(s), f.duration(s), g.duration(s);
} }, color: { get: function() {
return k;
}, set: function(b2) {
k = a.utils.getColor(b2), e.color(k);
} }, rightAlignYAxis: { get: function() {
return n;
}, set: function(a2) {
n = a2, g.orient(a2 ? "right" : "left");
} } }), a.utils.inheritOptions(b, e), a.utils.initOptions(b), b;
}, a.models.bullet = function() {
"use strict";
function b(d2) {
return d2.each(function(b2, d4) {
var p2 = m - c.left - c.right, s = n - c.top - c.bottom;
o = d3.select(this), a.utils.initSVG(o);
var t = f.call(this, b2, d4).slice().sort(d3.descending), u = g.call(this, b2, d4).slice().sort(d3.descending), v = h.call(this, b2, d4).slice().sort(d3.descending), w = i.call(this, b2, d4).slice(), x = j.call(this, b2, d4).slice(), y = k.call(this, b2, d4).slice(), z = d3.scale.linear().domain(d3.extent(d3.merge([l, t]))).range(e ? [p2, 0] : [0, p2]);
this.__chart__ || d3.scale.linear().domain([0, 1 / 0]).range(z.range());
this.__chart__ = z;
var A = d3.min(t), B = d3.max(t), C = t[1], D = o.selectAll("g.nv-wrap.nv-bullet").data([b2]), E = D.enter().append("g").attr("class", "nvd3 nv-wrap nv-bullet"), F = E.append("g"), G = D.select("g");
F.append("rect").attr("class", "nv-range nv-rangeMax"), F.append("rect").attr("class", "nv-range nv-rangeAvg"), F.append("rect").attr("class", "nv-range nv-rangeMin"), F.append("rect").attr("class", "nv-measure"), D.attr("transform", "translate(" + c.left + "," + c.top + ")");
var H = function(a2) {
return Math.abs(z(a2) - z(0));
}, I = function(a2) {
return z(0 > a2 ? a2 : 0);
};
G.select("rect.nv-rangeMax").attr("height", s).attr("width", H(B > 0 ? B : A)).attr("x", I(B > 0 ? B : A)).datum(B > 0 ? B : A), G.select("rect.nv-rangeAvg").attr("height", s).attr("width", H(C)).attr("x", I(C)).datum(C), G.select("rect.nv-rangeMin").attr("height", s).attr("width", H(B)).attr("x", I(B)).attr("width", H(B > 0 ? A : B)).attr("x", I(B > 0 ? A : B)).datum(B > 0 ? A : B), G.select("rect.nv-measure").style("fill", q).attr("height", s / 3).attr("y", s / 3).attr("width", 0 > v ? z(0) - z(v[0]) : z(v[0]) - z(0)).attr("x", I(v)).on("mouseover", function() {
r.elementMouseover({ value: v[0], label: y[0] || "Current", color: d3.select(this).style("fill") });
}).on("mousemove", function() {
r.elementMousemove({ value: v[0], label: y[0] || "Current", color: d3.select(this).style("fill") });
}).on("mouseout", function() {
r.elementMouseout({ value: v[0], label: y[0] || "Current", color: d3.select(this).style("fill") });
});
var J = s / 6, K = u.map(function(a2, b3) {
return { value: a2, label: x[b3] };
});
F.selectAll("path.nv-markerTriangle").data(K).enter().append("path").attr("class", "nv-markerTriangle").attr("transform", function(a2) {
return "translate(" + z(a2.value) + "," + s / 2 + ")";
}).attr("d", "M0," + J + "L" + J + "," + -J + " " + -J + "," + -J + "Z").on("mouseover", function(a2) {
r.elementMouseover({ value: a2.value, label: a2.label || "Previous", color: d3.select(this).style("fill"), pos: [z(a2.value), s / 2] });
}).on("mousemove", function(a2) {
r.elementMousemove({ value: a2.value, label: a2.label || "Previous", color: d3.select(this).style("fill") });
}).on("mouseout", function(a2, b3) {
r.elementMouseout({ value: a2.value, label: a2.label || "Previous", color: d3.select(this).style("fill") });
}), D.selectAll(".nv-range").on("mouseover", function(a2, b3) {
var c2 = w[b3] || (b3 ? 1 == b3 ? "Mean" : "Minimum" : "Maximum");
r.elementMouseover({ value: a2, label: c2, color: d3.select(this).style("fill") });
}).on("mousemove", function() {
r.elementMousemove({ value: v[0], label: y[0] || "Previous", color: d3.select(this).style("fill") });
}).on("mouseout", function(a2, b3) {
var c2 = w[b3] || (b3 ? 1 == b3 ? "Mean" : "Minimum" : "Maximum");
r.elementMouseout({ value: a2, label: c2, color: d3.select(this).style("fill") });
});
}), b;
}
var c = { top: 0, right: 0, bottom: 0, left: 0 }, d = "left", e = false, f = function(a2) {
return a2.ranges;
}, g = function(a2) {
return a2.markers ? a2.markers : [0];
}, h = function(a2) {
return a2.measures;
}, i = function(a2) {
return a2.rangeLabels ? a2.rangeLabels : [];
}, j = function(a2) {
return a2.markerLabels ? a2.markerLabels : [];
}, k = function(a2) {
return a2.measureLabels ? a2.measureLabels : [];
}, l = [0], m = 380, n = 30, o = null, p = null, q = a.utils.getColor(["#1f77b4"]), r = d3.dispatch("elementMouseover", "elementMouseout", "elementMousemove");
return b.dispatch = r, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { ranges: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, markers: { get: function() {
return g;
}, set: function(a2) {
g = a2;
} }, measures: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, forceX: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, width: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, height: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, tickFormat: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, margin: { get: function() {
return c;
}, set: function(a2) {
c.top = void 0 !== a2.top ? a2.top : c.top, c.right = void 0 !== a2.right ? a2.right : c.right, c.bottom = void 0 !== a2.bottom ? a2.bottom : c.bottom, c.left = void 0 !== a2.left ? a2.left : c.left;
} }, orient: { get: function() {
return d;
}, set: function(a2) {
d = a2, e = "right" == d || "bottom" == d;
} }, color: { get: function() {
return q;
}, set: function(b2) {
q = a.utils.getColor(b2);
} } }), a.utils.initOptions(b), b;
}, a.models.bulletChart = function() {
"use strict";
function b(d2) {
return d2.each(function(e2, o2) {
var p2 = d3.select(this);
a.utils.initSVG(p2);
var q = a.utils.availableWidth(k, p2, g), r = l - g.top - g.bottom;
if (b.update = function() {
b(d2);
}, b.container = this, !e2 || !h.call(this, e2, o2))
return a.utils.noData(b, p2), b;
p2.selectAll(".nv-noData").remove();
var s = h.call(this, e2, o2).slice().sort(d3.descending), t = i.call(this, e2, o2).slice().sort(d3.descending), u = j.call(this, e2, o2).slice().sort(d3.descending), v = p2.selectAll("g.nv-wrap.nv-bulletChart").data([e2]), w = v.enter().append("g").attr("class", "nvd3 nv-wrap nv-bulletChart"), x = w.append("g"), y = v.select("g");
x.append("g").attr("class", "nv-bulletWrap"), x.append("g").attr("class", "nv-titles"), v.attr("transform", "translate(" + g.left + "," + g.top + ")");
var z = d3.scale.linear().domain([0, Math.max(s[0], t[0], u[0])]).range(f ? [q, 0] : [0, q]), A = this.__chart__ || d3.scale.linear().domain([0, 1 / 0]).range(z.range());
this.__chart__ = z;
var B = x.select(".nv-titles").append("g").attr("text-anchor", "end").attr("transform", "translate(-6," + (l - g.top - g.bottom) / 2 + ")");
B.append("text").attr("class", "nv-title").text(function(a2) {
return a2.title;
}), B.append("text").attr("class", "nv-subtitle").attr("dy", "1em").text(function(a2) {
return a2.subtitle;
}), c.width(q).height(r);
var C = y.select(".nv-bulletWrap");
d3.transition(C).call(c);
var D = m || z.tickFormat(q / 100), E = y.selectAll("g.nv-tick").data(z.ticks(n ? n : q / 50), function(a2) {
return this.textContent || D(a2);
}), F = E.enter().append("g").attr("class", "nv-tick").attr("transform", function(a2) {
return "translate(" + A(a2) + ",0)";
}).style("opacity", 1e-6);
F.append("line").attr("y1", r).attr("y2", 7 * r / 6), F.append("text").attr("text-anchor", "middle").attr("dy", "1em").attr("y", 7 * r / 6).text(D);
var G = d3.transition(E).attr("transform", function(a2) {
return "translate(" + z(a2) + ",0)";
}).style("opacity", 1);
G.select("line").attr("y1", r).attr("y2", 7 * r / 6), G.select("text").attr("y", 7 * r / 6), d3.transition(E.exit()).attr("transform", function(a2) {
return "translate(" + z(a2) + ",0)";
}).style("opacity", 1e-6).remove();
}), d3.timer.flush(), b;
}
var c = a.models.bullet(), d = a.models.tooltip(), e = "left", f = false, g = { top: 5, right: 40, bottom: 20, left: 120 }, h = function(a2) {
return a2.ranges;
}, i = function(a2) {
return a2.markers ? a2.markers : [0];
}, j = function(a2) {
return a2.measures;
}, k = null, l = 55, m = null, n = null, o = null, p = d3.dispatch();
return d.duration(0).headerEnabled(false), c.dispatch.on("elementMouseover.tooltip", function(a2) {
a2.series = { key: a2.label, value: a2.value, color: a2.color }, d.data(a2).hidden(false);
}), c.dispatch.on("elementMouseout.tooltip", function(a2) {
d.hidden(true);
}), c.dispatch.on("elementMousemove.tooltip", function(a2) {
d();
}), b.bullet = c, b.dispatch = p, b.tooltip = d, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { ranges: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, markers: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, measures: { get: function() {
return j;
}, set: function(a2) {
j = a2;
} }, width: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, height: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, tickFormat: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, ticks: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, noData: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, margin: { get: function() {
return g;
}, set: function(a2) {
g.top = void 0 !== a2.top ? a2.top : g.top, g.right = void 0 !== a2.right ? a2.right : g.right, g.bottom = void 0 !== a2.bottom ? a2.bottom : g.bottom, g.left = void 0 !== a2.left ? a2.left : g.left;
} }, orient: { get: function() {
return e;
}, set: function(a2) {
e = a2, f = "right" == e || "bottom" == e;
} } }), a.utils.inheritOptions(b, c), a.utils.initOptions(b), b;
}, a.models.candlestickBar = function() {
"use strict";
function b(x2) {
return x2.each(function(b2) {
c = d3.select(this);
var x3 = a.utils.availableWidth(i, c, h), y2 = a.utils.availableHeight(j, c, h);
a.utils.initSVG(c);
var A = x3 / b2[0].values.length * 0.45;
l.domain(d || d3.extent(b2[0].values.map(n).concat(t))), v ? l.range(f || [0.5 * x3 / b2[0].values.length, x3 * (b2[0].values.length - 0.5) / b2[0].values.length]) : l.range(f || [5 + A / 2, x3 - A / 2 - 5]), m.domain(e || [d3.min(b2[0].values.map(s).concat(u)), d3.max(b2[0].values.map(r).concat(u))]).range(g || [y2, 0]), l.domain()[0] === l.domain()[1] && (l.domain()[0] ? l.domain([l.domain()[0] - 0.01 * l.domain()[0], l.domain()[1] + 0.01 * l.domain()[1]]) : l.domain([-1, 1])), m.domain()[0] === m.domain()[1] && (m.domain()[0] ? m.domain([m.domain()[0] + 0.01 * m.domain()[0], m.domain()[1] - 0.01 * m.domain()[1]]) : m.domain([-1, 1]));
var B = d3.select(this).selectAll("g.nv-wrap.nv-candlestickBar").data([b2[0].values]), C = B.enter().append("g").attr("class", "nvd3 nv-wrap nv-candlestickBar"), D = C.append("defs"), E = C.append("g"), F = B.select("g");
E.append("g").attr("class", "nv-ticks"), B.attr("transform", "translate(" + h.left + "," + h.top + ")"), c.on("click", function(a2, b3) {
z.chartClick({ data: a2, index: b3, pos: d3.event, id: k });
}), D.append("clipPath").attr("id", "nv-chart-clip-path-" + k).append("rect"), B.select("#nv-chart-clip-path-" + k + " rect").attr("width", x3).attr("height", y2), F.attr("clip-path", w ? "url(#nv-chart-clip-path-" + k + ")" : "");
var G = B.select(".nv-ticks").selectAll(".nv-tick").data(function(a2) {
return a2;
});
G.exit().remove();
var H = G.enter().append("g");
G.attr("class", function(a2, b3, c2) {
return (p(a2, b3) > q(a2, b3) ? "nv-tick negative" : "nv-tick positive") + " nv-tick-" + c2 + "-" + b3;
});
H.append("line").attr("class", "nv-candlestick-lines").attr("transform", function(a2, b3) {
return "translate(" + l(n(a2, b3)) + ",0)";
}).attr("x1", 0).attr("y1", function(a2, b3) {
return m(r(a2, b3));
}).attr("x2", 0).attr("y2", function(a2, b3) {
return m(s(a2, b3));
}), H.append("rect").attr("class", "nv-candlestick-rects nv-bars").attr("transform", function(a2, b3) {
return "translate(" + (l(n(a2, b3)) - A / 2) + "," + (m(o(a2, b3)) - (p(a2, b3) > q(a2, b3) ? m(q(a2, b3)) - m(p(a2, b3)) : 0)) + ")";
}).attr("x", 0).attr("y", 0).attr("width", A).attr("height", function(a2, b3) {
var c2 = p(a2, b3), d2 = q(a2, b3);
return c2 > d2 ? m(d2) - m(c2) : m(c2) - m(d2);
});
G.select(".nv-candlestick-lines").transition().attr("transform", function(a2, b3) {
return "translate(" + l(n(a2, b3)) + ",0)";
}).attr("x1", 0).attr("y1", function(a2, b3) {
return m(r(a2, b3));
}).attr("x2", 0).attr("y2", function(a2, b3) {
return m(s(a2, b3));
}), G.select(".nv-candlestick-rects").transition().attr("transform", function(a2, b3) {
return "translate(" + (l(n(a2, b3)) - A / 2) + "," + (m(o(a2, b3)) - (p(a2, b3) > q(a2, b3) ? m(q(a2, b3)) - m(p(a2, b3)) : 0)) + ")";
}).attr("x", 0).attr("y", 0).attr("width", A).attr("height", function(a2, b3) {
var c2 = p(a2, b3), d2 = q(a2, b3);
return c2 > d2 ? m(d2) - m(c2) : m(c2) - m(d2);
});
}), b;
}
var c, d, e, f, g, h = { top: 0, right: 0, bottom: 0, left: 0 }, i = null, j = null, k = Math.floor(1e4 * Math.random()), l = d3.scale.linear(), m = d3.scale.linear(), n = function(a2) {
return a2.x;
}, o = function(a2) {
return a2.y;
}, p = function(a2) {
return a2.open;
}, q = function(a2) {
return a2.close;
}, r = function(a2) {
return a2.high;
}, s = function(a2) {
return a2.low;
}, t = [], u = [], v = false, w = true, x = a.utils.defaultColor(), y = false, z = d3.dispatch("stateChange", "changeState", "renderEnd", "chartClick", "elementClick", "elementDblClick", "elementMouseover", "elementMouseout", "elementMousemove");
return b.highlightPoint = function(a2, d2) {
b.clearHighlights(), c.select(".nv-candlestickBar .nv-tick-0-" + a2).classed("hover", d2);
}, b.clearHighlights = function() {
c.select(".nv-candlestickBar .nv-tick.hover").classed("hover", false);
}, b.dispatch = z, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, height: { get: function() {
return j;
}, set: function(a2) {
j = a2;
} }, xScale: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, yScale: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, xDomain: { get: function() {
return d;
}, set: function(a2) {
d = a2;
} }, yDomain: { get: function() {
return e;
}, set: function(a2) {
e = a2;
} }, xRange: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, yRange: { get: function() {
return g;
}, set: function(a2) {
g = a2;
} }, forceX: { get: function() {
return t;
}, set: function(a2) {
t = a2;
} }, forceY: { get: function() {
return u;
}, set: function(a2) {
u = a2;
} }, padData: { get: function() {
return v;
}, set: function(a2) {
v = a2;
} }, clipEdge: { get: function() {
return w;
}, set: function(a2) {
w = a2;
} }, id: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, interactive: { get: function() {
return y;
}, set: function(a2) {
y = a2;
} }, x: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, y: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, open: { get: function() {
return p();
}, set: function(a2) {
p = a2;
} }, close: { get: function() {
return q();
}, set: function(a2) {
q = a2;
} }, high: { get: function() {
return r;
}, set: function(a2) {
r = a2;
} }, low: { get: function() {
return s;
}, set: function(a2) {
s = a2;
} }, margin: { get: function() {
return h;
}, set: function(a2) {
h.top = void 0 != a2.top ? a2.top : h.top, h.right = void 0 != a2.right ? a2.right : h.right, h.bottom = void 0 != a2.bottom ? a2.bottom : h.bottom, h.left = void 0 != a2.left ? a2.left : h.left;
} }, color: { get: function() {
return x;
}, set: function(b2) {
x = a.utils.getColor(b2);
} } }), a.utils.initOptions(b), b;
}, a.models.cumulativeLineChart = function() {
"use strict";
function b(l2) {
return H.reset(), H.models(f), r && H.models(g), s && H.models(h), l2.each(function(l3) {
function A2(a2, c2) {
d3.select(b.container).style("cursor", "ew-resize");
}
function E2(a2, b2) {
G.x = d3.event.x, G.i = Math.round(F.invert(G.x)), K2();
}
function H2(a2, c2) {
d3.select(b.container).style("cursor", "auto"), y.index = G.i, C.stateChange(y);
}
function K2() {
ba.data([G]);
var a2 = b.duration();
b.duration(0), b.update(), b.duration(a2);
}
var L = d3.select(this);
a.utils.initSVG(L), L.classed("nv-chart-" + x, true);
var M = this, N = a.utils.availableWidth(o, L, m), O = a.utils.availableHeight(p, L, m);
if (b.update = function() {
0 === D ? L.call(b) : L.transition().duration(D).call(b);
}, b.container = this, y.setter(J(l3), b.update).getter(I(l3)).update(), y.disabled = l3.map(function(a2) {
return !!a2.disabled;
}), !z) {
var P;
z = {};
for (P in y)
y[P] instanceof Array ? z[P] = y[P].slice(0) : z[P] = y[P];
}
var Q = d3.behavior.drag().on("dragstart", A2).on("drag", E2).on("dragend", H2);
if (!(l3 && l3.length && l3.filter(function(a2) {
return a2.values.length;
}).length))
return a.utils.noData(b, L), b;
if (L.selectAll(".nv-noData").remove(), d = f.xScale(), e = f.yScale(), w)
f.yDomain(null);
else {
var R = l3.filter(function(a2) {
return !a2.disabled;
}).map(function(a2, b2) {
var c2 = d3.extent(a2.values, f.y());
return c2[0] < -0.95 && (c2[0] = -0.95), [(c2[0] - c2[1]) / (1 + c2[1]), (c2[1] - c2[0]) / (1 + c2[0])];
}), S = [d3.min(R, function(a2) {
return a2[0];
}), d3.max(R, function(a2) {
return a2[1];
})];
f.yDomain(S);
}
F.domain([0, l3[0].values.length - 1]).range([0, N]).clamp(true);
var l3 = c(G.i, l3), T = v ? "none" : "all", U = L.selectAll("g.nv-wrap.nv-cumulativeLine").data([l3]), V = U.enter().append("g").attr("class", "nvd3 nv-wrap nv-cumulativeLine").append("g"), W = U.select("g");
if (V.append("g").attr("class", "nv-interactive"), V.append("g").attr("class", "nv-x nv-axis").style("pointer-events", "none"), V.append("g").attr("class", "nv-y nv-axis"), V.append("g").attr("class", "nv-background"), V.append("g").attr("class", "nv-linesWrap").style("pointer-events", T), V.append("g").attr("class", "nv-avgLinesWrap").style("pointer-events", "none"), V.append("g").attr("class", "nv-legendWrap"), V.append("g").attr("class", "nv-controlsWrap"), q && (i.width(N), W.select(".nv-legendWrap").datum(l3).call(i), m.top != i.height() && (m.top = i.height(), O = a.utils.availableHeight(p, L, m)), W.select(".nv-legendWrap").attr("transform", "translate(0," + -m.top + ")")), u) {
var X = [{ key: "Re-scale y-axis", disabled: !w }];
j.width(140).color(["#444", "#444", "#444"]).rightAlign(false).margin({ top: 5, right: 0, bottom: 5, left: 20 }), W.select(".nv-controlsWrap").datum(X).attr("transform", "translate(0," + -m.top + ")").call(j);
}
U.attr("transform", "translate(" + m.left + "," + m.top + ")"), t && W.select(".nv-y.nv-axis").attr("transform", "translate(" + N + ",0)");
var Y = l3.filter(function(a2) {
return a2.tempDisabled;
});
U.select(".tempDisabled").remove(), Y.length && U.append("text").attr("class", "tempDisabled").attr("x", N / 2).attr("y", "-.71em").style("text-anchor", "end").text(Y.map(function(a2) {
return a2.key;
}).join(", ") + " values cannot be calculated for this time period."), v && (k.width(N).height(O).margin({ left: m.left, top: m.top }).svgContainer(L).xScale(d), U.select(".nv-interactive").call(k)), V.select(".nv-background").append("rect"), W.select(".nv-background rect").attr("width", N).attr("height", O), f.y(function(a2) {
return a2.display.y;
}).width(N).height(O).color(l3.map(function(a2, b2) {
return a2.color || n(a2, b2);
}).filter(function(a2, b2) {
return !l3[b2].disabled && !l3[b2].tempDisabled;
}));
var Z = W.select(".nv-linesWrap").datum(l3.filter(function(a2) {
return !a2.disabled && !a2.tempDisabled;
}));
Z.call(f), l3.forEach(function(a2, b2) {
a2.seriesIndex = b2;
});
var $ = l3.filter(function(a2) {
return !a2.disabled && !!B(a2);
}), _ = W.select(".nv-avgLinesWrap").selectAll("line").data($, function(a2) {
return a2.key;
}), aa = function(a2) {
var b2 = e(B(a2));
return 0 > b2 ? 0 : b2 > O ? O : b2;
};
_.enter().append("line").style("stroke-width", 2).style("stroke-dasharray", "10,10").style("stroke", function(a2, b2) {
return f.color()(a2, a2.seriesIndex);
}).attr("x1", 0).attr("x2", N).attr("y1", aa).attr("y2", aa), _.style("stroke-opacity", function(a2) {
var b2 = e(B(a2));
return 0 > b2 || b2 > O ? 0 : 1;
}).attr("x1", 0).attr("x2", N).attr("y1", aa).attr("y2", aa), _.exit().remove();
var ba = Z.selectAll(".nv-indexLine").data([G]);
ba.enter().append("rect").attr("class", "nv-indexLine").attr("width", 3).attr("x", -2).attr("fill", "red").attr("fill-opacity", 0.5).style("pointer-events", "all").call(Q), ba.attr("transform", function(a2) {
return "translate(" + F(a2.i) + ",0)";
}).attr("height", O), r && (g.scale(d)._ticks(a.utils.calcTicksX(N / 70, l3)).tickSize(-O, 0), W.select(".nv-x.nv-axis").attr("transform", "translate(0," + e.range()[0] + ")"), W.select(".nv-x.nv-axis").call(g)), s && (h.scale(e)._ticks(a.utils.calcTicksY(O / 36, l3)).tickSize(-N, 0), W.select(".nv-y.nv-axis").call(h)), W.select(".nv-background rect").on("click", function() {
G.x = d3.mouse(this)[0], G.i = Math.round(F.invert(G.x)), y.index = G.i, C.stateChange(y), K2();
}), f.dispatch.on("elementClick", function(a2) {
G.i = a2.pointIndex, G.x = F(G.i), y.index = G.i, C.stateChange(y), K2();
}), j.dispatch.on("legendClick", function(a2, c2) {
a2.disabled = !a2.disabled, w = !a2.disabled, y.rescaleY = w, C.stateChange(y), b.update();
}), i.dispatch.on("stateChange", function(a2) {
for (var c2 in a2)
y[c2] = a2[c2];
C.stateChange(y), b.update();
}), k.dispatch.on("elementMousemove", function(c2) {
f.clearHighlights();
var d2, e2, i2, j2 = [];
if (l3.filter(function(a2, b2) {
return a2.seriesIndex = b2, !a2.disabled;
}).forEach(function(g2, h2) {
e2 = a.interactiveBisect(g2.values, c2.pointXValue, b.x()), f.highlightPoint(h2, e2, true);
var k2 = g2.values[e2];
"undefined" != typeof k2 && ("undefined" == typeof d2 && (d2 = k2), "undefined" == typeof i2 && (i2 = b.xScale()(b.x()(k2, e2))), j2.push({ key: g2.key, value: b.y()(k2, e2), color: n(g2, g2.seriesIndex) }));
}), j2.length > 2) {
var m2 = b.yScale().invert(c2.mouseY), o2 = Math.abs(b.yScale().domain()[0] - b.yScale().domain()[1]), p2 = 0.03 * o2, q2 = a.nearestValueIndex(j2.map(function(a2) {
return a2.value;
}), m2, p2);
null !== q2 && (j2[q2].highlight = true);
}
var r2 = g.tickFormat()(b.x()(d2, e2), e2);
k.tooltip.chartContainer(M.parentNode).valueFormatter(function(a2, b2) {
return h.tickFormat()(a2);
}).data({ value: r2, series: j2 })(), k.renderGuideLine(i2);
}), k.dispatch.on("elementMouseout", function(a2) {
f.clearHighlights();
}), C.on("changeState", function(a2) {
"undefined" != typeof a2.disabled && (l3.forEach(function(b2, c2) {
b2.disabled = a2.disabled[c2];
}), y.disabled = a2.disabled), "undefined" != typeof a2.index && (G.i = a2.index, G.x = F(G.i), y.index = a2.index, ba.data([G])), "undefined" != typeof a2.rescaleY && (w = a2.rescaleY), b.update();
});
}), H.renderEnd("cumulativeLineChart immediate"), b;
}
function c(a2, b2) {
return K || (K = f.y()), b2.map(function(b3, c2) {
if (!b3.values)
return b3;
var d2 = b3.values[a2];
if (null == d2)
return b3;
var e2 = K(d2, a2);
return -0.95 > e2 && !E ? (b3.tempDisabled = true, b3) : (b3.tempDisabled = false, b3.values = b3.values.map(function(a3, b4) {
return a3.display = { y: (K(a3, b4) - e2) / (1 + e2) }, a3;
}), b3);
});
}
var d, e, f = a.models.line(), g = a.models.axis(), h = a.models.axis(), i = a.models.legend(), j = a.models.legend(), k = a.interactiveGuideline(), l = a.models.tooltip(), m = { top: 30, right: 30, bottom: 50, left: 60 }, n = a.utils.defaultColor(), o = null, p = null, q = true, r = true, s = true, t = false, u = true, v = false, w = true, x = f.id(), y = a.utils.state(), z = null, A = null, B = function(a2) {
return a2.average;
}, C = d3.dispatch("stateChange", "changeState", "renderEnd"), D = 250, E = false;
y.index = 0, y.rescaleY = w, g.orient("bottom").tickPadding(7), h.orient(t ? "right" : "left"), l.valueFormatter(function(a2, b2) {
return h.tickFormat()(a2, b2);
}).headerFormatter(function(a2, b2) {
return g.tickFormat()(a2, b2);
}), j.updateState(false);
var F = d3.scale.linear(), G = { i: 0, x: 0 }, H = a.utils.renderWatch(C, D), I = function(a2) {
return function() {
return { active: a2.map(function(a3) {
return !a3.disabled;
}), index: G.i, rescaleY: w };
};
}, J = function(a2) {
return function(b2) {
void 0 !== b2.index && (G.i = b2.index), void 0 !== b2.rescaleY && (w = b2.rescaleY), void 0 !== b2.active && a2.forEach(function(a3, c2) {
a3.disabled = !b2.active[c2];
});
};
};
f.dispatch.on("elementMouseover.tooltip", function(a2) {
var c2 = { x: b.x()(a2.point), y: b.y()(a2.point), color: a2.point.color };
a2.point = c2, l.data(a2).hidden(false);
}), f.dispatch.on("elementMouseout.tooltip", function(a2) {
l.hidden(true);
});
var K = null;
return b.dispatch = C, b.lines = f, b.legend = i, b.controls = j, b.xAxis = g, b.yAxis = h, b.interactiveLayer = k, b.state = y, b.tooltip = l, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, height: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, rescaleY: { get: function() {
return w;
}, set: function(a2) {
w = a2;
} }, showControls: { get: function() {
return u;
}, set: function(a2) {
u = a2;
} }, showLegend: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, average: { get: function() {
return B;
}, set: function(a2) {
B = a2;
} }, defaultState: { get: function() {
return z;
}, set: function(a2) {
z = a2;
} }, noData: { get: function() {
return A;
}, set: function(a2) {
A = a2;
} }, showXAxis: { get: function() {
return r;
}, set: function(a2) {
r = a2;
} }, showYAxis: { get: function() {
return s;
}, set: function(a2) {
s = a2;
} }, noErrorCheck: { get: function() {
return E;
}, set: function(a2) {
E = a2;
} }, margin: { get: function() {
return m;
}, set: function(a2) {
m.top = void 0 !== a2.top ? a2.top : m.top, m.right = void 0 !== a2.right ? a2.right : m.right, m.bottom = void 0 !== a2.bottom ? a2.bottom : m.bottom, m.left = void 0 !== a2.left ? a2.left : m.left;
} }, color: { get: function() {
return n;
}, set: function(b2) {
n = a.utils.getColor(b2), i.color(n);
} }, useInteractiveGuideline: { get: function() {
return v;
}, set: function(a2) {
v = a2, a2 === true && (b.interactive(false), b.useVoronoi(false));
} }, rightAlignYAxis: { get: function() {
return t;
}, set: function(a2) {
t = a2, h.orient(a2 ? "right" : "left");
} }, duration: { get: function() {
return D;
}, set: function(a2) {
D = a2, f.duration(D), g.duration(D), h.duration(D), H.reset(D);
} } }), a.utils.inheritOptions(b, f), a.utils.initOptions(b), b;
}, a.models.discreteBar = function() {
"use strict";
function b(m2) {
return y.reset(), m2.each(function(b2) {
var m3 = k - j.left - j.right, x2 = l - j.top - j.bottom;
c = d3.select(this), a.utils.initSVG(c), b2.forEach(function(a2, b3) {
a2.values.forEach(function(a3) {
a3.series = b3;
});
});
var z = d && e ? [] : b2.map(function(a2) {
return a2.values.map(function(a3, b3) {
return { x: p(a3, b3), y: q(a3, b3), y0: a3.y0 };
});
});
n.domain(d || d3.merge(z).map(function(a2) {
return a2.x;
})).rangeBands(f || [0, m3], 0.1), o.domain(e || d3.extent(d3.merge(z).map(function(a2) {
return a2.y;
}).concat(r))), t ? o.range(g || [x2 - (o.domain()[0] < 0 ? 12 : 0), o.domain()[1] > 0 ? 12 : 0]) : o.range(g || [x2, 0]), h = h || n, i = i || o.copy().range([o(0), o(0)]);
var A = c.selectAll("g.nv-wrap.nv-discretebar").data([b2]), B = A.enter().append("g").attr("class", "nvd3 nv-wrap nv-discretebar"), C = B.append("g");
A.select("g");
C.append("g").attr("class", "nv-groups"), A.attr("transform", "translate(" + j.left + "," + j.top + ")");
var D = A.select(".nv-groups").selectAll(".nv-group").data(function(a2) {
return a2;
}, function(a2) {
return a2.key;
});
D.enter().append("g").style("stroke-opacity", 1e-6).style("fill-opacity", 1e-6), D.exit().watchTransition(y, "discreteBar: exit groups").style("stroke-opacity", 1e-6).style("fill-opacity", 1e-6).remove(), D.attr("class", function(a2, b3) {
return "nv-group nv-series-" + b3;
}).classed("hover", function(a2) {
return a2.hover;
}), D.watchTransition(y, "discreteBar: groups").style("stroke-opacity", 1).style("fill-opacity", 0.75);
var E = D.selectAll("g.nv-bar").data(function(a2) {
return a2.values;
});
E.exit().remove();
var F = E.enter().append("g").attr("transform", function(a2, b3, c2) {
return "translate(" + (n(p(a2, b3)) + 0.05 * n.rangeBand()) + ", " + o(0) + ")";
}).on("mouseover", function(a2, b3) {
d3.select(this).classed("hover", true), v.elementMouseover({ data: a2, index: b3, color: d3.select(this).style("fill") });
}).on("mouseout", function(a2, b3) {
d3.select(this).classed("hover", false), v.elementMouseout({ data: a2, index: b3, color: d3.select(this).style("fill") });
}).on("mousemove", function(a2, b3) {
v.elementMousemove({ data: a2, index: b3, color: d3.select(this).style("fill") });
}).on("click", function(a2, b3) {
v.elementClick({ data: a2, index: b3, color: d3.select(this).style("fill") }), d3.event.stopPropagation();
}).on("dblclick", function(a2, b3) {
v.elementDblClick({ data: a2, index: b3, color: d3.select(this).style("fill") }), d3.event.stopPropagation();
});
F.append("rect").attr("height", 0).attr("width", 0.9 * n.rangeBand() / b2.length), t ? (F.append("text").attr("text-anchor", "middle"), E.select("text").text(function(a2, b3) {
return u(q(a2, b3));
}).watchTransition(y, "discreteBar: bars text").attr("x", 0.9 * n.rangeBand() / 2).attr("y", function(a2, b3) {
return q(a2, b3) < 0 ? o(q(a2, b3)) - o(0) + 12 : -4;
})) : E.selectAll("text").remove(), E.attr("class", function(a2, b3) {
return q(a2, b3) < 0 ? "nv-bar negative" : "nv-bar positive";
}).style("fill", function(a2, b3) {
return a2.color || s(a2, b3);
}).style("stroke", function(a2, b3) {
return a2.color || s(a2, b3);
}).select("rect").attr("class", w).watchTransition(y, "discreteBar: bars rect").attr("width", 0.9 * n.rangeBand() / b2.length), E.watchTransition(y, "discreteBar: bars").attr("transform", function(a2, b3) {
var c2 = n(p(a2, b3)) + 0.05 * n.rangeBand(), d2 = q(a2, b3) < 0 ? o(0) : o(0) - o(q(a2, b3)) < 1 ? o(0) - 1 : o(q(a2, b3));
return "translate(" + c2 + ", " + d2 + ")";
}).select("rect").attr("height", function(a2, b3) {
return Math.max(Math.abs(o(q(a2, b3)) - o(e && e[0] || 0)) || 1);
}), h = n.copy(), i = o.copy();
}), y.renderEnd("discreteBar immediate"), b;
}
var c, d, e, f, g, h, i, j = { top: 0, right: 0, bottom: 0, left: 0 }, k = 960, l = 500, m = Math.floor(1e4 * Math.random()), n = d3.scale.ordinal(), o = d3.scale.linear(), p = function(a2) {
return a2.x;
}, q = function(a2) {
return a2.y;
}, r = [0], s = a.utils.defaultColor(), t = false, u = d3.format(",.2f"), v = d3.dispatch("chartClick", "elementClick", "elementDblClick", "elementMouseover", "elementMouseout", "elementMousemove", "renderEnd"), w = "discreteBar", x = 250, y = a.utils.renderWatch(v, x);
return b.dispatch = v, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, height: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, forceY: { get: function() {
return r;
}, set: function(a2) {
r = a2;
} }, showValues: { get: function() {
return t;
}, set: function(a2) {
t = a2;
} }, x: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, y: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, xScale: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, yScale: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, xDomain: { get: function() {
return d;
}, set: function(a2) {
d = a2;
} }, yDomain: { get: function() {
return e;
}, set: function(a2) {
e = a2;
} }, xRange: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, yRange: { get: function() {
return g;
}, set: function(a2) {
g = a2;
} }, valueFormat: { get: function() {
return u;
}, set: function(a2) {
u = a2;
} }, id: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, rectClass: { get: function() {
return w;
}, set: function(a2) {
w = a2;
} }, margin: { get: function() {
return j;
}, set: function(a2) {
j.top = void 0 !== a2.top ? a2.top : j.top, j.right = void 0 !== a2.right ? a2.right : j.right, j.bottom = void 0 !== a2.bottom ? a2.bottom : j.bottom, j.left = void 0 !== a2.left ? a2.left : j.left;
} }, color: { get: function() {
return s;
}, set: function(b2) {
s = a.utils.getColor(b2);
} }, duration: { get: function() {
return x;
}, set: function(a2) {
x = a2, y.reset(x);
} } }), a.utils.initOptions(b), b;
}, a.models.discreteBarChart = function() {
"use strict";
function b(h2) {
return v.reset(), v.models(e), m && v.models(f), n && v.models(g), h2.each(function(h3) {
var l2 = d3.select(this);
a.utils.initSVG(l2);
var s2 = a.utils.availableWidth(j, l2, i), v2 = a.utils.availableHeight(k, l2, i);
if (b.update = function() {
t.beforeUpdate(), l2.transition().duration(u).call(b);
}, b.container = this, !(h3 && h3.length && h3.filter(function(a2) {
return a2.values.length;
}).length))
return a.utils.noData(b, l2), b;
l2.selectAll(".nv-noData").remove(), c = e.xScale(), d = e.yScale().clamp(true);
var w = l2.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([h3]), x = w.enter().append("g").attr("class", "nvd3 nv-wrap nv-discreteBarWithAxes").append("g"), y = x.append("defs"), z = w.select("g");
x.append("g").attr("class", "nv-x nv-axis"), x.append("g").attr("class", "nv-y nv-axis").append("g").attr("class", "nv-zeroLine").append("line"), x.append("g").attr("class", "nv-barsWrap"), z.attr("transform", "translate(" + i.left + "," + i.top + ")"), o && z.select(".nv-y.nv-axis").attr("transform", "translate(" + s2 + ",0)"), e.width(s2).height(v2);
var A = z.select(".nv-barsWrap").datum(h3.filter(function(a2) {
return !a2.disabled;
}));
if (A.transition().call(e), y.append("clipPath").attr("id", "nv-x-label-clip-" + e.id()).append("rect"), z.select("#nv-x-label-clip-" + e.id() + " rect").attr("width", c.rangeBand() * (p ? 2 : 1)).attr("height", 16).attr("x", -c.rangeBand() / (p ? 1 : 2)), m) {
f.scale(c)._ticks(a.utils.calcTicksX(s2 / 100, h3)).tickSize(-v2, 0), z.select(".nv-x.nv-axis").attr("transform", "translate(0," + (d.range()[0] + (e.showValues() && d.domain()[0] < 0 ? 16 : 0)) + ")"), z.select(".nv-x.nv-axis").call(f);
var B = z.select(".nv-x.nv-axis").selectAll("g");
p && B.selectAll("text").attr("transform", function(a2, b2, c2) {
return "translate(0," + (c2 % 2 == 0 ? "5" : "17") + ")";
}), r && B.selectAll(".tick text").attr("transform", "rotate(" + r + " 0,0)").style("text-anchor", r > 0 ? "start" : "end"), q && z.selectAll(".tick text").call(a.utils.wrapTicks, b.xAxis.rangeBand());
}
n && (g.scale(d)._ticks(a.utils.calcTicksY(v2 / 36, h3)).tickSize(-s2, 0), z.select(".nv-y.nv-axis").call(g)), z.select(".nv-zeroLine line").attr("x1", 0).attr("x2", s2).attr("y1", d(0)).attr("y2", d(0));
}), v.renderEnd("discreteBar chart immediate"), b;
}
var c, d, e = a.models.discreteBar(), f = a.models.axis(), g = a.models.axis(), h = a.models.tooltip(), i = { top: 15, right: 10, bottom: 50, left: 60 }, j = null, k = null, l = a.utils.getColor(), m = true, n = true, o = false, p = false, q = false, r = 0, s = null, t = d3.dispatch("beforeUpdate", "renderEnd"), u = 250;
f.orient("bottom").showMaxMin(false).tickFormat(function(a2) {
return a2;
}), g.orient(o ? "right" : "left").tickFormat(d3.format(",.1f")), h.duration(0).headerEnabled(false).valueFormatter(function(a2, b2) {
return g.tickFormat()(a2, b2);
}).keyFormatter(function(a2, b2) {
return f.tickFormat()(a2, b2);
});
var v = a.utils.renderWatch(t, u);
return e.dispatch.on("elementMouseover.tooltip", function(a2) {
a2.series = { key: b.x()(a2.data), value: b.y()(a2.data), color: a2.color }, h.data(a2).hidden(false);
}), e.dispatch.on("elementMouseout.tooltip", function(a2) {
h.hidden(true);
}), e.dispatch.on("elementMousemove.tooltip", function(a2) {
h();
}), b.dispatch = t, b.discretebar = e, b.xAxis = f, b.yAxis = g, b.tooltip = h, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return j;
}, set: function(a2) {
j = a2;
} }, height: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, staggerLabels: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, rotateLabels: { get: function() {
return r;
}, set: function(a2) {
r = a2;
} }, wrapLabels: { get: function() {
return q;
}, set: function(a2) {
q = !!a2;
} }, showXAxis: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, showYAxis: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, noData: { get: function() {
return s;
}, set: function(a2) {
s = a2;
} }, margin: { get: function() {
return i;
}, set: function(a2) {
i.top = void 0 !== a2.top ? a2.top : i.top, i.right = void 0 !== a2.right ? a2.right : i.right, i.bottom = void 0 !== a2.bottom ? a2.bottom : i.bottom, i.left = void 0 !== a2.left ? a2.left : i.left;
} }, duration: { get: function() {
return u;
}, set: function(a2) {
u = a2, v.reset(u), e.duration(u), f.duration(u), g.duration(u);
} }, color: { get: function() {
return l;
}, set: function(b2) {
l = a.utils.getColor(b2), e.color(l);
} }, rightAlignYAxis: { get: function() {
return o;
}, set: function(a2) {
o = a2, g.orient(a2 ? "right" : "left");
} } }), a.utils.inheritOptions(b, e), a.utils.initOptions(b), b;
}, a.models.distribution = function() {
"use strict";
function b(k2) {
return m.reset(), k2.each(function(b2) {
var k3 = (e - ("x" === g ? d.left + d.right : d.top + d.bottom), "x" == g ? "y" : "x"), l2 = d3.select(this);
a.utils.initSVG(l2), c = c || j;
var n = l2.selectAll("g.nv-distribution").data([b2]), o = n.enter().append("g").attr("class", "nvd3 nv-distribution"), p = (o.append("g"), n.select("g"));
n.attr("transform", "translate(" + d.left + "," + d.top + ")");
var q = p.selectAll("g.nv-dist").data(function(a2) {
return a2;
}, function(a2) {
return a2.key;
});
q.enter().append("g"), q.attr("class", function(a2, b3) {
return "nv-dist nv-series-" + b3;
}).style("stroke", function(a2, b3) {
return i(a2, b3);
});
var r = q.selectAll("line.nv-dist" + g).data(function(a2) {
return a2.values;
});
r.enter().append("line").attr(g + "1", function(a2, b3) {
return c(h(a2, b3));
}).attr(g + "2", function(a2, b3) {
return c(h(a2, b3));
}), m.transition(q.exit().selectAll("line.nv-dist" + g), "dist exit").attr(g + "1", function(a2, b3) {
return j(h(a2, b3));
}).attr(g + "2", function(a2, b3) {
return j(h(a2, b3));
}).style("stroke-opacity", 0).remove(), r.attr("class", function(a2, b3) {
return "nv-dist" + g + " nv-dist" + g + "-" + b3;
}).attr(k3 + "1", 0).attr(k3 + "2", f), m.transition(r, "dist").attr(g + "1", function(a2, b3) {
return j(h(a2, b3));
}).attr(g + "2", function(a2, b3) {
return j(h(a2, b3));
}), c = j.copy();
}), m.renderEnd("distribution immediate"), b;
}
var c, d = { top: 0, right: 0, bottom: 0, left: 0 }, e = 400, f = 8, g = "x", h = function(a2) {
return a2[g];
}, i = a.utils.defaultColor(), j = d3.scale.linear(), k = 250, l = d3.dispatch("renderEnd"), m = a.utils.renderWatch(l, k);
return b.options = a.utils.optionsFunc.bind(b), b.dispatch = l, b.margin = function(a2) {
return arguments.length ? (d.top = "undefined" != typeof a2.top ? a2.top : d.top, d.right = "undefined" != typeof a2.right ? a2.right : d.right, d.bottom = "undefined" != typeof a2.bottom ? a2.bottom : d.bottom, d.left = "undefined" != typeof a2.left ? a2.left : d.left, b) : d;
}, b.width = function(a2) {
return arguments.length ? (e = a2, b) : e;
}, b.axis = function(a2) {
return arguments.length ? (g = a2, b) : g;
}, b.size = function(a2) {
return arguments.length ? (f = a2, b) : f;
}, b.getData = function(a2) {
return arguments.length ? (h = d3.functor(a2), b) : h;
}, b.scale = function(a2) {
return arguments.length ? (j = a2, b) : j;
}, b.color = function(c2) {
return arguments.length ? (i = a.utils.getColor(c2), b) : i;
}, b.duration = function(a2) {
return arguments.length ? (k = a2, m.reset(k), b) : k;
}, b;
}, a.models.furiousLegend = function() {
"use strict";
function b(q) {
function r(a2, b2) {
return "furious" != p ? "#000" : n ? a2.disengaged ? g(a2, b2) : "#fff" : n ? void 0 : a2.disabled ? g(a2, b2) : "#fff";
}
function s(a2, b2) {
return n && "furious" == p ? a2.disengaged ? "#fff" : g(a2, b2) : a2.disabled ? "#fff" : g(a2, b2);
}
return q.each(function(b2) {
var q2 = d - c.left - c.right, t = d3.select(this);
a.utils.initSVG(t);
var u = t.selectAll("g.nv-legend").data([b2]), v = (u.enter().append("g").attr("class", "nvd3 nv-legend").append("g"), u.select("g"));
u.attr("transform", "translate(" + c.left + "," + c.top + ")");
var w, x = v.selectAll(".nv-series").data(function(a2) {
return "furious" != p ? a2 : a2.filter(function(a3) {
return n ? true : !a3.disengaged;
});
}), y = x.enter().append("g").attr("class", "nv-series");
if ("classic" == p)
y.append("circle").style("stroke-width", 2).attr("class", "nv-legend-symbol").attr("r", 5), w = x.select("circle");
else if ("furious" == p) {
y.append("rect").style("stroke-width", 2).attr("class", "nv-legend-symbol").attr("rx", 3).attr("ry", 3), w = x.select("rect"), y.append("g").attr("class", "nv-check-box").property("innerHTML", '<path d="M0.5,5 L22.5,5 L22.5,26.5 L0.5,26.5 L0.5,5 Z" class="nv-box"></path><path d="M5.5,12.8618467 L11.9185089,19.2803556 L31,0.198864511" class="nv-check"></path>').attr("transform", "translate(-10,-8)scale(0.5)");
var z = x.select(".nv-check-box");
z.each(function(a2, b3) {
d3.select(this).selectAll("path").attr("stroke", r(a2, b3));
});
}
y.append("text").attr("text-anchor", "start").attr("class", "nv-legend-text").attr("dy", ".32em").attr("dx", "8");
var A = x.select("text.nv-legend-text");
x.on("mouseover", function(a2, b3) {
o.legendMouseover(a2, b3);
}).on("mouseout", function(a2, b3) {
o.legendMouseout(a2, b3);
}).on("click", function(a2, b3) {
o.legendClick(a2, b3);
var c2 = x.data();
if (l) {
if ("classic" == p)
m ? (c2.forEach(function(a3) {
a3.disabled = true;
}), a2.disabled = false) : (a2.disabled = !a2.disabled, c2.every(function(a3) {
return a3.disabled;
}) && c2.forEach(function(a3) {
a3.disabled = false;
}));
else if ("furious" == p) {
if (n)
a2.disengaged = !a2.disengaged, a2.userDisabled = void 0 == a2.userDisabled ? !!a2.disabled : a2.userDisabled, a2.disabled = a2.disengaged || a2.userDisabled;
else if (!n) {
a2.disabled = !a2.disabled, a2.userDisabled = a2.disabled;
var d2 = c2.filter(function(a3) {
return !a3.disengaged;
});
d2.every(function(a3) {
return a3.userDisabled;
}) && c2.forEach(function(a3) {
a3.disabled = a3.userDisabled = false;
});
}
}
o.stateChange({ disabled: c2.map(function(a3) {
return !!a3.disabled;
}), disengaged: c2.map(function(a3) {
return !!a3.disengaged;
}) });
}
}).on("dblclick", function(a2, b3) {
if (("furious" != p || !n) && (o.legendDblclick(a2, b3), l)) {
var c2 = x.data();
c2.forEach(function(a3) {
a3.disabled = true, "furious" == p && (a3.userDisabled = a3.disabled);
}), a2.disabled = false, "furious" == p && (a2.userDisabled = a2.disabled), o.stateChange({ disabled: c2.map(function(a3) {
return !!a3.disabled;
}) });
}
}), x.classed("nv-disabled", function(a2) {
return a2.userDisabled;
}), x.exit().remove(), A.attr("fill", r).text(f);
var B;
switch (p) {
case "furious":
B = 23;
break;
case "classic":
B = 20;
}
if (i) {
var C = [];
x.each(function(b3, c2) {
var d2;
if (f(b3).length > h) {
var e2 = f(b3).substring(0, h);
d2 = d3.select(this).select("text").text(e2 + "..."), d3.select(this).append("svg:title").text(f(b3));
} else
d2 = d3.select(this).select("text");
var g2;
try {
if (g2 = d2.node().getComputedTextLength(), 0 >= g2)
throw Error();
} catch (i2) {
g2 = a.utils.calcApproxTextWidth(d2);
}
C.push(g2 + j);
});
for (var D = 0, E = 0, F = []; q2 > E && D < C.length; )
F[D] = C[D], E += C[D++];
for (0 === D && (D = 1); E > q2 && D > 1; ) {
F = [], D--;
for (var G = 0; G < C.length; G++)
C[G] > (F[G % D] || 0) && (F[G % D] = C[G]);
E = F.reduce(function(a2, b3, c2, d2) {
return a2 + b3;
});
}
for (var H = [], I = 0, J = 0; D > I; I++)
H[I] = J, J += F[I];
x.attr("transform", function(a2, b3) {
return "translate(" + H[b3 % D] + "," + (5 + Math.floor(b3 / D) * B) + ")";
}), k ? v.attr("transform", "translate(" + (d - c.right - E) + "," + c.top + ")") : v.attr("transform", "translate(0," + c.top + ")"), e = c.top + c.bottom + Math.ceil(C.length / D) * B;
} else {
var K, L = 5, M = 5, N = 0;
x.attr("transform", function(a2, b3) {
var e2 = d3.select(this).select("text").node().getComputedTextLength() + j;
return K = M, d < c.left + c.right + K + e2 && (M = K = 5, L += B), M += e2, M > N && (N = M), "translate(" + K + "," + L + ")";
}), v.attr("transform", "translate(" + (d - c.right - N) + "," + c.top + ")"), e = c.top + c.bottom + L + 15;
}
"furious" == p && w.attr("width", function(a2, b3) {
return A[0][b3].getComputedTextLength() + 27;
}).attr("height", 18).attr("y", -9).attr("x", -15), w.style("fill", s).style("stroke", function(a2, b3) {
return a2.color || g(a2, b3);
});
}), b;
}
var c = { top: 5, right: 0, bottom: 5, left: 0 }, d = 400, e = 20, f = function(a2) {
return a2.key;
}, g = a.utils.getColor(), h = 20, i = true, j = 28, k = true, l = true, m = false, n = false, o = d3.dispatch("legendClick", "legendDblclick", "legendMouseover", "legendMouseout", "stateChange"), p = "classic";
return b.dispatch = o, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return d;
}, set: function(a2) {
d = a2;
} }, height: { get: function() {
return e;
}, set: function(a2) {
e = a2;
} }, key: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, align: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, rightAlign: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, maxKeyLength: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, padding: { get: function() {
return j;
}, set: function(a2) {
j = a2;
} }, updateState: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, radioButtonMode: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, expanded: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, vers: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, margin: { get: function() {
return c;
}, set: function(a2) {
c.top = void 0 !== a2.top ? a2.top : c.top, c.right = void 0 !== a2.right ? a2.right : c.right, c.bottom = void 0 !== a2.bottom ? a2.bottom : c.bottom, c.left = void 0 !== a2.left ? a2.left : c.left;
} }, color: { get: function() {
return g;
}, set: function(b2) {
g = a.utils.getColor(b2);
} } }), a.utils.initOptions(b), b;
}, a.models.historicalBar = function() {
"use strict";
function b(x) {
return x.each(function(b2) {
w.reset(), k = d3.select(this);
var x2 = a.utils.availableWidth(h, k, g), y = a.utils.availableHeight(i, k, g);
a.utils.initSVG(k), l.domain(c || d3.extent(b2[0].values.map(n).concat(p))), r ? l.range(e || [0.5 * x2 / b2[0].values.length, x2 * (b2[0].values.length - 0.5) / b2[0].values.length]) : l.range(e || [0, x2]), m.domain(d || d3.extent(b2[0].values.map(o).concat(q))).range(f || [y, 0]), l.domain()[0] === l.domain()[1] && (l.domain()[0] ? l.domain([l.domain()[0] - 0.01 * l.domain()[0], l.domain()[1] + 0.01 * l.domain()[1]]) : l.domain([-1, 1])), m.domain()[0] === m.domain()[1] && (m.domain()[0] ? m.domain([m.domain()[0] + 0.01 * m.domain()[0], m.domain()[1] - 0.01 * m.domain()[1]]) : m.domain([-1, 1]));
var z = k.selectAll("g.nv-wrap.nv-historicalBar-" + j).data([b2[0].values]), A = z.enter().append("g").attr("class", "nvd3 nv-wrap nv-historicalBar-" + j), B = A.append("defs"), C = A.append("g"), D = z.select("g");
C.append("g").attr("class", "nv-bars"), z.attr("transform", "translate(" + g.left + "," + g.top + ")"), k.on("click", function(a2, b3) {
u.chartClick({ data: a2, index: b3, pos: d3.event, id: j });
}), B.append("clipPath").attr("id", "nv-chart-clip-path-" + j).append("rect"), z.select("#nv-chart-clip-path-" + j + " rect").attr("width", x2).attr("height", y), D.attr("clip-path", s ? "url(#nv-chart-clip-path-" + j + ")" : "");
var E = z.select(".nv-bars").selectAll(".nv-bar").data(function(a2) {
return a2;
}, function(a2, b3) {
return n(a2, b3);
});
E.exit().remove(), E.enter().append("rect").attr("x", 0).attr("y", function(b3, c2) {
return a.utils.NaNtoZero(m(Math.max(0, o(b3, c2))));
}).attr("height", function(b3, c2) {
return a.utils.NaNtoZero(Math.abs(m(o(b3, c2)) - m(0)));
}).attr("transform", function(a2, c2) {
return "translate(" + (l(n(a2, c2)) - x2 / b2[0].values.length * 0.45) + ",0)";
}).on("mouseover", function(a2, b3) {
v && (d3.select(this).classed("hover", true), u.elementMouseover({ data: a2, index: b3, color: d3.select(this).style("fill") }));
}).on("mouseout", function(a2, b3) {
v && (d3.select(this).classed("hover", false), u.elementMouseout({ data: a2, index: b3, color: d3.select(this).style("fill") }));
}).on("mousemove", function(a2, b3) {
v && u.elementMousemove({ data: a2, index: b3, color: d3.select(this).style("fill") });
}).on("click", function(a2, b3) {
v && (u.elementClick({ data: a2, index: b3, color: d3.select(this).style("fill") }), d3.event.stopPropagation());
}).on("dblclick", function(a2, b3) {
v && (u.elementDblClick({ data: a2, index: b3, color: d3.select(this).style("fill") }), d3.event.stopPropagation());
}), E.attr("fill", function(a2, b3) {
return t(a2, b3);
}).attr("class", function(a2, b3, c2) {
return (o(a2, b3) < 0 ? "nv-bar negative" : "nv-bar positive") + " nv-bar-" + c2 + "-" + b3;
}).watchTransition(w, "bars").attr("transform", function(a2, c2) {
return "translate(" + (l(n(a2, c2)) - x2 / b2[0].values.length * 0.45) + ",0)";
}).attr("width", x2 / b2[0].values.length * 0.9), E.watchTransition(w, "bars").attr("y", function(b3, c2) {
var d2 = o(b3, c2) < 0 ? m(0) : m(0) - m(o(b3, c2)) < 1 ? m(0) - 1 : m(o(b3, c2));
return a.utils.NaNtoZero(d2);
}).attr("height", function(b3, c2) {
return a.utils.NaNtoZero(Math.max(Math.abs(m(o(b3, c2)) - m(0)), 1));
});
}), w.renderEnd("historicalBar immediate"), b;
}
var c, d, e, f, g = { top: 0, right: 0, bottom: 0, left: 0 }, h = null, i = null, j = Math.floor(1e4 * Math.random()), k = null, l = d3.scale.linear(), m = d3.scale.linear(), n = function(a2) {
return a2.x;
}, o = function(a2) {
return a2.y;
}, p = [], q = [0], r = false, s = true, t = a.utils.defaultColor(), u = d3.dispatch("chartClick", "elementClick", "elementDblClick", "elementMouseover", "elementMouseout", "elementMousemove", "renderEnd"), v = true, w = a.utils.renderWatch(u, 0);
return b.highlightPoint = function(a2, b2) {
k.select(".nv-bars .nv-bar-0-" + a2).classed("hover", b2);
}, b.clearHighlights = function() {
k.select(".nv-bars .nv-bar.hover").classed("hover", false);
}, b.dispatch = u, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, height: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, forceX: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, forceY: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, padData: { get: function() {
return r;
}, set: function(a2) {
r = a2;
} }, x: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, y: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, xScale: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, yScale: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, xDomain: { get: function() {
return c;
}, set: function(a2) {
c = a2;
} }, yDomain: { get: function() {
return d;
}, set: function(a2) {
d = a2;
} }, xRange: { get: function() {
return e;
}, set: function(a2) {
e = a2;
} }, yRange: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, clipEdge: { get: function() {
return s;
}, set: function(a2) {
s = a2;
} }, id: { get: function() {
return j;
}, set: function(a2) {
j = a2;
} }, interactive: { get: function() {
return v;
}, set: function(a2) {
v = a2;
} }, margin: { get: function() {
return g;
}, set: function(a2) {
g.top = void 0 !== a2.top ? a2.top : g.top, g.right = void 0 !== a2.right ? a2.right : g.right, g.bottom = void 0 !== a2.bottom ? a2.bottom : g.bottom, g.left = void 0 !== a2.left ? a2.left : g.left;
} }, color: { get: function() {
return t;
}, set: function(b2) {
t = a.utils.getColor(b2);
} } }), a.utils.initOptions(b), b;
}, a.models.historicalBarChart = function(b) {
"use strict";
function c(b2) {
return b2.each(function(k2) {
z.reset(), z.models(f), q && z.models(g), r && z.models(h);
var w2 = d3.select(this), A = this;
a.utils.initSVG(w2);
var B = a.utils.availableWidth(n, w2, l), C = a.utils.availableHeight(o, w2, l);
if (c.update = function() {
w2.transition().duration(y).call(c);
}, c.container = this, u.disabled = k2.map(function(a2) {
return !!a2.disabled;
}), !v) {
var D;
v = {};
for (D in u)
u[D] instanceof Array ? v[D] = u[D].slice(0) : v[D] = u[D];
}
if (!(k2 && k2.length && k2.filter(function(a2) {
return a2.values.length;
}).length))
return a.utils.noData(c, w2), c;
w2.selectAll(".nv-noData").remove(), d = f.xScale(), e = f.yScale();
var E = w2.selectAll("g.nv-wrap.nv-historicalBarChart").data([k2]), F = E.enter().append("g").attr("class", "nvd3 nv-wrap nv-historicalBarChart").append("g"), G = E.select("g");
F.append("g").attr("class", "nv-x nv-axis"), F.append("g").attr("class", "nv-y nv-axis"), F.append("g").attr("class", "nv-barsWrap"), F.append("g").attr("class", "nv-legendWrap"), F.append("g").attr("class", "nv-interactive"), p && (i.width(B), G.select(".nv-legendWrap").datum(k2).call(i), l.top != i.height() && (l.top = i.height(), C = a.utils.availableHeight(o, w2, l)), E.select(".nv-legendWrap").attr("transform", "translate(0," + -l.top + ")")), E.attr("transform", "translate(" + l.left + "," + l.top + ")"), s && G.select(".nv-y.nv-axis").attr("transform", "translate(" + B + ",0)"), t && (j.width(B).height(C).margin({ left: l.left, top: l.top }).svgContainer(w2).xScale(d), E.select(".nv-interactive").call(j)), f.width(B).height(C).color(k2.map(function(a2, b3) {
return a2.color || m(a2, b3);
}).filter(function(a2, b3) {
return !k2[b3].disabled;
}));
var H = G.select(".nv-barsWrap").datum(k2.filter(function(a2) {
return !a2.disabled;
}));
H.transition().call(f), q && (g.scale(d)._ticks(a.utils.calcTicksX(B / 100, k2)).tickSize(-C, 0), G.select(".nv-x.nv-axis").attr("transform", "translate(0," + e.range()[0] + ")"), G.select(".nv-x.nv-axis").transition().call(g)), r && (h.scale(e)._ticks(a.utils.calcTicksY(C / 36, k2)).tickSize(-B, 0), G.select(".nv-y.nv-axis").transition().call(h)), j.dispatch.on("elementMousemove", function(b3) {
f.clearHighlights();
var d2, e2, i2, l2 = [];
k2.filter(function(a2, b4) {
return a2.seriesIndex = b4, !a2.disabled;
}).forEach(function(g2, h2) {
e2 = a.interactiveBisect(g2.values, b3.pointXValue, c.x()), f.highlightPoint(e2, true);
var j2 = g2.values[e2];
void 0 !== j2 && (void 0 === d2 && (d2 = j2), void 0 === i2 && (i2 = c.xScale()(c.x()(j2, e2))), l2.push({ key: g2.key, value: c.y()(j2, e2), color: m(g2, g2.seriesIndex), data: g2.values[e2] }));
});
var n2 = g.tickFormat()(c.x()(d2, e2));
j.tooltip.chartContainer(A.parentNode).valueFormatter(function(a2, b4) {
return h.tickFormat()(a2);
}).data({ value: n2, index: e2, series: l2 })(), j.renderGuideLine(i2);
}), j.dispatch.on("elementMouseout", function(a2) {
x.tooltipHide(), f.clearHighlights();
}), i.dispatch.on("legendClick", function(a2, d2) {
a2.disabled = !a2.disabled, k2.filter(function(a3) {
return !a3.disabled;
}).length || k2.map(function(a3) {
return a3.disabled = false, E.selectAll(".nv-series").classed("disabled", false), a3;
}), u.disabled = k2.map(function(a3) {
return !!a3.disabled;
}), x.stateChange(u), b2.transition().call(c);
}), i.dispatch.on("legendDblclick", function(a2) {
k2.forEach(function(a3) {
a3.disabled = true;
}), a2.disabled = false, u.disabled = k2.map(function(a3) {
return !!a3.disabled;
}), x.stateChange(u), c.update();
}), x.on("changeState", function(a2) {
"undefined" != typeof a2.disabled && (k2.forEach(function(b3, c2) {
b3.disabled = a2.disabled[c2];
}), u.disabled = a2.disabled), c.update();
});
}), z.renderEnd("historicalBarChart immediate"), c;
}
var d, e, f = b || a.models.historicalBar(), g = a.models.axis(), h = a.models.axis(), i = a.models.legend(), j = a.interactiveGuideline(), k = a.models.tooltip(), l = { top: 30, right: 90, bottom: 50, left: 90 }, m = a.utils.defaultColor(), n = null, o = null, p = false, q = true, r = true, s = false, t = false, u = {}, v = null, w = null, x = d3.dispatch("tooltipHide", "stateChange", "changeState", "renderEnd"), y = 250;
g.orient("bottom").tickPadding(7), h.orient(s ? "right" : "left"), k.duration(0).headerEnabled(false).valueFormatter(function(a2, b2) {
return h.tickFormat()(a2, b2);
}).headerFormatter(function(a2, b2) {
return g.tickFormat()(a2, b2);
});
var z = a.utils.renderWatch(x, 0);
return f.dispatch.on("elementMouseover.tooltip", function(a2) {
a2.series = { key: c.x()(a2.data), value: c.y()(a2.data), color: a2.color }, k.data(a2).hidden(false);
}), f.dispatch.on("elementMouseout.tooltip", function(a2) {
k.hidden(true);
}), f.dispatch.on("elementMousemove.tooltip", function(a2) {
k();
}), c.dispatch = x, c.bars = f, c.legend = i, c.xAxis = g, c.yAxis = h, c.interactiveLayer = j, c.tooltip = k, c.options = a.utils.optionsFunc.bind(c), c._options = Object.create({}, { width: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, height: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, showLegend: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, showXAxis: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, showYAxis: { get: function() {
return r;
}, set: function(a2) {
r = a2;
} }, defaultState: { get: function() {
return v;
}, set: function(a2) {
v = a2;
} }, noData: { get: function() {
return w;
}, set: function(a2) {
w = a2;
} }, margin: { get: function() {
return l;
}, set: function(a2) {
l.top = void 0 !== a2.top ? a2.top : l.top, l.right = void 0 !== a2.right ? a2.right : l.right, l.bottom = void 0 !== a2.bottom ? a2.bottom : l.bottom, l.left = void 0 !== a2.left ? a2.left : l.left;
} }, color: { get: function() {
return m;
}, set: function(b2) {
m = a.utils.getColor(b2), i.color(m), f.color(m);
} }, duration: { get: function() {
return y;
}, set: function(a2) {
y = a2, z.reset(y), h.duration(y), g.duration(y);
} }, rightAlignYAxis: { get: function() {
return s;
}, set: function(a2) {
s = a2, h.orient(a2 ? "right" : "left");
} }, useInteractiveGuideline: { get: function() {
return t;
}, set: function(a2) {
t = a2, a2 === true && c.interactive(false);
} } }), a.utils.inheritOptions(c, f), a.utils.initOptions(c), c;
}, a.models.ohlcBarChart = function() {
var b = a.models.historicalBarChart(a.models.ohlcBar());
return b.useInteractiveGuideline(true), b.interactiveLayer.tooltip.contentGenerator(function(a2) {
var c = a2.series[0].data, d = c.open < c.close ? "2ca02c" : "d62728";
return '<h3 style="color: #' + d + '">' + a2.value + "</h3><table><tr><td>open:</td><td>" + b.yAxis.tickFormat()(c.open) + "</td></tr><tr><td>close:</td><td>" + b.yAxis.tickFormat()(c.close) + "</td></tr><tr><td>high</td><td>" + b.yAxis.tickFormat()(c.high) + "</td></tr><tr><td>low:</td><td>" + b.yAxis.tickFormat()(c.low) + "</td></tr></table>";
}), b;
}, a.models.candlestickBarChart = function() {
var b = a.models.historicalBarChart(a.models.candlestickBar());
return b.useInteractiveGuideline(true), b.interactiveLayer.tooltip.contentGenerator(function(a2) {
var c = a2.series[0].data, d = c.open < c.close ? "2ca02c" : "d62728";
return '<h3 style="color: #' + d + '">' + a2.value + "</h3><table><tr><td>open:</td><td>" + b.yAxis.tickFormat()(c.open) + "</td></tr><tr><td>close:</td><td>" + b.yAxis.tickFormat()(c.close) + "</td></tr><tr><td>high</td><td>" + b.yAxis.tickFormat()(c.high) + "</td></tr><tr><td>low:</td><td>" + b.yAxis.tickFormat()(c.low) + "</td></tr></table>";
}), b;
}, a.models.legend = function() {
"use strict";
function b(q) {
function r(a2, b2) {
return "furious" != p ? "#000" : n ? a2.disengaged ? "#000" : "#fff" : n ? void 0 : (a2.color || (a2.color = g(a2, b2)), a2.disabled ? a2.color : "#fff");
}
function s(a2, b2) {
return n && "furious" == p && a2.disengaged ? "#eee" : a2.color || g(a2, b2);
}
function t(a2, b2) {
return n && "furious" == p ? 1 : a2.disabled ? 0 : 1;
}
return q.each(function(b2) {
var g2 = d - c.left - c.right, q2 = d3.select(this);
a.utils.initSVG(q2);
var u = q2.selectAll("g.nv-legend").data([b2]), v = u.enter().append("g").attr("class", "nvd3 nv-legend").append("g"), w = u.select("g");
u.attr("transform", "translate(" + c.left + "," + c.top + ")");
var x, y, z = w.selectAll(".nv-series").data(function(a2) {
return "furious" != p ? a2 : a2.filter(function(a3) {
return n ? true : !a3.disengaged;
});
}), A = z.enter().append("g").attr("class", "nv-series");
switch (p) {
case "furious":
y = 23;
break;
case "classic":
y = 20;
}
if ("classic" == p)
A.append("circle").style("stroke-width", 2).attr("class", "nv-legend-symbol").attr("r", 5), x = z.select("circle");
else if ("furious" == p) {
A.append("rect").style("stroke-width", 2).attr("class", "nv-legend-symbol").attr("rx", 3).attr("ry", 3), x = z.select(".nv-legend-symbol"), A.append("g").attr("class", "nv-check-box").property("innerHTML", '<path d="M0.5,5 L22.5,5 L22.5,26.5 L0.5,26.5 L0.5,5 Z" class="nv-box"></path><path d="M5.5,12.8618467 L11.9185089,19.2803556 L31,0.198864511" class="nv-check"></path>').attr("transform", "translate(-10,-8)scale(0.5)");
var B = z.select(".nv-check-box");
B.each(function(a2, b3) {
d3.select(this).selectAll("path").attr("stroke", r(a2, b3));
});
}
A.append("text").attr("text-anchor", "start").attr("class", "nv-legend-text").attr("dy", ".32em").attr("dx", "8");
var C = z.select("text.nv-legend-text");
z.on("mouseover", function(a2, b3) {
o.legendMouseover(a2, b3);
}).on("mouseout", function(a2, b3) {
o.legendMouseout(a2, b3);
}).on("click", function(a2, b3) {
o.legendClick(a2, b3);
var c2 = z.data();
if (l) {
if ("classic" == p)
m ? (c2.forEach(function(a3) {
a3.disabled = true;
}), a2.disabled = false) : (a2.disabled = !a2.disabled, c2.every(function(a3) {
return a3.disabled;
}) && c2.forEach(function(a3) {
a3.disabled = false;
}));
else if ("furious" == p) {
if (n)
a2.disengaged = !a2.disengaged, a2.userDisabled = void 0 == a2.userDisabled ? !!a2.disabled : a2.userDisabled, a2.disabled = a2.disengaged || a2.userDisabled;
else if (!n) {
a2.disabled = !a2.disabled, a2.userDisabled = a2.disabled;
var d2 = c2.filter(function(a3) {
return !a3.disengaged;
});
d2.every(function(a3) {
return a3.userDisabled;
}) && c2.forEach(function(a3) {
a3.disabled = a3.userDisabled = false;
});
}
}
o.stateChange({ disabled: c2.map(function(a3) {
return !!a3.disabled;
}), disengaged: c2.map(function(a3) {
return !!a3.disengaged;
}) });
}
}).on("dblclick", function(a2, b3) {
if (("furious" != p || !n) && (o.legendDblclick(a2, b3), l)) {
var c2 = z.data();
c2.forEach(function(a3) {
a3.disabled = true, "furious" == p && (a3.userDisabled = a3.disabled);
}), a2.disabled = false, "furious" == p && (a2.userDisabled = a2.disabled), o.stateChange({ disabled: c2.map(function(a3) {
return !!a3.disabled;
}) });
}
}), z.classed("nv-disabled", function(a2) {
return a2.userDisabled;
}), z.exit().remove(), C.attr("fill", r).text(f);
var D = 0;
if (i) {
var E = [];
z.each(function(b3, c2) {
var d2;
if (f(b3).length > h) {
var e2 = f(b3).substring(0, h);
d2 = d3.select(this).select("text").text(e2 + "..."), d3.select(this).append("svg:title").text(f(b3));
} else
d2 = d3.select(this).select("text");
var g3;
try {
if (g3 = d2.node().getComputedTextLength(), 0 >= g3)
throw Error();
} catch (i2) {
g3 = a.utils.calcApproxTextWidth(d2);
}
E.push(g3 + j);
});
var F = 0, G = [];
for (D = 0; g2 > D && F < E.length; )
G[F] = E[F], D += E[F++];
for (0 === F && (F = 1); D > g2 && F > 1; ) {
G = [], F--;
for (var H = 0; H < E.length; H++)
E[H] > (G[H % F] || 0) && (G[H % F] = E[H]);
D = G.reduce(function(a2, b3, c2, d2) {
return a2 + b3;
});
}
for (var I = [], J = 0, K = 0; F > J; J++)
I[J] = K, K += G[J];
z.attr("transform", function(a2, b3) {
return "translate(" + I[b3 % F] + "," + (5 + Math.floor(b3 / F) * y) + ")";
}), k ? w.attr("transform", "translate(" + (d - c.right - D) + "," + c.top + ")") : w.attr("transform", "translate(0," + c.top + ")"), e = c.top + c.bottom + Math.ceil(E.length / F) * y;
} else {
var L, M = 5, N = 5, O = 0;
z.attr("transform", function(a2, b3) {
var e2 = d3.select(this).select("text").node().getComputedTextLength() + j;
return L = N, d < c.left + c.right + L + e2 && (N = L = 5, M += y), N += e2, N > O && (O = N), L + O > D && (D = L + O), "translate(" + L + "," + M + ")";
}), w.attr("transform", "translate(" + (d - c.right - O) + "," + c.top + ")"), e = c.top + c.bottom + M + 15;
}
if ("furious" == p) {
x.attr("width", function(a2, b3) {
return C[0][b3].getComputedTextLength() + 27;
}).attr("height", 18).attr("y", -9).attr("x", -15), v.insert("rect", ":first-child").attr("class", "nv-legend-bg").attr("fill", "#eee").attr("opacity", 0);
var P = w.select(".nv-legend-bg");
P.transition().duration(300).attr("x", -y).attr("width", D + y - 12).attr("height", e + 10).attr("y", -c.top - 10).attr("opacity", n ? 1 : 0);
}
x.style("fill", s).style("fill-opacity", t).style("stroke", s);
}), b;
}
var c = { top: 5, right: 0, bottom: 5, left: 0 }, d = 400, e = 20, f = function(a2) {
return a2.key;
}, g = a.utils.getColor(), h = 20, i = true, j = 32, k = true, l = true, m = false, n = false, o = d3.dispatch("legendClick", "legendDblclick", "legendMouseover", "legendMouseout", "stateChange"), p = "classic";
return b.dispatch = o, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return d;
}, set: function(a2) {
d = a2;
} }, height: { get: function() {
return e;
}, set: function(a2) {
e = a2;
} }, key: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, align: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, maxKeyLength: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, rightAlign: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, padding: { get: function() {
return j;
}, set: function(a2) {
j = a2;
} }, updateState: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, radioButtonMode: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, expanded: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, vers: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, margin: { get: function() {
return c;
}, set: function(a2) {
c.top = void 0 !== a2.top ? a2.top : c.top, c.right = void 0 !== a2.right ? a2.right : c.right, c.bottom = void 0 !== a2.bottom ? a2.bottom : c.bottom, c.left = void 0 !== a2.left ? a2.left : c.left;
} }, color: { get: function() {
return g;
}, set: function(b2) {
g = a.utils.getColor(b2);
} } }), a.utils.initOptions(b), b;
}, a.models.line = function() {
"use strict";
function b(r2) {
return v.reset(), v.models(e), r2.each(function(b2) {
i = d3.select(this);
var r3 = a.utils.availableWidth(g, i, f), s2 = a.utils.availableHeight(h, i, f);
a.utils.initSVG(i), c = e.xScale(), d = e.yScale(), t = t || c, u = u || d;
var w = i.selectAll("g.nv-wrap.nv-line").data([b2]), x = w.enter().append("g").attr("class", "nvd3 nv-wrap nv-line"), y = x.append("defs"), z = x.append("g"), A = w.select("g");
z.append("g").attr("class", "nv-groups"), z.append("g").attr("class", "nv-scatterWrap"), w.attr("transform", "translate(" + f.left + "," + f.top + ")"), e.width(r3).height(s2);
var B = w.select(".nv-scatterWrap");
B.call(e), y.append("clipPath").attr("id", "nv-edge-clip-" + e.id()).append("rect"), w.select("#nv-edge-clip-" + e.id() + " rect").attr("width", r3).attr("height", s2 > 0 ? s2 : 0), A.attr("clip-path", p ? "url(#nv-edge-clip-" + e.id() + ")" : ""), B.attr("clip-path", p ? "url(#nv-edge-clip-" + e.id() + ")" : "");
var C = w.select(".nv-groups").selectAll(".nv-group").data(function(a2) {
return a2;
}, function(a2) {
return a2.key;
});
C.enter().append("g").style("stroke-opacity", 1e-6).style("stroke-width", function(a2) {
return a2.strokeWidth || j;
}).style("fill-opacity", 1e-6), C.exit().remove(), C.attr("class", function(a2, b3) {
return (a2.classed || "") + " nv-group nv-series-" + b3;
}).classed("hover", function(a2) {
return a2.hover;
}).style("fill", function(a2, b3) {
return k(a2, b3);
}).style("stroke", function(a2, b3) {
return k(a2, b3);
}), C.watchTransition(v, "line: groups").style("stroke-opacity", 1).style("fill-opacity", function(a2) {
return a2.fillOpacity || 0.5;
});
var D = C.selectAll("path.nv-area").data(function(a2) {
return o(a2) ? [a2] : [];
});
D.enter().append("path").attr("class", "nv-area").attr("d", function(b3) {
return d3.svg.area().interpolate(q).defined(n).x(function(b4, c2) {
return a.utils.NaNtoZero(t(l(b4, c2)));
}).y0(function(b4, c2) {
return a.utils.NaNtoZero(u(m(b4, c2)));
}).y1(function(a2, b4) {
return u(d.domain()[0] <= 0 ? d.domain()[1] >= 0 ? 0 : d.domain()[1] : d.domain()[0]);
}).apply(this, [b3.values]);
}), C.exit().selectAll("path.nv-area").remove(), D.watchTransition(v, "line: areaPaths").attr("d", function(b3) {
return d3.svg.area().interpolate(q).defined(n).x(function(b4, d2) {
return a.utils.NaNtoZero(c(l(b4, d2)));
}).y0(function(b4, c2) {
return a.utils.NaNtoZero(d(m(b4, c2)));
}).y1(function(a2, b4) {
return d(d.domain()[0] <= 0 ? d.domain()[1] >= 0 ? 0 : d.domain()[1] : d.domain()[0]);
}).apply(this, [b3.values]);
});
var E = C.selectAll("path.nv-line").data(function(a2) {
return [a2.values];
});
E.enter().append("path").attr("class", "nv-line").attr("d", d3.svg.line().interpolate(q).defined(n).x(function(b3, c2) {
return a.utils.NaNtoZero(t(l(b3, c2)));
}).y(function(b3, c2) {
return a.utils.NaNtoZero(u(m(b3, c2)));
})), E.watchTransition(v, "line: linePaths").attr("d", d3.svg.line().interpolate(q).defined(n).x(function(b3, d2) {
return a.utils.NaNtoZero(c(l(b3, d2)));
}).y(function(b3, c2) {
return a.utils.NaNtoZero(d(m(b3, c2)));
})), t = c.copy(), u = d.copy();
}), v.renderEnd("line immediate"), b;
}
var c, d, e = a.models.scatter(), f = { top: 0, right: 0, bottom: 0, left: 0 }, g = 960, h = 500, i = null, j = 1.5, k = a.utils.defaultColor(), l = function(a2) {
return a2.x;
}, m = function(a2) {
return a2.y;
}, n = function(a2, b2) {
return !isNaN(m(a2, b2)) && null !== m(a2, b2);
}, o = function(a2) {
return a2.area;
}, p = false, q = "linear", r = 250, s = d3.dispatch("elementClick", "elementMouseover", "elementMouseout", "renderEnd");
e.pointSize(16).pointDomain([16, 256]);
var t, u, v = a.utils.renderWatch(s, r);
return b.dispatch = s, b.scatter = e, e.dispatch.on("elementClick", function() {
s.elementClick.apply(this, arguments);
}), e.dispatch.on("elementMouseover", function() {
s.elementMouseover.apply(this, arguments);
}), e.dispatch.on("elementMouseout", function() {
s.elementMouseout.apply(this, arguments);
}), b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return g;
}, set: function(a2) {
g = a2;
} }, height: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, defined: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, interpolate: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, clipEdge: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, margin: { get: function() {
return f;
}, set: function(a2) {
f.top = void 0 !== a2.top ? a2.top : f.top, f.right = void 0 !== a2.right ? a2.right : f.right, f.bottom = void 0 !== a2.bottom ? a2.bottom : f.bottom, f.left = void 0 !== a2.left ? a2.left : f.left;
} }, duration: { get: function() {
return r;
}, set: function(a2) {
r = a2, v.reset(r), e.duration(r);
} }, isArea: { get: function() {
return o;
}, set: function(a2) {
o = d3.functor(a2);
} }, x: { get: function() {
return l;
}, set: function(a2) {
l = a2, e.x(a2);
} }, y: { get: function() {
return m;
}, set: function(a2) {
m = a2, e.y(a2);
} }, color: { get: function() {
return k;
}, set: function(b2) {
k = a.utils.getColor(b2), e.color(k);
} } }), a.utils.inheritOptions(b, e), a.utils.initOptions(b), b;
}, a.models.lineChart = function() {
"use strict";
function b(j2) {
return y.reset(), y.models(e), p && y.models(f), q && y.models(g), j2.each(function(j3) {
var v2 = d3.select(this), y2 = this;
a.utils.initSVG(v2);
var B = a.utils.availableWidth(m, v2, k), C = a.utils.availableHeight(n, v2, k);
if (b.update = function() {
0 === x ? v2.call(b) : v2.transition().duration(x).call(b);
}, b.container = this, t.setter(A(j3), b.update).getter(z(j3)).update(), t.disabled = j3.map(function(a2) {
return !!a2.disabled;
}), !u) {
var D;
u = {};
for (D in t)
t[D] instanceof Array ? u[D] = t[D].slice(0) : u[D] = t[D];
}
if (!(j3 && j3.length && j3.filter(function(a2) {
return a2.values.length;
}).length))
return a.utils.noData(b, v2), b;
v2.selectAll(".nv-noData").remove(), c = e.xScale(), d = e.yScale();
var E = v2.selectAll("g.nv-wrap.nv-lineChart").data([j3]), F = E.enter().append("g").attr("class", "nvd3 nv-wrap nv-lineChart").append("g"), G = E.select("g");
F.append("rect").style("opacity", 0), F.append("g").attr("class", "nv-x nv-axis"), F.append("g").attr("class", "nv-y nv-axis"), F.append("g").attr("class", "nv-linesWrap"), F.append("g").attr("class", "nv-legendWrap"), F.append("g").attr("class", "nv-interactive"), G.select("rect").attr("width", B).attr("height", C > 0 ? C : 0), o && (h.width(B), G.select(".nv-legendWrap").datum(j3).call(h), k.top != h.height() && (k.top = h.height(), C = a.utils.availableHeight(n, v2, k)), E.select(".nv-legendWrap").attr("transform", "translate(0," + -k.top + ")")), E.attr("transform", "translate(" + k.left + "," + k.top + ")"), r && G.select(".nv-y.nv-axis").attr("transform", "translate(" + B + ",0)"), s && (i.width(B).height(C).margin({
left: k.left,
top: k.top
}).svgContainer(v2).xScale(c), E.select(".nv-interactive").call(i)), e.width(B).height(C).color(j3.map(function(a2, b2) {
return a2.color || l(a2, b2);
}).filter(function(a2, b2) {
return !j3[b2].disabled;
}));
var H = G.select(".nv-linesWrap").datum(j3.filter(function(a2) {
return !a2.disabled;
}));
H.call(e), p && (f.scale(c)._ticks(a.utils.calcTicksX(B / 100, j3)).tickSize(-C, 0), G.select(".nv-x.nv-axis").attr("transform", "translate(0," + d.range()[0] + ")"), G.select(".nv-x.nv-axis").call(f)), q && (g.scale(d)._ticks(a.utils.calcTicksY(C / 36, j3)).tickSize(-B, 0), G.select(".nv-y.nv-axis").call(g)), h.dispatch.on("stateChange", function(a2) {
for (var c2 in a2)
t[c2] = a2[c2];
w.stateChange(t), b.update();
}), i.dispatch.on("elementMousemove", function(c2) {
e.clearHighlights();
var d2, h2, k2, m2 = [];
if (j3.filter(function(a2, b2) {
return a2.seriesIndex = b2, !a2.disabled;
}).forEach(function(f2, g2) {
h2 = a.interactiveBisect(f2.values, c2.pointXValue, b.x());
var i2 = f2.values[h2], j4 = b.y()(i2, h2);
null != j4 && e.highlightPoint(g2, h2, true), void 0 !== i2 && (void 0 === d2 && (d2 = i2), void 0 === k2 && (k2 = b.xScale()(b.x()(i2, h2))), m2.push({ key: f2.key, value: j4, color: l(f2, f2.seriesIndex) }));
}), m2.length > 2) {
var n2 = b.yScale().invert(c2.mouseY), o2 = Math.abs(b.yScale().domain()[0] - b.yScale().domain()[1]), p2 = 0.03 * o2, q2 = a.nearestValueIndex(m2.map(function(a2) {
return a2.value;
}), n2, p2);
null !== q2 && (m2[q2].highlight = true);
}
var r2 = f.tickFormat()(b.x()(d2, h2));
i.tooltip.chartContainer(y2.parentNode).valueFormatter(function(a2, b2) {
return null == a2 ? "N/A" : g.tickFormat()(a2);
}).data({ value: r2, index: h2, series: m2 })(), i.renderGuideLine(k2);
}), i.dispatch.on("elementClick", function(c2) {
var d2, f2 = [];
j3.filter(function(a2, b2) {
return a2.seriesIndex = b2, !a2.disabled;
}).forEach(function(e2) {
var g2 = a.interactiveBisect(e2.values, c2.pointXValue, b.x()), h2 = e2.values[g2];
if ("undefined" != typeof h2) {
"undefined" == typeof d2 && (d2 = b.xScale()(b.x()(h2, g2)));
var i2 = b.yScale()(b.y()(h2, g2));
f2.push({ point: h2, pointIndex: g2, pos: [d2, i2], seriesIndex: e2.seriesIndex, series: e2 });
}
}), e.dispatch.elementClick(f2);
}), i.dispatch.on("elementMouseout", function(a2) {
e.clearHighlights();
}), w.on("changeState", function(a2) {
"undefined" != typeof a2.disabled && j3.length === a2.disabled.length && (j3.forEach(function(b2, c2) {
b2.disabled = a2.disabled[c2];
}), t.disabled = a2.disabled), b.update();
});
}), y.renderEnd("lineChart immediate"), b;
}
var c, d, e = a.models.line(), f = a.models.axis(), g = a.models.axis(), h = a.models.legend(), i = a.interactiveGuideline(), j = a.models.tooltip(), k = { top: 30, right: 20, bottom: 50, left: 60 }, l = a.utils.defaultColor(), m = null, n = null, o = true, p = true, q = true, r = false, s = false, t = a.utils.state(), u = null, v = null, w = d3.dispatch("tooltipShow", "tooltipHide", "stateChange", "changeState", "renderEnd"), x = 250;
f.orient("bottom").tickPadding(7), g.orient(r ? "right" : "left"), j.valueFormatter(function(a2, b2) {
return g.tickFormat()(a2, b2);
}).headerFormatter(function(a2, b2) {
return f.tickFormat()(a2, b2);
});
var y = a.utils.renderWatch(w, x), z = function(a2) {
return function() {
return { active: a2.map(function(a3) {
return !a3.disabled;
}) };
};
}, A = function(a2) {
return function(b2) {
void 0 !== b2.active && a2.forEach(function(a3, c2) {
a3.disabled = !b2.active[c2];
});
};
};
return e.dispatch.on("elementMouseover.tooltip", function(a2) {
j.data(a2).hidden(false);
}), e.dispatch.on("elementMouseout.tooltip", function(a2) {
j.hidden(true);
}), b.dispatch = w, b.lines = e, b.legend = h, b.xAxis = f, b.yAxis = g, b.interactiveLayer = i, b.tooltip = j, b.dispatch = w, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, height: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, showLegend: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, showXAxis: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, showYAxis: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, defaultState: { get: function() {
return u;
}, set: function(a2) {
u = a2;
} }, noData: { get: function() {
return v;
}, set: function(a2) {
v = a2;
} }, margin: { get: function() {
return k;
}, set: function(a2) {
k.top = void 0 !== a2.top ? a2.top : k.top, k.right = void 0 !== a2.right ? a2.right : k.right, k.bottom = void 0 !== a2.bottom ? a2.bottom : k.bottom, k.left = void 0 !== a2.left ? a2.left : k.left;
} }, duration: { get: function() {
return x;
}, set: function(a2) {
x = a2, y.reset(x), e.duration(x), f.duration(x), g.duration(x);
} }, color: { get: function() {
return l;
}, set: function(b2) {
l = a.utils.getColor(b2), h.color(l), e.color(l);
} }, rightAlignYAxis: { get: function() {
return r;
}, set: function(a2) {
r = a2, g.orient(r ? "right" : "left");
} }, useInteractiveGuideline: { get: function() {
return s;
}, set: function(a2) {
s = a2, s && (e.interactive(false), e.useVoronoi(false));
} } }), a.utils.inheritOptions(b, e), a.utils.initOptions(b), b;
}, a.models.linePlusBarChart = function() {
"use strict";
function b(v2) {
return v2.each(function(v3) {
function J2(a2) {
var b2 = +("e" == a2), c2 = b2 ? 1 : -1, d2 = Y / 3;
return "M" + 0.5 * c2 + "," + d2 + "A6,6 0 0 " + b2 + " " + 6.5 * c2 + "," + (d2 + 6) + "V" + (2 * d2 - 6) + "A6,6 0 0 " + b2 + " " + 0.5 * c2 + "," + 2 * d2 + "ZM" + 2.5 * c2 + "," + (d2 + 8) + "V" + (2 * d2 - 8) + "M" + 4.5 * c2 + "," + (d2 + 8) + "V" + (2 * d2 - 8);
}
function T() {
u.empty() || u.extent(I), la.data([u.empty() ? e.domain() : I]).each(function(a2, b2) {
var c2 = e(a2[0]) - e.range()[0], d2 = e.range()[1] - e(a2[1]);
d3.select(this).select(".left").attr("width", 0 > c2 ? 0 : c2), d3.select(this).select(".right").attr("x", e(a2[1])).attr("width", 0 > d2 ? 0 : d2);
});
}
function U() {
I = u.empty() ? null : u.extent(), c = u.empty() ? e.domain() : u.extent(), K.brush({ extent: c, brush: u }), T(), l.width(W).height(X).color(v3.map(function(a2, b3) {
return a2.color || C(a2, b3);
}).filter(function(a2, b3) {
return !v3[b3].disabled && v3[b3].bar;
})), j.width(W).height(X).color(v3.map(function(a2, b3) {
return a2.color || C(a2, b3);
}).filter(function(a2, b3) {
return !v3[b3].disabled && !v3[b3].bar;
}));
var b2 = ea.select(".nv-focus .nv-barsWrap").datum($.length ? $.map(function(a2, b3) {
return { key: a2.key, values: a2.values.filter(function(a3, b4) {
return l.x()(a3, b4) >= c[0] && l.x()(a3, b4) <= c[1];
}) };
}) : [{ values: [] }]), h2 = ea.select(".nv-focus .nv-linesWrap").datum(S(_) ? [{ values: [] }] : _.filter(function(a2) {
return !a2.disabled;
}).map(function(a2, b3) {
return { area: a2.area, fillOpacity: a2.fillOpacity, key: a2.key, values: a2.values.filter(function(a3, b4) {
return j.x()(a3, b4) >= c[0] && j.x()(a3, b4) <= c[1];
}) };
}));
d = $.length ? l.xScale() : j.xScale(), n.scale(d)._ticks(a.utils.calcTicksX(W / 100, v3)).tickSize(-X, 0), n.domain([Math.ceil(c[0]), Math.floor(c[1])]), ea.select(".nv-x.nv-axis").transition().duration(L).call(n), b2.transition().duration(L).call(l), h2.transition().duration(L).call(j), ea.select(".nv-focus .nv-x.nv-axis").attr("transform", "translate(0," + f.range()[0] + ")"), p.scale(f)._ticks(a.utils.calcTicksY(X / 36, v3)).tickSize(-W, 0), q.scale(g)._ticks(a.utils.calcTicksY(X / 36, v3)).tickSize($.length ? 0 : -W, 0), ea.select(".nv-focus .nv-y1.nv-axis").style("opacity", $.length ? 1 : 0), ea.select(".nv-focus .nv-y2.nv-axis").style("opacity", _.length && !S(_) ? 1 : 0).attr("transform", "translate(" + d.range()[1] + ",0)"), ea.select(".nv-focus .nv-y1.nv-axis").transition().duration(L).call(p), ea.select(".nv-focus .nv-y2.nv-axis").transition().duration(L).call(q);
}
var V = d3.select(this);
a.utils.initSVG(V);
var W = a.utils.availableWidth(y, V, w), X = a.utils.availableHeight(z, V, w) - (E ? H : 0), Y = H - x.top - x.bottom;
if (b.update = function() {
V.transition().duration(L).call(b);
}, b.container = this, M.setter(R(v3), b.update).getter(Q(v3)).update(), M.disabled = v3.map(function(a2) {
return !!a2.disabled;
}), !N) {
var Z;
N = {};
for (Z in M)
M[Z] instanceof Array ? N[Z] = M[Z].slice(0) : N[Z] = M[Z];
}
if (!(v3 && v3.length && v3.filter(function(a2) {
return a2.values.length;
}).length))
return a.utils.noData(b, V), b;
V.selectAll(".nv-noData").remove();
var $ = v3.filter(function(a2) {
return !a2.disabled && a2.bar;
}), _ = v3.filter(function(a2) {
return !a2.bar;
});
d = l.xScale(), e = o.scale(), f = l.yScale(), g = j.yScale(), h = m.yScale(), i = k.yScale();
var aa = v3.filter(function(a2) {
return !a2.disabled && a2.bar;
}).map(function(a2) {
return a2.values.map(function(a3, b2) {
return { x: A(a3, b2), y: B(a3, b2) };
});
}), ba = v3.filter(function(a2) {
return !a2.disabled && !a2.bar;
}).map(function(a2) {
return a2.values.map(function(a3, b2) {
return { x: A(a3, b2), y: B(a3, b2) };
});
});
d.range([0, W]), e.domain(d3.extent(d3.merge(aa.concat(ba)), function(a2) {
return a2.x;
})).range([0, W]);
var ca = V.selectAll("g.nv-wrap.nv-linePlusBar").data([v3]), da = ca.enter().append("g").attr("class", "nvd3 nv-wrap nv-linePlusBar").append("g"), ea = ca.select("g");
da.append("g").attr("class", "nv-legendWrap");
var fa = da.append("g").attr("class", "nv-focus");
fa.append("g").attr("class", "nv-x nv-axis"), fa.append("g").attr("class", "nv-y1 nv-axis"), fa.append("g").attr("class", "nv-y2 nv-axis"), fa.append("g").attr("class", "nv-barsWrap"), fa.append("g").attr("class", "nv-linesWrap");
var ga = da.append("g").attr("class", "nv-context");
if (ga.append("g").attr("class", "nv-x nv-axis"), ga.append("g").attr("class", "nv-y1 nv-axis"), ga.append("g").attr("class", "nv-y2 nv-axis"), ga.append("g").attr("class", "nv-barsWrap"), ga.append("g").attr("class", "nv-linesWrap"), ga.append("g").attr("class", "nv-brushBackground"), ga.append("g").attr("class", "nv-x nv-brush"), D) {
var ha = t.align() ? W / 2 : W, ia = t.align() ? ha : 0;
t.width(ha), ea.select(".nv-legendWrap").datum(v3.map(function(a2) {
return a2.originalKey = void 0 === a2.originalKey ? a2.key : a2.originalKey, a2.key = a2.originalKey + (a2.bar ? O : P), a2;
})).call(t), w.top != t.height() && (w.top = t.height(), X = a.utils.availableHeight(z, V, w) - H), ea.select(".nv-legendWrap").attr("transform", "translate(" + ia + "," + -w.top + ")");
}
ca.attr("transform", "translate(" + w.left + "," + w.top + ")"), ea.select(".nv-context").style("display", E ? "initial" : "none"), m.width(W).height(Y).color(v3.map(function(a2, b2) {
return a2.color || C(a2, b2);
}).filter(function(a2, b2) {
return !v3[b2].disabled && v3[b2].bar;
})), k.width(W).height(Y).color(v3.map(function(a2, b2) {
return a2.color || C(a2, b2);
}).filter(function(a2, b2) {
return !v3[b2].disabled && !v3[b2].bar;
}));
var ja = ea.select(".nv-context .nv-barsWrap").datum($.length ? $ : [{ values: [] }]), ka = ea.select(".nv-context .nv-linesWrap").datum(S(_) ? [{ values: [] }] : _.filter(function(a2) {
return !a2.disabled;
}));
ea.select(".nv-context").attr("transform", "translate(0," + (X + w.bottom + x.top) + ")"), ja.transition().call(m), ka.transition().call(k), G && (o._ticks(a.utils.calcTicksX(W / 100, v3)).tickSize(-Y, 0), ea.select(".nv-context .nv-x.nv-axis").attr("transform", "translate(0," + h.range()[0] + ")"), ea.select(".nv-context .nv-x.nv-axis").transition().call(o)), F && (r.scale(h)._ticks(Y / 36).tickSize(-W, 0), s.scale(i)._ticks(Y / 36).tickSize($.length ? 0 : -W, 0), ea.select(".nv-context .nv-y3.nv-axis").style("opacity", $.length ? 1 : 0).attr("transform", "translate(0," + e.range()[0] + ")"), ea.select(".nv-context .nv-y2.nv-axis").style("opacity", _.length ? 1 : 0).attr("transform", "translate(" + e.range()[1] + ",0)"), ea.select(".nv-context .nv-y1.nv-axis").transition().call(r), ea.select(".nv-context .nv-y2.nv-axis").transition().call(s)), u.x(e).on("brush", U), I && u.extent(I);
var la = ea.select(".nv-brushBackground").selectAll("g").data([I || u.extent()]), ma = la.enter().append("g");
ma.append("rect").attr("class", "left").attr("x", 0).attr("y", 0).attr("height", Y), ma.append("rect").attr("class", "right").attr("x", 0).attr("y", 0).attr("height", Y);
var na = ea.select(".nv-x.nv-brush").call(u);
na.selectAll("rect").attr("height", Y), na.selectAll(".resize").append("path").attr("d", J2), t.dispatch.on("stateChange", function(a2) {
for (var c2 in a2)
M[c2] = a2[c2];
K.stateChange(M), b.update();
}), K.on("changeState", function(a2) {
"undefined" != typeof a2.disabled && (v3.forEach(function(b2, c2) {
b2.disabled = a2.disabled[c2];
}), M.disabled = a2.disabled), b.update();
}), U();
}), b;
}
var c, d, e, f, g, h, i, j = a.models.line(), k = a.models.line(), l = a.models.historicalBar(), m = a.models.historicalBar(), n = a.models.axis(), o = a.models.axis(), p = a.models.axis(), q = a.models.axis(), r = a.models.axis(), s = a.models.axis(), t = a.models.legend(), u = d3.svg.brush(), v = a.models.tooltip(), w = { top: 30, right: 30, bottom: 30, left: 60 }, x = { top: 0, right: 30, bottom: 20, left: 60 }, y = null, z = null, A = function(a2) {
return a2.x;
}, B = function(a2) {
return a2.y;
}, C = a.utils.defaultColor(), D = true, E = true, F = false, G = true, H = 50, I = null, J = null, K = d3.dispatch("brush", "stateChange", "changeState"), L = 0, M = a.utils.state(), N = null, O = " (left axis)", P = " (right axis)";
j.clipEdge(true), k.interactive(false), k.pointActive(function(a2) {
return false;
}), n.orient("bottom").tickPadding(5), p.orient("left"), q.orient("right"), o.orient("bottom").tickPadding(5), r.orient("left"), s.orient("right"), v.headerEnabled(true).headerFormatter(function(a2, b2) {
return n.tickFormat()(a2, b2);
});
var Q = function(a2) {
return function() {
return { active: a2.map(function(a3) {
return !a3.disabled;
}) };
};
}, R = function(a2) {
return function(b2) {
void 0 !== b2.active && a2.forEach(function(a3, c2) {
a3.disabled = !b2.active[c2];
});
};
}, S = function(a2) {
return a2.every(function(a3) {
return a3.disabled;
});
};
return j.dispatch.on("elementMouseover.tooltip", function(a2) {
v.duration(100).valueFormatter(function(a3, b2) {
return q.tickFormat()(a3, b2);
}).data(a2).hidden(false);
}), j.dispatch.on("elementMouseout.tooltip", function(a2) {
v.hidden(true);
}), l.dispatch.on("elementMouseover.tooltip", function(a2) {
a2.value = b.x()(a2.data), a2.series = { value: b.y()(a2.data), color: a2.color }, v.duration(0).valueFormatter(function(a3, b2) {
return p.tickFormat()(a3, b2);
}).data(a2).hidden(false);
}), l.dispatch.on("elementMouseout.tooltip", function(a2) {
v.hidden(true);
}), l.dispatch.on("elementMousemove.tooltip", function(a2) {
v();
}), b.dispatch = K, b.legend = t, b.lines = j, b.lines2 = k, b.bars = l, b.bars2 = m, b.xAxis = n, b.x2Axis = o, b.y1Axis = p, b.y2Axis = q, b.y3Axis = r, b.y4Axis = s, b.tooltip = v, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return y;
}, set: function(a2) {
y = a2;
} }, height: { get: function() {
return z;
}, set: function(a2) {
z = a2;
} }, showLegend: { get: function() {
return D;
}, set: function(a2) {
D = a2;
} }, brushExtent: { get: function() {
return I;
}, set: function(a2) {
I = a2;
} }, noData: { get: function() {
return J;
}, set: function(a2) {
J = a2;
} }, focusEnable: { get: function() {
return E;
}, set: function(a2) {
E = a2;
} }, focusHeight: { get: function() {
return H;
}, set: function(a2) {
H = a2;
} }, focusShowAxisX: { get: function() {
return G;
}, set: function(a2) {
G = a2;
} }, focusShowAxisY: { get: function() {
return F;
}, set: function(a2) {
F = a2;
} }, legendLeftAxisHint: { get: function() {
return O;
}, set: function(a2) {
O = a2;
} }, legendRightAxisHint: { get: function() {
return P;
}, set: function(a2) {
P = a2;
} }, margin: { get: function() {
return w;
}, set: function(a2) {
w.top = void 0 !== a2.top ? a2.top : w.top, w.right = void 0 !== a2.right ? a2.right : w.right, w.bottom = void 0 !== a2.bottom ? a2.bottom : w.bottom, w.left = void 0 !== a2.left ? a2.left : w.left;
} }, focusMargin: { get: function() {
return x;
}, set: function(a2) {
x.top = void 0 !== a2.top ? a2.top : x.top, x.right = void 0 !== a2.right ? a2.right : x.right, x.bottom = void 0 !== a2.bottom ? a2.bottom : x.bottom, x.left = void 0 !== a2.left ? a2.left : x.left;
} }, duration: { get: function() {
return L;
}, set: function(a2) {
L = a2;
} }, color: { get: function() {
return C;
}, set: function(b2) {
C = a.utils.getColor(b2), t.color(C);
} }, x: { get: function() {
return A;
}, set: function(a2) {
A = a2, j.x(a2), k.x(a2), l.x(a2), m.x(a2);
} }, y: { get: function() {
return B;
}, set: function(a2) {
B = a2, j.y(a2), k.y(a2), l.y(a2), m.y(a2);
} } }), a.utils.inheritOptions(b, j), a.utils.initOptions(b), b;
}, a.models.lineWithFocusChart = function() {
"use strict";
function b(o2) {
return o2.each(function(o3) {
function z2(a2) {
var b2 = +("e" == a2), c2 = b2 ? 1 : -1, d2 = M / 3;
return "M" + 0.5 * c2 + "," + d2 + "A6,6 0 0 " + b2 + " " + 6.5 * c2 + "," + (d2 + 6) + "V" + (2 * d2 - 6) + "A6,6 0 0 " + b2 + " " + 0.5 * c2 + "," + 2 * d2 + "ZM" + 2.5 * c2 + "," + (d2 + 8) + "V" + (2 * d2 - 8) + "M" + 4.5 * c2 + "," + (d2 + 8) + "V" + (2 * d2 - 8);
}
function G() {
n.empty() || n.extent(y), U.data([n.empty() ? e.domain() : y]).each(function(a2, b2) {
var d2 = e(a2[0]) - c.range()[0], f2 = K - e(a2[1]);
d3.select(this).select(".left").attr("width", 0 > d2 ? 0 : d2), d3.select(this).select(".right").attr("x", e(a2[1])).attr("width", 0 > f2 ? 0 : f2);
});
}
function H() {
y = n.empty() ? null : n.extent();
var a2 = n.empty() ? e.domain() : n.extent();
if (!(Math.abs(a2[0] - a2[1]) <= 1)) {
A.brush({ extent: a2, brush: n }), G();
var b2 = Q.select(".nv-focus .nv-linesWrap").datum(o3.filter(function(a3) {
return !a3.disabled;
}).map(function(b3, c2) {
return { key: b3.key, area: b3.area, classed: b3.classed, values: b3.values.filter(function(b4, c3) {
return g.x()(b4, c3) >= a2[0] && g.x()(b4, c3) <= a2[1];
}) };
}));
b2.transition().duration(B).call(g), Q.select(".nv-focus .nv-x.nv-axis").transition().duration(B).call(i), Q.select(".nv-focus .nv-y.nv-axis").transition().duration(B).call(j);
}
}
var I = d3.select(this), J = this;
a.utils.initSVG(I);
var K = a.utils.availableWidth(t, I, q), L = a.utils.availableHeight(u, I, q) - v, M = v - r.top - r.bottom;
if (b.update = function() {
I.transition().duration(B).call(b);
}, b.container = this, C.setter(F(o3), b.update).getter(E(o3)).update(), C.disabled = o3.map(function(a2) {
return !!a2.disabled;
}), !D) {
var N;
D = {};
for (N in C)
C[N] instanceof Array ? D[N] = C[N].slice(0) : D[N] = C[N];
}
if (!(o3 && o3.length && o3.filter(function(a2) {
return a2.values.length;
}).length))
return a.utils.noData(b, I), b;
I.selectAll(".nv-noData").remove(), c = g.xScale(), d = g.yScale(), e = h.xScale(), f = h.yScale();
var O = I.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([o3]), P = O.enter().append("g").attr("class", "nvd3 nv-wrap nv-lineWithFocusChart").append("g"), Q = O.select("g");
P.append("g").attr("class", "nv-legendWrap");
var R = P.append("g").attr("class", "nv-focus");
R.append("g").attr("class", "nv-x nv-axis"), R.append("g").attr("class", "nv-y nv-axis"), R.append("g").attr("class", "nv-linesWrap"), R.append("g").attr("class", "nv-interactive");
var S = P.append("g").attr("class", "nv-context");
S.append("g").attr("class", "nv-x nv-axis"), S.append("g").attr("class", "nv-y nv-axis"), S.append("g").attr("class", "nv-linesWrap"), S.append("g").attr("class", "nv-brushBackground"), S.append("g").attr("class", "nv-x nv-brush"), x && (m.width(K), Q.select(".nv-legendWrap").datum(o3).call(m), q.top != m.height() && (q.top = m.height(), L = a.utils.availableHeight(u, I, q) - v), Q.select(".nv-legendWrap").attr("transform", "translate(0," + -q.top + ")")), O.attr("transform", "translate(" + q.left + "," + q.top + ")"), w && (p.width(K).height(L).margin({ left: q.left, top: q.top }).svgContainer(I).xScale(c), O.select(".nv-interactive").call(p)), g.width(K).height(L).color(o3.map(function(a2, b2) {
return a2.color || s(a2, b2);
}).filter(function(a2, b2) {
return !o3[b2].disabled;
})), h.defined(g.defined()).width(K).height(M).color(o3.map(function(a2, b2) {
return a2.color || s(a2, b2);
}).filter(function(a2, b2) {
return !o3[b2].disabled;
})), Q.select(".nv-context").attr("transform", "translate(0," + (L + q.bottom + r.top) + ")");
var T = Q.select(".nv-context .nv-linesWrap").datum(o3.filter(function(a2) {
return !a2.disabled;
}));
d3.transition(T).call(h), i.scale(c)._ticks(a.utils.calcTicksX(K / 100, o3)).tickSize(-L, 0), j.scale(d)._ticks(a.utils.calcTicksY(L / 36, o3)).tickSize(-K, 0), Q.select(".nv-focus .nv-x.nv-axis").attr("transform", "translate(0," + L + ")"), n.x(e).on("brush", function() {
H();
}), y && n.extent(y);
var U = Q.select(".nv-brushBackground").selectAll("g").data([y || n.extent()]), V = U.enter().append("g");
V.append("rect").attr("class", "left").attr("x", 0).attr("y", 0).attr("height", M), V.append("rect").attr("class", "right").attr("x", 0).attr("y", 0).attr("height", M);
var W = Q.select(".nv-x.nv-brush").call(n);
W.selectAll("rect").attr("height", M), W.selectAll(".resize").append("path").attr("d", z2), H(), k.scale(e)._ticks(a.utils.calcTicksX(K / 100, o3)).tickSize(-M, 0), Q.select(".nv-context .nv-x.nv-axis").attr("transform", "translate(0," + f.range()[0] + ")"), d3.transition(Q.select(".nv-context .nv-x.nv-axis")).call(k), l.scale(f)._ticks(a.utils.calcTicksY(M / 36, o3)).tickSize(-K, 0), d3.transition(Q.select(".nv-context .nv-y.nv-axis")).call(l), Q.select(".nv-context .nv-x.nv-axis").attr("transform", "translate(0," + f.range()[0] + ")"), m.dispatch.on("stateChange", function(a2) {
for (var c2 in a2)
C[c2] = a2[c2];
A.stateChange(C), b.update();
}), p.dispatch.on("elementMousemove", function(c2) {
g.clearHighlights();
var d2, f2, h2, k2 = [];
if (o3.filter(function(a2, b2) {
return a2.seriesIndex = b2, !a2.disabled;
}).forEach(function(i2, j2) {
var l3 = n.empty() ? e.domain() : n.extent(), m3 = i2.values.filter(function(a2, b2) {
return g.x()(a2, b2) >= l3[0] && g.x()(a2, b2) <= l3[1];
});
f2 = a.interactiveBisect(m3, c2.pointXValue, g.x());
var o4 = m3[f2], p2 = b.y()(o4, f2);
null != p2 && g.highlightPoint(j2, f2, true), void 0 !== o4 && (void 0 === d2 && (d2 = o4), void 0 === h2 && (h2 = b.xScale()(b.x()(o4, f2))), k2.push({ key: i2.key, value: b.y()(o4, f2), color: s(i2, i2.seriesIndex) }));
}), k2.length > 2) {
var l2 = b.yScale().invert(c2.mouseY), m2 = Math.abs(b.yScale().domain()[0] - b.yScale().domain()[1]), q2 = 0.03 * m2, r2 = a.nearestValueIndex(k2.map(function(a2) {
return a2.value;
}), l2, q2);
null !== r2 && (k2[r2].highlight = true);
}
var t2 = i.tickFormat()(b.x()(d2, f2));
p.tooltip.chartContainer(J.parentNode).valueFormatter(function(a2, b2) {
return null == a2 ? "N/A" : j.tickFormat()(a2);
}).data({ value: t2, index: f2, series: k2 })(), p.renderGuideLine(h2);
}), p.dispatch.on("elementMouseout", function(a2) {
g.clearHighlights();
}), A.on("changeState", function(a2) {
"undefined" != typeof a2.disabled && o3.forEach(function(b2, c2) {
b2.disabled = a2.disabled[c2];
}), b.update();
});
}), b;
}
var c, d, e, f, g = a.models.line(), h = a.models.line(), i = a.models.axis(), j = a.models.axis(), k = a.models.axis(), l = a.models.axis(), m = a.models.legend(), n = d3.svg.brush(), o = a.models.tooltip(), p = a.interactiveGuideline(), q = { top: 30, right: 30, bottom: 30, left: 60 }, r = { top: 0, right: 30, bottom: 20, left: 60 }, s = a.utils.defaultColor(), t = null, u = null, v = 50, w = false, x = true, y = null, z = null, A = d3.dispatch("brush", "stateChange", "changeState"), B = 250, C = a.utils.state(), D = null;
g.clipEdge(true).duration(0), h.interactive(false), h.pointActive(function(a2) {
return false;
}), i.orient("bottom").tickPadding(5), j.orient("left"), k.orient("bottom").tickPadding(5), l.orient("left"), o.valueFormatter(function(a2, b2) {
return j.tickFormat()(a2, b2);
}).headerFormatter(function(a2, b2) {
return i.tickFormat()(a2, b2);
});
var E = function(a2) {
return function() {
return { active: a2.map(function(a3) {
return !a3.disabled;
}) };
};
}, F = function(a2) {
return function(b2) {
void 0 !== b2.active && a2.forEach(function(a3, c2) {
a3.disabled = !b2.active[c2];
});
};
};
return g.dispatch.on("elementMouseover.tooltip", function(a2) {
o.data(a2).hidden(false);
}), g.dispatch.on("elementMouseout.tooltip", function(a2) {
o.hidden(true);
}), b.dispatch = A, b.legend = m, b.lines = g, b.lines2 = h, b.xAxis = i, b.yAxis = j, b.x2Axis = k, b.y2Axis = l, b.interactiveLayer = p, b.tooltip = o, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return t;
}, set: function(a2) {
t = a2;
} }, height: { get: function() {
return u;
}, set: function(a2) {
u = a2;
} }, focusHeight: { get: function() {
return v;
}, set: function(a2) {
v = a2;
} }, showLegend: { get: function() {
return x;
}, set: function(a2) {
x = a2;
} }, brushExtent: { get: function() {
return y;
}, set: function(a2) {
y = a2;
} }, defaultState: { get: function() {
return D;
}, set: function(a2) {
D = a2;
} }, noData: { get: function() {
return z;
}, set: function(a2) {
z = a2;
} }, margin: { get: function() {
return q;
}, set: function(a2) {
q.top = void 0 !== a2.top ? a2.top : q.top, q.right = void 0 !== a2.right ? a2.right : q.right, q.bottom = void 0 !== a2.bottom ? a2.bottom : q.bottom, q.left = void 0 !== a2.left ? a2.left : q.left;
} }, focusMargin: { get: function() {
return r;
}, set: function(a2) {
r.top = void 0 !== a2.top ? a2.top : r.top, r.right = void 0 !== a2.right ? a2.right : r.right, r.bottom = void 0 !== a2.bottom ? a2.bottom : r.bottom, r.left = void 0 !== a2.left ? a2.left : r.left;
} }, color: { get: function() {
return s;
}, set: function(b2) {
s = a.utils.getColor(b2), m.color(s);
} }, interpolate: { get: function() {
return g.interpolate();
}, set: function(a2) {
g.interpolate(a2), h.interpolate(a2);
} }, xTickFormat: { get: function() {
return i.tickFormat();
}, set: function(a2) {
i.tickFormat(a2), k.tickFormat(a2);
} }, yTickFormat: { get: function() {
return j.tickFormat();
}, set: function(a2) {
j.tickFormat(a2), l.tickFormat(a2);
} }, duration: { get: function() {
return B;
}, set: function(a2) {
B = a2, j.duration(B), l.duration(B), i.duration(B), k.duration(B);
} }, x: { get: function() {
return g.x();
}, set: function(a2) {
g.x(a2), h.x(a2);
} }, y: { get: function() {
return g.y();
}, set: function(a2) {
g.y(a2), h.y(a2);
} }, useInteractiveGuideline: { get: function() {
return w;
}, set: function(a2) {
w = a2, w && (g.interactive(false), g.useVoronoi(false));
} } }), a.utils.inheritOptions(b, g), a.utils.initOptions(b), b;
}, a.models.multiBar = function() {
"use strict";
function b(E) {
return C.reset(), E.each(function(b2) {
var E2 = k - j.left - j.right, F = l - j.top - j.bottom;
p = d3.select(this), a.utils.initSVG(p);
var G = 0;
if (x && b2.length && (x = [{ values: b2[0].values.map(function(a2) {
return { x: a2.x, y: 0, series: a2.series, size: 0.01 };
}) }]), u) {
var H = d3.layout.stack().offset(v).values(function(a2) {
return a2.values;
}).y(r)(!b2.length && x ? x : b2);
H.forEach(function(a2, c2) {
a2.nonStackable ? (b2[c2].nonStackableSeries = G++, H[c2] = b2[c2]) : c2 > 0 && H[c2 - 1].nonStackable && H[c2].values.map(function(a3, b3) {
a3.y0 -= H[c2 - 1].values[b3].y, a3.y1 = a3.y0 + a3.y;
});
}), b2 = H;
}
b2.forEach(function(a2, b3) {
a2.values.forEach(function(c2) {
c2.series = b3, c2.key = a2.key;
});
}), u && b2[0].values.map(function(a2, c2) {
var d2 = 0, e2 = 0;
b2.map(function(a3, f2) {
if (!b2[f2].nonStackable) {
var g2 = a3.values[c2];
g2.size = Math.abs(g2.y), g2.y < 0 ? (g2.y1 = e2, e2 -= g2.size) : (g2.y1 = g2.size + d2, d2 += g2.size);
}
});
});
var I = d && e ? [] : b2.map(function(a2, b3) {
return a2.values.map(function(a3, c2) {
return { x: q(a3, c2), y: r(a3, c2), y0: a3.y0, y1: a3.y1, idx: b3 };
});
});
m.domain(d || d3.merge(I).map(function(a2) {
return a2.x;
})).rangeBands(f || [0, E2], A), n.domain(e || d3.extent(d3.merge(I).map(function(a2) {
var c2 = a2.y;
return u && !b2[a2.idx].nonStackable && (c2 = a2.y > 0 ? a2.y1 : a2.y1 + a2.y), c2;
}).concat(s))).range(g || [F, 0]), m.domain()[0] === m.domain()[1] && (m.domain()[0] ? m.domain([m.domain()[0] - 0.01 * m.domain()[0], m.domain()[1] + 0.01 * m.domain()[1]]) : m.domain([-1, 1])), n.domain()[0] === n.domain()[1] && (n.domain()[0] ? n.domain([n.domain()[0] + 0.01 * n.domain()[0], n.domain()[1] - 0.01 * n.domain()[1]]) : n.domain([-1, 1])), h = h || m, i = i || n;
var J = p.selectAll("g.nv-wrap.nv-multibar").data([b2]), K = J.enter().append("g").attr("class", "nvd3 nv-wrap nv-multibar"), L = K.append("defs"), M = K.append("g"), N = J.select("g");
M.append("g").attr("class", "nv-groups"), J.attr("transform", "translate(" + j.left + "," + j.top + ")"), L.append("clipPath").attr("id", "nv-edge-clip-" + o).append("rect"), J.select("#nv-edge-clip-" + o + " rect").attr("width", E2).attr("height", F), N.attr("clip-path", t ? "url(#nv-edge-clip-" + o + ")" : "");
var O = J.select(".nv-groups").selectAll(".nv-group").data(function(a2) {
return a2;
}, function(a2, b3) {
return b3;
});
O.enter().append("g").style("stroke-opacity", 1e-6).style("fill-opacity", 1e-6);
var P = C.transition(O.exit().selectAll("rect.nv-bar"), "multibarExit", Math.min(100, z)).attr("y", function(a2, c2, d2) {
var e2 = i(0) || 0;
return u && b2[a2.series] && !b2[a2.series].nonStackable && (e2 = i(a2.y0)), e2;
}).attr("height", 0).remove();
P.delay && P.delay(function(a2, b3) {
var c2 = b3 * (z / (D + 1)) - b3;
return c2;
}), O.attr("class", function(a2, b3) {
return "nv-group nv-series-" + b3;
}).classed("hover", function(a2) {
return a2.hover;
}).style("fill", function(a2, b3) {
return w(a2, b3);
}).style("stroke", function(a2, b3) {
return w(a2, b3);
}), O.style("stroke-opacity", 1).style("fill-opacity", 0.75);
var Q = O.selectAll("rect.nv-bar").data(function(a2) {
return x && !b2.length ? x.values : a2.values;
});
Q.exit().remove();
Q.enter().append("rect").attr("class", function(a2, b3) {
return r(a2, b3) < 0 ? "nv-bar negative" : "nv-bar positive";
}).attr("x", function(a2, c2, d2) {
return u && !b2[d2].nonStackable ? 0 : d2 * m.rangeBand() / b2.length;
}).attr("y", function(a2, c2, d2) {
return i(u && !b2[d2].nonStackable ? a2.y0 : 0) || 0;
}).attr("height", 0).attr("width", function(a2, c2, d2) {
return m.rangeBand() / (u && !b2[d2].nonStackable ? 1 : b2.length);
}).attr("transform", function(a2, b3) {
return "translate(" + m(q(a2, b3)) + ",0)";
});
Q.style("fill", function(a2, b3, c2) {
return w(a2, c2, b3);
}).style("stroke", function(a2, b3, c2) {
return w(a2, c2, b3);
}).on("mouseover", function(a2, b3) {
d3.select(this).classed("hover", true), B.elementMouseover({ data: a2, index: b3, color: d3.select(this).style("fill") });
}).on("mouseout", function(a2, b3) {
d3.select(this).classed("hover", false), B.elementMouseout({ data: a2, index: b3, color: d3.select(this).style("fill") });
}).on("mousemove", function(a2, b3) {
B.elementMousemove({ data: a2, index: b3, color: d3.select(this).style("fill") });
}).on("click", function(a2, b3) {
B.elementClick({ data: a2, index: b3, color: d3.select(this).style("fill") }), d3.event.stopPropagation();
}).on("dblclick", function(a2, b3) {
B.elementDblClick({ data: a2, index: b3, color: d3.select(this).style("fill") }), d3.event.stopPropagation();
}), Q.attr("class", function(a2, b3) {
return r(a2, b3) < 0 ? "nv-bar negative" : "nv-bar positive";
}).attr("transform", function(a2, b3) {
return "translate(" + m(q(a2, b3)) + ",0)";
}), y && (c || (c = b2.map(function() {
return true;
})), Q.style("fill", function(a2, b3, d2) {
return d3.rgb(y(a2, b3)).darker(c.map(function(a3, b4) {
return b4;
}).filter(function(a3, b4) {
return !c[b4];
})[d2]).toString();
}).style("stroke", function(a2, b3, d2) {
return d3.rgb(y(a2, b3)).darker(c.map(function(a3, b4) {
return b4;
}).filter(function(a3, b4) {
return !c[b4];
})[d2]).toString();
}));
var R = Q.watchTransition(C, "multibar", Math.min(250, z)).delay(function(a2, c2) {
return c2 * z / b2[0].values.length;
});
u ? R.attr("y", function(a2, c2, d2) {
var e2 = 0;
return e2 = b2[d2].nonStackable ? r(a2, c2) < 0 ? n(0) : n(0) - n(r(a2, c2)) < -1 ? n(0) - 1 : n(r(a2, c2)) || 0 : n(a2.y1);
}).attr("height", function(a2, c2, d2) {
return b2[d2].nonStackable ? Math.max(Math.abs(n(r(a2, c2)) - n(0)), 0) || 0 : Math.max(Math.abs(n(a2.y + a2.y0) - n(a2.y0)), 0);
}).attr("x", function(a2, c2, d2) {
var e2 = 0;
return b2[d2].nonStackable && (e2 = a2.series * m.rangeBand() / b2.length, b2.length !== G && (e2 = b2[d2].nonStackableSeries * m.rangeBand() / (2 * G))), e2;
}).attr("width", function(a2, c2, d2) {
if (b2[d2].nonStackable) {
var e2 = m.rangeBand() / G;
return b2.length !== G && (e2 = m.rangeBand() / (2 * G)), e2;
}
return m.rangeBand();
}) : R.attr("x", function(a2, c2) {
return a2.series * m.rangeBand() / b2.length;
}).attr("width", m.rangeBand() / b2.length).attr("y", function(a2, b3) {
return r(a2, b3) < 0 ? n(0) : n(0) - n(r(a2, b3)) < 1 ? n(0) - 1 : n(r(a2, b3)) || 0;
}).attr("height", function(a2, b3) {
return Math.max(Math.abs(n(r(a2, b3)) - n(0)), 1) || 0;
}), h = m.copy(), i = n.copy(), b2[0] && b2[0].values && (D = b2[0].values.length);
}), C.renderEnd("multibar immediate"), b;
}
var c, d, e, f, g, h, i, j = { top: 0, right: 0, bottom: 0, left: 0 }, k = 960, l = 500, m = d3.scale.ordinal(), n = d3.scale.linear(), o = Math.floor(1e4 * Math.random()), p = null, q = function(a2) {
return a2.x;
}, r = function(a2) {
return a2.y;
}, s = [0], t = true, u = false, v = "zero", w = a.utils.defaultColor(), x = false, y = null, z = 500, A = 0.1, B = d3.dispatch("chartClick", "elementClick", "elementDblClick", "elementMouseover", "elementMouseout", "elementMousemove", "renderEnd"), C = a.utils.renderWatch(B, z), D = 0;
return b.dispatch = B, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, height: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, x: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, y: { get: function() {
return r;
}, set: function(a2) {
r = a2;
} }, xScale: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, yScale: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, xDomain: { get: function() {
return d;
}, set: function(a2) {
d = a2;
} }, yDomain: { get: function() {
return e;
}, set: function(a2) {
e = a2;
} }, xRange: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, yRange: { get: function() {
return g;
}, set: function(a2) {
g = a2;
} }, forceY: { get: function() {
return s;
}, set: function(a2) {
s = a2;
} }, stacked: { get: function() {
return u;
}, set: function(a2) {
u = a2;
} }, stackOffset: { get: function() {
return v;
}, set: function(a2) {
v = a2;
} }, clipEdge: { get: function() {
return t;
}, set: function(a2) {
t = a2;
} }, disabled: { get: function() {
return c;
}, set: function(a2) {
c = a2;
} }, id: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, hideable: { get: function() {
return x;
}, set: function(a2) {
x = a2;
} }, groupSpacing: { get: function() {
return A;
}, set: function(a2) {
A = a2;
} }, margin: { get: function() {
return j;
}, set: function(a2) {
j.top = void 0 !== a2.top ? a2.top : j.top, j.right = void 0 !== a2.right ? a2.right : j.right, j.bottom = void 0 !== a2.bottom ? a2.bottom : j.bottom, j.left = void 0 !== a2.left ? a2.left : j.left;
} }, duration: { get: function() {
return z;
}, set: function(a2) {
z = a2, C.reset(z);
} }, color: { get: function() {
return w;
}, set: function(b2) {
w = a.utils.getColor(b2);
} }, barColor: { get: function() {
return y;
}, set: function(b2) {
y = b2 ? a.utils.getColor(b2) : null;
} } }), a.utils.initOptions(b), b;
}, a.models.multiBarChart = function() {
"use strict";
function b(j2) {
return E.reset(), E.models(e), r && E.models(f), s && E.models(g), j2.each(function(j3) {
var A2 = d3.select(this);
a.utils.initSVG(A2);
var E2 = a.utils.availableWidth(l, A2, k), I = a.utils.availableHeight(m, A2, k);
if (b.update = function() {
0 === D ? A2.call(b) : A2.transition().duration(D).call(b);
}, b.container = this, y.setter(H(j3), b.update).getter(G(j3)).update(), y.disabled = j3.map(function(a2) {
return !!a2.disabled;
}), !z) {
var J;
z = {};
for (J in y)
y[J] instanceof Array ? z[J] = y[J].slice(0) : z[J] = y[J];
}
if (!(j3 && j3.length && j3.filter(function(a2) {
return a2.values.length;
}).length))
return a.utils.noData(b, A2), b;
A2.selectAll(".nv-noData").remove(), c = e.xScale(), d = e.yScale();
var K = A2.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([j3]), L = K.enter().append("g").attr("class", "nvd3 nv-wrap nv-multiBarWithLegend").append("g"), M = K.select("g");
if (L.append("g").attr("class", "nv-x nv-axis"), L.append("g").attr("class", "nv-y nv-axis"), L.append("g").attr("class", "nv-barsWrap"), L.append("g").attr("class", "nv-legendWrap"), L.append("g").attr("class", "nv-controlsWrap"), q && (h.width(E2 - C()), M.select(".nv-legendWrap").datum(j3).call(h), k.top != h.height() && (k.top = h.height(), I = a.utils.availableHeight(m, A2, k)), M.select(".nv-legendWrap").attr("transform", "translate(" + C() + "," + -k.top + ")")), o) {
var N = [{ key: p.grouped || "Grouped", disabled: e.stacked() }, { key: p.stacked || "Stacked", disabled: !e.stacked() }];
i.width(C()).color(["#444", "#444", "#444"]), M.select(".nv-controlsWrap").datum(N).attr("transform", "translate(0," + -k.top + ")").call(i);
}
K.attr("transform", "translate(" + k.left + "," + k.top + ")"), t && M.select(".nv-y.nv-axis").attr("transform", "translate(" + E2 + ",0)"), e.disabled(j3.map(function(a2) {
return a2.disabled;
})).width(E2).height(I).color(j3.map(function(a2, b2) {
return a2.color || n(a2, b2);
}).filter(function(a2, b2) {
return !j3[b2].disabled;
}));
var O = M.select(".nv-barsWrap").datum(j3.filter(function(a2) {
return !a2.disabled;
}));
if (O.call(e), r) {
f.scale(c)._ticks(a.utils.calcTicksX(E2 / 100, j3)).tickSize(-I, 0), M.select(".nv-x.nv-axis").attr("transform", "translate(0," + d.range()[0] + ")"), M.select(".nv-x.nv-axis").call(f);
var P = M.select(".nv-x.nv-axis > g").selectAll("g");
if (P.selectAll("line, text").style("opacity", 1), v) {
var Q = function(a2, b2) {
return "translate(" + a2 + "," + b2 + ")";
}, R = 5, S = 17;
P.selectAll("text").attr("transform", function(a2, b2, c2) {
return Q(0, c2 % 2 == 0 ? R : S);
});
var T = d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;
M.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform", function(a2, b2) {
return Q(0, 0 === b2 || T % 2 !== 0 ? S : R);
});
}
w && M.selectAll(".tick text").call(a.utils.wrapTicks, b.xAxis.rangeBand()), u && P.filter(function(a2, b2) {
return b2 % Math.ceil(j3[0].values.length / (E2 / 100)) !== 0;
}).selectAll("text, line").style("opacity", 0), x && P.selectAll(".tick text").attr("transform", "rotate(" + x + " 0,0)").style("text-anchor", x > 0 ? "start" : "end"), M.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity", 1);
}
s && (g.scale(d)._ticks(a.utils.calcTicksY(I / 36, j3)).tickSize(-E2, 0), M.select(".nv-y.nv-axis").call(g)), h.dispatch.on("stateChange", function(a2) {
for (var c2 in a2)
y[c2] = a2[c2];
B.stateChange(y), b.update();
}), i.dispatch.on("legendClick", function(a2, c2) {
if (a2.disabled) {
switch (N = N.map(function(a3) {
return a3.disabled = true, a3;
}), a2.disabled = false, a2.key) {
case "Grouped":
case p.grouped:
e.stacked(false);
break;
case "Stacked":
case p.stacked:
e.stacked(true);
}
y.stacked = e.stacked(), B.stateChange(y), b.update();
}
}), B.on("changeState", function(a2) {
"undefined" != typeof a2.disabled && (j3.forEach(function(b2, c2) {
b2.disabled = a2.disabled[c2];
}), y.disabled = a2.disabled), "undefined" != typeof a2.stacked && (e.stacked(a2.stacked), y.stacked = a2.stacked, F = a2.stacked), b.update();
});
}), E.renderEnd("multibarchart immediate"), b;
}
var c, d, e = a.models.multiBar(), f = a.models.axis(), g = a.models.axis(), h = a.models.legend(), i = a.models.legend(), j = a.models.tooltip(), k = { top: 30, right: 20, bottom: 50, left: 60 }, l = null, m = null, n = a.utils.defaultColor(), o = true, p = {}, q = true, r = true, s = true, t = false, u = true, v = false, w = false, x = 0, y = a.utils.state(), z = null, A = null, B = d3.dispatch("stateChange", "changeState", "renderEnd"), C = function() {
return o ? 180 : 0;
}, D = 250;
y.stacked = false, e.stacked(false), f.orient("bottom").tickPadding(7).showMaxMin(false).tickFormat(function(a2) {
return a2;
}), g.orient(t ? "right" : "left").tickFormat(d3.format(",.1f")), j.duration(0).valueFormatter(function(a2, b2) {
return g.tickFormat()(a2, b2);
}).headerFormatter(function(a2, b2) {
return f.tickFormat()(a2, b2);
}), i.updateState(false);
var E = a.utils.renderWatch(B), F = false, G = function(a2) {
return function() {
return { active: a2.map(function(a3) {
return !a3.disabled;
}), stacked: F };
};
}, H = function(a2) {
return function(b2) {
void 0 !== b2.stacked && (F = b2.stacked), void 0 !== b2.active && a2.forEach(function(a3, c2) {
a3.disabled = !b2.active[c2];
});
};
};
return e.dispatch.on("elementMouseover.tooltip", function(a2) {
a2.value = b.x()(a2.data), a2.series = { key: a2.data.key, value: b.y()(a2.data), color: a2.color }, j.data(a2).hidden(false);
}), e.dispatch.on("elementMouseout.tooltip", function(a2) {
j.hidden(true);
}), e.dispatch.on("elementMousemove.tooltip", function(a2) {
j();
}), b.dispatch = B, b.multibar = e, b.legend = h, b.controls = i, b.xAxis = f, b.yAxis = g, b.state = y, b.tooltip = j, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, height: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, showLegend: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, showControls: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, controlLabels: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, showXAxis: { get: function() {
return r;
}, set: function(a2) {
r = a2;
} }, showYAxis: { get: function() {
return s;
}, set: function(a2) {
s = a2;
} }, defaultState: { get: function() {
return z;
}, set: function(a2) {
z = a2;
} }, noData: { get: function() {
return A;
}, set: function(a2) {
A = a2;
} }, reduceXTicks: { get: function() {
return u;
}, set: function(a2) {
u = a2;
} }, rotateLabels: { get: function() {
return x;
}, set: function(a2) {
x = a2;
} }, staggerLabels: { get: function() {
return v;
}, set: function(a2) {
v = a2;
} }, wrapLabels: { get: function() {
return w;
}, set: function(a2) {
w = !!a2;
} }, margin: { get: function() {
return k;
}, set: function(a2) {
k.top = void 0 !== a2.top ? a2.top : k.top, k.right = void 0 !== a2.right ? a2.right : k.right, k.bottom = void 0 !== a2.bottom ? a2.bottom : k.bottom, k.left = void 0 !== a2.left ? a2.left : k.left;
} }, duration: { get: function() {
return D;
}, set: function(a2) {
D = a2, e.duration(D), f.duration(D), g.duration(D), E.reset(D);
} }, color: { get: function() {
return n;
}, set: function(b2) {
n = a.utils.getColor(b2), h.color(n);
} }, rightAlignYAxis: { get: function() {
return t;
}, set: function(a2) {
t = a2, g.orient(t ? "right" : "left");
} }, barColor: { get: function() {
return e.barColor;
}, set: function(a2) {
e.barColor(a2), h.color(function(a3, b2) {
return d3.rgb("#ccc").darker(1.5 * b2).toString();
});
} } }), a.utils.inheritOptions(b, e), a.utils.initOptions(b), b;
}, a.models.multiBarHorizontal = function() {
"use strict";
function b(m2) {
return E.reset(), m2.each(function(b2) {
var m3 = k - j.left - j.right, C2 = l - j.top - j.bottom;
n = d3.select(this), a.utils.initSVG(n), w && (b2 = d3.layout.stack().offset("zero").values(function(a2) {
return a2.values;
}).y(r)(b2)), b2.forEach(function(a2, b3) {
a2.values.forEach(function(c2) {
c2.series = b3, c2.key = a2.key;
});
}), w && b2[0].values.map(function(a2, c2) {
var d2 = 0, e2 = 0;
b2.map(function(a3) {
var b3 = a3.values[c2];
b3.size = Math.abs(b3.y), b3.y < 0 ? (b3.y1 = e2 - b3.size, e2 -= b3.size) : (b3.y1 = d2, d2 += b3.size);
});
});
var F = d && e ? [] : b2.map(function(a2) {
return a2.values.map(function(a3, b3) {
return { x: q(a3, b3), y: r(a3, b3), y0: a3.y0, y1: a3.y1 };
});
});
o.domain(d || d3.merge(F).map(function(a2) {
return a2.x;
})).rangeBands(f || [0, C2], A), p.domain(e || d3.extent(d3.merge(F).map(function(a2) {
return w ? a2.y > 0 ? a2.y1 + a2.y : a2.y1 : a2.y;
}).concat(t))), x && !w ? p.range(g || [p.domain()[0] < 0 ? z : 0, m3 - (p.domain()[1] > 0 ? z : 0)]) : p.range(g || [0, m3]), h = h || o, i = i || d3.scale.linear().domain(p.domain()).range([p(0), p(0)]);
var G = d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([b2]), H = G.enter().append("g").attr("class", "nvd3 nv-wrap nv-multibarHorizontal"), I = (H.append("defs"), H.append("g"));
G.select("g");
I.append("g").attr("class", "nv-groups"), G.attr("transform", "translate(" + j.left + "," + j.top + ")");
var J = G.select(".nv-groups").selectAll(".nv-group").data(function(a2) {
return a2;
}, function(a2, b3) {
return b3;
});
J.enter().append("g").style("stroke-opacity", 1e-6).style("fill-opacity", 1e-6), J.exit().watchTransition(E, "multibarhorizontal: exit groups").style("stroke-opacity", 1e-6).style("fill-opacity", 1e-6).remove(), J.attr("class", function(a2, b3) {
return "nv-group nv-series-" + b3;
}).classed("hover", function(a2) {
return a2.hover;
}).style("fill", function(a2, b3) {
return u(a2, b3);
}).style("stroke", function(a2, b3) {
return u(a2, b3);
}), J.watchTransition(E, "multibarhorizontal: groups").style("stroke-opacity", 1).style("fill-opacity", 0.75);
var K = J.selectAll("g.nv-bar").data(function(a2) {
return a2.values;
});
K.exit().remove();
var L = K.enter().append("g").attr("transform", function(a2, c2, d2) {
return "translate(" + i(w ? a2.y0 : 0) + "," + (w ? 0 : d2 * o.rangeBand() / b2.length + o(q(a2, c2))) + ")";
});
L.append("rect").attr("width", 0).attr("height", o.rangeBand() / (w ? 1 : b2.length)), K.on("mouseover", function(a2, b3) {
d3.select(this).classed("hover", true), D.elementMouseover({ data: a2, index: b3, color: d3.select(this).style("fill") });
}).on("mouseout", function(a2, b3) {
d3.select(this).classed("hover", false), D.elementMouseout({ data: a2, index: b3, color: d3.select(this).style("fill") });
}).on("mouseout", function(a2, b3) {
D.elementMouseout({ data: a2, index: b3, color: d3.select(this).style("fill") });
}).on("mousemove", function(a2, b3) {
D.elementMousemove({ data: a2, index: b3, color: d3.select(this).style("fill") });
}).on("click", function(a2, b3) {
D.elementClick({ data: a2, index: b3, color: d3.select(this).style("fill") }), d3.event.stopPropagation();
}).on("dblclick", function(a2, b3) {
D.elementDblClick({ data: a2, index: b3, color: d3.select(this).style("fill") }), d3.event.stopPropagation();
}), s(b2[0], 0) && (L.append("polyline"), K.select("polyline").attr("fill", "none").attr("points", function(a2, c2) {
var d2 = s(a2, c2), e2 = 0.8 * o.rangeBand() / (2 * (w ? 1 : b2.length));
d2 = d2.length ? d2 : [-Math.abs(d2), Math.abs(d2)], d2 = d2.map(function(a3) {
return p(a3) - p(0);
});
var f2 = [[d2[0], -e2], [d2[0], e2], [d2[0], 0], [d2[1], 0], [d2[1], -e2], [d2[1], e2]];
return f2.map(function(a3) {
return a3.join(",");
}).join(" ");
}).attr("transform", function(a2, c2) {
var d2 = o.rangeBand() / (2 * (w ? 1 : b2.length));
return "translate(" + (r(a2, c2) < 0 ? 0 : p(r(a2, c2)) - p(0)) + ", " + d2 + ")";
})), L.append("text"), x && !w ? (K.select("text").attr("text-anchor", function(a2, b3) {
return r(a2, b3) < 0 ? "end" : "start";
}).attr("y", o.rangeBand() / (2 * b2.length)).attr("dy", ".32em").text(function(a2, b3) {
var c2 = B(r(a2, b3)), d2 = s(a2, b3);
return void 0 === d2 ? c2 : d2.length ? c2 + "+" + B(Math.abs(d2[1])) + "-" + B(Math.abs(d2[0])) : c2 + "±" + B(Math.abs(d2));
}), K.watchTransition(E, "multibarhorizontal: bars").select("text").attr("x", function(a2, b3) {
return r(a2, b3) < 0 ? -4 : p(r(a2, b3)) - p(0) + 4;
})) : K.selectAll("text").text(""), y && !w ? (L.append("text").classed("nv-bar-label", true), K.select("text.nv-bar-label").attr("text-anchor", function(a2, b3) {
return r(a2, b3) < 0 ? "start" : "end";
}).attr("y", o.rangeBand() / (2 * b2.length)).attr("dy", ".32em").text(function(a2, b3) {
return q(a2, b3);
}), K.watchTransition(E, "multibarhorizontal: bars").select("text.nv-bar-label").attr("x", function(a2, b3) {
return r(a2, b3) < 0 ? p(0) - p(r(a2, b3)) + 4 : -4;
})) : K.selectAll("text.nv-bar-label").text(""), K.attr("class", function(a2, b3) {
return r(a2, b3) < 0 ? "nv-bar negative" : "nv-bar positive";
}), v && (c || (c = b2.map(function() {
return true;
})), K.style("fill", function(a2, b3, d2) {
return d3.rgb(v(a2, b3)).darker(c.map(function(a3, b4) {
return b4;
}).filter(function(a3, b4) {
return !c[b4];
})[d2]).toString();
}).style("stroke", function(a2, b3, d2) {
return d3.rgb(v(a2, b3)).darker(c.map(function(a3, b4) {
return b4;
}).filter(function(a3, b4) {
return !c[b4];
})[d2]).toString();
})), w ? K.watchTransition(E, "multibarhorizontal: bars").attr("transform", function(a2, b3) {
return "translate(" + p(a2.y1) + "," + o(q(a2, b3)) + ")";
}).select("rect").attr("width", function(a2, b3) {
return Math.abs(p(r(a2, b3) + a2.y0) - p(a2.y0)) || 0;
}).attr("height", o.rangeBand()) : K.watchTransition(E, "multibarhorizontal: bars").attr("transform", function(a2, c2) {
return "translate(" + p(r(a2, c2) < 0 ? r(a2, c2) : 0) + "," + (a2.series * o.rangeBand() / b2.length + o(q(a2, c2))) + ")";
}).select("rect").attr("height", o.rangeBand() / b2.length).attr("width", function(a2, b3) {
return Math.max(Math.abs(p(r(a2, b3)) - p(0)), 1) || 0;
}), h = o.copy(), i = p.copy();
}), E.renderEnd("multibarHorizontal immediate"), b;
}
var c, d, e, f, g, h, i, j = { top: 0, right: 0, bottom: 0, left: 0 }, k = 960, l = 500, m = Math.floor(1e4 * Math.random()), n = null, o = d3.scale.ordinal(), p = d3.scale.linear(), q = function(a2) {
return a2.x;
}, r = function(a2) {
return a2.y;
}, s = function(a2) {
return a2.yErr;
}, t = [0], u = a.utils.defaultColor(), v = null, w = false, x = false, y = false, z = 60, A = 0.1, B = d3.format(",.2f"), C = 250, D = d3.dispatch("chartClick", "elementClick", "elementDblClick", "elementMouseover", "elementMouseout", "elementMousemove", "renderEnd"), E = a.utils.renderWatch(D, C);
return b.dispatch = D, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, height: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, x: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, y: { get: function() {
return r;
}, set: function(a2) {
r = a2;
} }, yErr: { get: function() {
return s;
}, set: function(a2) {
s = a2;
} }, xScale: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, yScale: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, xDomain: { get: function() {
return d;
}, set: function(a2) {
d = a2;
} }, yDomain: { get: function() {
return e;
}, set: function(a2) {
e = a2;
} }, xRange: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, yRange: { get: function() {
return g;
}, set: function(a2) {
g = a2;
} }, forceY: { get: function() {
return t;
}, set: function(a2) {
t = a2;
} }, stacked: { get: function() {
return w;
}, set: function(a2) {
w = a2;
} }, showValues: { get: function() {
return x;
}, set: function(a2) {
x = a2;
} }, disabled: { get: function() {
return c;
}, set: function(a2) {
c = a2;
} }, id: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, valueFormat: { get: function() {
return B;
}, set: function(a2) {
B = a2;
} }, valuePadding: { get: function() {
return z;
}, set: function(a2) {
z = a2;
} }, groupSpacing: { get: function() {
return A;
}, set: function(a2) {
A = a2;
} }, margin: { get: function() {
return j;
}, set: function(a2) {
j.top = void 0 !== a2.top ? a2.top : j.top, j.right = void 0 !== a2.right ? a2.right : j.right, j.bottom = void 0 !== a2.bottom ? a2.bottom : j.bottom, j.left = void 0 !== a2.left ? a2.left : j.left;
} }, duration: { get: function() {
return C;
}, set: function(a2) {
C = a2, E.reset(C);
} }, color: { get: function() {
return u;
}, set: function(b2) {
u = a.utils.getColor(b2);
} }, barColor: { get: function() {
return v;
}, set: function(b2) {
v = b2 ? a.utils.getColor(b2) : null;
} } }), a.utils.initOptions(b), b;
}, a.models.multiBarHorizontalChart = function() {
"use strict";
function b(j2) {
return C.reset(), C.models(e), r && C.models(f), s && C.models(g), j2.each(function(j3) {
var w2 = d3.select(this);
a.utils.initSVG(w2);
var C2 = a.utils.availableWidth(l, w2, k), D = a.utils.availableHeight(m, w2, k);
if (b.update = function() {
w2.transition().duration(z).call(b);
}, b.container = this, t = e.stacked(), u.setter(B(j3), b.update).getter(A(j3)).update(), u.disabled = j3.map(function(a2) {
return !!a2.disabled;
}), !v) {
var E;
v = {};
for (E in u)
u[E] instanceof Array ? v[E] = u[E].slice(0) : v[E] = u[E];
}
if (!(j3 && j3.length && j3.filter(function(a2) {
return a2.values.length;
}).length))
return a.utils.noData(b, w2), b;
w2.selectAll(".nv-noData").remove(), c = e.xScale(), d = e.yScale();
var F = w2.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([j3]), G = F.enter().append("g").attr("class", "nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"), H = F.select("g");
if (G.append("g").attr("class", "nv-x nv-axis"), G.append("g").attr("class", "nv-y nv-axis").append("g").attr("class", "nv-zeroLine").append("line"), G.append("g").attr("class", "nv-barsWrap"), G.append("g").attr("class", "nv-legendWrap"), G.append("g").attr("class", "nv-controlsWrap"), q && (h.width(C2 - y()), H.select(".nv-legendWrap").datum(j3).call(h), k.top != h.height() && (k.top = h.height(), D = a.utils.availableHeight(m, w2, k)), H.select(".nv-legendWrap").attr("transform", "translate(" + y() + "," + -k.top + ")")), o) {
var I = [{ key: p.grouped || "Grouped", disabled: e.stacked() }, { key: p.stacked || "Stacked", disabled: !e.stacked() }];
i.width(y()).color(["#444", "#444", "#444"]), H.select(".nv-controlsWrap").datum(I).attr("transform", "translate(0," + -k.top + ")").call(i);
}
F.attr("transform", "translate(" + k.left + "," + k.top + ")"), e.disabled(j3.map(function(a2) {
return a2.disabled;
})).width(C2).height(D).color(j3.map(function(a2, b2) {
return a2.color || n(a2, b2);
}).filter(function(a2, b2) {
return !j3[b2].disabled;
}));
var J = H.select(".nv-barsWrap").datum(j3.filter(function(a2) {
return !a2.disabled;
}));
if (J.transition().call(e), r) {
f.scale(c)._ticks(a.utils.calcTicksY(D / 24, j3)).tickSize(-C2, 0), H.select(".nv-x.nv-axis").call(f);
var K = H.select(".nv-x.nv-axis").selectAll("g");
K.selectAll("line, text");
}
s && (g.scale(d)._ticks(a.utils.calcTicksX(C2 / 100, j3)).tickSize(-D, 0), H.select(".nv-y.nv-axis").attr("transform", "translate(0," + D + ")"), H.select(".nv-y.nv-axis").call(g)), H.select(".nv-zeroLine line").attr("x1", d(0)).attr("x2", d(0)).attr("y1", 0).attr("y2", -D), h.dispatch.on("stateChange", function(a2) {
for (var c2 in a2)
u[c2] = a2[c2];
x.stateChange(u), b.update();
}), i.dispatch.on("legendClick", function(a2, c2) {
if (a2.disabled) {
switch (I = I.map(function(a3) {
return a3.disabled = true, a3;
}), a2.disabled = false, a2.key) {
case "Grouped":
e.stacked(false);
break;
case "Stacked":
e.stacked(true);
}
u.stacked = e.stacked(), x.stateChange(u), t = e.stacked(), b.update();
}
}), x.on("changeState", function(a2) {
"undefined" != typeof a2.disabled && (j3.forEach(function(b2, c2) {
b2.disabled = a2.disabled[c2];
}), u.disabled = a2.disabled), "undefined" != typeof a2.stacked && (e.stacked(a2.stacked), u.stacked = a2.stacked, t = a2.stacked), b.update();
});
}), C.renderEnd("multibar horizontal chart immediate"), b;
}
var c, d, e = a.models.multiBarHorizontal(), f = a.models.axis(), g = a.models.axis(), h = a.models.legend().height(30), i = a.models.legend().height(30), j = a.models.tooltip(), k = { top: 30, right: 20, bottom: 50, left: 60 }, l = null, m = null, n = a.utils.defaultColor(), o = true, p = {}, q = true, r = true, s = true, t = false, u = a.utils.state(), v = null, w = null, x = d3.dispatch("stateChange", "changeState", "renderEnd"), y = function() {
return o ? 180 : 0;
}, z = 250;
u.stacked = false, e.stacked(t), f.orient("left").tickPadding(5).showMaxMin(false).tickFormat(function(a2) {
return a2;
}), g.orient("bottom").tickFormat(d3.format(",.1f")), j.duration(0).valueFormatter(function(a2, b2) {
return g.tickFormat()(a2, b2);
}).headerFormatter(function(a2, b2) {
return f.tickFormat()(a2, b2);
}), i.updateState(false);
var A = function(a2) {
return function() {
return { active: a2.map(function(a3) {
return !a3.disabled;
}), stacked: t };
};
}, B = function(a2) {
return function(b2) {
void 0 !== b2.stacked && (t = b2.stacked), void 0 !== b2.active && a2.forEach(function(a3, c2) {
a3.disabled = !b2.active[c2];
});
};
}, C = a.utils.renderWatch(x, z);
return e.dispatch.on("elementMouseover.tooltip", function(a2) {
a2.value = b.x()(a2.data), a2.series = { key: a2.data.key, value: b.y()(a2.data), color: a2.color }, j.data(a2).hidden(false);
}), e.dispatch.on("elementMouseout.tooltip", function(a2) {
j.hidden(true);
}), e.dispatch.on("elementMousemove.tooltip", function(a2) {
j();
}), b.dispatch = x, b.multibar = e, b.legend = h, b.controls = i, b.xAxis = f, b.yAxis = g, b.state = u, b.tooltip = j, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, height: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, showLegend: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, showControls: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, controlLabels: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, showXAxis: { get: function() {
return r;
}, set: function(a2) {
r = a2;
} }, showYAxis: { get: function() {
return s;
}, set: function(a2) {
s = a2;
} }, defaultState: { get: function() {
return v;
}, set: function(a2) {
v = a2;
} }, noData: { get: function() {
return w;
}, set: function(a2) {
w = a2;
} }, margin: { get: function() {
return k;
}, set: function(a2) {
k.top = void 0 !== a2.top ? a2.top : k.top, k.right = void 0 !== a2.right ? a2.right : k.right, k.bottom = void 0 !== a2.bottom ? a2.bottom : k.bottom, k.left = void 0 !== a2.left ? a2.left : k.left;
} }, duration: { get: function() {
return z;
}, set: function(a2) {
z = a2, C.reset(z), e.duration(z), f.duration(z), g.duration(z);
} }, color: { get: function() {
return n;
}, set: function(b2) {
n = a.utils.getColor(b2), h.color(n);
} }, barColor: { get: function() {
return e.barColor;
}, set: function(a2) {
e.barColor(a2), h.color(function(a3, b2) {
return d3.rgb("#ccc").darker(1.5 * b2).toString();
});
} } }), a.utils.inheritOptions(b, e), a.utils.initOptions(b), b;
}, a.models.multiChart = function() {
"use strict";
function b(j2) {
return j2.each(function(j3) {
function n2(a2) {
var b2 = 2 === j3[a2.seriesIndex].yAxis ? B : A;
a2.value = a2.point.x, a2.series = { value: a2.point.y, color: a2.point.color, key: a2.series.key }, D.duration(0).valueFormatter(function(a3, c2) {
return b2.tickFormat()(a3, c2);
}).data(a2).hidden(false);
}
function E2(a2) {
var b2 = 2 === j3[a2.seriesIndex].yAxis ? B : A;
a2.value = a2.point.x, a2.series = { value: a2.point.y, color: a2.point.color, key: a2.series.key }, D.duration(100).valueFormatter(function(a3, c2) {
return b2.tickFormat()(a3, c2);
}).data(a2).hidden(false);
}
function F(a2) {
var b2 = 2 === j3[a2.seriesIndex].yAxis ? B : A;
a2.point.x = x.x()(a2.point), a2.point.y = x.y()(a2.point), D.duration(0).valueFormatter(function(a3, c2) {
return b2.tickFormat()(a3, c2);
}).data(a2).hidden(false);
}
function G(a2) {
var b2 = 2 === j3[a2.data.series].yAxis ? B : A;
a2.value = v.x()(a2.data), a2.series = { value: v.y()(a2.data), color: a2.color, key: a2.data.key }, D.duration(0).valueFormatter(function(a3, c2) {
return b2.tickFormat()(a3, c2);
}).data(a2).hidden(false);
}
var H = d3.select(this);
a.utils.initSVG(H), b.update = function() {
H.transition().call(b);
}, b.container = this;
var I = a.utils.availableWidth(g, H, e), J = a.utils.availableHeight(h, H, e), K = j3.filter(function(a2) {
return "line" == a2.type && 1 == a2.yAxis;
}), L = j3.filter(function(a2) {
return "line" == a2.type && 2 == a2.yAxis;
}), M = j3.filter(function(a2) {
return "scatter" == a2.type && 1 == a2.yAxis;
}), N = j3.filter(function(a2) {
return "scatter" == a2.type && 2 == a2.yAxis;
}), O = j3.filter(function(a2) {
return "bar" == a2.type && 1 == a2.yAxis;
}), P = j3.filter(function(a2) {
return "bar" == a2.type && 2 == a2.yAxis;
}), Q = j3.filter(function(a2) {
return "area" == a2.type && 1 == a2.yAxis;
}), R = j3.filter(function(a2) {
return "area" == a2.type && 2 == a2.yAxis;
});
if (!(j3 && j3.length && j3.filter(function(a2) {
return a2.values.length;
}).length))
return a.utils.noData(b, H), b;
H.selectAll(".nv-noData").remove();
var S = j3.filter(function(a2) {
return !a2.disabled && 1 == a2.yAxis;
}).map(function(a2) {
return a2.values.map(function(a3, b2) {
return { x: k(a3), y: l(a3) };
});
}), T = j3.filter(function(a2) {
return !a2.disabled && 2 == a2.yAxis;
}).map(function(a2) {
return a2.values.map(function(a3, b2) {
return { x: k(a3), y: l(a3) };
});
});
o.domain(d3.extent(d3.merge(S.concat(T)), function(a2) {
return k(a2);
})).range([0, I]);
var U = H.selectAll("g.wrap.multiChart").data([j3]), V = U.enter().append("g").attr("class", "wrap nvd3 multiChart").append("g");
V.append("g").attr("class", "nv-x nv-axis"), V.append("g").attr("class", "nv-y1 nv-axis"), V.append("g").attr("class", "nv-y2 nv-axis"), V.append("g").attr("class", "lines1Wrap"), V.append("g").attr("class", "lines2Wrap"), V.append("g").attr("class", "scatters1Wrap"), V.append("g").attr("class", "scatters2Wrap"), V.append("g").attr("class", "bars1Wrap"), V.append("g").attr("class", "bars2Wrap"), V.append("g").attr("class", "stack1Wrap"), V.append("g").attr("class", "stack2Wrap"), V.append("g").attr("class", "legendWrap");
var W = U.select("g"), X = j3.map(function(a2, b2) {
return j3[b2].color || f(a2, b2);
});
if (i) {
var Y = C.align() ? I / 2 : I, Z = C.align() ? Y : 0;
C.width(Y), C.color(X), W.select(".legendWrap").datum(j3.map(function(a2) {
return a2.originalKey = void 0 === a2.originalKey ? a2.key : a2.originalKey, a2.key = a2.originalKey + (1 == a2.yAxis ? "" : " (right axis)"), a2;
})).call(C), e.top != C.height() && (e.top = C.height(), J = a.utils.availableHeight(h, H, e)), W.select(".legendWrap").attr("transform", "translate(" + Z + "," + -e.top + ")");
}
r.width(I).height(J).interpolate(m).color(X.filter(function(a2, b2) {
return !j3[b2].disabled && 1 == j3[b2].yAxis && "line" == j3[b2].type;
})), s.width(I).height(J).interpolate(m).color(X.filter(function(a2, b2) {
return !j3[b2].disabled && 2 == j3[b2].yAxis && "line" == j3[b2].type;
})), t.width(I).height(J).color(X.filter(function(a2, b2) {
return !j3[b2].disabled && 1 == j3[b2].yAxis && "scatter" == j3[b2].type;
})), u.width(I).height(J).color(X.filter(function(a2, b2) {
return !j3[b2].disabled && 2 == j3[b2].yAxis && "scatter" == j3[b2].type;
})), v.width(I).height(J).color(X.filter(function(a2, b2) {
return !j3[b2].disabled && 1 == j3[b2].yAxis && "bar" == j3[b2].type;
})), w.width(I).height(J).color(X.filter(function(a2, b2) {
return !j3[b2].disabled && 2 == j3[b2].yAxis && "bar" == j3[b2].type;
})), x.width(I).height(J).color(X.filter(function(a2, b2) {
return !j3[b2].disabled && 1 == j3[b2].yAxis && "area" == j3[b2].type;
})), y.width(I).height(J).color(X.filter(function(a2, b2) {
return !j3[b2].disabled && 2 == j3[b2].yAxis && "area" == j3[b2].type;
})), W.attr("transform", "translate(" + e.left + "," + e.top + ")");
var $ = W.select(".lines1Wrap").datum(K.filter(function(a2) {
return !a2.disabled;
})), _ = W.select(".scatters1Wrap").datum(M.filter(function(a2) {
return !a2.disabled;
})), aa = W.select(".bars1Wrap").datum(O.filter(function(a2) {
return !a2.disabled;
})), ba = W.select(".stack1Wrap").datum(Q.filter(function(a2) {
return !a2.disabled;
})), ca = W.select(".lines2Wrap").datum(L.filter(function(a2) {
return !a2.disabled;
})), da = W.select(".scatters2Wrap").datum(N.filter(function(a2) {
return !a2.disabled;
})), ea = W.select(".bars2Wrap").datum(P.filter(function(a2) {
return !a2.disabled;
})), fa = W.select(".stack2Wrap").datum(R.filter(function(a2) {
return !a2.disabled;
})), ga = Q.length ? Q.map(function(a2) {
return a2.values;
}).reduce(function(a2, b2) {
return a2.map(function(a3, c2) {
return { x: a3.x, y: a3.y + b2[c2].y };
});
}).concat([{ x: 0, y: 0 }]) : [], ha = R.length ? R.map(function(a2) {
return a2.values;
}).reduce(function(a2, b2) {
return a2.map(function(a3, c2) {
return { x: a3.x, y: a3.y + b2[c2].y };
});
}).concat([{ x: 0, y: 0 }]) : [];
p.domain(c || d3.extent(d3.merge(S).concat(ga), function(a2) {
return a2.y;
})).range([0, J]), q.domain(d || d3.extent(d3.merge(T).concat(ha), function(a2) {
return a2.y;
})).range([0, J]), r.yDomain(p.domain()), t.yDomain(p.domain()), v.yDomain(p.domain()), x.yDomain(p.domain()), s.yDomain(q.domain()), u.yDomain(q.domain()), w.yDomain(q.domain()), y.yDomain(q.domain()), Q.length && d3.transition(ba).call(x), R.length && d3.transition(fa).call(y), O.length && d3.transition(aa).call(v), P.length && d3.transition(ea).call(w), K.length && d3.transition($).call(r), L.length && d3.transition(ca).call(s), M.length && d3.transition(_).call(t), N.length && d3.transition(da).call(u), z._ticks(a.utils.calcTicksX(I / 100, j3)).tickSize(-J, 0), W.select(".nv-x.nv-axis").attr("transform", "translate(0," + J + ")"), d3.transition(W.select(".nv-x.nv-axis")).call(z), A._ticks(a.utils.calcTicksY(J / 36, j3)).tickSize(-I, 0), d3.transition(W.select(".nv-y1.nv-axis")).call(A), B._ticks(a.utils.calcTicksY(J / 36, j3)).tickSize(-I, 0), d3.transition(W.select(".nv-y2.nv-axis")).call(B), W.select(".nv-y1.nv-axis").classed("nv-disabled", S.length ? false : true).attr("transform", "translate(" + o.range()[0] + ",0)"), W.select(".nv-y2.nv-axis").classed("nv-disabled", T.length ? false : true).attr("transform", "translate(" + o.range()[1] + ",0)"), C.dispatch.on("stateChange", function(a2) {
b.update();
}), r.dispatch.on("elementMouseover.tooltip", n2), s.dispatch.on("elementMouseover.tooltip", n2), r.dispatch.on("elementMouseout.tooltip", function(a2) {
D.hidden(true);
}), s.dispatch.on("elementMouseout.tooltip", function(a2) {
D.hidden(true);
}), t.dispatch.on("elementMouseover.tooltip", E2), u.dispatch.on("elementMouseover.tooltip", E2), t.dispatch.on("elementMouseout.tooltip", function(a2) {
D.hidden(true);
}), u.dispatch.on("elementMouseout.tooltip", function(a2) {
D.hidden(true);
}), x.dispatch.on("elementMouseover.tooltip", F), y.dispatch.on("elementMouseover.tooltip", F), x.dispatch.on("elementMouseout.tooltip", function(a2) {
D.hidden(true);
}), y.dispatch.on("elementMouseout.tooltip", function(a2) {
D.hidden(true);
}), v.dispatch.on("elementMouseover.tooltip", G), w.dispatch.on("elementMouseover.tooltip", G), v.dispatch.on("elementMouseout.tooltip", function(a2) {
D.hidden(true);
}), w.dispatch.on("elementMouseout.tooltip", function(a2) {
D.hidden(true);
}), v.dispatch.on("elementMousemove.tooltip", function(a2) {
D();
}), w.dispatch.on("elementMousemove.tooltip", function(a2) {
D();
});
}), b;
}
var c, d, e = { top: 30, right: 20, bottom: 50, left: 60 }, f = a.utils.defaultColor(), g = null, h = null, i = true, j = null, k = function(a2) {
return a2.x;
}, l = function(a2) {
return a2.y;
}, m = "monotone", n = true, o = d3.scale.linear(), p = d3.scale.linear(), q = d3.scale.linear(), r = a.models.line().yScale(p), s = a.models.line().yScale(q), t = a.models.scatter().yScale(p), u = a.models.scatter().yScale(q), v = a.models.multiBar().stacked(false).yScale(p), w = a.models.multiBar().stacked(false).yScale(q), x = a.models.stackedArea().yScale(p), y = a.models.stackedArea().yScale(q), z = a.models.axis().scale(o).orient("bottom").tickPadding(5), A = a.models.axis().scale(p).orient("left"), B = a.models.axis().scale(q).orient("right"), C = a.models.legend().height(30), D = a.models.tooltip(), E = d3.dispatch();
return b.dispatch = E, b.legend = C, b.lines1 = r, b.lines2 = s, b.scatters1 = t, b.scatters2 = u, b.bars1 = v, b.bars2 = w, b.stack1 = x, b.stack2 = y, b.xAxis = z, b.yAxis1 = A, b.yAxis2 = B, b.tooltip = D, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return g;
}, set: function(a2) {
g = a2;
} }, height: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, showLegend: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, yDomain1: { get: function() {
return c;
}, set: function(a2) {
c = a2;
} }, yDomain2: { get: function() {
return d;
}, set: function(a2) {
d = a2;
} }, noData: { get: function() {
return j;
}, set: function(a2) {
j = a2;
} }, interpolate: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, margin: { get: function() {
return e;
}, set: function(a2) {
e.top = void 0 !== a2.top ? a2.top : e.top, e.right = void 0 !== a2.right ? a2.right : e.right, e.bottom = void 0 !== a2.bottom ? a2.bottom : e.bottom, e.left = void 0 !== a2.left ? a2.left : e.left;
} }, color: { get: function() {
return f;
}, set: function(b2) {
f = a.utils.getColor(b2);
} }, x: { get: function() {
return k;
}, set: function(a2) {
k = a2, r.x(a2), s.x(a2), t.x(a2), u.x(a2), v.x(a2), w.x(a2), x.x(a2), y.x(a2);
} }, y: { get: function() {
return l;
}, set: function(a2) {
l = a2, r.y(a2), s.y(a2), t.y(a2), u.y(a2), x.y(a2), y.y(a2), v.y(a2), w.y(a2);
} }, useVoronoi: { get: function() {
return n;
}, set: function(a2) {
n = a2, r.useVoronoi(a2), s.useVoronoi(a2), x.useVoronoi(a2), y.useVoronoi(a2);
} } }), a.utils.initOptions(b), b;
}, a.models.ohlcBar = function() {
"use strict";
function b(y2) {
return y2.each(function(b2) {
k = d3.select(this);
var y3 = a.utils.availableWidth(h, k, g), A = a.utils.availableHeight(i, k, g);
a.utils.initSVG(k);
var B = y3 / b2[0].values.length * 0.9;
l.domain(c || d3.extent(b2[0].values.map(n).concat(t))), v ? l.range(e || [0.5 * y3 / b2[0].values.length, y3 * (b2[0].values.length - 0.5) / b2[0].values.length]) : l.range(e || [5 + B / 2, y3 - B / 2 - 5]), m.domain(d || [d3.min(b2[0].values.map(s).concat(u)), d3.max(b2[0].values.map(r).concat(u))]).range(f || [A, 0]), l.domain()[0] === l.domain()[1] && (l.domain()[0] ? l.domain([l.domain()[0] - 0.01 * l.domain()[0], l.domain()[1] + 0.01 * l.domain()[1]]) : l.domain([-1, 1])), m.domain()[0] === m.domain()[1] && (m.domain()[0] ? m.domain([m.domain()[0] + 0.01 * m.domain()[0], m.domain()[1] - 0.01 * m.domain()[1]]) : m.domain([-1, 1]));
var C = d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([b2[0].values]), D = C.enter().append("g").attr("class", "nvd3 nv-wrap nv-ohlcBar"), E = D.append("defs"), F = D.append("g"), G = C.select("g");
F.append("g").attr("class", "nv-ticks"), C.attr("transform", "translate(" + g.left + "," + g.top + ")"), k.on("click", function(a2, b3) {
z.chartClick({ data: a2, index: b3, pos: d3.event, id: j });
}), E.append("clipPath").attr("id", "nv-chart-clip-path-" + j).append("rect"), C.select("#nv-chart-clip-path-" + j + " rect").attr("width", y3).attr("height", A), G.attr("clip-path", w ? "url(#nv-chart-clip-path-" + j + ")" : "");
var H = C.select(".nv-ticks").selectAll(".nv-tick").data(function(a2) {
return a2;
});
H.exit().remove(), H.enter().append("path").attr("class", function(a2, b3, c2) {
return (p(a2, b3) > q(a2, b3) ? "nv-tick negative" : "nv-tick positive") + " nv-tick-" + c2 + "-" + b3;
}).attr("d", function(a2, b3) {
return "m0,0l0," + (m(p(a2, b3)) - m(r(a2, b3))) + "l" + -B / 2 + ",0l" + B / 2 + ",0l0," + (m(s(a2, b3)) - m(p(a2, b3))) + "l0," + (m(q(a2, b3)) - m(s(a2, b3))) + "l" + B / 2 + ",0l" + -B / 2 + ",0z";
}).attr("transform", function(a2, b3) {
return "translate(" + l(n(a2, b3)) + "," + m(r(a2, b3)) + ")";
}).attr("fill", function(a2, b3) {
return x[0];
}).attr("stroke", function(a2, b3) {
return x[0];
}).attr("x", 0).attr("y", function(a2, b3) {
return m(Math.max(0, o(a2, b3)));
}).attr("height", function(a2, b3) {
return Math.abs(m(o(a2, b3)) - m(0));
}), H.attr("class", function(a2, b3, c2) {
return (p(a2, b3) > q(a2, b3) ? "nv-tick negative" : "nv-tick positive") + " nv-tick-" + c2 + "-" + b3;
}), d3.transition(H).attr("transform", function(a2, b3) {
return "translate(" + l(n(a2, b3)) + "," + m(r(a2, b3)) + ")";
}).attr("d", function(a2, c2) {
var d2 = y3 / b2[0].values.length * 0.9;
return "m0,0l0," + (m(p(a2, c2)) - m(r(a2, c2))) + "l" + -d2 / 2 + ",0l" + d2 / 2 + ",0l0," + (m(s(a2, c2)) - m(p(a2, c2))) + "l0," + (m(q(a2, c2)) - m(s(a2, c2))) + "l" + d2 / 2 + ",0l" + -d2 / 2 + ",0z";
});
}), b;
}
var c, d, e, f, g = { top: 0, right: 0, bottom: 0, left: 0 }, h = null, i = null, j = Math.floor(1e4 * Math.random()), k = null, l = d3.scale.linear(), m = d3.scale.linear(), n = function(a2) {
return a2.x;
}, o = function(a2) {
return a2.y;
}, p = function(a2) {
return a2.open;
}, q = function(a2) {
return a2.close;
}, r = function(a2) {
return a2.high;
}, s = function(a2) {
return a2.low;
}, t = [], u = [], v = false, w = true, x = a.utils.defaultColor(), y = false, z = d3.dispatch("stateChange", "changeState", "renderEnd", "chartClick", "elementClick", "elementDblClick", "elementMouseover", "elementMouseout", "elementMousemove");
return b.highlightPoint = function(a2, c2) {
b.clearHighlights(), k.select(".nv-ohlcBar .nv-tick-0-" + a2).classed("hover", c2);
}, b.clearHighlights = function() {
k.select(".nv-ohlcBar .nv-tick.hover").classed("hover", false);
}, b.dispatch = z, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, height: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, xScale: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, yScale: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, xDomain: { get: function() {
return c;
}, set: function(a2) {
c = a2;
} }, yDomain: { get: function() {
return d;
}, set: function(a2) {
d = a2;
} }, xRange: { get: function() {
return e;
}, set: function(a2) {
e = a2;
} }, yRange: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, forceX: { get: function() {
return t;
}, set: function(a2) {
t = a2;
} }, forceY: { get: function() {
return u;
}, set: function(a2) {
u = a2;
} }, padData: { get: function() {
return v;
}, set: function(a2) {
v = a2;
} }, clipEdge: { get: function() {
return w;
}, set: function(a2) {
w = a2;
} }, id: { get: function() {
return j;
}, set: function(a2) {
j = a2;
} }, interactive: { get: function() {
return y;
}, set: function(a2) {
y = a2;
} }, x: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, y: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, open: { get: function() {
return p();
}, set: function(a2) {
p = a2;
} }, close: { get: function() {
return q();
}, set: function(a2) {
q = a2;
} }, high: { get: function() {
return r;
}, set: function(a2) {
r = a2;
} }, low: { get: function() {
return s;
}, set: function(a2) {
s = a2;
} }, margin: { get: function() {
return g;
}, set: function(a2) {
g.top = void 0 != a2.top ? a2.top : g.top, g.right = void 0 != a2.right ? a2.right : g.right, g.bottom = void 0 != a2.bottom ? a2.bottom : g.bottom, g.left = void 0 != a2.left ? a2.left : g.left;
} }, color: { get: function() {
return x;
}, set: function(b2) {
x = a.utils.getColor(b2);
} } }), a.utils.initOptions(b), b;
}, a.models.parallelCoordinates = function() {
"use strict";
function b(p) {
return p.each(function(b2) {
function p2(a2) {
return F(h.map(function(b3) {
if (isNaN(a2[b3]) || isNaN(parseFloat(a2[b3]))) {
var c2 = g[b3].domain(), d2 = g[b3].range(), e2 = c2[0] - (c2[1] - c2[0]) / 9;
if (J.indexOf(b3) < 0) {
var h2 = d3.scale.linear().domain([e2, c2[1]]).range([x - 12, d2[1]]);
g[b3].brush.y(h2), J.push(b3);
}
return [f(b3), g[b3](e2)];
}
return J.length > 0 ? (D.style("display", "inline"), E.style("display", "inline")) : (D.style("display", "none"), E.style("display", "none")), [f(b3), g[b3](a2[b3])];
}));
}
function q() {
var a2 = h.filter(function(a3) {
return !g[a3].brush.empty();
}), b3 = a2.map(function(a3) {
return g[a3].brush.extent();
});
k = [], a2.forEach(function(a3, c2) {
k[c2] = { dimension: a3, extent: b3[c2] };
}), l = [], M.style("display", function(c2) {
var d2 = a2.every(function(a3, d4) {
return isNaN(c2[a3]) && b3[d4][0] == g[a3].brush.y().domain()[0] ? true : b3[d4][0] <= c2[a3] && c2[a3] <= b3[d4][1];
});
return d2 && l.push(c2), d2 ? null : "none";
}), o.brush({ filters: k, active: l });
}
function r(a2, b3) {
m[a2] = this.parentNode.__origin__ = f(a2), L.attr("visibility", "hidden");
}
function s(a2, b3) {
m[a2] = Math.min(w, Math.max(0, this.parentNode.__origin__ += d3.event.x)), M.attr("d", p2), h.sort(function(a3, b4) {
return u(a3) - u(b4);
}), f.domain(h), N.attr("transform", function(a3) {
return "translate(" + u(a3) + ")";
});
}
function t(a2, b3) {
delete this.parentNode.__origin__, delete m[a2], d3.select(this.parentNode).attr("transform", "translate(" + f(a2) + ")"), M.attr("d", p2), L.attr("d", p2).attr("visibility", null);
}
function u(a2) {
var b3 = m[a2];
return null == b3 ? f(a2) : b3;
}
var v = d3.select(this), w = a.utils.availableWidth(d, v, c), x = a.utils.availableHeight(e, v, c);
a.utils.initSVG(v), l = b2, f.rangePoints([0, w], 1).domain(h);
var y = {};
h.forEach(function(a2) {
var c2 = d3.extent(b2, function(b3) {
return +b3[a2];
});
return y[a2] = false, void 0 === c2[0] && (y[a2] = true, c2[0] = 0, c2[1] = 0), c2[0] === c2[1] && (c2[0] = c2[0] - 1, c2[1] = c2[1] + 1), g[a2] = d3.scale.linear().domain(c2).range([0.9 * (x - 12), 0]), g[a2].brush = d3.svg.brush().y(g[a2]).on("brush", q), "name" != a2;
});
var z = v.selectAll("g.nv-wrap.nv-parallelCoordinates").data([b2]), A = z.enter().append("g").attr("class", "nvd3 nv-wrap nv-parallelCoordinates"), B = A.append("g"), C = z.select("g");
B.append("g").attr("class", "nv-parallelCoordinates background"), B.append("g").attr("class", "nv-parallelCoordinates foreground"), B.append("g").attr("class", "nv-parallelCoordinates missingValuesline"), z.attr("transform", "translate(" + c.left + "," + c.top + ")");
var D, E, F = d3.svg.line().interpolate("cardinal").tension(n), G = d3.svg.axis().orient("left"), H = d3.behavior.drag().on("dragstart", r).on("drag", s).on("dragend", t), I = f.range()[1] - f.range()[0], J = [], K = [0 + I / 2, x - 12, w - I / 2, x - 12];
D = z.select(".missingValuesline").selectAll("line").data([K]), D.enter().append("line"), D.exit().remove(), D.attr("x1", function(a2) {
return a2[0];
}).attr("y1", function(a2) {
return a2[1];
}).attr("x2", function(a2) {
return a2[2];
}).attr("y2", function(a2) {
return a2[3];
}), E = z.select(".missingValuesline").selectAll("text").data(["undefined values"]), E.append("text").data(["undefined values"]), E.enter().append("text"), E.exit().remove(), E.attr("y", x).attr("x", w - 92 - I / 2).text(function(a2) {
return a2;
});
var L = z.select(".background").selectAll("path").data(b2);
L.enter().append("path"), L.exit().remove(), L.attr("d", p2);
var M = z.select(".foreground").selectAll("path").data(b2);
M.enter().append("path"), M.exit().remove(), M.attr("d", p2).attr("stroke", j), M.on("mouseover", function(a2, b3) {
d3.select(this).classed("hover", true), o.elementMouseover({ label: a2.name, data: a2.data, index: b3, pos: [d3.mouse(this.parentNode)[0], d3.mouse(this.parentNode)[1]] });
}), M.on("mouseout", function(a2, b3) {
d3.select(this).classed("hover", false), o.elementMouseout({ label: a2.name, data: a2.data, index: b3 });
});
var N = C.selectAll(".dimension").data(h), O = N.enter().append("g").attr("class", "nv-parallelCoordinates dimension");
O.append("g").attr("class", "nv-parallelCoordinates nv-axis"), O.append("g").attr("class", "nv-parallelCoordinates-brush"), O.append("text").attr("class", "nv-parallelCoordinates nv-label"), N.attr("transform", function(a2) {
return "translate(" + f(a2) + ",0)";
}), N.exit().remove(), N.select(".nv-label").style("cursor", "move").attr("dy", "-1em").attr("text-anchor", "middle").text(String).on("mouseover", function(a2, b3) {
o.elementMouseover({ dim: a2, pos: [d3.mouse(this.parentNode.parentNode)[0], d3.mouse(this.parentNode.parentNode)[1]] });
}).on("mouseout", function(a2, b3) {
o.elementMouseout({ dim: a2 });
}).call(H), N.select(".nv-axis").each(function(a2, b3) {
d3.select(this).call(G.scale(g[a2]).tickFormat(d3.format(i[b3])));
}), N.select(".nv-parallelCoordinates-brush").each(function(a2) {
d3.select(this).call(g[a2].brush);
}).selectAll("rect").attr("x", -8).attr("width", 16);
}), b;
}
var c = { top: 30, right: 0, bottom: 10, left: 0 }, d = null, e = null, f = d3.scale.ordinal(), g = {}, h = [], i = [], j = a.utils.defaultColor(), k = [], l = [], m = [], n = 1, o = d3.dispatch("brush", "elementMouseover", "elementMouseout");
return b.dispatch = o, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return d;
}, set: function(a2) {
d = a2;
} }, height: { get: function() {
return e;
}, set: function(a2) {
e = a2;
} }, dimensionNames: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, dimensionFormats: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, lineTension: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, dimensions: { get: function() {
return h;
}, set: function(b2) {
a.deprecated("dimensions", "use dimensionNames instead"), h = b2;
} }, margin: { get: function() {
return c;
}, set: function(a2) {
c.top = void 0 !== a2.top ? a2.top : c.top, c.right = void 0 !== a2.right ? a2.right : c.right, c.bottom = void 0 !== a2.bottom ? a2.bottom : c.bottom, c.left = void 0 !== a2.left ? a2.left : c.left;
} }, color: { get: function() {
return j;
}, set: function(b2) {
j = a.utils.getColor(b2);
} } }), a.utils.initOptions(b), b;
}, a.models.pie = function() {
"use strict";
function b(E) {
return D.reset(), E.each(function(b2) {
function E2(a2, b3) {
a2.endAngle = isNaN(a2.endAngle) ? 0 : a2.endAngle, a2.startAngle = isNaN(a2.startAngle) ? 0 : a2.startAngle, p || (a2.innerRadius = 0);
var c2 = d3.interpolate(this._current, a2);
return this._current = c2(0), function(a3) {
return B[b3](c2(a3));
};
}
var F = d - c.left - c.right, G = e - c.top - c.bottom, H = Math.min(F, G) / 2, I = [], J = [];
if (i = d3.select(this), 0 === z.length)
for (var K = H - H / 5, L = y * H, M = 0; M < b2[0].length; M++)
I.push(K), J.push(L);
else
I = z.map(function(a2) {
return (a2.outer - a2.outer / 5) * H;
}), J = z.map(function(a2) {
return (a2.inner - a2.inner / 5) * H;
}), y = d3.min(z.map(function(a2) {
return a2.inner - a2.inner / 5;
}));
a.utils.initSVG(i);
var N = i.selectAll(".nv-wrap.nv-pie").data(b2), O = N.enter().append("g").attr("class", "nvd3 nv-wrap nv-pie nv-chart-" + h), P = O.append("g"), Q = N.select("g"), R = P.append("g").attr("class", "nv-pie");
P.append("g").attr("class", "nv-pieLabels"), N.attr("transform", "translate(" + c.left + "," + c.top + ")"), Q.select(".nv-pie").attr("transform", "translate(" + F / 2 + "," + G / 2 + ")"), Q.select(".nv-pieLabels").attr("transform", "translate(" + F / 2 + "," + G / 2 + ")"), i.on("click", function(a2, b3) {
A.chartClick({ data: a2, index: b3, pos: d3.event, id: h });
}), B = [], C = [];
for (var M = 0; M < b2[0].length; M++) {
var S = d3.svg.arc().outerRadius(I[M]), T = d3.svg.arc().outerRadius(I[M] + 5);
u !== false && (S.startAngle(u), T.startAngle(u)), w !== false && (S.endAngle(w), T.endAngle(w)), p && (S.innerRadius(J[M]), T.innerRadius(J[M])), S.cornerRadius && x && (S.cornerRadius(x), T.cornerRadius(x)), B.push(S), C.push(T);
}
var U = d3.layout.pie().sort(null).value(function(a2) {
return a2.disabled ? 0 : g(a2);
});
U.padAngle && v && U.padAngle(v), p && q && (R.append("text").attr("class", "nv-pie-title"), N.select(".nv-pie-title").style("text-anchor", "middle").text(function(a2) {
return q;
}).style("font-size", Math.min(F, G) * y * 2 / (q.length + 2) + "px").attr("dy", "0.35em").attr("transform", function(a2, b3) {
return "translate(0, " + s + ")";
}));
var V = N.select(".nv-pie").selectAll(".nv-slice").data(U), W = N.select(".nv-pieLabels").selectAll(".nv-label").data(U);
V.exit().remove(), W.exit().remove();
var X = V.enter().append("g");
X.attr("class", "nv-slice"), X.on("mouseover", function(a2, b3) {
d3.select(this).classed("hover", true), r && d3.select(this).select("path").transition().duration(70).attr("d", C[b3]), A.elementMouseover({ data: a2.data, index: b3, color: d3.select(this).style("fill") });
}), X.on("mouseout", function(a2, b3) {
d3.select(this).classed("hover", false), r && d3.select(this).select("path").transition().duration(50).attr("d", B[b3]), A.elementMouseout({ data: a2.data, index: b3 });
}), X.on("mousemove", function(a2, b3) {
A.elementMousemove({ data: a2.data, index: b3 });
}), X.on("click", function(a2, b3) {
A.elementClick({ data: a2.data, index: b3, color: d3.select(this).style("fill") });
}), X.on("dblclick", function(a2, b3) {
A.elementDblClick({ data: a2.data, index: b3, color: d3.select(this).style("fill") });
}), V.attr("fill", function(a2, b3) {
return j(a2.data, b3);
}), V.attr("stroke", function(a2, b3) {
return j(a2.data, b3);
});
X.append("path").each(function(a2) {
this._current = a2;
});
if (V.select("path").transition().attr("d", function(a2, b3) {
return B[b3](a2);
}).attrTween("d", E2), l) {
for (var Y = [], M = 0; M < b2[0].length; M++)
Y.push(B[M]), m ? p && (Y[M] = d3.svg.arc().outerRadius(B[M].outerRadius()), u !== false && Y[M].startAngle(u), w !== false && Y[M].endAngle(w)) : p || Y[M].innerRadius(0);
W.enter().append("g").classed("nv-label", true).each(function(a2, b3) {
var c2 = d3.select(this);
c2.attr("transform", function(a3, b4) {
if (t) {
a3.outerRadius = I[b4] + 10, a3.innerRadius = I[b4] + 15;
var c3 = (a3.startAngle + a3.endAngle) / 2 * (180 / Math.PI);
return (a3.startAngle + a3.endAngle) / 2 < Math.PI ? c3 -= 90 : c3 += 90, "translate(" + Y[b4].centroid(a3) + ") rotate(" + c3 + ")";
}
return a3.outerRadius = H + 10, a3.innerRadius = H + 15, "translate(" + Y[b4].centroid(a3) + ")";
}), c2.append("rect").style("stroke", "#fff").style("fill", "#fff").attr("rx", 3).attr("ry", 3), c2.append("text").style("text-anchor", t ? (a2.startAngle + a2.endAngle) / 2 < Math.PI ? "start" : "end" : "middle").style("fill", "#000");
});
var Z = {}, $ = 14, _ = 140, aa = function(a2) {
return Math.floor(a2[0] / _) * _ + "," + Math.floor(a2[1] / $) * $;
};
W.watchTransition(D, "pie labels").attr("transform", function(a2, b3) {
if (t) {
a2.outerRadius = I[b3] + 10, a2.innerRadius = I[b3] + 15;
var c2 = (a2.startAngle + a2.endAngle) / 2 * (180 / Math.PI);
return (a2.startAngle + a2.endAngle) / 2 < Math.PI ? c2 -= 90 : c2 += 90, "translate(" + Y[b3].centroid(a2) + ") rotate(" + c2 + ")";
}
a2.outerRadius = H + 10, a2.innerRadius = H + 15;
var d2 = Y[b3].centroid(a2);
if (a2.value) {
var e2 = aa(d2);
Z[e2] && (d2[1] -= $), Z[aa(d2)] = true;
}
return "translate(" + d2 + ")";
}), W.select(".nv-label text").style("text-anchor", function(a2, b3) {
return t ? (a2.startAngle + a2.endAngle) / 2 < Math.PI ? "start" : "end" : "middle";
}).text(function(a2, b3) {
var c2 = (a2.endAngle - a2.startAngle) / (2 * Math.PI), d2 = "";
if (!a2.value || o > c2)
return "";
if ("function" == typeof n)
d2 = n(a2, b3, { key: f(a2.data), value: g(a2.data), percent: k(c2) });
else
switch (n) {
case "key":
d2 = f(a2.data);
break;
case "value":
d2 = k(g(a2.data));
break;
case "percent":
d2 = d3.format("%")(c2);
}
return d2;
});
}
}), D.renderEnd("pie immediate"), b;
}
var c = { top: 0, right: 0, bottom: 0, left: 0 }, d = 500, e = 500, f = function(a2) {
return a2.x;
}, g = function(a2) {
return a2.y;
}, h = Math.floor(1e4 * Math.random()), i = null, j = a.utils.defaultColor(), k = d3.format(",.2f"), l = true, m = false, n = "key", o = 0.02, p = false, q = false, r = true, s = 0, t = false, u = false, v = false, w = false, x = 0, y = 0.5, z = [], A = d3.dispatch("chartClick", "elementClick", "elementDblClick", "elementMouseover", "elementMouseout", "elementMousemove", "renderEnd"), B = [], C = [], D = a.utils.renderWatch(A);
return b.dispatch = A, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { arcsRadius: { get: function() {
return z;
}, set: function(a2) {
z = a2;
} }, width: { get: function() {
return d;
}, set: function(a2) {
d = a2;
} }, height: { get: function() {
return e;
}, set: function(a2) {
e = a2;
} }, showLabels: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, title: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, titleOffset: { get: function() {
return s;
}, set: function(a2) {
s = a2;
} }, labelThreshold: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, valueFormat: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, x: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, id: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, endAngle: { get: function() {
return w;
}, set: function(a2) {
w = a2;
} }, startAngle: { get: function() {
return u;
}, set: function(a2) {
u = a2;
} }, padAngle: { get: function() {
return v;
}, set: function(a2) {
v = a2;
} }, cornerRadius: { get: function() {
return x;
}, set: function(a2) {
x = a2;
} }, donutRatio: { get: function() {
return y;
}, set: function(a2) {
y = a2;
} }, labelsOutside: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, labelSunbeamLayout: { get: function() {
return t;
}, set: function(a2) {
t = a2;
} }, donut: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, growOnHover: { get: function() {
return r;
}, set: function(a2) {
r = a2;
} }, pieLabelsOutside: { get: function() {
return m;
}, set: function(b2) {
m = b2, a.deprecated("pieLabelsOutside", "use labelsOutside instead");
} }, donutLabelsOutside: { get: function() {
return m;
}, set: function(b2) {
m = b2, a.deprecated("donutLabelsOutside", "use labelsOutside instead");
} }, labelFormat: { get: function() {
return k;
}, set: function(b2) {
k = b2, a.deprecated("labelFormat", "use valueFormat instead");
} }, margin: { get: function() {
return c;
}, set: function(a2) {
c.top = "undefined" != typeof a2.top ? a2.top : c.top, c.right = "undefined" != typeof a2.right ? a2.right : c.right, c.bottom = "undefined" != typeof a2.bottom ? a2.bottom : c.bottom, c.left = "undefined" != typeof a2.left ? a2.left : c.left;
} }, y: { get: function() {
return g;
}, set: function(a2) {
g = d3.functor(a2);
} }, color: { get: function() {
return j;
}, set: function(b2) {
j = a.utils.getColor(b2);
} }, labelType: { get: function() {
return n;
}, set: function(a2) {
n = a2 || "key";
} } }), a.utils.initOptions(b), b;
}, a.models.pieChart = function() {
"use strict";
function b(e2) {
return q.reset(), q.models(c), e2.each(function(e3) {
var k2 = d3.select(this);
a.utils.initSVG(k2);
var n2 = a.utils.availableWidth(g, k2, f), o2 = a.utils.availableHeight(h, k2, f);
if (b.update = function() {
k2.transition().call(b);
}, b.container = this, l.setter(s(e3), b.update).getter(r(e3)).update(), l.disabled = e3.map(function(a2) {
return !!a2.disabled;
}), !m) {
var q2;
m = {};
for (q2 in l)
l[q2] instanceof Array ? m[q2] = l[q2].slice(0) : m[q2] = l[q2];
}
if (!e3 || !e3.length)
return a.utils.noData(b, k2), b;
k2.selectAll(".nv-noData").remove();
var t = k2.selectAll("g.nv-wrap.nv-pieChart").data([e3]), u = t.enter().append("g").attr("class", "nvd3 nv-wrap nv-pieChart").append("g"), v = t.select("g");
if (u.append("g").attr("class", "nv-pieWrap"), u.append("g").attr("class", "nv-legendWrap"), i) {
if ("top" === j)
d.width(n2).key(c.x()), t.select(".nv-legendWrap").datum(e3).call(d), f.top != d.height() && (f.top = d.height(), o2 = a.utils.availableHeight(h, k2, f)), t.select(".nv-legendWrap").attr("transform", "translate(0," + -f.top + ")");
else if ("right" === j) {
var w = a.models.legend().width();
w > n2 / 2 && (w = n2 / 2), d.height(o2).key(c.x()), d.width(w), n2 -= d.width(), t.select(".nv-legendWrap").datum(e3).call(d).attr("transform", "translate(" + n2 + ",0)");
}
}
t.attr("transform", "translate(" + f.left + "," + f.top + ")"), c.width(n2).height(o2);
var x = v.select(".nv-pieWrap").datum([e3]);
d3.transition(x).call(c), d.dispatch.on("stateChange", function(a2) {
for (var c2 in a2)
l[c2] = a2[c2];
p.stateChange(l), b.update();
}), p.on("changeState", function(a2) {
"undefined" != typeof a2.disabled && (e3.forEach(function(b2, c2) {
b2.disabled = a2.disabled[c2];
}), l.disabled = a2.disabled), b.update();
});
}), q.renderEnd("pieChart immediate"), b;
}
var c = a.models.pie(), d = a.models.legend(), e = a.models.tooltip(), f = { top: 30, right: 20, bottom: 20, left: 20 }, g = null, h = null, i = true, j = "top", k = a.utils.defaultColor(), l = a.utils.state(), m = null, n = null, o = 250, p = d3.dispatch("stateChange", "changeState", "renderEnd");
e.duration(0).headerEnabled(false).valueFormatter(function(a2, b2) {
return c.valueFormat()(a2, b2);
});
var q = a.utils.renderWatch(p), r = function(a2) {
return function() {
return { active: a2.map(function(a3) {
return !a3.disabled;
}) };
};
}, s = function(a2) {
return function(b2) {
void 0 !== b2.active && a2.forEach(function(a3, c2) {
a3.disabled = !b2.active[c2];
});
};
};
return c.dispatch.on("elementMouseover.tooltip", function(a2) {
a2.series = { key: b.x()(a2.data), value: b.y()(a2.data), color: a2.color }, e.data(a2).hidden(false);
}), c.dispatch.on("elementMouseout.tooltip", function(a2) {
e.hidden(true);
}), c.dispatch.on("elementMousemove.tooltip", function(a2) {
e();
}), b.legend = d, b.dispatch = p, b.pie = c, b.tooltip = e, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { noData: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, showLegend: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, legendPosition: { get: function() {
return j;
}, set: function(a2) {
j = a2;
} }, defaultState: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, color: { get: function() {
return k;
}, set: function(a2) {
k = a2, d.color(k), c.color(k);
} }, duration: { get: function() {
return o;
}, set: function(a2) {
o = a2, q.reset(o);
} }, margin: { get: function() {
return f;
}, set: function(a2) {
f.top = void 0 !== a2.top ? a2.top : f.top, f.right = void 0 !== a2.right ? a2.right : f.right, f.bottom = void 0 !== a2.bottom ? a2.bottom : f.bottom, f.left = void 0 !== a2.left ? a2.left : f.left;
} } }), a.utils.inheritOptions(b, c), a.utils.initOptions(b), b;
}, a.models.scatter = function() {
"use strict";
function b(N2) {
return P.reset(), N2.each(function(b2) {
function N3() {
if (O = false, !w)
return false;
if (M === true) {
var a2 = d3.merge(b2.map(function(a3, b3) {
return a3.values.map(function(a4, c3) {
var d4 = p(a4, c3), e3 = q(a4, c3);
return [m(d4) + 1e-4 * Math.random(), n(e3) + 1e-4 * Math.random(), b3, c3, a4];
}).filter(function(a4, b4) {
return x(a4[4], b4);
});
}));
if (0 == a2.length)
return false;
a2.length < 3 && (a2.push([m.range()[0] - 20, n.range()[0] - 20, null, null]), a2.push([m.range()[1] + 20, n.range()[1] + 20, null, null]), a2.push([m.range()[0] - 20, n.range()[0] + 20, null, null]), a2.push([m.range()[1] + 20, n.range()[1] - 20, null, null]));
var c2 = d3.geom.polygon([[-10, -10], [-10, i + 10], [h + 10, i + 10], [h + 10, -10]]), d2 = d3.geom.voronoi(a2).map(function(b3, d4) {
return { data: c2.clip(b3), series: a2[d4][2], point: a2[d4][3] };
});
U.select(".nv-point-paths").selectAll("path").remove();
var e2 = U.select(".nv-point-paths").selectAll("path").data(d2), f2 = e2.enter().append("svg:path").attr("d", function(a3) {
return a3 && a3.data && 0 !== a3.data.length ? "M" + a3.data.join(",") + "Z" : "M 0 0";
}).attr("id", function(a3, b3) {
return "nv-path-" + b3;
}).attr("clip-path", function(a3, b3) {
return "url(#nv-clip-" + k + "-" + b3 + ")";
});
if (C && f2.style("fill", d3.rgb(230, 230, 230)).style("fill-opacity", 0.4).style("stroke-opacity", 1).style("stroke", d3.rgb(200, 200, 200)), B) {
U.select(".nv-point-clips").selectAll("*").remove();
var o2 = U.select(".nv-point-clips").selectAll("clipPath").data(a2);
o2.enter().append("svg:clipPath").attr("id", function(a3, b3) {
return "nv-clip-" + k + "-" + b3;
}).append("svg:circle").attr("cx", function(a3) {
return a3[0];
}).attr("cy", function(a3) {
return a3[1];
}).attr("r", D);
}
var r2 = function(a3, c3) {
if (O)
return 0;
var d4 = b2[a3.series];
if (void 0 !== d4) {
var e3 = d4.values[a3.point];
e3.color = j(d4, a3.series), e3.x = p(e3), e3.y = q(e3);
var f3 = l.node().getBoundingClientRect(), h2 = window.pageYOffset || document.documentElement.scrollTop, i2 = window.pageXOffset || document.documentElement.scrollLeft, k2 = { left: m(p(e3, a3.point)) + f3.left + i2 + g.left + 10, top: n(q(e3, a3.point)) + f3.top + h2 + g.top + 10 };
c3({ point: e3, series: d4, pos: k2, relativePos: [m(p(e3, a3.point)) + g.left, n(q(e3, a3.point)) + g.top], seriesIndex: a3.series, pointIndex: a3.point });
}
};
e2.on("click", function(a3) {
r2(a3, L.elementClick);
}).on("dblclick", function(a3) {
r2(a3, L.elementDblClick);
}).on("mouseover", function(a3) {
r2(a3, L.elementMouseover);
}).on("mouseout", function(a3, b3) {
r2(a3, L.elementMouseout);
});
} else
U.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click", function(a3, c3) {
if (O || !b2[a3.series])
return 0;
var d4 = b2[a3.series], e3 = d4.values[c3];
L.elementClick({ point: e3, series: d4, pos: [m(p(e3, c3)) + g.left, n(q(e3, c3)) + g.top], relativePos: [m(p(e3, c3)) + g.left, n(q(e3, c3)) + g.top], seriesIndex: a3.series, pointIndex: c3 });
}).on("dblclick", function(a3, c3) {
if (O || !b2[a3.series])
return 0;
var d4 = b2[a3.series], e3 = d4.values[c3];
L.elementDblClick({ point: e3, series: d4, pos: [m(p(e3, c3)) + g.left, n(q(e3, c3)) + g.top], relativePos: [m(p(e3, c3)) + g.left, n(q(e3, c3)) + g.top], seriesIndex: a3.series, pointIndex: c3 });
}).on("mouseover", function(a3, c3) {
if (O || !b2[a3.series])
return 0;
var d4 = b2[a3.series], e3 = d4.values[c3];
L.elementMouseover({ point: e3, series: d4, pos: [m(p(e3, c3)) + g.left, n(q(e3, c3)) + g.top], relativePos: [m(p(e3, c3)) + g.left, n(q(e3, c3)) + g.top], seriesIndex: a3.series, pointIndex: c3, color: j(a3, c3) });
}).on("mouseout", function(a3, c3) {
if (O || !b2[a3.series])
return 0;
var d4 = b2[a3.series], e3 = d4.values[c3];
L.elementMouseout({ point: e3, series: d4, pos: [m(p(e3, c3)) + g.left, n(q(e3, c3)) + g.top], relativePos: [m(p(e3, c3)) + g.left, n(q(e3, c3)) + g.top], seriesIndex: a3.series, pointIndex: c3, color: j(a3, c3) });
});
}
l = d3.select(this);
var R = a.utils.availableWidth(h, l, g), S = a.utils.availableHeight(i, l, g);
a.utils.initSVG(l), b2.forEach(function(a2, b3) {
a2.values.forEach(function(a3) {
a3.series = b3;
});
});
var T = E && F && I ? [] : d3.merge(b2.map(function(a2) {
return a2.values.map(function(a3, b3) {
return { x: p(a3, b3), y: q(a3, b3), size: r(a3, b3) };
});
}));
m.domain(E || d3.extent(T.map(function(a2) {
return a2.x;
}).concat(t))), y && b2[0] ? m.range(G || [(R * z + R) / (2 * b2[0].values.length), R - R * (1 + z) / (2 * b2[0].values.length)]) : m.range(G || [0, R]), n.domain(F || d3.extent(T.map(function(a2) {
return a2.y;
}).concat(u))).range(H || [S, 0]), o.domain(I || d3.extent(T.map(function(a2) {
return a2.size;
}).concat(v))).range(J || Q), K = m.domain()[0] === m.domain()[1] || n.domain()[0] === n.domain()[1], m.domain()[0] === m.domain()[1] && (m.domain()[0] ? m.domain([m.domain()[0] - 0.01 * m.domain()[0], m.domain()[1] + 0.01 * m.domain()[1]]) : m.domain([-1, 1])), n.domain()[0] === n.domain()[1] && (n.domain()[0] ? n.domain([n.domain()[0] - 0.01 * n.domain()[0], n.domain()[1] + 0.01 * n.domain()[1]]) : n.domain([-1, 1])), isNaN(m.domain()[0]) && m.domain([-1, 1]), isNaN(n.domain()[0]) && n.domain([-1, 1]), c = c || m, d = d || n, e = e || o;
var U = l.selectAll("g.nv-wrap.nv-scatter").data([b2]), V = U.enter().append("g").attr("class", "nvd3 nv-wrap nv-scatter nv-chart-" + k), W = V.append("defs"), X = V.append("g"), Y = U.select("g");
U.classed("nv-single-point", K), X.append("g").attr("class", "nv-groups"), X.append("g").attr("class", "nv-point-paths"), V.append("g").attr("class", "nv-point-clips"), U.attr("transform", "translate(" + g.left + "," + g.top + ")"), W.append("clipPath").attr("id", "nv-edge-clip-" + k).append("rect"), U.select("#nv-edge-clip-" + k + " rect").attr("width", R).attr("height", S > 0 ? S : 0), Y.attr("clip-path", A ? "url(#nv-edge-clip-" + k + ")" : ""), O = true;
var Z = U.select(".nv-groups").selectAll(".nv-group").data(function(a2) {
return a2;
}, function(a2) {
return a2.key;
});
Z.enter().append("g").style("stroke-opacity", 1e-6).style("fill-opacity", 1e-6), Z.exit().remove(), Z.attr("class", function(a2, b3) {
return "nv-group nv-series-" + b3;
}).classed("hover", function(a2) {
return a2.hover;
}), Z.watchTransition(P, "scatter: groups").style("fill", function(a2, b3) {
return j(a2, b3);
}).style("stroke", function(a2, b3) {
return j(a2, b3);
}).style("stroke-opacity", 1).style("fill-opacity", 0.5);
var $ = Z.selectAll("path.nv-point").data(function(a2) {
return a2.values.map(function(a3, b3) {
return [a3, b3];
}).filter(function(a3, b3) {
return x(a3[0], b3);
});
});
$.enter().append("path").style("fill", function(a2) {
return a2.color;
}).style("stroke", function(a2) {
return a2.color;
}).attr("transform", function(a2) {
return "translate(" + c(p(a2[0], a2[1])) + "," + d(q(a2[0], a2[1])) + ")";
}).attr("d", a.utils.symbol().type(function(a2) {
return s(a2[0]);
}).size(function(a2) {
return o(r(a2[0], a2[1]));
})), $.exit().remove(), Z.exit().selectAll("path.nv-point").watchTransition(P, "scatter exit").attr("transform", function(a2) {
return "translate(" + m(p(a2[0], a2[1])) + "," + n(q(a2[0], a2[1])) + ")";
}).remove(), $.each(function(a2) {
d3.select(this).classed("nv-point", true).classed("nv-point-" + a2[1], true).classed("nv-noninteractive", !w).classed("hover", false);
}), $.watchTransition(P, "scatter points").attr("transform", function(a2) {
return "translate(" + m(p(a2[0], a2[1])) + "," + n(q(a2[0], a2[1])) + ")";
}).attr("d", a.utils.symbol().type(function(a2) {
return s(a2[0]);
}).size(function(a2) {
return o(r(a2[0], a2[1]));
})), clearTimeout(f), f = setTimeout(N3, 300), c = m.copy(), d = n.copy(), e = o.copy();
}), P.renderEnd("scatter immediate"), b;
}
var c, d, e, f, g = { top: 0, right: 0, bottom: 0, left: 0 }, h = null, i = null, j = a.utils.defaultColor(), k = Math.floor(1e5 * Math.random()), l = null, m = d3.scale.linear(), n = d3.scale.linear(), o = d3.scale.linear(), p = function(a2) {
return a2.x;
}, q = function(a2) {
return a2.y;
}, r = function(a2) {
return a2.size || 1;
}, s = function(a2) {
return a2.shape || "circle";
}, t = [], u = [], v = [], w = true, x = function(a2) {
return !a2.notActive;
}, y = false, z = 0.1, A = false, B = true, C = false, D = function() {
return 25;
}, E = null, F = null, G = null, H = null, I = null, J = null, K = false, L = d3.dispatch("elementClick", "elementDblClick", "elementMouseover", "elementMouseout", "renderEnd"), M = true, N = 250, O = false, P = a.utils.renderWatch(L, N), Q = [16, 256];
return b.dispatch = L, b.options = a.utils.optionsFunc.bind(b), b._calls = new function() {
this.clearHighlights = function() {
return a.dom.write(function() {
l.selectAll(".nv-point.hover").classed("hover", false);
}), null;
}, this.highlightPoint = function(b2, c2, d2) {
a.dom.write(function() {
l.select(".nv-groups").selectAll(".nv-series-" + b2).selectAll(".nv-point-" + c2).classed("hover", d2);
});
};
}(), L.on("elementMouseover.point", function(a2) {
w && b._calls.highlightPoint(a2.seriesIndex, a2.pointIndex, true);
}), L.on("elementMouseout.point", function(a2) {
w && b._calls.highlightPoint(a2.seriesIndex, a2.pointIndex, false);
}), b._options = Object.create({}, { width: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, height: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, xScale: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, yScale: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, pointScale: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, xDomain: { get: function() {
return E;
}, set: function(a2) {
E = a2;
} }, yDomain: { get: function() {
return F;
}, set: function(a2) {
F = a2;
} }, pointDomain: { get: function() {
return I;
}, set: function(a2) {
I = a2;
} }, xRange: { get: function() {
return G;
}, set: function(a2) {
G = a2;
} }, yRange: { get: function() {
return H;
}, set: function(a2) {
H = a2;
} }, pointRange: { get: function() {
return J;
}, set: function(a2) {
J = a2;
} }, forceX: { get: function() {
return t;
}, set: function(a2) {
t = a2;
} }, forceY: { get: function() {
return u;
}, set: function(a2) {
u = a2;
} }, forcePoint: { get: function() {
return v;
}, set: function(a2) {
v = a2;
} }, interactive: { get: function() {
return w;
}, set: function(a2) {
w = a2;
} }, pointActive: { get: function() {
return x;
}, set: function(a2) {
x = a2;
} }, padDataOuter: { get: function() {
return z;
}, set: function(a2) {
z = a2;
} }, padData: { get: function() {
return y;
}, set: function(a2) {
y = a2;
} }, clipEdge: { get: function() {
return A;
}, set: function(a2) {
A = a2;
} }, clipVoronoi: { get: function() {
return B;
}, set: function(a2) {
B = a2;
} }, clipRadius: { get: function() {
return D;
}, set: function(a2) {
D = a2;
} }, showVoronoi: { get: function() {
return C;
}, set: function(a2) {
C = a2;
} }, id: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, x: { get: function() {
return p;
}, set: function(a2) {
p = d3.functor(a2);
} }, y: { get: function() {
return q;
}, set: function(a2) {
q = d3.functor(a2);
} }, pointSize: { get: function() {
return r;
}, set: function(a2) {
r = d3.functor(a2);
} }, pointShape: { get: function() {
return s;
}, set: function(a2) {
s = d3.functor(a2);
} }, margin: { get: function() {
return g;
}, set: function(a2) {
g.top = void 0 !== a2.top ? a2.top : g.top, g.right = void 0 !== a2.right ? a2.right : g.right, g.bottom = void 0 !== a2.bottom ? a2.bottom : g.bottom, g.left = void 0 !== a2.left ? a2.left : g.left;
} }, duration: { get: function() {
return N;
}, set: function(a2) {
N = a2, P.reset(N);
} }, color: { get: function() {
return j;
}, set: function(b2) {
j = a.utils.getColor(b2);
} }, useVoronoi: { get: function() {
return M;
}, set: function(a2) {
M = a2, M === false && (B = false);
} } }), a.utils.initOptions(b), b;
}, a.models.scatterChart = function() {
"use strict";
function b(z2) {
return D.reset(), D.models(c), t && D.models(d), u && D.models(e), q && D.models(g), r && D.models(h), z2.each(function(z3) {
m = d3.select(this), a.utils.initSVG(m);
var G = a.utils.availableWidth(k, m, j), H = a.utils.availableHeight(l, m, j);
if (b.update = function() {
0 === A ? m.call(b) : m.transition().duration(A).call(b);
}, b.container = this, w.setter(F(z3), b.update).getter(E(z3)).update(), w.disabled = z3.map(function(a2) {
return !!a2.disabled;
}), !x) {
var I;
x = {};
for (I in w)
w[I] instanceof Array ? x[I] = w[I].slice(0) : x[I] = w[I];
}
if (!(z3 && z3.length && z3.filter(function(a2) {
return a2.values.length;
}).length))
return a.utils.noData(b, m), D.renderEnd("scatter immediate"), b;
m.selectAll(".nv-noData").remove(), o = c.xScale(), p = c.yScale();
var J = m.selectAll("g.nv-wrap.nv-scatterChart").data([z3]), K = J.enter().append("g").attr("class", "nvd3 nv-wrap nv-scatterChart nv-chart-" + c.id()), L = K.append("g"), M = J.select("g");
if (L.append("rect").attr("class", "nvd3 nv-background").style("pointer-events", "none"), L.append("g").attr("class", "nv-x nv-axis"), L.append("g").attr("class", "nv-y nv-axis"), L.append("g").attr("class", "nv-scatterWrap"), L.append("g").attr("class", "nv-regressionLinesWrap"), L.append("g").attr("class", "nv-distWrap"), L.append("g").attr("class", "nv-legendWrap"), v && M.select(".nv-y.nv-axis").attr("transform", "translate(" + G + ",0)"), s) {
var N = G;
f.width(N), J.select(".nv-legendWrap").datum(z3).call(f), j.top != f.height() && (j.top = f.height(), H = a.utils.availableHeight(l, m, j)), J.select(".nv-legendWrap").attr("transform", "translate(0," + -j.top + ")");
}
J.attr("transform", "translate(" + j.left + "," + j.top + ")"), c.width(G).height(H).color(z3.map(function(a2, b2) {
return a2.color = a2.color || n(a2, b2), a2.color;
}).filter(function(a2, b2) {
return !z3[b2].disabled;
})), J.select(".nv-scatterWrap").datum(z3.filter(function(a2) {
return !a2.disabled;
})).call(c), J.select(".nv-regressionLinesWrap").attr("clip-path", "url(#nv-edge-clip-" + c.id() + ")");
var O = J.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(a2) {
return a2;
});
O.enter().append("g").attr("class", "nv-regLines");
var P = O.selectAll(".nv-regLine").data(function(a2) {
return [a2];
});
P.enter().append("line").attr("class", "nv-regLine").style("stroke-opacity", 0), P.filter(function(a2) {
return a2.intercept && a2.slope;
}).watchTransition(D, "scatterPlusLineChart: regline").attr("x1", o.range()[0]).attr("x2", o.range()[1]).attr("y1", function(a2, b2) {
return p(o.domain()[0] * a2.slope + a2.intercept);
}).attr("y2", function(a2, b2) {
return p(o.domain()[1] * a2.slope + a2.intercept);
}).style("stroke", function(a2, b2, c2) {
return n(a2, c2);
}).style("stroke-opacity", function(a2, b2) {
return a2.disabled || "undefined" == typeof a2.slope || "undefined" == typeof a2.intercept ? 0 : 1;
}), t && (d.scale(o)._ticks(a.utils.calcTicksX(G / 100, z3)).tickSize(-H, 0), M.select(".nv-x.nv-axis").attr("transform", "translate(0," + p.range()[0] + ")").call(d)), u && (e.scale(p)._ticks(a.utils.calcTicksY(H / 36, z3)).tickSize(-G, 0), M.select(".nv-y.nv-axis").call(e)), q && (g.getData(c.x()).scale(o).width(G).color(z3.map(function(a2, b2) {
return a2.color || n(a2, b2);
}).filter(function(a2, b2) {
return !z3[b2].disabled;
})), L.select(".nv-distWrap").append("g").attr("class", "nv-distributionX"), M.select(".nv-distributionX").attr("transform", "translate(0," + p.range()[0] + ")").datum(z3.filter(function(a2) {
return !a2.disabled;
})).call(g)), r && (h.getData(c.y()).scale(p).width(H).color(z3.map(function(a2, b2) {
return a2.color || n(a2, b2);
}).filter(function(a2, b2) {
return !z3[b2].disabled;
})), L.select(".nv-distWrap").append("g").attr("class", "nv-distributionY"), M.select(".nv-distributionY").attr("transform", "translate(" + (v ? G : -h.size()) + ",0)").datum(z3.filter(function(a2) {
return !a2.disabled;
})).call(h)), f.dispatch.on("stateChange", function(a2) {
for (var c2 in a2)
w[c2] = a2[c2];
y.stateChange(w), b.update();
}), y.on("changeState", function(a2) {
"undefined" != typeof a2.disabled && (z3.forEach(function(b2, c2) {
b2.disabled = a2.disabled[c2];
}), w.disabled = a2.disabled), b.update();
}), c.dispatch.on("elementMouseout.tooltip", function(a2) {
i.hidden(true), m.select(".nv-chart-" + c.id() + " .nv-series-" + a2.seriesIndex + " .nv-distx-" + a2.pointIndex).attr("y1", 0), m.select(".nv-chart-" + c.id() + " .nv-series-" + a2.seriesIndex + " .nv-disty-" + a2.pointIndex).attr("x2", h.size());
}), c.dispatch.on("elementMouseover.tooltip", function(a2) {
m.select(".nv-series-" + a2.seriesIndex + " .nv-distx-" + a2.pointIndex).attr("y1", a2.relativePos[1] - H), m.select(".nv-series-" + a2.seriesIndex + " .nv-disty-" + a2.pointIndex).attr("x2", a2.relativePos[0] + g.size()), i.data(a2).hidden(false);
}), B = o.copy(), C = p.copy();
}), D.renderEnd("scatter with line immediate"), b;
}
var c = a.models.scatter(), d = a.models.axis(), e = a.models.axis(), f = a.models.legend(), g = a.models.distribution(), h = a.models.distribution(), i = a.models.tooltip(), j = { top: 30, right: 20, bottom: 50, left: 75 }, k = null, l = null, m = null, n = a.utils.defaultColor(), o = c.xScale(), p = c.yScale(), q = false, r = false, s = true, t = true, u = true, v = false, w = a.utils.state(), x = null, y = d3.dispatch("stateChange", "changeState", "renderEnd"), z = null, A = 250;
c.xScale(o).yScale(p), d.orient("bottom").tickPadding(10), e.orient(v ? "right" : "left").tickPadding(10), g.axis("x"), h.axis("y"), i.headerFormatter(function(a2, b2) {
return d.tickFormat()(a2, b2);
}).valueFormatter(function(a2, b2) {
return e.tickFormat()(a2, b2);
});
var B, C, D = a.utils.renderWatch(y, A), E = function(a2) {
return function() {
return { active: a2.map(function(a3) {
return !a3.disabled;
}) };
};
}, F = function(a2) {
return function(b2) {
void 0 !== b2.active && a2.forEach(function(a3, c2) {
a3.disabled = !b2.active[c2];
});
};
};
return b.dispatch = y, b.scatter = c, b.legend = f, b.xAxis = d, b.yAxis = e, b.distX = g, b.distY = h, b.tooltip = i, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, height: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, container: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, showDistX: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, showDistY: { get: function() {
return r;
}, set: function(a2) {
r = a2;
} }, showLegend: { get: function() {
return s;
}, set: function(a2) {
s = a2;
} }, showXAxis: { get: function() {
return t;
}, set: function(a2) {
t = a2;
} }, showYAxis: { get: function() {
return u;
}, set: function(a2) {
u = a2;
} }, defaultState: { get: function() {
return x;
}, set: function(a2) {
x = a2;
} }, noData: { get: function() {
return z;
}, set: function(a2) {
z = a2;
} }, duration: { get: function() {
return A;
}, set: function(a2) {
A = a2;
} }, margin: { get: function() {
return j;
}, set: function(a2) {
j.top = void 0 !== a2.top ? a2.top : j.top, j.right = void 0 !== a2.right ? a2.right : j.right, j.bottom = void 0 !== a2.bottom ? a2.bottom : j.bottom, j.left = void 0 !== a2.left ? a2.left : j.left;
} }, rightAlignYAxis: { get: function() {
return v;
}, set: function(a2) {
v = a2, e.orient(a2 ? "right" : "left");
} }, color: { get: function() {
return n;
}, set: function(b2) {
n = a.utils.getColor(b2), f.color(n), g.color(n), h.color(n);
} } }), a.utils.inheritOptions(b, c), a.utils.initOptions(b), b;
}, a.models.sparkline = function() {
"use strict";
function b(k2) {
return k2.each(function(b2) {
var k3 = h - g.left - g.right, q = i - g.top - g.bottom;
j = d3.select(this), a.utils.initSVG(j), l.domain(c || d3.extent(b2, n)).range(e || [0, k3]), m.domain(d || d3.extent(b2, o)).range(f || [q, 0]);
var r = j.selectAll("g.nv-wrap.nv-sparkline").data([b2]), s = r.enter().append("g").attr("class", "nvd3 nv-wrap nv-sparkline");
s.append("g"), r.select("g");
r.attr("transform", "translate(" + g.left + "," + g.top + ")");
var t = r.selectAll("path").data(function(a2) {
return [a2];
});
t.enter().append("path"), t.exit().remove(), t.style("stroke", function(a2, b3) {
return a2.color || p(a2, b3);
}).attr("d", d3.svg.line().x(function(a2, b3) {
return l(n(a2, b3));
}).y(function(a2, b3) {
return m(o(a2, b3));
}));
var u = r.selectAll("circle.nv-point").data(function(a2) {
function b3(b4) {
if (-1 != b4) {
var c3 = a2[b4];
return c3.pointIndex = b4, c3;
}
return null;
}
var c2 = a2.map(function(a3, b4) {
return o(a3, b4);
}), d2 = b3(c2.lastIndexOf(m.domain()[1])), e2 = b3(c2.indexOf(m.domain()[0])), f2 = b3(c2.length - 1);
return [e2, d2, f2].filter(function(a3) {
return null != a3;
});
});
u.enter().append("circle"), u.exit().remove(), u.attr("cx", function(a2, b3) {
return l(n(a2, a2.pointIndex));
}).attr("cy", function(a2, b3) {
return m(o(a2, a2.pointIndex));
}).attr("r", 2).attr("class", function(a2, b3) {
return n(a2, a2.pointIndex) == l.domain()[1] ? "nv-point nv-currentValue" : o(a2, a2.pointIndex) == m.domain()[0] ? "nv-point nv-minValue" : "nv-point nv-maxValue";
});
}), b;
}
var c, d, e, f, g = { top: 2, right: 0, bottom: 2, left: 0 }, h = 400, i = 32, j = null, k = true, l = d3.scale.linear(), m = d3.scale.linear(), n = function(a2) {
return a2.x;
}, o = function(a2) {
return a2.y;
}, p = a.utils.getColor(["#000"]);
return b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, height: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, xDomain: { get: function() {
return c;
}, set: function(a2) {
c = a2;
} }, yDomain: { get: function() {
return d;
}, set: function(a2) {
d = a2;
} }, xRange: { get: function() {
return e;
}, set: function(a2) {
e = a2;
} }, yRange: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, xScale: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, yScale: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, animate: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, x: { get: function() {
return n;
}, set: function(a2) {
n = d3.functor(a2);
} }, y: { get: function() {
return o;
}, set: function(a2) {
o = d3.functor(a2);
} }, margin: { get: function() {
return g;
}, set: function(a2) {
g.top = void 0 !== a2.top ? a2.top : g.top, g.right = void 0 !== a2.right ? a2.right : g.right, g.bottom = void 0 !== a2.bottom ? a2.bottom : g.bottom, g.left = void 0 !== a2.left ? a2.left : g.left;
} }, color: { get: function() {
return p;
}, set: function(b2) {
p = a.utils.getColor(b2);
} } }), a.utils.initOptions(b), b;
}, a.models.sparklinePlus = function() {
"use strict";
function b(p2) {
return p2.each(function(p3) {
function q() {
if (!j) {
var a2 = z.selectAll(".nv-hoverValue").data(i), b2 = a2.enter().append("g").attr("class", "nv-hoverValue").style("stroke-opacity", 0).style("fill-opacity", 0);
a2.exit().transition().duration(250).style("stroke-opacity", 0).style("fill-opacity", 0).remove(), a2.attr("transform", function(a3) {
return "translate(" + c(e.x()(p3[a3], a3)) + ",0)";
}).transition().duration(250).style("stroke-opacity", 1).style("fill-opacity", 1), i.length && (b2.append("line").attr("x1", 0).attr("y1", -f.top).attr("x2", 0).attr("y2", u), b2.append("text").attr("class", "nv-xValue").attr("x", -6).attr("y", -f.top).attr("text-anchor", "end").attr("dy", ".9em"), z.select(".nv-hoverValue .nv-xValue").text(k(e.x()(p3[i[0]], i[0]))), b2.append("text").attr("class", "nv-yValue").attr("x", 6).attr("y", -f.top).attr("text-anchor", "start").attr("dy", ".9em"), z.select(".nv-hoverValue .nv-yValue").text(l(e.y()(p3[i[0]], i[0]))));
}
}
function r() {
function a2(a3, b3) {
for (var c2 = Math.abs(e.x()(a3[0], 0) - b3), d2 = 0, f2 = 0; f2 < a3.length; f2++)
Math.abs(e.x()(a3[f2], f2) - b3) < c2 && (c2 = Math.abs(e.x()(a3[f2], f2) - b3), d2 = f2);
return d2;
}
if (!j) {
var b2 = d3.mouse(this)[0] - f.left;
i = [a2(p3, Math.round(c.invert(b2)))], q();
}
}
var s = d3.select(this);
a.utils.initSVG(s);
var t = a.utils.availableWidth(g, s, f), u = a.utils.availableHeight(h, s, f);
if (b.update = function() {
s.call(b);
}, b.container = this, !p3 || !p3.length)
return a.utils.noData(b, s), b;
s.selectAll(".nv-noData").remove();
var v = e.y()(p3[p3.length - 1], p3.length - 1);
c = e.xScale(), d = e.yScale();
var w = s.selectAll("g.nv-wrap.nv-sparklineplus").data([p3]), x = w.enter().append("g").attr("class", "nvd3 nv-wrap nv-sparklineplus"), y = x.append("g"), z = w.select("g");
y.append("g").attr("class", "nv-sparklineWrap"), y.append("g").attr("class", "nv-valueWrap"), y.append("g").attr("class", "nv-hoverArea"), w.attr("transform", "translate(" + f.left + "," + f.top + ")");
var A = z.select(".nv-sparklineWrap");
if (e.width(t).height(u), A.call(e), m) {
var B = z.select(".nv-valueWrap"), C = B.selectAll(".nv-currentValue").data([v]);
C.enter().append("text").attr("class", "nv-currentValue").attr("dx", o ? -8 : 8).attr("dy", ".9em").style("text-anchor", o ? "end" : "start"), C.attr("x", t + (o ? f.right : 0)).attr("y", n ? function(a2) {
return d(a2);
} : 0).style("fill", e.color()(p3[p3.length - 1], p3.length - 1)).text(l(v));
}
y.select(".nv-hoverArea").append("rect").on("mousemove", r).on("click", function() {
j = !j;
}).on("mouseout", function() {
i = [], q();
}), z.select(".nv-hoverArea rect").attr("transform", function(a2) {
return "translate(" + -f.left + "," + -f.top + ")";
}).attr("width", t + f.left + f.right).attr("height", u + f.top);
}), b;
}
var c, d, e = a.models.sparkline(), f = { top: 15, right: 100, bottom: 10, left: 50 }, g = null, h = null, i = [], j = false, k = d3.format(",r"), l = d3.format(",.2f"), m = true, n = true, o = false, p = null;
return b.sparkline = e, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return g;
}, set: function(a2) {
g = a2;
} }, height: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, xTickFormat: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, yTickFormat: { get: function() {
return l;
}, set: function(a2) {
l = a2;
} }, showLastValue: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, alignValue: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, rightAlignValue: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, noData: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, margin: { get: function() {
return f;
}, set: function(a2) {
f.top = void 0 !== a2.top ? a2.top : f.top, f.right = void 0 !== a2.right ? a2.right : f.right, f.bottom = void 0 !== a2.bottom ? a2.bottom : f.bottom, f.left = void 0 !== a2.left ? a2.left : f.left;
} } }), a.utils.inheritOptions(b, e), a.utils.initOptions(b), b;
}, a.models.stackedArea = function() {
"use strict";
function b(m2) {
return u.reset(), u.models(r), m2.each(function(m3) {
var s2 = f - e.left - e.right, v = g - e.top - e.bottom;
j = d3.select(this), a.utils.initSVG(j), c = r.xScale(), d = r.yScale();
var w = m3;
m3.forEach(function(a2, b2) {
a2.seriesIndex = b2, a2.values = a2.values.map(function(a3, c2) {
return a3.index = c2, a3.seriesIndex = b2, a3;
});
});
var x = m3.filter(function(a2) {
return !a2.disabled;
});
m3 = d3.layout.stack().order(o).offset(n).values(function(a2) {
return a2.values;
}).x(k).y(l).out(function(a2, b2, c2) {
a2.display = { y: c2, y0: b2 };
})(x);
var y = j.selectAll("g.nv-wrap.nv-stackedarea").data([m3]), z = y.enter().append("g").attr("class", "nvd3 nv-wrap nv-stackedarea"), A = z.append("defs"), B = z.append("g"), C = y.select("g");
B.append("g").attr("class", "nv-areaWrap"), B.append("g").attr("class", "nv-scatterWrap"), y.attr("transform", "translate(" + e.left + "," + e.top + ")"), 0 == r.forceY().length && r.forceY().push(0), r.width(s2).height(v).x(k).y(function(a2) {
return void 0 !== a2.display ? a2.display.y + a2.display.y0 : void 0;
}).forceY([0]).color(m3.map(function(a2, b2) {
return a2.color || h(a2, a2.seriesIndex);
}));
var D = C.select(".nv-scatterWrap").datum(m3);
D.call(r), A.append("clipPath").attr("id", "nv-edge-clip-" + i).append("rect"), y.select("#nv-edge-clip-" + i + " rect").attr("width", s2).attr("height", v), C.attr("clip-path", q ? "url(#nv-edge-clip-" + i + ")" : "");
var E = d3.svg.area().x(function(a2, b2) {
return c(k(a2, b2));
}).y0(function(a2) {
return d(a2.display.y0);
}).y1(function(a2) {
return d(a2.display.y + a2.display.y0);
}).interpolate(p), F = d3.svg.area().x(function(a2, b2) {
return c(k(a2, b2));
}).y0(function(a2) {
return d(a2.display.y0);
}).y1(function(a2) {
return d(a2.display.y0);
}), G = C.select(".nv-areaWrap").selectAll("path.nv-area").data(function(a2) {
return a2;
});
G.enter().append("path").attr("class", function(a2, b2) {
return "nv-area nv-area-" + b2;
}).attr("d", function(a2, b2) {
return F(a2.values, a2.seriesIndex);
}).on("mouseover", function(a2, b2) {
d3.select(this).classed("hover", true), t.areaMouseover({ point: a2, series: a2.key, pos: [d3.event.pageX, d3.event.pageY], seriesIndex: a2.seriesIndex });
}).on("mouseout", function(a2, b2) {
d3.select(this).classed("hover", false), t.areaMouseout({ point: a2, series: a2.key, pos: [d3.event.pageX, d3.event.pageY], seriesIndex: a2.seriesIndex });
}).on("click", function(a2, b2) {
d3.select(this).classed("hover", false), t.areaClick({ point: a2, series: a2.key, pos: [d3.event.pageX, d3.event.pageY], seriesIndex: a2.seriesIndex });
}), G.exit().remove(), G.style("fill", function(a2, b2) {
return a2.color || h(a2, a2.seriesIndex);
}).style("stroke", function(a2, b2) {
return a2.color || h(a2, a2.seriesIndex);
}), G.watchTransition(u, "stackedArea path").attr("d", function(a2, b2) {
return E(a2.values, b2);
}), r.dispatch.on("elementMouseover.area", function(a2) {
C.select(".nv-chart-" + i + " .nv-area-" + a2.seriesIndex).classed("hover", true);
}), r.dispatch.on("elementMouseout.area", function(a2) {
C.select(".nv-chart-" + i + " .nv-area-" + a2.seriesIndex).classed("hover", false);
}), b.d3_stackedOffset_stackPercent = function(a2) {
var b2, c2, d2, e2 = a2.length, f2 = a2[0].length, g2 = [];
for (c2 = 0; f2 > c2; ++c2) {
for (b2 = 0, d2 = 0; b2 < w.length; b2++)
d2 += l(w[b2].values[c2]);
if (d2)
for (b2 = 0; e2 > b2; b2++)
a2[b2][c2][1] /= d2;
else
for (b2 = 0; e2 > b2; b2++)
a2[b2][c2][1] = 0;
}
for (c2 = 0; f2 > c2; ++c2)
g2[c2] = 0;
return g2;
};
}), u.renderEnd("stackedArea immediate"), b;
}
var c, d, e = { top: 0, right: 0, bottom: 0, left: 0 }, f = 960, g = 500, h = a.utils.defaultColor(), i = Math.floor(1e5 * Math.random()), j = null, k = function(a2) {
return a2.x;
}, l = function(a2) {
return a2.y;
}, m = "stack", n = "zero", o = "default", p = "linear", q = false, r = a.models.scatter(), s = 250, t = d3.dispatch("areaClick", "areaMouseover", "areaMouseout", "renderEnd", "elementClick", "elementMouseover", "elementMouseout");
r.pointSize(2.2).pointDomain([2.2, 2.2]);
var u = a.utils.renderWatch(t, s);
return b.dispatch = t, b.scatter = r, r.dispatch.on("elementClick", function() {
t.elementClick.apply(this, arguments);
}), r.dispatch.on("elementMouseover", function() {
t.elementMouseover.apply(this, arguments);
}), r.dispatch.on("elementMouseout", function() {
t.elementMouseout.apply(this, arguments);
}), b.interpolate = function(a2) {
return arguments.length ? (p = a2, b) : p;
}, b.duration = function(a2) {
return arguments.length ? (s = a2, u.reset(s), r.duration(s), b) : s;
}, b.dispatch = t, b.scatter = r, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return f;
}, set: function(a2) {
f = a2;
} }, height: { get: function() {
return g;
}, set: function(a2) {
g = a2;
} }, clipEdge: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, offset: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, order: { get: function() {
return o;
}, set: function(a2) {
o = a2;
} }, interpolate: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, x: { get: function() {
return k;
}, set: function(a2) {
k = d3.functor(a2);
} }, y: { get: function() {
return l;
}, set: function(a2) {
l = d3.functor(a2);
} }, margin: { get: function() {
return e;
}, set: function(a2) {
e.top = void 0 !== a2.top ? a2.top : e.top, e.right = void 0 !== a2.right ? a2.right : e.right, e.bottom = void 0 !== a2.bottom ? a2.bottom : e.bottom, e.left = void 0 !== a2.left ? a2.left : e.left;
} }, color: { get: function() {
return h;
}, set: function(b2) {
h = a.utils.getColor(b2);
} }, style: { get: function() {
return m;
}, set: function(a2) {
switch (m = a2) {
case "stack":
b.offset("zero"), b.order("default");
break;
case "stream":
b.offset("wiggle"), b.order("inside-out");
break;
case "stream-center":
b.offset("silhouette"), b.order("inside-out");
break;
case "expand":
b.offset("expand"), b.order("default");
break;
case "stack_percent":
b.offset(b.d3_stackedOffset_stackPercent), b.order("default");
}
} }, duration: { get: function() {
return s;
}, set: function(a2) {
s = a2, u.reset(s), r.duration(s);
} } }), a.utils.inheritOptions(b, r), a.utils.initOptions(b), b;
}, a.models.stackedAreaChart = function() {
"use strict";
function b(k2) {
return H.reset(), H.models(e), r && H.models(f), s && H.models(g), k2.each(function(k3) {
var z2 = d3.select(this), H2 = this;
a.utils.initSVG(z2);
var M = a.utils.availableWidth(m, z2, l), N = a.utils.availableHeight(n, z2, l);
if (b.update = function() {
z2.transition().duration(E).call(b);
}, b.container = this, x.setter(K(k3), b.update).getter(J(k3)).update(), x.disabled = k3.map(function(a2) {
return !!a2.disabled;
}), !y) {
var O;
y = {};
for (O in x)
x[O] instanceof Array ? y[O] = x[O].slice(0) : y[O] = x[O];
}
if (!(k3 && k3.length && k3.filter(function(a2) {
return a2.values.length;
}).length))
return a.utils.noData(b, z2), b;
z2.selectAll(".nv-noData").remove(), c = e.xScale(), d = e.yScale();
var P = z2.selectAll("g.nv-wrap.nv-stackedAreaChart").data([k3]), Q = P.enter().append("g").attr("class", "nvd3 nv-wrap nv-stackedAreaChart").append("g"), R = P.select("g");
if (Q.append("rect").style("opacity", 0), Q.append("g").attr("class", "nv-x nv-axis"), Q.append("g").attr("class", "nv-y nv-axis"), Q.append("g").attr("class", "nv-stackedWrap"), Q.append("g").attr("class", "nv-legendWrap"), Q.append("g").attr("class", "nv-controlsWrap"), Q.append("g").attr("class", "nv-interactive"), R.select("rect").attr("width", M).attr("height", N), q) {
var S = p ? M - B : M;
h.width(S), R.select(".nv-legendWrap").datum(k3).call(h), l.top != h.height() && (l.top = h.height(), N = a.utils.availableHeight(n, z2, l)), R.select(".nv-legendWrap").attr("transform", "translate(" + (M - S) + "," + -l.top + ")");
}
if (p) {
var T = [{ key: D.stacked || "Stacked", metaKey: "Stacked", disabled: "stack" != e.style(), style: "stack" }, { key: D.stream || "Stream", metaKey: "Stream", disabled: "stream" != e.style(), style: "stream" }, { key: D.expanded || "Expanded", metaKey: "Expanded", disabled: "expand" != e.style(), style: "expand" }, { key: D.stack_percent || "Stack %", metaKey: "Stack_Percent", disabled: "stack_percent" != e.style(), style: "stack_percent" }];
B = C.length / 3 * 260, T = T.filter(function(a2) {
return -1 !== C.indexOf(a2.metaKey);
}), i.width(B).color(["#444", "#444", "#444"]), R.select(".nv-controlsWrap").datum(T).call(i), l.top != Math.max(i.height(), h.height()) && (l.top = Math.max(i.height(), h.height()), N = a.utils.availableHeight(n, z2, l)), R.select(".nv-controlsWrap").attr("transform", "translate(0," + -l.top + ")");
}
P.attr("transform", "translate(" + l.left + "," + l.top + ")"), t && R.select(".nv-y.nv-axis").attr("transform", "translate(" + M + ",0)"), u && (j.width(M).height(N).margin({ left: l.left, top: l.top }).svgContainer(z2).xScale(c), P.select(".nv-interactive").call(j)), e.width(M).height(N);
var U = R.select(".nv-stackedWrap").datum(k3);
if (U.transition().call(e), r && (f.scale(c)._ticks(a.utils.calcTicksX(M / 100, k3)).tickSize(-N, 0), R.select(".nv-x.nv-axis").attr("transform", "translate(0," + N + ")"), R.select(".nv-x.nv-axis").transition().duration(0).call(f)), s) {
var V;
if (V = "wiggle" === e.offset() ? 0 : a.utils.calcTicksY(N / 36, k3), g.scale(d)._ticks(V).tickSize(-M, 0), "expand" === e.style() || "stack_percent" === e.style()) {
var W = g.tickFormat();
F && W === L || (F = W), g.tickFormat(L);
} else
F && (g.tickFormat(F), F = null);
R.select(".nv-y.nv-axis").transition().duration(0).call(g);
}
e.dispatch.on("areaClick.toggle", function(a2) {
1 === k3.filter(function(a3) {
return !a3.disabled;
}).length ? k3.forEach(function(a3) {
a3.disabled = false;
}) : k3.forEach(function(b2, c2) {
b2.disabled = c2 != a2.seriesIndex;
}), x.disabled = k3.map(function(a3) {
return !!a3.disabled;
}), A.stateChange(x), b.update();
}), h.dispatch.on("stateChange", function(a2) {
for (var c2 in a2)
x[c2] = a2[c2];
A.stateChange(x), b.update();
}), i.dispatch.on("legendClick", function(a2, c2) {
a2.disabled && (T = T.map(function(a3) {
return a3.disabled = true, a3;
}), a2.disabled = false, e.style(a2.style), x.style = e.style(), A.stateChange(x), b.update());
}), j.dispatch.on("elementMousemove", function(c2) {
e.clearHighlights();
var d2, g2, h2, i2 = [], l2 = 0;
if (k3.filter(function(a2, b2) {
return a2.seriesIndex = b2, !a2.disabled;
}).forEach(function(f2, j2) {
g2 = a.interactiveBisect(f2.values, c2.pointXValue, b.x());
var k4 = f2.values[g2], m3 = b.y()(k4, g2);
if (null != m3 && e.highlightPoint(j2, g2, true), "undefined" != typeof k4) {
"undefined" == typeof d2 && (d2 = k4), "undefined" == typeof h2 && (h2 = b.xScale()(b.x()(k4, g2)));
var n3 = "expand" == e.style() ? k4.display.y : b.y()(k4, g2);
i2.push({ key: f2.key, value: n3, color: o(f2, f2.seriesIndex), stackedValue: k4.display }), v && "expand" != e.style() && (l2 += n3);
}
}), i2.reverse(), i2.length > 2) {
var m2 = b.yScale().invert(c2.mouseY), n2 = null;
i2.forEach(function(a2, b2) {
m2 = Math.abs(m2);
var c3 = Math.abs(a2.stackedValue.y0), d4 = Math.abs(a2.stackedValue.y);
return m2 >= c3 && d4 + c3 >= m2 ? void (n2 = b2) : void 0;
}), null != n2 && (i2[n2].highlight = true);
}
v && "expand" != e.style() && i2.length >= 2 && i2.push({ key: w, value: l2, total: true });
var p2 = f.tickFormat()(b.x()(d2, g2)), q2 = j.tooltip.valueFormatter();
"expand" === e.style() || "stack_percent" === e.style() ? (G || (G = q2), q2 = d3.format(".1%")) : G && (q2 = G, G = null), j.tooltip.chartContainer(H2.parentNode).valueFormatter(q2).data({ value: p2, series: i2 })(), j.renderGuideLine(h2);
}), j.dispatch.on("elementMouseout", function(a2) {
e.clearHighlights();
}), A.on("changeState", function(a2) {
"undefined" != typeof a2.disabled && k3.length === a2.disabled.length && (k3.forEach(function(b2, c2) {
b2.disabled = a2.disabled[c2];
}), x.disabled = a2.disabled), "undefined" != typeof a2.style && (e.style(a2.style), I = a2.style), b.update();
});
}), H.renderEnd("stacked Area chart immediate"), b;
}
var c, d, e = a.models.stackedArea(), f = a.models.axis(), g = a.models.axis(), h = a.models.legend(), i = a.models.legend(), j = a.interactiveGuideline(), k = a.models.tooltip(), l = { top: 30, right: 25, bottom: 50, left: 60 }, m = null, n = null, o = a.utils.defaultColor(), p = true, q = true, r = true, s = true, t = false, u = false, v = true, w = "TOTAL", x = a.utils.state(), y = null, z = null, A = d3.dispatch("stateChange", "changeState", "renderEnd"), B = 250, C = ["Stacked", "Stream", "Expanded"], D = {}, E = 250;
x.style = e.style(), f.orient("bottom").tickPadding(7), g.orient(t ? "right" : "left"), k.headerFormatter(function(a2, b2) {
return f.tickFormat()(a2, b2);
}).valueFormatter(function(a2, b2) {
return g.tickFormat()(a2, b2);
}), j.tooltip.headerFormatter(function(a2, b2) {
return f.tickFormat()(a2, b2);
}).valueFormatter(function(a2, b2) {
return g.tickFormat()(a2, b2);
});
var F = null, G = null;
i.updateState(false);
var H = a.utils.renderWatch(A), I = e.style(), J = function(a2) {
return function() {
return { active: a2.map(function(a3) {
return !a3.disabled;
}), style: e.style() };
};
}, K = function(a2) {
return function(b2) {
void 0 !== b2.style && (I = b2.style), void 0 !== b2.active && a2.forEach(function(a3, c2) {
a3.disabled = !b2.active[c2];
});
};
}, L = d3.format("%");
return e.dispatch.on("elementMouseover.tooltip", function(a2) {
a2.point.x = e.x()(a2.point), a2.point.y = e.y()(a2.point), k.data(a2).hidden(false);
}), e.dispatch.on("elementMouseout.tooltip", function(a2) {
k.hidden(true);
}), b.dispatch = A, b.stacked = e, b.legend = h, b.controls = i, b.xAxis = f, b.yAxis = g, b.interactiveLayer = j, b.tooltip = k, b.dispatch = A, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return m;
}, set: function(a2) {
m = a2;
} }, height: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, showLegend: { get: function() {
return q;
}, set: function(a2) {
q = a2;
} }, showXAxis: { get: function() {
return r;
}, set: function(a2) {
r = a2;
} }, showYAxis: { get: function() {
return s;
}, set: function(a2) {
s = a2;
} }, defaultState: { get: function() {
return y;
}, set: function(a2) {
y = a2;
} }, noData: { get: function() {
return z;
}, set: function(a2) {
z = a2;
} }, showControls: { get: function() {
return p;
}, set: function(a2) {
p = a2;
} }, controlLabels: { get: function() {
return D;
}, set: function(a2) {
D = a2;
} }, controlOptions: { get: function() {
return C;
}, set: function(a2) {
C = a2;
} }, showTotalInTooltip: { get: function() {
return v;
}, set: function(a2) {
v = a2;
} }, totalLabel: { get: function() {
return w;
}, set: function(a2) {
w = a2;
} }, margin: { get: function() {
return l;
}, set: function(a2) {
l.top = void 0 !== a2.top ? a2.top : l.top, l.right = void 0 !== a2.right ? a2.right : l.right, l.bottom = void 0 !== a2.bottom ? a2.bottom : l.bottom, l.left = void 0 !== a2.left ? a2.left : l.left;
} }, duration: { get: function() {
return E;
}, set: function(a2) {
E = a2, H.reset(E), e.duration(E), f.duration(E), g.duration(E);
} }, color: { get: function() {
return o;
}, set: function(b2) {
o = a.utils.getColor(b2), h.color(o), e.color(o);
} }, rightAlignYAxis: { get: function() {
return t;
}, set: function(a2) {
t = a2, g.orient(t ? "right" : "left");
} }, useInteractiveGuideline: { get: function() {
return u;
}, set: function(a2) {
u = !!a2, b.interactive(!a2), b.useVoronoi(!a2), e.scatter.interactive(!a2);
} } }), a.utils.inheritOptions(b, e), a.utils.initOptions(b), b;
}, a.models.sunburst = function() {
"use strict";
function b(u) {
return t.reset(), u.each(function(b2) {
function t2(a2) {
a2.x0 = a2.x, a2.dx0 = a2.dx;
}
function u2(a2) {
var b3 = d3.interpolate(p.domain(), [a2.x, a2.x + a2.dx]), c2 = d3.interpolate(q.domain(), [a2.y, 1]), d2 = d3.interpolate(q.range(), [a2.y ? 20 : 0, y]);
return function(a3, e2) {
return e2 ? function(b4) {
return s(a3);
} : function(e3) {
return p.domain(b3(e3)), q.domain(c2(e3)).range(d2(e3)), s(a3);
};
};
}
l = d3.select(this);
var v, w = a.utils.availableWidth(g, l, f), x = a.utils.availableHeight(h, l, f), y = Math.min(w, x) / 2;
a.utils.initSVG(l);
var z = l.selectAll(".nv-wrap.nv-sunburst").data(b2), A = z.enter().append("g").attr("class", "nvd3 nv-wrap nv-sunburst nv-chart-" + k), B = A.selectAll("nv-sunburst");
z.attr("transform", "translate(" + w / 2 + "," + x / 2 + ")"), l.on("click", function(a2, b3) {
o.chartClick({ data: a2, index: b3, pos: d3.event, id: k });
}), q.range([0, y]), c = c || b2, e = b2[0], r.value(j[i] || j.count), v = B.data(r.nodes).enter().append("path").attr("d", s).style("fill", function(a2) {
return m((a2.children ? a2 : a2.parent).name);
}).style("stroke", "#FFF").on("click", function(a2) {
d !== c && c !== a2 && (d = c), c = a2, v.transition().duration(n).attrTween("d", u2(a2));
}).each(t2).on("dblclick", function(a2) {
d.parent == a2 && v.transition().duration(n).attrTween("d", u2(e));
}).each(t2).on("mouseover", function(a2, b3) {
d3.select(this).classed("hover", true).style("opacity", 0.8), o.elementMouseover({ data: a2, color: d3.select(this).style("fill") });
}).on("mouseout", function(a2, b3) {
d3.select(this).classed("hover", false).style("opacity", 1), o.elementMouseout({ data: a2 });
}).on("mousemove", function(a2, b3) {
o.elementMousemove({ data: a2 });
});
}), t.renderEnd("sunburst immediate"), b;
}
var c, d, e, f = { top: 0, right: 0, bottom: 0, left: 0 }, g = null, h = null, i = "count", j = { count: function(a2) {
return 1;
}, size: function(a2) {
return a2.size;
} }, k = Math.floor(1e4 * Math.random()), l = null, m = a.utils.defaultColor(), n = 500, o = d3.dispatch("chartClick", "elementClick", "elementDblClick", "elementMousemove", "elementMouseover", "elementMouseout", "renderEnd"), p = d3.scale.linear().range([0, 2 * Math.PI]), q = d3.scale.sqrt(), r = d3.layout.partition().sort(null).value(function(a2) {
return 1;
}), s = d3.svg.arc().startAngle(function(a2) {
return Math.max(0, Math.min(2 * Math.PI, p(a2.x)));
}).endAngle(function(a2) {
return Math.max(0, Math.min(2 * Math.PI, p(a2.x + a2.dx)));
}).innerRadius(function(a2) {
return Math.max(0, q(a2.y));
}).outerRadius(function(a2) {
return Math.max(0, q(a2.y + a2.dy));
}), t = a.utils.renderWatch(o);
return b.dispatch = o, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { width: { get: function() {
return g;
}, set: function(a2) {
g = a2;
} }, height: { get: function() {
return h;
}, set: function(a2) {
h = a2;
} }, mode: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, id: { get: function() {
return k;
}, set: function(a2) {
k = a2;
} }, duration: { get: function() {
return n;
}, set: function(a2) {
n = a2;
} }, margin: { get: function() {
return f;
}, set: function(a2) {
f.top = void 0 != a2.top ? a2.top : f.top, f.right = void 0 != a2.right ? a2.right : f.right, f.bottom = void 0 != a2.bottom ? a2.bottom : f.bottom, f.left = void 0 != a2.left ? a2.left : f.left;
} }, color: { get: function() {
return m;
}, set: function(b2) {
m = a.utils.getColor(b2);
} } }), a.utils.initOptions(b), b;
}, a.models.sunburstChart = function() {
"use strict";
function b(d2) {
return m.reset(), m.models(c), d2.each(function(d4) {
var h2 = d3.select(this);
a.utils.initSVG(h2);
var i2 = a.utils.availableWidth(f, h2, e), j2 = a.utils.availableHeight(g, h2, e);
if (b.update = function() {
0 === k ? h2.call(b) : h2.transition().duration(k).call(b);
}, b.container = this, !d4 || !d4.length)
return a.utils.noData(b, h2), b;
h2.selectAll(".nv-noData").remove();
var l2 = h2.selectAll("g.nv-wrap.nv-sunburstChart").data(d4), m2 = l2.enter().append("g").attr("class", "nvd3 nv-wrap nv-sunburstChart").append("g"), n = l2.select("g");
m2.append("g").attr("class", "nv-sunburstWrap"), l2.attr("transform", "translate(" + e.left + "," + e.top + ")"), c.width(i2).height(j2);
var o = n.select(".nv-sunburstWrap").datum(d4);
d3.transition(o).call(c);
}), m.renderEnd("sunburstChart immediate"), b;
}
var c = a.models.sunburst(), d = a.models.tooltip(), e = { top: 30, right: 20, bottom: 20, left: 20 }, f = null, g = null, h = a.utils.defaultColor(), i = (Math.round(1e5 * Math.random()), null), j = null, k = 250, l = d3.dispatch("stateChange", "changeState", "renderEnd");
d.duration(0);
var m = a.utils.renderWatch(l);
return d.headerEnabled(false).valueFormatter(function(a2, b2) {
return a2;
}), c.dispatch.on("elementMouseover.tooltip", function(a2) {
a2.series = { key: a2.data.name, value: a2.data.size, color: a2.color }, d.data(a2).hidden(false);
}), c.dispatch.on("elementMouseout.tooltip", function(a2) {
d.hidden(true);
}), c.dispatch.on("elementMousemove.tooltip", function(a2) {
d();
}), b.dispatch = l, b.sunburst = c, b.tooltip = d, b.options = a.utils.optionsFunc.bind(b), b._options = Object.create({}, { noData: { get: function() {
return j;
}, set: function(a2) {
j = a2;
} }, defaultState: { get: function() {
return i;
}, set: function(a2) {
i = a2;
} }, color: { get: function() {
return h;
}, set: function(a2) {
h = a2, c.color(h);
} }, duration: { get: function() {
return k;
}, set: function(a2) {
k = a2, m.reset(k), c.duration(k);
} }, margin: { get: function() {
return e;
}, set: function(a2) {
e.top = void 0 !== a2.top ? a2.top : e.top, e.right = void 0 !== a2.right ? a2.right : e.right, e.bottom = void 0 !== a2.bottom ? a2.bottom : e.bottom, e.left = void 0 !== a2.left ? a2.left : e.left;
} } }), a.utils.inheritOptions(b, c), a.utils.initOptions(b), b;
}, a.version = "1.8.1-dev";
}();