not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

653 lines
32 KiB

  1. ! function(t) {
  2. if ("object" == typeof exports && "undefined" != typeof module) module.exports = t();
  3. else if ("function" == typeof define && define.amd) define([], t);
  4. else {
  5. var e;
  6. e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this, e.functionPlot = t()
  7. }
  8. }(function() {
  9. return function t(e, n, r) {
  10. function i(a, o) {
  11. if (!n[a]) {
  12. if (!e[a]) {
  13. var l = "function" == typeof require && require;
  14. if (!o && l) return l(a, !0);
  15. if (s) return s(a, !0);
  16. var c = new Error("Cannot find module '" + a + "'");
  17. throw c.code = "MODULE_NOT_FOUND", c
  18. }
  19. var u = n[a] = {
  20. exports: {}
  21. };
  22. e[a][0].call(u.exports, function(t) {
  23. var n = e[a][1][t];
  24. return i(n ? n : t)
  25. }, u, u.exports, t, e, n, r)
  26. }
  27. return n[a].exports
  28. }
  29. for (var s = "function" == typeof require && require, a = 0; a < r.length; a++) i(r[a]);
  30. return i
  31. }({
  32. 1: [function(t, e) {
  33. "use strict";
  34. var n, r, i = window.d3,
  35. s = t("events"),
  36. a = t("extend"),
  37. o = t("./lib/tip"),
  38. l = t("./lib/utils"),
  39. c = t("./lib/helper/"),
  40. u = l.assert;
  41. e.exports = function(t) {
  42. function e() {
  43. this.id = t.target, this.linkedGraphs = [this], this.setVars(), this.build(), this.setUpEventListeners()
  44. }
  45. t = t || {}, t.data = t.data || [];
  46. var l, h, p, f, d, v, m = i.svg.line().x(function(t) {
  47. return d(t[0])
  48. }).y(function(t) {
  49. return v(t[1])
  50. });
  51. return e.prototype = Object.create(s.prototype), e.prototype.updateBounds = function() {
  52. l = this.meta.width = (t.width || n.DEFAULT_WIDTH) - p.left - p.right, h = this.meta.height = (t.height || n.DEFAULT_HEIGHT) - p.top - p.bottom;
  53. var e = this.meta.xDomain,
  54. r = this.meta.yDomain,
  55. s = i.format("s"),
  56. a = i.format(".0r"),
  57. o = function(t) {
  58. return Math.abs(t) >= 1 ? s(t) : a(t)
  59. };
  60. d = this.meta.xScale = i.scale.linear().domain(e).range([0, l]), v = this.meta.yScale = i.scale.linear().domain(r).range([h, 0]), this.meta.xAxis = i.svg.axis().scale(d).orient("bottom").tickFormat(o), this.meta.yAxis = i.svg.axis().scale(v).orient("left").tickFormat(o)
  61. }, e.prototype.setVars = function() {
  62. var e = 10;
  63. this.meta = {}, p = this.meta.margin = {
  64. left: 30,
  65. right: 30,
  66. top: 20,
  67. bottom: 20
  68. }, f = this.meta.zoomBehavior = i.behavior.zoom();
  69. var n = this.meta.xDomain = t.xDomain || [-e / 2, e / 2],
  70. r = this.meta.yDomain = t.yDomain || [-e / 2, e / 2];
  71. u(n[0] < n[1]), u(r[0] < r[1]), t.title && (this.meta.margin.top = 40), this.updateBounds()
  72. }, e.prototype.build = function() {
  73. var e = this.root = i.select(t.target).selectAll("svg").data([t]);
  74. this.root.enter = e.enter().append("svg").attr("class", "function-plot").attr("font-size", this.getFontSize()), e.attr("width", l + p.left + p.right).attr("height", h + p.top + p.bottom), this.buildTitle(), this.buildLegend(), this.buildCanvas(), this.buildClip(), this.buildAxis(), this.buildContent();
  75. var n = this.tip = o(a(t.tip, {
  76. owner: this
  77. }));
  78. this.canvas.call(n), this.buildZoomHelper()
  79. }, e.prototype.buildTitle = function() {
  80. var e = this.root.selectAll("text.title").data(function(t) {
  81. return [t.title].filter(Boolean)
  82. });
  83. e.enter().append("text").attr("class", "title").attr("y", p.top / 2).attr("x", p.left + l / 2).attr("font-size", 25).attr("text-anchor", "middle").attr("alignment-baseline", "middle").text(t.title), e.exit().remove()
  84. }, e.prototype.buildLegend = function() {
  85. this.root.enter.append("text").attr("class", "top-right-legend").attr("text-anchor", "end"), this.root.select(".top-right-legend").attr("y", p.top).attr("x", l + p.left)
  86. }, e.prototype.buildCanvas = function() {
  87. var e = this;
  88. this.meta.zoomBehavior.x(d).y(v).scaleExtent([1e-5, 1 / 0]).on("zoom", function() {
  89. e.emit("all:zoom", d, v)
  90. });
  91. var n = this.canvas = this.root.selectAll(".canvas").data(function(t) {
  92. return [t]
  93. });
  94. this.canvas.enter = n.enter().append("g").attr("class", "canvas"), n.attr("transform", "translate(" + p.left + "," + p.top + ")").call(f).each(function() {
  95. var e = i.select(this);
  96. t.disableZoom && e.on(".zoom", null)
  97. })
  98. }, e.prototype.buildClip = function() {
  99. var t = this.id,
  100. e = this.canvas.enter.append("defs");
  101. e.append("clipPath").attr("id", "function-plot-clip-" + t).append("rect").attr("class", "clip static-clip"), this.canvas.selectAll(".clip").attr("width", l).attr("height", h)
  102. }, e.prototype.buildAxis = function() {
  103. var t = this.canvas.enter;
  104. t.append("g").attr("class", "x axis"), t.append("g").attr("class", "y axis"), this.canvas.select(".x.axis").attr("transform", "translate(0," + h + ")").call(this.meta.xAxis), this.canvas.select(".y.axis").call(this.meta.yAxis), this.canvas.selectAll(".axis path, .axis line").attr("fill", "none").attr("stroke", "black").attr("shape-rendering", "crispedges").attr("opacity", .1)
  105. }, e.prototype.buildAxisLabel = function() {
  106. var t, e, n = this.canvas;
  107. t = n.selectAll("text.x.axis-label").data(function(t) {
  108. return [t.xLabel].filter(Boolean)
  109. }), t.enter().append("text").attr("class", "x axis-label").attr("text-anchor", "end"), t.attr("x", l).attr("y", h - 6).text(function(t) {
  110. return t
  111. }), t.exit().remove(), e = n.selectAll("text.y.axis-label").data(function(t) {
  112. return [t.yLabel].filter(Boolean)
  113. }), e.enter().append("text").attr("class", "y axis-label").attr("y", 6).attr("dy", ".75em").attr("text-anchor", "end").attr("transform", "rotate(-90)"), e.text(function(t) {
  114. return t
  115. }), e.exit().remove()
  116. }, e.prototype.buildContent = function() {
  117. var t = this,
  118. e = this.canvas,
  119. n = this.content = e.selectAll("g.content").data(function(t) {
  120. return [t]
  121. });
  122. n.enter().append("g").attr("clip-path", "url(#function-plot-clip-" + this.id + ")").attr("class", "content");
  123. var s = n.selectAll("path.y.origin").data([
  124. [
  125. [0, v.domain()[0]],
  126. [0, v.domain()[1]]
  127. ]
  128. ]);
  129. s.enter().append("path").attr("class", "y origin").attr("stroke", "#eee"), s.attr("d", m);
  130. var o = n.selectAll("path.x.origin").data([
  131. [
  132. [d.domain()[0], 0],
  133. [d.domain()[1], 0]
  134. ]
  135. ]);
  136. o.enter().append("path").attr("class", "x origin").attr("stroke", "#eee"), o.attr("d", m);
  137. var l = n.selectAll("g.graph").data(function(t) {
  138. return t.data
  139. });
  140. l.enter().append("g").attr("class", "graph"), l.each(function(e, n) {
  141. var s = a({
  142. owner: t,
  143. index: n
  144. }, e.graphOptions),
  145. o = s.type || "line";
  146. i.select(this).call(r[o](s)), i.select(this).call(c(s))
  147. })
  148. }, e.prototype.buildZoomHelper = function() {
  149. var t = this;
  150. this.canvas.enter.append("rect").attr("class", "zoom-and-drag").style("fill", "none").style("pointer-events", "all"), this.canvas.select(".zoom-and-drag").attr("width", l).attr("height", h).on("mouseover", function() {
  151. t.emit("all:mouseover")
  152. }).on("mouseout", function() {
  153. t.emit("all:mouseout")
  154. }).on("mousemove", function() {
  155. t.emit("all:mousemove")
  156. })
  157. }, e.prototype.addLink = function() {
  158. for (var t = 0; t < arguments.length; t += 1) this.linkedGraphs.push(arguments[t])
  159. }, e.prototype.getFontSize = function() {
  160. var fontSize = Math.max(Math.max(l, h) / 60, 8)
  161. if (fontSize > 15) {
  162. fontSize = 15;
  163. }
  164. return fontSize
  165. }, e.prototype.setUpEventListeners = function() {
  166. var t = this,
  167. e = {
  168. mousemove: function(e, n) {
  169. t.tip.move(e, n)
  170. },
  171. mouseover: function() {
  172. t.tip.show()
  173. },
  174. mouseout: function() {
  175. t.tip.hide()
  176. },
  177. draw: function() {
  178. t.buildContent()
  179. },
  180. "zoom:scaleUpdate": function(t, e) {
  181. f.x(d.domain(t.domain())).y(v.domain(e.domain()))
  182. },
  183. "tip:update": function(e, r, i) {
  184. var s = t.root.datum().data[i],
  185. a = s.title || "",
  186. o = s.renderer || function(t, e) {
  187. return t.toFixed(3) + ", " + e.toFixed(3)
  188. },
  189. l = [];
  190. a && l.push(a), l.push(o(e, r)), t.root.select(".top-right-legend").attr("fill", n.COLORS[i]).text(l.join(" "))
  191. }
  192. },
  193. r = {
  194. mousemove: function() {
  195. var e = i.mouse(t.root.select("rect.zoom-and-drag").node()),
  196. n = d.invert(e[0]),
  197. r = v.invert(e[1]);
  198. t.linkedGraphs.forEach(function(t) {
  199. t.emit("mousemove", n, r)
  200. })
  201. },
  202. zoom: function(e, n) {
  203. t.linkedGraphs.forEach(function(t, r) {
  204. var i = t.canvas;
  205. i.select(".x.axis").call(t.meta.xAxis), i.select(".y.axis").call(t.meta.yAxis), r && t.emit("zoom:scaleUpdate", e, n), t.emit("draw")
  206. }), t.emit("all:mousemove")
  207. }
  208. };
  209. Object.keys(e).forEach(function(n) {
  210. t.on(n, e[n]), !r[n] && t.on("all:" + n, function() {
  211. var e = Array.prototype.slice.call(arguments);
  212. t.linkedGraphs.forEach(function(t) {
  213. var r = e.slice();
  214. r.unshift(n), t.emit.apply(t, r)
  215. })
  216. })
  217. }), Object.keys(r).forEach(function(e) {
  218. t.on("all:" + e, r[e])
  219. })
  220. }, new e
  221. }, n = e.exports.constants = t("./lib/constants"), r = e.exports.types = t("./lib/types/")
  222. }, {
  223. "./lib/constants": 3,
  224. "./lib/helper/": 6,
  225. "./lib/tip": 7,
  226. "./lib/types/": 8,
  227. "./lib/utils": 11,
  228. events: 2,
  229. extend: 12
  230. }],
  231. 2: [function(t, e) {
  232. function n() {
  233. this._events = this._events || {}, this._maxListeners = this._maxListeners || void 0
  234. }
  235. function r(t) {
  236. return "function" == typeof t
  237. }
  238. function i(t) {
  239. return "number" == typeof t
  240. }
  241. function s(t) {
  242. return "object" == typeof t && null !== t
  243. }
  244. function a(t) {
  245. return void 0 === t
  246. }
  247. e.exports = n, n.EventEmitter = n, n.prototype._events = void 0, n.prototype._maxListeners = void 0, n.defaultMaxListeners = 10, n.prototype.setMaxListeners = function(t) {
  248. if (!i(t) || 0 > t || isNaN(t)) throw TypeError("n must be a positive number");
  249. return this._maxListeners = t, this
  250. }, n.prototype.emit = function(t) {
  251. var e, n, i, o, l, c;
  252. if (this._events || (this._events = {}), "error" === t && (!this._events.error || s(this._events.error) && !this._events.error.length)) {
  253. if (e = arguments[1], e instanceof Error) throw e;
  254. throw TypeError('Uncaught, unspecified "error" event.')
  255. }
  256. if (n = this._events[t], a(n)) return !1;
  257. if (r(n)) switch (arguments.length) {
  258. case 1:
  259. n.call(this);
  260. break;
  261. case 2:
  262. n.call(this, arguments[1]);
  263. break;
  264. case 3:
  265. n.call(this, arguments[1], arguments[2]);
  266. break;
  267. default:
  268. for (i = arguments.length, o = new Array(i - 1), l = 1; i > l; l++) o[l - 1] = arguments[l];
  269. n.apply(this, o)
  270. } else if (s(n)) {
  271. for (i = arguments.length, o = new Array(i - 1), l = 1; i > l; l++) o[l - 1] = arguments[l];
  272. for (c = n.slice(), i = c.length, l = 0; i > l; l++) c[l].apply(this, o)
  273. }
  274. return !0
  275. }, n.prototype.addListener = function(t, e) {
  276. var i;
  277. if (!r(e)) throw TypeError("listener must be a function");
  278. if (this._events || (this._events = {}), this._events.newListener && this.emit("newListener", t, r(e.listener) ? e.listener : e), this._events[t] ? s(this._events[t]) ? this._events[t].push(e) : this._events[t] = [this._events[t], e] : this._events[t] = e, s(this._events[t]) && !this._events[t].warned) {
  279. var i;
  280. i = a(this._maxListeners) ? n.defaultMaxListeners : this._maxListeners, i && i > 0 && this._events[t].length > i && (this._events[t].warned = !0, console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", this._events[t].length), "function" == typeof console.trace && console.trace())
  281. }
  282. return this
  283. }, n.prototype.on = n.prototype.addListener, n.prototype.once = function(t, e) {
  284. function n() {
  285. this.removeListener(t, n), i || (i = !0, e.apply(this, arguments))
  286. }
  287. if (!r(e)) throw TypeError("listener must be a function");
  288. var i = !1;
  289. return n.listener = e, this.on(t, n), this
  290. }, n.prototype.removeListener = function(t, e) {
  291. var n, i, a, o;
  292. if (!r(e)) throw TypeError("listener must be a function");
  293. if (!this._events || !this._events[t]) return this;
  294. if (n = this._events[t], a = n.length, i = -1, n === e || r(n.listener) && n.listener === e) delete this._events[t], this._events.removeListener && this.emit("removeListener", t, e);
  295. else if (s(n)) {
  296. for (o = a; o-- > 0;)
  297. if (n[o] === e || n[o].listener && n[o].listener === e) {
  298. i = o;
  299. break
  300. }
  301. if (0 > i) return this;
  302. 1 === n.length ? (n.length = 0, delete this._events[t]) : n.splice(i, 1), this._events.removeListener && this.emit("removeListener", t, e)
  303. }
  304. return this
  305. }, n.prototype.removeAllListeners = function(t) {
  306. var e, n;
  307. if (!this._events) return this;
  308. if (!this._events.removeListener) return 0 === arguments.length ? this._events = {} : this._events[t] && delete this._events[t], this;
  309. if (0 === arguments.length) {
  310. for (e in this._events) "removeListener" !== e && this.removeAllListeners(e);
  311. return this.removeAllListeners("removeListener"), this._events = {}, this
  312. }
  313. if (n = this._events[t], r(n)) this.removeListener(t, n);
  314. else
  315. for (; n.length;) this.removeListener(t, n[n.length - 1]);
  316. return delete this._events[t], this
  317. }, n.prototype.listeners = function(t) {
  318. var e;
  319. return e = this._events && this._events[t] ? r(this._events[t]) ? [this._events[t]] : this._events[t].slice() : []
  320. }, n.listenerCount = function(t, e) {
  321. var n;
  322. return n = t._events && t._events[e] ? r(t._events[e]) ? 1 : t._events[e].length : 0
  323. }
  324. }, {}],
  325. 3: [function(t, e) {
  326. "use strict";
  327. var n = window.d3;
  328. e.exports = {
  329. COLORS: ["steelblue", "red", "#05b378", "orange", "#4040e8", "yellow"].map(function(t) {
  330. return n.hsl(t)
  331. }),
  332. ITERATIONS_LIMIT: 1e3,
  333. DEFAULT_WIDTH: 550,
  334. DEFAULT_HEIGHT: 350,
  335. TIP_X_EPS: 1
  336. }
  337. }, {}],
  338. 4: [function(t, e) {
  339. "use strict";
  340. var n = t("./utils"),
  341. r = t("./constants"),
  342. i = n.assert;
  343. e.exports = {
  344. range: function(t, e) {
  345. var n = e.range || [-1 / 0, 1 / 0],
  346. r = t.meta.xScale,
  347. i = Math.max(r.domain()[0], n[0]),
  348. s = Math.min(r.domain()[1], n[1]);
  349. return [i, s]
  350. },
  351. eval: function(t, e) {
  352. i("function" == typeof e.fn);
  353. var s = [],
  354. a = this.range(t, e),
  355. o = a[0],
  356. l = a[1],
  357. c = e.samples || 100,
  358. u = e.deltaX;
  359. u || (u = (l - o) / c);
  360. var h = (l - o) / u;
  361. h = h || 1, i(h >= 0), h > r.ITERATIONS_LIMIT && (h = r.ITERATIONS_LIMIT, u = (l - o) / h);
  362. for (var p = 0; h >= p; p += 1) {
  363. var f = o + u * p,
  364. d = e.fn(f);
  365. n.isValidNumber(f) && n.isValidNumber(d) && s.push([f, d])
  366. }
  367. return s = this.split(s, e.graphOptions)
  368. },
  369. split: function(t, e) {
  370. e = e || {};
  371. var n = .001,
  372. r = Array.prototype.slice.call(e.limits || []),
  373. i = [],
  374. s = 0,
  375. a = 1,
  376. o = [];
  377. for (r.unshift(-1e8), r.push(1e8); s < t.length;) {
  378. for (; s < t.length && t[s][0] < r[a - 1] + n;) ++s;
  379. for (o = []; s < t.length && t[s][0] >= r[a - 1] + n && t[s][0] <= r[a] - n;) o.push(t[s++]);
  380. ++a, o.length && i.push(o)
  381. }
  382. return i
  383. }
  384. }
  385. }, {
  386. "./constants": 3,
  387. "./utils": 11
  388. }],
  389. 5: [function(t, e) {
  390. "use strict";
  391. var n = window.d3,
  392. r = t("../types/line");
  393. e.exports = function(t) {
  394. function e(t) {
  395. var e = t.derivative.x0,
  396. n = t.fn(e),
  397. r = t.derivative.fn(e);
  398. a.fn = function(t) {
  399. return r * (t - e) + n
  400. }
  401. }
  402. function i(e) {
  403. var n = this;
  404. e.derivative.updateOnMouseOver && !e.derivative.$$mouseListener && (e.derivative.$$mouseListener = function(t) {
  405. e.derivative.x0 = t, s(n)
  406. }, t.owner.on("tip:update", e.derivative.$$mouseListener))
  407. }
  408. var s, a = {
  409. skipTip: !0
  410. };
  411. return s = function(s) {
  412. s.each(function(o) {
  413. var l = n.select(this);
  414. e.call(s, o), i.call(s, o);
  415. var c = l.selectAll("g.derivative").data([a]);
  416. c.enter().append("g").attr("class", "derivative"), c.call(r(t)), c.selectAll("path").attr("opacity", .5)
  417. })
  418. }
  419. }
  420. }, {
  421. "../types/line": 9
  422. }],
  423. 6: [function(t, e) {
  424. "use strict";
  425. var n = window.d3,
  426. r = t("./derivative");
  427. e.exports = function(t) {
  428. function e(e) {
  429. e.each(function(e) {
  430. var i = n.select(this);
  431. e.derivative && i.call(r(t))
  432. })
  433. }
  434. return e
  435. }
  436. }, {
  437. "./derivative": 5
  438. }],
  439. 7: [function(t, e) {
  440. "use strict";
  441. var n = window.d3,
  442. r = t("extend"),
  443. i = t("./utils"),
  444. s = t("./constants");
  445. e.exports = function(t) {
  446. function e(t, e) {
  447. return t.append("path").datum(e).attr("stroke", "grey").attr("stroke-dasharray", "5,5").attr("opacity", .5).attr("d", l)
  448. }
  449. function a(r) {
  450. var i = r.selectAll("g.tip").data(function(t) {
  451. return [t]
  452. });
  453. i.enter().append("g").attr("class", "tip").attr("clip-path", "url(#function-plot-clip-" + t.owner.id + ")"), a.el = i.selectAll("g.inner-tip").data(function(t) {
  454. return [t]
  455. }), a.el.enter().append("g").attr("class", "inner-tip").style("display", "none").each(function() {
  456. var r = n.select(this);
  457. e(r, [
  458. [0, -t.owner.meta.height - o],
  459. [0, t.owner.meta.height + o]
  460. ]).attr("class", "tip-x-line").style("display", "none"), e(r, [
  461. [-t.owner.meta.width - o, 0],
  462. [t.owner.meta.width + o, 0]
  463. ]).attr("class", "tip-y-line").style("display", "none"), r.append("circle").attr("r", 3), r.append("text").attr("transform", "translate(5,-5)")
  464. }), r.selectAll(".tip-x-line").style("display", t.xLine ? null : "none"), r.selectAll(".tip-y-line").style("display", t.yLine ? null : "none")
  465. }
  466. t = r({
  467. xLine: !1,
  468. yLine: !1,
  469. renderer: function(t, e) {
  470. return "(" + t.toFixed(3) + ", " + e.toFixed(3) + ")"
  471. },
  472. owner: null
  473. }, t);
  474. var o = 20,
  475. l = n.svg.line().x(function(t) {
  476. return t[0]
  477. }).y(function(t) {
  478. return t[1]
  479. });
  480. return a.move = function(e, n) {
  481. var r, l, c, u = 1 / 0,
  482. h = -1,
  483. p = a.el,
  484. f = 1e8,
  485. d = t.owner.meta,
  486. v = p.data()[0].data,
  487. m = d.xScale,
  488. y = d.yScale,
  489. x = d.width,
  490. g = d.height;
  491. for (r = 0; r < v.length; r += 1)
  492. if (!v[r].skipTip) {
  493. var b = v[r].range || [-f, f];
  494. if (e > b[0] - s.TIP_X_EPS && e < b[1] + s.TIP_X_EPS) {
  495. var w = v[r].fn(e);
  496. if (i.isValidNumber(w)) {
  497. var _ = Math.abs(w - n);
  498. u > _ && (u = _, h = r)
  499. }
  500. }
  501. }
  502. if (-1 !== h) {
  503. l = e, v[h].range && (l = Math.max(l, v[h].range[0]), l = Math.min(l, v[h].range[1])), c = v[h].fn(l), a.show(), t.owner.emit("tip:update", l, c, h);
  504. var L = i.restrict(l, m.invert(-o), m.invert(x + o)),
  505. A = i.restrict(c, y.invert(g + o), y.invert(-o));
  506. p.attr("transform", "translate(" + m(L) + "," + y(A) + ")"), p.select("circle").attr("fill", s.COLORS[h]), p.select("text").attr("fill", s.COLORS[h]).text(t.renderer(l, c))
  507. } else a.hide()
  508. }, a.show = function() {
  509. this.el.style("display", null)
  510. }, a.hide = function() {
  511. this.el.style("display", "none")
  512. }, Object.keys(t).forEach(function(e) {
  513. i.getterSetter.call(a, t, e)
  514. }), a
  515. }
  516. }, {
  517. "./constants": 3,
  518. "./utils": 11,
  519. extend: 12
  520. }],
  521. 8: [function(t, e) {
  522. "use strict";
  523. e.exports = {
  524. line: t("./line"),
  525. scatter: t("./scatter")
  526. }
  527. }, {
  528. "./line": 9,
  529. "./scatter": 10
  530. }],
  531. 9: [function(t, e) {
  532. "use strict";
  533. var n = window.d3,
  534. r = t("../constants"),
  535. i = t("../data");
  536. e.exports = function(t) {
  537. function e(s) {
  538. var a = t.index;
  539. s.each(function(s) {
  540. var c = e.el = n.select(this),
  541. u = i.eval(t.owner, s),
  542. h = c.selectAll("path").data(u);
  543. h.enter().append("path").attr("class", "line line-" + a).attr("stroke", r.COLORS[a]), h.each(function() {
  544. var e, i = n.select(this);
  545. t.closed ? (i.attr("fill", r.COLORS[a]), i.attr("fill-opacity", .3), e = l) : (i.attr("fill", "none"), e = o), i.attr("d", e)
  546. }), h.exit().remove()
  547. })
  548. }
  549. var s = t.owner.meta.xScale,
  550. a = t.owner.meta.yScale,
  551. o = n.svg.line().interpolate(t.interpolate || "cardinal").x(function(t) {
  552. return s(t[0])
  553. }).y(function(t) {
  554. return a(t[1])
  555. }),
  556. l = n.svg.area().x(function(t) {
  557. return s(t[0])
  558. }).y0(a(0)).y1(function(t) {
  559. return a(t[1])
  560. });
  561. return e
  562. }
  563. }, {
  564. "../constants": 3,
  565. "../data": 4
  566. }],
  567. 10: [function(t, e) {
  568. "use strict";
  569. var n = window.d3,
  570. r = t("../constants"),
  571. i = t("../data");
  572. e.exports = function(t) {
  573. function e(e) {
  574. var o = t.index;
  575. e.each(function(e) {
  576. var l, c, u = n.hsl(r.COLORS[o].toString()),
  577. h = i.eval(t.owner, e),
  578. p = [];
  579. for (l = 0; l < h.length; l += 1)
  580. for (c = 0; c < h[l].length; c += 1) p.push(h[l][c]);
  581. var f = n.select(this).selectAll("circle").data(p);
  582. f.enter().append("circle").attr("class", "circle circle-" + o).attr("fill", n.hsl(u.toString()).brighter(1.5)).attr("stroke", u), f.attr("opacity", .7).attr("r", 1).attr("cx", function(t) {
  583. return s(t[0])
  584. }).attr("cy", function(t) {
  585. return a(t[1])
  586. }), f.exit().remove()
  587. })
  588. }
  589. var s = t.owner.meta.xScale,
  590. a = t.owner.meta.yScale;
  591. return e
  592. }
  593. }, {
  594. "../constants": 3,
  595. "../data": 4
  596. }],
  597. 11: [function(t, e) {
  598. "use strict";
  599. e.exports = {
  600. isValidNumber: function(t) {
  601. return "number" == typeof t && !isNaN(t) && isFinite(t)
  602. },
  603. getterSetter: function(t, e) {
  604. var n = this;
  605. this[e] = function(r) {
  606. return arguments.length ? (t[e] = r, n) : t[e]
  607. }
  608. },
  609. restrict: function(t, e, n) {
  610. if (e > n) {
  611. var r = e;
  612. e = n, n = r
  613. }
  614. return t = Math.max(t, e), t = Math.min(t, n)
  615. },
  616. assert: function(t, e) {
  617. if (e = e || "assertion failed", !t) throw new Error(e)
  618. }
  619. }
  620. }, {}],
  621. 12: [function(t, e) {
  622. var n, r = Object.prototype.hasOwnProperty,
  623. i = Object.prototype.toString,
  624. s = function(t) {
  625. "use strict";
  626. if (!t || "[object Object]" !== i.call(t)) return !1;
  627. var e = r.call(t, "constructor"),
  628. s = t.constructor && t.constructor.prototype && r.call(t.constructor.prototype, "isPrototypeOf");
  629. if (t.constructor && !e && !s) return !1;
  630. var a;
  631. for (a in t);
  632. return a === n || r.call(t, a)
  633. };
  634. e.exports = function a() {
  635. "use strict";
  636. var t, e, r, i, o, l, c = arguments[0],
  637. u = 1,
  638. h = arguments.length,
  639. p = !1;
  640. for ("boolean" == typeof c ? (p = c, c = arguments[1] || {}, u = 2) : ("object" != typeof c && "function" != typeof c || null == c) && (c = {}); h > u; ++u)
  641. if (t = arguments[u], null != t)
  642. for (e in t) r = c[e], i = t[e], c !== i && (p && i && (s(i) || (o = Array.isArray(i))) ? (o ? (o = !1, l = r && Array.isArray(r) ? r : []) : l = r && s(r) ? r : {}, c[e] = a(p, l, i)) : i !== n && (c[e] = i));
  643. return c
  644. }
  645. }, {}]
  646. }, {}, [1])(1)
  647. });