From ef03469fec14f1f0358b690934fc173d744f4e7d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 17:26:01 +0200 Subject: Adding debian version 5.6.0-1. Signed-off-by: Daniel Baumann --- debian/NEWS | 40 + debian/README.source | 70 + debian/TODO | 8 + debian/changelog | 1109 ++ debian/clean | 5 + debian/control | 113 + debian/copyright | 391 + debian/docs | 1 + debian/gbp.conf | 10 + debian/init-d-script | 239 + debian/knot-resolver-doc.doc-base | 12 + debian/knot-resolver-doc.docs | 1 + debian/knot-resolver-doc.links | 2 + debian/knot-resolver-module-http.install | 7 + debian/knot-resolver-module-http.links | 6 + debian/knot-resolver-module-tinyweb.install | 1 + debian/knot-resolver.dirs | 3 + debian/knot-resolver.install | 36 + debian/knot-resolver.kresd.default | 13 + debian/knot-resolver.kresd.init | 59 + debian/knot-resolver.links | 2 + debian/knot-resolver.lintian-overrides | 9 + debian/knot-resolver.postinst.in | 43 + debian/knot-resolver.postrm | 8 + debian/knot-resolver.preinst | 29 + debian/knot-resolver.templates | 17 + debian/knot-resolver.triggers | 1 + debian/missing-sources/bootstrap-theme.css | 587 + debian/missing-sources/bootstrap.css | 6760 ++++++++++ debian/missing-sources/bootstrap.js | 2363 ++++ debian/missing-sources/d3.js | 9550 +++++++++++++++ debian/missing-sources/datamaps.world.js | 12241 +++++++++++++++++++ debian/missing-sources/dygraph.js | 9464 ++++++++++++++ debian/missing-sources/epoch.css | 1494 +++ debian/missing-sources/epoch.js | 3924 ++++++ debian/missing-sources/epoch/.travis.yml | 4 + debian/missing-sources/epoch/CHANGELOG.md | 102 + debian/missing-sources/epoch/LICENSE | 21 + debian/missing-sources/epoch/README.md | 135 + debian/missing-sources/epoch/bower.json | 37 + debian/missing-sources/epoch/composer.json | 22 + debian/missing-sources/epoch/gulpfile.js | 108 + debian/missing-sources/epoch/package.json | 55 + debian/missing-sources/epoch/sass/_core.scss | 99 + debian/missing-sources/epoch/sass/epoch.scss | 12 + .../missing-sources/epoch/sass/themes/_dark.scss | 95 + .../epoch/sass/themes/_default.scss | 189 + debian/missing-sources/epoch/src/adapters.coffee | 13 + .../epoch/src/adapters/MooTools.coffee | 19 + .../epoch/src/adapters/jQuery.coffee | 18 + .../epoch/src/adapters/zepto.coffee | 27 + debian/missing-sources/epoch/src/basic.coffee | 243 + debian/missing-sources/epoch/src/basic/area.coffee | 51 + debian/missing-sources/epoch/src/basic/bar.coffee | 273 + .../epoch/src/basic/histogram.coffee | 61 + debian/missing-sources/epoch/src/basic/line.coffee | 46 + debian/missing-sources/epoch/src/basic/pie.coffee | 59 + .../missing-sources/epoch/src/basic/scatter.coffee | 59 + debian/missing-sources/epoch/src/core/chart.coffee | 361 + .../missing-sources/epoch/src/core/context.coffee | 25 + debian/missing-sources/epoch/src/core/css.coffee | 131 + debian/missing-sources/epoch/src/core/d3.coffee | 25 + .../missing-sources/epoch/src/core/format.coffee | 15 + debian/missing-sources/epoch/src/core/util.coffee | 236 + debian/missing-sources/epoch/src/data.coffee | 311 + debian/missing-sources/epoch/src/epoch.coffee | 17 + debian/missing-sources/epoch/src/model.coffee | 55 + debian/missing-sources/epoch/src/time.coffee | 615 + debian/missing-sources/epoch/src/time/area.coffee | 80 + debian/missing-sources/epoch/src/time/bar.coffee | 48 + debian/missing-sources/epoch/src/time/gauge.coffee | 209 + .../missing-sources/epoch/src/time/heatmap.coffee | 261 + debian/missing-sources/epoch/src/time/line.coffee | 39 + .../epoch/tests/render/basic/area.html | 450 + .../epoch/tests/render/basic/bar.html | 745 ++ .../epoch/tests/render/basic/histogram.html | 155 + .../epoch/tests/render/basic/line.html | 471 + .../epoch/tests/render/basic/model.html | 94 + .../epoch/tests/render/basic/options.html | 267 + .../epoch/tests/render/basic/pie.html | 346 + .../epoch/tests/render/basic/scatter.html | 398 + .../epoch/tests/render/css/tests.css | 12 + .../missing-sources/epoch/tests/render/index.html | 57 + .../missing-sources/epoch/tests/render/js/data.js | 210 + .../epoch/tests/render/real-time/area.html | 494 + .../epoch/tests/render/real-time/bar.html | 484 + .../epoch/tests/render/real-time/gauge.html | 283 + .../epoch/tests/render/real-time/heatmap.html | 559 + .../epoch/tests/render/real-time/line.html | 596 + .../epoch/tests/render/real-time/model.html | 85 + .../epoch/tests/render/real-time/options.html | 299 + .../epoch/tests/render/themes/dark.html | 211 + .../epoch/tests/render/themes/default.html | 70 + .../epoch/tests/unit/core/charts.coffee | 573 + .../epoch/tests/unit/core/copy.coffee | 47 + .../epoch/tests/unit/core/css.coffee | 85 + .../epoch/tests/unit/core/d3.coffee | 40 + .../epoch/tests/unit/core/events.coffee | 111 + .../epoch/tests/unit/core/format.coffee | 68 + .../epoch/tests/unit/core/is.coffee | 88 + .../epoch/tests/unit/core/util.coffee | 92 + .../epoch/tests/unit/data/array_format.coffee | 106 + .../epoch/tests/unit/data/chart.coffee | 121 + .../epoch/tests/unit/data/keyvalue_format.coffee | 101 + .../epoch/tests/unit/data/tuple_format.coffee | 76 + .../missing-sources/epoch/tests/unit/init.coffee | 55 + .../missing-sources/epoch/tests/unit/time.coffee | 67 + .../epoch/tests/unit/time/line.coffee | 15 + debian/missing-sources/jquery.js | 9210 ++++++++++++++ debian/missing-sources/selectize.bootstrap3.css | 407 + debian/missing-sources/selectize.css | 323 + debian/missing-sources/selectize.js | 3124 +++++ debian/missing-sources/topojson.js | 534 + debian/not-installed | 9 + debian/po/POTFILES.in | 1 + debian/po/de.po | 69 + debian/po/es.po | 68 + debian/po/fr.po | 73 + debian/po/nl.po | 71 + debian/po/pt.po | 71 + debian/po/templates.pot | 58 + debian/rules | 57 + debian/salsa-ci.yml | 7 + debian/source/format | 1 + debian/source/lintian-overrides | 9 + debian/tests/control | 6 + debian/tests/roundtrip | 134 + debian/upstream/signing-key.asc | 126 + debian/watch | 4 + 129 files changed, 75087 insertions(+) create mode 100644 debian/NEWS create mode 100644 debian/README.source create mode 100644 debian/TODO create mode 100644 debian/changelog create mode 100644 debian/clean create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/docs create mode 100644 debian/gbp.conf create mode 100755 debian/init-d-script create mode 100644 debian/knot-resolver-doc.doc-base create mode 100644 debian/knot-resolver-doc.docs create mode 100644 debian/knot-resolver-doc.links create mode 100644 debian/knot-resolver-module-http.install create mode 100644 debian/knot-resolver-module-http.links create mode 100644 debian/knot-resolver-module-tinyweb.install create mode 100644 debian/knot-resolver.dirs create mode 100644 debian/knot-resolver.install create mode 100644 debian/knot-resolver.kresd.default create mode 100644 debian/knot-resolver.kresd.init create mode 100644 debian/knot-resolver.links create mode 100644 debian/knot-resolver.lintian-overrides create mode 100644 debian/knot-resolver.postinst.in create mode 100644 debian/knot-resolver.postrm create mode 100644 debian/knot-resolver.preinst create mode 100644 debian/knot-resolver.templates create mode 100644 debian/knot-resolver.triggers create mode 100644 debian/missing-sources/bootstrap-theme.css create mode 100644 debian/missing-sources/bootstrap.css create mode 100644 debian/missing-sources/bootstrap.js create mode 100644 debian/missing-sources/d3.js create mode 100644 debian/missing-sources/datamaps.world.js create mode 100644 debian/missing-sources/dygraph.js create mode 100644 debian/missing-sources/epoch.css create mode 100644 debian/missing-sources/epoch.js create mode 100644 debian/missing-sources/epoch/.travis.yml create mode 100644 debian/missing-sources/epoch/CHANGELOG.md create mode 100644 debian/missing-sources/epoch/LICENSE create mode 100644 debian/missing-sources/epoch/README.md create mode 100644 debian/missing-sources/epoch/bower.json create mode 100644 debian/missing-sources/epoch/composer.json create mode 100644 debian/missing-sources/epoch/gulpfile.js create mode 100644 debian/missing-sources/epoch/package.json create mode 100644 debian/missing-sources/epoch/sass/_core.scss create mode 100644 debian/missing-sources/epoch/sass/epoch.scss create mode 100644 debian/missing-sources/epoch/sass/themes/_dark.scss create mode 100644 debian/missing-sources/epoch/sass/themes/_default.scss create mode 100644 debian/missing-sources/epoch/src/adapters.coffee create mode 100644 debian/missing-sources/epoch/src/adapters/MooTools.coffee create mode 100644 debian/missing-sources/epoch/src/adapters/jQuery.coffee create mode 100644 debian/missing-sources/epoch/src/adapters/zepto.coffee create mode 100644 debian/missing-sources/epoch/src/basic.coffee create mode 100644 debian/missing-sources/epoch/src/basic/area.coffee create mode 100644 debian/missing-sources/epoch/src/basic/bar.coffee create mode 100644 debian/missing-sources/epoch/src/basic/histogram.coffee create mode 100644 debian/missing-sources/epoch/src/basic/line.coffee create mode 100644 debian/missing-sources/epoch/src/basic/pie.coffee create mode 100644 debian/missing-sources/epoch/src/basic/scatter.coffee create mode 100644 debian/missing-sources/epoch/src/core/chart.coffee create mode 100644 debian/missing-sources/epoch/src/core/context.coffee create mode 100644 debian/missing-sources/epoch/src/core/css.coffee create mode 100644 debian/missing-sources/epoch/src/core/d3.coffee create mode 100644 debian/missing-sources/epoch/src/core/format.coffee create mode 100644 debian/missing-sources/epoch/src/core/util.coffee create mode 100644 debian/missing-sources/epoch/src/data.coffee create mode 100644 debian/missing-sources/epoch/src/epoch.coffee create mode 100644 debian/missing-sources/epoch/src/model.coffee create mode 100644 debian/missing-sources/epoch/src/time.coffee create mode 100644 debian/missing-sources/epoch/src/time/area.coffee create mode 100644 debian/missing-sources/epoch/src/time/bar.coffee create mode 100644 debian/missing-sources/epoch/src/time/gauge.coffee create mode 100644 debian/missing-sources/epoch/src/time/heatmap.coffee create mode 100644 debian/missing-sources/epoch/src/time/line.coffee create mode 100644 debian/missing-sources/epoch/tests/render/basic/area.html create mode 100644 debian/missing-sources/epoch/tests/render/basic/bar.html create mode 100644 debian/missing-sources/epoch/tests/render/basic/histogram.html create mode 100644 debian/missing-sources/epoch/tests/render/basic/line.html create mode 100644 debian/missing-sources/epoch/tests/render/basic/model.html create mode 100644 debian/missing-sources/epoch/tests/render/basic/options.html create mode 100644 debian/missing-sources/epoch/tests/render/basic/pie.html create mode 100644 debian/missing-sources/epoch/tests/render/basic/scatter.html create mode 100644 debian/missing-sources/epoch/tests/render/css/tests.css create mode 100644 debian/missing-sources/epoch/tests/render/index.html create mode 100644 debian/missing-sources/epoch/tests/render/js/data.js create mode 100644 debian/missing-sources/epoch/tests/render/real-time/area.html create mode 100644 debian/missing-sources/epoch/tests/render/real-time/bar.html create mode 100644 debian/missing-sources/epoch/tests/render/real-time/gauge.html create mode 100644 debian/missing-sources/epoch/tests/render/real-time/heatmap.html create mode 100644 debian/missing-sources/epoch/tests/render/real-time/line.html create mode 100644 debian/missing-sources/epoch/tests/render/real-time/model.html create mode 100644 debian/missing-sources/epoch/tests/render/real-time/options.html create mode 100644 debian/missing-sources/epoch/tests/render/themes/dark.html create mode 100644 debian/missing-sources/epoch/tests/render/themes/default.html create mode 100644 debian/missing-sources/epoch/tests/unit/core/charts.coffee create mode 100644 debian/missing-sources/epoch/tests/unit/core/copy.coffee create mode 100644 debian/missing-sources/epoch/tests/unit/core/css.coffee create mode 100644 debian/missing-sources/epoch/tests/unit/core/d3.coffee create mode 100644 debian/missing-sources/epoch/tests/unit/core/events.coffee create mode 100644 debian/missing-sources/epoch/tests/unit/core/format.coffee create mode 100644 debian/missing-sources/epoch/tests/unit/core/is.coffee create mode 100644 debian/missing-sources/epoch/tests/unit/core/util.coffee create mode 100644 debian/missing-sources/epoch/tests/unit/data/array_format.coffee create mode 100644 debian/missing-sources/epoch/tests/unit/data/chart.coffee create mode 100644 debian/missing-sources/epoch/tests/unit/data/keyvalue_format.coffee create mode 100644 debian/missing-sources/epoch/tests/unit/data/tuple_format.coffee create mode 100644 debian/missing-sources/epoch/tests/unit/init.coffee create mode 100644 debian/missing-sources/epoch/tests/unit/time.coffee create mode 100644 debian/missing-sources/epoch/tests/unit/time/line.coffee create mode 100644 debian/missing-sources/jquery.js create mode 100644 debian/missing-sources/selectize.bootstrap3.css create mode 100644 debian/missing-sources/selectize.css create mode 100644 debian/missing-sources/selectize.js create mode 100644 debian/missing-sources/topojson.js create mode 100644 debian/not-installed create mode 100644 debian/po/POTFILES.in create mode 100644 debian/po/de.po create mode 100644 debian/po/es.po create mode 100644 debian/po/fr.po create mode 100644 debian/po/nl.po create mode 100644 debian/po/pt.po create mode 100644 debian/po/templates.pot create mode 100755 debian/rules create mode 100644 debian/salsa-ci.yml create mode 100644 debian/source/format create mode 100644 debian/source/lintian-overrides create mode 100644 debian/tests/control create mode 100755 debian/tests/roundtrip create mode 100644 debian/upstream/signing-key.asc create mode 100644 debian/watch (limited to 'debian') diff --git a/debian/NEWS b/debian/NEWS new file mode 100644 index 0000000..5df8f90 --- /dev/null +++ b/debian/NEWS @@ -0,0 +1,40 @@ +knot-resolver (5.1.2-1) unstable; urgency=medium + + Up to Knot Resolver 4.x, network interface bindings and service + start were done by default via systemd sockets. These systemd sockets + are no longer supported, and upgrading from a 3.x version (as in Debian + Buster) requires manual action to (re)enable the service. + + Please refer to kresd.systemd(7) and to the + /usr/share/doc/knot-resolver/upgrading.html file (from + knot-resolver-doc). An online version of the latter is available at + https://knot-resolver.readthedocs.io/en/stable/upgrading.html#x-to-5-x + + For convenience, a suggested networking configuration can be found in + the file /var/lib/knot-resolver/.upgrade-4-to-5/kresd.conf.net + + -- Santiago Ruano Rincón Tue, 28 Jul 2020 14:48:09 +0200 + +knot-resolver (2.0.0-1) unstable; urgency=medium + + Knot Resolver systemd service units are now templated, so that multiple + processes can run concurrently on multi-core systems. For a full + overview of the status of all the running daemons, use: + + systemctl status system-kresd.slice + + For more information about this setup, please see kresd.systemd(7). + + -- Daniel Kahn Gillmor Sat, 03 Feb 2018 22:51:02 -0500 + +knot-resolver (1.1.0~git2016072900-1) unstable; urgency=medium + + Knot Resolver now starts and runs under unprivileged user and uses a + socket activations to bind on the privileged ports. That means that if + you use anything more complicated than that you need to either override + the default service file with `systemd edit kresd.service` and + `systemd edit kresd.socket` to add more IP addresses, or just disable + it with `systemd mask kresd*.socket kresd.service` and provide your + own custom system service file tailored to your needs. + + -- Ondřej Surý Thu, 04 Aug 2016 09:04:53 +0200 diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 0000000..657fc28 --- /dev/null +++ b/debian/README.source @@ -0,0 +1,70 @@ +Tracking upstream sources in git +-------------------------------- + +This debian package is tracked in the git "debian/master" branch at +https://salsa.debian.org/dns-team/knot-resolver, which +includes the commits from the upstream git repository at +https://gitlab.labs.nic.cz/knot/knot-resolver.git. When importing +upstream tarballs, make sure you've fetched from the upstream repo +before using "gbp import-orig" the tarball. We rely on +upstream-vcs-tag from debian/gbp.conf to link upstream git history +with new package history. + +See Joey Hess's thoughts about why tracking upstream git history is +useful: https://joeyh.name/blog/entry/upstream_git_repositories/, as +well as DEP-14 for the branch-naming scheme: +http://dep.debian.net/deps/dep14/ + +Rebuilding epoch.js and epoch.css +--------------------------------- + + If you need to rebuild epoch.js and epoch.css using only tools + available in Debian, read gulpfile.js in d/missing-sources/epoch/ and + adjust following script if any files has been changed. You also need + to install ruby-sass, coffeescript and node-uglify + +cat > build.sh << EOF +#!/bin/sh + +coffee -b -c \ + src/epoch.coffee \ + src/core/context.coffee \ + src/core/util.coffee \ + src/core/d3.coffee \ + src/core/format.coffee \ + src/core/chart.coffee \ + src/core/css.coffee \ + src/data.coffee \ + src/model.coffee \ + src/basic.coffee \ + src/basic/*.coffee \ + src/time.coffee \ + src/time/*.coffee \ + src/adapters.coffee \ + src/adapters/*.coffee + +cat \ + src/epoch.js \ + src/core/context.js \ + src/core/util.js \ + src/core/d3.js \ + src/core/format.js \ + src/core/chart.js \ + src/core/css.js \ + src/data.js \ + src/model.js \ + src/basic.js \ + src/basic/*.js \ + src/time.js \ + src/time/*.js \ + src/adapters.js \ + src/adapters/*.js \ + > dist/js/epoch.js + +uglifyjs dist/js/epoch.js > dist/js/epoch.min.js + +sass -t compact sass/epoch.scss > dist/css/epoch.css +sass -t compressed sass/epoch.scss > dist/css/epoch.min.css +EOF + + -- Daniel Kahn Gillmor , Thu, 22 Feb 2018 13:25:27 -0800 diff --git a/debian/TODO b/debian/TODO new file mode 100644 index 0000000..ed3a0cd --- /dev/null +++ b/debian/TODO @@ -0,0 +1,8 @@ +Things to work on for debian packaging for knot-resolver: + +* clean up javascript bundled by upstream, try to regenerate it from + source (starting with https://bugs.debian.org/923991 and + https://bugs.debian.org/924021) + +* normalize kresd.conf for sysvinit use by updating initscript to use + socket-activate + runuser diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..40af4db --- /dev/null +++ b/debian/changelog @@ -0,0 +1,1109 @@ +knot-resolver (5.6.0-1) unstable; urgency=medium + + * New upstream release + * New Build-Depends: libjemalloc-dev + * Remove years from CZ.NIC copyright + + -- Jakub Ružička Thu, 26 Jan 2023 21:41:02 +0100 + +knot-resolver (5.5.3-1) unstable; urgency=medium + + * New upstream release + - Resolves CVE-2022-40188 + + -- Jakub Ružička Thu, 22 Sep 2022 05:34:20 +0000 + +knot-resolver (5.5.2-1) unstable; urgency=medium + + * New upstream release with support for Knot DNS >= 3.2.0 + * Remove ppc64 arch without luajit + + -- Jakub Ružička Fri, 02 Sep 2022 13:05:58 +0000 + +knot-resolver (5.5.1-5) unstable; urgency=medium + + * d/control: remove ppc64el from module-http + + -- Jakub Ružička Fri, 05 Aug 2022 16:59:22 +0000 + +knot-resolver (5.5.1-4) unstable; urgency=medium + + * d/control: remove broken ppc64el and s390x arches + + -- Jakub Ružička Tue, 02 Aug 2022 10:09:52 +0000 + +knot-resolver (5.5.1-3) unstable; urgency=medium + + * Upload to unstable + + -- Jakub Ružička Wed, 27 Jul 2022 08:14:55 +0000 + +knot-resolver (5.5.1-2) experimental; urgency=medium + + * Use experimental to test luajit2 (Closes: #1013810) + * d/control: enable s390x due to luajit2 support + + -- Jakub Ružička Sun, 03 Jul 2022 18:19:14 +0000 + +knot-resolver (5.5.1-1) unstable; urgency=medium + + * New upstream release + + -- Jakub Ružička Tue, 14 Jun 2022 13:20:04 +0000 + +knot-resolver (5.5.0-1) unstable; urgency=medium + + * New upstream release + * d/upstream/signing-key.asc: update upstream key + * d/control: require Knot DNS 3.0.2 + + -- Jakub Ružička Thu, 17 Mar 2022 17:34:34 +0000 + +knot-resolver (5.4.4-1) unstable; urgency=medium + + * New upstream release + + -- Jakub Ružička Wed, 05 Jan 2022 17:35:35 +0000 + +knot-resolver (5.4.3-1) unstable; urgency=medium + + * New upstream release + + -- Jakub Ružička Wed, 01 Dec 2021 15:34:11 +0000 + +knot-resolver (5.4.2-1) unstable; urgency=medium + + * New upstream release + + -- Jakub Ružička Mon, 18 Oct 2021 13:56:09 +0000 + +knot-resolver (5.4.1-2) unstable; urgency=medium + + * Upload to unstable + + -- Jakub Ružička Tue, 31 Aug 2021 14:14:14 +0000 + +knot-resolver (5.4.1-1) experimental; urgency=medium + + * New upstream release + - Compatible with Knot DNS 3.1 + - Includes fix for CVE-2021-40083 (Closes: #991463) + * d/control: bump Standards-Version to 4.6.0 + * d/control: add Multi-Arch: same for module-http + * d/tests: replace `which` with `command -v` + + -- Jakub Ružička Wed, 25 Aug 2021 12:21:12 +0000 + +knot-resolver (5.3.2-1) unstable; urgency=medium + + [ Jakub Ružička ] + * New upstream release + * d/patches: remove patch included upstream + + [ Santiago Ruano Rincón ] + * Add Spanish debconf template translation (Closes: #987594) + + -- Jakub Ružička Thu, 13 May 2021 18:18:18 +0100 + +knot-resolver (5.3.1-1) unstable; urgency=medium + + [ Jakub Ružička ] + * New upstream release + + [ Santiago Ruano Rincón ] + * Fix unaligned access and SIGBUS on armhf, and then the autopkgtest on + armhf at ci.debian.net (Closes: #918248) + + -- Santiago Ruano Rincón Mon, 12 Apr 2021 07:59:28 +0200 + +knot-resolver (5.3.0-1) unstable; urgency=medium + + [ Jakub Ružička ] + * New upstream release + + [ Santiago Ruano Rincón ] + * Add Portuguese debconf template translation (Closes: #982329) + + -- Jakub Ružička Wed, 03 Mar 2021 15:11:51 +0100 + +knot-resolver (5.2.1-1) unstable; urgency=medium + + * New upstream release + * Remove no longer needed upstream patch: + 0001-fix-map-command-on-32-bit-platforms-regressed-in-5.2.patch + Note: it made the build non-reproducible. Thanks to Chris Lamb! + (Closes: #976827) + * Add lintian overrides for no-debconf-config tag and excessive line lengths + in some d/missing-sources/ .js files + * Fix no-symbols-control-file lintian override + * Update d/copyright: remove no longer included entries and reorder File + sections. + * Bump Standards-Version to 4.5.1. No changes required + + -- Santiago Ruano Rincón Tue, 15 Dec 2020 09:56:25 +0100 + +knot-resolver (5.2.0-2) unstable; urgency=low + + * Team upload. + + [ Jakub Ružička ] + * bugfix release + * debian/patches: fix map() command on 32-bit + + [ Dan Streetman ] + * d/control: Change arch 'any' to specific list + + [ Santiago Ruano Rincón ] + * Upload to unstable + + -- Santiago Ruano Rincón Mon, 07 Dec 2020 17:29:18 +0100 + +knot-resolver (5.2.0-1) experimental; urgency=medium + + [ Jakub Ružička ] + * new upstream release + * use experimental in order to safely move to knot >= 3.0 + * debian/control: require libknot-dev >= 3.0.1 + * debian/control: add myself to Uploaders + * debian/control: add lua-basexx build dep + * debian/control: add libnghttp2 dep for DoH support + * debian/control: use HTTP instead of HTTP/2 in desc + * debian/not-installed: don't use sysusers + + [ Santiago Ruano Rincón ] + * Set RELEASE to experimental in debian/salsa-ci.yml + + -- Jakub Ružička Fri, 20 Nov 2020 21:41:22 +0100 + +knot-resolver (5.1.3-1) unstable; urgency=low + + * New upstream release. + * Add debconf template translations: + - German (Closes: #969234) + - Dutch (Closes: #969341) + - French (Closes: #969478) + * d/control: build again for arm64. See + https://gitlab.nic.cz/knot/knot-resolver/-/merge_requests/1033 + * d/rules: really disable config_test on arm64. enable on other archs + + -- Santiago Ruano Rincón Mon, 14 Sep 2020 11:24:10 +0200 + +knot-resolver (5.1.2-3) unstable; urgency=medium + + * d/tests/control: add skip-not-installable restriction to avoid failure + state on arm64 + + -- Santiago Ruano Rincón Wed, 12 Aug 2020 22:24:46 +0200 + +knot-resolver (5.1.2-2) unstable; urgency=low + + * Add myself to Uploaders + * debian/rules: disable config_tests on arm64 + https://gitlab.nic.cz/knot/knot-resolver/-/issues/593 + * knot-resolver-module-http: explicitly set non-arm64 architectures + + -- Santiago Ruano Rincón Fri, 31 Jul 2020 16:17:50 +0200 + +knot-resolver (5.1.2-1) unstable; urgency=low + + * Team upload. + * New upstream release. (Closes: #966077) + * preinst, postinst maintainer scripts: base upgrade-4-to-5-related code + from upstream distro/deb/. + * Update debian/copyright to include CZ.NIC in debian/ files + * Document changes and manual action required when upgrading from 3.x, in + debian/NEWS and through debconf. (Closes: #952673) + Thanks to Justin B Rye for reviewing the English template. + * Add Build-Dep on po-debconf + * Add debian/po + + -- Santiago Ruano Rincón Wed, 29 Jul 2020 17:07:51 +0200 + +knot-resolver (5.1.1-1) unstable; urgency=medium + + * Team upload. + * Acknowledge 5.1.1-0.1 NMU. Thanks to Daniel Baumann. + * Mitigates NXNSAttack (CVE-2020-12667) (Closes: #961076) + * d/tests/control: remove Test-Command: make -k installcheck ... It is + broken since meson+ninja is used to build kresd + * d/tests/roundtrip: update to 5.x: change --forks for --noninteractive + option. fix control socket path + * Add debian/salsa-ci.yml + * d/tests/control: set Restrictions: needs-root for roundtrip + * Add source of dygraph.js to debian/missing-sources + * update dygraph.min.js in debian/copyright, remove entry for + dygraph-combined.js + * remove debian/missing-sources/dygraph-combined.js + * Renable PIE. Building seems to be OK now. + * d/control: Bump debhelper-compat to 13 + + -- Santiago Ruano Rincón Fri, 10 Jul 2020 13:43:19 +0200 + +knot-resolver (5.1.1-0.1) unstable; urgency=medium + + * Non-maintainer upload. + * New upstream release: + - mitigation for NXNSAttack DNS protocol vulnerability + [CVE-2020-12667] (Closes: #961076) + + -- Daniel Baumann Sun, 14 Jun 2020 06:24:58 +0200 + +knot-resolver (5.0.1-2) unstable; urgency=medium + + * Merge the indep and arch build, it doesn't really work with meson + * With new layout, the http module has to be converted to arch:any + + -- Ondřej Surý Fri, 28 Feb 2020 10:10:07 +0100 + +knot-resolver (5.0.1-1) unstable; urgency=medium + + * Adapt d/rules to meson-build + * Use wrap-and-sort -a to sort the d/control and d/tests/control + * Remove debian/patches, they are no longer applicable + * Enable upstream systemd files, enable config_tests + * Update the list of installed and not-installed files + * Enable the documentation build and build it in dh_auto_build target + * Merge manpages installation to knot-resolver.install + * Don't call dh_installsystemd, remove the extra Debian unit files + * Use deb-systemd-invoke instead of systemctl in the maintainer scripts + * Enable dnstap and add libprotobuf-c-dev to B-D + + -- Ondřej Surý Sat, 22 Feb 2020 21:14:47 +0100 + +knot-resolver (3.2.1-3) unstable; urgency=medium + + * knot-resolver-module-http is arch: all, not arch: any + * Explicitly list all non-arm64 architectures + + -- Daniel Kahn Gillmor Fri, 08 Mar 2019 00:56:09 -0500 + +knot-resolver (3.2.1-2) unstable; urgency=medium + + * Standards-Version: move to 4.3.0 (no changes needed) + * move to debhelper 12 + * Avoid breakage when built against knot-dns 2.8.0 + * d/tests/control: wrap-and-sort + * Drop libkres9 and libkres-dev packages (Closes: #923970) + * avoid clobbering CXXFLAGS when compiling lua-aho-corasick + * missing-sources: updated dygraph-combined.js to match minified version + * avoid shipping pre-built glyphicons-halflings-regular.woff2 + + -- Daniel Kahn Gillmor Thu, 07 Mar 2019 16:23:16 -0500 + +knot-resolver (3.2.1-1) unstable; urgency=medium + + * new upstream release (Closes: #922172) + * Update symbols file for 3.2.1 release + + -- Ondřej Surý Thu, 21 Feb 2019 09:42:37 +0000 + +knot-resolver (3.2.0-1) unstable; urgency=medium + + * new upstream release + * bump ABI from libkres8 to libkres9 + * drop reproducibility patch, adopted upstream + * include experimental_dot_auth module (recommend: lua-basexx for it) + * d/copyright: removed reference to ISAAC, removed upstream + + -- Daniel Kahn Gillmor Wed, 19 Dec 2018 19:23:37 -0500 + +knot-resolver (3.1.0-1) unstable; urgency=medium + + * new upstream release + * set knot-resolver-doc to Multi-Arch: foreign + * drop upstreamed patch; avoid use of git during installcheck + * make reproducible datestamp in kresd(8) + * increase build-dep on libknot to 2.7.2 + * updated libkres8.symbols + * minimize upstream signing keys + * drop unused lintian-overrides + + -- Daniel Kahn Gillmor Tue, 20 Nov 2018 15:47:19 -0500 + +knot-resolver (3.0.0-9) unstable; urgency=medium + + * autopkg: allow stderr on "make installcheck" + + -- Daniel Kahn Gillmor Wed, 12 Sep 2018 13:02:45 -0400 + +knot-resolver (3.0.0-8) unstable; urgency=medium + + * avoid stderr during autopkgtest + * refresh patches + + -- Daniel Kahn Gillmor Wed, 12 Sep 2018 09:51:40 -0400 + +knot-resolver (3.0.0-7) unstable; urgency=medium + + * try upstream proposed test suite change + + -- Daniel Kahn Gillmor Tue, 11 Sep 2018 23:58:14 -0400 + +knot-resolver (3.0.0-6) unstable; urgency=medium + + * stop building knot-resolver on arm64 (Closes: #907729) + + -- Daniel Kahn Gillmor Wed, 05 Sep 2018 19:30:10 -0400 + +knot-resolver (3.0.0-5) unstable; urgency=medium + + * roundtrip test: increase verbosity + * roundtrip test: avoid long timeouts if UDP query fails + * autopkgtest: improve call to "make installcheck" + + -- Daniel Kahn Gillmor Fri, 31 Aug 2018 21:10:39 -0400 + +knot-resolver (3.0.0-4) unstable; urgency=medium + + * Re-enable tests on all architectures + * autopkgtest: be more verbose about error + * autopkgtest: allow specifying module directory + * point to modules needed to run roundtrip test at build time + + -- Daniel Kahn Gillmor Fri, 31 Aug 2018 14:00:24 -0400 + +knot-resolver (3.0.0-3) unstable; urgency=medium + + * improve autopkgtest + * autopkgtest: env vars can select which kdig and kresd to test + * run roundtrip test at compile time too + + -- Daniel Kahn Gillmor Fri, 31 Aug 2018 11:36:17 -0400 + +knot-resolver (3.0.0-2) unstable; urgency=medium + + * autopkgtest: added full roundtrip tests + + -- Daniel Kahn Gillmor Thu, 30 Aug 2018 14:41:02 -0400 + +knot-resolver (3.0.0-1) unstable; urgency=medium + + * new upstream release + * Standards-Version: bump to 4.2.1 (no changes needed) + * build-depend on libknot 2.7 or later + + -- Daniel Kahn Gillmor Mon, 27 Aug 2018 18:42:45 -0400 + +knot-resolver (2.4.1-1) unstable; urgency=medium + + * new upstream release + - resolves CVE-2018-10920 + * k-r.postinst: strip trailing whitespace + * clean up patches already adopted upstream + * ship rebinding lua module + * use upstream-preferred systemd service configuration + * tell lintian not to complain about kresd.target + * tighten up build-deps on libknot-dev + * three symbols (re)introduced into libkres7 + * Standards-Version: bump to 4.2.0 (no changes needed) + + -- Daniel Kahn Gillmor Mon, 27 Aug 2018 18:22:48 -0400 + +knot-resolver (2.3.0-4) unstable; urgency=medium + + * try to restart any running kresd daemon on upgrade + * correct systemctl start documentation (Closes: #891838) + * fix FTBFS on kfreebsd (Closes: #900013) + + -- Daniel Kahn Gillmor Thu, 24 May 2018 13:10:31 -0400 + +knot-resolver (2.3.0-3) unstable; urgency=medium + + * create knot-resolver user correctly in postinst (Closes: #894580) + * d/changelog: update to acknowledge CVE-2018-1110 + + -- Daniel Kahn Gillmor Mon, 14 May 2018 11:58:29 -0400 + +knot-resolver (2.3.0-2) unstable; urgency=medium + + * only build against libsystemd on linux architectures + + -- Daniel Kahn Gillmor Thu, 26 Apr 2018 11:56:29 -0400 + +knot-resolver (2.3.0-1) unstable; urgency=medium + + * new upstream release + - resolves CVE-2018-1110 + * drop patches already upstream + * ship prefill module + * d/copyright: adjust years of main stanza + * add trie_* and kr_zonecut_is_empty to symbols + * Standards-Version: bump to 4.1.4 (no changes needed) + * drop unnecessary build-dependencies + + -- Daniel Kahn Gillmor Tue, 24 Apr 2018 19:20:45 -0400 + +knot-resolver (2.2.0-1) unstable; urgency=medium + + * new upstream release + - move from libkres6 to libkres7 due to ABI change + * drop patches already merged upstream + * avoid shipping root.hints and icann-ca.pem without a patch + * work around https://gitlab.labs.nic.cz/knot/knot-resolver/issues/338 + * renumbering patches for cleanliness + * use externally-set CPPFLAGS during build + * clean up build of lua-aho-corasick + * document copyright better to drop a lintian override + * clarify rationales behind lintian-overrides + * be clearer about keyfile-ro restarting kresd in kresd.8 + + -- Daniel Kahn Gillmor Sun, 08 Apr 2018 23:46:47 -0400 + +knot-resolver (2.1.1-1) unstable; urgency=medium + + * new upstream release + * drop patches already upstream + * refresh remaining patches + + -- Daniel Kahn Gillmor Sun, 25 Feb 2018 17:36:46 -0800 + +knot-resolver (2.1.0-2) unstable; urgency=medium + + * clean up README.source + * more bugfix patches from upstream + + -- Daniel Kahn Gillmor Thu, 22 Feb 2018 13:27:59 -0800 + +knot-resolver (2.1.0-1) unstable; urgency=medium + + * new upstream release + - move from libkres5 to libkres6 due to an ABI change + - kresd.systemd(7) documents running a public-facing resolver + (Closes: #880682) + * d/upstream/signing-key.asc: add Tomas Krizek's key + * d/gbp.conf: use DEP-14 branch naming + * drop patches already upstream + * d/control: build-depend on libknot-dev (>= 2.6.4) + * handle updates to the DNS root.key sensibly (dpkg triggers) + * systemd: mask kresd.service, following upstream's recommendation + * /etc/default/kresd: indicate that it is only for sysvinit + * d/rules: clean up unnecessary lines + * systemd: ship upstream unit files and tmpfiles config directly + * d/control: Rules-Requires-Root: no + * use python3 during the build. + * ship upstream NEWS file as upstream changelog + * debian/TODO: clean up + + -- Daniel Kahn Gillmor Sat, 17 Feb 2018 21:13:45 -0500 + +knot-resolver (2.0.0-3) unstable; urgency=medium + + * documentation: build with sphinx_rtd_theme + + -- Daniel Kahn Gillmor Mon, 05 Feb 2018 17:13:04 -0500 + +knot-resolver (2.0.0-2) unstable; urgency=medium + + * Simplify /etc/default/kresd + * drop preinst special case for versions < 1.1.0-2 + * postinst: create the knot-resolver user at configure time + * initscript knows path to /usr/lib/tmpfiles.d/knot-resolver.conf + * Overhaul systemd integration. + * d/copyright: include more contributed subprojects (Closes: #889646) + + -- Daniel Kahn Gillmor Mon, 05 Feb 2018 13:46:25 -0500 + +knot-resolver (2.0.0-1) unstable; urgency=medium + + [ Ondřej Surý ] + * Reduce the (non-public) symbols in libkres4 + + [ Daniel Kahn Gillmor ] + * import systemd fixes from Tomas Krizek + * avoid leaving /run/knot-resolver world-executable + * systemd: set up kresd@1 service and sockets + * wrap-and-sort -ast + * Add kresd.service as a symlink to kresd@1.service + * more bugfixes from upstream + * NEWS: document changes for using kresd with systemd + * include new lua modules + * move from libkres4 to libkres5 (cache functions dropped) + + -- Daniel Kahn Gillmor Mon, 05 Feb 2018 00:25:51 -0500 + +knot-resolver (1.5.3-1) unstable; urgency=medium + + * New upstream release + + -- Ondřej Surý Wed, 24 Jan 2018 12:35:55 +0000 + +knot-resolver (1.5.2-1) unstable; urgency=medium + + * New upstream release + - closes CVE-2018-1000002 + * d/copyright: use https where possible + * move to debhelper 11 (docs to /u/s/doc/knot-resolver/, policy §12.3) + * d/control: move Maintainer: to knot-resolver@packages.debian.org + + -- Daniel Kahn Gillmor Mon, 22 Jan 2018 15:00:21 +0100 + +knot-resolver (1.5.1-2) unstable; urgency=medium + + * libkres-dev Depends on libkres4 (Closes: #887572) + * Standards-Version: bump to 4.1.3 (no changes needed) + * move Vcs-* to salsa.debian.org + + -- Daniel Kahn Gillmor Wed, 17 Jan 2018 23:23:45 -0500 + +knot-resolver (1.5.1-1) unstable; urgency=medium + + * new upstream release + * move packaging split to unstable + * d/watch: move to version 4, avoid alpha/beta releases + * drop patches for bugs already fixed upstream + * use "make installcheck" as a simple test + * track evolving name of etcd module + * wrap-and-sort -a + * shipping new modules: priming, detect_time_{jump,skew} + * added kr_now to exported symbols + * Standards-Version: bump to 4.1.2 (no changes needed) + + -- Daniel Kahn Gillmor Wed, 13 Dec 2017 15:40:10 -0500 + +knot-resolver (1.5.0-5) experimental; urgency=medium + + * packaging cleanup, splitting out library packages + * dbgsym migration no longer needed + knot-resolver-dbg is not shipped anywhere + * clean up installation of knot-resolver-module-http + * move to dh_missing, as dh_install --fail-missing is deprecated + * clean up/simplify knot-resolver.install + * break out libkres library packages + * put manpage installation under control of dh_installman + * knock stuff off the packaging todo list + * register knot-resolver-doc with doc-base + * add libkres4.symbols to track API evolution + * correct debian/copyright paths + + -- Daniel Kahn Gillmor Thu, 30 Nov 2017 23:25:54 -0500 + +knot-resolver (1.5.0-4) unstable; urgency=medium + + * Pull upstream patch to increase the CACHE_SIZE in tests_cache for + platforms with page size greater than 4k (Closes: #878976) + * Pull upstream patch from MR!389 to not run check-config at all as + modulepath is hardcoded (Closes: #881492) + + -- Ondřej Surý Mon, 13 Nov 2017 19:53:30 +0000 + +knot-resolver (1.5.0-3) unstable; urgency=medium + + * reorder tests + + -- Daniel Kahn Gillmor Mon, 13 Nov 2017 03:24:06 +0800 + +knot-resolver (1.5.0-2) unstable; urgency=medium + + * include a list of suggestions for future packaging work + * try some debugging to see failures for #881492 + + -- Daniel Kahn Gillmor Mon, 13 Nov 2017 03:19:21 +0800 + +knot-resolver (1.5.0-1) unstable; urgency=medium + + * New upstream version. + * d/copyright: update source homepage (Closes: #879166) + * Standards-Version: bump to 4.1.1 (no changes needed) + * switch to debhelper 10 + * drop dh-systemd build-dep -- no longer needed (may be added back for + backports) + * [lintian] fix debian-news-entry-uses-asterisk + * drop unused lintian overrides + * added myself to uploaders + * update upstream signer key + * patch from upstream for SIGPIPE (Closes: #881462) + * patch to fix upstream test suite + * debian/copyright: cleanup + * move to python3-{sphinx,breathe} for build-dep + * use root.hints from dns-root-data + + -- Daniel Kahn Gillmor Sun, 12 Nov 2017 13:00:50 +0800 + +knot-resolver (1.4.0-2) unstable; urgency=medium + + * Add root.hints into the package + * Bump required libknot version to >= 2.6.0 + + -- Ondřej Surý Fri, 29 Sep 2017 19:56:14 +0200 + +knot-resolver (1.4.0-1) unstable; urgency=medium + + * Make libsystemd-dev (>= 227) a hard requirement + * Fix the Knot Resolver homepage + * New upstream version 1.4.0 + * aho-corrasick.lua has been removed from the sources + + -- Ondřej Surý Thu, 28 Sep 2017 18:31:54 +0200 + +knot-resolver (1.3.3-1) unstable; urgency=medium + + * New upstream version 1.3.3 + + -- Ondřej Surý Wed, 09 Aug 2017 15:28:35 +0200 + +knot-resolver (1.3.2-1) unstable; urgency=medium + + * New upstream version 1.3.2 + + -- Ondřej Surý Fri, 28 Jul 2017 14:22:08 +0200 + +knot-resolver (1.3.1-1) unstable; urgency=medium + + * New upstream version 1.3.1 + * Remove all upstream patches merged upstream + + -- Ondřej Surý Fri, 23 Jun 2017 14:38:15 +0200 + +knot-resolver (1.3.0-2) unstable; urgency=medium + + * Fix the moduledir in the http2 module + + -- Ondřej Surý Fri, 16 Jun 2017 13:20:14 +0200 + +knot-resolver (1.3.0-1) unstable; urgency=medium + + [ Ondřej Surý ] + * New upstream version 1.3.0 + * Export MAKEVARS as environment variables + * Add libedit-dev to B-D to build kresc + + [ Daniel Kahn Gillmor ] + * ship kresc because we use --fail-missing + * clean up things the upstream build scripts leave behind + + -- Ondřej Surý Tue, 13 Jun 2017 09:07:54 +0200 + +knot-resolver (1.2.6-1) unstable; urgency=medium + + * New upstream version 1.2.6 + + -- Ondřej Surý Mon, 24 Apr 2017 16:31:11 +0200 + +knot-resolver (1.2.5-1) unstable; urgency=medium + + * New upstream version 1.2.5 + + -- Ondřej Surý Wed, 05 Apr 2017 16:07:40 +0200 + +knot-resolver (1.2.4-1) unstable; urgency=medium + + * New upstream version 1.2.4 + + -- Ondřej Surý Thu, 09 Mar 2017 14:20:24 +0100 + +knot-resolver (1.2.3-1) unstable; urgency=medium + + * New upstream version 1.2.3 + + -- Ondřej Surý Thu, 23 Feb 2017 15:49:14 +0100 + +knot-resolver (1.2.2-1) unstable; urgency=medium + + * New upstream version 1.2.2 + + -- Ondřej Surý Fri, 10 Feb 2017 13:54:28 +0100 + +knot-resolver (1.2.1-1) unstable; urgency=high + + * New upstream version 1.2.1 + + -- Ondřej Surý Wed, 01 Feb 2017 20:56:35 +0100 + +knot-resolver (1.2.0-1) unstable; urgency=medium + + * New upstream version 1.2.0 + * Squash 1.2.0 changelog into a single 1.2.0 entry + * Add d/upstream/signing-key.asc + * Add d/watch to monitor upstream tarballs + + -- Ondřej Surý Wed, 25 Jan 2017 14:23:27 +0100 + +knot-resolver (1.1.1-131-g59d5adf-1) unstable; urgency=medium + + * Disable tests on mipsel that started to fail in a mysterious way + (Closes: #847696) + * Imported Upstream version 1.1.1-131-g59d5adf + + -- Ondřej Surý Wed, 14 Dec 2016 12:16:36 +0100 + +knot-resolver (1.1.1-122-g940fda9-2) unstable; urgency=medium + + * Move -DNDEBUG just to build target + + -- Ondřej Surý Tue, 13 Dec 2016 09:52:19 +0100 + +knot-resolver (1.1.1-122-g940fda9-1) unstable; urgency=medium + + * Imported Upstream version 1.1.1-122-g940fda9 + * Remove static linking patch + * Add $(MAKEVARS) to make check invocation + * Use SOVERSION when compiling to unfail the tests + + -- Ondřej Surý Mon, 12 Dec 2016 16:26:27 +0100 + +knot-resolver (1.1.1-41-g8437a7d-2) unstable; urgency=medium + + * Update NEWS with kresd.service (Closes: #843178) + * Enable NDEBUG on production builds + + -- Ondřej Surý Wed, 07 Dec 2016 10:02:55 +0100 + +knot-resolver (1.1.1-41-g8437a7d-1) unstable; urgency=medium + + * Imported Upstream version 1.1.1-41-g8437a7d + * Add instructions how to rebuild epoch.js and epoch.css using Debian + tools (Closes: #833309) + * Record SONAMEs of used C libraries as lua literals instead of guessing + (Closes: #841496) + * Rebase patches on top of new git master release + + -- Ondřej Surý Fri, 21 Oct 2016 11:27:56 +0200 + +knot-resolver (1.1.1-2) unstable; urgency=medium + + * Add missing sources for epoch.js + * Also allow loading of libknot.so.4 + + -- Ondřej Surý Tue, 11 Oct 2016 14:54:20 +0200 + +knot-resolver (1.1.1-1) unstable; urgency=medium + + * Imported Upstream version 1.1.1 + + -- Ondřej Surý Tue, 11 Oct 2016 14:52:37 +0200 + +knot-resolver (1.1.0-8) unstable; urgency=medium + + * Use restart instead of try-restart if upgrading from << 1.1.0-7 + + -- Ondřej Surý Tue, 16 Aug 2016 11:18:46 +0200 + +knot-resolver (1.1.0-7) unstable; urgency=medium + + * Add the final missing bits from dh_systemd_enable + + -- Ondřej Surý Tue, 16 Aug 2016 10:29:22 +0200 + +knot-resolver (1.1.0-6) unstable; urgency=medium + + * Make extra sure that kresd.service is stopped before starting the + sockets again + * Stop old systemd units early before they are removed + + -- Ondřej Surý Tue, 16 Aug 2016 08:32:22 +0200 + +knot-resolver (1.1.0-5) unstable; urgency=medium + + * Stop kresd.service in prerm script to allow kresd.socket restarts + + -- Ondřej Surý Mon, 15 Aug 2016 15:43:59 +0200 + +knot-resolver (1.1.0-4) unstable; urgency=medium + + * Install kresd-tls.socket into the package + * Unwrap variables in default file as systemd units cannot resolve + nested variables + + -- Ondřej Surý Mon, 15 Aug 2016 13:29:32 +0200 + +knot-resolver (1.1.0-3) unstable; urgency=medium + + * Tighten Build-Depends on libcmocka-dev to 1.0.0 + * Cleanup the knot-resolver -> kresd init script rename + + -- Ondřej Surý Mon, 15 Aug 2016 13:11:10 +0200 + +knot-resolver (1.1.0-2) unstable; urgency=medium + + * Update systemd units to be named after the daemon (kresd) + + -- Ondřej Surý Mon, 15 Aug 2016 10:09:53 +0200 + +knot-resolver (1.1.0-1) unstable; urgency=medium + + * Imported Upstream version 1.1.0 + * Rebase patches on top of Knot Resolver 1.1.0 + * Don't require libsystemd-dev on Ubuntu 14.04 LTS + + -- Ondřej Surý Fri, 12 Aug 2016 10:45:09 +0200 + +knot-resolver (1.1.0~git2016072900-2) unstable; urgency=medium + + * Fix minor nits in maintainers scripts (Courtesy of Andreas Henriksson) + * Imported Upstream version 1.1.0~2016080800 + * Bump required version of libknot to 2.3.0 + + -- Ondřej Surý Wed, 10 Aug 2016 10:04:01 +0200 + +knot-resolver (1.1.0~git2016072900-1) unstable; urgency=medium + + * Imported Upstream version 1.1.0~git2016072900 + * Knot Resolver is now running as non-privileged socket activated + systemd service. + + -- Ondřej Surý Thu, 04 Aug 2016 09:01:15 +0200 + +knot-resolver (1.1.0~git2016072000-1) unstable; urgency=medium + + * Imported Upstream version 1.1.0~git2016072000 + + -- Ondřej Surý Wed, 20 Jul 2016 14:31:10 +0200 + +knot-resolver (1.1.0~git2016071900-1) unstable; urgency=medium + + * Use correct lua comments in default kresd.conf + * knot-resolver 1.1.0~git2016071300-3 + * Imported Upstream version 1.1.0~git2016071900 + + -- Ondřej Surý Wed, 20 Jul 2016 07:45:42 +0200 + +knot-resolver (1.1.0~git2016071300-3) unstable; urgency=medium + + [ Daniel Kahn Gillmor ] + * Remove static lib/libkres.a during clean + * Put knot-resolver-doc into Section: doc (thanks, Lintian!) + + [ Ondřej Surý ] + * Use correct lua comments in default kresd.conf + + -- Ondřej Surý Mon, 18 Jul 2016 10:47:12 +0200 + +knot-resolver (1.1.0~git2016071300-2) unstable; urgency=medium + + * Build and install documentation into knot-resolver-doc package + (Closes: #831461) + * Build with libsystemd-dev to get socket-activation + * Set LD_LIBRARY_PATH to load correct libkresd.so.1 for tests + * Link the tests with static libkres library + + -- Ondřej Surý Sat, 16 Jul 2016 15:55:04 +0200 + +knot-resolver (1.1.0~git2016071300-1) unstable; urgency=medium + + * Imported Upstream version 1.1.0~git2016071300 + * knot-resolver-module-all should be arch:all (only lua there) + * Don't build tinyweb module anymore as HTTP/2 module replaces it + + -- Ondřej Surý Thu, 14 Jul 2016 07:28:24 +0200 + +knot-resolver (1.1.0~git2016070600-4) unstable; urgency=medium + + * Add missing http.lua to knot-resolver-module-http package + + -- Ondřej Surý Wed, 13 Jul 2016 15:35:11 +0200 + +knot-resolver (1.1.0~git2016070600-3) unstable; urgency=medium + + * Add NEW packages lua-http and lua-mmdb to knot-resolver-module-http + Depends + * knot-resolver now recommends knot-resolver-module-http + * Add liblmdb-dev to Build-Depends (Closes: #830934) + + -- Ondřej Surý Wed, 13 Jul 2016 14:09:12 +0200 + +knot-resolver (1.1.0~git2016070600-2) unstable; urgency=medium + + * Explicitly declare architectures for tinyweb module + (Closes: #830939) + + -- Ondřej Surý Wed, 13 Jul 2016 09:32:30 +0200 + +knot-resolver (1.1.0~git2016070600-1) unstable; urgency=medium + + * Imported Upstream version 1.1.0~git2016070600 + * Adapt to the new fixed config.mk that accepts overrides + * Add new HTTP/2 module that will replace tinyweb module + * Add daf module to knot-resolver + * Bump standards to 3.9.8 (no change) + + -- Ondřej Surý Mon, 11 Jul 2016 15:33:21 +0200 + +knot-resolver (1.0.0-16-g1070c49-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0-16-g1070c49 + * Add Breaks/Replaces for knot-resolver-module-tinyweb (Closes: #829051) + + -- Ondřej Surý Thu, 30 Jun 2016 11:02:06 +0200 + +knot-resolver (1.0.0-13-g95b243f-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0-13-g95b243f + + -- Ondřej Surý Wed, 22 Jun 2016 09:28:44 +0200 + +knot-resolver (1.0.0-12-g86f75f0-1) unstable; urgency=medium + + * Split tinyweb module into separate package + * Imported Upstream version 1.0.0-12-g86f75f0 + * Use simpler method for optional dh_strip parameter + + -- Ondřej Surý Tue, 21 Jun 2016 09:23:27 +0200 + +knot-resolver (1.0.0-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0 + + -- Ondřej Surý Tue, 31 May 2016 10:12:26 +0200 + +knot-resolver (1.0.0~beta3-95-g550ceca-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0~beta3-95-g550ceca + + -- Ondřej Surý Mon, 30 May 2016 09:38:02 +0200 + +knot-resolver (1.0.0~beta3-91-g9259b27-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0~beta3-91-g9259b27 + + -- Ondřej Surý Fri, 27 May 2016 14:51:19 +0200 + +knot-resolver (1.0.0~beta3-85-g503adee-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0~beta3-85-g503adee + + -- Ondřej Surý Wed, 25 May 2016 09:19:05 +0200 + +knot-resolver (1.0.0~beta3-83-gc416877-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0~beta3-83-gc416877 + + -- Ondřej Surý Mon, 23 May 2016 14:24:41 +0200 + +knot-resolver (1.0.0~beta3-78-g3429619-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0~beta3-78-g3429619 + + -- Ondřej Surý Wed, 18 May 2016 10:33:19 +0200 + +knot-resolver (1.0.0~beta3-72-g4ffb749-1) unstable; urgency=medium + + * Move lintian overrides for sources to d/source.lintian-overrides + * Add missing wildcard in lintian overrides + * Require golang-go (>= 1.5.0) that's needed + * Fix order of version requirement and arch for golang-go + * Imported Upstream version 1.0.0~beta3-72-g4ffb749 + * Dynamic Go modules are supported on arm*, amd64 and i386 since + golang-go (>= 1.6.0) + + -- Ondřej Surý Thu, 12 May 2016 15:32:22 +0200 + +knot-resolver (1.0.0~beta3-71-gb5b0232-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0~beta3-71-gb5b0232 + * Back to master branch + + -- Ondřej Surý Wed, 11 May 2016 13:36:37 +0200 + +knot-resolver (1.0.0~beta3-61-gc23edd0-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0~beta3-61-gc23edd0 + * Pull fixes from tcp-ooo branch + + -- Ondřej Surý Tue, 03 May 2016 09:55:40 +0200 + +knot-resolver (1.0.0~beta3-60-ge61c48e-3) unstable; urgency=medium + + * Add a versioned Built-Using for golang-github-abh-geoip-dev + (Courtesy of Michael Hudson-Doyle) + + -- Ondřej Surý Tue, 26 Apr 2016 13:18:16 +0200 + +knot-resolver (1.0.0~beta3-60-ge61c48e-2) unstable; urgency=medium + + * Don't use dh_golang for computing Built-Using as it doesn't work, + so we can build tinyweb module again + + -- Ondřej Surý Tue, 26 Apr 2016 11:40:30 +0200 + +knot-resolver (1.0.0~beta3-60-ge61c48e-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0~beta3-60-ge61c48e + * Remove -dbg package for dbgsym transition + * Don't build tinyweb module as dh_golang is broken right now + (Closes: #822386) + + -- Ondřej Surý Tue, 26 Apr 2016 10:35:56 +0200 + +knot-resolver (1.0.0~beta3-41-g5bf6748-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0~beta3-41-g5bf6748 + + -- Ondřej Surý Wed, 13 Apr 2016 21:55:07 +0200 + +knot-resolver (1.0.0~beta3-31-g79a8440-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0~beta3-31-g79a8440 + * Add kresd.8 man page to distribution + * Fix WS in d/control + + -- Ondřej Surý Thu, 31 Mar 2016 18:46:30 +0200 + +knot-resolver (1.0.0~beta3-1) unstable; urgency=medium + + * Add lua-socket and lua-sec for root TA bootstrapping + * Imported Upstream version 1.0.0~beta3 + + -- Ondřej Surý Sat, 30 Jan 2016 16:15:23 +0100 + +knot-resolver (1.0.0~beta2-123-g6134920-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0~beta2-123-g6134920 + * Mangle tinyweb only if it exists (Closes: #812276) + * Mute lintian error about missing tinyweb.js sources and mute lintian + warnings about shared library + + -- Ondřej Surý Tue, 26 Jan 2016 15:00:54 +0100 + +knot-resolver (1.0.0~beta2-104-ge110f97-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0~beta2-104-ge110f97 + * Rebase patches on top of 1.0.0~beta2-104-ge110f97 release + * Knot Resolver needs libknot 2.1.0 at least + * Disable PIE hardening as it breaks the build + * Squash debian quirks patch into one + * Disable ASAN sanitized build + * libkresd is now dynamic library + * Install other new files into the package + + -- Ondřej Surý Tue, 12 Jan 2016 16:45:42 +0100 + +knot-resolver (1.0.0~beta2-58-gd8762fb-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0~beta2-58-gd8762fb + + -- Ondřej Surý Fri, 04 Dec 2015 15:16:43 +0100 + +knot-resolver (1.0.0~beta2-1) unstable; urgency=medium + + * Imported Upstream version 1.0.0~beta2 + * Build the Go modules on amd64 + * Compile the experimental with clang and AddressSanitizer + * Fix missing GPL-2 and s/MIT/Expat/ in d/copyright + * Add missing sources for javascript files + * Add ${misc:Depends} to -dbg package + * Tidy-up the permissions on modules + * Use libjs-jquery and libjs-d3 instead of bundled javascript + * Stop depending on libknot-dev as the code can cope with SOVERSION + + -- Ondřej Surý Mon, 23 Nov 2015 11:49:25 +0100 + +knot-resolver (1.0.0~beta1-85-gd94caa6-1) experimental; urgency=medium + + * Imported Upstream version 1.0.0~beta1-85-gd94caa6 + + -- Ondřej Surý Thu, 12 Nov 2015 23:14:07 +0100 + +knot-resolver (1.0.0~beta1-75-g0497be2-1) experimental; urgency=medium + + * Imported Upstream version 1.0.0~beta1-75-g0497be2 + * Rebase patches on top of 1.0.0~beta1-75-g0497be2 + + -- Ondřej Surý Wed, 11 Nov 2015 09:58:20 +0100 + +knot-resolver (1.0.0~beta1-12-g822d8fe-1) experimental; urgency=medium + + * Initial release + * Update d/copyright with some missing bits + * Imported Upstream version 1.0.0~beta1-12-g822d8fe + + -- Ondřej Surý Mon, 12 Oct 2015 11:55:14 +0200 diff --git a/debian/clean b/debian/clean new file mode 100644 index 0000000..ce17de8 --- /dev/null +++ b/debian/clean @@ -0,0 +1,5 @@ +doc/kresd.8 +libkres.pc +lib/libkres.a +lib/libkres.so.* +test-modules/ diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..2031085 --- /dev/null +++ b/debian/control @@ -0,0 +1,113 @@ +Source: knot-resolver +Section: net +Priority: optional +Maintainer: knot-resolver packagers +Uploaders: Ondřej Surý , + Daniel Kahn Gillmor , + Santiago Ruano Rincón , + Jakub Ružička +Build-Depends: debhelper-compat (= 13), + dns-root-data, + doxygen, + gnutls-bin , + knot-dnsutils , + libcmocka-dev (>= 1.0.0), + libedit-dev, + libfstrm-dev, + libgnutls28-dev, + libjemalloc-dev, + libknot-dev (>= 3.0.2), + liblmdb-dev, + libluajit-5.1-dev, + libnghttp2-dev, + libprotobuf-c-dev, + libsystemd-dev (>= 227) [linux-any], + libuv1-dev, + lua-basexx, + lua-cqueues, + luajit, + meson, + ninja-build, + po-debconf, + pkg-config, + protobuf-c-compiler, + python3-breathe, + python3-sphinx, + python3-sphinx-rtd-theme, + socat +Standards-Version: 4.6.0 +Homepage: https://www.knot-resolver.cz/ +Vcs-Browser: https://salsa.debian.org/dns-team/knot-resolver +Vcs-Git: https://salsa.debian.org/dns-team/knot-resolver.git +Rules-Requires-Root: no + +Package: knot-resolver +Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel +Depends: adduser, + debconf, + dns-root-data, + lua-sec, + lua-socket, + ${misc:Depends}, + ${shlibs:Depends} +Replaces: libkres9 (<< 3.2.1-2) +Breaks: libkres9 (<< 3.2.1-2) +Recommends: knot-resolver-module-http, + lua-basexx, + lua-cqueues +Description: caching, DNSSEC-validating DNS resolver + The Knot Resolver is a caching full resolver implementation + written in C and LuaJIT, including both a resolver library and a + daemon. Modular architecture of the library keeps the core tiny and + efficient, and provides a state-machine like API for + extensions. There are three built-in modules - iterator, cache, + validator, and many external. + . + The Lua modules, switchable and shareable cache, and fast FFI + bindings makes it great to tap into resolution process, or be used + for your recursive DNS service. It's the OpenResty of DNS. + . + The server adopts a different scaling strategy than the rest of the + DNS recursors - no threading, shared-nothing architecture (except + MVCC cache that may be shared). You can start and stop additional + nodes depending on the contention without downtime. + +Package: knot-resolver-module-http +Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel +Multi-Arch: same +Depends: fonts-glyphicons-halflings, + libjs-bootstrap, + libjs-d3, + libjs-jquery, + lua-http, + lua-mmdb, + ${misc:Depends}, + ${shlibs:Depends} +Breaks: knot-resolver-module-tinyweb (<< 1.1.0~git20160713-1~) +Description: HTTP module for Knot Resolver + The Knot Resolver is a caching full resolver implementation + written in C and LuaJIT, including both a resolver library and a + daemon. Modular architecture of the library keeps the core tiny and + efficient, and provides a state-machine like API for + extensions. There are three built-in modules - iterator, cache, + validator, and many external. + . + This package contains HTTP module for local visualization of the + resolver cache and queries. + +Package: knot-resolver-doc +Architecture: all +Multi-Arch: foreign +Section: doc +Depends: libjs-jquery, + libjs-underscore, + ${misc:Depends} +Description: Documentation for Knot Resolver + The Knot Resolver is a caching full resolver implementation + written in C and LuaJIT, including both a resolver library and a + daemon. Modular architecture of the library keeps the core tiny and + efficient, and provides a state-machine like API for + extensions. There are three built-in modules - iterator, cache, + validator, and many external. + . + This package contains Knot Resolver Documentation. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..dfcde1f --- /dev/null +++ b/debian/copyright @@ -0,0 +1,391 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: knot-resolver +Source: https://www.knot-resolver.cz/ + +Files: * +Copyright: CZ.NIC +License: GPL-3.0+ + +Files: contrib/ccan/asprintf/* +Copyright: Rusty Russell +License: Expat + +Files: contrib/ccan/compiler/* +Copyright: Rusty Russell +License: CC0 + +Files: contrib/ccan/json/* +Copyright: 2011 Joey Adams +License: Expat + +Files: contrib/murmurhash3/* +Copyright: Austin Appleby +License: CC0-1.0 + +Files: contrib/ucw/* +Copyright: 1997-2015 Martin Mares + 2005-2014 Tomas Valla + 2006 Robert Spalek + 2007-2015 Pavel Charvat +License: LGPL-2.1 + +Files: debian/* +Copyright: 2015 Ondřej Surý + 2015-2019 CZ.NIC +License: GPL-3.0+ + +Files: debian/missing-sources/dygraph.js + modules/http/static/dygraph.min.js +Copyright: 2006-2017 Dan Vanderkam + 2016 Paul Miller + 2011 Robert Konigsberg + 2013 David Eberlein +License: MIT +Comment: upstream site: http://dygraphs.com/download.html + +Files: lib/generic/map.c lib/generic/map.h +Copyright: Dan Bernstein + Jonas Gehring + Adam Langley + Marek Vavrusa +License: public-domain + +Files: modules/policy/lua-aho-corasick/* +Copyright: 2013 CloudFlare, Inc. +License: BSD-3-CloudFlare + +Files: modules/http/static/jquery.js +Copyright: 2005-2011 John Resig, Brandon Aaron & Jörn Zaefferer +License: GPL-2 or Expat + +Files: modules/http/static/d3.js + modules/http/static/topojson.js +Copyright: 2010-2015 Michael Bostock +License: BSD-3-clause + +Files: modules/http/static/epoch.* + debian/missing-sources/epoch/* + debian/missing-sources/epoch.* +Copyright: 2014 Fastly, Inc. +License: Expat + +Files: modules/http/static/datamaps.world.min.js +Copyright: 2012 Mark DiMarco +License: Expat + +Files: modules/http/static/bootstrap.min.css + modules/http/static/bootstrap.min.js + modules/http/static/bootstrap-theme.min.css + modules/http/static/glyphicons-halflings-regular.woff2 +Copyright: 2012-2016 Thomas Park + 2011-2015 Twitter, Inc. +License: Expat + +Files: modules/http/static/selectize.bootstrap3.css + modules/http/static/selectize.min.js +Copyright: 2013–2015 Brian Reavis & contributors +License: Apache-2.0 + +Files: tests/config/tapered/* +Copyright: 2012-2017, Peter Aronoff +License: BSD-3-clause + +License: LGPL-2.1 + This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + . + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + . + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/LGPL-2.1". + +License: GPL-3.0+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + +License: Expat + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +License: CC0 + Statement of Purpose + . + The laws of most jurisdictions throughout the world automatically + confer exclusive Copyright and Related Rights (defined below) upon + the creator and subsequent owner(s) (each and all, an "owner") of an + original work of authorship and/or a database (each, a "Work"). + . + Certain owners wish to permanently relinquish those rights to a Work + for the purpose of contributing to a commons of creative, cultural + and scientific works ("Commons") that the public can reliably and + without fear of later claims of infringement build upon, modify, + incorporate in other works, reuse and redistribute as freely as + possible in any form whatsoever and for any purposes, including + without limitation commercial purposes. These owners may contribute + to the Commons to promote the ideal of a free culture and the further + production of creative, cultural and scientific works, or to gain + reputation or greater distribution for their Work in part through the + use and efforts of others. + . + For these and/or other purposes and motivations, and without any + expectation of additional consideration or compensation, the person + associating CC0 with a Work (the "Affirmer"), to the extent that he + or she is an owner of Copyright and Related Rights in the Work, + voluntarily elects to apply CC0 to the Work and publicly distribute + the Work under its terms, with knowledge of his or her Copyright and + Related Rights in the Work and the meaning and intended legal effect + of CC0 on those rights. + . + 1. Copyright and Related Rights. A Work made available under CC0 may + be protected by copyright and related or neighboring rights + ("Copyright and Related Rights"). Copyright and Related Rights + include, but are not limited to, the following: + . + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or + performer(s); + iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a + Work, subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse + of data in a Work; + vi. database rights (such as those arising under Directive 96/9/EC + of the European Parliament and of the Council of 11 March 1996 + on the legal protection of databases, and under any national + implementation thereof, including any amended or successor + version of such directive); and + vii. other similar, equivalent or corresponding rights throughout + the world based on applicable law or treaty, and any national + implementations thereof. + . + 2. Waiver. To the greatest extent permitted by, but not in + contravention of, applicable law, Affirmer hereby overtly, fully, + permanently, irrevocably and unconditionally waives, abandons, and + surrenders all of Affirmer's Copyright and Related Rights and + associated claims and causes of action, whether now known or + unknown (including existing as well as future claims and causes of + action), in the Work (i) in all territories worldwide, (ii) for + the maximum duration provided by applicable law or treaty + (including future time extensions), (iii) in any current or future + medium and for any number of copies, and (iv) for any purpose + whatsoever, including without limitation commercial, advertising + or promotional purposes (the "Waiver"). Affirmer makes the Waiver + for the benefit of each member of the public at large and to the + detriment of Affirmer's heirs and successors, fully intending that + such Waiver shall not be subject to revocation, rescission, + cancellation, termination, or any other legal or equitable action + to disrupt the quiet enjoyment of the Work by the public as + contemplated by Affirmer's express Statement of Purpose. + . + 3. Public License Fallback. Should any part of the Waiver for any + reason be judged legally invalid or ineffective under applicable + law, then the Waiver shall be preserved to the maximum extent + permitted taking into account Affirmer's express Statement of + Purpose. In addition, to the extent the Waiver is so judged + Affirmer hereby grants to each affected person a royalty-free, non + transferable, non sublicensable, non exclusive, irrevocable and + unconditional license to exercise Affirmer's Copyright and Related + Rights in the Work (i) in all territories worldwide, (ii) for the + maximum duration provided by applicable law or treaty (including + future time extensions), (iii) in any current or future medium and + for any number of copies, and (iv) for any purpose whatsoever, + including without limitation commercial, advertising or + promotional purposes (the "License"). The License shall be deemed + effective as of the date CC0 was applied by Affirmer to the + Work. Should any part of the License for any reason be judged + legally invalid or ineffective under applicable law, such partial + invalidity or ineffectiveness shall not invalidate the remainder + of the License, and in such case Affirmer hereby affirms that he + or she will not (i) exercise any of his or her remaining Copyright + and Related Rights in the Work or (ii) assert any associated + claims and causes of action with respect to the Work, in either + case contrary to Affirmer's express Statement of Purpose. + . + 4. Limitations and Disclaimers. + . + a. No trademark or patent rights held by Affirmer are waived, + abandoned, surrendered, licensed or otherwise affected by this + document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties + of title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, + accuracy, or the present or absence of errors, whether or not + discoverable, all to the greatest extent permissible under + applicable law. + c. Affirmer disclaims responsibility for clearing rights of other + persons that may apply to the Work or any use thereof, including + without limitation any person's Copyright and Related Rights in + the Work. Further, Affirmer disclaims responsibility for + obtaining any necessary consents, permissions or other rights + required for any use of the Work. + d. Affirmer understands and acknowledges that Creative Commons is + not a party to this document and has no duty or obligation with + respect to this CC0 or use of the Work. + +License: BSD-3-CloudFlare + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + . + 3. Neither the name of CloudFlare, Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD-3-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + 3. Neither the name of the author nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: GPL-2 + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + . + On Debian systems, the complete text of the GNU General Public + License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: Apache-2.0 + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + . + https://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian systems, the full text of the Apache Software License version 2 can + be found in the file `/usr/share/common-licenses/Apache-2.0'. + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +License: CC0-1.0 + This work is licensed under the "Creative Commons Zero" license. + . + On debian systems, a copy of the Creative Commons Zero license may be + found at /usr/share/common-licenses/CC0-1.0. + +License: public-domain + This work has been released into the public domain. The map + implementation builds off of prior public domain work from Dan + Bernstein (qhasm) and Adam Langley (critbit). diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..b43bf86 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README.md diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..ff17343 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,10 @@ +[DEFAULT] +debian-branch = debian/master +debian-tag = debian/%(version)s +upstream-branch = upstream +upstream-tag = upstream/%(version)s +upstream-vcs-tag = v%(version)s +pristine-tar = True + +[dch] +meta = 1 diff --git a/debian/init-d-script b/debian/init-d-script new file mode 100755 index 0000000..334dc32 --- /dev/null +++ b/debian/init-d-script @@ -0,0 +1,239 @@ +#!/bin/sh +# See init-d-script(5) for instructions on how to use this library. +#============================================================================= +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.2-14) to ensure that this file is present +# and status_of_proc is working. +. /lib/lsb/init-functions + +# PATH should only include /usr/* if it runs after the mountnfs.sh +# script. Scripts running before mountnfs.sh should remove the /usr/* +# entries. +PATH=/sbin:/usr/sbin:/bin:/usr/bin +export PATH + +is_call_implemented() { + command -V $1 > /dev/null 2>&1 +} + +do_usage() { + if is_call_implemented do_reload ; then + echo "Usage: $SCRIPTNAME {start|stop|status|reload|restart|try-restart|force-reload}" >&2 + else + echo "Usage: $SCRIPTNAME {start|stop|status|restart|try-restart|force-reload}" >&2 + fi +} + +call() { + cmd="$1" + shift + if is_call_implemented ${cmd}_override ; then + ${cmd}_override "$@" + else + ${cmd} "$@" + fi +} + +# +# Function that starts the daemon/service +# + +# Return +# 0 if daemon has been started +# 1 if daemon was already running +# 2 if daemon could not be started +do_start_cmd() { + start-stop-daemon --start --quiet ${PIDFILE:+--pidfile ${PIDFILE}} \ + $START_ARGS \ + --startas $DAEMON --name $NAME --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet ${PIDFILE:+--pidfile ${PIDFILE}} \ + $START_ARGS \ + --startas $DAEMON --name $NAME --exec $DAEMON -- $DAEMON_ARGS \ + || return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +do_start() +{ + if is_call_implemented do_start_prepare ; then + call do_start_prepare + fi + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + call do_start_cmd + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + if is_call_implemented do_start_cleanup ; then + call do_start_cleanup + fi +} + +# +# Function that stops the daemon/service +# + +# Return +# 0 if daemon has been stopped +# 1 if daemon was already stopped +# 2 if daemon could not be stopped +# other if a failure occurred +do_stop_cmd() { + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \ + $STOP_ARGS \ + ${PIDFILE:+--pidfile ${PIDFILE}} --name $NAME --exec $DAEMON + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 \ + $STOP_ARGS \ + --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return $RETVAL +} + +do_stop() +{ + if is_call_implemented do_stop_prepare ; then + call do_stop_prepare + fi + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + call do_stop_cmd + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + if is_call_implemented do_stop_cleanup ; then + call do_stop_cleanup + fi +} + +do_restart() { + [ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME" + call do_stop_cmd + call do_start_cmd + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac +} + +do_force_reload() { + if is_call_implemented do_reload ; then + call do_reload + else + call do_restart + fi +} + +# Enable this using +# alias do_reload=do_reload_sigusr1 +do_reload_sigusr1() { + log_daemon_msg "Reloading $DESC configuration files" "$NAME" + start-stop-daemon --oknodo --stop --signal 1 --quiet \ + --pidfile "$PIDFILE" --exec "$DAEMON" + log_end_msg $? +} + +do_status() { + status_of_proc "$DAEMON" "$NAME" && return 0 || return $? +} + +if [ "$DEBUG" = "true" ] ; then + set -x +fi + +SCRIPTNAME=$1 +scriptbasename="$(basename $1)" +if [ "$scriptbasename" != "init-d-script" ] ; then + script="$1" + shift + . $script +else + exit 0 +fi + +NAME=${NAME:=$(basename $DAEMON)} +DESC=${DESC:=$NAME} + +# Do not use pid file if $PIDFILE is 'none'. Otherwise, generate from +# $NAME or use the value provided by the init.d script. +if [ none = "$PIDFILE" ] ; then + PIDFILE= +elif [ -z "$PIDFILE" ] ; then + PIDFILE=/var/run/$NAME.pid +fi + +# Exit if the package is not installed +if [ none != "$DAEMON" ] && [ ! -x "$DAEMON" ] ; then + exit 0 +fi + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh +if [ -t 0 ] ; then # Be verbose when called from a terminal + VERBOSE=yes +fi + +case "$1" in + start) + call do_start + ;; + stop) + call do_stop + ;; + status) + call do_status + ;; + reload) + if is_call_implemented do_reload ; then + do_reload + else + call do_usage + exit 3 + fi + ;; + force-reload) + call do_force_reload + ;; + restart) + call do_restart + ;; + try-restart) + log_daemon_msg "Trying to restart $DESC" "$NAME" + if call do_status > /dev/null 2>&1 ; then + call do_restart + log_end_msg $? + else + log_progress_msg "is not running." + log_end_msg 1 + fi + ;; + '') + call do_usage + exit 3 + ;; + *) + if is_call_implemented do_unknown ; then + call do_unknown "$1" + exit 3 + else + call do_usage + exit 3 + fi + ;; +esac +exit 0 diff --git a/debian/knot-resolver-doc.doc-base b/debian/knot-resolver-doc.doc-base new file mode 100644 index 0000000..32b415d --- /dev/null +++ b/debian/knot-resolver-doc.doc-base @@ -0,0 +1,12 @@ +Document: knot-resolver +Title: Knot Resolver documentation +Author: CZ.NIC labs +Abstract: Documentation for the Knot Resolver, + a caching recursive DNS resolver. Documentation + includes building from source, using the library, + and configuration and operation of the daemon. +Section: Network/Communication + +Format: HTML +Index: /usr/share/doc/knot-resolver/index.html +Files: /usr/share/doc/knot-resolver/*.html diff --git a/debian/knot-resolver-doc.docs b/debian/knot-resolver-doc.docs new file mode 100644 index 0000000..ac44141 --- /dev/null +++ b/debian/knot-resolver-doc.docs @@ -0,0 +1 @@ +usr/share/doc/knot-resolver/html/* diff --git a/debian/knot-resolver-doc.links b/debian/knot-resolver-doc.links new file mode 100644 index 0000000..4c7c74f --- /dev/null +++ b/debian/knot-resolver-doc.links @@ -0,0 +1,2 @@ +usr/share/javascript/jquery/jquery.min.js usr/share/doc/knot-resolver/_static/jquery.js +usr/share/javascript/underscore/underscore.min.js usr/share/doc/knot-resolver/_static/underscore.js diff --git a/debian/knot-resolver-module-http.install b/debian/knot-resolver-module-http.install new file mode 100644 index 0000000..0875a3f --- /dev/null +++ b/debian/knot-resolver-module-http.install @@ -0,0 +1,7 @@ +usr/lib/*/knot-resolver/kres_modules/http*.lua +usr/lib/*/knot-resolver/kres_modules/http/*.css +usr/lib/*/knot-resolver/kres_modules/http/*.ico +usr/lib/*/knot-resolver/kres_modules/http/*.js +usr/lib/*/knot-resolver/kres_modules/http/*.tpl +usr/lib/*/knot-resolver/kres_modules/http/*.woff2 +usr/lib/*/knot-resolver/kres_modules/prometheus.lua diff --git a/debian/knot-resolver-module-http.links b/debian/knot-resolver-module-http.links new file mode 100644 index 0000000..d651f6f --- /dev/null +++ b/debian/knot-resolver-module-http.links @@ -0,0 +1,6 @@ +/usr/share/fonts-glyphicons/glyphicons-halflings-regular.woff2 /usr/lib/knot-resolver/http/glyphicons-halflings-regular.woff2 +/usr/share/javascript/bootstrap/css/bootstrap-theme.min.css /usr/lib/knot-resolver/http/bootstrap-theme.min.css +/usr/share/javascript/bootstrap/css/bootstrap.min.css /usr/lib/knot-resolver/http/bootstrap.min.css +/usr/share/javascript/bootstrap/js/bootstrap.min.js /usr/lib/knot-resolver/http/bootstrap.min.js +/usr/share/javascript/d3/d3.min.js /usr/lib/knot-resolver/http/d3.js +/usr/share/javascript/jquery/jquery.min.js /usr/lib/knot-resolver/http/jquery.js diff --git a/debian/knot-resolver-module-tinyweb.install b/debian/knot-resolver-module-tinyweb.install new file mode 100644 index 0000000..905241c --- /dev/null +++ b/debian/knot-resolver-module-tinyweb.install @@ -0,0 +1 @@ +usr/lib/knot-resolver/tinyweb/* diff --git a/debian/knot-resolver.dirs b/debian/knot-resolver.dirs new file mode 100644 index 0000000..472b32a --- /dev/null +++ b/debian/knot-resolver.dirs @@ -0,0 +1,3 @@ +/etc/knot-resolver +/usr/share/doc/knot-resolver/examples/ +/var/lib/knot-resolver diff --git a/debian/knot-resolver.install b/debian/knot-resolver.install new file mode 100644 index 0000000..11c4ca8 --- /dev/null +++ b/debian/knot-resolver.install @@ -0,0 +1,36 @@ +etc/knot-resolver/kresd.conf +usr/lib/*/*.so.* +usr/lib/*/knot-resolver/*.lua +usr/lib/*/knot-resolver/*.so +usr/lib/*/knot-resolver/kres_modules/*.so +usr/lib/*/knot-resolver/kres_modules/daf.lua +usr/lib/*/knot-resolver/kres_modules/daf/* +usr/lib/*/knot-resolver/kres_modules/detect_time_jump.lua +usr/lib/*/knot-resolver/kres_modules/detect_time_skew.lua +usr/lib/*/knot-resolver/kres_modules/dns64.lua +usr/lib/*/knot-resolver/kres_modules/etcd.lua +usr/lib/*/knot-resolver/kres_modules/experimental_dot_auth.lua +usr/lib/*/knot-resolver/kres_modules/graphite.lua +usr/lib/*/knot-resolver/kres_modules/policy.lua +usr/lib/*/knot-resolver/kres_modules/predict.lua +usr/lib/*/knot-resolver/kres_modules/prefill.lua +usr/lib/*/knot-resolver/kres_modules/priming.lua +usr/lib/*/knot-resolver/kres_modules/rebinding.lua +usr/lib/*/knot-resolver/kres_modules/renumber.lua +usr/lib/*/knot-resolver/kres_modules/serve_stale.lua +usr/lib/*/knot-resolver/kres_modules/ta_sentinel.lua +usr/lib/*/knot-resolver/kres_modules/ta_signal_query.lua +usr/lib/*/knot-resolver/kres_modules/ta_update.lua +usr/lib/*/knot-resolver/kres_modules/view.lua +usr/lib/*/knot-resolver/kres_modules/watchdog.lua +usr/lib/*/knot-resolver/kres_modules/workarounds.lua +usr/lib/systemd/system/kres-cache-gc.service lib/systemd/system/ +usr/lib/systemd/system/kresd.target lib/systemd/system/ +usr/lib/systemd/system/kresd@.service lib/systemd/system/ +usr/lib/tmpfiles.d/knot-resolver.conf +usr/sbin/kres-cache-gc +usr/sbin/kresc +usr/sbin/kresd +usr/share/doc/knot-resolver/examples +usr/share/man/man7/kresd.systemd.7 +usr/share/man/man8/kresd.8 diff --git a/debian/knot-resolver.kresd.default b/debian/knot-resolver.kresd.default new file mode 100644 index 0000000..f7c46e5 --- /dev/null +++ b/debian/knot-resolver.kresd.default @@ -0,0 +1,13 @@ +# /etc/default/kresd + +# This file is used only under sysvinit. If you use systemd and you +# want to modify the arguments with which kresd is invoked, you should +# instead use "systemctl edit kresd@.service" to override ExecStart= +# in the [Service] section (see kresd.systemd(7) for more details). + +# For sysvinit users: KRESD_ARGS used to exist for historical reasons, +# but that variable is deprecated and may stop working at some point +# in the future. You are encouraged to merge any local changes into +# DAEMON_ARGS directly. + +DAEMON_ARGS="--config=/etc/knot-resolver/kresd.conf --addr=127.0.0.1#53 --addr=::1#53 $KRESD_ARGS" diff --git a/debian/knot-resolver.kresd.init b/debian/knot-resolver.kresd.init new file mode 100644 index 0000000..b1361fd --- /dev/null +++ b/debian/knot-resolver.kresd.init @@ -0,0 +1,59 @@ +#!/bin/sh +# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing. +if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then + if [ -x /lib/init/init-d-script ]; then + set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script + else + set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /usr/lib/knot-resolver/init-d-script + fi +fi +### BEGIN INIT INFO +# Provides: kresd +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Knot Resolver +# Description: Knot Resolver +### END INIT INFO + +# Author: Ondřej Surý + +NAME=kresd +DESC="Knot Resolver" +DAEMON=/usr/sbin/kresd +START_ARGS="--background --make-pidfile" + +do_tmpfiles() { + local tmpfile type path mode user group age argument + tmpfile=/usr/lib/tmpfiles.d/$1.conf + if [ -r "$tmpfile" ]; then + if [ -x /bin/systemd-tmpfiles ]; then + /bin/systemd-tmpfiles --create "$tmpfile" + else + while read type path mode user group age argument; do + case "$type" in + d) + mkdir -p "$path"; + chmod "$mode" "$path"; + chown "$user:$group" "$path"; + ;; + L) + if [ ! -e "$path" ]; then ln -s "$argument" "$path"; fi + ;; + \#*) + ;; + *) + log_warning_msg "tmpfile.d type '$type' is not supported yet" + ;; + esac + done < "$tmpfile" + fi + else + log_warning_msg "tmpfiles.d file '$1' doesn't exist or is not readable" + fi +} + +do_start_prepare() { + do_tmpfiles knot-resolver +} diff --git a/debian/knot-resolver.links b/debian/knot-resolver.links new file mode 100644 index 0000000..8196524 --- /dev/null +++ b/debian/knot-resolver.links @@ -0,0 +1,2 @@ +dev/null lib/systemd/system/kresd.service +lib/systemd/system/kresd.target lib/systemd/system/multi-user.target.wants/kresd.target diff --git a/debian/knot-resolver.lintian-overrides b/debian/knot-resolver.lintian-overrides new file mode 100644 index 0000000..5e0d7c3 --- /dev/null +++ b/debian/knot-resolver.lintian-overrides @@ -0,0 +1,9 @@ +# debian uses kresd.target recommended by both knot-resolver upstream and systemd upstream +# see https://gitlab.labs.nic.cz/knot/knot-resolver/merge_requests/597 +# and https://github.com/systemd/systemd/issues/9080#issuecomment-393552613 +knot-resolver: systemd-service-file-refers-to-unusual-wantedby-target lib/systemd/system/kresd@.service kresd.target +# libkres9 is not currently functional independently. see https://bugs.debian.org/923970 +knot-resolver: package-name-doesnt-match-sonames libkres9 +knot-resolver: no-symbols-control-file usr/lib/*/libkres.so.9 +# Current use of debconf no required config - 2020-12-14 +knot-resolver: no-debconf-config diff --git a/debian/knot-resolver.postinst.in b/debian/knot-resolver.postinst.in new file mode 100644 index 0000000..d403ff4 --- /dev/null +++ b/debian/knot-resolver.postinst.in @@ -0,0 +1,43 @@ +#!/bin/sh +set -e + +# Source debconf library. +. /usr/share/debconf/confmodule + +# In Debian, this should be upgrade from 3-to-5, but the following code +# and the upgrade-4-to-5.lua file come from upstream. So I keep it like +# this for uniformity. Also, the issue relies on the lack of support on +# systemd sockets since 5.x. +# upgrade-4-to-5 +export UPG_DIR=/var/lib/knot-resolver/.upgrade-4-to-5 +if [ -f ${UPG_DIR}/.unfinished ] ; then + rm -f ${UPG_DIR}/.unfinished + kresd -c /usr/lib/@DEB_HOST_MULTIARCH@/knot-resolver/upgrade-4-to-5.lua >/dev/null 2>/dev/null + db_input high knot-resolver/upgrade-buster-to-bullseye || true + db_go || true + cat ${UPG_DIR}/kresd.conf.net 2>/dev/null +fi + +if [ "$1" = "configure" ]; then + adduser --quiet --system --group --no-create-home --home /var/cache/knot-resolver knot-resolver +fi + +# Restart any running kresd instances if the root key is updated. +# Note: if knot-resolver upstream watches this file and reloads it +# upon a change, we can and should remove this trigger. +if [ "$1" = "triggered" ]; then + if [ "$2" = "/usr/share/dns/root.key" ]; then + # systemctl of the sub-services is the preferred method to restart + deb-systemd-invoke try-restart 'kresd@*.service' || true + # but if we are running sysvinit, we can try to restart that process anyway + # (kresd.service is masked on systems that use systemd) + invoke-rc.d kresd try-restart || true + fi +fi + +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then + deb-systemd-invoke try-restart 'kresd@*.service' || true + invoke-rc.d kresd try-restart || true +fi + +#DEBHELPER# diff --git a/debian/knot-resolver.postrm b/debian/knot-resolver.postrm new file mode 100644 index 0000000..78f3b6f --- /dev/null +++ b/debian/knot-resolver.postrm @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +if [ "$1" = "remove" ]; then + deb-systemd-invoke stop system-kresd.slice || true +fi + +#DEBHELPER# diff --git a/debian/knot-resolver.preinst b/debian/knot-resolver.preinst new file mode 100644 index 0000000..c6df754 --- /dev/null +++ b/debian/knot-resolver.preinst @@ -0,0 +1,29 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-3.0-or-later +set -e + +# upgrade-4-to-5 +if [ -f /lib/systemd/system/kresd.socket ] ; then + export UPG_DIR=/var/lib/knot-resolver/.upgrade-4-to-5 + mkdir -p ${UPG_DIR} + touch ${UPG_DIR}/.unfinished + + for sock in kresd.socket kresd-tls.socket ; do + if deb-systemd-helper is-enabled ${sock} 2>/dev/null | grep -qv masked ; then + #TODO: handle systems not running systemd + systemctl show ${sock} -p Listen > ${UPG_DIR}/${sock} + case "$(systemctl show ${sock} -p BindIPv6Only)" in + *ipv6-only) + touch ${UPG_DIR}/${sock}.v6only + ;; + *default) + if cat /proc/sys/net/ipv6/bindv6only | grep -q 1 ; then + touch ${UPG_DIR}/${sock}.v6only + fi + ;; + esac + fi + done +fi + +#DEBHELPER# diff --git a/debian/knot-resolver.templates b/debian/knot-resolver.templates new file mode 100644 index 0000000..931934b --- /dev/null +++ b/debian/knot-resolver.templates @@ -0,0 +1,17 @@ +Template: knot-resolver/upgrade-buster-to-bullseye +Type: note +_Description: Upgrading from Knot Resolver < 5.x + Knot Resolver configuration file requires manual upgrade. + . + Up to Knot Resolver 4.x, network interface bindings and service + start were done by default via systemd sockets. These systemd sockets + are no longer supported, and upgrading from a 3.x version (as in Debian + Buster) requires manual action to (re)enable the service. + . + Please refer to kresd.systemd(7) and to the + /usr/share/doc/knot-resolver/upgrading.html file (from + knot-resolver-doc). An online version of the latter is available at + https://knot-resolver.readthedocs.io/en/stable/upgrading.html#x-to-5-x + . + For convenience, a suggested networking configuration can be found in + the file /var/lib/knot-resolver/.upgrade-4-to-5/kresd.conf.net diff --git a/debian/knot-resolver.triggers b/debian/knot-resolver.triggers new file mode 100644 index 0000000..e8d8246 --- /dev/null +++ b/debian/knot-resolver.triggers @@ -0,0 +1 @@ +interest-noawait /usr/share/dns/root.key diff --git a/debian/missing-sources/bootstrap-theme.css b/debian/missing-sources/bootstrap-theme.css new file mode 100644 index 0000000..ebe57fb --- /dev/null +++ b/debian/missing-sources/bootstrap-theme.css @@ -0,0 +1,587 @@ +/*! + * Bootstrap v3.3.6 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ +.btn-default, +.btn-primary, +.btn-success, +.btn-info, +.btn-warning, +.btn-danger { + text-shadow: 0 -1px 0 rgba(0, 0, 0, .2); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075); +} +.btn-default:active, +.btn-primary:active, +.btn-success:active, +.btn-info:active, +.btn-warning:active, +.btn-danger:active, +.btn-default.active, +.btn-primary.active, +.btn-success.active, +.btn-info.active, +.btn-warning.active, +.btn-danger.active { + -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); + box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); +} +.btn-default.disabled, +.btn-primary.disabled, +.btn-success.disabled, +.btn-info.disabled, +.btn-warning.disabled, +.btn-danger.disabled, +.btn-default[disabled], +.btn-primary[disabled], +.btn-success[disabled], +.btn-info[disabled], +.btn-warning[disabled], +.btn-danger[disabled], +fieldset[disabled] .btn-default, +fieldset[disabled] .btn-primary, +fieldset[disabled] .btn-success, +fieldset[disabled] .btn-info, +fieldset[disabled] .btn-warning, +fieldset[disabled] .btn-danger { + -webkit-box-shadow: none; + box-shadow: none; +} +.btn-default .badge, +.btn-primary .badge, +.btn-success .badge, +.btn-info .badge, +.btn-warning .badge, +.btn-danger .badge { + text-shadow: none; +} +.btn:active, +.btn.active { + background-image: none; +} +.btn-default { + text-shadow: 0 1px 0 #fff; + background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%); + background-image: -o-linear-gradient(top, #fff 0%, #e0e0e0 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#e0e0e0)); + background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-color: #dbdbdb; + border-color: #ccc; +} +.btn-default:hover, +.btn-default:focus { + background-color: #e0e0e0; + background-position: 0 -15px; +} +.btn-default:active, +.btn-default.active { + background-color: #e0e0e0; + border-color: #dbdbdb; +} +.btn-default.disabled, +.btn-default[disabled], +fieldset[disabled] .btn-default, +.btn-default.disabled:hover, +.btn-default[disabled]:hover, +fieldset[disabled] .btn-default:hover, +.btn-default.disabled:focus, +.btn-default[disabled]:focus, +fieldset[disabled] .btn-default:focus, +.btn-default.disabled.focus, +.btn-default[disabled].focus, +fieldset[disabled] .btn-default.focus, +.btn-default.disabled:active, +.btn-default[disabled]:active, +fieldset[disabled] .btn-default:active, +.btn-default.disabled.active, +.btn-default[disabled].active, +fieldset[disabled] .btn-default.active { + background-color: #e0e0e0; + background-image: none; +} +.btn-primary { + background-image: -webkit-linear-gradient(top, #337ab7 0%, #265a88 100%); + background-image: -o-linear-gradient(top, #337ab7 0%, #265a88 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#265a88)); + background-image: linear-gradient(to bottom, #337ab7 0%, #265a88 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-color: #245580; +} +.btn-primary:hover, +.btn-primary:focus { + background-color: #265a88; + background-position: 0 -15px; +} +.btn-primary:active, +.btn-primary.active { + background-color: #265a88; + border-color: #245580; +} +.btn-primary.disabled, +.btn-primary[disabled], +fieldset[disabled] .btn-primary, +.btn-primary.disabled:hover, +.btn-primary[disabled]:hover, +fieldset[disabled] .btn-primary:hover, +.btn-primary.disabled:focus, +.btn-primary[disabled]:focus, +fieldset[disabled] .btn-primary:focus, +.btn-primary.disabled.focus, +.btn-primary[disabled].focus, +fieldset[disabled] .btn-primary.focus, +.btn-primary.disabled:active, +.btn-primary[disabled]:active, +fieldset[disabled] .btn-primary:active, +.btn-primary.disabled.active, +.btn-primary[disabled].active, +fieldset[disabled] .btn-primary.active { + background-color: #265a88; + background-image: none; +} +.btn-success { + background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%); + background-image: -o-linear-gradient(top, #5cb85c 0%, #419641 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#419641)); + background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-color: #3e8f3e; +} +.btn-success:hover, +.btn-success:focus { + background-color: #419641; + background-position: 0 -15px; +} +.btn-success:active, +.btn-success.active { + background-color: #419641; + border-color: #3e8f3e; +} +.btn-success.disabled, +.btn-success[disabled], +fieldset[disabled] .btn-success, +.btn-success.disabled:hover, +.btn-success[disabled]:hover, +fieldset[disabled] .btn-success:hover, +.btn-success.disabled:focus, +.btn-success[disabled]:focus, +fieldset[disabled] .btn-success:focus, +.btn-success.disabled.focus, +.btn-success[disabled].focus, +fieldset[disabled] .btn-success.focus, +.btn-success.disabled:active, +.btn-success[disabled]:active, +fieldset[disabled] .btn-success:active, +.btn-success.disabled.active, +.btn-success[disabled].active, +fieldset[disabled] .btn-success.active { + background-color: #419641; + background-image: none; +} +.btn-info { + background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%); + background-image: -o-linear-gradient(top, #5bc0de 0%, #2aabd2 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#2aabd2)); + background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-color: #28a4c9; +} +.btn-info:hover, +.btn-info:focus { + background-color: #2aabd2; + background-position: 0 -15px; +} +.btn-info:active, +.btn-info.active { + background-color: #2aabd2; + border-color: #28a4c9; +} +.btn-info.disabled, +.btn-info[disabled], +fieldset[disabled] .btn-info, +.btn-info.disabled:hover, +.btn-info[disabled]:hover, +fieldset[disabled] .btn-info:hover, +.btn-info.disabled:focus, +.btn-info[disabled]:focus, +fieldset[disabled] .btn-info:focus, +.btn-info.disabled.focus, +.btn-info[disabled].focus, +fieldset[disabled] .btn-info.focus, +.btn-info.disabled:active, +.btn-info[disabled]:active, +fieldset[disabled] .btn-info:active, +.btn-info.disabled.active, +.btn-info[disabled].active, +fieldset[disabled] .btn-info.active { + background-color: #2aabd2; + background-image: none; +} +.btn-warning { + background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%); + background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316)); + background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-color: #e38d13; +} +.btn-warning:hover, +.btn-warning:focus { + background-color: #eb9316; + background-position: 0 -15px; +} +.btn-warning:active, +.btn-warning.active { + background-color: #eb9316; + border-color: #e38d13; +} +.btn-warning.disabled, +.btn-warning[disabled], +fieldset[disabled] .btn-warning, +.btn-warning.disabled:hover, +.btn-warning[disabled]:hover, +fieldset[disabled] .btn-warning:hover, +.btn-warning.disabled:focus, +.btn-warning[disabled]:focus, +fieldset[disabled] .btn-warning:focus, +.btn-warning.disabled.focus, +.btn-warning[disabled].focus, +fieldset[disabled] .btn-warning.focus, +.btn-warning.disabled:active, +.btn-warning[disabled]:active, +fieldset[disabled] .btn-warning:active, +.btn-warning.disabled.active, +.btn-warning[disabled].active, +fieldset[disabled] .btn-warning.active { + background-color: #eb9316; + background-image: none; +} +.btn-danger { + background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%); + background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a)); + background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-color: #b92c28; +} +.btn-danger:hover, +.btn-danger:focus { + background-color: #c12e2a; + background-position: 0 -15px; +} +.btn-danger:active, +.btn-danger.active { + background-color: #c12e2a; + border-color: #b92c28; +} +.btn-danger.disabled, +.btn-danger[disabled], +fieldset[disabled] .btn-danger, +.btn-danger.disabled:hover, +.btn-danger[disabled]:hover, +fieldset[disabled] .btn-danger:hover, +.btn-danger.disabled:focus, +.btn-danger[disabled]:focus, +fieldset[disabled] .btn-danger:focus, +.btn-danger.disabled.focus, +.btn-danger[disabled].focus, +fieldset[disabled] .btn-danger.focus, +.btn-danger.disabled:active, +.btn-danger[disabled]:active, +fieldset[disabled] .btn-danger:active, +.btn-danger.disabled.active, +.btn-danger[disabled].active, +fieldset[disabled] .btn-danger.active { + background-color: #c12e2a; + background-image: none; +} +.thumbnail, +.img-thumbnail { + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075); + box-shadow: 0 1px 2px rgba(0, 0, 0, .075); +} +.dropdown-menu > li > a:hover, +.dropdown-menu > li > a:focus { + background-color: #e8e8e8; + background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); + background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8)); + background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); + background-repeat: repeat-x; +} +.dropdown-menu > .active > a, +.dropdown-menu > .active > a:hover, +.dropdown-menu > .active > a:focus { + background-color: #2e6da4; + background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%); + background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4)); + background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0); + background-repeat: repeat-x; +} +.navbar-default { + background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%); + background-image: -o-linear-gradient(top, #fff 0%, #f8f8f8 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f8f8f8)); + background-image: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075); +} +.navbar-default .navbar-nav > .open > a, +.navbar-default .navbar-nav > .active > a { + background-image: -webkit-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%); + background-image: -o-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#dbdbdb), to(#e2e2e2)); + background-image: linear-gradient(to bottom, #dbdbdb 0%, #e2e2e2 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0); + background-repeat: repeat-x; + -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075); + box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075); +} +.navbar-brand, +.navbar-nav > li > a { + text-shadow: 0 1px 0 rgba(255, 255, 255, .25); +} +.navbar-inverse { + background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%); + background-image: -o-linear-gradient(top, #3c3c3c 0%, #222 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#222)); + background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-radius: 4px; +} +.navbar-inverse .navbar-nav > .open > a, +.navbar-inverse .navbar-nav > .active > a { + background-image: -webkit-linear-gradient(top, #080808 0%, #0f0f0f 100%); + background-image: -o-linear-gradient(top, #080808 0%, #0f0f0f 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#080808), to(#0f0f0f)); + background-image: linear-gradient(to bottom, #080808 0%, #0f0f0f 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0); + background-repeat: repeat-x; + -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25); + box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25); +} +.navbar-inverse .navbar-brand, +.navbar-inverse .navbar-nav > li > a { + text-shadow: 0 -1px 0 rgba(0, 0, 0, .25); +} +.navbar-static-top, +.navbar-fixed-top, +.navbar-fixed-bottom { + border-radius: 0; +} +@media (max-width: 767px) { + .navbar .navbar-nav .open .dropdown-menu > .active > a, + .navbar .navbar-nav .open .dropdown-menu > .active > a:hover, + .navbar .navbar-nav .open .dropdown-menu > .active > a:focus { + color: #fff; + background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%); + background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4)); + background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0); + background-repeat: repeat-x; + } +} +.alert { + text-shadow: 0 1px 0 rgba(255, 255, 255, .2); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05); +} +.alert-success { + background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); + background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc)); + background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0); + background-repeat: repeat-x; + border-color: #b2dba1; +} +.alert-info { + background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%); + background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0)); + background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0); + background-repeat: repeat-x; + border-color: #9acfea; +} +.alert-warning { + background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); + background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0)); + background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0); + background-repeat: repeat-x; + border-color: #f5e79e; +} +.alert-danger { + background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); + background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3)); + background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0); + background-repeat: repeat-x; + border-color: #dca7a7; +} +.progress { + background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); + background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5)); + background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0); + background-repeat: repeat-x; +} +.progress-bar { + background-image: -webkit-linear-gradient(top, #337ab7 0%, #286090 100%); + background-image: -o-linear-gradient(top, #337ab7 0%, #286090 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#286090)); + background-image: linear-gradient(to bottom, #337ab7 0%, #286090 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0); + background-repeat: repeat-x; +} +.progress-bar-success { + background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%); + background-image: -o-linear-gradient(top, #5cb85c 0%, #449d44 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#449d44)); + background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0); + background-repeat: repeat-x; +} +.progress-bar-info { + background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); + background-image: -o-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#31b0d5)); + background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0); + background-repeat: repeat-x; +} +.progress-bar-warning { + background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); + background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f)); + background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0); + background-repeat: repeat-x; +} +.progress-bar-danger { + background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%); + background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c)); + background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0); + background-repeat: repeat-x; +} +.progress-bar-striped { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); +} +.list-group { + border-radius: 4px; + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075); + box-shadow: 0 1px 2px rgba(0, 0, 0, .075); +} +.list-group-item.active, +.list-group-item.active:hover, +.list-group-item.active:focus { + text-shadow: 0 -1px 0 #286090; + background-image: -webkit-linear-gradient(top, #337ab7 0%, #2b669a 100%); + background-image: -o-linear-gradient(top, #337ab7 0%, #2b669a 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2b669a)); + background-image: linear-gradient(to bottom, #337ab7 0%, #2b669a 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0); + background-repeat: repeat-x; + border-color: #2b669a; +} +.list-group-item.active .badge, +.list-group-item.active:hover .badge, +.list-group-item.active:focus .badge { + text-shadow: none; +} +.panel { + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05); + box-shadow: 0 1px 2px rgba(0, 0, 0, .05); +} +.panel-default > .panel-heading { + background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); + background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8)); + background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); + background-repeat: repeat-x; +} +.panel-primary > .panel-heading { + background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%); + background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4)); + background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0); + background-repeat: repeat-x; +} +.panel-success > .panel-heading { + background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); + background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6)); + background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0); + background-repeat: repeat-x; +} +.panel-info > .panel-heading { + background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); + background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3)); + background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0); + background-repeat: repeat-x; +} +.panel-warning > .panel-heading { + background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); + background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc)); + background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0); + background-repeat: repeat-x; +} +.panel-danger > .panel-heading { + background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%); + background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc)); + background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0); + background-repeat: repeat-x; +} +.well { + background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); + background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5)); + background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0); + background-repeat: repeat-x; + border-color: #dcdcdc; + -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1); + box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1); +} +/*# sourceMappingURL=bootstrap-theme.css.map */ diff --git a/debian/missing-sources/bootstrap.css b/debian/missing-sources/bootstrap.css new file mode 100644 index 0000000..42c79d6 --- /dev/null +++ b/debian/missing-sources/bootstrap.css @@ -0,0 +1,6760 @@ +/*! + * Bootstrap v3.3.6 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ +/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ +html { + font-family: sans-serif; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} +body { + margin: 0; +} +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} +audio, +canvas, +progress, +video { + display: inline-block; + vertical-align: baseline; +} +audio:not([controls]) { + display: none; + height: 0; +} +[hidden], +template { + display: none; +} +a { + background-color: transparent; +} +a:active, +a:hover { + outline: 0; +} +abbr[title] { + border-bottom: 1px dotted; +} +b, +strong { + font-weight: bold; +} +dfn { + font-style: italic; +} +h1 { + margin: .67em 0; + font-size: 2em; +} +mark { + color: #000; + background: #ff0; +} +small { + font-size: 80%; +} +sub, +sup { + position: relative; + font-size: 75%; + line-height: 0; + vertical-align: baseline; +} +sup { + top: -.5em; +} +sub { + bottom: -.25em; +} +img { + border: 0; +} +svg:not(:root) { + overflow: hidden; +} +figure { + margin: 1em 40px; +} +hr { + height: 0; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; +} +pre { + overflow: auto; +} +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} +button, +input, +optgroup, +select, +textarea { + margin: 0; + font: inherit; + color: inherit; +} +button { + overflow: visible; +} +button, +select { + text-transform: none; +} +button, +html input[type="button"], +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; + cursor: pointer; +} +button[disabled], +html input[disabled] { + cursor: default; +} +button::-moz-focus-inner, +input::-moz-focus-inner { + padding: 0; + border: 0; +} +input { + line-height: normal; +} +input[type="checkbox"], +input[type="radio"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 0; +} +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} +input[type="search"] { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + -webkit-appearance: textfield; +} +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} +fieldset { + padding: .35em .625em .75em; + margin: 0 2px; + border: 1px solid #c0c0c0; +} +legend { + padding: 0; + border: 0; +} +textarea { + overflow: auto; +} +optgroup { + font-weight: bold; +} +table { + border-spacing: 0; + border-collapse: collapse; +} +td, +th { + padding: 0; +} +/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ +@media print { + *, + *:before, + *:after { + color: #000 !important; + text-shadow: none !important; + background: transparent !important; + -webkit-box-shadow: none !important; + box-shadow: none !important; + } + a, + a:visited { + text-decoration: underline; + } + a[href]:after { + content: " (" attr(href) ")"; + } + abbr[title]:after { + content: " (" attr(title) ")"; + } + a[href^="#"]:after, + a[href^="javascript:"]:after { + content: ""; + } + pre, + blockquote { + border: 1px solid #999; + + page-break-inside: avoid; + } + thead { + display: table-header-group; + } + tr, + img { + page-break-inside: avoid; + } + img { + max-width: 100% !important; + } + p, + h2, + h3 { + orphans: 3; + widows: 3; + } + h2, + h3 { + page-break-after: avoid; + } + .navbar { + display: none; + } + .btn > .caret, + .dropup > .btn > .caret { + border-top-color: #000 !important; + } + .label { + border: 1px solid #000; + } + .table { + border-collapse: collapse !important; + } + .table td, + .table th { + background-color: #fff !important; + } + .table-bordered th, + .table-bordered td { + border: 1px solid #ddd !important; + } +} +@font-face { + font-family: 'Glyphicons Halflings'; + + src: url('../fonts/glyphicons-halflings-regular.eot'); + src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); +} +.glyphicon { + position: relative; + top: 1px; + display: inline-block; + font-family: 'Glyphicons Halflings'; + font-style: normal; + font-weight: normal; + line-height: 1; + + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} +.glyphicon-asterisk:before { + content: "\002a"; +} +.glyphicon-plus:before { + content: "\002b"; +} +.glyphicon-euro:before, +.glyphicon-eur:before { + content: "\20ac"; +} +.glyphicon-minus:before { + content: "\2212"; +} +.glyphicon-cloud:before { + content: "\2601"; +} +.glyphicon-envelope:before { + content: "\2709"; +} +.glyphicon-pencil:before { + content: "\270f"; +} +.glyphicon-glass:before { + content: "\e001"; +} +.glyphicon-music:before { + content: "\e002"; +} +.glyphicon-search:before { + content: "\e003"; +} +.glyphicon-heart:before { + content: "\e005"; +} +.glyphicon-star:before { + content: "\e006"; +} +.glyphicon-star-empty:before { + content: "\e007"; +} +.glyphicon-user:before { + content: "\e008"; +} +.glyphicon-film:before { + content: "\e009"; +} +.glyphicon-th-large:before { + content: "\e010"; +} +.glyphicon-th:before { + content: "\e011"; +} +.glyphicon-th-list:before { + content: "\e012"; +} +.glyphicon-ok:before { + content: "\e013"; +} +.glyphicon-remove:before { + content: "\e014"; +} +.glyphicon-zoom-in:before { + content: "\e015"; +} +.glyphicon-zoom-out:before { + content: "\e016"; +} +.glyphicon-off:before { + content: "\e017"; +} +.glyphicon-signal:before { + content: "\e018"; +} +.glyphicon-cog:before { + content: "\e019"; +} +.glyphicon-trash:before { + content: "\e020"; +} +.glyphicon-home:before { + content: "\e021"; +} +.glyphicon-file:before { + content: "\e022"; +} +.glyphicon-time:before { + content: "\e023"; +} +.glyphicon-road:before { + content: "\e024"; +} +.glyphicon-download-alt:before { + content: "\e025"; +} +.glyphicon-download:before { + content: "\e026"; +} +.glyphicon-upload:before { + content: "\e027"; +} +.glyphicon-inbox:before { + content: "\e028"; +} +.glyphicon-play-circle:before { + content: "\e029"; +} +.glyphicon-repeat:before { + content: "\e030"; +} +.glyphicon-refresh:before { + content: "\e031"; +} +.glyphicon-list-alt:before { + content: "\e032"; +} +.glyphicon-lock:before { + content: "\e033"; +} +.glyphicon-flag:before { + content: "\e034"; +} +.glyphicon-headphones:before { + content: "\e035"; +} +.glyphicon-volume-off:before { + content: "\e036"; +} +.glyphicon-volume-down:before { + content: "\e037"; +} +.glyphicon-volume-up:before { + content: "\e038"; +} +.glyphicon-qrcode:before { + content: "\e039"; +} +.glyphicon-barcode:before { + content: "\e040"; +} +.glyphicon-tag:before { + content: "\e041"; +} +.glyphicon-tags:before { + content: "\e042"; +} +.glyphicon-book:before { + content: "\e043"; +} +.glyphicon-bookmark:before { + content: "\e044"; +} +.glyphicon-print:before { + content: "\e045"; +} +.glyphicon-camera:before { + content: "\e046"; +} +.glyphicon-font:before { + content: "\e047"; +} +.glyphicon-bold:before { + content: "\e048"; +} +.glyphicon-italic:before { + content: "\e049"; +} +.glyphicon-text-height:before { + content: "\e050"; +} +.glyphicon-text-width:before { + content: "\e051"; +} +.glyphicon-align-left:before { + content: "\e052"; +} +.glyphicon-align-center:before { + content: "\e053"; +} +.glyphicon-align-right:before { + content: "\e054"; +} +.glyphicon-align-justify:before { + content: "\e055"; +} +.glyphicon-list:before { + content: "\e056"; +} +.glyphicon-indent-left:before { + content: "\e057"; +} +.glyphicon-indent-right:before { + content: "\e058"; +} +.glyphicon-facetime-video:before { + content: "\e059"; +} +.glyphicon-picture:before { + content: "\e060"; +} +.glyphicon-map-marker:before { + content: "\e062"; +} +.glyphicon-adjust:before { + content: "\e063"; +} +.glyphicon-tint:before { + content: "\e064"; +} +.glyphicon-edit:before { + content: "\e065"; +} +.glyphicon-share:before { + content: "\e066"; +} +.glyphicon-check:before { + content: "\e067"; +} +.glyphicon-move:before { + content: "\e068"; +} +.glyphicon-step-backward:before { + content: "\e069"; +} +.glyphicon-fast-backward:before { + content: "\e070"; +} +.glyphicon-backward:before { + content: "\e071"; +} +.glyphicon-play:before { + content: "\e072"; +} +.glyphicon-pause:before { + content: "\e073"; +} +.glyphicon-stop:before { + content: "\e074"; +} +.glyphicon-forward:before { + content: "\e075"; +} +.glyphicon-fast-forward:before { + content: "\e076"; +} +.glyphicon-step-forward:before { + content: "\e077"; +} +.glyphicon-eject:before { + content: "\e078"; +} +.glyphicon-chevron-left:before { + content: "\e079"; +} +.glyphicon-chevron-right:before { + content: "\e080"; +} +.glyphicon-plus-sign:before { + content: "\e081"; +} +.glyphicon-minus-sign:before { + content: "\e082"; +} +.glyphicon-remove-sign:before { + content: "\e083"; +} +.glyphicon-ok-sign:before { + content: "\e084"; +} +.glyphicon-question-sign:before { + content: "\e085"; +} +.glyphicon-info-sign:before { + content: "\e086"; +} +.glyphicon-screenshot:before { + content: "\e087"; +} +.glyphicon-remove-circle:before { + content: "\e088"; +} +.glyphicon-ok-circle:before { + content: "\e089"; +} +.glyphicon-ban-circle:before { + content: "\e090"; +} +.glyphicon-arrow-left:before { + content: "\e091"; +} +.glyphicon-arrow-right:before { + content: "\e092"; +} +.glyphicon-arrow-up:before { + content: "\e093"; +} +.glyphicon-arrow-down:before { + content: "\e094"; +} +.glyphicon-share-alt:before { + content: "\e095"; +} +.glyphicon-resize-full:before { + content: "\e096"; +} +.glyphicon-resize-small:before { + content: "\e097"; +} +.glyphicon-exclamation-sign:before { + content: "\e101"; +} +.glyphicon-gift:before { + content: "\e102"; +} +.glyphicon-leaf:before { + content: "\e103"; +} +.glyphicon-fire:before { + content: "\e104"; +} +.glyphicon-eye-open:before { + content: "\e105"; +} +.glyphicon-eye-close:before { + content: "\e106"; +} +.glyphicon-warning-sign:before { + content: "\e107"; +} +.glyphicon-plane:before { + content: "\e108"; +} +.glyphicon-calendar:before { + content: "\e109"; +} +.glyphicon-random:before { + content: "\e110"; +} +.glyphicon-comment:before { + content: "\e111"; +} +.glyphicon-magnet:before { + content: "\e112"; +} +.glyphicon-chevron-up:before { + content: "\e113"; +} +.glyphicon-chevron-down:before { + content: "\e114"; +} +.glyphicon-retweet:before { + content: "\e115"; +} +.glyphicon-shopping-cart:before { + content: "\e116"; +} +.glyphicon-folder-close:before { + content: "\e117"; +} +.glyphicon-folder-open:before { + content: "\e118"; +} +.glyphicon-resize-vertical:before { + content: "\e119"; +} +.glyphicon-resize-horizontal:before { + content: "\e120"; +} +.glyphicon-hdd:before { + content: "\e121"; +} +.glyphicon-bullhorn:before { + content: "\e122"; +} +.glyphicon-bell:before { + content: "\e123"; +} +.glyphicon-certificate:before { + content: "\e124"; +} +.glyphicon-thumbs-up:before { + content: "\e125"; +} +.glyphicon-thumbs-down:before { + content: "\e126"; +} +.glyphicon-hand-right:before { + content: "\e127"; +} +.glyphicon-hand-left:before { + content: "\e128"; +} +.glyphicon-hand-up:before { + content: "\e129"; +} +.glyphicon-hand-down:before { + content: "\e130"; +} +.glyphicon-circle-arrow-right:before { + content: "\e131"; +} +.glyphicon-circle-arrow-left:before { + content: "\e132"; +} +.glyphicon-circle-arrow-up:before { + content: "\e133"; +} +.glyphicon-circle-arrow-down:before { + content: "\e134"; +} +.glyphicon-globe:before { + content: "\e135"; +} +.glyphicon-wrench:before { + content: "\e136"; +} +.glyphicon-tasks:before { + content: "\e137"; +} +.glyphicon-filter:before { + content: "\e138"; +} +.glyphicon-briefcase:before { + content: "\e139"; +} +.glyphicon-fullscreen:before { + content: "\e140"; +} +.glyphicon-dashboard:before { + content: "\e141"; +} +.glyphicon-paperclip:before { + content: "\e142"; +} +.glyphicon-heart-empty:before { + content: "\e143"; +} +.glyphicon-link:before { + content: "\e144"; +} +.glyphicon-phone:before { + content: "\e145"; +} +.glyphicon-pushpin:before { + content: "\e146"; +} +.glyphicon-usd:before { + content: "\e148"; +} +.glyphicon-gbp:before { + content: "\e149"; +} +.glyphicon-sort:before { + content: "\e150"; +} +.glyphicon-sort-by-alphabet:before { + content: "\e151"; +} +.glyphicon-sort-by-alphabet-alt:before { + content: "\e152"; +} +.glyphicon-sort-by-order:before { + content: "\e153"; +} +.glyphicon-sort-by-order-alt:before { + content: "\e154"; +} +.glyphicon-sort-by-attributes:before { + content: "\e155"; +} +.glyphicon-sort-by-attributes-alt:before { + content: "\e156"; +} +.glyphicon-unchecked:before { + content: "\e157"; +} +.glyphicon-expand:before { + content: "\e158"; +} +.glyphicon-collapse-down:before { + content: "\e159"; +} +.glyphicon-collapse-up:before { + content: "\e160"; +} +.glyphicon-log-in:before { + content: "\e161"; +} +.glyphicon-flash:before { + content: "\e162"; +} +.glyphicon-log-out:before { + content: "\e163"; +} +.glyphicon-new-window:before { + content: "\e164"; +} +.glyphicon-record:before { + content: "\e165"; +} +.glyphicon-save:before { + content: "\e166"; +} +.glyphicon-open:before { + content: "\e167"; +} +.glyphicon-saved:before { + content: "\e168"; +} +.glyphicon-import:before { + content: "\e169"; +} +.glyphicon-export:before { + content: "\e170"; +} +.glyphicon-send:before { + content: "\e171"; +} +.glyphicon-floppy-disk:before { + content: "\e172"; +} +.glyphicon-floppy-saved:before { + content: "\e173"; +} +.glyphicon-floppy-remove:before { + content: "\e174"; +} +.glyphicon-floppy-save:before { + content: "\e175"; +} +.glyphicon-floppy-open:before { + content: "\e176"; +} +.glyphicon-credit-card:before { + content: "\e177"; +} +.glyphicon-transfer:before { + content: "\e178"; +} +.glyphicon-cutlery:before { + content: "\e179"; +} +.glyphicon-header:before { + content: "\e180"; +} +.glyphicon-compressed:before { + content: "\e181"; +} +.glyphicon-earphone:before { + content: "\e182"; +} +.glyphicon-phone-alt:before { + content: "\e183"; +} +.glyphicon-tower:before { + content: "\e184"; +} +.glyphicon-stats:before { + content: "\e185"; +} +.glyphicon-sd-video:before { + content: "\e186"; +} +.glyphicon-hd-video:before { + content: "\e187"; +} +.glyphicon-subtitles:before { + content: "\e188"; +} +.glyphicon-sound-stereo:before { + content: "\e189"; +} +.glyphicon-sound-dolby:before { + content: "\e190"; +} +.glyphicon-sound-5-1:before { + content: "\e191"; +} +.glyphicon-sound-6-1:before { + content: "\e192"; +} +.glyphicon-sound-7-1:before { + content: "\e193"; +} +.glyphicon-copyright-mark:before { + content: "\e194"; +} +.glyphicon-registration-mark:before { + content: "\e195"; +} +.glyphicon-cloud-download:before { + content: "\e197"; +} +.glyphicon-cloud-upload:before { + content: "\e198"; +} +.glyphicon-tree-conifer:before { + content: "\e199"; +} +.glyphicon-tree-deciduous:before { + content: "\e200"; +} +.glyphicon-cd:before { + content: "\e201"; +} +.glyphicon-save-file:before { + content: "\e202"; +} +.glyphicon-open-file:before { + content: "\e203"; +} +.glyphicon-level-up:before { + content: "\e204"; +} +.glyphicon-copy:before { + content: "\e205"; +} +.glyphicon-paste:before { + content: "\e206"; +} +.glyphicon-alert:before { + content: "\e209"; +} +.glyphicon-equalizer:before { + content: "\e210"; +} +.glyphicon-king:before { + content: "\e211"; +} +.glyphicon-queen:before { + content: "\e212"; +} +.glyphicon-pawn:before { + content: "\e213"; +} +.glyphicon-bishop:before { + content: "\e214"; +} +.glyphicon-knight:before { + content: "\e215"; +} +.glyphicon-baby-formula:before { + content: "\e216"; +} +.glyphicon-tent:before { + content: "\26fa"; +} +.glyphicon-blackboard:before { + content: "\e218"; +} +.glyphicon-bed:before { + content: "\e219"; +} +.glyphicon-apple:before { + content: "\f8ff"; +} +.glyphicon-erase:before { + content: "\e221"; +} +.glyphicon-hourglass:before { + content: "\231b"; +} +.glyphicon-lamp:before { + content: "\e223"; +} +.glyphicon-duplicate:before { + content: "\e224"; +} +.glyphicon-piggy-bank:before { + content: "\e225"; +} +.glyphicon-scissors:before { + content: "\e226"; +} +.glyphicon-bitcoin:before { + content: "\e227"; +} +.glyphicon-btc:before { + content: "\e227"; +} +.glyphicon-xbt:before { + content: "\e227"; +} +.glyphicon-yen:before { + content: "\00a5"; +} +.glyphicon-jpy:before { + content: "\00a5"; +} +.glyphicon-ruble:before { + content: "\20bd"; +} +.glyphicon-rub:before { + content: "\20bd"; +} +.glyphicon-scale:before { + content: "\e230"; +} +.glyphicon-ice-lolly:before { + content: "\e231"; +} +.glyphicon-ice-lolly-tasted:before { + content: "\e232"; +} +.glyphicon-education:before { + content: "\e233"; +} +.glyphicon-option-horizontal:before { + content: "\e234"; +} +.glyphicon-option-vertical:before { + content: "\e235"; +} +.glyphicon-menu-hamburger:before { + content: "\e236"; +} +.glyphicon-modal-window:before { + content: "\e237"; +} +.glyphicon-oil:before { + content: "\e238"; +} +.glyphicon-grain:before { + content: "\e239"; +} +.glyphicon-sunglasses:before { + content: "\e240"; +} +.glyphicon-text-size:before { + content: "\e241"; +} +.glyphicon-text-color:before { + content: "\e242"; +} +.glyphicon-text-background:before { + content: "\e243"; +} +.glyphicon-object-align-top:before { + content: "\e244"; +} +.glyphicon-object-align-bottom:before { + content: "\e245"; +} +.glyphicon-object-align-horizontal:before { + content: "\e246"; +} +.glyphicon-object-align-left:before { + content: "\e247"; +} +.glyphicon-object-align-vertical:before { + content: "\e248"; +} +.glyphicon-object-align-right:before { + content: "\e249"; +} +.glyphicon-triangle-right:before { + content: "\e250"; +} +.glyphicon-triangle-left:before { + content: "\e251"; +} +.glyphicon-triangle-bottom:before { + content: "\e252"; +} +.glyphicon-triangle-top:before { + content: "\e253"; +} +.glyphicon-console:before { + content: "\e254"; +} +.glyphicon-superscript:before { + content: "\e255"; +} +.glyphicon-subscript:before { + content: "\e256"; +} +.glyphicon-menu-left:before { + content: "\e257"; +} +.glyphicon-menu-right:before { + content: "\e258"; +} +.glyphicon-menu-down:before { + content: "\e259"; +} +.glyphicon-menu-up:before { + content: "\e260"; +} +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +*:before, +*:after { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +html { + font-size: 10px; + + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} +body { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 1.42857143; + color: #333; + background-color: #fff; +} +input, +button, +select, +textarea { + font-family: inherit; + font-size: inherit; + line-height: inherit; +} +a { + color: #337ab7; + text-decoration: none; +} +a:hover, +a:focus { + color: #23527c; + text-decoration: underline; +} +a:focus { + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +figure { + margin: 0; +} +img { + vertical-align: middle; +} +.img-responsive, +.thumbnail > img, +.thumbnail a > img, +.carousel-inner > .item > img, +.carousel-inner > .item > a > img { + display: block; + max-width: 100%; + height: auto; +} +.img-rounded { + border-radius: 6px; +} +.img-thumbnail { + display: inline-block; + max-width: 100%; + height: auto; + padding: 4px; + line-height: 1.42857143; + background-color: #fff; + border: 1px solid #ddd; + border-radius: 4px; + -webkit-transition: all .2s ease-in-out; + -o-transition: all .2s ease-in-out; + transition: all .2s ease-in-out; +} +.img-circle { + border-radius: 50%; +} +hr { + margin-top: 20px; + margin-bottom: 20px; + border: 0; + border-top: 1px solid #eee; +} +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + border: 0; +} +.sr-only-focusable:active, +.sr-only-focusable:focus { + position: static; + width: auto; + height: auto; + margin: 0; + overflow: visible; + clip: auto; +} +[role="button"] { + cursor: pointer; +} +h1, +h2, +h3, +h4, +h5, +h6, +.h1, +.h2, +.h3, +.h4, +.h5, +.h6 { + font-family: inherit; + font-weight: 500; + line-height: 1.1; + color: inherit; +} +h1 small, +h2 small, +h3 small, +h4 small, +h5 small, +h6 small, +.h1 small, +.h2 small, +.h3 small, +.h4 small, +.h5 small, +.h6 small, +h1 .small, +h2 .small, +h3 .small, +h4 .small, +h5 .small, +h6 .small, +.h1 .small, +.h2 .small, +.h3 .small, +.h4 .small, +.h5 .small, +.h6 .small { + font-weight: normal; + line-height: 1; + color: #777; +} +h1, +.h1, +h2, +.h2, +h3, +.h3 { + margin-top: 20px; + margin-bottom: 10px; +} +h1 small, +.h1 small, +h2 small, +.h2 small, +h3 small, +.h3 small, +h1 .small, +.h1 .small, +h2 .small, +.h2 .small, +h3 .small, +.h3 .small { + font-size: 65%; +} +h4, +.h4, +h5, +.h5, +h6, +.h6 { + margin-top: 10px; + margin-bottom: 10px; +} +h4 small, +.h4 small, +h5 small, +.h5 small, +h6 small, +.h6 small, +h4 .small, +.h4 .small, +h5 .small, +.h5 .small, +h6 .small, +.h6 .small { + font-size: 75%; +} +h1, +.h1 { + font-size: 36px; +} +h2, +.h2 { + font-size: 30px; +} +h3, +.h3 { + font-size: 24px; +} +h4, +.h4 { + font-size: 18px; +} +h5, +.h5 { + font-size: 14px; +} +h6, +.h6 { + font-size: 12px; +} +p { + margin: 0 0 10px; +} +.lead { + margin-bottom: 20px; + font-size: 16px; + font-weight: 300; + line-height: 1.4; +} +@media (min-width: 768px) { + .lead { + font-size: 21px; + } +} +small, +.small { + font-size: 85%; +} +mark, +.mark { + padding: .2em; + background-color: #fcf8e3; +} +.text-left { + text-align: left; +} +.text-right { + text-align: right; +} +.text-center { + text-align: center; +} +.text-justify { + text-align: justify; +} +.text-nowrap { + white-space: nowrap; +} +.text-lowercase { + text-transform: lowercase; +} +.text-uppercase { + text-transform: uppercase; +} +.text-capitalize { + text-transform: capitalize; +} +.text-muted { + color: #777; +} +.text-primary { + color: #337ab7; +} +a.text-primary:hover, +a.text-primary:focus { + color: #286090; +} +.text-success { + color: #3c763d; +} +a.text-success:hover, +a.text-success:focus { + color: #2b542c; +} +.text-info { + color: #31708f; +} +a.text-info:hover, +a.text-info:focus { + color: #245269; +} +.text-warning { + color: #8a6d3b; +} +a.text-warning:hover, +a.text-warning:focus { + color: #66512c; +} +.text-danger { + color: #a94442; +} +a.text-danger:hover, +a.text-danger:focus { + color: #843534; +} +.bg-primary { + color: #fff; + background-color: #337ab7; +} +a.bg-primary:hover, +a.bg-primary:focus { + background-color: #286090; +} +.bg-success { + background-color: #dff0d8; +} +a.bg-success:hover, +a.bg-success:focus { + background-color: #c1e2b3; +} +.bg-info { + background-color: #d9edf7; +} +a.bg-info:hover, +a.bg-info:focus { + background-color: #afd9ee; +} +.bg-warning { + background-color: #fcf8e3; +} +a.bg-warning:hover, +a.bg-warning:focus { + background-color: #f7ecb5; +} +.bg-danger { + background-color: #f2dede; +} +a.bg-danger:hover, +a.bg-danger:focus { + background-color: #e4b9b9; +} +.page-header { + padding-bottom: 9px; + margin: 40px 0 20px; + border-bottom: 1px solid #eee; +} +ul, +ol { + margin-top: 0; + margin-bottom: 10px; +} +ul ul, +ol ul, +ul ol, +ol ol { + margin-bottom: 0; +} +.list-unstyled { + padding-left: 0; + list-style: none; +} +.list-inline { + padding-left: 0; + margin-left: -5px; + list-style: none; +} +.list-inline > li { + display: inline-block; + padding-right: 5px; + padding-left: 5px; +} +dl { + margin-top: 0; + margin-bottom: 20px; +} +dt, +dd { + line-height: 1.42857143; +} +dt { + font-weight: bold; +} +dd { + margin-left: 0; +} +@media (min-width: 768px) { + .dl-horizontal dt { + float: left; + width: 160px; + overflow: hidden; + clear: left; + text-align: right; + text-overflow: ellipsis; + white-space: nowrap; + } + .dl-horizontal dd { + margin-left: 180px; + } +} +abbr[title], +abbr[data-original-title] { + cursor: help; + border-bottom: 1px dotted #777; +} +.initialism { + font-size: 90%; + text-transform: uppercase; +} +blockquote { + padding: 10px 20px; + margin: 0 0 20px; + font-size: 17.5px; + border-left: 5px solid #eee; +} +blockquote p:last-child, +blockquote ul:last-child, +blockquote ol:last-child { + margin-bottom: 0; +} +blockquote footer, +blockquote small, +blockquote .small { + display: block; + font-size: 80%; + line-height: 1.42857143; + color: #777; +} +blockquote footer:before, +blockquote small:before, +blockquote .small:before { + content: '\2014 \00A0'; +} +.blockquote-reverse, +blockquote.pull-right { + padding-right: 15px; + padding-left: 0; + text-align: right; + border-right: 5px solid #eee; + border-left: 0; +} +.blockquote-reverse footer:before, +blockquote.pull-right footer:before, +.blockquote-reverse small:before, +blockquote.pull-right small:before, +.blockquote-reverse .small:before, +blockquote.pull-right .small:before { + content: ''; +} +.blockquote-reverse footer:after, +blockquote.pull-right footer:after, +.blockquote-reverse small:after, +blockquote.pull-right small:after, +.blockquote-reverse .small:after, +blockquote.pull-right .small:after { + content: '\00A0 \2014'; +} +address { + margin-bottom: 20px; + font-style: normal; + line-height: 1.42857143; +} +code, +kbd, +pre, +samp { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} +code { + padding: 2px 4px; + font-size: 90%; + color: #c7254e; + background-color: #f9f2f4; + border-radius: 4px; +} +kbd { + padding: 2px 4px; + font-size: 90%; + color: #fff; + background-color: #333; + border-radius: 3px; + -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); +} +kbd kbd { + padding: 0; + font-size: 100%; + font-weight: bold; + -webkit-box-shadow: none; + box-shadow: none; +} +pre { + display: block; + padding: 9.5px; + margin: 0 0 10px; + font-size: 13px; + line-height: 1.42857143; + color: #333; + word-break: break-all; + word-wrap: break-word; + background-color: #f5f5f5; + border: 1px solid #ccc; + border-radius: 4px; +} +pre code { + padding: 0; + font-size: inherit; + color: inherit; + white-space: pre-wrap; + background-color: transparent; + border-radius: 0; +} +.pre-scrollable { + max-height: 340px; + overflow-y: scroll; +} +.container { + padding-right: 15px; + padding-left: 15px; + margin-right: auto; + margin-left: auto; +} +@media (min-width: 768px) { + .container { + width: 750px; + } +} +@media (min-width: 992px) { + .container { + width: 970px; + } +} +@media (min-width: 1200px) { + .container { + width: 1170px; + } +} +.container-fluid { + padding-right: 15px; + padding-left: 15px; + margin-right: auto; + margin-left: auto; +} +.row { + margin-right: -15px; + margin-left: -15px; +} +.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { + position: relative; + min-height: 1px; + padding-right: 15px; + padding-left: 15px; +} +.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { + float: left; +} +.col-xs-12 { + width: 100%; +} +.col-xs-11 { + width: 91.66666667%; +} +.col-xs-10 { + width: 83.33333333%; +} +.col-xs-9 { + width: 75%; +} +.col-xs-8 { + width: 66.66666667%; +} +.col-xs-7 { + width: 58.33333333%; +} +.col-xs-6 { + width: 50%; +} +.col-xs-5 { + width: 41.66666667%; +} +.col-xs-4 { + width: 33.33333333%; +} +.col-xs-3 { + width: 25%; +} +.col-xs-2 { + width: 16.66666667%; +} +.col-xs-1 { + width: 8.33333333%; +} +.col-xs-pull-12 { + right: 100%; +} +.col-xs-pull-11 { + right: 91.66666667%; +} +.col-xs-pull-10 { + right: 83.33333333%; +} +.col-xs-pull-9 { + right: 75%; +} +.col-xs-pull-8 { + right: 66.66666667%; +} +.col-xs-pull-7 { + right: 58.33333333%; +} +.col-xs-pull-6 { + right: 50%; +} +.col-xs-pull-5 { + right: 41.66666667%; +} +.col-xs-pull-4 { + right: 33.33333333%; +} +.col-xs-pull-3 { + right: 25%; +} +.col-xs-pull-2 { + right: 16.66666667%; +} +.col-xs-pull-1 { + right: 8.33333333%; +} +.col-xs-pull-0 { + right: auto; +} +.col-xs-push-12 { + left: 100%; +} +.col-xs-push-11 { + left: 91.66666667%; +} +.col-xs-push-10 { + left: 83.33333333%; +} +.col-xs-push-9 { + left: 75%; +} +.col-xs-push-8 { + left: 66.66666667%; +} +.col-xs-push-7 { + left: 58.33333333%; +} +.col-xs-push-6 { + left: 50%; +} +.col-xs-push-5 { + left: 41.66666667%; +} +.col-xs-push-4 { + left: 33.33333333%; +} +.col-xs-push-3 { + left: 25%; +} +.col-xs-push-2 { + left: 16.66666667%; +} +.col-xs-push-1 { + left: 8.33333333%; +} +.col-xs-push-0 { + left: auto; +} +.col-xs-offset-12 { + margin-left: 100%; +} +.col-xs-offset-11 { + margin-left: 91.66666667%; +} +.col-xs-offset-10 { + margin-left: 83.33333333%; +} +.col-xs-offset-9 { + margin-left: 75%; +} +.col-xs-offset-8 { + margin-left: 66.66666667%; +} +.col-xs-offset-7 { + margin-left: 58.33333333%; +} +.col-xs-offset-6 { + margin-left: 50%; +} +.col-xs-offset-5 { + margin-left: 41.66666667%; +} +.col-xs-offset-4 { + margin-left: 33.33333333%; +} +.col-xs-offset-3 { + margin-left: 25%; +} +.col-xs-offset-2 { + margin-left: 16.66666667%; +} +.col-xs-offset-1 { + margin-left: 8.33333333%; +} +.col-xs-offset-0 { + margin-left: 0; +} +@media (min-width: 768px) { + .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { + float: left; + } + .col-sm-12 { + width: 100%; + } + .col-sm-11 { + width: 91.66666667%; + } + .col-sm-10 { + width: 83.33333333%; + } + .col-sm-9 { + width: 75%; + } + .col-sm-8 { + width: 66.66666667%; + } + .col-sm-7 { + width: 58.33333333%; + } + .col-sm-6 { + width: 50%; + } + .col-sm-5 { + width: 41.66666667%; + } + .col-sm-4 { + width: 33.33333333%; + } + .col-sm-3 { + width: 25%; + } + .col-sm-2 { + width: 16.66666667%; + } + .col-sm-1 { + width: 8.33333333%; + } + .col-sm-pull-12 { + right: 100%; + } + .col-sm-pull-11 { + right: 91.66666667%; + } + .col-sm-pull-10 { + right: 83.33333333%; + } + .col-sm-pull-9 { + right: 75%; + } + .col-sm-pull-8 { + right: 66.66666667%; + } + .col-sm-pull-7 { + right: 58.33333333%; + } + .col-sm-pull-6 { + right: 50%; + } + .col-sm-pull-5 { + right: 41.66666667%; + } + .col-sm-pull-4 { + right: 33.33333333%; + } + .col-sm-pull-3 { + right: 25%; + } + .col-sm-pull-2 { + right: 16.66666667%; + } + .col-sm-pull-1 { + right: 8.33333333%; + } + .col-sm-pull-0 { + right: auto; + } + .col-sm-push-12 { + left: 100%; + } + .col-sm-push-11 { + left: 91.66666667%; + } + .col-sm-push-10 { + left: 83.33333333%; + } + .col-sm-push-9 { + left: 75%; + } + .col-sm-push-8 { + left: 66.66666667%; + } + .col-sm-push-7 { + left: 58.33333333%; + } + .col-sm-push-6 { + left: 50%; + } + .col-sm-push-5 { + left: 41.66666667%; + } + .col-sm-push-4 { + left: 33.33333333%; + } + .col-sm-push-3 { + left: 25%; + } + .col-sm-push-2 { + left: 16.66666667%; + } + .col-sm-push-1 { + left: 8.33333333%; + } + .col-sm-push-0 { + left: auto; + } + .col-sm-offset-12 { + margin-left: 100%; + } + .col-sm-offset-11 { + margin-left: 91.66666667%; + } + .col-sm-offset-10 { + margin-left: 83.33333333%; + } + .col-sm-offset-9 { + margin-left: 75%; + } + .col-sm-offset-8 { + margin-left: 66.66666667%; + } + .col-sm-offset-7 { + margin-left: 58.33333333%; + } + .col-sm-offset-6 { + margin-left: 50%; + } + .col-sm-offset-5 { + margin-left: 41.66666667%; + } + .col-sm-offset-4 { + margin-left: 33.33333333%; + } + .col-sm-offset-3 { + margin-left: 25%; + } + .col-sm-offset-2 { + margin-left: 16.66666667%; + } + .col-sm-offset-1 { + margin-left: 8.33333333%; + } + .col-sm-offset-0 { + margin-left: 0; + } +} +@media (min-width: 992px) { + .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { + float: left; + } + .col-md-12 { + width: 100%; + } + .col-md-11 { + width: 91.66666667%; + } + .col-md-10 { + width: 83.33333333%; + } + .col-md-9 { + width: 75%; + } + .col-md-8 { + width: 66.66666667%; + } + .col-md-7 { + width: 58.33333333%; + } + .col-md-6 { + width: 50%; + } + .col-md-5 { + width: 41.66666667%; + } + .col-md-4 { + width: 33.33333333%; + } + .col-md-3 { + width: 25%; + } + .col-md-2 { + width: 16.66666667%; + } + .col-md-1 { + width: 8.33333333%; + } + .col-md-pull-12 { + right: 100%; + } + .col-md-pull-11 { + right: 91.66666667%; + } + .col-md-pull-10 { + right: 83.33333333%; + } + .col-md-pull-9 { + right: 75%; + } + .col-md-pull-8 { + right: 66.66666667%; + } + .col-md-pull-7 { + right: 58.33333333%; + } + .col-md-pull-6 { + right: 50%; + } + .col-md-pull-5 { + right: 41.66666667%; + } + .col-md-pull-4 { + right: 33.33333333%; + } + .col-md-pull-3 { + right: 25%; + } + .col-md-pull-2 { + right: 16.66666667%; + } + .col-md-pull-1 { + right: 8.33333333%; + } + .col-md-pull-0 { + right: auto; + } + .col-md-push-12 { + left: 100%; + } + .col-md-push-11 { + left: 91.66666667%; + } + .col-md-push-10 { + left: 83.33333333%; + } + .col-md-push-9 { + left: 75%; + } + .col-md-push-8 { + left: 66.66666667%; + } + .col-md-push-7 { + left: 58.33333333%; + } + .col-md-push-6 { + left: 50%; + } + .col-md-push-5 { + left: 41.66666667%; + } + .col-md-push-4 { + left: 33.33333333%; + } + .col-md-push-3 { + left: 25%; + } + .col-md-push-2 { + left: 16.66666667%; + } + .col-md-push-1 { + left: 8.33333333%; + } + .col-md-push-0 { + left: auto; + } + .col-md-offset-12 { + margin-left: 100%; + } + .col-md-offset-11 { + margin-left: 91.66666667%; + } + .col-md-offset-10 { + margin-left: 83.33333333%; + } + .col-md-offset-9 { + margin-left: 75%; + } + .col-md-offset-8 { + margin-left: 66.66666667%; + } + .col-md-offset-7 { + margin-left: 58.33333333%; + } + .col-md-offset-6 { + margin-left: 50%; + } + .col-md-offset-5 { + margin-left: 41.66666667%; + } + .col-md-offset-4 { + margin-left: 33.33333333%; + } + .col-md-offset-3 { + margin-left: 25%; + } + .col-md-offset-2 { + margin-left: 16.66666667%; + } + .col-md-offset-1 { + margin-left: 8.33333333%; + } + .col-md-offset-0 { + margin-left: 0; + } +} +@media (min-width: 1200px) { + .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { + float: left; + } + .col-lg-12 { + width: 100%; + } + .col-lg-11 { + width: 91.66666667%; + } + .col-lg-10 { + width: 83.33333333%; + } + .col-lg-9 { + width: 75%; + } + .col-lg-8 { + width: 66.66666667%; + } + .col-lg-7 { + width: 58.33333333%; + } + .col-lg-6 { + width: 50%; + } + .col-lg-5 { + width: 41.66666667%; + } + .col-lg-4 { + width: 33.33333333%; + } + .col-lg-3 { + width: 25%; + } + .col-lg-2 { + width: 16.66666667%; + } + .col-lg-1 { + width: 8.33333333%; + } + .col-lg-pull-12 { + right: 100%; + } + .col-lg-pull-11 { + right: 91.66666667%; + } + .col-lg-pull-10 { + right: 83.33333333%; + } + .col-lg-pull-9 { + right: 75%; + } + .col-lg-pull-8 { + right: 66.66666667%; + } + .col-lg-pull-7 { + right: 58.33333333%; + } + .col-lg-pull-6 { + right: 50%; + } + .col-lg-pull-5 { + right: 41.66666667%; + } + .col-lg-pull-4 { + right: 33.33333333%; + } + .col-lg-pull-3 { + right: 25%; + } + .col-lg-pull-2 { + right: 16.66666667%; + } + .col-lg-pull-1 { + right: 8.33333333%; + } + .col-lg-pull-0 { + right: auto; + } + .col-lg-push-12 { + left: 100%; + } + .col-lg-push-11 { + left: 91.66666667%; + } + .col-lg-push-10 { + left: 83.33333333%; + } + .col-lg-push-9 { + left: 75%; + } + .col-lg-push-8 { + left: 66.66666667%; + } + .col-lg-push-7 { + left: 58.33333333%; + } + .col-lg-push-6 { + left: 50%; + } + .col-lg-push-5 { + left: 41.66666667%; + } + .col-lg-push-4 { + left: 33.33333333%; + } + .col-lg-push-3 { + left: 25%; + } + .col-lg-push-2 { + left: 16.66666667%; + } + .col-lg-push-1 { + left: 8.33333333%; + } + .col-lg-push-0 { + left: auto; + } + .col-lg-offset-12 { + margin-left: 100%; + } + .col-lg-offset-11 { + margin-left: 91.66666667%; + } + .col-lg-offset-10 { + margin-left: 83.33333333%; + } + .col-lg-offset-9 { + margin-left: 75%; + } + .col-lg-offset-8 { + margin-left: 66.66666667%; + } + .col-lg-offset-7 { + margin-left: 58.33333333%; + } + .col-lg-offset-6 { + margin-left: 50%; + } + .col-lg-offset-5 { + margin-left: 41.66666667%; + } + .col-lg-offset-4 { + margin-left: 33.33333333%; + } + .col-lg-offset-3 { + margin-left: 25%; + } + .col-lg-offset-2 { + margin-left: 16.66666667%; + } + .col-lg-offset-1 { + margin-left: 8.33333333%; + } + .col-lg-offset-0 { + margin-left: 0; + } +} +table { + background-color: transparent; +} +caption { + padding-top: 8px; + padding-bottom: 8px; + color: #777; + text-align: left; +} +th { + text-align: left; +} +.table { + width: 100%; + max-width: 100%; + margin-bottom: 20px; +} +.table > thead > tr > th, +.table > tbody > tr > th, +.table > tfoot > tr > th, +.table > thead > tr > td, +.table > tbody > tr > td, +.table > tfoot > tr > td { + padding: 8px; + line-height: 1.42857143; + vertical-align: top; + border-top: 1px solid #ddd; +} +.table > thead > tr > th { + vertical-align: bottom; + border-bottom: 2px solid #ddd; +} +.table > caption + thead > tr:first-child > th, +.table > colgroup + thead > tr:first-child > th, +.table > thead:first-child > tr:first-child > th, +.table > caption + thead > tr:first-child > td, +.table > colgroup + thead > tr:first-child > td, +.table > thead:first-child > tr:first-child > td { + border-top: 0; +} +.table > tbody + tbody { + border-top: 2px solid #ddd; +} +.table .table { + background-color: #fff; +} +.table-condensed > thead > tr > th, +.table-condensed > tbody > tr > th, +.table-condensed > tfoot > tr > th, +.table-condensed > thead > tr > td, +.table-condensed > tbody > tr > td, +.table-condensed > tfoot > tr > td { + padding: 5px; +} +.table-bordered { + border: 1px solid #ddd; +} +.table-bordered > thead > tr > th, +.table-bordered > tbody > tr > th, +.table-bordered > tfoot > tr > th, +.table-bordered > thead > tr > td, +.table-bordered > tbody > tr > td, +.table-bordered > tfoot > tr > td { + border: 1px solid #ddd; +} +.table-bordered > thead > tr > th, +.table-bordered > thead > tr > td { + border-bottom-width: 2px; +} +.table-striped > tbody > tr:nth-of-type(odd) { + background-color: #f9f9f9; +} +.table-hover > tbody > tr:hover { + background-color: #f5f5f5; +} +table col[class*="col-"] { + position: static; + display: table-column; + float: none; +} +table td[class*="col-"], +table th[class*="col-"] { + position: static; + display: table-cell; + float: none; +} +.table > thead > tr > td.active, +.table > tbody > tr > td.active, +.table > tfoot > tr > td.active, +.table > thead > tr > th.active, +.table > tbody > tr > th.active, +.table > tfoot > tr > th.active, +.table > thead > tr.active > td, +.table > tbody > tr.active > td, +.table > tfoot > tr.active > td, +.table > thead > tr.active > th, +.table > tbody > tr.active > th, +.table > tfoot > tr.active > th { + background-color: #f5f5f5; +} +.table-hover > tbody > tr > td.active:hover, +.table-hover > tbody > tr > th.active:hover, +.table-hover > tbody > tr.active:hover > td, +.table-hover > tbody > tr:hover > .active, +.table-hover > tbody > tr.active:hover > th { + background-color: #e8e8e8; +} +.table > thead > tr > td.success, +.table > tbody > tr > td.success, +.table > tfoot > tr > td.success, +.table > thead > tr > th.success, +.table > tbody > tr > th.success, +.table > tfoot > tr > th.success, +.table > thead > tr.success > td, +.table > tbody > tr.success > td, +.table > tfoot > tr.success > td, +.table > thead > tr.success > th, +.table > tbody > tr.success > th, +.table > tfoot > tr.success > th { + background-color: #dff0d8; +} +.table-hover > tbody > tr > td.success:hover, +.table-hover > tbody > tr > th.success:hover, +.table-hover > tbody > tr.success:hover > td, +.table-hover > tbody > tr:hover > .success, +.table-hover > tbody > tr.success:hover > th { + background-color: #d0e9c6; +} +.table > thead > tr > td.info, +.table > tbody > tr > td.info, +.table > tfoot > tr > td.info, +.table > thead > tr > th.info, +.table > tbody > tr > th.info, +.table > tfoot > tr > th.info, +.table > thead > tr.info > td, +.table > tbody > tr.info > td, +.table > tfoot > tr.info > td, +.table > thead > tr.info > th, +.table > tbody > tr.info > th, +.table > tfoot > tr.info > th { + background-color: #d9edf7; +} +.table-hover > tbody > tr > td.info:hover, +.table-hover > tbody > tr > th.info:hover, +.table-hover > tbody > tr.info:hover > td, +.table-hover > tbody > tr:hover > .info, +.table-hover > tbody > tr.info:hover > th { + background-color: #c4e3f3; +} +.table > thead > tr > td.warning, +.table > tbody > tr > td.warning, +.table > tfoot > tr > td.warning, +.table > thead > tr > th.warning, +.table > tbody > tr > th.warning, +.table > tfoot > tr > th.warning, +.table > thead > tr.warning > td, +.table > tbody > tr.warning > td, +.table > tfoot > tr.warning > td, +.table > thead > tr.warning > th, +.table > tbody > tr.warning > th, +.table > tfoot > tr.warning > th { + background-color: #fcf8e3; +} +.table-hover > tbody > tr > td.warning:hover, +.table-hover > tbody > tr > th.warning:hover, +.table-hover > tbody > tr.warning:hover > td, +.table-hover > tbody > tr:hover > .warning, +.table-hover > tbody > tr.warning:hover > th { + background-color: #faf2cc; +} +.table > thead > tr > td.danger, +.table > tbody > tr > td.danger, +.table > tfoot > tr > td.danger, +.table > thead > tr > th.danger, +.table > tbody > tr > th.danger, +.table > tfoot > tr > th.danger, +.table > thead > tr.danger > td, +.table > tbody > tr.danger > td, +.table > tfoot > tr.danger > td, +.table > thead > tr.danger > th, +.table > tbody > tr.danger > th, +.table > tfoot > tr.danger > th { + background-color: #f2dede; +} +.table-hover > tbody > tr > td.danger:hover, +.table-hover > tbody > tr > th.danger:hover, +.table-hover > tbody > tr.danger:hover > td, +.table-hover > tbody > tr:hover > .danger, +.table-hover > tbody > tr.danger:hover > th { + background-color: #ebcccc; +} +.table-responsive { + min-height: .01%; + overflow-x: auto; +} +@media screen and (max-width: 767px) { + .table-responsive { + width: 100%; + margin-bottom: 15px; + overflow-y: hidden; + -ms-overflow-style: -ms-autohiding-scrollbar; + border: 1px solid #ddd; + } + .table-responsive > .table { + margin-bottom: 0; + } + .table-responsive > .table > thead > tr > th, + .table-responsive > .table > tbody > tr > th, + .table-responsive > .table > tfoot > tr > th, + .table-responsive > .table > thead > tr > td, + .table-responsive > .table > tbody > tr > td, + .table-responsive > .table > tfoot > tr > td { + white-space: nowrap; + } + .table-responsive > .table-bordered { + border: 0; + } + .table-responsive > .table-bordered > thead > tr > th:first-child, + .table-responsive > .table-bordered > tbody > tr > th:first-child, + .table-responsive > .table-bordered > tfoot > tr > th:first-child, + .table-responsive > .table-bordered > thead > tr > td:first-child, + .table-responsive > .table-bordered > tbody > tr > td:first-child, + .table-responsive > .table-bordered > tfoot > tr > td:first-child { + border-left: 0; + } + .table-responsive > .table-bordered > thead > tr > th:last-child, + .table-responsive > .table-bordered > tbody > tr > th:last-child, + .table-responsive > .table-bordered > tfoot > tr > th:last-child, + .table-responsive > .table-bordered > thead > tr > td:last-child, + .table-responsive > .table-bordered > tbody > tr > td:last-child, + .table-responsive > .table-bordered > tfoot > tr > td:last-child { + border-right: 0; + } + .table-responsive > .table-bordered > tbody > tr:last-child > th, + .table-responsive > .table-bordered > tfoot > tr:last-child > th, + .table-responsive > .table-bordered > tbody > tr:last-child > td, + .table-responsive > .table-bordered > tfoot > tr:last-child > td { + border-bottom: 0; + } +} +fieldset { + min-width: 0; + padding: 0; + margin: 0; + border: 0; +} +legend { + display: block; + width: 100%; + padding: 0; + margin-bottom: 20px; + font-size: 21px; + line-height: inherit; + color: #333; + border: 0; + border-bottom: 1px solid #e5e5e5; +} +label { + display: inline-block; + max-width: 100%; + margin-bottom: 5px; + font-weight: bold; +} +input[type="search"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +input[type="radio"], +input[type="checkbox"] { + margin: 4px 0 0; + margin-top: 1px \9; + line-height: normal; +} +input[type="file"] { + display: block; +} +input[type="range"] { + display: block; + width: 100%; +} +select[multiple], +select[size] { + height: auto; +} +input[type="file"]:focus, +input[type="radio"]:focus, +input[type="checkbox"]:focus { + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +output { + display: block; + padding-top: 7px; + font-size: 14px; + line-height: 1.42857143; + color: #555; +} +.form-control { + display: block; + width: 100%; + height: 34px; + padding: 6px 12px; + font-size: 14px; + line-height: 1.42857143; + color: #555; + background-color: #fff; + background-image: none; + border: 1px solid #ccc; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; + -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; + transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; +} +.form-control:focus { + border-color: #66afe9; + outline: 0; + -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6); + box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6); +} +.form-control::-moz-placeholder { + color: #999; + opacity: 1; +} +.form-control:-ms-input-placeholder { + color: #999; +} +.form-control::-webkit-input-placeholder { + color: #999; +} +.form-control::-ms-expand { + background-color: transparent; + border: 0; +} +.form-control[disabled], +.form-control[readonly], +fieldset[disabled] .form-control { + background-color: #eee; + opacity: 1; +} +.form-control[disabled], +fieldset[disabled] .form-control { + cursor: not-allowed; +} +textarea.form-control { + height: auto; +} +input[type="search"] { + -webkit-appearance: none; +} +@media screen and (-webkit-min-device-pixel-ratio: 0) { + input[type="date"].form-control, + input[type="time"].form-control, + input[type="datetime-local"].form-control, + input[type="month"].form-control { + line-height: 34px; + } + input[type="date"].input-sm, + input[type="time"].input-sm, + input[type="datetime-local"].input-sm, + input[type="month"].input-sm, + .input-group-sm input[type="date"], + .input-group-sm input[type="time"], + .input-group-sm input[type="datetime-local"], + .input-group-sm input[type="month"] { + line-height: 30px; + } + input[type="date"].input-lg, + input[type="time"].input-lg, + input[type="datetime-local"].input-lg, + input[type="month"].input-lg, + .input-group-lg input[type="date"], + .input-group-lg input[type="time"], + .input-group-lg input[type="datetime-local"], + .input-group-lg input[type="month"] { + line-height: 46px; + } +} +.form-group { + margin-bottom: 15px; +} +.radio, +.checkbox { + position: relative; + display: block; + margin-top: 10px; + margin-bottom: 10px; +} +.radio label, +.checkbox label { + min-height: 20px; + padding-left: 20px; + margin-bottom: 0; + font-weight: normal; + cursor: pointer; +} +.radio input[type="radio"], +.radio-inline input[type="radio"], +.checkbox input[type="checkbox"], +.checkbox-inline input[type="checkbox"] { + position: absolute; + margin-top: 4px \9; + margin-left: -20px; +} +.radio + .radio, +.checkbox + .checkbox { + margin-top: -5px; +} +.radio-inline, +.checkbox-inline { + position: relative; + display: inline-block; + padding-left: 20px; + margin-bottom: 0; + font-weight: normal; + vertical-align: middle; + cursor: pointer; +} +.radio-inline + .radio-inline, +.checkbox-inline + .checkbox-inline { + margin-top: 0; + margin-left: 10px; +} +input[type="radio"][disabled], +input[type="checkbox"][disabled], +input[type="radio"].disabled, +input[type="checkbox"].disabled, +fieldset[disabled] input[type="radio"], +fieldset[disabled] input[type="checkbox"] { + cursor: not-allowed; +} +.radio-inline.disabled, +.checkbox-inline.disabled, +fieldset[disabled] .radio-inline, +fieldset[disabled] .checkbox-inline { + cursor: not-allowed; +} +.radio.disabled label, +.checkbox.disabled label, +fieldset[disabled] .radio label, +fieldset[disabled] .checkbox label { + cursor: not-allowed; +} +.form-control-static { + min-height: 34px; + padding-top: 7px; + padding-bottom: 7px; + margin-bottom: 0; +} +.form-control-static.input-lg, +.form-control-static.input-sm { + padding-right: 0; + padding-left: 0; +} +.input-sm { + height: 30px; + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} +select.input-sm { + height: 30px; + line-height: 30px; +} +textarea.input-sm, +select[multiple].input-sm { + height: auto; +} +.form-group-sm .form-control { + height: 30px; + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} +.form-group-sm select.form-control { + height: 30px; + line-height: 30px; +} +.form-group-sm textarea.form-control, +.form-group-sm select[multiple].form-control { + height: auto; +} +.form-group-sm .form-control-static { + height: 30px; + min-height: 32px; + padding: 6px 10px; + font-size: 12px; + line-height: 1.5; +} +.input-lg { + height: 46px; + padding: 10px 16px; + font-size: 18px; + line-height: 1.3333333; + border-radius: 6px; +} +select.input-lg { + height: 46px; + line-height: 46px; +} +textarea.input-lg, +select[multiple].input-lg { + height: auto; +} +.form-group-lg .form-control { + height: 46px; + padding: 10px 16px; + font-size: 18px; + line-height: 1.3333333; + border-radius: 6px; +} +.form-group-lg select.form-control { + height: 46px; + line-height: 46px; +} +.form-group-lg textarea.form-control, +.form-group-lg select[multiple].form-control { + height: auto; +} +.form-group-lg .form-control-static { + height: 46px; + min-height: 38px; + padding: 11px 16px; + font-size: 18px; + line-height: 1.3333333; +} +.has-feedback { + position: relative; +} +.has-feedback .form-control { + padding-right: 42.5px; +} +.form-control-feedback { + position: absolute; + top: 0; + right: 0; + z-index: 2; + display: block; + width: 34px; + height: 34px; + line-height: 34px; + text-align: center; + pointer-events: none; +} +.input-lg + .form-control-feedback, +.input-group-lg + .form-control-feedback, +.form-group-lg .form-control + .form-control-feedback { + width: 46px; + height: 46px; + line-height: 46px; +} +.input-sm + .form-control-feedback, +.input-group-sm + .form-control-feedback, +.form-group-sm .form-control + .form-control-feedback { + width: 30px; + height: 30px; + line-height: 30px; +} +.has-success .help-block, +.has-success .control-label, +.has-success .radio, +.has-success .checkbox, +.has-success .radio-inline, +.has-success .checkbox-inline, +.has-success.radio label, +.has-success.checkbox label, +.has-success.radio-inline label, +.has-success.checkbox-inline label { + color: #3c763d; +} +.has-success .form-control { + border-color: #3c763d; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); +} +.has-success .form-control:focus { + border-color: #2b542c; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168; +} +.has-success .input-group-addon { + color: #3c763d; + background-color: #dff0d8; + border-color: #3c763d; +} +.has-success .form-control-feedback { + color: #3c763d; +} +.has-warning .help-block, +.has-warning .control-label, +.has-warning .radio, +.has-warning .checkbox, +.has-warning .radio-inline, +.has-warning .checkbox-inline, +.has-warning.radio label, +.has-warning.checkbox label, +.has-warning.radio-inline label, +.has-warning.checkbox-inline label { + color: #8a6d3b; +} +.has-warning .form-control { + border-color: #8a6d3b; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); +} +.has-warning .form-control:focus { + border-color: #66512c; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b; +} +.has-warning .input-group-addon { + color: #8a6d3b; + background-color: #fcf8e3; + border-color: #8a6d3b; +} +.has-warning .form-control-feedback { + color: #8a6d3b; +} +.has-error .help-block, +.has-error .control-label, +.has-error .radio, +.has-error .checkbox, +.has-error .radio-inline, +.has-error .checkbox-inline, +.has-error.radio label, +.has-error.checkbox label, +.has-error.radio-inline label, +.has-error.checkbox-inline label { + color: #a94442; +} +.has-error .form-control { + border-color: #a94442; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); +} +.has-error .form-control:focus { + border-color: #843534; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483; +} +.has-error .input-group-addon { + color: #a94442; + background-color: #f2dede; + border-color: #a94442; +} +.has-error .form-control-feedback { + color: #a94442; +} +.has-feedback label ~ .form-control-feedback { + top: 25px; +} +.has-feedback label.sr-only ~ .form-control-feedback { + top: 0; +} +.help-block { + display: block; + margin-top: 5px; + margin-bottom: 10px; + color: #737373; +} +@media (min-width: 768px) { + .form-inline .form-group { + display: inline-block; + margin-bottom: 0; + vertical-align: middle; + } + .form-inline .form-control { + display: inline-block; + width: auto; + vertical-align: middle; + } + .form-inline .form-control-static { + display: inline-block; + } + .form-inline .input-group { + display: inline-table; + vertical-align: middle; + } + .form-inline .input-group .input-group-addon, + .form-inline .input-group .input-group-btn, + .form-inline .input-group .form-control { + width: auto; + } + .form-inline .input-group > .form-control { + width: 100%; + } + .form-inline .control-label { + margin-bottom: 0; + vertical-align: middle; + } + .form-inline .radio, + .form-inline .checkbox { + display: inline-block; + margin-top: 0; + margin-bottom: 0; + vertical-align: middle; + } + .form-inline .radio label, + .form-inline .checkbox label { + padding-left: 0; + } + .form-inline .radio input[type="radio"], + .form-inline .checkbox input[type="checkbox"] { + position: relative; + margin-left: 0; + } + .form-inline .has-feedback .form-control-feedback { + top: 0; + } +} +.form-horizontal .radio, +.form-horizontal .checkbox, +.form-horizontal .radio-inline, +.form-horizontal .checkbox-inline { + padding-top: 7px; + margin-top: 0; + margin-bottom: 0; +} +.form-horizontal .radio, +.form-horizontal .checkbox { + min-height: 27px; +} +.form-horizontal .form-group { + margin-right: -15px; + margin-left: -15px; +} +@media (min-width: 768px) { + .form-horizontal .control-label { + padding-top: 7px; + margin-bottom: 0; + text-align: right; + } +} +.form-horizontal .has-feedback .form-control-feedback { + right: 15px; +} +@media (min-width: 768px) { + .form-horizontal .form-group-lg .control-label { + padding-top: 11px; + font-size: 18px; + } +} +@media (min-width: 768px) { + .form-horizontal .form-group-sm .control-label { + padding-top: 6px; + font-size: 12px; + } +} +.btn { + display: inline-block; + padding: 6px 12px; + margin-bottom: 0; + font-size: 14px; + font-weight: normal; + line-height: 1.42857143; + text-align: center; + white-space: nowrap; + vertical-align: middle; + -ms-touch-action: manipulation; + touch-action: manipulation; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-image: none; + border: 1px solid transparent; + border-radius: 4px; +} +.btn:focus, +.btn:active:focus, +.btn.active:focus, +.btn.focus, +.btn:active.focus, +.btn.active.focus { + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +.btn:hover, +.btn:focus, +.btn.focus { + color: #333; + text-decoration: none; +} +.btn:active, +.btn.active { + background-image: none; + outline: 0; + -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); + box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); +} +.btn.disabled, +.btn[disabled], +fieldset[disabled] .btn { + cursor: not-allowed; + filter: alpha(opacity=65); + -webkit-box-shadow: none; + box-shadow: none; + opacity: .65; +} +a.btn.disabled, +fieldset[disabled] a.btn { + pointer-events: none; +} +.btn-default { + color: #333; + background-color: #fff; + border-color: #ccc; +} +.btn-default:focus, +.btn-default.focus { + color: #333; + background-color: #e6e6e6; + border-color: #8c8c8c; +} +.btn-default:hover { + color: #333; + background-color: #e6e6e6; + border-color: #adadad; +} +.btn-default:active, +.btn-default.active, +.open > .dropdown-toggle.btn-default { + color: #333; + background-color: #e6e6e6; + border-color: #adadad; +} +.btn-default:active:hover, +.btn-default.active:hover, +.open > .dropdown-toggle.btn-default:hover, +.btn-default:active:focus, +.btn-default.active:focus, +.open > .dropdown-toggle.btn-default:focus, +.btn-default:active.focus, +.btn-default.active.focus, +.open > .dropdown-toggle.btn-default.focus { + color: #333; + background-color: #d4d4d4; + border-color: #8c8c8c; +} +.btn-default:active, +.btn-default.active, +.open > .dropdown-toggle.btn-default { + background-image: none; +} +.btn-default.disabled:hover, +.btn-default[disabled]:hover, +fieldset[disabled] .btn-default:hover, +.btn-default.disabled:focus, +.btn-default[disabled]:focus, +fieldset[disabled] .btn-default:focus, +.btn-default.disabled.focus, +.btn-default[disabled].focus, +fieldset[disabled] .btn-default.focus { + background-color: #fff; + border-color: #ccc; +} +.btn-default .badge { + color: #fff; + background-color: #333; +} +.btn-primary { + color: #fff; + background-color: #337ab7; + border-color: #2e6da4; +} +.btn-primary:focus, +.btn-primary.focus { + color: #fff; + background-color: #286090; + border-color: #122b40; +} +.btn-primary:hover { + color: #fff; + background-color: #286090; + border-color: #204d74; +} +.btn-primary:active, +.btn-primary.active, +.open > .dropdown-toggle.btn-primary { + color: #fff; + background-color: #286090; + border-color: #204d74; +} +.btn-primary:active:hover, +.btn-primary.active:hover, +.open > .dropdown-toggle.btn-primary:hover, +.btn-primary:active:focus, +.btn-primary.active:focus, +.open > .dropdown-toggle.btn-primary:focus, +.btn-primary:active.focus, +.btn-primary.active.focus, +.open > .dropdown-toggle.btn-primary.focus { + color: #fff; + background-color: #204d74; + border-color: #122b40; +} +.btn-primary:active, +.btn-primary.active, +.open > .dropdown-toggle.btn-primary { + background-image: none; +} +.btn-primary.disabled:hover, +.btn-primary[disabled]:hover, +fieldset[disabled] .btn-primary:hover, +.btn-primary.disabled:focus, +.btn-primary[disabled]:focus, +fieldset[disabled] .btn-primary:focus, +.btn-primary.disabled.focus, +.btn-primary[disabled].focus, +fieldset[disabled] .btn-primary.focus { + background-color: #337ab7; + border-color: #2e6da4; +} +.btn-primary .badge { + color: #337ab7; + background-color: #fff; +} +.btn-success { + color: #fff; + background-color: #5cb85c; + border-color: #4cae4c; +} +.btn-success:focus, +.btn-success.focus { + color: #fff; + background-color: #449d44; + border-color: #255625; +} +.btn-success:hover { + color: #fff; + background-color: #449d44; + border-color: #398439; +} +.btn-success:active, +.btn-success.active, +.open > .dropdown-toggle.btn-success { + color: #fff; + background-color: #449d44; + border-color: #398439; +} +.btn-success:active:hover, +.btn-success.active:hover, +.open > .dropdown-toggle.btn-success:hover, +.btn-success:active:focus, +.btn-success.active:focus, +.open > .dropdown-toggle.btn-success:focus, +.btn-success:active.focus, +.btn-success.active.focus, +.open > .dropdown-toggle.btn-success.focus { + color: #fff; + background-color: #398439; + border-color: #255625; +} +.btn-success:active, +.btn-success.active, +.open > .dropdown-toggle.btn-success { + background-image: none; +} +.btn-success.disabled:hover, +.btn-success[disabled]:hover, +fieldset[disabled] .btn-success:hover, +.btn-success.disabled:focus, +.btn-success[disabled]:focus, +fieldset[disabled] .btn-success:focus, +.btn-success.disabled.focus, +.btn-success[disabled].focus, +fieldset[disabled] .btn-success.focus { + background-color: #5cb85c; + border-color: #4cae4c; +} +.btn-success .badge { + color: #5cb85c; + background-color: #fff; +} +.btn-info { + color: #fff; + background-color: #5bc0de; + border-color: #46b8da; +} +.btn-info:focus, +.btn-info.focus { + color: #fff; + background-color: #31b0d5; + border-color: #1b6d85; +} +.btn-info:hover { + color: #fff; + background-color: #31b0d5; + border-color: #269abc; +} +.btn-info:active, +.btn-info.active, +.open > .dropdown-toggle.btn-info { + color: #fff; + background-color: #31b0d5; + border-color: #269abc; +} +.btn-info:active:hover, +.btn-info.active:hover, +.open > .dropdown-toggle.btn-info:hover, +.btn-info:active:focus, +.btn-info.active:focus, +.open > .dropdown-toggle.btn-info:focus, +.btn-info:active.focus, +.btn-info.active.focus, +.open > .dropdown-toggle.btn-info.focus { + color: #fff; + background-color: #269abc; + border-color: #1b6d85; +} +.btn-info:active, +.btn-info.active, +.open > .dropdown-toggle.btn-info { + background-image: none; +} +.btn-info.disabled:hover, +.btn-info[disabled]:hover, +fieldset[disabled] .btn-info:hover, +.btn-info.disabled:focus, +.btn-info[disabled]:focus, +fieldset[disabled] .btn-info:focus, +.btn-info.disabled.focus, +.btn-info[disabled].focus, +fieldset[disabled] .btn-info.focus { + background-color: #5bc0de; + border-color: #46b8da; +} +.btn-info .badge { + color: #5bc0de; + background-color: #fff; +} +.btn-warning { + color: #fff; + background-color: #f0ad4e; + border-color: #eea236; +} +.btn-warning:focus, +.btn-warning.focus { + color: #fff; + background-color: #ec971f; + border-color: #985f0d; +} +.btn-warning:hover { + color: #fff; + background-color: #ec971f; + border-color: #d58512; +} +.btn-warning:active, +.btn-warning.active, +.open > .dropdown-toggle.btn-warning { + color: #fff; + background-color: #ec971f; + border-color: #d58512; +} +.btn-warning:active:hover, +.btn-warning.active:hover, +.open > .dropdown-toggle.btn-warning:hover, +.btn-warning:active:focus, +.btn-warning.active:focus, +.open > .dropdown-toggle.btn-warning:focus, +.btn-warning:active.focus, +.btn-warning.active.focus, +.open > .dropdown-toggle.btn-warning.focus { + color: #fff; + background-color: #d58512; + border-color: #985f0d; +} +.btn-warning:active, +.btn-warning.active, +.open > .dropdown-toggle.btn-warning { + background-image: none; +} +.btn-warning.disabled:hover, +.btn-warning[disabled]:hover, +fieldset[disabled] .btn-warning:hover, +.btn-warning.disabled:focus, +.btn-warning[disabled]:focus, +fieldset[disabled] .btn-warning:focus, +.btn-warning.disabled.focus, +.btn-warning[disabled].focus, +fieldset[disabled] .btn-warning.focus { + background-color: #f0ad4e; + border-color: #eea236; +} +.btn-warning .badge { + color: #f0ad4e; + background-color: #fff; +} +.btn-danger { + color: #fff; + background-color: #d9534f; + border-color: #d43f3a; +} +.btn-danger:focus, +.btn-danger.focus { + color: #fff; + background-color: #c9302c; + border-color: #761c19; +} +.btn-danger:hover { + color: #fff; + background-color: #c9302c; + border-color: #ac2925; +} +.btn-danger:active, +.btn-danger.active, +.open > .dropdown-toggle.btn-danger { + color: #fff; + background-color: #c9302c; + border-color: #ac2925; +} +.btn-danger:active:hover, +.btn-danger.active:hover, +.open > .dropdown-toggle.btn-danger:hover, +.btn-danger:active:focus, +.btn-danger.active:focus, +.open > .dropdown-toggle.btn-danger:focus, +.btn-danger:active.focus, +.btn-danger.active.focus, +.open > .dropdown-toggle.btn-danger.focus { + color: #fff; + background-color: #ac2925; + border-color: #761c19; +} +.btn-danger:active, +.btn-danger.active, +.open > .dropdown-toggle.btn-danger { + background-image: none; +} +.btn-danger.disabled:hover, +.btn-danger[disabled]:hover, +fieldset[disabled] .btn-danger:hover, +.btn-danger.disabled:focus, +.btn-danger[disabled]:focus, +fieldset[disabled] .btn-danger:focus, +.btn-danger.disabled.focus, +.btn-danger[disabled].focus, +fieldset[disabled] .btn-danger.focus { + background-color: #d9534f; + border-color: #d43f3a; +} +.btn-danger .badge { + color: #d9534f; + background-color: #fff; +} +.btn-link { + font-weight: normal; + color: #337ab7; + border-radius: 0; +} +.btn-link, +.btn-link:active, +.btn-link.active, +.btn-link[disabled], +fieldset[disabled] .btn-link { + background-color: transparent; + -webkit-box-shadow: none; + box-shadow: none; +} +.btn-link, +.btn-link:hover, +.btn-link:focus, +.btn-link:active { + border-color: transparent; +} +.btn-link:hover, +.btn-link:focus { + color: #23527c; + text-decoration: underline; + background-color: transparent; +} +.btn-link[disabled]:hover, +fieldset[disabled] .btn-link:hover, +.btn-link[disabled]:focus, +fieldset[disabled] .btn-link:focus { + color: #777; + text-decoration: none; +} +.btn-lg, +.btn-group-lg > .btn { + padding: 10px 16px; + font-size: 18px; + line-height: 1.3333333; + border-radius: 6px; +} +.btn-sm, +.btn-group-sm > .btn { + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} +.btn-xs, +.btn-group-xs > .btn { + padding: 1px 5px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} +.btn-block { + display: block; + width: 100%; +} +.btn-block + .btn-block { + margin-top: 5px; +} +input[type="submit"].btn-block, +input[type="reset"].btn-block, +input[type="button"].btn-block { + width: 100%; +} +.fade { + opacity: 0; + -webkit-transition: opacity .15s linear; + -o-transition: opacity .15s linear; + transition: opacity .15s linear; +} +.fade.in { + opacity: 1; +} +.collapse { + display: none; +} +.collapse.in { + display: block; +} +tr.collapse.in { + display: table-row; +} +tbody.collapse.in { + display: table-row-group; +} +.collapsing { + position: relative; + height: 0; + overflow: hidden; + -webkit-transition-timing-function: ease; + -o-transition-timing-function: ease; + transition-timing-function: ease; + -webkit-transition-duration: .35s; + -o-transition-duration: .35s; + transition-duration: .35s; + -webkit-transition-property: height, visibility; + -o-transition-property: height, visibility; + transition-property: height, visibility; +} +.caret { + display: inline-block; + width: 0; + height: 0; + margin-left: 2px; + vertical-align: middle; + border-top: 4px dashed; + border-top: 4px solid \9; + border-right: 4px solid transparent; + border-left: 4px solid transparent; +} +.dropup, +.dropdown { + position: relative; +} +.dropdown-toggle:focus { + outline: 0; +} +.dropdown-menu { + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 160px; + padding: 5px 0; + margin: 2px 0 0; + font-size: 14px; + text-align: left; + list-style: none; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, .15); + border-radius: 4px; + -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175); + box-shadow: 0 6px 12px rgba(0, 0, 0, .175); +} +.dropdown-menu.pull-right { + right: 0; + left: auto; +} +.dropdown-menu .divider { + height: 1px; + margin: 9px 0; + overflow: hidden; + background-color: #e5e5e5; +} +.dropdown-menu > li > a { + display: block; + padding: 3px 20px; + clear: both; + font-weight: normal; + line-height: 1.42857143; + color: #333; + white-space: nowrap; +} +.dropdown-menu > li > a:hover, +.dropdown-menu > li > a:focus { + color: #262626; + text-decoration: none; + background-color: #f5f5f5; +} +.dropdown-menu > .active > a, +.dropdown-menu > .active > a:hover, +.dropdown-menu > .active > a:focus { + color: #fff; + text-decoration: none; + background-color: #337ab7; + outline: 0; +} +.dropdown-menu > .disabled > a, +.dropdown-menu > .disabled > a:hover, +.dropdown-menu > .disabled > a:focus { + color: #777; +} +.dropdown-menu > .disabled > a:hover, +.dropdown-menu > .disabled > a:focus { + text-decoration: none; + cursor: not-allowed; + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} +.open > .dropdown-menu { + display: block; +} +.open > a { + outline: 0; +} +.dropdown-menu-right { + right: 0; + left: auto; +} +.dropdown-menu-left { + right: auto; + left: 0; +} +.dropdown-header { + display: block; + padding: 3px 20px; + font-size: 12px; + line-height: 1.42857143; + color: #777; + white-space: nowrap; +} +.dropdown-backdrop { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 990; +} +.pull-right > .dropdown-menu { + right: 0; + left: auto; +} +.dropup .caret, +.navbar-fixed-bottom .dropdown .caret { + content: ""; + border-top: 0; + border-bottom: 4px dashed; + border-bottom: 4px solid \9; +} +.dropup .dropdown-menu, +.navbar-fixed-bottom .dropdown .dropdown-menu { + top: auto; + bottom: 100%; + margin-bottom: 2px; +} +@media (min-width: 768px) { + .navbar-right .dropdown-menu { + right: 0; + left: auto; + } + .navbar-right .dropdown-menu-left { + right: auto; + left: 0; + } +} +.btn-group, +.btn-group-vertical { + position: relative; + display: inline-block; + vertical-align: middle; +} +.btn-group > .btn, +.btn-group-vertical > .btn { + position: relative; + float: left; +} +.btn-group > .btn:hover, +.btn-group-vertical > .btn:hover, +.btn-group > .btn:focus, +.btn-group-vertical > .btn:focus, +.btn-group > .btn:active, +.btn-group-vertical > .btn:active, +.btn-group > .btn.active, +.btn-group-vertical > .btn.active { + z-index: 2; +} +.btn-group .btn + .btn, +.btn-group .btn + .btn-group, +.btn-group .btn-group + .btn, +.btn-group .btn-group + .btn-group { + margin-left: -1px; +} +.btn-toolbar { + margin-left: -5px; +} +.btn-toolbar .btn, +.btn-toolbar .btn-group, +.btn-toolbar .input-group { + float: left; +} +.btn-toolbar > .btn, +.btn-toolbar > .btn-group, +.btn-toolbar > .input-group { + margin-left: 5px; +} +.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { + border-radius: 0; +} +.btn-group > .btn:first-child { + margin-left: 0; +} +.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} +.btn-group > .btn:last-child:not(:first-child), +.btn-group > .dropdown-toggle:not(:first-child) { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} +.btn-group > .btn-group { + float: left; +} +.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { + border-radius: 0; +} +.btn-group > .btn-group:first-child:not(:last-child) > .btn:last-child, +.btn-group > .btn-group:first-child:not(:last-child) > .dropdown-toggle { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} +.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} +.btn-group .dropdown-toggle:active, +.btn-group.open .dropdown-toggle { + outline: 0; +} +.btn-group > .btn + .dropdown-toggle { + padding-right: 8px; + padding-left: 8px; +} +.btn-group > .btn-lg + .dropdown-toggle { + padding-right: 12px; + padding-left: 12px; +} +.btn-group.open .dropdown-toggle { + -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); + box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); +} +.btn-group.open .dropdown-toggle.btn-link { + -webkit-box-shadow: none; + box-shadow: none; +} +.btn .caret { + margin-left: 0; +} +.btn-lg .caret { + border-width: 5px 5px 0; + border-bottom-width: 0; +} +.dropup .btn-lg .caret { + border-width: 0 5px 5px; +} +.btn-group-vertical > .btn, +.btn-group-vertical > .btn-group, +.btn-group-vertical > .btn-group > .btn { + display: block; + float: none; + width: 100%; + max-width: 100%; +} +.btn-group-vertical > .btn-group > .btn { + float: none; +} +.btn-group-vertical > .btn + .btn, +.btn-group-vertical > .btn + .btn-group, +.btn-group-vertical > .btn-group + .btn, +.btn-group-vertical > .btn-group + .btn-group { + margin-top: -1px; + margin-left: 0; +} +.btn-group-vertical > .btn:not(:first-child):not(:last-child) { + border-radius: 0; +} +.btn-group-vertical > .btn:first-child:not(:last-child) { + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.btn-group-vertical > .btn:last-child:not(:first-child) { + border-top-left-radius: 0; + border-top-right-radius: 0; + border-bottom-right-radius: 4px; + border-bottom-left-radius: 4px; +} +.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { + border-radius: 0; +} +.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child, +.btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle { + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child { + border-top-left-radius: 0; + border-top-right-radius: 0; +} +.btn-group-justified { + display: table; + width: 100%; + table-layout: fixed; + border-collapse: separate; +} +.btn-group-justified > .btn, +.btn-group-justified > .btn-group { + display: table-cell; + float: none; + width: 1%; +} +.btn-group-justified > .btn-group .btn { + width: 100%; +} +.btn-group-justified > .btn-group .dropdown-menu { + left: auto; +} +[data-toggle="buttons"] > .btn input[type="radio"], +[data-toggle="buttons"] > .btn-group > .btn input[type="radio"], +[data-toggle="buttons"] > .btn input[type="checkbox"], +[data-toggle="buttons"] > .btn-group > .btn input[type="checkbox"] { + position: absolute; + clip: rect(0, 0, 0, 0); + pointer-events: none; +} +.input-group { + position: relative; + display: table; + border-collapse: separate; +} +.input-group[class*="col-"] { + float: none; + padding-right: 0; + padding-left: 0; +} +.input-group .form-control { + position: relative; + z-index: 2; + float: left; + width: 100%; + margin-bottom: 0; +} +.input-group .form-control:focus { + z-index: 3; +} +.input-group-lg > .form-control, +.input-group-lg > .input-group-addon, +.input-group-lg > .input-group-btn > .btn { + height: 46px; + padding: 10px 16px; + font-size: 18px; + line-height: 1.3333333; + border-radius: 6px; +} +select.input-group-lg > .form-control, +select.input-group-lg > .input-group-addon, +select.input-group-lg > .input-group-btn > .btn { + height: 46px; + line-height: 46px; +} +textarea.input-group-lg > .form-control, +textarea.input-group-lg > .input-group-addon, +textarea.input-group-lg > .input-group-btn > .btn, +select[multiple].input-group-lg > .form-control, +select[multiple].input-group-lg > .input-group-addon, +select[multiple].input-group-lg > .input-group-btn > .btn { + height: auto; +} +.input-group-sm > .form-control, +.input-group-sm > .input-group-addon, +.input-group-sm > .input-group-btn > .btn { + height: 30px; + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} +select.input-group-sm > .form-control, +select.input-group-sm > .input-group-addon, +select.input-group-sm > .input-group-btn > .btn { + height: 30px; + line-height: 30px; +} +textarea.input-group-sm > .form-control, +textarea.input-group-sm > .input-group-addon, +textarea.input-group-sm > .input-group-btn > .btn, +select[multiple].input-group-sm > .form-control, +select[multiple].input-group-sm > .input-group-addon, +select[multiple].input-group-sm > .input-group-btn > .btn { + height: auto; +} +.input-group-addon, +.input-group-btn, +.input-group .form-control { + display: table-cell; +} +.input-group-addon:not(:first-child):not(:last-child), +.input-group-btn:not(:first-child):not(:last-child), +.input-group .form-control:not(:first-child):not(:last-child) { + border-radius: 0; +} +.input-group-addon, +.input-group-btn { + width: 1%; + white-space: nowrap; + vertical-align: middle; +} +.input-group-addon { + padding: 6px 12px; + font-size: 14px; + font-weight: normal; + line-height: 1; + color: #555; + text-align: center; + background-color: #eee; + border: 1px solid #ccc; + border-radius: 4px; +} +.input-group-addon.input-sm { + padding: 5px 10px; + font-size: 12px; + border-radius: 3px; +} +.input-group-addon.input-lg { + padding: 10px 16px; + font-size: 18px; + border-radius: 6px; +} +.input-group-addon input[type="radio"], +.input-group-addon input[type="checkbox"] { + margin-top: 0; +} +.input-group .form-control:first-child, +.input-group-addon:first-child, +.input-group-btn:first-child > .btn, +.input-group-btn:first-child > .btn-group > .btn, +.input-group-btn:first-child > .dropdown-toggle, +.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle), +.input-group-btn:last-child > .btn-group:not(:last-child) > .btn { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} +.input-group-addon:first-child { + border-right: 0; +} +.input-group .form-control:last-child, +.input-group-addon:last-child, +.input-group-btn:last-child > .btn, +.input-group-btn:last-child > .btn-group > .btn, +.input-group-btn:last-child > .dropdown-toggle, +.input-group-btn:first-child > .btn:not(:first-child), +.input-group-btn:first-child > .btn-group:not(:first-child) > .btn { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} +.input-group-addon:last-child { + border-left: 0; +} +.input-group-btn { + position: relative; + font-size: 0; + white-space: nowrap; +} +.input-group-btn > .btn { + position: relative; +} +.input-group-btn > .btn + .btn { + margin-left: -1px; +} +.input-group-btn > .btn:hover, +.input-group-btn > .btn:focus, +.input-group-btn > .btn:active { + z-index: 2; +} +.input-group-btn:first-child > .btn, +.input-group-btn:first-child > .btn-group { + margin-right: -1px; +} +.input-group-btn:last-child > .btn, +.input-group-btn:last-child > .btn-group { + z-index: 2; + margin-left: -1px; +} +.nav { + padding-left: 0; + margin-bottom: 0; + list-style: none; +} +.nav > li { + position: relative; + display: block; +} +.nav > li > a { + position: relative; + display: block; + padding: 10px 15px; +} +.nav > li > a:hover, +.nav > li > a:focus { + text-decoration: none; + background-color: #eee; +} +.nav > li.disabled > a { + color: #777; +} +.nav > li.disabled > a:hover, +.nav > li.disabled > a:focus { + color: #777; + text-decoration: none; + cursor: not-allowed; + background-color: transparent; +} +.nav .open > a, +.nav .open > a:hover, +.nav .open > a:focus { + background-color: #eee; + border-color: #337ab7; +} +.nav .nav-divider { + height: 1px; + margin: 9px 0; + overflow: hidden; + background-color: #e5e5e5; +} +.nav > li > a > img { + max-width: none; +} +.nav-tabs { + border-bottom: 1px solid #ddd; +} +.nav-tabs > li { + float: left; + margin-bottom: -1px; +} +.nav-tabs > li > a { + margin-right: 2px; + line-height: 1.42857143; + border: 1px solid transparent; + border-radius: 4px 4px 0 0; +} +.nav-tabs > li > a:hover { + border-color: #eee #eee #ddd; +} +.nav-tabs > li.active > a, +.nav-tabs > li.active > a:hover, +.nav-tabs > li.active > a:focus { + color: #555; + cursor: default; + background-color: #fff; + border: 1px solid #ddd; + border-bottom-color: transparent; +} +.nav-tabs.nav-justified { + width: 100%; + border-bottom: 0; +} +.nav-tabs.nav-justified > li { + float: none; +} +.nav-tabs.nav-justified > li > a { + margin-bottom: 5px; + text-align: center; +} +.nav-tabs.nav-justified > .dropdown .dropdown-menu { + top: auto; + left: auto; +} +@media (min-width: 768px) { + .nav-tabs.nav-justified > li { + display: table-cell; + width: 1%; + } + .nav-tabs.nav-justified > li > a { + margin-bottom: 0; + } +} +.nav-tabs.nav-justified > li > a { + margin-right: 0; + border-radius: 4px; +} +.nav-tabs.nav-justified > .active > a, +.nav-tabs.nav-justified > .active > a:hover, +.nav-tabs.nav-justified > .active > a:focus { + border: 1px solid #ddd; +} +@media (min-width: 768px) { + .nav-tabs.nav-justified > li > a { + border-bottom: 1px solid #ddd; + border-radius: 4px 4px 0 0; + } + .nav-tabs.nav-justified > .active > a, + .nav-tabs.nav-justified > .active > a:hover, + .nav-tabs.nav-justified > .active > a:focus { + border-bottom-color: #fff; + } +} +.nav-pills > li { + float: left; +} +.nav-pills > li > a { + border-radius: 4px; +} +.nav-pills > li + li { + margin-left: 2px; +} +.nav-pills > li.active > a, +.nav-pills > li.active > a:hover, +.nav-pills > li.active > a:focus { + color: #fff; + background-color: #337ab7; +} +.nav-stacked > li { + float: none; +} +.nav-stacked > li + li { + margin-top: 2px; + margin-left: 0; +} +.nav-justified { + width: 100%; +} +.nav-justified > li { + float: none; +} +.nav-justified > li > a { + margin-bottom: 5px; + text-align: center; +} +.nav-justified > .dropdown .dropdown-menu { + top: auto; + left: auto; +} +@media (min-width: 768px) { + .nav-justified > li { + display: table-cell; + width: 1%; + } + .nav-justified > li > a { + margin-bottom: 0; + } +} +.nav-tabs-justified { + border-bottom: 0; +} +.nav-tabs-justified > li > a { + margin-right: 0; + border-radius: 4px; +} +.nav-tabs-justified > .active > a, +.nav-tabs-justified > .active > a:hover, +.nav-tabs-justified > .active > a:focus { + border: 1px solid #ddd; +} +@media (min-width: 768px) { + .nav-tabs-justified > li > a { + border-bottom: 1px solid #ddd; + border-radius: 4px 4px 0 0; + } + .nav-tabs-justified > .active > a, + .nav-tabs-justified > .active > a:hover, + .nav-tabs-justified > .active > a:focus { + border-bottom-color: #fff; + } +} +.tab-content > .tab-pane { + display: none; +} +.tab-content > .active { + display: block; +} +.nav-tabs .dropdown-menu { + margin-top: -1px; + border-top-left-radius: 0; + border-top-right-radius: 0; +} +.navbar { + position: relative; + min-height: 50px; + margin-bottom: 20px; + border: 1px solid transparent; +} +@media (min-width: 768px) { + .navbar { + border-radius: 4px; + } +} +@media (min-width: 768px) { + .navbar-header { + float: left; + } +} +.navbar-collapse { + padding-right: 15px; + padding-left: 15px; + overflow-x: visible; + -webkit-overflow-scrolling: touch; + border-top: 1px solid transparent; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); +} +.navbar-collapse.in { + overflow-y: auto; +} +@media (min-width: 768px) { + .navbar-collapse { + width: auto; + border-top: 0; + -webkit-box-shadow: none; + box-shadow: none; + } + .navbar-collapse.collapse { + display: block !important; + height: auto !important; + padding-bottom: 0; + overflow: visible !important; + } + .navbar-collapse.in { + overflow-y: visible; + } + .navbar-fixed-top .navbar-collapse, + .navbar-static-top .navbar-collapse, + .navbar-fixed-bottom .navbar-collapse { + padding-right: 0; + padding-left: 0; + } +} +.navbar-fixed-top .navbar-collapse, +.navbar-fixed-bottom .navbar-collapse { + max-height: 340px; +} +@media (max-device-width: 480px) and (orientation: landscape) { + .navbar-fixed-top .navbar-collapse, + .navbar-fixed-bottom .navbar-collapse { + max-height: 200px; + } +} +.container > .navbar-header, +.container-fluid > .navbar-header, +.container > .navbar-collapse, +.container-fluid > .navbar-collapse { + margin-right: -15px; + margin-left: -15px; +} +@media (min-width: 768px) { + .container > .navbar-header, + .container-fluid > .navbar-header, + .container > .navbar-collapse, + .container-fluid > .navbar-collapse { + margin-right: 0; + margin-left: 0; + } +} +.navbar-static-top { + z-index: 1000; + border-width: 0 0 1px; +} +@media (min-width: 768px) { + .navbar-static-top { + border-radius: 0; + } +} +.navbar-fixed-top, +.navbar-fixed-bottom { + position: fixed; + right: 0; + left: 0; + z-index: 1030; +} +@media (min-width: 768px) { + .navbar-fixed-top, + .navbar-fixed-bottom { + border-radius: 0; + } +} +.navbar-fixed-top { + top: 0; + border-width: 0 0 1px; +} +.navbar-fixed-bottom { + bottom: 0; + margin-bottom: 0; + border-width: 1px 0 0; +} +.navbar-brand { + float: left; + height: 50px; + padding: 15px 15px; + font-size: 18px; + line-height: 20px; +} +.navbar-brand:hover, +.navbar-brand:focus { + text-decoration: none; +} +.navbar-brand > img { + display: block; +} +@media (min-width: 768px) { + .navbar > .container .navbar-brand, + .navbar > .container-fluid .navbar-brand { + margin-left: -15px; + } +} +.navbar-toggle { + position: relative; + float: right; + padding: 9px 10px; + margin-top: 8px; + margin-right: 15px; + margin-bottom: 8px; + background-color: transparent; + background-image: none; + border: 1px solid transparent; + border-radius: 4px; +} +.navbar-toggle:focus { + outline: 0; +} +.navbar-toggle .icon-bar { + display: block; + width: 22px; + height: 2px; + border-radius: 1px; +} +.navbar-toggle .icon-bar + .icon-bar { + margin-top: 4px; +} +@media (min-width: 768px) { + .navbar-toggle { + display: none; + } +} +.navbar-nav { + margin: 7.5px -15px; +} +.navbar-nav > li > a { + padding-top: 10px; + padding-bottom: 10px; + line-height: 20px; +} +@media (max-width: 767px) { + .navbar-nav .open .dropdown-menu { + position: static; + float: none; + width: auto; + margin-top: 0; + background-color: transparent; + border: 0; + -webkit-box-shadow: none; + box-shadow: none; + } + .navbar-nav .open .dropdown-menu > li > a, + .navbar-nav .open .dropdown-menu .dropdown-header { + padding: 5px 15px 5px 25px; + } + .navbar-nav .open .dropdown-menu > li > a { + line-height: 20px; + } + .navbar-nav .open .dropdown-menu > li > a:hover, + .navbar-nav .open .dropdown-menu > li > a:focus { + background-image: none; + } +} +@media (min-width: 768px) { + .navbar-nav { + float: left; + margin: 0; + } + .navbar-nav > li { + float: left; + } + .navbar-nav > li > a { + padding-top: 15px; + padding-bottom: 15px; + } +} +.navbar-form { + padding: 10px 15px; + margin-top: 8px; + margin-right: -15px; + margin-bottom: 8px; + margin-left: -15px; + border-top: 1px solid transparent; + border-bottom: 1px solid transparent; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1); +} +@media (min-width: 768px) { + .navbar-form .form-group { + display: inline-block; + margin-bottom: 0; + vertical-align: middle; + } + .navbar-form .form-control { + display: inline-block; + width: auto; + vertical-align: middle; + } + .navbar-form .form-control-static { + display: inline-block; + } + .navbar-form .input-group { + display: inline-table; + vertical-align: middle; + } + .navbar-form .input-group .input-group-addon, + .navbar-form .input-group .input-group-btn, + .navbar-form .input-group .form-control { + width: auto; + } + .navbar-form .input-group > .form-control { + width: 100%; + } + .navbar-form .control-label { + margin-bottom: 0; + vertical-align: middle; + } + .navbar-form .radio, + .navbar-form .checkbox { + display: inline-block; + margin-top: 0; + margin-bottom: 0; + vertical-align: middle; + } + .navbar-form .radio label, + .navbar-form .checkbox label { + padding-left: 0; + } + .navbar-form .radio input[type="radio"], + .navbar-form .checkbox input[type="checkbox"] { + position: relative; + margin-left: 0; + } + .navbar-form .has-feedback .form-control-feedback { + top: 0; + } +} +@media (max-width: 767px) { + .navbar-form .form-group { + margin-bottom: 5px; + } + .navbar-form .form-group:last-child { + margin-bottom: 0; + } +} +@media (min-width: 768px) { + .navbar-form { + width: auto; + padding-top: 0; + padding-bottom: 0; + margin-right: 0; + margin-left: 0; + border: 0; + -webkit-box-shadow: none; + box-shadow: none; + } +} +.navbar-nav > li > .dropdown-menu { + margin-top: 0; + border-top-left-radius: 0; + border-top-right-radius: 0; +} +.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu { + margin-bottom: 0; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.navbar-btn { + margin-top: 8px; + margin-bottom: 8px; +} +.navbar-btn.btn-sm { + margin-top: 10px; + margin-bottom: 10px; +} +.navbar-btn.btn-xs { + margin-top: 14px; + margin-bottom: 14px; +} +.navbar-text { + margin-top: 15px; + margin-bottom: 15px; +} +@media (min-width: 768px) { + .navbar-text { + float: left; + margin-right: 15px; + margin-left: 15px; + } +} +@media (min-width: 768px) { + .navbar-left { + float: left !important; + } + .navbar-right { + float: right !important; + margin-right: -15px; + } + .navbar-right ~ .navbar-right { + margin-right: 0; + } +} +.navbar-default { + background-color: #f8f8f8; + border-color: #e7e7e7; +} +.navbar-default .navbar-brand { + color: #777; +} +.navbar-default .navbar-brand:hover, +.navbar-default .navbar-brand:focus { + color: #5e5e5e; + background-color: transparent; +} +.navbar-default .navbar-text { + color: #777; +} +.navbar-default .navbar-nav > li > a { + color: #777; +} +.navbar-default .navbar-nav > li > a:hover, +.navbar-default .navbar-nav > li > a:focus { + color: #333; + background-color: transparent; +} +.navbar-default .navbar-nav > .active > a, +.navbar-default .navbar-nav > .active > a:hover, +.navbar-default .navbar-nav > .active > a:focus { + color: #555; + background-color: #e7e7e7; +} +.navbar-default .navbar-nav > .disabled > a, +.navbar-default .navbar-nav > .disabled > a:hover, +.navbar-default .navbar-nav > .disabled > a:focus { + color: #ccc; + background-color: transparent; +} +.navbar-default .navbar-toggle { + border-color: #ddd; +} +.navbar-default .navbar-toggle:hover, +.navbar-default .navbar-toggle:focus { + background-color: #ddd; +} +.navbar-default .navbar-toggle .icon-bar { + background-color: #888; +} +.navbar-default .navbar-collapse, +.navbar-default .navbar-form { + border-color: #e7e7e7; +} +.navbar-default .navbar-nav > .open > a, +.navbar-default .navbar-nav > .open > a:hover, +.navbar-default .navbar-nav > .open > a:focus { + color: #555; + background-color: #e7e7e7; +} +@media (max-width: 767px) { + .navbar-default .navbar-nav .open .dropdown-menu > li > a { + color: #777; + } + .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, + .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus { + color: #333; + background-color: transparent; + } + .navbar-default .navbar-nav .open .dropdown-menu > .active > a, + .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover, + .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus { + color: #555; + background-color: #e7e7e7; + } + .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a, + .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover, + .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus { + color: #ccc; + background-color: transparent; + } +} +.navbar-default .navbar-link { + color: #777; +} +.navbar-default .navbar-link:hover { + color: #333; +} +.navbar-default .btn-link { + color: #777; +} +.navbar-default .btn-link:hover, +.navbar-default .btn-link:focus { + color: #333; +} +.navbar-default .btn-link[disabled]:hover, +fieldset[disabled] .navbar-default .btn-link:hover, +.navbar-default .btn-link[disabled]:focus, +fieldset[disabled] .navbar-default .btn-link:focus { + color: #ccc; +} +.navbar-inverse { + background-color: #222; + border-color: #080808; +} +.navbar-inverse .navbar-brand { + color: #9d9d9d; +} +.navbar-inverse .navbar-brand:hover, +.navbar-inverse .navbar-brand:focus { + color: #fff; + background-color: transparent; +} +.navbar-inverse .navbar-text { + color: #9d9d9d; +} +.navbar-inverse .navbar-nav > li > a { + color: #9d9d9d; +} +.navbar-inverse .navbar-nav > li > a:hover, +.navbar-inverse .navbar-nav > li > a:focus { + color: #fff; + background-color: transparent; +} +.navbar-inverse .navbar-nav > .active > a, +.navbar-inverse .navbar-nav > .active > a:hover, +.navbar-inverse .navbar-nav > .active > a:focus { + color: #fff; + background-color: #080808; +} +.navbar-inverse .navbar-nav > .disabled > a, +.navbar-inverse .navbar-nav > .disabled > a:hover, +.navbar-inverse .navbar-nav > .disabled > a:focus { + color: #444; + background-color: transparent; +} +.navbar-inverse .navbar-toggle { + border-color: #333; +} +.navbar-inverse .navbar-toggle:hover, +.navbar-inverse .navbar-toggle:focus { + background-color: #333; +} +.navbar-inverse .navbar-toggle .icon-bar { + background-color: #fff; +} +.navbar-inverse .navbar-collapse, +.navbar-inverse .navbar-form { + border-color: #101010; +} +.navbar-inverse .navbar-nav > .open > a, +.navbar-inverse .navbar-nav > .open > a:hover, +.navbar-inverse .navbar-nav > .open > a:focus { + color: #fff; + background-color: #080808; +} +@media (max-width: 767px) { + .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header { + border-color: #080808; + } + .navbar-inverse .navbar-nav .open .dropdown-menu .divider { + background-color: #080808; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > li > a { + color: #9d9d9d; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover, + .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus { + color: #fff; + background-color: transparent; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a, + .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover, + .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus { + color: #fff; + background-color: #080808; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a, + .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover, + .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus { + color: #444; + background-color: transparent; + } +} +.navbar-inverse .navbar-link { + color: #9d9d9d; +} +.navbar-inverse .navbar-link:hover { + color: #fff; +} +.navbar-inverse .btn-link { + color: #9d9d9d; +} +.navbar-inverse .btn-link:hover, +.navbar-inverse .btn-link:focus { + color: #fff; +} +.navbar-inverse .btn-link[disabled]:hover, +fieldset[disabled] .navbar-inverse .btn-link:hover, +.navbar-inverse .btn-link[disabled]:focus, +fieldset[disabled] .navbar-inverse .btn-link:focus { + color: #444; +} +.breadcrumb { + padding: 8px 15px; + margin-bottom: 20px; + list-style: none; + background-color: #f5f5f5; + border-radius: 4px; +} +.breadcrumb > li { + display: inline-block; +} +.breadcrumb > li + li:before { + padding: 0 5px; + color: #ccc; + content: "/\00a0"; +} +.breadcrumb > .active { + color: #777; +} +.pagination { + display: inline-block; + padding-left: 0; + margin: 20px 0; + border-radius: 4px; +} +.pagination > li { + display: inline; +} +.pagination > li > a, +.pagination > li > span { + position: relative; + float: left; + padding: 6px 12px; + margin-left: -1px; + line-height: 1.42857143; + color: #337ab7; + text-decoration: none; + background-color: #fff; + border: 1px solid #ddd; +} +.pagination > li:first-child > a, +.pagination > li:first-child > span { + margin-left: 0; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; +} +.pagination > li:last-child > a, +.pagination > li:last-child > span { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} +.pagination > li > a:hover, +.pagination > li > span:hover, +.pagination > li > a:focus, +.pagination > li > span:focus { + z-index: 2; + color: #23527c; + background-color: #eee; + border-color: #ddd; +} +.pagination > .active > a, +.pagination > .active > span, +.pagination > .active > a:hover, +.pagination > .active > span:hover, +.pagination > .active > a:focus, +.pagination > .active > span:focus { + z-index: 3; + color: #fff; + cursor: default; + background-color: #337ab7; + border-color: #337ab7; +} +.pagination > .disabled > span, +.pagination > .disabled > span:hover, +.pagination > .disabled > span:focus, +.pagination > .disabled > a, +.pagination > .disabled > a:hover, +.pagination > .disabled > a:focus { + color: #777; + cursor: not-allowed; + background-color: #fff; + border-color: #ddd; +} +.pagination-lg > li > a, +.pagination-lg > li > span { + padding: 10px 16px; + font-size: 18px; + line-height: 1.3333333; +} +.pagination-lg > li:first-child > a, +.pagination-lg > li:first-child > span { + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; +} +.pagination-lg > li:last-child > a, +.pagination-lg > li:last-child > span { + border-top-right-radius: 6px; + border-bottom-right-radius: 6px; +} +.pagination-sm > li > a, +.pagination-sm > li > span { + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; +} +.pagination-sm > li:first-child > a, +.pagination-sm > li:first-child > span { + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; +} +.pagination-sm > li:last-child > a, +.pagination-sm > li:last-child > span { + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} +.pager { + padding-left: 0; + margin: 20px 0; + text-align: center; + list-style: none; +} +.pager li { + display: inline; +} +.pager li > a, +.pager li > span { + display: inline-block; + padding: 5px 14px; + background-color: #fff; + border: 1px solid #ddd; + border-radius: 15px; +} +.pager li > a:hover, +.pager li > a:focus { + text-decoration: none; + background-color: #eee; +} +.pager .next > a, +.pager .next > span { + float: right; +} +.pager .previous > a, +.pager .previous > span { + float: left; +} +.pager .disabled > a, +.pager .disabled > a:hover, +.pager .disabled > a:focus, +.pager .disabled > span { + color: #777; + cursor: not-allowed; + background-color: #fff; +} +.label { + display: inline; + padding: .2em .6em .3em; + font-size: 75%; + font-weight: bold; + line-height: 1; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + border-radius: .25em; +} +a.label:hover, +a.label:focus { + color: #fff; + text-decoration: none; + cursor: pointer; +} +.label:empty { + display: none; +} +.btn .label { + position: relative; + top: -1px; +} +.label-default { + background-color: #777; +} +.label-default[href]:hover, +.label-default[href]:focus { + background-color: #5e5e5e; +} +.label-primary { + background-color: #337ab7; +} +.label-primary[href]:hover, +.label-primary[href]:focus { + background-color: #286090; +} +.label-success { + background-color: #5cb85c; +} +.label-success[href]:hover, +.label-success[href]:focus { + background-color: #449d44; +} +.label-info { + background-color: #5bc0de; +} +.label-info[href]:hover, +.label-info[href]:focus { + background-color: #31b0d5; +} +.label-warning { + background-color: #f0ad4e; +} +.label-warning[href]:hover, +.label-warning[href]:focus { + background-color: #ec971f; +} +.label-danger { + background-color: #d9534f; +} +.label-danger[href]:hover, +.label-danger[href]:focus { + background-color: #c9302c; +} +.badge { + display: inline-block; + min-width: 10px; + padding: 3px 7px; + font-size: 12px; + font-weight: bold; + line-height: 1; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: middle; + background-color: #777; + border-radius: 10px; +} +.badge:empty { + display: none; +} +.btn .badge { + position: relative; + top: -1px; +} +.btn-xs .badge, +.btn-group-xs > .btn .badge { + top: 0; + padding: 1px 5px; +} +a.badge:hover, +a.badge:focus { + color: #fff; + text-decoration: none; + cursor: pointer; +} +.list-group-item.active > .badge, +.nav-pills > .active > a > .badge { + color: #337ab7; + background-color: #fff; +} +.list-group-item > .badge { + float: right; +} +.list-group-item > .badge + .badge { + margin-right: 5px; +} +.nav-pills > li > a > .badge { + margin-left: 3px; +} +.jumbotron { + padding-top: 30px; + padding-bottom: 30px; + margin-bottom: 30px; + color: inherit; + background-color: #eee; +} +.jumbotron h1, +.jumbotron .h1 { + color: inherit; +} +.jumbotron p { + margin-bottom: 15px; + font-size: 21px; + font-weight: 200; +} +.jumbotron > hr { + border-top-color: #d5d5d5; +} +.container .jumbotron, +.container-fluid .jumbotron { + padding-right: 15px; + padding-left: 15px; + border-radius: 6px; +} +.jumbotron .container { + max-width: 100%; +} +@media screen and (min-width: 768px) { + .jumbotron { + padding-top: 48px; + padding-bottom: 48px; + } + .container .jumbotron, + .container-fluid .jumbotron { + padding-right: 60px; + padding-left: 60px; + } + .jumbotron h1, + .jumbotron .h1 { + font-size: 63px; + } +} +.thumbnail { + display: block; + padding: 4px; + margin-bottom: 20px; + line-height: 1.42857143; + background-color: #fff; + border: 1px solid #ddd; + border-radius: 4px; + -webkit-transition: border .2s ease-in-out; + -o-transition: border .2s ease-in-out; + transition: border .2s ease-in-out; +} +.thumbnail > img, +.thumbnail a > img { + margin-right: auto; + margin-left: auto; +} +a.thumbnail:hover, +a.thumbnail:focus, +a.thumbnail.active { + border-color: #337ab7; +} +.thumbnail .caption { + padding: 9px; + color: #333; +} +.alert { + padding: 15px; + margin-bottom: 20px; + border: 1px solid transparent; + border-radius: 4px; +} +.alert h4 { + margin-top: 0; + color: inherit; +} +.alert .alert-link { + font-weight: bold; +} +.alert > p, +.alert > ul { + margin-bottom: 0; +} +.alert > p + p { + margin-top: 5px; +} +.alert-dismissable, +.alert-dismissible { + padding-right: 35px; +} +.alert-dismissable .close, +.alert-dismissible .close { + position: relative; + top: -2px; + right: -21px; + color: inherit; +} +.alert-success { + color: #3c763d; + background-color: #dff0d8; + border-color: #d6e9c6; +} +.alert-success hr { + border-top-color: #c9e2b3; +} +.alert-success .alert-link { + color: #2b542c; +} +.alert-info { + color: #31708f; + background-color: #d9edf7; + border-color: #bce8f1; +} +.alert-info hr { + border-top-color: #a6e1ec; +} +.alert-info .alert-link { + color: #245269; +} +.alert-warning { + color: #8a6d3b; + background-color: #fcf8e3; + border-color: #faebcc; +} +.alert-warning hr { + border-top-color: #f7e1b5; +} +.alert-warning .alert-link { + color: #66512c; +} +.alert-danger { + color: #a94442; + background-color: #f2dede; + border-color: #ebccd1; +} +.alert-danger hr { + border-top-color: #e4b9c0; +} +.alert-danger .alert-link { + color: #843534; +} +@-webkit-keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} +@-o-keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} +@keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} +.progress { + height: 20px; + margin-bottom: 20px; + overflow: hidden; + background-color: #f5f5f5; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); +} +.progress-bar { + float: left; + width: 0; + height: 100%; + font-size: 12px; + line-height: 20px; + color: #fff; + text-align: center; + background-color: #337ab7; + -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); + -webkit-transition: width .6s ease; + -o-transition: width .6s ease; + transition: width .6s ease; +} +.progress-striped .progress-bar, +.progress-bar-striped { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + -webkit-background-size: 40px 40px; + background-size: 40px 40px; +} +.progress.active .progress-bar, +.progress-bar.active { + -webkit-animation: progress-bar-stripes 2s linear infinite; + -o-animation: progress-bar-stripes 2s linear infinite; + animation: progress-bar-stripes 2s linear infinite; +} +.progress-bar-success { + background-color: #5cb85c; +} +.progress-striped .progress-bar-success { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); +} +.progress-bar-info { + background-color: #5bc0de; +} +.progress-striped .progress-bar-info { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); +} +.progress-bar-warning { + background-color: #f0ad4e; +} +.progress-striped .progress-bar-warning { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); +} +.progress-bar-danger { + background-color: #d9534f; +} +.progress-striped .progress-bar-danger { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); +} +.media { + margin-top: 15px; +} +.media:first-child { + margin-top: 0; +} +.media, +.media-body { + overflow: hidden; + zoom: 1; +} +.media-body { + width: 10000px; +} +.media-object { + display: block; +} +.media-object.img-thumbnail { + max-width: none; +} +.media-right, +.media > .pull-right { + padding-left: 10px; +} +.media-left, +.media > .pull-left { + padding-right: 10px; +} +.media-left, +.media-right, +.media-body { + display: table-cell; + vertical-align: top; +} +.media-middle { + vertical-align: middle; +} +.media-bottom { + vertical-align: bottom; +} +.media-heading { + margin-top: 0; + margin-bottom: 5px; +} +.media-list { + padding-left: 0; + list-style: none; +} +.list-group { + padding-left: 0; + margin-bottom: 20px; +} +.list-group-item { + position: relative; + display: block; + padding: 10px 15px; + margin-bottom: -1px; + background-color: #fff; + border: 1px solid #ddd; +} +.list-group-item:first-child { + border-top-left-radius: 4px; + border-top-right-radius: 4px; +} +.list-group-item:last-child { + margin-bottom: 0; + border-bottom-right-radius: 4px; + border-bottom-left-radius: 4px; +} +a.list-group-item, +button.list-group-item { + color: #555; +} +a.list-group-item .list-group-item-heading, +button.list-group-item .list-group-item-heading { + color: #333; +} +a.list-group-item:hover, +button.list-group-item:hover, +a.list-group-item:focus, +button.list-group-item:focus { + color: #555; + text-decoration: none; + background-color: #f5f5f5; +} +button.list-group-item { + width: 100%; + text-align: left; +} +.list-group-item.disabled, +.list-group-item.disabled:hover, +.list-group-item.disabled:focus { + color: #777; + cursor: not-allowed; + background-color: #eee; +} +.list-group-item.disabled .list-group-item-heading, +.list-group-item.disabled:hover .list-group-item-heading, +.list-group-item.disabled:focus .list-group-item-heading { + color: inherit; +} +.list-group-item.disabled .list-group-item-text, +.list-group-item.disabled:hover .list-group-item-text, +.list-group-item.disabled:focus .list-group-item-text { + color: #777; +} +.list-group-item.active, +.list-group-item.active:hover, +.list-group-item.active:focus { + z-index: 2; + color: #fff; + background-color: #337ab7; + border-color: #337ab7; +} +.list-group-item.active .list-group-item-heading, +.list-group-item.active:hover .list-group-item-heading, +.list-group-item.active:focus .list-group-item-heading, +.list-group-item.active .list-group-item-heading > small, +.list-group-item.active:hover .list-group-item-heading > small, +.list-group-item.active:focus .list-group-item-heading > small, +.list-group-item.active .list-group-item-heading > .small, +.list-group-item.active:hover .list-group-item-heading > .small, +.list-group-item.active:focus .list-group-item-heading > .small { + color: inherit; +} +.list-group-item.active .list-group-item-text, +.list-group-item.active:hover .list-group-item-text, +.list-group-item.active:focus .list-group-item-text { + color: #c7ddef; +} +.list-group-item-success { + color: #3c763d; + background-color: #dff0d8; +} +a.list-group-item-success, +button.list-group-item-success { + color: #3c763d; +} +a.list-group-item-success .list-group-item-heading, +button.list-group-item-success .list-group-item-heading { + color: inherit; +} +a.list-group-item-success:hover, +button.list-group-item-success:hover, +a.list-group-item-success:focus, +button.list-group-item-success:focus { + color: #3c763d; + background-color: #d0e9c6; +} +a.list-group-item-success.active, +button.list-group-item-success.active, +a.list-group-item-success.active:hover, +button.list-group-item-success.active:hover, +a.list-group-item-success.active:focus, +button.list-group-item-success.active:focus { + color: #fff; + background-color: #3c763d; + border-color: #3c763d; +} +.list-group-item-info { + color: #31708f; + background-color: #d9edf7; +} +a.list-group-item-info, +button.list-group-item-info { + color: #31708f; +} +a.list-group-item-info .list-group-item-heading, +button.list-group-item-info .list-group-item-heading { + color: inherit; +} +a.list-group-item-info:hover, +button.list-group-item-info:hover, +a.list-group-item-info:focus, +button.list-group-item-info:focus { + color: #31708f; + background-color: #c4e3f3; +} +a.list-group-item-info.active, +button.list-group-item-info.active, +a.list-group-item-info.active:hover, +button.list-group-item-info.active:hover, +a.list-group-item-info.active:focus, +button.list-group-item-info.active:focus { + color: #fff; + background-color: #31708f; + border-color: #31708f; +} +.list-group-item-warning { + color: #8a6d3b; + background-color: #fcf8e3; +} +a.list-group-item-warning, +button.list-group-item-warning { + color: #8a6d3b; +} +a.list-group-item-warning .list-group-item-heading, +button.list-group-item-warning .list-group-item-heading { + color: inherit; +} +a.list-group-item-warning:hover, +button.list-group-item-warning:hover, +a.list-group-item-warning:focus, +button.list-group-item-warning:focus { + color: #8a6d3b; + background-color: #faf2cc; +} +a.list-group-item-warning.active, +button.list-group-item-warning.active, +a.list-group-item-warning.active:hover, +button.list-group-item-warning.active:hover, +a.list-group-item-warning.active:focus, +button.list-group-item-warning.active:focus { + color: #fff; + background-color: #8a6d3b; + border-color: #8a6d3b; +} +.list-group-item-danger { + color: #a94442; + background-color: #f2dede; +} +a.list-group-item-danger, +button.list-group-item-danger { + color: #a94442; +} +a.list-group-item-danger .list-group-item-heading, +button.list-group-item-danger .list-group-item-heading { + color: inherit; +} +a.list-group-item-danger:hover, +button.list-group-item-danger:hover, +a.list-group-item-danger:focus, +button.list-group-item-danger:focus { + color: #a94442; + background-color: #ebcccc; +} +a.list-group-item-danger.active, +button.list-group-item-danger.active, +a.list-group-item-danger.active:hover, +button.list-group-item-danger.active:hover, +a.list-group-item-danger.active:focus, +button.list-group-item-danger.active:focus { + color: #fff; + background-color: #a94442; + border-color: #a94442; +} +.list-group-item-heading { + margin-top: 0; + margin-bottom: 5px; +} +.list-group-item-text { + margin-bottom: 0; + line-height: 1.3; +} +.panel { + margin-bottom: 20px; + background-color: #fff; + border: 1px solid transparent; + border-radius: 4px; + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05); + box-shadow: 0 1px 1px rgba(0, 0, 0, .05); +} +.panel-body { + padding: 15px; +} +.panel-heading { + padding: 10px 15px; + border-bottom: 1px solid transparent; + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} +.panel-heading > .dropdown .dropdown-toggle { + color: inherit; +} +.panel-title { + margin-top: 0; + margin-bottom: 0; + font-size: 16px; + color: inherit; +} +.panel-title > a, +.panel-title > small, +.panel-title > .small, +.panel-title > small > a, +.panel-title > .small > a { + color: inherit; +} +.panel-footer { + padding: 10px 15px; + background-color: #f5f5f5; + border-top: 1px solid #ddd; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} +.panel > .list-group, +.panel > .panel-collapse > .list-group { + margin-bottom: 0; +} +.panel > .list-group .list-group-item, +.panel > .panel-collapse > .list-group .list-group-item { + border-width: 1px 0; + border-radius: 0; +} +.panel > .list-group:first-child .list-group-item:first-child, +.panel > .panel-collapse > .list-group:first-child .list-group-item:first-child { + border-top: 0; + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} +.panel > .list-group:last-child .list-group-item:last-child, +.panel > .panel-collapse > .list-group:last-child .list-group-item:last-child { + border-bottom: 0; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} +.panel > .panel-heading + .panel-collapse > .list-group .list-group-item:first-child { + border-top-left-radius: 0; + border-top-right-radius: 0; +} +.panel-heading + .list-group .list-group-item:first-child { + border-top-width: 0; +} +.list-group + .panel-footer { + border-top-width: 0; +} +.panel > .table, +.panel > .table-responsive > .table, +.panel > .panel-collapse > .table { + margin-bottom: 0; +} +.panel > .table caption, +.panel > .table-responsive > .table caption, +.panel > .panel-collapse > .table caption { + padding-right: 15px; + padding-left: 15px; +} +.panel > .table:first-child, +.panel > .table-responsive:first-child > .table:first-child { + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} +.panel > .table:first-child > thead:first-child > tr:first-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child, +.panel > .table:first-child > tbody:first-child > tr:first-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child { + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} +.panel > .table:first-child > thead:first-child > tr:first-child td:first-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child, +.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child, +.panel > .table:first-child > thead:first-child > tr:first-child th:first-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child, +.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child { + border-top-left-radius: 3px; +} +.panel > .table:first-child > thead:first-child > tr:first-child td:last-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child, +.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child, +.panel > .table:first-child > thead:first-child > tr:first-child th:last-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child, +.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child { + border-top-right-radius: 3px; +} +.panel > .table:last-child, +.panel > .table-responsive:last-child > .table:last-child { + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} +.panel > .table:last-child > tbody:last-child > tr:last-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child { + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} +.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child, +.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child { + border-bottom-left-radius: 3px; +} +.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child, +.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child { + border-bottom-right-radius: 3px; +} +.panel > .panel-body + .table, +.panel > .panel-body + .table-responsive, +.panel > .table + .panel-body, +.panel > .table-responsive + .panel-body { + border-top: 1px solid #ddd; +} +.panel > .table > tbody:first-child > tr:first-child th, +.panel > .table > tbody:first-child > tr:first-child td { + border-top: 0; +} +.panel > .table-bordered, +.panel > .table-responsive > .table-bordered { + border: 0; +} +.panel > .table-bordered > thead > tr > th:first-child, +.panel > .table-responsive > .table-bordered > thead > tr > th:first-child, +.panel > .table-bordered > tbody > tr > th:first-child, +.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child, +.panel > .table-bordered > tfoot > tr > th:first-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child, +.panel > .table-bordered > thead > tr > td:first-child, +.panel > .table-responsive > .table-bordered > thead > tr > td:first-child, +.panel > .table-bordered > tbody > tr > td:first-child, +.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child, +.panel > .table-bordered > tfoot > tr > td:first-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child { + border-left: 0; +} +.panel > .table-bordered > thead > tr > th:last-child, +.panel > .table-responsive > .table-bordered > thead > tr > th:last-child, +.panel > .table-bordered > tbody > tr > th:last-child, +.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child, +.panel > .table-bordered > tfoot > tr > th:last-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child, +.panel > .table-bordered > thead > tr > td:last-child, +.panel > .table-responsive > .table-bordered > thead > tr > td:last-child, +.panel > .table-bordered > tbody > tr > td:last-child, +.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child, +.panel > .table-bordered > tfoot > tr > td:last-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child { + border-right: 0; +} +.panel > .table-bordered > thead > tr:first-child > td, +.panel > .table-responsive > .table-bordered > thead > tr:first-child > td, +.panel > .table-bordered > tbody > tr:first-child > td, +.panel > .table-responsive > .table-bordered > tbody > tr:first-child > td, +.panel > .table-bordered > thead > tr:first-child > th, +.panel > .table-responsive > .table-bordered > thead > tr:first-child > th, +.panel > .table-bordered > tbody > tr:first-child > th, +.panel > .table-responsive > .table-bordered > tbody > tr:first-child > th { + border-bottom: 0; +} +.panel > .table-bordered > tbody > tr:last-child > td, +.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td, +.panel > .table-bordered > tfoot > tr:last-child > td, +.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td, +.panel > .table-bordered > tbody > tr:last-child > th, +.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th, +.panel > .table-bordered > tfoot > tr:last-child > th, +.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th { + border-bottom: 0; +} +.panel > .table-responsive { + margin-bottom: 0; + border: 0; +} +.panel-group { + margin-bottom: 20px; +} +.panel-group .panel { + margin-bottom: 0; + border-radius: 4px; +} +.panel-group .panel + .panel { + margin-top: 5px; +} +.panel-group .panel-heading { + border-bottom: 0; +} +.panel-group .panel-heading + .panel-collapse > .panel-body, +.panel-group .panel-heading + .panel-collapse > .list-group { + border-top: 1px solid #ddd; +} +.panel-group .panel-footer { + border-top: 0; +} +.panel-group .panel-footer + .panel-collapse .panel-body { + border-bottom: 1px solid #ddd; +} +.panel-default { + border-color: #ddd; +} +.panel-default > .panel-heading { + color: #333; + background-color: #f5f5f5; + border-color: #ddd; +} +.panel-default > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #ddd; +} +.panel-default > .panel-heading .badge { + color: #f5f5f5; + background-color: #333; +} +.panel-default > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #ddd; +} +.panel-primary { + border-color: #337ab7; +} +.panel-primary > .panel-heading { + color: #fff; + background-color: #337ab7; + border-color: #337ab7; +} +.panel-primary > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #337ab7; +} +.panel-primary > .panel-heading .badge { + color: #337ab7; + background-color: #fff; +} +.panel-primary > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #337ab7; +} +.panel-success { + border-color: #d6e9c6; +} +.panel-success > .panel-heading { + color: #3c763d; + background-color: #dff0d8; + border-color: #d6e9c6; +} +.panel-success > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #d6e9c6; +} +.panel-success > .panel-heading .badge { + color: #dff0d8; + background-color: #3c763d; +} +.panel-success > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #d6e9c6; +} +.panel-info { + border-color: #bce8f1; +} +.panel-info > .panel-heading { + color: #31708f; + background-color: #d9edf7; + border-color: #bce8f1; +} +.panel-info > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #bce8f1; +} +.panel-info > .panel-heading .badge { + color: #d9edf7; + background-color: #31708f; +} +.panel-info > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #bce8f1; +} +.panel-warning { + border-color: #faebcc; +} +.panel-warning > .panel-heading { + color: #8a6d3b; + background-color: #fcf8e3; + border-color: #faebcc; +} +.panel-warning > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #faebcc; +} +.panel-warning > .panel-heading .badge { + color: #fcf8e3; + background-color: #8a6d3b; +} +.panel-warning > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #faebcc; +} +.panel-danger { + border-color: #ebccd1; +} +.panel-danger > .panel-heading { + color: #a94442; + background-color: #f2dede; + border-color: #ebccd1; +} +.panel-danger > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #ebccd1; +} +.panel-danger > .panel-heading .badge { + color: #f2dede; + background-color: #a94442; +} +.panel-danger > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #ebccd1; +} +.embed-responsive { + position: relative; + display: block; + height: 0; + padding: 0; + overflow: hidden; +} +.embed-responsive .embed-responsive-item, +.embed-responsive iframe, +.embed-responsive embed, +.embed-responsive object, +.embed-responsive video { + position: absolute; + top: 0; + bottom: 0; + left: 0; + width: 100%; + height: 100%; + border: 0; +} +.embed-responsive-16by9 { + padding-bottom: 56.25%; +} +.embed-responsive-4by3 { + padding-bottom: 75%; +} +.well { + min-height: 20px; + padding: 19px; + margin-bottom: 20px; + background-color: #f5f5f5; + border: 1px solid #e3e3e3; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); +} +.well blockquote { + border-color: #ddd; + border-color: rgba(0, 0, 0, .15); +} +.well-lg { + padding: 24px; + border-radius: 6px; +} +.well-sm { + padding: 9px; + border-radius: 3px; +} +.close { + float: right; + font-size: 21px; + font-weight: bold; + line-height: 1; + color: #000; + text-shadow: 0 1px 0 #fff; + filter: alpha(opacity=20); + opacity: .2; +} +.close:hover, +.close:focus { + color: #000; + text-decoration: none; + cursor: pointer; + filter: alpha(opacity=50); + opacity: .5; +} +button.close { + -webkit-appearance: none; + padding: 0; + cursor: pointer; + background: transparent; + border: 0; +} +.modal-open { + overflow: hidden; +} +.modal { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1050; + display: none; + overflow: hidden; + -webkit-overflow-scrolling: touch; + outline: 0; +} +.modal.fade .modal-dialog { + -webkit-transition: -webkit-transform .3s ease-out; + -o-transition: -o-transform .3s ease-out; + transition: transform .3s ease-out; + -webkit-transform: translate(0, -25%); + -ms-transform: translate(0, -25%); + -o-transform: translate(0, -25%); + transform: translate(0, -25%); +} +.modal.in .modal-dialog { + -webkit-transform: translate(0, 0); + -ms-transform: translate(0, 0); + -o-transform: translate(0, 0); + transform: translate(0, 0); +} +.modal-open .modal { + overflow-x: hidden; + overflow-y: auto; +} +.modal-dialog { + position: relative; + width: auto; + margin: 10px; +} +.modal-content { + position: relative; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #999; + border: 1px solid rgba(0, 0, 0, .2); + border-radius: 6px; + outline: 0; + -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5); + box-shadow: 0 3px 9px rgba(0, 0, 0, .5); +} +.modal-backdrop { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1040; + background-color: #000; +} +.modal-backdrop.fade { + filter: alpha(opacity=0); + opacity: 0; +} +.modal-backdrop.in { + filter: alpha(opacity=50); + opacity: .5; +} +.modal-header { + padding: 15px; + border-bottom: 1px solid #e5e5e5; +} +.modal-header .close { + margin-top: -2px; +} +.modal-title { + margin: 0; + line-height: 1.42857143; +} +.modal-body { + position: relative; + padding: 15px; +} +.modal-footer { + padding: 15px; + text-align: right; + border-top: 1px solid #e5e5e5; +} +.modal-footer .btn + .btn { + margin-bottom: 0; + margin-left: 5px; +} +.modal-footer .btn-group .btn + .btn { + margin-left: -1px; +} +.modal-footer .btn-block + .btn-block { + margin-left: 0; +} +.modal-scrollbar-measure { + position: absolute; + top: -9999px; + width: 50px; + height: 50px; + overflow: scroll; +} +@media (min-width: 768px) { + .modal-dialog { + width: 600px; + margin: 30px auto; + } + .modal-content { + -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5); + box-shadow: 0 5px 15px rgba(0, 0, 0, .5); + } + .modal-sm { + width: 300px; + } +} +@media (min-width: 992px) { + .modal-lg { + width: 900px; + } +} +.tooltip { + position: absolute; + z-index: 1070; + display: block; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 12px; + font-style: normal; + font-weight: normal; + line-height: 1.42857143; + text-align: left; + text-align: start; + text-decoration: none; + text-shadow: none; + text-transform: none; + letter-spacing: normal; + word-break: normal; + word-spacing: normal; + word-wrap: normal; + white-space: normal; + filter: alpha(opacity=0); + opacity: 0; + + line-break: auto; +} +.tooltip.in { + filter: alpha(opacity=90); + opacity: .9; +} +.tooltip.top { + padding: 5px 0; + margin-top: -3px; +} +.tooltip.right { + padding: 0 5px; + margin-left: 3px; +} +.tooltip.bottom { + padding: 5px 0; + margin-top: 3px; +} +.tooltip.left { + padding: 0 5px; + margin-left: -3px; +} +.tooltip-inner { + max-width: 200px; + padding: 3px 8px; + color: #fff; + text-align: center; + background-color: #000; + border-radius: 4px; +} +.tooltip-arrow { + position: absolute; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} +.tooltip.top .tooltip-arrow { + bottom: 0; + left: 50%; + margin-left: -5px; + border-width: 5px 5px 0; + border-top-color: #000; +} +.tooltip.top-left .tooltip-arrow { + right: 5px; + bottom: 0; + margin-bottom: -5px; + border-width: 5px 5px 0; + border-top-color: #000; +} +.tooltip.top-right .tooltip-arrow { + bottom: 0; + left: 5px; + margin-bottom: -5px; + border-width: 5px 5px 0; + border-top-color: #000; +} +.tooltip.right .tooltip-arrow { + top: 50%; + left: 0; + margin-top: -5px; + border-width: 5px 5px 5px 0; + border-right-color: #000; +} +.tooltip.left .tooltip-arrow { + top: 50%; + right: 0; + margin-top: -5px; + border-width: 5px 0 5px 5px; + border-left-color: #000; +} +.tooltip.bottom .tooltip-arrow { + top: 0; + left: 50%; + margin-left: -5px; + border-width: 0 5px 5px; + border-bottom-color: #000; +} +.tooltip.bottom-left .tooltip-arrow { + top: 0; + right: 5px; + margin-top: -5px; + border-width: 0 5px 5px; + border-bottom-color: #000; +} +.tooltip.bottom-right .tooltip-arrow { + top: 0; + left: 5px; + margin-top: -5px; + border-width: 0 5px 5px; + border-bottom-color: #000; +} +.popover { + position: absolute; + top: 0; + left: 0; + z-index: 1060; + display: none; + max-width: 276px; + padding: 1px; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + font-style: normal; + font-weight: normal; + line-height: 1.42857143; + text-align: left; + text-align: start; + text-decoration: none; + text-shadow: none; + text-transform: none; + letter-spacing: normal; + word-break: normal; + word-spacing: normal; + word-wrap: normal; + white-space: normal; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, .2); + border-radius: 6px; + -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2); + box-shadow: 0 5px 10px rgba(0, 0, 0, .2); + + line-break: auto; +} +.popover.top { + margin-top: -10px; +} +.popover.right { + margin-left: 10px; +} +.popover.bottom { + margin-top: 10px; +} +.popover.left { + margin-left: -10px; +} +.popover-title { + padding: 8px 14px; + margin: 0; + font-size: 14px; + background-color: #f7f7f7; + border-bottom: 1px solid #ebebeb; + border-radius: 5px 5px 0 0; +} +.popover-content { + padding: 9px 14px; +} +.popover > .arrow, +.popover > .arrow:after { + position: absolute; + display: block; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} +.popover > .arrow { + border-width: 11px; +} +.popover > .arrow:after { + content: ""; + border-width: 10px; +} +.popover.top > .arrow { + bottom: -11px; + left: 50%; + margin-left: -11px; + border-top-color: #999; + border-top-color: rgba(0, 0, 0, .25); + border-bottom-width: 0; +} +.popover.top > .arrow:after { + bottom: 1px; + margin-left: -10px; + content: " "; + border-top-color: #fff; + border-bottom-width: 0; +} +.popover.right > .arrow { + top: 50%; + left: -11px; + margin-top: -11px; + border-right-color: #999; + border-right-color: rgba(0, 0, 0, .25); + border-left-width: 0; +} +.popover.right > .arrow:after { + bottom: -10px; + left: 1px; + content: " "; + border-right-color: #fff; + border-left-width: 0; +} +.popover.bottom > .arrow { + top: -11px; + left: 50%; + margin-left: -11px; + border-top-width: 0; + border-bottom-color: #999; + border-bottom-color: rgba(0, 0, 0, .25); +} +.popover.bottom > .arrow:after { + top: 1px; + margin-left: -10px; + content: " "; + border-top-width: 0; + border-bottom-color: #fff; +} +.popover.left > .arrow { + top: 50%; + right: -11px; + margin-top: -11px; + border-right-width: 0; + border-left-color: #999; + border-left-color: rgba(0, 0, 0, .25); +} +.popover.left > .arrow:after { + right: 1px; + bottom: -10px; + content: " "; + border-right-width: 0; + border-left-color: #fff; +} +.carousel { + position: relative; +} +.carousel-inner { + position: relative; + width: 100%; + overflow: hidden; +} +.carousel-inner > .item { + position: relative; + display: none; + -webkit-transition: .6s ease-in-out left; + -o-transition: .6s ease-in-out left; + transition: .6s ease-in-out left; +} +.carousel-inner > .item > img, +.carousel-inner > .item > a > img { + line-height: 1; +} +@media all and (transform-3d), (-webkit-transform-3d) { + .carousel-inner > .item { + -webkit-transition: -webkit-transform .6s ease-in-out; + -o-transition: -o-transform .6s ease-in-out; + transition: transform .6s ease-in-out; + + -webkit-backface-visibility: hidden; + backface-visibility: hidden; + -webkit-perspective: 1000px; + perspective: 1000px; + } + .carousel-inner > .item.next, + .carousel-inner > .item.active.right { + left: 0; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } + .carousel-inner > .item.prev, + .carousel-inner > .item.active.left { + left: 0; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } + .carousel-inner > .item.next.left, + .carousel-inner > .item.prev.right, + .carousel-inner > .item.active { + left: 0; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +.carousel-inner > .active, +.carousel-inner > .next, +.carousel-inner > .prev { + display: block; +} +.carousel-inner > .active { + left: 0; +} +.carousel-inner > .next, +.carousel-inner > .prev { + position: absolute; + top: 0; + width: 100%; +} +.carousel-inner > .next { + left: 100%; +} +.carousel-inner > .prev { + left: -100%; +} +.carousel-inner > .next.left, +.carousel-inner > .prev.right { + left: 0; +} +.carousel-inner > .active.left { + left: -100%; +} +.carousel-inner > .active.right { + left: 100%; +} +.carousel-control { + position: absolute; + top: 0; + bottom: 0; + left: 0; + width: 15%; + font-size: 20px; + color: #fff; + text-align: center; + text-shadow: 0 1px 2px rgba(0, 0, 0, .6); + background-color: rgba(0, 0, 0, 0); + filter: alpha(opacity=50); + opacity: .5; +} +.carousel-control.left { + background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%); + background-image: -o-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%); + background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, .0001))); + background-image: linear-gradient(to right, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1); + background-repeat: repeat-x; +} +.carousel-control.right { + right: 0; + left: auto; + background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%); + background-image: -o-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%); + background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .0001)), to(rgba(0, 0, 0, .5))); + background-image: linear-gradient(to right, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1); + background-repeat: repeat-x; +} +.carousel-control:hover, +.carousel-control:focus { + color: #fff; + text-decoration: none; + filter: alpha(opacity=90); + outline: 0; + opacity: .9; +} +.carousel-control .icon-prev, +.carousel-control .icon-next, +.carousel-control .glyphicon-chevron-left, +.carousel-control .glyphicon-chevron-right { + position: absolute; + top: 50%; + z-index: 5; + display: inline-block; + margin-top: -10px; +} +.carousel-control .icon-prev, +.carousel-control .glyphicon-chevron-left { + left: 50%; + margin-left: -10px; +} +.carousel-control .icon-next, +.carousel-control .glyphicon-chevron-right { + right: 50%; + margin-right: -10px; +} +.carousel-control .icon-prev, +.carousel-control .icon-next { + width: 20px; + height: 20px; + font-family: serif; + line-height: 1; +} +.carousel-control .icon-prev:before { + content: '\2039'; +} +.carousel-control .icon-next:before { + content: '\203a'; +} +.carousel-indicators { + position: absolute; + bottom: 10px; + left: 50%; + z-index: 15; + width: 60%; + padding-left: 0; + margin-left: -30%; + text-align: center; + list-style: none; +} +.carousel-indicators li { + display: inline-block; + width: 10px; + height: 10px; + margin: 1px; + text-indent: -999px; + cursor: pointer; + background-color: #000 \9; + background-color: rgba(0, 0, 0, 0); + border: 1px solid #fff; + border-radius: 10px; +} +.carousel-indicators .active { + width: 12px; + height: 12px; + margin: 0; + background-color: #fff; +} +.carousel-caption { + position: absolute; + right: 15%; + bottom: 20px; + left: 15%; + z-index: 10; + padding-top: 20px; + padding-bottom: 20px; + color: #fff; + text-align: center; + text-shadow: 0 1px 2px rgba(0, 0, 0, .6); +} +.carousel-caption .btn { + text-shadow: none; +} +@media screen and (min-width: 768px) { + .carousel-control .glyphicon-chevron-left, + .carousel-control .glyphicon-chevron-right, + .carousel-control .icon-prev, + .carousel-control .icon-next { + width: 30px; + height: 30px; + margin-top: -10px; + font-size: 30px; + } + .carousel-control .glyphicon-chevron-left, + .carousel-control .icon-prev { + margin-left: -10px; + } + .carousel-control .glyphicon-chevron-right, + .carousel-control .icon-next { + margin-right: -10px; + } + .carousel-caption { + right: 20%; + left: 20%; + padding-bottom: 30px; + } + .carousel-indicators { + bottom: 20px; + } +} +.clearfix:before, +.clearfix:after, +.dl-horizontal dd:before, +.dl-horizontal dd:after, +.container:before, +.container:after, +.container-fluid:before, +.container-fluid:after, +.row:before, +.row:after, +.form-horizontal .form-group:before, +.form-horizontal .form-group:after, +.btn-toolbar:before, +.btn-toolbar:after, +.btn-group-vertical > .btn-group:before, +.btn-group-vertical > .btn-group:after, +.nav:before, +.nav:after, +.navbar:before, +.navbar:after, +.navbar-header:before, +.navbar-header:after, +.navbar-collapse:before, +.navbar-collapse:after, +.pager:before, +.pager:after, +.panel-body:before, +.panel-body:after, +.modal-header:before, +.modal-header:after, +.modal-footer:before, +.modal-footer:after { + display: table; + content: " "; +} +.clearfix:after, +.dl-horizontal dd:after, +.container:after, +.container-fluid:after, +.row:after, +.form-horizontal .form-group:after, +.btn-toolbar:after, +.btn-group-vertical > .btn-group:after, +.nav:after, +.navbar:after, +.navbar-header:after, +.navbar-collapse:after, +.pager:after, +.panel-body:after, +.modal-header:after, +.modal-footer:after { + clear: both; +} +.center-block { + display: block; + margin-right: auto; + margin-left: auto; +} +.pull-right { + float: right !important; +} +.pull-left { + float: left !important; +} +.hide { + display: none !important; +} +.show { + display: block !important; +} +.invisible { + visibility: hidden; +} +.text-hide { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} +.hidden { + display: none !important; +} +.affix { + position: fixed; +} +@-ms-viewport { + width: device-width; +} +.visible-xs, +.visible-sm, +.visible-md, +.visible-lg { + display: none !important; +} +.visible-xs-block, +.visible-xs-inline, +.visible-xs-inline-block, +.visible-sm-block, +.visible-sm-inline, +.visible-sm-inline-block, +.visible-md-block, +.visible-md-inline, +.visible-md-inline-block, +.visible-lg-block, +.visible-lg-inline, +.visible-lg-inline-block { + display: none !important; +} +@media (max-width: 767px) { + .visible-xs { + display: block !important; + } + table.visible-xs { + display: table !important; + } + tr.visible-xs { + display: table-row !important; + } + th.visible-xs, + td.visible-xs { + display: table-cell !important; + } +} +@media (max-width: 767px) { + .visible-xs-block { + display: block !important; + } +} +@media (max-width: 767px) { + .visible-xs-inline { + display: inline !important; + } +} +@media (max-width: 767px) { + .visible-xs-inline-block { + display: inline-block !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .visible-sm { + display: block !important; + } + table.visible-sm { + display: table !important; + } + tr.visible-sm { + display: table-row !important; + } + th.visible-sm, + td.visible-sm { + display: table-cell !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .visible-sm-block { + display: block !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .visible-sm-inline { + display: inline !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .visible-sm-inline-block { + display: inline-block !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .visible-md { + display: block !important; + } + table.visible-md { + display: table !important; + } + tr.visible-md { + display: table-row !important; + } + th.visible-md, + td.visible-md { + display: table-cell !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .visible-md-block { + display: block !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .visible-md-inline { + display: inline !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .visible-md-inline-block { + display: inline-block !important; + } +} +@media (min-width: 1200px) { + .visible-lg { + display: block !important; + } + table.visible-lg { + display: table !important; + } + tr.visible-lg { + display: table-row !important; + } + th.visible-lg, + td.visible-lg { + display: table-cell !important; + } +} +@media (min-width: 1200px) { + .visible-lg-block { + display: block !important; + } +} +@media (min-width: 1200px) { + .visible-lg-inline { + display: inline !important; + } +} +@media (min-width: 1200px) { + .visible-lg-inline-block { + display: inline-block !important; + } +} +@media (max-width: 767px) { + .hidden-xs { + display: none !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .hidden-sm { + display: none !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .hidden-md { + display: none !important; + } +} +@media (min-width: 1200px) { + .hidden-lg { + display: none !important; + } +} +.visible-print { + display: none !important; +} +@media print { + .visible-print { + display: block !important; + } + table.visible-print { + display: table !important; + } + tr.visible-print { + display: table-row !important; + } + th.visible-print, + td.visible-print { + display: table-cell !important; + } +} +.visible-print-block { + display: none !important; +} +@media print { + .visible-print-block { + display: block !important; + } +} +.visible-print-inline { + display: none !important; +} +@media print { + .visible-print-inline { + display: inline !important; + } +} +.visible-print-inline-block { + display: none !important; +} +@media print { + .visible-print-inline-block { + display: inline-block !important; + } +} +@media print { + .hidden-print { + display: none !important; + } +} +/*# sourceMappingURL=bootstrap.css.map */ diff --git a/debian/missing-sources/bootstrap.js b/debian/missing-sources/bootstrap.js new file mode 100644 index 0000000..01fbbcb --- /dev/null +++ b/debian/missing-sources/bootstrap.js @@ -0,0 +1,2363 @@ +/*! + * Bootstrap v3.3.6 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. + * Licensed under the MIT license + */ + +if (typeof jQuery === 'undefined') { + throw new Error('Bootstrap\'s JavaScript requires jQuery') +} + ++function ($) { + 'use strict'; + var version = $.fn.jquery.split(' ')[0].split('.') + if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 2)) { + throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3') + } +}(jQuery); + +/* ======================================================================== + * Bootstrap: transition.js v3.3.6 + * http://getbootstrap.com/javascript/#transitions + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) + // ============================================================ + + function transitionEnd() { + var el = document.createElement('bootstrap') + + var transEndEventNames = { + WebkitTransition : 'webkitTransitionEnd', + MozTransition : 'transitionend', + OTransition : 'oTransitionEnd otransitionend', + transition : 'transitionend' + } + + for (var name in transEndEventNames) { + if (el.style[name] !== undefined) { + return { end: transEndEventNames[name] } + } + } + + return false // explicit for ie8 ( ._.) + } + + // http://blog.alexmaccaw.com/css-transitions + $.fn.emulateTransitionEnd = function (duration) { + var called = false + var $el = this + $(this).one('bsTransitionEnd', function () { called = true }) + var callback = function () { if (!called) $($el).trigger($.support.transition.end) } + setTimeout(callback, duration) + return this + } + + $(function () { + $.support.transition = transitionEnd() + + if (!$.support.transition) return + + $.event.special.bsTransitionEnd = { + bindType: $.support.transition.end, + delegateType: $.support.transition.end, + handle: function (e) { + if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) + } + } + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: alert.js v3.3.6 + * http://getbootstrap.com/javascript/#alerts + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // ALERT CLASS DEFINITION + // ====================== + + var dismiss = '[data-dismiss="alert"]' + var Alert = function (el) { + $(el).on('click', dismiss, this.close) + } + + Alert.VERSION = '3.3.6' + + Alert.TRANSITION_DURATION = 150 + + Alert.prototype.close = function (e) { + var $this = $(this) + var selector = $this.attr('data-target') + + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 + } + + var $parent = $(selector) + + if (e) e.preventDefault() + + if (!$parent.length) { + $parent = $this.closest('.alert') + } + + $parent.trigger(e = $.Event('close.bs.alert')) + + if (e.isDefaultPrevented()) return + + $parent.removeClass('in') + + function removeElement() { + // detach from parent, fire event then clean up data + $parent.detach().trigger('closed.bs.alert').remove() + } + + $.support.transition && $parent.hasClass('fade') ? + $parent + .one('bsTransitionEnd', removeElement) + .emulateTransitionEnd(Alert.TRANSITION_DURATION) : + removeElement() + } + + + // ALERT PLUGIN DEFINITION + // ======================= + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.alert') + + if (!data) $this.data('bs.alert', (data = new Alert(this))) + if (typeof option == 'string') data[option].call($this) + }) + } + + var old = $.fn.alert + + $.fn.alert = Plugin + $.fn.alert.Constructor = Alert + + + // ALERT NO CONFLICT + // ================= + + $.fn.alert.noConflict = function () { + $.fn.alert = old + return this + } + + + // ALERT DATA-API + // ============== + + $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: button.js v3.3.6 + * http://getbootstrap.com/javascript/#buttons + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // BUTTON PUBLIC CLASS DEFINITION + // ============================== + + var Button = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, Button.DEFAULTS, options) + this.isLoading = false + } + + Button.VERSION = '3.3.6' + + Button.DEFAULTS = { + loadingText: 'loading...' + } + + Button.prototype.setState = function (state) { + var d = 'disabled' + var $el = this.$element + var val = $el.is('input') ? 'val' : 'html' + var data = $el.data() + + state += 'Text' + + if (data.resetText == null) $el.data('resetText', $el[val]()) + + // push to event loop to allow forms to submit + setTimeout($.proxy(function () { + $el[val](data[state] == null ? this.options[state] : data[state]) + + if (state == 'loadingText') { + this.isLoading = true + $el.addClass(d).attr(d, d) + } else if (this.isLoading) { + this.isLoading = false + $el.removeClass(d).removeAttr(d) + } + }, this), 0) + } + + Button.prototype.toggle = function () { + var changed = true + var $parent = this.$element.closest('[data-toggle="buttons"]') + + if ($parent.length) { + var $input = this.$element.find('input') + if ($input.prop('type') == 'radio') { + if ($input.prop('checked')) changed = false + $parent.find('.active').removeClass('active') + this.$element.addClass('active') + } else if ($input.prop('type') == 'checkbox') { + if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false + this.$element.toggleClass('active') + } + $input.prop('checked', this.$element.hasClass('active')) + if (changed) $input.trigger('change') + } else { + this.$element.attr('aria-pressed', !this.$element.hasClass('active')) + this.$element.toggleClass('active') + } + } + + + // BUTTON PLUGIN DEFINITION + // ======================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.button') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs.button', (data = new Button(this, options))) + + if (option == 'toggle') data.toggle() + else if (option) data.setState(option) + }) + } + + var old = $.fn.button + + $.fn.button = Plugin + $.fn.button.Constructor = Button + + + // BUTTON NO CONFLICT + // ================== + + $.fn.button.noConflict = function () { + $.fn.button = old + return this + } + + + // BUTTON DATA-API + // =============== + + $(document) + .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { + var $btn = $(e.target) + if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') + Plugin.call($btn, 'toggle') + if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) e.preventDefault() + }) + .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { + $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: carousel.js v3.3.6 + * http://getbootstrap.com/javascript/#carousel + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // CAROUSEL CLASS DEFINITION + // ========================= + + var Carousel = function (element, options) { + this.$element = $(element) + this.$indicators = this.$element.find('.carousel-indicators') + this.options = options + this.paused = null + this.sliding = null + this.interval = null + this.$active = null + this.$items = null + + this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) + + this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element + .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) + .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) + } + + Carousel.VERSION = '3.3.6' + + Carousel.TRANSITION_DURATION = 600 + + Carousel.DEFAULTS = { + interval: 5000, + pause: 'hover', + wrap: true, + keyboard: true + } + + Carousel.prototype.keydown = function (e) { + if (/input|textarea/i.test(e.target.tagName)) return + switch (e.which) { + case 37: this.prev(); break + case 39: this.next(); break + default: return + } + + e.preventDefault() + } + + Carousel.prototype.cycle = function (e) { + e || (this.paused = false) + + this.interval && clearInterval(this.interval) + + this.options.interval + && !this.paused + && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) + + return this + } + + Carousel.prototype.getItemIndex = function (item) { + this.$items = item.parent().children('.item') + return this.$items.index(item || this.$active) + } + + Carousel.prototype.getItemForDirection = function (direction, active) { + var activeIndex = this.getItemIndex(active) + var willWrap = (direction == 'prev' && activeIndex === 0) + || (direction == 'next' && activeIndex == (this.$items.length - 1)) + if (willWrap && !this.options.wrap) return active + var delta = direction == 'prev' ? -1 : 1 + var itemIndex = (activeIndex + delta) % this.$items.length + return this.$items.eq(itemIndex) + } + + Carousel.prototype.to = function (pos) { + var that = this + var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) + + if (pos > (this.$items.length - 1) || pos < 0) return + + if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" + if (activeIndex == pos) return this.pause().cycle() + + return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos)) + } + + Carousel.prototype.pause = function (e) { + e || (this.paused = true) + + if (this.$element.find('.next, .prev').length && $.support.transition) { + this.$element.trigger($.support.transition.end) + this.cycle(true) + } + + this.interval = clearInterval(this.interval) + + return this + } + + Carousel.prototype.next = function () { + if (this.sliding) return + return this.slide('next') + } + + Carousel.prototype.prev = function () { + if (this.sliding) return + return this.slide('prev') + } + + Carousel.prototype.slide = function (type, next) { + var $active = this.$element.find('.item.active') + var $next = next || this.getItemForDirection(type, $active) + var isCycling = this.interval + var direction = type == 'next' ? 'left' : 'right' + var that = this + + if ($next.hasClass('active')) return (this.sliding = false) + + var relatedTarget = $next[0] + var slideEvent = $.Event('slide.bs.carousel', { + relatedTarget: relatedTarget, + direction: direction + }) + this.$element.trigger(slideEvent) + if (slideEvent.isDefaultPrevented()) return + + this.sliding = true + + isCycling && this.pause() + + if (this.$indicators.length) { + this.$indicators.find('.active').removeClass('active') + var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) + $nextIndicator && $nextIndicator.addClass('active') + } + + var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" + if ($.support.transition && this.$element.hasClass('slide')) { + $next.addClass(type) + $next[0].offsetWidth // force reflow + $active.addClass(direction) + $next.addClass(direction) + $active + .one('bsTransitionEnd', function () { + $next.removeClass([type, direction].join(' ')).addClass('active') + $active.removeClass(['active', direction].join(' ')) + that.sliding = false + setTimeout(function () { + that.$element.trigger(slidEvent) + }, 0) + }) + .emulateTransitionEnd(Carousel.TRANSITION_DURATION) + } else { + $active.removeClass('active') + $next.addClass('active') + this.sliding = false + this.$element.trigger(slidEvent) + } + + isCycling && this.cycle() + + return this + } + + + // CAROUSEL PLUGIN DEFINITION + // ========================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.carousel') + var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) + var action = typeof option == 'string' ? option : options.slide + + if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) + if (typeof option == 'number') data.to(option) + else if (action) data[action]() + else if (options.interval) data.pause().cycle() + }) + } + + var old = $.fn.carousel + + $.fn.carousel = Plugin + $.fn.carousel.Constructor = Carousel + + + // CAROUSEL NO CONFLICT + // ==================== + + $.fn.carousel.noConflict = function () { + $.fn.carousel = old + return this + } + + + // CAROUSEL DATA-API + // ================= + + var clickHandler = function (e) { + var href + var $this = $(this) + var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 + if (!$target.hasClass('carousel')) return + var options = $.extend({}, $target.data(), $this.data()) + var slideIndex = $this.attr('data-slide-to') + if (slideIndex) options.interval = false + + Plugin.call($target, options) + + if (slideIndex) { + $target.data('bs.carousel').to(slideIndex) + } + + e.preventDefault() + } + + $(document) + .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) + .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler) + + $(window).on('load', function () { + $('[data-ride="carousel"]').each(function () { + var $carousel = $(this) + Plugin.call($carousel, $carousel.data()) + }) + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: collapse.js v3.3.6 + * http://getbootstrap.com/javascript/#collapse + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // COLLAPSE PUBLIC CLASS DEFINITION + // ================================ + + var Collapse = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, Collapse.DEFAULTS, options) + this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' + + '[data-toggle="collapse"][data-target="#' + element.id + '"]') + this.transitioning = null + + if (this.options.parent) { + this.$parent = this.getParent() + } else { + this.addAriaAndCollapsedClass(this.$element, this.$trigger) + } + + if (this.options.toggle) this.toggle() + } + + Collapse.VERSION = '3.3.6' + + Collapse.TRANSITION_DURATION = 350 + + Collapse.DEFAULTS = { + toggle: true + } + + Collapse.prototype.dimension = function () { + var hasWidth = this.$element.hasClass('width') + return hasWidth ? 'width' : 'height' + } + + Collapse.prototype.show = function () { + if (this.transitioning || this.$element.hasClass('in')) return + + var activesData + var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') + + if (actives && actives.length) { + activesData = actives.data('bs.collapse') + if (activesData && activesData.transitioning) return + } + + var startEvent = $.Event('show.bs.collapse') + this.$element.trigger(startEvent) + if (startEvent.isDefaultPrevented()) return + + if (actives && actives.length) { + Plugin.call(actives, 'hide') + activesData || actives.data('bs.collapse', null) + } + + var dimension = this.dimension() + + this.$element + .removeClass('collapse') + .addClass('collapsing')[dimension](0) + .attr('aria-expanded', true) + + this.$trigger + .removeClass('collapsed') + .attr('aria-expanded', true) + + this.transitioning = 1 + + var complete = function () { + this.$element + .removeClass('collapsing') + .addClass('collapse in')[dimension]('') + this.transitioning = 0 + this.$element + .trigger('shown.bs.collapse') + } + + if (!$.support.transition) return complete.call(this) + + var scrollSize = $.camelCase(['scroll', dimension].join('-')) + + this.$element + .one('bsTransitionEnd', $.proxy(complete, this)) + .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]) + } + + Collapse.prototype.hide = function () { + if (this.transitioning || !this.$element.hasClass('in')) return + + var startEvent = $.Event('hide.bs.collapse') + this.$element.trigger(startEvent) + if (startEvent.isDefaultPrevented()) return + + var dimension = this.dimension() + + this.$element[dimension](this.$element[dimension]())[0].offsetHeight + + this.$element + .addClass('collapsing') + .removeClass('collapse in') + .attr('aria-expanded', false) + + this.$trigger + .addClass('collapsed') + .attr('aria-expanded', false) + + this.transitioning = 1 + + var complete = function () { + this.transitioning = 0 + this.$element + .removeClass('collapsing') + .addClass('collapse') + .trigger('hidden.bs.collapse') + } + + if (!$.support.transition) return complete.call(this) + + this.$element + [dimension](0) + .one('bsTransitionEnd', $.proxy(complete, this)) + .emulateTransitionEnd(Collapse.TRANSITION_DURATION) + } + + Collapse.prototype.toggle = function () { + this[this.$element.hasClass('in') ? 'hide' : 'show']() + } + + Collapse.prototype.getParent = function () { + return $(this.options.parent) + .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') + .each($.proxy(function (i, element) { + var $element = $(element) + this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element) + }, this)) + .end() + } + + Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) { + var isOpen = $element.hasClass('in') + + $element.attr('aria-expanded', isOpen) + $trigger + .toggleClass('collapsed', !isOpen) + .attr('aria-expanded', isOpen) + } + + function getTargetFromTrigger($trigger) { + var href + var target = $trigger.attr('data-target') + || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 + + return $(target) + } + + + // COLLAPSE PLUGIN DEFINITION + // ========================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.collapse') + var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) + + if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false + if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.collapse + + $.fn.collapse = Plugin + $.fn.collapse.Constructor = Collapse + + + // COLLAPSE NO CONFLICT + // ==================== + + $.fn.collapse.noConflict = function () { + $.fn.collapse = old + return this + } + + + // COLLAPSE DATA-API + // ================= + + $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { + var $this = $(this) + + if (!$this.attr('data-target')) e.preventDefault() + + var $target = getTargetFromTrigger($this) + var data = $target.data('bs.collapse') + var option = data ? 'toggle' : $this.data() + + Plugin.call($target, option) + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: dropdown.js v3.3.6 + * http://getbootstrap.com/javascript/#dropdowns + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // DROPDOWN CLASS DEFINITION + // ========================= + + var backdrop = '.dropdown-backdrop' + var toggle = '[data-toggle="dropdown"]' + var Dropdown = function (element) { + $(element).on('click.bs.dropdown', this.toggle) + } + + Dropdown.VERSION = '3.3.6' + + function getParent($this) { + var selector = $this.attr('data-target') + + if (!selector) { + selector = $this.attr('href') + selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 + } + + var $parent = selector && $(selector) + + return $parent && $parent.length ? $parent : $this.parent() + } + + function clearMenus(e) { + if (e && e.which === 3) return + $(backdrop).remove() + $(toggle).each(function () { + var $this = $(this) + var $parent = getParent($this) + var relatedTarget = { relatedTarget: this } + + if (!$parent.hasClass('open')) return + + if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return + + $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) + + if (e.isDefaultPrevented()) return + + $this.attr('aria-expanded', 'false') + $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget)) + }) + } + + Dropdown.prototype.toggle = function (e) { + var $this = $(this) + + if ($this.is('.disabled, :disabled')) return + + var $parent = getParent($this) + var isActive = $parent.hasClass('open') + + clearMenus() + + if (!isActive) { + if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { + // if mobile we use a backdrop because click events don't delegate + $(document.createElement('div')) + .addClass('dropdown-backdrop') + .insertAfter($(this)) + .on('click', clearMenus) + } + + var relatedTarget = { relatedTarget: this } + $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) + + if (e.isDefaultPrevented()) return + + $this + .trigger('focus') + .attr('aria-expanded', 'true') + + $parent + .toggleClass('open') + .trigger($.Event('shown.bs.dropdown', relatedTarget)) + } + + return false + } + + Dropdown.prototype.keydown = function (e) { + if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return + + var $this = $(this) + + e.preventDefault() + e.stopPropagation() + + if ($this.is('.disabled, :disabled')) return + + var $parent = getParent($this) + var isActive = $parent.hasClass('open') + + if (!isActive && e.which != 27 || isActive && e.which == 27) { + if (e.which == 27) $parent.find(toggle).trigger('focus') + return $this.trigger('click') + } + + var desc = ' li:not(.disabled):visible a' + var $items = $parent.find('.dropdown-menu' + desc) + + if (!$items.length) return + + var index = $items.index(e.target) + + if (e.which == 38 && index > 0) index-- // up + if (e.which == 40 && index < $items.length - 1) index++ // down + if (!~index) index = 0 + + $items.eq(index).trigger('focus') + } + + + // DROPDOWN PLUGIN DEFINITION + // ========================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.dropdown') + + if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) + if (typeof option == 'string') data[option].call($this) + }) + } + + var old = $.fn.dropdown + + $.fn.dropdown = Plugin + $.fn.dropdown.Constructor = Dropdown + + + // DROPDOWN NO CONFLICT + // ==================== + + $.fn.dropdown.noConflict = function () { + $.fn.dropdown = old + return this + } + + + // APPLY TO STANDARD DROPDOWN ELEMENTS + // =================================== + + $(document) + .on('click.bs.dropdown.data-api', clearMenus) + .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) + .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) + .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown) + .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: modal.js v3.3.6 + * http://getbootstrap.com/javascript/#modals + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // MODAL CLASS DEFINITION + // ====================== + + var Modal = function (element, options) { + this.options = options + this.$body = $(document.body) + this.$element = $(element) + this.$dialog = this.$element.find('.modal-dialog') + this.$backdrop = null + this.isShown = null + this.originalBodyPad = null + this.scrollbarWidth = 0 + this.ignoreBackdropClick = false + + if (this.options.remote) { + this.$element + .find('.modal-content') + .load(this.options.remote, $.proxy(function () { + this.$element.trigger('loaded.bs.modal') + }, this)) + } + } + + Modal.VERSION = '3.3.6' + + Modal.TRANSITION_DURATION = 300 + Modal.BACKDROP_TRANSITION_DURATION = 150 + + Modal.DEFAULTS = { + backdrop: true, + keyboard: true, + show: true + } + + Modal.prototype.toggle = function (_relatedTarget) { + return this.isShown ? this.hide() : this.show(_relatedTarget) + } + + Modal.prototype.show = function (_relatedTarget) { + var that = this + var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) + + this.$element.trigger(e) + + if (this.isShown || e.isDefaultPrevented()) return + + this.isShown = true + + this.checkScrollbar() + this.setScrollbar() + this.$body.addClass('modal-open') + + this.escape() + this.resize() + + this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) + + this.$dialog.on('mousedown.dismiss.bs.modal', function () { + that.$element.one('mouseup.dismiss.bs.modal', function (e) { + if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true + }) + }) + + this.backdrop(function () { + var transition = $.support.transition && that.$element.hasClass('fade') + + if (!that.$element.parent().length) { + that.$element.appendTo(that.$body) // don't move modals dom position + } + + that.$element + .show() + .scrollTop(0) + + that.adjustDialog() + + if (transition) { + that.$element[0].offsetWidth // force reflow + } + + that.$element.addClass('in') + + that.enforceFocus() + + var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) + + transition ? + that.$dialog // wait for modal to slide in + .one('bsTransitionEnd', function () { + that.$element.trigger('focus').trigger(e) + }) + .emulateTransitionEnd(Modal.TRANSITION_DURATION) : + that.$element.trigger('focus').trigger(e) + }) + } + + Modal.prototype.hide = function (e) { + if (e) e.preventDefault() + + e = $.Event('hide.bs.modal') + + this.$element.trigger(e) + + if (!this.isShown || e.isDefaultPrevented()) return + + this.isShown = false + + this.escape() + this.resize() + + $(document).off('focusin.bs.modal') + + this.$element + .removeClass('in') + .off('click.dismiss.bs.modal') + .off('mouseup.dismiss.bs.modal') + + this.$dialog.off('mousedown.dismiss.bs.modal') + + $.support.transition && this.$element.hasClass('fade') ? + this.$element + .one('bsTransitionEnd', $.proxy(this.hideModal, this)) + .emulateTransitionEnd(Modal.TRANSITION_DURATION) : + this.hideModal() + } + + Modal.prototype.enforceFocus = function () { + $(document) + .off('focusin.bs.modal') // guard against infinite focus loop + .on('focusin.bs.modal', $.proxy(function (e) { + if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { + this.$element.trigger('focus') + } + }, this)) + } + + Modal.prototype.escape = function () { + if (this.isShown && this.options.keyboard) { + this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) { + e.which == 27 && this.hide() + }, this)) + } else if (!this.isShown) { + this.$element.off('keydown.dismiss.bs.modal') + } + } + + Modal.prototype.resize = function () { + if (this.isShown) { + $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) + } else { + $(window).off('resize.bs.modal') + } + } + + Modal.prototype.hideModal = function () { + var that = this + this.$element.hide() + this.backdrop(function () { + that.$body.removeClass('modal-open') + that.resetAdjustments() + that.resetScrollbar() + that.$element.trigger('hidden.bs.modal') + }) + } + + Modal.prototype.removeBackdrop = function () { + this.$backdrop && this.$backdrop.remove() + this.$backdrop = null + } + + Modal.prototype.backdrop = function (callback) { + var that = this + var animate = this.$element.hasClass('fade') ? 'fade' : '' + + if (this.isShown && this.options.backdrop) { + var doAnimate = $.support.transition && animate + + this.$backdrop = $(document.createElement('div')) + .addClass('modal-backdrop ' + animate) + .appendTo(this.$body) + + this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { + if (this.ignoreBackdropClick) { + this.ignoreBackdropClick = false + return + } + if (e.target !== e.currentTarget) return + this.options.backdrop == 'static' + ? this.$element[0].focus() + : this.hide() + }, this)) + + if (doAnimate) this.$backdrop[0].offsetWidth // force reflow + + this.$backdrop.addClass('in') + + if (!callback) return + + doAnimate ? + this.$backdrop + .one('bsTransitionEnd', callback) + .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : + callback() + + } else if (!this.isShown && this.$backdrop) { + this.$backdrop.removeClass('in') + + var callbackRemove = function () { + that.removeBackdrop() + callback && callback() + } + $.support.transition && this.$element.hasClass('fade') ? + this.$backdrop + .one('bsTransitionEnd', callbackRemove) + .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : + callbackRemove() + + } else if (callback) { + callback() + } + } + + // these following methods are used to handle overflowing modals + + Modal.prototype.handleUpdate = function () { + this.adjustDialog() + } + + Modal.prototype.adjustDialog = function () { + var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight + + this.$element.css({ + paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', + paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' + }) + } + + Modal.prototype.resetAdjustments = function () { + this.$element.css({ + paddingLeft: '', + paddingRight: '' + }) + } + + Modal.prototype.checkScrollbar = function () { + var fullWindowWidth = window.innerWidth + if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8 + var documentElementRect = document.documentElement.getBoundingClientRect() + fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left) + } + this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth + this.scrollbarWidth = this.measureScrollbar() + } + + Modal.prototype.setScrollbar = function () { + var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) + this.originalBodyPad = document.body.style.paddingRight || '' + if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) + } + + Modal.prototype.resetScrollbar = function () { + this.$body.css('padding-right', this.originalBodyPad) + } + + Modal.prototype.measureScrollbar = function () { // thx walsh + var scrollDiv = document.createElement('div') + scrollDiv.className = 'modal-scrollbar-measure' + this.$body.append(scrollDiv) + var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth + this.$body[0].removeChild(scrollDiv) + return scrollbarWidth + } + + + // MODAL PLUGIN DEFINITION + // ======================= + + function Plugin(option, _relatedTarget) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.modal') + var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) + + if (!data) $this.data('bs.modal', (data = new Modal(this, options))) + if (typeof option == 'string') data[option](_relatedTarget) + else if (options.show) data.show(_relatedTarget) + }) + } + + var old = $.fn.modal + + $.fn.modal = Plugin + $.fn.modal.Constructor = Modal + + + // MODAL NO CONFLICT + // ================= + + $.fn.modal.noConflict = function () { + $.fn.modal = old + return this + } + + + // MODAL DATA-API + // ============== + + $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { + var $this = $(this) + var href = $this.attr('href') + var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7 + var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) + + if ($this.is('a')) e.preventDefault() + + $target.one('show.bs.modal', function (showEvent) { + if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown + $target.one('hidden.bs.modal', function () { + $this.is(':visible') && $this.trigger('focus') + }) + }) + Plugin.call($target, option, this) + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: tooltip.js v3.3.6 + * http://getbootstrap.com/javascript/#tooltip + * Inspired by the original jQuery.tipsy by Jason Frame + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // TOOLTIP PUBLIC CLASS DEFINITION + // =============================== + + var Tooltip = function (element, options) { + this.type = null + this.options = null + this.enabled = null + this.timeout = null + this.hoverState = null + this.$element = null + this.inState = null + + this.init('tooltip', element, options) + } + + Tooltip.VERSION = '3.3.6' + + Tooltip.TRANSITION_DURATION = 150 + + Tooltip.DEFAULTS = { + animation: true, + placement: 'top', + selector: false, + template: '', + trigger: 'hover focus', + title: '', + delay: 0, + html: false, + container: false, + viewport: { + selector: 'body', + padding: 0 + } + } + + Tooltip.prototype.init = function (type, element, options) { + this.enabled = true + this.type = type + this.$element = $(element) + this.options = this.getOptions(options) + this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport)) + this.inState = { click: false, hover: false, focus: false } + + if (this.$element[0] instanceof document.constructor && !this.options.selector) { + throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!') + } + + var triggers = this.options.trigger.split(' ') + + for (var i = triggers.length; i--;) { + var trigger = triggers[i] + + if (trigger == 'click') { + this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) + } else if (trigger != 'manual') { + var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' + var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' + + this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) + this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) + } + } + + this.options.selector ? + (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : + this.fixTitle() + } + + Tooltip.prototype.getDefaults = function () { + return Tooltip.DEFAULTS + } + + Tooltip.prototype.getOptions = function (options) { + options = $.extend({}, this.getDefaults(), this.$element.data(), options) + + if (options.delay && typeof options.delay == 'number') { + options.delay = { + show: options.delay, + hide: options.delay + } + } + + return options + } + + Tooltip.prototype.getDelegateOptions = function () { + var options = {} + var defaults = this.getDefaults() + + this._options && $.each(this._options, function (key, value) { + if (defaults[key] != value) options[key] = value + }) + + return options + } + + Tooltip.prototype.enter = function (obj) { + var self = obj instanceof this.constructor ? + obj : $(obj.currentTarget).data('bs.' + this.type) + + if (!self) { + self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) + $(obj.currentTarget).data('bs.' + this.type, self) + } + + if (obj instanceof $.Event) { + self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true + } + + if (self.tip().hasClass('in') || self.hoverState == 'in') { + self.hoverState = 'in' + return + } + + clearTimeout(self.timeout) + + self.hoverState = 'in' + + if (!self.options.delay || !self.options.delay.show) return self.show() + + self.timeout = setTimeout(function () { + if (self.hoverState == 'in') self.show() + }, self.options.delay.show) + } + + Tooltip.prototype.isInStateTrue = function () { + for (var key in this.inState) { + if (this.inState[key]) return true + } + + return false + } + + Tooltip.prototype.leave = function (obj) { + var self = obj instanceof this.constructor ? + obj : $(obj.currentTarget).data('bs.' + this.type) + + if (!self) { + self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) + $(obj.currentTarget).data('bs.' + this.type, self) + } + + if (obj instanceof $.Event) { + self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false + } + + if (self.isInStateTrue()) return + + clearTimeout(self.timeout) + + self.hoverState = 'out' + + if (!self.options.delay || !self.options.delay.hide) return self.hide() + + self.timeout = setTimeout(function () { + if (self.hoverState == 'out') self.hide() + }, self.options.delay.hide) + } + + Tooltip.prototype.show = function () { + var e = $.Event('show.bs.' + this.type) + + if (this.hasContent() && this.enabled) { + this.$element.trigger(e) + + var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) + if (e.isDefaultPrevented() || !inDom) return + var that = this + + var $tip = this.tip() + + var tipId = this.getUID(this.type) + + this.setContent() + $tip.attr('id', tipId) + this.$element.attr('aria-describedby', tipId) + + if (this.options.animation) $tip.addClass('fade') + + var placement = typeof this.options.placement == 'function' ? + this.options.placement.call(this, $tip[0], this.$element[0]) : + this.options.placement + + var autoToken = /\s?auto?\s?/i + var autoPlace = autoToken.test(placement) + if (autoPlace) placement = placement.replace(autoToken, '') || 'top' + + $tip + .detach() + .css({ top: 0, left: 0, display: 'block' }) + .addClass(placement) + .data('bs.' + this.type, this) + + this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) + this.$element.trigger('inserted.bs.' + this.type) + + var pos = this.getPosition() + var actualWidth = $tip[0].offsetWidth + var actualHeight = $tip[0].offsetHeight + + if (autoPlace) { + var orgPlacement = placement + var viewportDim = this.getPosition(this.$viewport) + + placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : + placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : + placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : + placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : + placement + + $tip + .removeClass(orgPlacement) + .addClass(placement) + } + + var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) + + this.applyPlacement(calculatedOffset, placement) + + var complete = function () { + var prevHoverState = that.hoverState + that.$element.trigger('shown.bs.' + that.type) + that.hoverState = null + + if (prevHoverState == 'out') that.leave(that) + } + + $.support.transition && this.$tip.hasClass('fade') ? + $tip + .one('bsTransitionEnd', complete) + .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : + complete() + } + } + + Tooltip.prototype.applyPlacement = function (offset, placement) { + var $tip = this.tip() + var width = $tip[0].offsetWidth + var height = $tip[0].offsetHeight + + // manually read margins because getBoundingClientRect includes difference + var marginTop = parseInt($tip.css('margin-top'), 10) + var marginLeft = parseInt($tip.css('margin-left'), 10) + + // we must check for NaN for ie 8/9 + if (isNaN(marginTop)) marginTop = 0 + if (isNaN(marginLeft)) marginLeft = 0 + + offset.top += marginTop + offset.left += marginLeft + + // $.fn.offset doesn't round pixel values + // so we use setOffset directly with our own function B-0 + $.offset.setOffset($tip[0], $.extend({ + using: function (props) { + $tip.css({ + top: Math.round(props.top), + left: Math.round(props.left) + }) + } + }, offset), 0) + + $tip.addClass('in') + + // check to see if placing tip in new offset caused the tip to resize itself + var actualWidth = $tip[0].offsetWidth + var actualHeight = $tip[0].offsetHeight + + if (placement == 'top' && actualHeight != height) { + offset.top = offset.top + height - actualHeight + } + + var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) + + if (delta.left) offset.left += delta.left + else offset.top += delta.top + + var isVertical = /top|bottom/.test(placement) + var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight + var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' + + $tip.offset(offset) + this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) + } + + Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) { + this.arrow() + .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') + .css(isVertical ? 'top' : 'left', '') + } + + Tooltip.prototype.setContent = function () { + var $tip = this.tip() + var title = this.getTitle() + + $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) + $tip.removeClass('fade in top bottom left right') + } + + Tooltip.prototype.hide = function (callback) { + var that = this + var $tip = $(this.$tip) + var e = $.Event('hide.bs.' + this.type) + + function complete() { + if (that.hoverState != 'in') $tip.detach() + that.$element + .removeAttr('aria-describedby') + .trigger('hidden.bs.' + that.type) + callback && callback() + } + + this.$element.trigger(e) + + if (e.isDefaultPrevented()) return + + $tip.removeClass('in') + + $.support.transition && $tip.hasClass('fade') ? + $tip + .one('bsTransitionEnd', complete) + .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : + complete() + + this.hoverState = null + + return this + } + + Tooltip.prototype.fixTitle = function () { + var $e = this.$element + if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') { + $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') + } + } + + Tooltip.prototype.hasContent = function () { + return this.getTitle() + } + + Tooltip.prototype.getPosition = function ($element) { + $element = $element || this.$element + + var el = $element[0] + var isBody = el.tagName == 'BODY' + + var elRect = el.getBoundingClientRect() + if (elRect.width == null) { + // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 + elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) + } + var elOffset = isBody ? { top: 0, left: 0 } : $element.offset() + var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } + var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null + + return $.extend({}, elRect, scroll, outerDims, elOffset) + } + + Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { + return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : + placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : + placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : + /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } + + } + + Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { + var delta = { top: 0, left: 0 } + if (!this.$viewport) return delta + + var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 + var viewportDimensions = this.getPosition(this.$viewport) + + if (/right|left/.test(placement)) { + var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll + var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight + if (topEdgeOffset < viewportDimensions.top) { // top overflow + delta.top = viewportDimensions.top - topEdgeOffset + } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow + delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset + } + } else { + var leftEdgeOffset = pos.left - viewportPadding + var rightEdgeOffset = pos.left + viewportPadding + actualWidth + if (leftEdgeOffset < viewportDimensions.left) { // left overflow + delta.left = viewportDimensions.left - leftEdgeOffset + } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow + delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset + } + } + + return delta + } + + Tooltip.prototype.getTitle = function () { + var title + var $e = this.$element + var o = this.options + + title = $e.attr('data-original-title') + || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) + + return title + } + + Tooltip.prototype.getUID = function (prefix) { + do prefix += ~~(Math.random() * 1000000) + while (document.getElementById(prefix)) + return prefix + } + + Tooltip.prototype.tip = function () { + if (!this.$tip) { + this.$tip = $(this.options.template) + if (this.$tip.length != 1) { + throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!') + } + } + return this.$tip + } + + Tooltip.prototype.arrow = function () { + return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) + } + + Tooltip.prototype.enable = function () { + this.enabled = true + } + + Tooltip.prototype.disable = function () { + this.enabled = false + } + + Tooltip.prototype.toggleEnabled = function () { + this.enabled = !this.enabled + } + + Tooltip.prototype.toggle = function (e) { + var self = this + if (e) { + self = $(e.currentTarget).data('bs.' + this.type) + if (!self) { + self = new this.constructor(e.currentTarget, this.getDelegateOptions()) + $(e.currentTarget).data('bs.' + this.type, self) + } + } + + if (e) { + self.inState.click = !self.inState.click + if (self.isInStateTrue()) self.enter(self) + else self.leave(self) + } else { + self.tip().hasClass('in') ? self.leave(self) : self.enter(self) + } + } + + Tooltip.prototype.destroy = function () { + var that = this + clearTimeout(this.timeout) + this.hide(function () { + that.$element.off('.' + that.type).removeData('bs.' + that.type) + if (that.$tip) { + that.$tip.detach() + } + that.$tip = null + that.$arrow = null + that.$viewport = null + }) + } + + + // TOOLTIP PLUGIN DEFINITION + // ========================= + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.tooltip') + var options = typeof option == 'object' && option + + if (!data && /destroy|hide/.test(option)) return + if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.tooltip + + $.fn.tooltip = Plugin + $.fn.tooltip.Constructor = Tooltip + + + // TOOLTIP NO CONFLICT + // =================== + + $.fn.tooltip.noConflict = function () { + $.fn.tooltip = old + return this + } + +}(jQuery); + +/* ======================================================================== + * Bootstrap: popover.js v3.3.6 + * http://getbootstrap.com/javascript/#popovers + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // POPOVER PUBLIC CLASS DEFINITION + // =============================== + + var Popover = function (element, options) { + this.init('popover', element, options) + } + + if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') + + Popover.VERSION = '3.3.6' + + Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { + placement: 'right', + trigger: 'click', + content: '', + template: '' + }) + + + // NOTE: POPOVER EXTENDS tooltip.js + // ================================ + + Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) + + Popover.prototype.constructor = Popover + + Popover.prototype.getDefaults = function () { + return Popover.DEFAULTS + } + + Popover.prototype.setContent = function () { + var $tip = this.tip() + var title = this.getTitle() + var content = this.getContent() + + $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) + $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events + this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' + ](content) + + $tip.removeClass('fade top bottom left right in') + + // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do + // this manually by checking the contents. + if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() + } + + Popover.prototype.hasContent = function () { + return this.getTitle() || this.getContent() + } + + Popover.prototype.getContent = function () { + var $e = this.$element + var o = this.options + + return $e.attr('data-content') + || (typeof o.content == 'function' ? + o.content.call($e[0]) : + o.content) + } + + Popover.prototype.arrow = function () { + return (this.$arrow = this.$arrow || this.tip().find('.arrow')) + } + + + // POPOVER PLUGIN DEFINITION + // ========================= + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.popover') + var options = typeof option == 'object' && option + + if (!data && /destroy|hide/.test(option)) return + if (!data) $this.data('bs.popover', (data = new Popover(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.popover + + $.fn.popover = Plugin + $.fn.popover.Constructor = Popover + + + // POPOVER NO CONFLICT + // =================== + + $.fn.popover.noConflict = function () { + $.fn.popover = old + return this + } + +}(jQuery); + +/* ======================================================================== + * Bootstrap: scrollspy.js v3.3.6 + * http://getbootstrap.com/javascript/#scrollspy + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // SCROLLSPY CLASS DEFINITION + // ========================== + + function ScrollSpy(element, options) { + this.$body = $(document.body) + this.$scrollElement = $(element).is(document.body) ? $(window) : $(element) + this.options = $.extend({}, ScrollSpy.DEFAULTS, options) + this.selector = (this.options.target || '') + ' .nav li > a' + this.offsets = [] + this.targets = [] + this.activeTarget = null + this.scrollHeight = 0 + + this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)) + this.refresh() + this.process() + } + + ScrollSpy.VERSION = '3.3.6' + + ScrollSpy.DEFAULTS = { + offset: 10 + } + + ScrollSpy.prototype.getScrollHeight = function () { + return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) + } + + ScrollSpy.prototype.refresh = function () { + var that = this + var offsetMethod = 'offset' + var offsetBase = 0 + + this.offsets = [] + this.targets = [] + this.scrollHeight = this.getScrollHeight() + + if (!$.isWindow(this.$scrollElement[0])) { + offsetMethod = 'position' + offsetBase = this.$scrollElement.scrollTop() + } + + this.$body + .find(this.selector) + .map(function () { + var $el = $(this) + var href = $el.data('target') || $el.attr('href') + var $href = /^#./.test(href) && $(href) + + return ($href + && $href.length + && $href.is(':visible') + && [[$href[offsetMethod]().top + offsetBase, href]]) || null + }) + .sort(function (a, b) { return a[0] - b[0] }) + .each(function () { + that.offsets.push(this[0]) + that.targets.push(this[1]) + }) + } + + ScrollSpy.prototype.process = function () { + var scrollTop = this.$scrollElement.scrollTop() + this.options.offset + var scrollHeight = this.getScrollHeight() + var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() + var offsets = this.offsets + var targets = this.targets + var activeTarget = this.activeTarget + var i + + if (this.scrollHeight != scrollHeight) { + this.refresh() + } + + if (scrollTop >= maxScroll) { + return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) + } + + if (activeTarget && scrollTop < offsets[0]) { + this.activeTarget = null + return this.clear() + } + + for (i = offsets.length; i--;) { + activeTarget != targets[i] + && scrollTop >= offsets[i] + && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) + && this.activate(targets[i]) + } + } + + ScrollSpy.prototype.activate = function (target) { + this.activeTarget = target + + this.clear() + + var selector = this.selector + + '[data-target="' + target + '"],' + + this.selector + '[href="' + target + '"]' + + var active = $(selector) + .parents('li') + .addClass('active') + + if (active.parent('.dropdown-menu').length) { + active = active + .closest('li.dropdown') + .addClass('active') + } + + active.trigger('activate.bs.scrollspy') + } + + ScrollSpy.prototype.clear = function () { + $(this.selector) + .parentsUntil(this.options.target, '.active') + .removeClass('active') + } + + + // SCROLLSPY PLUGIN DEFINITION + // =========================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.scrollspy') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.scrollspy + + $.fn.scrollspy = Plugin + $.fn.scrollspy.Constructor = ScrollSpy + + + // SCROLLSPY NO CONFLICT + // ===================== + + $.fn.scrollspy.noConflict = function () { + $.fn.scrollspy = old + return this + } + + + // SCROLLSPY DATA-API + // ================== + + $(window).on('load.bs.scrollspy.data-api', function () { + $('[data-spy="scroll"]').each(function () { + var $spy = $(this) + Plugin.call($spy, $spy.data()) + }) + }) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: tab.js v3.3.6 + * http://getbootstrap.com/javascript/#tabs + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // TAB CLASS DEFINITION + // ==================== + + var Tab = function (element) { + // jscs:disable requireDollarBeforejQueryAssignment + this.element = $(element) + // jscs:enable requireDollarBeforejQueryAssignment + } + + Tab.VERSION = '3.3.6' + + Tab.TRANSITION_DURATION = 150 + + Tab.prototype.show = function () { + var $this = this.element + var $ul = $this.closest('ul:not(.dropdown-menu)') + var selector = $this.data('target') + + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 + } + + if ($this.parent('li').hasClass('active')) return + + var $previous = $ul.find('.active:last a') + var hideEvent = $.Event('hide.bs.tab', { + relatedTarget: $this[0] + }) + var showEvent = $.Event('show.bs.tab', { + relatedTarget: $previous[0] + }) + + $previous.trigger(hideEvent) + $this.trigger(showEvent) + + if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return + + var $target = $(selector) + + this.activate($this.closest('li'), $ul) + this.activate($target, $target.parent(), function () { + $previous.trigger({ + type: 'hidden.bs.tab', + relatedTarget: $this[0] + }) + $this.trigger({ + type: 'shown.bs.tab', + relatedTarget: $previous[0] + }) + }) + } + + Tab.prototype.activate = function (element, container, callback) { + var $active = container.find('> .active') + var transition = callback + && $.support.transition + && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) + + function next() { + $active + .removeClass('active') + .find('> .dropdown-menu > .active') + .removeClass('active') + .end() + .find('[data-toggle="tab"]') + .attr('aria-expanded', false) + + element + .addClass('active') + .find('[data-toggle="tab"]') + .attr('aria-expanded', true) + + if (transition) { + element[0].offsetWidth // reflow for transition + element.addClass('in') + } else { + element.removeClass('fade') + } + + if (element.parent('.dropdown-menu').length) { + element + .closest('li.dropdown') + .addClass('active') + .end() + .find('[data-toggle="tab"]') + .attr('aria-expanded', true) + } + + callback && callback() + } + + $active.length && transition ? + $active + .one('bsTransitionEnd', next) + .emulateTransitionEnd(Tab.TRANSITION_DURATION) : + next() + + $active.removeClass('in') + } + + + // TAB PLUGIN DEFINITION + // ===================== + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.tab') + + if (!data) $this.data('bs.tab', (data = new Tab(this))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.tab + + $.fn.tab = Plugin + $.fn.tab.Constructor = Tab + + + // TAB NO CONFLICT + // =============== + + $.fn.tab.noConflict = function () { + $.fn.tab = old + return this + } + + + // TAB DATA-API + // ============ + + var clickHandler = function (e) { + e.preventDefault() + Plugin.call($(this), 'show') + } + + $(document) + .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) + .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) + +}(jQuery); + +/* ======================================================================== + * Bootstrap: affix.js v3.3.6 + * http://getbootstrap.com/javascript/#affix + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // AFFIX CLASS DEFINITION + // ====================== + + var Affix = function (element, options) { + this.options = $.extend({}, Affix.DEFAULTS, options) + + this.$target = $(this.options.target) + .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) + .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) + + this.$element = $(element) + this.affixed = null + this.unpin = null + this.pinnedOffset = null + + this.checkPosition() + } + + Affix.VERSION = '3.3.6' + + Affix.RESET = 'affix affix-top affix-bottom' + + Affix.DEFAULTS = { + offset: 0, + target: window + } + + Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { + var scrollTop = this.$target.scrollTop() + var position = this.$element.offset() + var targetHeight = this.$target.height() + + if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false + + if (this.affixed == 'bottom') { + if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' + return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' + } + + var initializing = this.affixed == null + var colliderTop = initializing ? scrollTop : position.top + var colliderHeight = initializing ? targetHeight : height + + if (offsetTop != null && scrollTop <= offsetTop) return 'top' + if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' + + return false + } + + Affix.prototype.getPinnedOffset = function () { + if (this.pinnedOffset) return this.pinnedOffset + this.$element.removeClass(Affix.RESET).addClass('affix') + var scrollTop = this.$target.scrollTop() + var position = this.$element.offset() + return (this.pinnedOffset = position.top - scrollTop) + } + + Affix.prototype.checkPositionWithEventLoop = function () { + setTimeout($.proxy(this.checkPosition, this), 1) + } + + Affix.prototype.checkPosition = function () { + if (!this.$element.is(':visible')) return + + var height = this.$element.height() + var offset = this.options.offset + var offsetTop = offset.top + var offsetBottom = offset.bottom + var scrollHeight = Math.max($(document).height(), $(document.body).height()) + + if (typeof offset != 'object') offsetBottom = offsetTop = offset + if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) + if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) + + var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) + + if (this.affixed != affix) { + if (this.unpin != null) this.$element.css('top', '') + + var affixType = 'affix' + (affix ? '-' + affix : '') + var e = $.Event(affixType + '.bs.affix') + + this.$element.trigger(e) + + if (e.isDefaultPrevented()) return + + this.affixed = affix + this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null + + this.$element + .removeClass(Affix.RESET) + .addClass(affixType) + .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') + } + + if (affix == 'bottom') { + this.$element.offset({ + top: scrollHeight - height - offsetBottom + }) + } + } + + + // AFFIX PLUGIN DEFINITION + // ======================= + + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.affix') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs.affix', (data = new Affix(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + var old = $.fn.affix + + $.fn.affix = Plugin + $.fn.affix.Constructor = Affix + + + // AFFIX NO CONFLICT + // ================= + + $.fn.affix.noConflict = function () { + $.fn.affix = old + return this + } + + + // AFFIX DATA-API + // ============== + + $(window).on('load', function () { + $('[data-spy="affix"]').each(function () { + var $spy = $(this) + var data = $spy.data() + + data.offset = data.offset || {} + + if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom + if (data.offsetTop != null) data.offset.top = data.offsetTop + + Plugin.call($spy, data) + }) + }) + +}(jQuery); diff --git a/debian/missing-sources/d3.js b/debian/missing-sources/d3.js new file mode 100644 index 0000000..8873e0a --- /dev/null +++ b/debian/missing-sources/d3.js @@ -0,0 +1,9550 @@ +!function() { + var d3 = { + version: "3.5.9" + }; + var d3_arraySlice = [].slice, d3_array = function(list) { + return d3_arraySlice.call(list); + }; + var d3_document = this.document; + function d3_documentElement(node) { + return node && (node.ownerDocument || node.document || node).documentElement; + } + function d3_window(node) { + return node && (node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView); + } + if (d3_document) { + try { + d3_array(d3_document.documentElement.childNodes)[0].nodeType; + } catch (e) { + d3_array = function(list) { + var i = list.length, array = new Array(i); + while (i--) array[i] = list[i]; + return array; + }; + } + } + if (!Date.now) Date.now = function() { + return +new Date(); + }; + if (d3_document) { + try { + d3_document.createElement("DIV").style.setProperty("opacity", 0, ""); + } catch (error) { + var d3_element_prototype = this.Element.prototype, d3_element_setAttribute = d3_element_prototype.setAttribute, d3_element_setAttributeNS = d3_element_prototype.setAttributeNS, d3_style_prototype = this.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty; + d3_element_prototype.setAttribute = function(name, value) { + d3_element_setAttribute.call(this, name, value + ""); + }; + d3_element_prototype.setAttributeNS = function(space, local, value) { + d3_element_setAttributeNS.call(this, space, local, value + ""); + }; + d3_style_prototype.setProperty = function(name, value, priority) { + d3_style_setProperty.call(this, name, value + "", priority); + }; + } + } + d3.ascending = d3_ascending; + function d3_ascending(a, b) { + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; + } + d3.descending = function(a, b) { + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; + }; + d3.min = function(array, f) { + var i = -1, n = array.length, a, b; + if (arguments.length === 1) { + while (++i < n) if ((b = array[i]) != null && b >= b) { + a = b; + break; + } + while (++i < n) if ((b = array[i]) != null && a > b) a = b; + } else { + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { + a = b; + break; + } + while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; + } + return a; + }; + d3.max = function(array, f) { + var i = -1, n = array.length, a, b; + if (arguments.length === 1) { + while (++i < n) if ((b = array[i]) != null && b >= b) { + a = b; + break; + } + while (++i < n) if ((b = array[i]) != null && b > a) a = b; + } else { + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { + a = b; + break; + } + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; + } + return a; + }; + d3.extent = function(array, f) { + var i = -1, n = array.length, a, b, c; + if (arguments.length === 1) { + while (++i < n) if ((b = array[i]) != null && b >= b) { + a = c = b; + break; + } + while (++i < n) if ((b = array[i]) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } else { + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { + a = c = b; + break; + } + while (++i < n) if ((b = f.call(array, array[i], i)) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } + return [ a, c ]; + }; + function d3_number(x) { + return x === null ? NaN : +x; + } + function d3_numeric(x) { + return !isNaN(x); + } + d3.sum = function(array, f) { + var s = 0, n = array.length, a, i = -1; + if (arguments.length === 1) { + while (++i < n) if (d3_numeric(a = +array[i])) s += a; + } else { + while (++i < n) if (d3_numeric(a = +f.call(array, array[i], i))) s += a; + } + return s; + }; + d3.mean = function(array, f) { + var s = 0, n = array.length, a, i = -1, j = n; + if (arguments.length === 1) { + while (++i < n) if (d3_numeric(a = d3_number(array[i]))) s += a; else --j; + } else { + while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) s += a; else --j; + } + if (j) return s / j; + }; + d3.quantile = function(values, p) { + var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h; + return e ? v + e * (values[h] - v) : v; + }; + d3.median = function(array, f) { + var numbers = [], n = array.length, a, i = -1; + if (arguments.length === 1) { + while (++i < n) if (d3_numeric(a = d3_number(array[i]))) numbers.push(a); + } else { + while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) numbers.push(a); + } + if (numbers.length) return d3.quantile(numbers.sort(d3_ascending), .5); + }; + d3.variance = function(array, f) { + var n = array.length, m = 0, a, d, s = 0, i = -1, j = 0; + if (arguments.length === 1) { + while (++i < n) { + if (d3_numeric(a = d3_number(array[i]))) { + d = a - m; + m += d / ++j; + s += d * (a - m); + } + } + } else { + while (++i < n) { + if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) { + d = a - m; + m += d / ++j; + s += d * (a - m); + } + } + } + if (j > 1) return s / (j - 1); + }; + d3.deviation = function() { + var v = d3.variance.apply(this, arguments); + return v ? Math.sqrt(v) : v; + }; + function d3_bisector(compare) { + return { + left: function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (compare(a[mid], x) < 0) lo = mid + 1; else hi = mid; + } + return lo; + }, + right: function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (compare(a[mid], x) > 0) hi = mid; else lo = mid + 1; + } + return lo; + } + }; + } + var d3_bisect = d3_bisector(d3_ascending); + d3.bisectLeft = d3_bisect.left; + d3.bisect = d3.bisectRight = d3_bisect.right; + d3.bisector = function(f) { + return d3_bisector(f.length === 1 ? function(d, x) { + return d3_ascending(f(d), x); + } : f); + }; + d3.shuffle = function(array, i0, i1) { + if ((m = arguments.length) < 3) { + i1 = array.length; + if (m < 2) i0 = 0; + } + var m = i1 - i0, t, i; + while (m) { + i = Math.random() * m-- | 0; + t = array[m + i0], array[m + i0] = array[i + i0], array[i + i0] = t; + } + return array; + }; + d3.permute = function(array, indexes) { + var i = indexes.length, permutes = new Array(i); + while (i--) permutes[i] = array[indexes[i]]; + return permutes; + }; + d3.pairs = function(array) { + var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n); + while (i < n) pairs[i] = [ p0 = p1, p1 = array[++i] ]; + return pairs; + }; + d3.zip = function() { + if (!(n = arguments.length)) return []; + for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) { + for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) { + zip[j] = arguments[j][i]; + } + } + return zips; + }; + function d3_zipLength(d) { + return d.length; + } + d3.transpose = function(matrix) { + return d3.zip.apply(d3, matrix); + }; + d3.keys = function(map) { + var keys = []; + for (var key in map) keys.push(key); + return keys; + }; + d3.values = function(map) { + var values = []; + for (var key in map) values.push(map[key]); + return values; + }; + d3.entries = function(map) { + var entries = []; + for (var key in map) entries.push({ + key: key, + value: map[key] + }); + return entries; + }; + d3.merge = function(arrays) { + var n = arrays.length, m, i = -1, j = 0, merged, array; + while (++i < n) j += arrays[i].length; + merged = new Array(j); + while (--n >= 0) { + array = arrays[n]; + m = array.length; + while (--m >= 0) { + merged[--j] = array[m]; + } + } + return merged; + }; + var abs = Math.abs; + d3.range = function(start, stop, step) { + if (arguments.length < 3) { + step = 1; + if (arguments.length < 2) { + stop = start; + start = 0; + } + } + if ((stop - start) / step === Infinity) throw new Error("infinite range"); + var range = [], k = d3_range_integerScale(abs(step)), i = -1, j; + start *= k, stop *= k, step *= k; + if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k); + return range; + }; + function d3_range_integerScale(x) { + var k = 1; + while (x * k % 1) k *= 10; + return k; + } + function d3_class(ctor, properties) { + for (var key in properties) { + Object.defineProperty(ctor.prototype, key, { + value: properties[key], + enumerable: false + }); + } + } + d3.map = function(object, f) { + var map = new d3_Map(); + if (object instanceof d3_Map) { + object.forEach(function(key, value) { + map.set(key, value); + }); + } else if (Array.isArray(object)) { + var i = -1, n = object.length, o; + if (arguments.length === 1) while (++i < n) map.set(i, object[i]); else while (++i < n) map.set(f.call(object, o = object[i], i), o); + } else { + for (var key in object) map.set(key, object[key]); + } + return map; + }; + function d3_Map() { + this._ = Object.create(null); + } + var d3_map_proto = "__proto__", d3_map_zero = "\x00"; + d3_class(d3_Map, { + has: d3_map_has, + get: function(key) { + return this._[d3_map_escape(key)]; + }, + set: function(key, value) { + return this._[d3_map_escape(key)] = value; + }, + remove: d3_map_remove, + keys: d3_map_keys, + values: function() { + var values = []; + for (var key in this._) values.push(this._[key]); + return values; + }, + entries: function() { + var entries = []; + for (var key in this._) entries.push({ + key: d3_map_unescape(key), + value: this._[key] + }); + return entries; + }, + size: d3_map_size, + empty: d3_map_empty, + forEach: function(f) { + for (var key in this._) f.call(this, d3_map_unescape(key), this._[key]); + } + }); + function d3_map_escape(key) { + return (key += "") === d3_map_proto || key[0] === d3_map_zero ? d3_map_zero + key : key; + } + function d3_map_unescape(key) { + return (key += "")[0] === d3_map_zero ? key.slice(1) : key; + } + function d3_map_has(key) { + return d3_map_escape(key) in this._; + } + function d3_map_remove(key) { + return (key = d3_map_escape(key)) in this._ && delete this._[key]; + } + function d3_map_keys() { + var keys = []; + for (var key in this._) keys.push(d3_map_unescape(key)); + return keys; + } + function d3_map_size() { + var size = 0; + for (var key in this._) ++size; + return size; + } + function d3_map_empty() { + for (var key in this._) return false; + return true; + } + d3.nest = function() { + var nest = {}, keys = [], sortKeys = [], sortValues, rollup; + function map(mapType, array, depth) { + if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array; + var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values; + while (++i < n) { + if (values = valuesByKey.get(keyValue = key(object = array[i]))) { + values.push(object); + } else { + valuesByKey.set(keyValue, [ object ]); + } + } + if (mapType) { + object = mapType(); + setter = function(keyValue, values) { + object.set(keyValue, map(mapType, values, depth)); + }; + } else { + object = {}; + setter = function(keyValue, values) { + object[keyValue] = map(mapType, values, depth); + }; + } + valuesByKey.forEach(setter); + return object; + } + function entries(map, depth) { + if (depth >= keys.length) return map; + var array = [], sortKey = sortKeys[depth++]; + map.forEach(function(key, keyMap) { + array.push({ + key: key, + values: entries(keyMap, depth) + }); + }); + return sortKey ? array.sort(function(a, b) { + return sortKey(a.key, b.key); + }) : array; + } + nest.map = function(array, mapType) { + return map(mapType, array, 0); + }; + nest.entries = function(array) { + return entries(map(d3.map, array, 0), 0); + }; + nest.key = function(d) { + keys.push(d); + return nest; + }; + nest.sortKeys = function(order) { + sortKeys[keys.length - 1] = order; + return nest; + }; + nest.sortValues = function(order) { + sortValues = order; + return nest; + }; + nest.rollup = function(f) { + rollup = f; + return nest; + }; + return nest; + }; + d3.set = function(array) { + var set = new d3_Set(); + if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]); + return set; + }; + function d3_Set() { + this._ = Object.create(null); + } + d3_class(d3_Set, { + has: d3_map_has, + add: function(key) { + this._[d3_map_escape(key += "")] = true; + return key; + }, + remove: d3_map_remove, + values: d3_map_keys, + size: d3_map_size, + empty: d3_map_empty, + forEach: function(f) { + for (var key in this._) f.call(this, d3_map_unescape(key)); + } + }); + d3.behavior = {}; + function d3_identity(d) { + return d; + } + d3.rebind = function(target, source) { + var i = 1, n = arguments.length, method; + while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); + return target; + }; + function d3_rebind(target, source, method) { + return function() { + var value = method.apply(source, arguments); + return value === source ? target : value; + }; + } + function d3_vendorSymbol(object, name) { + if (name in object) return name; + name = name.charAt(0).toUpperCase() + name.slice(1); + for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) { + var prefixName = d3_vendorPrefixes[i] + name; + if (prefixName in object) return prefixName; + } + } + var d3_vendorPrefixes = [ "webkit", "ms", "moz", "Moz", "o", "O" ]; + function d3_noop() {} + d3.dispatch = function() { + var dispatch = new d3_dispatch(), i = -1, n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); + return dispatch; + }; + function d3_dispatch() {} + d3_dispatch.prototype.on = function(type, listener) { + var i = type.indexOf("."), name = ""; + if (i >= 0) { + name = type.slice(i + 1); + type = type.slice(0, i); + } + if (type) return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener); + if (arguments.length === 2) { + if (listener == null) for (type in this) { + if (this.hasOwnProperty(type)) this[type].on(name, null); + } + return this; + } + }; + function d3_dispatch_event(dispatch) { + var listeners = [], listenerByName = new d3_Map(); + function event() { + var z = listeners, i = -1, n = z.length, l; + while (++i < n) if (l = z[i].on) l.apply(this, arguments); + return dispatch; + } + event.on = function(name, listener) { + var l = listenerByName.get(name), i; + if (arguments.length < 2) return l && l.on; + if (l) { + l.on = null; + listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); + listenerByName.remove(name); + } + if (listener) listeners.push(listenerByName.set(name, { + on: listener + })); + return dispatch; + }; + return event; + } + d3.event = null; + function d3_eventPreventDefault() { + d3.event.preventDefault(); + } + function d3_eventSource() { + var e = d3.event, s; + while (s = e.sourceEvent) e = s; + return e; + } + function d3_eventDispatch(target) { + var dispatch = new d3_dispatch(), i = 0, n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); + dispatch.of = function(thiz, argumentz) { + return function(e1) { + try { + var e0 = e1.sourceEvent = d3.event; + e1.target = target; + d3.event = e1; + dispatch[e1.type].apply(thiz, argumentz); + } finally { + d3.event = e0; + } + }; + }; + return dispatch; + } + d3.requote = function(s) { + return s.replace(d3_requote_re, "\\$&"); + }; + var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; + var d3_subclass = {}.__proto__ ? function(object, prototype) { + object.__proto__ = prototype; + } : function(object, prototype) { + for (var property in prototype) object[property] = prototype[property]; + }; + function d3_selection(groups) { + d3_subclass(groups, d3_selectionPrototype); + return groups; + } + var d3_select = function(s, n) { + return n.querySelector(s); + }, d3_selectAll = function(s, n) { + return n.querySelectorAll(s); + }, d3_selectMatches = function(n, s) { + var d3_selectMatcher = n.matches || n[d3_vendorSymbol(n, "matchesSelector")]; + d3_selectMatches = function(n, s) { + return d3_selectMatcher.call(n, s); + }; + return d3_selectMatches(n, s); + }; + if (typeof Sizzle === "function") { + d3_select = function(s, n) { + return Sizzle(s, n)[0] || null; + }; + d3_selectAll = Sizzle; + d3_selectMatches = Sizzle.matchesSelector; + } + d3.selection = function() { + return d3.select(d3_document.documentElement); + }; + var d3_selectionPrototype = d3.selection.prototype = []; + d3_selectionPrototype.select = function(selector) { + var subgroups = [], subgroup, subnode, group, node; + selector = d3_selection_selector(selector); + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroup.push(subnode = selector.call(node, node.__data__, i, j)); + if (subnode && "__data__" in node) subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + return d3_selection(subgroups); + }; + function d3_selection_selector(selector) { + return typeof selector === "function" ? selector : function() { + return d3_select(selector, this); + }; + } + d3_selectionPrototype.selectAll = function(selector) { + var subgroups = [], subgroup, node; + selector = d3_selection_selectorAll(selector); + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i, j))); + subgroup.parentNode = node; + } + } + } + return d3_selection(subgroups); + }; + function d3_selection_selectorAll(selector) { + return typeof selector === "function" ? selector : function() { + return d3_selectAll(selector, this); + }; + } + var d3_nsPrefix = { + svg: "http://www.w3.org/2000/svg", + xhtml: "http://www.w3.org/1999/xhtml", + xlink: "http://www.w3.org/1999/xlink", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/" + }; + d3.ns = { + prefix: d3_nsPrefix, + qualify: function(name) { + var i = name.indexOf(":"), prefix = name; + if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1); + return d3_nsPrefix.hasOwnProperty(prefix) ? { + space: d3_nsPrefix[prefix], + local: name + } : name; + } + }; + d3_selectionPrototype.attr = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") { + var node = this.node(); + name = d3.ns.qualify(name); + return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name); + } + for (value in name) this.each(d3_selection_attr(value, name[value])); + return this; + } + return this.each(d3_selection_attr(name, value)); + }; + function d3_selection_attr(name, value) { + name = d3.ns.qualify(name); + function attrNull() { + this.removeAttribute(name); + } + function attrNullNS() { + this.removeAttributeNS(name.space, name.local); + } + function attrConstant() { + this.setAttribute(name, value); + } + function attrConstantNS() { + this.setAttributeNS(name.space, name.local, value); + } + function attrFunction() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttribute(name); else this.setAttribute(name, x); + } + function attrFunctionNS() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x); + } + return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant; + } + function d3_collapse(s) { + return s.trim().replace(/\s+/g, " "); + } + d3_selectionPrototype.classed = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") { + var node = this.node(), n = (name = d3_selection_classes(name)).length, i = -1; + if (value = node.classList) { + while (++i < n) if (!value.contains(name[i])) return false; + } else { + value = node.getAttribute("class"); + while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false; + } + return true; + } + for (value in name) this.each(d3_selection_classed(value, name[value])); + return this; + } + return this.each(d3_selection_classed(name, value)); + }; + function d3_selection_classedRe(name) { + return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g"); + } + function d3_selection_classes(name) { + return (name + "").trim().split(/^|\s+/); + } + function d3_selection_classed(name, value) { + name = d3_selection_classes(name).map(d3_selection_classedName); + var n = name.length; + function classedConstant() { + var i = -1; + while (++i < n) name[i](this, value); + } + function classedFunction() { + var i = -1, x = value.apply(this, arguments); + while (++i < n) name[i](this, x); + } + return typeof value === "function" ? classedFunction : classedConstant; + } + function d3_selection_classedName(name) { + var re = d3_selection_classedRe(name); + return function(node, value) { + if (c = node.classList) return value ? c.add(name) : c.remove(name); + var c = node.getAttribute("class") || ""; + if (value) { + re.lastIndex = 0; + if (!re.test(c)) node.setAttribute("class", d3_collapse(c + " " + name)); + } else { + node.setAttribute("class", d3_collapse(c.replace(re, " "))); + } + }; + } + d3_selectionPrototype.style = function(name, value, priority) { + var n = arguments.length; + if (n < 3) { + if (typeof name !== "string") { + if (n < 2) value = ""; + for (priority in name) this.each(d3_selection_style(priority, name[priority], value)); + return this; + } + if (n < 2) { + var node = this.node(); + return d3_window(node).getComputedStyle(node, null).getPropertyValue(name); + } + priority = ""; + } + return this.each(d3_selection_style(name, value, priority)); + }; + function d3_selection_style(name, value, priority) { + function styleNull() { + this.style.removeProperty(name); + } + function styleConstant() { + this.style.setProperty(name, value, priority); + } + function styleFunction() { + var x = value.apply(this, arguments); + if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority); + } + return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant; + } + d3_selectionPrototype.property = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") return this.node()[name]; + for (value in name) this.each(d3_selection_property(value, name[value])); + return this; + } + return this.each(d3_selection_property(name, value)); + }; + function d3_selection_property(name, value) { + function propertyNull() { + delete this[name]; + } + function propertyConstant() { + this[name] = value; + } + function propertyFunction() { + var x = value.apply(this, arguments); + if (x == null) delete this[name]; else this[name] = x; + } + return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant; + } + d3_selectionPrototype.text = function(value) { + return arguments.length ? this.each(typeof value === "function" ? function() { + var v = value.apply(this, arguments); + this.textContent = v == null ? "" : v; + } : value == null ? function() { + this.textContent = ""; + } : function() { + this.textContent = value; + }) : this.node().textContent; + }; + d3_selectionPrototype.html = function(value) { + return arguments.length ? this.each(typeof value === "function" ? function() { + var v = value.apply(this, arguments); + this.innerHTML = v == null ? "" : v; + } : value == null ? function() { + this.innerHTML = ""; + } : function() { + this.innerHTML = value; + }) : this.node().innerHTML; + }; + d3_selectionPrototype.append = function(name) { + name = d3_selection_creator(name); + return this.select(function() { + return this.appendChild(name.apply(this, arguments)); + }); + }; + function d3_selection_creator(name) { + function create() { + var document = this.ownerDocument, namespace = this.namespaceURI; + return namespace ? document.createElementNS(namespace, name) : document.createElement(name); + } + function createNS() { + return this.ownerDocument.createElementNS(name.space, name.local); + } + return typeof name === "function" ? name : (name = d3.ns.qualify(name)).local ? createNS : create; + } + d3_selectionPrototype.insert = function(name, before) { + name = d3_selection_creator(name); + before = d3_selection_selector(before); + return this.select(function() { + return this.insertBefore(name.apply(this, arguments), before.apply(this, arguments) || null); + }); + }; + d3_selectionPrototype.remove = function() { + return this.each(d3_selectionRemove); + }; + function d3_selectionRemove() { + var parent = this.parentNode; + if (parent) parent.removeChild(this); + } + d3_selectionPrototype.data = function(value, key) { + var i = -1, n = this.length, group, node; + if (!arguments.length) { + value = new Array(n = (group = this[0]).length); + while (++i < n) { + if (node = group[i]) { + value[i] = node.__data__; + } + } + return value; + } + function bind(group, groupData) { + var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData; + if (key) { + var nodeByKeyValue = new d3_Map(), keyValues = new Array(n), keyValue; + for (i = -1; ++i < n; ) { + if (node = group[i]) { + if (nodeByKeyValue.has(keyValue = key.call(node, node.__data__, i))) { + exitNodes[i] = node; + } else { + nodeByKeyValue.set(keyValue, node); + } + keyValues[i] = keyValue; + } + } + for (i = -1; ++i < m; ) { + if (!(node = nodeByKeyValue.get(keyValue = key.call(groupData, nodeData = groupData[i], i)))) { + enterNodes[i] = d3_selection_dataNode(nodeData); + } else if (node !== true) { + updateNodes[i] = node; + node.__data__ = nodeData; + } + nodeByKeyValue.set(keyValue, true); + } + for (i = -1; ++i < n; ) { + if (i in keyValues && nodeByKeyValue.get(keyValues[i]) !== true) { + exitNodes[i] = group[i]; + } + } + } else { + for (i = -1; ++i < n0; ) { + node = group[i]; + nodeData = groupData[i]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + } + } + for (;i < m; ++i) { + enterNodes[i] = d3_selection_dataNode(groupData[i]); + } + for (;i < n; ++i) { + exitNodes[i] = group[i]; + } + } + enterNodes.update = updateNodes; + enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode; + enter.push(enterNodes); + update.push(updateNodes); + exit.push(exitNodes); + } + var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]); + if (typeof value === "function") { + while (++i < n) { + bind(group = this[i], value.call(group, group.parentNode.__data__, i)); + } + } else { + while (++i < n) { + bind(group = this[i], value); + } + } + update.enter = function() { + return enter; + }; + update.exit = function() { + return exit; + }; + return update; + }; + function d3_selection_dataNode(data) { + return { + __data__: data + }; + } + d3_selectionPrototype.datum = function(value) { + return arguments.length ? this.property("__data__", value) : this.property("__data__"); + }; + d3_selectionPrototype.filter = function(filter) { + var subgroups = [], subgroup, group, node; + if (typeof filter !== "function") filter = d3_selection_filter(filter); + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node, node.__data__, i, j)) { + subgroup.push(node); + } + } + } + return d3_selection(subgroups); + }; + function d3_selection_filter(selector) { + return function() { + return d3_selectMatches(this, selector); + }; + } + d3_selectionPrototype.order = function() { + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) { + if (node = group[i]) { + if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); + next = node; + } + } + } + return this; + }; + d3_selectionPrototype.sort = function(comparator) { + comparator = d3_selection_sortComparator.apply(this, arguments); + for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator); + return this.order(); + }; + function d3_selection_sortComparator(comparator) { + if (!arguments.length) comparator = d3_ascending; + return function(a, b) { + return a && b ? comparator(a.__data__, b.__data__) : !a - !b; + }; + } + d3_selectionPrototype.each = function(callback) { + return d3_selection_each(this, function(node, i, j) { + callback.call(node, node.__data__, i, j); + }); + }; + function d3_selection_each(groups, callback) { + for (var j = 0, m = groups.length; j < m; j++) { + for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) { + if (node = group[i]) callback(node, i, j); + } + } + return groups; + } + d3_selectionPrototype.call = function(callback) { + var args = d3_array(arguments); + callback.apply(args[0] = this, args); + return this; + }; + d3_selectionPrototype.empty = function() { + return !this.node(); + }; + d3_selectionPrototype.node = function() { + for (var j = 0, m = this.length; j < m; j++) { + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) return node; + } + } + return null; + }; + d3_selectionPrototype.size = function() { + var n = 0; + d3_selection_each(this, function() { + ++n; + }); + return n; + }; + function d3_selection_enter(selection) { + d3_subclass(selection, d3_selection_enterPrototype); + return selection; + } + var d3_selection_enterPrototype = []; + d3.selection.enter = d3_selection_enter; + d3.selection.enter.prototype = d3_selection_enterPrototype; + d3_selection_enterPrototype.append = d3_selectionPrototype.append; + d3_selection_enterPrototype.empty = d3_selectionPrototype.empty; + d3_selection_enterPrototype.node = d3_selectionPrototype.node; + d3_selection_enterPrototype.call = d3_selectionPrototype.call; + d3_selection_enterPrototype.size = d3_selectionPrototype.size; + d3_selection_enterPrototype.select = function(selector) { + var subgroups = [], subgroup, subnode, upgroup, group, node; + for (var j = -1, m = this.length; ++j < m; ) { + upgroup = (group = this[j]).update; + subgroups.push(subgroup = []); + subgroup.parentNode = group.parentNode; + for (var i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i, j)); + subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + return d3_selection(subgroups); + }; + d3_selection_enterPrototype.insert = function(name, before) { + if (arguments.length < 2) before = d3_selection_enterInsertBefore(this); + return d3_selectionPrototype.insert.call(this, name, before); + }; + function d3_selection_enterInsertBefore(enter) { + var i0, j0; + return function(d, i, j) { + var group = enter[j].update, n = group.length, node; + if (j != j0) j0 = j, i0 = 0; + if (i >= i0) i0 = i + 1; + while (!(node = group[i0]) && ++i0 < n) ; + return node; + }; + } + d3.select = function(node) { + var group; + if (typeof node === "string") { + group = [ d3_select(node, d3_document) ]; + group.parentNode = d3_document.documentElement; + } else { + group = [ node ]; + group.parentNode = d3_documentElement(node); + } + return d3_selection([ group ]); + }; + d3.selectAll = function(nodes) { + var group; + if (typeof nodes === "string") { + group = d3_array(d3_selectAll(nodes, d3_document)); + group.parentNode = d3_document.documentElement; + } else { + group = d3_array(nodes); + group.parentNode = null; + } + return d3_selection([ group ]); + }; + d3_selectionPrototype.on = function(type, listener, capture) { + var n = arguments.length; + if (n < 3) { + if (typeof type !== "string") { + if (n < 2) listener = false; + for (capture in type) this.each(d3_selection_on(capture, type[capture], listener)); + return this; + } + if (n < 2) return (n = this.node()["__on" + type]) && n._; + capture = false; + } + return this.each(d3_selection_on(type, listener, capture)); + }; + function d3_selection_on(type, listener, capture) { + var name = "__on" + type, i = type.indexOf("."), wrap = d3_selection_onListener; + if (i > 0) type = type.slice(0, i); + var filter = d3_selection_onFilters.get(type); + if (filter) type = filter, wrap = d3_selection_onFilter; + function onRemove() { + var l = this[name]; + if (l) { + this.removeEventListener(type, l, l.$); + delete this[name]; + } + } + function onAdd() { + var l = wrap(listener, d3_array(arguments)); + onRemove.call(this); + this.addEventListener(type, this[name] = l, l.$ = capture); + l._ = listener; + } + function removeAll() { + var re = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match; + for (var name in this) { + if (match = name.match(re)) { + var l = this[name]; + this.removeEventListener(match[1], l, l.$); + delete this[name]; + } + } + } + return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll; + } + var d3_selection_onFilters = d3.map({ + mouseenter: "mouseover", + mouseleave: "mouseout" + }); + if (d3_document) { + d3_selection_onFilters.forEach(function(k) { + if ("on" + k in d3_document) d3_selection_onFilters.remove(k); + }); + } + function d3_selection_onListener(listener, argumentz) { + return function(e) { + var o = d3.event; + d3.event = e; + argumentz[0] = this.__data__; + try { + listener.apply(this, argumentz); + } finally { + d3.event = o; + } + }; + } + function d3_selection_onFilter(listener, argumentz) { + var l = d3_selection_onListener(listener, argumentz); + return function(e) { + var target = this, related = e.relatedTarget; + if (!related || related !== target && !(related.compareDocumentPosition(target) & 8)) { + l.call(target, e); + } + }; + } + var d3_event_dragSelect, d3_event_dragId = 0; + function d3_event_dragSuppress(node) { + var name = ".dragsuppress-" + ++d3_event_dragId, click = "click" + name, w = d3.select(d3_window(node)).on("touchmove" + name, d3_eventPreventDefault).on("dragstart" + name, d3_eventPreventDefault).on("selectstart" + name, d3_eventPreventDefault); + if (d3_event_dragSelect == null) { + d3_event_dragSelect = "onselectstart" in node ? false : d3_vendorSymbol(node.style, "userSelect"); + } + if (d3_event_dragSelect) { + var style = d3_documentElement(node).style, select = style[d3_event_dragSelect]; + style[d3_event_dragSelect] = "none"; + } + return function(suppressClick) { + w.on(name, null); + if (d3_event_dragSelect) style[d3_event_dragSelect] = select; + if (suppressClick) { + var off = function() { + w.on(click, null); + }; + w.on(click, function() { + d3_eventPreventDefault(); + off(); + }, true); + setTimeout(off, 0); + } + }; + } + d3.mouse = function(container) { + return d3_mousePoint(container, d3_eventSource()); + }; + var d3_mouse_bug44083 = this.navigator && /WebKit/.test(this.navigator.userAgent) ? -1 : 0; + function d3_mousePoint(container, e) { + if (e.changedTouches) e = e.changedTouches[0]; + var svg = container.ownerSVGElement || container; + if (svg.createSVGPoint) { + var point = svg.createSVGPoint(); + if (d3_mouse_bug44083 < 0) { + var window = d3_window(container); + if (window.scrollX || window.scrollY) { + svg = d3.select("body").append("svg").style({ + position: "absolute", + top: 0, + left: 0, + margin: 0, + padding: 0, + border: "none" + }, "important"); + var ctm = svg[0][0].getScreenCTM(); + d3_mouse_bug44083 = !(ctm.f || ctm.e); + svg.remove(); + } + } + if (d3_mouse_bug44083) point.x = e.pageX, point.y = e.pageY; else point.x = e.clientX, + point.y = e.clientY; + point = point.matrixTransform(container.getScreenCTM().inverse()); + return [ point.x, point.y ]; + } + var rect = container.getBoundingClientRect(); + return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ]; + } + d3.touch = function(container, touches, identifier) { + if (arguments.length < 3) identifier = touches, touches = d3_eventSource().changedTouches; + if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) { + if ((touch = touches[i]).identifier === identifier) { + return d3_mousePoint(container, touch); + } + } + }; + d3.behavior.drag = function() { + var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null, mousedown = dragstart(d3_noop, d3.mouse, d3_window, "mousemove", "mouseup"), touchstart = dragstart(d3_behavior_dragTouchId, d3.touch, d3_identity, "touchmove", "touchend"); + function drag() { + this.on("mousedown.drag", mousedown).on("touchstart.drag", touchstart); + } + function dragstart(id, position, subject, move, end) { + return function() { + var that = this, target = d3.event.target, parent = that.parentNode, dispatch = event.of(that, arguments), dragged = 0, dragId = id(), dragName = ".drag" + (dragId == null ? "" : "-" + dragId), dragOffset, dragSubject = d3.select(subject(target)).on(move + dragName, moved).on(end + dragName, ended), dragRestore = d3_event_dragSuppress(target), position0 = position(parent, dragId); + if (origin) { + dragOffset = origin.apply(that, arguments); + dragOffset = [ dragOffset.x - position0[0], dragOffset.y - position0[1] ]; + } else { + dragOffset = [ 0, 0 ]; + } + dispatch({ + type: "dragstart" + }); + function moved() { + var position1 = position(parent, dragId), dx, dy; + if (!position1) return; + dx = position1[0] - position0[0]; + dy = position1[1] - position0[1]; + dragged |= dx | dy; + position0 = position1; + dispatch({ + type: "drag", + x: position1[0] + dragOffset[0], + y: position1[1] + dragOffset[1], + dx: dx, + dy: dy + }); + } + function ended() { + if (!position(parent, dragId)) return; + dragSubject.on(move + dragName, null).on(end + dragName, null); + dragRestore(dragged); + dispatch({ + type: "dragend" + }); + } + }; + } + drag.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return drag; + }; + return d3.rebind(drag, event, "on"); + }; + function d3_behavior_dragTouchId() { + return d3.event.changedTouches[0].identifier; + } + d3.touches = function(container, touches) { + if (arguments.length < 2) touches = d3_eventSource().touches; + return touches ? d3_array(touches).map(function(touch) { + var point = d3_mousePoint(container, touch); + point.identifier = touch.identifier; + return point; + }) : []; + }; + var ε = 1e-6, ε2 = ε * ε, π = Math.PI, τ = 2 * π, τε = τ - ε, halfπ = π / 2, d3_radians = π / 180, d3_degrees = 180 / π; + function d3_sgn(x) { + return x > 0 ? 1 : x < 0 ? -1 : 0; + } + function d3_cross2d(a, b, c) { + return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]); + } + function d3_acos(x) { + return x > 1 ? 0 : x < -1 ? π : Math.acos(x); + } + function d3_asin(x) { + return x > 1 ? halfπ : x < -1 ? -halfπ : Math.asin(x); + } + function d3_sinh(x) { + return ((x = Math.exp(x)) - 1 / x) / 2; + } + function d3_cosh(x) { + return ((x = Math.exp(x)) + 1 / x) / 2; + } + function d3_tanh(x) { + return ((x = Math.exp(2 * x)) - 1) / (x + 1); + } + function d3_haversin(x) { + return (x = Math.sin(x / 2)) * x; + } + var ρ = Math.SQRT2, ρ2 = 2, ρ4 = 4; + d3.interpolateZoom = function(p0, p1) { + var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; + if (d2 < ε2) { + S = Math.log(w1 / w0) / ρ; + i = function(t) { + return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(ρ * t * S) ]; + }; + } else { + var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + ρ4 * d2) / (2 * w0 * ρ2 * d1), b1 = (w1 * w1 - w0 * w0 - ρ4 * d2) / (2 * w1 * ρ2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); + S = (r1 - r0) / ρ; + i = function(t) { + var s = t * S, coshr0 = d3_cosh(r0), u = w0 / (ρ2 * d1) * (coshr0 * d3_tanh(ρ * s + r0) - d3_sinh(r0)); + return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / d3_cosh(ρ * s + r0) ]; + }; + } + i.duration = S * 1e3; + return i; + }; + d3.behavior.zoom = function() { + var view = { + x: 0, + y: 0, + k: 1 + }, translate0, center0, center, size = [ 960, 500 ], scaleExtent = d3_behavior_zoomInfinity, duration = 250, zooming = 0, mousedown = "mousedown.zoom", mousemove = "mousemove.zoom", mouseup = "mouseup.zoom", mousewheelTimer, touchstart = "touchstart.zoom", touchtime, event = d3_eventDispatch(zoom, "zoomstart", "zoom", "zoomend"), x0, x1, y0, y1; + if (!d3_behavior_zoomWheel) { + d3_behavior_zoomWheel = "onwheel" in d3_document ? (d3_behavior_zoomDelta = function() { + return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1); + }, "wheel") : "onmousewheel" in d3_document ? (d3_behavior_zoomDelta = function() { + return d3.event.wheelDelta; + }, "mousewheel") : (d3_behavior_zoomDelta = function() { + return -d3.event.detail; + }, "MozMousePixelScroll"); + } + function zoom(g) { + g.on(mousedown, mousedowned).on(d3_behavior_zoomWheel + ".zoom", mousewheeled).on("dblclick.zoom", dblclicked).on(touchstart, touchstarted); + } + zoom.event = function(g) { + g.each(function() { + var dispatch = event.of(this, arguments), view1 = view; + if (d3_transitionInheritId) { + d3.select(this).transition().each("start.zoom", function() { + view = this.__chart__ || { + x: 0, + y: 0, + k: 1 + }; + zoomstarted(dispatch); + }).tween("zoom:zoom", function() { + var dx = size[0], dy = size[1], cx = center0 ? center0[0] : dx / 2, cy = center0 ? center0[1] : dy / 2, i = d3.interpolateZoom([ (cx - view.x) / view.k, (cy - view.y) / view.k, dx / view.k ], [ (cx - view1.x) / view1.k, (cy - view1.y) / view1.k, dx / view1.k ]); + return function(t) { + var l = i(t), k = dx / l[2]; + this.__chart__ = view = { + x: cx - l[0] * k, + y: cy - l[1] * k, + k: k + }; + zoomed(dispatch); + }; + }).each("interrupt.zoom", function() { + zoomended(dispatch); + }).each("end.zoom", function() { + zoomended(dispatch); + }); + } else { + this.__chart__ = view; + zoomstarted(dispatch); + zoomed(dispatch); + zoomended(dispatch); + } + }); + }; + zoom.translate = function(_) { + if (!arguments.length) return [ view.x, view.y ]; + view = { + x: +_[0], + y: +_[1], + k: view.k + }; + rescale(); + return zoom; + }; + zoom.scale = function(_) { + if (!arguments.length) return view.k; + view = { + x: view.x, + y: view.y, + k: null + }; + scaleTo(+_); + rescale(); + return zoom; + }; + zoom.scaleExtent = function(_) { + if (!arguments.length) return scaleExtent; + scaleExtent = _ == null ? d3_behavior_zoomInfinity : [ +_[0], +_[1] ]; + return zoom; + }; + zoom.center = function(_) { + if (!arguments.length) return center; + center = _ && [ +_[0], +_[1] ]; + return zoom; + }; + zoom.size = function(_) { + if (!arguments.length) return size; + size = _ && [ +_[0], +_[1] ]; + return zoom; + }; + zoom.duration = function(_) { + if (!arguments.length) return duration; + duration = +_; + return zoom; + }; + zoom.x = function(z) { + if (!arguments.length) return x1; + x1 = z; + x0 = z.copy(); + view = { + x: 0, + y: 0, + k: 1 + }; + return zoom; + }; + zoom.y = function(z) { + if (!arguments.length) return y1; + y1 = z; + y0 = z.copy(); + view = { + x: 0, + y: 0, + k: 1 + }; + return zoom; + }; + function location(p) { + return [ (p[0] - view.x) / view.k, (p[1] - view.y) / view.k ]; + } + function point(l) { + return [ l[0] * view.k + view.x, l[1] * view.k + view.y ]; + } + function scaleTo(s) { + view.k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s)); + } + function translateTo(p, l) { + l = point(l); + view.x += p[0] - l[0]; + view.y += p[1] - l[1]; + } + function zoomTo(that, p, l, k) { + that.__chart__ = { + x: view.x, + y: view.y, + k: view.k + }; + scaleTo(Math.pow(2, k)); + translateTo(center0 = p, l); + that = d3.select(that); + if (duration > 0) that = that.transition().duration(duration); + that.call(zoom.event); + } + function rescale() { + if (x1) x1.domain(x0.range().map(function(x) { + return (x - view.x) / view.k; + }).map(x0.invert)); + if (y1) y1.domain(y0.range().map(function(y) { + return (y - view.y) / view.k; + }).map(y0.invert)); + } + function zoomstarted(dispatch) { + if (!zooming++) dispatch({ + type: "zoomstart" + }); + } + function zoomed(dispatch) { + rescale(); + dispatch({ + type: "zoom", + scale: view.k, + translate: [ view.x, view.y ] + }); + } + function zoomended(dispatch) { + if (!--zooming) dispatch({ + type: "zoomend" + }), center0 = null; + } + function mousedowned() { + var that = this, dispatch = event.of(that, arguments), dragged = 0, subject = d3.select(d3_window(that)).on(mousemove, moved).on(mouseup, ended), location0 = location(d3.mouse(that)), dragRestore = d3_event_dragSuppress(that); + d3_selection_interrupt.call(that); + zoomstarted(dispatch); + function moved() { + dragged = 1; + translateTo(d3.mouse(that), location0); + zoomed(dispatch); + } + function ended() { + subject.on(mousemove, null).on(mouseup, null); + dragRestore(dragged); + zoomended(dispatch); + } + } + function touchstarted() { + var that = this, dispatch = event.of(that, arguments), locations0 = {}, distance0 = 0, scale0, zoomName = ".zoom-" + d3.event.changedTouches[0].identifier, touchmove = "touchmove" + zoomName, touchend = "touchend" + zoomName, targets = [], subject = d3.select(that), dragRestore = d3_event_dragSuppress(that); + started(); + zoomstarted(dispatch); + subject.on(mousedown, null).on(touchstart, started); + function relocate() { + var touches = d3.touches(that); + scale0 = view.k; + touches.forEach(function(t) { + if (t.identifier in locations0) locations0[t.identifier] = location(t); + }); + return touches; + } + function started() { + var target = d3.event.target; + d3.select(target).on(touchmove, moved).on(touchend, ended); + targets.push(target); + var changed = d3.event.changedTouches; + for (var i = 0, n = changed.length; i < n; ++i) { + locations0[changed[i].identifier] = null; + } + var touches = relocate(), now = Date.now(); + if (touches.length === 1) { + if (now - touchtime < 500) { + var p = touches[0]; + zoomTo(that, p, locations0[p.identifier], Math.floor(Math.log(view.k) / Math.LN2) + 1); + d3_eventPreventDefault(); + } + touchtime = now; + } else if (touches.length > 1) { + var p = touches[0], q = touches[1], dx = p[0] - q[0], dy = p[1] - q[1]; + distance0 = dx * dx + dy * dy; + } + } + function moved() { + var touches = d3.touches(that), p0, l0, p1, l1; + d3_selection_interrupt.call(that); + for (var i = 0, n = touches.length; i < n; ++i, l1 = null) { + p1 = touches[i]; + if (l1 = locations0[p1.identifier]) { + if (l0) break; + p0 = p1, l0 = l1; + } + } + if (l1) { + var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1, scale1 = distance0 && Math.sqrt(distance1 / distance0); + p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ]; + l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ]; + scaleTo(scale1 * scale0); + } + touchtime = null; + translateTo(p0, l0); + zoomed(dispatch); + } + function ended() { + if (d3.event.touches.length) { + var changed = d3.event.changedTouches; + for (var i = 0, n = changed.length; i < n; ++i) { + delete locations0[changed[i].identifier]; + } + for (var identifier in locations0) { + return void relocate(); + } + } + d3.selectAll(targets).on(zoomName, null); + subject.on(mousedown, mousedowned).on(touchstart, touchstarted); + dragRestore(); + zoomended(dispatch); + } + } + function mousewheeled() { + var dispatch = event.of(this, arguments); + if (mousewheelTimer) clearTimeout(mousewheelTimer); else d3_selection_interrupt.call(this), + translate0 = location(center0 = center || d3.mouse(this)), zoomstarted(dispatch); + mousewheelTimer = setTimeout(function() { + mousewheelTimer = null; + zoomended(dispatch); + }, 50); + d3_eventPreventDefault(); + scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * view.k); + translateTo(center0, translate0); + zoomed(dispatch); + } + function dblclicked() { + var p = d3.mouse(this), k = Math.log(view.k) / Math.LN2; + zoomTo(this, p, location(p), d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1); + } + return d3.rebind(zoom, event, "on"); + }; + var d3_behavior_zoomInfinity = [ 0, Infinity ], d3_behavior_zoomDelta, d3_behavior_zoomWheel; + d3.color = d3_color; + function d3_color() {} + d3_color.prototype.toString = function() { + return this.rgb() + ""; + }; + d3.hsl = d3_hsl; + function d3_hsl(h, s, l) { + return this instanceof d3_hsl ? void (this.h = +h, this.s = +s, this.l = +l) : arguments.length < 2 ? h instanceof d3_hsl ? new d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : new d3_hsl(h, s, l); + } + var d3_hslPrototype = d3_hsl.prototype = new d3_color(); + d3_hslPrototype.brighter = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return new d3_hsl(this.h, this.s, this.l / k); + }; + d3_hslPrototype.darker = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return new d3_hsl(this.h, this.s, k * this.l); + }; + d3_hslPrototype.rgb = function() { + return d3_hsl_rgb(this.h, this.s, this.l); + }; + function d3_hsl_rgb(h, s, l) { + var m1, m2; + h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h; + s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s; + l = l < 0 ? 0 : l > 1 ? 1 : l; + m2 = l <= .5 ? l * (1 + s) : l + s - l * s; + m1 = 2 * l - m2; + function v(h) { + if (h > 360) h -= 360; else if (h < 0) h += 360; + if (h < 60) return m1 + (m2 - m1) * h / 60; + if (h < 180) return m2; + if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; + return m1; + } + function vv(h) { + return Math.round(v(h) * 255); + } + return new d3_rgb(vv(h + 120), vv(h), vv(h - 120)); + } + d3.hcl = d3_hcl; + function d3_hcl(h, c, l) { + return this instanceof d3_hcl ? void (this.h = +h, this.c = +c, this.l = +l) : arguments.length < 2 ? h instanceof d3_hcl ? new d3_hcl(h.h, h.c, h.l) : h instanceof d3_lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : new d3_hcl(h, c, l); + } + var d3_hclPrototype = d3_hcl.prototype = new d3_color(); + d3_hclPrototype.brighter = function(k) { + return new d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1))); + }; + d3_hclPrototype.darker = function(k) { + return new d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1))); + }; + d3_hclPrototype.rgb = function() { + return d3_hcl_lab(this.h, this.c, this.l).rgb(); + }; + function d3_hcl_lab(h, c, l) { + if (isNaN(h)) h = 0; + if (isNaN(c)) c = 0; + return new d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c); + } + d3.lab = d3_lab; + function d3_lab(l, a, b) { + return this instanceof d3_lab ? void (this.l = +l, this.a = +a, this.b = +b) : arguments.length < 2 ? l instanceof d3_lab ? new d3_lab(l.l, l.a, l.b) : l instanceof d3_hcl ? d3_hcl_lab(l.h, l.c, l.l) : d3_rgb_lab((l = d3_rgb(l)).r, l.g, l.b) : new d3_lab(l, a, b); + } + var d3_lab_K = 18; + var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883; + var d3_labPrototype = d3_lab.prototype = new d3_color(); + d3_labPrototype.brighter = function(k) { + return new d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); + }; + d3_labPrototype.darker = function(k) { + return new d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); + }; + d3_labPrototype.rgb = function() { + return d3_lab_rgb(this.l, this.a, this.b); + }; + function d3_lab_rgb(l, a, b) { + var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200; + x = d3_lab_xyz(x) * d3_lab_X; + y = d3_lab_xyz(y) * d3_lab_Y; + z = d3_lab_xyz(z) * d3_lab_Z; + return new d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z)); + } + function d3_lab_hcl(l, a, b) { + return l > 0 ? new d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l) : new d3_hcl(NaN, NaN, l); + } + function d3_lab_xyz(x) { + return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037; + } + function d3_xyz_lab(x) { + return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; + } + function d3_xyz_rgb(r) { + return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055)); + } + d3.rgb = d3_rgb; + function d3_rgb(r, g, b) { + return this instanceof d3_rgb ? void (this.r = ~~r, this.g = ~~g, this.b = ~~b) : arguments.length < 2 ? r instanceof d3_rgb ? new d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : new d3_rgb(r, g, b); + } + function d3_rgbNumber(value) { + return new d3_rgb(value >> 16, value >> 8 & 255, value & 255); + } + function d3_rgbString(value) { + return d3_rgbNumber(value) + ""; + } + var d3_rgbPrototype = d3_rgb.prototype = new d3_color(); + d3_rgbPrototype.brighter = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + var r = this.r, g = this.g, b = this.b, i = 30; + if (!r && !g && !b) return new d3_rgb(i, i, i); + if (r && r < i) r = i; + if (g && g < i) g = i; + if (b && b < i) b = i; + return new d3_rgb(Math.min(255, r / k), Math.min(255, g / k), Math.min(255, b / k)); + }; + d3_rgbPrototype.darker = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return new d3_rgb(k * this.r, k * this.g, k * this.b); + }; + d3_rgbPrototype.hsl = function() { + return d3_rgb_hsl(this.r, this.g, this.b); + }; + d3_rgbPrototype.toString = function() { + return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); + }; + function d3_rgb_hex(v) { + return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16); + } + function d3_rgb_parse(format, rgb, hsl) { + var r = 0, g = 0, b = 0, m1, m2, color; + m1 = /([a-z]+)\((.*)\)/.exec(format = format.toLowerCase()); + if (m1) { + m2 = m1[2].split(","); + switch (m1[1]) { + case "hsl": + { + return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100); + } + + case "rgb": + { + return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2])); + } + } + } + if (color = d3_rgb_names.get(format)) { + return rgb(color.r, color.g, color.b); + } + if (format != null && format.charAt(0) === "#" && !isNaN(color = parseInt(format.slice(1), 16))) { + if (format.length === 4) { + r = (color & 3840) >> 4; + r = r >> 4 | r; + g = color & 240; + g = g >> 4 | g; + b = color & 15; + b = b << 4 | b; + } else if (format.length === 7) { + r = (color & 16711680) >> 16; + g = (color & 65280) >> 8; + b = color & 255; + } + } + return rgb(r, g, b); + } + function d3_rgb_hsl(r, g, b) { + var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2; + if (d) { + s = l < .5 ? d / (max + min) : d / (2 - max - min); + if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4; + h *= 60; + } else { + h = NaN; + s = l > 0 && l < 1 ? 0 : h; + } + return new d3_hsl(h, s, l); + } + function d3_rgb_lab(r, g, b) { + r = d3_rgb_xyz(r); + g = d3_rgb_xyz(g); + b = d3_rgb_xyz(b); + var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z); + return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z)); + } + function d3_rgb_xyz(r) { + return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4); + } + function d3_rgb_parseNumber(c) { + var f = parseFloat(c); + return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; + } + var d3_rgb_names = d3.map({ + aliceblue: 15792383, + antiquewhite: 16444375, + aqua: 65535, + aquamarine: 8388564, + azure: 15794175, + beige: 16119260, + bisque: 16770244, + black: 0, + blanchedalmond: 16772045, + blue: 255, + blueviolet: 9055202, + brown: 10824234, + burlywood: 14596231, + cadetblue: 6266528, + chartreuse: 8388352, + chocolate: 13789470, + coral: 16744272, + cornflowerblue: 6591981, + cornsilk: 16775388, + crimson: 14423100, + cyan: 65535, + darkblue: 139, + darkcyan: 35723, + darkgoldenrod: 12092939, + darkgray: 11119017, + darkgreen: 25600, + darkgrey: 11119017, + darkkhaki: 12433259, + darkmagenta: 9109643, + darkolivegreen: 5597999, + darkorange: 16747520, + darkorchid: 10040012, + darkred: 9109504, + darksalmon: 15308410, + darkseagreen: 9419919, + darkslateblue: 4734347, + darkslategray: 3100495, + darkslategrey: 3100495, + darkturquoise: 52945, + darkviolet: 9699539, + deeppink: 16716947, + deepskyblue: 49151, + dimgray: 6908265, + dimgrey: 6908265, + dodgerblue: 2003199, + firebrick: 11674146, + floralwhite: 16775920, + forestgreen: 2263842, + fuchsia: 16711935, + gainsboro: 14474460, + ghostwhite: 16316671, + gold: 16766720, + goldenrod: 14329120, + gray: 8421504, + green: 32768, + greenyellow: 11403055, + grey: 8421504, + honeydew: 15794160, + hotpink: 16738740, + indianred: 13458524, + indigo: 4915330, + ivory: 16777200, + khaki: 15787660, + lavender: 15132410, + lavenderblush: 16773365, + lawngreen: 8190976, + lemonchiffon: 16775885, + lightblue: 11393254, + lightcoral: 15761536, + lightcyan: 14745599, + lightgoldenrodyellow: 16448210, + lightgray: 13882323, + lightgreen: 9498256, + lightgrey: 13882323, + lightpink: 16758465, + lightsalmon: 16752762, + lightseagreen: 2142890, + lightskyblue: 8900346, + lightslategray: 7833753, + lightslategrey: 7833753, + lightsteelblue: 11584734, + lightyellow: 16777184, + lime: 65280, + limegreen: 3329330, + linen: 16445670, + magenta: 16711935, + maroon: 8388608, + mediumaquamarine: 6737322, + mediumblue: 205, + mediumorchid: 12211667, + mediumpurple: 9662683, + mediumseagreen: 3978097, + mediumslateblue: 8087790, + mediumspringgreen: 64154, + mediumturquoise: 4772300, + mediumvioletred: 13047173, + midnightblue: 1644912, + mintcream: 16121850, + mistyrose: 16770273, + moccasin: 16770229, + navajowhite: 16768685, + navy: 128, + oldlace: 16643558, + olive: 8421376, + olivedrab: 7048739, + orange: 16753920, + orangered: 16729344, + orchid: 14315734, + palegoldenrod: 15657130, + palegreen: 10025880, + paleturquoise: 11529966, + palevioletred: 14381203, + papayawhip: 16773077, + peachpuff: 16767673, + peru: 13468991, + pink: 16761035, + plum: 14524637, + powderblue: 11591910, + purple: 8388736, + rebeccapurple: 6697881, + red: 16711680, + rosybrown: 12357519, + royalblue: 4286945, + saddlebrown: 9127187, + salmon: 16416882, + sandybrown: 16032864, + seagreen: 3050327, + seashell: 16774638, + sienna: 10506797, + silver: 12632256, + skyblue: 8900331, + slateblue: 6970061, + slategray: 7372944, + slategrey: 7372944, + snow: 16775930, + springgreen: 65407, + steelblue: 4620980, + tan: 13808780, + teal: 32896, + thistle: 14204888, + tomato: 16737095, + turquoise: 4251856, + violet: 15631086, + wheat: 16113331, + white: 16777215, + whitesmoke: 16119285, + yellow: 16776960, + yellowgreen: 10145074 + }); + d3_rgb_names.forEach(function(key, value) { + d3_rgb_names.set(key, d3_rgbNumber(value)); + }); + function d3_functor(v) { + return typeof v === "function" ? v : function() { + return v; + }; + } + d3.functor = d3_functor; + d3.xhr = d3_xhrType(d3_identity); + function d3_xhrType(response) { + return function(url, mimeType, callback) { + if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType, + mimeType = null; + return d3_xhr(url, mimeType, response, callback); + }; + } + function d3_xhr(url, mimeType, response, callback) { + var xhr = {}, dispatch = d3.dispatch("beforesend", "progress", "load", "error"), headers = {}, request = new XMLHttpRequest(), responseType = null; + if (this.XDomainRequest && !("withCredentials" in request) && /^(http(s)?:)?\/\//.test(url)) request = new XDomainRequest(); + "onload" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() { + request.readyState > 3 && respond(); + }; + function respond() { + var status = request.status, result; + if (!status && d3_xhrHasResponse(request) || status >= 200 && status < 300 || status === 304) { + try { + result = response.call(xhr, request); + } catch (e) { + dispatch.error.call(xhr, e); + return; + } + dispatch.load.call(xhr, result); + } else { + dispatch.error.call(xhr, request); + } + } + request.onprogress = function(event) { + var o = d3.event; + d3.event = event; + try { + dispatch.progress.call(xhr, request); + } finally { + d3.event = o; + } + }; + xhr.header = function(name, value) { + name = (name + "").toLowerCase(); + if (arguments.length < 2) return headers[name]; + if (value == null) delete headers[name]; else headers[name] = value + ""; + return xhr; + }; + xhr.mimeType = function(value) { + if (!arguments.length) return mimeType; + mimeType = value == null ? null : value + ""; + return xhr; + }; + xhr.responseType = function(value) { + if (!arguments.length) return responseType; + responseType = value; + return xhr; + }; + xhr.response = function(value) { + response = value; + return xhr; + }; + [ "get", "post" ].forEach(function(method) { + xhr[method] = function() { + return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments))); + }; + }); + xhr.send = function(method, data, callback) { + if (arguments.length === 2 && typeof data === "function") callback = data, data = null; + request.open(method, url, true); + if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*"; + if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]); + if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType); + if (responseType != null) request.responseType = responseType; + if (callback != null) xhr.on("error", callback).on("load", function(request) { + callback(null, request); + }); + dispatch.beforesend.call(xhr, request); + request.send(data == null ? null : data); + return xhr; + }; + xhr.abort = function() { + request.abort(); + return xhr; + }; + d3.rebind(xhr, dispatch, "on"); + return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback)); + } + function d3_xhr_fixCallback(callback) { + return callback.length === 1 ? function(error, request) { + callback(error == null ? request : null); + } : callback; + } + function d3_xhrHasResponse(request) { + var type = request.responseType; + return type && type !== "text" ? request.response : request.responseText; + } + d3.dsv = function(delimiter, mimeType) { + var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0); + function dsv(url, row, callback) { + if (arguments.length < 3) callback = row, row = null; + var xhr = d3_xhr(url, mimeType, row == null ? response : typedResponse(row), callback); + xhr.row = function(_) { + return arguments.length ? xhr.response((row = _) == null ? response : typedResponse(_)) : row; + }; + return xhr; + } + function response(request) { + return dsv.parse(request.responseText); + } + function typedResponse(f) { + return function(request) { + return dsv.parse(request.responseText, f); + }; + } + dsv.parse = function(text, f) { + var o; + return dsv.parseRows(text, function(row, i) { + if (o) return o(row, i - 1); + var a = new Function("d", "return {" + row.map(function(name, i) { + return JSON.stringify(name) + ": d[" + i + "]"; + }).join(",") + "}"); + o = f ? function(row, i) { + return f(a(row), i); + } : a; + }); + }; + dsv.parseRows = function(text, f) { + var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol; + function token() { + if (I >= N) return EOF; + if (eol) return eol = false, EOL; + var j = I; + if (text.charCodeAt(j) === 34) { + var i = j; + while (i++ < N) { + if (text.charCodeAt(i) === 34) { + if (text.charCodeAt(i + 1) !== 34) break; + ++i; + } + } + I = i + 2; + var c = text.charCodeAt(i + 1); + if (c === 13) { + eol = true; + if (text.charCodeAt(i + 2) === 10) ++I; + } else if (c === 10) { + eol = true; + } + return text.slice(j + 1, i).replace(/""/g, '"'); + } + while (I < N) { + var c = text.charCodeAt(I++), k = 1; + if (c === 10) eol = true; else if (c === 13) { + eol = true; + if (text.charCodeAt(I) === 10) ++I, ++k; + } else if (c !== delimiterCode) continue; + return text.slice(j, I - k); + } + return text.slice(j); + } + while ((t = token()) !== EOF) { + var a = []; + while (t !== EOL && t !== EOF) { + a.push(t); + t = token(); + } + if (f && (a = f(a, n++)) == null) continue; + rows.push(a); + } + return rows; + }; + dsv.format = function(rows) { + if (Array.isArray(rows[0])) return dsv.formatRows(rows); + var fieldSet = new d3_Set(), fields = []; + rows.forEach(function(row) { + for (var field in row) { + if (!fieldSet.has(field)) { + fields.push(fieldSet.add(field)); + } + } + }); + return [ fields.map(formatValue).join(delimiter) ].concat(rows.map(function(row) { + return fields.map(function(field) { + return formatValue(row[field]); + }).join(delimiter); + })).join("\n"); + }; + dsv.formatRows = function(rows) { + return rows.map(formatRow).join("\n"); + }; + function formatRow(row) { + return row.map(formatValue).join(delimiter); + } + function formatValue(text) { + return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text; + } + return dsv; + }; + d3.csv = d3.dsv(",", "text/csv"); + d3.tsv = d3.dsv(" ", "text/tab-separated-values"); + var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_frame = this[d3_vendorSymbol(this, "requestAnimationFrame")] || function(callback) { + setTimeout(callback, 17); + }; + d3.timer = function() { + d3_timer.apply(this, arguments); + }; + function d3_timer(callback, delay, then) { + var n = arguments.length; + if (n < 2) delay = 0; + if (n < 3) then = Date.now(); + var time = then + delay, timer = { + c: callback, + t: time, + n: null + }; + if (d3_timer_queueTail) d3_timer_queueTail.n = timer; else d3_timer_queueHead = timer; + d3_timer_queueTail = timer; + if (!d3_timer_interval) { + d3_timer_timeout = clearTimeout(d3_timer_timeout); + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } + return timer; + } + function d3_timer_step() { + var now = d3_timer_mark(), delay = d3_timer_sweep() - now; + if (delay > 24) { + if (isFinite(delay)) { + clearTimeout(d3_timer_timeout); + d3_timer_timeout = setTimeout(d3_timer_step, delay); + } + d3_timer_interval = 0; + } else { + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } + } + d3.timer.flush = function() { + d3_timer_mark(); + d3_timer_sweep(); + }; + function d3_timer_mark() { + var now = Date.now(), timer = d3_timer_queueHead; + while (timer) { + if (now >= timer.t && timer.c(now - timer.t)) timer.c = null; + timer = timer.n; + } + return now; + } + function d3_timer_sweep() { + var t0, t1 = d3_timer_queueHead, time = Infinity; + while (t1) { + if (t1.c) { + if (t1.t < time) time = t1.t; + t1 = (t0 = t1).n; + } else { + t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n; + } + } + d3_timer_queueTail = t0; + return time; + } + function d3_format_precision(x, p) { + return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1); + } + d3.round = function(x, n) { + return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x); + }; + var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix); + d3.formatPrefix = function(value, precision) { + var i = 0; + if (value = +value) { + if (value < 0) value *= -1; + if (precision) value = d3.round(value, d3_format_precision(value, precision)); + i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); + i = Math.max(-24, Math.min(24, Math.floor((i - 1) / 3) * 3)); + } + return d3_formatPrefixes[8 + i / 3]; + }; + function d3_formatPrefix(d, i) { + var k = Math.pow(10, abs(8 - i) * 3); + return { + scale: i > 8 ? function(d) { + return d / k; + } : function(d) { + return d * k; + }, + symbol: d + }; + } + function d3_locale_numberFormat(locale) { + var locale_decimal = locale.decimal, locale_thousands = locale.thousands, locale_grouping = locale.grouping, locale_currency = locale.currency, formatGroup = locale_grouping && locale_thousands ? function(value, width) { + var i = value.length, t = [], j = 0, g = locale_grouping[0], length = 0; + while (i > 0 && g > 0) { + if (length + g + 1 > width) g = Math.max(1, width - length); + t.push(value.substring(i -= g, i + g)); + if ((length += g + 1) > width) break; + g = locale_grouping[j = (j + 1) % locale_grouping.length]; + } + return t.reverse().join(locale_thousands); + } : d3_identity; + return function(specifier) { + var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "-", symbol = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, prefix = "", suffix = "", integer = false, exponent = true; + if (precision) precision = +precision.substring(1); + if (zfill || fill === "0" && align === "=") { + zfill = fill = "0"; + align = "="; + } + switch (type) { + case "n": + comma = true; + type = "g"; + break; + + case "%": + scale = 100; + suffix = "%"; + type = "f"; + break; + + case "p": + scale = 100; + suffix = "%"; + type = "r"; + break; + + case "b": + case "o": + case "x": + case "X": + if (symbol === "#") prefix = "0" + type.toLowerCase(); + + case "c": + exponent = false; + + case "d": + integer = true; + precision = 0; + break; + + case "s": + scale = -1; + type = "r"; + break; + } + if (symbol === "$") prefix = locale_currency[0], suffix = locale_currency[1]; + if (type == "r" && !precision) type = "g"; + if (precision != null) { + if (type == "g") precision = Math.max(1, Math.min(21, precision)); else if (type == "e" || type == "f") precision = Math.max(0, Math.min(20, precision)); + } + type = d3_format_types.get(type) || d3_format_typeDefault; + var zcomma = zfill && comma; + return function(value) { + var fullSuffix = suffix; + if (integer && value % 1) return ""; + var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign === "-" ? "" : sign; + if (scale < 0) { + var unit = d3.formatPrefix(value, precision); + value = unit.scale(value); + fullSuffix = unit.symbol + suffix; + } else { + value *= scale; + } + value = type(value, precision); + var i = value.lastIndexOf("."), before, after; + if (i < 0) { + var j = exponent ? value.lastIndexOf("e") : -1; + if (j < 0) before = value, after = ""; else before = value.substring(0, j), after = value.substring(j); + } else { + before = value.substring(0, i); + after = locale_decimal + value.substring(i + 1); + } + if (!zfill && comma) before = formatGroup(before, Infinity); + var length = prefix.length + before.length + after.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : ""; + if (zcomma) before = formatGroup(padding + before, padding.length ? width - after.length : Infinity); + negative += prefix; + value = before + after; + return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + fullSuffix; + }; + }; + } + var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i; + var d3_format_types = d3.map({ + b: function(x) { + return x.toString(2); + }, + c: function(x) { + return String.fromCharCode(x); + }, + o: function(x) { + return x.toString(8); + }, + x: function(x) { + return x.toString(16); + }, + X: function(x) { + return x.toString(16).toUpperCase(); + }, + g: function(x, p) { + return x.toPrecision(p); + }, + e: function(x, p) { + return x.toExponential(p); + }, + f: function(x, p) { + return x.toFixed(p); + }, + r: function(x, p) { + return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p)))); + } + }); + function d3_format_typeDefault(x) { + return x + ""; + } + var d3_time = d3.time = {}, d3_date = Date; + function d3_date_utc() { + this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]); + } + d3_date_utc.prototype = { + getDate: function() { + return this._.getUTCDate(); + }, + getDay: function() { + return this._.getUTCDay(); + }, + getFullYear: function() { + return this._.getUTCFullYear(); + }, + getHours: function() { + return this._.getUTCHours(); + }, + getMilliseconds: function() { + return this._.getUTCMilliseconds(); + }, + getMinutes: function() { + return this._.getUTCMinutes(); + }, + getMonth: function() { + return this._.getUTCMonth(); + }, + getSeconds: function() { + return this._.getUTCSeconds(); + }, + getTime: function() { + return this._.getTime(); + }, + getTimezoneOffset: function() { + return 0; + }, + valueOf: function() { + return this._.valueOf(); + }, + setDate: function() { + d3_time_prototype.setUTCDate.apply(this._, arguments); + }, + setDay: function() { + d3_time_prototype.setUTCDay.apply(this._, arguments); + }, + setFullYear: function() { + d3_time_prototype.setUTCFullYear.apply(this._, arguments); + }, + setHours: function() { + d3_time_prototype.setUTCHours.apply(this._, arguments); + }, + setMilliseconds: function() { + d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); + }, + setMinutes: function() { + d3_time_prototype.setUTCMinutes.apply(this._, arguments); + }, + setMonth: function() { + d3_time_prototype.setUTCMonth.apply(this._, arguments); + }, + setSeconds: function() { + d3_time_prototype.setUTCSeconds.apply(this._, arguments); + }, + setTime: function() { + d3_time_prototype.setTime.apply(this._, arguments); + } + }; + var d3_time_prototype = Date.prototype; + function d3_time_interval(local, step, number) { + function round(date) { + var d0 = local(date), d1 = offset(d0, 1); + return date - d0 < d1 - date ? d0 : d1; + } + function ceil(date) { + step(date = local(new d3_date(date - 1)), 1); + return date; + } + function offset(date, k) { + step(date = new d3_date(+date), k); + return date; + } + function range(t0, t1, dt) { + var time = ceil(t0), times = []; + if (dt > 1) { + while (time < t1) { + if (!(number(time) % dt)) times.push(new Date(+time)); + step(time, 1); + } + } else { + while (time < t1) times.push(new Date(+time)), step(time, 1); + } + return times; + } + function range_utc(t0, t1, dt) { + try { + d3_date = d3_date_utc; + var utc = new d3_date_utc(); + utc._ = t0; + return range(utc, t1, dt); + } finally { + d3_date = Date; + } + } + local.floor = local; + local.round = round; + local.ceil = ceil; + local.offset = offset; + local.range = range; + var utc = local.utc = d3_time_interval_utc(local); + utc.floor = utc; + utc.round = d3_time_interval_utc(round); + utc.ceil = d3_time_interval_utc(ceil); + utc.offset = d3_time_interval_utc(offset); + utc.range = range_utc; + return local; + } + function d3_time_interval_utc(method) { + return function(date, k) { + try { + d3_date = d3_date_utc; + var utc = new d3_date_utc(); + utc._ = date; + return method(utc, k)._; + } finally { + d3_date = Date; + } + }; + } + d3_time.year = d3_time_interval(function(date) { + date = d3_time.day(date); + date.setMonth(0, 1); + return date; + }, function(date, offset) { + date.setFullYear(date.getFullYear() + offset); + }, function(date) { + return date.getFullYear(); + }); + d3_time.years = d3_time.year.range; + d3_time.years.utc = d3_time.year.utc.range; + d3_time.day = d3_time_interval(function(date) { + var day = new d3_date(2e3, 0); + day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); + return day; + }, function(date, offset) { + date.setDate(date.getDate() + offset); + }, function(date) { + return date.getDate() - 1; + }); + d3_time.days = d3_time.day.range; + d3_time.days.utc = d3_time.day.utc.range; + d3_time.dayOfYear = function(date) { + var year = d3_time.year(date); + return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5); + }; + [ "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" ].forEach(function(day, i) { + i = 7 - i; + var interval = d3_time[day] = d3_time_interval(function(date) { + (date = d3_time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7); + return date; + }, function(date, offset) { + date.setDate(date.getDate() + Math.floor(offset) * 7); + }, function(date) { + var day = d3_time.year(date).getDay(); + return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i); + }); + d3_time[day + "s"] = interval.range; + d3_time[day + "s"].utc = interval.utc.range; + d3_time[day + "OfYear"] = function(date) { + var day = d3_time.year(date).getDay(); + return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7); + }; + }); + d3_time.week = d3_time.sunday; + d3_time.weeks = d3_time.sunday.range; + d3_time.weeks.utc = d3_time.sunday.utc.range; + d3_time.weekOfYear = d3_time.sundayOfYear; + function d3_locale_timeFormat(locale) { + var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_days = locale.days, locale_shortDays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths; + function d3_time_format(template) { + var n = template.length; + function format(date) { + var string = [], i = -1, j = 0, c, p, f; + while (++i < n) { + if (template.charCodeAt(i) === 37) { + string.push(template.slice(j, i)); + if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i); + if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p); + string.push(c); + j = i + 1; + } + } + string.push(template.slice(j, i)); + return string.join(""); + } + format.parse = function(string) { + var d = { + y: 1900, + m: 0, + d: 1, + H: 0, + M: 0, + S: 0, + L: 0, + Z: null + }, i = d3_time_parse(d, template, string, 0); + if (i != string.length) return null; + if ("p" in d) d.H = d.H % 12 + d.p * 12; + var localZ = d.Z != null && d3_date !== d3_date_utc, date = new (localZ ? d3_date_utc : d3_date)(); + if ("j" in d) date.setFullYear(d.y, 0, d.j); else if ("W" in d || "U" in d) { + if (!("w" in d)) d.w = "W" in d ? 1 : 0; + date.setFullYear(d.y, 0, 1); + date.setFullYear(d.y, 0, "W" in d ? (d.w + 6) % 7 + d.W * 7 - (date.getDay() + 5) % 7 : d.w + d.U * 7 - (date.getDay() + 6) % 7); + } else date.setFullYear(d.y, d.m, d.d); + date.setHours(d.H + (d.Z / 100 | 0), d.M + d.Z % 100, d.S, d.L); + return localZ ? date._ : date; + }; + format.toString = function() { + return template; + }; + return format; + } + function d3_time_parse(date, template, string, j) { + var c, p, t, i = 0, n = template.length, m = string.length; + while (i < n) { + if (j >= m) return -1; + c = template.charCodeAt(i++); + if (c === 37) { + t = template.charAt(i++); + p = d3_time_parsers[t in d3_time_formatPads ? template.charAt(i++) : t]; + if (!p || (j = p(date, string, j)) < 0) return -1; + } else if (c != string.charCodeAt(j++)) { + return -1; + } + } + return j; + } + d3_time_format.utc = function(template) { + var local = d3_time_format(template); + function format(date) { + try { + d3_date = d3_date_utc; + var utc = new d3_date(); + utc._ = date; + return local(utc); + } finally { + d3_date = Date; + } + } + format.parse = function(string) { + try { + d3_date = d3_date_utc; + var date = local.parse(string); + return date && date._; + } finally { + d3_date = Date; + } + }; + format.toString = local.toString; + return format; + }; + d3_time_format.multi = d3_time_format.utc.multi = d3_time_formatMulti; + var d3_time_periodLookup = d3.map(), d3_time_dayRe = d3_time_formatRe(locale_days), d3_time_dayLookup = d3_time_formatLookup(locale_days), d3_time_dayAbbrevRe = d3_time_formatRe(locale_shortDays), d3_time_dayAbbrevLookup = d3_time_formatLookup(locale_shortDays), d3_time_monthRe = d3_time_formatRe(locale_months), d3_time_monthLookup = d3_time_formatLookup(locale_months), d3_time_monthAbbrevRe = d3_time_formatRe(locale_shortMonths), d3_time_monthAbbrevLookup = d3_time_formatLookup(locale_shortMonths); + locale_periods.forEach(function(p, i) { + d3_time_periodLookup.set(p.toLowerCase(), i); + }); + var d3_time_formats = { + a: function(d) { + return locale_shortDays[d.getDay()]; + }, + A: function(d) { + return locale_days[d.getDay()]; + }, + b: function(d) { + return locale_shortMonths[d.getMonth()]; + }, + B: function(d) { + return locale_months[d.getMonth()]; + }, + c: d3_time_format(locale_dateTime), + d: function(d, p) { + return d3_time_formatPad(d.getDate(), p, 2); + }, + e: function(d, p) { + return d3_time_formatPad(d.getDate(), p, 2); + }, + H: function(d, p) { + return d3_time_formatPad(d.getHours(), p, 2); + }, + I: function(d, p) { + return d3_time_formatPad(d.getHours() % 12 || 12, p, 2); + }, + j: function(d, p) { + return d3_time_formatPad(1 + d3_time.dayOfYear(d), p, 3); + }, + L: function(d, p) { + return d3_time_formatPad(d.getMilliseconds(), p, 3); + }, + m: function(d, p) { + return d3_time_formatPad(d.getMonth() + 1, p, 2); + }, + M: function(d, p) { + return d3_time_formatPad(d.getMinutes(), p, 2); + }, + p: function(d) { + return locale_periods[+(d.getHours() >= 12)]; + }, + S: function(d, p) { + return d3_time_formatPad(d.getSeconds(), p, 2); + }, + U: function(d, p) { + return d3_time_formatPad(d3_time.sundayOfYear(d), p, 2); + }, + w: function(d) { + return d.getDay(); + }, + W: function(d, p) { + return d3_time_formatPad(d3_time.mondayOfYear(d), p, 2); + }, + x: d3_time_format(locale_date), + X: d3_time_format(locale_time), + y: function(d, p) { + return d3_time_formatPad(d.getFullYear() % 100, p, 2); + }, + Y: function(d, p) { + return d3_time_formatPad(d.getFullYear() % 1e4, p, 4); + }, + Z: d3_time_zone, + "%": function() { + return "%"; + } + }; + var d3_time_parsers = { + a: d3_time_parseWeekdayAbbrev, + A: d3_time_parseWeekday, + b: d3_time_parseMonthAbbrev, + B: d3_time_parseMonth, + c: d3_time_parseLocaleFull, + d: d3_time_parseDay, + e: d3_time_parseDay, + H: d3_time_parseHour24, + I: d3_time_parseHour24, + j: d3_time_parseDayOfYear, + L: d3_time_parseMilliseconds, + m: d3_time_parseMonthNumber, + M: d3_time_parseMinutes, + p: d3_time_parseAmPm, + S: d3_time_parseSeconds, + U: d3_time_parseWeekNumberSunday, + w: d3_time_parseWeekdayNumber, + W: d3_time_parseWeekNumberMonday, + x: d3_time_parseLocaleDate, + X: d3_time_parseLocaleTime, + y: d3_time_parseYear, + Y: d3_time_parseFullYear, + Z: d3_time_parseZone, + "%": d3_time_parseLiteralPercent + }; + function d3_time_parseWeekdayAbbrev(date, string, i) { + d3_time_dayAbbrevRe.lastIndex = 0; + var n = d3_time_dayAbbrevRe.exec(string.slice(i)); + return n ? (date.w = d3_time_dayAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function d3_time_parseWeekday(date, string, i) { + d3_time_dayRe.lastIndex = 0; + var n = d3_time_dayRe.exec(string.slice(i)); + return n ? (date.w = d3_time_dayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function d3_time_parseMonthAbbrev(date, string, i) { + d3_time_monthAbbrevRe.lastIndex = 0; + var n = d3_time_monthAbbrevRe.exec(string.slice(i)); + return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function d3_time_parseMonth(date, string, i) { + d3_time_monthRe.lastIndex = 0; + var n = d3_time_monthRe.exec(string.slice(i)); + return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function d3_time_parseLocaleFull(date, string, i) { + return d3_time_parse(date, d3_time_formats.c.toString(), string, i); + } + function d3_time_parseLocaleDate(date, string, i) { + return d3_time_parse(date, d3_time_formats.x.toString(), string, i); + } + function d3_time_parseLocaleTime(date, string, i) { + return d3_time_parse(date, d3_time_formats.X.toString(), string, i); + } + function d3_time_parseAmPm(date, string, i) { + var n = d3_time_periodLookup.get(string.slice(i, i += 2).toLowerCase()); + return n == null ? -1 : (date.p = n, i); + } + return d3_time_format; + } + var d3_time_formatPads = { + "-": "", + _: " ", + "0": "0" + }, d3_time_numberRe = /^\s*\d+/, d3_time_percentRe = /^%/; + function d3_time_formatPad(value, fill, width) { + var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; + return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); + } + function d3_time_formatRe(names) { + return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i"); + } + function d3_time_formatLookup(names) { + var map = new d3_Map(), i = -1, n = names.length; + while (++i < n) map.set(names[i].toLowerCase(), i); + return map; + } + function d3_time_parseWeekdayNumber(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 1)); + return n ? (date.w = +n[0], i + n[0].length) : -1; + } + function d3_time_parseWeekNumberSunday(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i)); + return n ? (date.U = +n[0], i + n[0].length) : -1; + } + function d3_time_parseWeekNumberMonday(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i)); + return n ? (date.W = +n[0], i + n[0].length) : -1; + } + function d3_time_parseFullYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 4)); + return n ? (date.y = +n[0], i + n[0].length) : -1; + } + function d3_time_parseYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.y = d3_time_expandYear(+n[0]), i + n[0].length) : -1; + } + function d3_time_parseZone(date, string, i) { + return /^[+-]\d{4}$/.test(string = string.slice(i, i + 5)) ? (date.Z = -string, + i + 5) : -1; + } + function d3_time_expandYear(d) { + return d + (d > 68 ? 1900 : 2e3); + } + function d3_time_parseMonthNumber(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.m = n[0] - 1, i + n[0].length) : -1; + } + function d3_time_parseDay(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.d = +n[0], i + n[0].length) : -1; + } + function d3_time_parseDayOfYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 3)); + return n ? (date.j = +n[0], i + n[0].length) : -1; + } + function d3_time_parseHour24(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.H = +n[0], i + n[0].length) : -1; + } + function d3_time_parseMinutes(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.M = +n[0], i + n[0].length) : -1; + } + function d3_time_parseSeconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.S = +n[0], i + n[0].length) : -1; + } + function d3_time_parseMilliseconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 3)); + return n ? (date.L = +n[0], i + n[0].length) : -1; + } + function d3_time_zone(d) { + var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = abs(z) / 60 | 0, zm = abs(z) % 60; + return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2); + } + function d3_time_parseLiteralPercent(date, string, i) { + d3_time_percentRe.lastIndex = 0; + var n = d3_time_percentRe.exec(string.slice(i, i + 1)); + return n ? i + n[0].length : -1; + } + function d3_time_formatMulti(formats) { + var n = formats.length, i = -1; + while (++i < n) formats[i][0] = this(formats[i][0]); + return function(date) { + var i = 0, f = formats[i]; + while (!f[1](date)) f = formats[++i]; + return f[0](date); + }; + } + d3.locale = function(locale) { + return { + numberFormat: d3_locale_numberFormat(locale), + timeFormat: d3_locale_timeFormat(locale) + }; + }; + var d3_locale_enUS = d3.locale({ + decimal: ".", + thousands: ",", + grouping: [ 3 ], + currency: [ "$", "" ], + dateTime: "%a %b %e %X %Y", + date: "%m/%d/%Y", + time: "%H:%M:%S", + periods: [ "AM", "PM" ], + days: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], + shortDays: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], + months: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], + shortMonths: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] + }); + d3.format = d3_locale_enUS.numberFormat; + d3.geo = {}; + function d3_adder() {} + d3_adder.prototype = { + s: 0, + t: 0, + add: function(y) { + d3_adderSum(y, this.t, d3_adderTemp); + d3_adderSum(d3_adderTemp.s, this.s, this); + if (this.s) this.t += d3_adderTemp.t; else this.s = d3_adderTemp.t; + }, + reset: function() { + this.s = this.t = 0; + }, + valueOf: function() { + return this.s; + } + }; + var d3_adderTemp = new d3_adder(); + function d3_adderSum(a, b, o) { + var x = o.s = a + b, bv = x - a, av = x - bv; + o.t = a - av + (b - bv); + } + d3.geo.stream = function(object, listener) { + if (object && d3_geo_streamObjectType.hasOwnProperty(object.type)) { + d3_geo_streamObjectType[object.type](object, listener); + } else { + d3_geo_streamGeometry(object, listener); + } + }; + function d3_geo_streamGeometry(geometry, listener) { + if (geometry && d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) { + d3_geo_streamGeometryType[geometry.type](geometry, listener); + } + } + var d3_geo_streamObjectType = { + Feature: function(feature, listener) { + d3_geo_streamGeometry(feature.geometry, listener); + }, + FeatureCollection: function(object, listener) { + var features = object.features, i = -1, n = features.length; + while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener); + } + }; + var d3_geo_streamGeometryType = { + Sphere: function(object, listener) { + listener.sphere(); + }, + Point: function(object, listener) { + object = object.coordinates; + listener.point(object[0], object[1], object[2]); + }, + MultiPoint: function(object, listener) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) object = coordinates[i], listener.point(object[0], object[1], object[2]); + }, + LineString: function(object, listener) { + d3_geo_streamLine(object.coordinates, listener, 0); + }, + MultiLineString: function(object, listener) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0); + }, + Polygon: function(object, listener) { + d3_geo_streamPolygon(object.coordinates, listener); + }, + MultiPolygon: function(object, listener) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) d3_geo_streamPolygon(coordinates[i], listener); + }, + GeometryCollection: function(object, listener) { + var geometries = object.geometries, i = -1, n = geometries.length; + while (++i < n) d3_geo_streamGeometry(geometries[i], listener); + } + }; + function d3_geo_streamLine(coordinates, listener, closed) { + var i = -1, n = coordinates.length - closed, coordinate; + listener.lineStart(); + while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1], coordinate[2]); + listener.lineEnd(); + } + function d3_geo_streamPolygon(coordinates, listener) { + var i = -1, n = coordinates.length; + listener.polygonStart(); + while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1); + listener.polygonEnd(); + } + d3.geo.area = function(object) { + d3_geo_areaSum = 0; + d3.geo.stream(object, d3_geo_area); + return d3_geo_areaSum; + }; + var d3_geo_areaSum, d3_geo_areaRingSum = new d3_adder(); + var d3_geo_area = { + sphere: function() { + d3_geo_areaSum += 4 * π; + }, + point: d3_noop, + lineStart: d3_noop, + lineEnd: d3_noop, + polygonStart: function() { + d3_geo_areaRingSum.reset(); + d3_geo_area.lineStart = d3_geo_areaRingStart; + }, + polygonEnd: function() { + var area = 2 * d3_geo_areaRingSum; + d3_geo_areaSum += area < 0 ? 4 * π + area : area; + d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop; + } + }; + function d3_geo_areaRingStart() { + var λ00, φ00, λ0, cosφ0, sinφ0; + d3_geo_area.point = function(λ, φ) { + d3_geo_area.point = nextPoint; + λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4), + sinφ0 = Math.sin(φ); + }; + function nextPoint(λ, φ) { + λ *= d3_radians; + φ = φ * d3_radians / 2 + π / 4; + var dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u = cosφ0 * cosφ + k * Math.cos(adλ), v = k * sdλ * Math.sin(adλ); + d3_geo_areaRingSum.add(Math.atan2(v, u)); + λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ; + } + d3_geo_area.lineEnd = function() { + nextPoint(λ00, φ00); + }; + } + function d3_geo_cartesian(spherical) { + var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ); + return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ]; + } + function d3_geo_cartesianDot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + function d3_geo_cartesianCross(a, b) { + return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ]; + } + function d3_geo_cartesianAdd(a, b) { + a[0] += b[0]; + a[1] += b[1]; + a[2] += b[2]; + } + function d3_geo_cartesianScale(vector, k) { + return [ vector[0] * k, vector[1] * k, vector[2] * k ]; + } + function d3_geo_cartesianNormalize(d) { + var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); + d[0] /= l; + d[1] /= l; + d[2] /= l; + } + function d3_geo_spherical(cartesian) { + return [ Math.atan2(cartesian[1], cartesian[0]), d3_asin(cartesian[2]) ]; + } + function d3_geo_sphericalEqual(a, b) { + return abs(a[0] - b[0]) < ε && abs(a[1] - b[1]) < ε; + } + d3.geo.bounds = function() { + var λ0, φ0, λ1, φ1, λ_, λ__, φ__, p0, dλSum, ranges, range; + var bound = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + bound.point = ringPoint; + bound.lineStart = ringStart; + bound.lineEnd = ringEnd; + dλSum = 0; + d3_geo_area.polygonStart(); + }, + polygonEnd: function() { + d3_geo_area.polygonEnd(); + bound.point = point; + bound.lineStart = lineStart; + bound.lineEnd = lineEnd; + if (d3_geo_areaRingSum < 0) λ0 = -(λ1 = 180), φ0 = -(φ1 = 90); else if (dλSum > ε) φ1 = 90; else if (dλSum < -ε) φ0 = -90; + range[0] = λ0, range[1] = λ1; + } + }; + function point(λ, φ) { + ranges.push(range = [ λ0 = λ, λ1 = λ ]); + if (φ < φ0) φ0 = φ; + if (φ > φ1) φ1 = φ; + } + function linePoint(λ, φ) { + var p = d3_geo_cartesian([ λ * d3_radians, φ * d3_radians ]); + if (p0) { + var normal = d3_geo_cartesianCross(p0, p), equatorial = [ normal[1], -normal[0], 0 ], inflection = d3_geo_cartesianCross(equatorial, normal); + d3_geo_cartesianNormalize(inflection); + inflection = d3_geo_spherical(inflection); + var dλ = λ - λ_, s = dλ > 0 ? 1 : -1, λi = inflection[0] * d3_degrees * s, antimeridian = abs(dλ) > 180; + if (antimeridian ^ (s * λ_ < λi && λi < s * λ)) { + var φi = inflection[1] * d3_degrees; + if (φi > φ1) φ1 = φi; + } else if (λi = (λi + 360) % 360 - 180, antimeridian ^ (s * λ_ < λi && λi < s * λ)) { + var φi = -inflection[1] * d3_degrees; + if (φi < φ0) φ0 = φi; + } else { + if (φ < φ0) φ0 = φ; + if (φ > φ1) φ1 = φ; + } + if (antimeridian) { + if (λ < λ_) { + if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ; + } else { + if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ; + } + } else { + if (λ1 >= λ0) { + if (λ < λ0) λ0 = λ; + if (λ > λ1) λ1 = λ; + } else { + if (λ > λ_) { + if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ; + } else { + if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ; + } + } + } + } else { + point(λ, φ); + } + p0 = p, λ_ = λ; + } + function lineStart() { + bound.point = linePoint; + } + function lineEnd() { + range[0] = λ0, range[1] = λ1; + bound.point = point; + p0 = null; + } + function ringPoint(λ, φ) { + if (p0) { + var dλ = λ - λ_; + dλSum += abs(dλ) > 180 ? dλ + (dλ > 0 ? 360 : -360) : dλ; + } else λ__ = λ, φ__ = φ; + d3_geo_area.point(λ, φ); + linePoint(λ, φ); + } + function ringStart() { + d3_geo_area.lineStart(); + } + function ringEnd() { + ringPoint(λ__, φ__); + d3_geo_area.lineEnd(); + if (abs(dλSum) > ε) λ0 = -(λ1 = 180); + range[0] = λ0, range[1] = λ1; + p0 = null; + } + function angle(λ0, λ1) { + return (λ1 -= λ0) < 0 ? λ1 + 360 : λ1; + } + function compareRanges(a, b) { + return a[0] - b[0]; + } + function withinRange(x, range) { + return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; + } + return function(feature) { + φ1 = λ1 = -(λ0 = φ0 = Infinity); + ranges = []; + d3.geo.stream(feature, bound); + var n = ranges.length; + if (n) { + ranges.sort(compareRanges); + for (var i = 1, a = ranges[0], b, merged = [ a ]; i < n; ++i) { + b = ranges[i]; + if (withinRange(b[0], a) || withinRange(b[1], a)) { + if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1]; + if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0]; + } else { + merged.push(a = b); + } + } + var best = -Infinity, dλ; + for (var n = merged.length - 1, i = 0, a = merged[n], b; i <= n; a = b, ++i) { + b = merged[i]; + if ((dλ = angle(a[1], b[0])) > best) best = dλ, λ0 = b[0], λ1 = a[1]; + } + } + ranges = range = null; + return λ0 === Infinity || φ0 === Infinity ? [ [ NaN, NaN ], [ NaN, NaN ] ] : [ [ λ0, φ0 ], [ λ1, φ1 ] ]; + }; + }(); + d3.geo.centroid = function(object) { + d3_geo_centroidW0 = d3_geo_centroidW1 = d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0; + d3.geo.stream(object, d3_geo_centroid); + var x = d3_geo_centroidX2, y = d3_geo_centroidY2, z = d3_geo_centroidZ2, m = x * x + y * y + z * z; + if (m < ε2) { + x = d3_geo_centroidX1, y = d3_geo_centroidY1, z = d3_geo_centroidZ1; + if (d3_geo_centroidW1 < ε) x = d3_geo_centroidX0, y = d3_geo_centroidY0, z = d3_geo_centroidZ0; + m = x * x + y * y + z * z; + if (m < ε2) return [ NaN, NaN ]; + } + return [ Math.atan2(y, x) * d3_degrees, d3_asin(z / Math.sqrt(m)) * d3_degrees ]; + }; + var d3_geo_centroidW0, d3_geo_centroidW1, d3_geo_centroidX0, d3_geo_centroidY0, d3_geo_centroidZ0, d3_geo_centroidX1, d3_geo_centroidY1, d3_geo_centroidZ1, d3_geo_centroidX2, d3_geo_centroidY2, d3_geo_centroidZ2; + var d3_geo_centroid = { + sphere: d3_noop, + point: d3_geo_centroidPoint, + lineStart: d3_geo_centroidLineStart, + lineEnd: d3_geo_centroidLineEnd, + polygonStart: function() { + d3_geo_centroid.lineStart = d3_geo_centroidRingStart; + }, + polygonEnd: function() { + d3_geo_centroid.lineStart = d3_geo_centroidLineStart; + } + }; + function d3_geo_centroidPoint(λ, φ) { + λ *= d3_radians; + var cosφ = Math.cos(φ *= d3_radians); + d3_geo_centroidPointXYZ(cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ)); + } + function d3_geo_centroidPointXYZ(x, y, z) { + ++d3_geo_centroidW0; + d3_geo_centroidX0 += (x - d3_geo_centroidX0) / d3_geo_centroidW0; + d3_geo_centroidY0 += (y - d3_geo_centroidY0) / d3_geo_centroidW0; + d3_geo_centroidZ0 += (z - d3_geo_centroidZ0) / d3_geo_centroidW0; + } + function d3_geo_centroidLineStart() { + var x0, y0, z0; + d3_geo_centroid.point = function(λ, φ) { + λ *= d3_radians; + var cosφ = Math.cos(φ *= d3_radians); + x0 = cosφ * Math.cos(λ); + y0 = cosφ * Math.sin(λ); + z0 = Math.sin(φ); + d3_geo_centroid.point = nextPoint; + d3_geo_centroidPointXYZ(x0, y0, z0); + }; + function nextPoint(λ, φ) { + λ *= d3_radians; + var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); + d3_geo_centroidW1 += w; + d3_geo_centroidX1 += w * (x0 + (x0 = x)); + d3_geo_centroidY1 += w * (y0 + (y0 = y)); + d3_geo_centroidZ1 += w * (z0 + (z0 = z)); + d3_geo_centroidPointXYZ(x0, y0, z0); + } + } + function d3_geo_centroidLineEnd() { + d3_geo_centroid.point = d3_geo_centroidPoint; + } + function d3_geo_centroidRingStart() { + var λ00, φ00, x0, y0, z0; + d3_geo_centroid.point = function(λ, φ) { + λ00 = λ, φ00 = φ; + d3_geo_centroid.point = nextPoint; + λ *= d3_radians; + var cosφ = Math.cos(φ *= d3_radians); + x0 = cosφ * Math.cos(λ); + y0 = cosφ * Math.sin(λ); + z0 = Math.sin(φ); + d3_geo_centroidPointXYZ(x0, y0, z0); + }; + d3_geo_centroid.lineEnd = function() { + nextPoint(λ00, φ00); + d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd; + d3_geo_centroid.point = d3_geo_centroidPoint; + }; + function nextPoint(λ, φ) { + λ *= d3_radians; + var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = Math.sqrt(cx * cx + cy * cy + cz * cz), u = x0 * x + y0 * y + z0 * z, v = m && -d3_acos(u) / m, w = Math.atan2(m, u); + d3_geo_centroidX2 += v * cx; + d3_geo_centroidY2 += v * cy; + d3_geo_centroidZ2 += v * cz; + d3_geo_centroidW1 += w; + d3_geo_centroidX1 += w * (x0 + (x0 = x)); + d3_geo_centroidY1 += w * (y0 + (y0 = y)); + d3_geo_centroidZ1 += w * (z0 + (z0 = z)); + d3_geo_centroidPointXYZ(x0, y0, z0); + } + } + function d3_geo_compose(a, b) { + function compose(x, y) { + return x = a(x, y), b(x[0], x[1]); + } + if (a.invert && b.invert) compose.invert = function(x, y) { + return x = b.invert(x, y), x && a.invert(x[0], x[1]); + }; + return compose; + } + function d3_true() { + return true; + } + function d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener) { + var subject = [], clip = []; + segments.forEach(function(segment) { + if ((n = segment.length - 1) <= 0) return; + var n, p0 = segment[0], p1 = segment[n]; + if (d3_geo_sphericalEqual(p0, p1)) { + listener.lineStart(); + for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]); + listener.lineEnd(); + return; + } + var a = new d3_geo_clipPolygonIntersection(p0, segment, null, true), b = new d3_geo_clipPolygonIntersection(p0, null, a, false); + a.o = b; + subject.push(a); + clip.push(b); + a = new d3_geo_clipPolygonIntersection(p1, segment, null, false); + b = new d3_geo_clipPolygonIntersection(p1, null, a, true); + a.o = b; + subject.push(a); + clip.push(b); + }); + clip.sort(compare); + d3_geo_clipPolygonLinkCircular(subject); + d3_geo_clipPolygonLinkCircular(clip); + if (!subject.length) return; + for (var i = 0, entry = clipStartInside, n = clip.length; i < n; ++i) { + clip[i].e = entry = !entry; + } + var start = subject[0], points, point; + while (1) { + var current = start, isSubject = true; + while (current.v) if ((current = current.n) === start) return; + points = current.z; + listener.lineStart(); + do { + current.v = current.o.v = true; + if (current.e) { + if (isSubject) { + for (var i = 0, n = points.length; i < n; ++i) listener.point((point = points[i])[0], point[1]); + } else { + interpolate(current.x, current.n.x, 1, listener); + } + current = current.n; + } else { + if (isSubject) { + points = current.p.z; + for (var i = points.length - 1; i >= 0; --i) listener.point((point = points[i])[0], point[1]); + } else { + interpolate(current.x, current.p.x, -1, listener); + } + current = current.p; + } + current = current.o; + points = current.z; + isSubject = !isSubject; + } while (!current.v); + listener.lineEnd(); + } + } + function d3_geo_clipPolygonLinkCircular(array) { + if (!(n = array.length)) return; + var n, i = 0, a = array[0], b; + while (++i < n) { + a.n = b = array[i]; + b.p = a; + a = b; + } + a.n = b = array[0]; + b.p = a; + } + function d3_geo_clipPolygonIntersection(point, points, other, entry) { + this.x = point; + this.z = points; + this.o = other; + this.e = entry; + this.v = false; + this.n = this.p = null; + } + function d3_geo_clip(pointVisible, clipLine, interpolate, clipStart) { + return function(rotate, listener) { + var line = clipLine(listener), rotatedClipStart = rotate.invert(clipStart[0], clipStart[1]); + var clip = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + clip.point = pointRing; + clip.lineStart = ringStart; + clip.lineEnd = ringEnd; + segments = []; + polygon = []; + }, + polygonEnd: function() { + clip.point = point; + clip.lineStart = lineStart; + clip.lineEnd = lineEnd; + segments = d3.merge(segments); + var clipStartInside = d3_geo_pointInPolygon(rotatedClipStart, polygon); + if (segments.length) { + if (!polygonStarted) listener.polygonStart(), polygonStarted = true; + d3_geo_clipPolygon(segments, d3_geo_clipSort, clipStartInside, interpolate, listener); + } else if (clipStartInside) { + if (!polygonStarted) listener.polygonStart(), polygonStarted = true; + listener.lineStart(); + interpolate(null, null, 1, listener); + listener.lineEnd(); + } + if (polygonStarted) listener.polygonEnd(), polygonStarted = false; + segments = polygon = null; + }, + sphere: function() { + listener.polygonStart(); + listener.lineStart(); + interpolate(null, null, 1, listener); + listener.lineEnd(); + listener.polygonEnd(); + } + }; + function point(λ, φ) { + var point = rotate(λ, φ); + if (pointVisible(λ = point[0], φ = point[1])) listener.point(λ, φ); + } + function pointLine(λ, φ) { + var point = rotate(λ, φ); + line.point(point[0], point[1]); + } + function lineStart() { + clip.point = pointLine; + line.lineStart(); + } + function lineEnd() { + clip.point = point; + line.lineEnd(); + } + var segments; + var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), polygonStarted = false, polygon, ring; + function pointRing(λ, φ) { + ring.push([ λ, φ ]); + var point = rotate(λ, φ); + ringListener.point(point[0], point[1]); + } + function ringStart() { + ringListener.lineStart(); + ring = []; + } + function ringEnd() { + pointRing(ring[0][0], ring[0][1]); + ringListener.lineEnd(); + var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length; + ring.pop(); + polygon.push(ring); + ring = null; + if (!n) return; + if (clean & 1) { + segment = ringSegments[0]; + var n = segment.length - 1, i = -1, point; + if (n > 0) { + if (!polygonStarted) listener.polygonStart(), polygonStarted = true; + listener.lineStart(); + while (++i < n) listener.point((point = segment[i])[0], point[1]); + listener.lineEnd(); + } + return; + } + if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); + segments.push(ringSegments.filter(d3_geo_clipSegmentLength1)); + } + return clip; + }; + } + function d3_geo_clipSegmentLength1(segment) { + return segment.length > 1; + } + function d3_geo_clipBufferListener() { + var lines = [], line; + return { + lineStart: function() { + lines.push(line = []); + }, + point: function(λ, φ) { + line.push([ λ, φ ]); + }, + lineEnd: d3_noop, + buffer: function() { + var buffer = lines; + lines = []; + line = null; + return buffer; + }, + rejoin: function() { + if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); + } + }; + } + function d3_geo_clipSort(a, b) { + return ((a = a.x)[0] < 0 ? a[1] - halfπ - ε : halfπ - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfπ - ε : halfπ - b[1]); + } + var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate, [ -π, -π / 2 ]); + function d3_geo_clipAntimeridianLine(listener) { + var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean; + return { + lineStart: function() { + listener.lineStart(); + clean = 1; + }, + point: function(λ1, φ1) { + var sλ1 = λ1 > 0 ? π : -π, dλ = abs(λ1 - λ0); + if (abs(dλ - π) < ε) { + listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? halfπ : -halfπ); + listener.point(sλ0, φ0); + listener.lineEnd(); + listener.lineStart(); + listener.point(sλ1, φ0); + listener.point(λ1, φ0); + clean = 0; + } else if (sλ0 !== sλ1 && dλ >= π) { + if (abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε; + if (abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε; + φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1); + listener.point(sλ0, φ0); + listener.lineEnd(); + listener.lineStart(); + listener.point(sλ1, φ0); + clean = 0; + } + listener.point(λ0 = λ1, φ0 = φ1); + sλ0 = sλ1; + }, + lineEnd: function() { + listener.lineEnd(); + λ0 = φ0 = NaN; + }, + clean: function() { + return 2 - clean; + } + }; + } + function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) { + var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1); + return abs(sinλ0_λ1) > ε ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2; + } + function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) { + var φ; + if (from == null) { + φ = direction * halfπ; + listener.point(-π, φ); + listener.point(0, φ); + listener.point(π, φ); + listener.point(π, 0); + listener.point(π, -φ); + listener.point(0, -φ); + listener.point(-π, -φ); + listener.point(-π, 0); + listener.point(-π, φ); + } else if (abs(from[0] - to[0]) > ε) { + var s = from[0] < to[0] ? π : -π; + φ = direction * s / 2; + listener.point(-s, φ); + listener.point(0, φ); + listener.point(s, φ); + } else { + listener.point(to[0], to[1]); + } + } + function d3_geo_pointInPolygon(point, polygon) { + var meridian = point[0], parallel = point[1], meridianNormal = [ Math.sin(meridian), -Math.cos(meridian), 0 ], polarAngle = 0, winding = 0; + d3_geo_areaRingSum.reset(); + for (var i = 0, n = polygon.length; i < n; ++i) { + var ring = polygon[i], m = ring.length; + if (!m) continue; + var point0 = ring[0], λ0 = point0[0], φ0 = point0[1] / 2 + π / 4, sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), j = 1; + while (true) { + if (j === m) j = 0; + point = ring[j]; + var λ = point[0], φ = point[1] / 2 + π / 4, sinφ = Math.sin(φ), cosφ = Math.cos(φ), dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, antimeridian = adλ > π, k = sinφ0 * sinφ; + d3_geo_areaRingSum.add(Math.atan2(k * sdλ * Math.sin(adλ), cosφ0 * cosφ + k * Math.cos(adλ))); + polarAngle += antimeridian ? dλ + sdλ * τ : dλ; + if (antimeridian ^ λ0 >= meridian ^ λ >= meridian) { + var arc = d3_geo_cartesianCross(d3_geo_cartesian(point0), d3_geo_cartesian(point)); + d3_geo_cartesianNormalize(arc); + var intersection = d3_geo_cartesianCross(meridianNormal, arc); + d3_geo_cartesianNormalize(intersection); + var φarc = (antimeridian ^ dλ >= 0 ? -1 : 1) * d3_asin(intersection[2]); + if (parallel > φarc || parallel === φarc && (arc[0] || arc[1])) { + winding += antimeridian ^ dλ >= 0 ? 1 : -1; + } + } + if (!j++) break; + λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ, point0 = point; + } + } + return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < 0) ^ winding & 1; + } + function d3_geo_clipCircle(radius) { + var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = abs(cr) > ε, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians); + return d3_geo_clip(visible, clipLine, interpolate, smallRadius ? [ 0, -radius ] : [ -π, radius - π ]); + function visible(λ, φ) { + return Math.cos(λ) * Math.cos(φ) > cr; + } + function clipLine(listener) { + var point0, c0, v0, v00, clean; + return { + lineStart: function() { + v00 = v0 = false; + clean = 1; + }, + point: function(λ, φ) { + var point1 = [ λ, φ ], point2, v = visible(λ, φ), c = smallRadius ? v ? 0 : code(λ, φ) : v ? code(λ + (λ < 0 ? π : -π), φ) : 0; + if (!point0 && (v00 = v0 = v)) listener.lineStart(); + if (v !== v0) { + point2 = intersect(point0, point1); + if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) { + point1[0] += ε; + point1[1] += ε; + v = visible(point1[0], point1[1]); + } + } + if (v !== v0) { + clean = 0; + if (v) { + listener.lineStart(); + point2 = intersect(point1, point0); + listener.point(point2[0], point2[1]); + } else { + point2 = intersect(point0, point1); + listener.point(point2[0], point2[1]); + listener.lineEnd(); + } + point0 = point2; + } else if (notHemisphere && point0 && smallRadius ^ v) { + var t; + if (!(c & c0) && (t = intersect(point1, point0, true))) { + clean = 0; + if (smallRadius) { + listener.lineStart(); + listener.point(t[0][0], t[0][1]); + listener.point(t[1][0], t[1][1]); + listener.lineEnd(); + } else { + listener.point(t[1][0], t[1][1]); + listener.lineEnd(); + listener.lineStart(); + listener.point(t[0][0], t[0][1]); + } + } + } + if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) { + listener.point(point1[0], point1[1]); + } + point0 = point1, v0 = v, c0 = c; + }, + lineEnd: function() { + if (v0) listener.lineEnd(); + point0 = null; + }, + clean: function() { + return clean | (v00 && v0) << 1; + } + }; + } + function intersect(a, b, two) { + var pa = d3_geo_cartesian(a), pb = d3_geo_cartesian(b); + var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; + if (!determinant) return !two && a; + var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2); + d3_geo_cartesianAdd(A, B); + var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t2 = w * w - uu * (d3_geo_cartesianDot(A, A) - 1); + if (t2 < 0) return; + var t = Math.sqrt(t2), q = d3_geo_cartesianScale(u, (-w - t) / uu); + d3_geo_cartesianAdd(q, A); + q = d3_geo_spherical(q); + if (!two) return q; + var λ0 = a[0], λ1 = b[0], φ0 = a[1], φ1 = b[1], z; + if (λ1 < λ0) z = λ0, λ0 = λ1, λ1 = z; + var δλ = λ1 - λ0, polar = abs(δλ - π) < ε, meridian = polar || δλ < ε; + if (!polar && φ1 < φ0) z = φ0, φ0 = φ1, φ1 = z; + if (meridian ? polar ? φ0 + φ1 > 0 ^ q[1] < (abs(q[0] - λ0) < ε ? φ0 : φ1) : φ0 <= q[1] && q[1] <= φ1 : δλ > π ^ (λ0 <= q[0] && q[0] <= λ1)) { + var q1 = d3_geo_cartesianScale(u, (-w + t) / uu); + d3_geo_cartesianAdd(q1, A); + return [ q, d3_geo_spherical(q1) ]; + } + } + function code(λ, φ) { + var r = smallRadius ? radius : π - radius, code = 0; + if (λ < -r) code |= 1; else if (λ > r) code |= 2; + if (φ < -r) code |= 4; else if (φ > r) code |= 8; + return code; + } + } + function d3_geom_clipLine(x0, y0, x1, y1) { + return function(line) { + var a = line.a, b = line.b, ax = a.x, ay = a.y, bx = b.x, by = b.y, t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r; + r = x0 - ax; + if (!dx && r > 0) return; + r /= dx; + if (dx < 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } else if (dx > 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } + r = x1 - ax; + if (!dx && r < 0) return; + r /= dx; + if (dx < 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } else if (dx > 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } + r = y0 - ay; + if (!dy && r > 0) return; + r /= dy; + if (dy < 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } else if (dy > 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } + r = y1 - ay; + if (!dy && r < 0) return; + r /= dy; + if (dy < 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } else if (dy > 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } + if (t0 > 0) line.a = { + x: ax + t0 * dx, + y: ay + t0 * dy + }; + if (t1 < 1) line.b = { + x: ax + t1 * dx, + y: ay + t1 * dy + }; + return line; + }; + } + var d3_geo_clipExtentMAX = 1e9; + d3.geo.clipExtent = function() { + var x0, y0, x1, y1, stream, clip, clipExtent = { + stream: function(output) { + if (stream) stream.valid = false; + stream = clip(output); + stream.valid = true; + return stream; + }, + extent: function(_) { + if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; + clip = d3_geo_clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]); + if (stream) stream.valid = false, stream = null; + return clipExtent; + } + }; + return clipExtent.extent([ [ 0, 0 ], [ 960, 500 ] ]); + }; + function d3_geo_clipExtent(x0, y0, x1, y1) { + return function(listener) { + var listener_ = listener, bufferListener = d3_geo_clipBufferListener(), clipLine = d3_geom_clipLine(x0, y0, x1, y1), segments, polygon, ring; + var clip = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + listener = bufferListener; + segments = []; + polygon = []; + clean = true; + }, + polygonEnd: function() { + listener = listener_; + segments = d3.merge(segments); + var clipStartInside = insidePolygon([ x0, y1 ]), inside = clean && clipStartInside, visible = segments.length; + if (inside || visible) { + listener.polygonStart(); + if (inside) { + listener.lineStart(); + interpolate(null, null, 1, listener); + listener.lineEnd(); + } + if (visible) { + d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener); + } + listener.polygonEnd(); + } + segments = polygon = ring = null; + } + }; + function insidePolygon(p) { + var wn = 0, n = polygon.length, y = p[1]; + for (var i = 0; i < n; ++i) { + for (var j = 1, v = polygon[i], m = v.length, a = v[0], b; j < m; ++j) { + b = v[j]; + if (a[1] <= y) { + if (b[1] > y && d3_cross2d(a, b, p) > 0) ++wn; + } else { + if (b[1] <= y && d3_cross2d(a, b, p) < 0) --wn; + } + a = b; + } + } + return wn !== 0; + } + function interpolate(from, to, direction, listener) { + var a = 0, a1 = 0; + if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoints(from, to) < 0 ^ direction > 0) { + do { + listener.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); + } while ((a = (a + direction + 4) % 4) !== a1); + } else { + listener.point(to[0], to[1]); + } + } + function pointVisible(x, y) { + return x0 <= x && x <= x1 && y0 <= y && y <= y1; + } + function point(x, y) { + if (pointVisible(x, y)) listener.point(x, y); + } + var x__, y__, v__, x_, y_, v_, first, clean; + function lineStart() { + clip.point = linePoint; + if (polygon) polygon.push(ring = []); + first = true; + v_ = false; + x_ = y_ = NaN; + } + function lineEnd() { + if (segments) { + linePoint(x__, y__); + if (v__ && v_) bufferListener.rejoin(); + segments.push(bufferListener.buffer()); + } + clip.point = point; + if (v_) listener.lineEnd(); + } + function linePoint(x, y) { + x = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, x)); + y = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, y)); + var v = pointVisible(x, y); + if (polygon) ring.push([ x, y ]); + if (first) { + x__ = x, y__ = y, v__ = v; + first = false; + if (v) { + listener.lineStart(); + listener.point(x, y); + } + } else { + if (v && v_) listener.point(x, y); else { + var l = { + a: { + x: x_, + y: y_ + }, + b: { + x: x, + y: y + } + }; + if (clipLine(l)) { + if (!v_) { + listener.lineStart(); + listener.point(l.a.x, l.a.y); + } + listener.point(l.b.x, l.b.y); + if (!v) listener.lineEnd(); + clean = false; + } else if (v) { + listener.lineStart(); + listener.point(x, y); + clean = false; + } + } + } + x_ = x, y_ = y, v_ = v; + } + return clip; + }; + function corner(p, direction) { + return abs(p[0] - x0) < ε ? direction > 0 ? 0 : 3 : abs(p[0] - x1) < ε ? direction > 0 ? 2 : 1 : abs(p[1] - y0) < ε ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; + } + function compare(a, b) { + return comparePoints(a.x, b.x); + } + function comparePoints(a, b) { + var ca = corner(a, 1), cb = corner(b, 1); + return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0]; + } + } + function d3_geo_conic(projectAt) { + var φ0 = 0, φ1 = π / 3, m = d3_geo_projectionMutator(projectAt), p = m(φ0, φ1); + p.parallels = function(_) { + if (!arguments.length) return [ φ0 / π * 180, φ1 / π * 180 ]; + return m(φ0 = _[0] * π / 180, φ1 = _[1] * π / 180); + }; + return p; + } + function d3_geo_conicEqualArea(φ0, φ1) { + var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), ρ0 = Math.sqrt(C) / n; + function forward(λ, φ) { + var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n; + return [ ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ) ]; + } + forward.invert = function(x, y) { + var ρ0_y = ρ0 - y; + return [ Math.atan2(x, ρ0_y) / n, d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ]; + }; + return forward; + } + (d3.geo.conicEqualArea = function() { + return d3_geo_conic(d3_geo_conicEqualArea); + }).raw = d3_geo_conicEqualArea; + d3.geo.albers = function() { + return d3.geo.conicEqualArea().rotate([ 96, 0 ]).center([ -.6, 38.7 ]).parallels([ 29.5, 45.5 ]).scale(1070); + }; + d3.geo.albersUsa = function() { + var lower48 = d3.geo.albers(); + var alaska = d3.geo.conicEqualArea().rotate([ 154, 0 ]).center([ -2, 58.5 ]).parallels([ 55, 65 ]); + var hawaii = d3.geo.conicEqualArea().rotate([ 157, 0 ]).center([ -3, 19.9 ]).parallels([ 8, 18 ]); + var point, pointStream = { + point: function(x, y) { + point = [ x, y ]; + } + }, lower48Point, alaskaPoint, hawaiiPoint; + function albersUsa(coordinates) { + var x = coordinates[0], y = coordinates[1]; + point = null; + (lower48Point(x, y), point) || (alaskaPoint(x, y), point) || hawaiiPoint(x, y); + return point; + } + albersUsa.invert = function(coordinates) { + var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k; + return (y >= .12 && y < .234 && x >= -.425 && x < -.214 ? alaska : y >= .166 && y < .234 && x >= -.214 && x < -.115 ? hawaii : lower48).invert(coordinates); + }; + albersUsa.stream = function(stream) { + var lower48Stream = lower48.stream(stream), alaskaStream = alaska.stream(stream), hawaiiStream = hawaii.stream(stream); + return { + point: function(x, y) { + lower48Stream.point(x, y); + alaskaStream.point(x, y); + hawaiiStream.point(x, y); + }, + sphere: function() { + lower48Stream.sphere(); + alaskaStream.sphere(); + hawaiiStream.sphere(); + }, + lineStart: function() { + lower48Stream.lineStart(); + alaskaStream.lineStart(); + hawaiiStream.lineStart(); + }, + lineEnd: function() { + lower48Stream.lineEnd(); + alaskaStream.lineEnd(); + hawaiiStream.lineEnd(); + }, + polygonStart: function() { + lower48Stream.polygonStart(); + alaskaStream.polygonStart(); + hawaiiStream.polygonStart(); + }, + polygonEnd: function() { + lower48Stream.polygonEnd(); + alaskaStream.polygonEnd(); + hawaiiStream.polygonEnd(); + } + }; + }; + albersUsa.precision = function(_) { + if (!arguments.length) return lower48.precision(); + lower48.precision(_); + alaska.precision(_); + hawaii.precision(_); + return albersUsa; + }; + albersUsa.scale = function(_) { + if (!arguments.length) return lower48.scale(); + lower48.scale(_); + alaska.scale(_ * .35); + hawaii.scale(_); + return albersUsa.translate(lower48.translate()); + }; + albersUsa.translate = function(_) { + if (!arguments.length) return lower48.translate(); + var k = lower48.scale(), x = +_[0], y = +_[1]; + lower48Point = lower48.translate(_).clipExtent([ [ x - .455 * k, y - .238 * k ], [ x + .455 * k, y + .238 * k ] ]).stream(pointStream).point; + alaskaPoint = alaska.translate([ x - .307 * k, y + .201 * k ]).clipExtent([ [ x - .425 * k + ε, y + .12 * k + ε ], [ x - .214 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point; + hawaiiPoint = hawaii.translate([ x - .205 * k, y + .212 * k ]).clipExtent([ [ x - .214 * k + ε, y + .166 * k + ε ], [ x - .115 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point; + return albersUsa; + }; + return albersUsa.scale(1070); + }; + var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = { + point: d3_noop, + lineStart: d3_noop, + lineEnd: d3_noop, + polygonStart: function() { + d3_geo_pathAreaPolygon = 0; + d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart; + }, + polygonEnd: function() { + d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop; + d3_geo_pathAreaSum += abs(d3_geo_pathAreaPolygon / 2); + } + }; + function d3_geo_pathAreaRingStart() { + var x00, y00, x0, y0; + d3_geo_pathArea.point = function(x, y) { + d3_geo_pathArea.point = nextPoint; + x00 = x0 = x, y00 = y0 = y; + }; + function nextPoint(x, y) { + d3_geo_pathAreaPolygon += y0 * x - x0 * y; + x0 = x, y0 = y; + } + d3_geo_pathArea.lineEnd = function() { + nextPoint(x00, y00); + }; + } + var d3_geo_pathBoundsX0, d3_geo_pathBoundsY0, d3_geo_pathBoundsX1, d3_geo_pathBoundsY1; + var d3_geo_pathBounds = { + point: d3_geo_pathBoundsPoint, + lineStart: d3_noop, + lineEnd: d3_noop, + polygonStart: d3_noop, + polygonEnd: d3_noop + }; + function d3_geo_pathBoundsPoint(x, y) { + if (x < d3_geo_pathBoundsX0) d3_geo_pathBoundsX0 = x; + if (x > d3_geo_pathBoundsX1) d3_geo_pathBoundsX1 = x; + if (y < d3_geo_pathBoundsY0) d3_geo_pathBoundsY0 = y; + if (y > d3_geo_pathBoundsY1) d3_geo_pathBoundsY1 = y; + } + function d3_geo_pathBuffer() { + var pointCircle = d3_geo_pathBufferCircle(4.5), buffer = []; + var stream = { + point: point, + lineStart: function() { + stream.point = pointLineStart; + }, + lineEnd: lineEnd, + polygonStart: function() { + stream.lineEnd = lineEndPolygon; + }, + polygonEnd: function() { + stream.lineEnd = lineEnd; + stream.point = point; + }, + pointRadius: function(_) { + pointCircle = d3_geo_pathBufferCircle(_); + return stream; + }, + result: function() { + if (buffer.length) { + var result = buffer.join(""); + buffer = []; + return result; + } + } + }; + function point(x, y) { + buffer.push("M", x, ",", y, pointCircle); + } + function pointLineStart(x, y) { + buffer.push("M", x, ",", y); + stream.point = pointLine; + } + function pointLine(x, y) { + buffer.push("L", x, ",", y); + } + function lineEnd() { + stream.point = point; + } + function lineEndPolygon() { + buffer.push("Z"); + } + return stream; + } + function d3_geo_pathBufferCircle(radius) { + return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z"; + } + var d3_geo_pathCentroid = { + point: d3_geo_pathCentroidPoint, + lineStart: d3_geo_pathCentroidLineStart, + lineEnd: d3_geo_pathCentroidLineEnd, + polygonStart: function() { + d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart; + }, + polygonEnd: function() { + d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; + d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart; + d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd; + } + }; + function d3_geo_pathCentroidPoint(x, y) { + d3_geo_centroidX0 += x; + d3_geo_centroidY0 += y; + ++d3_geo_centroidZ0; + } + function d3_geo_pathCentroidLineStart() { + var x0, y0; + d3_geo_pathCentroid.point = function(x, y) { + d3_geo_pathCentroid.point = nextPoint; + d3_geo_pathCentroidPoint(x0 = x, y0 = y); + }; + function nextPoint(x, y) { + var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); + d3_geo_centroidX1 += z * (x0 + x) / 2; + d3_geo_centroidY1 += z * (y0 + y) / 2; + d3_geo_centroidZ1 += z; + d3_geo_pathCentroidPoint(x0 = x, y0 = y); + } + } + function d3_geo_pathCentroidLineEnd() { + d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; + } + function d3_geo_pathCentroidRingStart() { + var x00, y00, x0, y0; + d3_geo_pathCentroid.point = function(x, y) { + d3_geo_pathCentroid.point = nextPoint; + d3_geo_pathCentroidPoint(x00 = x0 = x, y00 = y0 = y); + }; + function nextPoint(x, y) { + var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); + d3_geo_centroidX1 += z * (x0 + x) / 2; + d3_geo_centroidY1 += z * (y0 + y) / 2; + d3_geo_centroidZ1 += z; + z = y0 * x - x0 * y; + d3_geo_centroidX2 += z * (x0 + x); + d3_geo_centroidY2 += z * (y0 + y); + d3_geo_centroidZ2 += z * 3; + d3_geo_pathCentroidPoint(x0 = x, y0 = y); + } + d3_geo_pathCentroid.lineEnd = function() { + nextPoint(x00, y00); + }; + } + function d3_geo_pathContext(context) { + var pointRadius = 4.5; + var stream = { + point: point, + lineStart: function() { + stream.point = pointLineStart; + }, + lineEnd: lineEnd, + polygonStart: function() { + stream.lineEnd = lineEndPolygon; + }, + polygonEnd: function() { + stream.lineEnd = lineEnd; + stream.point = point; + }, + pointRadius: function(_) { + pointRadius = _; + return stream; + }, + result: d3_noop + }; + function point(x, y) { + context.moveTo(x + pointRadius, y); + context.arc(x, y, pointRadius, 0, τ); + } + function pointLineStart(x, y) { + context.moveTo(x, y); + stream.point = pointLine; + } + function pointLine(x, y) { + context.lineTo(x, y); + } + function lineEnd() { + stream.point = point; + } + function lineEndPolygon() { + context.closePath(); + } + return stream; + } + function d3_geo_resample(project) { + var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16; + function resample(stream) { + return (maxDepth ? resampleRecursive : resampleNone)(stream); + } + function resampleNone(stream) { + return d3_geo_transformPoint(stream, function(x, y) { + x = project(x, y); + stream.point(x[0], x[1]); + }); + } + function resampleRecursive(stream) { + var λ00, φ00, x00, y00, a00, b00, c00, λ0, x0, y0, a0, b0, c0; + var resample = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + stream.polygonStart(); + resample.lineStart = ringStart; + }, + polygonEnd: function() { + stream.polygonEnd(); + resample.lineStart = lineStart; + } + }; + function point(x, y) { + x = project(x, y); + stream.point(x[0], x[1]); + } + function lineStart() { + x0 = NaN; + resample.point = linePoint; + stream.lineStart(); + } + function linePoint(λ, φ) { + var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ); + resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); + stream.point(x0, y0); + } + function lineEnd() { + resample.point = point; + stream.lineEnd(); + } + function ringStart() { + lineStart(); + resample.point = ringPoint; + resample.lineEnd = ringEnd; + } + function ringPoint(λ, φ) { + linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; + resample.point = linePoint; + } + function ringEnd() { + resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream); + resample.lineEnd = lineEnd; + lineEnd(); + } + return resample; + } + function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) { + var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy; + if (d2 > 4 * δ2 && depth--) { + var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = abs(abs(c) - 1) < ε || abs(λ0 - λ1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2; + if (dz * dz / d2 > δ2 || abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { + resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream); + stream.point(x2, y2); + resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream); + } + } + } + resample.precision = function(_) { + if (!arguments.length) return Math.sqrt(δ2); + maxDepth = (δ2 = _ * _) > 0 && 16; + return resample; + }; + return resample; + } + d3.geo.path = function() { + var pointRadius = 4.5, projection, context, projectStream, contextStream, cacheStream; + function path(object) { + if (object) { + if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); + if (!cacheStream || !cacheStream.valid) cacheStream = projectStream(contextStream); + d3.geo.stream(object, cacheStream); + } + return contextStream.result(); + } + path.area = function(object) { + d3_geo_pathAreaSum = 0; + d3.geo.stream(object, projectStream(d3_geo_pathArea)); + return d3_geo_pathAreaSum; + }; + path.centroid = function(object) { + d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0; + d3.geo.stream(object, projectStream(d3_geo_pathCentroid)); + return d3_geo_centroidZ2 ? [ d3_geo_centroidX2 / d3_geo_centroidZ2, d3_geo_centroidY2 / d3_geo_centroidZ2 ] : d3_geo_centroidZ1 ? [ d3_geo_centroidX1 / d3_geo_centroidZ1, d3_geo_centroidY1 / d3_geo_centroidZ1 ] : d3_geo_centroidZ0 ? [ d3_geo_centroidX0 / d3_geo_centroidZ0, d3_geo_centroidY0 / d3_geo_centroidZ0 ] : [ NaN, NaN ]; + }; + path.bounds = function(object) { + d3_geo_pathBoundsX1 = d3_geo_pathBoundsY1 = -(d3_geo_pathBoundsX0 = d3_geo_pathBoundsY0 = Infinity); + d3.geo.stream(object, projectStream(d3_geo_pathBounds)); + return [ [ d3_geo_pathBoundsX0, d3_geo_pathBoundsY0 ], [ d3_geo_pathBoundsX1, d3_geo_pathBoundsY1 ] ]; + }; + path.projection = function(_) { + if (!arguments.length) return projection; + projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity; + return reset(); + }; + path.context = function(_) { + if (!arguments.length) return context; + contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_); + if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); + return reset(); + }; + path.pointRadius = function(_) { + if (!arguments.length) return pointRadius; + pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); + return path; + }; + function reset() { + cacheStream = null; + return path; + } + return path.projection(d3.geo.albersUsa()).context(null); + }; + function d3_geo_pathProjectStream(project) { + var resample = d3_geo_resample(function(x, y) { + return project([ x * d3_degrees, y * d3_degrees ]); + }); + return function(stream) { + return d3_geo_projectionRadians(resample(stream)); + }; + } + d3.geo.transform = function(methods) { + return { + stream: function(stream) { + var transform = new d3_geo_transform(stream); + for (var k in methods) transform[k] = methods[k]; + return transform; + } + }; + }; + function d3_geo_transform(stream) { + this.stream = stream; + } + d3_geo_transform.prototype = { + point: function(x, y) { + this.stream.point(x, y); + }, + sphere: function() { + this.stream.sphere(); + }, + lineStart: function() { + this.stream.lineStart(); + }, + lineEnd: function() { + this.stream.lineEnd(); + }, + polygonStart: function() { + this.stream.polygonStart(); + }, + polygonEnd: function() { + this.stream.polygonEnd(); + } + }; + function d3_geo_transformPoint(stream, point) { + return { + point: point, + sphere: function() { + stream.sphere(); + }, + lineStart: function() { + stream.lineStart(); + }, + lineEnd: function() { + stream.lineEnd(); + }, + polygonStart: function() { + stream.polygonStart(); + }, + polygonEnd: function() { + stream.polygonEnd(); + } + }; + } + d3.geo.projection = d3_geo_projection; + d3.geo.projectionMutator = d3_geo_projectionMutator; + function d3_geo_projection(project) { + return d3_geo_projectionMutator(function() { + return project; + })(); + } + function d3_geo_projectionMutator(projectAt) { + var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) { + x = project(x, y); + return [ x[0] * k + δx, δy - x[1] * k ]; + }), k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, preclip = d3_geo_clipAntimeridian, postclip = d3_identity, clipAngle = null, clipExtent = null, stream; + function projection(point) { + point = projectRotate(point[0] * d3_radians, point[1] * d3_radians); + return [ point[0] * k + δx, δy - point[1] * k ]; + } + function invert(point) { + point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k); + return point && [ point[0] * d3_degrees, point[1] * d3_degrees ]; + } + projection.stream = function(output) { + if (stream) stream.valid = false; + stream = d3_geo_projectionRadians(preclip(rotate, projectResample(postclip(output)))); + stream.valid = true; + return stream; + }; + projection.clipAngle = function(_) { + if (!arguments.length) return clipAngle; + preclip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle((clipAngle = +_) * d3_radians); + return invalidate(); + }; + projection.clipExtent = function(_) { + if (!arguments.length) return clipExtent; + clipExtent = _; + postclip = _ ? d3_geo_clipExtent(_[0][0], _[0][1], _[1][0], _[1][1]) : d3_identity; + return invalidate(); + }; + projection.scale = function(_) { + if (!arguments.length) return k; + k = +_; + return reset(); + }; + projection.translate = function(_) { + if (!arguments.length) return [ x, y ]; + x = +_[0]; + y = +_[1]; + return reset(); + }; + projection.center = function(_) { + if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ]; + λ = _[0] % 360 * d3_radians; + φ = _[1] % 360 * d3_radians; + return reset(); + }; + projection.rotate = function(_) { + if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ]; + δλ = _[0] % 360 * d3_radians; + δφ = _[1] % 360 * d3_radians; + δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0; + return reset(); + }; + d3.rebind(projection, projectResample, "precision"); + function reset() { + projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project); + var center = project(λ, φ); + δx = x - center[0] * k; + δy = y + center[1] * k; + return invalidate(); + } + function invalidate() { + if (stream) stream.valid = false, stream = null; + return projection; + } + return function() { + project = projectAt.apply(this, arguments); + projection.invert = project.invert && invert; + return reset(); + }; + } + function d3_geo_projectionRadians(stream) { + return d3_geo_transformPoint(stream, function(x, y) { + stream.point(x * d3_radians, y * d3_radians); + }); + } + function d3_geo_equirectangular(λ, φ) { + return [ λ, φ ]; + } + (d3.geo.equirectangular = function() { + return d3_geo_projection(d3_geo_equirectangular); + }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular; + d3.geo.rotation = function(rotate) { + rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0); + function forward(coordinates) { + coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians); + return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; + } + forward.invert = function(coordinates) { + coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians); + return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; + }; + return forward; + }; + function d3_geo_identityRotation(λ, φ) { + return [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ]; + } + d3_geo_identityRotation.invert = d3_geo_equirectangular; + function d3_geo_rotation(δλ, δφ, δγ) { + return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_identityRotation; + } + function d3_geo_forwardRotationλ(δλ) { + return function(λ, φ) { + return λ += δλ, [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ]; + }; + } + function d3_geo_rotationλ(δλ) { + var rotation = d3_geo_forwardRotationλ(δλ); + rotation.invert = d3_geo_forwardRotationλ(-δλ); + return rotation; + } + function d3_geo_rotationφγ(δφ, δγ) { + var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ); + function rotation(λ, φ) { + var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ; + return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), d3_asin(k * cosδγ + y * sinδγ) ]; + } + rotation.invert = function(λ, φ) { + var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ; + return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), d3_asin(k * cosδφ - x * sinδφ) ]; + }; + return rotation; + } + d3.geo.circle = function() { + var origin = [ 0, 0 ], angle, precision = 6, interpolate; + function circle() { + var center = typeof origin === "function" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = []; + interpolate(null, null, 1, { + point: function(x, y) { + ring.push(x = rotate(x, y)); + x[0] *= d3_degrees, x[1] *= d3_degrees; + } + }); + return { + type: "Polygon", + coordinates: [ ring ] + }; + } + circle.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return circle; + }; + circle.angle = function(x) { + if (!arguments.length) return angle; + interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians); + return circle; + }; + circle.precision = function(_) { + if (!arguments.length) return precision; + interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians); + return circle; + }; + return circle.angle(90); + }; + function d3_geo_circleInterpolate(radius, precision) { + var cr = Math.cos(radius), sr = Math.sin(radius); + return function(from, to, direction, listener) { + var step = direction * precision; + if (from != null) { + from = d3_geo_circleAngle(cr, from); + to = d3_geo_circleAngle(cr, to); + if (direction > 0 ? from < to : from > to) from += direction * τ; + } else { + from = radius + direction * τ; + to = radius - .5 * step; + } + for (var point, t = from; direction > 0 ? t > to : t < to; t -= step) { + listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]); + } + }; + } + function d3_geo_circleAngle(cr, point) { + var a = d3_geo_cartesian(point); + a[0] -= cr; + d3_geo_cartesianNormalize(a); + var angle = d3_acos(-a[1]); + return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI); + } + d3.geo.distance = function(a, b) { + var Δλ = (b[0] - a[0]) * d3_radians, φ0 = a[1] * d3_radians, φ1 = b[1] * d3_radians, sinΔλ = Math.sin(Δλ), cosΔλ = Math.cos(Δλ), sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), sinφ1 = Math.sin(φ1), cosφ1 = Math.cos(φ1), t; + return Math.atan2(Math.sqrt((t = cosφ1 * sinΔλ) * t + (t = cosφ0 * sinφ1 - sinφ0 * cosφ1 * cosΔλ) * t), sinφ0 * sinφ1 + cosφ0 * cosφ1 * cosΔλ); + }; + d3.geo.graticule = function() { + var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5; + function graticule() { + return { + type: "MultiLineString", + coordinates: lines() + }; + } + function lines() { + return d3.range(Math.ceil(X0 / DX) * DX, X1, DX).map(X).concat(d3.range(Math.ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(d3.range(Math.ceil(x0 / dx) * dx, x1, dx).filter(function(x) { + return abs(x % DX) > ε; + }).map(x)).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).filter(function(y) { + return abs(y % DY) > ε; + }).map(y)); + } + graticule.lines = function() { + return lines().map(function(coordinates) { + return { + type: "LineString", + coordinates: coordinates + }; + }); + }; + graticule.outline = function() { + return { + type: "Polygon", + coordinates: [ X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ] + }; + }; + graticule.extent = function(_) { + if (!arguments.length) return graticule.minorExtent(); + return graticule.majorExtent(_).minorExtent(_); + }; + graticule.majorExtent = function(_) { + if (!arguments.length) return [ [ X0, Y0 ], [ X1, Y1 ] ]; + X0 = +_[0][0], X1 = +_[1][0]; + Y0 = +_[0][1], Y1 = +_[1][1]; + if (X0 > X1) _ = X0, X0 = X1, X1 = _; + if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; + return graticule.precision(precision); + }; + graticule.minorExtent = function(_) { + if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; + x0 = +_[0][0], x1 = +_[1][0]; + y0 = +_[0][1], y1 = +_[1][1]; + if (x0 > x1) _ = x0, x0 = x1, x1 = _; + if (y0 > y1) _ = y0, y0 = y1, y1 = _; + return graticule.precision(precision); + }; + graticule.step = function(_) { + if (!arguments.length) return graticule.minorStep(); + return graticule.majorStep(_).minorStep(_); + }; + graticule.majorStep = function(_) { + if (!arguments.length) return [ DX, DY ]; + DX = +_[0], DY = +_[1]; + return graticule; + }; + graticule.minorStep = function(_) { + if (!arguments.length) return [ dx, dy ]; + dx = +_[0], dy = +_[1]; + return graticule; + }; + graticule.precision = function(_) { + if (!arguments.length) return precision; + precision = +_; + x = d3_geo_graticuleX(y0, y1, 90); + y = d3_geo_graticuleY(x0, x1, precision); + X = d3_geo_graticuleX(Y0, Y1, 90); + Y = d3_geo_graticuleY(X0, X1, precision); + return graticule; + }; + return graticule.majorExtent([ [ -180, -90 + ε ], [ 180, 90 - ε ] ]).minorExtent([ [ -180, -80 - ε ], [ 180, 80 + ε ] ]); + }; + function d3_geo_graticuleX(y0, y1, dy) { + var y = d3.range(y0, y1 - ε, dy).concat(y1); + return function(x) { + return y.map(function(y) { + return [ x, y ]; + }); + }; + } + function d3_geo_graticuleY(x0, x1, dx) { + var x = d3.range(x0, x1 - ε, dx).concat(x1); + return function(y) { + return x.map(function(x) { + return [ x, y ]; + }); + }; + } + function d3_source(d) { + return d.source; + } + function d3_target(d) { + return d.target; + } + d3.geo.greatArc = function() { + var source = d3_source, source_, target = d3_target, target_; + function greatArc() { + return { + type: "LineString", + coordinates: [ source_ || source.apply(this, arguments), target_ || target.apply(this, arguments) ] + }; + } + greatArc.distance = function() { + return d3.geo.distance(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments)); + }; + greatArc.source = function(_) { + if (!arguments.length) return source; + source = _, source_ = typeof _ === "function" ? null : _; + return greatArc; + }; + greatArc.target = function(_) { + if (!arguments.length) return target; + target = _, target_ = typeof _ === "function" ? null : _; + return greatArc; + }; + greatArc.precision = function() { + return arguments.length ? greatArc : 0; + }; + return greatArc; + }; + d3.geo.interpolate = function(source, target) { + return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians); + }; + function d3_geo_interpolate(x0, y0, x1, y1) { + var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = 2 * Math.asin(Math.sqrt(d3_haversin(y1 - y0) + cy0 * cy1 * d3_haversin(x1 - x0))), k = 1 / Math.sin(d); + var interpolate = d ? function(t) { + var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1; + return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ]; + } : function() { + return [ x0 * d3_degrees, y0 * d3_degrees ]; + }; + interpolate.distance = d; + return interpolate; + } + d3.geo.length = function(object) { + d3_geo_lengthSum = 0; + d3.geo.stream(object, d3_geo_length); + return d3_geo_lengthSum; + }; + var d3_geo_lengthSum; + var d3_geo_length = { + sphere: d3_noop, + point: d3_noop, + lineStart: d3_geo_lengthLineStart, + lineEnd: d3_noop, + polygonStart: d3_noop, + polygonEnd: d3_noop + }; + function d3_geo_lengthLineStart() { + var λ0, sinφ0, cosφ0; + d3_geo_length.point = function(λ, φ) { + λ0 = λ * d3_radians, sinφ0 = Math.sin(φ *= d3_radians), cosφ0 = Math.cos(φ); + d3_geo_length.point = nextPoint; + }; + d3_geo_length.lineEnd = function() { + d3_geo_length.point = d3_geo_length.lineEnd = d3_noop; + }; + function nextPoint(λ, φ) { + var sinφ = Math.sin(φ *= d3_radians), cosφ = Math.cos(φ), t = abs((λ *= d3_radians) - λ0), cosΔλ = Math.cos(t); + d3_geo_lengthSum += Math.atan2(Math.sqrt((t = cosφ * Math.sin(t)) * t + (t = cosφ0 * sinφ - sinφ0 * cosφ * cosΔλ) * t), sinφ0 * sinφ + cosφ0 * cosφ * cosΔλ); + λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ; + } + } + function d3_geo_azimuthal(scale, angle) { + function azimuthal(λ, φ) { + var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ); + return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ]; + } + azimuthal.invert = function(x, y) { + var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c); + return [ Math.atan2(x * sinc, ρ * cosc), Math.asin(ρ && y * sinc / ρ) ]; + }; + return azimuthal; + } + var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) { + return Math.sqrt(2 / (1 + cosλcosφ)); + }, function(ρ) { + return 2 * Math.asin(ρ / 2); + }); + (d3.geo.azimuthalEqualArea = function() { + return d3_geo_projection(d3_geo_azimuthalEqualArea); + }).raw = d3_geo_azimuthalEqualArea; + var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) { + var c = Math.acos(cosλcosφ); + return c && c / Math.sin(c); + }, d3_identity); + (d3.geo.azimuthalEquidistant = function() { + return d3_geo_projection(d3_geo_azimuthalEquidistant); + }).raw = d3_geo_azimuthalEquidistant; + function d3_geo_conicConformal(φ0, φ1) { + var cosφ0 = Math.cos(φ0), t = function(φ) { + return Math.tan(π / 4 + φ / 2); + }, n = φ0 === φ1 ? Math.sin(φ0) : Math.log(cosφ0 / Math.cos(φ1)) / Math.log(t(φ1) / t(φ0)), F = cosφ0 * Math.pow(t(φ0), n) / n; + if (!n) return d3_geo_mercator; + function forward(λ, φ) { + if (F > 0) { + if (φ < -halfπ + ε) φ = -halfπ + ε; + } else { + if (φ > halfπ - ε) φ = halfπ - ε; + } + var ρ = F / Math.pow(t(φ), n); + return [ ρ * Math.sin(n * λ), F - ρ * Math.cos(n * λ) ]; + } + forward.invert = function(x, y) { + var ρ0_y = F - y, ρ = d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y); + return [ Math.atan2(x, ρ0_y) / n, 2 * Math.atan(Math.pow(F / ρ, 1 / n)) - halfπ ]; + }; + return forward; + } + (d3.geo.conicConformal = function() { + return d3_geo_conic(d3_geo_conicConformal); + }).raw = d3_geo_conicConformal; + function d3_geo_conicEquidistant(φ0, φ1) { + var cosφ0 = Math.cos(φ0), n = φ0 === φ1 ? Math.sin(φ0) : (cosφ0 - Math.cos(φ1)) / (φ1 - φ0), G = cosφ0 / n + φ0; + if (abs(n) < ε) return d3_geo_equirectangular; + function forward(λ, φ) { + var ρ = G - φ; + return [ ρ * Math.sin(n * λ), G - ρ * Math.cos(n * λ) ]; + } + forward.invert = function(x, y) { + var ρ0_y = G - y; + return [ Math.atan2(x, ρ0_y) / n, G - d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y) ]; + }; + return forward; + } + (d3.geo.conicEquidistant = function() { + return d3_geo_conic(d3_geo_conicEquidistant); + }).raw = d3_geo_conicEquidistant; + var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) { + return 1 / cosλcosφ; + }, Math.atan); + (d3.geo.gnomonic = function() { + return d3_geo_projection(d3_geo_gnomonic); + }).raw = d3_geo_gnomonic; + function d3_geo_mercator(λ, φ) { + return [ λ, Math.log(Math.tan(π / 4 + φ / 2)) ]; + } + d3_geo_mercator.invert = function(x, y) { + return [ x, 2 * Math.atan(Math.exp(y)) - halfπ ]; + }; + function d3_geo_mercatorProjection(project) { + var m = d3_geo_projection(project), scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, clipAuto; + m.scale = function() { + var v = scale.apply(m, arguments); + return v === m ? clipAuto ? m.clipExtent(null) : m : v; + }; + m.translate = function() { + var v = translate.apply(m, arguments); + return v === m ? clipAuto ? m.clipExtent(null) : m : v; + }; + m.clipExtent = function(_) { + var v = clipExtent.apply(m, arguments); + if (v === m) { + if (clipAuto = _ == null) { + var k = π * scale(), t = translate(); + clipExtent([ [ t[0] - k, t[1] - k ], [ t[0] + k, t[1] + k ] ]); + } + } else if (clipAuto) { + v = null; + } + return v; + }; + return m.clipExtent(null); + } + (d3.geo.mercator = function() { + return d3_geo_mercatorProjection(d3_geo_mercator); + }).raw = d3_geo_mercator; + var d3_geo_orthographic = d3_geo_azimuthal(function() { + return 1; + }, Math.asin); + (d3.geo.orthographic = function() { + return d3_geo_projection(d3_geo_orthographic); + }).raw = d3_geo_orthographic; + var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) { + return 1 / (1 + cosλcosφ); + }, function(ρ) { + return 2 * Math.atan(ρ); + }); + (d3.geo.stereographic = function() { + return d3_geo_projection(d3_geo_stereographic); + }).raw = d3_geo_stereographic; + function d3_geo_transverseMercator(λ, φ) { + return [ Math.log(Math.tan(π / 4 + φ / 2)), -λ ]; + } + d3_geo_transverseMercator.invert = function(x, y) { + return [ -y, 2 * Math.atan(Math.exp(x)) - halfπ ]; + }; + (d3.geo.transverseMercator = function() { + var projection = d3_geo_mercatorProjection(d3_geo_transverseMercator), center = projection.center, rotate = projection.rotate; + projection.center = function(_) { + return _ ? center([ -_[1], _[0] ]) : (_ = center(), [ _[1], -_[0] ]); + }; + projection.rotate = function(_) { + return _ ? rotate([ _[0], _[1], _.length > 2 ? _[2] + 90 : 90 ]) : (_ = rotate(), + [ _[0], _[1], _[2] - 90 ]); + }; + return rotate([ 0, 0, 90 ]); + }).raw = d3_geo_transverseMercator; + d3.geom = {}; + function d3_geom_pointX(d) { + return d[0]; + } + function d3_geom_pointY(d) { + return d[1]; + } + d3.geom.hull = function(vertices) { + var x = d3_geom_pointX, y = d3_geom_pointY; + if (arguments.length) return hull(vertices); + function hull(data) { + if (data.length < 3) return []; + var fx = d3_functor(x), fy = d3_functor(y), i, n = data.length, points = [], flippedPoints = []; + for (i = 0; i < n; i++) { + points.push([ +fx.call(this, data[i], i), +fy.call(this, data[i], i), i ]); + } + points.sort(d3_geom_hullOrder); + for (i = 0; i < n; i++) flippedPoints.push([ points[i][0], -points[i][1] ]); + var upper = d3_geom_hullUpper(points), lower = d3_geom_hullUpper(flippedPoints); + var skipLeft = lower[0] === upper[0], skipRight = lower[lower.length - 1] === upper[upper.length - 1], polygon = []; + for (i = upper.length - 1; i >= 0; --i) polygon.push(data[points[upper[i]][2]]); + for (i = +skipLeft; i < lower.length - skipRight; ++i) polygon.push(data[points[lower[i]][2]]); + return polygon; + } + hull.x = function(_) { + return arguments.length ? (x = _, hull) : x; + }; + hull.y = function(_) { + return arguments.length ? (y = _, hull) : y; + }; + return hull; + }; + function d3_geom_hullUpper(points) { + var n = points.length, hull = [ 0, 1 ], hs = 2; + for (var i = 2; i < n; i++) { + while (hs > 1 && d3_cross2d(points[hull[hs - 2]], points[hull[hs - 1]], points[i]) <= 0) --hs; + hull[hs++] = i; + } + return hull.slice(0, hs); + } + function d3_geom_hullOrder(a, b) { + return a[0] - b[0] || a[1] - b[1]; + } + d3.geom.polygon = function(coordinates) { + d3_subclass(coordinates, d3_geom_polygonPrototype); + return coordinates; + }; + var d3_geom_polygonPrototype = d3.geom.polygon.prototype = []; + d3_geom_polygonPrototype.area = function() { + var i = -1, n = this.length, a, b = this[n - 1], area = 0; + while (++i < n) { + a = b; + b = this[i]; + area += a[1] * b[0] - a[0] * b[1]; + } + return area * .5; + }; + d3_geom_polygonPrototype.centroid = function(k) { + var i = -1, n = this.length, x = 0, y = 0, a, b = this[n - 1], c; + if (!arguments.length) k = -1 / (6 * this.area()); + while (++i < n) { + a = b; + b = this[i]; + c = a[0] * b[1] - b[0] * a[1]; + x += (a[0] + b[0]) * c; + y += (a[1] + b[1]) * c; + } + return [ x * k, y * k ]; + }; + d3_geom_polygonPrototype.clip = function(subject) { + var input, closed = d3_geom_polygonClosed(subject), i = -1, n = this.length - d3_geom_polygonClosed(this), j, m, a = this[n - 1], b, c, d; + while (++i < n) { + input = subject.slice(); + subject.length = 0; + b = this[i]; + c = input[(m = input.length - closed) - 1]; + j = -1; + while (++j < m) { + d = input[j]; + if (d3_geom_polygonInside(d, a, b)) { + if (!d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + subject.push(d); + } else if (d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + c = d; + } + if (closed) subject.push(subject[0]); + a = b; + } + return subject; + }; + function d3_geom_polygonInside(p, a, b) { + return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); + } + function d3_geom_polygonIntersect(c, d, a, b) { + var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21); + return [ x1 + ua * x21, y1 + ua * y21 ]; + } + function d3_geom_polygonClosed(coordinates) { + var a = coordinates[0], b = coordinates[coordinates.length - 1]; + return !(a[0] - b[0] || a[1] - b[1]); + } + var d3_geom_voronoiEdges, d3_geom_voronoiCells, d3_geom_voronoiBeaches, d3_geom_voronoiBeachPool = [], d3_geom_voronoiFirstCircle, d3_geom_voronoiCircles, d3_geom_voronoiCirclePool = []; + function d3_geom_voronoiBeach() { + d3_geom_voronoiRedBlackNode(this); + this.edge = this.site = this.circle = null; + } + function d3_geom_voronoiCreateBeach(site) { + var beach = d3_geom_voronoiBeachPool.pop() || new d3_geom_voronoiBeach(); + beach.site = site; + return beach; + } + function d3_geom_voronoiDetachBeach(beach) { + d3_geom_voronoiDetachCircle(beach); + d3_geom_voronoiBeaches.remove(beach); + d3_geom_voronoiBeachPool.push(beach); + d3_geom_voronoiRedBlackNode(beach); + } + function d3_geom_voronoiRemoveBeach(beach) { + var circle = beach.circle, x = circle.x, y = circle.cy, vertex = { + x: x, + y: y + }, previous = beach.P, next = beach.N, disappearing = [ beach ]; + d3_geom_voronoiDetachBeach(beach); + var lArc = previous; + while (lArc.circle && abs(x - lArc.circle.x) < ε && abs(y - lArc.circle.cy) < ε) { + previous = lArc.P; + disappearing.unshift(lArc); + d3_geom_voronoiDetachBeach(lArc); + lArc = previous; + } + disappearing.unshift(lArc); + d3_geom_voronoiDetachCircle(lArc); + var rArc = next; + while (rArc.circle && abs(x - rArc.circle.x) < ε && abs(y - rArc.circle.cy) < ε) { + next = rArc.N; + disappearing.push(rArc); + d3_geom_voronoiDetachBeach(rArc); + rArc = next; + } + disappearing.push(rArc); + d3_geom_voronoiDetachCircle(rArc); + var nArcs = disappearing.length, iArc; + for (iArc = 1; iArc < nArcs; ++iArc) { + rArc = disappearing[iArc]; + lArc = disappearing[iArc - 1]; + d3_geom_voronoiSetEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex); + } + lArc = disappearing[0]; + rArc = disappearing[nArcs - 1]; + rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, rArc.site, null, vertex); + d3_geom_voronoiAttachCircle(lArc); + d3_geom_voronoiAttachCircle(rArc); + } + function d3_geom_voronoiAddBeach(site) { + var x = site.x, directrix = site.y, lArc, rArc, dxl, dxr, node = d3_geom_voronoiBeaches._; + while (node) { + dxl = d3_geom_voronoiLeftBreakPoint(node, directrix) - x; + if (dxl > ε) node = node.L; else { + dxr = x - d3_geom_voronoiRightBreakPoint(node, directrix); + if (dxr > ε) { + if (!node.R) { + lArc = node; + break; + } + node = node.R; + } else { + if (dxl > -ε) { + lArc = node.P; + rArc = node; + } else if (dxr > -ε) { + lArc = node; + rArc = node.N; + } else { + lArc = rArc = node; + } + break; + } + } + } + var newArc = d3_geom_voronoiCreateBeach(site); + d3_geom_voronoiBeaches.insert(lArc, newArc); + if (!lArc && !rArc) return; + if (lArc === rArc) { + d3_geom_voronoiDetachCircle(lArc); + rArc = d3_geom_voronoiCreateBeach(lArc.site); + d3_geom_voronoiBeaches.insert(newArc, rArc); + newArc.edge = rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site); + d3_geom_voronoiAttachCircle(lArc); + d3_geom_voronoiAttachCircle(rArc); + return; + } + if (!rArc) { + newArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site); + return; + } + d3_geom_voronoiDetachCircle(lArc); + d3_geom_voronoiDetachCircle(rArc); + var lSite = lArc.site, ax = lSite.x, ay = lSite.y, bx = site.x - ax, by = site.y - ay, rSite = rArc.site, cx = rSite.x - ax, cy = rSite.y - ay, d = 2 * (bx * cy - by * cx), hb = bx * bx + by * by, hc = cx * cx + cy * cy, vertex = { + x: (cy * hb - by * hc) / d + ax, + y: (bx * hc - cx * hb) / d + ay + }; + d3_geom_voronoiSetEdgeEnd(rArc.edge, lSite, rSite, vertex); + newArc.edge = d3_geom_voronoiCreateEdge(lSite, site, null, vertex); + rArc.edge = d3_geom_voronoiCreateEdge(site, rSite, null, vertex); + d3_geom_voronoiAttachCircle(lArc); + d3_geom_voronoiAttachCircle(rArc); + } + function d3_geom_voronoiLeftBreakPoint(arc, directrix) { + var site = arc.site, rfocx = site.x, rfocy = site.y, pby2 = rfocy - directrix; + if (!pby2) return rfocx; + var lArc = arc.P; + if (!lArc) return -Infinity; + site = lArc.site; + var lfocx = site.x, lfocy = site.y, plby2 = lfocy - directrix; + if (!plby2) return lfocx; + var hl = lfocx - rfocx, aby2 = 1 / pby2 - 1 / plby2, b = hl / plby2; + if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx; + return (rfocx + lfocx) / 2; + } + function d3_geom_voronoiRightBreakPoint(arc, directrix) { + var rArc = arc.N; + if (rArc) return d3_geom_voronoiLeftBreakPoint(rArc, directrix); + var site = arc.site; + return site.y === directrix ? site.x : Infinity; + } + function d3_geom_voronoiCell(site) { + this.site = site; + this.edges = []; + } + d3_geom_voronoiCell.prototype.prepare = function() { + var halfEdges = this.edges, iHalfEdge = halfEdges.length, edge; + while (iHalfEdge--) { + edge = halfEdges[iHalfEdge].edge; + if (!edge.b || !edge.a) halfEdges.splice(iHalfEdge, 1); + } + halfEdges.sort(d3_geom_voronoiHalfEdgeOrder); + return halfEdges.length; + }; + function d3_geom_voronoiCloseCells(extent) { + var x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], x2, y2, x3, y3, cells = d3_geom_voronoiCells, iCell = cells.length, cell, iHalfEdge, halfEdges, nHalfEdges, start, end; + while (iCell--) { + cell = cells[iCell]; + if (!cell || !cell.prepare()) continue; + halfEdges = cell.edges; + nHalfEdges = halfEdges.length; + iHalfEdge = 0; + while (iHalfEdge < nHalfEdges) { + end = halfEdges[iHalfEdge].end(), x3 = end.x, y3 = end.y; + start = halfEdges[++iHalfEdge % nHalfEdges].start(), x2 = start.x, y2 = start.y; + if (abs(x3 - x2) > ε || abs(y3 - y2) > ε) { + halfEdges.splice(iHalfEdge, 0, new d3_geom_voronoiHalfEdge(d3_geom_voronoiCreateBorderEdge(cell.site, end, abs(x3 - x0) < ε && y1 - y3 > ε ? { + x: x0, + y: abs(x2 - x0) < ε ? y2 : y1 + } : abs(y3 - y1) < ε && x1 - x3 > ε ? { + x: abs(y2 - y1) < ε ? x2 : x1, + y: y1 + } : abs(x3 - x1) < ε && y3 - y0 > ε ? { + x: x1, + y: abs(x2 - x1) < ε ? y2 : y0 + } : abs(y3 - y0) < ε && x3 - x0 > ε ? { + x: abs(y2 - y0) < ε ? x2 : x0, + y: y0 + } : null), cell.site, null)); + ++nHalfEdges; + } + } + } + } + function d3_geom_voronoiHalfEdgeOrder(a, b) { + return b.angle - a.angle; + } + function d3_geom_voronoiCircle() { + d3_geom_voronoiRedBlackNode(this); + this.x = this.y = this.arc = this.site = this.cy = null; + } + function d3_geom_voronoiAttachCircle(arc) { + var lArc = arc.P, rArc = arc.N; + if (!lArc || !rArc) return; + var lSite = lArc.site, cSite = arc.site, rSite = rArc.site; + if (lSite === rSite) return; + var bx = cSite.x, by = cSite.y, ax = lSite.x - bx, ay = lSite.y - by, cx = rSite.x - bx, cy = rSite.y - by; + var d = 2 * (ax * cy - ay * cx); + if (d >= -ε2) return; + var ha = ax * ax + ay * ay, hc = cx * cx + cy * cy, x = (cy * ha - ay * hc) / d, y = (ax * hc - cx * ha) / d, cy = y + by; + var circle = d3_geom_voronoiCirclePool.pop() || new d3_geom_voronoiCircle(); + circle.arc = arc; + circle.site = cSite; + circle.x = x + bx; + circle.y = cy + Math.sqrt(x * x + y * y); + circle.cy = cy; + arc.circle = circle; + var before = null, node = d3_geom_voronoiCircles._; + while (node) { + if (circle.y < node.y || circle.y === node.y && circle.x <= node.x) { + if (node.L) node = node.L; else { + before = node.P; + break; + } + } else { + if (node.R) node = node.R; else { + before = node; + break; + } + } + } + d3_geom_voronoiCircles.insert(before, circle); + if (!before) d3_geom_voronoiFirstCircle = circle; + } + function d3_geom_voronoiDetachCircle(arc) { + var circle = arc.circle; + if (circle) { + if (!circle.P) d3_geom_voronoiFirstCircle = circle.N; + d3_geom_voronoiCircles.remove(circle); + d3_geom_voronoiCirclePool.push(circle); + d3_geom_voronoiRedBlackNode(circle); + arc.circle = null; + } + } + function d3_geom_voronoiClipEdges(extent) { + var edges = d3_geom_voronoiEdges, clip = d3_geom_clipLine(extent[0][0], extent[0][1], extent[1][0], extent[1][1]), i = edges.length, e; + while (i--) { + e = edges[i]; + if (!d3_geom_voronoiConnectEdge(e, extent) || !clip(e) || abs(e.a.x - e.b.x) < ε && abs(e.a.y - e.b.y) < ε) { + e.a = e.b = null; + edges.splice(i, 1); + } + } + } + function d3_geom_voronoiConnectEdge(edge, extent) { + var vb = edge.b; + if (vb) return true; + var va = edge.a, x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], lSite = edge.l, rSite = edge.r, lx = lSite.x, ly = lSite.y, rx = rSite.x, ry = rSite.y, fx = (lx + rx) / 2, fy = (ly + ry) / 2, fm, fb; + if (ry === ly) { + if (fx < x0 || fx >= x1) return; + if (lx > rx) { + if (!va) va = { + x: fx, + y: y0 + }; else if (va.y >= y1) return; + vb = { + x: fx, + y: y1 + }; + } else { + if (!va) va = { + x: fx, + y: y1 + }; else if (va.y < y0) return; + vb = { + x: fx, + y: y0 + }; + } + } else { + fm = (lx - rx) / (ry - ly); + fb = fy - fm * fx; + if (fm < -1 || fm > 1) { + if (lx > rx) { + if (!va) va = { + x: (y0 - fb) / fm, + y: y0 + }; else if (va.y >= y1) return; + vb = { + x: (y1 - fb) / fm, + y: y1 + }; + } else { + if (!va) va = { + x: (y1 - fb) / fm, + y: y1 + }; else if (va.y < y0) return; + vb = { + x: (y0 - fb) / fm, + y: y0 + }; + } + } else { + if (ly < ry) { + if (!va) va = { + x: x0, + y: fm * x0 + fb + }; else if (va.x >= x1) return; + vb = { + x: x1, + y: fm * x1 + fb + }; + } else { + if (!va) va = { + x: x1, + y: fm * x1 + fb + }; else if (va.x < x0) return; + vb = { + x: x0, + y: fm * x0 + fb + }; + } + } + } + edge.a = va; + edge.b = vb; + return true; + } + function d3_geom_voronoiEdge(lSite, rSite) { + this.l = lSite; + this.r = rSite; + this.a = this.b = null; + } + function d3_geom_voronoiCreateEdge(lSite, rSite, va, vb) { + var edge = new d3_geom_voronoiEdge(lSite, rSite); + d3_geom_voronoiEdges.push(edge); + if (va) d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, va); + if (vb) d3_geom_voronoiSetEdgeEnd(edge, rSite, lSite, vb); + d3_geom_voronoiCells[lSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, lSite, rSite)); + d3_geom_voronoiCells[rSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, rSite, lSite)); + return edge; + } + function d3_geom_voronoiCreateBorderEdge(lSite, va, vb) { + var edge = new d3_geom_voronoiEdge(lSite, null); + edge.a = va; + edge.b = vb; + d3_geom_voronoiEdges.push(edge); + return edge; + } + function d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, vertex) { + if (!edge.a && !edge.b) { + edge.a = vertex; + edge.l = lSite; + edge.r = rSite; + } else if (edge.l === rSite) { + edge.b = vertex; + } else { + edge.a = vertex; + } + } + function d3_geom_voronoiHalfEdge(edge, lSite, rSite) { + var va = edge.a, vb = edge.b; + this.edge = edge; + this.site = lSite; + this.angle = rSite ? Math.atan2(rSite.y - lSite.y, rSite.x - lSite.x) : edge.l === lSite ? Math.atan2(vb.x - va.x, va.y - vb.y) : Math.atan2(va.x - vb.x, vb.y - va.y); + } + d3_geom_voronoiHalfEdge.prototype = { + start: function() { + return this.edge.l === this.site ? this.edge.a : this.edge.b; + }, + end: function() { + return this.edge.l === this.site ? this.edge.b : this.edge.a; + } + }; + function d3_geom_voronoiRedBlackTree() { + this._ = null; + } + function d3_geom_voronoiRedBlackNode(node) { + node.U = node.C = node.L = node.R = node.P = node.N = null; + } + d3_geom_voronoiRedBlackTree.prototype = { + insert: function(after, node) { + var parent, grandpa, uncle; + if (after) { + node.P = after; + node.N = after.N; + if (after.N) after.N.P = node; + after.N = node; + if (after.R) { + after = after.R; + while (after.L) after = after.L; + after.L = node; + } else { + after.R = node; + } + parent = after; + } else if (this._) { + after = d3_geom_voronoiRedBlackFirst(this._); + node.P = null; + node.N = after; + after.P = after.L = node; + parent = after; + } else { + node.P = node.N = null; + this._ = node; + parent = null; + } + node.L = node.R = null; + node.U = parent; + node.C = true; + after = node; + while (parent && parent.C) { + grandpa = parent.U; + if (parent === grandpa.L) { + uncle = grandpa.R; + if (uncle && uncle.C) { + parent.C = uncle.C = false; + grandpa.C = true; + after = grandpa; + } else { + if (after === parent.R) { + d3_geom_voronoiRedBlackRotateLeft(this, parent); + after = parent; + parent = after.U; + } + parent.C = false; + grandpa.C = true; + d3_geom_voronoiRedBlackRotateRight(this, grandpa); + } + } else { + uncle = grandpa.L; + if (uncle && uncle.C) { + parent.C = uncle.C = false; + grandpa.C = true; + after = grandpa; + } else { + if (after === parent.L) { + d3_geom_voronoiRedBlackRotateRight(this, parent); + after = parent; + parent = after.U; + } + parent.C = false; + grandpa.C = true; + d3_geom_voronoiRedBlackRotateLeft(this, grandpa); + } + } + parent = after.U; + } + this._.C = false; + }, + remove: function(node) { + if (node.N) node.N.P = node.P; + if (node.P) node.P.N = node.N; + node.N = node.P = null; + var parent = node.U, sibling, left = node.L, right = node.R, next, red; + if (!left) next = right; else if (!right) next = left; else next = d3_geom_voronoiRedBlackFirst(right); + if (parent) { + if (parent.L === node) parent.L = next; else parent.R = next; + } else { + this._ = next; + } + if (left && right) { + red = next.C; + next.C = node.C; + next.L = left; + left.U = next; + if (next !== right) { + parent = next.U; + next.U = node.U; + node = next.R; + parent.L = node; + next.R = right; + right.U = next; + } else { + next.U = parent; + parent = next; + node = next.R; + } + } else { + red = node.C; + node = next; + } + if (node) node.U = parent; + if (red) return; + if (node && node.C) { + node.C = false; + return; + } + do { + if (node === this._) break; + if (node === parent.L) { + sibling = parent.R; + if (sibling.C) { + sibling.C = false; + parent.C = true; + d3_geom_voronoiRedBlackRotateLeft(this, parent); + sibling = parent.R; + } + if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) { + if (!sibling.R || !sibling.R.C) { + sibling.L.C = false; + sibling.C = true; + d3_geom_voronoiRedBlackRotateRight(this, sibling); + sibling = parent.R; + } + sibling.C = parent.C; + parent.C = sibling.R.C = false; + d3_geom_voronoiRedBlackRotateLeft(this, parent); + node = this._; + break; + } + } else { + sibling = parent.L; + if (sibling.C) { + sibling.C = false; + parent.C = true; + d3_geom_voronoiRedBlackRotateRight(this, parent); + sibling = parent.L; + } + if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) { + if (!sibling.L || !sibling.L.C) { + sibling.R.C = false; + sibling.C = true; + d3_geom_voronoiRedBlackRotateLeft(this, sibling); + sibling = parent.L; + } + sibling.C = parent.C; + parent.C = sibling.L.C = false; + d3_geom_voronoiRedBlackRotateRight(this, parent); + node = this._; + break; + } + } + sibling.C = true; + node = parent; + parent = parent.U; + } while (!node.C); + if (node) node.C = false; + } + }; + function d3_geom_voronoiRedBlackRotateLeft(tree, node) { + var p = node, q = node.R, parent = p.U; + if (parent) { + if (parent.L === p) parent.L = q; else parent.R = q; + } else { + tree._ = q; + } + q.U = parent; + p.U = q; + p.R = q.L; + if (p.R) p.R.U = p; + q.L = p; + } + function d3_geom_voronoiRedBlackRotateRight(tree, node) { + var p = node, q = node.L, parent = p.U; + if (parent) { + if (parent.L === p) parent.L = q; else parent.R = q; + } else { + tree._ = q; + } + q.U = parent; + p.U = q; + p.L = q.R; + if (p.L) p.L.U = p; + q.R = p; + } + function d3_geom_voronoiRedBlackFirst(node) { + while (node.L) node = node.L; + return node; + } + function d3_geom_voronoi(sites, bbox) { + var site = sites.sort(d3_geom_voronoiVertexOrder).pop(), x0, y0, circle; + d3_geom_voronoiEdges = []; + d3_geom_voronoiCells = new Array(sites.length); + d3_geom_voronoiBeaches = new d3_geom_voronoiRedBlackTree(); + d3_geom_voronoiCircles = new d3_geom_voronoiRedBlackTree(); + while (true) { + circle = d3_geom_voronoiFirstCircle; + if (site && (!circle || site.y < circle.y || site.y === circle.y && site.x < circle.x)) { + if (site.x !== x0 || site.y !== y0) { + d3_geom_voronoiCells[site.i] = new d3_geom_voronoiCell(site); + d3_geom_voronoiAddBeach(site); + x0 = site.x, y0 = site.y; + } + site = sites.pop(); + } else if (circle) { + d3_geom_voronoiRemoveBeach(circle.arc); + } else { + break; + } + } + if (bbox) d3_geom_voronoiClipEdges(bbox), d3_geom_voronoiCloseCells(bbox); + var diagram = { + cells: d3_geom_voronoiCells, + edges: d3_geom_voronoiEdges + }; + d3_geom_voronoiBeaches = d3_geom_voronoiCircles = d3_geom_voronoiEdges = d3_geom_voronoiCells = null; + return diagram; + } + function d3_geom_voronoiVertexOrder(a, b) { + return b.y - a.y || b.x - a.x; + } + d3.geom.voronoi = function(points) { + var x = d3_geom_pointX, y = d3_geom_pointY, fx = x, fy = y, clipExtent = d3_geom_voronoiClipExtent; + if (points) return voronoi(points); + function voronoi(data) { + var polygons = new Array(data.length), x0 = clipExtent[0][0], y0 = clipExtent[0][1], x1 = clipExtent[1][0], y1 = clipExtent[1][1]; + d3_geom_voronoi(sites(data), clipExtent).cells.forEach(function(cell, i) { + var edges = cell.edges, site = cell.site, polygon = polygons[i] = edges.length ? edges.map(function(e) { + var s = e.start(); + return [ s.x, s.y ]; + }) : site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1 ? [ [ x0, y1 ], [ x1, y1 ], [ x1, y0 ], [ x0, y0 ] ] : []; + polygon.point = data[i]; + }); + return polygons; + } + function sites(data) { + return data.map(function(d, i) { + return { + x: Math.round(fx(d, i) / ε) * ε, + y: Math.round(fy(d, i) / ε) * ε, + i: i + }; + }); + } + voronoi.links = function(data) { + return d3_geom_voronoi(sites(data)).edges.filter(function(edge) { + return edge.l && edge.r; + }).map(function(edge) { + return { + source: data[edge.l.i], + target: data[edge.r.i] + }; + }); + }; + voronoi.triangles = function(data) { + var triangles = []; + d3_geom_voronoi(sites(data)).cells.forEach(function(cell, i) { + var site = cell.site, edges = cell.edges.sort(d3_geom_voronoiHalfEdgeOrder), j = -1, m = edges.length, e0, s0, e1 = edges[m - 1].edge, s1 = e1.l === site ? e1.r : e1.l; + while (++j < m) { + e0 = e1; + s0 = s1; + e1 = edges[j].edge; + s1 = e1.l === site ? e1.r : e1.l; + if (i < s0.i && i < s1.i && d3_geom_voronoiTriangleArea(site, s0, s1) < 0) { + triangles.push([ data[i], data[s0.i], data[s1.i] ]); + } + } + }); + return triangles; + }; + voronoi.x = function(_) { + return arguments.length ? (fx = d3_functor(x = _), voronoi) : x; + }; + voronoi.y = function(_) { + return arguments.length ? (fy = d3_functor(y = _), voronoi) : y; + }; + voronoi.clipExtent = function(_) { + if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent; + clipExtent = _ == null ? d3_geom_voronoiClipExtent : _; + return voronoi; + }; + voronoi.size = function(_) { + if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent && clipExtent[1]; + return voronoi.clipExtent(_ && [ [ 0, 0 ], _ ]); + }; + return voronoi; + }; + var d3_geom_voronoiClipExtent = [ [ -1e6, -1e6 ], [ 1e6, 1e6 ] ]; + function d3_geom_voronoiTriangleArea(a, b, c) { + return (a.x - c.x) * (b.y - a.y) - (a.x - b.x) * (c.y - a.y); + } + d3.geom.delaunay = function(vertices) { + return d3.geom.voronoi().triangles(vertices); + }; + d3.geom.quadtree = function(points, x1, y1, x2, y2) { + var x = d3_geom_pointX, y = d3_geom_pointY, compat; + if (compat = arguments.length) { + x = d3_geom_quadtreeCompatX; + y = d3_geom_quadtreeCompatY; + if (compat === 3) { + y2 = y1; + x2 = x1; + y1 = x1 = 0; + } + return quadtree(points); + } + function quadtree(data) { + var d, fx = d3_functor(x), fy = d3_functor(y), xs, ys, i, n, x1_, y1_, x2_, y2_; + if (x1 != null) { + x1_ = x1, y1_ = y1, x2_ = x2, y2_ = y2; + } else { + x2_ = y2_ = -(x1_ = y1_ = Infinity); + xs = [], ys = []; + n = data.length; + if (compat) for (i = 0; i < n; ++i) { + d = data[i]; + if (d.x < x1_) x1_ = d.x; + if (d.y < y1_) y1_ = d.y; + if (d.x > x2_) x2_ = d.x; + if (d.y > y2_) y2_ = d.y; + xs.push(d.x); + ys.push(d.y); + } else for (i = 0; i < n; ++i) { + var x_ = +fx(d = data[i], i), y_ = +fy(d, i); + if (x_ < x1_) x1_ = x_; + if (y_ < y1_) y1_ = y_; + if (x_ > x2_) x2_ = x_; + if (y_ > y2_) y2_ = y_; + xs.push(x_); + ys.push(y_); + } + } + var dx = x2_ - x1_, dy = y2_ - y1_; + if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy; + function insert(n, d, x, y, x1, y1, x2, y2) { + if (isNaN(x) || isNaN(y)) return; + if (n.leaf) { + var nx = n.x, ny = n.y; + if (nx != null) { + if (abs(nx - x) + abs(ny - y) < .01) { + insertChild(n, d, x, y, x1, y1, x2, y2); + } else { + var nPoint = n.point; + n.x = n.y = n.point = null; + insertChild(n, nPoint, nx, ny, x1, y1, x2, y2); + insertChild(n, d, x, y, x1, y1, x2, y2); + } + } else { + n.x = x, n.y = y, n.point = d; + } + } else { + insertChild(n, d, x, y, x1, y1, x2, y2); + } + } + function insertChild(n, d, x, y, x1, y1, x2, y2) { + var xm = (x1 + x2) * .5, ym = (y1 + y2) * .5, right = x >= xm, below = y >= ym, i = below << 1 | right; + n.leaf = false; + n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); + if (right) x1 = xm; else x2 = xm; + if (below) y1 = ym; else y2 = ym; + insert(n, d, x, y, x1, y1, x2, y2); + } + var root = d3_geom_quadtreeNode(); + root.add = function(d) { + insert(root, d, +fx(d, ++i), +fy(d, i), x1_, y1_, x2_, y2_); + }; + root.visit = function(f) { + d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_); + }; + root.find = function(point) { + return d3_geom_quadtreeFind(root, point[0], point[1], x1_, y1_, x2_, y2_); + }; + i = -1; + if (x1 == null) { + while (++i < n) { + insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_); + } + --i; + } else data.forEach(root.add); + xs = ys = data = d = null; + return root; + } + quadtree.x = function(_) { + return arguments.length ? (x = _, quadtree) : x; + }; + quadtree.y = function(_) { + return arguments.length ? (y = _, quadtree) : y; + }; + quadtree.extent = function(_) { + if (!arguments.length) return x1 == null ? null : [ [ x1, y1 ], [ x2, y2 ] ]; + if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = +_[0][0], y1 = +_[0][1], x2 = +_[1][0], + y2 = +_[1][1]; + return quadtree; + }; + quadtree.size = function(_) { + if (!arguments.length) return x1 == null ? null : [ x2 - x1, y2 - y1 ]; + if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = y1 = 0, x2 = +_[0], y2 = +_[1]; + return quadtree; + }; + return quadtree; + }; + function d3_geom_quadtreeCompatX(d) { + return d.x; + } + function d3_geom_quadtreeCompatY(d) { + return d.y; + } + function d3_geom_quadtreeNode() { + return { + leaf: true, + nodes: [], + point: null, + x: null, + y: null + }; + } + function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { + if (!f(node, x1, y1, x2, y2)) { + var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes; + if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); + if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); + if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); + if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); + } + } + function d3_geom_quadtreeFind(root, x, y, x0, y0, x3, y3) { + var minDistance2 = Infinity, closestPoint; + (function find(node, x1, y1, x2, y2) { + if (x1 > x3 || y1 > y3 || x2 < x0 || y2 < y0) return; + if (point = node.point) { + var point, dx = x - node.x, dy = y - node.y, distance2 = dx * dx + dy * dy; + if (distance2 < minDistance2) { + var distance = Math.sqrt(minDistance2 = distance2); + x0 = x - distance, y0 = y - distance; + x3 = x + distance, y3 = y + distance; + closestPoint = point; + } + } + var children = node.nodes, xm = (x1 + x2) * .5, ym = (y1 + y2) * .5, right = x >= xm, below = y >= ym; + for (var i = below << 1 | right, j = i + 4; i < j; ++i) { + if (node = children[i & 3]) switch (i & 3) { + case 0: + find(node, x1, y1, xm, ym); + break; + + case 1: + find(node, xm, y1, x2, ym); + break; + + case 2: + find(node, x1, ym, xm, y2); + break; + + case 3: + find(node, xm, ym, x2, y2); + break; + } + } + })(root, x0, y0, x3, y3); + return closestPoint; + } + d3.interpolateRgb = d3_interpolateRgb; + function d3_interpolateRgb(a, b) { + a = d3.rgb(a); + b = d3.rgb(b); + var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab; + return function(t) { + return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t)); + }; + } + d3.interpolateObject = d3_interpolateObject; + function d3_interpolateObject(a, b) { + var i = {}, c = {}, k; + for (k in a) { + if (k in b) { + i[k] = d3_interpolate(a[k], b[k]); + } else { + c[k] = a[k]; + } + } + for (k in b) { + if (!(k in a)) { + c[k] = b[k]; + } + } + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; + } + d3.interpolateNumber = d3_interpolateNumber; + function d3_interpolateNumber(a, b) { + a = +a, b = +b; + return function(t) { + return a * (1 - t) + b * t; + }; + } + d3.interpolateString = d3_interpolateString; + function d3_interpolateString(a, b) { + var bi = d3_interpolate_numberA.lastIndex = d3_interpolate_numberB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = []; + a = a + "", b = b + ""; + while ((am = d3_interpolate_numberA.exec(a)) && (bm = d3_interpolate_numberB.exec(b))) { + if ((bs = bm.index) > bi) { + bs = b.slice(bi, bs); + if (s[i]) s[i] += bs; else s[++i] = bs; + } + if ((am = am[0]) === (bm = bm[0])) { + if (s[i]) s[i] += bm; else s[++i] = bm; + } else { + s[++i] = null; + q.push({ + i: i, + x: d3_interpolateNumber(am, bm) + }); + } + bi = d3_interpolate_numberB.lastIndex; + } + if (bi < b.length) { + bs = b.slice(bi); + if (s[i]) s[i] += bs; else s[++i] = bs; + } + return s.length < 2 ? q[0] ? (b = q[0].x, function(t) { + return b(t) + ""; + }) : function() { + return b; + } : (b = q.length, function(t) { + for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }); + } + var d3_interpolate_numberA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, d3_interpolate_numberB = new RegExp(d3_interpolate_numberA.source, "g"); + d3.interpolate = d3_interpolate; + function d3_interpolate(a, b) { + var i = d3.interpolators.length, f; + while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ; + return f; + } + d3.interpolators = [ function(a, b) { + var t = typeof b; + return (t === "string" ? d3_rgb_names.has(b.toLowerCase()) || /^(#|rgb\(|hsl\()/i.test(b) ? d3_interpolateRgb : d3_interpolateString : b instanceof d3_color ? d3_interpolateRgb : Array.isArray(b) ? d3_interpolateArray : t === "object" && isNaN(b) ? d3_interpolateObject : d3_interpolateNumber)(a, b); + } ]; + d3.interpolateArray = d3_interpolateArray; + function d3_interpolateArray(a, b) { + var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i; + for (i = 0; i < n0; ++i) x.push(d3_interpolate(a[i], b[i])); + for (;i < na; ++i) c[i] = a[i]; + for (;i < nb; ++i) c[i] = b[i]; + return function(t) { + for (i = 0; i < n0; ++i) c[i] = x[i](t); + return c; + }; + } + var d3_ease_default = function() { + return d3_identity; + }; + var d3_ease = d3.map({ + linear: d3_ease_default, + poly: d3_ease_poly, + quad: function() { + return d3_ease_quad; + }, + cubic: function() { + return d3_ease_cubic; + }, + sin: function() { + return d3_ease_sin; + }, + exp: function() { + return d3_ease_exp; + }, + circle: function() { + return d3_ease_circle; + }, + elastic: d3_ease_elastic, + back: d3_ease_back, + bounce: function() { + return d3_ease_bounce; + } + }); + var d3_ease_mode = d3.map({ + "in": d3_identity, + out: d3_ease_reverse, + "in-out": d3_ease_reflect, + "out-in": function(f) { + return d3_ease_reflect(d3_ease_reverse(f)); + } + }); + d3.ease = function(name) { + var i = name.indexOf("-"), t = i >= 0 ? name.slice(0, i) : name, m = i >= 0 ? name.slice(i + 1) : "in"; + t = d3_ease.get(t) || d3_ease_default; + m = d3_ease_mode.get(m) || d3_identity; + return d3_ease_clamp(m(t.apply(null, d3_arraySlice.call(arguments, 1)))); + }; + function d3_ease_clamp(f) { + return function(t) { + return t <= 0 ? 0 : t >= 1 ? 1 : f(t); + }; + } + function d3_ease_reverse(f) { + return function(t) { + return 1 - f(1 - t); + }; + } + function d3_ease_reflect(f) { + return function(t) { + return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t)); + }; + } + function d3_ease_quad(t) { + return t * t; + } + function d3_ease_cubic(t) { + return t * t * t; + } + function d3_ease_cubicInOut(t) { + if (t <= 0) return 0; + if (t >= 1) return 1; + var t2 = t * t, t3 = t2 * t; + return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75); + } + function d3_ease_poly(e) { + return function(t) { + return Math.pow(t, e); + }; + } + function d3_ease_sin(t) { + return 1 - Math.cos(t * halfπ); + } + function d3_ease_exp(t) { + return Math.pow(2, 10 * (t - 1)); + } + function d3_ease_circle(t) { + return 1 - Math.sqrt(1 - t * t); + } + function d3_ease_elastic(a, p) { + var s; + if (arguments.length < 2) p = .45; + if (arguments.length) s = p / τ * Math.asin(1 / a); else a = 1, s = p / 4; + return function(t) { + return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * τ / p); + }; + } + function d3_ease_back(s) { + if (!s) s = 1.70158; + return function(t) { + return t * t * ((s + 1) * t - s); + }; + } + function d3_ease_bounce(t) { + return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; + } + d3.interpolateHcl = d3_interpolateHcl; + function d3_interpolateHcl(a, b) { + a = d3.hcl(a); + b = d3.hcl(b); + var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al; + if (isNaN(bc)) bc = 0, ac = isNaN(ac) ? b.c : ac; + if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; + return function(t) { + return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + ""; + }; + } + d3.interpolateHsl = d3_interpolateHsl; + function d3_interpolateHsl(a, b) { + a = d3.hsl(a); + b = d3.hsl(b); + var ah = a.h, as = a.s, al = a.l, bh = b.h - ah, bs = b.s - as, bl = b.l - al; + if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as; + if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; + return function(t) { + return d3_hsl_rgb(ah + bh * t, as + bs * t, al + bl * t) + ""; + }; + } + d3.interpolateLab = d3_interpolateLab; + function d3_interpolateLab(a, b) { + a = d3.lab(a); + b = d3.lab(b); + var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab; + return function(t) { + return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + ""; + }; + } + d3.interpolateRound = d3_interpolateRound; + function d3_interpolateRound(a, b) { + b -= a; + return function(t) { + return Math.round(a + b * t); + }; + } + d3.transform = function(string) { + var g = d3_document.createElementNS(d3.ns.prefix.svg, "g"); + return (d3.transform = function(string) { + if (string != null) { + g.setAttribute("transform", string); + var t = g.transform.baseVal.consolidate(); + } + return new d3_transform(t ? t.matrix : d3_transformIdentity); + })(string); + }; + function d3_transform(m) { + var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0; + if (r0[0] * r1[1] < r1[0] * r0[1]) { + r0[0] *= -1; + r0[1] *= -1; + kx *= -1; + kz *= -1; + } + this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees; + this.translate = [ m.e, m.f ]; + this.scale = [ kx, ky ]; + this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0; + } + d3_transform.prototype.toString = function() { + return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")"; + }; + function d3_transformDot(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + function d3_transformNormalize(a) { + var k = Math.sqrt(d3_transformDot(a, a)); + if (k) { + a[0] /= k; + a[1] /= k; + } + return k; + } + function d3_transformCombine(a, b, k) { + a[0] += k * b[0]; + a[1] += k * b[1]; + return a; + } + var d3_transformIdentity = { + a: 1, + b: 0, + c: 0, + d: 1, + e: 0, + f: 0 + }; + d3.interpolateTransform = d3_interpolateTransform; + function d3_interpolateTransformPop(s) { + return s.length ? s.pop() + "," : ""; + } + function d3_interpolateTranslate(ta, tb, s, q) { + if (ta[0] !== tb[0] || ta[1] !== tb[1]) { + var i = s.push("translate(", null, ",", null, ")"); + q.push({ + i: i - 4, + x: d3_interpolateNumber(ta[0], tb[0]) + }, { + i: i - 2, + x: d3_interpolateNumber(ta[1], tb[1]) + }); + } else if (tb[0] || tb[1]) { + s.push("translate(" + tb + ")"); + } + } + function d3_interpolateRotate(ra, rb, s, q) { + if (ra !== rb) { + if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360; + q.push({ + i: s.push(d3_interpolateTransformPop(s) + "rotate(", null, ")") - 2, + x: d3_interpolateNumber(ra, rb) + }); + } else if (rb) { + s.push(d3_interpolateTransformPop(s) + "rotate(" + rb + ")"); + } + } + function d3_interpolateSkew(wa, wb, s, q) { + if (wa !== wb) { + q.push({ + i: s.push(d3_interpolateTransformPop(s) + "skewX(", null, ")") - 2, + x: d3_interpolateNumber(wa, wb) + }); + } else if (wb) { + s.push(d3_interpolateTransformPop(s) + "skewX(" + wb + ")"); + } + } + function d3_interpolateScale(ka, kb, s, q) { + if (ka[0] !== kb[0] || ka[1] !== kb[1]) { + var i = s.push(d3_interpolateTransformPop(s) + "scale(", null, ",", null, ")"); + q.push({ + i: i - 4, + x: d3_interpolateNumber(ka[0], kb[0]) + }, { + i: i - 2, + x: d3_interpolateNumber(ka[1], kb[1]) + }); + } else if (kb[0] !== 1 || kb[1] !== 1) { + s.push(d3_interpolateTransformPop(s) + "scale(" + kb + ")"); + } + } + function d3_interpolateTransform(a, b) { + var s = [], q = []; + a = d3.transform(a), b = d3.transform(b); + d3_interpolateTranslate(a.translate, b.translate, s, q); + d3_interpolateRotate(a.rotate, b.rotate, s, q); + d3_interpolateSkew(a.skew, b.skew, s, q); + d3_interpolateScale(a.scale, b.scale, s, q); + a = b = null; + return function(t) { + var i = -1, n = q.length, o; + while (++i < n) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; + } + function d3_uninterpolateNumber(a, b) { + b = (b -= a = +a) || 1 / b; + return function(x) { + return (x - a) / b; + }; + } + function d3_uninterpolateClamp(a, b) { + b = (b -= a = +a) || 1 / b; + return function(x) { + return Math.max(0, Math.min(1, (x - a) / b)); + }; + } + d3.layout = {}; + d3.layout.bundle = function() { + return function(links) { + var paths = [], i = -1, n = links.length; + while (++i < n) paths.push(d3_layout_bundlePath(links[i])); + return paths; + }; + }; + function d3_layout_bundlePath(link) { + var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ]; + while (start !== lca) { + start = start.parent; + points.push(start); + } + var k = points.length; + while (end !== lca) { + points.splice(k, 0, end); + end = end.parent; + } + return points; + } + function d3_layout_bundleAncestors(node) { + var ancestors = [], parent = node.parent; + while (parent != null) { + ancestors.push(node); + node = parent; + parent = parent.parent; + } + ancestors.push(node); + return ancestors; + } + function d3_layout_bundleLeastCommonAncestor(a, b) { + if (a === b) return a; + var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null; + while (aNode === bNode) { + sharedNode = aNode; + aNode = aNodes.pop(); + bNode = bNodes.pop(); + } + return sharedNode; + } + d3.layout.chord = function() { + var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords; + function relayout() { + var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j; + chords = []; + groups = []; + k = 0, i = -1; + while (++i < n) { + x = 0, j = -1; + while (++j < n) { + x += matrix[i][j]; + } + groupSums.push(x); + subgroupIndex.push(d3.range(n)); + k += x; + } + if (sortGroups) { + groupIndex.sort(function(a, b) { + return sortGroups(groupSums[a], groupSums[b]); + }); + } + if (sortSubgroups) { + subgroupIndex.forEach(function(d, i) { + d.sort(function(a, b) { + return sortSubgroups(matrix[i][a], matrix[i][b]); + }); + }); + } + k = (τ - padding * n) / k; + x = 0, i = -1; + while (++i < n) { + x0 = x, j = -1; + while (++j < n) { + var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k; + subgroups[di + "-" + dj] = { + index: di, + subindex: dj, + startAngle: a0, + endAngle: a1, + value: v + }; + } + groups[di] = { + index: di, + startAngle: x0, + endAngle: x, + value: (x - x0) / k + }; + x += padding; + } + i = -1; + while (++i < n) { + j = i - 1; + while (++j < n) { + var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i]; + if (source.value || target.value) { + chords.push(source.value < target.value ? { + source: target, + target: source + } : { + source: source, + target: target + }); + } + } + } + if (sortChords) resort(); + } + function resort() { + chords.sort(function(a, b) { + return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2); + }); + } + chord.matrix = function(x) { + if (!arguments.length) return matrix; + n = (matrix = x) && matrix.length; + chords = groups = null; + return chord; + }; + chord.padding = function(x) { + if (!arguments.length) return padding; + padding = x; + chords = groups = null; + return chord; + }; + chord.sortGroups = function(x) { + if (!arguments.length) return sortGroups; + sortGroups = x; + chords = groups = null; + return chord; + }; + chord.sortSubgroups = function(x) { + if (!arguments.length) return sortSubgroups; + sortSubgroups = x; + chords = null; + return chord; + }; + chord.sortChords = function(x) { + if (!arguments.length) return sortChords; + sortChords = x; + if (chords) resort(); + return chord; + }; + chord.chords = function() { + if (!chords) relayout(); + return chords; + }; + chord.groups = function() { + if (!groups) relayout(); + return groups; + }; + return chord; + }; + d3.layout.force = function() { + var force = {}, event = d3.dispatch("start", "tick", "end"), timer, size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, chargeDistance2 = d3_layout_forceChargeDistance2, gravity = .1, theta2 = .64, nodes = [], links = [], distances, strengths, charges; + function repulse(node) { + return function(quad, x1, _, x2) { + if (quad.point !== node) { + var dx = quad.cx - node.x, dy = quad.cy - node.y, dw = x2 - x1, dn = dx * dx + dy * dy; + if (dw * dw / theta2 < dn) { + if (dn < chargeDistance2) { + var k = quad.charge / dn; + node.px -= dx * k; + node.py -= dy * k; + } + return true; + } + if (quad.point && dn && dn < chargeDistance2) { + var k = quad.pointCharge / dn; + node.px -= dx * k; + node.py -= dy * k; + } + } + return !quad.charge; + }; + } + force.tick = function() { + if ((alpha *= .99) < .005) { + timer = null; + event.end({ + type: "end", + alpha: alpha = 0 + }); + return true; + } + var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y; + for (i = 0; i < m; ++i) { + o = links[i]; + s = o.source; + t = o.target; + x = t.x - s.x; + y = t.y - s.y; + if (l = x * x + y * y) { + l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l; + x *= l; + y *= l; + t.x -= x * (k = s.weight + t.weight ? s.weight / (s.weight + t.weight) : .5); + t.y -= y * k; + s.x += x * (k = 1 - k); + s.y += y * k; + } + } + if (k = alpha * gravity) { + x = size[0] / 2; + y = size[1] / 2; + i = -1; + if (k) while (++i < n) { + o = nodes[i]; + o.x += (x - o.x) * k; + o.y += (y - o.y) * k; + } + } + if (charge) { + d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges); + i = -1; + while (++i < n) { + if (!(o = nodes[i]).fixed) { + q.visit(repulse(o)); + } + } + } + i = -1; + while (++i < n) { + o = nodes[i]; + if (o.fixed) { + o.x = o.px; + o.y = o.py; + } else { + o.x -= (o.px - (o.px = o.x)) * friction; + o.y -= (o.py - (o.py = o.y)) * friction; + } + } + event.tick({ + type: "tick", + alpha: alpha + }); + }; + force.nodes = function(x) { + if (!arguments.length) return nodes; + nodes = x; + return force; + }; + force.links = function(x) { + if (!arguments.length) return links; + links = x; + return force; + }; + force.size = function(x) { + if (!arguments.length) return size; + size = x; + return force; + }; + force.linkDistance = function(x) { + if (!arguments.length) return linkDistance; + linkDistance = typeof x === "function" ? x : +x; + return force; + }; + force.distance = force.linkDistance; + force.linkStrength = function(x) { + if (!arguments.length) return linkStrength; + linkStrength = typeof x === "function" ? x : +x; + return force; + }; + force.friction = function(x) { + if (!arguments.length) return friction; + friction = +x; + return force; + }; + force.charge = function(x) { + if (!arguments.length) return charge; + charge = typeof x === "function" ? x : +x; + return force; + }; + force.chargeDistance = function(x) { + if (!arguments.length) return Math.sqrt(chargeDistance2); + chargeDistance2 = x * x; + return force; + }; + force.gravity = function(x) { + if (!arguments.length) return gravity; + gravity = +x; + return force; + }; + force.theta = function(x) { + if (!arguments.length) return Math.sqrt(theta2); + theta2 = x * x; + return force; + }; + force.alpha = function(x) { + if (!arguments.length) return alpha; + x = +x; + if (alpha) { + if (x > 0) { + alpha = x; + } else { + timer.c = null, timer.t = NaN, timer = null; + event.start({ + type: "end", + alpha: alpha = 0 + }); + } + } else if (x > 0) { + event.start({ + type: "start", + alpha: alpha = x + }); + timer = d3_timer(force.tick); + } + return force; + }; + force.start = function() { + var i, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o; + for (i = 0; i < n; ++i) { + (o = nodes[i]).index = i; + o.weight = 0; + } + for (i = 0; i < m; ++i) { + o = links[i]; + if (typeof o.source == "number") o.source = nodes[o.source]; + if (typeof o.target == "number") o.target = nodes[o.target]; + ++o.source.weight; + ++o.target.weight; + } + for (i = 0; i < n; ++i) { + o = nodes[i]; + if (isNaN(o.x)) o.x = position("x", w); + if (isNaN(o.y)) o.y = position("y", h); + if (isNaN(o.px)) o.px = o.x; + if (isNaN(o.py)) o.py = o.y; + } + distances = []; + if (typeof linkDistance === "function") for (i = 0; i < m; ++i) distances[i] = +linkDistance.call(this, links[i], i); else for (i = 0; i < m; ++i) distances[i] = linkDistance; + strengths = []; + if (typeof linkStrength === "function") for (i = 0; i < m; ++i) strengths[i] = +linkStrength.call(this, links[i], i); else for (i = 0; i < m; ++i) strengths[i] = linkStrength; + charges = []; + if (typeof charge === "function") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i); else for (i = 0; i < n; ++i) charges[i] = charge; + function position(dimension, size) { + if (!neighbors) { + neighbors = new Array(n); + for (j = 0; j < n; ++j) { + neighbors[j] = []; + } + for (j = 0; j < m; ++j) { + var o = links[j]; + neighbors[o.source.index].push(o.target); + neighbors[o.target.index].push(o.source); + } + } + var candidates = neighbors[i], j = -1, l = candidates.length, x; + while (++j < l) if (!isNaN(x = candidates[j][dimension])) return x; + return Math.random() * size; + } + return force.resume(); + }; + force.resume = function() { + return force.alpha(.1); + }; + force.stop = function() { + return force.alpha(0); + }; + force.drag = function() { + if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart.force", d3_layout_forceDragstart).on("drag.force", dragmove).on("dragend.force", d3_layout_forceDragend); + if (!arguments.length) return drag; + this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag); + }; + function dragmove(d) { + d.px = d3.event.x, d.py = d3.event.y; + force.resume(); + } + return d3.rebind(force, event, "on"); + }; + function d3_layout_forceDragstart(d) { + d.fixed |= 2; + } + function d3_layout_forceDragend(d) { + d.fixed &= ~6; + } + function d3_layout_forceMouseover(d) { + d.fixed |= 4; + d.px = d.x, d.py = d.y; + } + function d3_layout_forceMouseout(d) { + d.fixed &= ~4; + } + function d3_layout_forceAccumulate(quad, alpha, charges) { + var cx = 0, cy = 0; + quad.charge = 0; + if (!quad.leaf) { + var nodes = quad.nodes, n = nodes.length, i = -1, c; + while (++i < n) { + c = nodes[i]; + if (c == null) continue; + d3_layout_forceAccumulate(c, alpha, charges); + quad.charge += c.charge; + cx += c.charge * c.cx; + cy += c.charge * c.cy; + } + } + if (quad.point) { + if (!quad.leaf) { + quad.point.x += Math.random() - .5; + quad.point.y += Math.random() - .5; + } + var k = alpha * charges[quad.point.index]; + quad.charge += quad.pointCharge = k; + cx += k * quad.point.x; + cy += k * quad.point.y; + } + quad.cx = cx / quad.charge; + quad.cy = cy / quad.charge; + } + var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1, d3_layout_forceChargeDistance2 = Infinity; + d3.layout.hierarchy = function() { + var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue; + function hierarchy(root) { + var stack = [ root ], nodes = [], node; + root.depth = 0; + while ((node = stack.pop()) != null) { + nodes.push(node); + if ((childs = children.call(hierarchy, node, node.depth)) && (n = childs.length)) { + var n, childs, child; + while (--n >= 0) { + stack.push(child = childs[n]); + child.parent = node; + child.depth = node.depth + 1; + } + if (value) node.value = 0; + node.children = childs; + } else { + if (value) node.value = +value.call(hierarchy, node, node.depth) || 0; + delete node.children; + } + } + d3_layout_hierarchyVisitAfter(root, function(node) { + var childs, parent; + if (sort && (childs = node.children)) childs.sort(sort); + if (value && (parent = node.parent)) parent.value += node.value; + }); + return nodes; + } + hierarchy.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return hierarchy; + }; + hierarchy.children = function(x) { + if (!arguments.length) return children; + children = x; + return hierarchy; + }; + hierarchy.value = function(x) { + if (!arguments.length) return value; + value = x; + return hierarchy; + }; + hierarchy.revalue = function(root) { + if (value) { + d3_layout_hierarchyVisitBefore(root, function(node) { + if (node.children) node.value = 0; + }); + d3_layout_hierarchyVisitAfter(root, function(node) { + var parent; + if (!node.children) node.value = +value.call(hierarchy, node, node.depth) || 0; + if (parent = node.parent) parent.value += node.value; + }); + } + return root; + }; + return hierarchy; + }; + function d3_layout_hierarchyRebind(object, hierarchy) { + d3.rebind(object, hierarchy, "sort", "children", "value"); + object.nodes = object; + object.links = d3_layout_hierarchyLinks; + return object; + } + function d3_layout_hierarchyVisitBefore(node, callback) { + var nodes = [ node ]; + while ((node = nodes.pop()) != null) { + callback(node); + if ((children = node.children) && (n = children.length)) { + var n, children; + while (--n >= 0) nodes.push(children[n]); + } + } + } + function d3_layout_hierarchyVisitAfter(node, callback) { + var nodes = [ node ], nodes2 = []; + while ((node = nodes.pop()) != null) { + nodes2.push(node); + if ((children = node.children) && (n = children.length)) { + var i = -1, n, children; + while (++i < n) nodes.push(children[i]); + } + } + while ((node = nodes2.pop()) != null) { + callback(node); + } + } + function d3_layout_hierarchyChildren(d) { + return d.children; + } + function d3_layout_hierarchyValue(d) { + return d.value; + } + function d3_layout_hierarchySort(a, b) { + return b.value - a.value; + } + function d3_layout_hierarchyLinks(nodes) { + return d3.merge(nodes.map(function(parent) { + return (parent.children || []).map(function(child) { + return { + source: parent, + target: child + }; + }); + })); + } + d3.layout.partition = function() { + var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ]; + function position(node, x, dx, dy) { + var children = node.children; + node.x = x; + node.y = node.depth * dy; + node.dx = dx; + node.dy = dy; + if (children && (n = children.length)) { + var i = -1, n, c, d; + dx = node.value ? dx / node.value : 0; + while (++i < n) { + position(c = children[i], x, d = c.value * dx, dy); + x += d; + } + } + } + function depth(node) { + var children = node.children, d = 0; + if (children && (n = children.length)) { + var i = -1, n; + while (++i < n) d = Math.max(d, depth(children[i])); + } + return 1 + d; + } + function partition(d, i) { + var nodes = hierarchy.call(this, d, i); + position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); + return nodes; + } + partition.size = function(x) { + if (!arguments.length) return size; + size = x; + return partition; + }; + return d3_layout_hierarchyRebind(partition, hierarchy); + }; + d3.layout.pie = function() { + var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = τ, padAngle = 0; + function pie(data) { + var n = data.length, values = data.map(function(d, i) { + return +value.call(pie, d, i); + }), a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle), da = (typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a, p = Math.min(Math.abs(da) / n, +(typeof padAngle === "function" ? padAngle.apply(this, arguments) : padAngle)), pa = p * (da < 0 ? -1 : 1), sum = d3.sum(values), k = sum ? (da - n * pa) / sum : 0, index = d3.range(n), arcs = [], v; + if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) { + return values[j] - values[i]; + } : function(i, j) { + return sort(data[i], data[j]); + }); + index.forEach(function(i) { + arcs[i] = { + data: data[i], + value: v = values[i], + startAngle: a, + endAngle: a += v * k + pa, + padAngle: p + }; + }); + return arcs; + } + pie.value = function(_) { + if (!arguments.length) return value; + value = _; + return pie; + }; + pie.sort = function(_) { + if (!arguments.length) return sort; + sort = _; + return pie; + }; + pie.startAngle = function(_) { + if (!arguments.length) return startAngle; + startAngle = _; + return pie; + }; + pie.endAngle = function(_) { + if (!arguments.length) return endAngle; + endAngle = _; + return pie; + }; + pie.padAngle = function(_) { + if (!arguments.length) return padAngle; + padAngle = _; + return pie; + }; + return pie; + }; + var d3_layout_pieSortByValue = {}; + d3.layout.stack = function() { + var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY; + function stack(data, index) { + if (!(n = data.length)) return data; + var series = data.map(function(d, i) { + return values.call(stack, d, i); + }); + var points = series.map(function(d) { + return d.map(function(v, i) { + return [ x.call(stack, v, i), y.call(stack, v, i) ]; + }); + }); + var orders = order.call(stack, points, index); + series = d3.permute(series, orders); + points = d3.permute(points, orders); + var offsets = offset.call(stack, points, index); + var m = series[0].length, n, i, j, o; + for (j = 0; j < m; ++j) { + out.call(stack, series[0][j], o = offsets[j], points[0][j][1]); + for (i = 1; i < n; ++i) { + out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]); + } + } + return data; + } + stack.values = function(x) { + if (!arguments.length) return values; + values = x; + return stack; + }; + stack.order = function(x) { + if (!arguments.length) return order; + order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault; + return stack; + }; + stack.offset = function(x) { + if (!arguments.length) return offset; + offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero; + return stack; + }; + stack.x = function(z) { + if (!arguments.length) return x; + x = z; + return stack; + }; + stack.y = function(z) { + if (!arguments.length) return y; + y = z; + return stack; + }; + stack.out = function(z) { + if (!arguments.length) return out; + out = z; + return stack; + }; + return stack; + }; + function d3_layout_stackX(d) { + return d.x; + } + function d3_layout_stackY(d) { + return d.y; + } + function d3_layout_stackOut(d, y0, y) { + d.y0 = y0; + d.y = y; + } + var d3_layout_stackOrders = d3.map({ + "inside-out": function(data) { + var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) { + return max[a] - max[b]; + }), top = 0, bottom = 0, tops = [], bottoms = []; + for (i = 0; i < n; ++i) { + j = index[i]; + if (top < bottom) { + top += sums[j]; + tops.push(j); + } else { + bottom += sums[j]; + bottoms.push(j); + } + } + return bottoms.reverse().concat(tops); + }, + reverse: function(data) { + return d3.range(data.length).reverse(); + }, + "default": d3_layout_stackOrderDefault + }); + var d3_layout_stackOffsets = d3.map({ + silhouette: function(data) { + var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o > max) max = o; + sums.push(o); + } + for (j = 0; j < m; ++j) { + y0[j] = (max - sums[j]) / 2; + } + return y0; + }, + wiggle: function(data) { + var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = []; + y0[0] = o = o0 = 0; + for (j = 1; j < m; ++j) { + for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; + for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { + for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { + s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; + } + s2 += s3 * data[i][j][1]; + } + y0[j] = o -= s1 ? s2 / s1 * dx : 0; + if (o < o0) o0 = o; + } + for (j = 0; j < m; ++j) y0[j] -= o0; + return y0; + }, + expand: function(data) { + var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k; + } + for (j = 0; j < m; ++j) y0[j] = 0; + return y0; + }, + zero: d3_layout_stackOffsetZero + }); + function d3_layout_stackOrderDefault(data) { + return d3.range(data.length); + } + function d3_layout_stackOffsetZero(data) { + var j = -1, m = data[0].length, y0 = []; + while (++j < m) y0[j] = 0; + return y0; + } + function d3_layout_stackMaxIndex(array) { + var i = 1, j = 0, v = array[0][1], k, n = array.length; + for (;i < n; ++i) { + if ((k = array[i][1]) > v) { + j = i; + v = k; + } + } + return j; + } + function d3_layout_stackReduceSum(d) { + return d.reduce(d3_layout_stackSum, 0); + } + function d3_layout_stackSum(p, d) { + return p + d[1]; + } + d3.layout.histogram = function() { + var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges; + function histogram(data, i) { + var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x; + while (++i < m) { + bin = bins[i] = []; + bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); + bin.y = 0; + } + if (m > 0) { + i = -1; + while (++i < n) { + x = values[i]; + if (x >= range[0] && x <= range[1]) { + bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; + bin.y += k; + bin.push(data[i]); + } + } + } + return bins; + } + histogram.value = function(x) { + if (!arguments.length) return valuer; + valuer = x; + return histogram; + }; + histogram.range = function(x) { + if (!arguments.length) return ranger; + ranger = d3_functor(x); + return histogram; + }; + histogram.bins = function(x) { + if (!arguments.length) return binner; + binner = typeof x === "number" ? function(range) { + return d3_layout_histogramBinFixed(range, x); + } : d3_functor(x); + return histogram; + }; + histogram.frequency = function(x) { + if (!arguments.length) return frequency; + frequency = !!x; + return histogram; + }; + return histogram; + }; + function d3_layout_histogramBinSturges(range, values) { + return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); + } + function d3_layout_histogramBinFixed(range, n) { + var x = -1, b = +range[0], m = (range[1] - b) / n, f = []; + while (++x <= n) f[x] = m * x + b; + return f; + } + function d3_layout_histogramRange(values) { + return [ d3.min(values), d3.max(values) ]; + } + d3.layout.pack = function() { + var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ], radius; + function pack(d, i) { + var nodes = hierarchy.call(this, d, i), root = nodes[0], w = size[0], h = size[1], r = radius == null ? Math.sqrt : typeof radius === "function" ? radius : function() { + return radius; + }; + root.x = root.y = 0; + d3_layout_hierarchyVisitAfter(root, function(d) { + d.r = +r(d.value); + }); + d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings); + if (padding) { + var dr = padding * (radius ? 1 : Math.max(2 * root.r / w, 2 * root.r / h)) / 2; + d3_layout_hierarchyVisitAfter(root, function(d) { + d.r += dr; + }); + d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings); + d3_layout_hierarchyVisitAfter(root, function(d) { + d.r -= dr; + }); + } + d3_layout_packTransform(root, w / 2, h / 2, radius ? 1 : 1 / Math.max(2 * root.r / w, 2 * root.r / h)); + return nodes; + } + pack.size = function(_) { + if (!arguments.length) return size; + size = _; + return pack; + }; + pack.radius = function(_) { + if (!arguments.length) return radius; + radius = _ == null || typeof _ === "function" ? _ : +_; + return pack; + }; + pack.padding = function(_) { + if (!arguments.length) return padding; + padding = +_; + return pack; + }; + return d3_layout_hierarchyRebind(pack, hierarchy); + }; + function d3_layout_packSort(a, b) { + return a.value - b.value; + } + function d3_layout_packInsert(a, b) { + var c = a._pack_next; + a._pack_next = b; + b._pack_prev = a; + b._pack_next = c; + c._pack_prev = b; + } + function d3_layout_packSplice(a, b) { + a._pack_next = b; + b._pack_prev = a; + } + function d3_layout_packIntersects(a, b) { + var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r; + return .999 * dr * dr > dx * dx + dy * dy; + } + function d3_layout_packSiblings(node) { + if (!(nodes = node.children) || !(n = nodes.length)) return; + var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n; + function bound(node) { + xMin = Math.min(node.x - node.r, xMin); + xMax = Math.max(node.x + node.r, xMax); + yMin = Math.min(node.y - node.r, yMin); + yMax = Math.max(node.y + node.r, yMax); + } + nodes.forEach(d3_layout_packLink); + a = nodes[0]; + a.x = -a.r; + a.y = 0; + bound(a); + if (n > 1) { + b = nodes[1]; + b.x = b.r; + b.y = 0; + bound(b); + if (n > 2) { + c = nodes[2]; + d3_layout_packPlace(a, b, c); + bound(c); + d3_layout_packInsert(a, c); + a._pack_prev = c; + d3_layout_packInsert(c, b); + b = a._pack_next; + for (i = 3; i < n; i++) { + d3_layout_packPlace(a, b, c = nodes[i]); + var isect = 0, s1 = 1, s2 = 1; + for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { + if (d3_layout_packIntersects(j, c)) { + isect = 1; + break; + } + } + if (isect == 1) { + for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { + if (d3_layout_packIntersects(k, c)) { + break; + } + } + } + if (isect) { + if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b); + i--; + } else { + d3_layout_packInsert(a, c); + b = c; + bound(c); + } + } + } + } + var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0; + for (i = 0; i < n; i++) { + c = nodes[i]; + c.x -= cx; + c.y -= cy; + cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y)); + } + node.r = cr; + nodes.forEach(d3_layout_packUnlink); + } + function d3_layout_packLink(node) { + node._pack_next = node._pack_prev = node; + } + function d3_layout_packUnlink(node) { + delete node._pack_next; + delete node._pack_prev; + } + function d3_layout_packTransform(node, x, y, k) { + var children = node.children; + node.x = x += k * node.x; + node.y = y += k * node.y; + node.r *= k; + if (children) { + var i = -1, n = children.length; + while (++i < n) d3_layout_packTransform(children[i], x, y, k); + } + } + function d3_layout_packPlace(a, b, c) { + var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y; + if (db && (dx || dy)) { + var da = b.r + c.r, dc = dx * dx + dy * dy; + da *= da; + db *= db; + var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc); + c.x = a.x + x * dx + y * dy; + c.y = a.y + x * dy - y * dx; + } else { + c.x = a.x + db; + c.y = a.y; + } + } + d3.layout.tree = function() { + var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = null; + function tree(d, i) { + var nodes = hierarchy.call(this, d, i), root0 = nodes[0], root1 = wrapTree(root0); + d3_layout_hierarchyVisitAfter(root1, firstWalk), root1.parent.m = -root1.z; + d3_layout_hierarchyVisitBefore(root1, secondWalk); + if (nodeSize) d3_layout_hierarchyVisitBefore(root0, sizeNode); else { + var left = root0, right = root0, bottom = root0; + d3_layout_hierarchyVisitBefore(root0, function(node) { + if (node.x < left.x) left = node; + if (node.x > right.x) right = node; + if (node.depth > bottom.depth) bottom = node; + }); + var tx = separation(left, right) / 2 - left.x, kx = size[0] / (right.x + separation(right, left) / 2 + tx), ky = size[1] / (bottom.depth || 1); + d3_layout_hierarchyVisitBefore(root0, function(node) { + node.x = (node.x + tx) * kx; + node.y = node.depth * ky; + }); + } + return nodes; + } + function wrapTree(root0) { + var root1 = { + A: null, + children: [ root0 ] + }, queue = [ root1 ], node1; + while ((node1 = queue.pop()) != null) { + for (var children = node1.children, child, i = 0, n = children.length; i < n; ++i) { + queue.push((children[i] = child = { + _: children[i], + parent: node1, + children: (child = children[i].children) && child.slice() || [], + A: null, + a: null, + z: 0, + m: 0, + c: 0, + s: 0, + t: null, + i: i + }).a = child); + } + } + return root1.children[0]; + } + function firstWalk(v) { + var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null; + if (children.length) { + d3_layout_treeShift(v); + var midpoint = (children[0].z + children[children.length - 1].z) / 2; + if (w) { + v.z = w.z + separation(v._, w._); + v.m = v.z - midpoint; + } else { + v.z = midpoint; + } + } else if (w) { + v.z = w.z + separation(v._, w._); + } + v.parent.A = apportion(v, w, v.parent.A || siblings[0]); + } + function secondWalk(v) { + v._.x = v.z + v.parent.m; + v.m += v.parent.m; + } + function apportion(v, w, ancestor) { + if (w) { + var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift; + while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) { + vom = d3_layout_treeLeft(vom); + vop = d3_layout_treeRight(vop); + vop.a = v; + shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); + if (shift > 0) { + d3_layout_treeMove(d3_layout_treeAncestor(vim, v, ancestor), v, shift); + sip += shift; + sop += shift; + } + sim += vim.m; + sip += vip.m; + som += vom.m; + sop += vop.m; + } + if (vim && !d3_layout_treeRight(vop)) { + vop.t = vim; + vop.m += sim - sop; + } + if (vip && !d3_layout_treeLeft(vom)) { + vom.t = vip; + vom.m += sip - som; + ancestor = v; + } + } + return ancestor; + } + function sizeNode(node) { + node.x *= size[0]; + node.y = node.depth * size[1]; + } + tree.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return tree; + }; + tree.size = function(x) { + if (!arguments.length) return nodeSize ? null : size; + nodeSize = (size = x) == null ? sizeNode : null; + return tree; + }; + tree.nodeSize = function(x) { + if (!arguments.length) return nodeSize ? size : null; + nodeSize = (size = x) == null ? null : sizeNode; + return tree; + }; + return d3_layout_hierarchyRebind(tree, hierarchy); + }; + function d3_layout_treeSeparation(a, b) { + return a.parent == b.parent ? 1 : 2; + } + function d3_layout_treeLeft(v) { + var children = v.children; + return children.length ? children[0] : v.t; + } + function d3_layout_treeRight(v) { + var children = v.children, n; + return (n = children.length) ? children[n - 1] : v.t; + } + function d3_layout_treeMove(wm, wp, shift) { + var change = shift / (wp.i - wm.i); + wp.c -= change; + wp.s += shift; + wm.c += change; + wp.z += shift; + wp.m += shift; + } + function d3_layout_treeShift(v) { + var shift = 0, change = 0, children = v.children, i = children.length, w; + while (--i >= 0) { + w = children[i]; + w.z += shift; + w.m += shift; + shift += w.s + (change += w.c); + } + } + function d3_layout_treeAncestor(vim, v, ancestor) { + return vim.a.parent === v.parent ? vim.a : ancestor; + } + d3.layout.cluster = function() { + var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = false; + function cluster(d, i) { + var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0; + d3_layout_hierarchyVisitAfter(root, function(node) { + var children = node.children; + if (children && children.length) { + node.x = d3_layout_clusterX(children); + node.y = d3_layout_clusterY(children); + } else { + node.x = previousNode ? x += separation(node, previousNode) : 0; + node.y = 0; + previousNode = node; + } + }); + var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2; + d3_layout_hierarchyVisitAfter(root, nodeSize ? function(node) { + node.x = (node.x - root.x) * size[0]; + node.y = (root.y - node.y) * size[1]; + } : function(node) { + node.x = (node.x - x0) / (x1 - x0) * size[0]; + node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; + }); + return nodes; + } + cluster.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return cluster; + }; + cluster.size = function(x) { + if (!arguments.length) return nodeSize ? null : size; + nodeSize = (size = x) == null; + return cluster; + }; + cluster.nodeSize = function(x) { + if (!arguments.length) return nodeSize ? size : null; + nodeSize = (size = x) != null; + return cluster; + }; + return d3_layout_hierarchyRebind(cluster, hierarchy); + }; + function d3_layout_clusterY(children) { + return 1 + d3.max(children, function(child) { + return child.y; + }); + } + function d3_layout_clusterX(children) { + return children.reduce(function(x, child) { + return x + child.x; + }, 0) / children.length; + } + function d3_layout_clusterLeft(node) { + var children = node.children; + return children && children.length ? d3_layout_clusterLeft(children[0]) : node; + } + function d3_layout_clusterRight(node) { + var children = node.children, n; + return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; + } + d3.layout.treemap = function() { + var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = .5 * (1 + Math.sqrt(5)); + function scale(children, k) { + var i = -1, n = children.length, child, area; + while (++i < n) { + area = (child = children[i]).value * (k < 0 ? 0 : k); + child.area = isNaN(area) || area <= 0 ? 0 : area; + } + } + function squarify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === "slice" ? rect.dx : mode === "dice" ? rect.dy : mode === "slice-dice" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while ((n = remaining.length) > 0) { + row.push(child = remaining[n - 1]); + row.area += child.area; + if (mode !== "squarify" || (score = worst(row, u)) <= best) { + remaining.pop(); + best = score; + } else { + row.area -= row.pop().area; + position(row, u, rect, false); + u = Math.min(rect.dx, rect.dy); + row.length = row.area = 0; + best = Infinity; + } + } + if (row.length) { + position(row, u, rect, true); + row.length = row.area = 0; + } + children.forEach(squarify); + } + } + function stickify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), remaining = children.slice(), child, row = []; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while (child = remaining.pop()) { + row.push(child); + row.area += child.area; + if (child.z != null) { + position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); + row.length = row.area = 0; + } + } + children.forEach(stickify); + } + } + function worst(row, u) { + var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length; + while (++i < n) { + if (!(r = row[i].area)) continue; + if (r < rmin) rmin = r; + if (r > rmax) rmax = r; + } + s *= s; + u *= u; + return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity; + } + function position(row, u, rect, flush) { + var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o; + if (u == rect.dx) { + if (flush || v > rect.dy) v = rect.dy; + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dy = v; + x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0); + } + o.z = true; + o.dx += rect.x + rect.dx - x; + rect.y += v; + rect.dy -= v; + } else { + if (flush || v > rect.dx) v = rect.dx; + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dx = v; + y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0); + } + o.z = false; + o.dy += rect.y + rect.dy - y; + rect.x += v; + rect.dx -= v; + } + } + function treemap(d) { + var nodes = stickies || hierarchy(d), root = nodes[0]; + root.x = root.y = 0; + if (root.value) root.dx = size[0], root.dy = size[1]; else root.dx = root.dy = 0; + if (stickies) hierarchy.revalue(root); + scale([ root ], root.dx * root.dy / root.value); + (stickies ? stickify : squarify)(root); + if (sticky) stickies = nodes; + return nodes; + } + treemap.size = function(x) { + if (!arguments.length) return size; + size = x; + return treemap; + }; + treemap.padding = function(x) { + if (!arguments.length) return padding; + function padFunction(node) { + var p = x.call(treemap, node, node.depth); + return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p); + } + function padConstant(node) { + return d3_layout_treemapPad(node, x); + } + var type; + pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], + padConstant) : padConstant; + return treemap; + }; + treemap.round = function(x) { + if (!arguments.length) return round != Number; + round = x ? Math.round : Number; + return treemap; + }; + treemap.sticky = function(x) { + if (!arguments.length) return sticky; + sticky = x; + stickies = null; + return treemap; + }; + treemap.ratio = function(x) { + if (!arguments.length) return ratio; + ratio = x; + return treemap; + }; + treemap.mode = function(x) { + if (!arguments.length) return mode; + mode = x + ""; + return treemap; + }; + return d3_layout_hierarchyRebind(treemap, hierarchy); + }; + function d3_layout_treemapPadNull(node) { + return { + x: node.x, + y: node.y, + dx: node.dx, + dy: node.dy + }; + } + function d3_layout_treemapPad(node, padding) { + var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2]; + if (dx < 0) { + x += dx / 2; + dx = 0; + } + if (dy < 0) { + y += dy / 2; + dy = 0; + } + return { + x: x, + y: y, + dx: dx, + dy: dy + }; + } + d3.random = { + normal: function(µ, σ) { + var n = arguments.length; + if (n < 2) σ = 1; + if (n < 1) µ = 0; + return function() { + var x, y, r; + do { + x = Math.random() * 2 - 1; + y = Math.random() * 2 - 1; + r = x * x + y * y; + } while (!r || r > 1); + return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r); + }; + }, + logNormal: function() { + var random = d3.random.normal.apply(d3, arguments); + return function() { + return Math.exp(random()); + }; + }, + bates: function(m) { + var random = d3.random.irwinHall(m); + return function() { + return random() / m; + }; + }, + irwinHall: function(m) { + return function() { + for (var s = 0, j = 0; j < m; j++) s += Math.random(); + return s; + }; + } + }; + d3.scale = {}; + function d3_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [ start, stop ] : [ stop, start ]; + } + function d3_scaleRange(scale) { + return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); + } + function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { + var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]); + return function(x) { + return i(u(x)); + }; + } + function d3_scale_nice(domain, nice) { + var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx; + if (x1 < x0) { + dx = i0, i0 = i1, i1 = dx; + dx = x0, x0 = x1, x1 = dx; + } + domain[i0] = nice.floor(x0); + domain[i1] = nice.ceil(x1); + return domain; + } + function d3_scale_niceStep(step) { + return step ? { + floor: function(x) { + return Math.floor(x / step) * step; + }, + ceil: function(x) { + return Math.ceil(x / step) * step; + } + } : d3_scale_niceIdentity; + } + var d3_scale_niceIdentity = { + floor: d3_identity, + ceil: d3_identity + }; + function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { + var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1; + if (domain[k] < domain[0]) { + domain = domain.slice().reverse(); + range = range.slice().reverse(); + } + while (++j <= k) { + u.push(uninterpolate(domain[j - 1], domain[j])); + i.push(interpolate(range[j - 1], range[j])); + } + return function(x) { + var j = d3.bisect(domain, x, 1, k) - 1; + return i[j](u[j](x)); + }; + } + d3.scale.linear = function() { + return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3_interpolate, false); + }; + function d3_scale_linear(domain, range, interpolate, clamp) { + var output, input; + function rescale() { + var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; + output = linear(domain, range, uninterpolate, interpolate); + input = linear(range, domain, uninterpolate, d3_interpolate); + return scale; + } + function scale(x) { + return output(x); + } + scale.invert = function(y) { + return input(y); + }; + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.map(Number); + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.rangeRound = function(x) { + return scale.range(x).interpolate(d3_interpolateRound); + }; + scale.clamp = function(x) { + if (!arguments.length) return clamp; + clamp = x; + return rescale(); + }; + scale.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x; + return rescale(); + }; + scale.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + scale.tickFormat = function(m, format) { + return d3_scale_linearTickFormat(domain, m, format); + }; + scale.nice = function(m) { + d3_scale_linearNice(domain, m); + return rescale(); + }; + scale.copy = function() { + return d3_scale_linear(domain, range, interpolate, clamp); + }; + return rescale(); + } + function d3_scale_linearRebind(scale, linear) { + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); + } + function d3_scale_linearNice(domain, m) { + return d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2])); + } + function d3_scale_linearTickRange(domain, m) { + if (m == null) m = 10; + var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step; + if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2; + extent[0] = Math.ceil(extent[0] / step) * step; + extent[1] = Math.floor(extent[1] / step) * step + step * .5; + extent[2] = step; + return extent; + } + function d3_scale_linearTicks(domain, m) { + return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); + } + function d3_scale_linearTickFormat(domain, m, format) { + var range = d3_scale_linearTickRange(domain, m); + if (format) { + var match = d3_format_re.exec(format); + match.shift(); + if (match[8] === "s") { + var prefix = d3.formatPrefix(Math.max(abs(range[0]), abs(range[1]))); + if (!match[7]) match[7] = "." + d3_scale_linearPrecision(prefix.scale(range[2])); + match[8] = "f"; + format = d3.format(match.join("")); + return function(d) { + return format(prefix.scale(d)) + prefix.symbol; + }; + } + if (!match[7]) match[7] = "." + d3_scale_linearFormatPrecision(match[8], range); + format = match.join(""); + } else { + format = ",." + d3_scale_linearPrecision(range[2]) + "f"; + } + return d3.format(format); + } + var d3_scale_linearFormatSignificant = { + s: 1, + g: 1, + p: 1, + r: 1, + e: 1 + }; + function d3_scale_linearPrecision(value) { + return -Math.floor(Math.log(value) / Math.LN10 + .01); + } + function d3_scale_linearFormatPrecision(type, range) { + var p = d3_scale_linearPrecision(range[2]); + return type in d3_scale_linearFormatSignificant ? Math.abs(p - d3_scale_linearPrecision(Math.max(abs(range[0]), abs(range[1])))) + +(type !== "e") : p - (type === "%") * 2; + } + d3.scale.log = function() { + return d3_scale_log(d3.scale.linear().domain([ 0, 1 ]), 10, true, [ 1, 10 ]); + }; + function d3_scale_log(linear, base, positive, domain) { + function log(x) { + return (positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(base); + } + function pow(x) { + return positive ? Math.pow(base, x) : -Math.pow(base, -x); + } + function scale(x) { + return linear(log(x)); + } + scale.invert = function(x) { + return pow(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return domain; + positive = x[0] >= 0; + linear.domain((domain = x.map(Number)).map(log)); + return scale; + }; + scale.base = function(_) { + if (!arguments.length) return base; + base = +_; + linear.domain(domain.map(log)); + return scale; + }; + scale.nice = function() { + var niced = d3_scale_nice(domain.map(log), positive ? Math : d3_scale_logNiceNegative); + linear.domain(niced); + domain = niced.map(pow); + return scale; + }; + scale.ticks = function() { + var extent = d3_scaleExtent(domain), ticks = [], u = extent[0], v = extent[1], i = Math.floor(log(u)), j = Math.ceil(log(v)), n = base % 1 ? 2 : base; + if (isFinite(j - i)) { + if (positive) { + for (;i < j; i++) for (var k = 1; k < n; k++) ticks.push(pow(i) * k); + ticks.push(pow(i)); + } else { + ticks.push(pow(i)); + for (;i++ < j; ) for (var k = n - 1; k > 0; k--) ticks.push(pow(i) * k); + } + for (i = 0; ticks[i] < u; i++) {} + for (j = ticks.length; ticks[j - 1] > v; j--) {} + ticks = ticks.slice(i, j); + } + return ticks; + }; + scale.tickFormat = function(n, format) { + if (!arguments.length) return d3_scale_logFormat; + if (arguments.length < 2) format = d3_scale_logFormat; else if (typeof format !== "function") format = d3.format(format); + var k = Math.max(.1, n / scale.ticks().length), f = positive ? (e = 1e-12, Math.ceil) : (e = -1e-12, + Math.floor), e; + return function(d) { + return d / pow(f(log(d) + e)) <= k ? format(d) : ""; + }; + }; + scale.copy = function() { + return d3_scale_log(linear.copy(), base, positive, domain); + }; + return d3_scale_linearRebind(scale, linear); + } + var d3_scale_logFormat = d3.format(".0e"), d3_scale_logNiceNegative = { + floor: function(x) { + return -Math.ceil(-x); + }, + ceil: function(x) { + return -Math.floor(-x); + } + }; + d3.scale.pow = function() { + return d3_scale_pow(d3.scale.linear(), 1, [ 0, 1 ]); + }; + function d3_scale_pow(linear, exponent, domain) { + var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent); + function scale(x) { + return linear(powp(x)); + } + scale.invert = function(x) { + return powb(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return domain; + linear.domain((domain = x.map(Number)).map(powp)); + return scale; + }; + scale.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + scale.tickFormat = function(m, format) { + return d3_scale_linearTickFormat(domain, m, format); + }; + scale.nice = function(m) { + return scale.domain(d3_scale_linearNice(domain, m)); + }; + scale.exponent = function(x) { + if (!arguments.length) return exponent; + powp = d3_scale_powPow(exponent = x); + powb = d3_scale_powPow(1 / exponent); + linear.domain(domain.map(powp)); + return scale; + }; + scale.copy = function() { + return d3_scale_pow(linear.copy(), exponent, domain); + }; + return d3_scale_linearRebind(scale, linear); + } + function d3_scale_powPow(e) { + return function(x) { + return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); + }; + } + d3.scale.sqrt = function() { + return d3.scale.pow().exponent(.5); + }; + d3.scale.ordinal = function() { + return d3_scale_ordinal([], { + t: "range", + a: [ [] ] + }); + }; + function d3_scale_ordinal(domain, ranger) { + var index, range, rangeBand; + function scale(x) { + return range[((index.get(x) || (ranger.t === "range" ? index.set(x, domain.push(x)) : NaN)) - 1) % range.length]; + } + function steps(start, step) { + return d3.range(domain.length).map(function(i) { + return start + step * i; + }); + } + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = []; + index = new d3_Map(); + var i = -1, n = x.length, xi; + while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi)); + return scale[ranger.t].apply(scale, ranger.a); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + rangeBand = 0; + ranger = { + t: "range", + a: arguments + }; + return scale; + }; + scale.rangePoints = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], stop = x[1], step = domain.length < 2 ? (start = (start + stop) / 2, + 0) : (stop - start) / (domain.length - 1 + padding); + range = steps(start + step * padding / 2, step); + rangeBand = 0; + ranger = { + t: "rangePoints", + a: arguments + }; + return scale; + }; + scale.rangeRoundPoints = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], stop = x[1], step = domain.length < 2 ? (start = stop = Math.round((start + stop) / 2), + 0) : (stop - start) / (domain.length - 1 + padding) | 0; + range = steps(start + Math.round(step * padding / 2 + (stop - start - (domain.length - 1 + padding) * step) / 2), step); + rangeBand = 0; + ranger = { + t: "rangeRoundPoints", + a: arguments + }; + return scale; + }; + scale.rangeBands = function(x, padding, outerPadding) { + if (arguments.length < 2) padding = 0; + if (arguments.length < 3) outerPadding = padding; + var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding); + range = steps(start + step * outerPadding, step); + if (reverse) range.reverse(); + rangeBand = step * (1 - padding); + ranger = { + t: "rangeBands", + a: arguments + }; + return scale; + }; + scale.rangeRoundBands = function(x, padding, outerPadding) { + if (arguments.length < 2) padding = 0; + if (arguments.length < 3) outerPadding = padding; + var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)); + range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 2), step); + if (reverse) range.reverse(); + rangeBand = Math.round(step * (1 - padding)); + ranger = { + t: "rangeRoundBands", + a: arguments + }; + return scale; + }; + scale.rangeBand = function() { + return rangeBand; + }; + scale.rangeExtent = function() { + return d3_scaleExtent(ranger.a[0]); + }; + scale.copy = function() { + return d3_scale_ordinal(domain, ranger); + }; + return scale.domain(domain); + } + d3.scale.category10 = function() { + return d3.scale.ordinal().range(d3_category10); + }; + d3.scale.category20 = function() { + return d3.scale.ordinal().range(d3_category20); + }; + d3.scale.category20b = function() { + return d3.scale.ordinal().range(d3_category20b); + }; + d3.scale.category20c = function() { + return d3.scale.ordinal().range(d3_category20c); + }; + var d3_category10 = [ 2062260, 16744206, 2924588, 14034728, 9725885, 9197131, 14907330, 8355711, 12369186, 1556175 ].map(d3_rgbString); + var d3_category20 = [ 2062260, 11454440, 16744206, 16759672, 2924588, 10018698, 14034728, 16750742, 9725885, 12955861, 9197131, 12885140, 14907330, 16234194, 8355711, 13092807, 12369186, 14408589, 1556175, 10410725 ].map(d3_rgbString); + var d3_category20b = [ 3750777, 5395619, 7040719, 10264286, 6519097, 9216594, 11915115, 13556636, 9202993, 12426809, 15186514, 15190932, 8666169, 11356490, 14049643, 15177372, 8077683, 10834324, 13528509, 14589654 ].map(d3_rgbString); + var d3_category20c = [ 3244733, 7057110, 10406625, 13032431, 15095053, 16616764, 16625259, 16634018, 3253076, 7652470, 10607003, 13101504, 7695281, 10394312, 12369372, 14342891, 6513507, 9868950, 12434877, 14277081 ].map(d3_rgbString); + d3.scale.quantile = function() { + return d3_scale_quantile([], []); + }; + function d3_scale_quantile(domain, range) { + var thresholds; + function rescale() { + var k = 0, q = range.length; + thresholds = []; + while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); + return scale; + } + function scale(x) { + if (!isNaN(x = +x)) return range[d3.bisect(thresholds, x)]; + } + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.map(d3_number).filter(d3_numeric).sort(d3_ascending); + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.quantiles = function() { + return thresholds; + }; + scale.invertExtent = function(y) { + y = range.indexOf(y); + return y < 0 ? [ NaN, NaN ] : [ y > 0 ? thresholds[y - 1] : domain[0], y < thresholds.length ? thresholds[y] : domain[domain.length - 1] ]; + }; + scale.copy = function() { + return d3_scale_quantile(domain, range); + }; + return rescale(); + } + d3.scale.quantize = function() { + return d3_scale_quantize(0, 1, [ 0, 1 ]); + }; + function d3_scale_quantize(x0, x1, range) { + var kx, i; + function scale(x) { + return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; + } + function rescale() { + kx = range.length / (x1 - x0); + i = range.length - 1; + return scale; + } + scale.domain = function(x) { + if (!arguments.length) return [ x0, x1 ]; + x0 = +x[0]; + x1 = +x[x.length - 1]; + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.invertExtent = function(y) { + y = range.indexOf(y); + y = y < 0 ? NaN : y / kx + x0; + return [ y, y + 1 / kx ]; + }; + scale.copy = function() { + return d3_scale_quantize(x0, x1, range); + }; + return rescale(); + } + d3.scale.threshold = function() { + return d3_scale_threshold([ .5 ], [ 0, 1 ]); + }; + function d3_scale_threshold(domain, range) { + function scale(x) { + if (x <= x) return range[d3.bisect(domain, x)]; + } + scale.domain = function(_) { + if (!arguments.length) return domain; + domain = _; + return scale; + }; + scale.range = function(_) { + if (!arguments.length) return range; + range = _; + return scale; + }; + scale.invertExtent = function(y) { + y = range.indexOf(y); + return [ domain[y - 1], domain[y] ]; + }; + scale.copy = function() { + return d3_scale_threshold(domain, range); + }; + return scale; + } + d3.scale.identity = function() { + return d3_scale_identity([ 0, 1 ]); + }; + function d3_scale_identity(domain) { + function identity(x) { + return +x; + } + identity.invert = identity; + identity.domain = identity.range = function(x) { + if (!arguments.length) return domain; + domain = x.map(identity); + return identity; + }; + identity.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + identity.tickFormat = function(m, format) { + return d3_scale_linearTickFormat(domain, m, format); + }; + identity.copy = function() { + return d3_scale_identity(domain); + }; + return identity; + } + d3.svg = {}; + function d3_zero() { + return 0; + } + d3.svg.arc = function() { + var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, cornerRadius = d3_zero, padRadius = d3_svg_arcAuto, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle, padAngle = d3_svg_arcPadAngle; + function arc() { + var r0 = Math.max(0, +innerRadius.apply(this, arguments)), r1 = Math.max(0, +outerRadius.apply(this, arguments)), a0 = startAngle.apply(this, arguments) - halfπ, a1 = endAngle.apply(this, arguments) - halfπ, da = Math.abs(a1 - a0), cw = a0 > a1 ? 0 : 1; + if (r1 < r0) rc = r1, r1 = r0, r0 = rc; + if (da >= τε) return circleSegment(r1, cw) + (r0 ? circleSegment(r0, 1 - cw) : "") + "Z"; + var rc, cr, rp, ap, p0 = 0, p1 = 0, x0, y0, x1, y1, x2, y2, x3, y3, path = []; + if (ap = (+padAngle.apply(this, arguments) || 0) / 2) { + rp = padRadius === d3_svg_arcAuto ? Math.sqrt(r0 * r0 + r1 * r1) : +padRadius.apply(this, arguments); + if (!cw) p1 *= -1; + if (r1) p1 = d3_asin(rp / r1 * Math.sin(ap)); + if (r0) p0 = d3_asin(rp / r0 * Math.sin(ap)); + } + if (r1) { + x0 = r1 * Math.cos(a0 + p1); + y0 = r1 * Math.sin(a0 + p1); + x1 = r1 * Math.cos(a1 - p1); + y1 = r1 * Math.sin(a1 - p1); + var l1 = Math.abs(a1 - a0 - 2 * p1) <= π ? 0 : 1; + if (p1 && d3_svg_arcSweep(x0, y0, x1, y1) === cw ^ l1) { + var h1 = (a0 + a1) / 2; + x0 = r1 * Math.cos(h1); + y0 = r1 * Math.sin(h1); + x1 = y1 = null; + } + } else { + x0 = y0 = 0; + } + if (r0) { + x2 = r0 * Math.cos(a1 - p0); + y2 = r0 * Math.sin(a1 - p0); + x3 = r0 * Math.cos(a0 + p0); + y3 = r0 * Math.sin(a0 + p0); + var l0 = Math.abs(a0 - a1 + 2 * p0) <= π ? 0 : 1; + if (p0 && d3_svg_arcSweep(x2, y2, x3, y3) === 1 - cw ^ l0) { + var h0 = (a0 + a1) / 2; + x2 = r0 * Math.cos(h0); + y2 = r0 * Math.sin(h0); + x3 = y3 = null; + } + } else { + x2 = y2 = 0; + } + if (da > ε && (rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) { + cr = r0 < r1 ^ cw ? 0 : 1; + var rc1 = rc, rc0 = rc; + if (da < π) { + var oc = x3 == null ? [ x2, y2 ] : x1 == null ? [ x0, y0 ] : d3_geom_polygonIntersect([ x0, y0 ], [ x3, y3 ], [ x1, y1 ], [ x2, y2 ]), ax = x0 - oc[0], ay = y0 - oc[1], bx = x1 - oc[0], by = y1 - oc[1], kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2), lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]); + rc0 = Math.min(rc, (r0 - lc) / (kc - 1)); + rc1 = Math.min(rc, (r1 - lc) / (kc + 1)); + } + if (x1 != null) { + var t30 = d3_svg_arcCornerTangents(x3 == null ? [ x2, y2 ] : [ x3, y3 ], [ x0, y0 ], r1, rc1, cw), t12 = d3_svg_arcCornerTangents([ x1, y1 ], [ x2, y2 ], r1, rc1, cw); + if (rc === rc1) { + path.push("M", t30[0], "A", rc1, ",", rc1, " 0 0,", cr, " ", t30[1], "A", r1, ",", r1, " 0 ", 1 - cw ^ d3_svg_arcSweep(t30[1][0], t30[1][1], t12[1][0], t12[1][1]), ",", cw, " ", t12[1], "A", rc1, ",", rc1, " 0 0,", cr, " ", t12[0]); + } else { + path.push("M", t30[0], "A", rc1, ",", rc1, " 0 1,", cr, " ", t12[0]); + } + } else { + path.push("M", x0, ",", y0); + } + if (x3 != null) { + var t03 = d3_svg_arcCornerTangents([ x0, y0 ], [ x3, y3 ], r0, -rc0, cw), t21 = d3_svg_arcCornerTangents([ x2, y2 ], x1 == null ? [ x0, y0 ] : [ x1, y1 ], r0, -rc0, cw); + if (rc === rc0) { + path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr, " ", t21[1], "A", r0, ",", r0, " 0 ", cw ^ d3_svg_arcSweep(t21[1][0], t21[1][1], t03[1][0], t03[1][1]), ",", 1 - cw, " ", t03[1], "A", rc0, ",", rc0, " 0 0,", cr, " ", t03[0]); + } else { + path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr, " ", t03[0]); + } + } else { + path.push("L", x2, ",", y2); + } + } else { + path.push("M", x0, ",", y0); + if (x1 != null) path.push("A", r1, ",", r1, " 0 ", l1, ",", cw, " ", x1, ",", y1); + path.push("L", x2, ",", y2); + if (x3 != null) path.push("A", r0, ",", r0, " 0 ", l0, ",", 1 - cw, " ", x3, ",", y3); + } + path.push("Z"); + return path.join(""); + } + function circleSegment(r1, cw) { + return "M0," + r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + -r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + r1; + } + arc.innerRadius = function(v) { + if (!arguments.length) return innerRadius; + innerRadius = d3_functor(v); + return arc; + }; + arc.outerRadius = function(v) { + if (!arguments.length) return outerRadius; + outerRadius = d3_functor(v); + return arc; + }; + arc.cornerRadius = function(v) { + if (!arguments.length) return cornerRadius; + cornerRadius = d3_functor(v); + return arc; + }; + arc.padRadius = function(v) { + if (!arguments.length) return padRadius; + padRadius = v == d3_svg_arcAuto ? d3_svg_arcAuto : d3_functor(v); + return arc; + }; + arc.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return arc; + }; + arc.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return arc; + }; + arc.padAngle = function(v) { + if (!arguments.length) return padAngle; + padAngle = d3_functor(v); + return arc; + }; + arc.centroid = function() { + var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - halfπ; + return [ Math.cos(a) * r, Math.sin(a) * r ]; + }; + return arc; + }; + var d3_svg_arcAuto = "auto"; + function d3_svg_arcInnerRadius(d) { + return d.innerRadius; + } + function d3_svg_arcOuterRadius(d) { + return d.outerRadius; + } + function d3_svg_arcStartAngle(d) { + return d.startAngle; + } + function d3_svg_arcEndAngle(d) { + return d.endAngle; + } + function d3_svg_arcPadAngle(d) { + return d && d.padAngle; + } + function d3_svg_arcSweep(x0, y0, x1, y1) { + return (x0 - x1) * y0 - (y0 - y1) * x0 > 0 ? 0 : 1; + } + function d3_svg_arcCornerTangents(p0, p1, r1, rc, cw) { + var x01 = p0[0] - p1[0], y01 = p0[1] - p1[1], lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x1 = p0[0] + ox, y1 = p0[1] + oy, x2 = p1[0] + ox, y2 = p1[1] + oy, x3 = (x1 + x2) / 2, y3 = (y1 + y2) / 2, dx = x2 - x1, dy = y2 - y1, d2 = dx * dx + dy * dy, r = r1 - rc, D = x1 * y2 - x2 * y1, d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x3, dy0 = cy0 - y3, dx1 = cx1 - x3, dy1 = cy1 - y3; + if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; + return [ [ cx0 - ox, cy0 - oy ], [ cx0 * r1 / r, cy0 * r1 / r ] ]; + } + function d3_svg_line(projection) { + var x = d3_geom_pointX, y = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7; + function line(data) { + var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y); + function segment() { + segments.push("M", interpolate(projection(points), tension)); + } + while (++i < n) { + if (defined.call(this, d = data[i], i)) { + points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]); + } else if (points.length) { + segment(); + points = []; + } + } + if (points.length) segment(); + return segments.length ? segments.join("") : null; + } + line.x = function(_) { + if (!arguments.length) return x; + x = _; + return line; + }; + line.y = function(_) { + if (!arguments.length) return y; + y = _; + return line; + }; + line.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return line; + }; + line.interpolate = function(_) { + if (!arguments.length) return interpolateKey; + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; + return line; + }; + line.tension = function(_) { + if (!arguments.length) return tension; + tension = _; + return line; + }; + return line; + } + d3.svg.line = function() { + return d3_svg_line(d3_identity); + }; + var d3_svg_lineInterpolators = d3.map({ + linear: d3_svg_lineLinear, + "linear-closed": d3_svg_lineLinearClosed, + step: d3_svg_lineStep, + "step-before": d3_svg_lineStepBefore, + "step-after": d3_svg_lineStepAfter, + basis: d3_svg_lineBasis, + "basis-open": d3_svg_lineBasisOpen, + "basis-closed": d3_svg_lineBasisClosed, + bundle: d3_svg_lineBundle, + cardinal: d3_svg_lineCardinal, + "cardinal-open": d3_svg_lineCardinalOpen, + "cardinal-closed": d3_svg_lineCardinalClosed, + monotone: d3_svg_lineMonotone + }); + d3_svg_lineInterpolators.forEach(function(key, value) { + value.key = key; + value.closed = /-closed$/.test(key); + }); + function d3_svg_lineLinear(points) { + return points.length > 1 ? points.join("L") : points + "Z"; + } + function d3_svg_lineLinearClosed(points) { + return points.join("L") + "Z"; + } + function d3_svg_lineStep(points) { + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; + while (++i < n) path.push("H", (p[0] + (p = points[i])[0]) / 2, "V", p[1]); + if (n > 1) path.push("H", p[0]); + return path.join(""); + } + function d3_svg_lineStepBefore(points) { + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; + while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); + return path.join(""); + } + function d3_svg_lineStepAfter(points) { + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; + while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); + return path.join(""); + } + function d3_svg_lineCardinalOpen(points, tension) { + return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, -1), d3_svg_lineCardinalTangents(points, tension)); + } + function d3_svg_lineCardinalClosed(points, tension) { + return points.length < 3 ? d3_svg_lineLinearClosed(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), + points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension)); + } + function d3_svg_lineCardinal(points, tension) { + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension)); + } + function d3_svg_lineHermite(points, tangents) { + if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) { + return d3_svg_lineLinear(points); + } + var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1; + if (quad) { + path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1]; + p0 = points[1]; + pi = 2; + } + if (tangents.length > 1) { + t = tangents[1]; + p = points[pi]; + pi++; + path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; + for (var i = 2; i < tangents.length; i++, pi++) { + p = points[pi]; + t = tangents[i]; + path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; + } + } + if (quad) { + var lp = points[pi]; + path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1]; + } + return path; + } + function d3_svg_lineCardinalTangents(points, tension) { + var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length; + while (++i < n) { + p0 = p1; + p1 = p2; + p2 = points[i]; + tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]); + } + return tangents; + } + function d3_svg_lineBasis(points) { + if (points.length < 3) return d3_svg_lineLinear(points); + var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0, "L", d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; + points.push(points[n - 1]); + while (++i <= n) { + pi = points[i]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + points.pop(); + path.push("L", pi); + return path.join(""); + } + function d3_svg_lineBasisOpen(points) { + if (points.length < 4) return d3_svg_lineLinear(points); + var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ]; + while (++i < 3) { + pi = points[i]; + px.push(pi[0]); + py.push(pi[1]); + } + path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); + --i; + while (++i < n) { + pi = points[i]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); + } + function d3_svg_lineBasisClosed(points) { + var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = []; + while (++i < 4) { + pi = points[i % n]; + px.push(pi[0]); + py.push(pi[1]); + } + path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; + --i; + while (++i < m) { + pi = points[i % n]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); + } + function d3_svg_lineBundle(points, tension) { + var n = points.length - 1; + if (n) { + var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t; + while (++i <= n) { + p = points[i]; + t = i / n; + p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); + p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); + } + } + return d3_svg_lineBasis(points); + } + function d3_svg_lineDot4(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ]; + function d3_svg_lineBasisBezier(path, x, y) { + path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y)); + } + function d3_svg_lineSlope(p0, p1) { + return (p1[1] - p0[1]) / (p1[0] - p0[0]); + } + function d3_svg_lineFiniteDifferences(points) { + var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1); + while (++i < j) { + m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2; + } + m[i] = d; + return m; + } + function d3_svg_lineMonotoneTangents(points) { + var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1; + while (++i < j) { + d = d3_svg_lineSlope(points[i], points[i + 1]); + if (abs(d) < ε) { + m[i] = m[i + 1] = 0; + } else { + a = m[i] / d; + b = m[i + 1] / d; + s = a * a + b * b; + if (s > 9) { + s = d * 3 / Math.sqrt(s); + m[i] = s * a; + m[i + 1] = s * b; + } + } + } + i = -1; + while (++i <= j) { + s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i])); + tangents.push([ s || 0, m[i] * s || 0 ]); + } + return tangents; + } + function d3_svg_lineMonotone(points) { + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); + } + d3.svg.line.radial = function() { + var line = d3_svg_line(d3_svg_lineRadial); + line.radius = line.x, delete line.x; + line.angle = line.y, delete line.y; + return line; + }; + function d3_svg_lineRadial(points) { + var point, i = -1, n = points.length, r, a; + while (++i < n) { + point = points[i]; + r = point[0]; + a = point[1] - halfπ; + point[0] = r * Math.cos(a); + point[1] = r * Math.sin(a); + } + return points; + } + function d3_svg_area(projection) { + var x0 = d3_geom_pointX, x1 = d3_geom_pointX, y0 = 0, y1 = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7; + function area(data) { + var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() { + return x; + } : d3_functor(x1), fy1 = y0 === y1 ? function() { + return y; + } : d3_functor(y1), x, y; + function segment() { + segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z"); + } + while (++i < n) { + if (defined.call(this, d = data[i], i)) { + points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]); + points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]); + } else if (points0.length) { + segment(); + points0 = []; + points1 = []; + } + } + if (points0.length) segment(); + return segments.length ? segments.join("") : null; + } + area.x = function(_) { + if (!arguments.length) return x1; + x0 = x1 = _; + return area; + }; + area.x0 = function(_) { + if (!arguments.length) return x0; + x0 = _; + return area; + }; + area.x1 = function(_) { + if (!arguments.length) return x1; + x1 = _; + return area; + }; + area.y = function(_) { + if (!arguments.length) return y1; + y0 = y1 = _; + return area; + }; + area.y0 = function(_) { + if (!arguments.length) return y0; + y0 = _; + return area; + }; + area.y1 = function(_) { + if (!arguments.length) return y1; + y1 = _; + return area; + }; + area.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return area; + }; + area.interpolate = function(_) { + if (!arguments.length) return interpolateKey; + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; + interpolateReverse = interpolate.reverse || interpolate; + L = interpolate.closed ? "M" : "L"; + return area; + }; + area.tension = function(_) { + if (!arguments.length) return tension; + tension = _; + return area; + }; + return area; + } + d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; + d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; + d3.svg.area = function() { + return d3_svg_area(d3_identity); + }; + d3.svg.area.radial = function() { + var area = d3_svg_area(d3_svg_lineRadial); + area.radius = area.x, delete area.x; + area.innerRadius = area.x0, delete area.x0; + area.outerRadius = area.x1, delete area.x1; + area.angle = area.y, delete area.y; + area.startAngle = area.y0, delete area.y0; + area.endAngle = area.y1, delete area.y1; + return area; + }; + d3.svg.chord = function() { + var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; + function chord(d, i) { + var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i); + return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z"; + } + function subgroup(self, f, d, i) { + var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) - halfπ, a1 = endAngle.call(self, subgroup, i) - halfπ; + return { + r: r, + a0: a0, + a1: a1, + p0: [ r * Math.cos(a0), r * Math.sin(a0) ], + p1: [ r * Math.cos(a1), r * Math.sin(a1) ] + }; + } + function equals(a, b) { + return a.a0 == b.a0 && a.a1 == b.a1; + } + function arc(r, p, a) { + return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p; + } + function curve(r0, p0, r1, p1) { + return "Q 0,0 " + p1; + } + chord.radius = function(v) { + if (!arguments.length) return radius; + radius = d3_functor(v); + return chord; + }; + chord.source = function(v) { + if (!arguments.length) return source; + source = d3_functor(v); + return chord; + }; + chord.target = function(v) { + if (!arguments.length) return target; + target = d3_functor(v); + return chord; + }; + chord.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return chord; + }; + chord.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return chord; + }; + return chord; + }; + function d3_svg_chordRadius(d) { + return d.radius; + } + d3.svg.diagonal = function() { + var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection; + function diagonal(d, i) { + var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, { + x: p0.x, + y: m + }, { + x: p3.x, + y: m + }, p3 ]; + p = p.map(projection); + return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; + } + diagonal.source = function(x) { + if (!arguments.length) return source; + source = d3_functor(x); + return diagonal; + }; + diagonal.target = function(x) { + if (!arguments.length) return target; + target = d3_functor(x); + return diagonal; + }; + diagonal.projection = function(x) { + if (!arguments.length) return projection; + projection = x; + return diagonal; + }; + return diagonal; + }; + function d3_svg_diagonalProjection(d) { + return [ d.x, d.y ]; + } + d3.svg.diagonal.radial = function() { + var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection; + diagonal.projection = function(x) { + return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection; + }; + return diagonal; + }; + function d3_svg_diagonalRadialProjection(projection) { + return function() { + var d = projection.apply(this, arguments), r = d[0], a = d[1] - halfπ; + return [ r * Math.cos(a), r * Math.sin(a) ]; + }; + } + d3.svg.symbol = function() { + var type = d3_svg_symbolType, size = d3_svg_symbolSize; + function symbol(d, i) { + return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i)); + } + symbol.type = function(x) { + if (!arguments.length) return type; + type = d3_functor(x); + return symbol; + }; + symbol.size = function(x) { + if (!arguments.length) return size; + size = d3_functor(x); + return symbol; + }; + return symbol; + }; + function d3_svg_symbolSize() { + return 64; + } + function d3_svg_symbolType() { + return "circle"; + } + function d3_svg_symbolCircle(size) { + var r = Math.sqrt(size / π); + return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z"; + } + var d3_svg_symbols = d3.map({ + circle: d3_svg_symbolCircle, + cross: function(size) { + var r = Math.sqrt(size / 5) / 2; + return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z"; + }, + diamond: function(size) { + var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30; + return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z"; + }, + square: function(size) { + var r = Math.sqrt(size) / 2; + return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z"; + }, + "triangle-down": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z"; + }, + "triangle-up": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z"; + } + }); + d3.svg.symbolTypes = d3_svg_symbols.keys(); + var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians); + d3_selectionPrototype.transition = function(name) { + var id = d3_transitionInheritId || ++d3_transitionId, ns = d3_transitionNamespace(name), subgroups = [], subgroup, node, transition = d3_transitionInherit || { + time: Date.now(), + ease: d3_ease_cubicInOut, + delay: 0, + duration: 250 + }; + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) d3_transitionNode(node, i, ns, id, transition); + subgroup.push(node); + } + } + return d3_transition(subgroups, ns, id); + }; + d3_selectionPrototype.interrupt = function(name) { + return this.each(name == null ? d3_selection_interrupt : d3_selection_interruptNS(d3_transitionNamespace(name))); + }; + var d3_selection_interrupt = d3_selection_interruptNS(d3_transitionNamespace()); + function d3_selection_interruptNS(ns) { + return function() { + var lock, activeId, active; + if ((lock = this[ns]) && (active = lock[activeId = lock.active])) { + active.timer.c = null; + active.timer.t = NaN; + if (--lock.count) delete lock[activeId]; else delete this[ns]; + lock.active += .5; + active.event && active.event.interrupt.call(this, this.__data__, active.index); + } + }; + } + function d3_transition(groups, ns, id) { + d3_subclass(groups, d3_transitionPrototype); + groups.namespace = ns; + groups.id = id; + return groups; + } + var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit; + d3_transitionPrototype.call = d3_selectionPrototype.call; + d3_transitionPrototype.empty = d3_selectionPrototype.empty; + d3_transitionPrototype.node = d3_selectionPrototype.node; + d3_transitionPrototype.size = d3_selectionPrototype.size; + d3.transition = function(selection, name) { + return selection && selection.transition ? d3_transitionInheritId ? selection.transition(name) : selection : d3.selection().transition(selection); + }; + d3.transition.prototype = d3_transitionPrototype; + d3_transitionPrototype.select = function(selector) { + var id = this.id, ns = this.namespace, subgroups = [], subgroup, subnode, node; + selector = d3_selection_selector(selector); + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i, j))) { + if ("__data__" in node) subnode.__data__ = node.__data__; + d3_transitionNode(subnode, i, ns, id, node[ns][id]); + subgroup.push(subnode); + } else { + subgroup.push(null); + } + } + } + return d3_transition(subgroups, ns, id); + }; + d3_transitionPrototype.selectAll = function(selector) { + var id = this.id, ns = this.namespace, subgroups = [], subgroup, subnodes, node, subnode, transition; + selector = d3_selection_selectorAll(selector); + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + transition = node[ns][id]; + subnodes = selector.call(node, node.__data__, i, j); + subgroups.push(subgroup = []); + for (var k = -1, o = subnodes.length; ++k < o; ) { + if (subnode = subnodes[k]) d3_transitionNode(subnode, k, ns, id, transition); + subgroup.push(subnode); + } + } + } + } + return d3_transition(subgroups, ns, id); + }; + d3_transitionPrototype.filter = function(filter) { + var subgroups = [], subgroup, group, node; + if (typeof filter !== "function") filter = d3_selection_filter(filter); + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node, node.__data__, i, j)) { + subgroup.push(node); + } + } + } + return d3_transition(subgroups, this.namespace, this.id); + }; + d3_transitionPrototype.tween = function(name, tween) { + var id = this.id, ns = this.namespace; + if (arguments.length < 2) return this.node()[ns][id].tween.get(name); + return d3_selection_each(this, tween == null ? function(node) { + node[ns][id].tween.remove(name); + } : function(node) { + node[ns][id].tween.set(name, tween); + }); + }; + function d3_transition_tween(groups, name, value, tween) { + var id = groups.id, ns = groups.namespace; + return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) { + node[ns][id].tween.set(name, tween(value.call(node, node.__data__, i, j))); + } : (value = tween(value), function(node) { + node[ns][id].tween.set(name, value); + })); + } + d3_transitionPrototype.attr = function(nameNS, value) { + if (arguments.length < 2) { + for (value in nameNS) this.attr(value, nameNS[value]); + return this; + } + var interpolate = nameNS == "transform" ? d3_interpolateTransform : d3_interpolate, name = d3.ns.qualify(nameNS); + function attrNull() { + this.removeAttribute(name); + } + function attrNullNS() { + this.removeAttributeNS(name.space, name.local); + } + function attrTween(b) { + return b == null ? attrNull : (b += "", function() { + var a = this.getAttribute(name), i; + return a !== b && (i = interpolate(a, b), function(t) { + this.setAttribute(name, i(t)); + }); + }); + } + function attrTweenNS(b) { + return b == null ? attrNullNS : (b += "", function() { + var a = this.getAttributeNS(name.space, name.local), i; + return a !== b && (i = interpolate(a, b), function(t) { + this.setAttributeNS(name.space, name.local, i(t)); + }); + }); + } + return d3_transition_tween(this, "attr." + nameNS, value, name.local ? attrTweenNS : attrTween); + }; + d3_transitionPrototype.attrTween = function(nameNS, tween) { + var name = d3.ns.qualify(nameNS); + function attrTween(d, i) { + var f = tween.call(this, d, i, this.getAttribute(name)); + return f && function(t) { + this.setAttribute(name, f(t)); + }; + } + function attrTweenNS(d, i) { + var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); + return f && function(t) { + this.setAttributeNS(name.space, name.local, f(t)); + }; + } + return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); + }; + d3_transitionPrototype.style = function(name, value, priority) { + var n = arguments.length; + if (n < 3) { + if (typeof name !== "string") { + if (n < 2) value = ""; + for (priority in name) this.style(priority, name[priority], value); + return this; + } + priority = ""; + } + function styleNull() { + this.style.removeProperty(name); + } + function styleString(b) { + return b == null ? styleNull : (b += "", function() { + var a = d3_window(this).getComputedStyle(this, null).getPropertyValue(name), i; + return a !== b && (i = d3_interpolate(a, b), function(t) { + this.style.setProperty(name, i(t), priority); + }); + }); + } + return d3_transition_tween(this, "style." + name, value, styleString); + }; + d3_transitionPrototype.styleTween = function(name, tween, priority) { + if (arguments.length < 3) priority = ""; + function styleTween(d, i) { + var f = tween.call(this, d, i, d3_window(this).getComputedStyle(this, null).getPropertyValue(name)); + return f && function(t) { + this.style.setProperty(name, f(t), priority); + }; + } + return this.tween("style." + name, styleTween); + }; + d3_transitionPrototype.text = function(value) { + return d3_transition_tween(this, "text", value, d3_transition_text); + }; + function d3_transition_text(b) { + if (b == null) b = ""; + return function() { + this.textContent = b; + }; + } + d3_transitionPrototype.remove = function() { + var ns = this.namespace; + return this.each("end.transition", function() { + var p; + if (this[ns].count < 2 && (p = this.parentNode)) p.removeChild(this); + }); + }; + d3_transitionPrototype.ease = function(value) { + var id = this.id, ns = this.namespace; + if (arguments.length < 1) return this.node()[ns][id].ease; + if (typeof value !== "function") value = d3.ease.apply(d3, arguments); + return d3_selection_each(this, function(node) { + node[ns][id].ease = value; + }); + }; + d3_transitionPrototype.delay = function(value) { + var id = this.id, ns = this.namespace; + if (arguments.length < 1) return this.node()[ns][id].delay; + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { + node[ns][id].delay = +value.call(node, node.__data__, i, j); + } : (value = +value, function(node) { + node[ns][id].delay = value; + })); + }; + d3_transitionPrototype.duration = function(value) { + var id = this.id, ns = this.namespace; + if (arguments.length < 1) return this.node()[ns][id].duration; + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { + node[ns][id].duration = Math.max(1, value.call(node, node.__data__, i, j)); + } : (value = Math.max(1, value), function(node) { + node[ns][id].duration = value; + })); + }; + d3_transitionPrototype.each = function(type, listener) { + var id = this.id, ns = this.namespace; + if (arguments.length < 2) { + var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId; + try { + d3_transitionInheritId = id; + d3_selection_each(this, function(node, i, j) { + d3_transitionInherit = node[ns][id]; + type.call(node, node.__data__, i, j); + }); + } finally { + d3_transitionInherit = inherit; + d3_transitionInheritId = inheritId; + } + } else { + d3_selection_each(this, function(node) { + var transition = node[ns][id]; + (transition.event || (transition.event = d3.dispatch("start", "end", "interrupt"))).on(type, listener); + }); + } + return this; + }; + d3_transitionPrototype.transition = function() { + var id0 = this.id, id1 = ++d3_transitionId, ns = this.namespace, subgroups = [], subgroup, group, node, transition; + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + if (node = group[i]) { + transition = node[ns][id0]; + d3_transitionNode(node, i, ns, id1, { + time: transition.time, + ease: transition.ease, + delay: transition.delay + transition.duration, + duration: transition.duration + }); + } + subgroup.push(node); + } + } + return d3_transition(subgroups, ns, id1); + }; + function d3_transitionNamespace(name) { + return name == null ? "__transition__" : "__transition_" + name + "__"; + } + function d3_transitionNode(node, i, ns, id, inherit) { + var lock = node[ns] || (node[ns] = { + active: 0, + count: 0 + }), transition = lock[id], time, timer, duration, ease, tweens; + function schedule(elapsed) { + var delay = transition.delay; + timer.t = delay + time; + if (delay <= elapsed) return start(elapsed - delay); + timer.c = start; + } + function start(elapsed) { + var activeId = lock.active, active = lock[activeId]; + if (active) { + active.timer.c = null; + active.timer.t = NaN; + --lock.count; + delete lock[activeId]; + active.event && active.event.interrupt.call(node, node.__data__, active.index); + } + for (var cancelId in lock) { + if (+cancelId < id) { + var cancel = lock[cancelId]; + cancel.timer.c = null; + cancel.timer.t = NaN; + --lock.count; + delete lock[cancelId]; + } + } + timer.c = tick; + d3_timer(function() { + if (timer.c && tick(elapsed || 1)) { + timer.c = null; + timer.t = NaN; + } + return 1; + }, 0, time); + lock.active = id; + transition.event && transition.event.start.call(node, node.__data__, i); + tweens = []; + transition.tween.forEach(function(key, value) { + if (value = value.call(node, node.__data__, i)) { + tweens.push(value); + } + }); + ease = transition.ease; + duration = transition.duration; + } + function tick(elapsed) { + var t = elapsed / duration, e = ease(t), n = tweens.length; + while (n > 0) { + tweens[--n].call(node, e); + } + if (t >= 1) { + transition.event && transition.event.end.call(node, node.__data__, i); + if (--lock.count) delete lock[id]; else delete node[ns]; + return 1; + } + } + if (!transition) { + time = inherit.time; + timer = d3_timer(schedule, 0, time); + transition = lock[id] = { + tween: new d3_Map(), + time: time, + timer: timer, + delay: inherit.delay, + duration: inherit.duration, + ease: inherit.ease, + index: i + }; + inherit = null; + ++lock.count; + } + } + d3.svg.axis = function() { + var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_; + function axis(g) { + g.each(function() { + var g = d3.select(this); + var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy(); + var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g.selectAll(".tick").data(ticks, scale1), tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", ε), tickExit = d3.transition(tick.exit()).style("opacity", ε).remove(), tickUpdate = d3.transition(tick.order()).style("opacity", 1), tickSpacing = Math.max(innerTickSize, 0) + tickPadding, tickTransform; + var range = d3_scaleRange(scale1), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"), + d3.transition(path)); + tickEnter.append("line"); + tickEnter.append("text"); + var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"), sign = orient === "top" || orient === "left" ? -1 : 1, x1, x2, y1, y2; + if (orient === "bottom" || orient === "top") { + tickTransform = d3_svg_axisX, x1 = "x", y1 = "y", x2 = "x2", y2 = "y2"; + text.attr("dy", sign < 0 ? "0em" : ".71em").style("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + sign * outerTickSize + "V0H" + range[1] + "V" + sign * outerTickSize); + } else { + tickTransform = d3_svg_axisY, x1 = "y", y1 = "x", x2 = "y2", y2 = "x2"; + text.attr("dy", ".32em").style("text-anchor", sign < 0 ? "end" : "start"); + pathUpdate.attr("d", "M" + sign * outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + sign * outerTickSize); + } + lineEnter.attr(y2, sign * innerTickSize); + textEnter.attr(y1, sign * tickSpacing); + lineUpdate.attr(x2, 0).attr(y2, sign * innerTickSize); + textUpdate.attr(x1, 0).attr(y1, sign * tickSpacing); + if (scale1.rangeBand) { + var x = scale1, dx = x.rangeBand() / 2; + scale0 = scale1 = function(d) { + return x(d) + dx; + }; + } else if (scale0.rangeBand) { + scale0 = scale1; + } else { + tickExit.call(tickTransform, scale1, scale0); + } + tickEnter.call(tickTransform, scale0, scale1); + tickUpdate.call(tickTransform, scale1, scale1); + }); + } + axis.scale = function(x) { + if (!arguments.length) return scale; + scale = x; + return axis; + }; + axis.orient = function(x) { + if (!arguments.length) return orient; + orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient; + return axis; + }; + axis.ticks = function() { + if (!arguments.length) return tickArguments_; + tickArguments_ = d3_array(arguments); + return axis; + }; + axis.tickValues = function(x) { + if (!arguments.length) return tickValues; + tickValues = x; + return axis; + }; + axis.tickFormat = function(x) { + if (!arguments.length) return tickFormat_; + tickFormat_ = x; + return axis; + }; + axis.tickSize = function(x) { + var n = arguments.length; + if (!n) return innerTickSize; + innerTickSize = +x; + outerTickSize = +arguments[n - 1]; + return axis; + }; + axis.innerTickSize = function(x) { + if (!arguments.length) return innerTickSize; + innerTickSize = +x; + return axis; + }; + axis.outerTickSize = function(x) { + if (!arguments.length) return outerTickSize; + outerTickSize = +x; + return axis; + }; + axis.tickPadding = function(x) { + if (!arguments.length) return tickPadding; + tickPadding = +x; + return axis; + }; + axis.tickSubdivide = function() { + return arguments.length && axis; + }; + return axis; + }; + var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = { + top: 1, + right: 1, + bottom: 1, + left: 1 + }; + function d3_svg_axisX(selection, x0, x1) { + selection.attr("transform", function(d) { + var v0 = x0(d); + return "translate(" + (isFinite(v0) ? v0 : x1(d)) + ",0)"; + }); + } + function d3_svg_axisY(selection, y0, y1) { + selection.attr("transform", function(d) { + var v0 = y0(d); + return "translate(0," + (isFinite(v0) ? v0 : y1(d)) + ")"; + }); + } + d3.svg.brush = function() { + var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, xExtent = [ 0, 0 ], yExtent = [ 0, 0 ], xExtentDomain, yExtentDomain, xClamp = true, yClamp = true, resizes = d3_svg_brushResizes[0]; + function brush(g) { + g.each(function() { + var g = d3.select(this).style("pointer-events", "all").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart); + var background = g.selectAll(".background").data([ 0 ]); + background.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair"); + g.selectAll(".extent").data([ 0 ]).enter().append("rect").attr("class", "extent").style("cursor", "move"); + var resize = g.selectAll(".resize").data(resizes, d3_identity); + resize.exit().remove(); + resize.enter().append("g").attr("class", function(d) { + return "resize " + d; + }).style("cursor", function(d) { + return d3_svg_brushCursor[d]; + }).append("rect").attr("x", function(d) { + return /[ew]$/.test(d) ? -3 : null; + }).attr("y", function(d) { + return /^[ns]/.test(d) ? -3 : null; + }).attr("width", 6).attr("height", 6).style("visibility", "hidden"); + resize.style("display", brush.empty() ? "none" : null); + var gUpdate = d3.transition(g), backgroundUpdate = d3.transition(background), range; + if (x) { + range = d3_scaleRange(x); + backgroundUpdate.attr("x", range[0]).attr("width", range[1] - range[0]); + redrawX(gUpdate); + } + if (y) { + range = d3_scaleRange(y); + backgroundUpdate.attr("y", range[0]).attr("height", range[1] - range[0]); + redrawY(gUpdate); + } + redraw(gUpdate); + }); + } + brush.event = function(g) { + g.each(function() { + var event_ = event.of(this, arguments), extent1 = { + x: xExtent, + y: yExtent, + i: xExtentDomain, + j: yExtentDomain + }, extent0 = this.__chart__ || extent1; + this.__chart__ = extent1; + if (d3_transitionInheritId) { + d3.select(this).transition().each("start.brush", function() { + xExtentDomain = extent0.i; + yExtentDomain = extent0.j; + xExtent = extent0.x; + yExtent = extent0.y; + event_({ + type: "brushstart" + }); + }).tween("brush:brush", function() { + var xi = d3_interpolateArray(xExtent, extent1.x), yi = d3_interpolateArray(yExtent, extent1.y); + xExtentDomain = yExtentDomain = null; + return function(t) { + xExtent = extent1.x = xi(t); + yExtent = extent1.y = yi(t); + event_({ + type: "brush", + mode: "resize" + }); + }; + }).each("end.brush", function() { + xExtentDomain = extent1.i; + yExtentDomain = extent1.j; + event_({ + type: "brush", + mode: "resize" + }); + event_({ + type: "brushend" + }); + }); + } else { + event_({ + type: "brushstart" + }); + event_({ + type: "brush", + mode: "resize" + }); + event_({ + type: "brushend" + }); + } + }); + }; + function redraw(g) { + g.selectAll(".resize").attr("transform", function(d) { + return "translate(" + xExtent[+/e$/.test(d)] + "," + yExtent[+/^s/.test(d)] + ")"; + }); + } + function redrawX(g) { + g.select(".extent").attr("x", xExtent[0]); + g.selectAll(".extent,.n>rect,.s>rect").attr("width", xExtent[1] - xExtent[0]); + } + function redrawY(g) { + g.select(".extent").attr("y", yExtent[0]); + g.selectAll(".extent,.e>rect,.w>rect").attr("height", yExtent[1] - yExtent[0]); + } + function brushstart() { + var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), dragRestore = d3_event_dragSuppress(target), center, origin = d3.mouse(target), offset; + var w = d3.select(d3_window(target)).on("keydown.brush", keydown).on("keyup.brush", keyup); + if (d3.event.changedTouches) { + w.on("touchmove.brush", brushmove).on("touchend.brush", brushend); + } else { + w.on("mousemove.brush", brushmove).on("mouseup.brush", brushend); + } + g.interrupt().selectAll("*").interrupt(); + if (dragging) { + origin[0] = xExtent[0] - origin[0]; + origin[1] = yExtent[0] - origin[1]; + } else if (resizing) { + var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing); + offset = [ xExtent[1 - ex] - origin[0], yExtent[1 - ey] - origin[1] ]; + origin[0] = xExtent[ex]; + origin[1] = yExtent[ey]; + } else if (d3.event.altKey) center = origin.slice(); + g.style("pointer-events", "none").selectAll(".resize").style("display", null); + d3.select("body").style("cursor", eventTarget.style("cursor")); + event_({ + type: "brushstart" + }); + brushmove(); + function keydown() { + if (d3.event.keyCode == 32) { + if (!dragging) { + center = null; + origin[0] -= xExtent[1]; + origin[1] -= yExtent[1]; + dragging = 2; + } + d3_eventPreventDefault(); + } + } + function keyup() { + if (d3.event.keyCode == 32 && dragging == 2) { + origin[0] += xExtent[1]; + origin[1] += yExtent[1]; + dragging = 0; + d3_eventPreventDefault(); + } + } + function brushmove() { + var point = d3.mouse(target), moved = false; + if (offset) { + point[0] += offset[0]; + point[1] += offset[1]; + } + if (!dragging) { + if (d3.event.altKey) { + if (!center) center = [ (xExtent[0] + xExtent[1]) / 2, (yExtent[0] + yExtent[1]) / 2 ]; + origin[0] = xExtent[+(point[0] < center[0])]; + origin[1] = yExtent[+(point[1] < center[1])]; + } else center = null; + } + if (resizingX && move1(point, x, 0)) { + redrawX(g); + moved = true; + } + if (resizingY && move1(point, y, 1)) { + redrawY(g); + moved = true; + } + if (moved) { + redraw(g); + event_({ + type: "brush", + mode: dragging ? "move" : "resize" + }); + } + } + function move1(point, scale, i) { + var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], extent = i ? yExtent : xExtent, size = extent[1] - extent[0], min, max; + if (dragging) { + r0 -= position; + r1 -= size + position; + } + min = (i ? yClamp : xClamp) ? Math.max(r0, Math.min(r1, point[i])) : point[i]; + if (dragging) { + max = (min += position) + size; + } else { + if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min)); + if (position < min) { + max = min; + min = position; + } else { + max = position; + } + } + if (extent[0] != min || extent[1] != max) { + if (i) yExtentDomain = null; else xExtentDomain = null; + extent[0] = min; + extent[1] = max; + return true; + } + } + function brushend() { + brushmove(); + g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null); + d3.select("body").style("cursor", null); + w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null); + dragRestore(); + event_({ + type: "brushend" + }); + } + } + brush.x = function(z) { + if (!arguments.length) return x; + x = z; + resizes = d3_svg_brushResizes[!x << 1 | !y]; + return brush; + }; + brush.y = function(z) { + if (!arguments.length) return y; + y = z; + resizes = d3_svg_brushResizes[!x << 1 | !y]; + return brush; + }; + brush.clamp = function(z) { + if (!arguments.length) return x && y ? [ xClamp, yClamp ] : x ? xClamp : y ? yClamp : null; + if (x && y) xClamp = !!z[0], yClamp = !!z[1]; else if (x) xClamp = !!z; else if (y) yClamp = !!z; + return brush; + }; + brush.extent = function(z) { + var x0, x1, y0, y1, t; + if (!arguments.length) { + if (x) { + if (xExtentDomain) { + x0 = xExtentDomain[0], x1 = xExtentDomain[1]; + } else { + x0 = xExtent[0], x1 = xExtent[1]; + if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + } + } + if (y) { + if (yExtentDomain) { + y0 = yExtentDomain[0], y1 = yExtentDomain[1]; + } else { + y0 = yExtent[0], y1 = yExtent[1]; + if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + } + } + return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ]; + } + if (x) { + x0 = z[0], x1 = z[1]; + if (y) x0 = x0[0], x1 = x1[0]; + xExtentDomain = [ x0, x1 ]; + if (x.invert) x0 = x(x0), x1 = x(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + if (x0 != xExtent[0] || x1 != xExtent[1]) xExtent = [ x0, x1 ]; + } + if (y) { + y0 = z[0], y1 = z[1]; + if (x) y0 = y0[1], y1 = y1[1]; + yExtentDomain = [ y0, y1 ]; + if (y.invert) y0 = y(y0), y1 = y(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + if (y0 != yExtent[0] || y1 != yExtent[1]) yExtent = [ y0, y1 ]; + } + return brush; + }; + brush.clear = function() { + if (!brush.empty()) { + xExtent = [ 0, 0 ], yExtent = [ 0, 0 ]; + xExtentDomain = yExtentDomain = null; + } + return brush; + }; + brush.empty = function() { + return !!x && xExtent[0] == xExtent[1] || !!y && yExtent[0] == yExtent[1]; + }; + return d3.rebind(brush, event, "on"); + }; + var d3_svg_brushCursor = { + n: "ns-resize", + e: "ew-resize", + s: "ns-resize", + w: "ew-resize", + nw: "nwse-resize", + ne: "nesw-resize", + se: "nwse-resize", + sw: "nesw-resize" + }; + var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ]; + var d3_time_format = d3_time.format = d3_locale_enUS.timeFormat; + var d3_time_formatUtc = d3_time_format.utc; + var d3_time_formatIso = d3_time_formatUtc("%Y-%m-%dT%H:%M:%S.%LZ"); + d3_time_format.iso = Date.prototype.toISOString && +new Date("2000-01-01T00:00:00.000Z") ? d3_time_formatIsoNative : d3_time_formatIso; + function d3_time_formatIsoNative(date) { + return date.toISOString(); + } + d3_time_formatIsoNative.parse = function(string) { + var date = new Date(string); + return isNaN(date) ? null : date; + }; + d3_time_formatIsoNative.toString = d3_time_formatIso.toString; + d3_time.second = d3_time_interval(function(date) { + return new d3_date(Math.floor(date / 1e3) * 1e3); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 1e3); + }, function(date) { + return date.getSeconds(); + }); + d3_time.seconds = d3_time.second.range; + d3_time.seconds.utc = d3_time.second.utc.range; + d3_time.minute = d3_time_interval(function(date) { + return new d3_date(Math.floor(date / 6e4) * 6e4); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 6e4); + }, function(date) { + return date.getMinutes(); + }); + d3_time.minutes = d3_time.minute.range; + d3_time.minutes.utc = d3_time.minute.utc.range; + d3_time.hour = d3_time_interval(function(date) { + var timezone = date.getTimezoneOffset() / 60; + return new d3_date((Math.floor(date / 36e5 - timezone) + timezone) * 36e5); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 36e5); + }, function(date) { + return date.getHours(); + }); + d3_time.hours = d3_time.hour.range; + d3_time.hours.utc = d3_time.hour.utc.range; + d3_time.month = d3_time_interval(function(date) { + date = d3_time.day(date); + date.setDate(1); + return date; + }, function(date, offset) { + date.setMonth(date.getMonth() + offset); + }, function(date) { + return date.getMonth(); + }); + d3_time.months = d3_time.month.range; + d3_time.months.utc = d3_time.month.utc.range; + function d3_time_scale(linear, methods, format) { + function scale(x) { + return linear(x); + } + scale.invert = function(x) { + return d3_time_scaleDate(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(d3_time_scaleDate); + linear.domain(x); + return scale; + }; + function tickMethod(extent, count) { + var span = extent[1] - extent[0], target = span / count, i = d3.bisect(d3_time_scaleSteps, target); + return i == d3_time_scaleSteps.length ? [ methods.year, d3_scale_linearTickRange(extent.map(function(d) { + return d / 31536e6; + }), count)[2] ] : !i ? [ d3_time_scaleMilliseconds, d3_scale_linearTickRange(extent, count)[2] ] : methods[target / d3_time_scaleSteps[i - 1] < d3_time_scaleSteps[i] / target ? i - 1 : i]; + } + scale.nice = function(interval, skip) { + var domain = scale.domain(), extent = d3_scaleExtent(domain), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" && tickMethod(extent, interval); + if (method) interval = method[0], skip = method[1]; + function skipped(date) { + return !isNaN(date) && !interval.range(date, d3_time_scaleDate(+date + 1), skip).length; + } + return scale.domain(d3_scale_nice(domain, skip > 1 ? { + floor: function(date) { + while (skipped(date = interval.floor(date))) date = d3_time_scaleDate(date - 1); + return date; + }, + ceil: function(date) { + while (skipped(date = interval.ceil(date))) date = d3_time_scaleDate(+date + 1); + return date; + } + } : interval)); + }; + scale.ticks = function(interval, skip) { + var extent = d3_scaleExtent(scale.domain()), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" ? tickMethod(extent, interval) : !interval.range && [ { + range: interval + }, skip ]; + if (method) interval = method[0], skip = method[1]; + return interval.range(extent[0], d3_time_scaleDate(+extent[1] + 1), skip < 1 ? 1 : skip); + }; + scale.tickFormat = function() { + return format; + }; + scale.copy = function() { + return d3_time_scale(linear.copy(), methods, format); + }; + return d3_scale_linearRebind(scale, linear); + } + function d3_time_scaleDate(t) { + return new Date(t); + } + var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ]; + var d3_time_scaleLocalMethods = [ [ d3_time.second, 1 ], [ d3_time.second, 5 ], [ d3_time.second, 15 ], [ d3_time.second, 30 ], [ d3_time.minute, 1 ], [ d3_time.minute, 5 ], [ d3_time.minute, 15 ], [ d3_time.minute, 30 ], [ d3_time.hour, 1 ], [ d3_time.hour, 3 ], [ d3_time.hour, 6 ], [ d3_time.hour, 12 ], [ d3_time.day, 1 ], [ d3_time.day, 2 ], [ d3_time.week, 1 ], [ d3_time.month, 1 ], [ d3_time.month, 3 ], [ d3_time.year, 1 ] ]; + var d3_time_scaleLocalFormat = d3_time_format.multi([ [ ".%L", function(d) { + return d.getMilliseconds(); + } ], [ ":%S", function(d) { + return d.getSeconds(); + } ], [ "%I:%M", function(d) { + return d.getMinutes(); + } ], [ "%I %p", function(d) { + return d.getHours(); + } ], [ "%a %d", function(d) { + return d.getDay() && d.getDate() != 1; + } ], [ "%b %d", function(d) { + return d.getDate() != 1; + } ], [ "%B", function(d) { + return d.getMonth(); + } ], [ "%Y", d3_true ] ]); + var d3_time_scaleMilliseconds = { + range: function(start, stop, step) { + return d3.range(Math.ceil(start / step) * step, +stop, step).map(d3_time_scaleDate); + }, + floor: d3_identity, + ceil: d3_identity + }; + d3_time_scaleLocalMethods.year = d3_time.year; + d3_time.scale = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); + }; + var d3_time_scaleUtcMethods = d3_time_scaleLocalMethods.map(function(m) { + return [ m[0].utc, m[1] ]; + }); + var d3_time_scaleUtcFormat = d3_time_formatUtc.multi([ [ ".%L", function(d) { + return d.getUTCMilliseconds(); + } ], [ ":%S", function(d) { + return d.getUTCSeconds(); + } ], [ "%I:%M", function(d) { + return d.getUTCMinutes(); + } ], [ "%I %p", function(d) { + return d.getUTCHours(); + } ], [ "%a %d", function(d) { + return d.getUTCDay() && d.getUTCDate() != 1; + } ], [ "%b %d", function(d) { + return d.getUTCDate() != 1; + } ], [ "%B", function(d) { + return d.getUTCMonth(); + } ], [ "%Y", d3_true ] ]); + d3_time_scaleUtcMethods.year = d3_time.year.utc; + d3_time.scale.utc = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleUtcMethods, d3_time_scaleUtcFormat); + }; + d3.text = d3_xhrType(function(request) { + return request.responseText; + }); + d3.json = function(url, callback) { + return d3_xhr(url, "application/json", d3_json, callback); + }; + function d3_json(request) { + return JSON.parse(request.responseText); + } + d3.html = function(url, callback) { + return d3_xhr(url, "text/html", d3_html, callback); + }; + function d3_html(request) { + var range = d3_document.createRange(); + range.selectNode(d3_document.body); + return range.createContextualFragment(request.responseText); + } + d3.xml = d3_xhrType(function(request) { + return request.responseXML; + }); + if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; +}(); \ No newline at end of file diff --git a/debian/missing-sources/datamaps.world.js b/debian/missing-sources/datamaps.world.js new file mode 100644 index 0000000..492eaeb --- /dev/null +++ b/debian/missing-sources/datamaps.world.js @@ -0,0 +1,12241 @@ +(function() { + var svg; + + //save off default references + var d3 = window.d3, topojson = window.topojson; + + var defaultOptions = { + scope: 'world', + responsive: false, + setProjection: setProjection, + projection: 'equirectangular', + dataType: 'json', + data: {}, + done: function() {}, + fills: { + defaultFill: '#ABDDA4' + }, + geographyConfig: { + dataUrl: null, + hideAntarctica: true, + borderWidth: 1, + borderColor: '#FDFDFD', + popupTemplate: function(geography, data) { + return '
' + geography.properties.name + '
'; + }, + popupOnHover: true, + highlightOnHover: true, + highlightFillColor: '#FC8D59', + highlightBorderColor: 'rgba(250, 15, 160, 0.2)', + highlightBorderWidth: 2 + }, + projectionConfig: { + rotation: [97, 0] + }, + bubblesConfig: { + borderWidth: 2, + borderColor: '#FFFFFF', + popupOnHover: true, + radius: null, + popupTemplate: function(geography, data) { + return '
' + data.name + '
'; + }, + fillOpacity: 0.75, + animate: true, + highlightOnHover: true, + highlightFillColor: '#FC8D59', + highlightBorderColor: 'rgba(250, 15, 160, 0.2)', + highlightBorderWidth: 2, + highlightFillOpacity: 0.85, + exitDelay: 100 + }, + arcConfig: { + strokeColor: '#DD1C77', + strokeWidth: 1, + arcSharpness: 1, + animationSpeed: 600 + } + }; + + /* + Getter for value. If not declared on datumValue, look up the chain into optionsValue + */ + function val( datumValue, optionsValue, context ) { + if ( typeof context === 'undefined' ) { + context = optionsValue; + optionsValues = undefined; + } + var value = typeof datumValue !== 'undefined' ? datumValue : optionsValue; + + if (typeof value === 'undefined') { + return null; + } + + if ( typeof value === 'function' ) { + var fnContext = [context]; + if ( context.geography ) { + fnContext = [context.geography, context.data]; + } + return value.apply(null, fnContext); + } + else { + return value; + } + } + + function addContainer( element, height, width ) { + this.svg = d3.select( element ).append('svg') + .attr('width', width || element.offsetWidth) + .attr('data-width', width || element.offsetWidth) + .attr('class', 'datamap') + .attr('height', height || element.offsetHeight) + .style('overflow', 'hidden'); // IE10+ doesn't respect height/width when map is zoomed in + + if (this.options.responsive) { + d3.select(this.options.element).style({'position': 'relative', 'padding-bottom': '60%'}); + d3.select(this.options.element).select('svg').style({'position': 'absolute', 'width': '100%', 'height': '100%'}); + d3.select(this.options.element).select('svg').select('g').selectAll('path').style('vector-effect', 'non-scaling-stroke'); + + } + + return this.svg; + } + + // setProjection takes the svg element and options + function setProjection( element, options ) { + var width = options.width || element.offsetWidth; + var height = options.height || element.offsetHeight; + var projection, path; + var svg = this.svg; + + if ( options && typeof options.scope === 'undefined') { + options.scope = 'world'; + } + + if ( options.scope === 'usa' ) { + projection = d3.geo.albersUsa() + .scale(width) + .translate([width / 2, height / 2]); + } + else if ( options.scope === 'world' ) { + projection = d3.geo[options.projection]() + .scale((width + 1) / 2 / Math.PI) + .translate([width / 2, height / (options.projection === "mercator" ? 1.45 : 1.8)]); + } + + if ( options.projection === 'orthographic' ) { + + svg.append("defs").append("path") + .datum({type: "Sphere"}) + .attr("id", "sphere") + .attr("d", path); + + svg.append("use") + .attr("class", "stroke") + .attr("xlink:href", "#sphere"); + + svg.append("use") + .attr("class", "fill") + .attr("xlink:href", "#sphere"); + projection.scale(250).clipAngle(90).rotate(options.projectionConfig.rotation) + } + + path = d3.geo.path() + .projection( projection ); + + return {path: path, projection: projection}; + } + + function addStyleBlock() { + if ( d3.select('.datamaps-style-block').empty() ) { + d3.select('head').append('style').attr('class', 'datamaps-style-block') + .html('.datamap path.datamaps-graticule { fill: none; stroke: #777; stroke-width: 0.5px; stroke-opacity: .5; pointer-events: none; } .datamap .labels {pointer-events: none;} .datamap path {stroke: #FFFFFF; stroke-width: 1px;} .datamaps-legend dt, .datamaps-legend dd { float: left; margin: 0 3px 0 0;} .datamaps-legend dd {width: 20px; margin-right: 6px; border-radius: 3px;} .datamaps-legend {padding-bottom: 20px; z-index: 1001; position: absolute; left: 4px; font-size: 12px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;} .datamaps-hoverover {display: none; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } .hoverinfo {padding: 4px; border-radius: 1px; background-color: #FFF; box-shadow: 1px 1px 5px #CCC; font-size: 12px; border: 1px solid #CCC; } .hoverinfo hr {border:1px dotted #CCC; }'); + } + } + + function drawSubunits( data ) { + var fillData = this.options.fills, + colorCodeData = this.options.data || {}, + geoConfig = this.options.geographyConfig; + + + var subunits = this.svg.select('g.datamaps-subunits'); + if ( subunits.empty() ) { + subunits = this.addLayer('datamaps-subunits', null, true); + } + + var geoData = topojson.feature( data, data.objects[ this.options.scope ] ).features; + if ( geoConfig.hideAntarctica ) { + geoData = geoData.filter(function(feature) { + return feature.id !== "ATA"; + }); + } + + var geo = subunits.selectAll('path.datamaps-subunit').data( geoData ); + + geo.enter() + .append('path') + .attr('d', this.path) + .attr('class', function(d) { + return 'datamaps-subunit ' + d.id; + }) + .attr('data-info', function(d) { + return JSON.stringify( colorCodeData[d.id]); + }) + .style('fill', function(d) { + //if fillKey - use that + //otherwise check 'fill' + //otherwise check 'defaultFill' + var fillColor; + + var datum = colorCodeData[d.id]; + if ( datum && datum.fillKey ) { + fillColor = fillData[ val(datum.fillKey, {data: colorCodeData[d.id], geography: d}) ]; + } + + if ( typeof fillColor === 'undefined' ) { + fillColor = val(datum && datum.fillColor, fillData.defaultFill, {data: colorCodeData[d.id], geography: d}); + } + + return fillColor; + }) + .style('stroke-width', geoConfig.borderWidth) + .style('stroke', geoConfig.borderColor); + } + + function handleGeographyConfig () { + var hoverover; + var svg = this.svg; + var self = this; + var options = this.options.geographyConfig; + + if ( options.highlightOnHover || options.popupOnHover ) { + svg.selectAll('.datamaps-subunit') + .on('mouseover', function(d) { + var $this = d3.select(this); + var datum = self.options.data[d.id] || {}; + if ( options.highlightOnHover ) { + var previousAttributes = { + 'fill': $this.style('fill'), + 'stroke': $this.style('stroke'), + 'stroke-width': $this.style('stroke-width'), + 'fill-opacity': $this.style('fill-opacity') + }; + + $this + .style('fill', val(datum.highlightFillColor, options.highlightFillColor, datum)) + .style('stroke', val(datum.highlightBorderColor, options.highlightBorderColor, datum)) + .style('stroke-width', val(datum.highlightBorderWidth, options.highlightBorderWidth, datum)) + .style('fill-opacity', val(datum.highlightFillOpacity, options.highlightFillOpacity, datum)) + .attr('data-previousAttributes', JSON.stringify(previousAttributes)); + + //as per discussion on https://github.com/markmarkoh/datamaps/issues/19 + if ( ! /((MSIE)|(Trident))/.test ) { + moveToFront.call(this); + } + } + + if ( options.popupOnHover ) { + self.updatePopup($this, d, options, svg); + } + }) + .on('mouseout', function() { + var $this = d3.select(this); + + if (options.highlightOnHover) { + //reapply previous attributes + var previousAttributes = JSON.parse( $this.attr('data-previousAttributes') ); + for ( var attr in previousAttributes ) { + $this.style(attr, previousAttributes[attr]); + } + } + $this.on('mousemove', null); + d3.selectAll('.datamaps-hoverover').style('display', 'none'); + }); + } + + function moveToFront() { + this.parentNode.appendChild(this); + } + } + + //plugin to add a simple map legend + function addLegend(layer, data, options) { + data = data || {}; + if ( !this.options.fills ) { + return; + } + + var html = '
'; + var label = ''; + if ( data.legendTitle ) { + html = '

' + data.legendTitle + '

' + html; + } + for ( var fillKey in this.options.fills ) { + + if ( fillKey === 'defaultFill') { + if (! data.defaultFillName ) { + continue; + } + label = data.defaultFillName; + } else { + if (data.labels && data.labels[fillKey]) { + label = data.labels[fillKey]; + } else { + label= fillKey + ': '; + } + } + html += '
' + label + '
'; + html += '
 
'; + } + html += '
'; + + var hoverover = d3.select( this.options.element ).append('div') + .attr('class', 'datamaps-legend') + .html(html); + } + + function addGraticule ( layer, options ) { + var graticule = d3.geo.graticule(); + this.svg.insert("path", '.datamaps-subunits') + .datum(graticule) + .attr("class", "datamaps-graticule") + .attr("d", this.path); + } + + function handleArcs (layer, data, options) { + var self = this, + svg = this.svg; + + if ( !data || (data && !data.slice) ) { + throw "Datamaps Error - arcs must be an array"; + } + + // For some reason arc options were put in an `options` object instead of the parent arc + // I don't like this, so to match bubbles and other plugins I'm moving it + // This is to keep backwards compatability + for ( var i = 0; i < data.length; i++ ) { + data[i] = defaults(data[i], data[i].options); + delete data[i].options; + } + + if ( typeof options === "undefined" ) { + options = defaultOptions.arcConfig; + } + + var arcs = layer.selectAll('path.datamaps-arc').data( data, JSON.stringify ); + + var path = d3.geo.path() + .projection(self.projection); + + arcs + .enter() + .append('svg:path') + .attr('class', 'datamaps-arc') + .style('stroke-linecap', 'round') + .style('stroke', function(datum) { + return val(datum.strokeColor, options.strokeColor, datum); + }) + .style('fill', 'none') + .style('stroke-width', function(datum) { + return val(datum.strokeWidth, options.strokeWidth, datum); + }) + .attr('d', function(datum) { + var originXY = self.latLngToXY(val(datum.origin.latitude, datum), val(datum.origin.longitude, datum)) + var destXY = self.latLngToXY(val(datum.destination.latitude, datum), val(datum.destination.longitude, datum)); + var midXY = [ (originXY[0] + destXY[0]) / 2, (originXY[1] + destXY[1]) / 2]; + if (options.greatArc) { + // TODO: Move this to inside `if` clause when setting attr `d` + var greatArc = d3.geo.greatArc() + .source(function(d) { return [val(d.origin.longitude, d), val(d.origin.latitude, d)]; }) + .target(function(d) { return [val(d.destination.longitude, d), val(d.destination.latitude, d)]; }); + + return path(greatArc(datum)) + } + var sharpness = val(datum.arcSharpness, options.arcSharpness, datum); + return "M" + originXY[0] + ',' + originXY[1] + "S" + (midXY[0] + (50 * sharpness)) + "," + (midXY[1] - (75 * sharpness)) + "," + destXY[0] + "," + destXY[1]; + }) + .transition() + .delay(100) + .style('fill', function(datum) { + /* + Thank you Jake Archibald, this is awesome. + Source: http://jakearchibald.com/2013/animated-line-drawing-svg/ + */ + var length = this.getTotalLength(); + this.style.transition = this.style.WebkitTransition = 'none'; + this.style.strokeDasharray = length + ' ' + length; + this.style.strokeDashoffset = length; + this.getBoundingClientRect(); + this.style.transition = this.style.WebkitTransition = 'stroke-dashoffset ' + val(datum.animationSpeed, options.animationSpeed, datum) + 'ms ease-out'; + this.style.strokeDashoffset = '0'; + return 'none'; + }) + + arcs.exit() + .transition() + .style('opacity', 0) + .remove(); + } + + function handleLabels ( layer, options ) { + var self = this; + options = options || {}; + var labelStartCoodinates = this.projection([-67.707617, 42.722131]); + this.svg.selectAll(".datamaps-subunit") + .attr("data-foo", function(d) { + var center = self.path.centroid(d); + var xOffset = 7.5, yOffset = 5; + + if ( ["FL", "KY", "MI"].indexOf(d.id) > -1 ) xOffset = -2.5; + if ( d.id === "NY" ) xOffset = -1; + if ( d.id === "MI" ) yOffset = 18; + if ( d.id === "LA" ) xOffset = 13; + + var x,y; + + x = center[0] - xOffset; + y = center[1] + yOffset; + + var smallStateIndex = ["VT", "NH", "MA", "RI", "CT", "NJ", "DE", "MD", "DC"].indexOf(d.id); + if ( smallStateIndex > -1) { + var yStart = labelStartCoodinates[1]; + x = labelStartCoodinates[0]; + y = yStart + (smallStateIndex * (2+ (options.fontSize || 12))); + layer.append("line") + .attr("x1", x - 3) + .attr("y1", y - 5) + .attr("x2", center[0]) + .attr("y2", center[1]) + .style("stroke", options.labelColor || "#000") + .style("stroke-width", options.lineWidth || 1) + } + + layer.append("text") + .attr("x", x) + .attr("y", y) + .style("font-size", (options.fontSize || 10) + 'px') + .style("font-family", options.fontFamily || "Verdana") + .style("fill", options.labelColor || "#000") + .text( d.id ); + return "bar"; + }); + } + + + function handleBubbles (layer, data, options ) { + var self = this, + fillData = this.options.fills, + svg = this.svg; + + if ( !data || (data && !data.slice) ) { + throw "Datamaps Error - bubbles must be an array"; + } + + var bubbles = layer.selectAll('circle.datamaps-bubble').data( data, JSON.stringify ); + + bubbles + .enter() + .append('svg:circle') + .attr('class', 'datamaps-bubble') + .attr('cx', function ( datum ) { + var latLng; + if ( datumHasCoords(datum) ) { + latLng = self.latLngToXY(datum.latitude, datum.longitude); + } + else if ( datum.centered ) { + latLng = self.path.centroid(svg.select('path.' + datum.centered).data()[0]); + } + if ( latLng ) return latLng[0]; + }) + .attr('cy', function ( datum ) { + var latLng; + if ( datumHasCoords(datum) ) { + latLng = self.latLngToXY(datum.latitude, datum.longitude); + } + else if ( datum.centered ) { + latLng = self.path.centroid(svg.select('path.' + datum.centered).data()[0]); + } + if ( latLng ) return latLng[1];; + }) + .attr('r', 0) //for animation purposes + .attr('data-info', function(d) { + return JSON.stringify(d); + }) + .style('stroke', function ( datum ) { + return val(datum.borderColor, options.borderColor, datum); + }) + .style('stroke-width', function ( datum ) { + return val(datum.borderWidth, options.borderWidth, datum); + }) + .style('fill-opacity', function ( datum ) { + return val(datum.fillOpacity, options.fillOpacity, datum); + }) + .style('fill', function ( datum ) { + var fillColor = fillData[ val(datum.fillKey, options.fillKey, datum) ]; + return fillColor || fillData.defaultFill; + }) + .on('mouseover', function ( datum ) { + var $this = d3.select(this); + + if (options.highlightOnHover) { + //save all previous attributes for mouseout + var previousAttributes = { + 'fill': $this.style('fill'), + 'stroke': $this.style('stroke'), + 'stroke-width': $this.style('stroke-width'), + 'fill-opacity': $this.style('fill-opacity') + }; + + $this + .style('fill', val(datum.highlightFillColor, options.highlightFillColor, datum)) + .style('stroke', val(datum.highlightBorderColor, options.highlightBorderColor, datum)) + .style('stroke-width', val(datum.highlightBorderWidth, options.highlightBorderWidth, datum)) + .style('fill-opacity', val(datum.highlightFillOpacity, options.highlightFillOpacity, datum)) + .attr('data-previousAttributes', JSON.stringify(previousAttributes)); + } + + if (options.popupOnHover) { + self.updatePopup($this, datum, options, svg); + } + }) + .on('mouseout', function ( datum ) { + var $this = d3.select(this); + + if (options.highlightOnHover) { + //reapply previous attributes + var previousAttributes = JSON.parse( $this.attr('data-previousAttributes') ); + for ( var attr in previousAttributes ) { + $this.style(attr, previousAttributes[attr]); + } + } + + d3.selectAll('.datamaps-hoverover').style('display', 'none'); + }) + .transition().duration(400) + .attr('r', function ( datum ) { + return val(datum.radius, options.radius, datum); + }); + + bubbles.exit() + .transition() + .delay(options.exitDelay) + .attr("r", 0) + .remove(); + + function datumHasCoords (datum) { + return typeof datum !== 'undefined' && typeof datum.latitude !== 'undefined' && typeof datum.longitude !== 'undefined'; + } + + } + + //stolen from underscore.js + function defaults(obj) { + Array.prototype.slice.call(arguments, 1).forEach(function(source) { + if (source) { + for (var prop in source) { + if (obj[prop] == null) obj[prop] = source[prop]; + } + } + }); + return obj; + } + /************************************** + Public Functions + ***************************************/ + + function Datamap( options ) { + + if ( typeof d3 === 'undefined' || typeof topojson === 'undefined' ) { + throw new Error('Include d3.js (v3.0.3 or greater) and topojson on this page before creating a new map'); + } + //set options for global use + this.options = defaults(options, defaultOptions); + this.options.geographyConfig = defaults(options.geographyConfig, defaultOptions.geographyConfig); + this.options.projectionConfig = defaults(options.projectionConfig, defaultOptions.projectionConfig); + this.options.bubblesConfig = defaults(options.bubblesConfig, defaultOptions.bubblesConfig); + this.options.arcConfig = defaults(options.arcConfig, defaultOptions.arcConfig); + + //add the SVG container + if ( d3.select( this.options.element ).select('svg').length > 0 ) { + addContainer.call(this, this.options.element, this.options.height, this.options.width ); + } + + /* Add core plugins to this instance */ + this.addPlugin('bubbles', handleBubbles); + this.addPlugin('legend', addLegend); + this.addPlugin('arc', handleArcs); + this.addPlugin('labels', handleLabels); + this.addPlugin('graticule', addGraticule); + + //append style block with basic hoverover styles + if ( ! this.options.disableDefaultStyles ) { + addStyleBlock(); + } + + return this.draw(); + } + + // resize map + Datamap.prototype.resize = function () { + + var self = this; + var options = self.options; + + if (options.responsive) { + var prefix = '-webkit-transform' in document.body.style ? '-webkit-' : '-moz-transform' in document.body.style ? '-moz-' : '-ms-transform' in document.body.style ? '-ms-' : '', + newsize = options.element.clientWidth, + oldsize = d3.select( options.element).select('svg').attr('data-width'); + + d3.select(options.element).select('svg').selectAll('g').style(prefix + 'transform', 'scale(' + (newsize / oldsize) + ')'); + } + } + + // actually draw the features(states & countries) + Datamap.prototype.draw = function() { + //save off in a closure + var self = this; + var options = self.options; + + //set projections and paths based on scope + var pathAndProjection = options.setProjection.apply(self, [options.element, options] ); + + this.path = pathAndProjection.path; + this.projection = pathAndProjection.projection; + + //if custom URL for topojson data, retrieve it and render + if ( options.geographyConfig.dataUrl ) { + d3.json( options.geographyConfig.dataUrl, function(error, results) { + if ( error ) throw new Error(error); + self.customTopo = results; + draw( results ); + }); + } + else { + draw( this[options.scope + 'Topo'] || options.geographyConfig.dataJson); + } + + return this; + + function draw (data) { + // if fetching remote data, draw the map first then call `updateChoropleth` + if ( self.options.dataUrl ) { + //allow for csv or json data types + d3[self.options.dataType](self.options.dataUrl, function(data) { + //in the case of csv, transform data to object + if ( self.options.dataType === 'csv' && (data && data.slice) ) { + var tmpData = {}; + for(var i = 0; i < data.length; i++) { + tmpData[data[i].id] = data[i]; + } + data = tmpData; + } + Datamaps.prototype.updateChoropleth.call(self, data); + }); + } + drawSubunits.call(self, data); + handleGeographyConfig.call(self); + + if ( self.options.geographyConfig.popupOnHover || self.options.bubblesConfig.popupOnHover) { + hoverover = d3.select( self.options.element ).append('div') + .attr('class', 'datamaps-hoverover') + .style('z-index', 10001) + .style('position', 'absolute'); + } + + //fire off finished callback + self.options.done(self); + } + }; + /************************************** + TopoJSON + ***************************************/ + Datamap.prototype.worldTopo = { + "type": "Topology", + "objects": { + "world": { + "type": "GeometryCollection", + "geometries": [{ + "type": "Polygon", + "properties": { + "name": "Afghanistan" + }, + "id": "AFG", + "arcs": [ + [0, 1, 2, 3, 4, 5] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Angola" + }, + "id": "AGO", + "arcs": [ + [ + [6, 7, 8, 9] + ], + [ + [10, 11, 12] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Albania" + }, + "id": "ALB", + "arcs": [ + [13, 14, 15, 16, 17] + ] + }, { + "type": "Polygon", + "properties": { + "name": "United Arab Emirates" + }, + "id": "ARE", + "arcs": [ + [18, 19, 20, 21, 22] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Argentina" + }, + "id": "ARG", + "arcs": [ + [ + [23, 24] + ], + [ + [25, 26, 27, 28, 29, 30] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Armenia" + }, + "id": "ARM", + "arcs": [ + [31, 32, 33, 34, 35] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Antarctica" + }, + "id": "ATA", + "arcs": [ + [ + [36] + ], + [ + [37] + ], + [ + [38] + ], + [ + [39] + ], + [ + [40] + ], + [ + [41] + ], + [ + [42] + ], + [ + [43] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "French Southern and Antarctic Lands" + }, + "id": "ATF", + "arcs": [ + [44] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Australia" + }, + "id": "AUS", + "arcs": [ + [ + [45] + ], + [ + [46] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Austria" + }, + "id": "AUT", + "arcs": [ + [47, 48, 49, 50, 51, 52, 53] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Azerbaijan" + }, + "id": "AZE", + "arcs": [ + [ + [54, -35] + ], + [ + [55, 56, -33, 57, 58] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Burundi" + }, + "id": "BDI", + "arcs": [ + [59, 60, 61] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Belgium" + }, + "id": "BEL", + "arcs": [ + [62, 63, 64, 65, 66] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Benin" + }, + "id": "BEN", + "arcs": [ + [67, 68, 69, 70, 71] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Burkina Faso" + }, + "id": "BFA", + "arcs": [ + [72, 73, 74, -70, 75, 76] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Bangladesh" + }, + "id": "BGD", + "arcs": [ + [77, 78, 79] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Bulgaria" + }, + "id": "BGR", + "arcs": [ + [80, 81, 82, 83, 84, 85] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "The Bahamas" + }, + "id": "BHS", + "arcs": [ + [ + [86] + ], + [ + [87] + ], + [ + [88] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Bosnia and Herzegovina" + }, + "id": "BIH", + "arcs": [ + [89, 90, 91] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Belarus" + }, + "id": "BLR", + "arcs": [ + [92, 93, 94, 95, 96] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Belize" + }, + "id": "BLZ", + "arcs": [ + [97, 98, 99] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Bolivia" + }, + "id": "BOL", + "arcs": [ + [100, 101, 102, 103, -31] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Brazil" + }, + "id": "BRA", + "arcs": [ + [-27, 104, -103, 105, 106, 107, 108, 109, 110, 111, 112] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Brunei" + }, + "id": "BRN", + "arcs": [ + [113, 114] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Bhutan" + }, + "id": "BTN", + "arcs": [ + [115, 116] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Botswana" + }, + "id": "BWA", + "arcs": [ + [117, 118, 119, 120] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Central African Republic" + }, + "id": "CAF", + "arcs": [ + [121, 122, 123, 124, 125, 126, 127] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Canada" + }, + "id": "CAN", + "arcs": [ + [ + [128] + ], + [ + [129] + ], + [ + [130] + ], + [ + [131] + ], + [ + [132] + ], + [ + [133] + ], + [ + [134] + ], + [ + [135] + ], + [ + [136] + ], + [ + [137] + ], + [ + [138, 139, 140, 141] + ], + [ + [142] + ], + [ + [143] + ], + [ + [144] + ], + [ + [145] + ], + [ + [146] + ], + [ + [147] + ], + [ + [148] + ], + [ + [149] + ], + [ + [150] + ], + [ + [151] + ], + [ + [152] + ], + [ + [153] + ], + [ + [154] + ], + [ + [155] + ], + [ + [156] + ], + [ + [157] + ], + [ + [158] + ], + [ + [159] + ], + [ + [160] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Switzerland" + }, + "id": "CHE", + "arcs": [ + [-51, 161, 162, 163] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Chile" + }, + "id": "CHL", + "arcs": [ + [ + [-24, 164] + ], + [ + [-30, 165, 166, -101] + ] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "China" + }, + "id": "CHN", + "arcs": [ + [ + [167] + ], + [ + [168, 169, 170, 171, 172, 173, -117, 174, 175, 176, 177, -4, 178, 179, 180, 181, 182, 183] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Ivory Coast" + }, + "id": "CIV", + "arcs": [ + [184, 185, 186, 187, -73, 188] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Cameroon" + }, + "id": "CMR", + "arcs": [ + [189, 190, 191, 192, 193, 194, -128, 195] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Democratic Republic of the Congo" + }, + "id": "COD", + "arcs": [ + [196, 197, -60, 198, 199, -10, 200, -13, 201, -126, 202] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Republic of the Congo" + }, + "id": "COG", + "arcs": [ + [-12, 203, 204, -196, -127, -202] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Colombia" + }, + "id": "COL", + "arcs": [ + [205, 206, 207, 208, 209, -107, 210] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Costa Rica" + }, + "id": "CRI", + "arcs": [ + [211, 212, 213, 214] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Cuba" + }, + "id": "CUB", + "arcs": [ + [215] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Northern Cyprus" + }, + "id": "-99", + "arcs": [ + [216, 217] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Cyprus" + }, + "id": "CYP", + "arcs": [ + [218, -218] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Czech Republic" + }, + "id": "CZE", + "arcs": [ + [-53, 219, 220, 221] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Germany" + }, + "id": "DEU", + "arcs": [ + [222, 223, -220, -52, -164, 224, 225, -64, 226, 227, 228] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Djibouti" + }, + "id": "DJI", + "arcs": [ + [229, 230, 231, 232] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Denmark" + }, + "id": "DNK", + "arcs": [ + [ + [233] + ], + [ + [-229, 234] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Dominican Republic" + }, + "id": "DOM", + "arcs": [ + [235, 236] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Algeria" + }, + "id": "DZA", + "arcs": [ + [237, 238, 239, 240, 241, 242, 243, 244] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Ecuador" + }, + "id": "ECU", + "arcs": [ + [245, -206, 246] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Egypt" + }, + "id": "EGY", + "arcs": [ + [247, 248, 249, 250, 251] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Eritrea" + }, + "id": "ERI", + "arcs": [ + [252, 253, 254, -233] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Spain" + }, + "id": "ESP", + "arcs": [ + [255, 256, 257, 258] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Estonia" + }, + "id": "EST", + "arcs": [ + [259, 260, 261] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Ethiopia" + }, + "id": "ETH", + "arcs": [ + [-232, 262, 263, 264, 265, 266, 267, -253] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Finland" + }, + "id": "FIN", + "arcs": [ + [268, 269, 270, 271] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Fiji" + }, + "id": "FJI", + "arcs": [ + [ + [272] + ], + [ + [273, 274] + ], + [ + [275, -275] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Falkland Islands" + }, + "id": "FLK", + "arcs": [ + [276] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "France" + }, + "id": "FRA", + "arcs": [ + [ + [277] + ], + [ + [278, -225, -163, 279, 280, -257, 281, -66] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "French Guiana" + }, + "id": "GUF", + "arcs": [ + [282, 283, 284, 285, -111] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Gabon" + }, + "id": "GAB", + "arcs": [ + [286, 287, -190, -205] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "United Kingdom" + }, + "id": "GBR", + "arcs": [ + [ + [288, 289] + ], + [ + [290] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Georgia" + }, + "id": "GEO", + "arcs": [ + [291, 292, -58, -32, 293] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Ghana" + }, + "id": "GHA", + "arcs": [ + [294, -189, -77, 295] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Guinea" + }, + "id": "GIN", + "arcs": [ + [296, 297, 298, 299, 300, 301, -187] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Gambia" + }, + "id": "GMB", + "arcs": [ + [302, 303] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Guinea Bissau" + }, + "id": "GNB", + "arcs": [ + [304, 305, -300] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Equatorial Guinea" + }, + "id": "GNQ", + "arcs": [ + [306, -191, -288] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Greece" + }, + "id": "GRC", + "arcs": [ + [ + [307] + ], + [ + [308, -15, 309, -84, 310] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Greenland" + }, + "id": "GRL", + "arcs": [ + [311] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Guatemala" + }, + "id": "GTM", + "arcs": [ + [312, 313, -100, 314, 315, 316] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Guyana" + }, + "id": "GUY", + "arcs": [ + [317, 318, -109, 319] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Honduras" + }, + "id": "HND", + "arcs": [ + [320, 321, -316, 322, 323] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Croatia" + }, + "id": "HRV", + "arcs": [ + [324, -92, 325, 326, 327, 328] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Haiti" + }, + "id": "HTI", + "arcs": [ + [-237, 329] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Hungary" + }, + "id": "HUN", + "arcs": [ + [-48, 330, 331, 332, 333, -329, 334] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Indonesia" + }, + "id": "IDN", + "arcs": [ + [ + [335] + ], + [ + [336, 337] + ], + [ + [338] + ], + [ + [339] + ], + [ + [340] + ], + [ + [341] + ], + [ + [342] + ], + [ + [343] + ], + [ + [344, 345] + ], + [ + [346] + ], + [ + [347] + ], + [ + [348, 349] + ], + [ + [350] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "India" + }, + "id": "IND", + "arcs": [ + [-177, 351, -175, -116, -174, 352, -80, 353, 354] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Ireland" + }, + "id": "IRL", + "arcs": [ + [355, -289] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Iran" + }, + "id": "IRN", + "arcs": [ + [356, -6, 357, 358, 359, 360, -55, -34, -57, 361] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Iraq" + }, + "id": "IRQ", + "arcs": [ + [362, 363, 364, 365, 366, 367, -360] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Iceland" + }, + "id": "ISL", + "arcs": [ + [368] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Israel" + }, + "id": "ISR", + "arcs": [ + [369, 370, 371, -252, 372, 373, 374] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Italy" + }, + "id": "ITA", + "arcs": [ + [ + [375] + ], + [ + [376] + ], + [ + [377, 378, -280, -162, -50] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Jamaica" + }, + "id": "JAM", + "arcs": [ + [379] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Jordan" + }, + "id": "JOR", + "arcs": [ + [-370, 380, -366, 381, 382, -372, 383] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Japan" + }, + "id": "JPN", + "arcs": [ + [ + [384] + ], + [ + [385] + ], + [ + [386] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Kazakhstan" + }, + "id": "KAZ", + "arcs": [ + [387, 388, 389, 390, -181, 391] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Kenya" + }, + "id": "KEN", + "arcs": [ + [392, 393, 394, 395, -265, 396] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Kyrgyzstan" + }, + "id": "KGZ", + "arcs": [ + [-392, -180, 397, 398] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Cambodia" + }, + "id": "KHM", + "arcs": [ + [399, 400, 401, 402] + ] + }, { + "type": "Polygon", + "properties": { + "name": "South Korea" + }, + "id": "KOR", + "arcs": [ + [403, 404] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Kosovo" + }, + "id": "-99", + "arcs": [ + [-18, 405, 406, 407] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Kuwait" + }, + "id": "KWT", + "arcs": [ + [408, 409, -364] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Laos" + }, + "id": "LAO", + "arcs": [ + [410, 411, -172, 412, -401] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Lebanon" + }, + "id": "LBN", + "arcs": [ + [-374, 413, 414] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Liberia" + }, + "id": "LBR", + "arcs": [ + [415, 416, -297, -186] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Libya" + }, + "id": "LBY", + "arcs": [ + [417, -245, 418, 419, -250, 420, 421] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Sri Lanka" + }, + "id": "LKA", + "arcs": [ + [422] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Lesotho" + }, + "id": "LSO", + "arcs": [ + [423] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Lithuania" + }, + "id": "LTU", + "arcs": [ + [424, 425, 426, -93, 427] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Luxembourg" + }, + "id": "LUX", + "arcs": [ + [-226, -279, -65] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Latvia" + }, + "id": "LVA", + "arcs": [ + [428, -262, 429, -94, -427] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Morocco" + }, + "id": "MAR", + "arcs": [ + [-242, 430, 431] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Moldova" + }, + "id": "MDA", + "arcs": [ + [432, 433] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Madagascar" + }, + "id": "MDG", + "arcs": [ + [434] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Mexico" + }, + "id": "MEX", + "arcs": [ + [435, -98, -314, 436, 437] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Macedonia" + }, + "id": "MKD", + "arcs": [ + [-408, 438, -85, -310, -14] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Mali" + }, + "id": "MLI", + "arcs": [ + [439, -239, 440, -74, -188, -302, 441] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Myanmar" + }, + "id": "MMR", + "arcs": [ + [442, -78, -353, -173, -412, 443] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Montenegro" + }, + "id": "MNE", + "arcs": [ + [444, -326, -91, 445, -406, -17] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Mongolia" + }, + "id": "MNG", + "arcs": [ + [446, -183] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Mozambique" + }, + "id": "MOZ", + "arcs": [ + [447, 448, 449, 450, 451, 452, 453, 454] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Mauritania" + }, + "id": "MRT", + "arcs": [ + [455, 456, 457, -240, -440] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Malawi" + }, + "id": "MWI", + "arcs": [ + [-455, 458, 459] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Malaysia" + }, + "id": "MYS", + "arcs": [ + [ + [460, 461] + ], + [ + [-349, 462, -115, 463] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Namibia" + }, + "id": "NAM", + "arcs": [ + [464, -8, 465, -119, 466] + ] + }, { + "type": "Polygon", + "properties": { + "name": "New Caledonia" + }, + "id": "NCL", + "arcs": [ + [467] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Niger" + }, + "id": "NER", + "arcs": [ + [-75, -441, -238, -418, 468, -194, 469, -71] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Nigeria" + }, + "id": "NGA", + "arcs": [ + [470, -72, -470, -193] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Nicaragua" + }, + "id": "NIC", + "arcs": [ + [471, -324, 472, -213] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Netherlands" + }, + "id": "NLD", + "arcs": [ + [-227, -63, 473] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Norway" + }, + "id": "NOR", + "arcs": [ + [ + [474, -272, 475, 476] + ], + [ + [477] + ], + [ + [478] + ], + [ + [479] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Nepal" + }, + "id": "NPL", + "arcs": [ + [-352, -176] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "New Zealand" + }, + "id": "NZL", + "arcs": [ + [ + [480] + ], + [ + [481] + ] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Oman" + }, + "id": "OMN", + "arcs": [ + [ + [482, 483, -22, 484] + ], + [ + [-20, 485] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Pakistan" + }, + "id": "PAK", + "arcs": [ + [-178, -355, 486, -358, -5] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Panama" + }, + "id": "PAN", + "arcs": [ + [487, -215, 488, -208] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Peru" + }, + "id": "PER", + "arcs": [ + [-167, 489, -247, -211, -106, -102] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Philippines" + }, + "id": "PHL", + "arcs": [ + [ + [490] + ], + [ + [491] + ], + [ + [492] + ], + [ + [493] + ], + [ + [494] + ], + [ + [495] + ], + [ + [496] + ] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Papua New Guinea" + }, + "id": "PNG", + "arcs": [ + [ + [497] + ], + [ + [498] + ], + [ + [-345, 499] + ], + [ + [500] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Poland" + }, + "id": "POL", + "arcs": [ + [-224, 501, 502, -428, -97, 503, 504, -221] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Puerto Rico" + }, + "id": "PRI", + "arcs": [ + [505] + ] + }, { + "type": "Polygon", + "properties": { + "name": "North Korea" + }, + "id": "PRK", + "arcs": [ + [506, 507, -405, 508, -169] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Portugal" + }, + "id": "PRT", + "arcs": [ + [-259, 509] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Paraguay" + }, + "id": "PRY", + "arcs": [ + [-104, -105, -26] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Qatar" + }, + "id": "QAT", + "arcs": [ + [510, 511] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Romania" + }, + "id": "ROU", + "arcs": [ + [512, -434, 513, 514, -81, 515, -333] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Russia" + }, + "id": "RUS", + "arcs": [ + [ + [516] + ], + [ + [-503, 517, -425] + ], + [ + [518, 519] + ], + [ + [520] + ], + [ + [521] + ], + [ + [522] + ], + [ + [523] + ], + [ + [524] + ], + [ + [525] + ], + [ + [526, -507, -184, -447, -182, -391, 527, -59, -293, 528, 529, -95, -430, -261, 530, -269, -475, 531, -520] + ], + [ + [532] + ], + [ + [533] + ], + [ + [534] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Rwanda" + }, + "id": "RWA", + "arcs": [ + [535, -61, -198, 536] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Western Sahara" + }, + "id": "ESH", + "arcs": [ + [-241, -458, 537, -431] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Saudi Arabia" + }, + "id": "SAU", + "arcs": [ + [538, -382, -365, -410, 539, -512, 540, -23, -484, 541] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Sudan" + }, + "id": "SDN", + "arcs": [ + [542, 543, -123, 544, -421, -249, 545, -254, -268, 546] + ] + }, { + "type": "Polygon", + "properties": { + "name": "South Sudan" + }, + "id": "SSD", + "arcs": [ + [547, -266, -396, 548, -203, -125, 549, -543] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Senegal" + }, + "id": "SEN", + "arcs": [ + [550, -456, -442, -301, -306, 551, -304] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Solomon Islands" + }, + "id": "SLB", + "arcs": [ + [ + [552] + ], + [ + [553] + ], + [ + [554] + ], + [ + [555] + ], + [ + [556] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Sierra Leone" + }, + "id": "SLE", + "arcs": [ + [557, -298, -417] + ] + }, { + "type": "Polygon", + "properties": { + "name": "El Salvador" + }, + "id": "SLV", + "arcs": [ + [558, -317, -322] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Somaliland" + }, + "id": "-99", + "arcs": [ + [-263, -231, 559, 560] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Somalia" + }, + "id": "SOM", + "arcs": [ + [-397, -264, -561, 561] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Republic of Serbia" + }, + "id": "SRB", + "arcs": [ + [-86, -439, -407, -446, -90, -325, -334, -516] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Suriname" + }, + "id": "SUR", + "arcs": [ + [562, -285, 563, -283, -110, -319] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Slovakia" + }, + "id": "SVK", + "arcs": [ + [-505, 564, -331, -54, -222] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Slovenia" + }, + "id": "SVN", + "arcs": [ + [-49, -335, -328, 565, -378] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Sweden" + }, + "id": "SWE", + "arcs": [ + [-476, -271, 566] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Swaziland" + }, + "id": "SWZ", + "arcs": [ + [567, -451] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Syria" + }, + "id": "SYR", + "arcs": [ + [-381, -375, -415, 568, 569, -367] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Chad" + }, + "id": "TCD", + "arcs": [ + [-469, -422, -545, -122, -195] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Togo" + }, + "id": "TGO", + "arcs": [ + [570, -296, -76, -69] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Thailand" + }, + "id": "THA", + "arcs": [ + [571, -462, 572, -444, -411, -400] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Tajikistan" + }, + "id": "TJK", + "arcs": [ + [-398, -179, -3, 573] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Turkmenistan" + }, + "id": "TKM", + "arcs": [ + [-357, 574, -389, 575, -1] + ] + }, { + "type": "Polygon", + "properties": { + "name": "East Timor" + }, + "id": "TLS", + "arcs": [ + [576, -337] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Trinidad and Tobago" + }, + "id": "TTO", + "arcs": [ + [577] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Tunisia" + }, + "id": "TUN", + "arcs": [ + [-244, 578, -419] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Turkey" + }, + "id": "TUR", + "arcs": [ + [ + [-294, -36, -361, -368, -570, 579] + ], + [ + [-311, -83, 580] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Taiwan" + }, + "id": "TWN", + "arcs": [ + [581] + ] + }, { + "type": "Polygon", + "properties": { + "name": "United Republic of Tanzania" + }, + "id": "TZA", + "arcs": [ + [-394, 582, -448, -460, 583, -199, -62, -536, 584] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Uganda" + }, + "id": "UGA", + "arcs": [ + [-537, -197, -549, -395, -585] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Ukraine" + }, + "id": "UKR", + "arcs": [ + [-530, 585, -514, -433, -513, -332, -565, -504, -96] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Uruguay" + }, + "id": "URY", + "arcs": [ + [-113, 586, -28] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "United States of America" + }, + "id": "USA", + "arcs": [ + [ + [587] + ], + [ + [588] + ], + [ + [589] + ], + [ + [590] + ], + [ + [591] + ], + [ + [592, -438, 593, -139] + ], + [ + [594] + ], + [ + [595] + ], + [ + [596] + ], + [ + [-141, 597] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Uzbekistan" + }, + "id": "UZB", + "arcs": [ + [-576, -388, -399, -574, -2] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Venezuela" + }, + "id": "VEN", + "arcs": [ + [598, -320, -108, -210] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Vietnam" + }, + "id": "VNM", + "arcs": [ + [599, -402, -413, -171] + ] + }, { + "type": "MultiPolygon", + "properties": { + "name": "Vanuatu" + }, + "id": "VUT", + "arcs": [ + [ + [600] + ], + [ + [601] + ] + ] + }, { + "type": "Polygon", + "properties": { + "name": "West Bank" + }, + "id": "PSE", + "arcs": [ + [-384, -371] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Yemen" + }, + "id": "YEM", + "arcs": [ + [602, -542, -483] + ] + }, { + "type": "Polygon", + "properties": { + "name": "South Africa" + }, + "id": "ZAF", + "arcs": [ + [-467, -118, 603, -452, -568, -450, 604], + [-424] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Zambia" + }, + "id": "ZMB", + "arcs": [ + [-459, -454, 605, -120, -466, -7, -200, -584] + ] + }, { + "type": "Polygon", + "properties": { + "name": "Zimbabwe" + }, + "id": "ZWE", + "arcs": [ + [-604, -121, -606, -453] + ] + }] + } + }, + "arcs": [ + [ + [6700, 7164], + [28, -23], + [21, 8], + [6, 27], + [22, 9], + [15, 18], + [6, 47], + [23, 11], + [5, 21], + [13, -15], + [8, -2] + ], + [ + [6847, 7265], + [16, -1], + [20, -12] + ], + [ + [6883, 7252], + [9, -7], + [20, 19], + [9, -12], + [9, 27], + [17, -1], + [4, 9], + [3, 24], + [12, 20], + [15, -13], + [-3, -18], + [9, -3], + [-3, -50], + [11, -19], + [10, 12], + [12, 6], + [17, 27], + [19, -5], + [29, 0] + ], + [ + [7082, 7268], + [5, -17] + ], + [ + [7087, 7251], + [-16, -6], + [-14, -11], + [-32, -7], + [-30, -13], + [-16, -25], + [6, -25], + [4, -30], + [-14, -25], + [1, -22], + [-8, -22], + [-26, 2], + [11, -39], + [-18, -15], + [-12, -35], + [2, -36], + [-11, -16], + [-10, 5], + [-22, -8], + [-3, -16], + [-20, 0], + [-16, -34], + [-1, -50], + [-36, -24], + [-19, 5], + [-6, -13], + [-16, 7], + [-28, -8], + [-47, 30] + ], + [ + [6690, 6820], + [25, 53], + [-2, 38], + [-21, 10], + [-2, 38], + [-9, 47], + [12, 32], + [-12, 9], + [7, 43], + [12, 74] + ], + [ + [5664, 4412], + [3, -18], + [-4, -29], + [5, -28], + [-4, -22], + [3, -20], + [-58, 1], + [-2, -188], + [19, -49], + [18, -37] + ], + [ + [5644, 4022], + [-51, -24], + [-67, 9], + [-19, 28], + [-113, -3], + [-4, -4], + [-17, 27], + [-18, 2], + [-16, -10], + [-14, -12] + ], + [ + [5325, 4035], + [-2, 38], + [4, 51], + [9, 55], + [2, 25], + [9, 53], + [6, 24], + [16, 39], + [9, 26], + [3, 44], + [-1, 34], + [-9, 21], + [-7, 36], + [-7, 35], + [2, 12], + [8, 24], + [-8, 57], + [-6, 39], + [-14, 38], + [3, 11] + ], + [ + [5342, 4697], + [11, 8], + [8, -1], + [10, 7], + [82, -1], + [7, -44], + [8, -35], + [6, -19], + [11, -31], + [18, 5], + [9, 8], + [16, -8], + [4, 14], + [7, 35], + [17, 2], + [2, 10], + [14, 1], + [-3, -22], + [34, 1], + [1, -37], + [5, -23], + [-4, -36], + [2, -36], + [9, -22], + [-1, -70], + [7, 5], + [12, -1], + [17, 8], + [13, -3] + ], + [ + [5338, 4715], + [-8, 45] + ], + [ + [5330, 4760], + [12, 25], + [8, 10], + [10, -20] + ], + [ + [5360, 4775], + [-10, -12], + [-4, -16], + [-1, -25], + [-7, -7] + ], + [ + [5571, 7530], + [-3, -20], + [4, -25], + [11, -15] + ], + [ + [5583, 7470], + [0, -15], + [-9, -9], + [-2, -19], + [-13, -29] + ], + [ + [5559, 7398], + [-5, 5], + [0, 13], + [-15, 19], + [-3, 29], + [2, 40], + [4, 18], + [-4, 10] + ], + [ + [5538, 7532], + [-2, 18], + [12, 29], + [1, -11], + [8, 6] + ], + [ + [5557, 7574], + [6, -16], + [7, -6], + [1, -22] + ], + [ + [6432, 6490], + [5, 3], + [1, -16], + [22, 9], + [23, -2], + [17, -1], + [19, 39], + [20, 38], + [18, 37] + ], + [ + [6557, 6597], + [5, -20] + ], + [ + [6562, 6577], + [4, -47] + ], + [ + [6566, 6530], + [-14, 0], + [-3, -39], + [5, -8], + [-12, -12], + [0, -24], + [-8, -24], + [-1, -24] + ], + [ + [6533, 6399], + [-6, -12], + [-83, 29], + [-11, 60], + [-1, 14] + ], + [ + [3140, 1814], + [-17, 2], + [-30, 0], + [0, 132] + ], + [ + [3093, 1948], + [11, -27], + [14, -45], + [36, -35], + [39, -15], + [-13, -30], + [-26, -2], + [-14, 20] + ], + [ + [3258, 3743], + [51, -96], + [23, -9], + [34, -44], + [29, -23], + [4, -26], + [-28, -90], + [28, -16], + [32, -9], + [22, 10], + [25, 45], + [4, 52] + ], + [ + [3482, 3537], + [14, 11], + [14, -34], + [-1, -47], + [-23, -33], + [-19, -24], + [-31, -57], + [-37, -81] + ], + [ + [3399, 3272], + [-7, -47], + [-7, -61], + [0, -58], + [-6, -14], + [-2, -38] + ], + [ + [3377, 3054], + [-2, -31], + [35, -50], + [-4, -41], + [18, -26], + [-2, -29], + [-26, -75], + [-42, -32], + [-55, -12], + [-31, 6], + [6, -36], + [-6, -44], + [5, -30], + [-16, -20], + [-29, -8], + [-26, 21], + [-11, -15], + [4, -59], + [18, -18], + [16, 19], + [8, -31], + [-26, -18], + [-22, -37], + [-4, -59], + [-7, -32], + [-26, 0], + [-22, -31], + [-8, -44], + [28, -43], + [26, -12], + [-9, -53], + [-33, -33], + [-18, -70], + [-25, -23], + [-12, -28], + [9, -61], + [19, -34], + [-12, 3] + ], + [ + [3095, 1968], + [-26, 9], + [-67, 8], + [-11, 34], + [0, 45], + [-18, -4], + [-10, 21], + [-3, 63], + [22, 26], + [9, 37], + [-4, 30], + [15, 51], + [10, 78], + [-3, 35], + [12, 11], + [-3, 22], + [-13, 12], + [10, 25], + [-13, 22], + [-6, 68], + [11, 12], + [-5, 72], + [7, 61], + [7, 52], + [17, 22], + [-9, 58], + [0, 54], + [21, 38], + [-1, 50], + [16, 57], + [0, 55], + [-7, 11], + [-13, 102], + [17, 60], + [-2, 58], + [10, 53], + [18, 56], + [20, 36], + [-9, 24], + [6, 19], + [-1, 98], + [30, 29], + [10, 62], + [-3, 14] + ], + [ + [3136, 3714], + [23, 54], + [36, -15], + [16, -42], + [11, 47], + [32, -2], + [4, -13] + ], + [ + [6210, 7485], + [39, 9] + ], + [ + [6249, 7494], + [5, -15], + [11, -10], + [-6, -15], + [15, -21], + [-8, -18], + [12, -16], + [13, -10], + [0, -41] + ], + [ + [6291, 7348], + [-10, -2] + ], + [ + [6281, 7346], + [-11, 34], + [0, 10], + [-12, -1], + [-9, 16], + [-5, -1] + ], + [ + [6244, 7404], + [-11, 17], + [-21, 15], + [3, 28], + [-5, 21] + ], + [ + [3345, 329], + [-8, -30], + [-8, -27], + [-59, 8], + [-62, -3], + [-34, 20], + [0, 2], + [-16, 17], + [63, -2], + [60, -6], + [20, 24], + [15, 21], + [29, -24] + ], + [ + [577, 361], + [-53, -8], + [-36, 21], + [-17, 21], + [-1, 3], + [-18, 16], + [17, 22], + [52, -9], + [28, -18], + [21, -21], + [7, -27] + ], + [ + [3745, 447], + [35, -26], + [12, -36], + [3, -25], + [1, -30], + [-43, -19], + [-45, -15], + [-52, -14], + [-59, -11], + [-65, 3], + [-37, 20], + [5, 24], + [59, 16], + [24, 20], + [18, 26], + [12, 22], + [17, 20], + [18, 25], + [14, 0], + [41, 12], + [42, -12] + ], + [ + [1633, 715], + [36, -9], + [33, 10], + [-16, -20], + [-26, -15], + [-39, 4], + [-27, 21], + [6, 20], + [33, -11] + ], + [ + [1512, 716], + [43, -23], + [-17, 3], + [-36, 5], + [-38, 17], + [20, 12], + [28, -14] + ], + [ + [2250, 808], + [31, -8], + [30, 7], + [17, -34], + [-22, 5], + [-34, -2], + [-34, 2], + [-38, -4], + [-28, 12], + [-15, 24], + [18, 11], + [35, -8], + [40, -5] + ], + [ + [3098, 866], + [4, -27], + [-5, -23], + [-8, -22], + [-33, -8], + [-31, -12], + [-36, 1], + [14, 24], + [-33, -9], + [-31, -8], + [-21, 18], + [-2, 24], + [30, 23], + [20, 7], + [32, -2], + [8, 30], + [1, 22], + [0, 47], + [16, 28], + [25, 9], + [15, -22], + [6, -22], + [12, -26], + [10, -26], + [7, -26] + ], + [ + [3371, 1268], + [-11, -13], + [-21, 9], + [-23, -6], + [-19, -14], + [-20, -15], + [-14, -17], + [-4, -23], + [2, -22], + [13, -20], + [-19, -14], + [-26, -4], + [-15, -20], + [-17, -19], + [-17, -25], + [-4, -22], + [9, -24], + [15, -19], + [23, -14], + [21, -18], + [12, -23], + [6, -22], + [8, -24], + [13, -19], + [8, -22], + [4, -55], + [8, -22], + [2, -23], + [9, -23], + [-4, -31], + [-15, -24], + [-17, -20], + [-37, -8], + [-12, -21], + [-17, -20], + [-42, -22], + [-37, -9], + [-35, -13], + [-37, -13], + [-22, -24], + [-45, -2], + [-49, 2], + [-44, -4], + [-47, 0], + [9, -24], + [42, -10], + [31, -16], + [18, -21], + [-31, -19], + [-48, 6], + [-40, -15], + [-2, -24], + [-1, -23], + [33, -20], + [6, -22], + [35, -22], + [59, -9], + [50, -16], + [40, -19], + [50, -18], + [70, -10], + [68, -16], + [47, -17], + [52, -20], + [27, -28], + [13, -22], + [34, 21], + [46, 17], + [48, 19], + [58, 15], + [49, 16], + [69, 1], + [68, -8], + [56, -14], + [18, 26], + [39, 17], + [70, 1], + [55, 13], + [52, 13], + [58, 8], + [62, 10], + [43, 15], + [-20, 21], + [-12, 21], + [0, 22], + [-54, -2], + [-57, -10], + [-54, 0], + [-8, 22], + [4, 44], + [12, 13], + [40, 14], + [47, 14], + [34, 17], + [33, 18], + [25, 23], + [38, 10], + [38, 8], + [19, 5], + [43, 2], + [41, 8], + [34, 12], + [34, 14], + [30, 14], + [39, 18], + [24, 20], + [26, 17], + [9, 24], + [-30, 13], + [10, 25], + [18, 18], + [29, 12], + [31, 14], + [28, 18], + [22, 23], + [13, 28], + [21, 16], + [33, -3], + [13, -20], + [34, -2], + [1, 22], + [14, 23], + [30, -6], + [7, -22], + [33, -3], + [36, 10], + [35, 7], + [31, -3], + [12, -25], + [31, 20], + [28, 10], + [31, 9], + [31, 8], + [29, 14], + [31, 9], + [24, 13], + [17, 20], + [20, -15], + [29, 8], + [20, -27], + [16, -21], + [32, 11], + [12, 24], + [28, 16], + [37, -4], + [11, -22], + [22, 22], + [30, 7], + [33, 3], + [29, -2], + [31, -7], + [30, -3], + [13, -20], + [18, -17], + [31, 10], + [32, 3], + [32, 0], + [31, 1], + [28, 8], + [29, 7], + [25, 16], + [26, 11], + [28, 5], + [21, 17], + [15, 32], + [16, 20], + [29, -10], + [11, -21], + [24, -13], + [29, 4], + [19, -21], + [21, -15], + [28, 14], + [10, 26], + [25, 10], + [29, 20], + [27, 8], + [33, 11], + [22, 13], + [22, 14], + [22, 13], + [26, -7], + [25, 21], + [18, 16], + [26, -1], + [23, 14], + [6, 21], + [23, 16], + [23, 11], + [28, 10], + [25, 4], + [25, -3], + [26, -6], + [22, -16], + [3, -26], + [24, -19], + [17, -17], + [33, -7], + [19, -16], + [23, -16], + [26, -3], + [23, 11], + [24, 24], + [26, -12], + [27, -7], + [26, -7], + [27, -5], + [28, 0], + [23, -61], + [-1, -15], + [-4, -27], + [-26, -15], + [-22, -22], + [4, -23], + [31, 1], + [-4, -23], + [-14, -22], + [-13, -24], + [21, -19], + [32, -6], + [32, 11], + [15, 23], + [10, 22], + [15, 18], + [17, 18], + [7, 21], + [15, 29], + [18, 5], + [31, 3], + [28, 7], + [28, 9], + [14, 23], + [8, 22], + [19, 22], + [27, 15], + [23, 12], + [16, 19], + [15, 11], + [21, 9], + [27, -6], + [25, 6], + [28, 7], + [30, -4], + [20, 17], + [14, 39], + [11, -16], + [13, -28], + [23, -12], + [27, -4], + [26, 7], + [29, -5], + [26, -1], + [17, 6], + [24, -4], + [21, -12], + [25, 8], + [30, 0], + [25, 8], + [29, -8], + [19, 19], + [14, 20], + [19, 16], + [35, 44], + [18, -8], + [21, -16], + [18, -21], + [36, -36], + [27, -1], + [25, 0], + [30, 7], + [30, 8], + [23, 16], + [19, 18], + [31, 2], + [21, 13], + [22, -12], + [14, -18], + [19, -19], + [31, 2], + [19, -15], + [33, -15], + [35, -5], + [29, 4], + [21, 19], + [19, 18], + [25, 5], + [25, -8], + [29, -6], + [26, 9], + [25, 0], + [24, -6], + [26, -5], + [25, 10], + [30, 9], + [28, 3], + [32, 0], + [25, 5], + [25, 5], + [8, 29], + [1, 24], + [17, -16], + [5, -27], + [10, -24], + [11, -20], + [23, -10], + [32, 4], + [36, 1], + [25, 3], + [37, 0], + [26, 1], + [36, -2], + [31, -5], + [20, -18], + [-5, -22], + [18, -18], + [30, -13], + [31, -15], + [35, -11], + [38, -9], + [28, -9], + [32, -2], + [18, 20], + [24, -16], + [21, -19], + [25, -13], + [34, -6], + [32, -7], + [13, -23], + [32, -14], + [21, -21], + [31, -9], + [32, 1], + [30, -4], + [33, 1], + [34, -4], + [31, -8], + [28, -14], + [29, -12], + [20, -17], + [-3, -23], + [-15, -21], + [-13, -27], + [-9, -21], + [-14, -24], + [-36, -9], + [-16, -21], + [-36, -13], + [-13, -23], + [-19, -22], + [-20, -18], + [-11, -25], + [-7, -22], + [-3, -26], + [0, -22], + [16, -23], + [6, -22], + [13, -21], + [52, -8], + [11, -26], + [-50, -9], + [-43, -13], + [-52, -2], + [-24, -34], + [-5, -27], + [-12, -22], + [-14, -22], + [37, -20], + [14, -24], + [24, -22], + [33, -20], + [39, -19], + [42, -18], + [64, -19], + [14, -29], + [80, -12], + [5, -5], + [21, -17], + [77, 15], + [63, -19], + [48, -14], + [-9997, -1], + [24, 35], + [50, -19], + [3, 2], + [30, 19], + [4, 0], + [3, -1], + [40, -25], + [35, 25], + [7, 3], + [81, 11], + [27, -14], + [13, -7], + [41, -20], + [79, -15], + [63, -18], + [107, -14], + [80, 16], + [118, -11], + [67, -19], + [73, 17], + [78, 17], + [6, 27], + [-110, 3], + [-89, 14], + [-24, 23], + [-74, 12], + [5, 27], + [10, 24], + [10, 22], + [-5, 25], + [-46, 16], + [-22, 21], + [-43, 18], + [68, -3], + [64, 9], + [40, -20], + [50, 18], + [45, 22], + [23, 19], + [-10, 25], + [-36, 16], + [-41, 17], + [-57, 4], + [-50, 8], + [-54, 6], + [-18, 22], + [-36, 18], + [-21, 21], + [-9, 67], + [14, -6], + [25, -18], + [45, 6], + [44, 8], + [23, -26], + [44, 6], + [37, 13], + [35, 16], + [32, 20], + [41, 5], + [-1, 22], + [-9, 22], + [8, 21], + [36, 11], + [16, -20], + [42, 12], + [32, 15], + [40, 1], + [38, 6], + [37, 13], + [30, 13], + [34, 13], + [22, -4], + [19, -4], + [41, 8], + [37, -10], + [38, 1], + [37, 8], + [37, -6], + [41, -6], + [39, 3], + [40, -2], + [42, -1], + [38, 3], + [28, 17], + [34, 9], + [35, -13], + [33, 11], + [30, 21], + [18, -19], + [9, -21], + [18, -19], + [29, 17], + [33, -22], + [38, -7], + [32, -16], + [39, 3], + [36, 11], + [41, -3], + [38, -8], + [38, -10], + [15, 25], + [-18, 20], + [-14, 21], + [-36, 5], + [-15, 22], + [-6, 22], + [-10, 43], + [21, -8], + [36, -3], + [36, 3], + [33, -9], + [28, -17], + [12, -21], + [38, -4], + [36, 9], + [38, 11], + [34, 7], + [28, -14], + [37, 5], + [24, 45], + [23, -27], + [32, -10], + [34, 6], + [23, -23], + [37, -3], + [33, -7], + [34, -12], + [21, 22], + [11, 20], + [28, -23], + [38, 6], + [28, -13], + [19, -19], + [37, 5], + [29, 13], + [29, 15], + [33, 8], + [39, 7], + [36, 8], + [27, 13], + [16, 19], + [7, 25], + [-3, 24], + [-9, 24], + [-10, 23], + [-9, 23], + [-7, 21], + [-1, 23], + [2, 23], + [13, 22], + [11, 24], + [5, 23], + [-6, 26], + [-3, 23], + [14, 27], + [15, 17], + [18, 22], + [19, 19], + [22, 17], + [11, 25], + [15, 17], + [18, 15], + [26, 3], + [18, 19], + [19, 11], + [23, 7], + [20, 15], + [16, 19], + [22, 7], + [16, -15], + [-10, -20], + [-29, -17] + ], + [ + [6914, 2185], + [18, -19], + [26, -7], + [1, -11], + [-7, -27], + [-43, -4], + [-1, 31], + [4, 25], + [2, 12] + ], + [ + [9038, 2648], + [27, -21], + [15, 8], + [22, 12], + [16, -4], + [2, -70], + [-9, -21], + [-3, -47], + [-10, 16], + [-19, -41], + [-6, 3], + [-17, 2], + [-17, 50], + [-4, 39], + [-16, 52], + [1, 27], + [18, -5] + ], + [ + [8987, 4244], + [10, -46], + [18, 22], + [9, -25], + [13, -23], + [-3, -26], + [6, -51], + [5, -29], + [7, -7], + [7, -51], + [-3, -30], + [9, -40], + [31, -31], + [19, -28], + [19, -26], + [-4, -14], + [16, -37], + [11, -64], + [11, 13], + [11, -26], + [7, 9], + [5, -63], + [19, -36], + [13, -22], + [22, -48], + [8, -48], + [1, -33], + [-2, -37], + [13, -50], + [-2, -52], + [-5, -28], + [-7, -52], + [1, -34], + [-6, -43], + [-12, -53], + [-21, -29], + [-10, -46], + [-9, -29], + [-8, -51], + [-11, -30], + [-7, -44], + [-4, -41], + [2, -18], + [-16, -21], + [-31, -2], + [-26, -24], + [-13, -23], + [-17, -26], + [-23, 27], + [-17, 10], + [5, 31], + [-15, -11], + [-25, -43], + [-24, 16], + [-15, 9], + [-16, 4], + [-27, 17], + [-18, 37], + [-5, 45], + [-7, 30], + [-13, 24], + [-27, 7], + [9, 28], + [-7, 44], + [-13, -41], + [-25, -11], + [14, 33], + [5, 34], + [10, 29], + [-2, 44], + [-22, -50], + [-18, -21], + [-10, -47], + [-22, 25], + [1, 31], + [-18, 43], + [-14, 22], + [5, 14], + [-36, 35], + [-19, 2], + [-27, 29], + [-50, -6], + [-36, -21], + [-31, -20], + [-27, 4], + [-29, -30], + [-24, -14], + [-6, -31], + [-10, -24], + [-23, -1], + [-18, -5], + [-24, 10], + [-20, -6], + [-19, -3], + [-17, -31], + [-8, 2], + [-14, -16], + [-13, -19], + [-21, 2], + [-18, 0], + [-30, 38], + [-15, 11], + [1, 34], + [14, 8], + [4, 14], + [-1, 21], + [4, 41], + [-3, 35], + [-15, 60], + [-4, 33], + [1, 34], + [-11, 38], + [-1, 18], + [-12, 23], + [-4, 47], + [-16, 46], + [-4, 26], + [13, -26], + [-10, 55], + [14, -17], + [8, -23], + [0, 30], + [-14, 47], + [-3, 18], + [-6, 18], + [3, 34], + [6, 15], + [4, 29], + [-3, 35], + [11, 42], + [2, -45], + [12, 41], + [22, 20], + [14, 25], + [21, 22], + [13, 4], + [7, -7], + [22, 22], + [17, 6], + [4, 13], + [8, 6], + [15, -2], + [29, 18], + [15, 26], + [7, 31], + [17, 30], + [1, 24], + [1, 32], + [19, 50], + [12, -51], + [12, 12], + [-10, 28], + [9, 29], + [12, -13], + [3, 45], + [15, 29], + [7, 23], + [14, 10], + [0, 17], + [13, -7], + [0, 15], + [12, 8], + [14, 8], + [20, -27], + [16, -35], + [17, 0], + [18, -6], + [-6, 33], + [13, 47], + [13, 15], + [-5, 15], + [12, 34], + [17, 21], + [14, -7], + [24, 11], + [-1, 30], + [-20, 19], + [15, 9], + [18, -15], + [15, -24], + [23, -15], + [8, 6], + [17, -18], + [17, 17], + [10, -5], + [7, 11], + [12, -29], + [-7, -32], + [-11, -24], + [-9, -2], + [3, -23], + [-8, -30], + [-10, -29], + [2, -17], + [22, -32], + [21, -19], + [15, -20], + [20, -35], + [8, 0], + [14, -15], + [4, -19], + [27, -20], + [18, 20], + [6, 32], + [5, 26], + [4, 33], + [8, 47], + [-4, 28], + [2, 17], + [-3, 34], + [4, 45], + [5, 12], + [-4, 20], + [7, 31], + [5, 32], + [1, 17], + [10, 22], + [8, -29], + [2, -37], + [7, -7], + [1, -25], + [10, -30], + [2, -33], + [-1, -22] + ], + [ + [5471, 7900], + [-2, -24], + [-16, 0], + [6, -13], + [-9, -38] + ], + [ + [5450, 7825], + [-6, -10], + [-24, -1], + [-14, -13], + [-23, 4] + ], + [ + [5383, 7805], + [-40, 15], + [-6, 21], + [-27, -10], + [-4, -12], + [-16, 9] + ], + [ + [5290, 7828], + [-15, 1], + [-12, 11], + [4, 15], + [-1, 10] + ], + [ + [5266, 7865], + [8, 3], + [14, -16], + [4, 16], + [25, -3], + [20, 11], + [13, -2], + [9, -12], + [2, 10], + [-4, 38], + [10, 8], + [10, 27] + ], + [ + [5377, 7945], + [21, -19], + [15, 24], + [10, 5], + [22, -18], + [13, 3], + [13, -12] + ], + [ + [5471, 7928], + [-3, -7], + [3, -21] + ], + [ + [6281, 7346], + [-19, 8], + [-14, 27], + [-4, 23] + ], + [ + [6349, 7527], + [15, -31], + [14, -42], + [13, -2], + [8, -16], + [-23, -5], + [-5, -46], + [-4, -21], + [-11, -13], + [1, -30] + ], + [ + [6357, 7321], + [-7, -3], + [-17, 31], + [10, 30], + [-9, 17], + [-10, -4], + [-33, -44] + ], + [ + [6249, 7494], + [6, 10], + [21, -17], + [15, -4], + [4, 7], + [-14, 32], + [7, 9] + ], + [ + [6288, 7531], + [8, -2], + [19, -36], + [13, -4], + [4, 15], + [17, 23] + ], + [ + [5814, 4792], + [-1, 71], + [-7, 27] + ], + [ + [5806, 4890], + [17, -5], + [8, 34], + [15, -4] + ], + [ + [5846, 4915], + [1, -23], + [6, -14], + [1, -19], + [-7, -12], + [-11, -31], + [-10, -22], + [-12, -2] + ], + [ + [5092, 8091], + [20, -5], + [26, 12], + [17, -25], + [16, -14] + ], + [ + [5171, 8059], + [-4, -40] + ], + [ + [5167, 8019], + [-7, -2], + [-3, -33] + ], + [ + [5157, 7984], + [-24, 26], + [-14, -4], + [-20, 28], + [-13, 23], + [-13, 1], + [-4, 21] + ], + [ + [5069, 8079], + [23, 12] + ], + [ + [5074, 5427], + [-23, -7] + ], + [ + [5051, 5420], + [-7, 41], + [2, 136], + [-6, 12], + [-1, 29], + [-10, 21], + [-8, 17], + [3, 31] + ], + [ + [5024, 5707], + [10, 7], + [6, 26], + [13, 5], + [6, 18] + ], + [ + [5059, 5763], + [10, 17], + [10, 0], + [21, -34] + ], + [ + [5100, 5746], + [-1, -19], + [6, -35], + [-6, -24], + [3, -16], + [-13, -37], + [-9, -18], + [-5, -37], + [1, -38], + [-2, -95] + ], + [ + [4921, 5627], + [-19, 15], + [-13, -2], + [-10, -15], + [-12, 13], + [-5, 19], + [-13, 13] + ], + [ + [4849, 5670], + [-1, 34], + [7, 26], + [-1, 20], + [23, 48], + [4, 41], + [7, 14], + [14, -8], + [11, 12], + [4, 16], + [22, 26], + [5, 19], + [26, 24], + [15, 9], + [7, -12], + [18, 0] + ], + [ + [5010, 5939], + [-2, -28], + [3, -27], + [16, -39], + [1, -28], + [32, -14], + [-1, -40] + ], + [ + [5024, 5707], + [-24, 1] + ], + [ + [5000, 5708], + [-13, 5], + [-9, -9], + [-12, 4], + [-48, -3], + [-1, -33], + [4, -45] + ], + [ + [7573, 6360], + [0, -43], + [-10, 9], + [2, -47] + ], + [ + [7565, 6279], + [-8, 30], + [-1, 31], + [-6, 28], + [-11, 34], + [-26, 3], + [3, -25], + [-9, -32], + [-12, 12], + [-4, -11], + [-8, 6], + [-11, 5] + ], + [ + [7472, 6360], + [-4, 49], + [-10, 45], + [5, 35], + [-17, 16], + [6, 22], + [18, 22], + [-20, 31], + [9, 40], + [22, -26], + [14, -3], + [2, -41], + [26, -8], + [26, 1], + [16, -10], + [-13, -50], + [-12, -3], + [-9, -34], + [16, -31], + [4, 38], + [8, 0], + [14, -93] + ], + [ + [5629, 7671], + [8, -25], + [11, 5], + [21, -9], + [41, -4], + [13, 16], + [33, 13], + [20, -21], + [17, -6] + ], + [ + [5793, 7640], + [-15, -25], + [-10, -42], + [9, -34] + ], + [ + [5777, 7539], + [-24, 8], + [-28, -18] + ], + [ + [5725, 7529], + [0, -30], + [-26, -5], + [-19, 20], + [-22, -16], + [-21, 2] + ], + [ + [5637, 7500], + [-2, 39], + [-14, 19] + ], + [ + [5621, 7558], + [5, 8], + [-3, 7], + [4, 19], + [11, 18], + [-14, 26], + [-2, 21], + [7, 14] + ], + [ + [2846, 6461], + [-7, -3], + [-7, 34], + [-10, 17], + [6, 38], + [8, -3], + [10, -49], + [0, -34] + ], + [ + [2838, 6628], + [-30, -10], + [-2, 22], + [13, 5], + [18, -2], + [1, -15] + ], + [ + [2861, 6628], + [-5, -42], + [-5, 8], + [0, 31], + [-12, 23], + [0, 7], + [22, -27] + ], + [ + [5527, 7708], + [10, 0], + [-7, -26], + [14, -23], + [-4, -28], + [-7, -2] + ], + [ + [5533, 7629], + [-5, -6], + [-9, -13], + [-4, -33] + ], + [ + [5515, 7577], + [-25, 23], + [-10, 24], + [-11, 13], + [-12, 22], + [-6, 19], + [-14, 27], + [6, 25], + [10, -14], + [6, 12], + [13, 2], + [24, -10], + [19, 1], + [12, -13] + ], + [ + [5652, 8242], + [27, 0], + [30, 22], + [6, 34], + [23, 19], + [-3, 26] + ], + [ + [5735, 8343], + [17, 10], + [30, 23] + ], + [ + [5782, 8376], + [29, -15], + [4, -15], + [15, 7], + [27, -14], + [3, -27], + [-6, -16], + [17, -39], + [12, -11], + [-2, -11], + [19, -10], + [8, -16], + [-11, -13], + [-23, 2], + [-5, -5], + [7, -20], + [6, -37] + ], + [ + [5882, 8136], + [-23, -4], + [-9, -13], + [-2, -30], + [-11, 6], + [-25, -3], + [-7, 14], + [-11, -10], + [-10, 8], + [-22, 1], + [-31, 15], + [-28, 4], + [-22, -1], + [-15, -16], + [-13, -2] + ], + [ + [5653, 8105], + [-1, 26], + [-8, 27], + [17, 12], + [0, 24], + [-8, 22], + [-1, 26] + ], + [ + [2524, 6110], + [-1, 8], + [4, 3], + [5, -7], + [10, 36], + [5, 0] + ], + [ + [2547, 6150], + [0, -8], + [5, -1], + [0, -16], + [-5, -25], + [3, -9], + [-3, -21], + [2, -6], + [-4, -30], + [-5, -16], + [-5, -1], + [-6, -21] + ], + [ + [2529, 5996], + [-8, 0], + [2, 67], + [1, 47] + ], + [ + [3136, 3714], + [-20, -8], + [-11, 82], + [-15, 66], + [9, 57], + [-15, 25], + [-4, 43], + [-13, 40] + ], + [ + [3067, 4019], + [17, 64], + [-12, 49], + [7, 20], + [-5, 22], + [10, 30], + [1, 50], + [1, 41], + [6, 20], + [-24, 96] + ], + [ + [3068, 4411], + [21, -5], + [14, 1], + [6, 18], + [25, 24], + [14, 22], + [37, 10], + [-3, -44], + [3, -23], + [-2, -40], + [30, -53], + [31, -9], + [11, -23], + [19, -11], + [11, -17], + [18, 0], + [16, -17], + [1, -34], + [6, -18], + [0, -25], + [-8, -1], + [11, -69], + [53, -2], + [-4, -35], + [3, -23], + [15, -16], + [6, -37], + [-4, -47], + [-8, -26], + [3, -33], + [-9, -12] + ], + [ + [3384, 3866], + [-1, 18], + [-25, 30], + [-26, 1], + [-49, -17], + [-13, -52], + [-1, -32], + [-11, -71] + ], + [ + [3482, 3537], + [6, 34], + [3, 35], + [1, 32], + [-10, 11], + [-11, -9], + [-10, 2], + [-4, 23], + [-2, 54], + [-5, 18], + [-19, 16], + [-11, -12], + [-30, 11], + [2, 81], + [-8, 33] + ], + [ + [3068, 4411], + [-15, -11], + [-13, 7], + [2, 90], + [-23, -35], + [-24, 2], + [-11, 31], + [-18, 4], + [5, 25], + [-15, 36], + [-11, 53], + [7, 11], + [0, 25], + [17, 17], + [-3, 32], + [7, 20], + [2, 28], + [32, 40], + [22, 11], + [4, 9], + [25, -2] + ], + [ + [3058, 4804], + [13, 162], + [0, 25], + [-4, 34], + [-12, 22], + [0, 42], + [15, 10], + [6, -6], + [1, 23], + [-16, 6], + [-1, 37], + [54, -2], + [10, 21], + [7, -19], + [6, -35], + [5, 8] + ], + [ + [3142, 5132], + [15, -32], + [22, 4], + [5, 18], + [21, 14], + [11, 10], + [4, 25], + [19, 17], + [-1, 12], + [-24, 5], + [-3, 37], + [1, 40], + [-13, 15], + [5, 6], + [21, -8], + [22, -15], + [8, 14], + [20, 9], + [31, 23], + [10, 22], + [-3, 17] + ], + [ + [3313, 5365], + [14, 2], + [7, -13], + [-4, -26], + [9, -9], + [7, -28], + [-8, -20], + [-4, -51], + [7, -30], + [2, -27], + [17, -28], + [14, -3], + [3, 12], + [8, 3], + [13, 10], + [9, 16], + [15, -5], + [7, 2] + ], + [ + [3429, 5170], + [15, -5], + [3, 12], + [-5, 12], + [3, 17], + [11, -5], + [13, 6], + [16, -13] + ], + [ + [3485, 5194], + [12, -12], + [9, 16], + [6, -3], + [4, -16], + [13, 4], + [11, 22], + [8, 44], + [17, 54] + ], + [ + [3565, 5303], + [9, 3], + [7, -33], + [16, -103], + [14, -10], + [1, -41], + [-21, -48], + [9, -18], + [49, -9], + [1, -60], + [21, 39], + [35, -21], + [46, -36], + [14, -35], + [-5, -32], + [33, 18], + [54, -32], + [41, 3], + [41, -49], + [36, -66], + [21, -17], + [24, -3], + [10, -18], + [9, -76], + [5, -35], + [-11, -98], + [-14, -39], + [-39, -82], + [-18, -67], + [-21, -51], + [-7, -1], + [-7, -43], + [2, -111], + [-8, -91], + [-3, -39], + [-9, -23], + [-5, -79], + [-28, -77], + [-5, -61], + [-22, -26], + [-7, -35], + [-30, 0], + [-44, -23], + [-19, -26], + [-31, -18], + [-33, -47], + [-23, -58], + [-5, -44], + [5, -33], + [-5, -60], + [-6, -28], + [-20, -33], + [-31, -104], + [-24, -47], + [-19, -27], + [-13, -57], + [-18, -33] + ], + [ + [3517, 3063], + [-8, 33], + [13, 28], + [-16, 40], + [-22, 33], + [-29, 38], + [-10, -2], + [-28, 46], + [-18, -7] + ], + [ + [8172, 5325], + [11, 22], + [23, 32] + ], + [ + [8206, 5379], + [-1, -29], + [-2, -37], + [-13, 1], + [-6, -20], + [-12, 31] + ], + [ + [7546, 6698], + [12, -19], + [-2, -36], + [-23, -2], + [-23, 4], + [-18, -9], + [-25, 22], + [-1, 12] + ], + [ + [7466, 6670], + [19, 44], + [15, 15], + [20, -14], + [14, -1], + [12, -16] + ], + [ + [5817, 3752], + [-39, -43], + [-25, -44], + [-10, -40], + [-8, -22], + [-15, -4], + [-5, -29], + [-3, -18], + [-17, -14], + [-23, 3], + [-13, 17], + [-12, 7], + [-14, -14], + [-6, -28], + [-14, -18], + [-13, -26], + [-20, -6], + [-6, 20], + [2, 36], + [-16, 56], + [-8, 9] + ], + [ + [5552, 3594], + [0, 173], + [27, 2], + [1, 210], + [21, 2], + [43, 21], + [10, -24], + [18, 23], + [9, 0], + [15, 13] + ], + [ + [5696, 4014], + [5, -4] + ], + [ + [5701, 4010], + [11, -48], + [5, -10], + [9, -34], + [32, -65], + [12, -7], + [0, -20], + [8, -38], + [21, -9], + [18, -27] + ], + [ + [5424, 5496], + [23, 4], + [5, 16], + [5, -2], + [7, -13], + [34, 23], + [12, 23], + [15, 20], + [-3, 21], + [8, 6], + [27, -4], + [26, 27], + [20, 65], + [14, 24], + [18, 10] + ], + [ + [5635, 5716], + [3, -26], + [16, -36], + [0, -25], + [-5, -24], + [2, -18], + [10, -18] + ], + [ + [5661, 5569], + [21, -25] + ], + [ + [5682, 5544], + [15, -24], + [0, -19], + [19, -31], + [12, -26], + [7, -35], + [20, -24], + [5, -18] + ], + [ + [5760, 5367], + [-9, -7], + [-18, 2], + [-21, 6], + [-10, -5], + [-5, -14], + [-9, -2], + [-10, 12], + [-31, -29], + [-13, 6], + [-4, -5], + [-8, -35], + [-21, 11], + [-20, 6], + [-18, 22], + [-23, 20], + [-15, -19], + [-10, -30], + [-3, -41] + ], + [ + [5512, 5265], + [-18, 3], + [-19, 10], + [-16, -32], + [-15, -55] + ], + [ + [5444, 5191], + [-3, 18], + [-1, 27], + [-13, 19], + [-10, 30], + [-2, 21], + [-13, 31], + [2, 18], + [-3, 25], + [2, 45], + [7, 11], + [14, 60] + ], + [ + [3231, 7808], + [20, -8], + [26, 1], + [-14, -24], + [-10, -4], + [-35, 25], + [-7, 20], + [10, 18], + [10, -28] + ], + [ + [3283, 7958], + [-14, -1], + [-36, 19], + [-26, 28], + [10, 5], + [37, -15], + [28, -25], + [1, -11] + ], + [ + [1569, 7923], + [-14, -8], + [-46, 27], + [-8, 21], + [-25, 21], + [-5, 16], + [-28, 11], + [-11, 32], + [2, 14], + [30, -13], + [17, -9], + [26, -6], + [9, -21], + [14, -28], + [28, -24], + [11, -33] + ], + [ + [3440, 8052], + [-18, -52], + [18, 20], + [19, -12], + [-10, -21], + [25, -16], + [12, 14], + [28, -18], + [-8, -43], + [19, 10], + [4, -32], + [8, -36], + [-11, -52], + [-13, -2], + [-18, 11], + [6, 48], + [-8, 8], + [-32, -52], + [-17, 2], + [20, 28], + [-27, 14], + [-30, -3], + [-54, 2], + [-4, 17], + [17, 21], + [-12, 16], + [24, 36], + [28, 94], + [18, 33], + [24, 21], + [13, -3], + [-6, -16], + [-15, -37] + ], + [ + [1313, 8250], + [27, 5], + [-8, -67], + [24, -48], + [-11, 0], + [-17, 27], + [-10, 27], + [-14, 19], + [-5, 26], + [1, 19], + [13, -8] + ], + [ + [2798, 8730], + [-11, -31], + [-12, 5], + [-8, 17], + [2, 4], + [10, 18], + [12, -1], + [7, -12] + ], + [ + [2725, 8762], + [-33, -32], + [-19, 1], + [-6, 16], + [20, 27], + [38, 0], + [0, -12] + ], + [ + [2634, 8936], + [5, -26], + [15, 9], + [16, -15], + [30, -20], + [32, -19], + [2, -28], + [21, 5], + [20, -20], + [-25, -18], + [-43, 14], + [-16, 26], + [-27, -31], + [-40, -31], + [-9, 35], + [-38, -6], + [24, 30], + [4, 46], + [9, 54], + [20, -5] + ], + [ + [2892, 9024], + [-31, -3], + [-7, 29], + [12, 34], + [26, 8], + [21, -17], + [1, -25], + [-4, -8], + [-18, -18] + ], + [ + [2343, 9140], + [-17, -21], + [-38, 18], + [-22, -6], + [-38, 26], + [24, 19], + [19, 25], + [30, -16], + [17, -11], + [8, -11], + [17, -23] + ], + [ + [3135, 7724], + [-18, 33], + [0, 81], + [-13, 17], + [-18, -10], + [-10, 16], + [-21, -45], + [-8, -46], + [-10, -27], + [-12, -9], + [-9, -3], + [-3, -15], + [-51, 0], + [-42, 0], + [-12, -11], + [-30, -42], + [-3, -5], + [-9, -23], + [-26, 0], + [-27, 0], + [-12, -10], + [4, -11], + [2, -18], + [0, -6], + [-36, -30], + [-29, -9], + [-32, -31], + [-7, 0], + [-10, 9], + [-3, 8], + [1, 6], + [6, 21], + [13, 33], + [8, 35], + [-5, 51], + [-6, 53], + [-29, 28], + [3, 11], + [-4, 7], + [-8, 0], + [-5, 9], + [-2, 14], + [-5, -6], + [-7, 2], + [1, 6], + [-6, 6], + [-3, 15], + [-21, 19], + [-23, 20], + [-27, 23], + [-26, 21], + [-25, -17], + [-9, 0], + [-34, 15], + [-23, -8], + [-27, 19], + [-28, 9], + [-19, 4], + [-9, 10], + [-5, 32], + [-9, 0], + [-1, -23], + [-57, 0], + [-95, 0], + [-94, 0], + [-84, 0], + [-83, 0], + [-82, 0], + [-85, 0], + [-27, 0], + [-82, 0], + [-79, 0] + ], + [ + [1588, 7952], + [-4, 0], + [-54, 58], + [-20, 26], + [-50, 24], + [-15, 53], + [3, 36], + [-35, 25], + [-5, 48], + [-34, 43], + [0, 30] + ], + [ + [1374, 8295], + [15, 29], + [0, 37], + [-48, 37], + [-28, 68], + [-17, 42], + [-26, 27], + [-19, 24], + [-14, 31], + [-28, -20], + [-27, -33], + [-25, 39], + [-19, 26], + [-27, 16], + [-28, 2], + [0, 337], + [1, 219] + ], + [ + [1084, 9176], + [51, -14], + [44, -29], + [29, -5], + [24, 24], + [34, 19], + [41, -7], + [42, 26], + [45, 14], + [20, -24], + [20, 14], + [6, 27], + [20, -6], + [47, -53], + [37, 40], + [3, -45], + [34, 10], + [11, 17], + [34, -3], + [42, -25], + [65, -22], + [38, -10], + [28, 4], + [37, -30], + [-39, -29], + [50, -13], + [75, 7], + [24, 11], + [29, -36], + [31, 30], + [-29, 25], + [18, 20], + [34, 3], + [22, 6], + [23, -14], + [28, -32], + [31, 5], + [49, -27], + [43, 9], + [40, -1], + [-3, 37], + [25, 10], + [43, -20], + [0, -56], + [17, 47], + [23, -1], + [12, 59], + [-30, 36], + [-32, 24], + [2, 65], + [33, 43], + [37, -9], + [28, -26], + [38, -67], + [-25, -29], + [52, -12], + [-1, -60], + [38, 46], + [33, -38], + [-9, -44], + [27, -40], + [29, 43], + [21, 51], + [1, 65], + [40, -5], + [41, -8], + [37, -30], + [2, -29], + [-21, -31], + [20, -32], + [-4, -29], + [-54, -41], + [-39, -9], + [-29, 18], + [-8, -30], + [-27, -50], + [-8, -26], + [-32, -40], + [-40, -4], + [-22, -25], + [-2, -38], + [-32, -7], + [-34, -48], + [-30, -67], + [-11, -46], + [-1, -69], + [40, -10], + [13, -55], + [13, -45], + [39, 12], + [51, -26], + [28, -22], + [20, -28], + [35, -17], + [29, -24], + [46, -4], + [30, -6], + [-4, -51], + [8, -59], + [21, -66], + [41, -56], + [21, 19], + [15, 61], + [-14, 93], + [-20, 31], + [45, 28], + [31, 41], + [16, 41], + [-3, 40], + [-19, 50], + [-33, 44], + [32, 62], + [-12, 54], + [-9, 92], + [19, 14], + [48, -16], + [29, -6], + [23, 15], + [25, -20], + [35, -34], + [8, -23], + [50, -4], + [-1, -50], + [9, -74], + [25, -10], + [21, -35], + [40, 33], + [26, 65], + [19, 28], + [21, -53], + [36, -75], + [31, -71], + [-11, -37], + [37, -33], + [25, -34], + [44, -15], + [18, -19], + [11, -50], + [22, -8], + [11, -22], + [2, -67], + [-20, -22], + [-20, -21], + [-46, -21], + [-35, -48], + [-47, -10], + [-59, 13], + [-42, 0], + [-29, -4], + [-23, -43], + [-35, -26], + [-40, -78], + [-32, -54], + [23, 9], + [45, 78], + [58, 49], + [42, 6], + [24, -29], + [-26, -40], + [9, -63], + [9, -45], + [36, -29], + [46, 8], + [28, 67], + [2, -43], + [17, -22], + [-34, -38], + [-61, -36], + [-28, -23], + [-31, -43], + [-21, 4], + [-1, 50], + [48, 49], + [-44, -2], + [-31, -7] + ], + [ + [1829, 9377], + [-14, -27], + [61, 17], + [39, -29], + [31, 30], + [26, -20], + [23, -58], + [14, 25], + [-20, 60], + [24, 9], + [28, -9], + [31, -24], + [17, -58], + [9, -41], + [47, -30], + [50, -28], + [-3, -26], + [-46, -4], + [18, -23], + [-9, -22], + [-51, 9], + [-48, 16], + [-32, -3], + [-52, -20], + [-70, -9], + [-50, -6], + [-15, 28], + [-38, 16], + [-24, -6], + [-35, 47], + [19, 6], + [43, 10], + [39, -3], + [36, 11], + [-54, 13], + [-59, -4], + [-39, 1], + [-15, 22], + [64, 23], + [-42, -1], + [-49, 16], + [23, 44], + [20, 24], + [74, 36], + [29, -12] + ], + [ + [2097, 9395], + [-24, -39], + [-44, 41], + [10, 9], + [37, 2], + [21, -13] + ], + [ + [2879, 9376], + [3, -16], + [-30, 2], + [-30, 1], + [-30, -8], + [-8, 3], + [-31, 32], + [1, 21], + [14, 4], + [63, -6], + [48, -33] + ], + [ + [2595, 9379], + [22, -36], + [26, 47], + [70, 24], + [48, -61], + [-4, -38], + [55, 17], + [26, 23], + [62, -30], + [38, -28], + [3, -25], + [52, 13], + [29, -38], + [67, -23], + [24, -24], + [26, -55], + [-51, -28], + [66, -38], + [44, -13], + [40, -55], + [44, -3], + [-9, -42], + [-49, -69], + [-34, 26], + [-44, 57], + [-36, -8], + [-3, -34], + [29, -34], + [38, -27], + [11, -16], + [18, -58], + [-9, -43], + [-35, 16], + [-70, 47], + [39, -51], + [29, -35], + [5, -21], + [-76, 24], + [-59, 34], + [-34, 29], + [10, 17], + [-42, 30], + [-40, 29], + [0, -18], + [-80, -9], + [-23, 20], + [18, 44], + [52, 1], + [57, 7], + [-9, 21], + [10, 30], + [36, 57], + [-8, 27], + [-11, 20], + [-42, 29], + [-57, 20], + [18, 15], + [-29, 36], + [-25, 4], + [-22, 20], + [-14, -18], + [-51, -7], + [-101, 13], + [-59, 17], + [-45, 9], + [-23, 21], + [29, 27], + [-39, 0], + [-9, 60], + [21, 53], + [29, 24], + [72, 16], + [-21, -39] + ], + [ + [2212, 9420], + [33, -12], + [50, 7], + [7, -17], + [-26, -28], + [42, -26], + [-5, -53], + [-45, -23], + [-27, 5], + [-19, 23], + [-69, 45], + [0, 19], + [57, -7], + [-31, 38], + [33, 29] + ], + [ + [2411, 9357], + [-30, -45], + [-32, 3], + [-17, 52], + [1, 29], + [14, 25], + [28, 16], + [58, -2], + [53, -14], + [-42, -53], + [-33, -11] + ], + [ + [1654, 9275], + [-73, -29], + [-15, 26], + [-64, 31], + [12, 25], + [19, 43], + [24, 39], + [-27, 36], + [94, 10], + [39, -13], + [71, -3], + [27, -17], + [30, -25], + [-35, -15], + [-68, -41], + [-34, -42], + [0, -25] + ], + [ + [2399, 9487], + [-15, -23], + [-40, 5], + [-34, 15], + [15, 27], + [40, 16], + [24, -21], + [10, -19] + ], + [ + [2264, 9590], + [21, -27], + [1, -31], + [-13, -44], + [-46, -6], + [-30, 10], + [1, 34], + [-45, -4], + [-2, 45], + [30, -2], + [41, 21], + [40, -4], + [2, 8] + ], + [ + [1994, 9559], + [11, -21], + [25, 10], + [29, -2], + [5, -29], + [-17, -28], + [-94, -10], + [-70, -25], + [-43, -2], + [-3, 20], + [57, 26], + [-125, -7], + [-39, 10], + [38, 58], + [26, 17], + [78, -20], + [50, -35], + [48, -5], + [-40, 57], + [26, 21], + [29, -7], + [9, -28] + ], + [ + [2370, 9612], + [30, -19], + [55, 0], + [24, -19], + [-6, -22], + [32, -14], + [17, -14], + [38, -2], + [40, -5], + [44, 13], + [57, 5], + [45, -5], + [30, -22], + [6, -24], + [-17, -16], + [-42, -13], + [-35, 8], + [-80, -10], + [-57, -1], + [-45, 8], + [-74, 19], + [-9, 32], + [-4, 29], + [-27, 26], + [-58, 7], + [-32, 19], + [10, 24], + [58, -4] + ], + [ + [1772, 9645], + [-4, -46], + [-21, -20], + [-26, -3], + [-52, -26], + [-44, -9], + [-38, 13], + [47, 44], + [57, 39], + [43, -1], + [38, 9] + ], + [ + [2393, 9637], + [-13, -2], + [-52, 4], + [-7, 17], + [56, -1], + [19, -11], + [-3, -7] + ], + [ + [1939, 9648], + [-52, -17], + [-41, 19], + [23, 19], + [40, 6], + [39, -10], + [-9, -17] + ], + [ + [1954, 9701], + [-34, -11], + [-46, 0], + [0, 8], + [29, 18], + [14, -3], + [37, -12] + ], + [ + [2338, 9669], + [-41, -12], + [-23, 13], + [-12, 23], + [-2, 24], + [36, -2], + [16, -4], + [33, -21], + [-7, -21] + ], + [ + [2220, 9685], + [11, -25], + [-45, 7], + [-46, 19], + [-62, 2], + [27, 18], + [-34, 14], + [-2, 22], + [55, -8], + [75, -21], + [21, -28] + ], + [ + [2583, 9764], + [33, -20], + [-38, -17], + [-51, -45], + [-50, -4], + [-57, 8], + [-30, 24], + [0, 21], + [22, 16], + [-50, 0], + [-31, 19], + [-18, 27], + [20, 26], + [19, 18], + [28, 4], + [-12, 14], + [65, 3], + [35, -32], + [47, -12], + [46, -11], + [22, -39] + ], + [ + [3097, 9967], + [74, -4], + [60, -8], + [51, -16], + [-2, -16], + [-67, -25], + [-68, -12], + [-25, -14], + [61, 1], + [-66, -36], + [-45, -17], + [-48, -48], + [-57, -10], + [-18, -12], + [-84, -6], + [39, -8], + [-20, -10], + [23, -29], + [-26, -21], + [-43, -16], + [-13, -24], + [-39, -17], + [4, -14], + [48, 3], + [0, -15], + [-74, -35], + [-73, 16], + [-81, -9], + [-42, 7], + [-52, 3], + [-4, 29], + [52, 13], + [-14, 43], + [17, 4], + [74, -26], + [-38, 38], + [-45, 11], + [23, 23], + [49, 14], + [8, 21], + [-39, 23], + [-12, 31], + [76, -3], + [22, -6], + [43, 21], + [-62, 7], + [-98, -4], + [-49, 20], + [-23, 24], + [-32, 17], + [-6, 21], + [41, 11], + [32, 2], + [55, 9], + [41, 22], + [34, -3], + [30, -16], + [21, 32], + [37, 9], + [50, 7], + [85, 2], + [14, -6], + [81, 10], + [60, -4], + [60, -4] + ], + [ + [5290, 7828], + [-3, -24], + [-12, -10], + [-20, 7], + [-6, -24], + [-14, -2], + [-5, 10], + [-15, -20], + [-13, -3], + [-12, 13] + ], + [ + [5190, 7775], + [-10, 25], + [-13, -9], + [0, 27], + [21, 33], + [-1, 15], + [12, -5], + [8, 10] + ], + [ + [5207, 7871], + [24, -1], + [5, 13], + [30, -18] + ], + [ + [3140, 1814], + [-10, -24], + [-23, -18], + [-14, 2], + [-16, 5], + [-21, 18], + [-29, 8], + [-35, 33], + [-28, 32], + [-38, 66], + [23, -12], + [39, -40], + [36, -21], + [15, 27], + [9, 41], + [25, 24], + [20, -7] + ], + [ + [3095, 1968], + [-25, 0], + [-13, -14], + [-25, -22], + [-5, -55], + [-11, -1], + [-32, 19], + [-32, 41], + [-34, 34], + [-9, 37], + [8, 35], + [-14, 39], + [-4, 101], + [12, 57], + [30, 45], + [-43, 18], + [27, 52], + [9, 98], + [31, -21], + [15, 123], + [-19, 15], + [-9, -73], + [-17, 8], + [9, 84], + [9, 110], + [13, 40], + [-8, 58], + [-2, 66], + [11, 2], + [17, 96], + [20, 94], + [11, 88], + [-6, 89], + [8, 49], + [-3, 72], + [16, 73], + [5, 114], + [9, 123], + [9, 132], + [-2, 96], + [-6, 84] + ], + [ + [3045, 3974], + [14, 15], + [8, 30] + ], + [ + [8064, 6161], + [-24, -28], + [-23, 18], + [0, 51], + [13, 26], + [31, 17], + [16, -1], + [6, -23], + [-12, -26], + [-7, -34] + ], + [ + [8628, 7562], + [-18, 35], + [-11, -33], + [-43, -26], + [4, -31], + [-24, 2], + [-13, 19], + [-19, -42], + [-30, -32], + [-23, -38] + ], + [ + [8451, 7416], + [-39, -17], + [-20, -27], + [-30, -17], + [15, 28], + [-6, 23], + [22, 40], + [-15, 30], + [-24, -20], + [-32, -41], + [-17, -39], + [-27, -2], + [-14, -28], + [15, -40], + [22, -10], + [1, -26], + [22, -17], + [31, 42], + [25, -23], + [18, -2], + [4, -31], + [-39, -16], + [-13, -32], + [-27, -30], + [-14, -41], + [30, -33], + [11, -58], + [17, -54], + [18, -45], + [0, -44], + [-17, -16], + [6, -32], + [17, -18], + [-5, -48], + [-7, -47], + [-15, -5], + [-21, -64], + [-22, -78], + [-26, -70], + [-38, -55], + [-39, -50], + [-31, -6], + [-17, -27], + [-10, 20], + [-15, -30], + [-39, -29], + [-29, -9], + [-10, -63], + [-15, -3], + [-8, 43], + [7, 22], + [-37, 19], + [-13, -9] + ], + [ + [8001, 6331], + [-28, 15], + [-14, 24], + [5, 34], + [-26, 11], + [-13, 22], + [-24, -31], + [-27, -7], + [-22, 0], + [-15, -14] + ], + [ + [7837, 6385], + [-14, -9], + [4, -68], + [-15, 2], + [-2, 14] + ], + [ + [7810, 6324], + [-1, 24], + [-20, -17], + [-12, 11], + [-21, 22], + [8, 49], + [-18, 12], + [-6, 54], + [-30, -10], + [4, 70], + [26, 50], + [1, 48], + [-1, 46], + [-12, 14], + [-9, 35], + [-16, -5] + ], + [ + [7703, 6727], + [-30, 9], + [9, 25], + [-13, 36], + [-20, -24], + [-23, 14], + [-32, -37], + [-25, -44], + [-23, -8] + ], + [ + [7466, 6670], + [-2, 47], + [-17, -13] + ], + [ + [7447, 6704], + [-32, 6], + [-32, 14], + [-22, 26], + [-22, 11], + [-9, 29], + [-16, 8], + [-28, 39], + [-22, 18], + [-12, -14] + ], + [ + [7252, 6841], + [-38, 41], + [-28, 37], + [-7, 65], + [20, -7], + [1, 30], + [-12, 30], + [3, 48], + [-30, 69] + ], + [ + [7161, 7154], + [-45, 24], + [-8, 46], + [-21, 27] + ], + [ + [7082, 7268], + [-4, 34], + [1, 23], + [-17, 13], + [-9, -6], + [-7, 55] + ], + [ + [7046, 7387], + [8, 13], + [-4, 14], + [26, 28], + [20, 12], + [29, -8], + [11, 38], + [35, 7], + [10, 23], + [44, 32], + [4, 13] + ], + [ + [7229, 7559], + [-2, 34], + [19, 15], + [-25, 103], + [55, 24], + [14, 13], + [20, 106], + [55, -20], + [15, 27], + [2, 59], + [23, 6], + [21, 39] + ], + [ + [7426, 7965], + [11, 5] + ], + [ + [7437, 7970], + [7, -41], + [23, -32], + [40, -22], + [19, -47], + [-10, -70], + [10, -25], + [33, -10], + [37, -8], + [33, -37], + [18, -7], + [12, -54], + [17, -35], + [30, 1], + [58, -13], + [36, 8], + [28, -9], + [41, -36], + [34, 0], + [12, -18], + [32, 32], + [45, 20], + [42, 2], + [32, 21], + [20, 32], + [20, 20], + [-5, 19], + [-9, 23], + [15, 38], + [15, -5], + [29, -12], + [28, 31], + [42, 23], + [20, 39], + [20, 17], + [40, 8], + [22, -7], + [3, 21], + [-25, 41], + [-22, 19], + [-22, -22], + [-27, 10], + [-16, -8], + [-7, 24], + [20, 59], + [13, 45] + ], + [ + [8240, 8005], + [34, -23], + [39, 38], + [-1, 26], + [26, 62], + [15, 19], + [0, 33], + [-16, 14], + [23, 29], + [35, 11], + [37, 2], + [41, -18], + [25, -22], + [17, -59], + [10, -26], + [10, -36], + [10, -58], + [49, -19], + [32, -42], + [12, -55], + [42, 0], + [24, 23], + [46, 17], + [-15, -53], + [-11, -21], + [-9, -65], + [-19, -58], + [-33, 11], + [-24, -21], + [7, -51], + [-4, -69], + [-14, -2], + [0, -30] + ], + [ + [4920, 5353], + [-12, -1], + [-20, 12], + [-18, -1], + [-33, -10], + [-19, -18], + [-27, -21], + [-6, 1] + ], + [ + [4785, 5315], + [2, 49], + [3, 7], + [-1, 24], + [-12, 24], + [-8, 4], + [-8, 17], + [6, 26], + [-3, 28], + [1, 18] + ], + [ + [4765, 5512], + [5, 0], + [1, 25], + [-2, 12], + [3, 8], + [10, 7], + [-7, 47], + [-6, 25], + [2, 20], + [5, 4] + ], + [ + [4776, 5660], + [4, 6], + [8, -9], + [21, -1], + [5, 18], + [5, -1], + [8, 6], + [4, -25], + [7, 7], + [11, 9] + ], + [ + [4921, 5627], + [7, -84], + [-11, -50], + [-8, -66], + [12, -51], + [-1, -23] + ], + [ + [5363, 5191], + [-4, 4], + [-16, -8], + [-17, 8], + [-13, -4] + ], + [ + [5313, 5191], + [-45, 1] + ], + [ + [5268, 5192], + [4, 47], + [-11, 39], + [-13, 10], + [-6, 27], + [-7, 8], + [1, 16] + ], + [ + [5236, 5339], + [7, 42], + [13, 57], + [8, 1], + [17, 34], + [10, 1], + [16, -24], + [19, 20], + [2, 25], + [7, 23], + [4, 30], + [15, 25], + [5, 41], + [6, 13], + [4, 31], + [7, 37], + [24, 46], + [1, 20], + [3, 10], + [-11, 24] + ], + [ + [5393, 5795], + [1, 19], + [8, 3] + ], + [ + [5402, 5817], + [11, -38], + [2, -39], + [-1, -39], + [15, -54], + [-15, 1], + [-8, -4], + [-13, 6], + [-6, -28], + [16, -35], + [13, -10], + [3, -24], + [9, -41], + [-4, -16] + ], + [ + [5444, 5191], + [-2, -31], + [-22, 14], + [-22, 15], + [-35, 2] + ], + [ + [5856, 5265], + [-2, -69], + [11, -8], + [-9, -21], + [-10, -16], + [-11, -31], + [-6, -27], + [-1, -48], + [-7, -22], + [0, -45] + ], + [ + [5821, 4978], + [-8, -16], + [-1, -35], + [-4, -5], + [-2, -32] + ], + [ + [5814, 4792], + [5, -55], + [-2, -30], + [5, -35], + [16, -33], + [15, -74] + ], + [ + [5853, 4565], + [-11, 6], + [-37, -10], + [-7, -7], + [-8, -38], + [6, -26], + [-5, -70], + [-3, -59], + [7, -11], + [19, -23], + [8, 11], + [2, -64], + [-21, 1], + [-11, 32], + [-10, 25], + [-22, 9], + [-6, 31], + [-17, -19], + [-22, 8], + [-10, 27], + [-17, 6], + [-13, -2], + [-2, 19], + [-9, 1] + ], + [ + [5342, 4697], + [-4, 18] + ], + [ + [5360, 4775], + [8, -6], + [9, 23], + [15, -1], + [2, -17], + [11, -10], + [16, 37], + [16, 29], + [7, 19], + [-1, 48], + [12, 58], + [13, 30], + [18, 29], + [3, 18], + [1, 22], + [5, 21], + [-2, 33], + [4, 52], + [5, 37], + [8, 32], + [2, 36] + ], + [ + [5760, 5367], + [17, -49], + [12, -7], + [8, 10], + [12, -4], + [16, 12], + [6, -25], + [25, -39] + ], + [ + [5330, 4760], + [-22, 62] + ], + [ + [5308, 4822], + [21, 33], + [-11, 39], + [10, 15], + [19, 7], + [2, 26], + [15, -28], + [24, -2], + [9, 27], + [3, 40], + [-3, 46], + [-13, 35], + [12, 68], + [-7, 12], + [-21, -5], + [-7, 31], + [2, 25] + ], + [ + [2906, 5049], + [-12, 14], + [-14, 19], + [-7, -9], + [-24, 8], + [-7, 25], + [-5, -1], + [-28, 34] + ], + [ + [2809, 5139], + [-3, 18], + [10, 5], + [-1, 29], + [6, 22], + [14, 4], + [12, 37], + [10, 31], + [-10, 14], + [5, 34], + [-6, 54], + [6, 16], + [-4, 50], + [-12, 31] + ], + [ + [2836, 5484], + [4, 29], + [9, -4], + [5, 17], + [-6, 35], + [3, 9] + ], + [ + [2851, 5570], + [14, -2], + [21, 41], + [12, 6], + [0, 20], + [5, 50], + [16, 27], + [17, 1], + [3, 13], + [21, -5], + [22, 30], + [11, 13], + [14, 28], + [9, -3], + [8, -16], + [-6, -20] + ], + [ + [3018, 5753], + [-18, -10], + [-7, -29], + [-10, -17], + [-8, -22], + [-4, -42], + [-8, -35], + [15, -4], + [3, -27], + [6, -13], + [3, -24], + [-4, -22], + [1, -12], + [7, -5], + [7, -20], + [36, 5], + [16, -7], + [19, -51], + [11, 6], + [20, -3], + [16, 7], + [10, -10], + [-5, -32], + [-6, -20], + [-2, -42], + [5, -40], + [8, -17], + [1, -13], + [-14, -30], + [10, -13], + [8, -21], + [8, -58] + ], + [ + [3058, 4804], + [-14, 31], + [-8, 1], + [18, 61], + [-21, 27], + [-17, -5], + [-10, 10], + [-15, -15], + [-21, 7], + [-16, 62], + [-13, 15], + [-9, 28], + [-19, 28], + [-7, -5] + ], + [ + [2695, 5543], + [-15, 14], + [-6, 12], + [4, 10], + [-1, 13], + [-8, 14], + [-11, 12], + [-10, 8], + [-1, 17], + [-8, 10], + [2, -17], + [-5, -14], + [-7, 17], + [-9, 5], + [-4, 12], + [1, 18], + [3, 19], + [-8, 8], + [7, 12] + ], + [ + [2619, 5713], + [4, 7], + [18, -15], + [7, 7], + [9, -5], + [4, -12], + [8, -4], + [7, 13] + ], + [ + [2676, 5704], + [7, -32], + [11, -24], + [13, -25] + ], + [ + [2707, 5623], + [-11, -6], + [0, -23], + [6, -9], + [-4, -7], + [1, -11], + [-2, -12], + [-2, -12] + ], + [ + [2715, 6427], + [23, -4], + [22, 0], + [26, -21], + [11, -21], + [26, 6], + [10, -13], + [24, -37], + [17, -27], + [9, 1], + [17, -12], + [-2, -17], + [20, -2], + [21, -24], + [-3, -14], + [-19, -7], + [-18, -3], + [-19, 4], + [-40, -5], + [18, 32], + [-11, 16], + [-18, 4], + [-9, 17], + [-7, 33], + [-16, -2], + [-26, 16], + [-8, 12], + [-36, 10], + [-10, 11], + [11, 15], + [-28, 3], + [-20, -31], + [-11, -1], + [-4, -14], + [-14, -7], + [-12, 6], + [15, 18], + [6, 22], + [13, 13], + [14, 11], + [21, 6], + [7, 6] + ], + [ + [5909, 7133], + [2, 1], + [4, 14], + [20, -1], + [25, 18], + [-19, -25], + [2, -11] + ], + [ + [5943, 7129], + [-3, 2], + [-5, -5], + [-4, 1], + [-2, -2], + [0, 6], + [-2, 4], + [-6, 0], + [-7, -5], + [-5, 3] + ], + [ + [5943, 7129], + [1, -5], + [-28, -24], + [-14, 8], + [-7, 23], + [14, 2] + ], + [ + [5377, 7945], + [-16, 25], + [-14, 15], + [-3, 25], + [-5, 17], + [21, 13], + [10, 15], + [20, 11], + [7, 11], + [7, -6], + [13, 6] + ], + [ + [5417, 8077], + [13, -19], + [21, -5], + [-2, -17], + [15, -12], + [4, 15], + [19, -6], + [3, -19], + [20, -3], + [13, -29] + ], + [ + [5523, 7982], + [-8, 0], + [-4, -11], + [-7, -3], + [-2, -13], + [-5, -3], + [-1, -5], + [-9, -7], + [-12, 1], + [-4, -13] + ], + [ + [5275, 8306], + [1, -23], + [28, -14], + [-1, -21], + [29, 11], + [15, 16], + [32, -23], + [13, -19] + ], + [ + [5392, 8233], + [6, -30], + [-8, -16], + [11, -21], + [6, -31], + [-2, -21], + [12, -37] + ], + [ + [5207, 7871], + [3, 42], + [14, 40], + [-40, 11], + [-13, 16] + ], + [ + [5171, 7980], + [2, 26], + [-6, 13] + ], + [ + [5171, 8059], + [-5, 62], + [17, 0], + [7, 22], + [6, 54], + [-5, 20] + ], + [ + [5191, 8217], + [6, 13], + [23, 3], + [5, -13], + [19, 29], + [-6, 22], + [-2, 34] + ], + [ + [5236, 8305], + [21, -8], + [18, 9] + ], + [ + [6196, 5808], + [7, -19], + [-1, -24], + [-16, -14], + [12, -16] + ], + [ + [6198, 5735], + [-10, -32] + ], + [ + [6188, 5703], + [-7, 11], + [-6, -5], + [-16, 1], + [0, 18], + [-2, 17], + [9, 27], + [10, 26] + ], + [ + [6176, 5798], + [12, -5], + [8, 15] + ], + [ + [5352, 8343], + [-17, -48], + [-29, 33], + [-4, 25], + [41, 19], + [9, -29] + ], + [ + [5236, 8305], + [-11, 32], + [-1, 61], + [5, 16], + [8, 17], + [24, 4], + [10, 16], + [22, 17], + [-1, -30], + [-8, -20], + [4, -16], + [15, -9], + [-7, -22], + [-8, 6], + [-20, -42], + [7, -29] + ], + [ + [3008, 6222], + [3, 10], + [22, 0], + [16, -15], + [8, 1], + [5, -21], + [15, 1], + [-1, -17], + [12, -2], + [14, -22], + [-10, -24], + [-14, 13], + [-12, -3], + [-9, 3], + [-5, -11], + [-11, -3], + [-4, 14], + [-10, -8], + [-11, -41], + [-7, 10], + [-1, 17] + ], + [ + [3008, 6124], + [0, 16], + [-7, 17], + [7, 10], + [2, 23], + [-2, 32] + ], + [ + [5333, 6444], + [-95, -112], + [-81, -117], + [-39, -26] + ], + [ + [5118, 6189], + [-31, -6], + [0, 38], + [-13, 10], + [-17, 16], + [-7, 28], + [-94, 129], + [-93, 129] + ], + [ + [4863, 6533], + [-105, 143] + ], + [ + [4758, 6676], + [1, 11], + [0, 4] + ], + [ + [4759, 6691], + [0, 70], + [44, 44], + [28, 9], + [23, 16], + [11, 29], + [32, 24], + [1, 44], + [16, 5], + [13, 22], + [36, 9], + [5, 23], + [-7, 13], + [-10, 62], + [-1, 36], + [-11, 38] + ], + [ + [4939, 7135], + [27, 32], + [30, 11], + [17, 24], + [27, 18], + [47, 11], + [46, 4], + [14, -8], + [26, 23], + [30, 0], + [11, -13], + [19, 3] + ], + [ + [5233, 7240], + [-5, -30], + [4, -56], + [-6, -49], + [-18, -33], + [3, -45], + [23, -35], + [0, -14], + [17, -24], + [12, -106] + ], + [ + [5263, 6848], + [9, -52], + [1, -28], + [-5, -48], + [2, -27], + [-3, -32], + [2, -37], + [-11, -25], + [17, -43], + [1, -25], + [10, -33], + [13, 11], + [22, -28], + [12, -37] + ], + [ + [2769, 4856], + [15, 45], + [-6, 25], + [-11, -27], + [-16, 26], + [5, 16], + [-4, 54], + [9, 9], + [5, 37], + [11, 38], + [-2, 24], + [15, 13], + [19, 23] + ], + [ + [2906, 5049], + [4, -45], + [-9, -39], + [-30, -62], + [-33, -23], + [-17, -51], + [-6, -40], + [-15, -24], + [-12, 29], + [-11, 7], + [-12, -5], + [-1, 22], + [8, 14], + [-3, 24] + ], + [ + [5969, 6800], + [-7, -23], + [-6, -45], + [-8, -31], + [-6, -10], + [-10, 19], + [-12, 26], + [-20, 85], + [-3, -5], + [12, -63], + [17, -59], + [21, -92], + [10, -32], + [9, -34], + [25, -65], + [-6, -10], + [1, -39], + [33, -53], + [4, -12] + ], + [ + [6023, 6357], + [-110, 0], + [-107, 0], + [-112, 0] + ], + [ + [5694, 6357], + [0, 218], + [0, 210], + [-8, 47], + [7, 37], + [-5, 25], + [10, 29] + ], + [ + [5698, 6923], + [37, 0], + [27, -15], + [28, -18], + [13, -9], + [21, 19], + [11, 17], + [25, 5], + [20, -8], + [7, -29], + [7, 19], + [22, -14], + [22, -3], + [13, 15] + ], + [ + [5951, 6902], + [18, -102] + ], + [ + [6176, 5798], + [-10, 20], + [-11, 34], + [-12, 19], + [-8, 21], + [-24, 23], + [-19, 1], + [-7, 12], + [-16, -14], + [-17, 27], + [-8, -44], + [-33, 13] + ], + [ + [6011, 5910], + [-3, 23], + [12, 87], + [3, 39], + [9, 18], + [20, 10], + [14, 34] + ], + [ + [6066, 6121], + [16, -69], + [8, -54], + [15, -29], + [38, -55], + [16, -34], + [15, -34], + [8, -20], + [14, -18] + ], + [ + [4749, 7532], + [1, 42], + [-11, 25], + [39, 43], + [34, -11], + [37, 1], + [30, -10], + [23, 3], + [45, -2] + ], + [ + [4947, 7623], + [11, -23], + [51, -27], + [10, 13], + [31, -27], + [32, 8] + ], + [ + [5082, 7567], + [2, -35], + [-26, -39], + [-36, -12], + [-2, -20], + [-18, -33], + [-10, -48], + [11, -34], + [-16, -26], + [-6, -39], + [-21, -11], + [-20, -46], + [-35, -1], + [-27, 1], + [-17, -21], + [-11, -22], + [-13, 5], + [-11, 20], + [-8, 34], + [-26, 9] + ], + [ + [4792, 7249], + [-2, 20], + [10, 22], + [4, 16], + [-9, 17], + [7, 39], + [-11, 36], + [12, 5], + [1, 27], + [5, 9], + [0, 46], + [13, 16], + [-8, 30], + [-16, 2], + [-5, -8], + [-16, 0], + [-7, 29], + [-11, -8], + [-10, -15] + ], + [ + [5675, 8472], + [3, 35], + [-10, -8], + [-18, 21], + [-2, 34], + [35, 17], + [35, 8], + [30, -10], + [29, 2] + ], + [ + [5777, 8571], + [4, -10], + [-20, -34], + [8, -55], + [-12, -19] + ], + [ + [5757, 8453], + [-22, 0], + [-24, 22], + [-13, 7], + [-23, -10] + ], + [ + [6188, 5703], + [-6, -21], + [10, -32], + [10, -29], + [11, -21], + [90, -70], + [24, 0] + ], + [ + [6327, 5530], + [-79, -177], + [-36, -3], + [-25, -41], + [-17, -1], + [-8, -19] + ], + [ + [6162, 5289], + [-19, 0], + [-11, 20], + [-26, -25], + [-8, -24], + [-18, 4], + [-6, 7], + [-7, -1], + [-9, 0], + [-35, 50], + [-19, 0], + [-10, 20], + [0, 33], + [-14, 10] + ], + [ + [5980, 5383], + [-17, 64], + [-12, 14], + [-5, 23], + [-14, 29], + [-17, 4], + [9, 34], + [15, 2], + [4, 18] + ], + [ + [5943, 5571], + [0, 53] + ], + [ + [5943, 5624], + [8, 62], + [13, 16], + [3, 24], + [12, 45], + [17, 30], + [11, 58], + [4, 51] + ], + [ + [5794, 9138], + [-4, -42], + [42, -39], + [-26, -45], + [33, -67], + [-19, -51], + [25, -43], + [-11, -39], + [41, -40], + [-11, -31], + [-25, -34], + [-60, -75] + ], + [ + [5779, 8632], + [-50, -5], + [-49, -21], + [-45, -13], + [-16, 32], + [-27, 20], + [6, 58], + [-14, 53], + [14, 35], + [25, 37], + [63, 64], + [19, 12], + [-3, 25], + [-39, 28] + ], + [ + [5663, 8957], + [-9, 23], + [-1, 91], + [-43, 40], + [-37, 29] + ], + [ + [5573, 9140], + [17, 16], + [30, -32], + [37, 3], + [30, -14], + [26, 26], + [14, 44], + [43, 20], + [35, -24], + [-11, -41] + ], + [ + [9954, 4033], + [9, -17], + [-4, -31], + [-17, -8], + [-16, 7], + [-2, 26], + [10, 21], + [13, -8], + [7, 10] + ], + [ + [0, 4079], + [9981, -14], + [-17, -13], + [-4, 23], + [14, 12], + [9, 3], + [-9983, 18] + ], + [ + [0, 4108], + [0, -29] + ], + [ + [0, 4108], + [6, 3], + [-4, -28], + [-2, -4] + ], + [ + [3300, 1994], + [33, 36], + [24, -15], + [16, 24], + [22, -27], + [-8, -21], + [-37, -17], + [-13, 20], + [-23, -26], + [-14, 26] + ], + [ + [5265, 7548], + [-9, -46], + [-13, 12], + [-6, 40], + [5, 22], + [18, 22], + [5, -50] + ], + [ + [5157, 7984], + [6, -6], + [8, 2] + ], + [ + [5190, 7775], + [-2, -17], + [9, -22], + [-10, -18], + [7, -46], + [15, -8], + [-3, -25] + ], + [ + [5206, 7639], + [-25, -34], + [-55, 16], + [-40, -19], + [-4, -35] + ], + [ + [4947, 7623], + [14, 35], + [5, 118], + [-28, 62], + [-21, 30], + [-42, 23], + [-3, 43], + [36, 12], + [47, -15], + [-9, 67], + [26, -25], + [65, 46], + [8, 48], + [24, 12] + ], + [ + [3485, 5194], + [7, 25], + [3, 27] + ], + [ + [3495, 5246], + [4, 26], + [-10, 34] + ], + [ + [3489, 5306], + [-3, 41], + [15, 51] + ], + [ + [3501, 5398], + [9, -7], + [21, -14], + [29, -50], + [5, -24] + ], + [ + [5308, 4822], + [-29, 60], + [-18, 49], + [-17, 61], + [1, 19], + [6, 19], + [7, 43], + [5, 44] + ], + [ + [5263, 5117], + [10, 4], + [40, -1], + [0, 71] + ], + [ + [4827, 8240], + [-21, 12], + [-17, -1], + [6, 32], + [-6, 32] + ], + [ + [4789, 8315], + [23, 2], + [30, -37], + [-15, -40] + ], + [ + [4916, 8521], + [-30, -63], + [29, 8], + [30, -1], + [-7, -48], + [-25, -53], + [29, -4], + [2, -6], + [25, -69], + [19, -10], + [17, -67], + [8, -24], + [33, -11], + [-3, -38], + [-14, -17], + [11, -30], + [-25, -31], + [-37, 0], + [-48, -16], + [-13, 12], + [-18, -28], + [-26, 7], + [-19, -23], + [-15, 12], + [41, 62], + [25, 13], + [-1, 0], + [-43, 9], + [-8, 24], + [29, 18], + [-15, 32], + [5, 39], + [42, -6], + [4, 35], + [-19, 36], + [0, 1], + [-34, 10], + [-7, 16], + [10, 27], + [-9, 16], + [-15, -28], + [-1, 57], + [-14, 30], + [10, 61], + [21, 48], + [23, -4], + [33, 4] + ], + [ + [6154, 7511], + [4, 26], + [-7, 40], + [-16, 22], + [-16, 6], + [-10, 19] + ], + [ + [6109, 7624], + [4, 6], + [23, -10], + [41, -9], + [38, -28], + [5, -11], + [17, 9], + [25, -13], + [9, -24], + [17, -13] + ], + [ + [6210, 7485], + [-27, 29], + [-29, -3] + ], + [ + [5029, 5408], + [-44, -35], + [-15, -20], + [-25, -17], + [-25, 17] + ], + [ + [5000, 5708], + [-2, -18], + [12, -30], + [0, -43], + [2, -47], + [7, -21], + [-6, -54], + [2, -29], + [8, -37], + [6, -21] + ], + [ + [4765, 5512], + [-8, 1], + [-5, -24], + [-8, 1], + [-6, 12], + [2, 24], + [-11, 36], + [-8, -7], + [-6, -1] + ], + [ + [4715, 5554], + [-7, -3], + [0, 21], + [-4, 16], + [0, 17], + [-6, 25], + [-7, 21], + [-23, 0], + [-6, -11], + [-8, -1], + [-4, -13], + [-4, -17], + [-14, -26] + ], + [ + [4632, 5583], + [-13, 35], + [-10, 24], + [-8, 7], + [-6, 12], + [-4, 26], + [-4, 13], + [-8, 10] + ], + [ + [4579, 5710], + [13, 29], + [8, -2], + [7, 10], + [6, 0], + [5, 8], + [-3, 20], + [3, 6], + [1, 20] + ], + [ + [4619, 5801], + [13, -1], + [20, -14], + [6, 1], + [3, 7], + [15, -5], + [4, 4] + ], + [ + [4680, 5793], + [1, -22], + [5, 0], + [7, 8], + [5, -2], + [7, -15], + [12, -5], + [8, 13], + [9, 8], + [6, 8], + [6, -1], + [6, -13], + [3, -17], + [12, -24], + [-6, -16], + [-1, -19], + [6, 6], + [3, -7], + [-1, -17], + [8, -18] + ], + [ + [4532, 5834], + [3, 27] + ], + [ + [4535, 5861], + [31, 1], + [6, 14], + [9, 1], + [11, -14], + [8, -1], + [9, 10], + [6, -17], + [-12, -13], + [-12, 1], + [-12, 13], + [-10, -14], + [-5, -1], + [-7, -8], + [-25, 1] + ], + [ + [4579, 5710], + [-15, 24], + [-11, 4], + [-7, 17], + [1, 9], + [-9, 13], + [-2, 12] + ], + [ + [4536, 5789], + [15, 10], + [9, -2], + [8, 7], + [51, -3] + ], + [ + [5263, 5117], + [-5, 9], + [10, 66] + ], + [ + [5658, 7167], + [15, -20], + [22, 3], + [20, -4], + [0, -10], + [15, 7], + [-4, -18], + [-40, -5], + [1, 10], + [-34, 12], + [5, 25] + ], + [ + [5723, 7469], + [-17, 2], + [-14, 6], + [-34, -16], + [19, -33], + [-14, -10], + [-15, 0], + [-15, 31], + [-5, -13], + [6, -36], + [14, -27], + [-10, -13], + [15, -27], + [14, -18], + [0, -33], + [-25, 16], + [8, -30], + [-18, -7], + [11, -52], + [-19, -1], + [-23, 26], + [-10, 47], + [-5, 40], + [-11, 27], + [-14, 34], + [-2, 16] + ], + [ + [5583, 7470], + [18, 6], + [11, 13], + [15, -2], + [5, 11], + [5, 2] + ], + [ + [5725, 7529], + [13, -16], + [-8, -37], + [-7, -7] + ], + [ + [3701, 9939], + [93, 35], + [97, -2], + [36, 21], + [98, 6], + [222, -7], + [174, -47], + [-52, -23], + [-106, -3], + [-150, -5], + [14, -11], + [99, 7], + [83, -21], + [54, 18], + [23, -21], + [-30, -34], + [71, 22], + [135, 23], + [83, -12], + [15, -25], + [-113, -42], + [-16, -14], + [-88, -10], + [64, -3], + [-32, -43], + [-23, -38], + [1, -66], + [33, -38], + [-43, -3], + [-46, -19], + [52, -31], + [6, -50], + [-30, -6], + [36, -50], + [-61, -5], + [32, -24], + [-9, -20], + [-39, -10], + [-39, 0], + [35, -40], + [0, -26], + [-55, 24], + [-14, -15], + [37, -15], + [37, -36], + [10, -48], + [-49, -11], + [-22, 22], + [-34, 34], + [10, -40], + [-33, -31], + [73, -2], + [39, -3], + [-75, -52], + [-75, -46], + [-81, -21], + [-31, 0], + [-29, -23], + [-38, -62], + [-60, -42], + [-19, -2], + [-37, -15], + [-40, -13], + [-24, -37], + [0, -41], + [-15, -39], + [-45, -47], + [11, -47], + [-12, -48], + [-14, -58], + [-39, -4], + [-41, 49], + [-56, 0], + [-27, 32], + [-18, 58], + [-49, 73], + [-14, 39], + [-3, 53], + [-39, 54], + [10, 44], + [-18, 21], + [27, 69], + [42, 22], + [11, 25], + [6, 46], + [-32, -21], + [-15, -9], + [-25, -8], + [-34, 19], + [-2, 40], + [11, 31], + [25, 1], + [57, -15], + [-48, 37], + [-24, 20], + [-28, -8], + [-23, 15], + [31, 55], + [-17, 22], + [-22, 41], + [-34, 62], + [-35, 23], + [0, 25], + [-74, 34], + [-59, 5], + [-74, -3], + [-68, -4], + [-32, 19], + [-49, 37], + [73, 19], + [56, 3], + [-119, 15], + [-62, 24], + [3, 23], + [106, 28], + [101, 29], + [11, 21], + [-75, 22], + [24, 23], + [97, 41], + [40, 7], + [-12, 26], + [66, 16], + [86, 9], + [85, 1], + [30, -19], + [74, 33], + [66, -22], + [39, -5], + [58, -19], + [-66, 32], + [4, 25] + ], + [ + [2497, 5869], + [-14, 10], + [-17, 1], + [-13, 12], + [-15, 24] + ], + [ + [2438, 5916], + [1, 18], + [3, 13], + [-4, 12], + [13, 48], + [36, 0], + [1, 20], + [-5, 4], + [-3, 12], + [-10, 14], + [-11, 20], + [13, 0], + [0, 33], + [26, 0], + [26, 0] + ], + [ + [2529, 5996], + [10, -11], + [2, 9], + [8, -7] + ], + [ + [2549, 5987], + [-13, -23], + [-13, -16], + [-2, -12], + [2, -11], + [-5, -15] + ], + [ + [2518, 5910], + [-7, -4], + [2, -7], + [-6, -6], + [-9, -15], + [-1, -9] + ], + [ + [3340, 5552], + [18, -22], + [17, -38], + [1, -31], + [10, -1], + [15, -29], + [11, -21] + ], + [ + [3412, 5410], + [-4, -53], + [-17, -15], + [1, -14], + [-5, -31], + [13, -42], + [9, -1], + [3, -33], + [17, -51] + ], + [ + [3313, 5365], + [-19, 45], + [7, 16], + [0, 27], + [17, 10], + [7, 11], + [-10, 22], + [3, 21], + [22, 35] + ], + [ + [2574, 5825], + [-5, 18], + [-8, 5] + ], + [ + [2561, 5848], + [2, 24], + [-4, 6], + [-6, 4], + [-12, -7], + [-1, 8], + [-8, 10], + [-6, 12], + [-8, 5] + ], + [ + [2549, 5987], + [3, -3], + [6, 11], + [8, 1], + [3, -5], + [4, 3], + [13, -6], + [13, 2], + [9, 6], + [3, 7], + [9, -3], + [6, -4], + [8, 1], + [5, 5], + [13, -8], + [4, -1], + [9, -11], + [8, -13], + [10, -9], + [7, -17] + ], + [ + [2690, 5943], + [-9, 2], + [-4, -8], + [-10, -8], + [-7, 0], + [-6, -8], + [-6, 3], + [-4, 9], + [-3, -2], + [-4, -14], + [-3, 1], + [0, -12], + [-10, -17], + [-5, -7], + [-3, -7], + [-8, 12], + [-6, -16], + [-6, 1], + [-6, -2], + [0, -29], + [-4, 0], + [-3, -14], + [-9, -2] + ], + [ + [5522, 7770], + [7, -23], + [9, -17], + [-11, -22] + ], + [ + [5515, 7577], + [-3, -10] + ], + [ + [5512, 7567], + [-26, 22], + [-16, 21], + [-26, 18], + [-23, 43], + [6, 5], + [-13, 25], + [-1, 19], + [-17, 10], + [-9, -26], + [-8, 20], + [0, 21], + [1, 1] + ], + [ + [5380, 7746], + [20, -2], + [5, 9], + [9, -9], + [11, -1], + [0, 16], + [10, 6], + [2, 24], + [23, 16] + ], + [ + [5460, 7805], + [8, -7], + [21, -26], + [23, -11], + [10, 9] + ], + [ + [3008, 6124], + [-19, 10], + [-13, -5], + [-17, 5], + [-13, -11], + [-15, 18], + [3, 19], + [25, -8], + [21, -5], + [10, 13], + [-12, 26], + [0, 23], + [-18, 9], + [7, 16], + [17, -3], + [24, -9] + ], + [ + [5471, 7900], + [14, -15], + [10, -6], + [24, 7], + [2, 12], + [11, 2], + [14, 9], + [3, -4], + [13, 8], + [6, 13], + [9, 4], + [30, -18], + [6, 6] + ], + [ + [5613, 7918], + [15, -16], + [2, -16] + ], + [ + [5630, 7886], + [-17, -12], + [-13, -40], + [-17, -40], + [-22, -11] + ], + [ + [5561, 7783], + [-17, 2], + [-22, -15] + ], + [ + [5460, 7805], + [-6, 20], + [-4, 0] + ], + [ + [8352, 4453], + [-11, -2], + [-37, 42], + [26, 11], + [14, -18], + [10, -17], + [-2, -16] + ], + [ + [8471, 4532], + [2, -11], + [1, -18] + ], + [ + [8474, 4503], + [-18, -45], + [-24, -13], + [-3, 8], + [2, 20], + [12, 36], + [28, 23] + ], + [ + [8274, 4579], + [10, -16], + [17, 5], + [7, -25], + [-32, -12], + [-19, -8], + [-15, 1], + [10, 34], + [15, 0], + [7, 21] + ], + [ + [8413, 4579], + [-4, -32], + [-42, -17], + [-37, 7], + [0, 22], + [22, 12], + [18, -18], + [18, 5], + [25, 21] + ], + [ + [8017, 4657], + [53, -6], + [6, 25], + [51, -29], + [10, -38], + [42, -11], + [34, -35], + [-31, -23], + [-31, 24], + [-25, -1], + [-29, 4], + [-26, 11], + [-32, 22], + [-21, 6], + [-11, -7], + [-51, 24], + [-5, 25], + [-25, 5], + [19, 56], + [34, -3], + [22, -23], + [12, -5], + [4, -21] + ], + [ + [8741, 4690], + [-14, -40], + [-3, 45], + [5, 21], + [6, 20], + [7, -17], + [-1, -29] + ], + [ + [8534, 4853], + [-11, -19], + [-19, 10], + [-5, 26], + [28, 3], + [7, -20] + ], + [ + [8623, 4875], + [10, -45], + [-23, 24], + [-23, 5], + [-16, -4], + [-19, 2], + [6, 33], + [35, 2], + [30, -17] + ], + [ + [8916, 4904], + [0, -193], + [1, -192] + ], + [ + [8917, 4519], + [-25, 48], + [-28, 12], + [-7, -17], + [-35, -1], + [12, 48], + [17, 16], + [-7, 64], + [-14, 50], + [-53, 50], + [-23, 5], + [-42, 54], + [-8, -28], + [-11, -5], + [-6, 21], + [0, 26], + [-21, 29], + [29, 21], + [20, -1], + [-2, 16], + [-41, 0], + [-11, 35], + [-25, 11], + [-11, 29], + [37, 14], + [14, 20], + [45, -25], + [4, -22], + [8, -95], + [29, -35], + [23, 62], + [32, 36], + [25, 0], + [23, -21], + [21, -21], + [30, -11] + ], + [ + [8478, 5141], + [-22, -58], + [-21, -12], + [-27, 12], + [-46, -3], + [-24, -8], + [-4, -45], + [24, -53], + [15, 27], + [52, 20], + [-2, -27], + [-12, 9], + [-12, -35], + [-25, -23], + [27, -76], + [-5, -20], + [25, -68], + [-1, -39], + [-14, -17], + [-11, 20], + [13, 49], + [-27, -23], + [-7, 16], + [3, 23], + [-20, 35], + [3, 57], + [-19, -18], + [2, -69], + [1, -84], + [-17, -9], + [-12, 18], + [8, 54], + [-4, 57], + [-12, 1], + [-9, 40], + [12, 39], + [4, 47], + [14, 89], + [5, 24], + [24, 44], + [22, -18], + [35, -8], + [32, 3], + [27, 43], + [5, -14] + ], + [ + [8574, 5124], + [-2, -51], + [-14, 6], + [-4, -36], + [11, -32], + [-8, -7], + [-11, 38], + [-8, 75], + [6, 47], + [9, 22], + [2, -32], + [16, -5], + [3, -25] + ], + [ + [8045, 5176], + [5, -39], + [19, -34], + [18, 12], + [18, -4], + [16, 30], + [13, 5], + [26, -17], + [23, 13], + [14, 82], + [11, 21], + [10, 67], + [32, 0], + [24, -10] + ], + [ + [8274, 5302], + [-16, -53], + [20, -56], + [-5, -28], + [32, -54], + [-33, -7], + [-10, -40], + [2, -54], + [-27, -40], + [-1, -59], + [-10, -91], + [-5, 21], + [-31, -26], + [-11, 36], + [-20, 3], + [-14, 19], + [-33, -21], + [-10, 29], + [-18, -4], + [-23, 7], + [-4, 79], + [-14, 17], + [-13, 50], + [-4, 52], + [3, 55], + [16, 39] + ], + [ + [7939, 4712], + [-31, -1], + [-24, 49], + [-35, 48], + [-12, 36], + [-21, 48], + [-14, 44], + [-21, 83], + [-24, 49], + [-9, 51], + [-10, 46], + [-25, 37], + [-14, 51], + [-21, 33], + [-29, 65], + [-3, 30], + [18, -2], + [43, -12], + [25, -57], + [21, -40], + [16, -25], + [26, -63], + [28, -1], + [23, -41], + [16, -49], + [22, -27], + [-12, -49], + [16, -20], + [10, -2], + [5, -41], + [10, -33], + [20, -5], + [14, -37], + [-7, -74], + [-1, -91] + ], + [ + [7252, 6841], + [-17, -27], + [-11, -55], + [27, -23], + [26, -29], + [36, -33], + [38, -8], + [16, -30], + [22, -5], + [33, -14], + [23, 1], + [4, 23], + [-4, 38], + [2, 25] + ], + [ + [7703, 6727], + [2, -22], + [-10, -11], + [2, -36], + [-19, 10], + [-36, -41], + [0, -33], + [-15, -50], + [-1, -29], + [-13, -48], + [-21, 13], + [-1, -61], + [-7, -20], + [3, -25], + [-14, -14] + ], + [ + [7472, 6360], + [-4, -21], + [-19, 1], + [-34, -13], + [2, -44], + [-15, -35], + [-40, -40], + [-31, -69], + [-21, -38], + [-28, -38], + [0, -27], + [-13, -15], + [-26, -21], + [-12, -3], + [-9, -45], + [6, -77], + [1, -49], + [-11, -56], + [0, -101], + [-15, -2], + [-12, -46], + [8, -19], + [-25, -17], + [-10, -40], + [-11, -17], + [-26, 55], + [-13, 83], + [-11, 60], + [-9, 28], + [-15, 56], + [-7, 74], + [-5, 37], + [-25, 81], + [-12, 115], + [-8, 75], + [0, 72], + [-5, 55], + [-41, -35], + [-19, 7], + [-36, 71], + [13, 22], + [-8, 23], + [-33, 50] + ], + [ + [6893, 6457], + [19, 40], + [61, -1], + [-6, 51], + [-15, 30], + [-4, 46], + [-18, 26], + [31, 62], + [32, -4], + [29, 61], + [18, 60], + [27, 60], + [-1, 42], + [24, 34], + [-23, 29], + [-9, 40], + [-10, 52], + [14, 25], + [42, -14], + [31, 9], + [26, 49] + ], + [ + [4827, 8240], + [5, -42], + [-21, -53], + [-49, -35], + [-40, 9], + [23, 62], + [-15, 60], + [38, 46], + [21, 28] + ], + [ + [6497, 7255], + [25, 12], + [19, 33], + [19, -1], + [12, 11], + [20, -6], + [31, -30], + [22, -6], + [31, -53], + [21, -2], + [3, -49] + ], + [ + [6690, 6820], + [14, -31], + [11, -36], + [27, -26], + [1, -52], + [13, -10], + [2, -27], + [-40, -30], + [-10, -69] + ], + [ + [6708, 6539], + [-53, 18], + [-30, 13], + [-31, 8], + [-12, 73], + [-13, 10], + [-22, -11], + [-28, -28], + [-34, 20], + [-28, 45], + [-27, 17], + [-18, 56], + [-21, 79], + [-15, -10], + [-17, 20], + [-11, -24] + ], + [ + [6348, 6825], + [-15, 32], + [0, 31], + [-9, 0], + [5, 43], + [-15, 45], + [-34, 32], + [-19, 56], + [6, 46], + [14, 21], + [-2, 34], + [-18, 18], + [-18, 70] + ], + [ + [6243, 7253], + [-15, 48], + [5, 18], + [-8, 68], + [19, 17] + ], + [ + [6357, 7321], + [9, -43], + [26, -13], + [20, -29], + [39, -10], + [44, 15], + [2, 14] + ], + [ + [6348, 6825], + [-16, 3] + ], + [ + [6332, 6828], + [-19, 5], + [-20, -56] + ], + [ + [6293, 6777], + [-52, 4], + [-78, 119], + [-41, 41], + [-34, 16] + ], + [ + [6088, 6957], + [-11, 72] + ], + [ + [6077, 7029], + [61, 62], + [11, 71], + [-3, 43], + [16, 15], + [14, 37] + ], + [ + [6176, 7257], + [12, 9], + [32, -8], + [10, -15], + [13, 10] + ], + [ + [4597, 8984], + [-7, -39], + [31, -40], + [-36, -45], + [-80, -41], + [-24, -10], + [-36, 8], + [-78, 19], + [28, 26], + [-61, 29], + [49, 12], + [-1, 17], + [-58, 14], + [19, 38], + [42, 9], + [43, -40], + [42, 32], + [35, -17], + [45, 32], + [47, -4] + ], + [ + [5992, 6990], + [-5, -19] + ], + [ + [5987, 6971], + [-10, 8], + [-6, -39], + [7, -7], + [-7, -8], + [-1, -15], + [13, 8] + ], + [ + [5983, 6918], + [0, -23], + [-14, -95] + ], + [ + [5951, 6902], + [8, 19], + [-2, 4], + [8, 27], + [5, 45], + [4, 15], + [1, 0] + ], + [ + [5975, 7012], + [9, 0], + [3, 11], + [7, 0] + ], + [ + [5994, 7023], + [1, -24], + [-4, -9], + [1, 0] + ], + [ + [5431, 7316], + [-10, -46], + [4, -19], + [-6, -30], + [-21, 22], + [-14, 7], + [-39, 30], + [4, 30], + [32, -6], + [28, 7], + [22, 5] + ], + [ + [5255, 7492], + [17, -42], + [-4, -78], + [-13, 4], + [-11, -20], + [-10, 16], + [-2, 71], + [-6, 34], + [15, -3], + [14, 18] + ], + [ + [5383, 7805], + [-3, -29], + [7, -25] + ], + [ + [5387, 7751], + [-22, 8], + [-23, -20], + [1, -30], + [-3, -17], + [9, -30], + [26, -29], + [14, -49], + [31, -48], + [22, 0], + [7, -13], + [-8, -11], + [25, -22], + [20, -18], + [24, -30], + [3, -11], + [-5, -22], + [-16, 28], + [-24, 10], + [-12, -39], + [20, -21], + [-3, -31], + [-11, -4], + [-15, -50], + [-12, -5], + [0, 18], + [6, 32], + [6, 12], + [-11, 35], + [-8, 29], + [-12, 8], + [-8, 25], + [-18, 11], + [-12, 24], + [-21, 4], + [-21, 26], + [-26, 39], + [-19, 34], + [-8, 58], + [-14, 7], + [-23, 20], + [-12, -8], + [-16, -28], + [-12, -4] + ], + [ + [2845, 6150], + [19, -5], + [14, -15], + [5, -16], + [-19, -1], + [-9, -10], + [-15, 10], + [-16, 21], + [3, 14], + [12, 4], + [6, -2] + ], + [ + [5992, 6990], + [31, -24], + [54, 63] + ], + [ + [6088, 6957], + [-5, -8], + [-56, -30], + [28, -59], + [-9, -10], + [-5, -20], + [-21, -8], + [-7, -21], + [-12, -19], + [-31, 10] + ], + [ + [5970, 6792], + [-1, 8] + ], + [ + [5983, 6918], + [4, 17], + [0, 36] + ], + [ + [8739, 7075], + [4, -20], + [-16, -36], + [-11, 19], + [-15, -14], + [-7, -34], + [-18, 16], + [0, 28], + [15, 36], + [16, -7], + [12, 25], + [20, -13] + ], + [ + [8915, 7252], + [-10, -47], + [4, -30], + [-14, -42], + [-35, -27], + [-49, -4], + [-40, -67], + [-19, 22], + [-1, 44], + [-48, -13], + [-33, -27], + [-32, -2], + [28, -43], + [-19, -101], + [-18, -24], + [-13, 23], + [7, 53], + [-18, 17], + [-11, 41], + [26, 18], + [15, 37], + [28, 30], + [20, 41], + [55, 17], + [30, -12], + [29, 105], + [19, -28], + [40, 59], + [16, 23], + [18, 72], + [-5, 67], + [11, 37], + [30, 11], + [15, -82], + [-1, -48], + [-25, -59], + [0, -61] + ], + [ + [8997, 7667], + [19, -12], + [20, 25], + [6, -67], + [-41, -16], + [-25, -59], + [-43, 41], + [-15, -65], + [-31, -1], + [-4, 59], + [14, 46], + [29, 3], + [8, 82], + [9, 46], + [32, -62], + [22, -20] + ], + [ + [6970, 7554], + [-15, -10], + [-37, -42], + [-12, -42], + [-11, 0], + [-7, 28], + [-36, 2], + [-5, 48], + [-14, 0], + [2, 60], + [-33, 43], + [-48, -5], + [-32, -8], + [-27, 53], + [-22, 22], + [-43, 43], + [-6, 5], + [-71, -35], + [1, -218] + ], + [ + [6554, 7498], + [-14, -3], + [-20, 46], + [-18, 17], + [-32, -12], + [-12, -20] + ], + [ + [6458, 7526], + [-2, 14], + [7, 25], + [-5, 21], + [-32, 20], + [-13, 53], + [-15, 15], + [-1, 19], + [27, -6], + [1, 44], + [23, 9], + [25, -9], + [5, 58], + [-5, 36], + [-28, -2], + [-24, 14], + [-32, -26], + [-26, -12] + ], + [ + [6363, 7799], + [-14, 9], + [3, 31], + [-18, 39], + [-20, -2], + [-24, 40], + [16, 45], + [-8, 12], + [22, 65], + [29, -34], + [3, 43], + [58, 64], + [43, 2], + [61, -41], + [33, -24], + [30, 25], + [44, 1], + [35, -30], + [8, 17], + [39, -2], + [7, 28], + [-45, 40], + [27, 29], + [-5, 16], + [26, 15], + [-20, 41], + [13, 20], + [104, 21], + [13, 14], + [70, 22], + [25, 24], + [50, -12], + [9, -61], + [29, 14], + [35, -20], + [-2, -32], + [27, 3], + [69, 56], + [-10, -19], + [35, -46], + [62, -150], + [15, 31], + [39, -34], + [39, 16], + [16, -11], + [13, -34], + [20, -12], + [11, -25], + [36, 8], + [15, -36] + ], + [ + [7229, 7559], + [-17, 9], + [-14, 21], + [-42, 6], + [-46, 2], + [-10, -6], + [-39, 24], + [-16, -12], + [-4, -35], + [-46, 21], + [-18, -9], + [-7, -26] + ], + [ + [6155, 4958], + [-20, -24], + [-7, -24], + [-10, -4], + [-4, -42], + [-9, -24], + [-5, -39], + [-12, -20] + ], + [ + [6088, 4781], + [-40, 59], + [-1, 35], + [-101, 120], + [-5, 6] + ], + [ + [5941, 5001], + [0, 63], + [8, 24], + [14, 39], + [10, 43], + [-13, 68], + [-3, 30], + [-13, 41] + ], + [ + [5944, 5309], + [17, 35], + [19, 39] + ], + [ + [6162, 5289], + [-24, -67], + [0, -215], + [17, -49] + ], + [ + [7046, 7387], + [-53, -9], + [-34, 19], + [-30, -4], + [3, 34], + [30, -10], + [10, 18] + ], + [ + [6972, 7435], + [21, -6], + [36, 43], + [-33, 31], + [-20, -15], + [-21, 22], + [24, 39], + [-9, 5] + ], + [ + [7849, 5777], + [-7, 72], + [18, 49], + [36, 11], + [26, -8] + ], + [ + [7922, 5901], + [23, -23], + [12, 40], + [25, -21] + ], + [ + [7982, 5897], + [6, -40], + [-3, -71], + [-47, -45], + [13, -36], + [-30, -4], + [-24, -24] + ], + [ + [7897, 5677], + [-23, 9], + [-11, 30], + [-14, 61] + ], + [ + [8564, 7339], + [24, -70], + [7, -38], + [0, -68], + [-10, -33], + [-25, -11], + [-22, -25], + [-25, -5], + [-3, 32], + [5, 45], + [-13, 61], + [21, 10], + [-19, 51] + ], + [ + [8504, 7288], + [2, 5], + [12, -2], + [11, 27], + [20, 2], + [11, 4], + [4, 15] + ], + [ + [5557, 7574], + [5, 13] + ], + [ + [5562, 7587], + [7, 4], + [4, 20], + [5, 3], + [4, -8], + [5, -4], + [3, -10], + [5, -2], + [5, -11], + [4, 0], + [-3, -14], + [-3, -7], + [1, -5] + ], + [ + [5599, 7553], + [-6, -2], + [-17, -9], + [-1, -12], + [-4, 0] + ], + [ + [6332, 6828], + [6, -26], + [-3, -13], + [9, -45] + ], + [ + [6344, 6744], + [-19, -1], + [-7, 28], + [-25, 6] + ], + [ + [7922, 5901], + [9, 26], + [1, 50], + [-22, 52], + [-2, 58], + [-21, 48], + [-21, 4], + [-6, -20], + [-16, -2], + [-8, 10], + [-30, -35], + [0, 53], + [7, 62], + [-19, 3], + [-2, 36], + [-12, 18] + ], + [ + [7780, 6264], + [6, 21], + [24, 39] + ], + [ + [7837, 6385], + [17, -47], + [12, -54], + [34, 0], + [11, -52], + [-18, -15], + [-8, -21], + [34, -36], + [23, -70], + [17, -52], + [21, -41], + [7, -41], + [-5, -59] + ], + [ + [5975, 7012], + [10, 49], + [14, 41], + [0, 2] + ], + [ + [5999, 7104], + [13, -3], + [4, -23], + [-15, -22], + [-7, -33] + ], + [ + [4785, 5315], + [-7, 0], + [-29, 28], + [-25, 45], + [-24, 32], + [-18, 38] + ], + [ + [4682, 5458], + [6, 19], + [2, 17], + [12, 33], + [13, 27] + ], + [ + [5412, 6408], + [-20, -22], + [-15, 33], + [-44, 25] + ], + [ + [5263, 6848], + [13, 14], + [3, 25], + [-3, 24], + [19, 23], + [8, 19], + [14, 17], + [2, 45] + ], + [ + [5319, 7015], + [32, -20], + [12, 5], + [23, -10], + [37, -26], + [13, -53], + [25, -11], + [39, -25], + [30, -29], + [13, 15], + [13, 27], + [-6, 45], + [9, 29], + [20, 28], + [19, 8], + [37, -12], + [10, -27], + [10, 0], + [9, -10], + [28, -7], + [6, -19] + ], + [ + [5694, 6357], + [0, -118], + [-32, 0], + [0, -25] + ], + [ + [5662, 6214], + [-111, 113], + [-111, 113], + [-28, -32] + ], + [ + [7271, 5502], + [-4, -62], + [-12, -16], + [-24, -14], + [-13, 47], + [-5, 85], + [13, 96], + [19, -33], + [13, -42], + [13, -61] + ], + [ + [5804, 3347], + [10, -18], + [-9, -29], + [-4, -19], + [-16, -9], + [-5, -19], + [-10, -6], + [-21, 46], + [15, 37], + [15, 23], + [13, 12], + [12, -18] + ], + [ + [5631, 8267], + [-2, 15], + [3, 16], + [-13, 10], + [-29, 10] + ], + [ + [5590, 8318], + [-6, 50] + ], + [ + [5584, 8368], + [32, 18], + [47, -4], + [27, 6], + [4, -12], + [15, -4], + [26, -29] + ], + [ + [5652, 8242], + [-7, 19], + [-14, 6] + ], + [ + [5584, 8368], + [1, 44], + [14, 37], + [26, 20], + [22, -44], + [22, 1], + [6, 46] + ], + [ + [5757, 8453], + [14, -14], + [2, -28], + [9, -35] + ], + [ + [4759, 6691], + [-4, 0], + [0, -31], + [-17, -2], + [-9, -14], + [-13, 0], + [-10, 8], + [-23, -6], + [-9, -46], + [-9, -5], + [-13, -74], + [-38, -64], + [-9, -81], + [-12, -27], + [-3, -21], + [-63, -5] + ], + [ + [4527, 6323], + [1, 27], + [11, 17], + [9, 30], + [-2, 20], + [10, 42], + [15, 38], + [9, 9], + [8, 35], + [0, 31], + [10, 37], + [19, 21], + [18, 60], + [0, 1], + [14, 23], + [26, 6], + [22, 41], + [14, 16], + [23, 49], + [-7, 73], + [10, 51], + [4, 31], + [18, 40], + [28, 27], + [21, 25], + [18, 61], + [9, 36], + [20, 0], + [17, -25], + [26, 4], + [29, -13], + [12, -1] + ], + [ + [5739, 7906], + [6, 9], + [19, 6], + [20, -19], + [12, -2], + [12, -16], + [-2, -20], + [11, -9], + [4, -25], + [9, -15], + [-2, -9], + [5, -6], + [-7, -4], + [-16, 1], + [-3, 9], + [-6, -5], + [2, -11], + [-7, -19], + [-5, -20], + [-7, -6] + ], + [ + [5784, 7745], + [-5, 27], + [3, 25], + [-1, 26], + [-16, 35], + [-9, 25], + [-9, 17], + [-8, 6] + ], + [ + [6376, 4321], + [7, -25], + [7, -39], + [4, -71], + [7, -28], + [-2, -28], + [-5, -18], + [-10, 35], + [-5, -18], + [5, -43], + [-2, -25], + [-8, -14], + [-1, -50], + [-11, -69], + [-14, -81], + [-17, -112], + [-11, -82], + [-12, -69], + [-23, -14], + [-24, -25], + [-16, 15], + [-22, 21], + [-8, 31], + [-2, 53], + [-10, 47], + [-2, 42], + [5, 43], + [13, 10], + [0, 20], + [13, 45], + [2, 37], + [-6, 28], + [-5, 38], + [-2, 54], + [9, 33], + [4, 38], + [14, 2], + [15, 12], + [11, 10], + [12, 1], + [16, 34], + [23, 36], + [8, 30], + [-4, 25], + [12, -7], + [15, 41], + [1, 36], + [9, 26], + [10, -25] + ], + [ + [2301, 6586], + [-10, -52], + [-5, -43], + [-2, -79], + [-3, -29], + [5, -32], + [9, -29], + [5, -45], + [19, -44], + [6, -34], + [11, -29], + [29, -16], + [12, -25], + [24, 17], + [21, 6], + [21, 11], + [18, 10], + [17, 24], + [7, 34], + [2, 50], + [5, 17], + [19, 16], + [29, 13], + [25, -2], + [17, 5], + [6, -12], + [-1, -29], + [-15, -35], + [-6, -36], + [5, -10], + [-4, -26], + [-7, -46], + [-7, 15], + [-6, -1] + ], + [ + [2438, 5916], + [-32, 64], + [-14, 19], + [-23, 16], + [-15, -5], + [-22, -22], + [-14, -6], + [-20, 16], + [-21, 11], + [-26, 27], + [-21, 8], + [-31, 28], + [-23, 28], + [-7, 16], + [-16, 3], + [-28, 19], + [-12, 27], + [-30, 34], + [-14, 37], + [-6, 29], + [9, 5], + [-3, 17], + [7, 16], + [0, 20], + [-10, 27], + [-2, 23], + [-9, 30], + [-25, 59], + [-28, 46], + [-13, 37], + [-24, 24], + [-5, 14], + [4, 37], + [-14, 13], + [-17, 29], + [-7, 41], + [-14, 5], + [-17, 31], + [-13, 29], + [-1, 19], + [-15, 44], + [-10, 45], + [1, 23], + [-20, 23], + [-10, -2], + [-15, 16], + [-5, -24], + [5, -28], + [2, -45], + [10, -24], + [21, -41], + [4, -14], + [4, -4], + [4, -20], + [5, 1], + [6, -38], + [8, -15], + [6, -21], + [17, -30], + [10, -55], + [8, -26], + [8, -28], + [1, -31], + [13, -2], + [12, -27], + [10, -26], + [-1, -11], + [-12, -21], + [-5, 0], + [-7, 36], + [-18, 33], + [-20, 29], + [-14, 15], + [1, 43], + [-5, 32], + [-13, 19], + [-19, 26], + [-4, -8], + [-7, 16], + [-17, 14], + [-16, 34], + [2, 5], + [11, -4], + [11, 22], + [1, 27], + [-22, 42], + [-16, 17], + [-10, 36], + [-11, 39], + [-12, 47], + [-12, 54] + ], + [ + [1746, 6980], + [32, 4], + [35, 7], + [-2, -12], + [41, -29], + [64, -41], + [55, 0], + [22, 0], + [0, 24], + [48, 0], + [10, -20], + [15, -19], + [16, -26], + [9, -31], + [7, -32], + [15, -18], + [23, -18], + [17, 47], + [23, 1], + [19, -24], + [14, -40], + [10, -35], + [16, -34], + [6, -41], + [8, -28], + [22, -18], + [20, -13], + [10, 2] + ], + [ + [5599, 7553], + [9, 4], + [13, 1] + ], + [ + [4661, 5921], + [10, 11], + [4, 35], + [9, 1], + [20, -16], + [15, 11], + [11, -4], + [4, 13], + [112, 1], + [6, 42], + [-5, 7], + [-13, 255], + [-14, 255], + [43, 1] + ], + [ + [5118, 6189], + [0, -136], + [-15, -39], + [-2, -37], + [-25, -9], + [-38, -5], + [-10, -21], + [-18, -3] + ], + [ + [4680, 5793], + [1, 18], + [-2, 23], + [-11, 16], + [-5, 34], + [-2, 37] + ], + [ + [7737, 5644], + [-3, 44], + [9, 45], + [-10, 35], + [3, 65], + [-12, 30], + [-9, 71], + [-5, 75], + [-12, 49], + [-18, -30], + [-32, -42], + [-15, 5], + [-17, 14], + [9, 73], + [-6, 56], + [-21, 68], + [3, 21], + [-16, 7], + [-20, 49] + ], + [ + [7780, 6264], + [-16, -14], + [-16, -26], + [-20, -2], + [-12, -64], + [-12, -11], + [14, -52], + [17, -43], + [12, -39], + [-11, -51], + [-9, -11], + [6, -30], + [19, -47], + [3, -33], + [0, -27], + [11, -54], + [-16, -55], + [-13, -61] + ], + [ + [5538, 7532], + [-6, 4], + [-8, 19], + [-12, 12] + ], + [ + [5533, 7629], + [8, -10], + [4, -9], + [9, -6], + [10, -12], + [-2, -5] + ], + [ + [7437, 7970], + [29, 10], + [53, 51], + [42, 28], + [24, -18], + [29, -1], + [19, -28], + [28, -2], + [40, -15], + [27, 41], + [-11, 35], + [28, 61], + [31, -24], + [26, -7], + [32, -15], + [6, -44], + [39, -25], + [26, 11], + [36, 7], + [27, -7], + [28, -29], + [16, -30], + [26, 1], + [35, -10], + [26, 15], + [36, 9], + [41, 42], + [17, -6], + [14, -20], + [33, 5] + ], + [ + [5959, 4377], + [21, 5], + [34, -17], + [7, 8], + [19, 1], + [10, 18], + [17, -1], + [30, 23], + [22, 34] + ], + [ + [6119, 4448], + [5, -26], + [-1, -59], + [3, -52], + [1, -92], + [5, -29], + [-8, -43], + [-11, -41], + [-18, -36], + [-25, -23], + [-31, -28], + [-32, -64], + [-10, -11], + [-20, -42], + [-11, -13], + [-3, -42], + [14, -45], + [5, -35], + [0, -17], + [5, 3], + [-1, -58], + [-4, -28], + [6, -10], + [-4, -25], + [-11, -21], + [-23, -20], + [-34, -32], + [-12, -21], + [3, -25], + [7, -4], + [-3, -31] + ], + [ + [5911, 3478], + [-21, 0] + ], + [ + [5890, 3478], + [-2, 26], + [-4, 27] + ], + [ + [5884, 3531], + [-3, 21], + [5, 66], + [-7, 42], + [-13, 83] + ], + [ + [5866, 3743], + [29, 67], + [7, 43], + [5, 5], + [3, 35], + [-5, 17], + [1, 44], + [6, 41], + [0, 75], + [-15, 19], + [-13, 4], + [-6, 15], + [-13, 12], + [-23, -1], + [-2, 22] + ], + [ + [5840, 4141], + [-2, 42], + [84, 49] + ], + [ + [5922, 4232], + [16, -28], + [8, 5], + [11, -15], + [1, -23], + [-6, -28], + [2, -42], + [19, -36], + [8, 41], + [12, 12], + [-2, 76], + [-12, 43], + [-10, 19], + [-10, -1], + [-7, 77], + [7, 45] + ], + [ + [4661, 5921], + [-18, 41], + [-17, 43], + [-18, 16], + [-13, 17], + [-16, -1], + [-13, -12], + [-14, 5], + [-10, -19] + ], + [ + [4542, 6011], + [-2, 32], + [8, 29], + [3, 55], + [-3, 59], + [-3, 29], + [2, 30], + [-7, 28], + [-14, 25] + ], + [ + [4526, 6298], + [6, 20], + [108, -1], + [-5, 86], + [7, 30], + [26, 5], + [-1, 152], + [91, -4], + [0, 90] + ], + [ + [5922, 4232], + [-15, 15], + [9, 55], + [9, 21], + [-6, 49], + [6, 48], + [5, 16], + [-7, 50], + [-14, 26] + ], + [ + [5909, 4512], + [28, -11], + [5, -16], + [10, -28], + [7, -80] + ], + [ + [7836, 5425], + [7, -5], + [16, -36], + [12, -40], + [2, -39], + [-3, -27], + [2, -21], + [2, -35], + [10, -16], + [11, -52], + [-1, -20], + [-19, -4], + [-27, 44], + [-32, 47], + [-4, 30], + [-16, 39], + [-4, 49], + [-10, 32], + [4, 43], + [-7, 25] + ], + [ + [7779, 5439], + [5, 11], + [23, -26], + [2, -30], + [18, 7], + [9, 24] + ], + [ + [8045, 5176], + [21, -20], + [21, 11], + [6, 50], + [12, 11], + [33, 13], + [20, 47], + [14, 37] + ], + [ + [8206, 5379], + [22, 41], + [14, 47], + [11, 0], + [14, -30], + [1, -26], + [19, -16], + [23, -18], + [-2, -23], + [-19, -3], + [5, -29], + [-20, -20] + ], + [ + [5453, 3369], + [-20, 45], + [-11, 43], + [-6, 58], + [-7, 42], + [-9, 91], + [-1, 71], + [-3, 32], + [-11, 25], + [-15, 48], + [-14, 71], + [-6, 37], + [-23, 58], + [-2, 45] + ], + [ + [5644, 4022], + [23, 14], + [18, -4], + [11, -13], + [0, -5] + ], + [ + [5552, 3594], + [0, -218], + [-25, -30], + [-15, -4], + [-17, 11], + [-13, 4], + [-4, 25], + [-11, 17], + [-14, -30] + ], + [ + [9604, 3812], + [23, -36], + [14, -28], + [-10, -14], + [-16, 16], + [-19, 27], + [-18, 31], + [-19, 42], + [-4, 20], + [12, -1], + [16, -20], + [12, -20], + [9, -17] + ], + [ + [5412, 6408], + [7, -92], + [10, -15], + [1, -19], + [11, -20], + [-6, -25], + [-11, -120], + [-1, -77], + [-35, -56], + [-12, -78], + [11, -22], + [0, -38], + [18, -1], + [-3, -28] + ], + [ + [5393, 5795], + [-5, -1], + [-19, 64], + [-6, 3], + [-22, -33], + [-21, 17], + [-15, 3], + [-8, -8], + [-17, 2], + [-16, -25], + [-14, -2], + [-34, 31], + [-13, -15], + [-14, 1], + [-10, 23], + [-28, 22], + [-30, -7], + [-7, -13], + [-4, -34], + [-8, -24], + [-2, -53] + ], + [ + [5236, 5339], + [-29, -21], + [-11, 3], + [-10, -13], + [-23, 1], + [-15, 37], + [-9, 43], + [-19, 39], + [-21, -1], + [-25, 0] + ], + [ + [2619, 5713], + [-10, 18], + [-13, 24], + [-6, 20], + [-12, 19], + [-13, 26], + [3, 9], + [4, -9], + [2, 5] + ], + [ + [2690, 5943], + [-2, -5], + [-2, -13], + [3, -22], + [-6, -20], + [-3, -24], + [-1, -26], + [1, -15], + [1, -27], + [-4, -6], + [-3, -25], + [2, -15], + [-6, -16], + [2, -16], + [4, -9] + ], + [ + [5092, 8091], + [14, 16], + [24, 87], + [38, 25], + [23, -2] + ], + [ + [5863, 9167], + [-47, -24], + [-22, -5] + ], + [ + [5573, 9140], + [-17, -2], + [-4, -39], + [-53, 9], + [-7, -33], + [-27, 1], + [-18, -42], + [-28, -66], + [-43, -83], + [10, -20], + [-10, -24], + [-27, 1], + [-18, -55], + [2, -79], + [17, -29], + [-9, -70], + [-23, -40], + [-12, -34] + ], + [ + [5306, 8535], + [-19, 36], + [-55, -69], + [-37, -13], + [-38, 30], + [-10, 63], + [-9, 137], + [26, 38], + [73, 49], + [55, 61], + [51, 82], + [66, 115], + [47, 44], + [76, 74], + [61, 26], + [46, -3], + [42, 49], + [51, -3], + [50, 12], + [87, -43], + [-36, -16], + [30, -37] + ], + [ + [5686, 9657], + [-62, -24], + [-49, 13], + [19, 16], + [-16, 19], + [57, 11], + [11, -22], + [40, -13] + ], + [ + [5506, 9766], + [92, -44], + [-70, -23], + [-15, -44], + [-25, -11], + [-13, -49], + [-34, -2], + [-59, 36], + [25, 21], + [-42, 17], + [-54, 50], + [-21, 46], + [75, 21], + [16, -20], + [39, 0], + [11, 21], + [40, 2], + [35, -21] + ], + [ + [5706, 9808], + [55, -21], + [-41, -32], + [-81, -7], + [-82, 10], + [-5, 16], + [-40, 1], + [-30, 27], + [86, 17], + [40, -14], + [28, 17], + [70, -14] + ], + [ + [9805, 2640], + [6, -24], + [20, 24], + [8, -25], + [0, -25], + [-10, -27], + [-18, -44], + [-14, -24], + [10, -28], + [-22, -1], + [-23, -22], + [-8, -39], + [-16, -60], + [-21, -26], + [-14, -17], + [-26, 1], + [-18, 20], + [-30, 4], + [-5, 22], + [15, 43], + [35, 59], + [18, 11], + [20, 22], + [24, 31], + [16, 31], + [13, 44], + [10, 15], + [5, 33], + [19, 27], + [6, -25] + ], + [ + [9849, 2922], + [20, -63], + [1, 41], + [13, -16], + [4, -45], + [22, -19], + [19, -5], + [16, 22], + [14, -6], + [-7, -53], + [-8, -34], + [-22, 1], + [-7, -18], + [3, -25], + [-4, -11], + [-11, -32], + [-14, -41], + [-21, -23], + [-5, 15], + [-12, 9], + [16, 48], + [-9, 33], + [-30, 23], + [1, 22], + [20, 20], + [5, 46], + [-1, 38], + [-12, 40], + [1, 10], + [-13, 25], + [-22, 52], + [-12, 42], + [11, 4], + [15, -33], + [21, -15], + [8, -52] + ], + [ + [6475, 6041], + [-9, 41], + [-22, 98] + ], + [ + [6444, 6180], + [83, 59], + [19, 118], + [-13, 42] + ], + [ + [6566, 6530], + [12, -40], + [16, -22], + [20, -8], + [17, -10], + [12, -34], + [8, -20], + [10, -7], + [0, -13], + [-10, -36], + [-5, -16], + [-12, -19], + [-10, -41], + [-13, 3], + [-5, -14], + [-5, -30], + [4, -39], + [-3, -7], + [-13, 0], + [-17, -22], + [-3, -29], + [-6, -12], + [-18, 0], + [-10, -15], + [0, -24], + [-14, -16], + [-15, 5], + [-19, -19], + [-12, -4] + ], + [ + [6557, 6597], + [8, 20], + [3, -5], + [-2, -25], + [-4, -10] + ], + [ + [6893, 6457], + [-20, 15], + [-9, 43], + [-21, 45], + [-51, -12], + [-45, -1], + [-39, -8] + ], + [ + [2836, 5484], + [-9, 17], + [-6, 32], + [7, 16], + [-7, 4], + [-5, 20], + [-14, 16], + [-12, -4], + [-6, -20], + [-11, -15], + [-6, -2], + [-3, -13], + [13, -32], + [-7, -7], + [-4, -9], + [-13, -3], + [-5, 35], + [-4, -10], + [-9, 4], + [-5, 24], + [-12, 3], + [-7, 7], + [-12, 0], + [-1, -13], + [-3, 9] + ], + [ + [2707, 5623], + [10, -22], + [-1, -12], + [11, -3], + [3, 5], + [8, -14], + [13, 4], + [12, 15], + [17, 12], + [9, 17], + [16, -3], + [-1, -6], + [15, -2], + [12, -10], + [10, -18], + [10, -16] + ], + [ + [3045, 3974], + [-28, 33], + [-2, 25], + [-55, 59], + [-50, 65], + [-22, 36], + [-11, 49], + [4, 17], + [-23, 77], + [-28, 109], + [-26, 118], + [-11, 27], + [-9, 43], + [-21, 39], + [-20, 24], + [9, 26], + [-14, 57], + [9, 41], + [22, 37] + ], + [ + [8510, 5555], + [2, -40], + [2, -33], + [-9, -54], + [-11, 60], + [-13, -30], + [9, -43], + [-8, -28], + [-32, 35], + [-8, 42], + [8, 28], + [-17, 28], + [-9, -24], + [-13, 2], + [-21, -33], + [-4, 17], + [11, 50], + [17, 17], + [15, 22], + [10, -27], + [21, 17], + [5, 26], + [19, 1], + [-1, 46], + [22, -28], + [3, -30], + [2, -21] + ], + [ + [8443, 5665], + [-10, -20], + [-9, -37], + [-8, -17], + [-17, 40], + [5, 16], + [7, 17], + [3, 36], + [16, 4], + [-5, -40], + [21, 57], + [-3, -56] + ], + [ + [8291, 5608], + [-37, -56], + [14, 41], + [20, 37], + [16, 41], + [15, 58], + [5, -48], + [-18, -33], + [-15, -40] + ], + [ + [8385, 5760], + [16, -18], + [18, 0], + [0, -25], + [-13, -25], + [-18, -18], + [-1, 28], + [2, 30], + [-4, 28] + ], + [ + [8485, 5776], + [8, -66], + [-21, 16], + [0, -20], + [7, -37], + [-13, -13], + [-1, 42], + [-9, 3], + [-4, 36], + [16, -5], + [0, 22], + [-17, 45], + [27, -1], + [7, -22] + ], + [ + [8375, 5830], + [-7, -51], + [-12, 29], + [-15, 45], + [24, -2], + [10, -21] + ], + [ + [8369, 6151], + [17, -17], + [9, 15], + [2, -15], + [-4, -24], + [9, -43], + [-7, -49], + [-16, -19], + [-5, -48], + [7, -47], + [14, -7], + [13, 7], + [34, -32], + [-2, -32], + [9, -15], + [-3, -27], + [-22, 29], + [-10, 31], + [-7, -22], + [-18, 36], + [-25, -9], + [-14, 13], + [1, 25], + [9, 15], + [-8, 13], + [-4, -21], + [-14, 34], + [-4, 26], + [-1, 56], + [11, -19], + [3, 92], + [9, 54], + [17, 0] + ], + [ + [9329, 4655], + [-8, -6], + [-12, 22], + [-12, 38], + [-6, 45], + [4, 6], + [3, -18], + [8, -13], + [14, -38], + [13, -20], + [-4, -16] + ], + [ + [9221, 4734], + [-15, -5], + [-4, -17], + [-15, -14], + [-15, -14], + [-14, 0], + [-23, 18], + [-16, 16], + [2, 18], + [25, -8], + [15, 4], + [5, 29], + [4, 1], + [2, -31], + [16, 4], + [8, 20], + [16, 21], + [-4, 35], + [17, 1], + [6, -9], + [-1, -33], + [-9, -36] + ], + [ + [8916, 4904], + [48, -41], + [51, -34], + [19, -30], + [16, -30], + [4, -34], + [46, -37], + [7, -31], + [-25, -7], + [6, -39], + [25, -39], + [18, -62], + [15, 2], + [-1, -27], + [22, -10], + [-9, -11], + [30, -25], + [-3, -17], + [-18, -4], + [-7, 16], + [-24, 6], + [-28, 9], + [-22, 38], + [-16, 32], + [-14, 52], + [-36, 26], + [-24, -17], + [-17, -20], + [4, -43], + [-22, -20], + [-16, 9], + [-28, 3] + ], + [ + [9253, 4792], + [-9, -16], + [-5, 35], + [-6, 23], + [-13, 19], + [-16, 25], + [-20, 18], + [8, 14], + [15, -17], + [9, -13], + [12, -14], + [11, -25], + [11, -19], + [3, -30] + ], + [ + [5392, 8233], + [19, 18], + [43, 27], + [35, 20], + [28, -10], + [2, -14], + [27, -1] + ], + [ + [5546, 8273], + [34, -7], + [51, 1] + ], + [ + [5653, 8105], + [14, -52], + [-3, -17], + [-14, -6], + [-25, -50], + [7, -26], + [-6, 3] + ], + [ + [5626, 7957], + [-26, 23], + [-20, -8], + [-13, 6], + [-17, -13], + [-14, 21], + [-11, -8], + [-2, 4] + ], + [ + [3159, 6151], + [14, -5], + [5, -12], + [-7, -15], + [-21, 1], + [-17, -2], + [-1, 25], + [4, 9], + [23, -1] + ], + [ + [8628, 7562], + [4, -10] + ], + [ + [8632, 7552], + [-11, 3], + [-12, -20], + [-8, -20], + [1, -42], + [-14, -13], + [-5, -11], + [-11, -17], + [-18, -10], + [-12, -16], + [-1, -25], + [-3, -7], + [11, -9], + [15, -26] + ], + [ + [8504, 7288], + [-13, 11], + [-4, -11], + [-8, -5], + [-1, 11], + [-7, 5], + [-8, 10], + [8, 26], + [7, 7], + [-3, 11], + [7, 31], + [-2, 10], + [-16, 7], + [-13, 15] + ], + [ + [4792, 7249], + [-11, -15], + [-14, 8], + [-15, -6], + [5, 46], + [-3, 36], + [-12, 6], + [-7, 22], + [2, 39], + [11, 21], + [2, 24], + [6, 36], + [-1, 25], + [-5, 21], + [-1, 20] + ], + [ + [6411, 6520], + [-2, 43], + [7, 31], + [8, 6], + [8, -18], + [1, -35], + [-6, -35] + ], + [ + [6427, 6512], + [-8, -4], + [-8, 12] + ], + [ + [5630, 7886], + [12, 13], + [17, -7], + [18, 0], + [13, -14], + [10, 9], + [20, 5], + [7, 14], + [12, 0] + ], + [ + [5784, 7745], + [12, -11], + [13, 9], + [13, -10] + ], + [ + [5822, 7733], + [0, -15], + [-13, -13], + [-9, 6], + [-7, -71] + ], + [ + [5629, 7671], + [-5, 10], + [6, 10], + [-7, 7], + [-8, -13], + [-17, 17], + [-2, 25], + [-17, 14], + [-3, 18], + [-15, 24] + ], + [ + [8989, 8056], + [28, -105], + [-41, 19], + [-17, -85], + [27, -61], + [-1, -41], + [-21, 36], + [-18, -46], + [-5, 50], + [3, 57], + [-3, 64], + [6, 45], + [2, 79], + [-17, 58], + [3, 80], + [25, 28], + [-11, 27], + [13, 8], + [7, -39], + [10, -57], + [-1, -58], + [11, -59] + ], + [ + [5546, 8273], + [6, 26], + [38, 19] + ], + [ + [0, 9132], + [68, -45], + [73, -59], + [-3, -37], + [19, -15], + [-6, 43], + [75, -8], + [55, -56], + [-28, -26], + [-46, -6], + [0, -57], + [-11, -13], + [-26, 2], + [-22, 21], + [-36, 17], + [-7, 26], + [-28, 9], + [-31, -7], + [-16, 20], + [6, 22], + [-33, -14], + [13, -28], + [-16, -25] + ], + [ + [0, 8896], + [0, 236] + ], + [ + [0, 9282], + [9999, -40], + [-30, -3], + [-5, 19], + [-9964, 24] + ], + [ + [0, 9282], + [4, 3], + [23, 0], + [40, -17], + [-2, -8], + [-29, -14], + [-36, -4], + [0, 40] + ], + [ + [8988, 9383], + [-42, -1], + [-57, 7], + [-5, 3], + [27, 23], + [34, 6], + [40, -23], + [3, -15] + ], + [ + [9186, 9493], + [-32, -23], + [-44, 5], + [-52, 23], + [7, 20], + [51, -9], + [70, -16] + ], + [ + [9029, 9522], + [-22, -44], + [-102, 1], + [-46, -14], + [-55, 39], + [15, 40], + [37, 11], + [73, -2], + [100, -31] + ], + [ + [6598, 9235], + [-17, -5], + [-91, 8], + [-7, 26], + [-50, 16], + [-4, 32], + [28, 13], + [-1, 32], + [55, 50], + [-25, 7], + [66, 52], + [-7, 27], + [62, 31], + [91, 38], + [93, 11], + [48, 22], + [54, 8], + [19, -23], + [-19, -19], + [-98, -29], + [-85, -28], + [-86, -57], + [-42, -57], + [-43, -57], + [5, -49], + [54, -49] + ], + [ + [0, 8896], + [9963, -26], + [-36, 4], + [25, -31], + [17, -49], + [13, -16], + [3, -24], + [-7, -16], + [-52, 13], + [-78, -44], + [-25, -7], + [-42, -42], + [-40, -36], + [-11, -27], + [-39, 41], + [-73, -46], + [-12, 22], + [-27, -26], + [-37, 8], + [-9, -38], + [-33, -58], + [1, -24], + [31, -13], + [-4, -86], + [-25, -2], + [-12, -49], + [11, -26], + [-48, -30], + [-10, -67], + [-41, -15], + [-9, -60], + [-40, -55], + [-10, 41], + [-12, 86], + [-15, 131], + [13, 82], + [23, 35], + [2, 28], + [43, 13], + [50, 75], + [47, 60], + [50, 48], + [23, 83], + [-34, -5], + [-17, -49], + [-70, -65], + [-23, 73], + [-72, -20], + [-69, -99], + [23, -36], + [-62, -16], + [-43, -6], + [2, 43], + [-43, 9], + [-35, -29], + [-85, 10], + [-91, -18], + [-90, -115], + [-106, -139], + [43, -8], + [14, -37], + [27, -13], + [18, 30], + [30, -4], + [40, -65], + [1, -50], + [-21, -59], + [-3, -71], + [-12, -94], + [-42, -86], + [-9, -41], + [-38, -69], + [-38, -68], + [-18, -35], + [-37, -34], + [-17, -1], + [-17, 29], + [-38, -44], + [-4, -19] + ], + [ + [6363, 7799], + [-12, -35], + [-27, -10], + [-28, -61], + [25, -56], + [-2, -40], + [30, -70] + ], + [ + [6109, 7624], + [-35, 49], + [-32, 23], + [-24, 34], + [20, 10], + [23, 49], + [-15, 24], + [41, 24], + [-1, 13], + [-25, -10] + ], + [ + [6061, 7840], + [1, 26], + [14, 17], + [27, 4], + [5, 20], + [-7, 33], + [12, 30], + [-1, 18], + [-41, 19], + [-16, -1], + [-17, 28], + [-21, -9], + [-35, 20], + [0, 12], + [-10, 26], + [-22, 3], + [-2, 18], + [7, 12], + [-18, 33], + [-29, -5], + [-8, 3], + [-7, -14], + [-11, 3] + ], + [ + [5777, 8571], + [31, 33], + [-29, 28] + ], + [ + [5863, 9167], + [29, 20], + [46, -35], + [76, -14], + [105, -67], + [21, -28], + [2, -40], + [-31, -31], + [-45, -15], + [-124, 44], + [-21, -7], + [45, -43], + [2, -28], + [2, -60], + [36, -18], + [22, -15], + [3, 28], + [-17, 26], + [18, 22], + [67, -37], + [24, 15], + [-19, 43], + [65, 58], + [25, -4], + [26, -20], + [16, 40], + [-23, 35], + [14, 36], + [-21, 36], + [78, -18], + [16, -34], + [-35, -7], + [0, -33], + [22, -20], + [43, 13], + [7, 38], + [58, 28], + [97, 50], + [20, -3], + [-27, -35], + [35, -7], + [19, 21], + [52, 1], + [42, 25], + [31, -36], + [32, 39], + [-29, 35], + [14, 19], + [82, -18], + [39, -18], + [100, -68], + [19, 31], + [-28, 31], + [-1, 13], + [-34, 6], + [10, 28], + [-15, 46], + [-1, 19], + [51, 53], + [18, 54], + [21, 11], + [74, -15], + [5, -33], + [-26, -48], + [17, -19], + [9, -41], + [-6, -81], + [31, -36], + [-12, -40], + [-55, -84], + [32, -8], + [11, 21], + [31, 15], + [7, 29], + [24, 29], + [-16, 33], + [13, 39], + [-31, 5], + [-6, 33], + [22, 59], + [-36, 48], + [50, 40], + [-7, 42], + [14, 2], + [15, -33], + [-11, -57], + [29, -11], + [-12, 43], + [46, 23], + [58, 3], + [51, -34], + [-25, 49], + [-2, 63], + [48, 12], + [67, -2], + [60, 7], + [-23, 31], + [33, 39], + [31, 2], + [54, 29], + [74, 8], + [9, 16], + [73, 6], + [23, -14], + [62, 32], + [51, -1], + [8, 25], + [26, 25], + [66, 25], + [48, -19], + [-38, -15], + [63, -9], + [7, -29], + [25, 14], + [82, -1], + [62, -29], + [23, -22], + [-7, -30], + [-31, -18], + [-73, -33], + [-21, -17], + [35, -8], + [41, -15], + [25, 11], + [14, -38], + [12, 15], + [44, 10], + [90, -10], + [6, -28], + [116, -9], + [2, 46], + [59, -11], + [44, 1], + [45, -32], + [13, -37], + [-17, -25], + [35, -47], + [44, -24], + [27, 62], + [44, -26], + [48, 16], + [53, -18], + [21, 16], + [45, -8], + [-20, 55], + [37, 25], + [251, -38], + [24, -35], + [72, -45], + [112, 11], + [56, -10], + [23, -24], + [-4, -44], + [35, -16], + [37, 12], + [49, 1], + [52, -11], + [53, 6], + [49, -52], + [34, 19], + [-23, 37], + [13, 27], + [88, -17], + [58, 4], + [80, -29], + [-9960, -25] + ], + [ + [7918, 9684], + [-157, -23], + [51, 77], + [23, 7], + [21, -4], + [70, -33], + [-8, -24] + ], + [ + [6420, 9816], + [-37, -8], + [-25, -4], + [-4, -10], + [-33, -10], + [-30, 14], + [16, 19], + [-62, 2], + [54, 10], + [43, 1], + [5, -16], + [16, 14], + [26, 10], + [42, -13], + [-11, -9] + ], + [ + [7775, 9718], + [-60, -8], + [-78, 17], + [-46, 23], + [-21, 42], + [-38, 12], + [72, 40], + [60, 14], + [54, -30], + [64, -57], + [-7, -53] + ], + [ + [5844, 4990], + [11, -33], + [-1, -35], + [-8, -7] + ], + [ + [5821, 4978], + [7, -6], + [16, 18] + ], + [ + [4526, 6298], + [1, 25] + ], + [ + [6188, 6023], + [-4, 26], + [-8, 17], + [-2, 24], + [-15, 21], + [-15, 50], + [-7, 48], + [-20, 40], + [-12, 10], + [-18, 56], + [-4, 41], + [2, 35], + [-16, 66], + [-13, 23], + [-15, 12], + [-10, 34], + [2, 13], + [-8, 31], + [-8, 13], + [-11, 44], + [-17, 48], + [-14, 40], + [-14, 0], + [5, 33], + [1, 20], + [3, 24] + ], + [ + [6344, 6744], + [11, -51], + [14, -13], + [5, -21], + [18, -25], + [2, -24], + [-3, -20], + [4, -20], + [8, -16], + [4, -20], + [4, -14] + ], + [ + [6427, 6512], + [5, -22] + ], + [ + [6444, 6180], + [-80, -23], + [-26, -26], + [-20, -62], + [-13, -10], + [-7, 20], + [-11, -3], + [-27, 6], + [-5, 5], + [-32, -1], + [-7, -5], + [-12, 15], + [-7, -29], + [3, -25], + [-12, -19] + ], + [ + [5943, 5617], + [-4, 1], + [0, 29], + [-3, 20], + [-14, 24], + [-4, 42], + [4, 44], + [-13, 4], + [-2, -13], + [-17, -3], + [7, -17], + [2, -36], + [-15, -32], + [-14, -43], + [-14, -6], + [-23, 34], + [-11, -12], + [-3, -17], + [-14, -11], + [-1, -12], + [-28, 0], + [-3, 12], + [-20, 2], + [-10, -10], + [-8, 5], + [-14, 34], + [-5, 17], + [-20, -9], + [-8, -27], + [-7, -53], + [-10, -11], + [-8, -6] + ], + [ + [5663, 5567], + [-2, 2] + ], + [ + [5635, 5716], + [0, 14], + [-10, 17], + [-1, 35], + [-5, 23], + [-10, -4], + [3, 22], + [7, 25], + [-3, 24], + [9, 18], + [-6, 14], + [7, 36], + [13, 44], + [24, -4], + [-1, 234] + ], + [ + [6023, 6357], + [9, -58], + [-6, -10], + [4, -61], + [11, -71], + [10, -14], + [15, -22] + ], + [ + [5943, 5624], + [0, -7] + ], + [ + [5943, 5617], + [0, -46] + ], + [ + [5944, 5309], + [-17, -28], + [-20, 1], + [-22, -14], + [-18, 13], + [-11, -16] + ], + [ + [5682, 5544], + [-19, 23] + ], + [ + [4535, 5861], + [-11, 46], + [-14, 21], + [12, 11], + [14, 41], + [6, 31] + ], + [ + [4536, 5789], + [-4, 45] + ], + [ + [9502, 4438], + [8, -20], + [-19, 0], + [-11, 37], + [17, -15], + [5, -2] + ], + [ + [9467, 4474], + [-11, -1], + [-17, 6], + [-5, 9], + [1, 23], + [19, -9], + [9, -12], + [4, -16] + ], + [ + [9490, 4490], + [-4, -11], + [-21, 52], + [-5, 35], + [9, 0], + [10, -47], + [11, -29] + ], + [ + [9440, 4565], + [1, -12], + [-22, 25], + [-15, 21], + [-10, 20], + [4, 6], + [13, -14], + [23, -27], + [6, -19] + ], + [ + [9375, 4623], + [-5, -3], + [-13, 14], + [-11, 24], + [1, 10], + [17, -25], + [11, -20] + ], + [ + [4682, 5458], + [-8, 5], + [-20, 24], + [-14, 31], + [-5, 22], + [-3, 43] + ], + [ + [2561, 5848], + [-3, -14], + [-16, 1], + [-10, 6], + [-12, 12], + [-15, 3], + [-8, 13] + ], + [ + [6198, 5735], + [9, -11], + [5, -25], + [13, -24], + [14, -1], + [26, 16], + [30, 7], + [25, 18], + [13, 4], + [10, 11], + [16, 2] + ], + [ + [6359, 5732], + [0, -1], + [0, -25], + [0, -59], + [0, -31], + [-13, -36], + [-19, -50] + ], + [ + [6359, 5732], + [9, 1], + [13, 9], + [14, 6], + [14, 20], + [10, 0], + [1, -16], + [-3, -35], + [0, -31], + [-6, -21], + [-7, -64], + [-14, -66], + [-17, -75], + [-24, -87], + [-23, -66], + [-33, -81], + [-28, -48], + [-42, -58], + [-25, -45], + [-31, -72], + [-6, -31], + [-6, -14] + ], + [ + [3412, 5410], + [34, -11], + [2, 10], + [23, 4], + [30, -15] + ], + [ + [3489, 5306], + [10, -35], + [-4, -25] + ], + [ + [5626, 7957], + [-8, -15], + [-5, -24] + ], + [ + [5380, 7746], + [7, 5] + ], + [ + [5663, 8957], + [-47, -17], + [-27, -41], + [4, -36], + [-44, -48], + [-54, -50], + [-20, -84], + [20, -41], + [26, -33], + [-25, -67], + [-29, -14], + [-11, -99], + [-15, -55], + [-34, 6], + [-16, -47], + [-32, -3], + [-9, 56], + [-23, 67], + [-21, 84] + ], + [ + [5890, 3478], + [-5, -26], + [-17, -6], + [-16, 32], + [0, 20], + [7, 22], + [3, 17], + [8, 5], + [14, -11] + ], + [ + [5999, 7104], + [-2, 45], + [7, 25] + ], + [ + [6004, 7174], + [7, 13], + [7, 13], + [2, 33], + [9, -12], + [31, 17], + [14, -12], + [23, 1], + [32, 22], + [15, -1], + [32, 9] + ], + [ + [5051, 5420], + [-22, -12] + ], + [ + [7849, 5777], + [-25, 28], + [-24, -2], + [4, 47], + [-24, 0], + [-2, -65], + [-15, -87], + [-10, -52], + [2, -43], + [18, -2], + [12, -53], + [5, -52], + [15, -33], + [17, -7], + [14, -31] + ], + [ + [7779, 5439], + [-11, 23], + [-4, 29], + [-15, 34], + [-14, 28], + [-4, -35], + [-5, 33], + [3, 37], + [8, 56] + ], + [ + [6883, 7252], + [16, 60], + [-6, 44], + [-20, 14], + [7, 26], + [23, -3], + [13, 33], + [9, 38], + [37, 13], + [-6, -27], + [4, -17], + [12, 2] + ], + [ + [6497, 7255], + [-5, 42], + [4, 62], + [-22, 20], + [8, 40], + [-19, 4], + [6, 49], + [26, -14], + [25, 19], + [-20, 35], + [-8, 34], + [-23, -15], + [-3, -43], + [-8, 38] + ], + [ + [6554, 7498], + [31, 1], + [-4, 29], + [24, 21], + [23, 34], + [37, -31], + [3, -47], + [11, -12], + [30, 2], + [9, -10], + [14, -61], + [32, -41], + [18, -28], + [29, -29], + [37, -25], + [-1, -36] + ], + [ + [8471, 4532], + [3, 14], + [24, 13], + [19, 2], + [9, 8], + [10, -8], + [-10, -16], + [-29, -25], + [-23, -17] + ], + [ + [3286, 5693], + [16, 8], + [6, -2], + [-1, -44], + [-23, -7], + [-5, 6], + [8, 16], + [-1, 23] + ], + [ + [5233, 7240], + [31, 24], + [19, -7], + [-1, -30], + [24, 22], + [2, -12], + [-14, -29], + [0, -27], + [9, -15], + [-3, -51], + [-19, -29], + [6, -33], + [14, -1], + [7, -28], + [11, -9] + ], + [ + [6004, 7174], + [-11, 27], + [11, 22], + [-17, -5], + [-23, 13], + [-19, -34], + [-43, -6], + [-22, 31], + [-30, 2], + [-6, -24], + [-20, -7], + [-26, 31], + [-31, -1], + [-16, 59], + [-21, 33], + [14, 46], + [-18, 28], + [31, 56], + [43, 3], + [12, 45], + [53, -8], + [33, 38], + [32, 17], + [46, 1], + [49, -42], + [40, -22], + [32, 9], + [24, -6], + [33, 31] + ], + [ + [5777, 7539], + [3, -23], + [25, -19], + [-5, -14], + [-33, -3], + [-12, -19], + [-23, -31], + [-9, 27], + [0, 12] + ], + [ + [8382, 6499], + [-17, -95], + [-12, -49], + [-14, 50], + [-4, 44], + [17, 58], + [22, 45], + [13, -18], + [-5, -35] + ], + [ + [6088, 4781], + [-12, -73], + [1, -33], + [18, -22], + [1, -15], + [-8, -36], + [2, -18], + [-2, -28], + [10, -37], + [11, -58], + [10, -13] + ], + [ + [5909, 4512], + [-15, 18], + [-18, 10], + [-11, 10], + [-12, 15] + ], + [ + [5844, 4990], + [10, 8], + [31, -1], + [56, 4] + ], + [ + [6061, 7840], + [-22, -5], + [-18, -19], + [-26, -3], + [-24, -22], + [1, -37], + [14, -14], + [28, 4], + [-5, -21], + [-31, -11], + [-37, -34], + [-16, 12], + [6, 28], + [-30, 17], + [5, 12], + [26, 19], + [-8, 14], + [-43, 15], + [-2, 22], + [-25, -8], + [-11, -32], + [-21, -44] + ], + [ + [3517, 3063], + [-12, -38], + [-31, -32], + [-21, 11], + [-15, -6], + [-26, 25], + [-18, -1], + [-17, 32] + ], + [ + [679, 6185], + [-4, -10], + [-7, 8], + [1, 17], + [-4, 21], + [1, 7], + [5, 10], + [-2, 11], + [1, 6], + [3, -1], + [10, -10], + [5, -5], + [5, -8], + [7, -21], + [-1, -3], + [-11, -13], + [-9, -9] + ], + [ + [664, 6277], + [-9, -4], + [-5, 12], + [-3, 5], + [0, 4], + [3, 5], + [9, -6], + [8, -9], + [-3, -7] + ], + [ + [646, 6309], + [-1, -7], + [-15, 2], + [2, 7], + [14, -2] + ], + [ + [621, 6317], + [-2, -3], + [-2, 1], + [-9, 2], + [-4, 13], + [-1, 2], + [7, 8], + [3, -3], + [8, -20] + ], + [ + [574, 6356], + [-4, -6], + [-9, 11], + [1, 4], + [5, 6], + [6, -1], + [1, -14] + ], + [ + [3135, 7724], + [5, -19], + [-30, -29], + [-29, -20], + [-29, -18], + [-15, -35], + [-4, -13], + [-1, -31], + [10, -32], + [11, -1], + [-3, 21], + [8, -13], + [-2, -17], + [-19, -9], + [-13, 1], + [-20, -10], + [-12, -3], + [-17, -3], + [-23, -17], + [41, 11], + [8, -11], + [-39, -18], + [-17, 0], + [0, 7], + [-8, -16], + [8, -3], + [-6, -43], + [-20, -45], + [-2, 15], + [-6, 3], + [-9, 15], + [5, -32], + [7, -10], + [1, -23], + [-9, -23], + [-16, -47], + [-2, 3], + [8, 40], + [-14, 22], + [-3, 49], + [-5, -25], + [5, -38], + [-18, 10], + [19, -19], + [1, -57], + [8, -4], + [3, -20], + [4, -59], + [-17, -44], + [-29, -18], + [-18, -34], + [-14, -4], + [-14, -22], + [-4, -20], + [-31, -38], + [-16, -28], + [-13, -35], + [-4, -42], + [5, -41], + [9, -51], + [13, -41], + [0, -26], + [13, -69], + [-1, -39], + [-1, -23], + [-7, -36], + [-8, -8], + [-14, 7], + [-4, 26], + [-11, 14], + [-15, 51], + [-13, 45], + [-4, 23], + [6, 39], + [-8, 33], + [-22, 49], + [-10, 9], + [-28, -27], + [-5, 3], + [-14, 28], + [-17, 14], + [-32, -7], + [-24, 7], + [-21, -5], + [-12, -9], + [5, -15], + [0, -24], + [5, -12], + [-5, -8], + [-10, 9], + [-11, -11], + [-20, 2], + [-20, 31], + [-25, -8], + [-20, 14], + [-17, -4], + [-24, -14], + [-25, -44], + [-27, -25], + [-16, -28], + [-6, -27], + [0, -41], + [1, -28], + [5, -20] + ], + [ + [1746, 6980], + [-4, 30], + [-18, 34], + [-13, 7], + [-3, 17], + [-16, 3], + [-10, 16], + [-26, 6], + [-7, 9], + [-3, 32], + [-27, 60], + [-23, 82], + [1, 14], + [-13, 19], + [-21, 50], + [-4, 48], + [-15, 32], + [6, 49], + [-1, 51], + [-8, 45], + [10, 56], + [4, 53], + [3, 54], + [-5, 79], + [-9, 51], + [-8, 27], + [4, 12], + [40, -20], + [15, -56], + [7, 15], + [-5, 49], + [-9, 48] + ], + [ + [750, 8432], + [-28, -23], + [-14, 15], + [-4, 28], + [25, 21], + [15, 9], + [18, -4], + [12, -18], + [-24, -28] + ], + [ + [401, 8597], + [-18, -9], + [-18, 11], + [-17, 16], + [28, 10], + [22, -6], + [3, -22] + ], + [ + [230, 8826], + [17, -12], + [17, 6], + [23, -15], + [27, -8], + [-2, -7], + [-21, -12], + [-21, 13], + [-11, 11], + [-24, -4], + [-7, 5], + [2, 23] + ], + [ + [1374, 8295], + [-15, 22], + [-25, 19], + [-8, 52], + [-36, 47], + [-15, 56], + [-26, 4], + [-44, 2], + [-33, 17], + [-57, 61], + [-27, 11], + [-49, 21], + [-38, -5], + [-55, 27], + [-33, 25], + [-30, -12], + [5, -41], + [-15, -4], + [-32, -12], + [-25, -20], + [-30, -13], + [-4, 35], + [12, 58], + [30, 18], + [-8, 15], + [-35, -33], + [-19, -39], + [-40, -42], + [20, -29], + [-26, -42], + [-30, -25], + [-28, -18], + [-7, -26], + [-43, -31], + [-9, -28], + [-32, -25], + [-20, 5], + [-25, -17], + [-29, -20], + [-23, -20], + [-47, -16], + [-5, 9], + [31, 28], + [27, 18], + [29, 33], + [35, 6], + [14, 25], + [38, 35], + [6, 12], + [21, 21], + [5, 44], + [14, 35], + [-32, -18], + [-9, 11], + [-15, -22], + [-18, 30], + [-8, -21], + [-10, 29], + [-28, -23], + [-17, 0], + [-3, 35], + [5, 21], + [-17, 22], + [-37, -12], + [-23, 28], + [-19, 14], + [0, 34], + [-22, 25], + [11, 34], + [23, 33], + [10, 30], + [22, 4], + [19, -9], + [23, 28], + [20, -5], + [21, 19], + [-5, 27], + [-16, 10], + [21, 23], + [-17, -1], + [-30, -13], + [-8, -13], + [-22, 13], + [-39, -6], + [-41, 14], + [-12, 24], + [-35, 34], + [39, 25], + [62, 29], + [23, 0], + [-4, -30], + [59, 2], + [-23, 37], + [-34, 23], + [-20, 29], + [-26, 25], + [-38, 19], + [15, 31], + [49, 2], + [35, 27], + [7, 29], + [28, 28], + [28, 6], + [52, 27], + [26, -4], + [42, 31], + [42, -12], + [21, -27], + [12, 11], + [47, -3], + [-2, -14], + [43, -10], + [28, 6], + [59, -18], + [53, -6], + [21, -8], + [37, 10], + [42, -18], + [31, -8] + ], + [ + [3018, 5753], + [-1, -14], + [-16, -7], + [9, -26], + [0, -31], + [-12, -35], + [10, -47], + [12, 4], + [6, 43], + [-8, 21], + [-2, 45], + [35, 24], + [-4, 27], + [10, 19], + [10, -41], + [19, -1], + [18, -33], + [1, -20], + [25, 0], + [30, 6], + [16, -27], + [21, -7], + [16, 18], + [0, 15], + [34, 4], + [34, 1], + [-24, -18], + [10, -28], + [22, -4], + [21, -29], + [4, -48], + [15, 2], + [11, -14] + ], + [ + [8001, 6331], + [-37, -51], + [-24, -56], + [-6, -41], + [22, -62], + [25, -77], + [26, -37], + [17, -47], + [12, -109], + [-3, -104], + [-24, -39], + [-31, -38], + [-23, -49], + [-35, -55], + [-10, 37], + [8, 40], + [-21, 34] + ], + [ + [9661, 4085], + [-9, -8], + [-9, 26], + [1, 16], + [17, -34] + ], + [ + [9641, 4175], + [4, -47], + [-7, 7], + [-6, -3], + [-4, 16], + [0, 45], + [13, -18] + ], + [ + [6475, 6041], + [-21, -16], + [-5, -26], + [-1, -20], + [-27, -25], + [-45, -28], + [-24, -41], + [-13, -3], + [-8, 3], + [-16, -25], + [-18, -11], + [-23, -3], + [-7, -3], + [-6, -16], + [-8, -4], + [-4, -15], + [-14, 1], + [-9, -8], + [-19, 3], + [-7, 35], + [1, 32], + [-5, 17], + [-5, 44], + [-8, 24], + [5, 3], + [-2, 27], + [3, 12], + [-1, 25] + ], + [ + [5817, 3752], + [11, 0], + [14, -10], + [9, 7], + [15, -6] + ], + [ + [5911, 3478], + [-7, -43], + [-3, -49], + [-7, -27], + [-19, -30], + [-5, -8], + [-12, -30], + [-8, -31], + [-16, -42], + [-31, -61], + [-20, -36], + [-21, -26], + [-29, -23], + [-14, -3], + [-3, -17], + [-17, 9], + [-14, -11], + [-30, 11], + [-17, -7], + [-12, 3], + [-28, -23], + [-24, -10], + [-17, -22], + [-13, -1], + [-11, 21], + [-10, 1], + [-12, 26], + [-1, -8], + [-4, 16], + [0, 34], + [-9, 40], + [9, 11], + [0, 45], + [-19, 55], + [-14, 50], + [0, 1], + [-20, 76] + ], + [ + [5840, 4141], + [-21, -8], + [-15, -23], + [-4, -21], + [-10, -4], + [-24, -49], + [-15, -38], + [-10, -2], + [-9, 7], + [-31, 7] + ] + ], + "transform": { + "scale": [0.036003600360036005, 0.016927109510951093], + "translate": [-180, -85.609038] + } +} +; + Datamap.prototype.usaTopo = '__USA__'; + + /************************************** + Utilities + ***************************************/ + + //convert lat/lng coords to X / Y coords + Datamap.prototype.latLngToXY = function(lat, lng) { + return this.projection([lng, lat]); + }; + + //add layer to root SVG + Datamap.prototype.addLayer = function( className, id, first ) { + var layer; + if ( first ) { + layer = this.svg.insert('g', ':first-child') + } + else { + layer = this.svg.append('g') + } + return layer.attr('id', id || '') + .attr('class', className || ''); + }; + + Datamap.prototype.updateChoropleth = function(data) { + var svg = this.svg; + for ( var subunit in data ) { + if ( data.hasOwnProperty(subunit) ) { + var color; + var subunitData = data[subunit] + if ( ! subunit ) { + continue; + } + else if ( typeof subunitData === "string" ) { + color = subunitData; + } + else if ( typeof subunitData.color === "string" ) { + color = subunitData.color; + } + else { + color = this.options.fills[ subunitData.fillKey ]; + } + //if it's an object, overriding the previous data + if ( subunitData === Object(subunitData) ) { + this.options.data[subunit] = defaults(subunitData, this.options.data[subunit] || {}); + var geo = this.svg.select('.' + subunit).attr('data-info', JSON.stringify(this.options.data[subunit])); + } + svg + .selectAll('.' + subunit) + .transition() + .style('fill', color); + } + } + }; + + Datamap.prototype.updatePopup = function (element, d, options) { + var self = this; + element.on('mousemove', null); + element.on('mousemove', function() { + var position = d3.mouse(self.options.element); + d3.select(self.svg[0][0].parentNode).select('.datamaps-hoverover') + .style('top', ( (position[1] + 30)) + "px") + .html(function() { + var data = JSON.parse(element.attr('data-info')); + //if ( !data ) return ''; + return options.popupTemplate(d, data); + }) + .style('left', ( position[0]) + "px"); + }); + + d3.select(self.svg[0][0].parentNode).select('.datamaps-hoverover').style('display', 'block'); + }; + + Datamap.prototype.addPlugin = function( name, pluginFn ) { + var self = this; + if ( typeof Datamap.prototype[name] === "undefined" ) { + Datamap.prototype[name] = function(data, options, callback, createNewLayer) { + var layer; + if ( typeof createNewLayer === "undefined" ) { + createNewLayer = false; + } + + if ( typeof options === 'function' ) { + callback = options; + options = undefined; + } + + options = defaults(options || {}, self.options[name + 'Config']); + + //add a single layer, reuse the old layer + if ( !createNewLayer && this.options[name + 'Layer'] ) { + layer = this.options[name + 'Layer']; + options = options || this.options[name + 'Options']; + } + else { + layer = this.addLayer(name); + this.options[name + 'Layer'] = layer; + this.options[name + 'Options'] = options; + } + pluginFn.apply(this, [layer, data, options]); + if ( callback ) { + callback(layer); + } + }; + } + }; + + // expose library + if ( typeof define === "function" && define.amd ) { + define( "datamaps", function(require) { d3 = require('d3'); topojson = require('topojson'); return Datamap; } ); + } + else { + window.Datamap = window.Datamaps = Datamap; + } + + if ( window.jQuery ) { + window.jQuery.fn.datamaps = function(options, callback) { + options = options || {}; + options.element = this[0]; + var datamap = new Datamap(options); + if ( typeof callback === "function" ) { + callback(datamap, options); + } + return this; + }; + } +})(); diff --git a/debian/missing-sources/dygraph.js b/debian/missing-sources/dygraph.js new file mode 100644 index 0000000..dff393a --- /dev/null +++ b/debian/missing-sources/dygraph.js @@ -0,0 +1,9464 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Dygraph = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + +},{}],2:[function(require,module,exports){ +/** + * @license + * Copyright 2013 David Eberlein (david.eberlein@ch.sauter-bc.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview DataHandler implementation for the custom bars option. + * @author David Eberlein (david.eberlein@ch.sauter-bc.com) + */ + +/*global Dygraph:false */ +"use strict"; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _bars = require('./bars'); + +var _bars2 = _interopRequireDefault(_bars); + +/** + * @constructor + * @extends Dygraph.DataHandlers.BarsHandler + */ +var CustomBarsHandler = function CustomBarsHandler() {}; + +CustomBarsHandler.prototype = new _bars2['default'](); + +/** @inheritDoc */ +CustomBarsHandler.prototype.extractSeries = function (rawData, i, options) { + // TODO(danvk): pre-allocate series here. + var series = []; + var x, y, point; + var logScale = options.get('logscale'); + for (var j = 0; j < rawData.length; j++) { + x = rawData[j][0]; + point = rawData[j][i]; + if (logScale && point !== null) { + // On the log scale, points less than zero do not exist. + // This will create a gap in the chart. + if (point[0] <= 0 || point[1] <= 0 || point[2] <= 0) { + point = null; + } + } + // Extract to the unified data format. + if (point !== null) { + y = point[1]; + if (y !== null && !isNaN(y)) { + series.push([x, y, [point[0], point[2]]]); + } else { + series.push([x, y, [y, y]]); + } + } else { + series.push([x, null, [null, null]]); + } + } + return series; +}; + +/** @inheritDoc */ +CustomBarsHandler.prototype.rollingAverage = function (originalData, rollPeriod, options) { + rollPeriod = Math.min(rollPeriod, originalData.length); + var rollingData = []; + var y, low, high, mid, count, i, extremes; + + low = 0; + mid = 0; + high = 0; + count = 0; + for (i = 0; i < originalData.length; i++) { + y = originalData[i][1]; + extremes = originalData[i][2]; + rollingData[i] = originalData[i]; + + if (y !== null && !isNaN(y)) { + low += extremes[0]; + mid += y; + high += extremes[1]; + count += 1; + } + if (i - rollPeriod >= 0) { + var prev = originalData[i - rollPeriod]; + if (prev[1] !== null && !isNaN(prev[1])) { + low -= prev[2][0]; + mid -= prev[1]; + high -= prev[2][1]; + count -= 1; + } + } + if (count) { + rollingData[i] = [originalData[i][0], 1.0 * mid / count, [1.0 * low / count, 1.0 * high / count]]; + } else { + rollingData[i] = [originalData[i][0], null, [null, null]]; + } + } + + return rollingData; +}; + +exports['default'] = CustomBarsHandler; +module.exports = exports['default']; + +},{"./bars":5}],3:[function(require,module,exports){ +/** + * @license + * Copyright 2013 David Eberlein (david.eberlein@ch.sauter-bc.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview DataHandler implementation for the error bars option. + * @author David Eberlein (david.eberlein@ch.sauter-bc.com) + */ + +/*global Dygraph:false */ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +var _bars = require('./bars'); + +var _bars2 = _interopRequireDefault(_bars); + +/** + * @constructor + * @extends BarsHandler + */ +var ErrorBarsHandler = function ErrorBarsHandler() {}; + +ErrorBarsHandler.prototype = new _bars2["default"](); + +/** @inheritDoc */ +ErrorBarsHandler.prototype.extractSeries = function (rawData, i, options) { + // TODO(danvk): pre-allocate series here. + var series = []; + var x, y, variance, point; + var sigma = options.get("sigma"); + var logScale = options.get('logscale'); + for (var j = 0; j < rawData.length; j++) { + x = rawData[j][0]; + point = rawData[j][i]; + if (logScale && point !== null) { + // On the log scale, points less than zero do not exist. + // This will create a gap in the chart. + if (point[0] <= 0 || point[0] - sigma * point[1] <= 0) { + point = null; + } + } + // Extract to the unified data format. + if (point !== null) { + y = point[0]; + if (y !== null && !isNaN(y)) { + variance = sigma * point[1]; + // preserve original error value in extras for further + // filtering + series.push([x, y, [y - variance, y + variance, point[1]]]); + } else { + series.push([x, y, [y, y, y]]); + } + } else { + series.push([x, null, [null, null, null]]); + } + } + return series; +}; + +/** @inheritDoc */ +ErrorBarsHandler.prototype.rollingAverage = function (originalData, rollPeriod, options) { + rollPeriod = Math.min(rollPeriod, originalData.length); + var rollingData = []; + var sigma = options.get("sigma"); + + var i, j, y, v, sum, num_ok, stddev, variance, value; + + // Calculate the rolling average for the first rollPeriod - 1 points + // where there is not enough data to roll over the full number of points + for (i = 0; i < originalData.length; i++) { + sum = 0; + variance = 0; + num_ok = 0; + for (j = Math.max(0, i - rollPeriod + 1); j < i + 1; j++) { + y = originalData[j][1]; + if (y === null || isNaN(y)) continue; + num_ok++; + sum += y; + variance += Math.pow(originalData[j][2][2], 2); + } + if (num_ok) { + stddev = Math.sqrt(variance) / num_ok; + value = sum / num_ok; + rollingData[i] = [originalData[i][0], value, [value - sigma * stddev, value + sigma * stddev]]; + } else { + // This explicitly preserves NaNs to aid with "independent + // series". + // See testRollingAveragePreservesNaNs. + v = rollPeriod == 1 ? originalData[i][1] : null; + rollingData[i] = [originalData[i][0], v, [v, v]]; + } + } + + return rollingData; +}; + +exports["default"] = ErrorBarsHandler; +module.exports = exports["default"]; + +},{"./bars":5}],4:[function(require,module,exports){ +/** + * @license + * Copyright 2013 David Eberlein (david.eberlein@ch.sauter-bc.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview DataHandler implementation for the combination + * of error bars and fractions options. + * @author David Eberlein (david.eberlein@ch.sauter-bc.com) + */ + +/*global Dygraph:false */ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +var _bars = require('./bars'); + +var _bars2 = _interopRequireDefault(_bars); + +/** + * @constructor + * @extends Dygraph.DataHandlers.BarsHandler + */ +var FractionsBarsHandler = function FractionsBarsHandler() {}; + +FractionsBarsHandler.prototype = new _bars2["default"](); + +/** @inheritDoc */ +FractionsBarsHandler.prototype.extractSeries = function (rawData, i, options) { + // TODO(danvk): pre-allocate series here. + var series = []; + var x, y, point, num, den, value, stddev, variance; + var mult = 100.0; + var sigma = options.get("sigma"); + var logScale = options.get('logscale'); + for (var j = 0; j < rawData.length; j++) { + x = rawData[j][0]; + point = rawData[j][i]; + if (logScale && point !== null) { + // On the log scale, points less than zero do not exist. + // This will create a gap in the chart. + if (point[0] <= 0 || point[1] <= 0) { + point = null; + } + } + // Extract to the unified data format. + if (point !== null) { + num = point[0]; + den = point[1]; + if (num !== null && !isNaN(num)) { + value = den ? num / den : 0.0; + stddev = den ? sigma * Math.sqrt(value * (1 - value) / den) : 1.0; + variance = mult * stddev; + y = mult * value; + // preserve original values in extras for further filtering + series.push([x, y, [y - variance, y + variance, num, den]]); + } else { + series.push([x, num, [num, num, num, den]]); + } + } else { + series.push([x, null, [null, null, null, null]]); + } + } + return series; +}; + +/** @inheritDoc */ +FractionsBarsHandler.prototype.rollingAverage = function (originalData, rollPeriod, options) { + rollPeriod = Math.min(rollPeriod, originalData.length); + var rollingData = []; + var sigma = options.get("sigma"); + var wilsonInterval = options.get("wilsonInterval"); + + var low, high, i, stddev; + var num = 0; + var den = 0; // numerator/denominator + var mult = 100.0; + for (i = 0; i < originalData.length; i++) { + num += originalData[i][2][2]; + den += originalData[i][2][3]; + if (i - rollPeriod >= 0) { + num -= originalData[i - rollPeriod][2][2]; + den -= originalData[i - rollPeriod][2][3]; + } + + var date = originalData[i][0]; + var value = den ? num / den : 0.0; + if (wilsonInterval) { + // For more details on this confidence interval, see: + // http://en.wikipedia.org/wiki/Binomial_confidence_interval + if (den) { + var p = value < 0 ? 0 : value, + n = den; + var pm = sigma * Math.sqrt(p * (1 - p) / n + sigma * sigma / (4 * n * n)); + var denom = 1 + sigma * sigma / den; + low = (p + sigma * sigma / (2 * den) - pm) / denom; + high = (p + sigma * sigma / (2 * den) + pm) / denom; + rollingData[i] = [date, p * mult, [low * mult, high * mult]]; + } else { + rollingData[i] = [date, 0, [0, 0]]; + } + } else { + stddev = den ? sigma * Math.sqrt(value * (1 - value) / den) : 1.0; + rollingData[i] = [date, mult * value, [mult * (value - stddev), mult * (value + stddev)]]; + } + } + + return rollingData; +}; + +exports["default"] = FractionsBarsHandler; +module.exports = exports["default"]; + +},{"./bars":5}],5:[function(require,module,exports){ +/** + * @license + * Copyright 2013 David Eberlein (david.eberlein@ch.sauter-bc.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview DataHandler base implementation for the "bar" + * data formats. This implementation must be extended and the + * extractSeries and rollingAverage must be implemented. + * @author David Eberlein (david.eberlein@ch.sauter-bc.com) + */ + +/*global Dygraph:false */ +/*global DygraphLayout:false */ +"use strict"; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _datahandler = require('./datahandler'); + +var _datahandler2 = _interopRequireDefault(_datahandler); + +var _dygraphLayout = require('../dygraph-layout'); + +var _dygraphLayout2 = _interopRequireDefault(_dygraphLayout); + +/** + * @constructor + * @extends {Dygraph.DataHandler} + */ +var BarsHandler = function BarsHandler() { + _datahandler2['default'].call(this); +}; +BarsHandler.prototype = new _datahandler2['default'](); + +// TODO(danvk): figure out why the jsdoc has to be copy/pasted from superclass. +// (I get closure compiler errors if this isn't here.) +/** + * @override + * @param {!Array.} rawData The raw data passed into dygraphs where + * rawData[i] = [x,ySeries1,...,ySeriesN]. + * @param {!number} seriesIndex Index of the series to extract. All other + * series should be ignored. + * @param {!DygraphOptions} options Dygraph options. + * @return {Array.<[!number,?number,?]>} The series in the unified data format + * where series[i] = [x,y,{extras}]. + */ +BarsHandler.prototype.extractSeries = function (rawData, seriesIndex, options) { + // Not implemented here must be extended +}; + +/** + * @override + * @param {!Array.<[!number,?number,?]>} series The series in the unified + * data format where series[i] = [x,y,{extras}]. + * @param {!number} rollPeriod The number of points over which to average the data + * @param {!DygraphOptions} options The dygraph options. + * TODO(danvk): be more specific than "Array" here. + * @return {!Array.<[!number,?number,?]>} the rolled series. + */ +BarsHandler.prototype.rollingAverage = function (series, rollPeriod, options) { + // Not implemented here, must be extended. +}; + +/** @inheritDoc */ +BarsHandler.prototype.onPointsCreated_ = function (series, points) { + for (var i = 0; i < series.length; ++i) { + var item = series[i]; + var point = points[i]; + point.y_top = NaN; + point.y_bottom = NaN; + point.yval_minus = _datahandler2['default'].parseFloat(item[2][0]); + point.yval_plus = _datahandler2['default'].parseFloat(item[2][1]); + } +}; + +/** @inheritDoc */ +BarsHandler.prototype.getExtremeYValues = function (series, dateWindow, options) { + var minY = null, + maxY = null, + y; + + var firstIdx = 0; + var lastIdx = series.length - 1; + + for (var j = firstIdx; j <= lastIdx; j++) { + y = series[j][1]; + if (y === null || isNaN(y)) continue; + + var low = series[j][2][0]; + var high = series[j][2][1]; + + if (low > y) low = y; // this can happen with custom bars, + if (high < y) high = y; // e.g. in tests/custom-bars.html + + if (maxY === null || high > maxY) maxY = high; + if (minY === null || low < minY) minY = low; + } + + return [minY, maxY]; +}; + +/** @inheritDoc */ +BarsHandler.prototype.onLineEvaluated = function (points, axis, logscale) { + var point; + for (var j = 0; j < points.length; j++) { + // Copy over the error terms + point = points[j]; + point.y_top = _dygraphLayout2['default'].calcYNormal_(axis, point.yval_minus, logscale); + point.y_bottom = _dygraphLayout2['default'].calcYNormal_(axis, point.yval_plus, logscale); + } +}; + +exports['default'] = BarsHandler; +module.exports = exports['default']; + +},{"../dygraph-layout":13,"./datahandler":6}],6:[function(require,module,exports){ +/** + * @license + * Copyright 2013 David Eberlein (david.eberlein@ch.sauter-bc.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview This file contains the managment of data handlers + * @author David Eberlein (david.eberlein@ch.sauter-bc.com) + * + * The idea is to define a common, generic data format that works for all data + * structures supported by dygraphs. To make this possible, the DataHandler + * interface is introduced. This makes it possible, that dygraph itself can work + * with the same logic for every data type independent of the actual format and + * the DataHandler takes care of the data format specific jobs. + * DataHandlers are implemented for all data types supported by Dygraphs and + * return Dygraphs compliant formats. + * By default the correct DataHandler is chosen based on the options set. + * Optionally the user may use his own DataHandler (similar to the plugin + * system). + * + * + * The unified data format returend by each handler is defined as so: + * series[n][point] = [x,y,(extras)] + * + * This format contains the common basis that is needed to draw a simple line + * series extended by optional extras for more complex graphing types. It + * contains a primitive x value as first array entry, a primitive y value as + * second array entry and an optional extras object for additional data needed. + * + * x must always be a number. + * y must always be a number, NaN of type number or null. + * extras is optional and must be interpreted by the DataHandler. It may be of + * any type. + * + * In practice this might look something like this: + * default: [x, yVal] + * errorBar / customBar: [x, yVal, [yTopVariance, yBottomVariance] ] + * + */ +/*global Dygraph:false */ +/*global DygraphLayout:false */ + +"use strict"; + +/** + * + * The data handler is responsible for all data specific operations. All of the + * series data it receives and returns is always in the unified data format. + * Initially the unified data is created by the extractSeries method + * @constructor + */ +Object.defineProperty(exports, "__esModule", { + value: true +}); +var DygraphDataHandler = function DygraphDataHandler() {}; + +var handler = DygraphDataHandler; + +/** + * X-value array index constant for unified data samples. + * @const + * @type {number} + */ +handler.X = 0; + +/** + * Y-value array index constant for unified data samples. + * @const + * @type {number} + */ +handler.Y = 1; + +/** + * Extras-value array index constant for unified data samples. + * @const + * @type {number} + */ +handler.EXTRAS = 2; + +/** + * Extracts one series from the raw data (a 2D array) into an array of the + * unified data format. + * This is where undesirable points (i.e. negative values on log scales and + * missing values through which we wish to connect lines) are dropped. + * TODO(danvk): the "missing values" bit above doesn't seem right. + * + * @param {!Array.} rawData The raw data passed into dygraphs where + * rawData[i] = [x,ySeries1,...,ySeriesN]. + * @param {!number} seriesIndex Index of the series to extract. All other + * series should be ignored. + * @param {!DygraphOptions} options Dygraph options. + * @return {Array.<[!number,?number,?]>} The series in the unified data format + * where series[i] = [x,y,{extras}]. + */ +handler.prototype.extractSeries = function (rawData, seriesIndex, options) {}; + +/** + * Converts a series to a Point array. The resulting point array must be + * returned in increasing order of idx property. + * + * @param {!Array.<[!number,?number,?]>} series The series in the unified + * data format where series[i] = [x,y,{extras}]. + * @param {!string} setName Name of the series. + * @param {!number} boundaryIdStart Index offset of the first point, equal to the + * number of skipped points left of the date window minimum (if any). + * @return {!Array.} List of points for this series. + */ +handler.prototype.seriesToPoints = function (series, setName, boundaryIdStart) { + // TODO(bhs): these loops are a hot-spot for high-point-count charts. In + // fact, + // on chrome+linux, they are 6 times more expensive than iterating through + // the + // points and drawing the lines. The brunt of the cost comes from allocating + // the |point| structures. + var points = []; + for (var i = 0; i < series.length; ++i) { + var item = series[i]; + var yraw = item[1]; + var yval = yraw === null ? null : handler.parseFloat(yraw); + var point = { + x: NaN, + y: NaN, + xval: handler.parseFloat(item[0]), + yval: yval, + name: setName, // TODO(danvk): is this really necessary? + idx: i + boundaryIdStart + }; + points.push(point); + } + this.onPointsCreated_(series, points); + return points; +}; + +/** + * Callback called for each series after the series points have been generated + * which will later be used by the plotters to draw the graph. + * Here data may be added to the seriesPoints which is needed by the plotters. + * The indexes of series and points are in sync meaning the original data + * sample for series[i] is points[i]. + * + * @param {!Array.<[!number,?number,?]>} series The series in the unified + * data format where series[i] = [x,y,{extras}]. + * @param {!Array.} points The corresponding points passed + * to the plotter. + * @protected + */ +handler.prototype.onPointsCreated_ = function (series, points) {}; + +/** + * Calculates the rolling average of a data set. + * + * @param {!Array.<[!number,?number,?]>} series The series in the unified + * data format where series[i] = [x,y,{extras}]. + * @param {!number} rollPeriod The number of points over which to average the data + * @param {!DygraphOptions} options The dygraph options. + * @return {!Array.<[!number,?number,?]>} the rolled series. + */ +handler.prototype.rollingAverage = function (series, rollPeriod, options) {}; + +/** + * Computes the range of the data series (including confidence intervals). + * + * @param {!Array.<[!number,?number,?]>} series The series in the unified + * data format where series[i] = [x, y, {extras}]. + * @param {!Array.} dateWindow The x-value range to display with + * the format: [min, max]. + * @param {!DygraphOptions} options The dygraph options. + * @return {Array.} The low and high extremes of the series in the + * given window with the format: [low, high]. + */ +handler.prototype.getExtremeYValues = function (series, dateWindow, options) {}; + +/** + * Callback called for each series after the layouting data has been + * calculated before the series is drawn. Here normalized positioning data + * should be calculated for the extras of each point. + * + * @param {!Array.} points The points passed to + * the plotter. + * @param {!Object} axis The axis on which the series will be plotted. + * @param {!boolean} logscale Weather or not to use a logscale. + */ +handler.prototype.onLineEvaluated = function (points, axis, logscale) {}; + +/** + * Optimized replacement for parseFloat, which was way too slow when almost + * all values were type number, with few edge cases, none of which were strings. + * @param {?number} val + * @return {number} + * @protected + */ +handler.parseFloat = function (val) { + // parseFloat(null) is NaN + if (val === null) { + return NaN; + } + + // Assume it's a number or NaN. If it's something else, I'll be shocked. + return val; +}; + +exports["default"] = DygraphDataHandler; +module.exports = exports["default"]; + +},{}],7:[function(require,module,exports){ +/** + * @license + * Copyright 2013 David Eberlein (david.eberlein@ch.sauter-bc.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview DataHandler implementation for the fractions option. + * @author David Eberlein (david.eberlein@ch.sauter-bc.com) + */ + +/*global Dygraph:false */ +"use strict"; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _datahandler = require('./datahandler'); + +var _datahandler2 = _interopRequireDefault(_datahandler); + +var _default = require('./default'); + +var _default2 = _interopRequireDefault(_default); + +/** + * @extends DefaultHandler + * @constructor + */ +var DefaultFractionHandler = function DefaultFractionHandler() {}; + +DefaultFractionHandler.prototype = new _default2['default'](); + +DefaultFractionHandler.prototype.extractSeries = function (rawData, i, options) { + // TODO(danvk): pre-allocate series here. + var series = []; + var x, y, point, num, den, value; + var mult = 100.0; + var logScale = options.get('logscale'); + for (var j = 0; j < rawData.length; j++) { + x = rawData[j][0]; + point = rawData[j][i]; + if (logScale && point !== null) { + // On the log scale, points less than zero do not exist. + // This will create a gap in the chart. + if (point[0] <= 0 || point[1] <= 0) { + point = null; + } + } + // Extract to the unified data format. + if (point !== null) { + num = point[0]; + den = point[1]; + if (num !== null && !isNaN(num)) { + value = den ? num / den : 0.0; + y = mult * value; + // preserve original values in extras for further filtering + series.push([x, y, [num, den]]); + } else { + series.push([x, num, [num, den]]); + } + } else { + series.push([x, null, [null, null]]); + } + } + return series; +}; + +DefaultFractionHandler.prototype.rollingAverage = function (originalData, rollPeriod, options) { + rollPeriod = Math.min(rollPeriod, originalData.length); + var rollingData = []; + + var i; + var num = 0; + var den = 0; // numerator/denominator + var mult = 100.0; + for (i = 0; i < originalData.length; i++) { + num += originalData[i][2][0]; + den += originalData[i][2][1]; + if (i - rollPeriod >= 0) { + num -= originalData[i - rollPeriod][2][0]; + den -= originalData[i - rollPeriod][2][1]; + } + + var date = originalData[i][0]; + var value = den ? num / den : 0.0; + rollingData[i] = [date, mult * value]; + } + + return rollingData; +}; + +exports['default'] = DefaultFractionHandler; +module.exports = exports['default']; + +},{"./datahandler":6,"./default":8}],8:[function(require,module,exports){ +/** + * @license + * Copyright 2013 David Eberlein (david.eberlein@ch.sauter-bc.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview DataHandler default implementation used for simple line charts. + * @author David Eberlein (david.eberlein@ch.sauter-bc.com) + */ + +/*global Dygraph:false */ +"use strict"; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _datahandler = require('./datahandler'); + +var _datahandler2 = _interopRequireDefault(_datahandler); + +/** + * @constructor + * @extends Dygraph.DataHandler + */ +var DefaultHandler = function DefaultHandler() {}; + +DefaultHandler.prototype = new _datahandler2['default'](); + +/** @inheritDoc */ +DefaultHandler.prototype.extractSeries = function (rawData, i, options) { + // TODO(danvk): pre-allocate series here. + var series = []; + var logScale = options.get('logscale'); + for (var j = 0; j < rawData.length; j++) { + var x = rawData[j][0]; + var point = rawData[j][i]; + if (logScale) { + // On the log scale, points less than zero do not exist. + // This will create a gap in the chart. + if (point <= 0) { + point = null; + } + } + series.push([x, point]); + } + return series; +}; + +/** @inheritDoc */ +DefaultHandler.prototype.rollingAverage = function (originalData, rollPeriod, options) { + rollPeriod = Math.min(rollPeriod, originalData.length); + var rollingData = []; + + var i, j, y, sum, num_ok; + // Calculate the rolling average for the first rollPeriod - 1 points + // where + // there is not enough data to roll over the full number of points + if (rollPeriod == 1) { + return originalData; + } + for (i = 0; i < originalData.length; i++) { + sum = 0; + num_ok = 0; + for (j = Math.max(0, i - rollPeriod + 1); j < i + 1; j++) { + y = originalData[j][1]; + if (y === null || isNaN(y)) continue; + num_ok++; + sum += originalData[j][1]; + } + if (num_ok) { + rollingData[i] = [originalData[i][0], sum / num_ok]; + } else { + rollingData[i] = [originalData[i][0], null]; + } + } + + return rollingData; +}; + +/** @inheritDoc */ +DefaultHandler.prototype.getExtremeYValues = function (series, dateWindow, options) { + var minY = null, + maxY = null, + y; + var firstIdx = 0, + lastIdx = series.length - 1; + + for (var j = firstIdx; j <= lastIdx; j++) { + y = series[j][1]; + if (y === null || isNaN(y)) continue; + if (maxY === null || y > maxY) { + maxY = y; + } + if (minY === null || y < minY) { + minY = y; + } + } + return [minY, maxY]; +}; + +exports['default'] = DefaultHandler; +module.exports = exports['default']; + +},{"./datahandler":6}],9:[function(require,module,exports){ +/** + * @license + * Copyright 2006 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview Based on PlotKit.CanvasRenderer, but modified to meet the + * needs of dygraphs. + * + * In particular, support for: + * - grid overlays + * - error bars + * - dygraphs attribute system + */ + +/** + * The DygraphCanvasRenderer class does the actual rendering of the chart onto + * a canvas. It's based on PlotKit.CanvasRenderer. + * @param {Object} element The canvas to attach to + * @param {Object} elementContext The 2d context of the canvas (injected so it + * can be mocked for testing.) + * @param {Layout} layout The DygraphLayout object for this graph. + * @constructor + */ + +/*global Dygraph:false */ +"use strict"; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } + +var _dygraphUtils = require('./dygraph-utils'); + +var utils = _interopRequireWildcard(_dygraphUtils); + +var _dygraph = require('./dygraph'); + +var _dygraph2 = _interopRequireDefault(_dygraph); + +/** + * @constructor + * + * This gets called when there are "new points" to chart. This is generally the + * case when the underlying data being charted has changed. It is _not_ called + * in the common case that the user has zoomed or is panning the view. + * + * The chart canvas has already been created by the Dygraph object. The + * renderer simply gets a drawing context. + * + * @param {Dygraph} dygraph The chart to which this renderer belongs. + * @param {HTMLCanvasElement} element The <canvas> DOM element on which to draw. + * @param {CanvasRenderingContext2D} elementContext The drawing context. + * @param {DygraphLayout} layout The chart's DygraphLayout object. + * + * TODO(danvk): remove the elementContext property. + */ +var DygraphCanvasRenderer = function DygraphCanvasRenderer(dygraph, element, elementContext, layout) { + this.dygraph_ = dygraph; + + this.layout = layout; + this.element = element; + this.elementContext = elementContext; + + this.height = dygraph.height_; + this.width = dygraph.width_; + + // --- check whether everything is ok before we return + if (!utils.isCanvasSupported(this.element)) { + throw "Canvas is not supported."; + } + + // internal state + this.area = layout.getPlotArea(); + + // Set up a clipping area for the canvas (and the interaction canvas). + // This ensures that we don't overdraw. + var ctx = this.dygraph_.canvas_ctx_; + ctx.beginPath(); + ctx.rect(this.area.x, this.area.y, this.area.w, this.area.h); + ctx.clip(); + + ctx = this.dygraph_.hidden_ctx_; + ctx.beginPath(); + ctx.rect(this.area.x, this.area.y, this.area.w, this.area.h); + ctx.clip(); +}; + +/** + * Clears out all chart content and DOM elements. + * This is called immediately before render() on every frame, including + * during zooms and pans. + * @private + */ +DygraphCanvasRenderer.prototype.clear = function () { + this.elementContext.clearRect(0, 0, this.width, this.height); +}; + +/** + * This method is responsible for drawing everything on the chart, including + * lines, error bars, fills and axes. + * It is called immediately after clear() on every frame, including during pans + * and zooms. + * @private + */ +DygraphCanvasRenderer.prototype.render = function () { + // attaches point.canvas{x,y} + this._updatePoints(); + + // actually draws the chart. + this._renderLineChart(); +}; + +/** + * Returns a predicate to be used with an iterator, which will + * iterate over points appropriately, depending on whether + * connectSeparatedPoints is true. When it's false, the predicate will + * skip over points with missing yVals. + */ +DygraphCanvasRenderer._getIteratorPredicate = function (connectSeparatedPoints) { + return connectSeparatedPoints ? DygraphCanvasRenderer._predicateThatSkipsEmptyPoints : null; +}; + +DygraphCanvasRenderer._predicateThatSkipsEmptyPoints = function (array, idx) { + return array[idx].yval !== null; +}; + +/** + * Draws a line with the styles passed in and calls all the drawPointCallbacks. + * @param {Object} e The dictionary passed to the plotter function. + * @private + */ +DygraphCanvasRenderer._drawStyledLine = function (e, color, strokeWidth, strokePattern, drawPoints, drawPointCallback, pointSize) { + var g = e.dygraph; + // TODO(konigsberg): Compute attributes outside this method call. + var stepPlot = g.getBooleanOption("stepPlot", e.setName); + + if (!utils.isArrayLike(strokePattern)) { + strokePattern = null; + } + + var drawGapPoints = g.getBooleanOption('drawGapEdgePoints', e.setName); + + var points = e.points; + var setName = e.setName; + var iter = utils.createIterator(points, 0, points.length, DygraphCanvasRenderer._getIteratorPredicate(g.getBooleanOption("connectSeparatedPoints", setName))); + + var stroking = strokePattern && strokePattern.length >= 2; + + var ctx = e.drawingContext; + ctx.save(); + if (stroking) { + if (ctx.setLineDash) ctx.setLineDash(strokePattern); + } + + var pointsOnLine = DygraphCanvasRenderer._drawSeries(e, iter, strokeWidth, pointSize, drawPoints, drawGapPoints, stepPlot, color); + DygraphCanvasRenderer._drawPointsOnLine(e, pointsOnLine, drawPointCallback, color, pointSize); + + if (stroking) { + if (ctx.setLineDash) ctx.setLineDash([]); + } + + ctx.restore(); +}; + +/** + * This does the actual drawing of lines on the canvas, for just one series. + * Returns a list of [canvasx, canvasy] pairs for points for which a + * drawPointCallback should be fired. These include isolated points, or all + * points if drawPoints=true. + * @param {Object} e The dictionary passed to the plotter function. + * @private + */ +DygraphCanvasRenderer._drawSeries = function (e, iter, strokeWidth, pointSize, drawPoints, drawGapPoints, stepPlot, color) { + + var prevCanvasX = null; + var prevCanvasY = null; + var nextCanvasY = null; + var isIsolated; // true if this point is isolated (no line segments) + var point; // the point being processed in the while loop + var pointsOnLine = []; // Array of [canvasx, canvasy] pairs. + var first = true; // the first cycle through the while loop + + var ctx = e.drawingContext; + ctx.beginPath(); + ctx.strokeStyle = color; + ctx.lineWidth = strokeWidth; + + // NOTE: we break the iterator's encapsulation here for about a 25% speedup. + var arr = iter.array_; + var limit = iter.end_; + var predicate = iter.predicate_; + + for (var i = iter.start_; i < limit; i++) { + point = arr[i]; + if (predicate) { + while (i < limit && !predicate(arr, i)) { + i++; + } + if (i == limit) break; + point = arr[i]; + } + + // FIXME: The 'canvasy != canvasy' test here catches NaN values but the test + // doesn't catch Infinity values. Could change this to + // !isFinite(point.canvasy), but I assume it avoids isNaN for performance? + if (point.canvasy === null || point.canvasy != point.canvasy) { + if (stepPlot && prevCanvasX !== null) { + // Draw a horizontal line to the start of the missing data + ctx.moveTo(prevCanvasX, prevCanvasY); + ctx.lineTo(point.canvasx, prevCanvasY); + } + prevCanvasX = prevCanvasY = null; + } else { + isIsolated = false; + if (drawGapPoints || prevCanvasX === null) { + iter.nextIdx_ = i; + iter.next(); + nextCanvasY = iter.hasNext ? iter.peek.canvasy : null; + + var isNextCanvasYNullOrNaN = nextCanvasY === null || nextCanvasY != nextCanvasY; + isIsolated = prevCanvasX === null && isNextCanvasYNullOrNaN; + if (drawGapPoints) { + // Also consider a point to be "isolated" if it's adjacent to a + // null point, excluding the graph edges. + if (!first && prevCanvasX === null || iter.hasNext && isNextCanvasYNullOrNaN) { + isIsolated = true; + } + } + } + + if (prevCanvasX !== null) { + if (strokeWidth) { + if (stepPlot) { + ctx.moveTo(prevCanvasX, prevCanvasY); + ctx.lineTo(point.canvasx, prevCanvasY); + } + + ctx.lineTo(point.canvasx, point.canvasy); + } + } else { + ctx.moveTo(point.canvasx, point.canvasy); + } + if (drawPoints || isIsolated) { + pointsOnLine.push([point.canvasx, point.canvasy, point.idx]); + } + prevCanvasX = point.canvasx; + prevCanvasY = point.canvasy; + } + first = false; + } + ctx.stroke(); + return pointsOnLine; +}; + +/** + * This fires the drawPointCallback functions, which draw dots on the points by + * default. This gets used when the "drawPoints" option is set, or when there + * are isolated points. + * @param {Object} e The dictionary passed to the plotter function. + * @private + */ +DygraphCanvasRenderer._drawPointsOnLine = function (e, pointsOnLine, drawPointCallback, color, pointSize) { + var ctx = e.drawingContext; + for (var idx = 0; idx < pointsOnLine.length; idx++) { + var cb = pointsOnLine[idx]; + ctx.save(); + drawPointCallback.call(e.dygraph, e.dygraph, e.setName, ctx, cb[0], cb[1], color, pointSize, cb[2]); + ctx.restore(); + } +}; + +/** + * Attaches canvas coordinates to the points array. + * @private + */ +DygraphCanvasRenderer.prototype._updatePoints = function () { + // Update Points + // TODO(danvk): here + // + // TODO(bhs): this loop is a hot-spot for high-point-count charts. These + // transformations can be pushed into the canvas via linear transformation + // matrices. + // NOTE(danvk): this is trickier than it sounds at first. The transformation + // needs to be done before the .moveTo() and .lineTo() calls, but must be + // undone before the .stroke() call to ensure that the stroke width is + // unaffected. An alternative is to reduce the stroke width in the + // transformed coordinate space, but you can't specify different values for + // each dimension (as you can with .scale()). The speedup here is ~12%. + var sets = this.layout.points; + for (var i = sets.length; i--;) { + var points = sets[i]; + for (var j = points.length; j--;) { + var point = points[j]; + point.canvasx = this.area.w * point.x + this.area.x; + point.canvasy = this.area.h * point.y + this.area.y; + } + } +}; + +/** + * Add canvas Actually draw the lines chart, including error bars. + * + * This function can only be called if DygraphLayout's points array has been + * updated with canvas{x,y} attributes, i.e. by + * DygraphCanvasRenderer._updatePoints. + * + * @param {string=} opt_seriesName when specified, only that series will + * be drawn. (This is used for expedited redrawing with highlightSeriesOpts) + * @param {CanvasRenderingContext2D} opt_ctx when specified, the drawing + * context. However, lines are typically drawn on the object's + * elementContext. + * @private + */ +DygraphCanvasRenderer.prototype._renderLineChart = function (opt_seriesName, opt_ctx) { + var ctx = opt_ctx || this.elementContext; + var i; + + var sets = this.layout.points; + var setNames = this.layout.setNames; + var setName; + + this.colors = this.dygraph_.colorsMap_; + + // Determine which series have specialized plotters. + var plotter_attr = this.dygraph_.getOption("plotter"); + var plotters = plotter_attr; + if (!utils.isArrayLike(plotters)) { + plotters = [plotters]; + } + + var setPlotters = {}; // series name -> plotter fn. + for (i = 0; i < setNames.length; i++) { + setName = setNames[i]; + var setPlotter = this.dygraph_.getOption("plotter", setName); + if (setPlotter == plotter_attr) continue; // not specialized. + + setPlotters[setName] = setPlotter; + } + + for (i = 0; i < plotters.length; i++) { + var plotter = plotters[i]; + var is_last = i == plotters.length - 1; + + for (var j = 0; j < sets.length; j++) { + setName = setNames[j]; + if (opt_seriesName && setName != opt_seriesName) continue; + + var points = sets[j]; + + // Only throw in the specialized plotters on the last iteration. + var p = plotter; + if (setName in setPlotters) { + if (is_last) { + p = setPlotters[setName]; + } else { + // Don't use the standard plotters in this case. + continue; + } + } + + var color = this.colors[setName]; + var strokeWidth = this.dygraph_.getOption("strokeWidth", setName); + + ctx.save(); + ctx.strokeStyle = color; + ctx.lineWidth = strokeWidth; + p({ + points: points, + setName: setName, + drawingContext: ctx, + color: color, + strokeWidth: strokeWidth, + dygraph: this.dygraph_, + axis: this.dygraph_.axisPropertiesForSeries(setName), + plotArea: this.area, + seriesIndex: j, + seriesCount: sets.length, + singleSeriesName: opt_seriesName, + allSeriesPoints: sets + }); + ctx.restore(); + } + } +}; + +/** + * Standard plotters. These may be used by clients via Dygraph.Plotters. + * See comments there for more details. + */ +DygraphCanvasRenderer._Plotters = { + linePlotter: function linePlotter(e) { + DygraphCanvasRenderer._linePlotter(e); + }, + + fillPlotter: function fillPlotter(e) { + DygraphCanvasRenderer._fillPlotter(e); + }, + + errorPlotter: function errorPlotter(e) { + DygraphCanvasRenderer._errorPlotter(e); + } +}; + +/** + * Plotter which draws the central lines for a series. + * @private + */ +DygraphCanvasRenderer._linePlotter = function (e) { + var g = e.dygraph; + var setName = e.setName; + var strokeWidth = e.strokeWidth; + + // TODO(danvk): Check if there's any performance impact of just calling + // getOption() inside of _drawStyledLine. Passing in so many parameters makes + // this code a bit nasty. + var borderWidth = g.getNumericOption("strokeBorderWidth", setName); + var drawPointCallback = g.getOption("drawPointCallback", setName) || utils.Circles.DEFAULT; + var strokePattern = g.getOption("strokePattern", setName); + var drawPoints = g.getBooleanOption("drawPoints", setName); + var pointSize = g.getNumericOption("pointSize", setName); + + if (borderWidth && strokeWidth) { + DygraphCanvasRenderer._drawStyledLine(e, g.getOption("strokeBorderColor", setName), strokeWidth + 2 * borderWidth, strokePattern, drawPoints, drawPointCallback, pointSize); + } + + DygraphCanvasRenderer._drawStyledLine(e, e.color, strokeWidth, strokePattern, drawPoints, drawPointCallback, pointSize); +}; + +/** + * Draws the shaded error bars/confidence intervals for each series. + * This happens before the center lines are drawn, since the center lines + * need to be drawn on top of the error bars for all series. + * @private + */ +DygraphCanvasRenderer._errorPlotter = function (e) { + var g = e.dygraph; + var setName = e.setName; + var errorBars = g.getBooleanOption("errorBars") || g.getBooleanOption("customBars"); + if (!errorBars) return; + + var fillGraph = g.getBooleanOption("fillGraph", setName); + if (fillGraph) { + console.warn("Can't use fillGraph option with error bars"); + } + + var ctx = e.drawingContext; + var color = e.color; + var fillAlpha = g.getNumericOption('fillAlpha', setName); + var stepPlot = g.getBooleanOption("stepPlot", setName); + var points = e.points; + + var iter = utils.createIterator(points, 0, points.length, DygraphCanvasRenderer._getIteratorPredicate(g.getBooleanOption("connectSeparatedPoints", setName))); + + var newYs; + + // setup graphics context + var prevX = NaN; + var prevY = NaN; + var prevYs = [-1, -1]; + // should be same color as the lines but only 15% opaque. + var rgb = utils.toRGB_(color); + var err_color = 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + fillAlpha + ')'; + ctx.fillStyle = err_color; + ctx.beginPath(); + + var isNullUndefinedOrNaN = function isNullUndefinedOrNaN(x) { + return x === null || x === undefined || isNaN(x); + }; + + while (iter.hasNext) { + var point = iter.next(); + if (!stepPlot && isNullUndefinedOrNaN(point.y) || stepPlot && !isNaN(prevY) && isNullUndefinedOrNaN(prevY)) { + prevX = NaN; + continue; + } + + newYs = [point.y_bottom, point.y_top]; + if (stepPlot) { + prevY = point.y; + } + + // The documentation specifically disallows nulls inside the point arrays, + // but in case it happens we should do something sensible. + if (isNaN(newYs[0])) newYs[0] = point.y; + if (isNaN(newYs[1])) newYs[1] = point.y; + + newYs[0] = e.plotArea.h * newYs[0] + e.plotArea.y; + newYs[1] = e.plotArea.h * newYs[1] + e.plotArea.y; + if (!isNaN(prevX)) { + if (stepPlot) { + ctx.moveTo(prevX, prevYs[0]); + ctx.lineTo(point.canvasx, prevYs[0]); + ctx.lineTo(point.canvasx, prevYs[1]); + } else { + ctx.moveTo(prevX, prevYs[0]); + ctx.lineTo(point.canvasx, newYs[0]); + ctx.lineTo(point.canvasx, newYs[1]); + } + ctx.lineTo(prevX, prevYs[1]); + ctx.closePath(); + } + prevYs = newYs; + prevX = point.canvasx; + } + ctx.fill(); +}; + +/** + * Proxy for CanvasRenderingContext2D which drops moveTo/lineTo calls which are + * superfluous. It accumulates all movements which haven't changed the x-value + * and only applies the two with the most extreme y-values. + * + * Calls to lineTo/moveTo must have non-decreasing x-values. + */ +DygraphCanvasRenderer._fastCanvasProxy = function (context) { + var pendingActions = []; // array of [type, x, y] tuples + var lastRoundedX = null; + var lastFlushedX = null; + + var LINE_TO = 1, + MOVE_TO = 2; + + var actionCount = 0; // number of moveTos and lineTos passed to context. + + // Drop superfluous motions + // Assumes all pendingActions have the same (rounded) x-value. + var compressActions = function compressActions(opt_losslessOnly) { + if (pendingActions.length <= 1) return; + + // Lossless compression: drop inconsequential moveTos. + for (var i = pendingActions.length - 1; i > 0; i--) { + var action = pendingActions[i]; + if (action[0] == MOVE_TO) { + var prevAction = pendingActions[i - 1]; + if (prevAction[1] == action[1] && prevAction[2] == action[2]) { + pendingActions.splice(i, 1); + } + } + } + + // Lossless compression: ... drop consecutive moveTos ... + for (var i = 0; i < pendingActions.length - 1;) /* incremented internally */{ + var action = pendingActions[i]; + if (action[0] == MOVE_TO && pendingActions[i + 1][0] == MOVE_TO) { + pendingActions.splice(i, 1); + } else { + i++; + } + } + + // Lossy compression: ... drop all but the extreme y-values ... + if (pendingActions.length > 2 && !opt_losslessOnly) { + // keep an initial moveTo, but drop all others. + var startIdx = 0; + if (pendingActions[0][0] == MOVE_TO) startIdx++; + var minIdx = null, + maxIdx = null; + for (var i = startIdx; i < pendingActions.length; i++) { + var action = pendingActions[i]; + if (action[0] != LINE_TO) continue; + if (minIdx === null && maxIdx === null) { + minIdx = i; + maxIdx = i; + } else { + var y = action[2]; + if (y < pendingActions[minIdx][2]) { + minIdx = i; + } else if (y > pendingActions[maxIdx][2]) { + maxIdx = i; + } + } + } + var minAction = pendingActions[minIdx], + maxAction = pendingActions[maxIdx]; + pendingActions.splice(startIdx, pendingActions.length - startIdx); + if (minIdx < maxIdx) { + pendingActions.push(minAction); + pendingActions.push(maxAction); + } else if (minIdx > maxIdx) { + pendingActions.push(maxAction); + pendingActions.push(minAction); + } else { + pendingActions.push(minAction); + } + } + }; + + var flushActions = function flushActions(opt_noLossyCompression) { + compressActions(opt_noLossyCompression); + for (var i = 0, len = pendingActions.length; i < len; i++) { + var action = pendingActions[i]; + if (action[0] == LINE_TO) { + context.lineTo(action[1], action[2]); + } else if (action[0] == MOVE_TO) { + context.moveTo(action[1], action[2]); + } + } + if (pendingActions.length) { + lastFlushedX = pendingActions[pendingActions.length - 1][1]; + } + actionCount += pendingActions.length; + pendingActions = []; + }; + + var addAction = function addAction(action, x, y) { + var rx = Math.round(x); + if (lastRoundedX === null || rx != lastRoundedX) { + // if there are large gaps on the x-axis, it's essential to keep the + // first and last point as well. + var hasGapOnLeft = lastRoundedX - lastFlushedX > 1, + hasGapOnRight = rx - lastRoundedX > 1, + hasGap = hasGapOnLeft || hasGapOnRight; + flushActions(hasGap); + lastRoundedX = rx; + } + pendingActions.push([action, x, y]); + }; + + return { + moveTo: function moveTo(x, y) { + addAction(MOVE_TO, x, y); + }, + lineTo: function lineTo(x, y) { + addAction(LINE_TO, x, y); + }, + + // for major operations like stroke/fill, we skip compression to ensure + // that there are no artifacts at the right edge. + stroke: function stroke() { + flushActions(true);context.stroke(); + }, + fill: function fill() { + flushActions(true);context.fill(); + }, + beginPath: function beginPath() { + flushActions(true);context.beginPath(); + }, + closePath: function closePath() { + flushActions(true);context.closePath(); + }, + + _count: function _count() { + return actionCount; + } + }; +}; + +/** + * Draws the shaded regions when "fillGraph" is set. Not to be confused with + * error bars. + * + * For stacked charts, it's more convenient to handle all the series + * simultaneously. So this plotter plots all the points on the first series + * it's asked to draw, then ignores all the other series. + * + * @private + */ +DygraphCanvasRenderer._fillPlotter = function (e) { + // Skip if we're drawing a single series for interactive highlight overlay. + if (e.singleSeriesName) return; + + // We'll handle all the series at once, not one-by-one. + if (e.seriesIndex !== 0) return; + + var g = e.dygraph; + var setNames = g.getLabels().slice(1); // remove x-axis + + // getLabels() includes names for invisible series, which are not included in + // allSeriesPoints. We remove those to make the two match. + // TODO(danvk): provide a simpler way to get this information. + for (var i = setNames.length; i >= 0; i--) { + if (!g.visibility()[i]) setNames.splice(i, 1); + } + + var anySeriesFilled = (function () { + for (var i = 0; i < setNames.length; i++) { + if (g.getBooleanOption("fillGraph", setNames[i])) return true; + } + return false; + })(); + + if (!anySeriesFilled) return; + + var area = e.plotArea; + var sets = e.allSeriesPoints; + var setCount = sets.length; + + var stackedGraph = g.getBooleanOption("stackedGraph"); + var colors = g.getColors(); + + // For stacked graphs, track the baseline for filling. + // + // The filled areas below graph lines are trapezoids with two + // vertical edges. The top edge is the line segment being drawn, and + // the baseline is the bottom edge. Each baseline corresponds to the + // top line segment from the previous stacked line. In the case of + // step plots, the trapezoids are rectangles. + var baseline = {}; + var currBaseline; + var prevStepPlot; // for different line drawing modes (line/step) per series + + // Helper function to trace a line back along the baseline. + var traceBackPath = function traceBackPath(ctx, baselineX, baselineY, pathBack) { + ctx.lineTo(baselineX, baselineY); + if (stackedGraph) { + for (var i = pathBack.length - 1; i >= 0; i--) { + var pt = pathBack[i]; + ctx.lineTo(pt[0], pt[1]); + } + } + }; + + // process sets in reverse order (needed for stacked graphs) + for (var setIdx = setCount - 1; setIdx >= 0; setIdx--) { + var ctx = e.drawingContext; + var setName = setNames[setIdx]; + if (!g.getBooleanOption('fillGraph', setName)) continue; + + var fillAlpha = g.getNumericOption('fillAlpha', setName); + var stepPlot = g.getBooleanOption('stepPlot', setName); + var color = colors[setIdx]; + var axis = g.axisPropertiesForSeries(setName); + var axisY = 1.0 + axis.minyval * axis.yscale; + if (axisY < 0.0) axisY = 0.0;else if (axisY > 1.0) axisY = 1.0; + axisY = area.h * axisY + area.y; + + var points = sets[setIdx]; + var iter = utils.createIterator(points, 0, points.length, DygraphCanvasRenderer._getIteratorPredicate(g.getBooleanOption("connectSeparatedPoints", setName))); + + // setup graphics context + var prevX = NaN; + var prevYs = [-1, -1]; + var newYs; + // should be same color as the lines but only 15% opaque. + var rgb = utils.toRGB_(color); + var err_color = 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + fillAlpha + ')'; + ctx.fillStyle = err_color; + ctx.beginPath(); + var last_x, + is_first = true; + + // If the point density is high enough, dropping segments on their way to + // the canvas justifies the overhead of doing so. + if (points.length > 2 * g.width_ || _dygraph2['default'].FORCE_FAST_PROXY) { + ctx = DygraphCanvasRenderer._fastCanvasProxy(ctx); + } + + // For filled charts, we draw points from left to right, then back along + // the x-axis to complete a shape for filling. + // For stacked plots, this "back path" is a more complex shape. This array + // stores the [x, y] values needed to trace that shape. + var pathBack = []; + + // TODO(danvk): there are a lot of options at play in this loop. + // The logic would be much clearer if some (e.g. stackGraph and + // stepPlot) were split off into separate sub-plotters. + var point; + while (iter.hasNext) { + point = iter.next(); + if (!utils.isOK(point.y) && !stepPlot) { + traceBackPath(ctx, prevX, prevYs[1], pathBack); + pathBack = []; + prevX = NaN; + if (point.y_stacked !== null && !isNaN(point.y_stacked)) { + baseline[point.canvasx] = area.h * point.y_stacked + area.y; + } + continue; + } + if (stackedGraph) { + if (!is_first && last_x == point.xval) { + continue; + } else { + is_first = false; + last_x = point.xval; + } + + currBaseline = baseline[point.canvasx]; + var lastY; + if (currBaseline === undefined) { + lastY = axisY; + } else { + if (prevStepPlot) { + lastY = currBaseline[0]; + } else { + lastY = currBaseline; + } + } + newYs = [point.canvasy, lastY]; + + if (stepPlot) { + // Step plots must keep track of the top and bottom of + // the baseline at each point. + if (prevYs[0] === -1) { + baseline[point.canvasx] = [point.canvasy, axisY]; + } else { + baseline[point.canvasx] = [point.canvasy, prevYs[0]]; + } + } else { + baseline[point.canvasx] = point.canvasy; + } + } else { + if (isNaN(point.canvasy) && stepPlot) { + newYs = [area.y + area.h, axisY]; + } else { + newYs = [point.canvasy, axisY]; + } + } + if (!isNaN(prevX)) { + // Move to top fill point + if (stepPlot) { + ctx.lineTo(point.canvasx, prevYs[0]); + ctx.lineTo(point.canvasx, newYs[0]); + } else { + ctx.lineTo(point.canvasx, newYs[0]); + } + + // Record the baseline for the reverse path. + if (stackedGraph) { + pathBack.push([prevX, prevYs[1]]); + if (prevStepPlot && currBaseline) { + // Draw to the bottom of the baseline + pathBack.push([point.canvasx, currBaseline[1]]); + } else { + pathBack.push([point.canvasx, newYs[1]]); + } + } + } else { + ctx.moveTo(point.canvasx, newYs[1]); + ctx.lineTo(point.canvasx, newYs[0]); + } + prevYs = newYs; + prevX = point.canvasx; + } + prevStepPlot = stepPlot; + if (newYs && point) { + traceBackPath(ctx, point.canvasx, newYs[1], pathBack); + pathBack = []; + } + ctx.fill(); + } +}; + +exports['default'] = DygraphCanvasRenderer; +module.exports = exports['default']; + +},{"./dygraph":18,"./dygraph-utils":17}],10:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } + +var _dygraphTickers = require('./dygraph-tickers'); + +var DygraphTickers = _interopRequireWildcard(_dygraphTickers); + +var _dygraphInteractionModel = require('./dygraph-interaction-model'); + +var _dygraphInteractionModel2 = _interopRequireDefault(_dygraphInteractionModel); + +var _dygraphCanvas = require('./dygraph-canvas'); + +var _dygraphCanvas2 = _interopRequireDefault(_dygraphCanvas); + +var _dygraphUtils = require('./dygraph-utils'); + +var utils = _interopRequireWildcard(_dygraphUtils); + +// Default attribute values. +var DEFAULT_ATTRS = { + highlightCircleSize: 3, + highlightSeriesOpts: null, + highlightSeriesBackgroundAlpha: 0.5, + highlightSeriesBackgroundColor: 'rgb(255, 255, 255)', + + labelsSeparateLines: false, + labelsShowZeroValues: true, + labelsKMB: false, + labelsKMG2: false, + showLabelsOnHighlight: true, + + digitsAfterDecimal: 2, + maxNumberWidth: 6, + sigFigs: null, + + strokeWidth: 1.0, + strokeBorderWidth: 0, + strokeBorderColor: "white", + + axisTickSize: 3, + axisLabelFontSize: 14, + rightGap: 5, + + showRoller: false, + xValueParser: undefined, + + delimiter: ',', + + sigma: 2.0, + errorBars: false, + fractions: false, + wilsonInterval: true, // only relevant if fractions is true + customBars: false, + fillGraph: false, + fillAlpha: 0.15, + connectSeparatedPoints: false, + + stackedGraph: false, + stackedGraphNaNFill: 'all', + hideOverlayOnMouseOut: true, + + legend: 'onmouseover', + stepPlot: false, + xRangePad: 0, + yRangePad: null, + drawAxesAtZero: false, + + // Sizes of the various chart labels. + titleHeight: 28, + xLabelHeight: 18, + yLabelWidth: 18, + + axisLineColor: "black", + axisLineWidth: 0.3, + gridLineWidth: 0.3, + axisLabelWidth: 50, + gridLineColor: "rgb(128,128,128)", + + interactionModel: _dygraphInteractionModel2['default'].defaultModel, + animatedZooms: false, // (for now) + + // Range selector options + showRangeSelector: false, + rangeSelectorHeight: 40, + rangeSelectorPlotStrokeColor: "#808FAB", + rangeSelectorPlotFillGradientColor: "white", + rangeSelectorPlotFillColor: "#A7B1C4", + rangeSelectorBackgroundStrokeColor: "gray", + rangeSelectorBackgroundLineWidth: 1, + rangeSelectorPlotLineWidth: 1.5, + rangeSelectorForegroundStrokeColor: "black", + rangeSelectorForegroundLineWidth: 1, + rangeSelectorAlpha: 0.6, + showInRangeSelector: null, + + // The ordering here ensures that central lines always appear above any + // fill bars/error bars. + plotter: [_dygraphCanvas2['default']._fillPlotter, _dygraphCanvas2['default']._errorPlotter, _dygraphCanvas2['default']._linePlotter], + + plugins: [], + + // per-axis options + axes: { + x: { + pixelsPerLabel: 70, + axisLabelWidth: 60, + axisLabelFormatter: utils.dateAxisLabelFormatter, + valueFormatter: utils.dateValueFormatter, + drawGrid: true, + drawAxis: true, + independentTicks: true, + ticker: DygraphTickers.dateTicker + }, + y: { + axisLabelWidth: 50, + pixelsPerLabel: 30, + valueFormatter: utils.numberValueFormatter, + axisLabelFormatter: utils.numberAxisLabelFormatter, + drawGrid: true, + drawAxis: true, + independentTicks: true, + ticker: DygraphTickers.numericTicks + }, + y2: { + axisLabelWidth: 50, + pixelsPerLabel: 30, + valueFormatter: utils.numberValueFormatter, + axisLabelFormatter: utils.numberAxisLabelFormatter, + drawAxis: true, // only applies when there are two axes of data. + drawGrid: false, + independentTicks: false, + ticker: DygraphTickers.numericTicks + } + } +}; + +exports['default'] = DEFAULT_ATTRS; +module.exports = exports['default']; + +},{"./dygraph-canvas":9,"./dygraph-interaction-model":12,"./dygraph-tickers":16,"./dygraph-utils":17}],11:[function(require,module,exports){ +/** + * @license + * Copyright 2011 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview A wrapper around the Dygraph class which implements the + * interface for a GViz (aka Google Visualization API) visualization. + * It is designed to be a drop-in replacement for Google's AnnotatedTimeline, + * so the documentation at + * http://code.google.com/apis/chart/interactive/docs/gallery/annotatedtimeline.html + * translates over directly. + * + * For a full demo, see: + * - http://dygraphs.com/tests/gviz.html + * - http://dygraphs.com/tests/annotation-gviz.html + */ + +/*global Dygraph:false */ +"use strict"; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _dygraph = require('./dygraph'); + +var _dygraph2 = _interopRequireDefault(_dygraph); + +/** + * A wrapper around Dygraph that implements the gviz API. + * @param {!HTMLDivElement} container The DOM object the visualization should + * live in. + * @constructor + */ +var GVizChart = function GVizChart(container) { + this.container = container; +}; + +/** + * @param {GVizDataTable} data + * @param {Object.<*>} options + */ +GVizChart.prototype.draw = function (data, options) { + // Clear out any existing dygraph. + // TODO(danvk): would it make more sense to simply redraw using the current + // date_graph object? + this.container.innerHTML = ''; + if (typeof this.date_graph != 'undefined') { + this.date_graph.destroy(); + } + + this.date_graph = new _dygraph2['default'](this.container, data, options); +}; + +/** + * Google charts compatible setSelection + * Only row selection is supported, all points in the row will be highlighted + * @param {Array.<{row:number}>} selection_array array of the selected cells + * @public + */ +GVizChart.prototype.setSelection = function (selection_array) { + var row = false; + if (selection_array.length) { + row = selection_array[0].row; + } + this.date_graph.setSelection(row); +}; + +/** + * Google charts compatible getSelection implementation + * @return {Array.<{row:number,column:number}>} array of the selected cells + * @public + */ +GVizChart.prototype.getSelection = function () { + var selection = []; + + var row = this.date_graph.getSelection(); + + if (row < 0) return selection; + + var points = this.date_graph.layout_.points; + for (var setIdx = 0; setIdx < points.length; ++setIdx) { + selection.push({ row: row, column: setIdx + 1 }); + } + + return selection; +}; + +exports['default'] = GVizChart; +module.exports = exports['default']; + +},{"./dygraph":18}],12:[function(require,module,exports){ +/** + * @license + * Copyright 2011 Robert Konigsberg (konigsberg@google.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview The default interaction model for Dygraphs. This is kept out + * of dygraph.js for better navigability. + * @author Robert Konigsberg (konigsberg@google.com) + */ + +/*global Dygraph:false */ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } + +var _dygraphUtils = require('./dygraph-utils'); + +var utils = _interopRequireWildcard(_dygraphUtils); + +/** + * You can drag this many pixels past the edge of the chart and still have it + * be considered a zoom. This makes it easier to zoom to the exact edge of the + * chart, a fairly common operation. + */ +var DRAG_EDGE_MARGIN = 100; + +/** + * A collection of functions to facilitate build custom interaction models. + * @class + */ +var DygraphInteraction = {}; + +/** + * Checks whether the beginning & ending of an event were close enough that it + * should be considered a click. If it should, dispatch appropriate events. + * Returns true if the event was treated as a click. + * + * @param {Event} event + * @param {Dygraph} g + * @param {Object} context + */ +DygraphInteraction.maybeTreatMouseOpAsClick = function (event, g, context) { + context.dragEndX = utils.dragGetX_(event, context); + context.dragEndY = utils.dragGetY_(event, context); + var regionWidth = Math.abs(context.dragEndX - context.dragStartX); + var regionHeight = Math.abs(context.dragEndY - context.dragStartY); + + if (regionWidth < 2 && regionHeight < 2 && g.lastx_ !== undefined && g.lastx_ != -1) { + DygraphInteraction.treatMouseOpAsClick(g, event, context); + } + + context.regionWidth = regionWidth; + context.regionHeight = regionHeight; +}; + +/** + * Called in response to an interaction model operation that + * should start the default panning behavior. + * + * It's used in the default callback for "mousedown" operations. + * Custom interaction model builders can use it to provide the default + * panning behavior. + * + * @param {Event} event the event object which led to the startPan call. + * @param {Dygraph} g The dygraph on which to act. + * @param {Object} context The dragging context object (with + * dragStartX/dragStartY/etc. properties). This function modifies the + * context. + */ +DygraphInteraction.startPan = function (event, g, context) { + var i, axis; + context.isPanning = true; + var xRange = g.xAxisRange(); + + if (g.getOptionForAxis("logscale", "x")) { + context.initialLeftmostDate = utils.log10(xRange[0]); + context.dateRange = utils.log10(xRange[1]) - utils.log10(xRange[0]); + } else { + context.initialLeftmostDate = xRange[0]; + context.dateRange = xRange[1] - xRange[0]; + } + context.xUnitsPerPixel = context.dateRange / (g.plotter_.area.w - 1); + + if (g.getNumericOption("panEdgeFraction")) { + var maxXPixelsToDraw = g.width_ * g.getNumericOption("panEdgeFraction"); + var xExtremes = g.xAxisExtremes(); // I REALLY WANT TO CALL THIS xTremes! + + var boundedLeftX = g.toDomXCoord(xExtremes[0]) - maxXPixelsToDraw; + var boundedRightX = g.toDomXCoord(xExtremes[1]) + maxXPixelsToDraw; + + var boundedLeftDate = g.toDataXCoord(boundedLeftX); + var boundedRightDate = g.toDataXCoord(boundedRightX); + context.boundedDates = [boundedLeftDate, boundedRightDate]; + + var boundedValues = []; + var maxYPixelsToDraw = g.height_ * g.getNumericOption("panEdgeFraction"); + + for (i = 0; i < g.axes_.length; i++) { + axis = g.axes_[i]; + var yExtremes = axis.extremeRange; + + var boundedTopY = g.toDomYCoord(yExtremes[0], i) + maxYPixelsToDraw; + var boundedBottomY = g.toDomYCoord(yExtremes[1], i) - maxYPixelsToDraw; + + var boundedTopValue = g.toDataYCoord(boundedTopY, i); + var boundedBottomValue = g.toDataYCoord(boundedBottomY, i); + + boundedValues[i] = [boundedTopValue, boundedBottomValue]; + } + context.boundedValues = boundedValues; + } + + // Record the range of each y-axis at the start of the drag. + // If any axis has a valueRange, then we want a 2D pan. + // We can't store data directly in g.axes_, because it does not belong to us + // and could change out from under us during a pan (say if there's a data + // update). + context.is2DPan = false; + context.axes = []; + for (i = 0; i < g.axes_.length; i++) { + axis = g.axes_[i]; + var axis_data = {}; + var yRange = g.yAxisRange(i); + // TODO(konigsberg): These values should be in |context|. + // In log scale, initialTopValue, dragValueRange and unitsPerPixel are log scale. + var logscale = g.attributes_.getForAxis("logscale", i); + if (logscale) { + axis_data.initialTopValue = utils.log10(yRange[1]); + axis_data.dragValueRange = utils.log10(yRange[1]) - utils.log10(yRange[0]); + } else { + axis_data.initialTopValue = yRange[1]; + axis_data.dragValueRange = yRange[1] - yRange[0]; + } + axis_data.unitsPerPixel = axis_data.dragValueRange / (g.plotter_.area.h - 1); + context.axes.push(axis_data); + + // While calculating axes, set 2dpan. + if (axis.valueRange) context.is2DPan = true; + } +}; + +/** + * Called in response to an interaction model operation that + * responds to an event that pans the view. + * + * It's used in the default callback for "mousemove" operations. + * Custom interaction model builders can use it to provide the default + * panning behavior. + * + * @param {Event} event the event object which led to the movePan call. + * @param {Dygraph} g The dygraph on which to act. + * @param {Object} context The dragging context object (with + * dragStartX/dragStartY/etc. properties). This function modifies the + * context. + */ +DygraphInteraction.movePan = function (event, g, context) { + context.dragEndX = utils.dragGetX_(event, context); + context.dragEndY = utils.dragGetY_(event, context); + + var minDate = context.initialLeftmostDate - (context.dragEndX - context.dragStartX) * context.xUnitsPerPixel; + if (context.boundedDates) { + minDate = Math.max(minDate, context.boundedDates[0]); + } + var maxDate = minDate + context.dateRange; + if (context.boundedDates) { + if (maxDate > context.boundedDates[1]) { + // Adjust minDate, and recompute maxDate. + minDate = minDate - (maxDate - context.boundedDates[1]); + maxDate = minDate + context.dateRange; + } + } + + if (g.getOptionForAxis("logscale", "x")) { + g.dateWindow_ = [Math.pow(utils.LOG_SCALE, minDate), Math.pow(utils.LOG_SCALE, maxDate)]; + } else { + g.dateWindow_ = [minDate, maxDate]; + } + + // y-axis scaling is automatic unless this is a full 2D pan. + if (context.is2DPan) { + + var pixelsDragged = context.dragEndY - context.dragStartY; + + // Adjust each axis appropriately. + for (var i = 0; i < g.axes_.length; i++) { + var axis = g.axes_[i]; + var axis_data = context.axes[i]; + var unitsDragged = pixelsDragged * axis_data.unitsPerPixel; + + var boundedValue = context.boundedValues ? context.boundedValues[i] : null; + + // In log scale, maxValue and minValue are the logs of those values. + var maxValue = axis_data.initialTopValue + unitsDragged; + if (boundedValue) { + maxValue = Math.min(maxValue, boundedValue[1]); + } + var minValue = maxValue - axis_data.dragValueRange; + if (boundedValue) { + if (minValue < boundedValue[0]) { + // Adjust maxValue, and recompute minValue. + maxValue = maxValue - (minValue - boundedValue[0]); + minValue = maxValue - axis_data.dragValueRange; + } + } + if (g.attributes_.getForAxis("logscale", i)) { + axis.valueRange = [Math.pow(utils.LOG_SCALE, minValue), Math.pow(utils.LOG_SCALE, maxValue)]; + } else { + axis.valueRange = [minValue, maxValue]; + } + } + } + + g.drawGraph_(false); +}; + +/** + * Called in response to an interaction model operation that + * responds to an event that ends panning. + * + * It's used in the default callback for "mouseup" operations. + * Custom interaction model builders can use it to provide the default + * panning behavior. + * + * @param {Event} event the event object which led to the endPan call. + * @param {Dygraph} g The dygraph on which to act. + * @param {Object} context The dragging context object (with + * dragStartX/dragStartY/etc. properties). This function modifies the + * context. + */ +DygraphInteraction.endPan = DygraphInteraction.maybeTreatMouseOpAsClick; + +/** + * Called in response to an interaction model operation that + * responds to an event that starts zooming. + * + * It's used in the default callback for "mousedown" operations. + * Custom interaction model builders can use it to provide the default + * zooming behavior. + * + * @param {Event} event the event object which led to the startZoom call. + * @param {Dygraph} g The dygraph on which to act. + * @param {Object} context The dragging context object (with + * dragStartX/dragStartY/etc. properties). This function modifies the + * context. + */ +DygraphInteraction.startZoom = function (event, g, context) { + context.isZooming = true; + context.zoomMoved = false; +}; + +/** + * Called in response to an interaction model operation that + * responds to an event that defines zoom boundaries. + * + * It's used in the default callback for "mousemove" operations. + * Custom interaction model builders can use it to provide the default + * zooming behavior. + * + * @param {Event} event the event object which led to the moveZoom call. + * @param {Dygraph} g The dygraph on which to act. + * @param {Object} context The dragging context object (with + * dragStartX/dragStartY/etc. properties). This function modifies the + * context. + */ +DygraphInteraction.moveZoom = function (event, g, context) { + context.zoomMoved = true; + context.dragEndX = utils.dragGetX_(event, context); + context.dragEndY = utils.dragGetY_(event, context); + + var xDelta = Math.abs(context.dragStartX - context.dragEndX); + var yDelta = Math.abs(context.dragStartY - context.dragEndY); + + // drag direction threshold for y axis is twice as large as x axis + context.dragDirection = xDelta < yDelta / 2 ? utils.VERTICAL : utils.HORIZONTAL; + + g.drawZoomRect_(context.dragDirection, context.dragStartX, context.dragEndX, context.dragStartY, context.dragEndY, context.prevDragDirection, context.prevEndX, context.prevEndY); + + context.prevEndX = context.dragEndX; + context.prevEndY = context.dragEndY; + context.prevDragDirection = context.dragDirection; +}; + +/** + * TODO(danvk): move this logic into dygraph.js + * @param {Dygraph} g + * @param {Event} event + * @param {Object} context + */ +DygraphInteraction.treatMouseOpAsClick = function (g, event, context) { + var clickCallback = g.getFunctionOption('clickCallback'); + var pointClickCallback = g.getFunctionOption('pointClickCallback'); + + var selectedPoint = null; + + // Find out if the click occurs on a point. + var closestIdx = -1; + var closestDistance = Number.MAX_VALUE; + + // check if the click was on a particular point. + for (var i = 0; i < g.selPoints_.length; i++) { + var p = g.selPoints_[i]; + var distance = Math.pow(p.canvasx - context.dragEndX, 2) + Math.pow(p.canvasy - context.dragEndY, 2); + if (!isNaN(distance) && (closestIdx == -1 || distance < closestDistance)) { + closestDistance = distance; + closestIdx = i; + } + } + + // Allow any click within two pixels of the dot. + var radius = g.getNumericOption('highlightCircleSize') + 2; + if (closestDistance <= radius * radius) { + selectedPoint = g.selPoints_[closestIdx]; + } + + if (selectedPoint) { + var e = { + cancelable: true, + point: selectedPoint, + canvasx: context.dragEndX, + canvasy: context.dragEndY + }; + var defaultPrevented = g.cascadeEvents_('pointClick', e); + if (defaultPrevented) { + // Note: this also prevents click / clickCallback from firing. + return; + } + if (pointClickCallback) { + pointClickCallback.call(g, event, selectedPoint); + } + } + + var e = { + cancelable: true, + xval: g.lastx_, // closest point by x value + pts: g.selPoints_, + canvasx: context.dragEndX, + canvasy: context.dragEndY + }; + if (!g.cascadeEvents_('click', e)) { + if (clickCallback) { + // TODO(danvk): pass along more info about the points, e.g. 'x' + clickCallback.call(g, event, g.lastx_, g.selPoints_); + } + } +}; + +/** + * Called in response to an interaction model operation that + * responds to an event that performs a zoom based on previously defined + * bounds.. + * + * It's used in the default callback for "mouseup" operations. + * Custom interaction model builders can use it to provide the default + * zooming behavior. + * + * @param {Event} event the event object which led to the endZoom call. + * @param {Dygraph} g The dygraph on which to end the zoom. + * @param {Object} context The dragging context object (with + * dragStartX/dragStartY/etc. properties). This function modifies the + * context. + */ +DygraphInteraction.endZoom = function (event, g, context) { + g.clearZoomRect_(); + context.isZooming = false; + DygraphInteraction.maybeTreatMouseOpAsClick(event, g, context); + + // The zoom rectangle is visibly clipped to the plot area, so its behavior + // should be as well. + // See http://code.google.com/p/dygraphs/issues/detail?id=280 + var plotArea = g.getArea(); + if (context.regionWidth >= 10 && context.dragDirection == utils.HORIZONTAL) { + var left = Math.min(context.dragStartX, context.dragEndX), + right = Math.max(context.dragStartX, context.dragEndX); + left = Math.max(left, plotArea.x); + right = Math.min(right, plotArea.x + plotArea.w); + if (left < right) { + g.doZoomX_(left, right); + } + context.cancelNextDblclick = true; + } else if (context.regionHeight >= 10 && context.dragDirection == utils.VERTICAL) { + var top = Math.min(context.dragStartY, context.dragEndY), + bottom = Math.max(context.dragStartY, context.dragEndY); + top = Math.max(top, plotArea.y); + bottom = Math.min(bottom, plotArea.y + plotArea.h); + if (top < bottom) { + g.doZoomY_(top, bottom); + } + context.cancelNextDblclick = true; + } + context.dragStartX = null; + context.dragStartY = null; +}; + +/** + * @private + */ +DygraphInteraction.startTouch = function (event, g, context) { + event.preventDefault(); // touch browsers are all nice. + if (event.touches.length > 1) { + // If the user ever puts two fingers down, it's not a double tap. + context.startTimeForDoubleTapMs = null; + } + + var touches = []; + for (var i = 0; i < event.touches.length; i++) { + var t = event.touches[i]; + // we dispense with 'dragGetX_' because all touchBrowsers support pageX + touches.push({ + pageX: t.pageX, + pageY: t.pageY, + dataX: g.toDataXCoord(t.pageX), + dataY: g.toDataYCoord(t.pageY) + // identifier: t.identifier + }); + } + context.initialTouches = touches; + + if (touches.length == 1) { + // This is just a swipe. + context.initialPinchCenter = touches[0]; + context.touchDirections = { x: true, y: true }; + } else if (touches.length >= 2) { + // It's become a pinch! + // In case there are 3+ touches, we ignore all but the "first" two. + + // only screen coordinates can be averaged (data coords could be log scale). + context.initialPinchCenter = { + pageX: 0.5 * (touches[0].pageX + touches[1].pageX), + pageY: 0.5 * (touches[0].pageY + touches[1].pageY), + + // TODO(danvk): remove + dataX: 0.5 * (touches[0].dataX + touches[1].dataX), + dataY: 0.5 * (touches[0].dataY + touches[1].dataY) + }; + + // Make pinches in a 45-degree swath around either axis 1-dimensional zooms. + var initialAngle = 180 / Math.PI * Math.atan2(context.initialPinchCenter.pageY - touches[0].pageY, touches[0].pageX - context.initialPinchCenter.pageX); + + // use symmetry to get it into the first quadrant. + initialAngle = Math.abs(initialAngle); + if (initialAngle > 90) initialAngle = 90 - initialAngle; + + context.touchDirections = { + x: initialAngle < 90 - 45 / 2, + y: initialAngle > 45 / 2 + }; + } + + // save the full x & y ranges. + context.initialRange = { + x: g.xAxisRange(), + y: g.yAxisRange() + }; +}; + +/** + * @private + */ +DygraphInteraction.moveTouch = function (event, g, context) { + // If the tap moves, then it's definitely not part of a double-tap. + context.startTimeForDoubleTapMs = null; + + var i, + touches = []; + for (i = 0; i < event.touches.length; i++) { + var t = event.touches[i]; + touches.push({ + pageX: t.pageX, + pageY: t.pageY + }); + } + var initialTouches = context.initialTouches; + + var c_now; + + // old and new centers. + var c_init = context.initialPinchCenter; + if (touches.length == 1) { + c_now = touches[0]; + } else { + c_now = { + pageX: 0.5 * (touches[0].pageX + touches[1].pageX), + pageY: 0.5 * (touches[0].pageY + touches[1].pageY) + }; + } + + // this is the "swipe" component + // we toss it out for now, but could use it in the future. + var swipe = { + pageX: c_now.pageX - c_init.pageX, + pageY: c_now.pageY - c_init.pageY + }; + var dataWidth = context.initialRange.x[1] - context.initialRange.x[0]; + var dataHeight = context.initialRange.y[0] - context.initialRange.y[1]; + swipe.dataX = swipe.pageX / g.plotter_.area.w * dataWidth; + swipe.dataY = swipe.pageY / g.plotter_.area.h * dataHeight; + var xScale, yScale; + + // The residual bits are usually split into scale & rotate bits, but we split + // them into x-scale and y-scale bits. + if (touches.length == 1) { + xScale = 1.0; + yScale = 1.0; + } else if (touches.length >= 2) { + var initHalfWidth = initialTouches[1].pageX - c_init.pageX; + xScale = (touches[1].pageX - c_now.pageX) / initHalfWidth; + + var initHalfHeight = initialTouches[1].pageY - c_init.pageY; + yScale = (touches[1].pageY - c_now.pageY) / initHalfHeight; + } + + // Clip scaling to [1/8, 8] to prevent too much blowup. + xScale = Math.min(8, Math.max(0.125, xScale)); + yScale = Math.min(8, Math.max(0.125, yScale)); + + var didZoom = false; + if (context.touchDirections.x) { + g.dateWindow_ = [c_init.dataX - swipe.dataX + (context.initialRange.x[0] - c_init.dataX) / xScale, c_init.dataX - swipe.dataX + (context.initialRange.x[1] - c_init.dataX) / xScale]; + didZoom = true; + } + + if (context.touchDirections.y) { + for (i = 0; i < 1 /*g.axes_.length*/; i++) { + var axis = g.axes_[i]; + var logscale = g.attributes_.getForAxis("logscale", i); + if (logscale) { + // TODO(danvk): implement + } else { + axis.valueRange = [c_init.dataY - swipe.dataY + (context.initialRange.y[0] - c_init.dataY) / yScale, c_init.dataY - swipe.dataY + (context.initialRange.y[1] - c_init.dataY) / yScale]; + didZoom = true; + } + } + } + + g.drawGraph_(false); + + // We only call zoomCallback on zooms, not pans, to mirror desktop behavior. + if (didZoom && touches.length > 1 && g.getFunctionOption('zoomCallback')) { + var viewWindow = g.xAxisRange(); + g.getFunctionOption("zoomCallback").call(g, viewWindow[0], viewWindow[1], g.yAxisRanges()); + } +}; + +/** + * @private + */ +DygraphInteraction.endTouch = function (event, g, context) { + if (event.touches.length !== 0) { + // this is effectively a "reset" + DygraphInteraction.startTouch(event, g, context); + } else if (event.changedTouches.length == 1) { + // Could be part of a "double tap" + // The heuristic here is that it's a double-tap if the two touchend events + // occur within 500ms and within a 50x50 pixel box. + var now = new Date().getTime(); + var t = event.changedTouches[0]; + if (context.startTimeForDoubleTapMs && now - context.startTimeForDoubleTapMs < 500 && context.doubleTapX && Math.abs(context.doubleTapX - t.screenX) < 50 && context.doubleTapY && Math.abs(context.doubleTapY - t.screenY) < 50) { + g.resetZoom(); + } else { + context.startTimeForDoubleTapMs = now; + context.doubleTapX = t.screenX; + context.doubleTapY = t.screenY; + } + } +}; + +// Determine the distance from x to [left, right]. +var distanceFromInterval = function distanceFromInterval(x, left, right) { + if (x < left) { + return left - x; + } else if (x > right) { + return x - right; + } else { + return 0; + } +}; + +/** + * Returns the number of pixels by which the event happens from the nearest + * edge of the chart. For events in the interior of the chart, this returns zero. + */ +var distanceFromChart = function distanceFromChart(event, g) { + var chartPos = utils.findPos(g.canvas_); + var box = { + left: chartPos.x, + right: chartPos.x + g.canvas_.offsetWidth, + top: chartPos.y, + bottom: chartPos.y + g.canvas_.offsetHeight + }; + + var pt = { + x: utils.pageX(event), + y: utils.pageY(event) + }; + + var dx = distanceFromInterval(pt.x, box.left, box.right), + dy = distanceFromInterval(pt.y, box.top, box.bottom); + return Math.max(dx, dy); +}; + +/** + * Default interation model for dygraphs. You can refer to specific elements of + * this when constructing your own interaction model, e.g.: + * g.updateOptions( { + * interactionModel: { + * mousedown: DygraphInteraction.defaultInteractionModel.mousedown + * } + * } ); + */ +DygraphInteraction.defaultModel = { + // Track the beginning of drag events + mousedown: function mousedown(event, g, context) { + // Right-click should not initiate a zoom. + if (event.button && event.button == 2) return; + + context.initializeMouseDown(event, g, context); + + if (event.altKey || event.shiftKey) { + DygraphInteraction.startPan(event, g, context); + } else { + DygraphInteraction.startZoom(event, g, context); + } + + // Note: we register mousemove/mouseup on document to allow some leeway for + // events to move outside of the chart. Interaction model events get + // registered on the canvas, which is too small to allow this. + var mousemove = function mousemove(event) { + if (context.isZooming) { + // When the mouse moves >200px from the chart edge, cancel the zoom. + var d = distanceFromChart(event, g); + if (d < DRAG_EDGE_MARGIN) { + DygraphInteraction.moveZoom(event, g, context); + } else { + if (context.dragEndX !== null) { + context.dragEndX = null; + context.dragEndY = null; + g.clearZoomRect_(); + } + } + } else if (context.isPanning) { + DygraphInteraction.movePan(event, g, context); + } + }; + var mouseup = function mouseup(event) { + if (context.isZooming) { + if (context.dragEndX !== null) { + DygraphInteraction.endZoom(event, g, context); + } else { + DygraphInteraction.maybeTreatMouseOpAsClick(event, g, context); + } + } else if (context.isPanning) { + DygraphInteraction.endPan(event, g, context); + } + + utils.removeEvent(document, 'mousemove', mousemove); + utils.removeEvent(document, 'mouseup', mouseup); + context.destroy(); + }; + + g.addAndTrackEvent(document, 'mousemove', mousemove); + g.addAndTrackEvent(document, 'mouseup', mouseup); + }, + willDestroyContextMyself: true, + + touchstart: function touchstart(event, g, context) { + DygraphInteraction.startTouch(event, g, context); + }, + touchmove: function touchmove(event, g, context) { + DygraphInteraction.moveTouch(event, g, context); + }, + touchend: function touchend(event, g, context) { + DygraphInteraction.endTouch(event, g, context); + }, + + // Disable zooming out if panning. + dblclick: function dblclick(event, g, context) { + if (context.cancelNextDblclick) { + context.cancelNextDblclick = false; + return; + } + + // Give plugins a chance to grab this event. + var e = { + canvasx: context.dragEndX, + canvasy: context.dragEndY, + cancelable: true + }; + if (g.cascadeEvents_('dblclick', e)) { + return; + } + + if (event.altKey || event.shiftKey) { + return; + } + g.resetZoom(); + } +}; + +/* +Dygraph.DEFAULT_ATTRS.interactionModel = DygraphInteraction.defaultModel; + +// old ways of accessing these methods/properties +Dygraph.defaultInteractionModel = DygraphInteraction.defaultModel; +Dygraph.endZoom = DygraphInteraction.endZoom; +Dygraph.moveZoom = DygraphInteraction.moveZoom; +Dygraph.startZoom = DygraphInteraction.startZoom; +Dygraph.endPan = DygraphInteraction.endPan; +Dygraph.movePan = DygraphInteraction.movePan; +Dygraph.startPan = DygraphInteraction.startPan; +*/ + +DygraphInteraction.nonInteractiveModel_ = { + mousedown: function mousedown(event, g, context) { + context.initializeMouseDown(event, g, context); + }, + mouseup: DygraphInteraction.maybeTreatMouseOpAsClick +}; + +// Default interaction model when using the range selector. +DygraphInteraction.dragIsPanInteractionModel = { + mousedown: function mousedown(event, g, context) { + context.initializeMouseDown(event, g, context); + DygraphInteraction.startPan(event, g, context); + }, + mousemove: function mousemove(event, g, context) { + if (context.isPanning) { + DygraphInteraction.movePan(event, g, context); + } + }, + mouseup: function mouseup(event, g, context) { + if (context.isPanning) { + DygraphInteraction.endPan(event, g, context); + } + } +}; + +exports["default"] = DygraphInteraction; +module.exports = exports["default"]; + +},{"./dygraph-utils":17}],13:[function(require,module,exports){ +/** + * @license + * Copyright 2011 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview Based on PlotKitLayout, but modified to meet the needs of + * dygraphs. + */ + +/*global Dygraph:false */ +"use strict"; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } + +var _dygraphUtils = require('./dygraph-utils'); + +var utils = _interopRequireWildcard(_dygraphUtils); + +/** + * Creates a new DygraphLayout object. + * + * This class contains all the data to be charted. + * It uses data coordinates, but also records the chart range (in data + * coordinates) and hence is able to calculate percentage positions ('In this + * view, Point A lies 25% down the x-axis.') + * + * Two things that it does not do are: + * 1. Record pixel coordinates for anything. + * 2. (oddly) determine anything about the layout of chart elements. + * + * The naming is a vestige of Dygraph's original PlotKit roots. + * + * @constructor + */ +var DygraphLayout = function DygraphLayout(dygraph) { + this.dygraph_ = dygraph; + /** + * Array of points for each series. + * + * [series index][row index in series] = |Point| structure, + * where series index refers to visible series only, and the + * point index is for the reduced set of points for the current + * zoom region (including one point just outside the window). + * All points in the same row index share the same X value. + * + * @type {Array.>} + */ + this.points = []; + this.setNames = []; + this.annotations = []; + this.yAxes_ = null; + + // TODO(danvk): it's odd that xTicks_ and yTicks_ are inputs, but xticks and + // yticks are outputs. Clean this up. + this.xTicks_ = null; + this.yTicks_ = null; +}; + +/** + * Add points for a single series. + * + * @param {string} setname Name of the series. + * @param {Array.} set_xy Points for the series. + */ +DygraphLayout.prototype.addDataset = function (setname, set_xy) { + this.points.push(set_xy); + this.setNames.push(setname); +}; + +/** + * Returns the box which the chart should be drawn in. This is the canvas's + * box, less space needed for the axis and chart labels. + * + * @return {{x: number, y: number, w: number, h: number}} + */ +DygraphLayout.prototype.getPlotArea = function () { + return this.area_; +}; + +// Compute the box which the chart should be drawn in. This is the canvas's +// box, less space needed for axis, chart labels, and other plug-ins. +// NOTE: This should only be called by Dygraph.predraw_(). +DygraphLayout.prototype.computePlotArea = function () { + var area = { + // TODO(danvk): per-axis setting. + x: 0, + y: 0 + }; + + area.w = this.dygraph_.width_ - area.x - this.dygraph_.getOption('rightGap'); + area.h = this.dygraph_.height_; + + // Let plugins reserve space. + var e = { + chart_div: this.dygraph_.graphDiv, + reserveSpaceLeft: function reserveSpaceLeft(px) { + var r = { + x: area.x, + y: area.y, + w: px, + h: area.h + }; + area.x += px; + area.w -= px; + return r; + }, + reserveSpaceRight: function reserveSpaceRight(px) { + var r = { + x: area.x + area.w - px, + y: area.y, + w: px, + h: area.h + }; + area.w -= px; + return r; + }, + reserveSpaceTop: function reserveSpaceTop(px) { + var r = { + x: area.x, + y: area.y, + w: area.w, + h: px + }; + area.y += px; + area.h -= px; + return r; + }, + reserveSpaceBottom: function reserveSpaceBottom(px) { + var r = { + x: area.x, + y: area.y + area.h - px, + w: area.w, + h: px + }; + area.h -= px; + return r; + }, + chartRect: function chartRect() { + return { x: area.x, y: area.y, w: area.w, h: area.h }; + } + }; + this.dygraph_.cascadeEvents_('layout', e); + + this.area_ = area; +}; + +DygraphLayout.prototype.setAnnotations = function (ann) { + // The Dygraph object's annotations aren't parsed. We parse them here and + // save a copy. If there is no parser, then the user must be using raw format. + this.annotations = []; + var parse = this.dygraph_.getOption('xValueParser') || function (x) { + return x; + }; + for (var i = 0; i < ann.length; i++) { + var a = {}; + if (!ann[i].xval && ann[i].x === undefined) { + console.error("Annotations must have an 'x' property"); + return; + } + if (ann[i].icon && !(ann[i].hasOwnProperty('width') && ann[i].hasOwnProperty('height'))) { + console.error("Must set width and height when setting " + "annotation.icon property"); + return; + } + utils.update(a, ann[i]); + if (!a.xval) a.xval = parse(a.x); + this.annotations.push(a); + } +}; + +DygraphLayout.prototype.setXTicks = function (xTicks) { + this.xTicks_ = xTicks; +}; + +// TODO(danvk): add this to the Dygraph object's API or move it into Layout. +DygraphLayout.prototype.setYAxes = function (yAxes) { + this.yAxes_ = yAxes; +}; + +DygraphLayout.prototype.evaluate = function () { + this._xAxis = {}; + this._evaluateLimits(); + this._evaluateLineCharts(); + this._evaluateLineTicks(); + this._evaluateAnnotations(); +}; + +DygraphLayout.prototype._evaluateLimits = function () { + var xlimits = this.dygraph_.xAxisRange(); + this._xAxis.minval = xlimits[0]; + this._xAxis.maxval = xlimits[1]; + var xrange = xlimits[1] - xlimits[0]; + this._xAxis.scale = xrange !== 0 ? 1 / xrange : 1.0; + + if (this.dygraph_.getOptionForAxis("logscale", 'x')) { + this._xAxis.xlogrange = utils.log10(this._xAxis.maxval) - utils.log10(this._xAxis.minval); + this._xAxis.xlogscale = this._xAxis.xlogrange !== 0 ? 1.0 / this._xAxis.xlogrange : 1.0; + } + for (var i = 0; i < this.yAxes_.length; i++) { + var axis = this.yAxes_[i]; + axis.minyval = axis.computedValueRange[0]; + axis.maxyval = axis.computedValueRange[1]; + axis.yrange = axis.maxyval - axis.minyval; + axis.yscale = axis.yrange !== 0 ? 1.0 / axis.yrange : 1.0; + + if (this.dygraph_.getOption("logscale")) { + axis.ylogrange = utils.log10(axis.maxyval) - utils.log10(axis.minyval); + axis.ylogscale = axis.ylogrange !== 0 ? 1.0 / axis.ylogrange : 1.0; + if (!isFinite(axis.ylogrange) || isNaN(axis.ylogrange)) { + console.error('axis ' + i + ' of graph at ' + axis.g + ' can\'t be displayed in log scale for range [' + axis.minyval + ' - ' + axis.maxyval + ']'); + } + } + } +}; + +DygraphLayout.calcXNormal_ = function (value, xAxis, logscale) { + if (logscale) { + return (utils.log10(value) - utils.log10(xAxis.minval)) * xAxis.xlogscale; + } else { + return (value - xAxis.minval) * xAxis.scale; + } +}; + +/** + * @param {DygraphAxisType} axis + * @param {number} value + * @param {boolean} logscale + * @return {number} + */ +DygraphLayout.calcYNormal_ = function (axis, value, logscale) { + if (logscale) { + var x = 1.0 - (utils.log10(value) - utils.log10(axis.minyval)) * axis.ylogscale; + return isFinite(x) ? x : NaN; // shim for v8 issue; see pull request 276 + } else { + return 1.0 - (value - axis.minyval) * axis.yscale; + } +}; + +DygraphLayout.prototype._evaluateLineCharts = function () { + var isStacked = this.dygraph_.getOption("stackedGraph"); + var isLogscaleForX = this.dygraph_.getOptionForAxis("logscale", 'x'); + + for (var setIdx = 0; setIdx < this.points.length; setIdx++) { + var points = this.points[setIdx]; + var setName = this.setNames[setIdx]; + var connectSeparated = this.dygraph_.getOption('connectSeparatedPoints', setName); + var axis = this.dygraph_.axisPropertiesForSeries(setName); + // TODO (konigsberg): use optionsForAxis instead. + var logscale = this.dygraph_.attributes_.getForSeries("logscale", setName); + + for (var j = 0; j < points.length; j++) { + var point = points[j]; + + // Range from 0-1 where 0 represents left and 1 represents right. + point.x = DygraphLayout.calcXNormal_(point.xval, this._xAxis, isLogscaleForX); + // Range from 0-1 where 0 represents top and 1 represents bottom + var yval = point.yval; + if (isStacked) { + point.y_stacked = DygraphLayout.calcYNormal_(axis, point.yval_stacked, logscale); + if (yval !== null && !isNaN(yval)) { + yval = point.yval_stacked; + } + } + if (yval === null) { + yval = NaN; + if (!connectSeparated) { + point.yval = NaN; + } + } + point.y = DygraphLayout.calcYNormal_(axis, yval, logscale); + } + + this.dygraph_.dataHandler_.onLineEvaluated(points, axis, logscale); + } +}; + +DygraphLayout.prototype._evaluateLineTicks = function () { + var i, tick, label, pos, v, has_tick; + this.xticks = []; + for (i = 0; i < this.xTicks_.length; i++) { + tick = this.xTicks_[i]; + label = tick.label; + has_tick = !('label_v' in tick); + v = has_tick ? tick.v : tick.label_v; + pos = this.dygraph_.toPercentXCoord(v); + if (pos >= 0.0 && pos < 1.0) { + this.xticks.push({ pos: pos, label: label, has_tick: has_tick }); + } + } + + this.yticks = []; + for (i = 0; i < this.yAxes_.length; i++) { + var axis = this.yAxes_[i]; + for (var j = 0; j < axis.ticks.length; j++) { + tick = axis.ticks[j]; + label = tick.label; + has_tick = !('label_v' in tick); + v = has_tick ? tick.v : tick.label_v; + pos = this.dygraph_.toPercentYCoord(v, i); + if (pos > 0.0 && pos <= 1.0) { + this.yticks.push({ axis: i, pos: pos, label: label, has_tick: has_tick }); + } + } + } +}; + +DygraphLayout.prototype._evaluateAnnotations = function () { + // Add the annotations to the point to which they belong. + // Make a map from (setName, xval) to annotation for quick lookups. + var i; + var annotations = {}; + for (i = 0; i < this.annotations.length; i++) { + var a = this.annotations[i]; + annotations[a.xval + "," + a.series] = a; + } + + this.annotated_points = []; + + // Exit the function early if there are no annotations. + if (!this.annotations || !this.annotations.length) { + return; + } + + // TODO(antrob): loop through annotations not points. + for (var setIdx = 0; setIdx < this.points.length; setIdx++) { + var points = this.points[setIdx]; + for (i = 0; i < points.length; i++) { + var p = points[i]; + var k = p.xval + "," + p.name; + if (k in annotations) { + p.annotation = annotations[k]; + this.annotated_points.push(p); + } + } + } +}; + +/** + * Convenience function to remove all the data sets from a graph + */ +DygraphLayout.prototype.removeAllDatasets = function () { + delete this.points; + delete this.setNames; + delete this.setPointsLengths; + delete this.setPointsOffsets; + this.points = []; + this.setNames = []; + this.setPointsLengths = []; + this.setPointsOffsets = []; +}; + +exports['default'] = DygraphLayout; +module.exports = exports['default']; + +},{"./dygraph-utils":17}],14:[function(require,module,exports){ +(function (process){ +/** + * @license + * Copyright 2011 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +"use strict"; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +var OPTIONS_REFERENCE = null; + +// For "production" code, this gets removed by uglifyjs. +if (typeof process !== 'undefined') { + if ("development" != 'production') { + + // NOTE: in addition to parsing as JS, this snippet is expected to be valid + // JSON. This assumption cannot be checked in JS, but it will be checked when + // documentation is generated by the generate-documentation.py script. For the + // most part, this just means that you should always use double quotes. + OPTIONS_REFERENCE = // + { + "xValueParser": { + "default": "parseFloat() or Date.parse()*", + "labels": ["CSV parsing"], + "type": "function(str) -> number", + "description": "A function which parses x-values (i.e. the dependent series). Must return a number, even when the values are dates. In this case, millis since epoch are used. This is used primarily for parsing CSV data. *=Dygraphs is slightly more accepting in the dates which it will parse. See code for details." + }, + "stackedGraph": { + "default": "false", + "labels": ["Data Line display"], + "type": "boolean", + "description": "If set, stack series on top of one another rather than drawing them independently. The first series specified in the input data will wind up on top of the chart and the last will be on bottom. NaN values are drawn as white areas without a line on top, see stackedGraphNaNFill for details." + }, + "stackedGraphNaNFill": { + "default": "all", + "labels": ["Data Line display"], + "type": "string", + "description": "Controls handling of NaN values inside a stacked graph. NaN values are interpolated/extended for stacking purposes, but the actual point value remains NaN in the legend display. Valid option values are \"all\" (interpolate internally, repeat leftmost and rightmost value as needed), \"inside\" (interpolate internally only, use zero outside leftmost and rightmost value), and \"none\" (treat NaN as zero everywhere)." + }, + "pointSize": { + "default": "1", + "labels": ["Data Line display"], + "type": "integer", + "description": "The size of the dot to draw on each point in pixels (see drawPoints). A dot is always drawn when a point is \"isolated\", i.e. there is a missing point on either side of it. This also controls the size of those dots." + }, + "drawPoints": { + "default": "false", + "labels": ["Data Line display"], + "type": "boolean", + "description": "Draw a small dot at each point, in addition to a line going through the point. This makes the individual data points easier to see, but can increase visual clutter in the chart. The small dot can be replaced with a custom rendering by supplying a drawPointCallback." + }, + "drawGapEdgePoints": { + "default": "false", + "labels": ["Data Line display"], + "type": "boolean", + "description": "Draw points at the edges of gaps in the data. This improves visibility of small data segments or other data irregularities." + }, + "drawPointCallback": { + "default": "null", + "labels": ["Data Line display"], + "type": "function(g, seriesName, canvasContext, cx, cy, color, pointSize)", + "parameters": [["g", "the reference graph"], ["seriesName", "the name of the series"], ["canvasContext", "the canvas to draw on"], ["cx", "center x coordinate"], ["cy", "center y coordinate"], ["color", "series color"], ["pointSize", "the radius of the image."], ["idx", "the row-index of the point in the data."]], + "description": "Draw a custom item when drawPoints is enabled. Default is a small dot matching the series color. This method should constrain drawing to within pointSize pixels from (cx, cy). Also see drawHighlightPointCallback" + }, + "height": { + "default": "320", + "labels": ["Overall display"], + "type": "integer", + "description": "Height, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored." + }, + "zoomCallback": { + "default": "null", + "labels": ["Callbacks"], + "type": "function(minDate, maxDate, yRanges)", + "parameters": [["minDate", "milliseconds since epoch"], ["maxDate", "milliseconds since epoch."], ["yRanges", "is an array of [bottom, top] pairs, one for each y-axis."]], + "description": "A function to call when the zoom window is changed (either by zooming in or out). When animatedZooms is set, zoomCallback is called once at the end of the transition (it will not be called for intermediate frames)." + }, + "pointClickCallback": { + "snippet": "function(e, point){
  alert(point);
}", + "default": "null", + "labels": ["Callbacks", "Interactive Elements"], + "type": "function(e, point)", + "parameters": [["e", "the event object for the click"], ["point", "the point that was clicked See Point properties for details"]], + "description": "A function to call when a data point is clicked. and the point that was clicked." + }, + "color": { + "default": "(see description)", + "labels": ["Data Series Colors"], + "type": "string", + "example": "red", + "description": "A per-series color definition. Used in conjunction with, and overrides, the colors option." + }, + "colors": { + "default": "(see description)", + "labels": ["Data Series Colors"], + "type": "array", + "example": "['red', '#00FF00']", + "description": "List of colors for the data series. These can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\", etc. If not specified, equally-spaced points around a color wheel are used. Overridden by the 'color' option." + }, + "connectSeparatedPoints": { + "default": "false", + "labels": ["Data Line display"], + "type": "boolean", + "description": "Usually, when Dygraphs encounters a missing value in a data series, it interprets this as a gap and draws it as such. If, instead, the missing values represents an x-value for which only a different series has data, then you'll want to connect the dots by setting this to true. To explicitly include a gap with this option set, use a value of NaN." + }, + "highlightCallback": { + "default": "null", + "labels": ["Callbacks"], + "type": "function(event, x, points, row, seriesName)", + "description": "When set, this callback gets called every time a new point is highlighted.", + "parameters": [["event", "the JavaScript mousemove event"], ["x", "the x-coordinate of the highlighted points"], ["points", "an array of highlighted points: [ {name: 'series', yval: y-value}, … ]"], ["row", "integer index of the highlighted row in the data table, starting from 0"], ["seriesName", "name of the highlighted series, only present if highlightSeriesOpts is set."]] + }, + "drawHighlightPointCallback": { + "default": "null", + "labels": ["Data Line display"], + "type": "function(g, seriesName, canvasContext, cx, cy, color, pointSize)", + "parameters": [["g", "the reference graph"], ["seriesName", "the name of the series"], ["canvasContext", "the canvas to draw on"], ["cx", "center x coordinate"], ["cy", "center y coordinate"], ["color", "series color"], ["pointSize", "the radius of the image."], ["idx", "the row-index of the point in the data."]], + "description": "Draw a custom item when a point is highlighted. Default is a small dot matching the series color. This method should constrain drawing to within pointSize pixels from (cx, cy) Also see drawPointCallback" + }, + "highlightSeriesOpts": { + "default": "null", + "labels": ["Interactive Elements"], + "type": "Object", + "description": "When set, the options from this object are applied to the timeseries closest to the mouse pointer for interactive highlighting. See also 'highlightCallback'. Example: highlightSeriesOpts: { strokeWidth: 3 }." + }, + "highlightSeriesBackgroundAlpha": { + "default": "0.5", + "labels": ["Interactive Elements"], + "type": "float", + "description": "Fade the background while highlighting series. 1=fully visible background (disable fading), 0=hiddden background (show highlighted series only)." + }, + "highlightSeriesBackgroundColor": { + "default": "rgb(255, 255, 255)", + "labels": ["Interactive Elements"], + "type": "string", + "description": "Sets the background color used to fade out the series in conjunction with 'highlightSeriesBackgroundAlpha'." + }, + "includeZero": { + "default": "false", + "labels": ["Axis display"], + "type": "boolean", + "description": "Usually, dygraphs will use the range of the data plus some padding to set the range of the y-axis. If this option is set, the y-axis will always include zero, typically as the lowest value. This can be used to avoid exaggerating the variance in the data" + }, + "rollPeriod": { + "default": "1", + "labels": ["Error Bars", "Rolling Averages"], + "type": "integer >= 1", + "description": "Number of days over which to average data. Discussed extensively above." + }, + "unhighlightCallback": { + "default": "null", + "labels": ["Callbacks"], + "type": "function(event)", + "parameters": [["event", "the mouse event"]], + "description": "When set, this callback gets called every time the user stops highlighting any point by mousing out of the graph." + }, + "axisTickSize": { + "default": "3.0", + "labels": ["Axis display"], + "type": "number", + "description": "The size of the line to display next to each tick mark on x- or y-axes." + }, + "labelsSeparateLines": { + "default": "false", + "labels": ["Legend"], + "type": "boolean", + "description": "Put <br/> between lines in the label string. Often used in conjunction with labelsDiv." + }, + "valueFormatter": { + "default": "Depends on the type of your data.", + "labels": ["Legend", "Value display/formatting"], + "type": "function(num or millis, opts, seriesName, dygraph, row, col)", + "description": "Function to provide a custom display format for the values displayed on mouseover. This does not affect the values that appear on tick marks next to the axes. To format those, see axisLabelFormatter. This is usually set on a per-axis basis. .", + "parameters": [["num_or_millis", "The value to be formatted. This is always a number. For date axes, it's millis since epoch. You can call new Date(millis) to get a Date object."], ["opts", "This is a function you can call to access various options (e.g. opts('labelsKMB')). It returns per-axis values for the option when available."], ["seriesName", "The name of the series from which the point came, e.g. 'X', 'Y', 'A', etc."], ["dygraph", "The dygraph object for which the formatting is being done"], ["row", "The row of the data from which this point comes. g.getValue(row, 0) will return the x-value for this point."], ["col", "The column of the data from which this point comes. g.getValue(row, col) will return the original y-value for this point. This can be used to get the full confidence interval for the point, or access un-rolled values for the point."]] + }, + "annotationMouseOverHandler": { + "default": "null", + "labels": ["Annotations"], + "type": "function(annotation, point, dygraph, event)", + "description": "If provided, this function is called whenever the user mouses over an annotation." + }, + "annotationMouseOutHandler": { + "default": "null", + "labels": ["Annotations"], + "type": "function(annotation, point, dygraph, event)", + "parameters": [["annotation", "the annotation left"], ["point", "the point associated with the annotation"], ["dygraph", "the reference graph"], ["event", "the mouse event"]], + "description": "If provided, this function is called whenever the user mouses out of an annotation." + }, + "annotationClickHandler": { + "default": "null", + "labels": ["Annotations"], + "type": "function(annotation, point, dygraph, event)", + "parameters": [["annotation", "the annotation left"], ["point", "the point associated with the annotation"], ["dygraph", "the reference graph"], ["event", "the mouse event"]], + "description": "If provided, this function is called whenever the user clicks on an annotation." + }, + "annotationDblClickHandler": { + "default": "null", + "labels": ["Annotations"], + "type": "function(annotation, point, dygraph, event)", + "parameters": [["annotation", "the annotation left"], ["point", "the point associated with the annotation"], ["dygraph", "the reference graph"], ["event", "the mouse event"]], + "description": "If provided, this function is called whenever the user double-clicks on an annotation." + }, + "drawCallback": { + "default": "null", + "labels": ["Callbacks"], + "type": "function(dygraph, is_initial)", + "parameters": [["dygraph", "The graph being drawn"], ["is_initial", "True if this is the initial draw, false for subsequent draws."]], + "description": "When set, this callback gets called every time the dygraph is drawn. This includes the initial draw, after zooming and repeatedly while panning." + }, + "labelsKMG2": { + "default": "false", + "labels": ["Value display/formatting"], + "type": "boolean", + "description": "Show k/M/G for kilo/Mega/Giga on y-axis. This is different than labelsKMB in that it uses base 2, not 10." + }, + "delimiter": { + "default": ",", + "labels": ["CSV parsing"], + "type": "string", + "description": "The delimiter to look for when separating fields of a CSV file. Setting this to a tab is not usually necessary, since tab-delimited data is auto-detected." + }, + "axisLabelFontSize": { + "default": "14", + "labels": ["Axis display"], + "type": "integer", + "description": "Size of the font (in pixels) to use in the axis labels, both x- and y-axis." + }, + "underlayCallback": { + "default": "null", + "labels": ["Callbacks"], + "type": "function(context, area, dygraph)", + "parameters": [["context", "the canvas drawing context on which to draw"], ["area", "An object with {x,y,w,h} properties describing the drawing area."], ["dygraph", "the reference graph"]], + "description": "When set, this callback gets called before the chart is drawn. It details on how to use this." + }, + "width": { + "default": "480", + "labels": ["Overall display"], + "type": "integer", + "description": "Width, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored." + }, + "pixelRatio": { + "default": "(devicePixelRatio / context.backingStoreRatio)", + "labels": ["Overall display"], + "type": "float", + "description": "Overrides the pixel ratio scaling factor for the canvas's 2d context. Ordinarily, this is set to the devicePixelRatio / (context.backingStoreRatio || 1), so on mobile devices, where the devicePixelRatio can be somewhere around 3, performance can be improved by overriding this value to something less precise, like 1, at the expense of resolution." + }, + "interactionModel": { + "default": "...", + "labels": ["Interactive Elements"], + "type": "Object", + "description": "TODO(konigsberg): document this" + }, + "ticker": { + "default": "Dygraph.dateTicker or Dygraph.numericTicks", + "labels": ["Axis display"], + "type": "function(min, max, pixels, opts, dygraph, vals) -> [{v: ..., label: ...}, ...]", + "parameters": [["min", ""], ["max", ""], ["pixels", ""], ["opts", ""], ["dygraph", "the reference graph"], ["vals", ""]], + "description": "This lets you specify an arbitrary function to generate tick marks on an axis. The tick marks are an array of (value, label) pairs. The built-in functions go to great lengths to choose good tick marks so, if you set this option, you'll most likely want to call one of them and modify the result. See dygraph-tickers.js for an extensive discussion. This is set on a per-axis basis." + }, + "xAxisHeight": { + "default": "(null)", + "labels": ["Axis display"], + "type": "integer", + "description": "Height, in pixels, of the x-axis. If not set explicitly, this is computed based on axisLabelFontSize and axisTickSize." + }, + "showLabelsOnHighlight": { + "default": "true", + "labels": ["Interactive Elements", "Legend"], + "type": "boolean", + "description": "Whether to show the legend upon mouseover." + }, + "axis": { + "default": "(none)", + "labels": ["Axis display"], + "type": "string", + "description": "Set to either 'y1' or 'y2' to assign a series to a y-axis (primary or secondary). Must be set per-series." + }, + "pixelsPerLabel": { + "default": "70 (x-axis) or 30 (y-axes)", + "labels": ["Axis display", "Grid"], + "type": "integer", + "description": "Number of pixels to require between each x- and y-label. Larger values will yield a sparser axis with fewer ticks. This is set on a per-axis basis." + }, + "labelsDiv": { + "default": "null", + "labels": ["Legend"], + "type": "DOM element or string", + "example": "document.getElementById('foo')or'foo'", + "description": "Show data labels in an external div, rather than on the graph. This value can either be a div element or a div id." + }, + "fractions": { + "default": "false", + "labels": ["CSV parsing", "Error Bars"], + "type": "boolean", + "description": "When set, attempt to parse each cell in the CSV file as \"a/b\", where a and b are integers. The ratio will be plotted. This allows computation of Wilson confidence intervals (see below)." + }, + "logscale": { + "default": "false", + "labels": ["Axis display"], + "type": "boolean", + "description": "When set for the y-axis or x-axis, the graph shows that axis in log scale. Any values less than or equal to zero are not displayed. Showing log scale with ranges that go below zero will result in an unviewable graph.\n\n Not compatible with showZero. connectSeparatedPoints is ignored. This is ignored for date-based x-axes." + }, + "strokeWidth": { + "default": "1.0", + "labels": ["Data Line display"], + "type": "float", + "example": "0.5, 2.0", + "description": "The width of the lines connecting data points. This can be used to increase the contrast or some graphs." + }, + "strokePattern": { + "default": "null", + "labels": ["Data Line display"], + "type": "array", + "example": "[10, 2, 5, 2]", + "description": "A custom pattern array where the even index is a draw and odd is a space in pixels. If null then it draws a solid line. The array should have a even length as any odd lengthed array could be expressed as a smaller even length array. This is used to create dashed lines." + }, + "strokeBorderWidth": { + "default": "null", + "labels": ["Data Line display"], + "type": "float", + "example": "1.0", + "description": "Draw a border around graph lines to make crossing lines more easily distinguishable. Useful for graphs with many lines." + }, + "strokeBorderColor": { + "default": "white", + "labels": ["Data Line display"], + "type": "string", + "example": "red, #ccffdd", + "description": "Color for the line border used if strokeBorderWidth is set." + }, + "wilsonInterval": { + "default": "true", + "labels": ["Error Bars"], + "type": "boolean", + "description": "Use in conjunction with the \"fractions\" option. Instead of plotting +/- N standard deviations, dygraphs will compute a Wilson confidence interval and plot that. This has more reasonable behavior for ratios close to 0 or 1." + }, + "fillGraph": { + "default": "false", + "labels": ["Data Line display"], + "type": "boolean", + "description": "Should the area underneath the graph be filled? This option is not compatible with error bars. This may be set on a per-series basis." + }, + "highlightCircleSize": { + "default": "3", + "labels": ["Interactive Elements"], + "type": "integer", + "description": "The size in pixels of the dot drawn over highlighted points." + }, + "gridLineColor": { + "default": "rgb(128,128,128)", + "labels": ["Grid"], + "type": "red, blue", + "description": "The color of the gridlines. This may be set on a per-axis basis to define each axis' grid separately." + }, + "gridLinePattern": { + "default": "null", + "labels": ["Grid"], + "type": "array", + "example": "[10, 2, 5, 2]", + "description": "A custom pattern array where the even index is a draw and odd is a space in pixels. If null then it draws a solid line. The array should have a even length as any odd lengthed array could be expressed as a smaller even length array. This is used to create dashed gridlines." + }, + "visibility": { + "default": "[true, true, ...]", + "labels": ["Data Line display"], + "type": "Array of booleans", + "description": "Which series should initially be visible? Once the Dygraph has been constructed, you can access and modify the visibility of each series using the visibility and setVisibility methods." + }, + "valueRange": { + "default": "Full range of the input is shown", + "labels": ["Axis display"], + "type": "Array of two numbers", + "example": "[10, 110]", + "description": "Explicitly set the vertical range of the graph to [low, high]. This may be set on a per-axis basis to define each y-axis separately. If either limit is unspecified, it will be calculated automatically (e.g. [null, 30] to automatically calculate just the lower bound)" + }, + "colorSaturation": { + "default": "1.0", + "labels": ["Data Series Colors"], + "type": "float (0.0 - 1.0)", + "description": "If colors is not specified, saturation of the automatically-generated data series colors." + }, + "hideOverlayOnMouseOut": { + "default": "true", + "labels": ["Interactive Elements", "Legend"], + "type": "boolean", + "description": "Whether to hide the legend when the mouse leaves the chart area." + }, + "legend": { + "default": "onmouseover", + "labels": ["Legend"], + "type": "string", + "description": "When to display the legend. By default, it only appears when a user mouses over the chart. Set it to \"always\" to always display a legend of some sort. When set to \"follow\", legend follows highlighted points." + }, + "legendFormatter": { + "default": "null", + "labels": ["Legend"], + "type": "function(data): string", + "params": [["data", "An object containing information about the selection (or lack of a selection). This includes formatted values and series information. See here for sample values."]], + "description": "Set this to supply a custom formatter for the legend. See this comment and the legendFormatter demo for usage." + }, + "labelsShowZeroValues": { + "default": "true", + "labels": ["Legend"], + "type": "boolean", + "description": "Show zero value labels in the labelsDiv." + }, + "stepPlot": { + "default": "false", + "labels": ["Data Line display"], + "type": "boolean", + "description": "When set, display the graph as a step plot instead of a line plot. This option may either be set for the whole graph or for single series." + }, + "labelsUTC": { + "default": "false", + "labels": ["Value display/formatting", "Axis display"], + "type": "boolean", + "description": "Show date/time labels according to UTC (instead of local time)." + }, + "labelsKMB": { + "default": "false", + "labels": ["Value display/formatting"], + "type": "boolean", + "description": "Show K/M/B for thousands/millions/billions on y-axis." + }, + "rightGap": { + "default": "5", + "labels": ["Overall display"], + "type": "integer", + "description": "Number of pixels to leave blank at the right edge of the Dygraph. This makes it easier to highlight the right-most data point." + }, + "drawAxesAtZero": { + "default": "false", + "labels": ["Axis display"], + "type": "boolean", + "description": "When set, draw the X axis at the Y=0 position and the Y axis at the X=0 position if those positions are inside the graph's visible area. Otherwise, draw the axes at the bottom or left graph edge as usual." + }, + "xRangePad": { + "default": "0", + "labels": ["Axis display"], + "type": "float", + "description": "Add the specified amount of extra space (in pixels) around the X-axis value range to ensure points at the edges remain visible." + }, + "yRangePad": { + "default": "null", + "labels": ["Axis display"], + "type": "float", + "description": "If set, add the specified amount of extra space (in pixels) around the Y-axis value range to ensure points at the edges remain visible. If unset, use the traditional Y padding algorithm." + }, + "axisLabelFormatter": { + "default": "Depends on the data type", + "labels": ["Axis display"], + "type": "function(number or Date, granularity, opts, dygraph)", + "parameters": [["number or date", "Either a number (for a numeric axis) or a Date object (for a date axis)"], ["granularity", "specifies how fine-grained the axis is. For date axes, this is a reference to the time granularity enumeration, defined in dygraph-tickers.js, e.g. Dygraph.WEEKLY."], ["opts", "a function which provides access to various options on the dygraph, e.g. opts('labelsKMB')."], ["dygraph", "the referenced graph"]], + "description": "Function to call to format the tick values that appear along an axis. This is usually set on a per-axis basis." + }, + "clickCallback": { + "snippet": "function(e, date_millis){
  alert(new Date(date_millis));
}", + "default": "null", + "labels": ["Callbacks"], + "type": "function(e, x, points)", + "parameters": [["e", "The event object for the click"], ["x", "The x value that was clicked (for dates, this is milliseconds since epoch)"], ["points", "The closest points along that date. See Point properties for details."]], + "description": "A function to call when the canvas is clicked." + }, + "labels": { + "default": "[\"X\", \"Y1\", \"Y2\", ...]*", + "labels": ["Legend"], + "type": "array", + "description": "A name for each data series, including the independent (X) series. For CSV files and DataTable objections, this is determined by context. For raw data, this must be specified. If it is not, default values are supplied and a warning is logged." + }, + "dateWindow": { + "default": "Full range of the input is shown", + "labels": ["Axis display"], + "type": "Array of two numbers", + "example": "[
  Date.parse('2006-01-01'),
  (new Date()).valueOf()
]", + "description": "Initially zoom in on a section of the graph. Is of the form [earliest, latest], where earliest/latest are milliseconds since epoch. If the data for the x-axis is numeric, the values in dateWindow must also be numbers." + }, + "showRoller": { + "default": "false", + "labels": ["Interactive Elements", "Rolling Averages"], + "type": "boolean", + "description": "If the rolling average period text box should be shown." + }, + "sigma": { + "default": "2.0", + "labels": ["Error Bars"], + "type": "float", + "description": "When errorBars is set, shade this many standard deviations above/below each point." + }, + "customBars": { + "default": "false", + "labels": ["CSV parsing", "Error Bars"], + "type": "boolean", + "description": "When set, parse each CSV cell as \"low;middle;high\". Error bars will be drawn for each point between low and high, with the series itself going through middle." + }, + "colorValue": { + "default": "1.0", + "labels": ["Data Series Colors"], + "type": "float (0.0 - 1.0)", + "description": "If colors is not specified, value of the data series colors, as in hue/saturation/value. (0.0-1.0, default 0.5)" + }, + "errorBars": { + "default": "false", + "labels": ["CSV parsing", "Error Bars"], + "type": "boolean", + "description": "Does the data contain standard deviations? Setting this to true alters the input format (see above)." + }, + "displayAnnotations": { + "default": "false", + "labels": ["Annotations"], + "type": "boolean", + "description": "Only applies when Dygraphs is used as a GViz chart. Causes string columns following a data series to be interpreted as annotations on points in that series. This is the same format used by Google's AnnotatedTimeLine chart." + }, + "panEdgeFraction": { + "default": "null", + "labels": ["Axis display", "Interactive Elements"], + "type": "float", + "description": "A value representing the farthest a graph may be panned, in percent of the display. For example, a value of 0.1 means that the graph can only be panned 10% passed the edges of the displayed values. null means no bounds." + }, + "title": { + "labels": ["Chart labels"], + "type": "string", + "default": "null", + "description": "Text to display above the chart. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-title' classes." + }, + "titleHeight": { + "default": "18", + "labels": ["Chart labels"], + "type": "integer", + "description": "Height of the chart title, in pixels. This also controls the default font size of the title. If you style the title on your own, this controls how much space is set aside above the chart for the title's div." + }, + "xlabel": { + "labels": ["Chart labels"], + "type": "string", + "default": "null", + "description": "Text to display below the chart's x-axis. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-xlabel' classes." + }, + "xLabelHeight": { + "labels": ["Chart labels"], + "type": "integer", + "default": "18", + "description": "Height of the x-axis label, in pixels. This also controls the default font size of the x-axis label. If you style the label on your own, this controls how much space is set aside below the chart for the x-axis label's div." + }, + "ylabel": { + "labels": ["Chart labels"], + "type": "string", + "default": "null", + "description": "Text to display to the left of the chart's y-axis. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-ylabel' classes. The text will be rotated 90 degrees by default, so CSS rules may behave in unintuitive ways. No additional space is set aside for a y-axis label. If you need more space, increase the width of the y-axis tick labels using the yAxisLabelWidth option. If you need a wider div for the y-axis label, either style it that way with CSS (but remember that it's rotated, so width is controlled by the 'height' property) or set the yLabelWidth option." + }, + "y2label": { + "labels": ["Chart labels"], + "type": "string", + "default": "null", + "description": "Text to display to the right of the chart's secondary y-axis. This label is only displayed if a secondary y-axis is present. See this test for an example of how to do this. The comments for the 'ylabel' option generally apply here as well. This label gets a 'dygraph-y2label' instead of a 'dygraph-ylabel' class." + }, + "yLabelWidth": { + "labels": ["Chart labels"], + "type": "integer", + "default": "18", + "description": "Width of the div which contains the y-axis label. Since the y-axis label appears rotated 90 degrees, this actually affects the height of its div." + }, + "drawGrid": { + "default": "true for x and y, false for y2", + "labels": ["Grid"], + "type": "boolean", + "description": "Whether to display gridlines in the chart. This may be set on a per-axis basis to define the visibility of each axis' grid separately." + }, + "independentTicks": { + "default": "true for y, false for y2", + "labels": ["Axis display", "Grid"], + "type": "boolean", + "description": "Only valid for y and y2, has no effect on x: This option defines whether the y axes should align their ticks or if they should be independent. Possible combinations: 1.) y=true, y2=false (default): y is the primary axis and the y2 ticks are aligned to the the ones of y. (only 1 grid) 2.) y=false, y2=true: y2 is the primary axis and the y ticks are aligned to the the ones of y2. (only 1 grid) 3.) y=true, y2=true: Both axis are independent and have their own ticks. (2 grids) 4.) y=false, y2=false: Invalid configuration causes an error." + }, + "drawAxis": { + "default": "true for x and y, false for y2", + "labels": ["Axis display"], + "type": "boolean", + "description": "Whether to draw the specified axis. This may be set on a per-axis basis to define the visibility of each axis separately. Setting this to false also prevents axis ticks from being drawn and reclaims the space for the chart grid/lines." + }, + "gridLineWidth": { + "default": "0.3", + "labels": ["Grid"], + "type": "float", + "description": "Thickness (in pixels) of the gridlines drawn under the chart. The vertical/horizontal gridlines can be turned off entirely by using the drawGrid option. This may be set on a per-axis basis to define each axis' grid separately." + }, + "axisLineWidth": { + "default": "0.3", + "labels": ["Axis display"], + "type": "float", + "description": "Thickness (in pixels) of the x- and y-axis lines." + }, + "axisLineColor": { + "default": "black", + "labels": ["Axis display"], + "type": "string", + "description": "Color of the x- and y-axis lines. Accepts any value which the HTML canvas strokeStyle attribute understands, e.g. 'black' or 'rgb(0, 100, 255)'." + }, + "fillAlpha": { + "default": "0.15", + "labels": ["Error Bars", "Data Series Colors"], + "type": "float (0.0 - 1.0)", + "description": "Error bars (or custom bars) for each series are drawn in the same color as the series, but with partial transparency. This sets the transparency. A value of 0.0 means that the error bars will not be drawn, whereas a value of 1.0 means that the error bars will be as dark as the line for the series itself. This can be used to produce chart lines whose thickness varies at each point." + }, + "axisLabelWidth": { + "default": "50 (y-axis), 60 (x-axis)", + "labels": ["Axis display", "Chart labels"], + "type": "integer", + "description": "Width (in pixels) of the containing divs for x- and y-axis labels. For the y-axis, this also controls the width of the y-axis. Note that for the x-axis, this is independent from pixelsPerLabel, which controls the spacing between labels." + }, + "sigFigs": { + "default": "null", + "labels": ["Value display/formatting"], + "type": "integer", + "description": "By default, dygraphs displays numbers with a fixed number of digits after the decimal point. If you'd prefer to have a fixed number of significant figures, set this option to that number of sig figs. A value of 2, for instance, would cause 1 to be display as 1.0 and 1234 to be displayed as 1.23e+3." + }, + "digitsAfterDecimal": { + "default": "2", + "labels": ["Value display/formatting"], + "type": "integer", + "description": "Unless it's run in scientific mode (see the sigFigs option), dygraphs displays numbers with digitsAfterDecimal digits after the decimal point. Trailing zeros are not displayed, so with a value of 2 you'll get '0', '0.1', '0.12', '123.45' but not '123.456' (it will be rounded to '123.46'). Numbers with absolute value less than 0.1^digitsAfterDecimal (i.e. those which would show up as '0.00') will be displayed in scientific notation." + }, + "maxNumberWidth": { + "default": "6", + "labels": ["Value display/formatting"], + "type": "integer", + "description": "When displaying numbers in normal (not scientific) mode, large numbers will be displayed with many trailing zeros (e.g. 100000000 instead of 1e9). This can lead to unwieldy y-axis labels. If there are more than maxNumberWidth digits to the left of the decimal in a number, dygraphs will switch to scientific notation, even when not operating in scientific mode. If you'd like to see all those digits, set this to something large, like 20 or 30." + }, + "file": { + "default": "(set when constructed)", + "labels": ["Data"], + "type": "string (URL of CSV or CSV), GViz DataTable or 2D Array", + "description": "Sets the data being displayed in the chart. This can only be set when calling updateOptions; it cannot be set from the constructor. For a full description of valid data formats, see the Data Formats page." + }, + "timingName": { + "default": "null", + "labels": ["Debugging", "Deprecated"], + "type": "string", + "description": "Set this option to log timing information. The value of the option will be logged along with the timimg, so that you can distinguish multiple dygraphs on the same page." + }, + "showRangeSelector": { + "default": "false", + "labels": ["Range Selector"], + "type": "boolean", + "description": "Show or hide the range selector widget." + }, + "rangeSelectorHeight": { + "default": "40", + "labels": ["Range Selector"], + "type": "integer", + "description": "Height, in pixels, of the range selector widget. This option can only be specified at Dygraph creation time." + }, + "rangeSelectorPlotStrokeColor": { + "default": "#808FAB", + "labels": ["Range Selector"], + "type": "string", + "description": "The range selector mini plot stroke color. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\". You can also specify null or \"\" to turn off stroke." + }, + "rangeSelectorPlotFillColor": { + "default": "#A7B1C4", + "labels": ["Range Selector"], + "type": "string", + "description": "The range selector mini plot fill color. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\". You can also specify null or \"\" to turn off fill." + }, + "rangeSelectorPlotFillGradientColor": { + "default": "white", + "labels": ["Range Selector"], + "type": "string", + "description": "The top color for the range selector mini plot fill color gradient. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"rgba(255,100,200,42)\" or \"yellow\". You can also specify null or \"\" to disable the gradient and fill with one single color." + }, + "rangeSelectorBackgroundStrokeColor": { + "default": "gray", + "labels": ["Range Selector"], + "type": "string", + "description": "The color of the lines below and on both sides of the range selector mini plot. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\"." + }, + "rangeSelectorBackgroundLineWidth": { + "default": "1", + "labels": ["Range Selector"], + "type": "float", + "description": "The width of the lines below and on both sides of the range selector mini plot." + }, + "rangeSelectorPlotLineWidth": { + "default": "1.5", + "labels": ["Range Selector"], + "type": "float", + "description": "The width of the range selector mini plot line." + }, + "rangeSelectorForegroundStrokeColor": { + "default": "black", + "labels": ["Range Selector"], + "type": "string", + "description": "The color of the lines in the interactive layer of the range selector. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\"." + }, + "rangeSelectorForegroundLineWidth": { + "default": "1", + "labels": ["Range Selector"], + "type": "float", + "description": "The width the lines in the interactive layer of the range selector." + }, + "rangeSelectorAlpha": { + "default": "0.6", + "labels": ["Range Selector"], + "type": "float (0.0 - 1.0)", + "description": "The transparency of the veil that is drawn over the unselected portions of the range selector mini plot. A value of 0 represents full transparency and the unselected portions of the mini plot will appear as normal. A value of 1 represents full opacity and the unselected portions of the mini plot will be hidden." + }, + "showInRangeSelector": { + "default": "null", + "labels": ["Range Selector"], + "type": "boolean", + "description": "Mark this series for inclusion in the range selector. The mini plot curve will be an average of all such series. If this is not specified for any series, the default behavior is to average all the visible series. Setting it for one series will result in that series being charted alone in the range selector. Once it's set for a single series, it needs to be set for all series which should be included (regardless of visibility)." + }, + "animatedZooms": { + "default": "false", + "labels": ["Interactive Elements"], + "type": "boolean", + "description": "Set this option to animate the transition between zoom windows. Applies to programmatic and interactive zooms. Note that if you also set a drawCallback, it will be called several times on each zoom. If you set a zoomCallback, it will only be called after the animation is complete." + }, + "plotter": { + "default": "[DygraphCanvasRenderer.Plotters.fillPlotter, DygraphCanvasRenderer.Plotters.errorPlotter, DygraphCanvasRenderer.Plotters.linePlotter]", + "labels": ["Data Line display"], + "type": "array or function", + "description": "A function (or array of functions) which plot each data series on the chart. TODO(danvk): more details! May be set per-series." + }, + "axes": { + "default": "null", + "labels": ["Configuration"], + "type": "Object", + "description": "Defines per-axis options. Valid keys are 'x', 'y' and 'y2'. Only some options may be set on a per-axis basis. If an option may be set in this way, it will be noted on this page. See also documentation on per-series and per-axis options." + }, + "series": { + "default": "null", + "labels": ["Series"], + "type": "Object", + "description": "Defines per-series options. Its keys match the y-axis label names, and the values are dictionaries themselves that contain options specific to that series." + }, + "plugins": { + "default": "[]", + "labels": ["Configuration"], + "type": "Array", + "description": "Defines per-graph plugins. Useful for per-graph customization" + }, + "dataHandler": { + "default": "(depends on data)", + "labels": ["Data"], + "type": "Dygraph.DataHandler", + "description": "Custom DataHandler. This is an advanced customization. See http://bit.ly/151E7Aq." + } + }; //
+ // NOTE: in addition to parsing as JS, this snippet is expected to be valid + // JSON. This assumption cannot be checked in JS, but it will be checked when + // documentation is generated by the generate-documentation.py script. For the + // most part, this just means that you should always use double quotes. + + // Do a quick sanity check on the options reference. + var warn = function warn(msg) { + if (window.console) window.console.warn(msg); + }; + var flds = ['type', 'default', 'description']; + var valid_cats = ['Annotations', 'Axis display', 'Chart labels', 'CSV parsing', 'Callbacks', 'Data', 'Data Line display', 'Data Series Colors', 'Error Bars', 'Grid', 'Interactive Elements', 'Range Selector', 'Legend', 'Overall display', 'Rolling Averages', 'Series', 'Value display/formatting', 'Zooming', 'Debugging', 'Configuration', 'Deprecated']; + var i; + var cats = {}; + for (i = 0; i < valid_cats.length; i++) cats[valid_cats[i]] = true; + + for (var k in OPTIONS_REFERENCE) { + if (!OPTIONS_REFERENCE.hasOwnProperty(k)) continue; + var op = OPTIONS_REFERENCE[k]; + for (i = 0; i < flds.length; i++) { + if (!op.hasOwnProperty(flds[i])) { + warn('Option ' + k + ' missing "' + flds[i] + '" property'); + } else if (typeof op[flds[i]] != 'string') { + warn(k + '.' + flds[i] + ' must be of type string'); + } + } + var labels = op.labels; + if (typeof labels !== 'object') { + warn('Option "' + k + '" is missing a "labels": [...] option'); + } else { + for (i = 0; i < labels.length; i++) { + if (!cats.hasOwnProperty(labels[i])) { + warn('Option "' + k + '" has label "' + labels[i] + '", which is invalid.'); + } + } + } + } + } +} + +exports['default'] = OPTIONS_REFERENCE; +module.exports = exports['default']; + +}).call(this,require('_process')) + +},{"_process":1}],15:[function(require,module,exports){ +(function (process){ +/** + * @license + * Copyright 2011 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview DygraphOptions is responsible for parsing and returning + * information about options. + */ + +// TODO: remove this jshint directive & fix the warnings. +/*jshint sub:true */ +"use strict"; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } + +var _dygraphUtils = require('./dygraph-utils'); + +var utils = _interopRequireWildcard(_dygraphUtils); + +var _dygraphDefaultAttrs = require('./dygraph-default-attrs'); + +var _dygraphDefaultAttrs2 = _interopRequireDefault(_dygraphDefaultAttrs); + +var _dygraphOptionsReference = require('./dygraph-options-reference'); + +var _dygraphOptionsReference2 = _interopRequireDefault(_dygraphOptionsReference); + +/* + * Interesting member variables: (REMOVING THIS LIST AS I CLOSURIZE) + * global_ - global attributes (common among all graphs, AIUI) + * user - attributes set by the user + * series_ - { seriesName -> { idx, yAxis, options }} + */ + +/** + * This parses attributes into an object that can be easily queried. + * + * It doesn't necessarily mean that all options are available, specifically + * if labels are not yet available, since those drive details of the per-series + * and per-axis options. + * + * @param {Dygraph} dygraph The chart to which these options belong. + * @constructor + */ +var DygraphOptions = function DygraphOptions(dygraph) { + /** + * The dygraph. + * @type {!Dygraph} + */ + this.dygraph_ = dygraph; + + /** + * Array of axis index to { series : [ series names ] , options : { axis-specific options. } + * @type {Array.<{series : Array., options : Object}>} @private + */ + this.yAxes_ = []; + + /** + * Contains x-axis specific options, which are stored in the options key. + * This matches the yAxes_ object structure (by being a dictionary with an + * options element) allowing for shared code. + * @type {options: Object} @private + */ + this.xAxis_ = {}; + this.series_ = {}; + + // Once these two objects are initialized, you can call get(); + this.global_ = this.dygraph_.attrs_; + this.user_ = this.dygraph_.user_attrs_ || {}; + + /** + * A list of series in columnar order. + * @type {Array.} + */ + this.labels_ = []; + + this.highlightSeries_ = this.get("highlightSeriesOpts") || {}; + this.reparseSeries(); +}; + +/** + * Not optimal, but does the trick when you're only using two axes. + * If we move to more axes, this can just become a function. + * + * @type {Object.} + * @private + */ +DygraphOptions.AXIS_STRING_MAPPINGS_ = { + 'y': 0, + 'Y': 0, + 'y1': 0, + 'Y1': 0, + 'y2': 1, + 'Y2': 1 +}; + +/** + * @param {string|number} axis + * @private + */ +DygraphOptions.axisToIndex_ = function (axis) { + if (typeof axis == "string") { + if (DygraphOptions.AXIS_STRING_MAPPINGS_.hasOwnProperty(axis)) { + return DygraphOptions.AXIS_STRING_MAPPINGS_[axis]; + } + throw "Unknown axis : " + axis; + } + if (typeof axis == "number") { + if (axis === 0 || axis === 1) { + return axis; + } + throw "Dygraphs only supports two y-axes, indexed from 0-1."; + } + if (axis) { + throw "Unknown axis : " + axis; + } + // No axis specification means axis 0. + return 0; +}; + +/** + * Reparses options that are all related to series. This typically occurs when + * options are either updated, or source data has been made available. + * + * TODO(konigsberg): The method name is kind of weak; fix. + */ +DygraphOptions.prototype.reparseSeries = function () { + var labels = this.get("labels"); + if (!labels) { + return; // -- can't do more for now, will parse after getting the labels. + } + + this.labels_ = labels.slice(1); + + this.yAxes_ = [{ series: [], options: {} }]; // Always one axis at least. + this.xAxis_ = { options: {} }; + this.series_ = {}; + + // Series are specified in the series element: + // + // { + // labels: [ "X", "foo", "bar" ], + // pointSize: 3, + // series : { + // foo : {}, // options for foo + // bar : {} // options for bar + // } + // } + // + // So, if series is found, it's expected to contain per-series data, otherwise set a + // default. + var seriesDict = this.user_.series || {}; + for (var idx = 0; idx < this.labels_.length; idx++) { + var seriesName = this.labels_[idx]; + var optionsForSeries = seriesDict[seriesName] || {}; + var yAxis = DygraphOptions.axisToIndex_(optionsForSeries["axis"]); + + this.series_[seriesName] = { + idx: idx, + yAxis: yAxis, + options: optionsForSeries }; + + if (!this.yAxes_[yAxis]) { + this.yAxes_[yAxis] = { series: [seriesName], options: {} }; + } else { + this.yAxes_[yAxis].series.push(seriesName); + } + } + + var axis_opts = this.user_["axes"] || {}; + utils.update(this.yAxes_[0].options, axis_opts["y"] || {}); + if (this.yAxes_.length > 1) { + utils.update(this.yAxes_[1].options, axis_opts["y2"] || {}); + } + utils.update(this.xAxis_.options, axis_opts["x"] || {}); + + // For "production" code, this gets removed by uglifyjs. + if (typeof process !== 'undefined') { + if ("development" != 'production') { + this.validateOptions_(); + } + } +}; + +/** + * Get a global value. + * + * @param {string} name the name of the option. + */ +DygraphOptions.prototype.get = function (name) { + var result = this.getGlobalUser_(name); + if (result !== null) { + return result; + } + return this.getGlobalDefault_(name); +}; + +DygraphOptions.prototype.getGlobalUser_ = function (name) { + if (this.user_.hasOwnProperty(name)) { + return this.user_[name]; + } + return null; +}; + +DygraphOptions.prototype.getGlobalDefault_ = function (name) { + if (this.global_.hasOwnProperty(name)) { + return this.global_[name]; + } + if (_dygraphDefaultAttrs2['default'].hasOwnProperty(name)) { + return _dygraphDefaultAttrs2['default'][name]; + } + return null; +}; + +/** + * Get a value for a specific axis. If there is no specific value for the axis, + * the global value is returned. + * + * @param {string} name the name of the option. + * @param {string|number} axis the axis to search. Can be the string representation + * ("y", "y2") or the axis number (0, 1). + */ +DygraphOptions.prototype.getForAxis = function (name, axis) { + var axisIdx; + var axisString; + + // Since axis can be a number or a string, straighten everything out here. + if (typeof axis == 'number') { + axisIdx = axis; + axisString = axisIdx === 0 ? "y" : "y2"; + } else { + if (axis == "y1") { + axis = "y"; + } // Standardize on 'y'. Is this bad? I think so. + if (axis == "y") { + axisIdx = 0; + } else if (axis == "y2") { + axisIdx = 1; + } else if (axis == "x") { + axisIdx = -1; // simply a placeholder for below. + } else { + throw "Unknown axis " + axis; + } + axisString = axis; + } + + var userAxis = axisIdx == -1 ? this.xAxis_ : this.yAxes_[axisIdx]; + + // Search the user-specified axis option first. + if (userAxis) { + // This condition could be removed if we always set up this.yAxes_ for y2. + var axisOptions = userAxis.options; + if (axisOptions.hasOwnProperty(name)) { + return axisOptions[name]; + } + } + + // User-specified global options second. + // But, hack, ignore globally-specified 'logscale' for 'x' axis declaration. + if (!(axis === 'x' && name === 'logscale')) { + var result = this.getGlobalUser_(name); + if (result !== null) { + return result; + } + } + // Default axis options third. + var defaultAxisOptions = _dygraphDefaultAttrs2['default'].axes[axisString]; + if (defaultAxisOptions.hasOwnProperty(name)) { + return defaultAxisOptions[name]; + } + + // Default global options last. + return this.getGlobalDefault_(name); +}; + +/** + * Get a value for a specific series. If there is no specific value for the series, + * the value for the axis is returned (and afterwards, the global value.) + * + * @param {string} name the name of the option. + * @param {string} series the series to search. + */ +DygraphOptions.prototype.getForSeries = function (name, series) { + // Honors indexes as series. + if (series === this.dygraph_.getHighlightSeries()) { + if (this.highlightSeries_.hasOwnProperty(name)) { + return this.highlightSeries_[name]; + } + } + + if (!this.series_.hasOwnProperty(series)) { + throw "Unknown series: " + series; + } + + var seriesObj = this.series_[series]; + var seriesOptions = seriesObj["options"]; + if (seriesOptions.hasOwnProperty(name)) { + return seriesOptions[name]; + } + + return this.getForAxis(name, seriesObj["yAxis"]); +}; + +/** + * Returns the number of y-axes on the chart. + * @return {number} the number of axes. + */ +DygraphOptions.prototype.numAxes = function () { + return this.yAxes_.length; +}; + +/** + * Return the y-axis for a given series, specified by name. + */ +DygraphOptions.prototype.axisForSeries = function (series) { + return this.series_[series].yAxis; +}; + +/** + * Returns the options for the specified axis. + */ +// TODO(konigsberg): this is y-axis specific. Support the x axis. +DygraphOptions.prototype.axisOptions = function (yAxis) { + return this.yAxes_[yAxis].options; +}; + +/** + * Return the series associated with an axis. + */ +DygraphOptions.prototype.seriesForAxis = function (yAxis) { + return this.yAxes_[yAxis].series; +}; + +/** + * Return the list of all series, in their columnar order. + */ +DygraphOptions.prototype.seriesNames = function () { + return this.labels_; +}; + +// For "production" code, this gets removed by uglifyjs. +if (typeof process !== 'undefined') { + if ("development" != 'production') { + + /** + * Validate all options. + * This requires OPTIONS_REFERENCE, which is only available in debug builds. + * @private + */ + DygraphOptions.prototype.validateOptions_ = function () { + if (typeof _dygraphOptionsReference2['default'] === 'undefined') { + throw 'Called validateOptions_ in prod build.'; + } + + var that = this; + var validateOption = function validateOption(optionName) { + if (!_dygraphOptionsReference2['default'][optionName]) { + that.warnInvalidOption_(optionName); + } + }; + + var optionsDicts = [this.xAxis_.options, this.yAxes_[0].options, this.yAxes_[1] && this.yAxes_[1].options, this.global_, this.user_, this.highlightSeries_]; + var names = this.seriesNames(); + for (var i = 0; i < names.length; i++) { + var name = names[i]; + if (this.series_.hasOwnProperty(name)) { + optionsDicts.push(this.series_[name].options); + } + } + for (var i = 0; i < optionsDicts.length; i++) { + var dict = optionsDicts[i]; + if (!dict) continue; + for (var optionName in dict) { + if (dict.hasOwnProperty(optionName)) { + validateOption(optionName); + } + } + } + }; + + var WARNINGS = {}; // Only show any particular warning once. + + /** + * Logs a warning about invalid options. + * TODO: make this throw for testing + * @private + */ + DygraphOptions.prototype.warnInvalidOption_ = function (optionName) { + if (!WARNINGS[optionName]) { + WARNINGS[optionName] = true; + var isSeries = this.labels_.indexOf(optionName) >= 0; + if (isSeries) { + console.warn('Use new-style per-series options (saw ' + optionName + ' as top-level options key). See http://bit.ly/1tceaJs'); + } else { + console.warn('Unknown option ' + optionName + ' (full list of options at dygraphs.com/options.html'); + } + throw "invalid option " + optionName; + } + }; + + // Reset list of previously-shown warnings. Used for testing. + DygraphOptions.resetWarnings_ = function () { + WARNINGS = {}; + }; + } +} + +exports['default'] = DygraphOptions; +module.exports = exports['default']; + +}).call(this,require('_process')) + +},{"./dygraph-default-attrs":10,"./dygraph-options-reference":14,"./dygraph-utils":17,"_process":1}],16:[function(require,module,exports){ +/** + * @license + * Copyright 2011 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview Description of this file. + * @author danvk@google.com (Dan Vanderkam) + * + * A ticker is a function with the following interface: + * + * function(a, b, pixels, options_view, dygraph, forced_values); + * -> [ { v: tick1_v, label: tick1_label[, label_v: label_v1] }, + * { v: tick2_v, label: tick2_label[, label_v: label_v2] }, + * ... + * ] + * + * The returned value is called a "tick list". + * + * Arguments + * --------- + * + * [a, b] is the range of the axis for which ticks are being generated. For a + * numeric axis, these will simply be numbers. For a date axis, these will be + * millis since epoch (convertable to Date objects using "new Date(a)" and "new + * Date(b)"). + * + * opts provides access to chart- and axis-specific options. It can be used to + * access number/date formatting code/options, check for a log scale, etc. + * + * pixels is the length of the axis in pixels. opts('pixelsPerLabel') is the + * minimum amount of space to be allotted to each label. For instance, if + * pixels=400 and opts('pixelsPerLabel')=40 then the ticker should return + * between zero and ten (400/40) ticks. + * + * dygraph is the Dygraph object for which an axis is being constructed. + * + * forced_values is used for secondary y-axes. The tick positions are typically + * set by the primary y-axis, so the secondary y-axis has no choice in where to + * put these. It simply has to generate labels for these data values. + * + * Tick lists + * ---------- + * Typically a tick will have both a grid/tick line and a label at one end of + * that line (at the bottom for an x-axis, at left or right for the y-axis). + * + * A tick may be missing one of these two components: + * - If "label_v" is specified instead of "v", then there will be no tick or + * gridline, just a label. + * - Similarly, if "label" is not specified, then there will be a gridline + * without a label. + * + * This flexibility is useful in a few situations: + * - For log scales, some of the tick lines may be too close to all have labels. + * - For date scales where years are being displayed, it is desirable to display + * tick marks at the beginnings of years but labels (e.g. "2006") in the + * middle of the years. + */ + +/*jshint sub:true */ +/*global Dygraph:false */ +"use strict"; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } + +var _dygraphUtils = require('./dygraph-utils'); + +var utils = _interopRequireWildcard(_dygraphUtils); + +/** @typedef {Array.<{v:number, label:string, label_v:(string|undefined)}>} */ +var TickList = undefined; // the ' = undefined' keeps jshint happy. + +/** @typedef {function( + * number, + * number, + * number, + * function(string):*, + * Dygraph=, + * Array.= + * ): TickList} + */ +var Ticker = undefined; // the ' = undefined' keeps jshint happy. + +/** @type {Ticker} */ +var numericLinearTicks = function numericLinearTicks(a, b, pixels, opts, dygraph, vals) { + var nonLogscaleOpts = function nonLogscaleOpts(opt) { + if (opt === 'logscale') return false; + return opts(opt); + }; + return numericTicks(a, b, pixels, nonLogscaleOpts, dygraph, vals); +}; + +exports.numericLinearTicks = numericLinearTicks; +/** @type {Ticker} */ +var numericTicks = function numericTicks(a, b, pixels, opts, dygraph, vals) { + var pixels_per_tick = /** @type{number} */opts('pixelsPerLabel'); + var ticks = []; + var i, j, tickV, nTicks; + if (vals) { + for (i = 0; i < vals.length; i++) { + ticks.push({ v: vals[i] }); + } + } else { + // TODO(danvk): factor this log-scale block out into a separate function. + if (opts("logscale")) { + nTicks = Math.floor(pixels / pixels_per_tick); + var minIdx = utils.binarySearch(a, PREFERRED_LOG_TICK_VALUES, 1); + var maxIdx = utils.binarySearch(b, PREFERRED_LOG_TICK_VALUES, -1); + if (minIdx == -1) { + minIdx = 0; + } + if (maxIdx == -1) { + maxIdx = PREFERRED_LOG_TICK_VALUES.length - 1; + } + // Count the number of tick values would appear, if we can get at least + // nTicks / 4 accept them. + var lastDisplayed = null; + if (maxIdx - minIdx >= nTicks / 4) { + for (var idx = maxIdx; idx >= minIdx; idx--) { + var tickValue = PREFERRED_LOG_TICK_VALUES[idx]; + var pixel_coord = Math.log(tickValue / a) / Math.log(b / a) * pixels; + var tick = { v: tickValue }; + if (lastDisplayed === null) { + lastDisplayed = { + tickValue: tickValue, + pixel_coord: pixel_coord + }; + } else { + if (Math.abs(pixel_coord - lastDisplayed.pixel_coord) >= pixels_per_tick) { + lastDisplayed = { + tickValue: tickValue, + pixel_coord: pixel_coord + }; + } else { + tick.label = ""; + } + } + ticks.push(tick); + } + // Since we went in backwards order. + ticks.reverse(); + } + } + + // ticks.length won't be 0 if the log scale function finds values to insert. + if (ticks.length === 0) { + // Basic idea: + // Try labels every 1, 2, 5, 10, 20, 50, 100, etc. + // Calculate the resulting tick spacing (i.e. this.height_ / nTicks). + // The first spacing greater than pixelsPerYLabel is what we use. + // TODO(danvk): version that works on a log scale. + var kmg2 = opts("labelsKMG2"); + var mults, base; + if (kmg2) { + mults = [1, 2, 4, 8, 16, 32, 64, 128, 256]; + base = 16; + } else { + mults = [1, 2, 5, 10, 20, 50, 100]; + base = 10; + } + + // Get the maximum number of permitted ticks based on the + // graph's pixel size and pixels_per_tick setting. + var max_ticks = Math.ceil(pixels / pixels_per_tick); + + // Now calculate the data unit equivalent of this tick spacing. + // Use abs() since graphs may have a reversed Y axis. + var units_per_tick = Math.abs(b - a) / max_ticks; + + // Based on this, get a starting scale which is the largest + // integer power of the chosen base (10 or 16) that still remains + // below the requested pixels_per_tick spacing. + var base_power = Math.floor(Math.log(units_per_tick) / Math.log(base)); + var base_scale = Math.pow(base, base_power); + + // Now try multiples of the starting scale until we find one + // that results in tick marks spaced sufficiently far apart. + // The "mults" array should cover the range 1 .. base^2 to + // adjust for rounding and edge effects. + var scale, low_val, high_val, spacing; + for (j = 0; j < mults.length; j++) { + scale = base_scale * mults[j]; + low_val = Math.floor(a / scale) * scale; + high_val = Math.ceil(b / scale) * scale; + nTicks = Math.abs(high_val - low_val) / scale; + spacing = pixels / nTicks; + if (spacing > pixels_per_tick) break; + } + + // Construct the set of ticks. + // Allow reverse y-axis if it's explicitly requested. + if (low_val > high_val) scale *= -1; + for (i = 0; i <= nTicks; i++) { + tickV = low_val + i * scale; + ticks.push({ v: tickV }); + } + } + } + + var formatter = /**@type{AxisLabelFormatter}*/opts('axisLabelFormatter'); + + // Add labels to the ticks. + for (i = 0; i < ticks.length; i++) { + if (ticks[i].label !== undefined) continue; // Use current label. + // TODO(danvk): set granularity to something appropriate here. + ticks[i].label = formatter.call(dygraph, ticks[i].v, 0, opts, dygraph); + } + + return ticks; +}; + +exports.numericTicks = numericTicks; +/** @type {Ticker} */ +var dateTicker = function dateTicker(a, b, pixels, opts, dygraph, vals) { + var chosen = pickDateTickGranularity(a, b, pixels, opts); + + if (chosen >= 0) { + return getDateAxis(a, b, chosen, opts, dygraph); + } else { + // this can happen if self.width_ is zero. + return []; + } +}; + +exports.dateTicker = dateTicker; +// Time granularity enumeration +var Granularity = { + MILLISECONDLY: 0, + TWO_MILLISECONDLY: 1, + FIVE_MILLISECONDLY: 2, + TEN_MILLISECONDLY: 3, + FIFTY_MILLISECONDLY: 4, + HUNDRED_MILLISECONDLY: 5, + FIVE_HUNDRED_MILLISECONDLY: 6, + SECONDLY: 7, + TWO_SECONDLY: 8, + FIVE_SECONDLY: 9, + TEN_SECONDLY: 10, + THIRTY_SECONDLY: 11, + MINUTELY: 12, + TWO_MINUTELY: 13, + FIVE_MINUTELY: 14, + TEN_MINUTELY: 15, + THIRTY_MINUTELY: 16, + HOURLY: 17, + TWO_HOURLY: 18, + SIX_HOURLY: 19, + DAILY: 20, + TWO_DAILY: 21, + WEEKLY: 22, + MONTHLY: 23, + QUARTERLY: 24, + BIANNUAL: 25, + ANNUAL: 26, + DECADAL: 27, + CENTENNIAL: 28, + NUM_GRANULARITIES: 29 +}; + +exports.Granularity = Granularity; +// Date components enumeration (in the order of the arguments in Date) +// TODO: make this an @enum +var DateField = { + DATEFIELD_Y: 0, + DATEFIELD_M: 1, + DATEFIELD_D: 2, + DATEFIELD_HH: 3, + DATEFIELD_MM: 4, + DATEFIELD_SS: 5, + DATEFIELD_MS: 6, + NUM_DATEFIELDS: 7 +}; + +/** + * The value of datefield will start at an even multiple of "step", i.e. + * if datefield=SS and step=5 then the first tick will be on a multiple of 5s. + * + * For granularities <= HOURLY, ticks are generated every `spacing` ms. + * + * At coarser granularities, ticks are generated by incrementing `datefield` by + * `step`. In this case, the `spacing` value is only used to estimate the + * number of ticks. It should roughly correspond to the spacing between + * adjacent ticks. + * + * @type {Array.<{datefield:number, step:number, spacing:number}>} + */ +var TICK_PLACEMENT = []; +TICK_PLACEMENT[Granularity.MILLISECONDLY] = { datefield: DateField.DATEFIELD_MS, step: 1, spacing: 1 }; +TICK_PLACEMENT[Granularity.TWO_MILLISECONDLY] = { datefield: DateField.DATEFIELD_MS, step: 2, spacing: 2 }; +TICK_PLACEMENT[Granularity.FIVE_MILLISECONDLY] = { datefield: DateField.DATEFIELD_MS, step: 5, spacing: 5 }; +TICK_PLACEMENT[Granularity.TEN_MILLISECONDLY] = { datefield: DateField.DATEFIELD_MS, step: 10, spacing: 10 }; +TICK_PLACEMENT[Granularity.FIFTY_MILLISECONDLY] = { datefield: DateField.DATEFIELD_MS, step: 50, spacing: 50 }; +TICK_PLACEMENT[Granularity.HUNDRED_MILLISECONDLY] = { datefield: DateField.DATEFIELD_MS, step: 100, spacing: 100 }; +TICK_PLACEMENT[Granularity.FIVE_HUNDRED_MILLISECONDLY] = { datefield: DateField.DATEFIELD_MS, step: 500, spacing: 500 }; +TICK_PLACEMENT[Granularity.SECONDLY] = { datefield: DateField.DATEFIELD_SS, step: 1, spacing: 1000 * 1 }; +TICK_PLACEMENT[Granularity.TWO_SECONDLY] = { datefield: DateField.DATEFIELD_SS, step: 2, spacing: 1000 * 2 }; +TICK_PLACEMENT[Granularity.FIVE_SECONDLY] = { datefield: DateField.DATEFIELD_SS, step: 5, spacing: 1000 * 5 }; +TICK_PLACEMENT[Granularity.TEN_SECONDLY] = { datefield: DateField.DATEFIELD_SS, step: 10, spacing: 1000 * 10 }; +TICK_PLACEMENT[Granularity.THIRTY_SECONDLY] = { datefield: DateField.DATEFIELD_SS, step: 30, spacing: 1000 * 30 }; +TICK_PLACEMENT[Granularity.MINUTELY] = { datefield: DateField.DATEFIELD_MM, step: 1, spacing: 1000 * 60 }; +TICK_PLACEMENT[Granularity.TWO_MINUTELY] = { datefield: DateField.DATEFIELD_MM, step: 2, spacing: 1000 * 60 * 2 }; +TICK_PLACEMENT[Granularity.FIVE_MINUTELY] = { datefield: DateField.DATEFIELD_MM, step: 5, spacing: 1000 * 60 * 5 }; +TICK_PLACEMENT[Granularity.TEN_MINUTELY] = { datefield: DateField.DATEFIELD_MM, step: 10, spacing: 1000 * 60 * 10 }; +TICK_PLACEMENT[Granularity.THIRTY_MINUTELY] = { datefield: DateField.DATEFIELD_MM, step: 30, spacing: 1000 * 60 * 30 }; +TICK_PLACEMENT[Granularity.HOURLY] = { datefield: DateField.DATEFIELD_HH, step: 1, spacing: 1000 * 3600 }; +TICK_PLACEMENT[Granularity.TWO_HOURLY] = { datefield: DateField.DATEFIELD_HH, step: 2, spacing: 1000 * 3600 * 2 }; +TICK_PLACEMENT[Granularity.SIX_HOURLY] = { datefield: DateField.DATEFIELD_HH, step: 6, spacing: 1000 * 3600 * 6 }; +TICK_PLACEMENT[Granularity.DAILY] = { datefield: DateField.DATEFIELD_D, step: 1, spacing: 1000 * 86400 }; +TICK_PLACEMENT[Granularity.TWO_DAILY] = { datefield: DateField.DATEFIELD_D, step: 2, spacing: 1000 * 86400 * 2 }; +TICK_PLACEMENT[Granularity.WEEKLY] = { datefield: DateField.DATEFIELD_D, step: 7, spacing: 1000 * 604800 }; +TICK_PLACEMENT[Granularity.MONTHLY] = { datefield: DateField.DATEFIELD_M, step: 1, spacing: 1000 * 7200 * 365.2524 }; // 1e3 * 60 * 60 * 24 * 365.2524 / 12 +TICK_PLACEMENT[Granularity.QUARTERLY] = { datefield: DateField.DATEFIELD_M, step: 3, spacing: 1000 * 21600 * 365.2524 }; // 1e3 * 60 * 60 * 24 * 365.2524 / 4 +TICK_PLACEMENT[Granularity.BIANNUAL] = { datefield: DateField.DATEFIELD_M, step: 6, spacing: 1000 * 43200 * 365.2524 }; // 1e3 * 60 * 60 * 24 * 365.2524 / 2 +TICK_PLACEMENT[Granularity.ANNUAL] = { datefield: DateField.DATEFIELD_Y, step: 1, spacing: 1000 * 86400 * 365.2524 }; // 1e3 * 60 * 60 * 24 * 365.2524 * 1 +TICK_PLACEMENT[Granularity.DECADAL] = { datefield: DateField.DATEFIELD_Y, step: 10, spacing: 1000 * 864000 * 365.2524 }; // 1e3 * 60 * 60 * 24 * 365.2524 * 10 +TICK_PLACEMENT[Granularity.CENTENNIAL] = { datefield: DateField.DATEFIELD_Y, step: 100, spacing: 1000 * 8640000 * 365.2524 }; // 1e3 * 60 * 60 * 24 * 365.2524 * 100 + +/** + * This is a list of human-friendly values at which to show tick marks on a log + * scale. It is k * 10^n, where k=1..9 and n=-39..+39, so: + * ..., 1, 2, 3, 4, 5, ..., 9, 10, 20, 30, ..., 90, 100, 200, 300, ... + * NOTE: this assumes that utils.LOG_SCALE = 10. + * @type {Array.} + */ +var PREFERRED_LOG_TICK_VALUES = (function () { + var vals = []; + for (var power = -39; power <= 39; power++) { + var range = Math.pow(10, power); + for (var mult = 1; mult <= 9; mult++) { + var val = range * mult; + vals.push(val); + } + } + return vals; +})(); + +/** + * Determine the correct granularity of ticks on a date axis. + * + * @param {number} a Left edge of the chart (ms) + * @param {number} b Right edge of the chart (ms) + * @param {number} pixels Size of the chart in the relevant dimension (width). + * @param {function(string):*} opts Function mapping from option name -> value. + * @return {number} The appropriate axis granularity for this chart. See the + * enumeration of possible values in dygraph-tickers.js. + */ +var pickDateTickGranularity = function pickDateTickGranularity(a, b, pixels, opts) { + var pixels_per_tick = /** @type{number} */opts('pixelsPerLabel'); + for (var i = 0; i < Granularity.NUM_GRANULARITIES; i++) { + var num_ticks = numDateTicks(a, b, i); + if (pixels / num_ticks >= pixels_per_tick) { + return i; + } + } + return -1; +}; + +/** + * Compute the number of ticks on a date axis for a given granularity. + * @param {number} start_time + * @param {number} end_time + * @param {number} granularity (one of the granularities enumerated above) + * @return {number} (Approximate) number of ticks that would result. + */ +var numDateTicks = function numDateTicks(start_time, end_time, granularity) { + var spacing = TICK_PLACEMENT[granularity].spacing; + return Math.round(1.0 * (end_time - start_time) / spacing); +}; + +/** + * Compute the positions and labels of ticks on a date axis for a given granularity. + * @param {number} start_time + * @param {number} end_time + * @param {number} granularity (one of the granularities enumerated above) + * @param {function(string):*} opts Function mapping from option name -> value. + * @param {Dygraph=} dg + * @return {!TickList} + */ +var getDateAxis = function getDateAxis(start_time, end_time, granularity, opts, dg) { + var formatter = /** @type{AxisLabelFormatter} */opts("axisLabelFormatter"); + var utc = opts("labelsUTC"); + var accessors = utc ? utils.DateAccessorsUTC : utils.DateAccessorsLocal; + + var datefield = TICK_PLACEMENT[granularity].datefield; + var step = TICK_PLACEMENT[granularity].step; + var spacing = TICK_PLACEMENT[granularity].spacing; + + // Choose a nice tick position before the initial instant. + // Currently, this code deals properly with the existent daily granularities: + // DAILY (with step of 1) and WEEKLY (with step of 7 but specially handled). + // Other daily granularities (say TWO_DAILY) should also be handled specially + // by setting the start_date_offset to 0. + var start_date = new Date(start_time); + var date_array = []; + date_array[DateField.DATEFIELD_Y] = accessors.getFullYear(start_date); + date_array[DateField.DATEFIELD_M] = accessors.getMonth(start_date); + date_array[DateField.DATEFIELD_D] = accessors.getDate(start_date); + date_array[DateField.DATEFIELD_HH] = accessors.getHours(start_date); + date_array[DateField.DATEFIELD_MM] = accessors.getMinutes(start_date); + date_array[DateField.DATEFIELD_SS] = accessors.getSeconds(start_date); + date_array[DateField.DATEFIELD_MS] = accessors.getMilliseconds(start_date); + + var start_date_offset = date_array[datefield] % step; + if (granularity == Granularity.WEEKLY) { + // This will put the ticks on Sundays. + start_date_offset = accessors.getDay(start_date); + } + + date_array[datefield] -= start_date_offset; + for (var df = datefield + 1; df < DateField.NUM_DATEFIELDS; df++) { + // The minimum value is 1 for the day of month, and 0 for all other fields. + date_array[df] = df === DateField.DATEFIELD_D ? 1 : 0; + } + + // Generate the ticks. + // For granularities not coarser than HOURLY we use the fact that: + // the number of milliseconds between ticks is constant + // and equal to the defined spacing. + // Otherwise we rely on the 'roll over' property of the Date functions: + // when some date field is set to a value outside of its logical range, + // the excess 'rolls over' the next (more significant) field. + // However, when using local time with DST transitions, + // there are dates that do not represent any time value at all + // (those in the hour skipped at the 'spring forward'), + // and the JavaScript engines usually return an equivalent value. + // Hence we have to check that the date is properly increased at each step, + // returning a date at a nice tick position. + var ticks = []; + var tick_date = accessors.makeDate.apply(null, date_array); + var tick_time = tick_date.getTime(); + if (granularity <= Granularity.HOURLY) { + if (tick_time < start_time) { + tick_time += spacing; + tick_date = new Date(tick_time); + } + while (tick_time <= end_time) { + ticks.push({ v: tick_time, + label: formatter.call(dg, tick_date, granularity, opts, dg) + }); + tick_time += spacing; + tick_date = new Date(tick_time); + } + } else { + if (tick_time < start_time) { + date_array[datefield] += step; + tick_date = accessors.makeDate.apply(null, date_array); + tick_time = tick_date.getTime(); + } + while (tick_time <= end_time) { + if (granularity >= Granularity.DAILY || accessors.getHours(tick_date) % step === 0) { + ticks.push({ v: tick_time, + label: formatter.call(dg, tick_date, granularity, opts, dg) + }); + } + date_array[datefield] += step; + tick_date = accessors.makeDate.apply(null, date_array); + tick_time = tick_date.getTime(); + } + } + return ticks; +}; +exports.getDateAxis = getDateAxis; + +},{"./dygraph-utils":17}],17:[function(require,module,exports){ +/** + * @license + * Copyright 2011 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview This file contains utility functions used by dygraphs. These + * are typically static (i.e. not related to any particular dygraph). Examples + * include date/time formatting functions, basic algorithms (e.g. binary + * search) and generic DOM-manipulation functions. + */ + +/*global Dygraph:false, Node:false */ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.removeEvent = removeEvent; +exports.cancelEvent = cancelEvent; +exports.hsvToRGB = hsvToRGB; +exports.findPos = findPos; +exports.pageX = pageX; +exports.pageY = pageY; +exports.dragGetX_ = dragGetX_; +exports.dragGetY_ = dragGetY_; +exports.isOK = isOK; +exports.isValidPoint = isValidPoint; +exports.floatFormat = floatFormat; +exports.zeropad = zeropad; +exports.hmsString_ = hmsString_; +exports.dateString_ = dateString_; +exports.round_ = round_; +exports.binarySearch = binarySearch; +exports.dateParser = dateParser; +exports.dateStrToMillis = dateStrToMillis; +exports.update = update; +exports.updateDeep = updateDeep; +exports.isArrayLike = isArrayLike; +exports.isDateLike = isDateLike; +exports.clone = clone; +exports.createCanvas = createCanvas; +exports.getContextPixelRatio = getContextPixelRatio; +exports.Iterator = Iterator; +exports.createIterator = createIterator; +exports.repeatAndCleanup = repeatAndCleanup; +exports.isPixelChangingOptionList = isPixelChangingOptionList; +exports.detectLineDelimiter = detectLineDelimiter; +exports.isNodeContainedBy = isNodeContainedBy; +exports.pow = pow; +exports.toRGB_ = toRGB_; +exports.isCanvasSupported = isCanvasSupported; +exports.parseFloat_ = parseFloat_; +exports.numberValueFormatter = numberValueFormatter; +exports.numberAxisLabelFormatter = numberAxisLabelFormatter; +exports.dateAxisLabelFormatter = dateAxisLabelFormatter; +exports.dateValueFormatter = dateValueFormatter; + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } + +var _dygraphTickers = require('./dygraph-tickers'); + +var DygraphTickers = _interopRequireWildcard(_dygraphTickers); + +var LOG_SCALE = 10; +exports.LOG_SCALE = LOG_SCALE; +var LN_TEN = Math.log(LOG_SCALE); + +exports.LN_TEN = LN_TEN; +/** + * @private + * @param {number} x + * @return {number} + */ +var log10 = function log10(x) { + return Math.log(x) / LN_TEN; +}; + +exports.log10 = log10; +/** + * @private + * @param {number} r0 + * @param {number} r1 + * @param {number} pct + * @return {number} + */ +var logRangeFraction = function logRangeFraction(r0, r1, pct) { + // Computing the inverse of toPercentXCoord. The function was arrived at with + // the following steps: + // + // Original calcuation: + // pct = (log(x) - log(xRange[0])) / (log(xRange[1]) - log(xRange[0]))); + // + // Multiply both sides by the right-side denominator. + // pct * (log(xRange[1] - log(xRange[0]))) = log(x) - log(xRange[0]) + // + // add log(xRange[0]) to both sides + // log(xRange[0]) + (pct * (log(xRange[1]) - log(xRange[0])) = log(x); + // + // Swap both sides of the equation, + // log(x) = log(xRange[0]) + (pct * (log(xRange[1]) - log(xRange[0])) + // + // Use both sides as the exponent in 10^exp and we're done. + // x = 10 ^ (log(xRange[0]) + (pct * (log(xRange[1]) - log(xRange[0]))) + + var logr0 = log10(r0); + var logr1 = log10(r1); + var exponent = logr0 + pct * (logr1 - logr0); + var value = Math.pow(LOG_SCALE, exponent); + return value; +}; + +exports.logRangeFraction = logRangeFraction; +/** A dotted line stroke pattern. */ +var DOTTED_LINE = [2, 2]; +exports.DOTTED_LINE = DOTTED_LINE; +/** A dashed line stroke pattern. */ +var DASHED_LINE = [7, 3]; +exports.DASHED_LINE = DASHED_LINE; +/** A dot dash stroke pattern. */ +var DOT_DASH_LINE = [7, 2, 2, 2]; + +exports.DOT_DASH_LINE = DOT_DASH_LINE; +// Directions for panning and zooming. Use bit operations when combined +// values are possible. +var HORIZONTAL = 1; +exports.HORIZONTAL = HORIZONTAL; +var VERTICAL = 2; + +exports.VERTICAL = VERTICAL; +/** + * Return the 2d context for a dygraph canvas. + * + * This method is only exposed for the sake of replacing the function in + * automated tests. + * + * @param {!HTMLCanvasElement} canvas + * @return {!CanvasRenderingContext2D} + * @private + */ +var getContext = function getContext(canvas) { + return (/** @type{!CanvasRenderingContext2D}*/canvas.getContext("2d") + ); +}; + +exports.getContext = getContext; +/** + * Add an event handler. + * @param {!Node} elem The element to add the event to. + * @param {string} type The type of the event, e.g. 'click' or 'mousemove'. + * @param {function(Event):(boolean|undefined)} fn The function to call + * on the event. The function takes one parameter: the event object. + * @private + */ +var addEvent = function addEvent(elem, type, fn) { + elem.addEventListener(type, fn, false); +}; + +exports.addEvent = addEvent; +/** + * Remove an event handler. + * @param {!Node} elem The element to remove the event from. + * @param {string} type The type of the event, e.g. 'click' or 'mousemove'. + * @param {function(Event):(boolean|undefined)} fn The function to call + * on the event. The function takes one parameter: the event object. + */ + +function removeEvent(elem, type, fn) { + elem.removeEventListener(type, fn, false); +} + +; + +/** + * Cancels further processing of an event. This is useful to prevent default + * browser actions, e.g. highlighting text on a double-click. + * Based on the article at + * http://www.switchonthecode.com/tutorials/javascript-tutorial-the-scroll-wheel + * @param {!Event} e The event whose normal behavior should be canceled. + * @private + */ + +function cancelEvent(e) { + e = e ? e : window.event; + if (e.stopPropagation) { + e.stopPropagation(); + } + if (e.preventDefault) { + e.preventDefault(); + } + e.cancelBubble = true; + e.cancel = true; + e.returnValue = false; + return false; +} + +; + +/** + * Convert hsv values to an rgb(r,g,b) string. Taken from MochiKit.Color. This + * is used to generate default series colors which are evenly spaced on the + * color wheel. + * @param { number } hue Range is 0.0-1.0. + * @param { number } saturation Range is 0.0-1.0. + * @param { number } value Range is 0.0-1.0. + * @return { string } "rgb(r,g,b)" where r, g and b range from 0-255. + * @private + */ + +function hsvToRGB(hue, saturation, value) { + var red; + var green; + var blue; + if (saturation === 0) { + red = value; + green = value; + blue = value; + } else { + var i = Math.floor(hue * 6); + var f = hue * 6 - i; + var p = value * (1 - saturation); + var q = value * (1 - saturation * f); + var t = value * (1 - saturation * (1 - f)); + switch (i) { + case 1: + red = q;green = value;blue = p;break; + case 2: + red = p;green = value;blue = t;break; + case 3: + red = p;green = q;blue = value;break; + case 4: + red = t;green = p;blue = value;break; + case 5: + red = value;green = p;blue = q;break; + case 6: // fall through + case 0: + red = value;green = t;blue = p;break; + } + } + red = Math.floor(255 * red + 0.5); + green = Math.floor(255 * green + 0.5); + blue = Math.floor(255 * blue + 0.5); + return 'rgb(' + red + ',' + green + ',' + blue + ')'; +} + +; + +/** + * Find the coordinates of an object relative to the top left of the page. + * + * @param {Node} obj + * @return {{x:number,y:number}} + * @private + */ + +function findPos(obj) { + var p = obj.getBoundingClientRect(), + w = window, + d = document.documentElement; + + return { + x: p.left + (w.pageXOffset || d.scrollLeft), + y: p.top + (w.pageYOffset || d.scrollTop) + }; +} + +; + +/** + * Returns the x-coordinate of the event in a coordinate system where the + * top-left corner of the page (not the window) is (0,0). + * Taken from MochiKit.Signal + * @param {!Event} e + * @return {number} + * @private + */ + +function pageX(e) { + return !e.pageX || e.pageX < 0 ? 0 : e.pageX; +} + +; + +/** + * Returns the y-coordinate of the event in a coordinate system where the + * top-left corner of the page (not the window) is (0,0). + * Taken from MochiKit.Signal + * @param {!Event} e + * @return {number} + * @private + */ + +function pageY(e) { + return !e.pageY || e.pageY < 0 ? 0 : e.pageY; +} + +; + +/** + * Converts page the x-coordinate of the event to pixel x-coordinates on the + * canvas (i.e. DOM Coords). + * @param {!Event} e Drag event. + * @param {!DygraphInteractionContext} context Interaction context object. + * @return {number} The amount by which the drag has moved to the right. + */ + +function dragGetX_(e, context) { + return pageX(e) - context.px; +} + +; + +/** + * Converts page the y-coordinate of the event to pixel y-coordinates on the + * canvas (i.e. DOM Coords). + * @param {!Event} e Drag event. + * @param {!DygraphInteractionContext} context Interaction context object. + * @return {number} The amount by which the drag has moved down. + */ + +function dragGetY_(e, context) { + return pageY(e) - context.py; +} + +; + +/** + * This returns true unless the parameter is 0, null, undefined or NaN. + * TODO(danvk): rename this function to something like 'isNonZeroNan'. + * + * @param {number} x The number to consider. + * @return {boolean} Whether the number is zero or NaN. + * @private + */ + +function isOK(x) { + return !!x && !isNaN(x); +} + +; + +/** + * @param {{x:?number,y:?number,yval:?number}} p The point to consider, valid + * points are {x, y} objects + * @param {boolean=} opt_allowNaNY Treat point with y=NaN as valid + * @return {boolean} Whether the point has numeric x and y. + * @private + */ + +function isValidPoint(p, opt_allowNaNY) { + if (!p) return false; // null or undefined object + if (p.yval === null) return false; // missing point + if (p.x === null || p.x === undefined) return false; + if (p.y === null || p.y === undefined) return false; + if (isNaN(p.x) || !opt_allowNaNY && isNaN(p.y)) return false; + return true; +} + +; + +/** + * Number formatting function which mimics the behavior of %g in printf, i.e. + * either exponential or fixed format (without trailing 0s) is used depending on + * the length of the generated string. The advantage of this format is that + * there is a predictable upper bound on the resulting string length, + * significant figures are not dropped, and normal numbers are not displayed in + * exponential notation. + * + * NOTE: JavaScript's native toPrecision() is NOT a drop-in replacement for %g. + * It creates strings which are too long for absolute values between 10^-4 and + * 10^-6, e.g. '0.00001' instead of '1e-5'. See tests/number-format.html for + * output examples. + * + * @param {number} x The number to format + * @param {number=} opt_precision The precision to use, default 2. + * @return {string} A string formatted like %g in printf. The max generated + * string length should be precision + 6 (e.g 1.123e+300). + */ + +function floatFormat(x, opt_precision) { + // Avoid invalid precision values; [1, 21] is the valid range. + var p = Math.min(Math.max(1, opt_precision || 2), 21); + + // This is deceptively simple. The actual algorithm comes from: + // + // Max allowed length = p + 4 + // where 4 comes from 'e+n' and '.'. + // + // Length of fixed format = 2 + y + p + // where 2 comes from '0.' and y = # of leading zeroes. + // + // Equating the two and solving for y yields y = 2, or 0.00xxxx which is + // 1.0e-3. + // + // Since the behavior of toPrecision() is identical for larger numbers, we + // don't have to worry about the other bound. + // + // Finally, the argument for toExponential() is the number of trailing digits, + // so we take off 1 for the value before the '.'. + return Math.abs(x) < 1.0e-3 && x !== 0.0 ? x.toExponential(p - 1) : x.toPrecision(p); +} + +; + +/** + * Converts '9' to '09' (useful for dates) + * @param {number} x + * @return {string} + * @private + */ + +function zeropad(x) { + if (x < 10) return "0" + x;else return "" + x; +} + +; + +/** + * Date accessors to get the parts of a calendar date (year, month, + * day, hour, minute, second and millisecond) according to local time, + * and factory method to call the Date constructor with an array of arguments. + */ +var DateAccessorsLocal = { + getFullYear: function getFullYear(d) { + return d.getFullYear(); + }, + getMonth: function getMonth(d) { + return d.getMonth(); + }, + getDate: function getDate(d) { + return d.getDate(); + }, + getHours: function getHours(d) { + return d.getHours(); + }, + getMinutes: function getMinutes(d) { + return d.getMinutes(); + }, + getSeconds: function getSeconds(d) { + return d.getSeconds(); + }, + getMilliseconds: function getMilliseconds(d) { + return d.getMilliseconds(); + }, + getDay: function getDay(d) { + return d.getDay(); + }, + makeDate: function makeDate(y, m, d, hh, mm, ss, ms) { + return new Date(y, m, d, hh, mm, ss, ms); + } +}; + +exports.DateAccessorsLocal = DateAccessorsLocal; +/** + * Date accessors to get the parts of a calendar date (year, month, + * day of month, hour, minute, second and millisecond) according to UTC time, + * and factory method to call the Date constructor with an array of arguments. + */ +var DateAccessorsUTC = { + getFullYear: function getFullYear(d) { + return d.getUTCFullYear(); + }, + getMonth: function getMonth(d) { + return d.getUTCMonth(); + }, + getDate: function getDate(d) { + return d.getUTCDate(); + }, + getHours: function getHours(d) { + return d.getUTCHours(); + }, + getMinutes: function getMinutes(d) { + return d.getUTCMinutes(); + }, + getSeconds: function getSeconds(d) { + return d.getUTCSeconds(); + }, + getMilliseconds: function getMilliseconds(d) { + return d.getUTCMilliseconds(); + }, + getDay: function getDay(d) { + return d.getUTCDay(); + }, + makeDate: function makeDate(y, m, d, hh, mm, ss, ms) { + return new Date(Date.UTC(y, m, d, hh, mm, ss, ms)); + } +}; + +exports.DateAccessorsUTC = DateAccessorsUTC; +/** + * Return a string version of the hours, minutes and seconds portion of a date. + * @param {number} hh The hours (from 0-23) + * @param {number} mm The minutes (from 0-59) + * @param {number} ss The seconds (from 0-59) + * @return {string} A time of the form "HH:MM" or "HH:MM:SS" + * @private + */ + +function hmsString_(hh, mm, ss, ms) { + var ret = zeropad(hh) + ":" + zeropad(mm); + if (ss) { + ret += ":" + zeropad(ss); + if (ms) { + var str = "" + ms; + ret += "." + ('000' + str).substring(str.length); + } + } + return ret; +} + +; + +/** + * Convert a JS date (millis since epoch) to a formatted string. + * @param {number} time The JavaScript time value (ms since epoch) + * @param {boolean} utc Whether output UTC or local time + * @return {string} A date of one of these forms: + * "YYYY/MM/DD", "YYYY/MM/DD HH:MM" or "YYYY/MM/DD HH:MM:SS" + * @private + */ + +function dateString_(time, utc) { + var accessors = utc ? DateAccessorsUTC : DateAccessorsLocal; + var date = new Date(time); + var y = accessors.getFullYear(date); + var m = accessors.getMonth(date); + var d = accessors.getDate(date); + var hh = accessors.getHours(date); + var mm = accessors.getMinutes(date); + var ss = accessors.getSeconds(date); + var ms = accessors.getMilliseconds(date); + // Get a year string: + var year = "" + y; + // Get a 0 padded month string + var month = zeropad(m + 1); //months are 0-offset, sigh + // Get a 0 padded day string + var day = zeropad(d); + var frac = hh * 3600 + mm * 60 + ss + 1e-3 * ms; + var ret = year + "/" + month + "/" + day; + if (frac) { + ret += " " + hmsString_(hh, mm, ss, ms); + } + return ret; +} + +; + +/** + * Round a number to the specified number of digits past the decimal point. + * @param {number} num The number to round + * @param {number} places The number of decimals to which to round + * @return {number} The rounded number + * @private + */ + +function round_(num, places) { + var shift = Math.pow(10, places); + return Math.round(num * shift) / shift; +} + +; + +/** + * Implementation of binary search over an array. + * Currently does not work when val is outside the range of arry's values. + * @param {number} val the value to search for + * @param {Array.} arry is the value over which to search + * @param {number} abs If abs > 0, find the lowest entry greater than val + * If abs < 0, find the highest entry less than val. + * If abs == 0, find the entry that equals val. + * @param {number=} low The first index in arry to consider (optional) + * @param {number=} high The last index in arry to consider (optional) + * @return {number} Index of the element, or -1 if it isn't found. + * @private + */ + +function binarySearch(_x, _x2, _x3, _x4, _x5) { + var _again = true; + + _function: while (_again) { + var val = _x, + arry = _x2, + abs = _x3, + low = _x4, + high = _x5; + _again = false; + + if (low === null || low === undefined || high === null || high === undefined) { + low = 0; + high = arry.length - 1; + } + if (low > high) { + return -1; + } + if (abs === null || abs === undefined) { + abs = 0; + } + var validIndex = function validIndex(idx) { + return idx >= 0 && idx < arry.length; + }; + var mid = parseInt((low + high) / 2, 10); + var element = arry[mid]; + var idx; + if (element == val) { + return mid; + } else if (element > val) { + if (abs > 0) { + // Accept if element > val, but also if prior element < val. + idx = mid - 1; + if (validIndex(idx) && arry[idx] < val) { + return mid; + } + } + _x = val; + _x2 = arry; + _x3 = abs; + _x4 = low; + _x5 = mid - 1; + _again = true; + validIndex = mid = element = idx = undefined; + continue _function; + } else if (element < val) { + if (abs < 0) { + // Accept if element < val, but also if prior element > val. + idx = mid + 1; + if (validIndex(idx) && arry[idx] > val) { + return mid; + } + } + _x = val; + _x2 = arry; + _x3 = abs; + _x4 = mid + 1; + _x5 = high; + _again = true; + validIndex = mid = element = idx = undefined; + continue _function; + } + return -1; // can't actually happen, but makes closure compiler happy + } +} + +; + +/** + * Parses a date, returning the number of milliseconds since epoch. This can be + * passed in as an xValueParser in the Dygraph constructor. + * TODO(danvk): enumerate formats that this understands. + * + * @param {string} dateStr A date in a variety of possible string formats. + * @return {number} Milliseconds since epoch. + * @private + */ + +function dateParser(dateStr) { + var dateStrSlashed; + var d; + + // Let the system try the format first, with one caveat: + // YYYY-MM-DD[ HH:MM:SS] is interpreted as UTC by a variety of browsers. + // dygraphs displays dates in local time, so this will result in surprising + // inconsistencies. But if you specify "T" or "Z" (i.e. YYYY-MM-DDTHH:MM:SS), + // then you probably know what you're doing, so we'll let you go ahead. + // Issue: http://code.google.com/p/dygraphs/issues/detail?id=255 + if (dateStr.search("-") == -1 || dateStr.search("T") != -1 || dateStr.search("Z") != -1) { + d = dateStrToMillis(dateStr); + if (d && !isNaN(d)) return d; + } + + if (dateStr.search("-") != -1) { + // e.g. '2009-7-12' or '2009-07-12' + dateStrSlashed = dateStr.replace("-", "/", "g"); + while (dateStrSlashed.search("-") != -1) { + dateStrSlashed = dateStrSlashed.replace("-", "/"); + } + d = dateStrToMillis(dateStrSlashed); + } else if (dateStr.length == 8) { + // e.g. '20090712' + // TODO(danvk): remove support for this format. It's confusing. + dateStrSlashed = dateStr.substr(0, 4) + "/" + dateStr.substr(4, 2) + "/" + dateStr.substr(6, 2); + d = dateStrToMillis(dateStrSlashed); + } else { + // Any format that Date.parse will accept, e.g. "2009/07/12" or + // "2009/07/12 12:34:56" + d = dateStrToMillis(dateStr); + } + + if (!d || isNaN(d)) { + console.error("Couldn't parse " + dateStr + " as a date"); + } + return d; +} + +; + +/** + * This is identical to JavaScript's built-in Date.parse() method, except that + * it doesn't get replaced with an incompatible method by aggressive JS + * libraries like MooTools or Joomla. + * @param {string} str The date string, e.g. "2011/05/06" + * @return {number} millis since epoch + * @private + */ + +function dateStrToMillis(str) { + return new Date(str).getTime(); +} + +; + +// These functions are all based on MochiKit. +/** + * Copies all the properties from o to self. + * + * @param {!Object} self + * @param {!Object} o + * @return {!Object} + */ + +function update(self, o) { + if (typeof o != 'undefined' && o !== null) { + for (var k in o) { + if (o.hasOwnProperty(k)) { + self[k] = o[k]; + } + } + } + return self; +} + +; + +/** + * Copies all the properties from o to self. + * + * @param {!Object} self + * @param {!Object} o + * @return {!Object} + * @private + */ + +function updateDeep(self, o) { + // Taken from http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object + function isNode(o) { + return typeof Node === "object" ? o instanceof Node : typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName === "string"; + } + + if (typeof o != 'undefined' && o !== null) { + for (var k in o) { + if (o.hasOwnProperty(k)) { + if (o[k] === null) { + self[k] = null; + } else if (isArrayLike(o[k])) { + self[k] = o[k].slice(); + } else if (isNode(o[k])) { + // DOM objects are shallowly-copied. + self[k] = o[k]; + } else if (typeof o[k] == 'object') { + if (typeof self[k] != 'object' || self[k] === null) { + self[k] = {}; + } + updateDeep(self[k], o[k]); + } else { + self[k] = o[k]; + } + } + } + } + return self; +} + +; + +/** + * @param {*} o + * @return {boolean} + * @private + */ + +function isArrayLike(o) { + var typ = typeof o; + if (typ != 'object' && !(typ == 'function' && typeof o.item == 'function') || o === null || typeof o.length != 'number' || o.nodeType === 3) { + return false; + } + return true; +} + +; + +/** + * @param {Object} o + * @return {boolean} + * @private + */ + +function isDateLike(o) { + if (typeof o != "object" || o === null || typeof o.getTime != 'function') { + return false; + } + return true; +} + +; + +/** + * Note: this only seems to work for arrays. + * @param {!Array} o + * @return {!Array} + * @private + */ + +function clone(o) { + // TODO(danvk): figure out how MochiKit's version works + var r = []; + for (var i = 0; i < o.length; i++) { + if (isArrayLike(o[i])) { + r.push(clone(o[i])); + } else { + r.push(o[i]); + } + } + return r; +} + +; + +/** + * Create a new canvas element. + * + * @return {!HTMLCanvasElement} + * @private + */ + +function createCanvas() { + return document.createElement('canvas'); +} + +; + +/** + * Returns the context's pixel ratio, which is the ratio between the device + * pixel ratio and the backing store ratio. Typically this is 1 for conventional + * displays, and > 1 for HiDPI displays (such as the Retina MBP). + * See http://www.html5rocks.com/en/tutorials/canvas/hidpi/ for more details. + * + * @param {!CanvasRenderingContext2D} context The canvas's 2d context. + * @return {number} The ratio of the device pixel ratio and the backing store + * ratio for the specified context. + */ + +function getContextPixelRatio(context) { + try { + var devicePixelRatio = window.devicePixelRatio; + var backingStoreRatio = context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1; + if (devicePixelRatio !== undefined) { + return devicePixelRatio / backingStoreRatio; + } else { + // At least devicePixelRatio must be defined for this ratio to make sense. + // We default backingStoreRatio to 1: this does not exist on some browsers + // (i.e. desktop Chrome). + return 1; + } + } catch (e) { + return 1; + } +} + +; + +/** + * TODO(danvk): use @template here when it's better supported for classes. + * @param {!Array} array + * @param {number} start + * @param {number} length + * @param {function(!Array,?):boolean=} predicate + * @constructor + */ + +function Iterator(array, start, length, predicate) { + start = start || 0; + length = length || array.length; + this.hasNext = true; // Use to identify if there's another element. + this.peek = null; // Use for look-ahead + this.start_ = start; + this.array_ = array; + this.predicate_ = predicate; + this.end_ = Math.min(array.length, start + length); + this.nextIdx_ = start - 1; // use -1 so initial advance works. + this.next(); // ignoring result. +} + +; + +/** + * @return {Object} + */ +Iterator.prototype.next = function () { + if (!this.hasNext) { + return null; + } + var obj = this.peek; + + var nextIdx = this.nextIdx_ + 1; + var found = false; + while (nextIdx < this.end_) { + if (!this.predicate_ || this.predicate_(this.array_, nextIdx)) { + this.peek = this.array_[nextIdx]; + found = true; + break; + } + nextIdx++; + } + this.nextIdx_ = nextIdx; + if (!found) { + this.hasNext = false; + this.peek = null; + } + return obj; +}; + +/** + * Returns a new iterator over array, between indexes start and + * start + length, and only returns entries that pass the accept function + * + * @param {!Array} array the array to iterate over. + * @param {number} start the first index to iterate over, 0 if absent. + * @param {number} length the number of elements in the array to iterate over. + * This, along with start, defines a slice of the array, and so length + * doesn't imply the number of elements in the iterator when accept doesn't + * always accept all values. array.length when absent. + * @param {function(?):boolean=} opt_predicate a function that takes + * parameters array and idx, which returns true when the element should be + * returned. If omitted, all elements are accepted. + * @private + */ + +function createIterator(array, start, length, opt_predicate) { + return new Iterator(array, start, length, opt_predicate); +} + +; + +// Shim layer with setTimeout fallback. +// From: http://paulirish.com/2011/requestanimationframe-for-smart-animating/ +// Should be called with the window context: +// Dygraph.requestAnimFrame.call(window, function() {}) +var requestAnimFrame = (function () { + return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) { + window.setTimeout(callback, 1000 / 60); + }; +})(); + +exports.requestAnimFrame = requestAnimFrame; +/** + * Call a function at most maxFrames times at an attempted interval of + * framePeriodInMillis, then call a cleanup function once. repeatFn is called + * once immediately, then at most (maxFrames - 1) times asynchronously. If + * maxFrames==1, then cleanup_fn() is also called synchronously. This function + * is used to sequence animation. + * @param {function(number)} repeatFn Called repeatedly -- takes the frame + * number (from 0 to maxFrames-1) as an argument. + * @param {number} maxFrames The max number of times to call repeatFn + * @param {number} framePeriodInMillis Max requested time between frames. + * @param {function()} cleanupFn A function to call after all repeatFn calls. + * @private + */ + +function repeatAndCleanup(repeatFn, maxFrames, framePeriodInMillis, cleanupFn) { + var frameNumber = 0; + var previousFrameNumber; + var startTime = new Date().getTime(); + repeatFn(frameNumber); + if (maxFrames == 1) { + cleanupFn(); + return; + } + var maxFrameArg = maxFrames - 1; + + (function loop() { + if (frameNumber >= maxFrames) return; + requestAnimFrame.call(window, function () { + // Determine which frame to draw based on the delay so far. Will skip + // frames if necessary. + var currentTime = new Date().getTime(); + var delayInMillis = currentTime - startTime; + previousFrameNumber = frameNumber; + frameNumber = Math.floor(delayInMillis / framePeriodInMillis); + var frameDelta = frameNumber - previousFrameNumber; + // If we predict that the subsequent repeatFn call will overshoot our + // total frame target, so our last call will cause a stutter, then jump to + // the last call immediately. If we're going to cause a stutter, better + // to do it faster than slower. + var predictOvershootStutter = frameNumber + frameDelta > maxFrameArg; + if (predictOvershootStutter || frameNumber >= maxFrameArg) { + repeatFn(maxFrameArg); // Ensure final call with maxFrameArg. + cleanupFn(); + } else { + if (frameDelta !== 0) { + // Don't call repeatFn with duplicate frames. + repeatFn(frameNumber); + } + loop(); + } + }); + })(); +} + +; + +// A whitelist of options that do not change pixel positions. +var pixelSafeOptions = { + 'annotationClickHandler': true, + 'annotationDblClickHandler': true, + 'annotationMouseOutHandler': true, + 'annotationMouseOverHandler': true, + 'axisLineColor': true, + 'axisLineWidth': true, + 'clickCallback': true, + 'drawCallback': true, + 'drawHighlightPointCallback': true, + 'drawPoints': true, + 'drawPointCallback': true, + 'drawGrid': true, + 'fillAlpha': true, + 'gridLineColor': true, + 'gridLineWidth': true, + 'hideOverlayOnMouseOut': true, + 'highlightCallback': true, + 'highlightCircleSize': true, + 'interactionModel': true, + 'labelsDiv': true, + 'labelsKMB': true, + 'labelsKMG2': true, + 'labelsSeparateLines': true, + 'labelsShowZeroValues': true, + 'legend': true, + 'panEdgeFraction': true, + 'pixelsPerYLabel': true, + 'pointClickCallback': true, + 'pointSize': true, + 'rangeSelectorPlotFillColor': true, + 'rangeSelectorPlotFillGradientColor': true, + 'rangeSelectorPlotStrokeColor': true, + 'rangeSelectorBackgroundStrokeColor': true, + 'rangeSelectorBackgroundLineWidth': true, + 'rangeSelectorPlotLineWidth': true, + 'rangeSelectorForegroundStrokeColor': true, + 'rangeSelectorForegroundLineWidth': true, + 'rangeSelectorAlpha': true, + 'showLabelsOnHighlight': true, + 'showRoller': true, + 'strokeWidth': true, + 'underlayCallback': true, + 'unhighlightCallback': true, + 'zoomCallback': true +}; + +/** + * This function will scan the option list and determine if they + * require us to recalculate the pixel positions of each point. + * TODO: move this into dygraph-options.js + * @param {!Array.} labels a list of options to check. + * @param {!Object} attrs + * @return {boolean} true if the graph needs new points else false. + * @private + */ + +function isPixelChangingOptionList(labels, attrs) { + // Assume that we do not require new points. + // This will change to true if we actually do need new points. + + // Create a dictionary of series names for faster lookup. + // If there are no labels, then the dictionary stays empty. + var seriesNamesDictionary = {}; + if (labels) { + for (var i = 1; i < labels.length; i++) { + seriesNamesDictionary[labels[i]] = true; + } + } + + // Scan through a flat (i.e. non-nested) object of options. + // Returns true/false depending on whether new points are needed. + var scanFlatOptions = function scanFlatOptions(options) { + for (var property in options) { + if (options.hasOwnProperty(property) && !pixelSafeOptions[property]) { + return true; + } + } + return false; + }; + + // Iterate through the list of updated options. + for (var property in attrs) { + if (!attrs.hasOwnProperty(property)) continue; + + // Find out of this field is actually a series specific options list. + if (property == 'highlightSeriesOpts' || seriesNamesDictionary[property] && !attrs.series) { + // This property value is a list of options for this series. + if (scanFlatOptions(attrs[property])) return true; + } else if (property == 'series' || property == 'axes') { + // This is twice-nested options list. + var perSeries = attrs[property]; + for (var series in perSeries) { + if (perSeries.hasOwnProperty(series) && scanFlatOptions(perSeries[series])) { + return true; + } + } + } else { + // If this was not a series specific option list, check if it's a pixel + // changing property. + if (!pixelSafeOptions[property]) return true; + } + } + + return false; +} + +; + +var Circles = { + DEFAULT: function DEFAULT(g, name, ctx, canvasx, canvasy, color, radius) { + ctx.beginPath(); + ctx.fillStyle = color; + ctx.arc(canvasx, canvasy, radius, 0, 2 * Math.PI, false); + ctx.fill(); + } + // For more shapes, include extras/shapes.js +}; + +exports.Circles = Circles; +/** + * Determine whether |data| is delimited by CR, CRLF, LF, LFCR. + * @param {string} data + * @return {?string} the delimiter that was detected (or null on failure). + */ + +function detectLineDelimiter(data) { + for (var i = 0; i < data.length; i++) { + var code = data.charAt(i); + if (code === '\r') { + // Might actually be "\r\n". + if (i + 1 < data.length && data.charAt(i + 1) === '\n') { + return '\r\n'; + } + return code; + } + if (code === '\n') { + // Might actually be "\n\r". + if (i + 1 < data.length && data.charAt(i + 1) === '\r') { + return '\n\r'; + } + return code; + } + } + + return null; +} + +; + +/** + * Is one node contained by another? + * @param {Node} containee The contained node. + * @param {Node} container The container node. + * @return {boolean} Whether containee is inside (or equal to) container. + * @private + */ + +function isNodeContainedBy(containee, container) { + if (container === null || containee === null) { + return false; + } + var containeeNode = /** @type {Node} */containee; + while (containeeNode && containeeNode !== container) { + containeeNode = containeeNode.parentNode; + } + return containeeNode === container; +} + +; + +// This masks some numeric issues in older versions of Firefox, +// where 1.0/Math.pow(10,2) != Math.pow(10,-2). +/** @type {function(number,number):number} */ + +function pow(base, exp) { + if (exp < 0) { + return 1.0 / Math.pow(base, -exp); + } + return Math.pow(base, exp); +} + +; + +var RGBA_RE = /^rgba?\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(?:,\s*([01](?:\.\d+)?))?\)$/; + +/** + * Helper for toRGB_ which parses strings of the form: + * rgb(123, 45, 67) + * rgba(123, 45, 67, 0.5) + * @return parsed {r,g,b,a?} tuple or null. + */ +function parseRGBA(rgbStr) { + var bits = RGBA_RE.exec(rgbStr); + if (!bits) return null; + var r = parseInt(bits[1], 10), + g = parseInt(bits[2], 10), + b = parseInt(bits[3], 10); + if (bits[4]) { + return { r: r, g: g, b: b, a: parseFloat(bits[4]) }; + } else { + return { r: r, g: g, b: b }; + } +} + +/** + * Converts any valid CSS color (hex, rgb(), named color) to an RGB tuple. + * + * @param {!string} colorStr Any valid CSS color string. + * @return {{r:number,g:number,b:number,a:number?}} Parsed RGB tuple. + * @private + */ + +function toRGB_(colorStr) { + // Strategy: First try to parse colorStr directly. This is fast & avoids DOM + // manipulation. If that fails (e.g. for named colors like 'red'), then + // create a hidden DOM element and parse its computed color. + var rgb = parseRGBA(colorStr); + if (rgb) return rgb; + + var div = document.createElement('div'); + div.style.backgroundColor = colorStr; + div.style.visibility = 'hidden'; + document.body.appendChild(div); + var rgbStr = window.getComputedStyle(div, null).backgroundColor; + document.body.removeChild(div); + return parseRGBA(rgbStr); +} + +; + +/** + * Checks whether the browser supports the <canvas> tag. + * @param {HTMLCanvasElement=} opt_canvasElement Pass a canvas element as an + * optimization if you have one. + * @return {boolean} Whether the browser supports canvas. + */ + +function isCanvasSupported(opt_canvasElement) { + try { + var canvas = opt_canvasElement || document.createElement("canvas"); + canvas.getContext("2d"); + } catch (e) { + return false; + } + return true; +} + +; + +/** + * Parses the value as a floating point number. This is like the parseFloat() + * built-in, but with a few differences: + * - the empty string is parsed as null, rather than NaN. + * - if the string cannot be parsed at all, an error is logged. + * If the string can't be parsed, this method returns null. + * @param {string} x The string to be parsed + * @param {number=} opt_line_no The line number from which the string comes. + * @param {string=} opt_line The text of the line from which the string comes. + */ + +function parseFloat_(x, opt_line_no, opt_line) { + var val = parseFloat(x); + if (!isNaN(val)) return val; + + // Try to figure out what happeend. + // If the value is the empty string, parse it as null. + if (/^ *$/.test(x)) return null; + + // If it was actually "NaN", return it as NaN. + if (/^ *nan *$/i.test(x)) return NaN; + + // Looks like a parsing error. + var msg = "Unable to parse '" + x + "' as a number"; + if (opt_line !== undefined && opt_line_no !== undefined) { + msg += " on line " + (1 + (opt_line_no || 0)) + " ('" + opt_line + "') of CSV."; + } + console.error(msg); + + return null; +} + +; + +// Label constants for the labelsKMB and labelsKMG2 options. +// (i.e. '100000' -> '100K') +var KMB_LABELS = ['K', 'M', 'B', 'T', 'Q']; +var KMG2_BIG_LABELS = ['k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; +var KMG2_SMALL_LABELS = ['m', 'u', 'n', 'p', 'f', 'a', 'z', 'y']; + +/** + * @private + * Return a string version of a number. This respects the digitsAfterDecimal + * and maxNumberWidth options. + * @param {number} x The number to be formatted + * @param {Dygraph} opts An options view + */ + +function numberValueFormatter(x, opts) { + var sigFigs = opts('sigFigs'); + + if (sigFigs !== null) { + // User has opted for a fixed number of significant figures. + return floatFormat(x, sigFigs); + } + + var digits = opts('digitsAfterDecimal'); + var maxNumberWidth = opts('maxNumberWidth'); + + var kmb = opts('labelsKMB'); + var kmg2 = opts('labelsKMG2'); + + var label; + + // switch to scientific notation if we underflow or overflow fixed display. + if (x !== 0.0 && (Math.abs(x) >= Math.pow(10, maxNumberWidth) || Math.abs(x) < Math.pow(10, -digits))) { + label = x.toExponential(digits); + } else { + label = '' + round_(x, digits); + } + + if (kmb || kmg2) { + var k; + var k_labels = []; + var m_labels = []; + if (kmb) { + k = 1000; + k_labels = KMB_LABELS; + } + if (kmg2) { + if (kmb) console.warn("Setting both labelsKMB and labelsKMG2. Pick one!"); + k = 1024; + k_labels = KMG2_BIG_LABELS; + m_labels = KMG2_SMALL_LABELS; + } + + var absx = Math.abs(x); + var n = pow(k, k_labels.length); + for (var j = k_labels.length - 1; j >= 0; j--, n /= k) { + if (absx >= n) { + label = round_(x / n, digits) + k_labels[j]; + break; + } + } + if (kmg2) { + // TODO(danvk): clean up this logic. Why so different than kmb? + var x_parts = String(x.toExponential()).split('e-'); + if (x_parts.length === 2 && x_parts[1] >= 3 && x_parts[1] <= 24) { + if (x_parts[1] % 3 > 0) { + label = round_(x_parts[0] / pow(10, x_parts[1] % 3), digits); + } else { + label = Number(x_parts[0]).toFixed(2); + } + label += m_labels[Math.floor(x_parts[1] / 3) - 1]; + } + } + } + + return label; +} + +; + +/** + * variant for use as an axisLabelFormatter. + * @private + */ + +function numberAxisLabelFormatter(x, granularity, opts) { + return numberValueFormatter.call(this, x, opts); +} + +; + +/** + * @type {!Array.} + * @private + * @constant + */ +var SHORT_MONTH_NAMES_ = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; + +/** + * Convert a JS date to a string appropriate to display on an axis that + * is displaying values at the stated granularity. This respects the + * labelsUTC option. + * @param {Date} date The date to format + * @param {number} granularity One of the Dygraph granularity constants + * @param {Dygraph} opts An options view + * @return {string} The date formatted as local time + * @private + */ + +function dateAxisLabelFormatter(date, granularity, opts) { + var utc = opts('labelsUTC'); + var accessors = utc ? DateAccessorsUTC : DateAccessorsLocal; + + var year = accessors.getFullYear(date), + month = accessors.getMonth(date), + day = accessors.getDate(date), + hours = accessors.getHours(date), + mins = accessors.getMinutes(date), + secs = accessors.getSeconds(date), + millis = accessors.getMilliseconds(date); + + if (granularity >= DygraphTickers.Granularity.DECADAL) { + return '' + year; + } else if (granularity >= DygraphTickers.Granularity.MONTHLY) { + return SHORT_MONTH_NAMES_[month] + ' ' + year; + } else { + var frac = hours * 3600 + mins * 60 + secs + 1e-3 * millis; + if (frac === 0 || granularity >= DygraphTickers.Granularity.DAILY) { + // e.g. '21 Jan' (%d%b) + return zeropad(day) + ' ' + SHORT_MONTH_NAMES_[month]; + } else if (granularity < DygraphTickers.Granularity.SECONDLY) { + // e.g. 40.310 (meaning 40 seconds and 310 milliseconds) + var str = "" + millis; + return zeropad(secs) + "." + ('000' + str).substring(str.length); + } else if (granularity > DygraphTickers.Granularity.MINUTELY) { + return hmsString_(hours, mins, secs, 0); + } else { + return hmsString_(hours, mins, secs, millis); + } + } +} + +; +// alias in case anyone is referencing the old method. +// Dygraph.dateAxisFormatter = Dygraph.dateAxisLabelFormatter; + +/** + * Return a string version of a JS date for a value label. This respects the + * labelsUTC option. + * @param {Date} date The date to be formatted + * @param {Dygraph} opts An options view + * @private + */ + +function dateValueFormatter(d, opts) { + return dateString_(d, opts('labelsUTC')); +} + +; + +},{"./dygraph-tickers":16}],18:[function(require,module,exports){ +(function (process){ +/** + * @license + * Copyright 2006 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ /** + * @fileoverview Creates an interactive, zoomable graph based on a CSV file or + * string. Dygraph can handle multiple series with or without error bars. The + * date/value ranges will be automatically set. Dygraph uses the + * <canvas> tag, so it only works in FF1.5+. + * @author danvdk@gmail.com (Dan Vanderkam) + + Usage: +
+ + + The CSV file is of the form + + Date,SeriesA,SeriesB,SeriesC + YYYYMMDD,A1,B1,C1 + YYYYMMDD,A2,B2,C2 + + If the 'errorBars' option is set in the constructor, the input should be of + the form + Date,SeriesA,SeriesB,... + YYYYMMDD,A1,sigmaA1,B1,sigmaB1,... + YYYYMMDD,A2,sigmaA2,B2,sigmaB2,... + + If the 'fractions' option is set, the input should be of the form: + + Date,SeriesA,SeriesB,... + YYYYMMDD,A1/B1,A2/B2,... + YYYYMMDD,A1/B1,A2/B2,... + + And error bars will be calculated automatically using a binomial distribution. + + For further documentation and examples, see http://dygraphs.com/ + */'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _slicedToArray=(function(){function sliceIterator(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n = (_s = _i.next()).done);_n = true) {_arr.push(_s.value);if(i && _arr.length === i)break;}}catch(err) {_d = true;_e = err;}finally {try{if(!_n && _i['return'])_i['return']();}finally {if(_d)throw _e;}}return _arr;}return function(arr,i){if(Array.isArray(arr)){return arr;}else if(Symbol.iterator in Object(arr)){return sliceIterator(arr,i);}else {throw new TypeError('Invalid attempt to destructure non-iterable instance');}};})();function _interopRequireWildcard(obj){if(obj && obj.__esModule){return obj;}else {var newObj={};if(obj != null){for(var key in obj) {if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key] = obj[key];}}newObj['default'] = obj;return newObj;}}function _interopRequireDefault(obj){return obj && obj.__esModule?obj:{'default':obj};}var _dygraphLayout=require('./dygraph-layout');var _dygraphLayout2=_interopRequireDefault(_dygraphLayout);var _dygraphCanvas=require('./dygraph-canvas');var _dygraphCanvas2=_interopRequireDefault(_dygraphCanvas);var _dygraphOptions=require('./dygraph-options');var _dygraphOptions2=_interopRequireDefault(_dygraphOptions);var _dygraphInteractionModel=require('./dygraph-interaction-model');var _dygraphInteractionModel2=_interopRequireDefault(_dygraphInteractionModel);var _dygraphTickers=require('./dygraph-tickers');var DygraphTickers=_interopRequireWildcard(_dygraphTickers);var _dygraphUtils=require('./dygraph-utils');var utils=_interopRequireWildcard(_dygraphUtils);var _dygraphDefaultAttrs=require('./dygraph-default-attrs');var _dygraphDefaultAttrs2=_interopRequireDefault(_dygraphDefaultAttrs);var _dygraphOptionsReference=require('./dygraph-options-reference');var _dygraphOptionsReference2=_interopRequireDefault(_dygraphOptionsReference);var _iframeTarp=require('./iframe-tarp');var _iframeTarp2=_interopRequireDefault(_iframeTarp);var _datahandlerDefault=require('./datahandler/default');var _datahandlerDefault2=_interopRequireDefault(_datahandlerDefault);var _datahandlerBarsError=require('./datahandler/bars-error');var _datahandlerBarsError2=_interopRequireDefault(_datahandlerBarsError);var _datahandlerBarsCustom=require('./datahandler/bars-custom');var _datahandlerBarsCustom2=_interopRequireDefault(_datahandlerBarsCustom);var _datahandlerDefaultFractions=require('./datahandler/default-fractions');var _datahandlerDefaultFractions2=_interopRequireDefault(_datahandlerDefaultFractions);var _datahandlerBarsFractions=require('./datahandler/bars-fractions');var _datahandlerBarsFractions2=_interopRequireDefault(_datahandlerBarsFractions);var _datahandlerBars=require('./datahandler/bars');var _datahandlerBars2=_interopRequireDefault(_datahandlerBars);var _pluginsAnnotations=require('./plugins/annotations');var _pluginsAnnotations2=_interopRequireDefault(_pluginsAnnotations);var _pluginsAxes=require('./plugins/axes');var _pluginsAxes2=_interopRequireDefault(_pluginsAxes);var _pluginsChartLabels=require('./plugins/chart-labels');var _pluginsChartLabels2=_interopRequireDefault(_pluginsChartLabels);var _pluginsGrid=require('./plugins/grid');var _pluginsGrid2=_interopRequireDefault(_pluginsGrid);var _pluginsLegend=require('./plugins/legend');var _pluginsLegend2=_interopRequireDefault(_pluginsLegend);var _pluginsRangeSelector=require('./plugins/range-selector');var _pluginsRangeSelector2=_interopRequireDefault(_pluginsRangeSelector);var _dygraphGviz=require('./dygraph-gviz');var _dygraphGviz2=_interopRequireDefault(_dygraphGviz);"use strict"; /** + * Creates an interactive, zoomable chart. + * + * @constructor + * @param {div | String} div A div or the id of a div into which to construct + * the chart. + * @param {String | Function} file A file containing CSV data or a function + * that returns this data. The most basic expected format for each line is + * "YYYY/MM/DD,val1,val2,...". For more information, see + * http://dygraphs.com/data.html. + * @param {Object} attrs Various other attributes, e.g. errorBars determines + * whether the input data contains error ranges. For a complete list of + * options, see http://dygraphs.com/options.html. + */var Dygraph=function Dygraph(div,data,opts){this.__init__(div,data,opts);};Dygraph.NAME = "Dygraph";Dygraph.VERSION = "2.1.0"; // Various default values +Dygraph.DEFAULT_ROLL_PERIOD = 1;Dygraph.DEFAULT_WIDTH = 480;Dygraph.DEFAULT_HEIGHT = 320; // For max 60 Hz. animation: +Dygraph.ANIMATION_STEPS = 12;Dygraph.ANIMATION_DURATION = 200; /** + * Standard plotters. These may be used by clients. + * Available plotters are: + * - Dygraph.Plotters.linePlotter: draws central lines (most common) + * - Dygraph.Plotters.errorPlotter: draws error bars + * - Dygraph.Plotters.fillPlotter: draws fills under lines (used with fillGraph) + * + * By default, the plotter is [fillPlotter, errorPlotter, linePlotter]. + * This causes all the lines to be drawn over all the fills/error bars. + */Dygraph.Plotters = _dygraphCanvas2['default']._Plotters; // Used for initializing annotation CSS rules only once. +Dygraph.addedAnnotationCSS = false; /** + * Initializes the Dygraph. This creates a new DIV and constructs the PlotKit + * and context <canvas> inside of it. See the constructor for details. + * on the parameters. + * @param {Element} div the Element to render the graph into. + * @param {string | Function} file Source data + * @param {Object} attrs Miscellaneous other options + * @private + */Dygraph.prototype.__init__ = function(div,file,attrs){this.is_initial_draw_ = true;this.readyFns_ = []; // Support two-argument constructor +if(attrs === null || attrs === undefined){attrs = {};}attrs = Dygraph.copyUserAttrs_(attrs);if(typeof div == 'string'){div = document.getElementById(div);}if(!div){throw new Error('Constructing dygraph with a non-existent div!');} // Copy the important bits into the object +// TODO(danvk): most of these should just stay in the attrs_ dictionary. +this.maindiv_ = div;this.file_ = file;this.rollPeriod_ = attrs.rollPeriod || Dygraph.DEFAULT_ROLL_PERIOD;this.previousVerticalX_ = -1;this.fractions_ = attrs.fractions || false;this.dateWindow_ = attrs.dateWindow || null;this.annotations_ = []; // Clear the div. This ensure that, if multiple dygraphs are passed the same +// div, then only one will be drawn. +div.innerHTML = ""; // For historical reasons, the 'width' and 'height' options trump all CSS +// rules _except_ for an explicit 'width' or 'height' on the div. +// As an added convenience, if the div has zero height (like
does +// without any styles), then we use a default height/width. +if(div.style.width === '' && attrs.width){div.style.width = attrs.width + "px";}if(div.style.height === '' && attrs.height){div.style.height = attrs.height + "px";}if(div.style.height === '' && div.clientHeight === 0){div.style.height = Dygraph.DEFAULT_HEIGHT + "px";if(div.style.width === ''){div.style.width = Dygraph.DEFAULT_WIDTH + "px";}} // These will be zero if the dygraph's div is hidden. In that case, +// use the user-specified attributes if present. If not, use zero +// and assume the user will call resize to fix things later. +this.width_ = div.clientWidth || attrs.width || 0;this.height_ = div.clientHeight || attrs.height || 0; // TODO(danvk): set fillGraph to be part of attrs_ here, not user_attrs_. +if(attrs.stackedGraph){attrs.fillGraph = true; // TODO(nikhilk): Add any other stackedGraph checks here. +} // DEPRECATION WARNING: All option processing should be moved from +// attrs_ and user_attrs_ to options_, which holds all this information. +// +// Dygraphs has many options, some of which interact with one another. +// To keep track of everything, we maintain two sets of options: +// +// this.user_attrs_ only options explicitly set by the user. +// this.attrs_ defaults, options derived from user_attrs_, data. +// +// Options are then accessed this.attr_('attr'), which first looks at +// user_attrs_ and then computed attrs_. This way Dygraphs can set intelligent +// defaults without overriding behavior that the user specifically asks for. +this.user_attrs_ = {};utils.update(this.user_attrs_,attrs); // This sequence ensures that Dygraph.DEFAULT_ATTRS is never modified. +this.attrs_ = {};utils.updateDeep(this.attrs_,_dygraphDefaultAttrs2['default']);this.boundaryIds_ = [];this.setIndexByName_ = {};this.datasetIndex_ = [];this.registeredEvents_ = [];this.eventListeners_ = {};this.attributes_ = new _dygraphOptions2['default'](this); // Create the containing DIV and other interactive elements +this.createInterface_(); // Activate plugins. +this.plugins_ = [];var plugins=Dygraph.PLUGINS.concat(this.getOption('plugins'));for(var i=0;i < plugins.length;i++) { // the plugins option may contain either plugin classes or instances. +// Plugin instances contain an activate method. +var Plugin=plugins[i]; // either a constructor or an instance. +var pluginInstance;if(typeof Plugin.activate !== 'undefined'){pluginInstance = Plugin;}else {pluginInstance = new Plugin();}var pluginDict={plugin:pluginInstance,events:{},options:{},pluginOptions:{}};var handlers=pluginInstance.activate(this);for(var eventName in handlers) {if(!handlers.hasOwnProperty(eventName))continue; // TODO(danvk): validate eventName. +pluginDict.events[eventName] = handlers[eventName];}this.plugins_.push(pluginDict);} // At this point, plugins can no longer register event handlers. +// Construct a map from event -> ordered list of [callback, plugin]. +for(var i=0;i < this.plugins_.length;i++) {var plugin_dict=this.plugins_[i];for(var eventName in plugin_dict.events) {if(!plugin_dict.events.hasOwnProperty(eventName))continue;var callback=plugin_dict.events[eventName];var pair=[plugin_dict.plugin,callback];if(!(eventName in this.eventListeners_)){this.eventListeners_[eventName] = [pair];}else {this.eventListeners_[eventName].push(pair);}}}this.createDragInterface_();this.start_();}; /** + * Triggers a cascade of events to the various plugins which are interested in them. + * Returns true if the "default behavior" should be prevented, i.e. if one + * of the event listeners called event.preventDefault(). + * @private + */Dygraph.prototype.cascadeEvents_ = function(name,extra_props){if(!(name in this.eventListeners_))return false; // QUESTION: can we use objects & prototypes to speed this up? +var e={dygraph:this,cancelable:false,defaultPrevented:false,preventDefault:function preventDefault(){if(!e.cancelable)throw "Cannot call preventDefault on non-cancelable event.";e.defaultPrevented = true;},propagationStopped:false,stopPropagation:function stopPropagation(){e.propagationStopped = true;}};utils.update(e,extra_props);var callback_plugin_pairs=this.eventListeners_[name];if(callback_plugin_pairs){for(var i=callback_plugin_pairs.length - 1;i >= 0;i--) {var plugin=callback_plugin_pairs[i][0];var callback=callback_plugin_pairs[i][1];callback.call(plugin,e);if(e.propagationStopped)break;}}return e.defaultPrevented;}; /** + * Fetch a plugin instance of a particular class. Only for testing. + * @private + * @param {!Class} type The type of the plugin. + * @return {Object} Instance of the plugin, or null if there is none. + */Dygraph.prototype.getPluginInstance_ = function(type){for(var i=0;i < this.plugins_.length;i++) {var p=this.plugins_[i];if(p.plugin instanceof type){return p.plugin;}}return null;}; /** + * Returns the zoomed status of the chart for one or both axes. + * + * Axis is an optional parameter. Can be set to 'x' or 'y'. + * + * The zoomed status for an axis is set whenever a user zooms using the mouse + * or when the dateWindow or valueRange are updated. Double-clicking or calling + * resetZoom() resets the zoom status for the chart. + */Dygraph.prototype.isZoomed = function(axis){var isZoomedX=!!this.dateWindow_;if(axis === 'x')return isZoomedX;var isZoomedY=this.axes_.map(function(axis){return !!axis.valueRange;}).indexOf(true) >= 0;if(axis === null || axis === undefined){return isZoomedX || isZoomedY;}if(axis === 'y')return isZoomedY;throw new Error('axis parameter is [' + axis + '] must be null, \'x\' or \'y\'.');}; /** + * Returns information about the Dygraph object, including its containing ID. + */Dygraph.prototype.toString = function(){var maindiv=this.maindiv_;var id=maindiv && maindiv.id?maindiv.id:maindiv;return "[Dygraph " + id + "]";}; /** + * @private + * Returns the value of an option. This may be set by the user (either in the + * constructor or by calling updateOptions) or by dygraphs, and may be set to a + * per-series value. + * @param {string} name The name of the option, e.g. 'rollPeriod'. + * @param {string} [seriesName] The name of the series to which the option + * will be applied. If no per-series value of this option is available, then + * the global value is returned. This is optional. + * @return { ... } The value of the option. + */Dygraph.prototype.attr_ = function(name,seriesName){ // For "production" code, this gets removed by uglifyjs. +if(typeof process !== 'undefined'){if("development" != 'production'){if(typeof _dygraphOptionsReference2['default'] === 'undefined'){console.error('Must include options reference JS for testing');}else if(!_dygraphOptionsReference2['default'].hasOwnProperty(name)){console.error('Dygraphs is using property ' + name + ', which has no ' + 'entry in the Dygraphs.OPTIONS_REFERENCE listing.'); // Only log this error once. +_dygraphOptionsReference2['default'][name] = true;}}}return seriesName?this.attributes_.getForSeries(name,seriesName):this.attributes_.get(name);}; /** + * Returns the current value for an option, as set in the constructor or via + * updateOptions. You may pass in an (optional) series name to get per-series + * values for the option. + * + * All values returned by this method should be considered immutable. If you + * modify them, there is no guarantee that the changes will be honored or that + * dygraphs will remain in a consistent state. If you want to modify an option, + * use updateOptions() instead. + * + * @param {string} name The name of the option (e.g. 'strokeWidth') + * @param {string=} opt_seriesName Series name to get per-series values. + * @return {*} The value of the option. + */Dygraph.prototype.getOption = function(name,opt_seriesName){return this.attr_(name,opt_seriesName);}; /** + * Like getOption(), but specifically returns a number. + * This is a convenience function for working with the Closure Compiler. + * @param {string} name The name of the option (e.g. 'strokeWidth') + * @param {string=} opt_seriesName Series name to get per-series values. + * @return {number} The value of the option. + * @private + */Dygraph.prototype.getNumericOption = function(name,opt_seriesName){return (/** @type{number} */this.getOption(name,opt_seriesName));}; /** + * Like getOption(), but specifically returns a string. + * This is a convenience function for working with the Closure Compiler. + * @param {string} name The name of the option (e.g. 'strokeWidth') + * @param {string=} opt_seriesName Series name to get per-series values. + * @return {string} The value of the option. + * @private + */Dygraph.prototype.getStringOption = function(name,opt_seriesName){return (/** @type{string} */this.getOption(name,opt_seriesName));}; /** + * Like getOption(), but specifically returns a boolean. + * This is a convenience function for working with the Closure Compiler. + * @param {string} name The name of the option (e.g. 'strokeWidth') + * @param {string=} opt_seriesName Series name to get per-series values. + * @return {boolean} The value of the option. + * @private + */Dygraph.prototype.getBooleanOption = function(name,opt_seriesName){return (/** @type{boolean} */this.getOption(name,opt_seriesName));}; /** + * Like getOption(), but specifically returns a function. + * This is a convenience function for working with the Closure Compiler. + * @param {string} name The name of the option (e.g. 'strokeWidth') + * @param {string=} opt_seriesName Series name to get per-series values. + * @return {function(...)} The value of the option. + * @private + */Dygraph.prototype.getFunctionOption = function(name,opt_seriesName){return (/** @type{function(...)} */this.getOption(name,opt_seriesName));};Dygraph.prototype.getOptionForAxis = function(name,axis){return this.attributes_.getForAxis(name,axis);}; /** + * @private + * @param {string} axis The name of the axis (i.e. 'x', 'y' or 'y2') + * @return { ... } A function mapping string -> option value + */Dygraph.prototype.optionsViewForAxis_ = function(axis){var self=this;return function(opt){var axis_opts=self.user_attrs_.axes;if(axis_opts && axis_opts[axis] && axis_opts[axis].hasOwnProperty(opt)){return axis_opts[axis][opt];} // I don't like that this is in a second spot. +if(axis === 'x' && opt === 'logscale'){ // return the default value. +// TODO(konigsberg): pull the default from a global default. +return false;} // user-specified attributes always trump defaults, even if they're less +// specific. +if(typeof self.user_attrs_[opt] != 'undefined'){return self.user_attrs_[opt];}axis_opts = self.attrs_.axes;if(axis_opts && axis_opts[axis] && axis_opts[axis].hasOwnProperty(opt)){return axis_opts[axis][opt];} // check old-style axis options +// TODO(danvk): add a deprecation warning if either of these match. +if(axis == 'y' && self.axes_[0].hasOwnProperty(opt)){return self.axes_[0][opt];}else if(axis == 'y2' && self.axes_[1].hasOwnProperty(opt)){return self.axes_[1][opt];}return self.attr_(opt);};}; /** + * Returns the current rolling period, as set by the user or an option. + * @return {number} The number of points in the rolling window + */Dygraph.prototype.rollPeriod = function(){return this.rollPeriod_;}; /** + * Returns the currently-visible x-range. This can be affected by zooming, + * panning or a call to updateOptions. + * Returns a two-element array: [left, right]. + * If the Dygraph has dates on the x-axis, these will be millis since epoch. + */Dygraph.prototype.xAxisRange = function(){return this.dateWindow_?this.dateWindow_:this.xAxisExtremes();}; /** + * Returns the lower- and upper-bound x-axis values of the data set. + */Dygraph.prototype.xAxisExtremes = function(){var pad=this.getNumericOption('xRangePad') / this.plotter_.area.w;if(this.numRows() === 0){return [0 - pad,1 + pad];}var left=this.rawData_[0][0];var right=this.rawData_[this.rawData_.length - 1][0];if(pad){ // Must keep this in sync with dygraph-layout _evaluateLimits() +var range=right - left;left -= range * pad;right += range * pad;}return [left,right];}; /** + * Returns the lower- and upper-bound y-axis values for each axis. These are + * the ranges you'll get if you double-click to zoom out or call resetZoom(). + * The return value is an array of [low, high] tuples, one for each y-axis. + */Dygraph.prototype.yAxisExtremes = function(){ // TODO(danvk): this is pretty inefficient +var packed=this.gatherDatasets_(this.rolledSeries_,null);var extremes=packed.extremes;var saveAxes=this.axes_;this.computeYAxisRanges_(extremes);var newAxes=this.axes_;this.axes_ = saveAxes;return newAxes.map(function(axis){return axis.extremeRange;});}; /** + * Returns the currently-visible y-range for an axis. This can be affected by + * zooming, panning or a call to updateOptions. Axis indices are zero-based. If + * called with no arguments, returns the range of the first axis. + * Returns a two-element array: [bottom, top]. + */Dygraph.prototype.yAxisRange = function(idx){if(typeof idx == "undefined")idx = 0;if(idx < 0 || idx >= this.axes_.length){return null;}var axis=this.axes_[idx];return [axis.computedValueRange[0],axis.computedValueRange[1]];}; /** + * Returns the currently-visible y-ranges for each axis. This can be affected by + * zooming, panning, calls to updateOptions, etc. + * Returns an array of [bottom, top] pairs, one for each y-axis. + */Dygraph.prototype.yAxisRanges = function(){var ret=[];for(var i=0;i < this.axes_.length;i++) {ret.push(this.yAxisRange(i));}return ret;}; // TODO(danvk): use these functions throughout dygraphs. +/** + * Convert from data coordinates to canvas/div X/Y coordinates. + * If specified, do this conversion for the coordinate system of a particular + * axis. Uses the first axis by default. + * Returns a two-element array: [X, Y] + * + * Note: use toDomXCoord instead of toDomCoords(x, null) and use toDomYCoord + * instead of toDomCoords(null, y, axis). + */Dygraph.prototype.toDomCoords = function(x,y,axis){return [this.toDomXCoord(x),this.toDomYCoord(y,axis)];}; /** + * Convert from data x coordinates to canvas/div X coordinate. + * If specified, do this conversion for the coordinate system of a particular + * axis. + * Returns a single value or null if x is null. + */Dygraph.prototype.toDomXCoord = function(x){if(x === null){return null;}var area=this.plotter_.area;var xRange=this.xAxisRange();return area.x + (x - xRange[0]) / (xRange[1] - xRange[0]) * area.w;}; /** + * Convert from data x coordinates to canvas/div Y coordinate and optional + * axis. Uses the first axis by default. + * + * returns a single value or null if y is null. + */Dygraph.prototype.toDomYCoord = function(y,axis){var pct=this.toPercentYCoord(y,axis);if(pct === null){return null;}var area=this.plotter_.area;return area.y + pct * area.h;}; /** + * Convert from canvas/div coords to data coordinates. + * If specified, do this conversion for the coordinate system of a particular + * axis. Uses the first axis by default. + * Returns a two-element array: [X, Y]. + * + * Note: use toDataXCoord instead of toDataCoords(x, null) and use toDataYCoord + * instead of toDataCoords(null, y, axis). + */Dygraph.prototype.toDataCoords = function(x,y,axis){return [this.toDataXCoord(x),this.toDataYCoord(y,axis)];}; /** + * Convert from canvas/div x coordinate to data coordinate. + * + * If x is null, this returns null. + */Dygraph.prototype.toDataXCoord = function(x){if(x === null){return null;}var area=this.plotter_.area;var xRange=this.xAxisRange();if(!this.attributes_.getForAxis("logscale",'x')){return xRange[0] + (x - area.x) / area.w * (xRange[1] - xRange[0]);}else {var pct=(x - area.x) / area.w;return utils.logRangeFraction(xRange[0],xRange[1],pct);}}; /** + * Convert from canvas/div y coord to value. + * + * If y is null, this returns null. + * if axis is null, this uses the first axis. + */Dygraph.prototype.toDataYCoord = function(y,axis){if(y === null){return null;}var area=this.plotter_.area;var yRange=this.yAxisRange(axis);if(typeof axis == "undefined")axis = 0;if(!this.attributes_.getForAxis("logscale",axis)){return yRange[0] + (area.y + area.h - y) / area.h * (yRange[1] - yRange[0]);}else { // Computing the inverse of toDomCoord. +var pct=(y - area.y) / area.h; // Note reversed yRange, y1 is on top with pct==0. +return utils.logRangeFraction(yRange[1],yRange[0],pct);}}; /** + * Converts a y for an axis to a percentage from the top to the + * bottom of the drawing area. + * + * If the coordinate represents a value visible on the canvas, then + * the value will be between 0 and 1, where 0 is the top of the canvas. + * However, this method will return values outside the range, as + * values can fall outside the canvas. + * + * If y is null, this returns null. + * if axis is null, this uses the first axis. + * + * @param {number} y The data y-coordinate. + * @param {number} [axis] The axis number on which the data coordinate lives. + * @return {number} A fraction in [0, 1] where 0 = the top edge. + */Dygraph.prototype.toPercentYCoord = function(y,axis){if(y === null){return null;}if(typeof axis == "undefined")axis = 0;var yRange=this.yAxisRange(axis);var pct;var logscale=this.attributes_.getForAxis("logscale",axis);if(logscale){var logr0=utils.log10(yRange[0]);var logr1=utils.log10(yRange[1]);pct = (logr1 - utils.log10(y)) / (logr1 - logr0);}else { // yRange[1] - y is unit distance from the bottom. +// yRange[1] - yRange[0] is the scale of the range. +// (yRange[1] - y) / (yRange[1] - yRange[0]) is the % from the bottom. +pct = (yRange[1] - y) / (yRange[1] - yRange[0]);}return pct;}; /** + * Converts an x value to a percentage from the left to the right of + * the drawing area. + * + * If the coordinate represents a value visible on the canvas, then + * the value will be between 0 and 1, where 0 is the left of the canvas. + * However, this method will return values outside the range, as + * values can fall outside the canvas. + * + * If x is null, this returns null. + * @param {number} x The data x-coordinate. + * @return {number} A fraction in [0, 1] where 0 = the left edge. + */Dygraph.prototype.toPercentXCoord = function(x){if(x === null){return null;}var xRange=this.xAxisRange();var pct;var logscale=this.attributes_.getForAxis("logscale",'x');if(logscale === true){ // logscale can be null so we test for true explicitly. +var logr0=utils.log10(xRange[0]);var logr1=utils.log10(xRange[1]);pct = (utils.log10(x) - logr0) / (logr1 - logr0);}else { // x - xRange[0] is unit distance from the left. +// xRange[1] - xRange[0] is the scale of the range. +// The full expression below is the % from the left. +pct = (x - xRange[0]) / (xRange[1] - xRange[0]);}return pct;}; /** + * Returns the number of columns (including the independent variable). + * @return {number} The number of columns. + */Dygraph.prototype.numColumns = function(){if(!this.rawData_)return 0;return this.rawData_[0]?this.rawData_[0].length:this.attr_("labels").length;}; /** + * Returns the number of rows (excluding any header/label row). + * @return {number} The number of rows, less any header. + */Dygraph.prototype.numRows = function(){if(!this.rawData_)return 0;return this.rawData_.length;}; /** + * Returns the value in the given row and column. If the row and column exceed + * the bounds on the data, returns null. Also returns null if the value is + * missing. + * @param {number} row The row number of the data (0-based). Row 0 is the + * first row of data, not a header row. + * @param {number} col The column number of the data (0-based) + * @return {number} The value in the specified cell or null if the row/col + * were out of range. + */Dygraph.prototype.getValue = function(row,col){if(row < 0 || row > this.rawData_.length)return null;if(col < 0 || col > this.rawData_[row].length)return null;return this.rawData_[row][col];}; /** + * Generates interface elements for the Dygraph: a containing div, a div to + * display the current point, and a textbox to adjust the rolling average + * period. Also creates the Renderer/Layout elements. + * @private + */Dygraph.prototype.createInterface_ = function(){ // Create the all-enclosing graph div +var enclosing=this.maindiv_;this.graphDiv = document.createElement("div"); // TODO(danvk): any other styles that are useful to set here? +this.graphDiv.style.textAlign = 'left'; // This is a CSS "reset" +this.graphDiv.style.position = 'relative';enclosing.appendChild(this.graphDiv); // Create the canvas for interactive parts of the chart. +this.canvas_ = utils.createCanvas();this.canvas_.style.position = "absolute"; // ... and for static parts of the chart. +this.hidden_ = this.createPlotKitCanvas_(this.canvas_);this.canvas_ctx_ = utils.getContext(this.canvas_);this.hidden_ctx_ = utils.getContext(this.hidden_);this.resizeElements_(); // The interactive parts of the graph are drawn on top of the chart. +this.graphDiv.appendChild(this.hidden_);this.graphDiv.appendChild(this.canvas_);this.mouseEventElement_ = this.createMouseEventElement_(); // Create the grapher +this.layout_ = new _dygraphLayout2['default'](this);var dygraph=this;this.mouseMoveHandler_ = function(e){dygraph.mouseMove_(e);};this.mouseOutHandler_ = function(e){ // The mouse has left the chart if: +// 1. e.target is inside the chart +// 2. e.relatedTarget is outside the chart +var target=e.target || e.fromElement;var relatedTarget=e.relatedTarget || e.toElement;if(utils.isNodeContainedBy(target,dygraph.graphDiv) && !utils.isNodeContainedBy(relatedTarget,dygraph.graphDiv)){dygraph.mouseOut_(e);}};this.addAndTrackEvent(window,'mouseout',this.mouseOutHandler_);this.addAndTrackEvent(this.mouseEventElement_,'mousemove',this.mouseMoveHandler_); // Don't recreate and register the resize handler on subsequent calls. +// This happens when the graph is resized. +if(!this.resizeHandler_){this.resizeHandler_ = function(e){dygraph.resize();}; // Update when the window is resized. +// TODO(danvk): drop frames depending on complexity of the chart. +this.addAndTrackEvent(window,'resize',this.resizeHandler_);}};Dygraph.prototype.resizeElements_ = function(){this.graphDiv.style.width = this.width_ + "px";this.graphDiv.style.height = this.height_ + "px";var pixelRatioOption=this.getNumericOption('pixelRatio');var canvasScale=pixelRatioOption || utils.getContextPixelRatio(this.canvas_ctx_);this.canvas_.width = this.width_ * canvasScale;this.canvas_.height = this.height_ * canvasScale;this.canvas_.style.width = this.width_ + "px"; // for IE +this.canvas_.style.height = this.height_ + "px"; // for IE +if(canvasScale !== 1){this.canvas_ctx_.scale(canvasScale,canvasScale);}var hiddenScale=pixelRatioOption || utils.getContextPixelRatio(this.hidden_ctx_);this.hidden_.width = this.width_ * hiddenScale;this.hidden_.height = this.height_ * hiddenScale;this.hidden_.style.width = this.width_ + "px"; // for IE +this.hidden_.style.height = this.height_ + "px"; // for IE +if(hiddenScale !== 1){this.hidden_ctx_.scale(hiddenScale,hiddenScale);}}; /** + * Detach DOM elements in the dygraph and null out all data references. + * Calling this when you're done with a dygraph can dramatically reduce memory + * usage. See, e.g., the tests/perf.html example. + */Dygraph.prototype.destroy = function(){this.canvas_ctx_.restore();this.hidden_ctx_.restore(); // Destroy any plugins, in the reverse order that they were registered. +for(var i=this.plugins_.length - 1;i >= 0;i--) {var p=this.plugins_.pop();if(p.plugin.destroy)p.plugin.destroy();}var removeRecursive=function removeRecursive(node){while(node.hasChildNodes()) {removeRecursive(node.firstChild);node.removeChild(node.firstChild);}};this.removeTrackedEvents_(); // remove mouse event handlers (This may not be necessary anymore) +utils.removeEvent(window,'mouseout',this.mouseOutHandler_);utils.removeEvent(this.mouseEventElement_,'mousemove',this.mouseMoveHandler_); // remove window handlers +utils.removeEvent(window,'resize',this.resizeHandler_);this.resizeHandler_ = null;removeRecursive(this.maindiv_);var nullOut=function nullOut(obj){for(var n in obj) {if(typeof obj[n] === 'object'){obj[n] = null;}}}; // These may not all be necessary, but it can't hurt... +nullOut(this.layout_);nullOut(this.plotter_);nullOut(this);}; /** + * Creates the canvas on which the chart will be drawn. Only the Renderer ever + * draws on this particular canvas. All Dygraph work (i.e. drawing hover dots + * or the zoom rectangles) is done on this.canvas_. + * @param {Object} canvas The Dygraph canvas over which to overlay the plot + * @return {Object} The newly-created canvas + * @private + */Dygraph.prototype.createPlotKitCanvas_ = function(canvas){var h=utils.createCanvas();h.style.position = "absolute"; // TODO(danvk): h should be offset from canvas. canvas needs to include +// some extra area to make it easier to zoom in on the far left and far +// right. h needs to be precisely the plot area, so that clipping occurs. +h.style.top = canvas.style.top;h.style.left = canvas.style.left;h.width = this.width_;h.height = this.height_;h.style.width = this.width_ + "px"; // for IE +h.style.height = this.height_ + "px"; // for IE +return h;}; /** + * Creates an overlay element used to handle mouse events. + * @return {Object} The mouse event element. + * @private + */Dygraph.prototype.createMouseEventElement_ = function(){return this.canvas_;}; /** + * Generate a set of distinct colors for the data series. This is done with a + * color wheel. Saturation/Value are customizable, and the hue is + * equally-spaced around the color wheel. If a custom set of colors is + * specified, that is used instead. + * @private + */Dygraph.prototype.setColors_ = function(){var labels=this.getLabels();var num=labels.length - 1;this.colors_ = [];this.colorsMap_ = {}; // These are used for when no custom colors are specified. +var sat=this.getNumericOption('colorSaturation') || 1.0;var val=this.getNumericOption('colorValue') || 0.5;var half=Math.ceil(num / 2);var colors=this.getOption('colors');var visibility=this.visibility();for(var i=0;i < num;i++) {if(!visibility[i]){continue;}var label=labels[i + 1];var colorStr=this.attributes_.getForSeries('color',label);if(!colorStr){if(colors){colorStr = colors[i % colors.length];}else { // alternate colors for high contrast. +var idx=i % 2?half + (i + 1) / 2:Math.ceil((i + 1) / 2);var hue=1.0 * idx / (1 + num);colorStr = utils.hsvToRGB(hue,sat,val);}}this.colors_.push(colorStr);this.colorsMap_[label] = colorStr;}}; /** + * Return the list of colors. This is either the list of colors passed in the + * attributes or the autogenerated list of rgb(r,g,b) strings. + * This does not return colors for invisible series. + * @return {Array.} The list of colors. + */Dygraph.prototype.getColors = function(){return this.colors_;}; /** + * Returns a few attributes of a series, i.e. its color, its visibility, which + * axis it's assigned to, and its column in the original data. + * Returns null if the series does not exist. + * Otherwise, returns an object with column, visibility, color and axis properties. + * The "axis" property will be set to 1 for y1 and 2 for y2. + * The "column" property can be fed back into getValue(row, column) to get + * values for this series. + */Dygraph.prototype.getPropertiesForSeries = function(series_name){var idx=-1;var labels=this.getLabels();for(var i=1;i < labels.length;i++) {if(labels[i] == series_name){idx = i;break;}}if(idx == -1)return null;return {name:series_name,column:idx,visible:this.visibility()[idx - 1],color:this.colorsMap_[series_name],axis:1 + this.attributes_.axisForSeries(series_name)};}; /** + * Create the text box to adjust the averaging period + * @private + */Dygraph.prototype.createRollInterface_ = function(){var _this=this; // Create a roller if one doesn't exist already. +var roller=this.roller_;if(!roller){this.roller_ = roller = document.createElement("input");roller.type = "text";roller.style.display = "none";roller.className = 'dygraph-roller';this.graphDiv.appendChild(roller);}var display=this.getBooleanOption('showRoller')?'block':'none';var area=this.getArea();var textAttr={"top":area.y + area.h - 25 + "px","left":area.x + 1 + "px","display":display};roller.size = "2";roller.value = this.rollPeriod_;utils.update(roller.style,textAttr);roller.onchange = function(){return _this.adjustRoll(roller.value);};}; /** + * Set up all the mouse handlers needed to capture dragging behavior for zoom + * events. + * @private + */Dygraph.prototype.createDragInterface_ = function(){var context={ // Tracks whether the mouse is down right now +isZooming:false,isPanning:false, // is this drag part of a pan? +is2DPan:false, // if so, is that pan 1- or 2-dimensional? +dragStartX:null, // pixel coordinates +dragStartY:null, // pixel coordinates +dragEndX:null, // pixel coordinates +dragEndY:null, // pixel coordinates +dragDirection:null,prevEndX:null, // pixel coordinates +prevEndY:null, // pixel coordinates +prevDragDirection:null,cancelNextDblclick:false, // see comment in dygraph-interaction-model.js +// The value on the left side of the graph when a pan operation starts. +initialLeftmostDate:null, // The number of units each pixel spans. (This won't be valid for log +// scales) +xUnitsPerPixel:null, // TODO(danvk): update this comment +// The range in second/value units that the viewport encompasses during a +// panning operation. +dateRange:null, // Top-left corner of the canvas, in DOM coords +// TODO(konigsberg): Rename topLeftCanvasX, topLeftCanvasY. +px:0,py:0, // Values for use with panEdgeFraction, which limit how far outside the +// graph's data boundaries it can be panned. +boundedDates:null, // [minDate, maxDate] +boundedValues:null, // [[minValue, maxValue] ...] +// We cover iframes during mouse interactions. See comments in +// dygraph-utils.js for more info on why this is a good idea. +tarp:new _iframeTarp2['default'](), // contextB is the same thing as this context object but renamed. +initializeMouseDown:function initializeMouseDown(event,g,contextB){ // prevents mouse drags from selecting page text. +if(event.preventDefault){event.preventDefault(); // Firefox, Chrome, etc. +}else {event.returnValue = false; // IE +event.cancelBubble = true;}var canvasPos=utils.findPos(g.canvas_);contextB.px = canvasPos.x;contextB.py = canvasPos.y;contextB.dragStartX = utils.dragGetX_(event,contextB);contextB.dragStartY = utils.dragGetY_(event,contextB);contextB.cancelNextDblclick = false;contextB.tarp.cover();},destroy:function destroy(){var context=this;if(context.isZooming || context.isPanning){context.isZooming = false;context.dragStartX = null;context.dragStartY = null;}if(context.isPanning){context.isPanning = false;context.draggingDate = null;context.dateRange = null;for(var i=0;i < self.axes_.length;i++) {delete self.axes_[i].draggingValue;delete self.axes_[i].dragValueRange;}}context.tarp.uncover();}};var interactionModel=this.getOption("interactionModel"); // Self is the graph. +var self=this; // Function that binds the graph and context to the handler. +var bindHandler=function bindHandler(handler){return function(event){handler(event,self,context);};};for(var eventName in interactionModel) {if(!interactionModel.hasOwnProperty(eventName))continue;this.addAndTrackEvent(this.mouseEventElement_,eventName,bindHandler(interactionModel[eventName]));} // If the user releases the mouse button during a drag, but not over the +// canvas, then it doesn't count as a zooming action. +if(!interactionModel.willDestroyContextMyself){var mouseUpHandler=function mouseUpHandler(event){context.destroy();};this.addAndTrackEvent(document,'mouseup',mouseUpHandler);}}; /** + * Draw a gray zoom rectangle over the desired area of the canvas. Also clears + * up any previous zoom rectangles that were drawn. This could be optimized to + * avoid extra redrawing, but it's tricky to avoid interactions with the status + * dots. + * + * @param {number} direction the direction of the zoom rectangle. Acceptable + * values are utils.HORIZONTAL and utils.VERTICAL. + * @param {number} startX The X position where the drag started, in canvas + * coordinates. + * @param {number} endX The current X position of the drag, in canvas coords. + * @param {number} startY The Y position where the drag started, in canvas + * coordinates. + * @param {number} endY The current Y position of the drag, in canvas coords. + * @param {number} prevDirection the value of direction on the previous call to + * this function. Used to avoid excess redrawing + * @param {number} prevEndX The value of endX on the previous call to this + * function. Used to avoid excess redrawing + * @param {number} prevEndY The value of endY on the previous call to this + * function. Used to avoid excess redrawing + * @private + */Dygraph.prototype.drawZoomRect_ = function(direction,startX,endX,startY,endY,prevDirection,prevEndX,prevEndY){var ctx=this.canvas_ctx_; // Clean up from the previous rect if necessary +if(prevDirection == utils.HORIZONTAL){ctx.clearRect(Math.min(startX,prevEndX),this.layout_.getPlotArea().y,Math.abs(startX - prevEndX),this.layout_.getPlotArea().h);}else if(prevDirection == utils.VERTICAL){ctx.clearRect(this.layout_.getPlotArea().x,Math.min(startY,prevEndY),this.layout_.getPlotArea().w,Math.abs(startY - prevEndY));} // Draw a light-grey rectangle to show the new viewing area +if(direction == utils.HORIZONTAL){if(endX && startX){ctx.fillStyle = "rgba(128,128,128,0.33)";ctx.fillRect(Math.min(startX,endX),this.layout_.getPlotArea().y,Math.abs(endX - startX),this.layout_.getPlotArea().h);}}else if(direction == utils.VERTICAL){if(endY && startY){ctx.fillStyle = "rgba(128,128,128,0.33)";ctx.fillRect(this.layout_.getPlotArea().x,Math.min(startY,endY),this.layout_.getPlotArea().w,Math.abs(endY - startY));}}}; /** + * Clear the zoom rectangle (and perform no zoom). + * @private + */Dygraph.prototype.clearZoomRect_ = function(){this.currentZoomRectArgs_ = null;this.canvas_ctx_.clearRect(0,0,this.width_,this.height_);}; /** + * Zoom to something containing [lowX, highX]. These are pixel coordinates in + * the canvas. The exact zoom window may be slightly larger if there are no data + * points near lowX or highX. Don't confuse this function with doZoomXDates, + * which accepts dates that match the raw data. This function redraws the graph. + * + * @param {number} lowX The leftmost pixel value that should be visible. + * @param {number} highX The rightmost pixel value that should be visible. + * @private + */Dygraph.prototype.doZoomX_ = function(lowX,highX){this.currentZoomRectArgs_ = null; // Find the earliest and latest dates contained in this canvasx range. +// Convert the call to date ranges of the raw data. +var minDate=this.toDataXCoord(lowX);var maxDate=this.toDataXCoord(highX);this.doZoomXDates_(minDate,maxDate);}; /** + * Zoom to something containing [minDate, maxDate] values. Don't confuse this + * method with doZoomX which accepts pixel coordinates. This function redraws + * the graph. + * + * @param {number} minDate The minimum date that should be visible. + * @param {number} maxDate The maximum date that should be visible. + * @private + */Dygraph.prototype.doZoomXDates_ = function(minDate,maxDate){var _this2=this; // TODO(danvk): when xAxisRange is null (i.e. "fit to data", the animation +// can produce strange effects. Rather than the x-axis transitioning slowly +// between values, it can jerk around.) +var old_window=this.xAxisRange();var new_window=[minDate,maxDate];var zoomCallback=this.getFunctionOption('zoomCallback');this.doAnimatedZoom(old_window,new_window,null,null,function(){if(zoomCallback){zoomCallback.call(_this2,minDate,maxDate,_this2.yAxisRanges());}});}; /** + * Zoom to something containing [lowY, highY]. These are pixel coordinates in + * the canvas. This function redraws the graph. + * + * @param {number} lowY The topmost pixel value that should be visible. + * @param {number} highY The lowest pixel value that should be visible. + * @private + */Dygraph.prototype.doZoomY_ = function(lowY,highY){var _this3=this;this.currentZoomRectArgs_ = null; // Find the highest and lowest values in pixel range for each axis. +// Note that lowY (in pixels) corresponds to the max Value (in data coords). +// This is because pixels increase as you go down on the screen, whereas data +// coordinates increase as you go up the screen. +var oldValueRanges=this.yAxisRanges();var newValueRanges=[];for(var i=0;i < this.axes_.length;i++) {var hi=this.toDataYCoord(lowY,i);var low=this.toDataYCoord(highY,i);newValueRanges.push([low,hi]);}var zoomCallback=this.getFunctionOption('zoomCallback');this.doAnimatedZoom(null,null,oldValueRanges,newValueRanges,function(){if(zoomCallback){var _xAxisRange=_this3.xAxisRange();var _xAxisRange2=_slicedToArray(_xAxisRange,2);var minX=_xAxisRange2[0];var maxX=_xAxisRange2[1];zoomCallback.call(_this3,minX,maxX,_this3.yAxisRanges());}});}; /** + * Transition function to use in animations. Returns values between 0.0 + * (totally old values) and 1.0 (totally new values) for each frame. + * @private + */Dygraph.zoomAnimationFunction = function(frame,numFrames){var k=1.5;return (1.0 - Math.pow(k,-frame)) / (1.0 - Math.pow(k,-numFrames));}; /** + * Reset the zoom to the original view coordinates. This is the same as + * double-clicking on the graph. + */Dygraph.prototype.resetZoom = function(){var _this4=this;var dirtyX=this.isZoomed('x');var dirtyY=this.isZoomed('y');var dirty=dirtyX || dirtyY; // Clear any selection, since it's likely to be drawn in the wrong place. +this.clearSelection();if(!dirty)return; // Calculate extremes to avoid lack of padding on reset. +var _xAxisExtremes=this.xAxisExtremes();var _xAxisExtremes2=_slicedToArray(_xAxisExtremes,2);var minDate=_xAxisExtremes2[0];var maxDate=_xAxisExtremes2[1];var animatedZooms=this.getBooleanOption('animatedZooms');var zoomCallback=this.getFunctionOption('zoomCallback'); // TODO(danvk): merge this block w/ the code below. +// TODO(danvk): factor out a generic, public zoomTo method. +if(!animatedZooms){this.dateWindow_ = null;this.axes_.forEach(function(axis){if(axis.valueRange)delete axis.valueRange;});this.drawGraph_();if(zoomCallback){zoomCallback.call(this,minDate,maxDate,this.yAxisRanges());}return;}var oldWindow=null,newWindow=null,oldValueRanges=null,newValueRanges=null;if(dirtyX){oldWindow = this.xAxisRange();newWindow = [minDate,maxDate];}if(dirtyY){oldValueRanges = this.yAxisRanges();newValueRanges = this.yAxisExtremes();}this.doAnimatedZoom(oldWindow,newWindow,oldValueRanges,newValueRanges,function(){_this4.dateWindow_ = null;_this4.axes_.forEach(function(axis){if(axis.valueRange)delete axis.valueRange;});if(zoomCallback){zoomCallback.call(_this4,minDate,maxDate,_this4.yAxisRanges());}});}; /** + * Combined animation logic for all zoom functions. + * either the x parameters or y parameters may be null. + * @private + */Dygraph.prototype.doAnimatedZoom = function(oldXRange,newXRange,oldYRanges,newYRanges,callback){var _this5=this;var steps=this.getBooleanOption("animatedZooms")?Dygraph.ANIMATION_STEPS:1;var windows=[];var valueRanges=[];var step,frac;if(oldXRange !== null && newXRange !== null){for(step = 1;step <= steps;step++) {frac = Dygraph.zoomAnimationFunction(step,steps);windows[step - 1] = [oldXRange[0] * (1 - frac) + frac * newXRange[0],oldXRange[1] * (1 - frac) + frac * newXRange[1]];}}if(oldYRanges !== null && newYRanges !== null){for(step = 1;step <= steps;step++) {frac = Dygraph.zoomAnimationFunction(step,steps);var thisRange=[];for(var j=0;j < this.axes_.length;j++) {thisRange.push([oldYRanges[j][0] * (1 - frac) + frac * newYRanges[j][0],oldYRanges[j][1] * (1 - frac) + frac * newYRanges[j][1]]);}valueRanges[step - 1] = thisRange;}}utils.repeatAndCleanup(function(step){if(valueRanges.length){for(var i=0;i < _this5.axes_.length;i++) {var w=valueRanges[step][i];_this5.axes_[i].valueRange = [w[0],w[1]];}}if(windows.length){_this5.dateWindow_ = windows[step];}_this5.drawGraph_();},steps,Dygraph.ANIMATION_DURATION / steps,callback);}; /** + * Get the current graph's area object. + * + * Returns: {x, y, w, h} + */Dygraph.prototype.getArea = function(){return this.plotter_.area;}; /** + * Convert a mouse event to DOM coordinates relative to the graph origin. + * + * Returns a two-element array: [X, Y]. + */Dygraph.prototype.eventToDomCoords = function(event){if(event.offsetX && event.offsetY){return [event.offsetX,event.offsetY];}else {var eventElementPos=utils.findPos(this.mouseEventElement_);var canvasx=utils.pageX(event) - eventElementPos.x;var canvasy=utils.pageY(event) - eventElementPos.y;return [canvasx,canvasy];}}; /** + * Given a canvas X coordinate, find the closest row. + * @param {number} domX graph-relative DOM X coordinate + * Returns {number} row number. + * @private + */Dygraph.prototype.findClosestRow = function(domX){var minDistX=Infinity;var closestRow=-1;var sets=this.layout_.points;for(var i=0;i < sets.length;i++) {var points=sets[i];var len=points.length;for(var j=0;j < len;j++) {var point=points[j];if(!utils.isValidPoint(point,true))continue;var dist=Math.abs(point.canvasx - domX);if(dist < minDistX){minDistX = dist;closestRow = point.idx;}}}return closestRow;}; /** + * Given canvas X,Y coordinates, find the closest point. + * + * This finds the individual data point across all visible series + * that's closest to the supplied DOM coordinates using the standard + * Euclidean X,Y distance. + * + * @param {number} domX graph-relative DOM X coordinate + * @param {number} domY graph-relative DOM Y coordinate + * Returns: {row, seriesName, point} + * @private + */Dygraph.prototype.findClosestPoint = function(domX,domY){var minDist=Infinity;var dist,dx,dy,point,closestPoint,closestSeries,closestRow;for(var setIdx=this.layout_.points.length - 1;setIdx >= 0;--setIdx) {var points=this.layout_.points[setIdx];for(var i=0;i < points.length;++i) {point = points[i];if(!utils.isValidPoint(point))continue;dx = point.canvasx - domX;dy = point.canvasy - domY;dist = dx * dx + dy * dy;if(dist < minDist){minDist = dist;closestPoint = point;closestSeries = setIdx;closestRow = point.idx;}}}var name=this.layout_.setNames[closestSeries];return {row:closestRow,seriesName:name,point:closestPoint};}; /** + * Given canvas X,Y coordinates, find the touched area in a stacked graph. + * + * This first finds the X data point closest to the supplied DOM X coordinate, + * then finds the series which puts the Y coordinate on top of its filled area, + * using linear interpolation between adjacent point pairs. + * + * @param {number} domX graph-relative DOM X coordinate + * @param {number} domY graph-relative DOM Y coordinate + * Returns: {row, seriesName, point} + * @private + */Dygraph.prototype.findStackedPoint = function(domX,domY){var row=this.findClosestRow(domX);var closestPoint,closestSeries;for(var setIdx=0;setIdx < this.layout_.points.length;++setIdx) {var boundary=this.getLeftBoundary_(setIdx);var rowIdx=row - boundary;var points=this.layout_.points[setIdx];if(rowIdx >= points.length)continue;var p1=points[rowIdx];if(!utils.isValidPoint(p1))continue;var py=p1.canvasy;if(domX > p1.canvasx && rowIdx + 1 < points.length){ // interpolate series Y value using next point +var p2=points[rowIdx + 1];if(utils.isValidPoint(p2)){var dx=p2.canvasx - p1.canvasx;if(dx > 0){var r=(domX - p1.canvasx) / dx;py += r * (p2.canvasy - p1.canvasy);}}}else if(domX < p1.canvasx && rowIdx > 0){ // interpolate series Y value using previous point +var p0=points[rowIdx - 1];if(utils.isValidPoint(p0)){var dx=p1.canvasx - p0.canvasx;if(dx > 0){var r=(p1.canvasx - domX) / dx;py += r * (p0.canvasy - p1.canvasy);}}} // Stop if the point (domX, py) is above this series' upper edge +if(setIdx === 0 || py < domY){closestPoint = p1;closestSeries = setIdx;}}var name=this.layout_.setNames[closestSeries];return {row:row,seriesName:name,point:closestPoint};}; /** + * When the mouse moves in the canvas, display information about a nearby data + * point and draw dots over those points in the data series. This function + * takes care of cleanup of previously-drawn dots. + * @param {Object} event The mousemove event from the browser. + * @private + */Dygraph.prototype.mouseMove_ = function(event){ // This prevents JS errors when mousing over the canvas before data loads. +var points=this.layout_.points;if(points === undefined || points === null)return;var canvasCoords=this.eventToDomCoords(event);var canvasx=canvasCoords[0];var canvasy=canvasCoords[1];var highlightSeriesOpts=this.getOption("highlightSeriesOpts");var selectionChanged=false;if(highlightSeriesOpts && !this.isSeriesLocked()){var closest;if(this.getBooleanOption("stackedGraph")){closest = this.findStackedPoint(canvasx,canvasy);}else {closest = this.findClosestPoint(canvasx,canvasy);}selectionChanged = this.setSelection(closest.row,closest.seriesName);}else {var idx=this.findClosestRow(canvasx);selectionChanged = this.setSelection(idx);}var callback=this.getFunctionOption("highlightCallback");if(callback && selectionChanged){callback.call(this,event,this.lastx_,this.selPoints_,this.lastRow_,this.highlightSet_);}}; /** + * Fetch left offset from the specified set index or if not passed, the + * first defined boundaryIds record (see bug #236). + * @private + */Dygraph.prototype.getLeftBoundary_ = function(setIdx){if(this.boundaryIds_[setIdx]){return this.boundaryIds_[setIdx][0];}else {for(var i=0;i < this.boundaryIds_.length;i++) {if(this.boundaryIds_[i] !== undefined){return this.boundaryIds_[i][0];}}return 0;}};Dygraph.prototype.animateSelection_ = function(direction){var totalSteps=10;var millis=30;if(this.fadeLevel === undefined)this.fadeLevel = 0;if(this.animateId === undefined)this.animateId = 0;var start=this.fadeLevel;var steps=direction < 0?start:totalSteps - start;if(steps <= 0){if(this.fadeLevel){this.updateSelection_(1.0);}return;}var thisId=++this.animateId;var that=this;var cleanupIfClearing=function cleanupIfClearing(){ // if we haven't reached fadeLevel 0 in the max frame time, +// ensure that the clear happens and just go to 0 +if(that.fadeLevel !== 0 && direction < 0){that.fadeLevel = 0;that.clearSelection();}};utils.repeatAndCleanup(function(n){ // ignore simultaneous animations +if(that.animateId != thisId)return;that.fadeLevel += direction;if(that.fadeLevel === 0){that.clearSelection();}else {that.updateSelection_(that.fadeLevel / totalSteps);}},steps,millis,cleanupIfClearing);}; /** + * Draw dots over the selectied points in the data series. This function + * takes care of cleanup of previously-drawn dots. + * @private + */Dygraph.prototype.updateSelection_ = function(opt_animFraction){ /*var defaultPrevented = */this.cascadeEvents_('select',{selectedRow:this.lastRow_ === -1?undefined:this.lastRow_,selectedX:this.lastx_ === -1?undefined:this.lastx_,selectedPoints:this.selPoints_}); // TODO(danvk): use defaultPrevented here? +// Clear the previously drawn vertical, if there is one +var i;var ctx=this.canvas_ctx_;if(this.getOption('highlightSeriesOpts')){ctx.clearRect(0,0,this.width_,this.height_);var alpha=1.0 - this.getNumericOption('highlightSeriesBackgroundAlpha');var backgroundColor=utils.toRGB_(this.getOption('highlightSeriesBackgroundColor'));if(alpha){ // Activating background fade includes an animation effect for a gradual +// fade. TODO(klausw): make this independently configurable if it causes +// issues? Use a shared preference to control animations? +var animateBackgroundFade=true;if(animateBackgroundFade){if(opt_animFraction === undefined){ // start a new animation +this.animateSelection_(1);return;}alpha *= opt_animFraction;}ctx.fillStyle = 'rgba(' + backgroundColor.r + ',' + backgroundColor.g + ',' + backgroundColor.b + ',' + alpha + ')';ctx.fillRect(0,0,this.width_,this.height_);} // Redraw only the highlighted series in the interactive canvas (not the +// static plot canvas, which is where series are usually drawn). +this.plotter_._renderLineChart(this.highlightSet_,ctx);}else if(this.previousVerticalX_ >= 0){ // Determine the maximum highlight circle size. +var maxCircleSize=0;var labels=this.attr_('labels');for(i = 1;i < labels.length;i++) {var r=this.getNumericOption('highlightCircleSize',labels[i]);if(r > maxCircleSize)maxCircleSize = r;}var px=this.previousVerticalX_;ctx.clearRect(px - maxCircleSize - 1,0,2 * maxCircleSize + 2,this.height_);}if(this.selPoints_.length > 0){ // Draw colored circles over the center of each selected point +var canvasx=this.selPoints_[0].canvasx;ctx.save();for(i = 0;i < this.selPoints_.length;i++) {var pt=this.selPoints_[i];if(isNaN(pt.canvasy))continue;var circleSize=this.getNumericOption('highlightCircleSize',pt.name);var callback=this.getFunctionOption("drawHighlightPointCallback",pt.name);var color=this.plotter_.colors[pt.name];if(!callback){callback = utils.Circles.DEFAULT;}ctx.lineWidth = this.getNumericOption('strokeWidth',pt.name);ctx.strokeStyle = color;ctx.fillStyle = color;callback.call(this,this,pt.name,ctx,canvasx,pt.canvasy,color,circleSize,pt.idx);}ctx.restore();this.previousVerticalX_ = canvasx;}}; /** + * Manually set the selected points and display information about them in the + * legend. The selection can be cleared using clearSelection() and queried + * using getSelection(). + * + * To set a selected series but not a selected point, call setSelection with + * row=false and the selected series name. + * + * @param {number} row Row number that should be highlighted (i.e. appear with + * hover dots on the chart). + * @param {seriesName} optional series name to highlight that series with the + * the highlightSeriesOpts setting. + * @param { locked } optional If true, keep seriesName selected when mousing + * over the graph, disabling closest-series highlighting. Call clearSelection() + * to unlock it. + */Dygraph.prototype.setSelection = function(row,opt_seriesName,opt_locked){ // Extract the points we've selected +this.selPoints_ = [];var changed=false;if(row !== false && row >= 0){if(row != this.lastRow_)changed = true;this.lastRow_ = row;for(var setIdx=0;setIdx < this.layout_.points.length;++setIdx) {var points=this.layout_.points[setIdx]; // Check if the point at the appropriate index is the point we're looking +// for. If it is, just use it, otherwise search the array for a point +// in the proper place. +var setRow=row - this.getLeftBoundary_(setIdx);if(setRow >= 0 && setRow < points.length && points[setRow].idx == row){var point=points[setRow];if(point.yval !== null)this.selPoints_.push(point);}else {for(var pointIdx=0;pointIdx < points.length;++pointIdx) {var point=points[pointIdx];if(point.idx == row){if(point.yval !== null){this.selPoints_.push(point);}break;}}}}}else {if(this.lastRow_ >= 0)changed = true;this.lastRow_ = -1;}if(this.selPoints_.length){this.lastx_ = this.selPoints_[0].xval;}else {this.lastx_ = -1;}if(opt_seriesName !== undefined){if(this.highlightSet_ !== opt_seriesName)changed = true;this.highlightSet_ = opt_seriesName;}if(opt_locked !== undefined){this.lockedSet_ = opt_locked;}if(changed){this.updateSelection_(undefined);}return changed;}; /** + * The mouse has left the canvas. Clear out whatever artifacts remain + * @param {Object} event the mouseout event from the browser. + * @private + */Dygraph.prototype.mouseOut_ = function(event){if(this.getFunctionOption("unhighlightCallback")){this.getFunctionOption("unhighlightCallback").call(this,event);}if(this.getBooleanOption("hideOverlayOnMouseOut") && !this.lockedSet_){this.clearSelection();}}; /** + * Clears the current selection (i.e. points that were highlighted by moving + * the mouse over the chart). + */Dygraph.prototype.clearSelection = function(){this.cascadeEvents_('deselect',{});this.lockedSet_ = false; // Get rid of the overlay data +if(this.fadeLevel){this.animateSelection_(-1);return;}this.canvas_ctx_.clearRect(0,0,this.width_,this.height_);this.fadeLevel = 0;this.selPoints_ = [];this.lastx_ = -1;this.lastRow_ = -1;this.highlightSet_ = null;}; /** + * Returns the number of the currently selected row. To get data for this row, + * you can use the getValue method. + * @return {number} row number, or -1 if nothing is selected + */Dygraph.prototype.getSelection = function(){if(!this.selPoints_ || this.selPoints_.length < 1){return -1;}for(var setIdx=0;setIdx < this.layout_.points.length;setIdx++) {var points=this.layout_.points[setIdx];for(var row=0;row < points.length;row++) {if(points[row].x == this.selPoints_[0].x){return points[row].idx;}}}return -1;}; /** + * Returns the name of the currently-highlighted series. + * Only available when the highlightSeriesOpts option is in use. + */Dygraph.prototype.getHighlightSeries = function(){return this.highlightSet_;}; /** + * Returns true if the currently-highlighted series was locked + * via setSelection(..., seriesName, true). + */Dygraph.prototype.isSeriesLocked = function(){return this.lockedSet_;}; /** + * Fires when there's data available to be graphed. + * @param {string} data Raw CSV data to be plotted + * @private + */Dygraph.prototype.loadedEvent_ = function(data){this.rawData_ = this.parseCSV_(data);this.cascadeDataDidUpdateEvent_();this.predraw_();}; /** + * Add ticks on the x-axis representing years, months, quarters, weeks, or days + * @private + */Dygraph.prototype.addXTicks_ = function(){ // Determine the correct ticks scale on the x-axis: quarterly, monthly, ... +var range;if(this.dateWindow_){range = [this.dateWindow_[0],this.dateWindow_[1]];}else {range = this.xAxisExtremes();}var xAxisOptionsView=this.optionsViewForAxis_('x');var xTicks=xAxisOptionsView('ticker')(range[0],range[1],this.plotter_.area.w, // TODO(danvk): should be area.width +xAxisOptionsView,this); // var msg = 'ticker(' + range[0] + ', ' + range[1] + ', ' + this.width_ + ', ' + this.attr_('pixelsPerXLabel') + ') -> ' + JSON.stringify(xTicks); +// console.log(msg); +this.layout_.setXTicks(xTicks);}; /** + * Returns the correct handler class for the currently set options. + * @private + */Dygraph.prototype.getHandlerClass_ = function(){var handlerClass;if(this.attr_('dataHandler')){handlerClass = this.attr_('dataHandler');}else if(this.fractions_){if(this.getBooleanOption('errorBars')){handlerClass = _datahandlerBarsFractions2['default'];}else {handlerClass = _datahandlerDefaultFractions2['default'];}}else if(this.getBooleanOption('customBars')){handlerClass = _datahandlerBarsCustom2['default'];}else if(this.getBooleanOption('errorBars')){handlerClass = _datahandlerBarsError2['default'];}else {handlerClass = _datahandlerDefault2['default'];}return handlerClass;}; /** + * @private + * This function is called once when the chart's data is changed or the options + * dictionary is updated. It is _not_ called when the user pans or zooms. The + * idea is that values derived from the chart's data can be computed here, + * rather than every time the chart is drawn. This includes things like the + * number of axes, rolling averages, etc. + */Dygraph.prototype.predraw_ = function(){var start=new Date(); // Create the correct dataHandler +this.dataHandler_ = new (this.getHandlerClass_())();this.layout_.computePlotArea(); // TODO(danvk): move more computations out of drawGraph_ and into here. +this.computeYAxes_();if(!this.is_initial_draw_){this.canvas_ctx_.restore();this.hidden_ctx_.restore();}this.canvas_ctx_.save();this.hidden_ctx_.save(); // Create a new plotter. +this.plotter_ = new _dygraphCanvas2['default'](this,this.hidden_,this.hidden_ctx_,this.layout_); // The roller sits in the bottom left corner of the chart. We don't know where +// this will be until the options are available, so it's positioned here. +this.createRollInterface_();this.cascadeEvents_('predraw'); // Convert the raw data (a 2D array) into the internal format and compute +// rolling averages. +this.rolledSeries_ = [null]; // x-axis is the first series and it's special +for(var i=1;i < this.numColumns();i++) { // var logScale = this.attr_('logscale', i); // TODO(klausw): this looks wrong // konigsberg thinks so too. +var series=this.dataHandler_.extractSeries(this.rawData_,i,this.attributes_);if(this.rollPeriod_ > 1){series = this.dataHandler_.rollingAverage(series,this.rollPeriod_,this.attributes_);}this.rolledSeries_.push(series);} // If the data or options have changed, then we'd better redraw. +this.drawGraph_(); // This is used to determine whether to do various animations. +var end=new Date();this.drawingTimeMs_ = end - start;}; /** + * Point structure. + * + * xval_* and yval_* are the original unscaled data values, + * while x_* and y_* are scaled to the range (0.0-1.0) for plotting. + * yval_stacked is the cumulative Y value used for stacking graphs, + * and bottom/top/minus/plus are used for error bar graphs. + * + * @typedef {{ + * idx: number, + * name: string, + * x: ?number, + * xval: ?number, + * y_bottom: ?number, + * y: ?number, + * y_stacked: ?number, + * y_top: ?number, + * yval_minus: ?number, + * yval: ?number, + * yval_plus: ?number, + * yval_stacked + * }} + */Dygraph.PointType = undefined; /** + * Calculates point stacking for stackedGraph=true. + * + * For stacking purposes, interpolate or extend neighboring data across + * NaN values based on stackedGraphNaNFill settings. This is for display + * only, the underlying data value as shown in the legend remains NaN. + * + * @param {Array.} points Point array for a single series. + * Updates each Point's yval_stacked property. + * @param {Array.} cumulativeYval Accumulated top-of-graph stacked Y + * values for the series seen so far. Index is the row number. Updated + * based on the current series's values. + * @param {Array.} seriesExtremes Min and max values, updated + * to reflect the stacked values. + * @param {string} fillMethod Interpolation method, one of 'all', 'inside', or + * 'none'. + * @private + */Dygraph.stackPoints_ = function(points,cumulativeYval,seriesExtremes,fillMethod){var lastXval=null;var prevPoint=null;var nextPoint=null;var nextPointIdx=-1; // Find the next stackable point starting from the given index. +var updateNextPoint=function updateNextPoint(idx){ // If we've previously found a non-NaN point and haven't gone past it yet, +// just use that. +if(nextPointIdx >= idx)return; // We haven't found a non-NaN point yet or have moved past it, +// look towards the right to find a non-NaN point. +for(var j=idx;j < points.length;++j) { // Clear out a previously-found point (if any) since it's no longer +// valid, we shouldn't use it for interpolation anymore. +nextPoint = null;if(!isNaN(points[j].yval) && points[j].yval !== null){nextPointIdx = j;nextPoint = points[j];break;}}};for(var i=0;i < points.length;++i) {var point=points[i];var xval=point.xval;if(cumulativeYval[xval] === undefined){cumulativeYval[xval] = 0;}var actualYval=point.yval;if(isNaN(actualYval) || actualYval === null){if(fillMethod == 'none'){actualYval = 0;}else { // Interpolate/extend for stacking purposes if possible. +updateNextPoint(i);if(prevPoint && nextPoint && fillMethod != 'none'){ // Use linear interpolation between prevPoint and nextPoint. +actualYval = prevPoint.yval + (nextPoint.yval - prevPoint.yval) * ((xval - prevPoint.xval) / (nextPoint.xval - prevPoint.xval));}else if(prevPoint && fillMethod == 'all'){actualYval = prevPoint.yval;}else if(nextPoint && fillMethod == 'all'){actualYval = nextPoint.yval;}else {actualYval = 0;}}}else {prevPoint = point;}var stackedYval=cumulativeYval[xval];if(lastXval != xval){ // If an x-value is repeated, we ignore the duplicates. +stackedYval += actualYval;cumulativeYval[xval] = stackedYval;}lastXval = xval;point.yval_stacked = stackedYval;if(stackedYval > seriesExtremes[1]){seriesExtremes[1] = stackedYval;}if(stackedYval < seriesExtremes[0]){seriesExtremes[0] = stackedYval;}}}; /** + * Loop over all fields and create datasets, calculating extreme y-values for + * each series and extreme x-indices as we go. + * + * dateWindow is passed in as an explicit parameter so that we can compute + * extreme values "speculatively", i.e. without actually setting state on the + * dygraph. + * + * @param {Array.)>>} rolledSeries, where + * rolledSeries[seriesIndex][row] = raw point, where + * seriesIndex is the column number starting with 1, and + * rawPoint is [x,y] or [x, [y, err]] or [x, [y, yminus, yplus]]. + * @param {?Array.} dateWindow [xmin, xmax] pair, or null. + * @return {{ + * points: Array.>, + * seriesExtremes: Array.>, + * boundaryIds: Array.}} + * @private + */Dygraph.prototype.gatherDatasets_ = function(rolledSeries,dateWindow){var boundaryIds=[];var points=[];var cumulativeYval=[]; // For stacked series. +var extremes={}; // series name -> [low, high] +var seriesIdx,sampleIdx;var firstIdx,lastIdx;var axisIdx; // Loop over the fields (series). Go from the last to the first, +// because if they're stacked that's how we accumulate the values. +var num_series=rolledSeries.length - 1;var series;for(seriesIdx = num_series;seriesIdx >= 1;seriesIdx--) {if(!this.visibility()[seriesIdx - 1])continue; // Prune down to the desired range, if necessary (for zooming) +// Because there can be lines going to points outside of the visible area, +// we actually prune to visible points, plus one on either side. +if(dateWindow){series = rolledSeries[seriesIdx];var low=dateWindow[0];var high=dateWindow[1]; // TODO(danvk): do binary search instead of linear search. +// TODO(danvk): pass firstIdx and lastIdx directly to the renderer. +firstIdx = null;lastIdx = null;for(sampleIdx = 0;sampleIdx < series.length;sampleIdx++) {if(series[sampleIdx][0] >= low && firstIdx === null){firstIdx = sampleIdx;}if(series[sampleIdx][0] <= high){lastIdx = sampleIdx;}}if(firstIdx === null)firstIdx = 0;var correctedFirstIdx=firstIdx;var isInvalidValue=true;while(isInvalidValue && correctedFirstIdx > 0) {correctedFirstIdx--; // check if the y value is null. +isInvalidValue = series[correctedFirstIdx][1] === null;}if(lastIdx === null)lastIdx = series.length - 1;var correctedLastIdx=lastIdx;isInvalidValue = true;while(isInvalidValue && correctedLastIdx < series.length - 1) {correctedLastIdx++;isInvalidValue = series[correctedLastIdx][1] === null;}if(correctedFirstIdx !== firstIdx){firstIdx = correctedFirstIdx;}if(correctedLastIdx !== lastIdx){lastIdx = correctedLastIdx;}boundaryIds[seriesIdx - 1] = [firstIdx,lastIdx]; // .slice's end is exclusive, we want to include lastIdx. +series = series.slice(firstIdx,lastIdx + 1);}else {series = rolledSeries[seriesIdx];boundaryIds[seriesIdx - 1] = [0,series.length - 1];}var seriesName=this.attr_("labels")[seriesIdx];var seriesExtremes=this.dataHandler_.getExtremeYValues(series,dateWindow,this.getBooleanOption("stepPlot",seriesName));var seriesPoints=this.dataHandler_.seriesToPoints(series,seriesName,boundaryIds[seriesIdx - 1][0]);if(this.getBooleanOption("stackedGraph")){axisIdx = this.attributes_.axisForSeries(seriesName);if(cumulativeYval[axisIdx] === undefined){cumulativeYval[axisIdx] = [];}Dygraph.stackPoints_(seriesPoints,cumulativeYval[axisIdx],seriesExtremes,this.getBooleanOption("stackedGraphNaNFill"));}extremes[seriesName] = seriesExtremes;points[seriesIdx] = seriesPoints;}return {points:points,extremes:extremes,boundaryIds:boundaryIds};}; /** + * Update the graph with new data. This method is called when the viewing area + * has changed. If the underlying data or options have changed, predraw_ will + * be called before drawGraph_ is called. + * + * @private + */Dygraph.prototype.drawGraph_ = function(){var start=new Date(); // This is used to set the second parameter to drawCallback, below. +var is_initial_draw=this.is_initial_draw_;this.is_initial_draw_ = false;this.layout_.removeAllDatasets();this.setColors_();this.attrs_.pointSize = 0.5 * this.getNumericOption('highlightCircleSize');var packed=this.gatherDatasets_(this.rolledSeries_,this.dateWindow_);var points=packed.points;var extremes=packed.extremes;this.boundaryIds_ = packed.boundaryIds;this.setIndexByName_ = {};var labels=this.attr_("labels");var dataIdx=0;for(var i=1;i < points.length;i++) {if(!this.visibility()[i - 1])continue;this.layout_.addDataset(labels[i],points[i]);this.datasetIndex_[i] = dataIdx++;}for(var i=0;i < labels.length;i++) {this.setIndexByName_[labels[i]] = i;}this.computeYAxisRanges_(extremes);this.layout_.setYAxes(this.axes_);this.addXTicks_(); // Tell PlotKit to use this new data and render itself +this.layout_.evaluate();this.renderGraph_(is_initial_draw);if(this.getStringOption("timingName")){var end=new Date();console.log(this.getStringOption("timingName") + " - drawGraph: " + (end - start) + "ms");}}; /** + * This does the work of drawing the chart. It assumes that the layout and axis + * scales have already been set (e.g. by predraw_). + * + * @private + */Dygraph.prototype.renderGraph_ = function(is_initial_draw){this.cascadeEvents_('clearChart');this.plotter_.clear();var underlayCallback=this.getFunctionOption('underlayCallback');if(underlayCallback){ // NOTE: we pass the dygraph object to this callback twice to avoid breaking +// users who expect a deprecated form of this callback. +underlayCallback.call(this,this.hidden_ctx_,this.layout_.getPlotArea(),this,this);}var e={canvas:this.hidden_,drawingContext:this.hidden_ctx_};this.cascadeEvents_('willDrawChart',e);this.plotter_.render();this.cascadeEvents_('didDrawChart',e);this.lastRow_ = -1; // because plugins/legend.js clears the legend +// TODO(danvk): is this a performance bottleneck when panning? +// The interaction canvas should already be empty in that situation. +this.canvas_.getContext('2d').clearRect(0,0,this.width_,this.height_);var drawCallback=this.getFunctionOption("drawCallback");if(drawCallback !== null){drawCallback.call(this,this,is_initial_draw);}if(is_initial_draw){this.readyFired_ = true;while(this.readyFns_.length > 0) {var fn=this.readyFns_.pop();fn(this);}}}; /** + * @private + * Determine properties of the y-axes which are independent of the data + * currently being displayed. This includes things like the number of axes and + * the style of the axes. It does not include the range of each axis and its + * tick marks. + * This fills in this.axes_. + * axes_ = [ { options } ] + * indices are into the axes_ array. + */Dygraph.prototype.computeYAxes_ = function(){var axis,index,opts,v; // this.axes_ doesn't match this.attributes_.axes_.options. It's used for +// data computation as well as options storage. +// Go through once and add all the axes. +this.axes_ = [];for(axis = 0;axis < this.attributes_.numAxes();axis++) { // Add a new axis, making a copy of its per-axis options. +opts = {g:this};utils.update(opts,this.attributes_.axisOptions(axis));this.axes_[axis] = opts;}for(axis = 0;axis < this.axes_.length;axis++) {if(axis === 0){opts = this.optionsViewForAxis_('y' + (axis?'2':''));v = opts("valueRange");if(v)this.axes_[axis].valueRange = v;}else { // To keep old behavior +var axes=this.user_attrs_.axes;if(axes && axes.y2){v = axes.y2.valueRange;if(v)this.axes_[axis].valueRange = v;}}}}; /** + * Returns the number of y-axes on the chart. + * @return {number} the number of axes. + */Dygraph.prototype.numAxes = function(){return this.attributes_.numAxes();}; /** + * @private + * Returns axis properties for the given series. + * @param {string} setName The name of the series for which to get axis + * properties, e.g. 'Y1'. + * @return {Object} The axis properties. + */Dygraph.prototype.axisPropertiesForSeries = function(series){ // TODO(danvk): handle errors. +return this.axes_[this.attributes_.axisForSeries(series)];}; /** + * @private + * Determine the value range and tick marks for each axis. + * @param {Object} extremes A mapping from seriesName -> [low, high] + * This fills in the valueRange and ticks fields in each entry of this.axes_. + */Dygraph.prototype.computeYAxisRanges_ = function(extremes){var isNullUndefinedOrNaN=function isNullUndefinedOrNaN(num){return isNaN(parseFloat(num));};var numAxes=this.attributes_.numAxes();var ypadCompat,span,series,ypad;var p_axis; // Compute extreme values, a span and tick marks for each axis. +for(var i=0;i < numAxes;i++) {var axis=this.axes_[i];var logscale=this.attributes_.getForAxis("logscale",i);var includeZero=this.attributes_.getForAxis("includeZero",i);var independentTicks=this.attributes_.getForAxis("independentTicks",i);series = this.attributes_.seriesForAxis(i); // Add some padding. This supports two Y padding operation modes: +// +// - backwards compatible (yRangePad not set): +// 10% padding for automatic Y ranges, but not for user-supplied +// ranges, and move a close-to-zero edge to zero, since drawing at the edge +// results in invisible lines. Unfortunately lines drawn at the edge of a +// user-supplied range will still be invisible. If logscale is +// set, add a variable amount of padding at the top but +// none at the bottom. +// +// - new-style (yRangePad set by the user): +// always add the specified Y padding. +// +ypadCompat = true;ypad = 0.1; // add 10% +var yRangePad=this.getNumericOption('yRangePad');if(yRangePad !== null){ypadCompat = false; // Convert pixel padding to ratio +ypad = yRangePad / this.plotter_.area.h;}if(series.length === 0){ // If no series are defined or visible then use a reasonable default +axis.extremeRange = [0,1];}else { // Calculate the extremes of extremes. +var minY=Infinity; // extremes[series[0]][0]; +var maxY=-Infinity; // extremes[series[0]][1]; +var extremeMinY,extremeMaxY;for(var j=0;j < series.length;j++) { // this skips invisible series +if(!extremes.hasOwnProperty(series[j]))continue; // Only use valid extremes to stop null data series' from corrupting the scale. +extremeMinY = extremes[series[j]][0];if(extremeMinY !== null){minY = Math.min(extremeMinY,minY);}extremeMaxY = extremes[series[j]][1];if(extremeMaxY !== null){maxY = Math.max(extremeMaxY,maxY);}} // Include zero if requested by the user. +if(includeZero && !logscale){if(minY > 0)minY = 0;if(maxY < 0)maxY = 0;} // Ensure we have a valid scale, otherwise default to [0, 1] for safety. +if(minY == Infinity)minY = 0;if(maxY == -Infinity)maxY = 1;span = maxY - minY; // special case: if we have no sense of scale, center on the sole value. +if(span === 0){if(maxY !== 0){span = Math.abs(maxY);}else { // ... and if the sole value is zero, use range 0-1. +maxY = 1;span = 1;}}var maxAxisY=maxY,minAxisY=minY;if(ypadCompat){if(logscale){maxAxisY = maxY + ypad * span;minAxisY = minY;}else {maxAxisY = maxY + ypad * span;minAxisY = minY - ypad * span; // Backwards-compatible behavior: Move the span to start or end at zero if it's +// close to zero. +if(minAxisY < 0 && minY >= 0)minAxisY = 0;if(maxAxisY > 0 && maxY <= 0)maxAxisY = 0;}}axis.extremeRange = [minAxisY,maxAxisY];}if(axis.valueRange){ // This is a user-set value range for this axis. +var y0=isNullUndefinedOrNaN(axis.valueRange[0])?axis.extremeRange[0]:axis.valueRange[0];var y1=isNullUndefinedOrNaN(axis.valueRange[1])?axis.extremeRange[1]:axis.valueRange[1];axis.computedValueRange = [y0,y1];}else {axis.computedValueRange = axis.extremeRange;}if(!ypadCompat){ // When using yRangePad, adjust the upper/lower bounds to add +// padding unless the user has zoomed/panned the Y axis range. +if(logscale){y0 = axis.computedValueRange[0];y1 = axis.computedValueRange[1];var y0pct=ypad / (2 * ypad - 1);var y1pct=(ypad - 1) / (2 * ypad - 1);axis.computedValueRange[0] = utils.logRangeFraction(y0,y1,y0pct);axis.computedValueRange[1] = utils.logRangeFraction(y0,y1,y1pct);}else {y0 = axis.computedValueRange[0];y1 = axis.computedValueRange[1];span = y1 - y0;axis.computedValueRange[0] = y0 - span * ypad;axis.computedValueRange[1] = y1 + span * ypad;}}if(independentTicks){axis.independentTicks = independentTicks;var opts=this.optionsViewForAxis_('y' + (i?'2':''));var ticker=opts('ticker');axis.ticks = ticker(axis.computedValueRange[0],axis.computedValueRange[1],this.plotter_.area.h,opts,this); // Define the first independent axis as primary axis. +if(!p_axis)p_axis = axis;}}if(p_axis === undefined){throw "Configuration Error: At least one axis has to have the \"independentTicks\" option activated.";} // Add ticks. By default, all axes inherit the tick positions of the +// primary axis. However, if an axis is specifically marked as having +// independent ticks, then that is permissible as well. +for(var i=0;i < numAxes;i++) {var axis=this.axes_[i];if(!axis.independentTicks){var opts=this.optionsViewForAxis_('y' + (i?'2':''));var ticker=opts('ticker');var p_ticks=p_axis.ticks;var p_scale=p_axis.computedValueRange[1] - p_axis.computedValueRange[0];var scale=axis.computedValueRange[1] - axis.computedValueRange[0];var tick_values=[];for(var k=0;k < p_ticks.length;k++) {var y_frac=(p_ticks[k].v - p_axis.computedValueRange[0]) / p_scale;var y_val=axis.computedValueRange[0] + y_frac * scale;tick_values.push(y_val);}axis.ticks = ticker(axis.computedValueRange[0],axis.computedValueRange[1],this.plotter_.area.h,opts,this,tick_values);}}}; /** + * Detects the type of the str (date or numeric) and sets the various + * formatting attributes in this.attrs_ based on this type. + * @param {string} str An x value. + * @private + */Dygraph.prototype.detectTypeFromString_ = function(str){var isDate=false;var dashPos=str.indexOf('-'); // could be 2006-01-01 _or_ 1.0e-2 +if(dashPos > 0 && str[dashPos - 1] != 'e' && str[dashPos - 1] != 'E' || str.indexOf('/') >= 0 || isNaN(parseFloat(str))){isDate = true;}else if(str.length == 8 && str > '19700101' && str < '20371231'){ // TODO(danvk): remove support for this format. +isDate = true;}this.setXAxisOptions_(isDate);};Dygraph.prototype.setXAxisOptions_ = function(isDate){if(isDate){this.attrs_.xValueParser = utils.dateParser;this.attrs_.axes.x.valueFormatter = utils.dateValueFormatter;this.attrs_.axes.x.ticker = DygraphTickers.dateTicker;this.attrs_.axes.x.axisLabelFormatter = utils.dateAxisLabelFormatter;}else { /** @private (shut up, jsdoc!) */this.attrs_.xValueParser = function(x){return parseFloat(x);}; // TODO(danvk): use Dygraph.numberValueFormatter here? +/** @private (shut up, jsdoc!) */this.attrs_.axes.x.valueFormatter = function(x){return x;};this.attrs_.axes.x.ticker = DygraphTickers.numericTicks;this.attrs_.axes.x.axisLabelFormatter = this.attrs_.axes.x.valueFormatter;}}; /** + * @private + * Parses a string in a special csv format. We expect a csv file where each + * line is a date point, and the first field in each line is the date string. + * We also expect that all remaining fields represent series. + * if the errorBars attribute is set, then interpret the fields as: + * date, series1, stddev1, series2, stddev2, ... + * @param {[Object]} data See above. + * + * @return [Object] An array with one entry for each row. These entries + * are an array of cells in that row. The first entry is the parsed x-value for + * the row. The second, third, etc. are the y-values. These can take on one of + * three forms, depending on the CSV and constructor parameters: + * 1. numeric value + * 2. [ value, stddev ] + * 3. [ low value, center value, high value ] + */Dygraph.prototype.parseCSV_ = function(data){var ret=[];var line_delimiter=utils.detectLineDelimiter(data);var lines=data.split(line_delimiter || "\n");var vals,j; // Use the default delimiter or fall back to a tab if that makes sense. +var delim=this.getStringOption('delimiter');if(lines[0].indexOf(delim) == -1 && lines[0].indexOf('\t') >= 0){delim = '\t';}var start=0;if(!('labels' in this.user_attrs_)){ // User hasn't explicitly set labels, so they're (presumably) in the CSV. +start = 1;this.attrs_.labels = lines[0].split(delim); // NOTE: _not_ user_attrs_. +this.attributes_.reparseSeries();}var line_no=0;var xParser;var defaultParserSet=false; // attempt to auto-detect x value type +var expectedCols=this.attr_("labels").length;var outOfOrder=false;for(var i=start;i < lines.length;i++) {var line=lines[i];line_no = i;if(line.length === 0)continue; // skip blank lines +if(line[0] == '#')continue; // skip comment lines +var inFields=line.split(delim);if(inFields.length < 2)continue;var fields=[];if(!defaultParserSet){this.detectTypeFromString_(inFields[0]);xParser = this.getFunctionOption("xValueParser");defaultParserSet = true;}fields[0] = xParser(inFields[0],this); // If fractions are expected, parse the numbers as "A/B" +if(this.fractions_){for(j = 1;j < inFields.length;j++) { // TODO(danvk): figure out an appropriate way to flag parse errors. +vals = inFields[j].split("/");if(vals.length != 2){console.error('Expected fractional "num/den" values in CSV data ' + "but found a value '" + inFields[j] + "' on line " + (1 + i) + " ('" + line + "') which is not of this form.");fields[j] = [0,0];}else {fields[j] = [utils.parseFloat_(vals[0],i,line),utils.parseFloat_(vals[1],i,line)];}}}else if(this.getBooleanOption("errorBars")){ // If there are error bars, values are (value, stddev) pairs +if(inFields.length % 2 != 1){console.error('Expected alternating (value, stdev.) pairs in CSV data ' + 'but line ' + (1 + i) + ' has an odd number of values (' + (inFields.length - 1) + "): '" + line + "'");}for(j = 1;j < inFields.length;j += 2) {fields[(j + 1) / 2] = [utils.parseFloat_(inFields[j],i,line),utils.parseFloat_(inFields[j + 1],i,line)];}}else if(this.getBooleanOption("customBars")){ // Bars are a low;center;high tuple +for(j = 1;j < inFields.length;j++) {var val=inFields[j];if(/^ *$/.test(val)){fields[j] = [null,null,null];}else {vals = val.split(";");if(vals.length == 3){fields[j] = [utils.parseFloat_(vals[0],i,line),utils.parseFloat_(vals[1],i,line),utils.parseFloat_(vals[2],i,line)];}else {console.warn('When using customBars, values must be either blank ' + 'or "low;center;high" tuples (got "' + val + '" on line ' + (1 + i));}}}}else { // Values are just numbers +for(j = 1;j < inFields.length;j++) {fields[j] = utils.parseFloat_(inFields[j],i,line);}}if(ret.length > 0 && fields[0] < ret[ret.length - 1][0]){outOfOrder = true;}if(fields.length != expectedCols){console.error("Number of columns in line " + i + " (" + fields.length + ") does not agree with number of labels (" + expectedCols + ") " + line);} // If the user specified the 'labels' option and none of the cells of the +// first row parsed correctly, then they probably double-specified the +// labels. We go with the values set in the option, discard this row and +// log a warning to the JS console. +if(i === 0 && this.attr_('labels')){var all_null=true;for(j = 0;all_null && j < fields.length;j++) {if(fields[j])all_null = false;}if(all_null){console.warn("The dygraphs 'labels' option is set, but the first row " + "of CSV data ('" + line + "') appears to also contain " + "labels. Will drop the CSV labels and use the option " + "labels.");continue;}}ret.push(fields);}if(outOfOrder){console.warn("CSV is out of order; order it correctly to speed loading.");ret.sort(function(a,b){return a[0] - b[0];});}return ret;}; // In native format, all values must be dates or numbers. +// This check isn't perfect but will catch most mistaken uses of strings. +function validateNativeFormat(data){var firstRow=data[0];var firstX=firstRow[0];if(typeof firstX !== 'number' && !utils.isDateLike(firstX)){throw new Error('Expected number or date but got ' + typeof firstX + ': ' + firstX + '.');}for(var i=1;i < firstRow.length;i++) {var val=firstRow[i];if(val === null || val === undefined)continue;if(typeof val === 'number')continue;if(utils.isArrayLike(val))continue; // e.g. error bars or custom bars. +throw new Error('Expected number or array but got ' + typeof val + ': ' + val + '.');}} /** + * The user has provided their data as a pre-packaged JS array. If the x values + * are numeric, this is the same as dygraphs' internal format. If the x values + * are dates, we need to convert them from Date objects to ms since epoch. + * @param {!Array} data + * @return {Object} data with numeric x values. + * @private + */Dygraph.prototype.parseArray_ = function(data){ // Peek at the first x value to see if it's numeric. +if(data.length === 0){console.error("Can't plot empty data set");return null;}if(data[0].length === 0){console.error("Data set cannot contain an empty row");return null;}validateNativeFormat(data);var i;if(this.attr_("labels") === null){console.warn("Using default labels. Set labels explicitly via 'labels' " + "in the options parameter");this.attrs_.labels = ["X"];for(i = 1;i < data[0].length;i++) {this.attrs_.labels.push("Y" + i); // Not user_attrs_. +}this.attributes_.reparseSeries();}else {var num_labels=this.attr_("labels");if(num_labels.length != data[0].length){console.error("Mismatch between number of labels (" + num_labels + ")" + " and number of columns in array (" + data[0].length + ")");return null;}}if(utils.isDateLike(data[0][0])){ // Some intelligent defaults for a date x-axis. +this.attrs_.axes.x.valueFormatter = utils.dateValueFormatter;this.attrs_.axes.x.ticker = DygraphTickers.dateTicker;this.attrs_.axes.x.axisLabelFormatter = utils.dateAxisLabelFormatter; // Assume they're all dates. +var parsedData=utils.clone(data);for(i = 0;i < data.length;i++) {if(parsedData[i].length === 0){console.error("Row " + (1 + i) + " of data is empty");return null;}if(parsedData[i][0] === null || typeof parsedData[i][0].getTime != 'function' || isNaN(parsedData[i][0].getTime())){console.error("x value in row " + (1 + i) + " is not a Date");return null;}parsedData[i][0] = parsedData[i][0].getTime();}return parsedData;}else { // Some intelligent defaults for a numeric x-axis. +/** @private (shut up, jsdoc!) */this.attrs_.axes.x.valueFormatter = function(x){return x;};this.attrs_.axes.x.ticker = DygraphTickers.numericTicks;this.attrs_.axes.x.axisLabelFormatter = utils.numberAxisLabelFormatter;return data;}}; /** + * Parses a DataTable object from gviz. + * The data is expected to have a first column that is either a date or a + * number. All subsequent columns must be numbers. If there is a clear mismatch + * between this.xValueParser_ and the type of the first column, it will be + * fixed. Fills out rawData_. + * @param {!google.visualization.DataTable} data See above. + * @private + */Dygraph.prototype.parseDataTable_ = function(data){var shortTextForAnnotationNum=function shortTextForAnnotationNum(num){ // converts [0-9]+ [A-Z][a-z]* +// example: 0=A, 1=B, 25=Z, 26=Aa, 27=Ab +// and continues like.. Ba Bb .. Za .. Zz..Aaa...Zzz Aaaa Zzzz +var shortText=String.fromCharCode(65 /* A */ + num % 26);num = Math.floor(num / 26);while(num > 0) {shortText = String.fromCharCode(65 /* A */ + (num - 1) % 26) + shortText.toLowerCase();num = Math.floor((num - 1) / 26);}return shortText;};var cols=data.getNumberOfColumns();var rows=data.getNumberOfRows();var indepType=data.getColumnType(0);if(indepType == 'date' || indepType == 'datetime'){this.attrs_.xValueParser = utils.dateParser;this.attrs_.axes.x.valueFormatter = utils.dateValueFormatter;this.attrs_.axes.x.ticker = DygraphTickers.dateTicker;this.attrs_.axes.x.axisLabelFormatter = utils.dateAxisLabelFormatter;}else if(indepType == 'number'){this.attrs_.xValueParser = function(x){return parseFloat(x);};this.attrs_.axes.x.valueFormatter = function(x){return x;};this.attrs_.axes.x.ticker = DygraphTickers.numericTicks;this.attrs_.axes.x.axisLabelFormatter = this.attrs_.axes.x.valueFormatter;}else {throw new Error("only 'date', 'datetime' and 'number' types are supported " + "for column 1 of DataTable input (Got '" + indepType + "')");} // Array of the column indices which contain data (and not annotations). +var colIdx=[];var annotationCols={}; // data index -> [annotation cols] +var hasAnnotations=false;var i,j;for(i = 1;i < cols;i++) {var type=data.getColumnType(i);if(type == 'number'){colIdx.push(i);}else if(type == 'string' && this.getBooleanOption('displayAnnotations')){ // This is OK -- it's an annotation column. +var dataIdx=colIdx[colIdx.length - 1];if(!annotationCols.hasOwnProperty(dataIdx)){annotationCols[dataIdx] = [i];}else {annotationCols[dataIdx].push(i);}hasAnnotations = true;}else {throw new Error("Only 'number' is supported as a dependent type with Gviz." + " 'string' is only supported if displayAnnotations is true");}} // Read column labels +// TODO(danvk): add support back for errorBars +var labels=[data.getColumnLabel(0)];for(i = 0;i < colIdx.length;i++) {labels.push(data.getColumnLabel(colIdx[i]));if(this.getBooleanOption("errorBars"))i += 1;}this.attrs_.labels = labels;cols = labels.length;var ret=[];var outOfOrder=false;var annotations=[];for(i = 0;i < rows;i++) {var row=[];if(typeof data.getValue(i,0) === 'undefined' || data.getValue(i,0) === null){console.warn("Ignoring row " + i + " of DataTable because of undefined or null first column.");continue;}if(indepType == 'date' || indepType == 'datetime'){row.push(data.getValue(i,0).getTime());}else {row.push(data.getValue(i,0));}if(!this.getBooleanOption("errorBars")){for(j = 0;j < colIdx.length;j++) {var col=colIdx[j];row.push(data.getValue(i,col));if(hasAnnotations && annotationCols.hasOwnProperty(col) && data.getValue(i,annotationCols[col][0]) !== null){var ann={};ann.series = data.getColumnLabel(col);ann.xval = row[0];ann.shortText = shortTextForAnnotationNum(annotations.length);ann.text = '';for(var k=0;k < annotationCols[col].length;k++) {if(k)ann.text += "\n";ann.text += data.getValue(i,annotationCols[col][k]);}annotations.push(ann);}} // Strip out infinities, which give dygraphs problems later on. +for(j = 0;j < row.length;j++) {if(!isFinite(row[j]))row[j] = null;}}else {for(j = 0;j < cols - 1;j++) {row.push([data.getValue(i,1 + 2 * j),data.getValue(i,2 + 2 * j)]);}}if(ret.length > 0 && row[0] < ret[ret.length - 1][0]){outOfOrder = true;}ret.push(row);}if(outOfOrder){console.warn("DataTable is out of order; order it correctly to speed loading.");ret.sort(function(a,b){return a[0] - b[0];});}this.rawData_ = ret;if(annotations.length > 0){this.setAnnotations(annotations,true);}this.attributes_.reparseSeries();}; /** + * Signals to plugins that the chart data has updated. + * This happens after the data has updated but before the chart has redrawn. + * @private + */Dygraph.prototype.cascadeDataDidUpdateEvent_ = function(){ // TODO(danvk): there are some issues checking xAxisRange() and using +// toDomCoords from handlers of this event. The visible range should be set +// when the chart is drawn, not derived from the data. +this.cascadeEvents_('dataDidUpdate',{});}; /** + * Get the CSV data. If it's in a function, call that function. If it's in a + * file, do an XMLHttpRequest to get it. + * @private + */Dygraph.prototype.start_ = function(){var data=this.file_; // Functions can return references of all other types. +if(typeof data == 'function'){data = data();}if(utils.isArrayLike(data)){this.rawData_ = this.parseArray_(data);this.cascadeDataDidUpdateEvent_();this.predraw_();}else if(typeof data == 'object' && typeof data.getColumnRange == 'function'){ // must be a DataTable from gviz. +this.parseDataTable_(data);this.cascadeDataDidUpdateEvent_();this.predraw_();}else if(typeof data == 'string'){ // Heuristic: a newline means it's CSV data. Otherwise it's an URL. +var line_delimiter=utils.detectLineDelimiter(data);if(line_delimiter){this.loadedEvent_(data);}else { // REMOVE_FOR_IE +var req;if(window.XMLHttpRequest){ // Firefox, Opera, IE7, and other browsers will use the native object +req = new XMLHttpRequest();}else { // IE 5 and 6 will use the ActiveX control +req = new ActiveXObject("Microsoft.XMLHTTP");}var caller=this;req.onreadystatechange = function(){if(req.readyState == 4){if(req.status === 200 || // Normal http +req.status === 0){ // Chrome w/ --allow-file-access-from-files +caller.loadedEvent_(req.responseText);}}};req.open("GET",data,true);req.send(null);}}else {console.error("Unknown data format: " + typeof data);}}; /** + * Changes various properties of the graph. These can include: + *
    + *
  • file: changes the source data for the graph
  • + *
  • errorBars: changes whether the data contains stddev
  • + *
+ * + * There's a huge variety of options that can be passed to this method. For a + * full list, see http://dygraphs.com/options.html. + * + * @param {Object} input_attrs The new properties and values + * @param {boolean} block_redraw Usually the chart is redrawn after every + * call to updateOptions(). If you know better, you can pass true to + * explicitly block the redraw. This can be useful for chaining + * updateOptions() calls, avoiding the occasional infinite loop and + * preventing redraws when it's not necessary (e.g. when updating a + * callback). + */Dygraph.prototype.updateOptions = function(input_attrs,block_redraw){if(typeof block_redraw == 'undefined')block_redraw = false; // copyUserAttrs_ drops the "file" parameter as a convenience to us. +var file=input_attrs.file;var attrs=Dygraph.copyUserAttrs_(input_attrs); // TODO(danvk): this is a mess. Move these options into attr_. +if('rollPeriod' in attrs){this.rollPeriod_ = attrs.rollPeriod;}if('dateWindow' in attrs){this.dateWindow_ = attrs.dateWindow;} // TODO(danvk): validate per-series options. +// Supported: +// strokeWidth +// pointSize +// drawPoints +// highlightCircleSize +// Check if this set options will require new points. +var requiresNewPoints=utils.isPixelChangingOptionList(this.attr_("labels"),attrs);utils.updateDeep(this.user_attrs_,attrs);this.attributes_.reparseSeries();if(file){ // This event indicates that the data is about to change, but hasn't yet. +// TODO(danvk): support cancellation of the update via this event. +this.cascadeEvents_('dataWillUpdate',{});this.file_ = file;if(!block_redraw)this.start_();}else {if(!block_redraw){if(requiresNewPoints){this.predraw_();}else {this.renderGraph_(false);}}}}; /** + * Make a copy of input attributes, removing file as a convenience. + * @private + */Dygraph.copyUserAttrs_ = function(attrs){var my_attrs={};for(var k in attrs) {if(!attrs.hasOwnProperty(k))continue;if(k == 'file')continue;if(attrs.hasOwnProperty(k))my_attrs[k] = attrs[k];}return my_attrs;}; /** + * Resizes the dygraph. If no parameters are specified, resizes to fill the + * containing div (which has presumably changed size since the dygraph was + * instantiated. If the width/height are specified, the div will be resized. + * + * This is far more efficient than destroying and re-instantiating a + * Dygraph, since it doesn't have to reparse the underlying data. + * + * @param {number} width Width (in pixels) + * @param {number} height Height (in pixels) + */Dygraph.prototype.resize = function(width,height){if(this.resize_lock){return;}this.resize_lock = true;if(width === null != (height === null)){console.warn("Dygraph.resize() should be called with zero parameters or " + "two non-NULL parameters. Pretending it was zero.");width = height = null;}var old_width=this.width_;var old_height=this.height_;if(width){this.maindiv_.style.width = width + "px";this.maindiv_.style.height = height + "px";this.width_ = width;this.height_ = height;}else {this.width_ = this.maindiv_.clientWidth;this.height_ = this.maindiv_.clientHeight;}if(old_width != this.width_ || old_height != this.height_){ // Resizing a canvas erases it, even when the size doesn't change, so +// any resize needs to be followed by a redraw. +this.resizeElements_();this.predraw_();}this.resize_lock = false;}; /** + * Adjusts the number of points in the rolling average. Updates the graph to + * reflect the new averaging period. + * @param {number} length Number of points over which to average the data. + */Dygraph.prototype.adjustRoll = function(length){this.rollPeriod_ = length;this.predraw_();}; /** + * Returns a boolean array of visibility statuses. + */Dygraph.prototype.visibility = function(){ // Do lazy-initialization, so that this happens after we know the number of +// data series. +if(!this.getOption("visibility")){this.attrs_.visibility = [];} // TODO(danvk): it looks like this could go into an infinite loop w/ user_attrs. +while(this.getOption("visibility").length < this.numColumns() - 1) {this.attrs_.visibility.push(true);}return this.getOption("visibility");}; /** + * Changes the visibility of one or more series. + * + * @param {number|number[]|object} num the series index or an array of series indices + * or a boolean array of visibility states by index + * or an object mapping series numbers, as keys, to + * visibility state (boolean values) + * @param {boolean} value the visibility state expressed as a boolean + */Dygraph.prototype.setVisibility = function(num,value){var x=this.visibility();var numIsObject=false;if(!Array.isArray(num)){if(num !== null && typeof num === 'object'){numIsObject = true;}else {num = [num];}}if(numIsObject){for(var i in num) {if(num.hasOwnProperty(i)){if(i < 0 || i >= x.length){console.warn("Invalid series number in setVisibility: " + i);}else {x[i] = num[i];}}}}else {for(var i=0;i < num.length;i++) {if(typeof num[i] === 'boolean'){if(i >= x.length){console.warn("Invalid series number in setVisibility: " + i);}else {x[i] = num[i];}}else {if(num[i] < 0 || num[i] >= x.length){console.warn("Invalid series number in setVisibility: " + num[i]);}else {x[num[i]] = value;}}}}this.predraw_();}; /** + * How large of an area will the dygraph render itself in? + * This is used for testing. + * @return A {width: w, height: h} object. + * @private + */Dygraph.prototype.size = function(){return {width:this.width_,height:this.height_};}; /** + * Update the list of annotations and redraw the chart. + * See dygraphs.com/annotations.html for more info on how to use annotations. + * @param ann {Array} An array of annotation objects. + * @param suppressDraw {Boolean} Set to "true" to block chart redraw (optional). + */Dygraph.prototype.setAnnotations = function(ann,suppressDraw){ // Only add the annotation CSS rule once we know it will be used. +this.annotations_ = ann;if(!this.layout_){console.warn("Tried to setAnnotations before dygraph was ready. " + "Try setting them in a ready() block. See " + "dygraphs.com/tests/annotation.html");return;}this.layout_.setAnnotations(this.annotations_);if(!suppressDraw){this.predraw_();}}; /** + * Return the list of annotations. + */Dygraph.prototype.annotations = function(){return this.annotations_;}; /** + * Get the list of label names for this graph. The first column is the + * x-axis, so the data series names start at index 1. + * + * Returns null when labels have not yet been defined. + */Dygraph.prototype.getLabels = function(){var labels=this.attr_("labels");return labels?labels.slice():null;}; /** + * Get the index of a series (column) given its name. The first column is the + * x-axis, so the data series start with index 1. + */Dygraph.prototype.indexFromSetName = function(name){return this.setIndexByName_[name];}; /** + * Find the row number corresponding to the given x-value. + * Returns null if there is no such x-value in the data. + * If there are multiple rows with the same x-value, this will return the + * first one. + * @param {number} xVal The x-value to look for (e.g. millis since epoch). + * @return {?number} The row number, which you can pass to getValue(), or null. + */Dygraph.prototype.getRowForX = function(xVal){var low=0,high=this.numRows() - 1;while(low <= high) {var idx=high + low >> 1;var x=this.getValue(idx,0);if(x < xVal){low = idx + 1;}else if(x > xVal){high = idx - 1;}else if(low != idx){ // equal, but there may be an earlier match. +high = idx;}else {return idx;}}return null;}; /** + * Trigger a callback when the dygraph has drawn itself and is ready to be + * manipulated. This is primarily useful when dygraphs has to do an XHR for the + * data (i.e. a URL is passed as the data source) and the chart is drawn + * asynchronously. If the chart has already drawn, the callback will fire + * immediately. + * + * This is a good place to call setAnnotation(). + * + * @param {function(!Dygraph)} callback The callback to trigger when the chart + * is ready. + */Dygraph.prototype.ready = function(callback){if(this.is_initial_draw_){this.readyFns_.push(callback);}else {callback.call(this,this);}}; /** + * Add an event handler. This event handler is kept until the graph is + * destroyed with a call to graph.destroy(). + * + * @param {!Node} elem The element to add the event to. + * @param {string} type The type of the event, e.g. 'click' or 'mousemove'. + * @param {function(Event):(boolean|undefined)} fn The function to call + * on the event. The function takes one parameter: the event object. + * @private + */Dygraph.prototype.addAndTrackEvent = function(elem,type,fn){utils.addEvent(elem,type,fn);this.registeredEvents_.push({elem:elem,type:type,fn:fn});};Dygraph.prototype.removeTrackedEvents_ = function(){if(this.registeredEvents_){for(var idx=0;idx < this.registeredEvents_.length;idx++) {var reg=this.registeredEvents_[idx];utils.removeEvent(reg.elem,reg.type,reg.fn);}}this.registeredEvents_ = [];}; // Installed plugins, in order of precedence (most-general to most-specific). +Dygraph.PLUGINS = [_pluginsLegend2['default'],_pluginsAxes2['default'],_pluginsRangeSelector2['default'], // Has to be before ChartLabels so that its callbacks are called after ChartLabels' callbacks. +_pluginsChartLabels2['default'],_pluginsAnnotations2['default'],_pluginsGrid2['default']]; // There are many symbols which have historically been available through the +// Dygraph class. These are exported here for backwards compatibility. +Dygraph.GVizChart = _dygraphGviz2['default'];Dygraph.DASHED_LINE = utils.DASHED_LINE;Dygraph.DOT_DASH_LINE = utils.DOT_DASH_LINE;Dygraph.dateAxisLabelFormatter = utils.dateAxisLabelFormatter;Dygraph.toRGB_ = utils.toRGB_;Dygraph.findPos = utils.findPos;Dygraph.pageX = utils.pageX;Dygraph.pageY = utils.pageY;Dygraph.dateString_ = utils.dateString_;Dygraph.defaultInteractionModel = _dygraphInteractionModel2['default'].defaultModel;Dygraph.nonInteractiveModel = Dygraph.nonInteractiveModel_ = _dygraphInteractionModel2['default'].nonInteractiveModel_;Dygraph.Circles = utils.Circles;Dygraph.Plugins = {Legend:_pluginsLegend2['default'],Axes:_pluginsAxes2['default'],Annotations:_pluginsAnnotations2['default'],ChartLabels:_pluginsChartLabels2['default'],Grid:_pluginsGrid2['default'],RangeSelector:_pluginsRangeSelector2['default']};Dygraph.DataHandlers = {DefaultHandler:_datahandlerDefault2['default'],BarsHandler:_datahandlerBars2['default'],CustomBarsHandler:_datahandlerBarsCustom2['default'],DefaultFractionHandler:_datahandlerDefaultFractions2['default'],ErrorBarsHandler:_datahandlerBarsError2['default'],FractionsBarsHandler:_datahandlerBarsFractions2['default']};Dygraph.startPan = _dygraphInteractionModel2['default'].startPan;Dygraph.startZoom = _dygraphInteractionModel2['default'].startZoom;Dygraph.movePan = _dygraphInteractionModel2['default'].movePan;Dygraph.moveZoom = _dygraphInteractionModel2['default'].moveZoom;Dygraph.endPan = _dygraphInteractionModel2['default'].endPan;Dygraph.endZoom = _dygraphInteractionModel2['default'].endZoom;Dygraph.numericLinearTicks = DygraphTickers.numericLinearTicks;Dygraph.numericTicks = DygraphTickers.numericTicks;Dygraph.dateTicker = DygraphTickers.dateTicker;Dygraph.Granularity = DygraphTickers.Granularity;Dygraph.getDateAxis = DygraphTickers.getDateAxis;Dygraph.floatFormat = utils.floatFormat;exports['default'] = Dygraph;module.exports = exports['default']; + +}).call(this,require('_process')) + +},{"./datahandler/bars":5,"./datahandler/bars-custom":2,"./datahandler/bars-error":3,"./datahandler/bars-fractions":4,"./datahandler/default":8,"./datahandler/default-fractions":7,"./dygraph-canvas":9,"./dygraph-default-attrs":10,"./dygraph-gviz":11,"./dygraph-interaction-model":12,"./dygraph-layout":13,"./dygraph-options":15,"./dygraph-options-reference":14,"./dygraph-tickers":16,"./dygraph-utils":17,"./iframe-tarp":19,"./plugins/annotations":20,"./plugins/axes":21,"./plugins/chart-labels":22,"./plugins/grid":23,"./plugins/legend":24,"./plugins/range-selector":25,"_process":1}],19:[function(require,module,exports){ +/** + * To create a "drag" interaction, you typically register a mousedown event + * handler on the element where the drag begins. In that handler, you register a + * mouseup handler on the window to determine when the mouse is released, + * wherever that release happens. This works well, except when the user releases + * the mouse over an off-domain iframe. In that case, the mouseup event is + * handled by the iframe and never bubbles up to the window handler. + * + * To deal with this issue, we cover iframes with high z-index divs to make sure + * they don't capture mouseup. + * + * Usage: + * element.addEventListener('mousedown', function() { + * var tarper = new IFrameTarp(); + * tarper.cover(); + * var mouseUpHandler = function() { + * ... + * window.removeEventListener(mouseUpHandler); + * tarper.uncover(); + * }; + * window.addEventListener('mouseup', mouseUpHandler); + * }; + * + * @constructor + */ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } + +var _dygraphUtils = require('./dygraph-utils'); + +var utils = _interopRequireWildcard(_dygraphUtils); + +function IFrameTarp() { + /** @type {Array.} */ + this.tarps = []; +}; + +/** + * Find all the iframes in the document and cover them with high z-index + * transparent divs. + */ +IFrameTarp.prototype.cover = function () { + var iframes = document.getElementsByTagName("iframe"); + for (var i = 0; i < iframes.length; i++) { + var iframe = iframes[i]; + var pos = utils.findPos(iframe), + x = pos.x, + y = pos.y, + width = iframe.offsetWidth, + height = iframe.offsetHeight; + + var div = document.createElement("div"); + div.style.position = "absolute"; + div.style.left = x + 'px'; + div.style.top = y + 'px'; + div.style.width = width + 'px'; + div.style.height = height + 'px'; + div.style.zIndex = 999; + document.body.appendChild(div); + this.tarps.push(div); + } +}; + +/** + * Remove all the iframe covers. You should call this in a mouseup handler. + */ +IFrameTarp.prototype.uncover = function () { + for (var i = 0; i < this.tarps.length; i++) { + this.tarps[i].parentNode.removeChild(this.tarps[i]); + } + this.tarps = []; +}; + +exports["default"] = IFrameTarp; +module.exports = exports["default"]; + +},{"./dygraph-utils":17}],20:[function(require,module,exports){ +/** + * @license + * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/*global Dygraph:false */ + +"use strict"; + +/** +Current bits of jankiness: +- Uses dygraph.layout_ to get the parsed annotations. +- Uses dygraph.plotter_.area + +It would be nice if the plugin didn't require so much special support inside +the core dygraphs classes, but annotations involve quite a bit of parsing and +layout. + +TODO(danvk): cache DOM elements. +*/ + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var annotations = function annotations() { + this.annotations_ = []; +}; + +annotations.prototype.toString = function () { + return "Annotations Plugin"; +}; + +annotations.prototype.activate = function (g) { + return { + clearChart: this.clearChart, + didDrawChart: this.didDrawChart + }; +}; + +annotations.prototype.detachLabels = function () { + for (var i = 0; i < this.annotations_.length; i++) { + var a = this.annotations_[i]; + if (a.parentNode) a.parentNode.removeChild(a); + this.annotations_[i] = null; + } + this.annotations_ = []; +}; + +annotations.prototype.clearChart = function (e) { + this.detachLabels(); +}; + +annotations.prototype.didDrawChart = function (e) { + var g = e.dygraph; + + // Early out in the (common) case of zero annotations. + var points = g.layout_.annotated_points; + if (!points || points.length === 0) return; + + var containerDiv = e.canvas.parentNode; + + var bindEvt = function bindEvt(eventName, classEventName, pt) { + return function (annotation_event) { + var a = pt.annotation; + if (a.hasOwnProperty(eventName)) { + a[eventName](a, pt, g, annotation_event); + } else if (g.getOption(classEventName)) { + g.getOption(classEventName)(a, pt, g, annotation_event); + } + }; + }; + + // Add the annotations one-by-one. + var area = e.dygraph.getArea(); + + // x-coord to sum of previous annotation's heights (used for stacking). + var xToUsedHeight = {}; + + for (var i = 0; i < points.length; i++) { + var p = points[i]; + if (p.canvasx < area.x || p.canvasx > area.x + area.w || p.canvasy < area.y || p.canvasy > area.y + area.h) { + continue; + } + + var a = p.annotation; + var tick_height = 6; + if (a.hasOwnProperty("tickHeight")) { + tick_height = a.tickHeight; + } + + // TODO: deprecate axisLabelFontSize in favor of CSS + var div = document.createElement("div"); + div.style['fontSize'] = g.getOption('axisLabelFontSize') + "px"; + var className = 'dygraph-annotation'; + if (!a.hasOwnProperty('icon')) { + // camelCase class names are deprecated. + className += ' dygraphDefaultAnnotation dygraph-default-annotation'; + } + if (a.hasOwnProperty('cssClass')) { + className += " " + a.cssClass; + } + div.className = className; + + var width = a.hasOwnProperty('width') ? a.width : 16; + var height = a.hasOwnProperty('height') ? a.height : 16; + if (a.hasOwnProperty('icon')) { + var img = document.createElement("img"); + img.src = a.icon; + img.width = width; + img.height = height; + div.appendChild(img); + } else if (p.annotation.hasOwnProperty('shortText')) { + div.appendChild(document.createTextNode(p.annotation.shortText)); + } + var left = p.canvasx - width / 2; + div.style.left = left + "px"; + var divTop = 0; + if (a.attachAtBottom) { + var y = area.y + area.h - height - tick_height; + if (xToUsedHeight[left]) { + y -= xToUsedHeight[left]; + } else { + xToUsedHeight[left] = 0; + } + xToUsedHeight[left] += tick_height + height; + divTop = y; + } else { + divTop = p.canvasy - height - tick_height; + } + div.style.top = divTop + "px"; + div.style.width = width + "px"; + div.style.height = height + "px"; + div.title = p.annotation.text; + div.style.color = g.colorsMap_[p.name]; + div.style.borderColor = g.colorsMap_[p.name]; + a.div = div; + + g.addAndTrackEvent(div, 'click', bindEvt('clickHandler', 'annotationClickHandler', p, this)); + g.addAndTrackEvent(div, 'mouseover', bindEvt('mouseOverHandler', 'annotationMouseOverHandler', p, this)); + g.addAndTrackEvent(div, 'mouseout', bindEvt('mouseOutHandler', 'annotationMouseOutHandler', p, this)); + g.addAndTrackEvent(div, 'dblclick', bindEvt('dblClickHandler', 'annotationDblClickHandler', p, this)); + + containerDiv.appendChild(div); + this.annotations_.push(div); + + var ctx = e.drawingContext; + ctx.save(); + ctx.strokeStyle = a.hasOwnProperty('tickColor') ? a.tickColor : g.colorsMap_[p.name]; + ctx.lineWidth = a.hasOwnProperty('tickWidth') ? a.tickWidth : g.getOption('strokeWidth'); + ctx.beginPath(); + if (!a.attachAtBottom) { + ctx.moveTo(p.canvasx, p.canvasy); + ctx.lineTo(p.canvasx, p.canvasy - 2 - tick_height); + } else { + var y = divTop + height; + ctx.moveTo(p.canvasx, y); + ctx.lineTo(p.canvasx, y + tick_height); + } + ctx.closePath(); + ctx.stroke(); + ctx.restore(); + } +}; + +annotations.prototype.destroy = function () { + this.detachLabels(); +}; + +exports["default"] = annotations; +module.exports = exports["default"]; + +},{}],21:[function(require,module,exports){ +/** + * @license + * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/*global Dygraph:false */ + +'use strict'; + +/* +Bits of jankiness: +- Direct layout access +- Direct area access +- Should include calculation of ticks, not just the drawing. + +Options left to make axis-friendly. + ('drawAxesAtZero') + ('xAxisHeight') +*/ + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } + +var _dygraphUtils = require('../dygraph-utils'); + +var utils = _interopRequireWildcard(_dygraphUtils); + +/** + * Draws the axes. This includes the labels on the x- and y-axes, as well + * as the tick marks on the axes. + * It does _not_ draw the grid lines which span the entire chart. + */ +var axes = function axes() { + this.xlabels_ = []; + this.ylabels_ = []; +}; + +axes.prototype.toString = function () { + return 'Axes Plugin'; +}; + +axes.prototype.activate = function (g) { + return { + layout: this.layout, + clearChart: this.clearChart, + willDrawChart: this.willDrawChart + }; +}; + +axes.prototype.layout = function (e) { + var g = e.dygraph; + + if (g.getOptionForAxis('drawAxis', 'y')) { + var w = g.getOptionForAxis('axisLabelWidth', 'y') + 2 * g.getOptionForAxis('axisTickSize', 'y'); + e.reserveSpaceLeft(w); + } + + if (g.getOptionForAxis('drawAxis', 'x')) { + var h; + // NOTE: I think this is probably broken now, since g.getOption() now + // hits the dictionary. (That is, g.getOption('xAxisHeight') now always + // has a value.) + if (g.getOption('xAxisHeight')) { + h = g.getOption('xAxisHeight'); + } else { + h = g.getOptionForAxis('axisLabelFontSize', 'x') + 2 * g.getOptionForAxis('axisTickSize', 'x'); + } + e.reserveSpaceBottom(h); + } + + if (g.numAxes() == 2) { + if (g.getOptionForAxis('drawAxis', 'y2')) { + var w = g.getOptionForAxis('axisLabelWidth', 'y2') + 2 * g.getOptionForAxis('axisTickSize', 'y2'); + e.reserveSpaceRight(w); + } + } else if (g.numAxes() > 2) { + g.error('Only two y-axes are supported at this time. (Trying ' + 'to use ' + g.numAxes() + ')'); + } +}; + +axes.prototype.detachLabels = function () { + function removeArray(ary) { + for (var i = 0; i < ary.length; i++) { + var el = ary[i]; + if (el.parentNode) el.parentNode.removeChild(el); + } + } + + removeArray(this.xlabels_); + removeArray(this.ylabels_); + this.xlabels_ = []; + this.ylabels_ = []; +}; + +axes.prototype.clearChart = function (e) { + this.detachLabels(); +}; + +axes.prototype.willDrawChart = function (e) { + var _this = this; + + var g = e.dygraph; + + if (!g.getOptionForAxis('drawAxis', 'x') && !g.getOptionForAxis('drawAxis', 'y') && !g.getOptionForAxis('drawAxis', 'y2')) { + return; + } + + // Round pixels to half-integer boundaries for crisper drawing. + function halfUp(x) { + return Math.round(x) + 0.5; + } + function halfDown(y) { + return Math.round(y) - 0.5; + } + + var context = e.drawingContext; + var containerDiv = e.canvas.parentNode; + var canvasWidth = g.width_; // e.canvas.width is affected by pixel ratio. + var canvasHeight = g.height_; + + var label, x, y, tick, i; + + var makeLabelStyle = function makeLabelStyle(axis) { + return { + position: 'absolute', + fontSize: g.getOptionForAxis('axisLabelFontSize', axis) + 'px', + width: g.getOptionForAxis('axisLabelWidth', axis) + 'px' + }; + }; + + var labelStyles = { + x: makeLabelStyle('x'), + y: makeLabelStyle('y'), + y2: makeLabelStyle('y2') + }; + + var makeDiv = function makeDiv(txt, axis, prec_axis) { + /* + * This seems to be called with the following three sets of axis/prec_axis: + * x: undefined + * y: y1 + * y: y2 + */ + var div = document.createElement('div'); + var labelStyle = labelStyles[prec_axis == 'y2' ? 'y2' : axis]; + utils.update(div.style, labelStyle); + // TODO: combine outer & inner divs + var inner_div = document.createElement('div'); + inner_div.className = 'dygraph-axis-label' + ' dygraph-axis-label-' + axis + (prec_axis ? ' dygraph-axis-label-' + prec_axis : ''); + inner_div.innerHTML = txt; + div.appendChild(inner_div); + return div; + }; + + // axis lines + context.save(); + + var layout = g.layout_; + var area = e.dygraph.plotter_.area; + + // Helper for repeated axis-option accesses. + var makeOptionGetter = function makeOptionGetter(axis) { + return function (option) { + return g.getOptionForAxis(option, axis); + }; + }; + + if (g.getOptionForAxis('drawAxis', 'y')) { + if (layout.yticks && layout.yticks.length > 0) { + var num_axes = g.numAxes(); + var getOptions = [makeOptionGetter('y'), makeOptionGetter('y2')]; + layout.yticks.forEach(function (tick) { + if (tick.label === undefined) return; // this tick only has a grid line. + x = area.x; + var sgn = 1; + var prec_axis = 'y1'; + var getAxisOption = getOptions[0]; + if (tick.axis == 1) { + // right-side y-axis + x = area.x + area.w; + sgn = -1; + prec_axis = 'y2'; + getAxisOption = getOptions[1]; + } + var fontSize = getAxisOption('axisLabelFontSize'); + y = area.y + tick.pos * area.h; + + /* Tick marks are currently clipped, so don't bother drawing them. + context.beginPath(); + context.moveTo(halfUp(x), halfDown(y)); + context.lineTo(halfUp(x - sgn * this.attr_('axisTickSize')), halfDown(y)); + context.closePath(); + context.stroke(); + */ + + label = makeDiv(tick.label, 'y', num_axes == 2 ? prec_axis : null); + var top = y - fontSize / 2; + if (top < 0) top = 0; + + if (top + fontSize + 3 > canvasHeight) { + label.style.bottom = '0'; + } else { + label.style.top = top + 'px'; + } + // TODO: replace these with css classes? + if (tick.axis === 0) { + label.style.left = area.x - getAxisOption('axisLabelWidth') - getAxisOption('axisTickSize') + 'px'; + label.style.textAlign = 'right'; + } else if (tick.axis == 1) { + label.style.left = area.x + area.w + getAxisOption('axisTickSize') + 'px'; + label.style.textAlign = 'left'; + } + label.style.width = getAxisOption('axisLabelWidth') + 'px'; + containerDiv.appendChild(label); + _this.ylabels_.push(label); + }); + + // The lowest tick on the y-axis often overlaps with the leftmost + // tick on the x-axis. Shift the bottom tick up a little bit to + // compensate if necessary. + var bottomTick = this.ylabels_[0]; + // Interested in the y2 axis also? + var fontSize = g.getOptionForAxis('axisLabelFontSize', 'y'); + var bottom = parseInt(bottomTick.style.top, 10) + fontSize; + if (bottom > canvasHeight - fontSize) { + bottomTick.style.top = parseInt(bottomTick.style.top, 10) - fontSize / 2 + 'px'; + } + } + + // draw a vertical line on the left to separate the chart from the labels. + var axisX; + if (g.getOption('drawAxesAtZero')) { + var r = g.toPercentXCoord(0); + if (r > 1 || r < 0 || isNaN(r)) r = 0; + axisX = halfUp(area.x + r * area.w); + } else { + axisX = halfUp(area.x); + } + + context.strokeStyle = g.getOptionForAxis('axisLineColor', 'y'); + context.lineWidth = g.getOptionForAxis('axisLineWidth', 'y'); + + context.beginPath(); + context.moveTo(axisX, halfDown(area.y)); + context.lineTo(axisX, halfDown(area.y + area.h)); + context.closePath(); + context.stroke(); + + // if there's a secondary y-axis, draw a vertical line for that, too. + if (g.numAxes() == 2) { + context.strokeStyle = g.getOptionForAxis('axisLineColor', 'y2'); + context.lineWidth = g.getOptionForAxis('axisLineWidth', 'y2'); + context.beginPath(); + context.moveTo(halfDown(area.x + area.w), halfDown(area.y)); + context.lineTo(halfDown(area.x + area.w), halfDown(area.y + area.h)); + context.closePath(); + context.stroke(); + } + } + + if (g.getOptionForAxis('drawAxis', 'x')) { + if (layout.xticks) { + var getAxisOption = makeOptionGetter('x'); + layout.xticks.forEach(function (tick) { + if (tick.label === undefined) return; // this tick only has a grid line. + x = area.x + tick.pos * area.w; + y = area.y + area.h; + + /* Tick marks are currently clipped, so don't bother drawing them. + context.beginPath(); + context.moveTo(halfUp(x), halfDown(y)); + context.lineTo(halfUp(x), halfDown(y + this.attr_('axisTickSize'))); + context.closePath(); + context.stroke(); + */ + + label = makeDiv(tick.label, 'x'); + label.style.textAlign = 'center'; + label.style.top = y + getAxisOption('axisTickSize') + 'px'; + + var left = x - getAxisOption('axisLabelWidth') / 2; + if (left + getAxisOption('axisLabelWidth') > canvasWidth) { + left = canvasWidth - getAxisOption('axisLabelWidth'); + label.style.textAlign = 'right'; + } + if (left < 0) { + left = 0; + label.style.textAlign = 'left'; + } + + label.style.left = left + 'px'; + label.style.width = getAxisOption('axisLabelWidth') + 'px'; + containerDiv.appendChild(label); + _this.xlabels_.push(label); + }); + } + + context.strokeStyle = g.getOptionForAxis('axisLineColor', 'x'); + context.lineWidth = g.getOptionForAxis('axisLineWidth', 'x'); + context.beginPath(); + var axisY; + if (g.getOption('drawAxesAtZero')) { + var r = g.toPercentYCoord(0, 0); + if (r > 1 || r < 0) r = 1; + axisY = halfDown(area.y + r * area.h); + } else { + axisY = halfDown(area.y + area.h); + } + context.moveTo(halfUp(area.x), axisY); + context.lineTo(halfUp(area.x + area.w), axisY); + context.closePath(); + context.stroke(); + } + + context.restore(); +}; + +exports['default'] = axes; +module.exports = exports['default']; + +},{"../dygraph-utils":17}],22:[function(require,module,exports){ +/** + * @license + * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ +/*global Dygraph:false */ + +"use strict"; + +// TODO(danvk): move chart label options out of dygraphs and into the plugin. +// TODO(danvk): only tear down & rebuild the DIVs when it's necessary. + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var chart_labels = function chart_labels() { + this.title_div_ = null; + this.xlabel_div_ = null; + this.ylabel_div_ = null; + this.y2label_div_ = null; +}; + +chart_labels.prototype.toString = function () { + return "ChartLabels Plugin"; +}; + +chart_labels.prototype.activate = function (g) { + return { + layout: this.layout, + // clearChart: this.clearChart, + didDrawChart: this.didDrawChart + }; +}; + +// QUESTION: should there be a plugin-utils.js? +var createDivInRect = function createDivInRect(r) { + var div = document.createElement('div'); + div.style.position = 'absolute'; + div.style.left = r.x + 'px'; + div.style.top = r.y + 'px'; + div.style.width = r.w + 'px'; + div.style.height = r.h + 'px'; + return div; +}; + +// Detach and null out any existing nodes. +chart_labels.prototype.detachLabels_ = function () { + var els = [this.title_div_, this.xlabel_div_, this.ylabel_div_, this.y2label_div_]; + for (var i = 0; i < els.length; i++) { + var el = els[i]; + if (!el) continue; + if (el.parentNode) el.parentNode.removeChild(el); + } + + this.title_div_ = null; + this.xlabel_div_ = null; + this.ylabel_div_ = null; + this.y2label_div_ = null; +}; + +var createRotatedDiv = function createRotatedDiv(g, box, axis, classes, html) { + // TODO(danvk): is this outer div actually necessary? + var div = document.createElement("div"); + div.style.position = 'absolute'; + if (axis == 1) { + // NOTE: this is cheating. Should be positioned relative to the box. + div.style.left = '0px'; + } else { + div.style.left = box.x + 'px'; + } + div.style.top = box.y + 'px'; + div.style.width = box.w + 'px'; + div.style.height = box.h + 'px'; + div.style.fontSize = g.getOption('yLabelWidth') - 2 + 'px'; + + var inner_div = document.createElement("div"); + inner_div.style.position = 'absolute'; + inner_div.style.width = box.h + 'px'; + inner_div.style.height = box.w + 'px'; + inner_div.style.top = box.h / 2 - box.w / 2 + 'px'; + inner_div.style.left = box.w / 2 - box.h / 2 + 'px'; + // TODO: combine inner_div and class_div. + inner_div.className = 'dygraph-label-rotate-' + (axis == 1 ? 'right' : 'left'); + + var class_div = document.createElement("div"); + class_div.className = classes; + class_div.innerHTML = html; + + inner_div.appendChild(class_div); + div.appendChild(inner_div); + return div; +}; + +chart_labels.prototype.layout = function (e) { + this.detachLabels_(); + + var g = e.dygraph; + var div = e.chart_div; + if (g.getOption('title')) { + // QUESTION: should this return an absolutely-positioned div instead? + var title_rect = e.reserveSpaceTop(g.getOption('titleHeight')); + this.title_div_ = createDivInRect(title_rect); + this.title_div_.style.fontSize = g.getOption('titleHeight') - 8 + 'px'; + + var class_div = document.createElement("div"); + class_div.className = 'dygraph-label dygraph-title'; + class_div.innerHTML = g.getOption('title'); + this.title_div_.appendChild(class_div); + div.appendChild(this.title_div_); + } + + if (g.getOption('xlabel')) { + var x_rect = e.reserveSpaceBottom(g.getOption('xLabelHeight')); + this.xlabel_div_ = createDivInRect(x_rect); + this.xlabel_div_.style.fontSize = g.getOption('xLabelHeight') - 2 + 'px'; + + var class_div = document.createElement("div"); + class_div.className = 'dygraph-label dygraph-xlabel'; + class_div.innerHTML = g.getOption('xlabel'); + this.xlabel_div_.appendChild(class_div); + div.appendChild(this.xlabel_div_); + } + + if (g.getOption('ylabel')) { + // It would make sense to shift the chart here to make room for the y-axis + // label, but the default yAxisLabelWidth is large enough that this results + // in overly-padded charts. The y-axis label should fit fine. If it + // doesn't, the yAxisLabelWidth option can be increased. + var y_rect = e.reserveSpaceLeft(0); + + this.ylabel_div_ = createRotatedDiv(g, y_rect, 1, // primary (left) y-axis + 'dygraph-label dygraph-ylabel', g.getOption('ylabel')); + div.appendChild(this.ylabel_div_); + } + + if (g.getOption('y2label') && g.numAxes() == 2) { + // same logic applies here as for ylabel. + var y2_rect = e.reserveSpaceRight(0); + this.y2label_div_ = createRotatedDiv(g, y2_rect, 2, // secondary (right) y-axis + 'dygraph-label dygraph-y2label', g.getOption('y2label')); + div.appendChild(this.y2label_div_); + } +}; + +chart_labels.prototype.didDrawChart = function (e) { + var g = e.dygraph; + if (this.title_div_) { + this.title_div_.children[0].innerHTML = g.getOption('title'); + } + if (this.xlabel_div_) { + this.xlabel_div_.children[0].innerHTML = g.getOption('xlabel'); + } + if (this.ylabel_div_) { + this.ylabel_div_.children[0].children[0].innerHTML = g.getOption('ylabel'); + } + if (this.y2label_div_) { + this.y2label_div_.children[0].children[0].innerHTML = g.getOption('y2label'); + } +}; + +chart_labels.prototype.clearChart = function () {}; + +chart_labels.prototype.destroy = function () { + this.detachLabels_(); +}; + +exports["default"] = chart_labels; +module.exports = exports["default"]; + +},{}],23:[function(require,module,exports){ +/** + * @license + * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ +/*global Dygraph:false */ + +/* + +Current bits of jankiness: +- Direct layout access +- Direct area access + +*/ + +"use strict"; + +/** + * Draws the gridlines, i.e. the gray horizontal & vertical lines running the + * length of the chart. + * + * @constructor + */ +Object.defineProperty(exports, "__esModule", { + value: true +}); +var grid = function grid() {}; + +grid.prototype.toString = function () { + return "Gridline Plugin"; +}; + +grid.prototype.activate = function (g) { + return { + willDrawChart: this.willDrawChart + }; +}; + +grid.prototype.willDrawChart = function (e) { + // Draw the new X/Y grid. Lines appear crisper when pixels are rounded to + // half-integers. This prevents them from drawing in two rows/cols. + var g = e.dygraph; + var ctx = e.drawingContext; + var layout = g.layout_; + var area = e.dygraph.plotter_.area; + + function halfUp(x) { + return Math.round(x) + 0.5; + } + function halfDown(y) { + return Math.round(y) - 0.5; + } + + var x, y, i, ticks; + if (g.getOptionForAxis('drawGrid', 'y')) { + var axes = ["y", "y2"]; + var strokeStyles = [], + lineWidths = [], + drawGrid = [], + stroking = [], + strokePattern = []; + for (var i = 0; i < axes.length; i++) { + drawGrid[i] = g.getOptionForAxis('drawGrid', axes[i]); + if (drawGrid[i]) { + strokeStyles[i] = g.getOptionForAxis('gridLineColor', axes[i]); + lineWidths[i] = g.getOptionForAxis('gridLineWidth', axes[i]); + strokePattern[i] = g.getOptionForAxis('gridLinePattern', axes[i]); + stroking[i] = strokePattern[i] && strokePattern[i].length >= 2; + } + } + ticks = layout.yticks; + ctx.save(); + // draw grids for the different y axes + ticks.forEach(function (tick) { + if (!tick.has_tick) return; + var axis = tick.axis; + if (drawGrid[axis]) { + ctx.save(); + if (stroking[axis]) { + if (ctx.setLineDash) ctx.setLineDash(strokePattern[axis]); + } + ctx.strokeStyle = strokeStyles[axis]; + ctx.lineWidth = lineWidths[axis]; + + x = halfUp(area.x); + y = halfDown(area.y + tick.pos * area.h); + ctx.beginPath(); + ctx.moveTo(x, y); + ctx.lineTo(x + area.w, y); + ctx.stroke(); + + ctx.restore(); + } + }); + ctx.restore(); + } + + // draw grid for x axis + if (g.getOptionForAxis('drawGrid', 'x')) { + ticks = layout.xticks; + ctx.save(); + var strokePattern = g.getOptionForAxis('gridLinePattern', 'x'); + var stroking = strokePattern && strokePattern.length >= 2; + if (stroking) { + if (ctx.setLineDash) ctx.setLineDash(strokePattern); + } + ctx.strokeStyle = g.getOptionForAxis('gridLineColor', 'x'); + ctx.lineWidth = g.getOptionForAxis('gridLineWidth', 'x'); + ticks.forEach(function (tick) { + if (!tick.has_tick) return; + x = halfUp(area.x + tick.pos * area.w); + y = halfDown(area.y + area.h); + ctx.beginPath(); + ctx.moveTo(x, y); + ctx.lineTo(x, area.y); + ctx.closePath(); + ctx.stroke(); + }); + if (stroking) { + if (ctx.setLineDash) ctx.setLineDash([]); + } + ctx.restore(); + } +}; + +grid.prototype.destroy = function () {}; + +exports["default"] = grid; +module.exports = exports["default"]; + +},{}],24:[function(require,module,exports){ +/** + * @license + * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ +/*global Dygraph:false */ + +/* +Current bits of jankiness: +- Uses two private APIs: + 1. Dygraph.optionsViewForAxis_ + 2. dygraph.plotter_.area +- Registers for a "predraw" event, which should be renamed. +- I call calculateEmWidthInDiv more often than needed. +*/ + +/*global Dygraph:false */ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } + +var _dygraphUtils = require('../dygraph-utils'); + +var utils = _interopRequireWildcard(_dygraphUtils); + +/** + * Creates the legend, which appears when the user hovers over the chart. + * The legend can be either a user-specified or generated div. + * + * @constructor + */ +var Legend = function Legend() { + this.legend_div_ = null; + this.is_generated_div_ = false; // do we own this div, or was it user-specified? +}; + +Legend.prototype.toString = function () { + return "Legend Plugin"; +}; + +/** + * This is called during the dygraph constructor, after options have been set + * but before the data is available. + * + * Proper tasks to do here include: + * - Reading your own options + * - DOM manipulation + * - Registering event listeners + * + * @param {Dygraph} g Graph instance. + * @return {object.} Mapping of event names to callbacks. + */ +Legend.prototype.activate = function (g) { + var div; + + var userLabelsDiv = g.getOption('labelsDiv'); + if (userLabelsDiv && null !== userLabelsDiv) { + if (typeof userLabelsDiv == "string" || userLabelsDiv instanceof String) { + div = document.getElementById(userLabelsDiv); + } else { + div = userLabelsDiv; + } + } else { + div = document.createElement("div"); + div.className = "dygraph-legend"; + // TODO(danvk): come up with a cleaner way to expose this. + g.graphDiv.appendChild(div); + this.is_generated_div_ = true; + } + + this.legend_div_ = div; + this.one_em_width_ = 10; // just a guess, will be updated. + + return { + select: this.select, + deselect: this.deselect, + // TODO(danvk): rethink the name "predraw" before we commit to it in any API. + predraw: this.predraw, + didDrawChart: this.didDrawChart + }; +}; + +// Needed for dashed lines. +var calculateEmWidthInDiv = function calculateEmWidthInDiv(div) { + var sizeSpan = document.createElement('span'); + sizeSpan.setAttribute('style', 'margin: 0; padding: 0 0 0 1em; border: 0;'); + div.appendChild(sizeSpan); + var oneEmWidth = sizeSpan.offsetWidth; + div.removeChild(sizeSpan); + return oneEmWidth; +}; + +var escapeHTML = function escapeHTML(str) { + return str.replace(/&/g, "&").replace(/"/g, """).replace(//g, ">"); +}; + +Legend.prototype.select = function (e) { + var xValue = e.selectedX; + var points = e.selectedPoints; + var row = e.selectedRow; + + var legendMode = e.dygraph.getOption('legend'); + if (legendMode === 'never') { + this.legend_div_.style.display = 'none'; + return; + } + + if (legendMode === 'follow') { + // create floating legend div + var area = e.dygraph.plotter_.area; + var labelsDivWidth = this.legend_div_.offsetWidth; + var yAxisLabelWidth = e.dygraph.getOptionForAxis('axisLabelWidth', 'y'); + // determine floating [left, top] coordinates of the legend div + // within the plotter_ area + // offset 50 px to the right and down from the first selection point + // 50 px is guess based on mouse cursor size + var leftLegend = points[0].x * area.w + 50; + var topLegend = points[0].y * area.h - 50; + + // if legend floats to end of the chart area, it flips to the other + // side of the selection point + if (leftLegend + labelsDivWidth + 1 > area.w) { + leftLegend = leftLegend - 2 * 50 - labelsDivWidth - (yAxisLabelWidth - area.x); + } + + e.dygraph.graphDiv.appendChild(this.legend_div_); + this.legend_div_.style.left = yAxisLabelWidth + leftLegend + "px"; + this.legend_div_.style.top = topLegend + "px"; + } + + var html = Legend.generateLegendHTML(e.dygraph, xValue, points, this.one_em_width_, row); + this.legend_div_.innerHTML = html; + this.legend_div_.style.display = ''; +}; + +Legend.prototype.deselect = function (e) { + var legendMode = e.dygraph.getOption('legend'); + if (legendMode !== 'always') { + this.legend_div_.style.display = "none"; + } + + // Have to do this every time, since styles might have changed. + var oneEmWidth = calculateEmWidthInDiv(this.legend_div_); + this.one_em_width_ = oneEmWidth; + + var html = Legend.generateLegendHTML(e.dygraph, undefined, undefined, oneEmWidth, null); + this.legend_div_.innerHTML = html; +}; + +Legend.prototype.didDrawChart = function (e) { + this.deselect(e); +}; + +// Right edge should be flush with the right edge of the charting area (which +// may not be the same as the right edge of the div, if we have two y-axes. +// TODO(danvk): is any of this really necessary? Could just set "right" in "activate". +/** + * Position the labels div so that: + * - its right edge is flush with the right edge of the charting area + * - its top edge is flush with the top edge of the charting area + * @private + */ +Legend.prototype.predraw = function (e) { + // Don't touch a user-specified labelsDiv. + if (!this.is_generated_div_) return; + + // TODO(danvk): only use real APIs for this. + e.dygraph.graphDiv.appendChild(this.legend_div_); + var area = e.dygraph.getArea(); + var labelsDivWidth = this.legend_div_.offsetWidth; + this.legend_div_.style.left = area.x + area.w - labelsDivWidth - 1 + "px"; + this.legend_div_.style.top = area.y + "px"; +}; + +/** + * Called when dygraph.destroy() is called. + * You should null out any references and detach any DOM elements. + */ +Legend.prototype.destroy = function () { + this.legend_div_ = null; +}; + +/** + * Generates HTML for the legend which is displayed when hovering over the + * chart. If no selected points are specified, a default legend is returned + * (this may just be the empty string). + * @param {number} x The x-value of the selected points. + * @param {Object} sel_points List of selected points for the given + * x-value. Should have properties like 'name', 'yval' and 'canvasy'. + * @param {number} oneEmWidth The pixel width for 1em in the legend. Only + * relevant when displaying a legend with no selection (i.e. {legend: + * 'always'}) and with dashed lines. + * @param {number} row The selected row index. + * @private + */ +Legend.generateLegendHTML = function (g, x, sel_points, oneEmWidth, row) { + // Data about the selection to pass to legendFormatter + var data = { + dygraph: g, + x: x, + series: [] + }; + + var labelToSeries = {}; + var labels = g.getLabels(); + if (labels) { + for (var i = 1; i < labels.length; i++) { + var series = g.getPropertiesForSeries(labels[i]); + var strokePattern = g.getOption('strokePattern', labels[i]); + var seriesData = { + dashHTML: generateLegendDashHTML(strokePattern, series.color, oneEmWidth), + label: labels[i], + labelHTML: escapeHTML(labels[i]), + isVisible: series.visible, + color: series.color + }; + + data.series.push(seriesData); + labelToSeries[labels[i]] = seriesData; + } + } + + if (typeof x !== 'undefined') { + var xOptView = g.optionsViewForAxis_('x'); + var xvf = xOptView('valueFormatter'); + data.xHTML = xvf.call(g, x, xOptView, labels[0], g, row, 0); + + var yOptViews = []; + var num_axes = g.numAxes(); + for (var i = 0; i < num_axes; i++) { + // TODO(danvk): remove this use of a private API + yOptViews[i] = g.optionsViewForAxis_('y' + (i ? 1 + i : '')); + } + + var showZeros = g.getOption('labelsShowZeroValues'); + var highlightSeries = g.getHighlightSeries(); + for (i = 0; i < sel_points.length; i++) { + var pt = sel_points[i]; + var seriesData = labelToSeries[pt.name]; + seriesData.y = pt.yval; + + if (pt.yval === 0 && !showZeros || isNaN(pt.canvasy)) { + seriesData.isVisible = false; + continue; + } + + var series = g.getPropertiesForSeries(pt.name); + var yOptView = yOptViews[series.axis - 1]; + var fmtFunc = yOptView('valueFormatter'); + var yHTML = fmtFunc.call(g, pt.yval, yOptView, pt.name, g, row, labels.indexOf(pt.name)); + + utils.update(seriesData, { yHTML: yHTML }); + + if (pt.name == highlightSeries) { + seriesData.isHighlighted = true; + } + } + } + + var formatter = g.getOption('legendFormatter') || Legend.defaultFormatter; + return formatter.call(g, data); +}; + +Legend.defaultFormatter = function (data) { + var g = data.dygraph; + + // TODO(danvk): deprecate this option in place of {legend: 'never'} + // XXX should this logic be in the formatter? + if (g.getOption('showLabelsOnHighlight') !== true) return ''; + + var sepLines = g.getOption('labelsSeparateLines'); + var html; + + if (typeof data.x === 'undefined') { + // TODO: this check is duplicated in generateLegendHTML. Put it in one place. + if (g.getOption('legend') != 'always') { + return ''; + } + + html = ''; + for (var i = 0; i < data.series.length; i++) { + var series = data.series[i]; + if (!series.isVisible) continue; + + if (html !== '') html += sepLines ? '
' : ' '; + html += "" + series.dashHTML + " " + series.labelHTML + ""; + } + return html; + } + + html = data.xHTML + ':'; + for (var i = 0; i < data.series.length; i++) { + var series = data.series[i]; + if (!series.isVisible) continue; + if (sepLines) html += '
'; + var cls = series.isHighlighted ? ' class="highlight"' : ''; + html += " " + series.labelHTML + ": " + series.yHTML + ""; + } + return html; +}; + +/** + * Generates html for the "dash" displayed on the legend when using "legend: always". + * In particular, this works for dashed lines with any stroke pattern. It will + * try to scale the pattern to fit in 1em width. Or if small enough repeat the + * pattern for 1em width. + * + * @param strokePattern The pattern + * @param color The color of the series. + * @param oneEmWidth The width in pixels of 1em in the legend. + * @private + */ +// TODO(danvk): cache the results of this +function generateLegendDashHTML(strokePattern, color, oneEmWidth) { + // Easy, common case: a solid line + if (!strokePattern || strokePattern.length <= 1) { + return "
"; + } + + var i, j, paddingLeft, marginRight; + var strokePixelLength = 0, + segmentLoop = 0; + var normalizedPattern = []; + var loop; + + // Compute the length of the pixels including the first segment twice, + // since we repeat it. + for (i = 0; i <= strokePattern.length; i++) { + strokePixelLength += strokePattern[i % strokePattern.length]; + } + + // See if we can loop the pattern by itself at least twice. + loop = Math.floor(oneEmWidth / (strokePixelLength - strokePattern[0])); + if (loop > 1) { + // This pattern fits at least two times, no scaling just convert to em; + for (i = 0; i < strokePattern.length; i++) { + normalizedPattern[i] = strokePattern[i] / oneEmWidth; + } + // Since we are repeating the pattern, we don't worry about repeating the + // first segment in one draw. + segmentLoop = normalizedPattern.length; + } else { + // If the pattern doesn't fit in the legend we scale it to fit. + loop = 1; + for (i = 0; i < strokePattern.length; i++) { + normalizedPattern[i] = strokePattern[i] / strokePixelLength; + } + // For the scaled patterns we do redraw the first segment. + segmentLoop = normalizedPattern.length + 1; + } + + // Now make the pattern. + var dash = ""; + for (j = 0; j < loop; j++) { + for (i = 0; i < segmentLoop; i += 2) { + // The padding is the drawn segment. + paddingLeft = normalizedPattern[i % normalizedPattern.length]; + if (i < strokePattern.length) { + // The margin is the space segment. + marginRight = normalizedPattern[(i + 1) % normalizedPattern.length]; + } else { + // The repeated first segment has no right margin. + marginRight = 0; + } + dash += "
"; + } + } + return dash; +}; + +exports["default"] = Legend; +module.exports = exports["default"]; + +},{"../dygraph-utils":17}],25:[function(require,module,exports){ +/** + * @license + * Copyright 2011 Paul Felix (paul.eric.felix@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ +/*global Dygraph:false,TouchEvent:false */ + +/** + * @fileoverview This file contains the RangeSelector plugin used to provide + * a timeline range selector widget for dygraphs. + */ + +/*global Dygraph:false */ +"use strict"; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } + +var _dygraphUtils = require('../dygraph-utils'); + +var utils = _interopRequireWildcard(_dygraphUtils); + +var _dygraphInteractionModel = require('../dygraph-interaction-model'); + +var _dygraphInteractionModel2 = _interopRequireDefault(_dygraphInteractionModel); + +var _iframeTarp = require('../iframe-tarp'); + +var _iframeTarp2 = _interopRequireDefault(_iframeTarp); + +var rangeSelector = function rangeSelector() { + this.hasTouchInterface_ = typeof TouchEvent != 'undefined'; + this.isMobileDevice_ = /mobile|android/gi.test(navigator.appVersion); + this.interfaceCreated_ = false; +}; + +rangeSelector.prototype.toString = function () { + return "RangeSelector Plugin"; +}; + +rangeSelector.prototype.activate = function (dygraph) { + this.dygraph_ = dygraph; + if (this.getOption_('showRangeSelector')) { + this.createInterface_(); + } + return { + layout: this.reserveSpace_, + predraw: this.renderStaticLayer_, + didDrawChart: this.renderInteractiveLayer_ + }; +}; + +rangeSelector.prototype.destroy = function () { + this.bgcanvas_ = null; + this.fgcanvas_ = null; + this.leftZoomHandle_ = null; + this.rightZoomHandle_ = null; +}; + +//------------------------------------------------------------------ +// Private methods +//------------------------------------------------------------------ + +rangeSelector.prototype.getOption_ = function (name, opt_series) { + return this.dygraph_.getOption(name, opt_series); +}; + +rangeSelector.prototype.setDefaultOption_ = function (name, value) { + this.dygraph_.attrs_[name] = value; +}; + +/** + * @private + * Creates the range selector elements and adds them to the graph. + */ +rangeSelector.prototype.createInterface_ = function () { + this.createCanvases_(); + this.createZoomHandles_(); + this.initInteraction_(); + + // Range selector and animatedZooms have a bad interaction. See issue 359. + if (this.getOption_('animatedZooms')) { + console.warn('Animated zooms and range selector are not compatible; disabling animatedZooms.'); + this.dygraph_.updateOptions({ animatedZooms: false }, true); + } + + this.interfaceCreated_ = true; + this.addToGraph_(); +}; + +/** + * @private + * Adds the range selector to the graph. + */ +rangeSelector.prototype.addToGraph_ = function () { + var graphDiv = this.graphDiv_ = this.dygraph_.graphDiv; + graphDiv.appendChild(this.bgcanvas_); + graphDiv.appendChild(this.fgcanvas_); + graphDiv.appendChild(this.leftZoomHandle_); + graphDiv.appendChild(this.rightZoomHandle_); +}; + +/** + * @private + * Removes the range selector from the graph. + */ +rangeSelector.prototype.removeFromGraph_ = function () { + var graphDiv = this.graphDiv_; + graphDiv.removeChild(this.bgcanvas_); + graphDiv.removeChild(this.fgcanvas_); + graphDiv.removeChild(this.leftZoomHandle_); + graphDiv.removeChild(this.rightZoomHandle_); + this.graphDiv_ = null; +}; + +/** + * @private + * Called by Layout to allow range selector to reserve its space. + */ +rangeSelector.prototype.reserveSpace_ = function (e) { + if (this.getOption_('showRangeSelector')) { + e.reserveSpaceBottom(this.getOption_('rangeSelectorHeight') + 4); + } +}; + +/** + * @private + * Renders the static portion of the range selector at the predraw stage. + */ +rangeSelector.prototype.renderStaticLayer_ = function () { + if (!this.updateVisibility_()) { + return; + } + this.resize_(); + this.drawStaticLayer_(); +}; + +/** + * @private + * Renders the interactive portion of the range selector after the chart has been drawn. + */ +rangeSelector.prototype.renderInteractiveLayer_ = function () { + if (!this.updateVisibility_() || this.isChangingRange_) { + return; + } + this.placeZoomHandles_(); + this.drawInteractiveLayer_(); +}; + +/** + * @private + * Check to see if the range selector is enabled/disabled and update visibility accordingly. + */ +rangeSelector.prototype.updateVisibility_ = function () { + var enabled = this.getOption_('showRangeSelector'); + if (enabled) { + if (!this.interfaceCreated_) { + this.createInterface_(); + } else if (!this.graphDiv_ || !this.graphDiv_.parentNode) { + this.addToGraph_(); + } + } else if (this.graphDiv_) { + this.removeFromGraph_(); + var dygraph = this.dygraph_; + setTimeout(function () { + dygraph.width_ = 0;dygraph.resize(); + }, 1); + } + return enabled; +}; + +/** + * @private + * Resizes the range selector. + */ +rangeSelector.prototype.resize_ = function () { + function setElementRect(canvas, context, rect, pixelRatioOption) { + var canvasScale = pixelRatioOption || utils.getContextPixelRatio(context); + + canvas.style.top = rect.y + 'px'; + canvas.style.left = rect.x + 'px'; + canvas.width = rect.w * canvasScale; + canvas.height = rect.h * canvasScale; + canvas.style.width = rect.w + 'px'; + canvas.style.height = rect.h + 'px'; + + if (canvasScale != 1) { + context.scale(canvasScale, canvasScale); + } + } + + var plotArea = this.dygraph_.layout_.getPlotArea(); + + var xAxisLabelHeight = 0; + if (this.dygraph_.getOptionForAxis('drawAxis', 'x')) { + xAxisLabelHeight = this.getOption_('xAxisHeight') || this.getOption_('axisLabelFontSize') + 2 * this.getOption_('axisTickSize'); + } + this.canvasRect_ = { + x: plotArea.x, + y: plotArea.y + plotArea.h + xAxisLabelHeight + 4, + w: plotArea.w, + h: this.getOption_('rangeSelectorHeight') + }; + + var pixelRatioOption = this.dygraph_.getNumericOption('pixelRatio'); + setElementRect(this.bgcanvas_, this.bgcanvas_ctx_, this.canvasRect_, pixelRatioOption); + setElementRect(this.fgcanvas_, this.fgcanvas_ctx_, this.canvasRect_, pixelRatioOption); +}; + +/** + * @private + * Creates the background and foreground canvases. + */ +rangeSelector.prototype.createCanvases_ = function () { + this.bgcanvas_ = utils.createCanvas(); + this.bgcanvas_.className = 'dygraph-rangesel-bgcanvas'; + this.bgcanvas_.style.position = 'absolute'; + this.bgcanvas_.style.zIndex = 9; + this.bgcanvas_ctx_ = utils.getContext(this.bgcanvas_); + + this.fgcanvas_ = utils.createCanvas(); + this.fgcanvas_.className = 'dygraph-rangesel-fgcanvas'; + this.fgcanvas_.style.position = 'absolute'; + this.fgcanvas_.style.zIndex = 9; + this.fgcanvas_.style.cursor = 'default'; + this.fgcanvas_ctx_ = utils.getContext(this.fgcanvas_); +}; + +/** + * @private + * Creates the zoom handle elements. + */ +rangeSelector.prototype.createZoomHandles_ = function () { + var img = new Image(); + img.className = 'dygraph-rangesel-zoomhandle'; + img.style.position = 'absolute'; + img.style.zIndex = 10; + img.style.visibility = 'hidden'; // Initially hidden so they don't show up in the wrong place. + img.style.cursor = 'col-resize'; + // TODO: change image to more options + img.width = 9; + img.height = 16; + img.src = 'data:image/png;base64,' + 'iVBORw0KGgoAAAANSUhEUgAAAAkAAAAQCAYAAADESFVDAAAAAXNSR0IArs4c6QAAAAZiS0dEANAA' + 'zwDP4Z7KegAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAd0SU1FB9sHGw0cMqdt1UwAAAAZdEVYdENv' + 'bW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAaElEQVQoz+3SsRFAQBCF4Z9WJM8KCDVwownl' + '6YXsTmCUsyKGkZzcl7zkz3YLkypgAnreFmDEpHkIwVOMfpdi9CEEN2nGpFdwD03yEqDtOgCaun7s' + 'qSTDH32I1pQA2Pb9sZecAxc5r3IAb21d6878xsAAAAAASUVORK5CYII='; + + if (this.isMobileDevice_) { + img.width *= 2; + img.height *= 2; + } + + this.leftZoomHandle_ = img; + this.rightZoomHandle_ = img.cloneNode(false); +}; + +/** + * @private + * Sets up the interaction for the range selector. + */ +rangeSelector.prototype.initInteraction_ = function () { + var self = this; + var topElem = document; + var clientXLast = 0; + var handle = null; + var isZooming = false; + var isPanning = false; + var dynamic = !this.isMobileDevice_; + + // We cover iframes during mouse interactions. See comments in + // dygraph-utils.js for more info on why this is a good idea. + var tarp = new _iframeTarp2['default'](); + + // functions, defined below. Defining them this way (rather than with + // "function foo() {...}" makes JSHint happy. + var toXDataWindow, onZoomStart, onZoom, onZoomEnd, doZoom, isMouseInPanZone, onPanStart, onPan, onPanEnd, doPan, onCanvasHover; + + // Touch event functions + var onZoomHandleTouchEvent, onCanvasTouchEvent, addTouchEvents; + + toXDataWindow = function (zoomHandleStatus) { + var xDataLimits = self.dygraph_.xAxisExtremes(); + var fact = (xDataLimits[1] - xDataLimits[0]) / self.canvasRect_.w; + var xDataMin = xDataLimits[0] + (zoomHandleStatus.leftHandlePos - self.canvasRect_.x) * fact; + var xDataMax = xDataLimits[0] + (zoomHandleStatus.rightHandlePos - self.canvasRect_.x) * fact; + return [xDataMin, xDataMax]; + }; + + onZoomStart = function (e) { + utils.cancelEvent(e); + isZooming = true; + clientXLast = e.clientX; + handle = e.target ? e.target : e.srcElement; + if (e.type === 'mousedown' || e.type === 'dragstart') { + // These events are removed manually. + utils.addEvent(topElem, 'mousemove', onZoom); + utils.addEvent(topElem, 'mouseup', onZoomEnd); + } + self.fgcanvas_.style.cursor = 'col-resize'; + tarp.cover(); + return true; + }; + + onZoom = function (e) { + if (!isZooming) { + return false; + } + utils.cancelEvent(e); + + var delX = e.clientX - clientXLast; + if (Math.abs(delX) < 4) { + return true; + } + clientXLast = e.clientX; + + // Move handle. + var zoomHandleStatus = self.getZoomHandleStatus_(); + var newPos; + if (handle == self.leftZoomHandle_) { + newPos = zoomHandleStatus.leftHandlePos + delX; + newPos = Math.min(newPos, zoomHandleStatus.rightHandlePos - handle.width - 3); + newPos = Math.max(newPos, self.canvasRect_.x); + } else { + newPos = zoomHandleStatus.rightHandlePos + delX; + newPos = Math.min(newPos, self.canvasRect_.x + self.canvasRect_.w); + newPos = Math.max(newPos, zoomHandleStatus.leftHandlePos + handle.width + 3); + } + var halfHandleWidth = handle.width / 2; + handle.style.left = newPos - halfHandleWidth + 'px'; + self.drawInteractiveLayer_(); + + // Zoom on the fly. + if (dynamic) { + doZoom(); + } + return true; + }; + + onZoomEnd = function (e) { + if (!isZooming) { + return false; + } + isZooming = false; + tarp.uncover(); + utils.removeEvent(topElem, 'mousemove', onZoom); + utils.removeEvent(topElem, 'mouseup', onZoomEnd); + self.fgcanvas_.style.cursor = 'default'; + + // If on a slower device, zoom now. + if (!dynamic) { + doZoom(); + } + return true; + }; + + doZoom = function () { + try { + var zoomHandleStatus = self.getZoomHandleStatus_(); + self.isChangingRange_ = true; + if (!zoomHandleStatus.isZoomed) { + self.dygraph_.resetZoom(); + } else { + var xDataWindow = toXDataWindow(zoomHandleStatus); + self.dygraph_.doZoomXDates_(xDataWindow[0], xDataWindow[1]); + } + } finally { + self.isChangingRange_ = false; + } + }; + + isMouseInPanZone = function (e) { + var rect = self.leftZoomHandle_.getBoundingClientRect(); + var leftHandleClientX = rect.left + rect.width / 2; + rect = self.rightZoomHandle_.getBoundingClientRect(); + var rightHandleClientX = rect.left + rect.width / 2; + return e.clientX > leftHandleClientX && e.clientX < rightHandleClientX; + }; + + onPanStart = function (e) { + if (!isPanning && isMouseInPanZone(e) && self.getZoomHandleStatus_().isZoomed) { + utils.cancelEvent(e); + isPanning = true; + clientXLast = e.clientX; + if (e.type === 'mousedown') { + // These events are removed manually. + utils.addEvent(topElem, 'mousemove', onPan); + utils.addEvent(topElem, 'mouseup', onPanEnd); + } + return true; + } + return false; + }; + + onPan = function (e) { + if (!isPanning) { + return false; + } + utils.cancelEvent(e); + + var delX = e.clientX - clientXLast; + if (Math.abs(delX) < 4) { + return true; + } + clientXLast = e.clientX; + + // Move range view + var zoomHandleStatus = self.getZoomHandleStatus_(); + var leftHandlePos = zoomHandleStatus.leftHandlePos; + var rightHandlePos = zoomHandleStatus.rightHandlePos; + var rangeSize = rightHandlePos - leftHandlePos; + if (leftHandlePos + delX <= self.canvasRect_.x) { + leftHandlePos = self.canvasRect_.x; + rightHandlePos = leftHandlePos + rangeSize; + } else if (rightHandlePos + delX >= self.canvasRect_.x + self.canvasRect_.w) { + rightHandlePos = self.canvasRect_.x + self.canvasRect_.w; + leftHandlePos = rightHandlePos - rangeSize; + } else { + leftHandlePos += delX; + rightHandlePos += delX; + } + var halfHandleWidth = self.leftZoomHandle_.width / 2; + self.leftZoomHandle_.style.left = leftHandlePos - halfHandleWidth + 'px'; + self.rightZoomHandle_.style.left = rightHandlePos - halfHandleWidth + 'px'; + self.drawInteractiveLayer_(); + + // Do pan on the fly. + if (dynamic) { + doPan(); + } + return true; + }; + + onPanEnd = function (e) { + if (!isPanning) { + return false; + } + isPanning = false; + utils.removeEvent(topElem, 'mousemove', onPan); + utils.removeEvent(topElem, 'mouseup', onPanEnd); + // If on a slower device, do pan now. + if (!dynamic) { + doPan(); + } + return true; + }; + + doPan = function () { + try { + self.isChangingRange_ = true; + self.dygraph_.dateWindow_ = toXDataWindow(self.getZoomHandleStatus_()); + self.dygraph_.drawGraph_(false); + } finally { + self.isChangingRange_ = false; + } + }; + + onCanvasHover = function (e) { + if (isZooming || isPanning) { + return; + } + var cursor = isMouseInPanZone(e) ? 'move' : 'default'; + if (cursor != self.fgcanvas_.style.cursor) { + self.fgcanvas_.style.cursor = cursor; + } + }; + + onZoomHandleTouchEvent = function (e) { + if (e.type == 'touchstart' && e.targetTouches.length == 1) { + if (onZoomStart(e.targetTouches[0])) { + utils.cancelEvent(e); + } + } else if (e.type == 'touchmove' && e.targetTouches.length == 1) { + if (onZoom(e.targetTouches[0])) { + utils.cancelEvent(e); + } + } else { + onZoomEnd(e); + } + }; + + onCanvasTouchEvent = function (e) { + if (e.type == 'touchstart' && e.targetTouches.length == 1) { + if (onPanStart(e.targetTouches[0])) { + utils.cancelEvent(e); + } + } else if (e.type == 'touchmove' && e.targetTouches.length == 1) { + if (onPan(e.targetTouches[0])) { + utils.cancelEvent(e); + } + } else { + onPanEnd(e); + } + }; + + addTouchEvents = function (elem, fn) { + var types = ['touchstart', 'touchend', 'touchmove', 'touchcancel']; + for (var i = 0; i < types.length; i++) { + self.dygraph_.addAndTrackEvent(elem, types[i], fn); + } + }; + + this.setDefaultOption_('interactionModel', _dygraphInteractionModel2['default'].dragIsPanInteractionModel); + this.setDefaultOption_('panEdgeFraction', 0.0001); + + var dragStartEvent = window.opera ? 'mousedown' : 'dragstart'; + this.dygraph_.addAndTrackEvent(this.leftZoomHandle_, dragStartEvent, onZoomStart); + this.dygraph_.addAndTrackEvent(this.rightZoomHandle_, dragStartEvent, onZoomStart); + + this.dygraph_.addAndTrackEvent(this.fgcanvas_, 'mousedown', onPanStart); + this.dygraph_.addAndTrackEvent(this.fgcanvas_, 'mousemove', onCanvasHover); + + // Touch events + if (this.hasTouchInterface_) { + addTouchEvents(this.leftZoomHandle_, onZoomHandleTouchEvent); + addTouchEvents(this.rightZoomHandle_, onZoomHandleTouchEvent); + addTouchEvents(this.fgcanvas_, onCanvasTouchEvent); + } +}; + +/** + * @private + * Draws the static layer in the background canvas. + */ +rangeSelector.prototype.drawStaticLayer_ = function () { + var ctx = this.bgcanvas_ctx_; + ctx.clearRect(0, 0, this.canvasRect_.w, this.canvasRect_.h); + try { + this.drawMiniPlot_(); + } catch (ex) { + console.warn(ex); + } + + var margin = 0.5; + this.bgcanvas_ctx_.lineWidth = this.getOption_('rangeSelectorBackgroundLineWidth'); + ctx.strokeStyle = this.getOption_('rangeSelectorBackgroundStrokeColor'); + ctx.beginPath(); + ctx.moveTo(margin, margin); + ctx.lineTo(margin, this.canvasRect_.h - margin); + ctx.lineTo(this.canvasRect_.w - margin, this.canvasRect_.h - margin); + ctx.lineTo(this.canvasRect_.w - margin, margin); + ctx.stroke(); +}; + +/** + * @private + * Draws the mini plot in the background canvas. + */ +rangeSelector.prototype.drawMiniPlot_ = function () { + var fillStyle = this.getOption_('rangeSelectorPlotFillColor'); + var fillGradientStyle = this.getOption_('rangeSelectorPlotFillGradientColor'); + var strokeStyle = this.getOption_('rangeSelectorPlotStrokeColor'); + if (!fillStyle && !strokeStyle) { + return; + } + + var stepPlot = this.getOption_('stepPlot'); + + var combinedSeriesData = this.computeCombinedSeriesAndLimits_(); + var yRange = combinedSeriesData.yMax - combinedSeriesData.yMin; + + // Draw the mini plot. + var ctx = this.bgcanvas_ctx_; + var margin = 0.5; + + var xExtremes = this.dygraph_.xAxisExtremes(); + var xRange = Math.max(xExtremes[1] - xExtremes[0], 1.e-30); + var xFact = (this.canvasRect_.w - margin) / xRange; + var yFact = (this.canvasRect_.h - margin) / yRange; + var canvasWidth = this.canvasRect_.w - margin; + var canvasHeight = this.canvasRect_.h - margin; + + var prevX = null, + prevY = null; + + ctx.beginPath(); + ctx.moveTo(margin, canvasHeight); + for (var i = 0; i < combinedSeriesData.data.length; i++) { + var dataPoint = combinedSeriesData.data[i]; + var x = dataPoint[0] !== null ? (dataPoint[0] - xExtremes[0]) * xFact : NaN; + var y = dataPoint[1] !== null ? canvasHeight - (dataPoint[1] - combinedSeriesData.yMin) * yFact : NaN; + + // Skip points that don't change the x-value. Overly fine-grained points + // can cause major slowdowns with the ctx.fill() call below. + if (!stepPlot && prevX !== null && Math.round(x) == Math.round(prevX)) { + continue; + } + + if (isFinite(x) && isFinite(y)) { + if (prevX === null) { + ctx.lineTo(x, canvasHeight); + } else if (stepPlot) { + ctx.lineTo(x, prevY); + } + ctx.lineTo(x, y); + prevX = x; + prevY = y; + } else { + if (prevX !== null) { + if (stepPlot) { + ctx.lineTo(x, prevY); + ctx.lineTo(x, canvasHeight); + } else { + ctx.lineTo(prevX, canvasHeight); + } + } + prevX = prevY = null; + } + } + ctx.lineTo(canvasWidth, canvasHeight); + ctx.closePath(); + + if (fillStyle) { + var lingrad = this.bgcanvas_ctx_.createLinearGradient(0, 0, 0, canvasHeight); + if (fillGradientStyle) { + lingrad.addColorStop(0, fillGradientStyle); + } + lingrad.addColorStop(1, fillStyle); + this.bgcanvas_ctx_.fillStyle = lingrad; + ctx.fill(); + } + + if (strokeStyle) { + this.bgcanvas_ctx_.strokeStyle = strokeStyle; + this.bgcanvas_ctx_.lineWidth = this.getOption_('rangeSelectorPlotLineWidth'); + ctx.stroke(); + } +}; + +/** + * @private + * Computes and returns the combined series data along with min/max for the mini plot. + * The combined series consists of averaged values for all series. + * When series have error bars, the error bars are ignored. + * @return {Object} An object containing combined series array, ymin, ymax. + */ +rangeSelector.prototype.computeCombinedSeriesAndLimits_ = function () { + var g = this.dygraph_; + var logscale = this.getOption_('logscale'); + var i; + + // Select series to combine. By default, all series are combined. + var numColumns = g.numColumns(); + var labels = g.getLabels(); + var includeSeries = new Array(numColumns); + var anySet = false; + var visibility = g.visibility(); + var inclusion = []; + + for (i = 1; i < numColumns; i++) { + var include = this.getOption_('showInRangeSelector', labels[i]); + inclusion.push(include); + if (include !== null) anySet = true; // it's set explicitly for this series + } + + if (anySet) { + for (i = 1; i < numColumns; i++) { + includeSeries[i] = inclusion[i - 1]; + } + } else { + for (i = 1; i < numColumns; i++) { + includeSeries[i] = visibility[i - 1]; + } + } + + // Create a combined series (average of selected series values). + // TODO(danvk): short-circuit if there's only one series. + var rolledSeries = []; + var dataHandler = g.dataHandler_; + var options = g.attributes_; + for (i = 1; i < g.numColumns(); i++) { + if (!includeSeries[i]) continue; + var series = dataHandler.extractSeries(g.rawData_, i, options); + if (g.rollPeriod() > 1) { + series = dataHandler.rollingAverage(series, g.rollPeriod(), options); + } + + rolledSeries.push(series); + } + + var combinedSeries = []; + for (i = 0; i < rolledSeries[0].length; i++) { + var sum = 0; + var count = 0; + for (var j = 0; j < rolledSeries.length; j++) { + var y = rolledSeries[j][i][1]; + if (y === null || isNaN(y)) continue; + count++; + sum += y; + } + combinedSeries.push([rolledSeries[0][i][0], sum / count]); + } + + // Compute the y range. + var yMin = Number.MAX_VALUE; + var yMax = -Number.MAX_VALUE; + for (i = 0; i < combinedSeries.length; i++) { + var yVal = combinedSeries[i][1]; + if (yVal !== null && isFinite(yVal) && (!logscale || yVal > 0)) { + yMin = Math.min(yMin, yVal); + yMax = Math.max(yMax, yVal); + } + } + + // Convert Y data to log scale if needed. + // Also, expand the Y range to compress the mini plot a little. + var extraPercent = 0.25; + if (logscale) { + yMax = utils.log10(yMax); + yMax += yMax * extraPercent; + yMin = utils.log10(yMin); + for (i = 0; i < combinedSeries.length; i++) { + combinedSeries[i][1] = utils.log10(combinedSeries[i][1]); + } + } else { + var yExtra; + var yRange = yMax - yMin; + if (yRange <= Number.MIN_VALUE) { + yExtra = yMax * extraPercent; + } else { + yExtra = yRange * extraPercent; + } + yMax += yExtra; + yMin -= yExtra; + } + + return { data: combinedSeries, yMin: yMin, yMax: yMax }; +}; + +/** + * @private + * Places the zoom handles in the proper position based on the current X data window. + */ +rangeSelector.prototype.placeZoomHandles_ = function () { + var xExtremes = this.dygraph_.xAxisExtremes(); + var xWindowLimits = this.dygraph_.xAxisRange(); + var xRange = xExtremes[1] - xExtremes[0]; + var leftPercent = Math.max(0, (xWindowLimits[0] - xExtremes[0]) / xRange); + var rightPercent = Math.max(0, (xExtremes[1] - xWindowLimits[1]) / xRange); + var leftCoord = this.canvasRect_.x + this.canvasRect_.w * leftPercent; + var rightCoord = this.canvasRect_.x + this.canvasRect_.w * (1 - rightPercent); + var handleTop = Math.max(this.canvasRect_.y, this.canvasRect_.y + (this.canvasRect_.h - this.leftZoomHandle_.height) / 2); + var halfHandleWidth = this.leftZoomHandle_.width / 2; + this.leftZoomHandle_.style.left = leftCoord - halfHandleWidth + 'px'; + this.leftZoomHandle_.style.top = handleTop + 'px'; + this.rightZoomHandle_.style.left = rightCoord - halfHandleWidth + 'px'; + this.rightZoomHandle_.style.top = this.leftZoomHandle_.style.top; + + this.leftZoomHandle_.style.visibility = 'visible'; + this.rightZoomHandle_.style.visibility = 'visible'; +}; + +/** + * @private + * Draws the interactive layer in the foreground canvas. + */ +rangeSelector.prototype.drawInteractiveLayer_ = function () { + var ctx = this.fgcanvas_ctx_; + ctx.clearRect(0, 0, this.canvasRect_.w, this.canvasRect_.h); + var margin = 1; + var width = this.canvasRect_.w - margin; + var height = this.canvasRect_.h - margin; + var zoomHandleStatus = this.getZoomHandleStatus_(); + + ctx.strokeStyle = this.getOption_('rangeSelectorForegroundStrokeColor'); + ctx.lineWidth = this.getOption_('rangeSelectorForegroundLineWidth'); + if (!zoomHandleStatus.isZoomed) { + ctx.beginPath(); + ctx.moveTo(margin, margin); + ctx.lineTo(margin, height); + ctx.lineTo(width, height); + ctx.lineTo(width, margin); + ctx.stroke(); + } else { + var leftHandleCanvasPos = Math.max(margin, zoomHandleStatus.leftHandlePos - this.canvasRect_.x); + var rightHandleCanvasPos = Math.min(width, zoomHandleStatus.rightHandlePos - this.canvasRect_.x); + + ctx.fillStyle = 'rgba(240, 240, 240, ' + this.getOption_('rangeSelectorAlpha').toString() + ')'; + ctx.fillRect(0, 0, leftHandleCanvasPos, this.canvasRect_.h); + ctx.fillRect(rightHandleCanvasPos, 0, this.canvasRect_.w - rightHandleCanvasPos, this.canvasRect_.h); + + ctx.beginPath(); + ctx.moveTo(margin, margin); + ctx.lineTo(leftHandleCanvasPos, margin); + ctx.lineTo(leftHandleCanvasPos, height); + ctx.lineTo(rightHandleCanvasPos, height); + ctx.lineTo(rightHandleCanvasPos, margin); + ctx.lineTo(width, margin); + ctx.stroke(); + } +}; + +/** + * @private + * Returns the current zoom handle position information. + * @return {Object} The zoom handle status. + */ +rangeSelector.prototype.getZoomHandleStatus_ = function () { + var halfHandleWidth = this.leftZoomHandle_.width / 2; + var leftHandlePos = parseFloat(this.leftZoomHandle_.style.left) + halfHandleWidth; + var rightHandlePos = parseFloat(this.rightZoomHandle_.style.left) + halfHandleWidth; + return { + leftHandlePos: leftHandlePos, + rightHandlePos: rightHandlePos, + isZoomed: leftHandlePos - 1 > this.canvasRect_.x || rightHandlePos + 1 < this.canvasRect_.x + this.canvasRect_.w + }; +}; + +exports['default'] = rangeSelector; +module.exports = exports['default']; + +},{"../dygraph-interaction-model":12,"../dygraph-utils":17,"../iframe-tarp":19}]},{},[18])(18) +}); +//# sourceMappingURL=dygraph.js.map diff --git a/debian/missing-sources/epoch.css b/debian/missing-sources/epoch.css new file mode 100644 index 0000000..84d97e3 --- /dev/null +++ b/debian/missing-sources/epoch.css @@ -0,0 +1,1494 @@ +/* Epoch Master SCSS Includes the core styles and all the themes to produce the complete epoch css file. By Ryan Sandor Richards Copyright 2013 Fastly, Inc. */ +/* Core Epoch Styles */ +/** Generates the styles needed to define a fill color for a given class name. @param $name Name of the class to use (sans the leading .) @param $color Fill color to associate with the class name. */ +/** Produces categorical color classes for plots (excluding heatmaps). @param $list List of colors to use for each category. @param $entries Size of the input list. */ +/** Produces categorical colors for heatmaps. @param $list List of colors to use for categories. @param $entries Size of the input list. */ +.epoch .axis path, .epoch .axis line { shape-rendering: crispEdges; } + +.epoch .axis.canvas .tick line { shape-rendering: geometricPrecision; } + +/* Canvas Styles Reference Container The reference container is an SVG that is automatically created when Epoch is loaded. It is used by the canvas based plots to obtain color information from the page styles by creating reference elements and then reading their computed styles. Note: don't mess with this ;) */ +div#_canvas_css_reference { width: 0; height: 0; position: absolute; top: -1000px; left: -1000px; } + +div#_canvas_css_reference svg { position: absolute; width: 0; height: 0; top: -1000px; left: -1000px; } + +/* theme/_default.scss - Default Color Theme Categorical Colors Adapted from d3: https://github.com/mbostock/d3/wiki/Ordinal-Scales#categorical-colors */ +.epoch { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 12pt; } + +.epoch .axis path, .epoch .axis line { fill: transparent; stroke: #000; } + +.epoch .axis .tick text { font-size: 9pt; } + +.epoch .line { fill: transparent; stroke-width: 2px; } + +.epoch.sparklines .line { stroke-width: 1px; } + +.epoch .area { stroke: transparent; } + +.epoch .arc.pie { stroke: #fff; stroke-width: 1.5px; } + +.epoch .arc.pie text { stroke: transparent; fill: white; font-size: 9pt; } + +.epoch .gauge-labels .value { text-anchor: middle; font-size: 140%; fill: #666; } + +.epoch.gauge-tiny { width: 120px; height: 90px; } + +.epoch.gauge-tiny .gauge-labels .value { font-size: 80%; } + +.epoch.gauge-tiny .gauge .arc.outer { stroke-width: 2px; } + +.epoch.gauge-small { width: 180px; height: 135px; } + +.epoch.gauge-small .gauge-labels .value { font-size: 120%; } + +.epoch.gauge-small .gauge .arc.outer { stroke-width: 3px; } + +.epoch.gauge-medium { width: 240px; height: 180px; } + +.epoch.gauge-medium .gauge .arc.outer { stroke-width: 3px; } + +.epoch.gauge-large { width: 320px; height: 240px; } + +.epoch.gauge-large .gauge-labels .value { font-size: 180%; } + +.epoch .gauge .arc.outer { stroke-width: 4px; stroke: #666; } + +.epoch .gauge .arc.inner { stroke-width: 1px; stroke: #555; } + +.epoch .gauge .tick { stroke-width: 1px; stroke: #555; } + +.epoch .gauge .needle { fill: orange; } + +.epoch .gauge .needle-base { fill: #666; } + +.epoch div.ref.category1, .epoch.category10 div.ref.category1 { background-color: #1f77b4; } + +.epoch .category1 .line, .epoch.category10 .category1 .line { stroke: #1f77b4; } + +.epoch .category1 .area, .epoch .category1 .dot, .epoch.category10 .category1 .area, .epoch.category10 .category1 .dot { fill: #1f77b4; stroke: transparent; } + +.epoch .arc.category1 path, .epoch.category10 .arc.category1 path { fill: #1f77b4; } + +.epoch .bar.category1, .epoch.category10 .bar.category1 { fill: #1f77b4; } + +.epoch div.ref.category2, .epoch.category10 div.ref.category2 { background-color: #ff7f0e; } + +.epoch .category2 .line, .epoch.category10 .category2 .line { stroke: #ff7f0e; } + +.epoch .category2 .area, .epoch .category2 .dot, .epoch.category10 .category2 .area, .epoch.category10 .category2 .dot { fill: #ff7f0e; stroke: transparent; } + +.epoch .arc.category2 path, .epoch.category10 .arc.category2 path { fill: #ff7f0e; } + +.epoch .bar.category2, .epoch.category10 .bar.category2 { fill: #ff7f0e; } + +.epoch div.ref.category3, .epoch.category10 div.ref.category3 { background-color: #2ca02c; } + +.epoch .category3 .line, .epoch.category10 .category3 .line { stroke: #2ca02c; } + +.epoch .category3 .area, .epoch .category3 .dot, .epoch.category10 .category3 .area, .epoch.category10 .category3 .dot { fill: #2ca02c; stroke: transparent; } + +.epoch .arc.category3 path, .epoch.category10 .arc.category3 path { fill: #2ca02c; } + +.epoch .bar.category3, .epoch.category10 .bar.category3 { fill: #2ca02c; } + +.epoch div.ref.category4, .epoch.category10 div.ref.category4 { background-color: #d62728; } + +.epoch .category4 .line, .epoch.category10 .category4 .line { stroke: #d62728; } + +.epoch .category4 .area, .epoch .category4 .dot, .epoch.category10 .category4 .area, .epoch.category10 .category4 .dot { fill: #d62728; stroke: transparent; } + +.epoch .arc.category4 path, .epoch.category10 .arc.category4 path { fill: #d62728; } + +.epoch .bar.category4, .epoch.category10 .bar.category4 { fill: #d62728; } + +.epoch div.ref.category5, .epoch.category10 div.ref.category5 { background-color: #9467bd; } + +.epoch .category5 .line, .epoch.category10 .category5 .line { stroke: #9467bd; } + +.epoch .category5 .area, .epoch .category5 .dot, .epoch.category10 .category5 .area, .epoch.category10 .category5 .dot { fill: #9467bd; stroke: transparent; } + +.epoch .arc.category5 path, .epoch.category10 .arc.category5 path { fill: #9467bd; } + +.epoch .bar.category5, .epoch.category10 .bar.category5 { fill: #9467bd; } + +.epoch div.ref.category6, .epoch.category10 div.ref.category6 { background-color: #8c564b; } + +.epoch .category6 .line, .epoch.category10 .category6 .line { stroke: #8c564b; } + +.epoch .category6 .area, .epoch .category6 .dot, .epoch.category10 .category6 .area, .epoch.category10 .category6 .dot { fill: #8c564b; stroke: transparent; } + +.epoch .arc.category6 path, .epoch.category10 .arc.category6 path { fill: #8c564b; } + +.epoch .bar.category6, .epoch.category10 .bar.category6 { fill: #8c564b; } + +.epoch div.ref.category7, .epoch.category10 div.ref.category7 { background-color: #e377c2; } + +.epoch .category7 .line, .epoch.category10 .category7 .line { stroke: #e377c2; } + +.epoch .category7 .area, .epoch .category7 .dot, .epoch.category10 .category7 .area, .epoch.category10 .category7 .dot { fill: #e377c2; stroke: transparent; } + +.epoch .arc.category7 path, .epoch.category10 .arc.category7 path { fill: #e377c2; } + +.epoch .bar.category7, .epoch.category10 .bar.category7 { fill: #e377c2; } + +.epoch div.ref.category8, .epoch.category10 div.ref.category8 { background-color: #7f7f7f; } + +.epoch .category8 .line, .epoch.category10 .category8 .line { stroke: #7f7f7f; } + +.epoch .category8 .area, .epoch .category8 .dot, .epoch.category10 .category8 .area, .epoch.category10 .category8 .dot { fill: #7f7f7f; stroke: transparent; } + +.epoch .arc.category8 path, .epoch.category10 .arc.category8 path { fill: #7f7f7f; } + +.epoch .bar.category8, .epoch.category10 .bar.category8 { fill: #7f7f7f; } + +.epoch div.ref.category9, .epoch.category10 div.ref.category9 { background-color: #bcbd22; } + +.epoch .category9 .line, .epoch.category10 .category9 .line { stroke: #bcbd22; } + +.epoch .category9 .area, .epoch .category9 .dot, .epoch.category10 .category9 .area, .epoch.category10 .category9 .dot { fill: #bcbd22; stroke: transparent; } + +.epoch .arc.category9 path, .epoch.category10 .arc.category9 path { fill: #bcbd22; } + +.epoch .bar.category9, .epoch.category10 .bar.category9 { fill: #bcbd22; } + +.epoch div.ref.category10, .epoch.category10 div.ref.category10 { background-color: #17becf; } + +.epoch .category10 .line, .epoch.category10 .category10 .line { stroke: #17becf; } + +.epoch .category10 .area, .epoch .category10 .dot, .epoch.category10 .category10 .area, .epoch.category10 .category10 .dot { fill: #17becf; stroke: transparent; } + +.epoch .arc.category10 path, .epoch.category10 .arc.category10 path { fill: #17becf; } + +.epoch .bar.category10, .epoch.category10 .bar.category10 { fill: #17becf; } + +.epoch.category20 div.ref.category1 { background-color: #1f77b4; } + +.epoch.category20 .category1 .line { stroke: #1f77b4; } + +.epoch.category20 .category1 .area, .epoch.category20 .category1 .dot { fill: #1f77b4; stroke: transparent; } + +.epoch.category20 .arc.category1 path { fill: #1f77b4; } + +.epoch.category20 .bar.category1 { fill: #1f77b4; } + +.epoch.category20 div.ref.category2 { background-color: #aec7e8; } + +.epoch.category20 .category2 .line { stroke: #aec7e8; } + +.epoch.category20 .category2 .area, .epoch.category20 .category2 .dot { fill: #aec7e8; stroke: transparent; } + +.epoch.category20 .arc.category2 path { fill: #aec7e8; } + +.epoch.category20 .bar.category2 { fill: #aec7e8; } + +.epoch.category20 div.ref.category3 { background-color: #ff7f0e; } + +.epoch.category20 .category3 .line { stroke: #ff7f0e; } + +.epoch.category20 .category3 .area, .epoch.category20 .category3 .dot { fill: #ff7f0e; stroke: transparent; } + +.epoch.category20 .arc.category3 path { fill: #ff7f0e; } + +.epoch.category20 .bar.category3 { fill: #ff7f0e; } + +.epoch.category20 div.ref.category4 { background-color: #ffbb78; } + +.epoch.category20 .category4 .line { stroke: #ffbb78; } + +.epoch.category20 .category4 .area, .epoch.category20 .category4 .dot { fill: #ffbb78; stroke: transparent; } + +.epoch.category20 .arc.category4 path { fill: #ffbb78; } + +.epoch.category20 .bar.category4 { fill: #ffbb78; } + +.epoch.category20 div.ref.category5 { background-color: #2ca02c; } + +.epoch.category20 .category5 .line { stroke: #2ca02c; } + +.epoch.category20 .category5 .area, .epoch.category20 .category5 .dot { fill: #2ca02c; stroke: transparent; } + +.epoch.category20 .arc.category5 path { fill: #2ca02c; } + +.epoch.category20 .bar.category5 { fill: #2ca02c; } + +.epoch.category20 div.ref.category6 { background-color: #98df8a; } + +.epoch.category20 .category6 .line { stroke: #98df8a; } + +.epoch.category20 .category6 .area, .epoch.category20 .category6 .dot { fill: #98df8a; stroke: transparent; } + +.epoch.category20 .arc.category6 path { fill: #98df8a; } + +.epoch.category20 .bar.category6 { fill: #98df8a; } + +.epoch.category20 div.ref.category7 { background-color: #d62728; } + +.epoch.category20 .category7 .line { stroke: #d62728; } + +.epoch.category20 .category7 .area, .epoch.category20 .category7 .dot { fill: #d62728; stroke: transparent; } + +.epoch.category20 .arc.category7 path { fill: #d62728; } + +.epoch.category20 .bar.category7 { fill: #d62728; } + +.epoch.category20 div.ref.category8 { background-color: #ff9896; } + +.epoch.category20 .category8 .line { stroke: #ff9896; } + +.epoch.category20 .category8 .area, .epoch.category20 .category8 .dot { fill: #ff9896; stroke: transparent; } + +.epoch.category20 .arc.category8 path { fill: #ff9896; } + +.epoch.category20 .bar.category8 { fill: #ff9896; } + +.epoch.category20 div.ref.category9 { background-color: #9467bd; } + +.epoch.category20 .category9 .line { stroke: #9467bd; } + +.epoch.category20 .category9 .area, .epoch.category20 .category9 .dot { fill: #9467bd; stroke: transparent; } + +.epoch.category20 .arc.category9 path { fill: #9467bd; } + +.epoch.category20 .bar.category9 { fill: #9467bd; } + +.epoch.category20 div.ref.category10 { background-color: #c5b0d5; } + +.epoch.category20 .category10 .line { stroke: #c5b0d5; } + +.epoch.category20 .category10 .area, .epoch.category20 .category10 .dot { fill: #c5b0d5; stroke: transparent; } + +.epoch.category20 .arc.category10 path { fill: #c5b0d5; } + +.epoch.category20 .bar.category10 { fill: #c5b0d5; } + +.epoch.category20 div.ref.category11 { background-color: #8c564b; } + +.epoch.category20 .category11 .line { stroke: #8c564b; } + +.epoch.category20 .category11 .area, .epoch.category20 .category11 .dot { fill: #8c564b; stroke: transparent; } + +.epoch.category20 .arc.category11 path { fill: #8c564b; } + +.epoch.category20 .bar.category11 { fill: #8c564b; } + +.epoch.category20 div.ref.category12 { background-color: #c49c94; } + +.epoch.category20 .category12 .line { stroke: #c49c94; } + +.epoch.category20 .category12 .area, .epoch.category20 .category12 .dot { fill: #c49c94; stroke: transparent; } + +.epoch.category20 .arc.category12 path { fill: #c49c94; } + +.epoch.category20 .bar.category12 { fill: #c49c94; } + +.epoch.category20 div.ref.category13 { background-color: #e377c2; } + +.epoch.category20 .category13 .line { stroke: #e377c2; } + +.epoch.category20 .category13 .area, .epoch.category20 .category13 .dot { fill: #e377c2; stroke: transparent; } + +.epoch.category20 .arc.category13 path { fill: #e377c2; } + +.epoch.category20 .bar.category13 { fill: #e377c2; } + +.epoch.category20 div.ref.category14 { background-color: #f7b6d2; } + +.epoch.category20 .category14 .line { stroke: #f7b6d2; } + +.epoch.category20 .category14 .area, .epoch.category20 .category14 .dot { fill: #f7b6d2; stroke: transparent; } + +.epoch.category20 .arc.category14 path { fill: #f7b6d2; } + +.epoch.category20 .bar.category14 { fill: #f7b6d2; } + +.epoch.category20 div.ref.category15 { background-color: #7f7f7f; } + +.epoch.category20 .category15 .line { stroke: #7f7f7f; } + +.epoch.category20 .category15 .area, .epoch.category20 .category15 .dot { fill: #7f7f7f; stroke: transparent; } + +.epoch.category20 .arc.category15 path { fill: #7f7f7f; } + +.epoch.category20 .bar.category15 { fill: #7f7f7f; } + +.epoch.category20 div.ref.category16 { background-color: #c7c7c7; } + +.epoch.category20 .category16 .line { stroke: #c7c7c7; } + +.epoch.category20 .category16 .area, .epoch.category20 .category16 .dot { fill: #c7c7c7; stroke: transparent; } + +.epoch.category20 .arc.category16 path { fill: #c7c7c7; } + +.epoch.category20 .bar.category16 { fill: #c7c7c7; } + +.epoch.category20 div.ref.category17 { background-color: #bcbd22; } + +.epoch.category20 .category17 .line { stroke: #bcbd22; } + +.epoch.category20 .category17 .area, .epoch.category20 .category17 .dot { fill: #bcbd22; stroke: transparent; } + +.epoch.category20 .arc.category17 path { fill: #bcbd22; } + +.epoch.category20 .bar.category17 { fill: #bcbd22; } + +.epoch.category20 div.ref.category18 { background-color: #dbdb8d; } + +.epoch.category20 .category18 .line { stroke: #dbdb8d; } + +.epoch.category20 .category18 .area, .epoch.category20 .category18 .dot { fill: #dbdb8d; stroke: transparent; } + +.epoch.category20 .arc.category18 path { fill: #dbdb8d; } + +.epoch.category20 .bar.category18 { fill: #dbdb8d; } + +.epoch.category20 div.ref.category19 { background-color: #17becf; } + +.epoch.category20 .category19 .line { stroke: #17becf; } + +.epoch.category20 .category19 .area, .epoch.category20 .category19 .dot { fill: #17becf; stroke: transparent; } + +.epoch.category20 .arc.category19 path { fill: #17becf; } + +.epoch.category20 .bar.category19 { fill: #17becf; } + +.epoch.category20 div.ref.category20 { background-color: #9edae5; } + +.epoch.category20 .category20 .line { stroke: #9edae5; } + +.epoch.category20 .category20 .area, .epoch.category20 .category20 .dot { fill: #9edae5; stroke: transparent; } + +.epoch.category20 .arc.category20 path { fill: #9edae5; } + +.epoch.category20 .bar.category20 { fill: #9edae5; } + +.epoch.category20b div.ref.category1 { background-color: #393b79; } + +.epoch.category20b .category1 .line { stroke: #393b79; } + +.epoch.category20b .category1 .area, .epoch.category20b .category1 .dot { fill: #393b79; stroke: transparent; } + +.epoch.category20b .arc.category1 path { fill: #393b79; } + +.epoch.category20b .bar.category1 { fill: #393b79; } + +.epoch.category20b div.ref.category2 { background-color: #5254a3; } + +.epoch.category20b .category2 .line { stroke: #5254a3; } + +.epoch.category20b .category2 .area, .epoch.category20b .category2 .dot { fill: #5254a3; stroke: transparent; } + +.epoch.category20b .arc.category2 path { fill: #5254a3; } + +.epoch.category20b .bar.category2 { fill: #5254a3; } + +.epoch.category20b div.ref.category3 { background-color: #6b6ecf; } + +.epoch.category20b .category3 .line { stroke: #6b6ecf; } + +.epoch.category20b .category3 .area, .epoch.category20b .category3 .dot { fill: #6b6ecf; stroke: transparent; } + +.epoch.category20b .arc.category3 path { fill: #6b6ecf; } + +.epoch.category20b .bar.category3 { fill: #6b6ecf; } + +.epoch.category20b div.ref.category4 { background-color: #9c9ede; } + +.epoch.category20b .category4 .line { stroke: #9c9ede; } + +.epoch.category20b .category4 .area, .epoch.category20b .category4 .dot { fill: #9c9ede; stroke: transparent; } + +.epoch.category20b .arc.category4 path { fill: #9c9ede; } + +.epoch.category20b .bar.category4 { fill: #9c9ede; } + +.epoch.category20b div.ref.category5 { background-color: #637939; } + +.epoch.category20b .category5 .line { stroke: #637939; } + +.epoch.category20b .category5 .area, .epoch.category20b .category5 .dot { fill: #637939; stroke: transparent; } + +.epoch.category20b .arc.category5 path { fill: #637939; } + +.epoch.category20b .bar.category5 { fill: #637939; } + +.epoch.category20b div.ref.category6 { background-color: #8ca252; } + +.epoch.category20b .category6 .line { stroke: #8ca252; } + +.epoch.category20b .category6 .area, .epoch.category20b .category6 .dot { fill: #8ca252; stroke: transparent; } + +.epoch.category20b .arc.category6 path { fill: #8ca252; } + +.epoch.category20b .bar.category6 { fill: #8ca252; } + +.epoch.category20b div.ref.category7 { background-color: #b5cf6b; } + +.epoch.category20b .category7 .line { stroke: #b5cf6b; } + +.epoch.category20b .category7 .area, .epoch.category20b .category7 .dot { fill: #b5cf6b; stroke: transparent; } + +.epoch.category20b .arc.category7 path { fill: #b5cf6b; } + +.epoch.category20b .bar.category7 { fill: #b5cf6b; } + +.epoch.category20b div.ref.category8 { background-color: #cedb9c; } + +.epoch.category20b .category8 .line { stroke: #cedb9c; } + +.epoch.category20b .category8 .area, .epoch.category20b .category8 .dot { fill: #cedb9c; stroke: transparent; } + +.epoch.category20b .arc.category8 path { fill: #cedb9c; } + +.epoch.category20b .bar.category8 { fill: #cedb9c; } + +.epoch.category20b div.ref.category9 { background-color: #8c6d31; } + +.epoch.category20b .category9 .line { stroke: #8c6d31; } + +.epoch.category20b .category9 .area, .epoch.category20b .category9 .dot { fill: #8c6d31; stroke: transparent; } + +.epoch.category20b .arc.category9 path { fill: #8c6d31; } + +.epoch.category20b .bar.category9 { fill: #8c6d31; } + +.epoch.category20b div.ref.category10 { background-color: #bd9e39; } + +.epoch.category20b .category10 .line { stroke: #bd9e39; } + +.epoch.category20b .category10 .area, .epoch.category20b .category10 .dot { fill: #bd9e39; stroke: transparent; } + +.epoch.category20b .arc.category10 path { fill: #bd9e39; } + +.epoch.category20b .bar.category10 { fill: #bd9e39; } + +.epoch.category20b div.ref.category11 { background-color: #e7ba52; } + +.epoch.category20b .category11 .line { stroke: #e7ba52; } + +.epoch.category20b .category11 .area, .epoch.category20b .category11 .dot { fill: #e7ba52; stroke: transparent; } + +.epoch.category20b .arc.category11 path { fill: #e7ba52; } + +.epoch.category20b .bar.category11 { fill: #e7ba52; } + +.epoch.category20b div.ref.category12 { background-color: #e7cb94; } + +.epoch.category20b .category12 .line { stroke: #e7cb94; } + +.epoch.category20b .category12 .area, .epoch.category20b .category12 .dot { fill: #e7cb94; stroke: transparent; } + +.epoch.category20b .arc.category12 path { fill: #e7cb94; } + +.epoch.category20b .bar.category12 { fill: #e7cb94; } + +.epoch.category20b div.ref.category13 { background-color: #843c39; } + +.epoch.category20b .category13 .line { stroke: #843c39; } + +.epoch.category20b .category13 .area, .epoch.category20b .category13 .dot { fill: #843c39; stroke: transparent; } + +.epoch.category20b .arc.category13 path { fill: #843c39; } + +.epoch.category20b .bar.category13 { fill: #843c39; } + +.epoch.category20b div.ref.category14 { background-color: #ad494a; } + +.epoch.category20b .category14 .line { stroke: #ad494a; } + +.epoch.category20b .category14 .area, .epoch.category20b .category14 .dot { fill: #ad494a; stroke: transparent; } + +.epoch.category20b .arc.category14 path { fill: #ad494a; } + +.epoch.category20b .bar.category14 { fill: #ad494a; } + +.epoch.category20b div.ref.category15 { background-color: #d6616b; } + +.epoch.category20b .category15 .line { stroke: #d6616b; } + +.epoch.category20b .category15 .area, .epoch.category20b .category15 .dot { fill: #d6616b; stroke: transparent; } + +.epoch.category20b .arc.category15 path { fill: #d6616b; } + +.epoch.category20b .bar.category15 { fill: #d6616b; } + +.epoch.category20b div.ref.category16 { background-color: #e7969c; } + +.epoch.category20b .category16 .line { stroke: #e7969c; } + +.epoch.category20b .category16 .area, .epoch.category20b .category16 .dot { fill: #e7969c; stroke: transparent; } + +.epoch.category20b .arc.category16 path { fill: #e7969c; } + +.epoch.category20b .bar.category16 { fill: #e7969c; } + +.epoch.category20b div.ref.category17 { background-color: #7b4173; } + +.epoch.category20b .category17 .line { stroke: #7b4173; } + +.epoch.category20b .category17 .area, .epoch.category20b .category17 .dot { fill: #7b4173; stroke: transparent; } + +.epoch.category20b .arc.category17 path { fill: #7b4173; } + +.epoch.category20b .bar.category17 { fill: #7b4173; } + +.epoch.category20b div.ref.category18 { background-color: #a55194; } + +.epoch.category20b .category18 .line { stroke: #a55194; } + +.epoch.category20b .category18 .area, .epoch.category20b .category18 .dot { fill: #a55194; stroke: transparent; } + +.epoch.category20b .arc.category18 path { fill: #a55194; } + +.epoch.category20b .bar.category18 { fill: #a55194; } + +.epoch.category20b div.ref.category19 { background-color: #ce6dbd; } + +.epoch.category20b .category19 .line { stroke: #ce6dbd; } + +.epoch.category20b .category19 .area, .epoch.category20b .category19 .dot { fill: #ce6dbd; stroke: transparent; } + +.epoch.category20b .arc.category19 path { fill: #ce6dbd; } + +.epoch.category20b .bar.category19 { fill: #ce6dbd; } + +.epoch.category20b div.ref.category20 { background-color: #de9ed6; } + +.epoch.category20b .category20 .line { stroke: #de9ed6; } + +.epoch.category20b .category20 .area, .epoch.category20b .category20 .dot { fill: #de9ed6; stroke: transparent; } + +.epoch.category20b .arc.category20 path { fill: #de9ed6; } + +.epoch.category20b .bar.category20 { fill: #de9ed6; } + +.epoch.category20c div.ref.category1 { background-color: #3182bd; } + +.epoch.category20c .category1 .line { stroke: #3182bd; } + +.epoch.category20c .category1 .area, .epoch.category20c .category1 .dot { fill: #3182bd; stroke: transparent; } + +.epoch.category20c .arc.category1 path { fill: #3182bd; } + +.epoch.category20c .bar.category1 { fill: #3182bd; } + +.epoch.category20c div.ref.category2 { background-color: #6baed6; } + +.epoch.category20c .category2 .line { stroke: #6baed6; } + +.epoch.category20c .category2 .area, .epoch.category20c .category2 .dot { fill: #6baed6; stroke: transparent; } + +.epoch.category20c .arc.category2 path { fill: #6baed6; } + +.epoch.category20c .bar.category2 { fill: #6baed6; } + +.epoch.category20c div.ref.category3 { background-color: #9ecae1; } + +.epoch.category20c .category3 .line { stroke: #9ecae1; } + +.epoch.category20c .category3 .area, .epoch.category20c .category3 .dot { fill: #9ecae1; stroke: transparent; } + +.epoch.category20c .arc.category3 path { fill: #9ecae1; } + +.epoch.category20c .bar.category3 { fill: #9ecae1; } + +.epoch.category20c div.ref.category4 { background-color: #c6dbef; } + +.epoch.category20c .category4 .line { stroke: #c6dbef; } + +.epoch.category20c .category4 .area, .epoch.category20c .category4 .dot { fill: #c6dbef; stroke: transparent; } + +.epoch.category20c .arc.category4 path { fill: #c6dbef; } + +.epoch.category20c .bar.category4 { fill: #c6dbef; } + +.epoch.category20c div.ref.category5 { background-color: #e6550d; } + +.epoch.category20c .category5 .line { stroke: #e6550d; } + +.epoch.category20c .category5 .area, .epoch.category20c .category5 .dot { fill: #e6550d; stroke: transparent; } + +.epoch.category20c .arc.category5 path { fill: #e6550d; } + +.epoch.category20c .bar.category5 { fill: #e6550d; } + +.epoch.category20c div.ref.category6 { background-color: #fd8d3c; } + +.epoch.category20c .category6 .line { stroke: #fd8d3c; } + +.epoch.category20c .category6 .area, .epoch.category20c .category6 .dot { fill: #fd8d3c; stroke: transparent; } + +.epoch.category20c .arc.category6 path { fill: #fd8d3c; } + +.epoch.category20c .bar.category6 { fill: #fd8d3c; } + +.epoch.category20c div.ref.category7 { background-color: #fdae6b; } + +.epoch.category20c .category7 .line { stroke: #fdae6b; } + +.epoch.category20c .category7 .area, .epoch.category20c .category7 .dot { fill: #fdae6b; stroke: transparent; } + +.epoch.category20c .arc.category7 path { fill: #fdae6b; } + +.epoch.category20c .bar.category7 { fill: #fdae6b; } + +.epoch.category20c div.ref.category8 { background-color: #fdd0a2; } + +.epoch.category20c .category8 .line { stroke: #fdd0a2; } + +.epoch.category20c .category8 .area, .epoch.category20c .category8 .dot { fill: #fdd0a2; stroke: transparent; } + +.epoch.category20c .arc.category8 path { fill: #fdd0a2; } + +.epoch.category20c .bar.category8 { fill: #fdd0a2; } + +.epoch.category20c div.ref.category9 { background-color: #31a354; } + +.epoch.category20c .category9 .line { stroke: #31a354; } + +.epoch.category20c .category9 .area, .epoch.category20c .category9 .dot { fill: #31a354; stroke: transparent; } + +.epoch.category20c .arc.category9 path { fill: #31a354; } + +.epoch.category20c .bar.category9 { fill: #31a354; } + +.epoch.category20c div.ref.category10 { background-color: #74c476; } + +.epoch.category20c .category10 .line { stroke: #74c476; } + +.epoch.category20c .category10 .area, .epoch.category20c .category10 .dot { fill: #74c476; stroke: transparent; } + +.epoch.category20c .arc.category10 path { fill: #74c476; } + +.epoch.category20c .bar.category10 { fill: #74c476; } + +.epoch.category20c div.ref.category11 { background-color: #a1d99b; } + +.epoch.category20c .category11 .line { stroke: #a1d99b; } + +.epoch.category20c .category11 .area, .epoch.category20c .category11 .dot { fill: #a1d99b; stroke: transparent; } + +.epoch.category20c .arc.category11 path { fill: #a1d99b; } + +.epoch.category20c .bar.category11 { fill: #a1d99b; } + +.epoch.category20c div.ref.category12 { background-color: #c7e9c0; } + +.epoch.category20c .category12 .line { stroke: #c7e9c0; } + +.epoch.category20c .category12 .area, .epoch.category20c .category12 .dot { fill: #c7e9c0; stroke: transparent; } + +.epoch.category20c .arc.category12 path { fill: #c7e9c0; } + +.epoch.category20c .bar.category12 { fill: #c7e9c0; } + +.epoch.category20c div.ref.category13 { background-color: #756bb1; } + +.epoch.category20c .category13 .line { stroke: #756bb1; } + +.epoch.category20c .category13 .area, .epoch.category20c .category13 .dot { fill: #756bb1; stroke: transparent; } + +.epoch.category20c .arc.category13 path { fill: #756bb1; } + +.epoch.category20c .bar.category13 { fill: #756bb1; } + +.epoch.category20c div.ref.category14 { background-color: #9e9ac8; } + +.epoch.category20c .category14 .line { stroke: #9e9ac8; } + +.epoch.category20c .category14 .area, .epoch.category20c .category14 .dot { fill: #9e9ac8; stroke: transparent; } + +.epoch.category20c .arc.category14 path { fill: #9e9ac8; } + +.epoch.category20c .bar.category14 { fill: #9e9ac8; } + +.epoch.category20c div.ref.category15 { background-color: #bcbddc; } + +.epoch.category20c .category15 .line { stroke: #bcbddc; } + +.epoch.category20c .category15 .area, .epoch.category20c .category15 .dot { fill: #bcbddc; stroke: transparent; } + +.epoch.category20c .arc.category15 path { fill: #bcbddc; } + +.epoch.category20c .bar.category15 { fill: #bcbddc; } + +.epoch.category20c div.ref.category16 { background-color: #dadaeb; } + +.epoch.category20c .category16 .line { stroke: #dadaeb; } + +.epoch.category20c .category16 .area, .epoch.category20c .category16 .dot { fill: #dadaeb; stroke: transparent; } + +.epoch.category20c .arc.category16 path { fill: #dadaeb; } + +.epoch.category20c .bar.category16 { fill: #dadaeb; } + +.epoch.category20c div.ref.category17 { background-color: #636363; } + +.epoch.category20c .category17 .line { stroke: #636363; } + +.epoch.category20c .category17 .area, .epoch.category20c .category17 .dot { fill: #636363; stroke: transparent; } + +.epoch.category20c .arc.category17 path { fill: #636363; } + +.epoch.category20c .bar.category17 { fill: #636363; } + +.epoch.category20c div.ref.category18 { background-color: #969696; } + +.epoch.category20c .category18 .line { stroke: #969696; } + +.epoch.category20c .category18 .area, .epoch.category20c .category18 .dot { fill: #969696; stroke: transparent; } + +.epoch.category20c .arc.category18 path { fill: #969696; } + +.epoch.category20c .bar.category18 { fill: #969696; } + +.epoch.category20c div.ref.category19 { background-color: #bdbdbd; } + +.epoch.category20c .category19 .line { stroke: #bdbdbd; } + +.epoch.category20c .category19 .area, .epoch.category20c .category19 .dot { fill: #bdbdbd; stroke: transparent; } + +.epoch.category20c .arc.category19 path { fill: #bdbdbd; } + +.epoch.category20c .bar.category19 { fill: #bdbdbd; } + +.epoch.category20c div.ref.category20 { background-color: #d9d9d9; } + +.epoch.category20c .category20 .line { stroke: #d9d9d9; } + +.epoch.category20c .category20 .area, .epoch.category20c .category20 .dot { fill: #d9d9d9; stroke: transparent; } + +.epoch.category20c .arc.category20 path { fill: #d9d9d9; } + +.epoch.category20c .bar.category20 { fill: #d9d9d9; } + +/* Heatmap Colors The heatmap real-time graph uses color blending to choose the color for which to render each bucket. Basic d3 categorical colors do not work well in this instance because the colors in the sequence vary wildly in precieved luminosity. Below we define small subsets that should work well together because they are of similar luminosities. Note: darker colors work better since we use opacity to denote "height" or "intensity" for each bucket after picking a mix color. */ +.epoch .category1 .bucket, .epoch.heatmap5 .category1 .bucket { fill: #1f77b4; } + +.epoch .category2 .bucket, .epoch.heatmap5 .category2 .bucket { fill: #2ca02c; } + +.epoch .category3 .bucket, .epoch.heatmap5 .category3 .bucket { fill: #d62728; } + +.epoch .category4 .bucket, .epoch.heatmap5 .category4 .bucket { fill: #8c564b; } + +.epoch .category5 .bucket, .epoch.heatmap5 .category5 .bucket { fill: #7f7f7f; } + +/* theme/_dark.scss - Theme design for dark page backgrounds. Designed by Ryan Sandor Richards */ +.epoch-theme-dark .epoch .axis path, .epoch-theme-dark .epoch .axis line { stroke: #d0d0d0; } + +.epoch-theme-dark .epoch .axis .tick text { fill: #d0d0d0; } + +.epoch-theme-dark .arc.pie { stroke: #333; } + +.epoch-theme-dark .arc.pie text { fill: #333; } + +.epoch-theme-dark .epoch .gauge-labels .value { fill: #BBB; } + +.epoch-theme-dark .epoch .gauge .arc.outer { stroke: #999; } + +.epoch-theme-dark .epoch .gauge .arc.inner { stroke: #AAA; } + +.epoch-theme-dark .epoch .gauge .tick { stroke: #AAA; } + +.epoch-theme-dark .epoch .gauge .needle { fill: #F3DE88; } + +.epoch-theme-dark .epoch .gauge .needle-base { fill: #999; } + +.epoch-theme-dark .epoch div.ref.category1, .epoch-theme-dark .epoch.category10 div.ref.category1 { background-color: #909CFF; } + +.epoch-theme-dark .epoch .category1 .line, .epoch-theme-dark .epoch.category10 .category1 .line { stroke: #909CFF; } + +.epoch-theme-dark .epoch .category1 .area, .epoch-theme-dark .epoch .category1 .dot, .epoch-theme-dark .epoch.category10 .category1 .area, .epoch-theme-dark .epoch.category10 .category1 .dot { fill: #909CFF; stroke: transparent; } + +.epoch-theme-dark .epoch .arc.category1 path, .epoch-theme-dark .epoch.category10 .arc.category1 path { fill: #909CFF; } + +.epoch-theme-dark .epoch .bar.category1, .epoch-theme-dark .epoch.category10 .bar.category1 { fill: #909CFF; } + +.epoch-theme-dark .epoch div.ref.category2, .epoch-theme-dark .epoch.category10 div.ref.category2 { background-color: #FFAC89; } + +.epoch-theme-dark .epoch .category2 .line, .epoch-theme-dark .epoch.category10 .category2 .line { stroke: #FFAC89; } + +.epoch-theme-dark .epoch .category2 .area, .epoch-theme-dark .epoch .category2 .dot, .epoch-theme-dark .epoch.category10 .category2 .area, .epoch-theme-dark .epoch.category10 .category2 .dot { fill: #FFAC89; stroke: transparent; } + +.epoch-theme-dark .epoch .arc.category2 path, .epoch-theme-dark .epoch.category10 .arc.category2 path { fill: #FFAC89; } + +.epoch-theme-dark .epoch .bar.category2, .epoch-theme-dark .epoch.category10 .bar.category2 { fill: #FFAC89; } + +.epoch-theme-dark .epoch div.ref.category3, .epoch-theme-dark .epoch.category10 div.ref.category3 { background-color: #E889E8; } + +.epoch-theme-dark .epoch .category3 .line, .epoch-theme-dark .epoch.category10 .category3 .line { stroke: #E889E8; } + +.epoch-theme-dark .epoch .category3 .area, .epoch-theme-dark .epoch .category3 .dot, .epoch-theme-dark .epoch.category10 .category3 .area, .epoch-theme-dark .epoch.category10 .category3 .dot { fill: #E889E8; stroke: transparent; } + +.epoch-theme-dark .epoch .arc.category3 path, .epoch-theme-dark .epoch.category10 .arc.category3 path { fill: #E889E8; } + +.epoch-theme-dark .epoch .bar.category3, .epoch-theme-dark .epoch.category10 .bar.category3 { fill: #E889E8; } + +.epoch-theme-dark .epoch div.ref.category4, .epoch-theme-dark .epoch.category10 div.ref.category4 { background-color: #78E8D3; } + +.epoch-theme-dark .epoch .category4 .line, .epoch-theme-dark .epoch.category10 .category4 .line { stroke: #78E8D3; } + +.epoch-theme-dark .epoch .category4 .area, .epoch-theme-dark .epoch .category4 .dot, .epoch-theme-dark .epoch.category10 .category4 .area, .epoch-theme-dark .epoch.category10 .category4 .dot { fill: #78E8D3; stroke: transparent; } + +.epoch-theme-dark .epoch .arc.category4 path, .epoch-theme-dark .epoch.category10 .arc.category4 path { fill: #78E8D3; } + +.epoch-theme-dark .epoch .bar.category4, .epoch-theme-dark .epoch.category10 .bar.category4 { fill: #78E8D3; } + +.epoch-theme-dark .epoch div.ref.category5, .epoch-theme-dark .epoch.category10 div.ref.category5 { background-color: #C2FF97; } + +.epoch-theme-dark .epoch .category5 .line, .epoch-theme-dark .epoch.category10 .category5 .line { stroke: #C2FF97; } + +.epoch-theme-dark .epoch .category5 .area, .epoch-theme-dark .epoch .category5 .dot, .epoch-theme-dark .epoch.category10 .category5 .area, .epoch-theme-dark .epoch.category10 .category5 .dot { fill: #C2FF97; stroke: transparent; } + +.epoch-theme-dark .epoch .arc.category5 path, .epoch-theme-dark .epoch.category10 .arc.category5 path { fill: #C2FF97; } + +.epoch-theme-dark .epoch .bar.category5, .epoch-theme-dark .epoch.category10 .bar.category5 { fill: #C2FF97; } + +.epoch-theme-dark .epoch div.ref.category6, .epoch-theme-dark .epoch.category10 div.ref.category6 { background-color: #B7BCD1; } + +.epoch-theme-dark .epoch .category6 .line, .epoch-theme-dark .epoch.category10 .category6 .line { stroke: #B7BCD1; } + +.epoch-theme-dark .epoch .category6 .area, .epoch-theme-dark .epoch .category6 .dot, .epoch-theme-dark .epoch.category10 .category6 .area, .epoch-theme-dark .epoch.category10 .category6 .dot { fill: #B7BCD1; stroke: transparent; } + +.epoch-theme-dark .epoch .arc.category6 path, .epoch-theme-dark .epoch.category10 .arc.category6 path { fill: #B7BCD1; } + +.epoch-theme-dark .epoch .bar.category6, .epoch-theme-dark .epoch.category10 .bar.category6 { fill: #B7BCD1; } + +.epoch-theme-dark .epoch div.ref.category7, .epoch-theme-dark .epoch.category10 div.ref.category7 { background-color: #FF857F; } + +.epoch-theme-dark .epoch .category7 .line, .epoch-theme-dark .epoch.category10 .category7 .line { stroke: #FF857F; } + +.epoch-theme-dark .epoch .category7 .area, .epoch-theme-dark .epoch .category7 .dot, .epoch-theme-dark .epoch.category10 .category7 .area, .epoch-theme-dark .epoch.category10 .category7 .dot { fill: #FF857F; stroke: transparent; } + +.epoch-theme-dark .epoch .arc.category7 path, .epoch-theme-dark .epoch.category10 .arc.category7 path { fill: #FF857F; } + +.epoch-theme-dark .epoch .bar.category7, .epoch-theme-dark .epoch.category10 .bar.category7 { fill: #FF857F; } + +.epoch-theme-dark .epoch div.ref.category8, .epoch-theme-dark .epoch.category10 div.ref.category8 { background-color: #F3DE88; } + +.epoch-theme-dark .epoch .category8 .line, .epoch-theme-dark .epoch.category10 .category8 .line { stroke: #F3DE88; } + +.epoch-theme-dark .epoch .category8 .area, .epoch-theme-dark .epoch .category8 .dot, .epoch-theme-dark .epoch.category10 .category8 .area, .epoch-theme-dark .epoch.category10 .category8 .dot { fill: #F3DE88; stroke: transparent; } + +.epoch-theme-dark .epoch .arc.category8 path, .epoch-theme-dark .epoch.category10 .arc.category8 path { fill: #F3DE88; } + +.epoch-theme-dark .epoch .bar.category8, .epoch-theme-dark .epoch.category10 .bar.category8 { fill: #F3DE88; } + +.epoch-theme-dark .epoch div.ref.category9, .epoch-theme-dark .epoch.category10 div.ref.category9 { background-color: #C9935E; } + +.epoch-theme-dark .epoch .category9 .line, .epoch-theme-dark .epoch.category10 .category9 .line { stroke: #C9935E; } + +.epoch-theme-dark .epoch .category9 .area, .epoch-theme-dark .epoch .category9 .dot, .epoch-theme-dark .epoch.category10 .category9 .area, .epoch-theme-dark .epoch.category10 .category9 .dot { fill: #C9935E; stroke: transparent; } + +.epoch-theme-dark .epoch .arc.category9 path, .epoch-theme-dark .epoch.category10 .arc.category9 path { fill: #C9935E; } + +.epoch-theme-dark .epoch .bar.category9, .epoch-theme-dark .epoch.category10 .bar.category9 { fill: #C9935E; } + +.epoch-theme-dark .epoch div.ref.category10, .epoch-theme-dark .epoch.category10 div.ref.category10 { background-color: #A488FF; } + +.epoch-theme-dark .epoch .category10 .line, .epoch-theme-dark .epoch.category10 .category10 .line { stroke: #A488FF; } + +.epoch-theme-dark .epoch .category10 .area, .epoch-theme-dark .epoch .category10 .dot, .epoch-theme-dark .epoch.category10 .category10 .area, .epoch-theme-dark .epoch.category10 .category10 .dot { fill: #A488FF; stroke: transparent; } + +.epoch-theme-dark .epoch .arc.category10 path, .epoch-theme-dark .epoch.category10 .arc.category10 path { fill: #A488FF; } + +.epoch-theme-dark .epoch .bar.category10, .epoch-theme-dark .epoch.category10 .bar.category10 { fill: #A488FF; } + +.epoch-theme-dark .epoch.category20 div.ref.category1 { background-color: #909CFF; } + +.epoch-theme-dark .epoch.category20 .category1 .line { stroke: #909CFF; } + +.epoch-theme-dark .epoch.category20 .category1 .area, .epoch-theme-dark .epoch.category20 .category1 .dot { fill: #909CFF; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category1 path { fill: #909CFF; } + +.epoch-theme-dark .epoch.category20 .bar.category1 { fill: #909CFF; } + +.epoch-theme-dark .epoch.category20 div.ref.category2 { background-color: #626AAD; } + +.epoch-theme-dark .epoch.category20 .category2 .line { stroke: #626AAD; } + +.epoch-theme-dark .epoch.category20 .category2 .area, .epoch-theme-dark .epoch.category20 .category2 .dot { fill: #626AAD; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category2 path { fill: #626AAD; } + +.epoch-theme-dark .epoch.category20 .bar.category2 { fill: #626AAD; } + +.epoch-theme-dark .epoch.category20 div.ref.category3 { background-color: #FFAC89; } + +.epoch-theme-dark .epoch.category20 .category3 .line { stroke: #FFAC89; } + +.epoch-theme-dark .epoch.category20 .category3 .area, .epoch-theme-dark .epoch.category20 .category3 .dot { fill: #FFAC89; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category3 path { fill: #FFAC89; } + +.epoch-theme-dark .epoch.category20 .bar.category3 { fill: #FFAC89; } + +.epoch-theme-dark .epoch.category20 div.ref.category4 { background-color: #BD7F66; } + +.epoch-theme-dark .epoch.category20 .category4 .line { stroke: #BD7F66; } + +.epoch-theme-dark .epoch.category20 .category4 .area, .epoch-theme-dark .epoch.category20 .category4 .dot { fill: #BD7F66; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category4 path { fill: #BD7F66; } + +.epoch-theme-dark .epoch.category20 .bar.category4 { fill: #BD7F66; } + +.epoch-theme-dark .epoch.category20 div.ref.category5 { background-color: #E889E8; } + +.epoch-theme-dark .epoch.category20 .category5 .line { stroke: #E889E8; } + +.epoch-theme-dark .epoch.category20 .category5 .area, .epoch-theme-dark .epoch.category20 .category5 .dot { fill: #E889E8; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category5 path { fill: #E889E8; } + +.epoch-theme-dark .epoch.category20 .bar.category5 { fill: #E889E8; } + +.epoch-theme-dark .epoch.category20 div.ref.category6 { background-color: #995A99; } + +.epoch-theme-dark .epoch.category20 .category6 .line { stroke: #995A99; } + +.epoch-theme-dark .epoch.category20 .category6 .area, .epoch-theme-dark .epoch.category20 .category6 .dot { fill: #995A99; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category6 path { fill: #995A99; } + +.epoch-theme-dark .epoch.category20 .bar.category6 { fill: #995A99; } + +.epoch-theme-dark .epoch.category20 div.ref.category7 { background-color: #78E8D3; } + +.epoch-theme-dark .epoch.category20 .category7 .line { stroke: #78E8D3; } + +.epoch-theme-dark .epoch.category20 .category7 .area, .epoch-theme-dark .epoch.category20 .category7 .dot { fill: #78E8D3; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category7 path { fill: #78E8D3; } + +.epoch-theme-dark .epoch.category20 .bar.category7 { fill: #78E8D3; } + +.epoch-theme-dark .epoch.category20 div.ref.category8 { background-color: #4F998C; } + +.epoch-theme-dark .epoch.category20 .category8 .line { stroke: #4F998C; } + +.epoch-theme-dark .epoch.category20 .category8 .area, .epoch-theme-dark .epoch.category20 .category8 .dot { fill: #4F998C; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category8 path { fill: #4F998C; } + +.epoch-theme-dark .epoch.category20 .bar.category8 { fill: #4F998C; } + +.epoch-theme-dark .epoch.category20 div.ref.category9 { background-color: #C2FF97; } + +.epoch-theme-dark .epoch.category20 .category9 .line { stroke: #C2FF97; } + +.epoch-theme-dark .epoch.category20 .category9 .area, .epoch-theme-dark .epoch.category20 .category9 .dot { fill: #C2FF97; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category9 path { fill: #C2FF97; } + +.epoch-theme-dark .epoch.category20 .bar.category9 { fill: #C2FF97; } + +.epoch-theme-dark .epoch.category20 div.ref.category10 { background-color: #789E5E; } + +.epoch-theme-dark .epoch.category20 .category10 .line { stroke: #789E5E; } + +.epoch-theme-dark .epoch.category20 .category10 .area, .epoch-theme-dark .epoch.category20 .category10 .dot { fill: #789E5E; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category10 path { fill: #789E5E; } + +.epoch-theme-dark .epoch.category20 .bar.category10 { fill: #789E5E; } + +.epoch-theme-dark .epoch.category20 div.ref.category11 { background-color: #B7BCD1; } + +.epoch-theme-dark .epoch.category20 .category11 .line { stroke: #B7BCD1; } + +.epoch-theme-dark .epoch.category20 .category11 .area, .epoch-theme-dark .epoch.category20 .category11 .dot { fill: #B7BCD1; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category11 path { fill: #B7BCD1; } + +.epoch-theme-dark .epoch.category20 .bar.category11 { fill: #B7BCD1; } + +.epoch-theme-dark .epoch.category20 div.ref.category12 { background-color: #7F8391; } + +.epoch-theme-dark .epoch.category20 .category12 .line { stroke: #7F8391; } + +.epoch-theme-dark .epoch.category20 .category12 .area, .epoch-theme-dark .epoch.category20 .category12 .dot { fill: #7F8391; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category12 path { fill: #7F8391; } + +.epoch-theme-dark .epoch.category20 .bar.category12 { fill: #7F8391; } + +.epoch-theme-dark .epoch.category20 div.ref.category13 { background-color: #CCB889; } + +.epoch-theme-dark .epoch.category20 .category13 .line { stroke: #CCB889; } + +.epoch-theme-dark .epoch.category20 .category13 .area, .epoch-theme-dark .epoch.category20 .category13 .dot { fill: #CCB889; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category13 path { fill: #CCB889; } + +.epoch-theme-dark .epoch.category20 .bar.category13 { fill: #CCB889; } + +.epoch-theme-dark .epoch.category20 div.ref.category14 { background-color: #A1906B; } + +.epoch-theme-dark .epoch.category20 .category14 .line { stroke: #A1906B; } + +.epoch-theme-dark .epoch.category20 .category14 .area, .epoch-theme-dark .epoch.category20 .category14 .dot { fill: #A1906B; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category14 path { fill: #A1906B; } + +.epoch-theme-dark .epoch.category20 .bar.category14 { fill: #A1906B; } + +.epoch-theme-dark .epoch.category20 div.ref.category15 { background-color: #F3DE88; } + +.epoch-theme-dark .epoch.category20 .category15 .line { stroke: #F3DE88; } + +.epoch-theme-dark .epoch.category20 .category15 .area, .epoch-theme-dark .epoch.category20 .category15 .dot { fill: #F3DE88; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category15 path { fill: #F3DE88; } + +.epoch-theme-dark .epoch.category20 .bar.category15 { fill: #F3DE88; } + +.epoch-theme-dark .epoch.category20 div.ref.category16 { background-color: #A89A5E; } + +.epoch-theme-dark .epoch.category20 .category16 .line { stroke: #A89A5E; } + +.epoch-theme-dark .epoch.category20 .category16 .area, .epoch-theme-dark .epoch.category20 .category16 .dot { fill: #A89A5E; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category16 path { fill: #A89A5E; } + +.epoch-theme-dark .epoch.category20 .bar.category16 { fill: #A89A5E; } + +.epoch-theme-dark .epoch.category20 div.ref.category17 { background-color: #FF857F; } + +.epoch-theme-dark .epoch.category20 .category17 .line { stroke: #FF857F; } + +.epoch-theme-dark .epoch.category20 .category17 .area, .epoch-theme-dark .epoch.category20 .category17 .dot { fill: #FF857F; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category17 path { fill: #FF857F; } + +.epoch-theme-dark .epoch.category20 .bar.category17 { fill: #FF857F; } + +.epoch-theme-dark .epoch.category20 div.ref.category18 { background-color: #BA615D; } + +.epoch-theme-dark .epoch.category20 .category18 .line { stroke: #BA615D; } + +.epoch-theme-dark .epoch.category20 .category18 .area, .epoch-theme-dark .epoch.category20 .category18 .dot { fill: #BA615D; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category18 path { fill: #BA615D; } + +.epoch-theme-dark .epoch.category20 .bar.category18 { fill: #BA615D; } + +.epoch-theme-dark .epoch.category20 div.ref.category19 { background-color: #A488FF; } + +.epoch-theme-dark .epoch.category20 .category19 .line { stroke: #A488FF; } + +.epoch-theme-dark .epoch.category20 .category19 .area, .epoch-theme-dark .epoch.category20 .category19 .dot { fill: #A488FF; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category19 path { fill: #A488FF; } + +.epoch-theme-dark .epoch.category20 .bar.category19 { fill: #A488FF; } + +.epoch-theme-dark .epoch.category20 div.ref.category20 { background-color: #7662B8; } + +.epoch-theme-dark .epoch.category20 .category20 .line { stroke: #7662B8; } + +.epoch-theme-dark .epoch.category20 .category20 .area, .epoch-theme-dark .epoch.category20 .category20 .dot { fill: #7662B8; stroke: transparent; } + +.epoch-theme-dark .epoch.category20 .arc.category20 path { fill: #7662B8; } + +.epoch-theme-dark .epoch.category20 .bar.category20 { fill: #7662B8; } + +.epoch-theme-dark .epoch.category20b div.ref.category1 { background-color: #909CFF; } + +.epoch-theme-dark .epoch.category20b .category1 .line { stroke: #909CFF; } + +.epoch-theme-dark .epoch.category20b .category1 .area, .epoch-theme-dark .epoch.category20b .category1 .dot { fill: #909CFF; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category1 path { fill: #909CFF; } + +.epoch-theme-dark .epoch.category20b .bar.category1 { fill: #909CFF; } + +.epoch-theme-dark .epoch.category20b div.ref.category2 { background-color: #7680D1; } + +.epoch-theme-dark .epoch.category20b .category2 .line { stroke: #7680D1; } + +.epoch-theme-dark .epoch.category20b .category2 .area, .epoch-theme-dark .epoch.category20b .category2 .dot { fill: #7680D1; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category2 path { fill: #7680D1; } + +.epoch-theme-dark .epoch.category20b .bar.category2 { fill: #7680D1; } + +.epoch-theme-dark .epoch.category20b div.ref.category3 { background-color: #656DB2; } + +.epoch-theme-dark .epoch.category20b .category3 .line { stroke: #656DB2; } + +.epoch-theme-dark .epoch.category20b .category3 .area, .epoch-theme-dark .epoch.category20b .category3 .dot { fill: #656DB2; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category3 path { fill: #656DB2; } + +.epoch-theme-dark .epoch.category20b .bar.category3 { fill: #656DB2; } + +.epoch-theme-dark .epoch.category20b div.ref.category4 { background-color: #525992; } + +.epoch-theme-dark .epoch.category20b .category4 .line { stroke: #525992; } + +.epoch-theme-dark .epoch.category20b .category4 .area, .epoch-theme-dark .epoch.category20b .category4 .dot { fill: #525992; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category4 path { fill: #525992; } + +.epoch-theme-dark .epoch.category20b .bar.category4 { fill: #525992; } + +.epoch-theme-dark .epoch.category20b div.ref.category5 { background-color: #FFAC89; } + +.epoch-theme-dark .epoch.category20b .category5 .line { stroke: #FFAC89; } + +.epoch-theme-dark .epoch.category20b .category5 .area, .epoch-theme-dark .epoch.category20b .category5 .dot { fill: #FFAC89; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category5 path { fill: #FFAC89; } + +.epoch-theme-dark .epoch.category20b .bar.category5 { fill: #FFAC89; } + +.epoch-theme-dark .epoch.category20b div.ref.category6 { background-color: #D18D71; } + +.epoch-theme-dark .epoch.category20b .category6 .line { stroke: #D18D71; } + +.epoch-theme-dark .epoch.category20b .category6 .area, .epoch-theme-dark .epoch.category20b .category6 .dot { fill: #D18D71; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category6 path { fill: #D18D71; } + +.epoch-theme-dark .epoch.category20b .bar.category6 { fill: #D18D71; } + +.epoch-theme-dark .epoch.category20b div.ref.category7 { background-color: #AB735C; } + +.epoch-theme-dark .epoch.category20b .category7 .line { stroke: #AB735C; } + +.epoch-theme-dark .epoch.category20b .category7 .area, .epoch-theme-dark .epoch.category20b .category7 .dot { fill: #AB735C; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category7 path { fill: #AB735C; } + +.epoch-theme-dark .epoch.category20b .bar.category7 { fill: #AB735C; } + +.epoch-theme-dark .epoch.category20b div.ref.category8 { background-color: #92624E; } + +.epoch-theme-dark .epoch.category20b .category8 .line { stroke: #92624E; } + +.epoch-theme-dark .epoch.category20b .category8 .area, .epoch-theme-dark .epoch.category20b .category8 .dot { fill: #92624E; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category8 path { fill: #92624E; } + +.epoch-theme-dark .epoch.category20b .bar.category8 { fill: #92624E; } + +.epoch-theme-dark .epoch.category20b div.ref.category9 { background-color: #E889E8; } + +.epoch-theme-dark .epoch.category20b .category9 .line { stroke: #E889E8; } + +.epoch-theme-dark .epoch.category20b .category9 .area, .epoch-theme-dark .epoch.category20b .category9 .dot { fill: #E889E8; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category9 path { fill: #E889E8; } + +.epoch-theme-dark .epoch.category20b .bar.category9 { fill: #E889E8; } + +.epoch-theme-dark .epoch.category20b div.ref.category10 { background-color: #BA6EBA; } + +.epoch-theme-dark .epoch.category20b .category10 .line { stroke: #BA6EBA; } + +.epoch-theme-dark .epoch.category20b .category10 .area, .epoch-theme-dark .epoch.category20b .category10 .dot { fill: #BA6EBA; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category10 path { fill: #BA6EBA; } + +.epoch-theme-dark .epoch.category20b .bar.category10 { fill: #BA6EBA; } + +.epoch-theme-dark .epoch.category20b div.ref.category11 { background-color: #9B5C9B; } + +.epoch-theme-dark .epoch.category20b .category11 .line { stroke: #9B5C9B; } + +.epoch-theme-dark .epoch.category20b .category11 .area, .epoch-theme-dark .epoch.category20b .category11 .dot { fill: #9B5C9B; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category11 path { fill: #9B5C9B; } + +.epoch-theme-dark .epoch.category20b .bar.category11 { fill: #9B5C9B; } + +.epoch-theme-dark .epoch.category20b div.ref.category12 { background-color: #7B487B; } + +.epoch-theme-dark .epoch.category20b .category12 .line { stroke: #7B487B; } + +.epoch-theme-dark .epoch.category20b .category12 .area, .epoch-theme-dark .epoch.category20b .category12 .dot { fill: #7B487B; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category12 path { fill: #7B487B; } + +.epoch-theme-dark .epoch.category20b .bar.category12 { fill: #7B487B; } + +.epoch-theme-dark .epoch.category20b div.ref.category13 { background-color: #78E8D3; } + +.epoch-theme-dark .epoch.category20b .category13 .line { stroke: #78E8D3; } + +.epoch-theme-dark .epoch.category20b .category13 .area, .epoch-theme-dark .epoch.category20b .category13 .dot { fill: #78E8D3; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category13 path { fill: #78E8D3; } + +.epoch-theme-dark .epoch.category20b .bar.category13 { fill: #78E8D3; } + +.epoch-theme-dark .epoch.category20b div.ref.category14 { background-color: #60BAAA; } + +.epoch-theme-dark .epoch.category20b .category14 .line { stroke: #60BAAA; } + +.epoch-theme-dark .epoch.category20b .category14 .area, .epoch-theme-dark .epoch.category20b .category14 .dot { fill: #60BAAA; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category14 path { fill: #60BAAA; } + +.epoch-theme-dark .epoch.category20b .bar.category14 { fill: #60BAAA; } + +.epoch-theme-dark .epoch.category20b div.ref.category15 { background-color: #509B8D; } + +.epoch-theme-dark .epoch.category20b .category15 .line { stroke: #509B8D; } + +.epoch-theme-dark .epoch.category20b .category15 .area, .epoch-theme-dark .epoch.category20b .category15 .dot { fill: #509B8D; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category15 path { fill: #509B8D; } + +.epoch-theme-dark .epoch.category20b .bar.category15 { fill: #509B8D; } + +.epoch-theme-dark .epoch.category20b div.ref.category16 { background-color: #3F7B70; } + +.epoch-theme-dark .epoch.category20b .category16 .line { stroke: #3F7B70; } + +.epoch-theme-dark .epoch.category20b .category16 .area, .epoch-theme-dark .epoch.category20b .category16 .dot { fill: #3F7B70; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category16 path { fill: #3F7B70; } + +.epoch-theme-dark .epoch.category20b .bar.category16 { fill: #3F7B70; } + +.epoch-theme-dark .epoch.category20b div.ref.category17 { background-color: #C2FF97; } + +.epoch-theme-dark .epoch.category20b .category17 .line { stroke: #C2FF97; } + +.epoch-theme-dark .epoch.category20b .category17 .area, .epoch-theme-dark .epoch.category20b .category17 .dot { fill: #C2FF97; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category17 path { fill: #C2FF97; } + +.epoch-theme-dark .epoch.category20b .bar.category17 { fill: #C2FF97; } + +.epoch-theme-dark .epoch.category20b div.ref.category18 { background-color: #9FD17C; } + +.epoch-theme-dark .epoch.category20b .category18 .line { stroke: #9FD17C; } + +.epoch-theme-dark .epoch.category20b .category18 .area, .epoch-theme-dark .epoch.category20b .category18 .dot { fill: #9FD17C; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category18 path { fill: #9FD17C; } + +.epoch-theme-dark .epoch.category20b .bar.category18 { fill: #9FD17C; } + +.epoch-theme-dark .epoch.category20b div.ref.category19 { background-color: #7DA361; } + +.epoch-theme-dark .epoch.category20b .category19 .line { stroke: #7DA361; } + +.epoch-theme-dark .epoch.category20b .category19 .area, .epoch-theme-dark .epoch.category20b .category19 .dot { fill: #7DA361; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category19 path { fill: #7DA361; } + +.epoch-theme-dark .epoch.category20b .bar.category19 { fill: #7DA361; } + +.epoch-theme-dark .epoch.category20b div.ref.category20 { background-color: #65854E; } + +.epoch-theme-dark .epoch.category20b .category20 .line { stroke: #65854E; } + +.epoch-theme-dark .epoch.category20b .category20 .area, .epoch-theme-dark .epoch.category20b .category20 .dot { fill: #65854E; stroke: transparent; } + +.epoch-theme-dark .epoch.category20b .arc.category20 path { fill: #65854E; } + +.epoch-theme-dark .epoch.category20b .bar.category20 { fill: #65854E; } + +.epoch-theme-dark .epoch.category20c div.ref.category1 { background-color: #B7BCD1; } + +.epoch-theme-dark .epoch.category20c .category1 .line { stroke: #B7BCD1; } + +.epoch-theme-dark .epoch.category20c .category1 .area, .epoch-theme-dark .epoch.category20c .category1 .dot { fill: #B7BCD1; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category1 path { fill: #B7BCD1; } + +.epoch-theme-dark .epoch.category20c .bar.category1 { fill: #B7BCD1; } + +.epoch-theme-dark .epoch.category20c div.ref.category2 { background-color: #979DAD; } + +.epoch-theme-dark .epoch.category20c .category2 .line { stroke: #979DAD; } + +.epoch-theme-dark .epoch.category20c .category2 .area, .epoch-theme-dark .epoch.category20c .category2 .dot { fill: #979DAD; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category2 path { fill: #979DAD; } + +.epoch-theme-dark .epoch.category20c .bar.category2 { fill: #979DAD; } + +.epoch-theme-dark .epoch.category20c div.ref.category3 { background-color: #6E717D; } + +.epoch-theme-dark .epoch.category20c .category3 .line { stroke: #6E717D; } + +.epoch-theme-dark .epoch.category20c .category3 .area, .epoch-theme-dark .epoch.category20c .category3 .dot { fill: #6E717D; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category3 path { fill: #6E717D; } + +.epoch-theme-dark .epoch.category20c .bar.category3 { fill: #6E717D; } + +.epoch-theme-dark .epoch.category20c div.ref.category4 { background-color: #595C66; } + +.epoch-theme-dark .epoch.category20c .category4 .line { stroke: #595C66; } + +.epoch-theme-dark .epoch.category20c .category4 .area, .epoch-theme-dark .epoch.category20c .category4 .dot { fill: #595C66; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category4 path { fill: #595C66; } + +.epoch-theme-dark .epoch.category20c .bar.category4 { fill: #595C66; } + +.epoch-theme-dark .epoch.category20c div.ref.category5 { background-color: #FF857F; } + +.epoch-theme-dark .epoch.category20c .category5 .line { stroke: #FF857F; } + +.epoch-theme-dark .epoch.category20c .category5 .area, .epoch-theme-dark .epoch.category20c .category5 .dot { fill: #FF857F; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category5 path { fill: #FF857F; } + +.epoch-theme-dark .epoch.category20c .bar.category5 { fill: #FF857F; } + +.epoch-theme-dark .epoch.category20c div.ref.category6 { background-color: #DE746E; } + +.epoch-theme-dark .epoch.category20c .category6 .line { stroke: #DE746E; } + +.epoch-theme-dark .epoch.category20c .category6 .area, .epoch-theme-dark .epoch.category20c .category6 .dot { fill: #DE746E; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category6 path { fill: #DE746E; } + +.epoch-theme-dark .epoch.category20c .bar.category6 { fill: #DE746E; } + +.epoch-theme-dark .epoch.category20c div.ref.category7 { background-color: #B55F5A; } + +.epoch-theme-dark .epoch.category20c .category7 .line { stroke: #B55F5A; } + +.epoch-theme-dark .epoch.category20c .category7 .area, .epoch-theme-dark .epoch.category20c .category7 .dot { fill: #B55F5A; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category7 path { fill: #B55F5A; } + +.epoch-theme-dark .epoch.category20c .bar.category7 { fill: #B55F5A; } + +.epoch-theme-dark .epoch.category20c div.ref.category8 { background-color: #964E4B; } + +.epoch-theme-dark .epoch.category20c .category8 .line { stroke: #964E4B; } + +.epoch-theme-dark .epoch.category20c .category8 .area, .epoch-theme-dark .epoch.category20c .category8 .dot { fill: #964E4B; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category8 path { fill: #964E4B; } + +.epoch-theme-dark .epoch.category20c .bar.category8 { fill: #964E4B; } + +.epoch-theme-dark .epoch.category20c div.ref.category9 { background-color: #F3DE88; } + +.epoch-theme-dark .epoch.category20c .category9 .line { stroke: #F3DE88; } + +.epoch-theme-dark .epoch.category20c .category9 .area, .epoch-theme-dark .epoch.category20c .category9 .dot { fill: #F3DE88; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category9 path { fill: #F3DE88; } + +.epoch-theme-dark .epoch.category20c .bar.category9 { fill: #F3DE88; } + +.epoch-theme-dark .epoch.category20c div.ref.category10 { background-color: #DBC87B; } + +.epoch-theme-dark .epoch.category20c .category10 .line { stroke: #DBC87B; } + +.epoch-theme-dark .epoch.category20c .category10 .area, .epoch-theme-dark .epoch.category20c .category10 .dot { fill: #DBC87B; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category10 path { fill: #DBC87B; } + +.epoch-theme-dark .epoch.category20c .bar.category10 { fill: #DBC87B; } + +.epoch-theme-dark .epoch.category20c div.ref.category11 { background-color: #BAAA68; } + +.epoch-theme-dark .epoch.category20c .category11 .line { stroke: #BAAA68; } + +.epoch-theme-dark .epoch.category20c .category11 .area, .epoch-theme-dark .epoch.category20c .category11 .dot { fill: #BAAA68; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category11 path { fill: #BAAA68; } + +.epoch-theme-dark .epoch.category20c .bar.category11 { fill: #BAAA68; } + +.epoch-theme-dark .epoch.category20c div.ref.category12 { background-color: #918551; } + +.epoch-theme-dark .epoch.category20c .category12 .line { stroke: #918551; } + +.epoch-theme-dark .epoch.category20c .category12 .area, .epoch-theme-dark .epoch.category20c .category12 .dot { fill: #918551; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category12 path { fill: #918551; } + +.epoch-theme-dark .epoch.category20c .bar.category12 { fill: #918551; } + +.epoch-theme-dark .epoch.category20c div.ref.category13 { background-color: #C9935E; } + +.epoch-theme-dark .epoch.category20c .category13 .line { stroke: #C9935E; } + +.epoch-theme-dark .epoch.category20c .category13 .area, .epoch-theme-dark .epoch.category20c .category13 .dot { fill: #C9935E; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category13 path { fill: #C9935E; } + +.epoch-theme-dark .epoch.category20c .bar.category13 { fill: #C9935E; } + +.epoch-theme-dark .epoch.category20c div.ref.category14 { background-color: #B58455; } + +.epoch-theme-dark .epoch.category20c .category14 .line { stroke: #B58455; } + +.epoch-theme-dark .epoch.category20c .category14 .area, .epoch-theme-dark .epoch.category20c .category14 .dot { fill: #B58455; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category14 path { fill: #B58455; } + +.epoch-theme-dark .epoch.category20c .bar.category14 { fill: #B58455; } + +.epoch-theme-dark .epoch.category20c div.ref.category15 { background-color: #997048; } + +.epoch-theme-dark .epoch.category20c .category15 .line { stroke: #997048; } + +.epoch-theme-dark .epoch.category20c .category15 .area, .epoch-theme-dark .epoch.category20c .category15 .dot { fill: #997048; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category15 path { fill: #997048; } + +.epoch-theme-dark .epoch.category20c .bar.category15 { fill: #997048; } + +.epoch-theme-dark .epoch.category20c div.ref.category16 { background-color: #735436; } + +.epoch-theme-dark .epoch.category20c .category16 .line { stroke: #735436; } + +.epoch-theme-dark .epoch.category20c .category16 .area, .epoch-theme-dark .epoch.category20c .category16 .dot { fill: #735436; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category16 path { fill: #735436; } + +.epoch-theme-dark .epoch.category20c .bar.category16 { fill: #735436; } + +.epoch-theme-dark .epoch.category20c div.ref.category17 { background-color: #A488FF; } + +.epoch-theme-dark .epoch.category20c .category17 .line { stroke: #A488FF; } + +.epoch-theme-dark .epoch.category20c .category17 .area, .epoch-theme-dark .epoch.category20c .category17 .dot { fill: #A488FF; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category17 path { fill: #A488FF; } + +.epoch-theme-dark .epoch.category20c .bar.category17 { fill: #A488FF; } + +.epoch-theme-dark .epoch.category20c div.ref.category18 { background-color: #8670D1; } + +.epoch-theme-dark .epoch.category20c .category18 .line { stroke: #8670D1; } + +.epoch-theme-dark .epoch.category20c .category18 .area, .epoch-theme-dark .epoch.category20c .category18 .dot { fill: #8670D1; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category18 path { fill: #8670D1; } + +.epoch-theme-dark .epoch.category20c .bar.category18 { fill: #8670D1; } + +.epoch-theme-dark .epoch.category20c div.ref.category19 { background-color: #705CAD; } + +.epoch-theme-dark .epoch.category20c .category19 .line { stroke: #705CAD; } + +.epoch-theme-dark .epoch.category20c .category19 .area, .epoch-theme-dark .epoch.category20c .category19 .dot { fill: #705CAD; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category19 path { fill: #705CAD; } + +.epoch-theme-dark .epoch.category20c .bar.category19 { fill: #705CAD; } + +.epoch-theme-dark .epoch.category20c div.ref.category20 { background-color: #52447F; } + +.epoch-theme-dark .epoch.category20c .category20 .line { stroke: #52447F; } + +.epoch-theme-dark .epoch.category20c .category20 .area, .epoch-theme-dark .epoch.category20c .category20 .dot { fill: #52447F; stroke: transparent; } + +.epoch-theme-dark .epoch.category20c .arc.category20 path { fill: #52447F; } + +.epoch-theme-dark .epoch.category20c .bar.category20 { fill: #52447F; } diff --git a/debian/missing-sources/epoch.js b/debian/missing-sources/epoch.js new file mode 100644 index 0000000..92bc514 --- /dev/null +++ b/debian/missing-sources/epoch.js @@ -0,0 +1,3924 @@ +var base, base1, base2, base3; + +if (window.Epoch == null) { + window.Epoch = {}; +} + +if ((base = window.Epoch).Chart == null) { + base.Chart = {}; +} + +if ((base1 = window.Epoch).Time == null) { + base1.Time = {}; +} + +if ((base2 = window.Epoch).Util == null) { + base2.Util = {}; +} + +if ((base3 = window.Epoch).Formats == null) { + base3.Formats = {}; +} + +Epoch.warn = function(msg) { + return (console.warn || console.log)("Epoch Warning: " + msg); +}; + +Epoch.exception = function(msg) { + throw "Epoch Error: " + msg; +}; + +Epoch.TestContext = (function() { + var VOID_METHODS; + + VOID_METHODS = ['arc', 'arcTo', 'beginPath', 'bezierCurveTo', 'clearRect', 'clip', 'closePath', 'drawImage', 'fill', 'fillRect', 'fillText', 'moveTo', 'quadraticCurveTo', 'rect', 'restore', 'rotate', 'save', 'scale', 'scrollPathIntoView', 'setLineDash', 'setTransform', 'stroke', 'strokeRect', 'strokeText', 'transform', 'translate', 'lineTo']; + + function TestContext() { + var i, len, method; + this._log = []; + for (i = 0, len = VOID_METHODS.length; i < len; i++) { + method = VOID_METHODS[i]; + this._makeFauxMethod(method); + } + } + + TestContext.prototype._makeFauxMethod = function(name) { + return this[name] = function() { + var arg; + return this._log.push(name + "(" + (((function() { + var i, len, results; + results = []; + for (i = 0, len = arguments.length; i < len; i++) { + arg = arguments[i]; + results.push(arg.toString()); + } + return results; + }).apply(this, arguments)).join(',')) + ")"); + }; + }; + + TestContext.prototype.getImageData = function() { + var arg; + this._log.push("getImageData(" + (((function() { + var i, len, results; + results = []; + for (i = 0, len = arguments.length; i < len; i++) { + arg = arguments[i]; + results.push(arg.toString()); + } + return results; + }).apply(this, arguments)).join(',')) + ")"); + return { + width: 0, + height: 0, + resolution: 1.0, + data: [] + }; + }; + + return TestContext; + +})(); + +var ref, typeFunction, + hasProp = {}.hasOwnProperty; + +typeFunction = function(objectName) { + return function(v) { + return Object.prototype.toString.call(v) === ("[object " + objectName + "]"); + }; +}; + +Epoch.isArray = (ref = Array.isArray) != null ? ref : typeFunction('Array'); + +Epoch.isObject = typeFunction('Object'); + +Epoch.isString = typeFunction('String'); + +Epoch.isFunction = typeFunction('Function'); + +Epoch.isNumber = typeFunction('Number'); + +Epoch.isElement = function(v) { + if (typeof HTMLElement !== "undefined" && HTMLElement !== null) { + return v instanceof HTMLElement; + } else { + return (v != null) && Epoch.isObject(v) && v.nodeType === 1 && Epoch.isString(v.nodeName); + } +}; + +Epoch.isNonEmptyArray = function(v) { + return Epoch.isArray(v) && v.length > 0; +}; + +Epoch.Util.copy = function(original) { + var copy, k, v; + if (original == null) { + return null; + } + copy = {}; + for (k in original) { + if (!hasProp.call(original, k)) continue; + v = original[k]; + copy[k] = v; + } + return copy; +}; + +Epoch.Util.defaults = function(options, defaults) { + var bothAreObjects, def, k, opt, result, v; + result = Epoch.Util.copy(options); + for (k in defaults) { + if (!hasProp.call(defaults, k)) continue; + v = defaults[k]; + opt = options[k]; + def = defaults[k]; + bothAreObjects = Epoch.isObject(opt) && Epoch.isObject(def); + if ((opt != null) && (def != null)) { + if (bothAreObjects && !Epoch.isArray(opt)) { + result[k] = Epoch.Util.defaults(opt, def); + } else { + result[k] = opt; + } + } else if (opt != null) { + result[k] = opt; + } else { + result[k] = def; + } + } + return result; +}; + +Epoch.Util.formatSI = function(v, fixed, fixIntegers) { + var base, i, label, q, ref1; + if (fixed == null) { + fixed = 1; + } + if (fixIntegers == null) { + fixIntegers = false; + } + if (v < 1000) { + q = v; + if (!((q | 0) === q && !fixIntegers)) { + q = q.toFixed(fixed); + } + return q; + } + ref1 = ['K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; + for (i in ref1) { + if (!hasProp.call(ref1, i)) continue; + label = ref1[i]; + base = Math.pow(10, ((i | 0) + 1) * 3); + if (v >= base && v < Math.pow(10, ((i | 0) + 2) * 3)) { + q = v / base; + if (!((q % 1) === 0 && !fixIntegers)) { + q = q.toFixed(fixed); + } + return q + " " + label; + } + } +}; + +Epoch.Util.formatBytes = function(v, fixed, fix_integers) { + var base, i, label, q, ref1; + if (fixed == null) { + fixed = 1; + } + if (fix_integers == null) { + fix_integers = false; + } + if (v < 1024) { + q = v; + if (!((q % 1) === 0 && !fix_integers)) { + q = q.toFixed(fixed); + } + return q + " B"; + } + ref1 = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + for (i in ref1) { + if (!hasProp.call(ref1, i)) continue; + label = ref1[i]; + base = Math.pow(1024, (i | 0) + 1); + if (v >= base && v < Math.pow(1024, (i | 0) + 2)) { + q = v / base; + if (!((q % 1) === 0 && !fix_integers)) { + q = q.toFixed(fixed); + } + return q + " " + label; + } + } +}; + +Epoch.Util.dasherize = function(str) { + return Epoch.Util.trim(str).replace("\n", '').replace(/\s+/g, '-').toLowerCase(); +}; + +Epoch.Util.domain = function(layers, key) { + var domain, entry, j, l, layer, len, len1, ref1, set; + if (key == null) { + key = 'x'; + } + set = {}; + domain = []; + for (j = 0, len = layers.length; j < len; j++) { + layer = layers[j]; + ref1 = layer.values; + for (l = 0, len1 = ref1.length; l < len1; l++) { + entry = ref1[l]; + if (set[entry[key]] != null) { + continue; + } + domain.push(entry[key]); + set[entry[key]] = true; + } + } + return domain; +}; + +Epoch.Util.trim = function(string) { + if (!Epoch.isString(string)) { + return null; + } + return string.replace(/^\s+/g, '').replace(/\s+$/g, ''); +}; + +Epoch.Util.getComputedStyle = function(element, pseudoElement) { + if (Epoch.isFunction(window.getComputedStyle)) { + return window.getComputedStyle(element, pseudoElement); + } else if (element.currentStyle != null) { + return element.currentStyle; + } +}; + +Epoch.Util.toRGBA = function(color, opacity) { + var all, b, g, parts, r, result, v; + if ((parts = color.match(/^rgba\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*[0-9\.]+\)/))) { + all = parts[0], r = parts[1], g = parts[2], b = parts[3]; + result = "rgba(" + r + "," + g + "," + b + "," + opacity + ")"; + } else if ((v = d3.rgb(color))) { + result = "rgba(" + v.r + "," + v.g + "," + v.b + "," + opacity + ")"; + } + return result; +}; + +Epoch.Util.getContext = function(node, type) { + if (type == null) { + type = '2d'; + } + return node.getContext(type); +}; + +Epoch.Events = (function() { + function Events() { + this._events = {}; + } + + Events.prototype.on = function(name, callback) { + var base1; + if (callback == null) { + return; + } + if ((base1 = this._events)[name] == null) { + base1[name] = []; + } + return this._events[name].push(callback); + }; + + Events.prototype.onAll = function(map) { + var callback, name, results; + if (!Epoch.isObject(map)) { + return; + } + results = []; + for (name in map) { + if (!hasProp.call(map, name)) continue; + callback = map[name]; + results.push(this.on(name, callback)); + } + return results; + }; + + Events.prototype.off = function(name, callback) { + var i, results; + if (!Epoch.isArray(this._events[name])) { + return; + } + if (callback == null) { + return delete this._events[name]; + } + results = []; + while ((i = this._events[name].indexOf(callback)) >= 0) { + results.push(this._events[name].splice(i, 1)); + } + return results; + }; + + Events.prototype.offAll = function(mapOrList) { + var callback, j, len, name, results, results1; + if (Epoch.isArray(mapOrList)) { + results = []; + for (j = 0, len = mapOrList.length; j < len; j++) { + name = mapOrList[j]; + results.push(this.off(name)); + } + return results; + } else if (Epoch.isObject(mapOrList)) { + results1 = []; + for (name in mapOrList) { + if (!hasProp.call(mapOrList, name)) continue; + callback = mapOrList[name]; + results1.push(this.off(name, callback)); + } + return results1; + } + }; + + Events.prototype.trigger = function(name) { + var args, callback, fn, i, j, len, ref1, results; + if (this._events[name] == null) { + return; + } + args = (function() { + var j, ref1, results; + results = []; + for (i = j = 1, ref1 = arguments.length; 1 <= ref1 ? j < ref1 : j > ref1; i = 1 <= ref1 ? ++j : --j) { + results.push(arguments[i]); + } + return results; + }).apply(this, arguments); + ref1 = this._events[name]; + results = []; + for (j = 0, len = ref1.length; j < len; j++) { + callback = ref1[j]; + fn = null; + if (Epoch.isString(callback)) { + fn = this[callback]; + } else if (Epoch.isFunction(callback)) { + fn = callback; + } + if (fn == null) { + Epoch.exception("Callback for event '" + name + "' is not a function or reference to a method."); + } + results.push(fn.apply(this, args)); + } + return results; + }; + + return Events; + +})(); + +Epoch.Util.flatten = function(multiarray) { + var array, item, j, l, len, len1, result; + if (!Array.isArray(multiarray)) { + throw new Error('Epoch.Util.flatten only accepts arrays'); + } + result = []; + for (j = 0, len = multiarray.length; j < len; j++) { + array = multiarray[j]; + if (Array.isArray(array)) { + for (l = 0, len1 = array.length; l < len1; l++) { + item = array[l]; + result.push(item); + } + } else { + result.push(array); + } + } + return result; +}; + +d3.selection.prototype.width = function(value) { + if ((value != null) && Epoch.isString(value)) { + return this.style('width', value); + } else if ((value != null) && Epoch.isNumber(value)) { + return this.style('width', value + "px"); + } else { + return +Epoch.Util.getComputedStyle(this.node(), null).width.replace('px', ''); + } +}; + +d3.selection.prototype.height = function(value) { + if ((value != null) && Epoch.isString(value)) { + return this.style('height', value); + } else if ((value != null) && Epoch.isNumber(value)) { + return this.style('height', value + "px"); + } else { + return +Epoch.Util.getComputedStyle(this.node(), null).height.replace('px', ''); + } +}; + +var d3Seconds; + +Epoch.Formats.regular = function(d) { + return d; +}; + +Epoch.Formats.si = function(d) { + return Epoch.Util.formatSI(d); +}; + +Epoch.Formats.percent = function(d) { + return (d * 100).toFixed(1) + "%"; +}; + +Epoch.Formats.seconds = function(t) { + return d3Seconds(new Date(t * 1000)); +}; + +d3Seconds = d3.time.format('%I:%M:%S %p'); + +Epoch.Formats.bytes = function(d) { + return Epoch.Util.formatBytes(d); +}; + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Base = (function(superClass) { + var defaults, optionListeners; + + extend(Base, superClass); + + defaults = { + width: 320, + height: 240, + dataFormat: null + }; + + optionListeners = { + 'option:width': 'dimensionsChanged', + 'option:height': 'dimensionsChanged', + 'layer:shown': 'layerChanged', + 'layer:hidden': 'layerChanged' + }; + + function Base(options1) { + this.options = options1 != null ? options1 : {}; + Base.__super__.constructor.call(this); + if (this.options.model) { + if (this.options.model.hasData() != null) { + this.setData(this.options.model.getData(this.options.type, this.options.dataFormat)); + } else { + this.setData(this.options.data || []); + } + this.options.model.on('data:updated', (function(_this) { + return function() { + return _this.setDataFromModel(); + }; + })(this)); + } else { + this.setData(this.options.data || []); + } + if (this.options.el != null) { + this.el = d3.select(this.options.el); + } + this.width = this.options.width; + this.height = this.options.height; + if (this.el != null) { + if (this.width == null) { + this.width = this.el.width(); + } + if (this.height == null) { + this.height = this.el.height(); + } + } else { + if (this.width == null) { + this.width = defaults.width; + } + if (this.height == null) { + this.height = defaults.height; + } + this.el = d3.select(document.createElement('DIV')).attr('width', this.width).attr('height', this.height); + } + this.onAll(optionListeners); + } + + Base.prototype._getAllOptions = function() { + return Epoch.Util.defaults({}, this.options); + }; + + Base.prototype._getOption = function(key) { + var parts, scope, subkey; + parts = key.split('.'); + scope = this.options; + while (parts.length && (scope != null)) { + subkey = parts.shift(); + scope = scope[subkey]; + } + return scope; + }; + + Base.prototype._setOption = function(key, value) { + var parts, scope, subkey; + parts = key.split('.'); + scope = this.options; + while (parts.length) { + subkey = parts.shift(); + if (parts.length === 0) { + scope[subkey] = arguments[1]; + this.trigger("option:" + arguments[0]); + return; + } + if (scope[subkey] == null) { + scope[subkey] = {}; + } + scope = scope[subkey]; + } + }; + + Base.prototype._setManyOptions = function(options, prefix) { + var key, results, value; + if (prefix == null) { + prefix = ''; + } + results = []; + for (key in options) { + if (!hasProp.call(options, key)) continue; + value = options[key]; + if (Epoch.isObject(value)) { + results.push(this._setManyOptions(value, (prefix + key) + ".")); + } else { + results.push(this._setOption(prefix + key, value)); + } + } + return results; + }; + + Base.prototype.option = function() { + if (arguments.length === 0) { + return this._getAllOptions(); + } else if (arguments.length === 1 && Epoch.isString(arguments[0])) { + return this._getOption(arguments[0]); + } else if (arguments.length === 2 && Epoch.isString(arguments[0])) { + return this._setOption(arguments[0], arguments[1]); + } else if (arguments.length === 1 && Epoch.isObject(arguments[0])) { + return this._setManyOptions(arguments[0]); + } + }; + + Base.prototype.setDataFromModel = function() { + var prepared; + prepared = this._prepareData(this.options.model.getData(this.options.type, this.options.dataFormat)); + this.data = this._annotateLayers(prepared); + return this.draw(); + }; + + Base.prototype.setData = function(data, options) { + var prepared; + if (options == null) { + options = {}; + } + prepared = this._prepareData((this.rawData = this._formatData(data))); + return this.data = this._annotateLayers(prepared); + }; + + Base.prototype._prepareData = function(data) { + return data; + }; + + Base.prototype._formatData = function(data) { + return Epoch.Data.formatData(data, this.options.type, this.options.dataFormat); + }; + + Base.prototype._annotateLayers = function(data) { + var category, classes, i, layer, len; + category = 1; + for (i = 0, len = data.length; i < len; i++) { + layer = data[i]; + classes = ['layer']; + classes.push("category" + category); + layer.category = category; + layer.visible = true; + if (layer.label != null) { + classes.push(Epoch.Util.dasherize(layer.label)); + } + layer.className = classes.join(' '); + category++; + } + return data; + }; + + Base.prototype._findLayer = function(labelOrIndex) { + var i, index, l, layer, len, ref; + layer = null; + if (Epoch.isString(labelOrIndex)) { + ref = this.data; + for (i = 0, len = ref.length; i < len; i++) { + l = ref[i]; + if (l.label === labelOrIndex) { + layer = l; + break; + } + } + } else if (Epoch.isNumber(labelOrIndex)) { + index = parseInt(labelOrIndex); + if (!(index < 0 || index >= this.data.length)) { + layer = this.data[index]; + } + } + return layer; + }; + + Base.prototype.showLayer = function(labelOrIndex) { + var layer; + if (!(layer = this._findLayer(labelOrIndex))) { + return; + } + if (layer.visible) { + return; + } + layer.visible = true; + return this.trigger('layer:shown'); + }; + + Base.prototype.hideLayer = function(labelOrIndex) { + var layer; + if (!(layer = this._findLayer(labelOrIndex))) { + return; + } + if (!layer.visible) { + return; + } + layer.visible = false; + return this.trigger('layer:hidden'); + }; + + Base.prototype.toggleLayer = function(labelOrIndex) { + var layer; + if (!(layer = this._findLayer(labelOrIndex))) { + return; + } + layer.visible = !layer.visible; + if (layer.visible) { + return this.trigger('layer:shown'); + } else { + return this.trigger('layer:hidden'); + } + }; + + Base.prototype.isLayerVisible = function(labelOrIndex) { + var layer; + if (!(layer = this._findLayer(labelOrIndex))) { + return null; + } + return layer.visible; + }; + + Base.prototype.getVisibleLayers = function() { + return this.data.filter(function(layer) { + return layer.visible; + }); + }; + + Base.prototype.update = function(data, draw) { + if (draw == null) { + draw = true; + } + this.setData(data); + if (draw) { + return this.draw(); + } + }; + + Base.prototype.draw = function() { + return this.trigger('draw'); + }; + + Base.prototype._getScaleDomain = function(givenDomain) { + var layers, maxFn, minFn, values; + if (Array.isArray(givenDomain)) { + return givenDomain; + } + if (Epoch.isString(givenDomain)) { + layers = this.getVisibleLayers().filter(function(l) { + return l.range === givenDomain; + }).map(function(l) { + return l.values; + }); + if ((layers != null) && layers.length) { + values = Epoch.Util.flatten(layers).map(function(d) { + return d.y; + }); + minFn = function(memo, curr) { + if (curr < memo) { + return curr; + } else { + return memo; + } + }; + maxFn = function(memo, curr) { + if (curr > memo) { + return curr; + } else { + return memo; + } + }; + return [values.reduce(minFn, values[0]), values.reduce(maxFn, values[0])]; + } + } + if (Array.isArray(this.options.range)) { + return this.options.range; + } else if (this.options.range && Array.isArray(this.options.range.left)) { + return this.options.range.left; + } else if (this.options.range && Array.isArray(this.options.range.right)) { + return this.options.range.right; + } else { + return this.extent(function(d) { + return d.y; + }); + } + }; + + Base.prototype.extent = function(cmp) { + return [ + d3.min(this.getVisibleLayers(), function(layer) { + return d3.min(layer.values, cmp); + }), d3.max(this.getVisibleLayers(), function(layer) { + return d3.max(layer.values, cmp); + }) + ]; + }; + + Base.prototype.dimensionsChanged = function() { + this.width = this.option('width') || this.width; + this.height = this.option('height') || this.height; + this.el.width(this.width); + return this.el.height(this.height); + }; + + Base.prototype.layerChanged = function() { + return this.draw(); + }; + + return Base; + +})(Epoch.Events); + +Epoch.Chart.SVG = (function(superClass) { + extend(SVG, superClass); + + function SVG(options1) { + this.options = options1 != null ? options1 : {}; + SVG.__super__.constructor.call(this, this.options); + if (this.el != null) { + this.svg = this.el.append('svg'); + } else { + this.svg = d3.select(document.createElement('svg')); + } + this.svg.attr({ + xmlns: 'http://www.w3.org/2000/svg', + width: this.width, + height: this.height + }); + } + + SVG.prototype.dimensionsChanged = function() { + SVG.__super__.dimensionsChanged.call(this); + return this.svg.attr('width', this.width).attr('height', this.height); + }; + + return SVG; + +})(Epoch.Chart.Base); + +Epoch.Chart.Canvas = (function(superClass) { + extend(Canvas, superClass); + + function Canvas(options1) { + this.options = options1 != null ? options1 : {}; + Canvas.__super__.constructor.call(this, this.options); + if (this.options.pixelRatio != null) { + this.pixelRatio = this.options.pixelRatio; + } else if (window.devicePixelRatio != null) { + this.pixelRatio = window.devicePixelRatio; + } else { + this.pixelRatio = 1; + } + this.canvas = d3.select(document.createElement('CANVAS')); + this.canvas.style({ + 'width': this.width + "px", + 'height': this.height + "px" + }); + this.canvas.attr({ + width: this.getWidth(), + height: this.getHeight() + }); + if (this.el != null) { + this.el.node().appendChild(this.canvas.node()); + } + this.ctx = Epoch.Util.getContext(this.canvas.node()); + } + + Canvas.prototype.getWidth = function() { + return this.width * this.pixelRatio; + }; + + Canvas.prototype.getHeight = function() { + return this.height * this.pixelRatio; + }; + + Canvas.prototype.clear = function() { + return this.ctx.clearRect(0, 0, this.getWidth(), this.getHeight()); + }; + + Canvas.prototype.getStyles = function(selector) { + return Epoch.QueryCSS.getStyles(selector, this.el); + }; + + Canvas.prototype.dimensionsChanged = function() { + Canvas.__super__.dimensionsChanged.call(this); + this.canvas.style({ + 'width': this.width + "px", + 'height': this.height + "px" + }); + return this.canvas.attr({ + width: this.getWidth(), + height: this.getHeight() + }); + }; + + Canvas.prototype.redraw = function() { + Epoch.QueryCSS.purge(); + return this.draw(); + }; + + return Canvas; + +})(Epoch.Chart.Base); + +var QueryCSS; + +QueryCSS = (function() { + var CONTAINER_HASH_ATTR, PUT_EXPR, REFERENCE_CONTAINER_ID, containerCount, logging, nextContainerId, put; + + function QueryCSS() {} + + REFERENCE_CONTAINER_ID = '_canvas_css_reference'; + + CONTAINER_HASH_ATTR = 'data-epoch-container-id'; + + containerCount = 0; + + nextContainerId = function() { + return "epoch-container-" + (containerCount++); + }; + + PUT_EXPR = /^([^#. ]+)?(#[^. ]+)?(\.[^# ]+)?$/; + + logging = false; + + put = function(selector) { + var classNames, element, id, match, tag, whole; + match = selector.match(PUT_EXPR); + if (match == null) { + return Epoch.error('Query CSS cannot match given selector: ' + selector); + } + whole = match[0], tag = match[1], id = match[2], classNames = match[3]; + tag = (tag != null ? tag : 'div').toUpperCase(); + element = document.createElement(tag); + if (id != null) { + element.id = id.substr(1); + } + if (classNames != null) { + element.className = classNames.substr(1).replace(/\./g, ' '); + } + return element; + }; + + QueryCSS.log = function(b) { + return logging = b; + }; + + QueryCSS.cache = {}; + + QueryCSS.styleList = ['fill', 'stroke', 'stroke-width']; + + QueryCSS.container = null; + + QueryCSS.purge = function() { + return QueryCSS.cache = {}; + }; + + QueryCSS.getContainer = function() { + var container; + if (QueryCSS.container != null) { + return QueryCSS.container; + } + container = document.createElement('DIV'); + container.id = REFERENCE_CONTAINER_ID; + document.body.appendChild(container); + return QueryCSS.container = d3.select(container); + }; + + QueryCSS.hash = function(selector, container) { + var containerId; + containerId = container.attr(CONTAINER_HASH_ATTR); + if (containerId == null) { + containerId = nextContainerId(); + container.attr(CONTAINER_HASH_ATTR, containerId); + } + return containerId + "__" + selector; + }; + + QueryCSS.getStyles = function(selector, container) { + var cache, cacheKey, el, element, i, j, k, len, len1, len2, name, parent, parentNode, parents, ref, ref1, ref2, root, sel, selectorList, styles, subSelector; + cacheKey = QueryCSS.hash(selector, container); + cache = QueryCSS.cache[cacheKey]; + if (cache != null) { + return cache; + } + parents = []; + parentNode = container.node().parentNode; + while ((parentNode != null) && parentNode.nodeName.toLowerCase() !== 'body') { + parents.unshift(parentNode); + parentNode = parentNode.parentNode; + } + parents.push(container.node()); + selectorList = []; + for (i = 0, len = parents.length; i < len; i++) { + element = parents[i]; + sel = element.nodeName.toLowerCase(); + if ((element.id != null) && element.id.length > 0) { + sel += '#' + element.id; + } + if ((element.className != null) && element.className.length > 0) { + sel += '.' + Epoch.Util.trim(element.className).replace(/\s+/g, '.'); + } + selectorList.push(sel); + } + selectorList.push('svg'); + ref1 = Epoch.Util.trim(selector).split(/\s+/); + for (j = 0, len1 = ref1.length; j < len1; j++) { + subSelector = ref1[j]; + selectorList.push(subSelector); + } + if (logging) { + console.log(selectorList); + } + parent = root = put(selectorList.shift()); + while (selectorList.length) { + el = put(selectorList.shift()); + parent.appendChild(el); + parent = el; + } + if (logging) { + console.log(root); + } + QueryCSS.getContainer().node().appendChild(root); + ref = d3.select('#' + REFERENCE_CONTAINER_ID + ' ' + selector); + styles = {}; + ref2 = QueryCSS.styleList; + for (k = 0, len2 = ref2.length; k < len2; k++) { + name = ref2[k]; + styles[name] = ref.style(name); + } + QueryCSS.cache[cacheKey] = styles; + QueryCSS.getContainer().html(''); + return styles; + }; + + return QueryCSS; + +})(); + +Epoch.QueryCSS = QueryCSS; + +var applyLayerLabel, base, + hasProp = {}.hasOwnProperty, + slice = [].slice; + +if (Epoch.Data == null) { + Epoch.Data = {}; +} + +if ((base = Epoch.Data).Format == null) { + base.Format = {}; +} + +applyLayerLabel = function(layer, options, i, keys) { + var autoLabels, keyLabels, label, labels, ref; + if (keys == null) { + keys = []; + } + ref = [options.labels, options.autoLabels, options.keyLabels], labels = ref[0], autoLabels = ref[1], keyLabels = ref[2]; + if ((labels != null) && Epoch.isArray(labels) && labels.length > i) { + layer.label = labels[i]; + } else if (keyLabels && keys.length > i) { + layer.label = keys[i]; + } else if (autoLabels) { + label = []; + while (i >= 0) { + label.push(String.fromCharCode(65 + (i % 26))); + i -= 26; + } + layer.label = label.join(''); + } + return layer; +}; + +Epoch.Data.Format.array = (function() { + var buildLayers, defaultOptions, format, formatBasicPlot, formatHeatmap, formatPie, formatTimePlot; + defaultOptions = { + x: function(d, i) { + return i; + }, + y: function(d, i) { + return d; + }, + time: function(d, i, startTime) { + return parseInt(startTime) + parseInt(i); + }, + type: 'area', + autoLabels: false, + labels: [], + startTime: parseInt(new Date().getTime() / 1000) + }; + buildLayers = function(data, options, mapFn) { + var i, result, series; + result = []; + if (Epoch.isArray(data[0])) { + for (i in data) { + if (!hasProp.call(data, i)) continue; + series = data[i]; + result.push(applyLayerLabel({ + values: series.map(mapFn) + }, options, parseInt(i))); + } + } else { + result.push(applyLayerLabel({ + values: data.map(mapFn) + }, options, 0)); + } + return result; + }; + formatBasicPlot = function(data, options) { + return buildLayers(data, options, function(d, i) { + return { + x: options.x(d, i), + y: options.y(d, i) + }; + }); + }; + formatTimePlot = function(data, options) { + return buildLayers(data, options, function(d, i) { + return { + time: options.time(d, i, options.startTime), + y: options.y(d, i) + }; + }); + }; + formatHeatmap = function(data, options) { + return buildLayers(data, options, function(d, i) { + return { + time: options.time(d, i, options.startTime), + histogram: d + }; + }); + }; + formatPie = function(data, options) { + var i, result, v; + result = []; + for (i in data) { + if (!hasProp.call(data, i)) continue; + v = data[i]; + if (!Epoch.isNumber(data[0])) { + return []; + } + result.push(applyLayerLabel({ + value: v + }, options, i)); + } + return result; + }; + format = function(data, options) { + var opt; + if (data == null) { + data = []; + } + if (options == null) { + options = {}; + } + if (!Epoch.isNonEmptyArray(data)) { + return []; + } + opt = Epoch.Util.defaults(options, defaultOptions); + if (opt.type === 'time.heatmap') { + return formatHeatmap(data, opt); + } else if (opt.type.match(/^time\./)) { + return formatTimePlot(data, opt); + } else if (opt.type === 'pie') { + return formatPie(data, opt); + } else { + return formatBasicPlot(data, opt); + } + }; + format.entry = function(datum, options) { + var d, data, k, layer, len, opt, ref, results; + if (options == null) { + options = {}; + } + if (options.type === 'time.gauge') { + if (datum == null) { + return 0; + } + opt = Epoch.Util.defaults(options, defaultOptions); + d = Epoch.isArray(datum) ? datum[0] : datum; + return opt.y(d, 0); + } + if (datum == null) { + return []; + } + if (options.startTime == null) { + options.startTime = parseInt(new Date().getTime() / 1000); + } + if (Epoch.isArray(datum)) { + data = datum.map(function(d) { + return [d]; + }); + } else { + data = [datum]; + } + ref = format(data, options); + results = []; + for (k = 0, len = ref.length; k < len; k++) { + layer = ref[k]; + results.push(layer.values[0]); + } + return results; + }; + return format; +})(); + +Epoch.Data.Format.tuple = (function() { + var buildLayers, defaultOptions, format; + defaultOptions = { + x: function(d, i) { + return d; + }, + y: function(d, i) { + return d; + }, + time: function(d, i) { + return d; + }, + type: 'area', + autoLabels: false, + labels: [] + }; + buildLayers = function(data, options, mapFn) { + var i, result, series; + if (!Epoch.isArray(data[0])) { + return []; + } + result = []; + if (Epoch.isArray(data[0][0])) { + for (i in data) { + if (!hasProp.call(data, i)) continue; + series = data[i]; + result.push(applyLayerLabel({ + values: series.map(mapFn) + }, options, parseInt(i))); + } + } else { + result.push(applyLayerLabel({ + values: data.map(mapFn) + }, options, 0)); + } + return result; + }; + format = function(data, options) { + var opt; + if (data == null) { + data = []; + } + if (options == null) { + options = {}; + } + if (!Epoch.isNonEmptyArray(data)) { + return []; + } + opt = Epoch.Util.defaults(options, defaultOptions); + if (opt.type === 'pie' || opt.type === 'time.heatmap' || opt.type === 'time.gauge') { + return []; + } else if (opt.type.match(/^time\./)) { + return buildLayers(data, opt, function(d, i) { + return { + time: opt.time(d[0], parseInt(i)), + y: opt.y(d[1], parseInt(i)) + }; + }); + } else { + return buildLayers(data, opt, function(d, i) { + return { + x: opt.x(d[0], parseInt(i)), + y: opt.y(d[1], parseInt(i)) + }; + }); + } + }; + format.entry = function(datum, options) { + var data, k, layer, len, ref, results; + if (options == null) { + options = {}; + } + if (datum == null) { + return []; + } + if (options.startTime == null) { + options.startTime = parseInt(new Date().getTime() / 1000); + } + if (Epoch.isArray(datum) && Epoch.isArray(datum[0])) { + data = datum.map(function(d) { + return [d]; + }); + } else { + data = [datum]; + } + ref = format(data, options); + results = []; + for (k = 0, len = ref.length; k < len; k++) { + layer = ref[k]; + results.push(layer.values[0]); + } + return results; + }; + return format; +})(); + +Epoch.Data.Format.keyvalue = (function() { + var buildLayers, defaultOptions, format, formatBasicPlot, formatTimePlot; + defaultOptions = { + type: 'area', + x: function(d, i) { + return parseInt(i); + }, + y: function(d, i) { + return d; + }, + time: function(d, i, startTime) { + return parseInt(startTime) + parseInt(i); + }, + labels: [], + autoLabels: false, + keyLabels: true, + startTime: parseInt(new Date().getTime() / 1000) + }; + buildLayers = function(data, keys, options, mapFn) { + var d, i, j, key, result, values; + result = []; + for (j in keys) { + if (!hasProp.call(keys, j)) continue; + key = keys[j]; + values = []; + for (i in data) { + if (!hasProp.call(data, i)) continue; + d = data[i]; + values.push(mapFn(d, key, parseInt(i))); + } + result.push(applyLayerLabel({ + values: values + }, options, parseInt(j), keys)); + } + return result; + }; + formatBasicPlot = function(data, keys, options) { + return buildLayers(data, keys, options, function(d, key, i) { + var x; + if (Epoch.isString(options.x)) { + x = d[options.x]; + } else { + x = options.x(d, parseInt(i)); + } + return { + x: x, + y: options.y(d[key], parseInt(i)) + }; + }); + }; + formatTimePlot = function(data, keys, options, rangeName) { + if (rangeName == null) { + rangeName = 'y'; + } + return buildLayers(data, keys, options, function(d, key, i) { + var value; + if (Epoch.isString(options.time)) { + value = { + time: d[options.time] + }; + } else { + value = { + time: options.time(d, parseInt(i), options.startTime) + }; + } + value[rangeName] = options.y(d[key], parseInt(i)); + return value; + }); + }; + format = function(data, keys, options) { + var opt; + if (data == null) { + data = []; + } + if (keys == null) { + keys = []; + } + if (options == null) { + options = {}; + } + if (!(Epoch.isNonEmptyArray(data) && Epoch.isNonEmptyArray(keys))) { + return []; + } + opt = Epoch.Util.defaults(options, defaultOptions); + if (opt.type === 'pie' || opt.type === 'time.gauge') { + return []; + } else if (opt.type === 'time.heatmap') { + return formatTimePlot(data, keys, opt, 'histogram'); + } else if (opt.type.match(/^time\./)) { + return formatTimePlot(data, keys, opt); + } else { + return formatBasicPlot(data, keys, opt); + } + }; + format.entry = function(datum, keys, options) { + var k, layer, len, ref, results; + if (keys == null) { + keys = []; + } + if (options == null) { + options = {}; + } + if (!((datum != null) && Epoch.isNonEmptyArray(keys))) { + return []; + } + if (options.startTime == null) { + options.startTime = parseInt(new Date().getTime() / 1000); + } + ref = format([datum], keys, options); + results = []; + for (k = 0, len = ref.length; k < len; k++) { + layer = ref[k]; + results.push(layer.values[0]); + } + return results; + }; + return format; +})(); + +Epoch.data = function() { + var args, formatFn, formatter; + formatter = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; + if ((formatFn = Epoch.Data.Format[formatter]) == null) { + return []; + } + return formatFn.apply(formatFn, args); +}; + +Epoch.Data.formatData = function(data, type, dataFormat) { + var a, args, k, len, opts, ref; + if (data == null) { + data = []; + } + if (!Epoch.isNonEmptyArray(data)) { + return data; + } + if (Epoch.isString(dataFormat)) { + opts = { + type: type + }; + return Epoch.data(dataFormat, data, opts); + } + if (!Epoch.isObject(dataFormat)) { + return data; + } + if (!((dataFormat.name != null) && Epoch.isString(dataFormat.name))) { + return data; + } + if (Epoch.Data.Format[dataFormat.name] == null) { + return data; + } + args = [dataFormat.name, data]; + if ((dataFormat["arguments"] != null) && Epoch.isArray(dataFormat["arguments"])) { + ref = dataFormat["arguments"]; + for (k = 0, len = ref.length; k < len; k++) { + a = ref[k]; + args.push(a); + } + } + if (dataFormat.options != null) { + opts = dataFormat.options; + if (type != null) { + if (opts.type == null) { + opts.type = type; + } + } + args.push(opts); + } else if (type != null) { + args.push({ + type: type + }); + } + return Epoch.data.apply(Epoch.data, args); +}; + +Epoch.Data.formatEntry = function(datum, type, format) { + var a, args, dataFormat, entry, k, len, opts, ref; + if (format == null) { + return datum; + } + if (Epoch.isString(format)) { + opts = { + type: type + }; + return Epoch.Data.Format[format].entry(datum, opts); + } + if (!Epoch.isObject(format)) { + return datum; + } + if (!((format.name != null) && Epoch.isString(format.name))) { + return datum; + } + if (Epoch.Data.Format[format.name] == null) { + return datum; + } + dataFormat = Epoch.Util.defaults(format, {}); + args = [datum]; + if ((dataFormat["arguments"] != null) && Epoch.isArray(dataFormat["arguments"])) { + ref = dataFormat["arguments"]; + for (k = 0, len = ref.length; k < len; k++) { + a = ref[k]; + args.push(a); + } + } + if (dataFormat.options != null) { + opts = dataFormat.options; + opts.type = type; + args.push(opts); + } else if (type != null) { + args.push({ + type: type + }); + } + entry = Epoch.Data.Format[dataFormat.name].entry; + return entry.apply(entry, args); +}; + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Model = (function(superClass) { + var defaults; + + extend(Model, superClass); + + defaults = { + dataFormat: null + }; + + function Model(options) { + if (options == null) { + options = {}; + } + Model.__super__.constructor.call(this); + options = Epoch.Util.defaults(options, defaults); + this.dataFormat = options.dataFormat; + this.data = options.data; + this.loading = false; + } + + Model.prototype.setData = function(data) { + this.data = data; + return this.trigger('data:updated'); + }; + + Model.prototype.push = function(entry) { + this.entry = entry; + return this.trigger('data:push'); + }; + + Model.prototype.hasData = function() { + return this.data != null; + }; + + Model.prototype.getData = function(type, dataFormat) { + if (dataFormat == null) { + dataFormat = this.dataFormat; + } + return Epoch.Data.formatData(this.data, type, dataFormat); + }; + + Model.prototype.getNext = function(type, dataFormat) { + if (dataFormat == null) { + dataFormat = this.dataFormat; + } + return Epoch.Data.formatEntry(this.entry, type, dataFormat); + }; + + return Model; + +})(Epoch.Events); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Plot = (function(superClass) { + var defaultAxisMargins, defaults, optionListeners; + + extend(Plot, superClass); + + defaults = { + domain: null, + range: null, + axes: ['left', 'bottom'], + ticks: { + top: 14, + bottom: 14, + left: 5, + right: 5 + }, + tickFormats: { + top: Epoch.Formats.regular, + bottom: Epoch.Formats.regular, + left: Epoch.Formats.si, + right: Epoch.Formats.si + } + }; + + defaultAxisMargins = { + top: 25, + right: 50, + bottom: 25, + left: 50 + }; + + optionListeners = { + 'option:margins.top': 'marginsChanged', + 'option:margins.right': 'marginsChanged', + 'option:margins.bottom': 'marginsChanged', + 'option:margins.left': 'marginsChanged', + 'option:axes': 'axesChanged', + 'option:ticks.top': 'ticksChanged', + 'option:ticks.right': 'ticksChanged', + 'option:ticks.bottom': 'ticksChanged', + 'option:ticks.left': 'ticksChanged', + 'option:tickFormats.top': 'tickFormatsChanged', + 'option:tickFormats.right': 'tickFormatsChanged', + 'option:tickFormats.bottom': 'tickFormatsChanged', + 'option:tickFormats.left': 'tickFormatsChanged', + 'option:domain': 'domainChanged', + 'option:range': 'rangeChanged' + }; + + function Plot(options) { + var givenMargins, i, len, pos, ref; + this.options = options != null ? options : {}; + givenMargins = Epoch.Util.copy(this.options.margins) || {}; + Plot.__super__.constructor.call(this, this.options = Epoch.Util.defaults(this.options, defaults)); + this.margins = {}; + ref = ['top', 'right', 'bottom', 'left']; + for (i = 0, len = ref.length; i < len; i++) { + pos = ref[i]; + this.margins[pos] = (this.options.margins != null) && (this.options.margins[pos] != null) ? this.options.margins[pos] : this.hasAxis(pos) ? defaultAxisMargins[pos] : 6; + } + this.g = this.svg.append("g").attr("transform", "translate(" + this.margins.left + ", " + this.margins.top + ")"); + this.onAll(optionListeners); + } + + Plot.prototype.setTickFormat = function(axis, fn) { + return this.options.tickFormats[axis] = fn; + }; + + Plot.prototype.hasAxis = function(axis) { + return this.options.axes.indexOf(axis) > -1; + }; + + Plot.prototype.innerWidth = function() { + return this.width - (this.margins.left + this.margins.right); + }; + + Plot.prototype.innerHeight = function() { + return this.height - (this.margins.top + this.margins.bottom); + }; + + Plot.prototype.x = function() { + var domain, ref; + domain = (ref = this.options.domain) != null ? ref : this.extent(function(d) { + return d.x; + }); + return d3.scale.linear().domain(domain).range([0, this.innerWidth()]); + }; + + Plot.prototype.y = function(givenDomain) { + return d3.scale.linear().domain(this._getScaleDomain(givenDomain)).range([this.innerHeight(), 0]); + }; + + Plot.prototype.bottomAxis = function() { + return d3.svg.axis().scale(this.x()).orient('bottom').ticks(this.options.ticks.bottom).tickFormat(this.options.tickFormats.bottom); + }; + + Plot.prototype.topAxis = function() { + return d3.svg.axis().scale(this.x()).orient('top').ticks(this.options.ticks.top).tickFormat(this.options.tickFormats.top); + }; + + Plot.prototype.leftAxis = function() { + var range; + range = this.options.range ? this.options.range.left : null; + return d3.svg.axis().scale(this.y(range)).orient('left').ticks(this.options.ticks.left).tickFormat(this.options.tickFormats.left); + }; + + Plot.prototype.rightAxis = function() { + var range; + range = this.options.range ? this.options.range.right : null; + return d3.svg.axis().scale(this.y(range)).orient('right').ticks(this.options.ticks.right).tickFormat(this.options.tickFormats.right); + }; + + Plot.prototype.draw = function() { + if (this._axesDrawn) { + this._redrawAxes(); + } else { + this._drawAxes(); + } + return Plot.__super__.draw.call(this); + }; + + Plot.prototype._redrawAxes = function() { + if (this.hasAxis('bottom')) { + this.g.selectAll('.x.axis.bottom').transition().duration(500).ease('linear').call(this.bottomAxis()); + } + if (this.hasAxis('top')) { + this.g.selectAll('.x.axis.top').transition().duration(500).ease('linear').call(this.topAxis()); + } + if (this.hasAxis('left')) { + this.g.selectAll('.y.axis.left').transition().duration(500).ease('linear').call(this.leftAxis()); + } + if (this.hasAxis('right')) { + return this.g.selectAll('.y.axis.right').transition().duration(500).ease('linear').call(this.rightAxis()); + } + }; + + Plot.prototype._drawAxes = function() { + if (this.hasAxis('bottom')) { + this.g.append("g").attr("class", "x axis bottom").attr("transform", "translate(0, " + (this.innerHeight()) + ")").call(this.bottomAxis()); + } + if (this.hasAxis('top')) { + this.g.append("g").attr('class', 'x axis top').call(this.topAxis()); + } + if (this.hasAxis('left')) { + this.g.append("g").attr("class", "y axis left").call(this.leftAxis()); + } + if (this.hasAxis('right')) { + this.g.append('g').attr('class', 'y axis right').attr('transform', "translate(" + (this.innerWidth()) + ", 0)").call(this.rightAxis()); + } + return this._axesDrawn = true; + }; + + Plot.prototype.dimensionsChanged = function() { + Plot.__super__.dimensionsChanged.call(this); + this.g.selectAll('.axis').remove(); + this._axesDrawn = false; + return this.draw(); + }; + + Plot.prototype.marginsChanged = function() { + var pos, ref, size; + if (this.options.margins == null) { + return; + } + ref = this.options.margins; + for (pos in ref) { + if (!hasProp.call(ref, pos)) continue; + size = ref[pos]; + if (size == null) { + this.margins[pos] = 6; + } else { + this.margins[pos] = size; + } + } + this.g.transition().duration(750).attr("transform", "translate(" + this.margins.left + ", " + this.margins.top + ")"); + return this.draw(); + }; + + Plot.prototype.axesChanged = function() { + var i, len, pos, ref; + ref = ['top', 'right', 'bottom', 'left']; + for (i = 0, len = ref.length; i < len; i++) { + pos = ref[i]; + if ((this.options.margins != null) && (this.options.margins[pos] != null)) { + continue; + } + if (this.hasAxis(pos)) { + this.margins[pos] = defaultAxisMargins[pos]; + } else { + this.margins[pos] = 6; + } + } + this.g.transition().duration(750).attr("transform", "translate(" + this.margins.left + ", " + this.margins.top + ")"); + this.g.selectAll('.axis').remove(); + this._axesDrawn = false; + return this.draw(); + }; + + Plot.prototype.ticksChanged = function() { + return this.draw(); + }; + + Plot.prototype.tickFormatsChanged = function() { + return this.draw(); + }; + + Plot.prototype.domainChanged = function() { + return this.draw(); + }; + + Plot.prototype.rangeChanged = function() { + return this.draw(); + }; + + return Plot; + +})(Epoch.Chart.SVG); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Area = (function(superClass) { + extend(Area, superClass); + + function Area(options) { + var base; + this.options = options != null ? options : {}; + if ((base = this.options).type == null) { + base.type = 'area'; + } + Area.__super__.constructor.call(this, this.options); + this.draw(); + } + + Area.prototype.y = function() { + var a, i, k, layer, len, ref, ref1, ref2, v; + a = []; + ref = this.getVisibleLayers(); + for (i = 0, len = ref.length; i < len; i++) { + layer = ref[i]; + ref1 = layer.values; + for (k in ref1) { + if (!hasProp.call(ref1, k)) continue; + v = ref1[k]; + if (a[k] != null) { + a[k] += v.y; + } + if (a[k] == null) { + a[k] = v.y; + } + } + } + return d3.scale.linear().domain((ref2 = this.options.range) != null ? ref2 : [0, d3.max(a)]).range([this.height - this.margins.top - this.margins.bottom, 0]); + }; + + Area.prototype.draw = function() { + var area, data, layer, layers, ref, stack, x, y; + ref = [this.x(), this.y(), this.getVisibleLayers()], x = ref[0], y = ref[1], layers = ref[2]; + this.g.selectAll('.layer').remove(); + if (layers.length === 0) { + return; + } + area = d3.svg.area().x(function(d) { + return x(d.x); + }).y0(function(d) { + return y(d.y0); + }).y1(function(d) { + return y(d.y0 + d.y); + }); + stack = d3.layout.stack().values(function(d) { + return d.values; + }); + data = stack(layers); + layer = this.g.selectAll('.layer').data(layers, function(d) { + return d.category; + }); + layer.select('.area').attr('d', function(d) { + return area(d.values); + }); + layer.enter().append('g').attr('class', function(d) { + return d.className; + }); + layer.append('path').attr('class', 'area').attr('d', function(d) { + return area(d.values); + }); + return Area.__super__.draw.call(this); + }; + + return Area; + +})(Epoch.Chart.Plot); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Bar = (function(superClass) { + var defaults, horizontal_defaults, horizontal_specific, optionListeners; + + extend(Bar, superClass); + + defaults = { + type: 'bar', + style: 'grouped', + orientation: 'vertical', + padding: { + bar: 0.08, + group: 0.1 + }, + outerPadding: { + bar: 0.08, + group: 0.1 + } + }; + + horizontal_specific = { + tickFormats: { + top: Epoch.Formats.si, + bottom: Epoch.Formats.si, + left: Epoch.Formats.regular, + right: Epoch.Formats.regular + } + }; + + horizontal_defaults = Epoch.Util.defaults(horizontal_specific, defaults); + + optionListeners = { + 'option:orientation': 'orientationChanged', + 'option:padding': 'paddingChanged', + 'option:outerPadding': 'paddingChanged', + 'option:padding:bar': 'paddingChanged', + 'option:padding:group': 'paddingChanged', + 'option:outerPadding:bar': 'paddingChanged', + 'option:outerPadding:group': 'paddingChanged' + }; + + function Bar(options) { + this.options = options != null ? options : {}; + if (this._isHorizontal()) { + this.options = Epoch.Util.defaults(this.options, horizontal_defaults); + } else { + this.options = Epoch.Util.defaults(this.options, defaults); + } + Bar.__super__.constructor.call(this, this.options); + this.onAll(optionListeners); + this.draw(); + } + + Bar.prototype._isVertical = function() { + return this.options.orientation === 'vertical'; + }; + + Bar.prototype._isHorizontal = function() { + return this.options.orientation === 'horizontal'; + }; + + Bar.prototype.x = function() { + var extent; + if (this._isVertical()) { + return d3.scale.ordinal().domain(Epoch.Util.domain(this.getVisibleLayers())).rangeRoundBands([0, this.innerWidth()], this.options.padding.group, this.options.outerPadding.group); + } else { + extent = this.extent(function(d) { + return d.y; + }); + extent[0] = Math.min(0, extent[0]); + return d3.scale.linear().domain(extent).range([0, this.width - this.margins.left - this.margins.right]); + } + }; + + Bar.prototype.x1 = function(x0) { + var layer; + return d3.scale.ordinal().domain((function() { + var j, len, ref, results; + ref = this.getVisibleLayers(); + results = []; + for (j = 0, len = ref.length; j < len; j++) { + layer = ref[j]; + results.push(layer.category); + } + return results; + }).call(this)).rangeRoundBands([0, x0.rangeBand()], this.options.padding.bar, this.options.outerPadding.bar); + }; + + Bar.prototype.y = function() { + var extent; + if (this._isVertical()) { + extent = this.extent(function(d) { + return d.y; + }); + extent[0] = Math.min(0, extent[0]); + return d3.scale.linear().domain(extent).range([this.height - this.margins.top - this.margins.bottom, 0]); + } else { + return d3.scale.ordinal().domain(Epoch.Util.domain(this.getVisibleLayers())).rangeRoundBands([0, this.innerHeight()], this.options.padding.group, this.options.outerPadding.group); + } + }; + + Bar.prototype.y1 = function(y0) { + var layer; + return d3.scale.ordinal().domain((function() { + var j, len, ref, results; + ref = this.getVisibleLayers(); + results = []; + for (j = 0, len = ref.length; j < len; j++) { + layer = ref[j]; + results.push(layer.category); + } + return results; + }).call(this)).rangeRoundBands([0, y0.rangeBand()], this.options.padding.bar, this.options.outerPadding.bar); + }; + + Bar.prototype._remapData = function() { + var className, entry, j, k, l, layer, len, len1, map, name, ref, ref1, results, v; + map = {}; + ref = this.getVisibleLayers(); + for (j = 0, len = ref.length; j < len; j++) { + layer = ref[j]; + className = 'bar ' + layer.className.replace(/\s*layer\s*/, ''); + ref1 = layer.values; + for (l = 0, len1 = ref1.length; l < len1; l++) { + entry = ref1[l]; + if (map[name = entry.x] == null) { + map[name] = []; + } + map[entry.x].push({ + label: layer.category, + y: entry.y, + className: className + }); + } + } + results = []; + for (k in map) { + if (!hasProp.call(map, k)) continue; + v = map[k]; + results.push({ + group: k, + values: v + }); + } + return results; + }; + + Bar.prototype.draw = function() { + if (this._isVertical()) { + this._drawVertical(); + } else { + this._drawHorizontal(); + } + return Bar.__super__.draw.call(this); + }; + + Bar.prototype._drawVertical = function() { + var data, height, layer, rects, ref, x0, x1, y; + ref = [this.x(), this.y()], x0 = ref[0], y = ref[1]; + x1 = this.x1(x0); + height = this.height - this.margins.top - this.margins.bottom; + data = this._remapData(); + layer = this.g.selectAll(".layer").data(data, function(d) { + return d.group; + }); + layer.transition().duration(750).attr("transform", function(d) { + return "translate(" + (x0(d.group)) + ", 0)"; + }); + layer.enter().append("g").attr('class', 'layer').attr("transform", function(d) { + return "translate(" + (x0(d.group)) + ", 0)"; + }); + rects = layer.selectAll('rect').data(function(group) { + return group.values; + }); + rects.attr('class', function(d) { + return d.className; + }); + rects.transition().duration(600).attr('x', function(d) { + return x1(d.label); + }).attr('y', function(d) { + return y(d.y); + }).attr('width', x1.rangeBand()).attr('height', function(d) { + return height - y(d.y); + }); + rects.enter().append('rect').attr('class', function(d) { + return d.className; + }).attr('x', function(d) { + return x1(d.label); + }).attr('y', function(d) { + return y(d.y); + }).attr('width', x1.rangeBand()).attr('height', function(d) { + return height - y(d.y); + }); + rects.exit().transition().duration(150).style('opacity', '0').remove(); + return layer.exit().transition().duration(750).style('opacity', '0').remove(); + }; + + Bar.prototype._drawHorizontal = function() { + var data, layer, rects, ref, width, x, y0, y1; + ref = [this.x(), this.y()], x = ref[0], y0 = ref[1]; + y1 = this.y1(y0); + width = this.width - this.margins.left - this.margins.right; + data = this._remapData(); + layer = this.g.selectAll(".layer").data(data, function(d) { + return d.group; + }); + layer.transition().duration(750).attr("transform", function(d) { + return "translate(0, " + (y0(d.group)) + ")"; + }); + layer.enter().append("g").attr('class', 'layer').attr("transform", function(d) { + return "translate(0, " + (y0(d.group)) + ")"; + }); + rects = layer.selectAll('rect').data(function(group) { + return group.values; + }); + rects.attr('class', function(d) { + return d.className; + }); + rects.transition().duration(600).attr('x', function(d) { + return 0; + }).attr('y', function(d) { + return y1(d.label); + }).attr('height', y1.rangeBand()).attr('width', function(d) { + return x(d.y); + }); + rects.enter().append('rect').attr('class', function(d) { + return d.className; + }).attr('x', function(d) { + return 0; + }).attr('y', function(d) { + return y1(d.label); + }).attr('height', y1.rangeBand()).attr('width', function(d) { + return x(d.y); + }); + rects.exit().transition().duration(150).style('opacity', '0').remove(); + return layer.exit().transition().duration(750).style('opacity', '0').remove(); + }; + + Bar.prototype._getTickValues = function(numTicks, dataKey) { + var i, step, tickValues, total; + if (dataKey == null) { + dataKey = 'x'; + } + if (this.data[0] == null) { + return []; + } + total = this.data[0].values.length; + step = Math.ceil(total / numTicks) | 0; + return tickValues = (function() { + var j, ref, ref1, results; + results = []; + for (i = j = 0, ref = total, ref1 = step; ref1 > 0 ? j < ref : j > ref; i = j += ref1) { + results.push(this.data[0].values[i].x); + } + return results; + }).call(this); + }; + + Bar.prototype.bottomAxis = function() { + var axis; + axis = d3.svg.axis().scale(this.x()).orient('bottom').ticks(this.options.ticks.bottom).tickFormat(this.options.tickFormats.bottom); + if (this._isVertical() && (this.options.ticks.bottom != null)) { + axis.tickValues(this._getTickValues(this.options.ticks.bottom)); + } + return axis; + }; + + Bar.prototype.topAxis = function() { + var axis; + axis = d3.svg.axis().scale(this.x()).orient('top').ticks(this.options.ticks.top).tickFormat(this.options.tickFormats.top); + if (this._isVertical() && (this.options.ticks.top != null)) { + axis.tickValues(this._getTickValues(this.options.ticks.top)); + } + return axis; + }; + + Bar.prototype.leftAxis = function() { + var axis; + axis = d3.svg.axis().scale(this.y()).orient('left').ticks(this.options.ticks.left).tickFormat(this.options.tickFormats.left); + if (this._isHorizontal() && (this.options.ticks.left != null)) { + axis.tickValues(this._getTickValues(this.options.ticks.left)); + } + return axis; + }; + + Bar.prototype.rightAxis = function() { + var axis; + axis = d3.svg.axis().scale(this.y()).orient('right').ticks(this.options.ticks.right).tickFormat(this.options.tickFormats.right); + if (this._isHorizontal() && (this.options.ticks.right != null)) { + axis.tickValues(this._getTickValues(this.options.ticks.right)); + } + return axis; + }; + + Bar.prototype.orientationChanged = function() { + var bottom, left, right, top; + top = this.options.tickFormats.top; + bottom = this.options.tickFormats.bottom; + left = this.options.tickFormats.left; + right = this.options.tickFormats.right; + this.options.tickFormats.left = top; + this.options.tickFormats.right = bottom; + this.options.tickFormats.top = left; + this.options.tickFormats.bottom = right; + return this.draw(); + }; + + Bar.prototype.paddingChanged = function() { + return this.draw(); + }; + + return Bar; + +})(Epoch.Chart.Plot); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Histogram = (function(superClass) { + var defaults, optionListeners; + + extend(Histogram, superClass); + + defaults = { + type: 'histogram', + domain: [0, 100], + bucketRange: [0, 100], + buckets: 10, + cutOutliers: false + }; + + optionListeners = { + 'option:bucketRange': 'bucketRangeChanged', + 'option:buckets': 'bucketsChanged', + 'option:cutOutliers': 'cutOutliersChanged' + }; + + function Histogram(options) { + this.options = options != null ? options : {}; + Histogram.__super__.constructor.call(this, this.options = Epoch.Util.defaults(this.options, defaults)); + this.onAll(optionListeners); + this.draw(); + } + + Histogram.prototype._prepareData = function(data) { + var bucketSize, buckets, i, index, j, k, l, layer, len, len1, point, prepared, preparedLayer, ref, v; + bucketSize = (this.options.bucketRange[1] - this.options.bucketRange[0]) / this.options.buckets; + prepared = []; + for (j = 0, len = data.length; j < len; j++) { + layer = data[j]; + buckets = (function() { + var l, ref, results; + results = []; + for (i = l = 0, ref = this.options.buckets; 0 <= ref ? l < ref : l > ref; i = 0 <= ref ? ++l : --l) { + results.push(0); + } + return results; + }).call(this); + ref = layer.values; + for (l = 0, len1 = ref.length; l < len1; l++) { + point = ref[l]; + index = parseInt((point.x - this.options.bucketRange[0]) / bucketSize); + if (this.options.cutOutliers && ((index < 0) || (index >= this.options.buckets))) { + continue; + } + if (index < 0) { + index = 0; + } else if (index >= this.options.buckets) { + index = this.options.buckets - 1; + } + buckets[index] += parseInt(point.y); + } + preparedLayer = { + values: buckets.map(function(d, i) { + return { + x: parseInt(i) * bucketSize, + y: d + }; + }) + }; + for (k in layer) { + if (!hasProp.call(layer, k)) continue; + v = layer[k]; + if (k !== 'values') { + preparedLayer[k] = v; + } + } + prepared.push(preparedLayer); + } + return prepared; + }; + + Histogram.prototype.resetData = function() { + this.setData(this.rawData); + return this.draw(); + }; + + Histogram.prototype.bucketRangeChanged = function() { + return this.resetData(); + }; + + Histogram.prototype.bucketsChanged = function() { + return this.resetData(); + }; + + Histogram.prototype.cutOutliersChanged = function() { + return this.resetData(); + }; + + return Histogram; + +})(Epoch.Chart.Bar); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Line = (function(superClass) { + extend(Line, superClass); + + function Line(options) { + var base; + this.options = options != null ? options : {}; + if ((base = this.options).type == null) { + base.type = 'line'; + } + Line.__super__.constructor.call(this, this.options); + this.draw(); + } + + Line.prototype.line = function(layer) { + var ref, x, y; + ref = [this.x(), this.y(layer.range)], x = ref[0], y = ref[1]; + return d3.svg.line().x(function(d) { + return x(d.x); + }).y(function(d) { + return y(d.y); + }); + }; + + Line.prototype.draw = function() { + var layer, layers, ref, x, y; + ref = [this.x(), this.y(), this.getVisibleLayers()], x = ref[0], y = ref[1], layers = ref[2]; + if (layers.length === 0) { + return this.g.selectAll('.layer').remove(); + } + layer = this.g.selectAll('.layer').data(layers, function(d) { + return d.category; + }); + layer.select('.line').transition().duration(500).attr('d', (function(_this) { + return function(l) { + return _this.line(l)(l.values); + }; + })(this)); + layer.enter().append('g').attr('class', function(l) { + return l.className; + }).append('path').attr('class', 'line').attr('d', (function(_this) { + return function(l) { + return _this.line(l)(l.values); + }; + })(this)); + layer.exit().transition().duration(750).style('opacity', '0').remove(); + return Line.__super__.draw.call(this); + }; + + return Line; + +})(Epoch.Chart.Plot); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Pie = (function(superClass) { + var defaults; + + extend(Pie, superClass); + + defaults = { + type: 'pie', + margin: 10, + inner: 0 + }; + + function Pie(options) { + this.options = options != null ? options : {}; + Pie.__super__.constructor.call(this, this.options = Epoch.Util.defaults(this.options, defaults)); + this.pie = d3.layout.pie().sort(null).value(function(d) { + return d.value; + }); + this.arc = d3.svg.arc().outerRadius((function(_this) { + return function() { + return (Math.max(_this.width, _this.height) / 2) - _this.options.margin; + }; + })(this)).innerRadius((function(_this) { + return function() { + return _this.options.inner; + }; + })(this)); + this.g = this.svg.append('g').attr("transform", "translate(" + (this.width / 2) + ", " + (this.height / 2) + ")"); + this.on('option:margin', 'marginChanged'); + this.on('option:inner', 'innerChanged'); + this.draw(); + } + + Pie.prototype.draw = function() { + var arcs, path, text; + this.g.selectAll('.arc').remove(); + arcs = this.g.selectAll(".arc").data(this.pie(this.getVisibleLayers()), function(d) { + return d.data.category; + }); + arcs.enter().append('g').attr('class', function(d) { + return "arc pie " + d.data.className; + }); + arcs.select('path').attr('d', this.arc); + arcs.select('text').attr("transform", (function(_this) { + return function(d) { + return "translate(" + (_this.arc.centroid(d)) + ")"; + }; + })(this)).text(function(d) { + return d.data.label || d.data.category; + }); + path = arcs.append("path").attr("d", this.arc).each(function(d) { + return this._current = d; + }); + text = arcs.append("text").attr("transform", (function(_this) { + return function(d) { + return "translate(" + (_this.arc.centroid(d)) + ")"; + }; + })(this)).attr("dy", ".35em").style("text-anchor", "middle").text(function(d) { + return d.data.label || d.data.category; + }); + return Pie.__super__.draw.call(this); + }; + + Pie.prototype.marginChanged = function() { + return this.draw(); + }; + + Pie.prototype.innerChanged = function() { + return this.draw(); + }; + + return Pie; + +})(Epoch.Chart.SVG); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Scatter = (function(superClass) { + var defaults; + + extend(Scatter, superClass); + + defaults = { + type: 'scatter', + radius: 3.5, + axes: ['top', 'bottom', 'left', 'right'] + }; + + function Scatter(options) { + this.options = options != null ? options : {}; + Scatter.__super__.constructor.call(this, this.options = Epoch.Util.defaults(this.options, defaults)); + this.on('option:radius', 'radiusChanged'); + this.draw(); + } + + Scatter.prototype.draw = function() { + var dots, layer, layers, radius, ref, x, y; + ref = [this.x(), this.y(), this.getVisibleLayers()], x = ref[0], y = ref[1], layers = ref[2]; + radius = this.options.radius; + if (layers.length === 0) { + return this.g.selectAll('.layer').remove(); + } + layer = this.g.selectAll('.layer').data(layers, function(d) { + return d.category; + }); + layer.enter().append('g').attr('class', function(d) { + return d.className; + }); + dots = layer.selectAll('.dot').data(function(l) { + return l.values; + }); + dots.transition().duration(500).attr("r", function(d) { + var ref1; + return (ref1 = d.r) != null ? ref1 : radius; + }).attr("cx", function(d) { + return x(d.x); + }).attr("cy", function(d) { + return y(d.y); + }); + dots.enter().append('circle').attr('class', 'dot').attr("r", function(d) { + var ref1; + return (ref1 = d.r) != null ? ref1 : radius; + }).attr("cx", function(d) { + return x(d.x); + }).attr("cy", function(d) { + return y(d.y); + }); + dots.exit().transition().duration(750).style('opacity', 0).remove(); + layer.exit().transition().duration(750).style('opacity', 0).remove(); + return Scatter.__super__.draw.call(this); + }; + + Scatter.prototype.radiusChanged = function() { + return this.draw(); + }; + + return Scatter; + +})(Epoch.Chart.Plot); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Time.Plot = (function(superClass) { + var defaultAxisMargins, defaults, optionListeners; + + extend(Plot, superClass); + + defaults = { + range: null, + fps: 24, + historySize: 120, + windowSize: 40, + queueSize: 10, + axes: ['bottom'], + ticks: { + time: 15, + left: 5, + right: 5 + }, + tickFormats: { + top: Epoch.Formats.seconds, + bottom: Epoch.Formats.seconds, + left: Epoch.Formats.si, + right: Epoch.Formats.si + } + }; + + defaultAxisMargins = { + top: 25, + right: 50, + bottom: 25, + left: 50 + }; + + optionListeners = { + 'option:margins': 'marginsChanged', + 'option:margins.top': 'marginsChanged', + 'option:margins.right': 'marginsChanged', + 'option:margins.bottom': 'marginsChanged', + 'option:margins.left': 'marginsChanged', + 'option:axes': 'axesChanged', + 'option:ticks': 'ticksChanged', + 'option:ticks.top': 'ticksChanged', + 'option:ticks.right': 'ticksChanged', + 'option:ticks.bottom': 'ticksChanged', + 'option:ticks.left': 'ticksChanged', + 'option:tickFormats': 'tickFormatsChanged', + 'option:tickFormats.top': 'tickFormatsChanged', + 'option:tickFormats.right': 'tickFormatsChanged', + 'option:tickFormats.bottom': 'tickFormatsChanged', + 'option:tickFormats.left': 'tickFormatsChanged' + }; + + function Plot(options) { + var givenMargins, l, len, pos, ref; + this.options = options; + givenMargins = Epoch.Util.copy(this.options.margins) || {}; + Plot.__super__.constructor.call(this, this.options = Epoch.Util.defaults(this.options, defaults)); + if (this.options.model) { + this.options.model.on('data:push', (function(_this) { + return function() { + return _this.pushFromModel(); + }; + })(this)); + } + this._queue = []; + this.margins = {}; + ref = ['top', 'right', 'bottom', 'left']; + for (l = 0, len = ref.length; l < len; l++) { + pos = ref[l]; + this.margins[pos] = (this.options.margins != null) && (this.options.margins[pos] != null) ? this.options.margins[pos] : this.hasAxis(pos) ? defaultAxisMargins[pos] : 6; + } + this.svg = this.el.insert('svg', ':first-child').attr('width', this.width).attr('height', this.height).style('z-index', '1000'); + if (this.el.style('position') !== 'absolute' && this.el.style('position') !== 'relative') { + this.el.style('position', 'relative'); + } + this.canvas.style({ + position: 'absolute', + 'z-index': '999' + }); + this._sizeCanvas(); + this.animation = { + interval: null, + active: false, + delta: (function(_this) { + return function() { + return -(_this.w() / _this.options.fps); + }; + })(this), + tickDelta: (function(_this) { + return function() { + return -((_this.w() / _this.pixelRatio) / _this.options.fps); + }; + })(this), + frame: 0, + duration: this.options.fps + }; + this._buildAxes(); + this.animationCallback = (function(_this) { + return function() { + return _this._animate(); + }; + })(this); + this.onAll(optionListeners); + } + + Plot.prototype._sizeCanvas = function() { + this.canvas.attr({ + width: this.innerWidth(), + height: this.innerHeight() + }); + return this.canvas.style({ + width: (this.innerWidth() / this.pixelRatio) + "px", + height: (this.innerHeight() / this.pixelRatio) + "px", + top: this.margins.top + "px", + left: this.margins.left + "px" + }); + }; + + Plot.prototype._buildAxes = function() { + this.svg.selectAll('.axis').remove(); + this._prepareTimeAxes(); + return this._prepareRangeAxes(); + }; + + Plot.prototype._annotateLayers = function(prepared) { + var classes, copy, data, i, layer, start; + data = []; + for (i in prepared) { + if (!hasProp.call(prepared, i)) continue; + layer = prepared[i]; + copy = Epoch.Util.copy(layer); + start = Math.max(0, layer.values.length - this.options.historySize); + copy.values = layer.values.slice(start); + classes = ['layer']; + classes.push("category" + ((i | 0) + 1)); + if (layer.label != null) { + classes.push(Epoch.Util.dasherize(layer.label)); + } + copy.className = classes.join(' '); + copy.visible = true; + data.push(copy); + } + return data; + }; + + Plot.prototype._offsetX = function() { + return 0; + }; + + Plot.prototype._prepareTimeAxes = function() { + var axis; + if (this.hasAxis('bottom')) { + axis = this.bottomAxis = this.svg.append('g').attr('class', "x axis bottom canvas").attr('transform', "translate(" + (this.margins.left - 1) + ", " + (this.innerHeight() / this.pixelRatio + this.margins.top) + ")"); + axis.append('path').attr('class', 'domain').attr('d', "M0,0H" + (this.innerWidth() / this.pixelRatio + 1)); + } + if (this.hasAxis('top')) { + axis = this.topAxis = this.svg.append('g').attr('class', "x axis top canvas").attr('transform', "translate(" + (this.margins.left - 1) + ", " + this.margins.top + ")"); + axis.append('path').attr('class', 'domain').attr('d', "M0,0H" + (this.innerWidth() / this.pixelRatio + 1)); + } + return this._resetInitialTimeTicks(); + }; + + Plot.prototype._resetInitialTimeTicks = function() { + var i, k, l, layer, len, ref, ref1, results, tickInterval; + tickInterval = this.options.ticks.time; + this._ticks = []; + this._tickTimer = tickInterval; + if (this.bottomAxis != null) { + this.bottomAxis.selectAll('.tick').remove(); + } + if (this.topAxis != null) { + this.topAxis.selectAll('.tick').remove(); + } + ref = this.data; + results = []; + for (l = 0, len = ref.length; l < len; l++) { + layer = ref[l]; + if (!Epoch.isNonEmptyArray(layer.values)) { + continue; + } + ref1 = [this.options.windowSize - 1, layer.values.length - 1], i = ref1[0], k = ref1[1]; + while (i >= 0 && k >= 0) { + this._pushTick(i, layer.values[k].time, false, true); + i -= tickInterval; + k -= tickInterval; + } + break; + } + return results; + }; + + Plot.prototype._prepareRangeAxes = function() { + if (this.hasAxis('left')) { + this.svg.append("g").attr("class", "y axis left").attr('transform', "translate(" + (this.margins.left - 1) + ", " + this.margins.top + ")").call(this.leftAxis()); + } + if (this.hasAxis('right')) { + return this.svg.append('g').attr('class', 'y axis right').attr('transform', "translate(" + (this.width - this.margins.right) + ", " + this.margins.top + ")").call(this.rightAxis()); + } + }; + + Plot.prototype.leftAxis = function() { + var axis, ticks; + ticks = this.options.ticks.left; + axis = d3.svg.axis().scale(this.ySvgLeft()).orient('left').tickFormat(this.options.tickFormats.left); + if (ticks === 2) { + return axis.tickValues(this.extent(function(d) { + return d.y; + })); + } else { + return axis.ticks(ticks); + } + }; + + Plot.prototype.rightAxis = function() { + var axis, extent, ticks; + extent = this.extent(function(d) { + return d.y; + }); + ticks = this.options.ticks.right; + axis = d3.svg.axis().scale(this.ySvgRight()).orient('right').tickFormat(this.options.tickFormats.right); + if (ticks === 2) { + return axis.tickValues(this.extent(function(d) { + return d.y; + })); + } else { + return axis.ticks(ticks); + } + }; + + Plot.prototype.hasAxis = function(name) { + return this.options.axes.indexOf(name) > -1; + }; + + Plot.prototype.innerWidth = function() { + return (this.width - (this.margins.left + this.margins.right)) * this.pixelRatio; + }; + + Plot.prototype.innerHeight = function() { + return (this.height - (this.margins.top + this.margins.bottom)) * this.pixelRatio; + }; + + Plot.prototype._prepareEntry = function(entry) { + return entry; + }; + + Plot.prototype._prepareLayers = function(layers) { + return layers; + }; + + Plot.prototype._startTransition = function() { + if (this.animation.active === true || this._queue.length === 0) { + return; + } + this.trigger('transition:start'); + this._shift(); + this.animation.active = true; + return this.animation.interval = setInterval(this.animationCallback, 1000 / this.options.fps); + }; + + Plot.prototype._stopTransition = function() { + var firstTick, l, lastTick, layer, len, ref, ref1; + if (!this.inTransition()) { + return; + } + ref = this.data; + for (l = 0, len = ref.length; l < len; l++) { + layer = ref[l]; + if (!(layer.values.length > this.options.windowSize + 1)) { + continue; + } + layer.values.shift(); + } + ref1 = [this._ticks[0], this._ticks[this._ticks.length - 1]], firstTick = ref1[0], lastTick = ref1[1]; + if ((lastTick != null) && lastTick.enter) { + lastTick.enter = false; + lastTick.opacity = 1; + } + if ((firstTick != null) && firstTick.exit) { + this._shiftTick(); + } + this.animation.frame = 0; + this.trigger('transition:end'); + if (this._queue.length > 0) { + return this._shift(); + } else { + this.animation.active = false; + return clearInterval(this.animation.interval); + } + }; + + Plot.prototype.inTransition = function() { + return this.animation.active; + }; + + Plot.prototype.push = function(layers) { + layers = this._prepareLayers(layers); + if (this._queue.length > this.options.queueSize) { + this._queue.splice(this.options.queueSize, this._queue.length - this.options.queueSize); + } + if (this._queue.length === this.options.queueSize) { + return false; + } + this._queue.push(layers.map((function(_this) { + return function(entry) { + return _this._prepareEntry(entry); + }; + })(this))); + this.trigger('push'); + if (!this.inTransition()) { + return this._startTransition(); + } + }; + + Plot.prototype.pushFromModel = function() { + return this.push(this.options.model.getNext(this.options.type, this.options.dataFormat)); + }; + + Plot.prototype._shift = function() { + var entry, i, layer, ref; + this.trigger('before:shift'); + entry = this._queue.shift(); + ref = this.data; + for (i in ref) { + if (!hasProp.call(ref, i)) continue; + layer = ref[i]; + layer.values.push(entry[i]); + } + this._updateTicks(entry[0].time); + this._transitionRangeAxes(); + return this.trigger('after:shift'); + }; + + Plot.prototype._transitionRangeAxes = function() { + if (this.hasAxis('left')) { + this.svg.selectAll('.y.axis.left').transition().duration(500).ease('linear').call(this.leftAxis()); + } + if (this.hasAxis('right')) { + return this.svg.selectAll('.y.axis.right').transition().duration(500).ease('linear').call(this.rightAxis()); + } + }; + + Plot.prototype._animate = function() { + if (!this.inTransition()) { + return; + } + if (++this.animation.frame === this.animation.duration) { + this._stopTransition(); + } + this.draw(this.animation.frame * this.animation.delta()); + return this._updateTimeAxes(); + }; + + Plot.prototype.y = function(givenDomain) { + return d3.scale.linear().domain(this._getScaleDomain(givenDomain)).range([this.innerHeight(), 0]); + }; + + Plot.prototype.ySvg = function(givenDomain) { + return d3.scale.linear().domain(this._getScaleDomain(givenDomain)).range([this.innerHeight() / this.pixelRatio, 0]); + }; + + Plot.prototype.ySvgLeft = function() { + if (this.options.range != null) { + return this.ySvg(this.options.range.left); + } else { + return this.ySvg(); + } + }; + + Plot.prototype.ySvgRight = function() { + if (this.options.range != null) { + return this.ySvg(this.options.range.right); + } else { + return this.ySvg(); + } + }; + + Plot.prototype.w = function() { + return this.innerWidth() / this.options.windowSize; + }; + + Plot.prototype._updateTicks = function(newTime) { + if (!(this.hasAxis('top') || this.hasAxis('bottom'))) { + return; + } + if (!((++this._tickTimer) % this.options.ticks.time)) { + this._pushTick(this.options.windowSize, newTime, true); + } + if (!(this._ticks.length > 0)) { + return; + } + if (!(this._ticks[0].x - (this.w() / this.pixelRatio) >= 0)) { + return this._ticks[0].exit = true; + } + }; + + Plot.prototype._pushTick = function(bucket, time, enter, reverse) { + var g, tick; + if (enter == null) { + enter = false; + } + if (reverse == null) { + reverse = false; + } + if (!(this.hasAxis('top') || this.hasAxis('bottom'))) { + return; + } + tick = { + time: time, + x: bucket * (this.w() / this.pixelRatio) + this._offsetX(), + opacity: enter ? 0 : 1, + enter: enter ? true : false, + exit: false + }; + if (this.hasAxis('bottom')) { + g = this.bottomAxis.append('g').attr('class', 'tick major').attr('transform', "translate(" + (tick.x + 1) + ",0)").style('opacity', tick.opacity); + g.append('line').attr('y2', 6); + g.append('text').attr('text-anchor', 'middle').attr('dy', 19).text(this.options.tickFormats.bottom(tick.time)); + tick.bottomEl = g; + } + if (this.hasAxis('top')) { + g = this.topAxis.append('g').attr('class', 'tick major').attr('transform', "translate(" + (tick.x + 1) + ",0)").style('opacity', tick.opacity); + g.append('line').attr('y2', -6); + g.append('text').attr('text-anchor', 'middle').attr('dy', -10).text(this.options.tickFormats.top(tick.time)); + tick.topEl = g; + } + if (reverse) { + this._ticks.unshift(tick); + } else { + this._ticks.push(tick); + } + return tick; + }; + + Plot.prototype._shiftTick = function() { + var tick; + if (!(this._ticks.length > 0)) { + return; + } + tick = this._ticks.shift(); + if (tick.topEl != null) { + tick.topEl.remove(); + } + if (tick.bottomEl != null) { + return tick.bottomEl.remove(); + } + }; + + Plot.prototype._updateTimeAxes = function() { + var dop, dx, l, len, ref, ref1, results, tick; + if (!(this.hasAxis('top') || this.hasAxis('bottom'))) { + return; + } + ref = [this.animation.tickDelta(), 1 / this.options.fps], dx = ref[0], dop = ref[1]; + ref1 = this._ticks; + results = []; + for (l = 0, len = ref1.length; l < len; l++) { + tick = ref1[l]; + tick.x += dx; + if (this.hasAxis('bottom')) { + tick.bottomEl.attr('transform', "translate(" + (tick.x + 1) + ",0)"); + } + if (this.hasAxis('top')) { + tick.topEl.attr('transform', "translate(" + (tick.x + 1) + ",0)"); + } + if (tick.enter) { + tick.opacity += dop; + } else if (tick.exit) { + tick.opacity -= dop; + } + if (tick.enter || tick.exit) { + if (this.hasAxis('bottom')) { + tick.bottomEl.style('opacity', tick.opacity); + } + if (this.hasAxis('top')) { + results.push(tick.topEl.style('opacity', tick.opacity)); + } else { + results.push(void 0); + } + } else { + results.push(void 0); + } + } + return results; + }; + + Plot.prototype.draw = function(delta) { + if (delta == null) { + delta = 0; + } + return Plot.__super__.draw.call(this); + }; + + Plot.prototype.dimensionsChanged = function() { + Plot.__super__.dimensionsChanged.call(this); + this.svg.attr('width', this.width).attr('height', this.height); + this._sizeCanvas(); + this._buildAxes(); + return this.draw(this.animation.frame * this.animation.delta()); + }; + + Plot.prototype.axesChanged = function() { + var l, len, pos, ref; + ref = ['top', 'right', 'bottom', 'left']; + for (l = 0, len = ref.length; l < len; l++) { + pos = ref[l]; + if ((this.options.margins != null) && (this.options.margins[pos] != null)) { + continue; + } + if (this.hasAxis(pos)) { + this.margins[pos] = defaultAxisMargins[pos]; + } else { + this.margins[pos] = 6; + } + } + this._sizeCanvas(); + this._buildAxes(); + return this.draw(this.animation.frame * this.animation.delta()); + }; + + Plot.prototype.ticksChanged = function() { + this._resetInitialTimeTicks(); + this._transitionRangeAxes(); + return this.draw(this.animation.frame * this.animation.delta()); + }; + + Plot.prototype.tickFormatsChanged = function() { + this._resetInitialTimeTicks(); + this._transitionRangeAxes(); + return this.draw(this.animation.frame * this.animation.delta()); + }; + + Plot.prototype.marginsChanged = function() { + var pos, ref, size; + if (this.options.margins == null) { + return; + } + ref = this.options.margins; + for (pos in ref) { + if (!hasProp.call(ref, pos)) continue; + size = ref[pos]; + if (size == null) { + this.margins[pos] = 6; + } else { + this.margins[pos] = size; + } + } + this._sizeCanvas(); + return this.draw(this.animation.frame * this.animation.delta()); + }; + + Plot.prototype.layerChanged = function() { + this._transitionRangeAxes(); + return Plot.__super__.layerChanged.call(this); + }; + + return Plot; + +})(Epoch.Chart.Canvas); + +Epoch.Time.Stack = (function(superClass) { + extend(Stack, superClass); + + function Stack() { + return Stack.__super__.constructor.apply(this, arguments); + } + + Stack.prototype._stackLayers = function() { + var i, l, layer, layers, ref, results, y0; + if (!((layers = this.getVisibleLayers()).length > 0)) { + return; + } + results = []; + for (i = l = 0, ref = layers[0].values.length; 0 <= ref ? l < ref : l > ref; i = 0 <= ref ? ++l : --l) { + y0 = 0; + results.push((function() { + var len, m, results1; + results1 = []; + for (m = 0, len = layers.length; m < len; m++) { + layer = layers[m]; + layer.values[i].y0 = y0; + results1.push(y0 += layer.values[i].y); + } + return results1; + })()); + } + return results; + }; + + Stack.prototype._prepareLayers = function(layers) { + var d, i, y0; + y0 = 0; + for (i in layers) { + if (!hasProp.call(layers, i)) continue; + d = layers[i]; + if (!this.data[i].visible) { + continue; + } + d.y0 = y0; + y0 += d.y; + } + return layers; + }; + + Stack.prototype.setData = function(data) { + Stack.__super__.setData.call(this, data); + return this._stackLayers(); + }; + + Stack.prototype.extent = function() { + var i, j, l, layers, m, max, ref, ref1, ref2, sum; + ref = [0, this.getVisibleLayers()], max = ref[0], layers = ref[1]; + if (!layers.length) { + return [0, 0]; + } + for (i = l = 0, ref1 = layers[0].values.length; 0 <= ref1 ? l < ref1 : l > ref1; i = 0 <= ref1 ? ++l : --l) { + sum = 0; + for (j = m = 0, ref2 = layers.length; 0 <= ref2 ? m < ref2 : m > ref2; j = 0 <= ref2 ? ++m : --m) { + sum += layers[j].values[i].y; + } + if (sum > max) { + max = sum; + } + } + return [0, max]; + }; + + Stack.prototype.layerChanged = function() { + var l, layers, len, ref; + this._stackLayers(); + ref = this._queue; + for (l = 0, len = ref.length; l < len; l++) { + layers = ref[l]; + this._prepareLayers(layers); + } + return Stack.__super__.layerChanged.call(this); + }; + + return Stack; + +})(Epoch.Time.Plot); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Time.Area = (function(superClass) { + extend(Area, superClass); + + function Area(options) { + var base; + this.options = options != null ? options : {}; + if ((base = this.options).type == null) { + base.type = 'time.area'; + } + Area.__super__.constructor.call(this, this.options); + this.draw(); + } + + Area.prototype.setStyles = function(layer) { + var styles; + if ((layer != null) && (layer.className != null)) { + styles = this.getStyles("g." + (layer.className.replace(/\s/g, '.')) + " path.area"); + } else { + styles = this.getStyles("g path.area"); + } + this.ctx.fillStyle = styles.fill; + if (styles.stroke != null) { + this.ctx.strokeStyle = styles.stroke; + } + if (styles['stroke-width'] != null) { + return this.ctx.lineWidth = styles['stroke-width'].replace('px', ''); + } + }; + + Area.prototype._drawAreas = function(delta) { + var args, borderX, entry, firstX, i, j, k, l, layer, layers, ref, ref1, ref2, results, trans, w, y; + if (delta == null) { + delta = 0; + } + ref = [this.y(), this.w(), this.getVisibleLayers()], y = ref[0], w = ref[1], layers = ref[2]; + results = []; + for (i = l = ref1 = layers.length - 1; ref1 <= 0 ? l <= 0 : l >= 0; i = ref1 <= 0 ? ++l : --l) { + if (!(layer = layers[i])) { + continue; + } + this.setStyles(layer); + this.ctx.beginPath(); + ref2 = [this.options.windowSize, layer.values.length, this.inTransition()], j = ref2[0], k = ref2[1], trans = ref2[2]; + firstX = null; + while ((--j >= -2) && (--k >= 0)) { + entry = layer.values[k]; + args = [(j + 1) * w + delta, y(entry.y + entry.y0)]; + if (trans) { + args[0] += w; + } + if (i === this.options.windowSize - 1) { + this.ctx.moveTo.apply(this.ctx, args); + } else { + this.ctx.lineTo.apply(this.ctx, args); + } + } + if (trans) { + borderX = (j + 3) * w + delta; + } else { + borderX = (j + 2) * w + delta; + } + this.ctx.lineTo(borderX, this.innerHeight()); + this.ctx.lineTo(this.width * this.pixelRatio + w + delta, this.innerHeight()); + this.ctx.closePath(); + results.push(this.ctx.fill()); + } + return results; + }; + + Area.prototype._drawStrokes = function(delta) { + var args, entry, firstX, i, k, l, layer, layers, ref, ref1, ref2, results, trans, w, y; + if (delta == null) { + delta = 0; + } + ref = [this.y(), this.w(), this.getVisibleLayers()], y = ref[0], w = ref[1], layers = ref[2]; + results = []; + for (i = l = ref1 = layers.length - 1; ref1 <= 0 ? l <= 0 : l >= 0; i = ref1 <= 0 ? ++l : --l) { + if (!(layer = layers[i])) { + continue; + } + this.setStyles(layer); + this.ctx.beginPath(); + ref2 = [this.options.windowSize, layer.values.length, this.inTransition()], i = ref2[0], k = ref2[1], trans = ref2[2]; + firstX = null; + while ((--i >= -2) && (--k >= 0)) { + entry = layer.values[k]; + args = [(i + 1) * w + delta, y(entry.y + entry.y0)]; + if (trans) { + args[0] += w; + } + if (i === this.options.windowSize - 1) { + this.ctx.moveTo.apply(this.ctx, args); + } else { + this.ctx.lineTo.apply(this.ctx, args); + } + } + results.push(this.ctx.stroke()); + } + return results; + }; + + Area.prototype.draw = function(delta) { + if (delta == null) { + delta = 0; + } + this.clear(); + this._drawAreas(delta); + this._drawStrokes(delta); + return Area.__super__.draw.call(this); + }; + + return Area; + +})(Epoch.Time.Stack); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Time.Bar = (function(superClass) { + extend(Bar, superClass); + + function Bar(options) { + var base; + this.options = options != null ? options : {}; + if ((base = this.options).type == null) { + base.type = 'time.bar'; + } + Bar.__super__.constructor.call(this, this.options); + this.draw(); + } + + Bar.prototype._offsetX = function() { + return 0.5 * this.w() / this.pixelRatio; + }; + + Bar.prototype.setStyles = function(className) { + var styles; + styles = this.getStyles("rect.bar." + (className.replace(/\s/g, '.'))); + this.ctx.fillStyle = styles.fill; + if ((styles.stroke == null) || styles.stroke === 'none') { + this.ctx.strokeStyle = 'transparent'; + } else { + this.ctx.strokeStyle = styles.stroke; + } + if (styles['stroke-width'] != null) { + return this.ctx.lineWidth = styles['stroke-width'].replace('px', ''); + } + }; + + Bar.prototype.draw = function(delta) { + var args, entry, ex, ey, ey0, i, iBoundry, j, k, layer, len, ref, ref1, ref2, ref3, trans, w, y; + if (delta == null) { + delta = 0; + } + this.clear(); + ref = [this.y(), this.w()], y = ref[0], w = ref[1]; + ref1 = this.getVisibleLayers(); + for (j = 0, len = ref1.length; j < len; j++) { + layer = ref1[j]; + if (!Epoch.isNonEmptyArray(layer.values)) { + continue; + } + this.setStyles(layer.className); + ref2 = [this.options.windowSize, layer.values.length, this.inTransition()], i = ref2[0], k = ref2[1], trans = ref2[2]; + iBoundry = trans ? -1 : 0; + while ((--i >= iBoundry) && (--k >= 0)) { + entry = layer.values[k]; + ref3 = [i * w + delta, entry.y, entry.y0], ex = ref3[0], ey = ref3[1], ey0 = ref3[2]; + if (trans) { + ex += w; + } + args = [ex + 1, y(ey + ey0), w - 2, this.innerHeight() - y(ey) + 0.5 * this.pixelRatio]; + this.ctx.fillRect.apply(this.ctx, args); + this.ctx.strokeRect.apply(this.ctx, args); + } + } + return Bar.__super__.draw.call(this); + }; + + return Bar; + +})(Epoch.Time.Stack); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Time.Gauge = (function(superClass) { + var defaults, optionListeners; + + extend(Gauge, superClass); + + defaults = { + type: 'time.gauge', + domain: [0, 1], + ticks: 10, + tickSize: 5, + tickOffset: 5, + fps: 34, + format: Epoch.Formats.percent + }; + + optionListeners = { + 'option:domain': 'domainChanged', + 'option:ticks': 'ticksChanged', + 'option:tickSize': 'tickSizeChanged', + 'option:tickOffset': 'tickOffsetChanged', + 'option:format': 'formatChanged' + }; + + function Gauge(options) { + this.options = options != null ? options : {}; + Gauge.__super__.constructor.call(this, this.options = Epoch.Util.defaults(this.options, defaults)); + this.value = this.options.value || 0; + if (this.options.model) { + this.options.model.on('data:push', (function(_this) { + return function() { + return _this.pushFromModel(); + }; + })(this)); + } + if (this.el.style('position') !== 'absolute' && this.el.style('position') !== 'relative') { + this.el.style('position', 'relative'); + } + this.svg = this.el.insert('svg', ':first-child').attr('width', this.width).attr('height', this.height).attr('class', 'gauge-labels'); + this.svg.style({ + 'position': 'absolute', + 'z-index': '1' + }); + this.svg.append('g').attr('transform', "translate(" + (this.textX()) + ", " + (this.textY()) + ")").append('text').attr('class', 'value').text(this.options.format(this.value)); + this.animation = { + interval: null, + active: false, + delta: 0, + target: 0 + }; + this._animate = (function(_this) { + return function() { + if (Math.abs(_this.animation.target - _this.value) < Math.abs(_this.animation.delta)) { + _this.value = _this.animation.target; + clearInterval(_this.animation.interval); + _this.animation.active = false; + } else { + _this.value += _this.animation.delta; + } + _this.svg.select('text.value').text(_this.options.format(_this.value)); + return _this.draw(); + }; + })(this); + this.onAll(optionListeners); + this.draw(); + } + + Gauge.prototype.update = function(value) { + this.animation.target = value; + this.animation.delta = (value - this.value) / this.options.fps; + if (!this.animation.active) { + this.animation.interval = setInterval(this._animate, 1000 / this.options.fps); + return this.animation.active = true; + } + }; + + Gauge.prototype.push = function(value) { + return this.update(value); + }; + + Gauge.prototype.pushFromModel = function() { + var next; + next = this.options.model.getNext(this.options.type, this.options.dataFormat); + return this.update(next); + }; + + Gauge.prototype.radius = function() { + return this.getHeight() / 1.58; + }; + + Gauge.prototype.centerX = function() { + return this.getWidth() / 2; + }; + + Gauge.prototype.centerY = function() { + return 0.68 * this.getHeight(); + }; + + Gauge.prototype.textX = function() { + return this.width / 2; + }; + + Gauge.prototype.textY = function() { + return 0.48 * this.height; + }; + + Gauge.prototype.getAngle = function(value) { + var a, b, ref; + ref = this.options.domain, a = ref[0], b = ref[1]; + return ((value - a) / (b - a)) * (Math.PI + 2 * Math.PI / 8) - Math.PI / 2 - Math.PI / 8; + }; + + Gauge.prototype.setStyles = function(selector) { + var styles; + styles = this.getStyles(selector); + this.ctx.fillStyle = styles.fill; + this.ctx.strokeStyle = styles.stroke; + if (styles['stroke-width'] != null) { + return this.ctx.lineWidth = styles['stroke-width'].replace('px', ''); + } + }; + + Gauge.prototype.draw = function() { + var a, c, cx, cy, i, j, r, ref, ref1, ref2, ref3, s, t, tickOffset, tickSize, x1, x2, y1, y2; + ref = [this.centerX(), this.centerY(), this.radius()], cx = ref[0], cy = ref[1], r = ref[2]; + ref1 = [this.options.tickOffset, this.options.tickSize], tickOffset = ref1[0], tickSize = ref1[1]; + this.clear(); + t = d3.scale.linear().domain([0, this.options.ticks]).range([-(9 / 8) * Math.PI, Math.PI / 8]); + this.setStyles('.epoch .gauge .tick'); + this.ctx.beginPath(); + for (i = j = 0, ref2 = this.options.ticks; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) { + a = t(i); + ref3 = [Math.cos(a), Math.sin(a)], c = ref3[0], s = ref3[1]; + x1 = c * (r - tickOffset) + cx; + y1 = s * (r - tickOffset) + cy; + x2 = c * (r - tickOffset - tickSize) + cx; + y2 = s * (r - tickOffset - tickSize) + cy; + this.ctx.moveTo(x1, y1); + this.ctx.lineTo(x2, y2); + } + this.ctx.stroke(); + this.setStyles('.epoch .gauge .arc.outer'); + this.ctx.beginPath(); + this.ctx.arc(cx, cy, r, -(9 / 8) * Math.PI, (1 / 8) * Math.PI, false); + this.ctx.stroke(); + this.setStyles('.epoch .gauge .arc.inner'); + this.ctx.beginPath(); + this.ctx.arc(cx, cy, r - 10, -(9 / 8) * Math.PI, (1 / 8) * Math.PI, false); + this.ctx.stroke(); + this.drawNeedle(); + return Gauge.__super__.draw.call(this); + }; + + Gauge.prototype.drawNeedle = function() { + var cx, cy, r, ratio, ref; + ref = [this.centerX(), this.centerY(), this.radius()], cx = ref[0], cy = ref[1], r = ref[2]; + ratio = this.value / this.options.domain[1]; + this.setStyles('.epoch .gauge .needle'); + this.ctx.beginPath(); + this.ctx.save(); + this.ctx.translate(cx, cy); + this.ctx.rotate(this.getAngle(this.value)); + this.ctx.moveTo(4 * this.pixelRatio, 0); + this.ctx.lineTo(-4 * this.pixelRatio, 0); + this.ctx.lineTo(-1 * this.pixelRatio, 19 - r); + this.ctx.lineTo(1, 19 - r); + this.ctx.fill(); + this.setStyles('.epoch .gauge .needle-base'); + this.ctx.beginPath(); + this.ctx.arc(0, 0, this.getWidth() / 25, 0, 2 * Math.PI); + this.ctx.fill(); + return this.ctx.restore(); + }; + + Gauge.prototype.domainChanged = function() { + return this.draw(); + }; + + Gauge.prototype.ticksChanged = function() { + return this.draw(); + }; + + Gauge.prototype.tickSizeChanged = function() { + return this.draw(); + }; + + Gauge.prototype.tickOffsetChanged = function() { + return this.draw(); + }; + + Gauge.prototype.formatChanged = function() { + return this.svg.select('text.value').text(this.options.format(this.value)); + }; + + return Gauge; + +})(Epoch.Chart.Canvas); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Time.Heatmap = (function(superClass) { + var colorFunctions, defaults, optionListeners; + + extend(Heatmap, superClass); + + defaults = { + type: 'time.heatmap', + buckets: 10, + bucketRange: [0, 100], + opacity: 'linear', + bucketPadding: 2, + paintZeroValues: false, + cutOutliers: false + }; + + colorFunctions = { + root: function(value, max) { + return Math.pow(value / max, 0.5); + }, + linear: function(value, max) { + return value / max; + }, + quadratic: function(value, max) { + return Math.pow(value / max, 2); + }, + cubic: function(value, max) { + return Math.pow(value / max, 3); + }, + quartic: function(value, max) { + return Math.pow(value / max, 4); + }, + quintic: function(value, max) { + return Math.pow(value / max, 5); + } + }; + + optionListeners = { + 'option:buckets': 'bucketsChanged', + 'option:bucketRange': 'bucketRangeChanged', + 'option:opacity': 'opacityChanged', + 'option:bucketPadding': 'bucketPaddingChanged', + 'option:paintZeroValues': 'paintZeroValuesChanged', + 'option:cutOutliers': 'cutOutliersChanged' + }; + + function Heatmap(options) { + this.options = options != null ? options : {}; + Heatmap.__super__.constructor.call(this, this.options = Epoch.Util.defaults(this.options, defaults)); + this._setOpacityFunction(); + this._setupPaintCanvas(); + this.onAll(optionListeners); + this.draw(); + } + + Heatmap.prototype._setOpacityFunction = function() { + if (Epoch.isString(this.options.opacity)) { + this._opacityFn = colorFunctions[this.options.opacity]; + if (this._opacityFn == null) { + return Epoch.exception("Unknown coloring function provided '" + this.options.opacity + "'"); + } + } else if (Epoch.isFunction(this.options.opacity)) { + return this._opacityFn = this.options.opacity; + } else { + return Epoch.exception("Unknown type for provided coloring function."); + } + }; + + Heatmap.prototype.setData = function(data) { + var k, layer, len, ref, results; + Heatmap.__super__.setData.call(this, data); + ref = this.data; + results = []; + for (k = 0, len = ref.length; k < len; k++) { + layer = ref[k]; + results.push(layer.values = layer.values.map((function(_this) { + return function(entry) { + return _this._prepareEntry(entry); + }; + })(this))); + } + return results; + }; + + Heatmap.prototype._getBuckets = function(entry) { + var bucketSize, count, i, index, k, prepared, ref, ref1, value; + prepared = { + time: entry.time, + max: 0, + buckets: (function() { + var k, ref, results; + results = []; + for (i = k = 0, ref = this.options.buckets; 0 <= ref ? k < ref : k > ref; i = 0 <= ref ? ++k : --k) { + results.push(0); + } + return results; + }).call(this) + }; + bucketSize = (this.options.bucketRange[1] - this.options.bucketRange[0]) / this.options.buckets; + ref = entry.histogram; + for (value in ref) { + if (!hasProp.call(ref, value)) continue; + count = ref[value]; + index = parseInt((value - this.options.bucketRange[0]) / bucketSize); + if (this.options.cutOutliers && ((index < 0) || (index >= this.options.buckets))) { + continue; + } + if (index < 0) { + index = 0; + } else if (index >= this.options.buckets) { + index = this.options.buckets - 1; + } + prepared.buckets[index] += parseInt(count); + } + for (i = k = 0, ref1 = prepared.buckets.length; 0 <= ref1 ? k < ref1 : k > ref1; i = 0 <= ref1 ? ++k : --k) { + prepared.max = Math.max(prepared.max, prepared.buckets[i]); + } + return prepared; + }; + + Heatmap.prototype.y = function() { + return d3.scale.linear().domain(this.options.bucketRange).range([this.innerHeight(), 0]); + }; + + Heatmap.prototype.ySvg = function() { + return d3.scale.linear().domain(this.options.bucketRange).range([this.innerHeight() / this.pixelRatio, 0]); + }; + + Heatmap.prototype.h = function() { + return this.innerHeight() / this.options.buckets; + }; + + Heatmap.prototype._offsetX = function() { + return 0.5 * this.w() / this.pixelRatio; + }; + + Heatmap.prototype._setupPaintCanvas = function() { + this.paintWidth = (this.options.windowSize + 1) * this.w(); + this.paintHeight = this.height * this.pixelRatio; + this.paint = document.createElement('CANVAS'); + this.paint.width = this.paintWidth; + this.paint.height = this.paintHeight; + this.p = Epoch.Util.getContext(this.paint); + this.redraw(); + this.on('after:shift', '_paintEntry'); + this.on('transition:end', '_shiftPaintCanvas'); + return this.on('transition:end', (function(_this) { + return function() { + return _this.draw(_this.animation.frame * _this.animation.delta()); + }; + })(this)); + }; + + Heatmap.prototype.redraw = function() { + var drawColumn, entryIndex; + if (!(Epoch.isNonEmptyArray(this.data) && Epoch.isNonEmptyArray(this.data[0].values))) { + return; + } + entryIndex = this.data[0].values.length; + drawColumn = this.options.windowSize; + if (this.inTransition()) { + drawColumn++; + } + while ((--entryIndex >= 0) && (--drawColumn >= 0)) { + this._paintEntry(entryIndex, drawColumn); + } + return this.draw(this.animation.frame * this.animation.delta()); + }; + + Heatmap.prototype._computeColor = function(value, max, color) { + return Epoch.Util.toRGBA(color, this._opacityFn(value, max)); + }; + + Heatmap.prototype._paintEntry = function(entryIndex, drawColumn) { + var bucket, bucketTotals, color, count, entries, entry, h, i, j, k, layer, len, len1, m, max, maxTotal, ref, ref1, ref2, results, styles, sum, w, xPos; + if (entryIndex == null) { + entryIndex = null; + } + if (drawColumn == null) { + drawColumn = null; + } + ref = [this.w(), this.h()], w = ref[0], h = ref[1]; + if (entryIndex == null) { + entryIndex = this.data[0].values.length - 1; + } + if (drawColumn == null) { + drawColumn = this.options.windowSize; + } + entries = []; + bucketTotals = (function() { + var k, ref1, results; + results = []; + for (i = k = 0, ref1 = this.options.buckets; 0 <= ref1 ? k < ref1 : k > ref1; i = 0 <= ref1 ? ++k : --k) { + results.push(0); + } + return results; + }).call(this); + maxTotal = 0; + ref1 = this.getVisibleLayers(); + for (k = 0, len = ref1.length; k < len; k++) { + layer = ref1[k]; + entry = this._getBuckets(layer.values[entryIndex]); + ref2 = entry.buckets; + for (bucket in ref2) { + if (!hasProp.call(ref2, bucket)) continue; + count = ref2[bucket]; + bucketTotals[bucket] += count; + } + maxTotal += entry.max; + styles = this.getStyles("." + (layer.className.split(' ').join('.')) + " rect.bucket"); + entry.color = styles.fill; + entries.push(entry); + } + xPos = drawColumn * w; + this.p.clearRect(xPos, 0, w, this.paintHeight); + j = this.options.buckets; + results = []; + for (bucket in bucketTotals) { + if (!hasProp.call(bucketTotals, bucket)) continue; + sum = bucketTotals[bucket]; + color = this._avgLab(entries, bucket); + max = 0; + for (m = 0, len1 = entries.length; m < len1; m++) { + entry = entries[m]; + max += (entry.buckets[bucket] / sum) * maxTotal; + } + if (sum > 0 || this.options.paintZeroValues) { + this.p.fillStyle = this._computeColor(sum, max, color); + this.p.fillRect(xPos, (j - 1) * h, w - this.options.bucketPadding, h - this.options.bucketPadding); + } + results.push(j--); + } + return results; + }; + + Heatmap.prototype._shiftPaintCanvas = function() { + var data; + data = this.p.getImageData(this.w(), 0, this.paintWidth - this.w(), this.paintHeight); + return this.p.putImageData(data, 0, 0); + }; + + Heatmap.prototype._avgLab = function(entries, bucket) { + var a, b, color, entry, i, k, l, len, ratio, ref, total, value; + ref = [0, 0, 0, 0], l = ref[0], a = ref[1], b = ref[2], total = ref[3]; + for (k = 0, len = entries.length; k < len; k++) { + entry = entries[k]; + if (entry.buckets[bucket] == null) { + continue; + } + total += entry.buckets[bucket]; + } + for (i in entries) { + if (!hasProp.call(entries, i)) continue; + entry = entries[i]; + if (entry.buckets[bucket] != null) { + value = entry.buckets[bucket] | 0; + } else { + value = 0; + } + ratio = value / total; + color = d3.lab(entry.color); + l += ratio * color.l; + a += ratio * color.a; + b += ratio * color.b; + } + return d3.lab(l, a, b).toString(); + }; + + Heatmap.prototype.draw = function(delta) { + if (delta == null) { + delta = 0; + } + this.clear(); + this.ctx.drawImage(this.paint, delta, 0); + return Heatmap.__super__.draw.call(this); + }; + + Heatmap.prototype.bucketsChanged = function() { + return this.redraw(); + }; + + Heatmap.prototype.bucketRangeChanged = function() { + this._transitionRangeAxes(); + return this.redraw(); + }; + + Heatmap.prototype.opacityChanged = function() { + this._setOpacityFunction(); + return this.redraw(); + }; + + Heatmap.prototype.bucketPaddingChanged = function() { + return this.redraw(); + }; + + Heatmap.prototype.paintZeroValuesChanged = function() { + return this.redraw(); + }; + + Heatmap.prototype.cutOutliersChanged = function() { + return this.redraw(); + }; + + Heatmap.prototype.layerChanged = function() { + return this.redraw(); + }; + + return Heatmap; + +})(Epoch.Time.Plot); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Time.Line = (function(superClass) { + extend(Line, superClass); + + function Line(options) { + var base; + this.options = options != null ? options : {}; + if ((base = this.options).type == null) { + base.type = 'time.line'; + } + Line.__super__.constructor.call(this, this.options); + this.draw(); + } + + Line.prototype.setStyles = function(className) { + var styles; + styles = this.getStyles("g." + (className.replace(/\s/g, '.')) + " path.line"); + this.ctx.fillStyle = styles.fill; + this.ctx.strokeStyle = styles.stroke; + return this.ctx.lineWidth = this.pixelRatio * styles['stroke-width'].replace('px', ''); + }; + + Line.prototype.draw = function(delta) { + var args, entry, i, j, k, layer, len, ref, ref1, trans, w, y; + if (delta == null) { + delta = 0; + } + this.clear(); + w = this.w(); + ref = this.getVisibleLayers(); + for (j = 0, len = ref.length; j < len; j++) { + layer = ref[j]; + if (!Epoch.isNonEmptyArray(layer.values)) { + continue; + } + this.setStyles(layer.className); + this.ctx.beginPath(); + y = this.y(layer.range); + ref1 = [this.options.windowSize, layer.values.length, this.inTransition()], i = ref1[0], k = ref1[1], trans = ref1[2]; + while ((--i >= -2) && (--k >= 0)) { + entry = layer.values[k]; + args = [(i + 1) * w + delta, y(entry.y)]; + if (trans) { + args[0] += w; + } + if (i === this.options.windowSize - 1) { + this.ctx.moveTo.apply(this.ctx, args); + } else { + this.ctx.lineTo.apply(this.ctx, args); + } + } + this.ctx.stroke(); + } + return Line.__super__.draw.call(this); + }; + + return Line; + +})(Epoch.Time.Plot); + +Epoch._typeMap = { + 'area': Epoch.Chart.Area, + 'bar': Epoch.Chart.Bar, + 'line': Epoch.Chart.Line, + 'pie': Epoch.Chart.Pie, + 'scatter': Epoch.Chart.Scatter, + 'histogram': Epoch.Chart.Histogram, + 'time.area': Epoch.Time.Area, + 'time.bar': Epoch.Time.Bar, + 'time.line': Epoch.Time.Line, + 'time.gauge': Epoch.Time.Gauge, + 'time.heatmap': Epoch.Time.Heatmap +}; + +var jQueryModule; + +jQueryModule = function($) { + var DATA_NAME; + DATA_NAME = 'epoch-chart'; + return $.fn.epoch = function(options) { + var chart, klass; + options.el = this.get(0); + if ((chart = this.data(DATA_NAME)) == null) { + klass = Epoch._typeMap[options.type]; + if (klass == null) { + Epoch.exception("Unknown chart type '" + options.type + "'"); + } + this.data(DATA_NAME, (chart = new klass(options))); + } + return chart; + }; +}; + +if (window.jQuery != null) { + jQueryModule(jQuery); +} + +var MooToolsModule; + +MooToolsModule = function() { + var DATA_NAME; + DATA_NAME = 'epoch-chart'; + return Element.implement('epoch', function(options) { + var chart, klass, self; + self = $$(this); + if ((chart = self.retrieve(DATA_NAME)[0]) == null) { + options.el = this; + klass = Epoch._typeMap[options.type]; + if (klass == null) { + Epoch.exception("Unknown chart type '" + options.type + "'"); + } + self.store(DATA_NAME, (chart = new klass(options))); + } + return chart; + }); +}; + +if (window.MooTools != null) { + MooToolsModule(); +} + +var zeptoModule; + +zeptoModule = function($) { + var DATA_NAME, chartId, chartMap, next_cid; + DATA_NAME = 'epoch-chart'; + chartMap = {}; + chartId = 0; + next_cid = function() { + return DATA_NAME + "-" + (++chartId); + }; + return $.extend($.fn, { + epoch: function(options) { + var chart, cid, klass; + if ((cid = this.data(DATA_NAME)) != null) { + return chartMap[cid]; + } + options.el = this.get(0); + klass = Epoch._typeMap[options.type]; + if (klass == null) { + Epoch.exception("Unknown chart type '" + options.type + "'"); + } + this.data(DATA_NAME, (cid = next_cid())); + chart = new klass(options); + chartMap[cid] = chart; + return chart; + } + }); +}; + +if (window.Zepto != null) { + zeptoModule(Zepto); +} diff --git a/debian/missing-sources/epoch/.travis.yml b/debian/missing-sources/epoch/.travis.yml new file mode 100644 index 0000000..c3bbff7 --- /dev/null +++ b/debian/missing-sources/epoch/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "4.1.1" +sudo: false diff --git a/debian/missing-sources/epoch/CHANGELOG.md b/debian/missing-sources/epoch/CHANGELOG.md new file mode 100644 index 0000000..0492850 --- /dev/null +++ b/debian/missing-sources/epoch/CHANGELOG.md @@ -0,0 +1,102 @@ +# Epoch Changelog + +## 0.8.4 - October 30th, 2015 +### Bug Fixes +* Fixed bower css path (@ftaiolivista) + +## 0.8.3 - October 17th, 2015 +### Enhancements / Features +* Added `redraw` method for clearing styles on canvas based charts (#196, @woozyking) + +## 0.8.2 - October 13th, 2015 +### Enhancements / Features +* Charts now auto draw on construction (#195) + +## 0.8.1 - October 13th, 2015 +### Enhancements / Features +* Added packagist/composer package manager support (#202) + +### Bug Fixes +* Real-time charts no-longer error when pushing first data point after initialized + with empty data layers. (#203) + +## 0.8.0 - October 10th, 2015 +### Enhancements / Features +* Multi-axis support for basic and real-time line plots +* Added new gulp build-system (for development) + +## 0.7.1 - October 4th, 2015 +* Moved minified source to `dist/js` and `dist/css` respectively +* Added non-minified source to aforementioned directories + +## 0.7.0 - October 4th, 2015 + +### Enhancements / Features +* New basic chart: Histogram +* New Feature: Data formatters +* Chart layers can now be hidden/shown + +### Bug Fixes +* Ticks now working for ordinal scaled bar charts +* Fixed CSS builds by updating NPM sass-node package +* Removed versions from minified release files (@RyanNielson) +* Time based graphs can now have fixed ranges (@willwhitney) +* NPM Package: epoch-charting (@sompylasar) +* Right axes now using correct formatters (@Dav1dde) +* Add 'main' attribute enabling webpack support. (@WRidder) +* Fixed Bower D3 Dependencies (@loopj) +* Fixed CSS errors by using `transparent` instead of `none` (@mwsmith2) +* Fixed bower "version" property (@kkirsche) + +## 0.6.0 - July 21st, 2014 + +### Enhancements / Features + +* Source code restructure for easier programming +* Replaced Compass with node-sass +* Removed put.js from the repository +* Removed dependency on jQuery +* Added CSS controlled themes + * New "Dark" theme for dark backgrounds +* Registered with bower +* Added option accessor / mutator to all charts (making them adaptive) +* Added bubble charts (special case of scatter plots) +* Added MooTools and Zepto Adapters +* Added Core Library Unit Testing +* New `domain` and `range` options for basic charts + +### Bug Fixes + +* Event `.off` method was completely busted, fixed +* Swapped terminology for horizontal and vertical bar plots +* Removed `isVisible` and related rendering hacks (caused all sorts of woe) + + +## 0.5.2 - June 24th, 2014 + +### Enhancements / Features + +* #36 - Fixed the readme to focus on development +* #54 - Added vertical orientation option to the basic bar chart + +## 0.5.1 - June 23rd, 2014 + +### Bug Fixes + +* #52 - Replaced instances of `$` with `jQuery` (ambiguous, otherwise) + +## 0.5.0 - June 23rd, 2014 + +### Enhancements / Features + +* #32 - QueryCSS greatly enhanced - now builds a full DOM context when computing styles +* #42 - Heat map now allows for painting of "zero" values via a new `paintZeroValues` option +* #43 - Heat map color computation abstracted out of `_paintEntry` (makes it easier to extend) + +### Bug Fixes + +* #22 - Fixed an issue with pie chart transitions +* #30 - Layers without labels now correctly render on a various basic charts +* #31 - Real-time Line Chart thickness fixed by taking pixel ratio into account +* #41 - Fixed bucketing issues with the Heat Map +* #46 - Removed default black stroke from the Real-Time Area chart diff --git a/debian/missing-sources/epoch/LICENSE b/debian/missing-sources/epoch/LICENSE new file mode 100644 index 0000000..3e8d8f8 --- /dev/null +++ b/debian/missing-sources/epoch/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Fastly, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/debian/missing-sources/epoch/README.md b/debian/missing-sources/epoch/README.md new file mode 100644 index 0000000..5095f3a --- /dev/null +++ b/debian/missing-sources/epoch/README.md @@ -0,0 +1,135 @@ +## Epoch +By Ryan Sandor Richards + +[![Build Status](https://travis-ci.org/epochjs/epoch.svg?branch=master)](https://travis-ci.org/epochjs/epoch) +[![Dependency Status](https://david-dm.org/epochjs/epoch.svg)](https://david-dm.org/epochjs/epoch) +[![devDependency Status](https://david-dm.org/epochjs/epoch/dev-status.svg)](https://david-dm.org/epochjs/epoch#info=devDependencies) + +Epoch is a general purpose charting library for application developers and visualization designers. It focuses on two different aspects of visualization programming: **basic charts** for creating historical reports, and **real-time charts** for displaying frequently updating timeseries data. + +To get started using Epoch, please refer to the [Epoch Project Site](http://epochjs.github.io/epoch/). There you can find full documentation and guides to help you start using Epoch right away. + +### Installation +Epoch can be easily installed via the following package managers: + +* [npm](https://www.npmjs.com/package/epoch-charting) +* [bower](http://bower.io/search/?q=epoch) +* [packagist](https://packagist.org/packages/epochjs/epoch) + +If you don't see your favorite package manager in the list above feel free to +[open up an issue](https://github.com/epochjs/epoch/issues/new) and let us know. +Finally, you can download any release of the library from the +[project releases page](https://github.com/epochjs/epoch/releases). + +**Important:** Epoch requires [d3](https://github.com/mbostock/d3). In order to +work properly your page must load d3 before epoch. + +#### Public CDN URLs +If you don't want to host the files yourself, you can use +[jsDelivr](http://www.jsdelivr.com/) to serve the files: + +1. Visit [epoch page on jsDelvr](http://www.jsdelivr.com/projects/epoch). +2. Copy the provided URL's and link to them in your project. + +### Developing Epoch + +Developing Epoch is a reasonably straight forward process. In this section we'll +cover the basic on how to develop Epoch by detailing common build task, exploring +how the source is arranged, and finally show how to use rendering tests to aid +development. + +#### Configuring Development Environment + +Epoch requires the following for development: + +1. [Node.js](https://nodejs.org/en/) (v4.1.1+) +2. [NPM](https://www.npmjs.com/) (v2.1.0+) + +Once both are installed on your machine you will need to run `npm install` from +the repository's root directory in order to install the npm packages required +to develop epoch. + +Once you have installed the required npm packages you can use `gulp build` to +fully rebuild the source (see more information about gulp tasks below). + + +#### Basic Development Process + +The best way to start contributing to Epoch is to follow these steps: + +1. Change to the source directory for the project +2. Run `gulp watch` to recompile the project after source files change +3. Make changes in a source file (either in `src/` or `sass/`) +4. In a web browser open the `test/index.html` and browse the rendering tests +5. Use the rendering tests to see if your changes had the desired result +6. Ensure unit tests with pass `npm test` + +#### Testing + +Epoch uses two types of testing to ensure that changes do not cause unintended +side effects. The first, unit tests, ensure that the core functional components +of the library work as expected. The second, rendering tests, allow you to +ensure that charts and graphs are correctly rendered. + +It is important to keep both unit test and rendering tests up-to-date! When +developing, use the following guidelines: + +* When adding new features make sure to add new tests +* When changing existing functionality, ensure that the appropriate both types + of tests still pass +* If you want to make a new type of chart, add a whole new test suite for that + chart! + +Keeping the tests current makes it easier for others to review your code and +spot issues. Also, pull requests without appropriate testing will not be +merged. + + +#### Gulp Tasks + +Epoch uses [gulp](https://github.com/gulpjs/gulp) to perform various tasks. The +`gulpfile.js` file defines the following tasks: + +* `gulp clean` - Cleans the `dist/` directory. +* `gulp build` - Builds the CoffeeScript and Sass source into the `dist/` + directory. +* `gulp watch` - Starts a watch script to recompile CoffeeScript and Sass when + any files change. + +#### Source Structure + +The directory structure for the Epoch project follows some basic guidelines, here's an overview of how it is structured: + +``` +dist/ - Compiled JavaScript and CSS source +src/ - Main source directory + core/ - Core Epoch Library Files + util.coffee - Library Utility Routines + d3.coffee - d3 Extensions + format.coffee - Data formatters + chart.coffee - Base Chart Classes + css.coffee - CSS Querying Engine + adapters/ - 3rd Party Library Adapters (currently only jQuery) + basic/ - Basic Chart Classes + time/ - Real-time Chart Classes + adapters.coffee - Options / Global Classes for Adapter Implementations + basic.coffee - Base Classes for Basic Charts + data.coffee - Data Formatting + epoch.coffee - Main source file, defines name spaces, etc. + model.coffee - Data Model + time.coffee - Base Classes for Real-Time Charts +sass/ - Scss source for the default epoch stylesheet +tests/ + render/ - Rendering tests + basic/ - Basic chart rendering tests + real-time/ - Real-time rendering tests + unit/ - Unit tests +``` + +### Release Checklist + +- Run `npm test` and ensure all tests pass +- Run `npm version [major|minor|patch]` +- Run `npm publish` +- Update CHANGELOG.md with the changes since last release +- Update the `gh-pages` branch's library version in `_config.yml` diff --git a/debian/missing-sources/epoch/bower.json b/debian/missing-sources/epoch/bower.json new file mode 100644 index 0000000..36ee8e6 --- /dev/null +++ b/debian/missing-sources/epoch/bower.json @@ -0,0 +1,37 @@ +{ + "name": "epoch", + "description": "A general purpose, real-time visualization library.", + "main": [ + "dist/js/epoch.min.js", + "dist/css/epoch.min.css" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "/src", + "/sass", + "/tests", + "/Cakefile", + "/CHANGELOG.md", + "/package.json" + ], + "authors": [ + "Ryan Sandor Richards " + ], + "keywords": [ + "fastly", + "realtime", + "graph", + "chart", + "stats", + "visualization" + ], + "homepage": "https://fastly.github.io/epoch/", + "repository": { + "type": "git", + "url": "git://github.com/fastly/epoch.git" + }, + "dependencies": { + "d3": "^3.4.13" + } +} diff --git a/debian/missing-sources/epoch/composer.json b/debian/missing-sources/epoch/composer.json new file mode 100644 index 0000000..184efe0 --- /dev/null +++ b/debian/missing-sources/epoch/composer.json @@ -0,0 +1,22 @@ +{ + "name": "epochjs/epoch", + "description": "A general purpose, real-time visualization library.", + "keywords": [ + "epoch", + "d3", + "chart", + "graph", + "plot", + "real-time" + ], + "homepage": "https://github.com/epochjs/epoch", + "license": "MIT", + "authors": [ + { + "name": "Ryan Sandor Richards" + } + ], + "require": { + "mbostock/d3": "@stable" + } +} diff --git a/debian/missing-sources/epoch/gulpfile.js b/debian/missing-sources/epoch/gulpfile.js new file mode 100644 index 0000000..4f3b975 --- /dev/null +++ b/debian/missing-sources/epoch/gulpfile.js @@ -0,0 +1,108 @@ +'use strict'; + +require('coffee-script/register'); // For coffee-script mocha unit tests + +var gulp = require('gulp'); +var coffee = require('gulp-coffee'); +var concat = require('gulp-concat'); +var mocha = require('gulp-mocha'); +var order = require('gulp-order'); +var rename = require('gulp-rename'); +var sass = require('gulp-sass'); +var uglify = require('gulp-uglify'); +var gutil = require('gulp-util'); +var del = require('del'); +var exec = require('child_process').exec; + +/** + * Common directories used by tasks below. + * @type {object} + */ +var path = { + source: { + coffee: 'src/', + sass: 'sass/' + }, + dist: { + js: 'dist/js/', + css: 'dist/css/' + }, + test: { + unit: 'tests/unit/' + }, + doc: 'doc/' +}; + +/** + * The default task simply calls the master 'build' task. + */ +gulp.task('default', ['build']); + +/** + * Builds the distribution files by packaging the compiled javascript source + * into the `dist/js/` directory and building the css into the `dist/css` + * directory + */ +gulp.task('build', ['sass', 'sass-minify'], function () { + gulp.src(path.source.coffee + '**/*.coffee') + .pipe(coffee({bare: true}).on('error', gutil.log)) + .pipe(order([ + 'epoch.js', + 'core/context.js', + 'core/util.js', + 'core/d3.js', + 'core/format.js', + 'core/chart.js', + 'core/css.js', + 'data.js', + 'model.js', + 'basic.js', + 'basic/*.js', + 'time.js', + 'time/*.js', + 'adapters.js', + 'adapters/*.js' + ])) + .pipe(concat('epoch.js')) + .pipe(gulp.dest(path.dist.js)) + .pipe(uglify().on('error', gutil.log)) + .pipe(rename('epoch.min.js')) + .pipe(gulp.dest(path.dist.js)); +}); + +/** + * Generates epoch CSS from Sass source. + */ +gulp.task('sass', function () { + gulp.src(path.source.sass + 'epoch.scss') + .pipe(sass({ outputStyle: 'compact' })) + .pipe(rename('epoch.css')) + .pipe(gulp.dest(path.dist.css)); +}); + +/** + * Generates the minified version of the epoch css from sass source. + */ +gulp.task('sass-minify', function () { + gulp.src(path.source.sass + 'epoch.scss') + .pipe(sass({ outputStyle: 'compressed' })) + .pipe(rename('epoch.min.css')) + .pipe(gulp.dest(path.dist.css)); +}); + +/** + * Watch script for recompiling JavaScript and CSS + */ +gulp.task('watch', function () { + gulp.watch(path.source.coffee + '**/*.coffee', ['build']); + gulp.watch(path.source.sass + '**/*.scss', ['sass', 'sass-minify']); +}); + +/** + * Cleans all build and distribution files. + */ +gulp.task('clean', function (cb) { + del([ path.dist.js, path.dist.css]).then(function () { + cb(); + }); +}); diff --git a/debian/missing-sources/epoch/package.json b/debian/missing-sources/epoch/package.json new file mode 100644 index 0000000..80f14ef --- /dev/null +++ b/debian/missing-sources/epoch/package.json @@ -0,0 +1,55 @@ +{ + "name": "epoch-charting", + "version": "0.8.4", + "description": "A general purpose real-time charting library for building beautiful, smooth, and high performance visualizations.", + "keywords": [ + "chart", + "charting", + "visualization", + "svg", + "animation", + "canvas", + "d3" + ], + "homepage": "http://fastly.github.io/epoch/", + "author": { + "name": "rsandor", + "url": "https://github.com/rsandor" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/fastly/epoch.git" + }, + "main": "dist/js/epoch.js", + "dependencies": { + "d3": "^3.4.13" + }, + "devDependencies": { + "chai": "^3.3.0", + "codo": "^2.0.11", + "coffee-script": "^1.10.0", + "del": "^2.0.2", + "gulp": "^3.9.0", + "gulp-coffee": "^2.3.1", + "gulp-concat": "^2.6.0", + "gulp-mocha": "^2.1.3", + "gulp-order": "^1.1.1", + "gulp-rename": "^1.2.2", + "gulp-sass": "^2.0.4", + "gulp-uglify": "^1.4.1", + "gulp-util": "^3.0.6", + "jsdom": "^7.0.2", + "mocha": "^2.3.3", + "node-minify": "^1.2.1", + "node-sass": "^3.3.3", + "sinon": "^1.17.1", + "xmlhttprequest": "^1.7.0" + }, + "scripts": { + "build": "gulp build", + "unit": "mocha --recursive --compilers coffee:coffee-script/register tests/unit/", + "test": "npm run build && npm run unit", + "codo": "./node_modules/.bin/codo --quiet --private --name Epoch --readme README.md --title 'Epoch Documentation' --output codo-doc src - LICENSE" + } +} diff --git a/debian/missing-sources/epoch/sass/_core.scss b/debian/missing-sources/epoch/sass/_core.scss new file mode 100644 index 0000000..93bc767 --- /dev/null +++ b/debian/missing-sources/epoch/sass/_core.scss @@ -0,0 +1,99 @@ +/* + * Core Epoch Styles + */ + +/** + * Generates the styles needed to define a fill color for a given class name. + * @param $name Name of the class to use (sans the leading .) + * @param $color Fill color to associate with the class name. + */ +@mixin epoch-color($name, $color) { + div.ref.#{$name} { + background-color: $color; + } + .#{$name} { + .line { stroke: $color; } + .area, .dot { fill: $color; } + } + .arc.#{$name} path { + fill: $color; + } + .bar.#{$name} { + fill: $color; + } + .#{$name} { + .bucket { fill: $color; } + } +} + +/** + * Produces categorical color classes for plots (excluding heatmaps). + * @param $list List of colors to use for each category. + * @param $entries Size of the input list. + */ +@mixin epoch-category-colors($list, $entries) { + @for $i from 1 through $entries { + div.ref.category#{$i} { + background-color: nth($list, $i); + } + .category#{$i} { + .line { stroke: nth($list, $i); } + .area, .dot { fill: nth($list, $i); stroke: rgba(0,0,0,0); } + } + .arc.category#{$i} path { + fill: nth($list, $i); + } + .bar.category#{$i} { + fill: nth($list, $i); + } + } +} + +/** + * Produces categorical colors for heatmaps. + * @param $list List of colors to use for categories. + * @param $entries Size of the input list. + */ +@mixin epoch-heatmap-colors($list, $entries) { + @for $i from 1 through $entries { + .category#{$i} { + .bucket { fill: nth($list, $i); } + } + } +} + +// Axis and Tick Shape Rendering +.epoch { + .axis path, .axis line { + shape-rendering: crispEdges; + } + + .axis.canvas .tick line { + shape-rendering: geometricPrecision; + } +} + +/* + * Canvas Styles Reference Container + * + * The reference container is an SVG that is automatically created when Epoch is loaded. It is used + * by the canvas based plots to obtain color information from the page styles by creating reference + * elements and then reading their computed styles. + * + * Note: don't mess with this ;) + */ +div#_canvas_css_reference { + width: 0; + height: 0; + position: absolute; + top: -1000px; + left: -1000px; + svg { + position: absolute; + width: 0; + height: 0; + top: -1000px; + left: -1000px; + } +} + diff --git a/debian/missing-sources/epoch/sass/epoch.scss b/debian/missing-sources/epoch/sass/epoch.scss new file mode 100644 index 0000000..2689262 --- /dev/null +++ b/debian/missing-sources/epoch/sass/epoch.scss @@ -0,0 +1,12 @@ +/* + * Epoch Master SCSS + * + * Includes the core styles and all the themes to produce the complete epoch css file. + * + * By Ryan Sandor Richards + * Copyright 2013 Fastly, Inc. + */ + +@import "core"; +@import "themes/default"; +@import "themes/dark"; diff --git a/debian/missing-sources/epoch/sass/themes/_dark.scss b/debian/missing-sources/epoch/sass/themes/_dark.scss new file mode 100644 index 0000000..e343eff --- /dev/null +++ b/debian/missing-sources/epoch/sass/themes/_dark.scss @@ -0,0 +1,95 @@ +/* + * theme/_dark.scss - Theme design for dark page backgrounds. + * Designed by Ryan Sandor Richards + */ + +$axisAndText: #d0d0d0; +$background: #333; + +.epoch-theme-dark { + // Axes and Ticks + .epoch { + .axis path, .axis line { + stroke: $axisAndText; + } + .axis .tick text { + fill: $axisAndText; + } + } + + // Pie Charts + .arc.pie { + stroke: $background; + } + + .arc.pie text { + fill: $background; + } + + // Gauges + .epoch .gauge-labels .value { + fill: #BBB; + } + + .epoch .gauge { + .arc.outer { + stroke: #999; + } + .arc.inner { + stroke: #AAA; + } + .tick { + stroke: #AAA; + } + + .needle { + fill: #F3DE88; + } + + .needle-base { + fill: #999; + } + } + + // Categorical Colors + $dark_category10: + #909CFF, #FFAC89, #E889E8, #78E8D3, #C2FF97, + #B7BCD1, #FF857F, #F3DE88, #C9935E, #A488FF; + + .epoch, .epoch.category10 { + @include epoch-category-colors($dark_category10, 10); + } + + $dark_category20: + #909CFF, #626AAD, #FFAC89, #BD7F66, + #E889E8, #995A99, #78E8D3, #4F998C, + #C2FF97, #789E5E, #B7BCD1, #7F8391, + #CCB889, #A1906B, #F3DE88, #A89A5E, + #FF857F, #BA615D, #A488FF, #7662B8; + + .epoch.category20 { + @include epoch-category-colors($dark_category20, 20); + } + + $dark_category20b: + #909CFF, #7680D1, #656DB2, #525992, + #FFAC89, #D18D71, #AB735C, #92624E, + #E889E8, #BA6EBA, #9B5C9B, #7B487B, + #78E8D3, #60BAAA, #509B8D, #3F7B70, + #C2FF97, #9FD17C, #7DA361, #65854E; + + .epoch.category20b { + @include epoch-category-colors($dark_category20b, 20); + } + + $dark_category20c: + #B7BCD1, #979DAD, #6E717D, #595C66, + #FF857F, #DE746E, #B55F5A, #964E4B, + #F3DE88, #DBC87B, #BAAA68, #918551, + #C9935E, #B58455, #997048, #735436, + #A488FF, #8670D1, #705CAD, #52447F; + + .epoch.category20c { + @include epoch-category-colors($dark_category20c, 20); + } +} diff --git a/debian/missing-sources/epoch/sass/themes/_default.scss b/debian/missing-sources/epoch/sass/themes/_default.scss new file mode 100644 index 0000000..d3075c8 --- /dev/null +++ b/debian/missing-sources/epoch/sass/themes/_default.scss @@ -0,0 +1,189 @@ +/* + * theme/_default.scss - Default Color Theme + * Categorical Colors Adapted from d3: + * https://github.com/mbostock/d3/wiki/Ordinal-Scales#categorical-colors + */ + +// Fonts +.epoch { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 12pt; +} + +// Axes and Ticks +.epoch { + .axis path, .axis line { + fill: transparent; + stroke: #000; + } + + .axis .tick text { + font-size: 9pt; + } +} + +// Line Charts +.epoch .line { + fill: transparent; + stroke-width: 2px; +} + +.epoch.sparklines .line { + stroke-width: 1px; +} + + +// Area Charts +.epoch .area { + stroke: transparent; +} + +// Pie Charts +.epoch { + .arc.pie { + stroke: #fff; + stroke-width: 1.5px; + } + + .arc.pie text { + stroke: transparent; + fill: white; + font-size: 9pt; + } +} + +// Gauge Charts +.epoch .gauge-labels { + .value { + text-anchor: middle; + font-size: 140%; + fill: #666; + } +} + +.epoch.gauge-tiny { + width: 120px; height: 90px; + + .gauge-labels { + .value { font-size: 80%; } + } + + .gauge { + .arc.outer { + stroke-width: 2px; + } + } +} + +.epoch.gauge-small { + width: 180px; height: 135px; + + .gauge-labels { + .value { font-size: 120%; } + } + + .gauge { + .arc.outer { + stroke-width: 3px; + } + } +} + +.epoch.gauge-medium { + width: 240px; height: 180px; + + .gauge { + .arc.outer { + stroke-width: 3px; + } + } +} + +.epoch.gauge-large { + width: 320px; height: 240px; + .gauge-labels { + .value { font-size: 180%; } + } +} + +.epoch .gauge { + .arc.outer { + stroke-width: 4px; + stroke: #666; + } + .arc.inner { + stroke-width: 1px; + stroke: #555; + } + .tick { + stroke-width: 1px; + stroke: #555; + } + + .needle { + fill: orange; + } + + .needle-base { + fill: #666; + } +} + +// Categorical Colors +$category10: + #1f77b4, #ff7f0e, #2ca02c, #d62728, #9467bd, + #8c564b, #e377c2, #7f7f7f, #bcbd22, #17becf; + +.epoch, .epoch.category10 { + @include epoch-category-colors($category10, 10); +} + +$category20: + #1f77b4, #aec7e8, #ff7f0e, #ffbb78, #2ca02c, + #98df8a, #d62728, #ff9896, #9467bd, #c5b0d5, + #8c564b, #c49c94, #e377c2, #f7b6d2, #7f7f7f, + #c7c7c7, #bcbd22, #dbdb8d, #17becf, #9edae5; + +.epoch.category20 { + @include epoch-category-colors($category20, 20); +} + +$category20b: + #393b79, #5254a3, #6b6ecf, #9c9ede, #637939, + #8ca252, #b5cf6b, #cedb9c, #8c6d31, #bd9e39, + #e7ba52, #e7cb94, #843c39, #ad494a, #d6616b, + #e7969c, #7b4173, #a55194, #ce6dbd, #de9ed6; + +.epoch.category20b { + @include epoch-category-colors($category20b, 20); +} + +$category20c: + #3182bd, #6baed6, #9ecae1, #c6dbef, + #e6550d, #fd8d3c, #fdae6b, #fdd0a2, + #31a354, #74c476, #a1d99b, #c7e9c0, + #756bb1, #9e9ac8, #bcbddc, #dadaeb, + #636363, #969696, #bdbdbd, #d9d9d9; + +.epoch.category20c { + @include epoch-category-colors($category20c, 20); +} + + +/* + * Heatmap Colors + * + * The heatmap real-time graph uses color blending to choose the color for which to render each bucket. + * Basic d3 categorical colors do not work well in this instance because the colors in the sequence + * vary wildly in precieved luminosity. + * + * Below we define small subsets that should work well together because they are of similar luminosities. + * Note: darker colors work better since we use opacity to denote "height" or "intensity" for each bucket + * after picking a mix color. + */ +$heatmap5: + #1f77b4, #2ca02c, #d62728, #8c564b, #7f7f7f; + +.epoch, .epoch.heatmap5 { + @include epoch-heatmap-colors($heatmap5, 5); +} diff --git a/debian/missing-sources/epoch/src/adapters.coffee b/debian/missing-sources/epoch/src/adapters.coffee new file mode 100644 index 0000000..e378af5 --- /dev/null +++ b/debian/missing-sources/epoch/src/adapters.coffee @@ -0,0 +1,13 @@ +# Maps short string names to classes for library adapters. +Epoch._typeMap = + 'area': Epoch.Chart.Area + 'bar': Epoch.Chart.Bar + 'line': Epoch.Chart.Line + 'pie': Epoch.Chart.Pie + 'scatter': Epoch.Chart.Scatter + 'histogram': Epoch.Chart.Histogram + 'time.area': Epoch.Time.Area + 'time.bar': Epoch.Time.Bar + 'time.line': Epoch.Time.Line + 'time.gauge': Epoch.Time.Gauge + 'time.heatmap': Epoch.Time.Heatmap diff --git a/debian/missing-sources/epoch/src/adapters/MooTools.coffee b/debian/missing-sources/epoch/src/adapters/MooTools.coffee new file mode 100644 index 0000000..8b3d544 --- /dev/null +++ b/debian/missing-sources/epoch/src/adapters/MooTools.coffee @@ -0,0 +1,19 @@ +MooToolsModule = -> + # Data key to use for storing a reference to the chart instance on an element. + DATA_NAME = 'epoch-chart' + + # Adds an Epoch chart of the given type to the referenced element. + # @param [Object] options Options for the chart. + # @option options [String] type The type of chart to append to the referenced element. + # @return [Object] The chart instance that was associated with the containing element. + Element.implement 'epoch', (options) -> + self = $$(this) + unless (chart = self.retrieve(DATA_NAME)[0])? + options.el = this + klass = Epoch._typeMap[options.type] + unless klass? + Epoch.exception "Unknown chart type '#{options.type}'" + self.store DATA_NAME, (chart = new klass options) + return chart + +MooToolsModule() if window.MooTools? diff --git a/debian/missing-sources/epoch/src/adapters/jQuery.coffee b/debian/missing-sources/epoch/src/adapters/jQuery.coffee new file mode 100644 index 0000000..e115bad --- /dev/null +++ b/debian/missing-sources/epoch/src/adapters/jQuery.coffee @@ -0,0 +1,18 @@ +jQueryModule = ($) -> + # Data key to use for storing a reference to the chart instance on an element. + DATA_NAME = 'epoch-chart' + + # Adds an Epoch chart of the given type to the referenced element. + # @param [Object] options Options for the chart. + # @option options [String] type The type of chart to append to the referenced element. + # @return [Object] The chart instance that was associated with the containing element. + $.fn.epoch = (options) -> + options.el = @get(0) + unless (chart = @data(DATA_NAME))? + klass = Epoch._typeMap[options.type] + unless klass? + Epoch.exception "Unknown chart type '#{options.type}'" + @data DATA_NAME, (chart = new klass options) + return chart + +jQueryModule(jQuery) if window.jQuery? diff --git a/debian/missing-sources/epoch/src/adapters/zepto.coffee b/debian/missing-sources/epoch/src/adapters/zepto.coffee new file mode 100644 index 0000000..81153dc --- /dev/null +++ b/debian/missing-sources/epoch/src/adapters/zepto.coffee @@ -0,0 +1,27 @@ +zeptoModule = ($) -> + # For mapping charts to selected elements + DATA_NAME = 'epoch-chart' + chartMap = {} + chartId = 0 + next_cid = -> "#{DATA_NAME}-#{++chartId}" + + # Adds an Epoch chart of the given type to the referenced element. + # @param [Object] options Options for the chart. + # @option options [String] type The type of chart to append to the referenced element. + # @return [Object] The chart instance that was associated with the containing element. + $.extend $.fn, + epoch: (options) -> + return chartMap[cid] if (cid = @data(DATA_NAME))? + options.el = @get(0) + + klass = Epoch._typeMap[options.type] + unless klass? + Epoch.exception "Unknown chart type '#{options.type}'" + + @data DATA_NAME, (cid = next_cid()) + chart = new klass options + chartMap[cid] = chart + + return chart + +zeptoModule(Zepto) if window.Zepto? diff --git a/debian/missing-sources/epoch/src/basic.coffee b/debian/missing-sources/epoch/src/basic.coffee new file mode 100644 index 0000000..8af3465 --- /dev/null +++ b/debian/missing-sources/epoch/src/basic.coffee @@ -0,0 +1,243 @@ +# Base class for all two-dimensional basic d3 charts. This class handles axes and +# margins so that subclasses can focus on the construction of particular chart +# types. +class Epoch.Chart.Plot extends Epoch.Chart.SVG + defaults = + domain: null, + range: null, + axes: ['left', 'bottom'] + ticks: + top: 14 + bottom: 14 + left: 5 + right: 5 + tickFormats: + top: Epoch.Formats.regular + bottom: Epoch.Formats.regular + left: Epoch.Formats.si + right: Epoch.Formats.si + + defaultAxisMargins = + top: 25 + right: 50 + bottom: 25 + left: 50 + + optionListeners = + 'option:margins.top': 'marginsChanged' + 'option:margins.right': 'marginsChanged' + 'option:margins.bottom': 'marginsChanged' + 'option:margins.left': 'marginsChanged' + 'option:axes': 'axesChanged' + 'option:ticks.top': 'ticksChanged' + 'option:ticks.right': 'ticksChanged' + 'option:ticks.bottom': 'ticksChanged' + 'option:ticks.left': 'ticksChanged' + 'option:tickFormats.top': 'tickFormatsChanged' + 'option:tickFormats.right': 'tickFormatsChanged' + 'option:tickFormats.bottom': 'tickFormatsChanged' + 'option:tickFormats.left': 'tickFormatsChanged' + 'option:domain': 'domainChanged' + 'option:range': 'rangeChanged' + + # Creates a new plot chart. + # @param [Object] options Options to use when constructing the plot. + # @option options [Object] margins For setting explicit values for the top, + # right, bottom, and left margins in the visualization. Normally these can + # be omitted and the class will set appropriately sized margins given which + # axes are specified. + # @option options [Array] axes A list of axes to display (top, left, bottom, right). + # @option options [Object] ticks Number of ticks to place on the top, left bottom + # and right axes. + # @option options [Object] tickFormats What tick formatting functions to use for + # the top, bottom, left, and right axes. + constructor: (@options={}) -> + givenMargins = Epoch.Util.copy(@options.margins) or {} + super(@options = Epoch.Util.defaults(@options, defaults)) + + # Margins are used in a special way and only for making room for axes. + # However, a user may explicitly set margins in the options, so we need + # to determine if they did so, and zero out the ones they didn't if no + # axis is present. + @margins = {} + for pos in ['top', 'right', 'bottom', 'left'] + @margins[pos] = if @options.margins? and @options.margins[pos]? + @options.margins[pos] + else if @hasAxis(pos) + defaultAxisMargins[pos] + else + 6 + + # Add a translation for the top and left margins + @g = @svg.append("g") + .attr("transform", "translate(#{@margins.left}, #{@margins.top})") + + # Register option change events + @onAll optionListeners + + # Sets the tick formatting function to use on the given axis. + # @param [String] axis Name of the axis. + # @param [Function] fn Formatting function to use. + setTickFormat: (axis, fn) -> + @options.tickFormats[axis] = fn + + # @return [Boolean] true if the chart has an axis with a given name, false otherwise. + # @param [String] axis Name of axis to check. + hasAxis: (axis) -> + @options.axes.indexOf(axis) > -1 + + # @return [Number] Width of the visualization portion of the chart (width - margins). + innerWidth: -> + @width - (@margins.left + @margins.right) + + # @return [Number] Height of the visualization portion of the chart (height - margins). + innerHeight: -> + @height - (@margins.top + @margins.bottom) + + # @return [Function] The x scale for the visualization. + x: -> + domain = @options.domain ? @extent((d) -> d.x) + d3.scale.linear() + .domain(domain) + .range([0, @innerWidth()]) + + # @return [Function] The y scale for the visualization. + y: (givenDomain) -> + d3.scale.linear() + .domain(@_getScaleDomain(givenDomain)) + .range([@innerHeight(), 0]) + + # @return [Function] d3 axis to use for the bottom of the visualization. + bottomAxis: -> + d3.svg.axis().scale(@x()).orient('bottom') + .ticks(@options.ticks.bottom) + .tickFormat(@options.tickFormats.bottom) + + # @return [Function] d3 axis to use for the top of the visualization. + topAxis: -> + d3.svg.axis().scale(@x()).orient('top') + .ticks(@options.ticks.top) + .tickFormat(@options.tickFormats.top) + + # @return [Function] d3 axis to use on the left of the visualization. + leftAxis: -> + range = if @options.range then @options.range.left else null + d3.svg.axis().scale(@y(range)).orient('left') + .ticks(@options.ticks.left) + .tickFormat(@options.tickFormats.left) + + # @return [Function] d3 axis to use on the right of the visualization. + rightAxis: -> + range = if @options.range then @options.range.right else null + d3.svg.axis().scale(@y(range)).orient('right') + .ticks(@options.ticks.right) + .tickFormat(@options.tickFormats.right) + + # Renders the axes for the visualization (subclasses must implement specific + # drawing routines). + draw: -> + if @_axesDrawn + @_redrawAxes() + else + @_drawAxes() + super() + + # Redraws the axes for the visualization. + _redrawAxes: -> + if @hasAxis('bottom') + @g.selectAll('.x.axis.bottom').transition() + .duration(500) + .ease('linear') + .call(@bottomAxis()) + if @hasAxis('top') + @g.selectAll('.x.axis.top').transition() + .duration(500) + .ease('linear') + .call(@topAxis()) + if @hasAxis('left') + @g.selectAll('.y.axis.left').transition() + .duration(500) + .ease('linear') + .call(@leftAxis()) + if @hasAxis('right') + @g.selectAll('.y.axis.right').transition() + .duration(500) + .ease('linear') + .call(@rightAxis()) + + # Draws the initial axes for the visualization. + _drawAxes: -> + if @hasAxis('bottom') + @g.append("g") + .attr("class", "x axis bottom") + .attr("transform", "translate(0, #{@innerHeight()})") + .call(@bottomAxis()) + if @hasAxis('top') + @g.append("g") + .attr('class', 'x axis top') + .call(@topAxis()) + if @hasAxis('left') + @g.append("g") + .attr("class", "y axis left") + .call(@leftAxis()) + if @hasAxis('right') + @g.append('g') + .attr('class', 'y axis right') + .attr('transform', "translate(#{@innerWidth()}, 0)") + .call(@rightAxis()) + @_axesDrawn = true + + dimensionsChanged: -> + super() + @g.selectAll('.axis').remove() + @_axesDrawn = false + @draw() + + # Updates margins in response to a option:margin.* event. + marginsChanged: -> + return unless @options.margins? + for own pos, size of @options.margins + unless size? + @margins[pos] = 6 + else + @margins[pos] = size + + @g.transition() + .duration(750) + .attr("transform", "translate(#{@margins.left}, #{@margins.top})") + + @draw() + + # Updates axes in response to a option:axes event. + axesChanged: -> + # Remove default axis margins + for pos in ['top', 'right', 'bottom', 'left'] + continue if @options.margins? and @options.margins[pos]? + if @hasAxis(pos) + @margins[pos] = defaultAxisMargins[pos] + else + @margins[pos] = 6 + + # Update the margin offset + @g.transition() + .duration(750) + .attr("transform", "translate(#{@margins.left}, #{@margins.top})") + + # Remove the axes and redraw + @g.selectAll('.axis').remove() + @_axesDrawn = false + @draw() + + # Updates ticks in response to a option:ticks.* event. + ticksChanged: -> @draw() + + # Updates tick formats in response to a option:tickFormats.* event. + tickFormatsChanged: -> @draw() + + # Updates chart in response to a option:domain event. + domainChanged: -> @draw() + + # Updates chart in response to a option:range event. + rangeChanged: -> @draw() + +# "They will see us waving from such great heights, come down now..." - The Postal Service diff --git a/debian/missing-sources/epoch/src/basic/area.coffee b/debian/missing-sources/epoch/src/basic/area.coffee new file mode 100644 index 0000000..e44b480 --- /dev/null +++ b/debian/missing-sources/epoch/src/basic/area.coffee @@ -0,0 +1,51 @@ + +# Static stacked area chart implementation using d3. +class Epoch.Chart.Area extends Epoch.Chart.Plot + constructor: (@options={}) -> + @options.type ?= 'area' + super(@options) + @draw() + + # Generates a scale needed to appropriately render the stacked visualization. + # @return [Function] The y scale for the visualization. + y: -> + a = [] + for layer in @getVisibleLayers() + for own k, v of layer.values + a[k] += v.y if a[k]? + a[k] = v.y unless a[k]? + d3.scale.linear() + .domain(@options.range ? [0, d3.max(a)]) + .range([@height - @margins.top - @margins.bottom, 0]) + + # Renders the SVG elements needed to display the stacked area chart. + draw: -> + [x, y, layers] = [@x(), @y(), @getVisibleLayers()] + + @g.selectAll('.layer').remove() + return if layers.length == 0 + + area = d3.svg.area() + .x((d) -> x(d.x)) + .y0((d) -> y(d.y0)) + .y1((d) -> y(d.y0 + d.y)) + + stack = d3.layout.stack() + .values((d) -> d.values) + + data = stack layers + + layer = @g.selectAll('.layer') + .data(layers, (d) -> d.category) + + layer.select('.area') + .attr('d', (d) -> area(d.values)) + + layer.enter().append('g') + .attr('class', (d) -> d.className) + + layer.append('path') + .attr('class', 'area') + .attr('d', (d) -> area(d.values)) + + super() diff --git a/debian/missing-sources/epoch/src/basic/bar.coffee b/debian/missing-sources/epoch/src/basic/bar.coffee new file mode 100644 index 0000000..8fbc427 --- /dev/null +++ b/debian/missing-sources/epoch/src/basic/bar.coffee @@ -0,0 +1,273 @@ +# Static bar chart implementation (using d3). +class Epoch.Chart.Bar extends Epoch.Chart.Plot + defaults = + type: 'bar' + style: 'grouped' + orientation: 'vertical' + padding: + bar: 0.08 + group: 0.1 + outerPadding: + bar: 0.08 + group: 0.1 + + horizontal_specific = + tickFormats: + top: Epoch.Formats.si + bottom: Epoch.Formats.si + left: Epoch.Formats.regular + right: Epoch.Formats.regular + + horizontal_defaults = Epoch.Util.defaults(horizontal_specific, defaults) + + optionListeners = + 'option:orientation': 'orientationChanged' + 'option:padding': 'paddingChanged' + 'option:outerPadding': 'paddingChanged' + 'option:padding:bar': 'paddingChanged' + 'option:padding:group': 'paddingChanged' + 'option:outerPadding:bar': 'paddingChanged' + 'option:outerPadding:group': 'paddingChanged' + + constructor: (@options={}) -> + if @_isHorizontal() + @options = Epoch.Util.defaults(@options, horizontal_defaults) + else + @options = Epoch.Util.defaults(@options, defaults) + super(@options) + @onAll optionListeners + @draw() + + # @return [Boolean] True if the chart is vertical, false otherwise + _isVertical: -> + @options.orientation == 'vertical' + + # @return [Boolean] True if the chart is horizontal, false otherwise + _isHorizontal: -> + @options.orientation == 'horizontal' + + # @return [Function] The scale used to generate the chart's x scale. + x: -> + if @_isVertical() + d3.scale.ordinal() + .domain(Epoch.Util.domain(@getVisibleLayers())) + .rangeRoundBands([0, @innerWidth()], @options.padding.group, @options.outerPadding.group) + else + extent = @extent((d) -> d.y) + extent[0] = Math.min(0, extent[0]) + d3.scale.linear() + .domain(extent) + .range([0, @width - @margins.left - @margins.right]) + + # @return [Function] The x scale used to render the horizontal bar chart. + x1: (x0) -> + d3.scale.ordinal() + .domain((layer.category for layer in @getVisibleLayers())) + .rangeRoundBands([0, x0.rangeBand()], @options.padding.bar, @options.outerPadding.bar) + + # @return [Function] The y scale used to render the bar chart. + y: -> + if @_isVertical() + extent = @extent((d) -> d.y) + extent[0] = Math.min(0, extent[0]) + d3.scale.linear() + .domain(extent) + .range([@height - @margins.top - @margins.bottom, 0]) + else + d3.scale.ordinal() + .domain(Epoch.Util.domain(@getVisibleLayers())) + .rangeRoundBands([0, @innerHeight()], @options.padding.group, @options.outerPadding.group) + + # @return [Function] The x scale used to render the vertical bar chart. + y1: (y0) -> + d3.scale.ordinal() + .domain((layer.category for layer in @getVisibleLayers())) + .rangeRoundBands([0, y0.rangeBand()], @options.padding.bar, @options.outerPadding.bar) + + # Remaps the bar chart data into a form that is easier to display. + # @return [Array] The reorganized data. + _remapData: -> + map = {} + for layer in @getVisibleLayers() + className = 'bar ' + layer.className.replace(/\s*layer\s*/, '') + for entry in layer.values + map[entry.x] ?= [] + map[entry.x].push { label: layer.category, y: entry.y, className: className } + ({group: k, values: v} for own k, v of map) + + # Draws the bar char. + draw: -> + if @_isVertical() + @_drawVertical() + else + @_drawHorizontal() + super() + + # Draws the bar chart with a vertical orientation + _drawVertical: -> + [x0, y] = [@x(), @y()] + x1 = @x1(x0) + height = @height - @margins.top - @margins.bottom + data = @_remapData() + + # 1) Join + layer = @g.selectAll(".layer") + .data(data, (d) -> d.group) + + # 2) Update + layer.transition().duration(750) + .attr("transform", (d) -> "translate(#{x0(d.group)}, 0)") + + # 3) Enter / Create + layer.enter().append("g") + .attr('class', 'layer') + .attr("transform", (d) -> "translate(#{x0(d.group)}, 0)") + + rects = layer.selectAll('rect') + .data((group) -> group.values) + + rects.attr('class', (d) -> d.className) + + rects.transition().duration(600) + .attr('x', (d) -> x1(d.label)) + .attr('y', (d) -> y(d.y)) + .attr('width', x1.rangeBand()) + .attr('height', (d) -> height - y(d.y)) + + rects.enter().append('rect') + .attr('class', (d) -> d.className) + .attr('x', (d) -> x1(d.label)) + .attr('y', (d) -> y(d.y)) + .attr('width', x1.rangeBand()) + .attr('height', (d) -> height - y(d.y)) + + rects.exit().transition() + .duration(150) + .style('opacity', '0') + .remove() + + # 4) Update new and existing + + # 5) Exit / Remove + layer.exit() + .transition() + .duration(750) + .style('opacity', '0') + .remove() + + # Draws the bar chart with a horizontal orientation + _drawHorizontal: -> + [x, y0] = [@x(), @y()] + y1 = @y1(y0) + width = @width - @margins.left - @margins.right + data = @_remapData() + + # 1) Join + layer = @g.selectAll(".layer") + .data(data, (d) -> d.group) + + # 2) Update + layer.transition().duration(750) + .attr("transform", (d) -> "translate(0, #{y0(d.group)})") + + # 3) Enter / Create + layer.enter().append("g") + .attr('class', 'layer') + .attr("transform", (d) -> "translate(0, #{y0(d.group)})") + + rects = layer.selectAll('rect') + .data((group) -> group.values) + + rects.attr('class', (d) -> d.className) + + rects.transition().duration(600) + .attr('x', (d) -> 0) + .attr('y', (d) -> y1(d.label)) + .attr('height', y1.rangeBand()) + .attr('width', (d) -> x(d.y)) + + rects.enter().append('rect') + .attr('class', (d) -> d.className) + .attr('x', (d) -> 0) + .attr('y', (d) -> y1(d.label)) + .attr('height', y1.rangeBand()) + .attr('width', (d) -> x(d.y)) + + rects.exit().transition() + .duration(150) + .style('opacity', '0') + .remove() + + # 4) Update new and existing + + # 5) Exit / Remove + layer.exit() + .transition() + .duration(750) + .style('opacity', '0') + .remove() + + # Generates specific tick marks to emulate d3's linear scale axis ticks + # for ordinal scales. Note: this should only be called if the user has + # defined a set number of ticks for a given axis. + # @param [Number] numTicks Number of ticks to generate + # @param [String] dataKey Property name of a datum to use for the tick value + # @return [Array] The ticks for the given axis + _getTickValues: (numTicks, dataKey='x') -> + return [] unless @data[0]? + total = @data[0].values.length + step = Math.ceil(total / numTicks)|0 + tickValues = (@data[0].values[i].x for i in [0...total] by step) + + # @return [Function] d3 axis to use for the bottom of the visualization. + bottomAxis: -> + axis = d3.svg.axis().scale(@x()).orient('bottom') + .ticks(@options.ticks.bottom) + .tickFormat(@options.tickFormats.bottom) + if @_isVertical() and @options.ticks.bottom? + axis.tickValues @_getTickValues(@options.ticks.bottom) + axis + + # @return [Function] d3 axis to use for the top of the visualization. + topAxis: -> + axis = d3.svg.axis().scale(@x()).orient('top') + .ticks(@options.ticks.top) + .tickFormat(@options.tickFormats.top) + if @_isVertical() and @options.ticks.top? + axis.tickValues @_getTickValues(@options.ticks.top) + axis + + # @return [Function] d3 axis to use on the left of the visualization. + leftAxis: -> + axis = d3.svg.axis().scale(@y()).orient('left') + .ticks(@options.ticks.left) + .tickFormat(@options.tickFormats.left) + if @_isHorizontal() and @options.ticks.left? + axis.tickValues @_getTickValues(@options.ticks.left) + axis + + # @return [Function] d3 axis to use on the right of the visualization. + rightAxis: -> + axis = d3.svg.axis().scale(@y()).orient('right') + .ticks(@options.ticks.right) + .tickFormat(@options.tickFormats.right) + if @_isHorizontal() and @options.ticks.right? + axis.tickValues @_getTickValues(@options.ticks.right) + axis + + # Updates orientation in response option:orientation. + orientationChanged: -> + top = @options.tickFormats.top + bottom = @options.tickFormats.bottom + left = @options.tickFormats.left + right = @options.tickFormats.right + + @options.tickFormats.left = top + @options.tickFormats.right = bottom + @options.tickFormats.top = left + @options.tickFormats.bottom = right + + @draw() + + # Updates padding in response to option:padding:* and option:outerPadding:*. + paddingChanged: -> @draw() diff --git a/debian/missing-sources/epoch/src/basic/histogram.coffee b/debian/missing-sources/epoch/src/basic/histogram.coffee new file mode 100644 index 0000000..4548e67 --- /dev/null +++ b/debian/missing-sources/epoch/src/basic/histogram.coffee @@ -0,0 +1,61 @@ +class Epoch.Chart.Histogram extends Epoch.Chart.Bar + defaults = + type: 'histogram' + domain: [0, 100] + bucketRange: [0, 100] + buckets: 10 + cutOutliers: false + + optionListeners = + 'option:bucketRange': 'bucketRangeChanged' + 'option:buckets': 'bucketsChanged' + 'option:cutOutliers': 'cutOutliersChanged' + + constructor: (@options={}) -> + super(@options = Epoch.Util.defaults(@options, defaults)) + @onAll optionListeners + @draw() + + # Prepares data by sorting it into histogram buckets as instructed by the chart options. + # @param [Array] data Data to prepare for rendering. + # @return [Array] The data prepared to be displayed as a histogram. + _prepareData: (data) -> + bucketSize = (@options.bucketRange[1] - @options.bucketRange[0]) / @options.buckets + + prepared = [] + for layer in data + buckets = (0 for i in [0...@options.buckets]) + for point in layer.values + index = parseInt((point.x - @options.bucketRange[0]) / bucketSize) + + if @options.cutOutliers and ((index < 0) or (index >= @options.buckets)) + continue + if index < 0 + index = 0 + else if index >= @options.buckets + index = @options.buckets - 1 + + buckets[index] += parseInt point.y + + preparedLayer = { values: (buckets.map (d, i) -> {x: parseInt(i) * bucketSize, y: d}) } + for own k, v of layer + preparedLayer[k] = v unless k == 'values' + + prepared.push preparedLayer + + return prepared + + # Called when options change, this prepares the raw data for the chart according to the new + # options, sets it, and renders the chart. + resetData: -> + @setData @rawData + @draw() + + # Updates the chart in response to an option:bucketRange event. + bucketRangeChanged: -> @resetData() + + # Updates the chart in response to an option:buckets event. + bucketsChanged: -> @resetData() + + # Updates the chart in response to an option:cutOutliers event. + cutOutliersChanged: -> @resetData() diff --git a/debian/missing-sources/epoch/src/basic/line.coffee b/debian/missing-sources/epoch/src/basic/line.coffee new file mode 100644 index 0000000..de56780 --- /dev/null +++ b/debian/missing-sources/epoch/src/basic/line.coffee @@ -0,0 +1,46 @@ +# Static line chart implementation (using d3). +class Epoch.Chart.Line extends Epoch.Chart.Plot + constructor: (@options={}) -> + @options.type ?= 'line' + super(@options) + @draw() + + # @return [Function] The line generator used to construct the plot. + line: (layer) -> + [x, y] = [@x(), @y(layer.range)] + d3.svg.line() + .x((d) -> x(d.x)) + .y((d) -> y(d.y)) + + # Draws the line chart. + draw: -> + [x, y, layers] = [@x(), @y(), @getVisibleLayers()] + + # Zero visible layers, just drop all and get out + if layers.length == 0 + return @g.selectAll('.layer').remove() + + # 1) Join + layer = @g.selectAll('.layer') + .data(layers, (d) -> d.category) + + # 2) Update (only existing) + layer.select('.line').transition().duration(500) + .attr('d', (l) => @line(l)(l.values)) + + # 3) Enter (Create) + layer.enter().append('g') + .attr('class', (l) -> l.className) + .append('path') + .attr('class', 'line') + .attr('d', (l) => @line(l)(l.values)) + + # 4) Update (existing & new) + # Nuuupp + + # 5) Exit (Remove) + layer.exit().transition().duration(750) + .style('opacity', '0') + .remove() + + super() diff --git a/debian/missing-sources/epoch/src/basic/pie.coffee b/debian/missing-sources/epoch/src/basic/pie.coffee new file mode 100644 index 0000000..e794a2f --- /dev/null +++ b/debian/missing-sources/epoch/src/basic/pie.coffee @@ -0,0 +1,59 @@ + +# Static Pie Chart implementation (using d3). +class Epoch.Chart.Pie extends Epoch.Chart.SVG + defaults = + type: 'pie' + margin: 10 + inner: 0 + + # Creates a new pie chart. + # @param [Object] options Options for the pie chart. + # @option options [Number] margin Margins to add around the pie chart (default: 10). + # @option options [Number] inner The inner radius for the chart (default: 0). + constructor: (@options={}) -> + super(@options = Epoch.Util.defaults(@options, defaults)) + @pie = d3.layout.pie().sort(null) + .value (d) -> d.value + @arc = d3.svg.arc() + .outerRadius(=> (Math.max(@width, @height) / 2) - @options.margin) + .innerRadius(=> @options.inner) + @g = @svg.append('g') + .attr("transform", "translate(#{@width/2}, #{@height/2})") + @on 'option:margin', 'marginChanged' + @on 'option:inner', 'innerChanged' + @draw() + + # Draws the pie chart + draw: -> + @g.selectAll('.arc').remove() + + arcs = @g.selectAll(".arc") + .data(@pie(@getVisibleLayers()), (d) -> d.data.category) + + arcs.enter().append('g') + .attr('class', (d) -> "arc pie " + d.data.className) + + arcs.select('path') + .attr('d', @arc) + + arcs.select('text') + .attr("transform", (d) => "translate(#{@arc.centroid(d)})") + .text((d) -> d.data.label or d.data.category) + + path = arcs.append("path") + .attr("d", @arc) + .each((d) -> @._current = d) + + text = arcs.append("text") + .attr("transform", (d) => "translate(#{@arc.centroid(d)})") + .attr("dy", ".35em") + .style("text-anchor", "middle") + .text((d) -> d.data.label or d.data.category) + + super() + + # Updates margins in response to an option:margin event. + marginChanged: -> @draw() + + # Updates inner margin in response to an option:inner event. + innerChanged: -> @draw() diff --git a/debian/missing-sources/epoch/src/basic/scatter.coffee b/debian/missing-sources/epoch/src/basic/scatter.coffee new file mode 100644 index 0000000..b8563ec --- /dev/null +++ b/debian/missing-sources/epoch/src/basic/scatter.coffee @@ -0,0 +1,59 @@ + +# Static scatter plot implementation (using d3). +class Epoch.Chart.Scatter extends Epoch.Chart.Plot + defaults = + type: 'scatter' + radius: 3.5 + axes: ['top', 'bottom', 'left', 'right'] + + # Creates a new scatter plot. + # @param [Object] options Options for the plot. + # @option options [Number] radius The default radius to use for the points in + # the plot (default 3.5). This can be overrwitten by individual points. + constructor: (@options={}) -> + super(@options = Epoch.Util.defaults(@options, defaults)) + @on 'option:radius', 'radiusChanged' + @draw() + + # Draws the scatter plot. + draw: -> + [x, y, layers] = [@x(), @y(), @getVisibleLayers()] + radius = @options.radius + + if layers.length == 0 + return @g.selectAll('.layer').remove() + + layer = @g.selectAll('.layer') + .data(layers, (d) -> d.category) + + layer.enter().append('g') + .attr('class', (d) -> d.className) + + dots = layer.selectAll('.dot') + .data((l) -> l.values) + + dots.transition().duration(500) + .attr("r", (d) -> d.r ? radius) + .attr("cx", (d) -> x(d.x)) + .attr("cy", (d) -> y(d.y)) + + dots.enter().append('circle') + .attr('class', 'dot') + .attr("r", (d) -> d.r ? radius) + .attr("cx", (d) -> x(d.x)) + .attr("cy", (d) -> y(d.y)) + + dots.exit().transition() + .duration(750) + .style('opacity', 0) + .remove() + + layer.exit().transition() + .duration(750) + .style('opacity', 0) + .remove() + + super() + + # Updates radius in response to an option:radius event. + radiusChanged: -> @draw() diff --git a/debian/missing-sources/epoch/src/core/chart.coffee b/debian/missing-sources/epoch/src/core/chart.coffee new file mode 100644 index 0000000..068335a --- /dev/null +++ b/debian/missing-sources/epoch/src/core/chart.coffee @@ -0,0 +1,361 @@ +# The base class for all charts in Epoch. Defines chart dimensions, keeps a reference +# of the chart's containing elements. And defines core method for handling data and +# drawing. +class Epoch.Chart.Base extends Epoch.Events + defaults = + width: 320 + height: 240 + dataFormat: null + + optionListeners = + 'option:width': 'dimensionsChanged' + 'option:height': 'dimensionsChanged' + 'layer:shown': 'layerChanged' + 'layer:hidden': 'layerChanged' + + # Creates a new base chart. + # @param [Object] options Options to set for this chart. + # @option options [Integer] width Sets an explicit width for the visualization. + # @option options [Integer] height Sets an explicit height for the visualization. + # @option options [Object, String] dataFormat Specific data format for the chart. + # @option options [Object] model Data model for the chart. + constructor: (@options={}) -> + super() + + if @options.model + if @options.model.hasData()? + @setData(@options.model.getData(@options.type, @options.dataFormat)) + else + @setData(@options.data or []) + @options.model.on 'data:updated', => @setDataFromModel() + else + @setData(@options.data or []) + + if @options.el? + @el = d3.select(@options.el) + + @width = @options.width + @height = @options.height + + if @el? + @width = @el.width() unless @width? + @height = @el.height() unless @height? + else + @width = defaults.width unless @width? + @height = defaults.height unless @height? + @el = d3.select(document.createElement('DIV')) + .attr('width', @width) + .attr('height', @height) + + @onAll optionListeners + + # @return [Object] A copy of this charts options. + _getAllOptions: -> + Epoch.Util.defaults({}, @options) + + # Chart option accessor. + # @param key Name of the option to fetch. Can be hierarchical, e.g. 'margins.left' + # @return The requested option if found, undefined otherwise. + _getOption: (key) -> + parts = key.split('.') + scope = @options + while parts.length and scope? + subkey = parts.shift() + scope = scope[subkey] + scope + + # Chart option mutator. + # @param key Name of the option to fetch. Can be hierarchical, e.g. 'margins.top' + # @param value Value to set for the option. + # @event option:`key` Triggers an option event with the given key being set. + _setOption: (key, value) -> + parts = key.split('.') + scope = @options + while parts.length + subkey = parts.shift() + if parts.length == 0 + scope[subkey] = arguments[1] + @trigger "option:#{arguments[0]}" + return + unless scope[subkey]? + scope[subkey] = {} + scope = scope[subkey] + + # Sets all options given an object of mixed hierarchical keys and nested objects. + # @param [Object] options Options to set. + # @event option:* Triggers an option event for each key that was set + _setManyOptions: (options, prefix='') -> + for own key, value of options + if Epoch.isObject(value) + @_setManyOptions value, "#{prefix + key}." + else + @_setOption prefix + key, value + + # General accessor / mutator for chart options. + # + # @overload option() + # Fetches chart options. + # @return a copy of this chart's options. + # + # @overload option(name) + # Fetches the value the option with the given name. + # @param [String] name Name of the option to fetch. Can be hierarchical, e.g. 'margins.left' + # @return The requested option if found, undefined otherwise. + # + # @overload option(name, value) + # Sets an option and triggers the associated event. + # @param [String] name Name of the option to fetch. Can be hierarchical, e.g. 'margins.top' + # @param value Value to set for the option. + # @event option:`name` Triggers an option event with the given key being set. + # + # @overload option(options) + # Sets multiple options at once. + # @param [Object] options Options to set for the chart. + # @event option:* Triggers an option event for each key that was set. + option: -> + if arguments.length == 0 + @_getAllOptions() + else if arguments.length == 1 and Epoch.isString(arguments[0]) + @_getOption arguments[0] + else if arguments.length == 2 and Epoch.isString(arguments[0]) + @_setOption arguments[0], arguments[1] + else if arguments.length == 1 and Epoch.isObject(arguments[0]) + @_setManyOptions arguments[0] + + # Retrieves and sets data from the chart's model + setDataFromModel: -> + prepared = @_prepareData @options.model.getData(@options.type, @options.dataFormat) + @data = @_annotateLayers(prepared) + @draw() + + # Set the initial data for the chart. + # @param data Data to initially set for the given chart. The data format can vary + # from chart to chart. The base class assumes that the data provided will be an + # array of layers. + setData: (data, options={}) -> + prepared = @_prepareData (@rawData = @_formatData(data)) + @data = @_annotateLayers(prepared) + + # Performs post formatted data preparation. + # @param data Data to prepare before setting. + # @return The prepared data. + _prepareData: (data) -> data + + # Performs data formatting before setting the charts data + # @param data Data to be formatted. + # @return The chart specific formatted data. + _formatData: (data) -> + Epoch.Data.formatData(data, @options.type, @options.dataFormat) + + # Annotates data to add class names, categories, and initial visibility states + _annotateLayers: (data) -> + category = 1 + for layer in data + classes = ['layer'] + classes.push "category#{category}" + layer.category = category + layer.visible = true + classes.push(Epoch.Util.dasherize layer.label) if layer.label? + layer.className = classes.join(' ') + category++ + return data + + # Finds a layer in the chart's current data that has the given label or index. + # @param [String, Number] labelOrIndex The label or index of the layer to find. + _findLayer: (labelOrIndex) -> + layer = null + if Epoch.isString(labelOrIndex) + for l in @data + if l.label == labelOrIndex + layer = l + break + else if Epoch.isNumber(labelOrIndex) + index = parseInt(labelOrIndex) + layer = @data[index] unless index < 0 or index >= @data.length + return layer + + # Instructs the chart that a data layer should be displayed. + # @param [String, Number] labelOrIndex The label or index of the layer to show. + # @event 'layer:shown' If a layer that was previously hidden now became visible. + showLayer: (labelOrIndex) -> + return unless (layer = @_findLayer labelOrIndex) + return if layer.visible + layer.visible = true + @trigger 'layer:shown' + + # Instructs the chart that a data layer should not be displayed. + # @param [String, Number] labelOrIndex The label or index of the layer to hide. + # @event 'layer:hidden' If a layer that was visible was made hidden. + hideLayer: (labelOrIndex) -> + return unless (layer = @_findLayer labelOrIndex) + return unless layer.visible + layer.visible = false + @trigger 'layer:hidden' + + # Instructs the chart that a data layer's visibility should be toggled. + # @param [String, Number] labelOrIndex The label or index of the layer to toggle. + # @event 'layer:shown' If the layer was made visible + # @event 'layer:hidden' If the layer was made invisible + toggleLayer: (labelOrIndex) -> + return unless (layer = @_findLayer labelOrIndex) + layer.visible = !layer.visible + if layer.visible + @trigger 'layer:shown' + else + @trigger 'layer:hidden' + + # Determines whether or not a data layer is visible. + # @param [String, Number] labelOrIndex The label or index of the layer to toggle. + # @return true if the layer is visible, false otherwise. + isLayerVisible: (labelOrIndex) -> + return null unless (layer = @_findLayer labelOrIndex) + layer.visible + + # Calculates an array of layers in the charts data that are flagged as visible. + # @return [Array] The chart's visible layers. + getVisibleLayers: -> + return @data.filter((layer) -> layer.visible) + + # Updates the chart with new data. + # @param data Data to replace the current data for the chart. + # @param [Boolean] draw Whether or not to redraw the chart after the data has been set. + # Default: true. + update: (data, draw=true) -> + @setData data + @draw() if draw + + # Draws the chart. Triggers the 'draw' event, subclasses should call super() after drawing to + # ensure that the event is triggered. + # @abstract Must be overriden in child classes to perform chart specific drawing. + draw: -> @trigger 'draw' + + # Determines a resulting scale domain for the y axis given a domain + # @param [Mixed] givenDomain A set domain, a label associated with mutliple + # layers, or null. + # @return The domain for the y scale + _getScaleDomain: (givenDomain) -> + # Explicitly set given domain + if Array.isArray(givenDomain) + return givenDomain + + # Check for "labeled" layer ranges + if Epoch.isString(givenDomain) + layers = @getVisibleLayers() + .filter((l) -> l.range == givenDomain) + .map((l) -> l.values) + if layers? && layers.length + values = Epoch.Util.flatten(layers).map((d) -> d.y) + minFn = (memo, curr) -> if curr < memo then curr else memo + maxFn = (memo, curr) -> if curr > memo then curr else memo + return [values.reduce(minFn, values[0]), values.reduce(maxFn, values[0])] + + # Find the domain based on chart options + if Array.isArray(@options.range) + @options.range + else if @options.range && Array.isArray(@options.range.left) + @options.range.left + else if @options.range && Array.isArray(@options.range.right) + @options.range.right + else + @extent((d) -> d.y) + + # Calculates an extent throughout the layers based on the given comparator. + # @param [Function] cmp Comparator to use for performing the min and max for the extent + # calculation. + # @return [Array] an extent array with the first element as the minimum value in the + # chart's data set and the second element as the maximum. + extent: (cmp) -> + [ + d3.min(@getVisibleLayers(), (layer) -> d3.min(layer.values, cmp)), + d3.max(@getVisibleLayers(), (layer) -> d3.max(layer.values, cmp)) + ] + + # Updates the width and height members and container dimensions in response to an + # 'option:width' or 'option:height' event. + dimensionsChanged: -> + @width = @option('width') or @width + @height = @option('height') or @height + @el.width(@width) + @el.height(@height) + + # Updates the chart in response to a layer being shown or hidden + layerChanged: -> + @draw() + +# Base class for all SVG charts (via d3). +class Epoch.Chart.SVG extends Epoch.Chart.Base + # Initializes the chart and places the rendering SVG in the specified HTML + # containing element. + # @param [Object] options Options for the SVG chart. + # @option options [HTMLElement] el Container element for the chart. + # @option options [Array] data Layered data used to render the chart. + constructor: (@options={}) -> + super(@options) + if @el? + @svg = @el.append('svg') + else + @svg = d3.select(document.createElement('svg')) + @svg.attr + xmlns: 'http://www.w3.org/2000/svg', + width: @width, + height: @height + + # Resizes the svg element in response to a 'option:width' or 'option:height' event. + dimensionsChanged: -> + super() + @svg.attr('width', @width).attr('height', @height) + +# Base Class for all Canvas based charts. +class Epoch.Chart.Canvas extends Epoch.Chart.Base + # Initializes the chart and places the rendering canvas in the specified + # HTML container element. + # @param [Object] options Options for the SVG chart. + # @option options [HTMLElement] el Container element for the chart. + # @option options [Array] data Layered data used to render the chart. + constructor: (@options={}) -> + super(@options) + + if @options.pixelRatio? + @pixelRatio = @options.pixelRatio + else if window.devicePixelRatio? + @pixelRatio = window.devicePixelRatio + else + @pixelRatio = 1 + + @canvas = d3.select( document.createElement('CANVAS') ) + @canvas.style + 'width': "#{@width}px" + 'height': "#{@height}px" + + @canvas.attr + width: @getWidth() + height: @getHeight() + + @el.node().appendChild @canvas.node() if @el? + @ctx = Epoch.Util.getContext @canvas.node() + + # @return [Number] width of the canvas with respect to the pixel ratio of the display + getWidth: -> @width * @pixelRatio + + # @return [Number] height of the canvas with respect to the pixel ratio of the display + getHeight: -> @height * @pixelRatio + + # Clears the render canvas. + clear: -> + @ctx.clearRect(0, 0, @getWidth(), @getHeight()) + + # @return [Object] computed styles for the given selector in the context of this chart. + # @param [String] selector The selector used to compute the styles. + getStyles: (selector) -> + Epoch.QueryCSS.getStyles(selector, @el) + + # Resizes the canvas element when the dimensions of the container change + dimensionsChanged: -> + super() + @canvas.style {'width': "#{@width}px", 'height': "#{@height}px"} + @canvas.attr { width: @getWidth(), height: @getHeight() } + + # Purges QueryCSS cache and redraws the Canvas based chart. + redraw: -> + Epoch.QueryCSS.purge() + @draw() diff --git a/debian/missing-sources/epoch/src/core/context.coffee b/debian/missing-sources/epoch/src/core/context.coffee new file mode 100644 index 0000000..8566552 --- /dev/null +++ b/debian/missing-sources/epoch/src/core/context.coffee @@ -0,0 +1,25 @@ +# Rendering context used for unit testing. +class Epoch.TestContext + VOID_METHODS = [ + 'arc', 'arcTo', 'beginPath', 'bezierCurveTo', 'clearRect', + 'clip', 'closePath', 'drawImage', 'fill', 'fillRect', 'fillText', + 'moveTo', 'quadraticCurveTo', 'rect', 'restore', 'rotate', 'save', + 'scale', 'scrollPathIntoView', 'setLineDash', 'setTransform', + 'stroke', 'strokeRect', 'strokeText', 'transform', 'translate', 'lineTo' + ] + + # Creates a new test rendering context. + constructor: -> + @_log = [] + @_makeFauxMethod(method) for method in VOID_METHODS + + # Creates a fake method with the given name that logs the method called + # and arguments passed when executed. + # @param name Name of the fake method to create. + _makeFauxMethod: (name) -> + @[name] = -> @_log.push "#{name}(#{(arg.toString() for arg in arguments).join(',')})" + + # Faux method that emulates the "getImageData" method + getImageData: -> + @_log.push "getImageData(#{(arg.toString() for arg in arguments).join(',')})" + return { width: 0, height: 0, resolution: 1.0, data: [] } diff --git a/debian/missing-sources/epoch/src/core/css.coffee b/debian/missing-sources/epoch/src/core/css.coffee new file mode 100644 index 0000000..03a7310 --- /dev/null +++ b/debian/missing-sources/epoch/src/core/css.coffee @@ -0,0 +1,131 @@ +# Singelton class used to query CSS styles by way of reference elements. +# This allows canvas based visualizations to use the same styles as their +# SVG counterparts. +class QueryCSS + # Reference container id + REFERENCE_CONTAINER_ID = '_canvas_css_reference' + + # Container Hash Attribute + CONTAINER_HASH_ATTR = 'data-epoch-container-id' + + # Handles automatic container id generation + containerCount = 0 + nextContainerId = -> "epoch-container-#{containerCount++}" + + # Expression used to derive tag name, id, and class names from + # selectors given the the put method. + PUT_EXPR = /^([^#. ]+)?(#[^. ]+)?(\.[^# ]+)?$/ + + # Whether or not to log full selector lists + logging = false + + # Converts selectors into actual dom elements (replaces put.js) + # Limited the functionality to what Epoch actually needs to + # operate correctly. We detect class names, ids, and element + # tag names. + put = (selector) -> + match = selector.match(PUT_EXPR) + return Epoch.error('Query CSS cannot match given selector: ' + selector) unless match? + [whole, tag, id, classNames] = match + tag = (tag ? 'div').toUpperCase() + + element = document.createElement(tag) + element.id = id.substr(1) if id? + if classNames? + element.className = classNames.substr(1).replace(/\./g, ' ') + + return element + + # Lets the user set whether or not to log selector lists and resulting DOM trees. + # Useful for debugging QueryCSS itself. + @log: (b) -> + logging = b + + # Key-Value cache for computed styles that we found using this class. + @cache = {} + + # List of styles to pull from the full list of computed styles + @styleList = ['fill', 'stroke', 'stroke-width'] + + # The svg reference container + @container = null + + # Purges the selector to style cache + @purge: -> + QueryCSS.cache = {} + + # Gets the reference element container. + @getContainer: -> + return QueryCSS.container if QueryCSS.container? + container = document.createElement('DIV') + container.id = REFERENCE_CONTAINER_ID + document.body.appendChild(container) + QueryCSS.container = d3.select(container) + + # @return [String] A unique identifier for the given container and selector. + # @param [String] selector Selector from which to derive the styles + # @param container The containing element for a chart. + @hash: (selector, container) -> + containerId = container.attr(CONTAINER_HASH_ATTR) + unless containerId? + containerId = nextContainerId() + container.attr(CONTAINER_HASH_ATTR, containerId) + return "#{containerId}__#{selector}" + + # @return The computed styles for the given selector in the given container element. + # @param [String] selector Selector from which to derive the styles. + # @param container HTML containing element in which to place the reference SVG. + @getStyles: (selector, container) -> + # 0) Check for cached styles + cacheKey = QueryCSS.hash(selector, container) + cache = QueryCSS.cache[cacheKey] + return cache if cache? + + # 1) Build a full reference tree (parents, container, and selector elements) + parents = [] + parentNode = container.node().parentNode + + while parentNode? and parentNode.nodeName.toLowerCase() != 'body' + parents.unshift parentNode + parentNode = parentNode.parentNode + parents.push container.node() + + selectorList = [] + for element in parents + sel = element.nodeName.toLowerCase() + if element.id? and element.id.length > 0 + sel += '#' + element.id + if element.className? and element.className.length > 0 + sel += '.' + Epoch.Util.trim(element.className).replace(/\s+/g, '.') + selectorList.push sel + + selectorList.push('svg') + + for subSelector in Epoch.Util.trim(selector).split(/\s+/) + selectorList.push(subSelector) + + console.log(selectorList) if logging + + parent = root = put(selectorList.shift()) + while selectorList.length + el = put(selectorList.shift()) + parent.appendChild el + parent = el + + console.log(root) if logging + + # 2) Place the reference tree and fetch styles given the selector + QueryCSS.getContainer().node().appendChild(root) + + ref = d3.select('#' + REFERENCE_CONTAINER_ID + ' ' + selector) + styles = {} + for name in QueryCSS.styleList + styles[name] = ref.style(name) + QueryCSS.cache[cacheKey] = styles + + # 3) Cleanup and return the styles + QueryCSS.getContainer().html('') + return styles + + +Epoch.QueryCSS = QueryCSS \ No newline at end of file diff --git a/debian/missing-sources/epoch/src/core/d3.coffee b/debian/missing-sources/epoch/src/core/d3.coffee new file mode 100644 index 0000000..a33d717 --- /dev/null +++ b/debian/missing-sources/epoch/src/core/d3.coffee @@ -0,0 +1,25 @@ +# Gets the width of the first node, or sets the width of all the nodes +# in a d3 selection. +# @param value [Number, String] (optional) Width to set for all the nodes in the selection. +# @return The selection if setting the width of the nodes, or the width +# in pixels of the first node in the selection. +d3.selection::width = (value) -> + if value? and Epoch.isString(value) + @style('width', value) + else if value? and Epoch.isNumber(value) + @style('width', "#{value}px") + else + +Epoch.Util.getComputedStyle(@node(), null).width.replace('px', '') + +# Gets the height of the first node, or sets the height of all the nodes +# in a d3 selection. +# @param value (optional) Height to set for all the nodes in the selection. +# @return The selection if setting the height of the nodes, or the height +# in pixels of the first node in the selection. +d3.selection::height = (value) -> + if value? and Epoch.isString(value) + @style('height', value) + else if value? and Epoch.isNumber(value) + @style('height', "#{value}px") + else + +Epoch.Util.getComputedStyle(@node(), null).height.replace('px', '') \ No newline at end of file diff --git a/debian/missing-sources/epoch/src/core/format.coffee b/debian/missing-sources/epoch/src/core/format.coffee new file mode 100644 index 0000000..d65932f --- /dev/null +++ b/debian/missing-sources/epoch/src/core/format.coffee @@ -0,0 +1,15 @@ +# Tick formatter identity. +Epoch.Formats.regular = (d) -> d + +# Tick formatter that formats the numbers using standard SI postfixes. +Epoch.Formats.si = (d) -> Epoch.Util.formatSI(d) + +# Tick formatter for percentages. +Epoch.Formats.percent = (d) -> (d*100).toFixed(1) + "%" + +# Tick formatter for seconds from timestamp data. +Epoch.Formats.seconds = (t) -> d3Seconds(new Date(t*1000)) +d3Seconds = d3.time.format('%I:%M:%S %p') + +# Tick formatter for bytes +Epoch.Formats.bytes = (d) -> Epoch.Util.formatBytes(d) diff --git a/debian/missing-sources/epoch/src/core/util.coffee b/debian/missing-sources/epoch/src/core/util.coffee new file mode 100644 index 0000000..30995bf --- /dev/null +++ b/debian/missing-sources/epoch/src/core/util.coffee @@ -0,0 +1,236 @@ +typeFunction = (objectName) -> (v) -> + Object::toString.call(v) == "[object #{objectName}]" + +# @return [Boolean] true if the given value is an array, false otherwise. +# @param v Value to test. +Epoch.isArray = Array.isArray ? typeFunction('Array') + +# @return [Boolean] true if the given value is an object, false otherwise. +# @param v Value to test. +Epoch.isObject = typeFunction('Object') + +# @return [Boolean] true if the given value is a string, false otherwise. +# @param v Value to test. +Epoch.isString = typeFunction('String') + +# @return [Boolean] true if the given value is a function, false otherwise. +# @param v Value to test. +Epoch.isFunction = typeFunction('Function') + +# @return [Boolean] true if the given value is a number, false otherwise. +# @param v Value to test. +Epoch.isNumber = typeFunction('Number') + +# Attempts to determine if a given value represents a DOM element. The result is always correct if the +# browser implements DOM Level 2, but one can fool it on certain versions of IE. Adapted from: +# Stack Overflow #384286. +# @return [Boolean] true if the given value is a DOM element, false otherwise. +# @param v Value to test. +Epoch.isElement = (v) -> + if HTMLElement? + v instanceof HTMLElement + else + v? and Epoch.isObject(v) and v.nodeType == 1 and Epoch.isString(v.nodeName) + +# Determines if a given value is a non-empty array. +# @param v Value to test. +# @return [Boolean] true if the given value is an array with at least one element. +Epoch.isNonEmptyArray = (v) -> + Epoch.isArray(v) and v.length > 0 + +# Generates shallow copy of an object. +# @return A shallow copy of the given object. +# @param [Object] original Object for which to make the shallow copy. +Epoch.Util.copy = (original) -> + return null unless original? + copy = {} + copy[k] = v for own k, v of original + return copy + +# Creates a deep copy of the given options filling in missing defaults. +# @param [Object] options Options to copy. +# @param [Object] defaults Default values for the options. +Epoch.Util.defaults = (options, defaults) -> + result = Epoch.Util.copy(options) + for own k, v of defaults + opt = options[k] + def = defaults[k] + bothAreObjects = Epoch.isObject(opt) and Epoch.isObject(def) + + if opt? and def? + if bothAreObjects and not Epoch.isArray(opt) + result[k] = Epoch.Util.defaults(opt, def) + else + result[k] = opt + else if opt? + result[k] = opt + else + result[k] = def + + return result + +# Formats numbers with standard postfixes (e.g. K, M, G) +# @param [Number] v Value to format. +# @param [Integer] fixed Number of floating point digits to fix after conversion. +# @param [Boolean] fixIntegers Whether or not to add floating point digits to non-floating point results. +# @example Formatting a very large number +# Epoch.Util.formatSI(1120000) == "1.1 M" +Epoch.Util.formatSI = (v, fixed=1, fixIntegers=false) -> + if v < 1000 + q = v + q = q.toFixed(fixed) unless (q|0) == q and !fixIntegers + return q + + for own i, label of ['K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'] + base = Math.pow(10, ((i|0)+1)*3) + if v >= base and v < Math.pow(10, ((i|0)+2)*3) + q = v/base + q = q.toFixed(fixed) unless (q % 1) == 0 and !fixIntegers + return "#{q} #{label}" + +# Formats large bandwidth and disk space usage numbers with byte postfixes (e.g. KB, MB, GB, etc.) +# @param [Number] v Value to format. +# @param [Integer] fixed Number of floating point digits to fix after conversion. +# @param [Boolean] fixIntegers Whether or not to add floating point digits to non-floating point results. +# @example Formatting a large number of bytes +# Epoch.Util.formatBytes(5.21 * Math.pow(2, 20)) == "5.2 MB" +Epoch.Util.formatBytes = (v, fixed=1, fix_integers=false) -> + if v < 1024 + q = v + q = q.toFixed(fixed) unless (q % 1) == 0 and !fix_integers + return "#{q} B" + + for own i, label of ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] + base = Math.pow(1024, (i|0)+1) + if v >= base and v < Math.pow(1024, (i|0)+2) + q = v/base + q = q.toFixed(fixed) unless (q % 1) == 0 and !fix_integers + return "#{q} #{label}" + +# @return a "dasherized" css class names from a given string +# @example Using dasherize +# Epoch.Util.dasherize('My Awesome Name') == 'my-awesome-name' +Epoch.Util.dasherize = (str) -> + Epoch.Util.trim(str).replace("\n", '').replace(/\s+/g, '-').toLowerCase() + +# @return the full domain of a given variable from an array of layers +# @param [Array] layers Layered plot data. +# @param [String] key The key name of the value at on each entry in the layers. +Epoch.Util.domain = (layers, key='x') -> + set = {} + domain = [] + for layer in layers + for entry in layer.values + continue if set[entry[key]]? + domain.push(entry[key]) + set[entry[key]] = true + return domain + +# Strips whitespace from the beginning and end of a string. +# @param [String] string String to trim. +# @return [String] The string without leading or trailing whitespace. +# Returns null if the given parameter was not a string. +Epoch.Util.trim = (string) -> + return null unless Epoch.isString(string) + string.replace(/^\s+/g, '').replace(/\s+$/g, '') + +# Returns the computed styles of an element in the document +# @param [HTMLElement] Element for which to fetch the styles. +# @param [String] pseudoElement Pseudo selectors on which to search for the element. +# @return [Object] The styles for the given element. +Epoch.Util.getComputedStyle = (element, pseudoElement) -> + if Epoch.isFunction(window.getComputedStyle) + window.getComputedStyle(element, pseudoElement) + else if element.currentStyle? + element.currentStyle + +# Converts a CSS color string into an RGBA string with the given opacity +# @param [String] color Color string to convert into an rgba +# @param [Number] opacity Opacity to use for the resulting color. +# @return the resulting rgba color string. +Epoch.Util.toRGBA = (color, opacity) -> + if (parts = color.match /^rgba\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*[0-9\.]+\)/) + [all, r, g, b] = parts + result = "rgba(#{r},#{g},#{b},#{opacity})" + else if (v = d3.rgb color) + result = "rgba(#{v.r},#{v.g},#{v.b},#{opacity})" + return result + +# Obtains a graphics context for the given canvas node. Nice to have +# this abstracted out in case we want to support WebGL in the future. +# Also allows us to setup a special context when unit testing, as +# jsdom doesn't have canvas support, and node-canvas is a pain in the +# butt to install properly across different platforms. +Epoch.Util.getContext = (node, type='2d') -> + node.getContext(type) + +# Basic eventing base class for all Epoch classes. +class Epoch.Events + constructor: -> + @_events = {} + + # Registers a callback to a given event. + # @param [String] name Name of the event. + # @param [Function, String] callback Either a closure to call when the event fires + # or a string that denotes a method name to call on this object. + on: (name, callback) -> + return unless callback? + @_events[name] ?= [] + @_events[name].push callback + + # Registers a map of event names to given callbacks. This method calls .on + # directly for each of the events given. + # @param [Object] map A map of event names to callbacks. + onAll: (map) -> + return unless Epoch.isObject(map) + @on(name, callback) for own name, callback of map + + # Removes a specific callback listener or all listeners for a given event. + # @param [String] name Name of the event. + # @param [Function, String] callback (Optional) Callback to remove from the listener list. + # If this parameter is not provided then all listeners will be removed for the event. + off: (name, callback) -> + return unless Epoch.isArray(@_events[name]) + return delete(@_events[name]) unless callback? + while (i = @_events[name].indexOf(callback)) >= 0 + @_events[name].splice(i, 1) + + # Removes a set of callback listeners for all events given in the map or array of strings. + # This method calls .off directly for each event and callback to remove. + # @param [Object, Array] mapOrList Either a map that associates event names to specific callbacks + # or an array of event names for which to completely remove listeners. + offAll: (mapOrList) -> + if Epoch.isArray(mapOrList) + @off(name) for name in mapOrList + else if Epoch.isObject(mapOrList) + @off(name, callback) for own name, callback of mapOrList + + # Triggers an event causing all active listeners to be executed. + # @param [String] name Name of the event to fire. + trigger: (name) -> + return unless @_events[name]? + args = (arguments[i] for i in [1...arguments.length]) + for callback in @_events[name] + fn = null + if Epoch.isString(callback) + fn = @[callback] + else if Epoch.isFunction(callback) + fn = callback + unless fn? + Epoch.exception "Callback for event '#{name}' is not a function or reference to a method." + fn.apply @, args + +# Performs a single pass flatten on a multi-array +# @param [Array] multiarray A deep multi-array to flatten +# @returns [Array] A single pass flatten of the multi-array +Epoch.Util.flatten = (multiarray) -> + if !Array.isArray(multiarray) + throw new Error('Epoch.Util.flatten only accepts arrays') + result = [] + for array in multiarray + if Array.isArray(array) + for item in array + result.push item + else + result.push array + result diff --git a/debian/missing-sources/epoch/src/data.coffee b/debian/missing-sources/epoch/src/data.coffee new file mode 100644 index 0000000..7627fd4 --- /dev/null +++ b/debian/missing-sources/epoch/src/data.coffee @@ -0,0 +1,311 @@ +Epoch.Data ?= {} +Epoch.Data.Format ?= {} + +# Private Helper Function for data formats below +applyLayerLabel = (layer, options, i, keys=[]) -> + [labels, autoLabels, keyLabels] = [options.labels, options.autoLabels, options.keyLabels] + if labels? and Epoch.isArray(labels) and labels.length > i + layer.label = labels[i] + else if keyLabels and keys.length > i + layer.label = keys[i] + else if autoLabels + label = [] + while i >= 0 + label.push String.fromCharCode(65+(i%26)) + i -= 26 + layer.label = label.join('') + return layer + +# Formats a given input array for the chart of the specified type. Notes: +# +# * Basic pie charts require a flat array of numbers +# * Real-time histogram charts require sparse histogram objects +# +# @param data Data array to format (can be multidimensional to allow for multiple layers). +# @option options [String] type Type of chart for which to format the data. +# @option options [Function] x(d, i) Maps the data to x values given a data point and the index of the point. +# @option options [Function] y(d, i) Maps the data to y values given a data point and the index of the point. +# @option options [Function] time(d, i, startTime) Maps the data to time values for real-time plots given the point and index. +# @option options [Array] labels Labels to apply to each data layer. +# @option options [Boolean] autoLabels Apply labels of ascending capital letters to each layer if true. +# @option options [Number] startTime Unix timestamp used as the starting point for auto acsending times in +# real-time data formatting. +Epoch.Data.Format.array = (-> + defaultOptions = + x: (d, i) -> i + y: (d, i) -> d + time: (d, i, startTime) -> parseInt(startTime) + parseInt(i) + type: 'area' + autoLabels: false + labels: [] + startTime: parseInt(new Date().getTime() / 1000) + + buildLayers = (data, options, mapFn) -> + result = [] + if Epoch.isArray(data[0]) + for own i, series of data + result.push applyLayerLabel({values: series.map(mapFn)}, options, parseInt(i)) + else + result.push applyLayerLabel({values: data.map(mapFn)}, options, 0) + return result + + formatBasicPlot = (data, options) -> + buildLayers data, options, (d, i) -> + { x: options.x(d, i), y: options.y(d, i) } + + formatTimePlot = (data, options) -> + buildLayers data, options, (d, i) -> + { time: options.time(d, i, options.startTime), y: options.y(d, i) } + + formatHeatmap = (data, options) -> + buildLayers data, options, (d, i) -> + { time: options.time(d, i, options.startTime), histogram: d } + + formatPie = (data, options) -> + result = [] + for own i, v of data + return [] unless Epoch.isNumber(data[0]) + result.push applyLayerLabel({ value: v }, options, i) + return result + + format = (data=[], options={}) -> + return [] unless Epoch.isNonEmptyArray(data) + opt = Epoch.Util.defaults options, defaultOptions + + if opt.type == 'time.heatmap' + formatHeatmap data, opt + else if opt.type.match /^time\./ + formatTimePlot data, opt + else if opt.type == 'pie' + formatPie data, opt + else + formatBasicPlot data, opt + + format.entry = (datum, options={}) -> + if options.type == 'time.gauge' + return 0 unless datum? + opt = Epoch.Util.defaults options, defaultOptions + d = if Epoch.isArray(datum) then datum[0] else datum + return opt.y(d, 0) + + return [] unless datum? + unless options.startTime? + options.startTime = parseInt(new Date().getTime() / 1000) + + if Epoch.isArray(datum) + data = datum.map (d) -> [d] + else + data = [datum] + + (layer.values[0] for layer in format(data, options)) + + return format +)() + +# Formats an input array of tuples such that the first element of the tuple is set +# as the x-coordinate and the second element as the y-coordinate. Supports layers +# of tupled series. For real-time plots the first element of a tuple is set as the +# time component of the value. +# +# This formatter will return an empty array if the chart type option is +# set as 'time.heatmap', 'time.gauge', or 'pie'. +# +# @param data Data array to format (can be multidimensional to allow for multiple layers). +# @option options [String] type Type of chart for which to format the data. +# @option options [Function] x(d, i) Maps the data to x values given a data point and the index of the point. +# @option options [Function] y(d, i) Maps the data to y values given a data point and the index of the point. +# @option options [Function] time(d, i, startTime) Maps the data to time values for real-time plots given the point and index. +# @option options [Array] labels Labels to apply to each data layer. +# @option options [Boolean] autoLabels Apply labels of ascending capital letters to each layer if true. +Epoch.Data.Format.tuple = (-> + defaultOptions = + x: (d, i) -> d + y: (d, i) -> d + time: (d, i) -> d + type: 'area' + autoLabels: false + labels: [] + + buildLayers = (data, options, mapFn) -> + return [] unless Epoch.isArray(data[0]) + result = [] + if Epoch.isArray(data[0][0]) + for own i, series of data + result.push applyLayerLabel({values: series.map(mapFn)}, options, parseInt(i)) + else + result.push applyLayerLabel({values: data.map(mapFn)}, options, 0) + return result + + format = (data=[], options={}) -> + return [] unless Epoch.isNonEmptyArray(data) + opt = Epoch.Util.defaults options, defaultOptions + + if opt.type == 'pie' or opt.type == 'time.heatmap' or opt.type == 'time.gauge' + return [] + else if opt.type.match /^time\./ + buildLayers data, opt, (d, i) -> + {time: opt.time(d[0], parseInt(i)), y: opt.y(d[1], parseInt(i))} + else + buildLayers data, opt, (d, i) -> + {x: opt.x(d[0], parseInt(i)), y: opt.y(d[1], parseInt(i))} + + format.entry = (datum, options={}) -> + return [] unless datum? + unless options.startTime? + options.startTime = parseInt(new Date().getTime() / 1000) + + if Epoch.isArray(datum) and Epoch.isArray(datum[0]) + data = datum.map (d) -> [d] + else + data = [datum] + + (layer.values[0] for layer in format(data, options)) + + return format +)() + +# This formatter expects to be passed a flat array of objects and a list of keys. +# It then extracts the value for each key across each of the objects in the array +# to produce multi-layer plot data of the given chart type. Note that this formatter +# also can be passed an x or time option as a string that +# allows the programmer specify a key to use for the value of the first component +# (x or time) of each resulting layer value. +# +# Note that this format does not work with basic pie charts nor real-time gauge charts. +# +# @param [Array] data Flat array of objects to format. +# @param [Array] keys List of keys used to extract data from each of the objects. +# @option options [String] type Type of chart for which to format the data. +# @option options [Function, String] x Either the key to use for the x-componet of +# the resulting values or a function of the data at that point and index of the data. +# @option options [Function, String] time Either an object key or function to use for the +# time-component of resulting real-time plot values. +# @option options [Function] y(d, i) Maps the data to y values given a data point and the index of the point. +# @option options [Array] labels Labels to apply to each data layer. +# @option options [Boolean] autoLabels Apply labels of ascending capital letters to each layer if true. +# @option options [Boolean] keyLabels Apply labels using the keys passed to the formatter (defaults to true). +# @option options [Number] startTime Unix timestamp used as the starting point for auto acsending times in +# real-time data formatting. +Epoch.Data.Format.keyvalue = (-> + defaultOptions = + type: 'area', + x: (d, i) -> parseInt(i) + y: (d, i) -> d + time: (d, i, startTime) -> parseInt(startTime) + parseInt(i) + labels: [] + autoLabels: false + keyLabels: true + startTime: parseInt(new Date().getTime() / 1000) + + buildLayers = (data, keys, options, mapFn) -> + result = [] + for own j, key of keys + values = [] + for own i, d of data + values.push mapFn(d, key, parseInt(i)) + result.push applyLayerLabel({ values: values }, options, parseInt(j), keys) + return result + + formatBasicPlot = (data, keys, options) -> + buildLayers data, keys, options, (d, key, i) -> + if Epoch.isString(options.x) + x = d[options.x] + else + x = options.x(d, parseInt(i)) + { x: x, y: options.y(d[key], parseInt(i)) } + + formatTimePlot = (data, keys, options, rangeName='y') -> + buildLayers data, keys, options, (d, key, i) -> + if Epoch.isString(options.time) + value = { time: d[options.time] } + else + value = { time: options.time(d, parseInt(i), options.startTime) } + value[rangeName] = options.y(d[key], parseInt(i)) + value + + format = (data=[], keys=[], options={}) -> + return [] unless Epoch.isNonEmptyArray(data) and Epoch.isNonEmptyArray(keys) + opt = Epoch.Util.defaults options, defaultOptions + + if opt.type == 'pie' or opt.type == 'time.gauge' + return [] + else if opt.type == 'time.heatmap' + formatTimePlot data, keys, opt, 'histogram' + else if opt.type.match /^time\./ + formatTimePlot data, keys, opt + else + formatBasicPlot data, keys, opt + + format.entry = (datum, keys=[], options={}) -> + return [] unless datum? and Epoch.isNonEmptyArray(keys) + unless options.startTime? + options.startTime = parseInt(new Date().getTime() / 1000) + (layer.values[0] for layer in format([datum], keys, options)) + + return format +)() + +# Convenience data formatting method for easily accessing the various formatters. +# @param [String] formatter Name of the formatter to use. +# @param [Array] data Data to format. +# @param [Object] options Options to pass to the formatter (if any). +Epoch.data = (formatter, args...) -> + return [] unless (formatFn = Epoch.Data.Format[formatter])? + formatFn.apply formatFn, args + + +# Method used by charts and models for handling option based data formatting. +# Abstracted here because we'd like to allow models and indivisual charts to +# perform this action depending on the context. +Epoch.Data.formatData = (data=[], type, dataFormat) -> + return data unless Epoch.isNonEmptyArray(data) + + if Epoch.isString(dataFormat) + opts = { type: type } + return Epoch.data(dataFormat, data, opts) + + return data unless Epoch.isObject(dataFormat) + return data unless dataFormat.name? and Epoch.isString(dataFormat.name) + return data unless Epoch.Data.Format[dataFormat.name]? + + args = [dataFormat.name, data] + if dataFormat.arguments? and Epoch.isArray(dataFormat.arguments) + args.push(a) for a in dataFormat.arguments + + if dataFormat.options? + opts = dataFormat.options + if type? + opts.type ?= type + args.push opts + else if type? + args.push {type: type} + + Epoch.data.apply(Epoch.data, args) + +# Method used to format incoming entries for real-time charts. +Epoch.Data.formatEntry = (datum, type, format) -> + return datum unless format? + + if Epoch.isString(format) + opts = { type: type } + return Epoch.Data.Format[format].entry datum, opts + + return datum unless Epoch.isObject(format) + return datum unless format.name? and Epoch.isString(format.name) + return datum unless Epoch.Data.Format[format.name]? + + dataFormat = Epoch.Util.defaults format, {} + + args = [datum] + if dataFormat.arguments? and Epoch.isArray(dataFormat.arguments) + args.push(a) for a in dataFormat.arguments + + if dataFormat.options? + opts = dataFormat.options + opts.type = type + args.push opts + else if type? + args.push {type: type} + + entry = Epoch.Data.Format[dataFormat.name].entry + entry.apply entry, args diff --git a/debian/missing-sources/epoch/src/epoch.coffee b/debian/missing-sources/epoch/src/epoch.coffee new file mode 100644 index 0000000..b2d06ca --- /dev/null +++ b/debian/missing-sources/epoch/src/epoch.coffee @@ -0,0 +1,17 @@ +window.Epoch ?= {} +window.Epoch.Chart ?= {} +window.Epoch.Time ?= {} +window.Epoch.Util ?= {} +window.Epoch.Formats ?= {} + +# Sends a warning to the developer console with the given message. +# @param [String] msg Message for the warning. +Epoch.warn = (msg) -> + (console.warn or console.log)("Epoch Warning: #{msg}") + +# Raises an exception with the given message (with the 'Epoch Error:' preamble). +# @param [String] msg Specific message for the exception. +Epoch.exception = (msg) -> + throw "Epoch Error: #{msg}" + +# "I think, baby, I was born just a little late!" -- Middle Class Rut diff --git a/debian/missing-sources/epoch/src/model.coffee b/debian/missing-sources/epoch/src/model.coffee new file mode 100644 index 0000000..76f6acd --- /dev/null +++ b/debian/missing-sources/epoch/src/model.coffee @@ -0,0 +1,55 @@ +# Data model for epoch charts. By instantiating a model and passing it to each +# of the charts on a page the application programmer can update data once and +# have each of the charts respond accordingly. +# +# In addition to setting basic / historical data via the setData method, the +# model also supports the push method, which when used will cause real-time +# plots to automatically update and animate. +class Epoch.Model extends Epoch.Events + defaults = + dataFormat: null + + # Creates a new Model. + # @option options dataFormat The default data fromat for the model. + # @option data Initial data for the model. + constructor: (options={}) -> + super() + options = Epoch.Util.defaults options, defaults + @dataFormat = options.dataFormat + @data = options.data + @loading = false + + # Sets the model's data. + # @param data Data to set for the model. + # @event data:updated Instructs listening charts that new data is available. + setData: (data) -> + @data = data + @trigger 'data:updated' + + # Pushes a new entry into the model. + # @param entry Entry to push. + # @event data:push Instructs listening charts that a new data entry is available. + push: (entry) -> + @entry = entry + @trigger 'data:push' + + # Determines if the model has data. + # @return true if the model has data, false otherwise. + hasData: -> + @data? + + # Retrieves and formats adata for the specific chart type and data format. + # @param [String] type Type of the chart for which to fetch the data. + # @param [String, Object] dataFormat (optional) Used to override the model's default data format. + # @return The model's data formatted based the parameters. + getData: (type, dataFormat) -> + dataFormat ?= @dataFormat + Epoch.Data.formatData @data, type, dataFormat + + # Retrieves the latest data entry that was pushed into the model. + # @param [String] type Type of the chart for which to fetch the data. + # @param [String, Object] dataFormat (optional) Used to override the model's default data format. + # @return The model's next data entry formatted based the parameters. + getNext: (type, dataFormat) -> + dataFormat ?= @dataFormat + Epoch.Data.formatEntry @entry, type, dataFormat diff --git a/debian/missing-sources/epoch/src/time.coffee b/debian/missing-sources/epoch/src/time.coffee new file mode 100644 index 0000000..402cc50 --- /dev/null +++ b/debian/missing-sources/epoch/src/time.coffee @@ -0,0 +1,615 @@ +# Real-time Plot Base Class. Uses an html5 canvas to recreate the basic d3 drawing routines +# while simultaneously reducing the load on the viewer's cpu (and, you know, not leaking +# memory which ultimately leads to a crashed browser). +# +# The class also handles the creation of axes and margins common to all time-series plots. +# Furthermore it layers the canvas below an SVG element to keep visual consistency when +# rendering text, glyphs, etc. +class Epoch.Time.Plot extends Epoch.Chart.Canvas + defaults = + range: null + fps: 24 + historySize: 120 + windowSize: 40 + queueSize: 10 + axes: ['bottom'] + ticks: + time: 15 + left: 5 + right: 5 + tickFormats: + top: Epoch.Formats.seconds + bottom: Epoch.Formats.seconds + left: Epoch.Formats.si + right: Epoch.Formats.si + + defaultAxisMargins = + top: 25 + right: 50 + bottom: 25 + left: 50 + + optionListeners = + 'option:margins': 'marginsChanged' + 'option:margins.top': 'marginsChanged' + 'option:margins.right': 'marginsChanged' + 'option:margins.bottom': 'marginsChanged' + 'option:margins.left': 'marginsChanged' + 'option:axes': 'axesChanged' + 'option:ticks': 'ticksChanged' + 'option:ticks.top': 'ticksChanged' + 'option:ticks.right': 'ticksChanged' + 'option:ticks.bottom': 'ticksChanged' + 'option:ticks.left': 'ticksChanged' + 'option:tickFormats': 'tickFormatsChanged' + 'option:tickFormats.top': 'tickFormatsChanged' + 'option:tickFormats.right': 'tickFormatsChanged' + 'option:tickFormats.bottom': 'tickFormatsChanged' + 'option:tickFormats.left': 'tickFormatsChanged' + + # Creates a new real-time plot. + # + # @param [Object] options Options for the plot. + # @option options [Integer] fps Number of frames per second to use when animating + # the plot. + # @option options [Integer] historySize Maximum number of elements to keep in history + # for the plot. + # @option options [Integer] windowSize Number of entries to simultaneously display + # when rendering the visualization. + # @option options [Integer] queueSize Number of elements to queue while not animating + # but still recieving elements. In some browsers, intervals will not fire if the + # page containing them is not the active tab. By setting a maximum limit to the + # number of unprocessed data points we can ensure that the memory footprint of the + # page does not get out of hand. + # @option options [Object] margins Explicit margins to use for the visualization. Note + # that these are optional and will be automatically generated based on which axes are + # used for the visualization. Margins are keyed by their position (top, left, bottom + # and/or right) and should map to [Integer] values. + # @option options [Array] axes Which axes to display when rendering the visualization + # (top, left, bottom, and/or right). + # @option options [Object] ticks Number of ticks to display on each axis available axes + # ares: time, left, and right. The number provided for the left and right axes are in + # absolute terms (i.e. there will be exactly that number of ticks). The time ticks + # denote how often a tick should be generated (e.g. if 5 is provided then a tick will + # be added every fifth time you push a new data entry into the visualization). + # @option options [Object] tickFormats Formatting functions for ticks on the given axes. + # The avaiable axes are: top, bottom, left, and right. + constructor: (@options) -> + givenMargins = Epoch.Util.copy(@options.margins) or {} + super(@options = Epoch.Util.defaults(@options, defaults)) + + if @options.model + @options.model.on 'data:push', => @pushFromModel() + + # Queue entering data to get around memory bloat and "non-active" tab issues + @_queue = [] + + # Margins + @margins = {} + for pos in ['top', 'right', 'bottom', 'left'] + @margins[pos] = if @options.margins? and @options.margins[pos]? + @options.margins[pos] + else if @hasAxis(pos) + defaultAxisMargins[pos] + else + 6 + + # SVG Overlay + @svg = @el.insert('svg', ':first-child') + .attr('width', @width) + .attr('height', @height) + .style('z-index', '1000') + + # Position the canvas "under" the SVG element + if @el.style('position') != 'absolute' and @el.style('position') != 'relative' + @el.style('position', 'relative') + + @canvas.style { position: 'absolute', 'z-index': '999' } + @_sizeCanvas() + + # Animation / Transitions + @animation = + interval: null + active: false + delta: => -(@w() / @options.fps), + tickDelta: => -( (@w() / @pixelRatio) / @options.fps ) + frame: 0, + duration: @options.fps + + # Add SVG Axes + @_buildAxes() + + # Callback used for animation + @animationCallback = => @_animate() + + # Listen for specific option changes + @onAll optionListeners + + # Positions and sizes the canvas based on margins and axes. + _sizeCanvas: -> + @canvas.attr + width: @innerWidth() + height: @innerHeight() + + @canvas.style + width: "#{@innerWidth() / @pixelRatio}px" + height: "#{@innerHeight() / @pixelRatio}px" + top: "#{@margins.top}px" + left: "#{@margins.left}px" + + # Removes any axes found in the SVG and adds both the time and range axes to the plot. + _buildAxes: -> + @svg.selectAll('.axis').remove() + @_prepareTimeAxes() + @_prepareRangeAxes() + + # Works exactly as in Epoch.Chart.Base with the addition of truncating value arrays + # to that of the historySize defined in the chart's options. + _annotateLayers: (prepared) -> + data = [] + for own i, layer of prepared + copy = Epoch.Util.copy(layer) + start = Math.max(0, layer.values.length - @options.historySize) + copy.values = layer.values.slice(start) + classes = ['layer'] + classes.push "category#{(i|0)+1}" + classes.push(Epoch.Util.dasherize layer.label) if layer.label? + copy.className = classes.join(' ') + copy.visible = true + data.push copy + return data + + # This method is called to provide a small offset for placement of horizontal ticks. + # The value returned will be added to the x value of each tick as they are being + # rendered. + # + # @return [Number] The horizontal offset for the top and bottom axes ticks. + _offsetX: -> 0 + + # Builds time axes (bottom and top) + _prepareTimeAxes: -> + if @hasAxis('bottom') + axis = @bottomAxis = @svg.append('g') + .attr('class', "x axis bottom canvas") + .attr('transform', "translate(#{@margins.left-1}, #{@innerHeight()/@pixelRatio+@margins.top})") + axis.append('path') + .attr('class', 'domain') + .attr('d', "M0,0H#{@innerWidth()/@pixelRatio+1}") + + if @hasAxis('top') + axis = @topAxis = @svg.append('g') + .attr('class', "x axis top canvas") + .attr('transform', "translate(#{@margins.left-1}, #{@margins.top})") + axis.append('path') + .attr('class', 'domain') + .attr('d', "M0,0H#{@innerWidth()/@pixelRatio+1}") + + @_resetInitialTimeTicks() + + # Resets the initial ticks for the time axes. + _resetInitialTimeTicks: -> + tickInterval = @options.ticks.time + @_ticks = [] + @_tickTimer = tickInterval + + @bottomAxis.selectAll('.tick').remove() if @bottomAxis? + @topAxis.selectAll('.tick').remove() if @topAxis? + + for layer in @data + continue unless Epoch.isNonEmptyArray(layer.values) + [i, k] = [@options.windowSize-1, layer.values.length-1] + while i >= 0 and k >= 0 + @_pushTick i, layer.values[k].time, false, true + i -= tickInterval + k -= tickInterval + break + + # Builds the range axes (left and right) + _prepareRangeAxes: -> + if @hasAxis('left') + @svg.append("g") + .attr("class", "y axis left") + .attr('transform', "translate(#{@margins.left-1}, #{@margins.top})") + .call(@leftAxis()) + + if @hasAxis('right') + @svg.append('g') + .attr('class', 'y axis right') + .attr('transform', "translate(#{@width - @margins.right}, #{@margins.top})") + .call(@rightAxis()) + + # @return [Object] The d3 left axis. + leftAxis: -> + ticks = @options.ticks.left + axis = d3.svg.axis().scale(@ySvgLeft()).orient('left') + .tickFormat(@options.tickFormats.left) + if ticks == 2 + axis.tickValues @extent((d) -> d.y) + else + axis.ticks(ticks) + + # @return [Object] The d3 right axis. + rightAxis: -> + extent = @extent((d) -> d.y) + ticks = @options.ticks.right + axis = d3.svg.axis().scale(@ySvgRight()).orient('right') + .tickFormat(@options.tickFormats.right) + if ticks == 2 + axis.tickValues @extent((d) -> d.y) + else + axis.ticks(ticks) + + # Determines if the visualization is displaying the axis with the given name. + # @param [String] name Name of the axis + # @return [Boolean] true if the axis was set in the options, false otherwise. + hasAxis: (name) -> + @options.axes.indexOf(name) > -1 + + # @return [Number] the width of the visualization area of the plot (full width - margins) + innerWidth: -> + (@width - (@margins.left + @margins.right)) * @pixelRatio + + # @return [Number] the height of the visualization area of the plot (full height - margins) + innerHeight: -> + (@height - (@margins.top + @margins.bottom)) * @pixelRatio + + # Abstract method for performing any preprocessing before queuing new entries + # @param entry [Object] The entry to prepare. + # @return [Object] The prepared entry. + _prepareEntry: (entry) -> entry + + # Abstract method for preparing a group of layered entries entering the visualization + # @param [Array] layers The layered entries to prepare. + # @return [Array] The prepared layers. + _prepareLayers: (layers) -> layers + + # This method will remove the first incoming entry from the visualization's queue + # and shift it into the working set (aka window). It then starts the animating the + # transition of the element into the visualization. + # @event transition:start in the case that animation is actually started. + _startTransition: -> + return if @animation.active == true or @_queue.length == 0 + @trigger 'transition:start' + @_shift() + @animation.active = true + @animation.interval = setInterval(@animationCallback, 1000/@options.fps) + + # Stops animating and clears the animation interval given there is no more + # incoming data to process. Also finalizes tick entering and exiting. + # @event transition:end After the transition has completed. + _stopTransition: -> + return unless @inTransition() + + # Shift data off the end + for layer in @data + continue unless layer.values.length > @options.windowSize + 1 + layer.values.shift() + + # Finalize tick transitions + [firstTick, lastTick] = [@_ticks[0], @_ticks[@_ticks.length-1]] + + if lastTick? and lastTick.enter + lastTick.enter = false + lastTick.opacity = 1 + + if firstTick? and firstTick.exit + @_shiftTick() + + # Reset the animation frame modulus + @animation.frame = 0 + + # Trigger that we are done transitioning + @trigger 'transition:end' + + # Clear the transition interval unless another entry is already queued + if @_queue.length > 0 + @_shift() + else + @animation.active = false + clearInterval @animation.interval + + # Determines if the plot is currently animating a transition. + # @return [Boolean] true if the plot is animating, false otherwise. + inTransition: -> + @animation.active + + # This method is used by the application programmer to introduce new data into + # the timeseries plot. The method queues the incoming data, ensures a fixed size + # for the data queue, and finally calls _startTransition method to + # begin animating the plot. + # @param [Array] layers Layered incoming visualization data. + # @event push Triggered after the new data has been pushed into the queue. + push: (layers) -> + layers = @_prepareLayers(layers) + + # Handle entry queue maximum size + if @_queue.length > @options.queueSize + @_queue.splice @options.queueSize, (@_queue.length - @options.queueSize) + return false if @_queue.length == @options.queueSize + + # Push the entry into the queue + @_queue.push layers.map((entry) => @_prepareEntry(entry)) + + @trigger 'push' + + # Begin the transition unless we are already doing so + @_startTransition() unless @inTransition() + + # Fetches new entry data from the model in response to a 'data:push' event. + pushFromModel: -> + @push @options.model.getNext(@options.type, @options.dataFormat) + + # Shift elements off the incoming data queue (see the implementation of + # push above). + # + # If there's data to be shoved into the visualization it will pull it + # off the queue and put it into the working dataset. It also calls through + # to @_updateTicks to handle horizontal (or "time") axes tick transitions + # since we're implementing independent of d3 as well. + # + # @event before:shift Before an element has been shifted off the queue. + # @event after:shift After the element has been shifted off the queue. + _shift: -> + @trigger 'before:shift' + entry = @_queue.shift() + layer.values.push(entry[i]) for own i, layer of @data + @_updateTicks(entry[0].time) + @_transitionRangeAxes() + @trigger 'after:shift' + + # Transitions the left and right axes when the range of the plot has changed. + _transitionRangeAxes: -> + if @hasAxis('left') + @svg.selectAll('.y.axis.left').transition() + .duration(500) + .ease('linear') + .call(@leftAxis()) + + if @hasAxis('right') + @svg.selectAll('.y.axis.right').transition() + .duration(500) + .ease('linear') + .call(@rightAxis()) + + # Performs the animation for transitioning elements in the visualization. + _animate: -> + return unless @inTransition() + @_stopTransition() if ++@animation.frame == @animation.duration + @draw(@animation.frame * @animation.delta()) + @_updateTimeAxes() + + # @param [Array] givenDomain A given domain for the scale + # @return [Function] The y scale for the plot + y: (givenDomain) -> + d3.scale.linear() + .domain(@_getScaleDomain(givenDomain)) + .range([@innerHeight(), 0]) + + # @param [Array] givenDomain Optional domain to override default + # @return [Function] The y scale for the svg portions of the plot + ySvg: (givenDomain) -> + d3.scale.linear() + .domain(@_getScaleDomain(givenDomain)) + .range([@innerHeight() / @pixelRatio, 0]) + + # @return [Function] The y scale for the svg portion of the plot for the left axis + ySvgLeft: -> + if @options.range? + @ySvg @options.range.left + else + @ySvg() + + # @return [Function] The y scale for the svg portion of the plot for the right axis + ySvgRight: -> + if @options.range? + @ySvg @options.range.right + else + @ySvg() + + # @return [Number] The width of a single section of the graph pertaining to a data point + w: -> + @innerWidth() / @options.windowSize + + # This is called every time we introduce new data (as a result of _shift) + # it checks to see if we also need to update the working tick set and + # makes the approriate changes for handling tick animation (enter, exit, + # and update in the d3 model). + # + # @param [Integer] newTime Current newest timestamp in the data + _updateTicks: (newTime) -> + return unless @hasAxis('top') or @hasAxis('bottom') + + # Incoming ticks + unless (++@_tickTimer) % @options.ticks.time + @_pushTick(@options.windowSize, newTime, true) + + # Outgoing ticks + return unless @_ticks.length > 0 + unless @_ticks[0].x - (@w()/@pixelRatio) >= 0 + @_ticks[0].exit = true + + # Makes and pushes a new tick into the visualization. + # + # @param bucket Index in the data window where the tick should initially be position + # @param time The unix timestamp associated with the tick + # @param enter Whether or not the tick should be considered as "newly entering" + # Used primarily for performing the tick opacity tween. + _pushTick: (bucket, time, enter=false, reverse=false) -> + return unless @hasAxis('top') or @hasAxis('bottom') + tick = + time: time + x: bucket*(@w()/@pixelRatio) + @_offsetX() + opacity: if enter then 0 else 1 + enter: if enter then true else false + exit: false + + if @hasAxis('bottom') + g = @bottomAxis.append('g') + .attr('class', 'tick major') + .attr('transform', "translate(#{tick.x+1},0)") + .style('opacity', tick.opacity) + + g.append('line') + .attr('y2', 6) + + g.append('text') + .attr('text-anchor', 'middle') + .attr('dy', 19) + .text(@options.tickFormats.bottom(tick.time)) + + tick.bottomEl = g + + if @hasAxis('top') + g = @topAxis.append('g') + .attr('class', 'tick major') + .attr('transform', "translate(#{tick.x+1},0)") + .style('opacity', tick.opacity) + + g.append('line') + .attr('y2', -6) + + g.append('text') + .attr('text-anchor', 'middle') + .attr('dy', -10) + .text(@options.tickFormats.top(tick.time)) + + tick.topEl = g + + if reverse + @_ticks.unshift tick + else + @_ticks.push tick + return tick + + # Shifts a tick that is no longer needed out of the visualization. + _shiftTick: -> + return unless @_ticks.length > 0 + tick = @_ticks.shift() + tick.topEl.remove() if tick.topEl? + tick.bottomEl.remove() if tick.bottomEl? + + # This performs animations for the time axes (top and bottom). + _updateTimeAxes: -> + return unless @hasAxis('top') or @hasAxis('bottom') + [dx, dop] = [@animation.tickDelta(), 1 / @options.fps] + + for tick in @_ticks + tick.x += dx + if @hasAxis('bottom') + tick.bottomEl.attr('transform', "translate(#{tick.x+1},0)") + if @hasAxis('top') + tick.topEl.attr('transform', "translate(#{tick.x+1},0)") + + if tick.enter + tick.opacity += dop + else if tick.exit + tick.opacity -= dop + + if tick.enter or tick.exit + tick.bottomEl.style('opacity', tick.opacity) if @hasAxis('bottom') + tick.topEl.style('opacity', tick.opacity) if @hasAxis('top') + + # Draws the visualization in the plot's canvas. + # @param delta The current x offset to apply to all elements when rendering. This number + # will be 0 when the plot is not animating and negative when it is. + # @abstract It does nothing on its own but is provided so that subclasses can + # define a custom rendering routine. + draw: (delta=0) -> super() + + dimensionsChanged: -> + super() + @svg.attr('width', @width).attr('height', @height) + @_sizeCanvas() + @_buildAxes() + @draw(@animation.frame * @animation.delta()) + + # Updates axes in response to an option:axes event. + axesChanged: -> + for pos in ['top', 'right', 'bottom', 'left'] + continue if @options.margins? and @options.margins[pos]? + if @hasAxis(pos) + @margins[pos] = defaultAxisMargins[pos] + else + @margins[pos] = 6 + @_sizeCanvas() + @_buildAxes() + @draw(@animation.frame * @animation.delta()) + + # Updates ticks in response to an option.ticks.* event. + ticksChanged: -> + @_resetInitialTimeTicks() + @_transitionRangeAxes() + @draw(@animation.frame * @animation.delta()) + + # Updates tick formats in response to an option.tickFormats.* event. + tickFormatsChanged: -> + @_resetInitialTimeTicks() + @_transitionRangeAxes() + @draw(@animation.frame * @animation.delta()) + + # Updates margins in response to an option.margins.* event. + marginsChanged: -> + return unless @options.margins? + for own pos, size of @options.margins + unless size? + @margins[pos] = 6 + else + @margins[pos] = size + + @_sizeCanvas() + @draw(@animation.frame * @animation.delta()) + + layerChanged: -> + @_transitionRangeAxes() + super() + + +# Base class for all "stacked" plot types (e.g. bar charts, area charts, etc.) +# @abstract It does not perform rendering but instead formats the data +# so as to ease the process of rendering stacked plots. +class Epoch.Time.Stack extends Epoch.Time.Plot + # Sets stacking information (y0) for each of the points in each layer + _stackLayers: -> + return unless (layers = @getVisibleLayers()).length > 0 + for i in [0...layers[0].values.length] + y0 = 0 + for layer in layers + layer.values[i].y0 = y0 + y0 += layer.values[i].y + + # Adds stacking information for layers entering the visualization. + # @param [Array] layers Layers to stack. + _prepareLayers: (layers) -> + y0 = 0 + for own i, d of layers + continue unless @data[i].visible + d.y0 = y0 + y0 += d.y + return layers + + # Ensures that elements are stacked when setting the initial data. + # @param [Array] data Layered data to set for the visualization. + setData: (data) -> + super(data) + @_stackLayers() + + # Finds the correct extent to use for range axes (left and right). + # @return [Array] An extent array with the first element equal to 0 + # and the second element equal to the maximum value amongst the + # stacked entries. + extent: -> + [max, layers] = [0, @getVisibleLayers()] + return [0, 0] unless layers.length + + for i in [0...layers[0].values.length] + sum = 0 + for j in [0...layers.length] + sum += layers[j].values[i].y + max = sum if sum > max + + [0, max] + + layerChanged: -> + @_stackLayers() + @_prepareLayers(layers) for layers in @_queue + super() diff --git a/debian/missing-sources/epoch/src/time/area.coffee b/debian/missing-sources/epoch/src/time/area.coffee new file mode 100644 index 0000000..22bf9db --- /dev/null +++ b/debian/missing-sources/epoch/src/time/area.coffee @@ -0,0 +1,80 @@ + +# Real-time stacked area chart implementation. +class Epoch.Time.Area extends Epoch.Time.Stack + constructor: (@options={}) -> + @options.type ?= 'time.area' + super(@options) + @draw() + + # Sets the appropriate styles to the graphics context given a particular layer. + # @param [Object] layer Layer for which to set the styles. + setStyles: (layer) -> + if layer? && layer.className? + styles = @getStyles "g.#{layer.className.replace(/\s/g,'.')} path.area" + else + styles = @getStyles "g path.area" + @ctx.fillStyle = styles.fill + if styles.stroke? + @ctx.strokeStyle = styles.stroke + if styles['stroke-width']? + @ctx.lineWidth = styles['stroke-width'].replace('px', '') + + # Draws areas for the chart + _drawAreas: (delta=0) -> + [y, w, layers] = [@y(), @w(), @getVisibleLayers()] + + for i in [layers.length-1..0] + continue unless (layer = layers[i]) + + @setStyles layer + @ctx.beginPath() + + [j, k, trans] = [@options.windowSize, layer.values.length, @inTransition()] + firstX = null + while (--j >= -2) and (--k >= 0) + entry = layer.values[k] + args = [(j+1)*w+delta, y(entry.y + entry.y0)] + args[0] += w if trans + if i == @options.windowSize - 1 + @ctx.moveTo.apply @ctx, args + else + @ctx.lineTo.apply @ctx, args + + if trans + borderX = (j+3)*w+delta + else + borderX = (j+2)*w+delta + + @ctx.lineTo(borderX, @innerHeight()) + @ctx.lineTo(@width*@pixelRatio+w+delta, @innerHeight()) + @ctx.closePath() + @ctx.fill() + + # Draws strokes for the chart + _drawStrokes: (delta=0) -> + [y, w, layers] = [@y(), @w(), @getVisibleLayers()] + + for i in [layers.length-1..0] + continue unless (layer = layers[i]) + @setStyles layer + @ctx.beginPath() + + [i, k, trans] = [@options.windowSize, layer.values.length, @inTransition()] + firstX = null + while (--i >= -2) and (--k >= 0) + entry = layer.values[k] + args = [(i+1)*w+delta, y(entry.y + entry.y0)] + args[0] += w if trans + if i == @options.windowSize - 1 + @ctx.moveTo.apply @ctx, args + else + @ctx.lineTo.apply @ctx, args + + @ctx.stroke() + + # Draws the area chart. + draw: (delta=0) -> + @clear() + @_drawAreas(delta) + @_drawStrokes(delta) + super() diff --git a/debian/missing-sources/epoch/src/time/bar.coffee b/debian/missing-sources/epoch/src/time/bar.coffee new file mode 100644 index 0000000..7bcb7be --- /dev/null +++ b/debian/missing-sources/epoch/src/time/bar.coffee @@ -0,0 +1,48 @@ + +# Real-time Bar Chart implementation. +class Epoch.Time.Bar extends Epoch.Time.Stack + constructor: (@options={}) -> + @options.type ?= 'time.bar' + super(@options) + @draw() + + # @return [Number] An offset used to align the ticks to the center of the rendered bars. + _offsetX: -> + 0.5 * @w() / @pixelRatio + + # Sets the styles for the graphics context given a layer class name. + # @param [String] className The class name to use when deriving the styles. + setStyles: (className) -> + styles = @getStyles "rect.bar.#{className.replace(/\s/g,'.')}" + @ctx.fillStyle = styles.fill + + if !styles.stroke? or styles.stroke == 'none' + @ctx.strokeStyle = 'transparent' + else + @ctx.strokeStyle = styles.stroke + + if styles['stroke-width']? + @ctx.lineWidth = styles['stroke-width'].replace('px', '') + + # Draws the stacked bar chart. + draw: (delta=0) -> + @clear() + [y, w] = [@y(), @w()] + + for layer in @getVisibleLayers() + continue unless Epoch.isNonEmptyArray(layer.values) + @setStyles(layer.className) + + [i, k, trans] = [@options.windowSize, layer.values.length, @inTransition()] + iBoundry = if trans then -1 else 0 + + while (--i >= iBoundry) and (--k >= 0) + entry = layer.values[k] + [ex, ey, ey0] = [i*w+delta, entry.y, entry.y0] + ex += w if trans + args = [ex+1, y(ey+ey0), w-2, @innerHeight()-y(ey)+0.5*@pixelRatio] + + @ctx.fillRect.apply(@ctx, args) + @ctx.strokeRect.apply(@ctx, args) + + super() diff --git a/debian/missing-sources/epoch/src/time/gauge.coffee b/debian/missing-sources/epoch/src/time/gauge.coffee new file mode 100644 index 0000000..8efadb2 --- /dev/null +++ b/debian/missing-sources/epoch/src/time/gauge.coffee @@ -0,0 +1,209 @@ + +# Real-time Gauge Visualization. Note: Looks best with a 4:3 aspect ratio (w:h) +class Epoch.Time.Gauge extends Epoch.Chart.Canvas + defaults = + type: 'time.gauge' + domain: [0, 1] + ticks: 10 + tickSize: 5 + tickOffset: 5 + fps: 34 + format: Epoch.Formats.percent + + optionListeners = + 'option:domain': 'domainChanged' + 'option:ticks': 'ticksChanged' + 'option:tickSize': 'tickSizeChanged' + 'option:tickOffset': 'tickOffsetChanged' + 'option:format': 'formatChanged' + + # Creates the new gauge chart. + # @param [Object] options Options for the gauge chart. + # @option options [Array] domain The domain to use when rendering values (default: [0, 1]). + # @option options [Integer] ticks Number of ticks to render (default: 10). + # @option options [Integer] tickSize The length (in pixels) for each tick (default: 5). + # @option options [Integer] tickOffset The number of pixels by which to offset ticks from the outer arc (default: 5). + # @option options [Integer] fps The number of animation frames to render per second (default: 34). + # @option options [Function] format The formatting function to use when rendering the gauge label + # (default: Epoch.Formats.percent). + constructor: (@options={}) -> + super(@options = Epoch.Util.defaults(@options, defaults)) + @value = @options.value or 0 + + if @options.model + @options.model.on 'data:push', => @pushFromModel() + + # SVG Labels Overlay + if @el.style('position') != 'absolute' and @el.style('position') != 'relative' + @el.style('position', 'relative') + + @svg = @el.insert('svg', ':first-child') + .attr('width', @width) + .attr('height', @height) + .attr('class', 'gauge-labels') + + @svg.style + 'position': 'absolute' + 'z-index': '1' + + @svg.append('g') + .attr('transform', "translate(#{@textX()}, #{@textY()})") + .append('text') + .attr('class', 'value') + .text(@options.format(@value)) + + # Animations + @animation = + interval: null + active: false + delta: 0 + target: 0 + + @_animate = => + if Math.abs(@animation.target - @value) < Math.abs(@animation.delta) + @value = @animation.target + clearInterval @animation.interval + @animation.active = false + else + @value += @animation.delta + + @svg.select('text.value').text(@options.format(@value)) + @draw() + + @onAll optionListeners + @draw() + + # Sets the value for the gauge to display and begins animating the guage. + # @param [Number] value Value to set for the gauge. + update: (value) -> + @animation.target = value + @animation.delta = (value - @value) / @options.fps + unless @animation.active + @animation.interval = setInterval @_animate, (1000/@options.fps) + @animation.active = true + + # Alias for the update() method. + # @param [Number] value Value to set for the gauge. + push: (value) -> + @update value + + # Responds to a model's 'data:push' event. + pushFromModel: -> + next = @options.model.getNext(@options.type, @options.dataFormat) + @update next + + # @return [Number] The radius for the gauge. + radius: -> @getHeight() / 1.58 + + # @return [Number] The center position x-coordinate for the gauge. + centerX: -> @getWidth() / 2 + + # @return [Number] The center position y-coordinate for the gauge. + centerY: -> 0.68 * @getHeight() + + # @return [Number] The x-coordinate for the gauge text display. + textX: -> @width / 2 + + # @return [Number] The y-coordinate for the gauge text display. + textY: -> 0.48 * @height + + # @return [Number] The angle to set for the needle given a value within the domain. + # @param [Number] value Value to translate into a needle angle. + getAngle: (value) -> + [a, b] = @options.domain + ((value - a) / (b - a)) * (Math.PI + 2*Math.PI/8) - Math.PI/2 - Math.PI/8 + + # Sets context styles given a particular selector. + # @param [String] selector The selector to use when setting the styles. + setStyles: (selector) -> + styles = @getStyles selector + @ctx.fillStyle = styles.fill + @ctx.strokeStyle = styles.stroke + @ctx.lineWidth = styles['stroke-width'].replace('px', '') if styles['stroke-width']? + + # Draws the gauge. + draw: -> + [cx, cy, r] = [@centerX(), @centerY(), @radius()] + [tickOffset, tickSize] = [@options.tickOffset, @options.tickSize] + + @clear() + + # Draw Ticks + t = d3.scale.linear() + .domain([0, @options.ticks]) + .range([ -(9/8)*Math.PI, Math.PI/8 ]) + + @setStyles '.epoch .gauge .tick' + @ctx.beginPath() + for i in [0..@options.ticks] + a = t(i) + [c, s] = [Math.cos(a), Math.sin(a)] + + x1 = c * (r-tickOffset) + cx + y1 = s * (r-tickOffset) + cy + x2 = c * (r-tickOffset-tickSize) + cx + y2 = s * (r-tickOffset-tickSize) + cy + + @ctx.moveTo x1, y1 + @ctx.lineTo x2, y2 + + @ctx.stroke() + + # Outer arc + @setStyles '.epoch .gauge .arc.outer' + @ctx.beginPath() + @ctx.arc cx, cy, r, -(9/8)*Math.PI, (1/8)*Math.PI, false + @ctx.stroke() + + # Inner arc + @setStyles '.epoch .gauge .arc.inner' + @ctx.beginPath() + @ctx.arc cx, cy, r-10, -(9/8)*Math.PI, (1/8)*Math.PI, false + @ctx.stroke() + + @drawNeedle() + + super() + + # Draws the needle. + drawNeedle: -> + [cx, cy, r] = [@centerX(), @centerY(), @radius()] + ratio = @value / @options.domain[1] + + @setStyles '.epoch .gauge .needle' + @ctx.beginPath() + @ctx.save() + @ctx.translate cx, cy + @ctx.rotate @getAngle(@value) + + @ctx.moveTo 4 * @pixelRatio, 0 + @ctx.lineTo -4 * @pixelRatio, 0 + @ctx.lineTo -1 * @pixelRatio, 19-r + @ctx.lineTo 1, 19-r + @ctx.fill() + + @setStyles '.epoch .gauge .needle-base' + @ctx.beginPath() + @ctx.arc 0, 0, (@getWidth() / 25), 0, 2*Math.PI + @ctx.fill() + + @ctx.restore() + + # Correctly responds to an option: + domainChanged: -> @draw() + + # Correctly responds to an option: + ticksChanged: -> @draw() + + # Correctly responds to an option: + tickSizeChanged: -> @draw() + + # Correctly responds to an option: + tickOffsetChanged: -> @draw() + + # Correctly responds to an option: + formatChanged: -> @svg.select('text.value').text(@options.format(@value)) + + + +# "The mother of a million sons... CIVILIZATION!" -- Justice diff --git a/debian/missing-sources/epoch/src/time/heatmap.coffee b/debian/missing-sources/epoch/src/time/heatmap.coffee new file mode 100644 index 0000000..d7f2c50 --- /dev/null +++ b/debian/missing-sources/epoch/src/time/heatmap.coffee @@ -0,0 +1,261 @@ + +# Real-time Heatmap Implementation. +class Epoch.Time.Heatmap extends Epoch.Time.Plot + defaults = + type: 'time.heatmap' + buckets: 10 + bucketRange: [0, 100] + opacity: 'linear' + bucketPadding: 2 + paintZeroValues: false + cutOutliers: false + + # Easy to use "named" color functions + colorFunctions = + root: (value, max) -> Math.pow(value/max, 0.5) + linear: (value, max) -> value / max + quadratic: (value, max) -> Math.pow(value/max, 2) + cubic: (value, max) -> Math.pow(value/max, 3) + quartic: (value, max) -> Math.pow(value/max, 4) + quintic: (value, max) -> Math.pow(value/max, 5) + + optionListeners = + 'option:buckets': 'bucketsChanged' + 'option:bucketRange': 'bucketRangeChanged' + 'option:opacity': 'opacityChanged' + 'option:bucketPadding': 'bucketPaddingChanged' + 'option:paintZeroValues': 'paintZeroValuesChanged' + 'option:cutOutliers': 'cutOutliersChanged' + + # Creates a new heatmap. + # @param [Object] options Options for the heatmap. + # @option options [Integer] buckets Number of vertical buckets to use when normalizing the + # incoming histogram data for visualization in the heatmap (default: 10). + # @option options [Array] bucketRange A range of acceptable values to be bucketed (default: [0, 100]). + # @option options [String, Function] opacity The opacity coloring function to use when rendering buckets + # in a column. The built-in functions (referenced by string) are: 'root', 'linear', 'quadratic', 'cubic', + # 'quartic', and 'quintic'. A custom function can be supplied given it accepts two parameters (value, max) + # and returns a numeric value from 0 to 1. Default: linear. + # @option options [Number] bucketPadding Amount of padding to apply around buckets (default: 2). + constructor: (@options={}) -> + super(@options = Epoch.Util.defaults(@options, defaults)) + @_setOpacityFunction() + @_setupPaintCanvas() + @onAll optionListeners + @draw() + + _setOpacityFunction: -> + if Epoch.isString(@options.opacity) + @_opacityFn = colorFunctions[@options.opacity] + Epoch.exception "Unknown coloring function provided '#{@options.opacity}'" unless @_opacityFn? + else if Epoch.isFunction(@options.opacity) + @_opacityFn = @options.opacity + else + Epoch.exception "Unknown type for provided coloring function." + + # Prepares initially set data for rendering. + # @param [Array] data Layered histogram data for the visualization. + setData: (data) -> + super(data) + for layer in @data + layer.values = layer.values.map((entry) => @_prepareEntry(entry)) + + # Distributes the full histogram in the entry into the defined buckets + # for the visualization. + # @param [Object] entry Entry to prepare for visualization. + _getBuckets: (entry) -> + prepared = + time: entry.time + max: 0 + buckets: (0 for i in [0...@options.buckets]) + + # Bucket size = (Range[1] - Range[0]) / number of buckets + bucketSize = (@options.bucketRange[1] - @options.bucketRange[0]) / @options.buckets + + for own value, count of entry.histogram + index = parseInt((value - @options.bucketRange[0]) / bucketSize) + + # Remove outliers from the preprared buckets if instructed to do so + if @options.cutOutliers and ((index < 0) or (index >= @options.buckets)) + continue + + # Bound the histogram to the range (aka, handle out of bounds values) + if index < 0 + index = 0 + else if index >= @options.buckets + index = @options.buckets - 1 + + prepared.buckets[index] += parseInt count + + for i in [0...prepared.buckets.length] + prepared.max = Math.max(prepared.max, prepared.buckets[i]) + + return prepared + + # @return [Function] The y scale for the heatmap. + y: -> + d3.scale.linear() + .domain(@options.bucketRange) + .range([@innerHeight(), 0]) + + # @return [Function] The y scale for the svg portions of the heatmap. + ySvg: -> + d3.scale.linear() + .domain(@options.bucketRange) + .range([@innerHeight() / @pixelRatio, 0]) + + # @return [Number] The height to render each bucket in a column (disregards padding). + h: -> + @innerHeight() / @options.buckets + + # @return [Number] The offset needed to center ticks at the middle of each column. + _offsetX: -> + 0.5 * @w() / @pixelRatio + + # Creates the painting canvas which is used to perform all the actual drawing. The contents + # of the canvas are then copied into the actual display canvas and through some image copy + # trickery at the end of a transition the illusion of motion over time is preserved. + # + # Using two canvases in this way allows us to render an incredible number of buckets in the + # visualization and animate them at high frame rates without smashing the cpu. + _setupPaintCanvas: -> + # Size the paint canvas to have a couple extra columns so we can perform smooth transitions + @paintWidth = (@options.windowSize + 1) * @w() + @paintHeight = @height * @pixelRatio + + # Create the "memory only" canvas and nab the drawing context + @paint = document.createElement('CANVAS') + @paint.width = @paintWidth + @paint.height = @paintHeight + @p = Epoch.Util.getContext @paint + + # Paint the initial data (rendering backwards from just before the fixed paint position) + @redraw() + + # Hook into the events to paint the next row after it's been shifted into the data + @on 'after:shift', '_paintEntry' + + # At the end of a transition we must reset the paint canvas by shifting the viewable + # buckets to the left (this allows for a fixed cut point and single renders below in @draw) + @on 'transition:end', '_shiftPaintCanvas' + @on 'transition:end', => @draw(@animation.frame * @animation.delta()) + + # Redraws the entire heatmap for the current data. + redraw: -> + return unless Epoch.isNonEmptyArray(@data) and Epoch.isNonEmptyArray(@data[0].values) + entryIndex = @data[0].values.length + drawColumn = @options.windowSize + + # This addresses a strange off-by-one issue when the chart is transitioning + drawColumn++ if @inTransition() + + while (--entryIndex >= 0) and (--drawColumn >= 0) + @_paintEntry(entryIndex, drawColumn) + @draw(@animation.frame * @animation.delta()) + + # Computes the correct color for a given bucket. + # @param [Integer] value Normalized value at the bucket. + # @param [Integer] max Normalized maximum for the column. + # @param [String] color Computed base color for the bucket. + _computeColor: (value, max, color) -> + Epoch.Util.toRGBA(color, @_opacityFn(value, max)) + + # Paints a single entry column on the paint canvas at the given column. + # @param [Integer] entryIndex Index of the entry to paint. + # @param [Integer] drawColumn Column on the paint canvas to place the visualized entry. + _paintEntry: (entryIndex=null, drawColumn=null) -> + [w, h] = [@w(), @h()] + + entryIndex ?= @data[0].values.length - 1 + drawColumn ?= @options.windowSize + + entries = [] + bucketTotals = (0 for i in [0...@options.buckets]) + maxTotal = 0 + + for layer in @getVisibleLayers() + entry = @_getBuckets( layer.values[entryIndex] ) + for own bucket, count of entry.buckets + bucketTotals[bucket] += count + maxTotal += entry.max + styles = @getStyles ".#{layer.className.split(' ').join('.')} rect.bucket" + entry.color = styles.fill + entries.push entry + + xPos = drawColumn * w + + @p.clearRect xPos, 0, w, @paintHeight + + j = @options.buckets + + for own bucket, sum of bucketTotals + color = @_avgLab(entries, bucket) + max = 0 + for entry in entries + max += (entry.buckets[bucket] / sum) * maxTotal + if sum > 0 or @options.paintZeroValues + @p.fillStyle = @_computeColor(sum, max, color) + @p.fillRect xPos, (j-1) * h, w-@options.bucketPadding, h-@options.bucketPadding + j-- + + # This shifts the image contents of the paint canvas to the left by 1 column width. + # It is called after a transition has ended (yay, slight of hand). + _shiftPaintCanvas: -> + data = @p.getImageData @w(), 0, @paintWidth-@w(), @paintHeight + @p.putImageData data, 0, 0 + + # Performs an averaging of the colors for muli-layer heatmaps using the lab color space. + # @param [Array] entries The layers for which the colors are to be averaged. + # @param [Number] bucket The bucket in the entries that must be averaged. + # @return [String] The css color code for the average of all the layer colors. + _avgLab: (entries, bucket) -> + [l, a, b, total] = [0, 0, 0, 0] + for entry in entries + continue unless entry.buckets[bucket]? + total += entry.buckets[bucket] + + for own i, entry of entries + if entry.buckets[bucket]? + value = entry.buckets[bucket]|0 + else + value = 0 + ratio = value / total + color = d3.lab(entry.color) + l += ratio * color.l + a += ratio * color.a + b += ratio * color.b + + d3.lab(l, a, b).toString() + + # Copies the paint canvas onto the display canvas, thus rendering the heatmap. + draw: (delta=0) -> + @clear() + @ctx.drawImage @paint, delta, 0 + super() + + # Changes the number of buckets in response to an option:buckets event. + bucketsChanged: -> @redraw() + + # Changes the range of the buckets in response to an option:bucketRange event. + bucketRangeChanged: -> + @_transitionRangeAxes() + @redraw() + + # Changes the opacity function in response to an option:opacity event. + opacityChanged: -> + @_setOpacityFunction() + @redraw() + + # Changes the bucket padding in response to an option:bucketPadding event. + bucketPaddingChanged: -> @redraw() + + # Changes whether or not to paint zeros in response to an option:paintZeroValues event. + paintZeroValuesChanged: -> @redraw() + + # Changes whether or not to cut outliers when bucketing in response to an + # option:cutOutliers event. + cutOutliersChanged: -> @redraw() + + layerChanged: -> @redraw() + +# "Audio... Audio... Audio... Video Disco..." - Justice diff --git a/debian/missing-sources/epoch/src/time/line.coffee b/debian/missing-sources/epoch/src/time/line.coffee new file mode 100644 index 0000000..8a4271b --- /dev/null +++ b/debian/missing-sources/epoch/src/time/line.coffee @@ -0,0 +1,39 @@ + +# Real-time line chart implementation +class Epoch.Time.Line extends Epoch.Time.Plot + constructor: (@options={}) -> + @options.type ?= 'time.line' + super(@options) + @draw() + + # Sets the graphics context styles based ont he given layer class name. + # @param [String] className The class name of the layer for which to set the styles. + setStyles: (className) -> + styles = @getStyles "g.#{className.replace(/\s/g,'.')} path.line" + @ctx.fillStyle = styles.fill + @ctx.strokeStyle = styles.stroke + @ctx.lineWidth = @pixelRatio * styles['stroke-width'].replace('px', '') + + # Draws the line chart. + draw: (delta=0) -> + @clear() + w = @w() + for layer in @getVisibleLayers() + continue unless Epoch.isNonEmptyArray(layer.values) + @setStyles(layer.className) + @ctx.beginPath() + y = @y(layer.range) + [i, k, trans] = [@options.windowSize, layer.values.length, @inTransition()] + + while (--i >= -2) and (--k >= 0) + entry = layer.values[k] + args = [(i+1)*w+delta, y(entry.y)] + args[0] += w if trans + if i == @options.windowSize - 1 + @ctx.moveTo.apply @ctx, args + else + @ctx.lineTo.apply @ctx, args + + @ctx.stroke() + + super() diff --git a/debian/missing-sources/epoch/tests/render/basic/area.html b/debian/missing-sources/epoch/tests/render/basic/area.html new file mode 100644 index 0000000..ea23851 --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/basic/area.html @@ -0,0 +1,450 @@ + + + + + + + + + + + +

Basic Area Chart Test

+ + +
    +
  1. Single Series
  2. +
  3. Single Series II
  4. +
  5. Multi Series
  6. +
  7. Multi Series II
  8. +
  9. Single Series Transition
  10. +
  11. Multi Series Transition
  12. +
  13. Single Series to Multi Series Transition
  14. +
  15. Layer Color Override
  16. +
  17. Categorical Color Switching
  18. +
  19. Multi Series without Labels
  20. +
  21. Hide/Show Layers
  22. +
  23. Data Format
  24. +
+ + + +
+

1. Single Series

+

It should display a plot of y = cos(x) + 1 over the range [0, 2π).

+
+
+ + + + + +
+

2. Single Series II

+

It should display a plot of y = sin(x) + 1 over the range [0, 2π).

+
+
+ + + + + +
+

3. Multi-series Plot

+

+ It should display a plot of the following functions stacked atop one another: +

    +
  • y = x
  • +
  • y = 2x
  • +
  • y = 3x
  • +
+ over the range [0, 10). +

+
+
+ + + + + +
+

4. Multi-series Plot II

+

+ It should display a plot of the following functions stacked atop one another: +

    +
  • y = |x|
  • +
  • y = x2
  • +
  • y = |x3|
  • +
+ over the range [-1, 1). +

+
+
+ + + + + +
+

5. Single Series Transition

+

+ It should correctly transition between the plots y = |x| over the range [-10, 10) and y = x2 over the range [-20, 20). The transition should be initiated when pressing the buttons below the plot. +

+
+

+ + +

+
+ + + + +
+

6. Multi Series Transition

+

+ It should correctly render and transition between Set A: +

    +
  • y = x
  • +
  • y = 2*x
  • +
  • y = 3*x
  • +
+ over the range [1, 100). and Set B: +
    +
  • y = ln(x)
  • +
  • y = 2*ln(x)
  • +
  • y = 3*ln(x)
  • +
+ over the range [1, 100). The transition should be initiated when pressing the buttons below the plot. +
+

+ + +

+
+ + + + + +
+

7. Single Series to Multi Series Transition

+

+ It should correctly transition between a single series, plotting the functions: +

    +
  • y = x2 - 0.5*x
  • +
+ To a multi series set, plotting the functions: +
    +
  • y = ln(x)
  • +
  • y = x
  • +
  • y = x * ln(x)
  • +
+ over the range [1, 4) for all plots. The transition should be initiated when pressing the buttons below the plot. +

+
+

+ + +

+
+ + + + +
+

8. Layer Color Override

+

+ It should display the first layer of the plot as pink, the second layer as green, and the third layer as blue. +

+
+
+ + + + + + +
+

9. Categorical Color Switching

+

+ It should change layer colors automatically when switching between the following categorical color classes on the containing element: +

    +
  • category10
  • +
  • category20
  • +
  • category20b
  • +
  • category20c
  • +
+ The colors should change when pressing the buttons for each categorical type below the chart. +

+ +
+ +

+ + + + +

+
+ + + +
+

10. Multi Series without Labels

+

+ Correctly render a multi-series plot of: +

    +
  • y = sin(x) + 1
  • +
  • y = cos(x) + 1
  • +
+ where the layers are given without labels. +

+
+
+ + + +
+

11. Hide/Show Layers

+

Correctly hide and show multiple layers

+
+

+ + + +

+
+ + + + diff --git a/debian/missing-sources/epoch/tests/render/basic/bar.html b/debian/missing-sources/epoch/tests/render/basic/bar.html new file mode 100644 index 0000000..07b5122 --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/basic/bar.html @@ -0,0 +1,745 @@ + + + + + + + + + + + +

Basic Bar Chart Test

+ + +
    +
  1. Single Series
  2. +
  3. Single Series II
  4. +
  5. Multi Series
  6. +
  7. Multi Series II
  8. +
  9. Single Series Transition
  10. +
  11. Multi Series Transition
  12. +
  13. Single Series to Multi Series Transition
  14. +
  15. Layer Color Override
  16. +
  17. Categorical Color Switching
  18. +
  19. Multi Series without Labels
  20. +
  21. Horizontally Oriented Single Series
  22. +
  23. Horizontally Oriented Multi Series
  24. +
  25. Horizontally Oriented Multi Series Transition
  26. +
  27. Vertical to Horizontal Transition
  28. +
  29. Padding Changes
  30. +
  31. Hide/Show Layers
  32. +
  33. Data Formatting
  34. +
  35. Many bars
  36. +
+ + + +
+

1. Single Series

+

Display a plot of y = cos(x) + 1 over the range [0, 2π).

+
+
+ + + + + +
+

2. Single Series II

+

Display a plot of y = sin(x) + 1 over the range [0, 2π).

+
+
+ + + + + +
+

3. Multi-series Plot

+

+ Display a plot of the following functions stacked atop one another: +

    +
  • y = x
  • +
  • y = 2x
  • +
  • y = 3x
  • +
+ over the range [0, 10). +

+
+
+ + + + + +
+

4. Multi-series Plot II

+

+ Display a plot of the following functions stacked atop one another: +

    +
  • y = |x|
  • +
  • y = x2
  • +
  • y = |x3|
  • +
+ over the range [-1, 1). +

+
+
+ + + + + +
+

5. Single Series Transition

+

+ Correctly transition between the plots y = |x| over the range [-10, 10) and y = x2 over the range [-20, 20). The transition is initiated by pressing the buttons below the plot. +

+
+

+ + +

+
+ + + + +
+

6. Multi Series Transition

+

+ Correctly render and transition between Set A: +

    +
  • y = x
  • +
  • y = 2*x
  • +
  • y = 3*x
  • +
+ over the range [1, 100). and Set B: +
    +
  • y = ln(x)
  • +
  • y = 2*ln(x)
  • +
  • y = 3*ln(x)
  • +
+ over the range [1, 100). The transition is initiated by pressing the buttons below the plot. +
+

+ + +

+
+ + + + + +
+

7. Single Series to Multi Series Transition

+

+ Correctly transition between a single series, plotting the functions: +

    +
  • y = x2 - 0.5*x
  • +
+ To a multi series set, plotting the functions: +
    +
  • y = ln(x)
  • +
  • y = x
  • +
  • y = x * ln(x)
  • +
+ over the range [1, 4) for all plots. The transition is initiated by pressing the buttons below the plot. +

+
+

+ + +

+
+ + + + +
+

8. Layer Color Override

+

+ Display the first layer of the plot as pink, the second layer as green, and the third layer as blue. +

+
+
+ + + + + + +
+

9. Categorical Color Switching

+

+ Change layer colors automatically when switching between the following categorical color classes on the containing element: +

    +
  • category10
  • +
  • category20
  • +
  • category20b
  • +
  • category20c
  • +
+ Change the categorical colors by pressing the buttons below the chart. +

+ +
+ +

+ + + + +

+
+ + + +
+

10. Multi Series without Labels

+

+ Correctly render a multi-series plot of: +

    +
  • y = sin(x) + 1
  • +
  • y = cos(x) + 1
  • +
+ where the layers are given without labels. +

+
+
+ + + +
+

11. Horizontally Oriented Single Series

+

+ Correctly render the single series plot of: +

    +
  • A - 20
  • +
  • B - 30
  • +
  • C - 60
  • +
+ using a horizontal orientation. +

+
+
+ + + +
+

12. Horizontally Oriented Multi Series

+

+ Correctly render the multi series plot of: +

    +
  • A - 10, 30
  • +
  • B - 20, 50
  • +
  • C - 60, 10
  • +
+ using a horizontal orientation. +

+
+
+ + + +
+

13. Horizontally Oriented Multi Series Transition

+

+ Correctly render the Horizontally oriented multi series plot of: +

    +
  • A - 10, 10
  • +
  • B - 20, 20
  • +
  • C - 30, 30
  • +
+ and transition to the single series plot: +
    +
  • A - 5
  • +
  • B - 10
  • +
  • C - 40
  • +
+

+
+

+ + +

+
+ + +
+

14. Vertical to Horizontal Transition

+
+

+ + +

+
+ + +
+

15. Padding Changes

+
+

+ + +

+
+ + +
+

16. Hide/Show Layers

+
+

+ + + + | + +

+
+ + +
+

17. Data Formatting

+

Ensure the chart works with the array, tuple, and key-value data formats.

+

+
+
+
+ + +
+

18. Bar Ticks

+

Ensure that we can use ticks option with bar charts.

+

+
+ + + diff --git a/debian/missing-sources/epoch/tests/render/basic/histogram.html b/debian/missing-sources/epoch/tests/render/basic/histogram.html new file mode 100644 index 0000000..505054e --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/basic/histogram.html @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + +

Basic Bar Chart Test

+ + +
    +
  1. Beta(2, 5)
  2. +
  3. Beta(2, 5) Horizontal
  4. +
  5. Option: buckets
  6. +
  7. Options: bucketRange & cutOutliers
  8. +
+ + +
+

1. Beta(2, 5)

+

Plot a random selection of points from the Beta(2, 5) distribution as a histogram.

+
+

+
+ + + +
+

2. Beta(2, 5) Horizontal

+

Plot a random selection of points from Beta(2, 5) and display in a horizontal histogram.

+
+

+
+ + + +
+

3. Option: buckets

+

Plot Beta(2, 2) and change number of buckets on the fly.

+
+

+ + + + + | + +

+
+ + + +
+

4. Options: bucketRange & cutOutliers

+

Plot beta(2, 5) and change the bucket range on the fly.

+
+

+ + + | + + | + +

+
+ + + diff --git a/debian/missing-sources/epoch/tests/render/basic/line.html b/debian/missing-sources/epoch/tests/render/basic/line.html new file mode 100644 index 0000000..37de38d --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/basic/line.html @@ -0,0 +1,471 @@ + + + + + + + + + + + +

Basic Line Chart Test

+ + +
    +
  1. Single Series
  2. +
  3. Single Series II
  4. +
  5. Multi Series
  6. +
  7. Single Series Transition
  8. +
  9. Multi Series Transition
  10. +
  11. Single to Multi Series Transition
  12. +
  13. Color Override
  14. +
  15. Categorical Colors
  16. +
  17. Multi Series without Labels
  18. +
  19. Multi Series with Fixed Domain
  20. +
  21. Show/Hide Layers
  22. +
+ + +
+

1. Single Series

+

Display a plot of y = cos(x) over the range [-2π, 2π).

+
+
+ + + + +
+

2. Single Series II

+

Display a plot of y = ex*sin(x) from [0, &pi).

+
+
+ + + + +
+

3. Multi Series

+

+ Display a plot of the following functions over the range [0, 2π]: +

    +
  • x*sin(x)
  • +
  • x*cos(x)
  • +
+

+
+
+ + + + +
+

4. Single Series Transition

+

+ Correctly transition between the functions y = 1 / x and y = x2 over the range [1, 2). + Use the buttons below the chart to initiate the transitions. +

+
+

+ + +

+
+ + + + +
+

5. Multi Series Transition

+

+ Correctly transition between Set A: +

    +
  • y = sin(x)
  • +
  • y = x - x3/3! + x5/5!
  • +
+ Set B: +
    +
  • y = cos(x)
  • +
  • y = 1 - x2/2! + x4/4!
  • +
+ and Set C: +
    +
  • y = sin(x) - (x - x3/3! + x5/5!)
  • +
  • y = cos(x) - (1 - x2/2! + x4/4!)
  • +
+

+
+

+ + + +

+
+ + + + +
+

6. Single to Multi Series Transition

+

+ Correctly transition between Set A: +

    +
  • y = ln(x)
  • +
+ Set B: +
    +
  • y = ln(x)
  • +
  • y = x * ln(x)
  • +
  • y = x * ln(x)2
  • +
+

+
+

+ + +

+
+ + + + +
+

7. Color Override

+

+ Display the first layer of the plot as pink, the second layer as green, and the third layer as blue. +

+
+
+ + + + + + +
+

Categorical Colors

+

+ Change layer colors automatically when switching between the following categorical color classes on the containing element: +

    +
  • category10
  • +
  • category20
  • +
  • category20b
  • +
  • category20c
  • +
+ Change the categorical colors by pressing the buttons below the chart. +

+
+

+ + + + +

+
+ + + + + +
+

9. Multi Series without Labels

+

+ Correctly render a multi-series plot of: +

    +
  • y = sin(x)
  • +
  • y = cos(x)
  • +
+ where the layers are given without labels. +

+
+
+ + + +
+

10. Multi Series with Fixed Domain

+

+ Display a plot of the following functions: +

    +
  • x*sin(x)
  • +
  • x*cos(x)
  • +
+ On the domain [0, 5] and range [0, 4]. +

+
+
+ + + + +
+

11. Show/Hide Layers

+
+

+ + + +

+
+ + + +
+

12. Multi-axis

+
+
+ + + diff --git a/debian/missing-sources/epoch/tests/render/basic/model.html b/debian/missing-sources/epoch/tests/render/basic/model.html new file mode 100644 index 0000000..2814fd8 --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/basic/model.html @@ -0,0 +1,94 @@ + + + + + + + + + + + + +

Basic Chart Model / Data Test

+ + +

+ + + +

+ +
+
+
+ + + + \ No newline at end of file diff --git a/debian/missing-sources/epoch/tests/render/basic/options.html b/debian/missing-sources/epoch/tests/render/basic/options.html new file mode 100644 index 0000000..5ff2d7e --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/basic/options.html @@ -0,0 +1,267 @@ + + + + + + + + + + + + +

Basic Chart Options and Events

+ +
    +
  1. Axes
  2. +
  3. Margins
  4. +
  5. Ticks and Tick Formats
  6. +
  7. Resize
  8. +
  9. Domain
  10. +
  11. Range
  12. +
+ + +
+

1. Axes

+

+ Correctly add and remove axes when options are set. +

+
+
+ + + + + + +
+
+ + + + +
+

2. Margins

+

+ Correctly resize margins when options are set. +

+
+
+ + + +
+
+ + + +
+

3. Ticks and Tick Formats

+

+ Correctly resize margins when options are set. +

+
+
+ + +
+
+ + + +
+

4. Resize

+

+ Correctly resize the chart when the width and height options are set. +

+
+
+ + +
+
+ + + +
+

6. Option: domain

+
+

+ + +

+
+ + + + +
+

7. Option: range

+
+

+ + +

+
+ + + + \ No newline at end of file diff --git a/debian/missing-sources/epoch/tests/render/basic/pie.html b/debian/missing-sources/epoch/tests/render/basic/pie.html new file mode 100644 index 0000000..fe105e8 --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/basic/pie.html @@ -0,0 +1,346 @@ + + + + + + + + + + + +

Basic Pie Chart Test

+ +
    +
  1. Basic Pie Test
  2. +
  3. Basic Donut Test
  4. +
  5. Pie Tranisition I
  6. +
  7. Pie Tranisition II
  8. +
  9. Color Override
  10. +
  11. Categorical Colors
  12. +
  13. Pie Chart Layers without Labels
  14. +
  15. Margin Changes
  16. +
  17. Inner Changes
  18. +
  19. Show/Hide Layers
  20. +
+ + +
+

Basic Pie Test

+

+ Correctly render a pie chart with three categories: +

    +
  • A - 20
  • +
  • B - 45
  • +
  • C - 35
  • +
+

+
+
+ + + + +
+

2. Basic Donut Test

+

+ Correctly render a donut chart with three categories: +

    +
  • A - 50
  • +
  • B - 30
  • +
  • C - 20
  • +
+

+
+
+ + + + +
+

3. Pie Tranisition I

+

+ Correctly transition between set A: +

    +
  • A - 20
  • +
  • B - 80
  • +
+ and set B: +
    +
  • A - 20
  • +
  • B - 30
  • +
  • C - 50
  • +
+ Use the buttons below the chart to initiate the transitions. +

+
+

+ + +

+
+ + + + +
+

4. Pie Tranisition II

+

+ Correctly transition between set A: +

    +
  • A - 20
  • +
  • B - 80
  • +
+ and set B: +
    +
  • A - 50
  • +
  • B - 50
  • +
+ Use the buttons below the chart to initiate the transitions. +

+
+

+ + +

+
+ + + + +
+

5. Color Override

+

+ Override the colors as such: +

    +
  • A - Pink
  • +
  • B - Green
  • +
  • C - Blue
  • +
+

+
+
+ + + + + + +
+

6. Categorical Colors

+

+ Correctly transition between different categorical colors sets. +

+
+

+ + + + +

+
+ + + + + + +
+

7. Pie Chart Layers without Labels

+

+ Correctly render a pie chart with three categories: +

    +
  • 30
  • +
  • 35
  • +
  • 35
  • +
+ when the layers are not provided labels. +

+
+
+ + + + +
+

8. Margin Changes

+
+

+ + +

+
+ + + +
+

9. Inner Changes

+
+

+ + + +

+
+ + + +
+

10. Show/Hide Layers

+
+

+ + + +

+
+ + + \ No newline at end of file diff --git a/debian/missing-sources/epoch/tests/render/basic/scatter.html b/debian/missing-sources/epoch/tests/render/basic/scatter.html new file mode 100644 index 0000000..31f1e42 --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/basic/scatter.html @@ -0,0 +1,398 @@ + + + + + + + + + + + +

Basic Scatter Plot Test

+ +
    +
  1. Single Series
  2. +
  3. Multi Series
  4. +
  5. Single Series Transition
  6. +
  7. Multi Series Transition
  8. +
  9. Multi Series Transition II
  10. +
  11. Color Override
  12. +
  13. Categorical Colors
  14. +
  15. Multi Series without Labels
  16. +
  17. Single Series with Radius
  18. +
  19. Radius Change
  20. +
  21. Show/Hide Layers
  22. +
+ + +
+

1. Single Series

+

Render a single random series scatter plot.

+
+
+ + + +
+

2. Multi Series

+

Render three random scatter series in the same plot.

+
+
+ + + +
+

3. Single Series Transition

+

+ Transition from one random series to another random series. Use the + buttons below the plot to initiate the transition. +

+
+

+ + +

+
+ + + +
+

4. Multi Series Transition

+

+ Transition from a set of multiple randoms series random series to another of multiple random series. Use the + buttons below the plot to initiate the transition. +

+
+

+ + +

+
+ + + +
+

5. Multi Series Transition II

+

+ Transition from a multi-series set of random data to a single series set of random data. +

+
+

+ + +

+
+ + + +
+

6. Color Override

+

The first series should be pink, the second green, and thrid blue.

+
+
+ + + + +
+

7. Categorical Colors

+

+ Correctly transition between different categorical color sets. +

+
+

+ + + + +

+
+ + + +
+

8. Multi Series without Labels

+

Correctly render two random scatter plots when labels are not specified for the layers.

+
+
+ + + +
+

9. Single Series with Radius

+

Render a single random series scatter plot with different radii.

+
+

+ +

+
+ + + +
+

10. Radius Change

+
+

+ + + + +

+
+ + + +
+

11. Show/Hide Layers

+
+

+ + + +

+
+ + + + diff --git a/debian/missing-sources/epoch/tests/render/css/tests.css b/debian/missing-sources/epoch/tests/render/css/tests.css new file mode 100644 index 0000000..7f4099e --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/css/tests.css @@ -0,0 +1,12 @@ +body { + font-family: helvetica; +} + +/* Default test chart height of 220px. */ +.test .epoch { + height: 220px; +} + +.broken { + color: red; +} diff --git a/debian/missing-sources/epoch/tests/render/index.html b/debian/missing-sources/epoch/tests/render/index.html new file mode 100644 index 0000000..1ab15c1 --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/index.html @@ -0,0 +1,57 @@ + + + + Epoch - Chart Rendering Tests + + + + + + + +

Epoch Chart Rendering Tests

+ +

Basic Charts

+

+

+

+ +

Real-time Charts

+

+

+

+ +

Themes

+

+

+

+ +

Data / Models

+

+

+

+ + diff --git a/debian/missing-sources/epoch/tests/render/js/data.js b/debian/missing-sources/epoch/tests/render/js/data.js new file mode 100644 index 0000000..a49da68 --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/js/data.js @@ -0,0 +1,210 @@ +(function() { + + // Quick data generator + Data = function() { + this.layers = [] + }; + + Data.prototype.add = function(fn) { + fn = fn ? fn : function(x) { return x; }; + this.layers.push(fn); + return this; + }; + + Data.prototype.get = function(domain, step) { + domain = domain ? domain : [0, 10]; + step = step ? step : 1; + + var data = [] + for (var i = 0; i < this.layers.length; i++) { + layer = { label: String.fromCharCode(i + 65), values: [] }; + for (var x = domain[0]; x < domain[1]; x += step) { + layer.values.push({ x: x, y: this.layers[i](x) }); + } + data.push(layer); + } + return data; + }; + + Data.prototype.random = function(entries, domain, range) { + entries = entries ? entries : 50; + domain = domain ? domain : [0, 100]; + range = range ? range : [0, 100]; + + var values = []; + for (var i = 0; i < entries; i++) { + var x = (domain[1] - domain[0]) * Math.random() + domain[0], + y = (range[1] - range[0]) * Math.random() + range[1]; + values.push({ x: x, y: y }); + } + + return [{ label: 'A', values: values }]; + }; + + Data.prototype.multiRandom = function(numSeries, entries, domain, range) { + numSeries = numSeries ? numSeries : 3; + entries = entries ? entries : 50; + domain = domain ? domain : [0, 100]; + range = range ? range : [0, 100]; + + var data = []; + + for (var j = 0; j < numSeries; j++) { + var layer = { label: String.fromCharCode(65 + j), values: [] }; + for (var i = 0; i < entries; i++) { + var x = (domain[1] - domain[0]) * Math.random() + domain[0], + y = (range[1] - range[0]) * Math.random() + range[1]; + layer.values.push({ x: x, y: y }); + } + data.push(layer); + } + + return data; + }; + + window.data = function() { return new Data(); }; + + + // Quick real-time data generator + Time = function() { + Data.call(this); + }; + + Time.prototype = new Data() + + Time.prototype.get = function(domain, step) { + var data = Data.prototype.get.apply(this, arguments), + time = parseInt(new Date().getTime() / 1000); + + for (var i = 0; i < data[0].values.length; i++) { + for (var j = 0; j < this.layers.length; j++) { + delete data[j].values[i].x; + data[j].values[i].time = time + i; + } + } + + this.currentTime = time; + this.lastX = domain[1]; + + return data; + }; + + Time.prototype.next = function(step) { + this.currentTime++; + this.lastX += (step ? step : 1); + + var data = []; + for (var j = 0; j < this.layers.length; j++) { + data.push({ time: this.currentTime, y: this.layers[j](this.lastX) }) + } + + return data; + } + + window.time = function() { return new Time(); }; + + + + + window.nextTime = (function() { + var currentTime = parseInt(new Date().getTime() / 1000); + return function() { return currentTime++; } + })(); + + + /* + * Normal distribution random histogram data generator. + */ + var NormalData = function(layers) { + this.layers = layers; + this.timestamp = ((new Date()).getTime() / 1000)|0; + }; + + var normal = function() { + var U = Math.random(), + V = Math.random(); + return Math.sqrt(-2*Math.log(U)) * Math.cos(2*Math.PI*V); + }; + + NormalData.prototype.sample = function() { + return parseInt(normal() * 12.5 + 50); + } + + NormalData.prototype.rand = function() { + var histogram = {}; + + for (var i = 0; i < 1000; i ++) { + var r = this.sample(); + if (!histogram[r]) { + histogram[r] = 1; + } + else { + histogram[r]++; + } + } + + return histogram; + }; + + NormalData.prototype.history = function(entries) { + if (typeof(entries) != 'number' || !entries) { + entries = 60; + } + + var history = []; + for (var k = 0; k < this.layers; k++) { + history.push({ label: String.fromCharCode(65+k), values: [] }); + } + + for (var i = 0; i < entries; i++) { + for (var j = 0; j < this.layers; j++) { + history[j].values.push({time: this.timestamp, histogram: this.rand()}); + } + this.timestamp++; + } + + return history; + }; + + NormalData.prototype.next = function() { + var entry = []; + for (var i = 0; i < this.layers; i++) { + entry.push({ time: this.timestamp, histogram: this.rand() }); + } + this.timestamp++; + return entry; + } + + window.NormalData = NormalData; + + + /* + * Beta distribution histogram data generator. + */ + var BetaData = function(alpha, beta, layers) { + this.alpha = alpha; + this.beta = beta; + this.layers = layers; + this.timestamp = ((new Date()).getTime() / 1000)|0; + }; + + BetaData.prototype = new NormalData(); + + BetaData.prototype.sample = function() { + var X = 0, + Y = 0; + + for (var j = 1; j <= this.alpha; j++) + X += -Math.log(1 - Math.random()); + + for (var j = 1; j <= this.beta; j++) + Y += -Math.log(1 - Math.random()); + + return parseInt(100 * X / (X + Y)); + } + + window.BetaData = BetaData; + +})(); + + diff --git a/debian/missing-sources/epoch/tests/render/real-time/area.html b/debian/missing-sources/epoch/tests/render/real-time/area.html new file mode 100644 index 0000000..b66ab7d --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/real-time/area.html @@ -0,0 +1,494 @@ + + + + + + + + + + + + +

Real-time Area Plot Test

+ +
    +
  1. Single Series
  2. +
  3. Single Series Single Transition
  4. +
  5. Single Seires Stream
  6. +
  7. Multi Series
  8. +
  9. Multi Series Single Transition
  10. +
  11. Multi Seires Stream
  12. +
  13. Color Override
  14. +
  15. Categorical Colors
  16. +
  17. Show/Hide Layers
  18. +
+ + +
+

1. Single Series

+

+ Correctly render a single series plot of y = cos(x) + 1 over the range [0, 2π]. +

+
+
+ + + + +
+

2. Single Series Single Transition

+

+ Correctly render a single series plot of y = sin(x) + 1. When the button is pressed push a new data point to the chart and correctly animate/render the transiton. +

+
+

+
+ + + + + +
+

3. Single Seires Stream

+

Correctly play / pause a single series stream of values from the plot y = cos(x) + 1.

+
+

+
+ + + + +
+

4. Multi Series

+

Correctly render a multi series plot of the following functions:

+
    +
  • y = log(x+1)
  • +
  • y = 2*log(x+1)
  • +
  • y = 3*log(x+1)
  • +
+
+
+ + + + + +
+

5. Multi Series Single Transition

+

+ Correctly render a multi series plot of the following functions: +

    +
  • y = x
  • +
  • y = x1.25
  • +
  • y = x1.5
  • +
+ and correctly render/animate the transiton after pressing the "Next" button. +

+
+

+ +

+
+ + + + +
+

6. Multi Seires Stream

+

+ Correctly play / pause a multi series stream of values over the following plots: +

    +
  • x
  • +
  • x * log(x)
  • +
  • x * log2(x)
  • +
+

+
+

+
+ + + + +
+

7. Color Override

+

The first layer should pink, the second green, and the third blue.

+
+
+ + + + + + +
+

8. Categorical Colors

+

Correctly render and switch between different categorical colors. Unlike with the basic charts this doesn't occur just by switching the class name on the containing element. The CSS query engine must be purge and the plot must be manually redrawn, like so:

+Epoch.QueryCSS.purge();
+chart.draw();
+
+

+ +
+ +

+ + + + +

+
+ + + + +
+

9. Show/Hide Layers

+
+

+ + + | + +

+
+ + + +
+

10. Fixed Range

+

+ Render a single series plot of y = cos(x). Instead of automatically setting the range to [-1, 1], the range is manually set to [-2, 5]. +

+
+
+ + + + \ No newline at end of file diff --git a/debian/missing-sources/epoch/tests/render/real-time/bar.html b/debian/missing-sources/epoch/tests/render/real-time/bar.html new file mode 100644 index 0000000..952119c --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/real-time/bar.html @@ -0,0 +1,484 @@ + + + + + + + + + + + + +

Real-time Bar Test

+ +
    +
  1. Single Series
  2. +
  3. Single Series Single Transition
  4. +
  5. Single Seires Stream
  6. +
  7. Multi Series
  8. +
  9. Multi Series Single Transition
  10. +
  11. Multi Seires Stream
  12. +
  13. Color Override
  14. +
  15. Categorical Colors
  16. +
  17. Show/Hide Layers
  18. +
+ + +
+

1. Single Series

+

+ Correctly render a single series plot of y = cos(x) + 1 over the range [0, 2π]. +

+
+
+ + + + +
+

2. Single Series Single Transition

+

+ Correctly render a single series plot of y = sin(x) + 1. When the button is pressed push a new data point to the chart and correctly animate/render the transiton. +

+
+

+
+ + + + + +
+

3. Single Seires Stream

+

Correctly play / pause a single series stream of values from the plot y = cos(x) + 1.

+
+

+
+ + + + +
+

4. Multi Series

+

Correctly render a multi series plot of the following functions:

+
    +
  • y = log(x+1)
  • +
  • y = 2*log(x+1)
  • +
  • y = 3*log(x+1)
  • +
+
+
+ + + + + +
+

5. Multi Series Single Transition

+

+ Correctly render a multi series plot of the following functions: +

    +
  • y = x
  • +
  • y = x1.25
  • +
  • y = x1.5
  • +
+ and correctly render/animate the transiton after pressing the "Next" button. +

+
+

+ +

+
+ + + + +
+

6. Multi Seires Stream

+

+ Correctly play / pause a multi series stream of values over the following plots: +

    +
  • x
  • +
  • x * log(x)
  • +
  • x * log2(x)
  • +
+

+
+

+
+ + + + +
+

7. Color Override

+

The first layer should pink, the second green, and the third blue.

+
+
+ + + + + + +
+

8. Categorical Colors

+

Correctly render and switch between different categorical colors. Unlike with the basic charts this doesn't occur just by switching the class name on the containing element. The CSS query engine must be purge and the plot must be manually redrawn, like so:

+Epoch.QueryCSS.purge();
+chart.draw();
+
+

+ +
+ +

+ + + + +

+
+ + + + +
+

9. Show/Hide Layers

+
+

+ + + | + +

+
+ + + +
+

10. Fixed Range

+

+ Render a single series plot of y = cos(x) + 1. Instead of automatically setting the range to [0, 2], the range is manually set to [0, 5]. +

+
+
+ + + + \ No newline at end of file diff --git a/debian/missing-sources/epoch/tests/render/real-time/gauge.html b/debian/missing-sources/epoch/tests/render/real-time/gauge.html new file mode 100644 index 0000000..614334d --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/real-time/gauge.html @@ -0,0 +1,283 @@ + + + + + + + + + + + + +

Real-time Gauge Test

+ +
    +
  1. Single Value Display
  2. +
  3. Single Transition
  4. +
  5. Stream Transition
  6. +
  7. Gauge Sizes
  8. +
  9. Color Override
  10. +
  11. Option: domain
  12. +
  13. Option: ticks
  14. +
  15. Option: tickSize
  16. +
  17. Option: tickOffset
  18. +
  19. Option: format
  20. +
+ + +
+

1. Single Value Display

+

Display a single value of 25%

+
+
+ + + + +
+

2. Single Transition

+

Display value of 0% and transition to a random value when the button is pressed.

+
+

+
+ + + + +
+

3. Stream Transition

+

Display value of 0% and transition to a random value every second when the button is pressed.

+
+

+
+ + + +
+

4. Gauge Sizes

+

Display the four built-in gauge sizes in this order: tiny, small, medium, large.

+
+
+
+
+
+ + + +
+

5. Color Override

+

+ Override the basic gauge styles with the following +

    +
  • Outer arc 8px thickness colored green
  • +
  • Inner arc 2px thickness colored orange
  • +
  • Ticks should be 3px in width and red
  • +
  • Needle colored blue.
  • +
  • Needle base colored black
  • +
+

+
+
+ + + + + + + + + + +
+

6. Option: domain

+
+

+ | + + +

+
+ + + +
+

7. Option: ticks

+
+

+ | + + + + +

+
+ + + +
+

8. Option: tickSize

+
+

+ | + + + + +

+
+ + + +
+

9. Option: tickOffset

+
+

+ | + + + +

+
+ + + +
+

10. Option: format

+
+

+ | + + +

+
+ + + diff --git a/debian/missing-sources/epoch/tests/render/real-time/heatmap.html b/debian/missing-sources/epoch/tests/render/real-time/heatmap.html new file mode 100644 index 0000000..ddabe2e --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/real-time/heatmap.html @@ -0,0 +1,559 @@ + + + + + + + + + + + +

Real-time Heatmap Plot Test

+ +
    +
  1. Single Series - Normal
  2. +
  3. Single Series - Beta
  4. +
  5. Single Series - Normal, Single Update
  6. +
  7. Single Series - Beta, Stream Update
  8. +
  9. Single Series - Color Override
  10. +
  11. Multi Series - Normal + Beta
  12. +
  13. Multi Series Color Override
  14. +
  15. Range Independent Bucketing
  16. +
  17. Option: buckets
  18. +
  19. Option: bucketRange
  20. +
  21. Option: bucketPadding
  22. +
  23. Option: cutOutliers
  24. +
  25. Option: opacity
  26. +
  27. Show/Hide Layer
  28. +
+ + +
+

1. Single Series - Normal

+

Select random values from the normal distribution and display them with the heatmap.

+
+
+ + + +
+

2. Single Series - Beta

+

Select random values from the Beta(2, 5) distribution and display them with the heatmap.

+
+
+ + + +
+

3. Single Sieres - Normal, Single Update

+

+ Plot the normal distribution and transition a new element when the button is pressed. +

+
+

+
+ + + +
+

4. Single Series - Beta, Stream Update

+

+ Plot the Beta(2, 5) distribution and begin streaming new elements each second once the + button is pressed. +

+
+ +
+ + + + +
+

5. Single Series - Color Override

+

Change the bucket base color to orange and plot the Beta(2, 2) distribution.

+
+
+ + + + + + +
+

6. Multi Series - Normal + Beta

+

+ Plot the Beta(2,5) and Normal distributions as two layers in a single heatmap. Stream elements to the plot + by pressing the button. The normal distribution layer is in blue and the beta in green. +

+
+ +
+ + + +
+

7. Multi Series Color Override

+

+ Plot the normal distribution and the Beta(2, 5) distribution overrding normal to be in red, and beta to + be in purple. +

+
+
+ + + + + + +
+

8. Range Independent Bucketing (Issue #41)

+

+ Discrete bucketing of sparse histogram values should produce similar looking graphs regardless + of numeric relation between the range of the plot and the number of buckets. +

+

Range [0, 100] with 20 buckets

+
+ +

Range [0, 100] with 45 buckets

+
+
+ + + +
+

9. Option: buckets

+
+

+ | + + + +

+
+ + + +
+

10. Option: bucketRange

+
+

+ | + + + + + +

+
+ + + +
+

11. Option: bucketPadding

+
+

+ | + + + + +

+
+ + + +
+

12. Option: cutOutliers

+
+

+ | + + +

+
+ + +
+

13. Option: opacity

+
+

+ | + +

+
+ + +
+

14. Show/Hide Layer

+
+

+ + | + +

+
+ + + diff --git a/debian/missing-sources/epoch/tests/render/real-time/line.html b/debian/missing-sources/epoch/tests/render/real-time/line.html new file mode 100644 index 0000000..3346c98 --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/real-time/line.html @@ -0,0 +1,596 @@ + + + + + + + + + + + + +

Real-time Line Plot Test

+ +
    +
  1. Single Series
  2. +
  3. Single Series Single Transition
  4. +
  5. Single Seires Stream
  6. +
  7. Multi Series
  8. +
  9. Multi Series Single Transition
  10. +
  11. Multi Seires Stream
  12. +
  13. Color Override
  14. +
  15. Categorical Colors
  16. +
  17. Show/Hide Layers
  18. +
  19. Show/Hide Layers
  20. +
  21. Multiaxes
  22. +
+ + +
+

1. Single Series

+

+ Correctly render a single series plot of y = cos(x) + 1 over the range [0, 2π]. +

+
+
+ + + + +
+

2. Single Series Single Transition

+

+ Correctly render a single series plot of y = sin(x) + 1. When the button is pressed push a new data point to the chart and correctly animate/render the transiton. +

+
+

+
+ + + + + +
+

3. Single Seires Stream

+

Correctly play / pause a single series stream of values from the plot y = cos(x) + 1.

+
+

+
+ + + + +
+

4. Multi Series

+

Correctly render a multi series plot of the following functions:

+
    +
  • y = log(x+1)
  • +
  • y = 2*log(x+1)
  • +
  • y = 3*log(x+1)
  • +
+
+
+ + + + + +
+

5. Multi Series Single Transition

+

+ Correctly render a multi series plot of the following functions: +

    +
  • y = x
  • +
  • y = x1.25
  • +
  • y = x1.5
  • +
+ and correctly render/animate the transiton after pressing the "Next" button. +

+
+

+ +

+
+ + + + +
+

6. Multi Seires Stream

+

+ Correctly play / pause a multi series stream of values over the following plots: +

    +
  • x
  • +
  • x * log(x)
  • +
  • x * log2(x)
  • +
+

+
+

+
+ + + + +
+

7. Color Override

+

The first layer should pink, the second green, and the third blue.

+
+
+ + + + + + +
+

8. Categorical Colors

+

Correctly render and switch between different categorical colors. Unlike with the basic charts this doesn't occur just by switching the class name on the containing element. The CSS query engine must be purge and the plot must be manually redrawn, like so:

+Epoch.QueryCSS.purge();
+chart.draw();
+
+

+ +
+ +

+ + + + +

+
+ + + + +
+

9. Show/Hide Layers

+
+

+ + + | + +

+
+ + + +
+

10. Fixed Range

+

+ Render a single series plot of y = cos(x). Instead of automatically setting the range to [-1, 1], the range is manually set to [-2, 5]. +

+
+
+ + + + +
+

11. Multi-axes

+

+ Render a plot that uses independent axes ranges for the left and + right sides. +

+
+
+ + + + +
+

12. Multi-axes with Labeled Ranges

+

+ Render a plot that uses independent axes ranges for the left and + right sides that are associated to labels in the chart data. +

+
+
+ + + + diff --git a/debian/missing-sources/epoch/tests/render/real-time/model.html b/debian/missing-sources/epoch/tests/render/real-time/model.html new file mode 100644 index 0000000..6f53963 --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/real-time/model.html @@ -0,0 +1,85 @@ + + + + + + + + + + + + +

Real-time Chart Model / Data Test

+ + +

+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/debian/missing-sources/epoch/tests/render/real-time/options.html b/debian/missing-sources/epoch/tests/render/real-time/options.html new file mode 100644 index 0000000..a2da792 --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/real-time/options.html @@ -0,0 +1,299 @@ + + + + + + + + + + + + +

Real-time Chart Options and Events

+ +
    +
  1. Resize
  2. +
  3. Axes
  4. +
  5. Ticks
  6. +
  7. Tick Formats
  8. +
  9. Margins
  10. +
+ + +
+

1. Resize

+

Correctly Resize a Real-time Chart.

+
+

+ | + + + +

+
+ + + +
+

2. Axes

+
+
+ | + + + + + + +
+
+ + + +
+

3. Ticks

+
+

+ | + + +

+
+ + + +
+

4. Tick Formats

+
+

+ | + + +

+
+ + + +
+

5. Margins

+
+

+ | + + + +

+
+ + + \ No newline at end of file diff --git a/debian/missing-sources/epoch/tests/render/themes/dark.html b/debian/missing-sources/epoch/tests/render/themes/dark.html new file mode 100644 index 0000000..265ad93 --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/themes/dark.html @@ -0,0 +1,211 @@ + + + + + + + + + + + + +

Dark Theme

+ +

Category 10

+
+
+ +
+ +
+ + + + +

Category 20

+
+
+
+
+
+ +
+ +
+ + + +

Category 20b

+
+
+
+
+
+ +
+ +
+ + + +

Category 20c

+
+
+
+
+
+ +
+ +
+ + +

Chart Examples

+ +
+ + +
+ + + +
+ + +
+ + + + + + \ No newline at end of file diff --git a/debian/missing-sources/epoch/tests/render/themes/default.html b/debian/missing-sources/epoch/tests/render/themes/default.html new file mode 100644 index 0000000..9e8bd4e --- /dev/null +++ b/debian/missing-sources/epoch/tests/render/themes/default.html @@ -0,0 +1,70 @@ + + + + + + + + + + + + + +

Default Theme

+ +

Category 10

+
+
+ +

Category 20

+
+
+
+
+
+ +

Category 20b

+
+
+
+
+
+ +

Category 20c

+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/debian/missing-sources/epoch/tests/unit/core/charts.coffee b/debian/missing-sources/epoch/tests/unit/core/charts.coffee new file mode 100644 index 0000000..0f0bb9c --- /dev/null +++ b/debian/missing-sources/epoch/tests/unit/core/charts.coffee @@ -0,0 +1,573 @@ +sinon = require 'sinon' + +describe 'Epoch.Chart', -> + [defaultWidth, defaultHeight] = [320, 240] + + describe 'Base', -> + [testDivWidth, testDivHeight] = [800, 200] + [resizeDivWidth, resizeDivHeight] = [200, 200] + + before (done) -> + d3.select(doc.body).append('div').attr('id', 'testDiv').style + width: "#{testDivWidth}px" + height: "#{testDivHeight}px" + + d3.select(doc.body).append('div').attr('id', 'resizeDiv').style + width: "#{resizeDivWidth}px" + height: "#{resizeDivHeight}px" + + done() + + after (done) -> + d3.select('#testDiv').remove() + d3.select('#resizeDiv').remove() + done() + + describe 'constructor', -> + it 'should set default dimensions', -> + c = new Epoch.Chart.Base() + assert.equal c.width, defaultWidth, 'Did not set default width' + assert.equal c.height, defaultHeight, 'Did not set default height' + + it 'should allow dimensions to be set via options', -> + [width, height] = [500, 780] + c = new Epoch.Chart.Base({ width: width, height: height }) + assert.equal c.width, width, "Did not set width to #{width}" + assert.equal c.height, height, "Did not set height to #{height}" + + it 'should use the dimensions of the given element when applicable', -> + c = new Epoch.Chart.Base({ el: '#testDiv' }) + assert.equal c.width, testDivWidth, "Did not set width to that of the div" + assert.equal c.height, testDivHeight, "Did not set height to that of the div" + + it 'should set default data to an empty array', -> + c = new Epoch.Chart.Base() + assert.isArray c.data + assert.equal c.data.length, 0 + + it 'should set data when given as an option', -> + data = [ + {label: 'A', values: [{x: 0, y: 0}]}, + {label: 'B', values: [{x: 1, y: 1}]} + ] + c = new Epoch.Chart.Base({ data: data }) + assert.sameMembers(c.data, data) + + describe 'setData', -> + data = [ + {label: 'A', values: [{x: 10, y: 20}]}, + {label: 'B', values: [{x: 10, y: 20}]}, + {label: 'C', values: [{x: 10, y: 20}]} + ] + classNames = [ + ['layer', 'category1', 'a'], + ['layer', 'category2', 'b'], + ['layer', 'category3', 'c'] + ] + chart = null + + before (done) -> + (chart = new Epoch.Chart.Base()).setData(data) + done() + + it 'should set data correctly', -> + assert.sameMembers chart.data, data + for i in [0...data.length] + assert.equal chart.data[i].label, data[i].label + assert.equal chart.data[i].values[0], data[i].values[0] + + it 'should add the correct categories and class names', -> + for i in [0...data.length] + className = chart.data[i].className + for name in classNames[i] + assert (className.indexOf(name) > -1), "Missing class '#{name}'" + + describe 'draw', -> + it "should trigger the 'draw' event", (done) -> + errorCallback = -> + assert 'false', "The 'draw' event was never triggered" + done() + timeout = setTimeout(errorCallback, 1000) + chart = new Epoch.Chart.Base() + chart.on 'draw', -> + clearTimeout(timeout) + done() + chart.draw() + + describe 'update', -> + it 'should call draw by default', (done) -> + errorCallback = -> + assert false, "update did not call draw by default." + done() + timeout = setTimeout(errorCallback, 1000) + chart = new Epoch.Chart.Base() + chart.on 'draw', -> + clearTimeout(timeout) + done() + chart.update([]) + + it 'should not call draw when instructed', (done) -> + chart = new Epoch.Chart.Base() + chart.on 'draw', -> + assert false, "Update incorrectly called draw." + done() + chart.update([], false) + done() + + describe 'extent', -> + data = [ + {values: [ + {x: -1, y: 10}, + {x: 2, y: 20}, + {x: 4, y: 50}, + {x: 8, y: 9900} + ]}, + {values: [ + {x: 1, y: 170}, + {x: 7, y: -2380}, + {x: 19, y: 90}, + {x: 33, y: 17} + ]} + ] + + [xMin, xMax] = [-1, 33] + [yMin, yMax] = [-2380, 9900] + + chart = null + + before (done) -> + chart = new Epoch.Chart.Base({ data: data }) + done() + + it 'should find the correct extent given a y-comparitor', -> + [min, max] = chart.extent (d) -> d.y + assert.equal min, yMin, "Incorrect minimum y" + assert.equal max, yMax, "Incorrect maximum y" + + it 'should find the correct extent give an x-comparitor', -> + [min, max] = chart.extent (d) -> d.x + assert.equal min, xMin, "Incorrect minimum x" + assert.equal max, xMax, "Incorrect maximum x" + + describe 'option', -> + it 'should return all options for the chart when called with no arguments', -> + options = { a: 20, b: 30, c: { d: 40 } } + chart = new Epoch.Chart.Base options + assert.isObject chart.option() + assert.deepEqual chart.option(), options + + it 'should return a single value when given a key', -> + options = { a: 20, b: 30 } + chart = new Epoch.Chart.Base options + assert.equal chart.option('a'), options.a + assert.equal chart.option('b'), options.b + assert.isUndefined chart.option('c') + + it 'should return a deep value when given a hierarchical key', -> + options = + a: + b: 20 + c: + d: 30 + chart = new Epoch.Chart.Base options + assert.equal chart.option('a.b'), options.a.b + assert.equal chart.option('a.c.d'), options.a.c.d + + it 'should set an option given a string and a value', -> + chart = new Epoch.Chart.Base() + [key, value] = ['a', 'hello world'] + chart.option(key, value) + assert.equal chart.option(key), value + + it 'should set a deep value when given a hierarchical key', -> + chart = new Epoch.Chart.Base() + + map = + 'a.b': 'deep' + 'a.c.d': 'deeper' + 'b': 'shallow' + + for key, value of map + chart.option(key, value) + assert.equal chart.option(key), value + + it 'should set all options given an object', -> + original = { a: 20, b: { c: 30 } } + newOptions = { a: 15, d: { e: 10, f: 30 } } + chart = new Epoch.Chart.Base() + chart.option(newOptions) + assert.deepEqual chart.option(), newOptions + + it 'should trigger an event when an option is changed', (done) -> + [key, value] = ['a', 20] + eventName = "option:#{key}" + + errorCallback = -> + assert false, "Setting an option did not trigger the appropriate event: #{eventName}" + done() + timeout = setTimeout(errorCallback, 1000) + + chart = new Epoch.Chart.Base() + chart.on eventName, -> + clearTimeout(timeout) + done() + chart.option(key, value) + + it 'should resize the containing element when the width option is changed', -> + newWidth = resizeDivWidth + 20 + chart = new Epoch.Chart.Base({ el: '#resizeDiv' }) + chart.option('width', newWidth) + assert.equal d3.select('#resizeDiv').width(), newWidth + + it 'should resize the containing element when the height option is changed', -> + newHeight = resizeDivHeight + 20 + chart = new Epoch.Chart.Base({ el: '#resizeDiv' }) + chart.option('height', newHeight) + assert.equal d3.select('#resizeDiv').height(), newHeight + + describe '_getScaleDomain', -> + chart = null + + beforeEach -> + chart = new Epoch.Chart.Base + data: [ layerWithRange(-2030, 5050) ] + + it 'returns a given array', -> + assert.deepEqual(chart._getScaleDomain([0,1]), [0,1]) + + it 'returns @options.range if it is an array', -> + chart.options.range = [-100, 100] + assert.equal chart._getScaleDomain(), chart.options.range + + it 'returns @options.range.left if it is an array', -> + chart.options.range = {left: [-100, 100]} + assert.equal chart._getScaleDomain(), chart.options.range.left + + it 'returns @options.range.right if it is an array', -> + chart.options.range = {right: [-100, 100]} + assert.equal chart._getScaleDomain(), chart.options.range.right + + it 'returns the extent of the data', -> + assert.deepEqual chart._getScaleDomain(), chart.extent((d) -> d.y) + + describe 'with range grouped layers', -> + beforeEach -> + chart = new Epoch.Chart.Base + data: [ + layerWithRange(0, 10, 'left'), + layerWithRange(-5000, 5000, 'right'), + layerWithRange(-10, -5, 'left') + ] + + it 'returns the extent of the layers with the given range label', -> + assert.deepEqual chart._getScaleDomain('left'), [-10, 10] + + it 'returns the extent of the data if the label is invalid', -> + assert.deepEqual chart._getScaleDomain('foobar'), chart.extent((d) -> d.y) + + describe 'layers', -> + [chart, eventChart] = [null, null] + labels = ['A', 'B', 'C'] + data = [ + { label: 'A', data: [{x: 0, y: 0}] }, + { label: 'B', data: [{x: 1, y: 1}] }, + { label: 'C', data: [{x: 2, y: 2}] } + ] + data2 = [ + { label: 'A', data: [{x: 0, y: 0}] } + ] + + before (done) -> + chart = new Epoch.Chart.Base + el: doc.createElement('div') + data: data + eventChart = new Epoch.Chart.Base + el: doc.createElement('div') + data: data2 + done() + + describe '_findLayer', -> + it 'should find layers given a label', -> + for label in labels + layer = chart._findLayer(label) + assert.equal label, layer.label, "Could not find layer with label #{label}" + + it 'should find layers given an index', -> + for i in [0...data.length] + layer = chart._findLayer(i) + assert.equal labels[i], layer.label, "Could not find layer with index #{i}" + + it 'should return null if given an invalid label', -> + assert.isNull (chart._findLayer 'D') + assert.isNull (chart._findLayer 'not a thing') + + it 'should return null if given an index that is out of bounds', -> + assert.isNull (chart._findLayer -1) + assert.isNull (chart._findLayer 5) + + describe 'hideLayer', -> + it 'should hide a visible layer', -> + chart.hideLayer('A') + assert.isFalse chart._findLayer('A').visible + + it 'should keep a hidden layer hidden', -> + assert.isFalse chart._findLayer('A').visible + chart.hideLayer('A') + assert.isFalse chart._findLayer('A').visible + + it 'should trigger layer:hidden when a layer is hidden', (done) -> + errorCallback = -> + assert false, "layer:hidden was not triggered" + done() + timeout = setTimeout errorCallback, 1000 + eventChart.on 'layer:hidden', -> + clearTimeout timeout + done() + eventChart.hideLayer('A') + + describe 'showLayer', -> + it 'should have keep a visible layer visible', -> + assert.isTrue chart._findLayer('B').visible + chart.showLayer('B') + assert.isTrue chart._findLayer('B').visible + + it 'should make a hidden layer visible', -> + assert.isFalse chart._findLayer('A').visible + chart.showLayer('A') + assert.isTrue chart._findLayer('A').visible + + it 'should trigger layer:shown when a layer is shown', (done) -> + errorCallback = -> + assert false, "layer:shown was not triggered" + done() + timeout = setTimeout errorCallback, 1000 + eventChart.on 'layer:shown', -> + clearTimeout timeout + done() + eventChart.showLayer('A') + + describe 'toggleLayer', -> + it 'should hide a visible layer', -> + chart.hideLayer('A') + chart.toggleLayer('A') + assert.isTrue chart._findLayer('A').visible + + it 'should show a hidden layer', -> + chart.showLayer('B') + chart.toggleLayer('B') + assert.isFalse chart._findLayer('B').visible + + describe 'isLayerVisible', -> + it 'should report true if a layer is visible', -> + chart.showLayer('A') + assert.isTrue chart.isLayerVisible('A') + + it 'should report false if a layer is not visible', -> + chart.hideLayer('A') + assert.isFalse chart.isLayerVisible('B') + + describe 'getVisibleLayers', -> + it 'should only return visible layers', -> + chart.showLayer('A') + chart.showLayer('B') + chart.hideLayer('C') + visible = chart.getVisibleLayers() + assert.equal visible.length, 2 + assert.equal visible[0].label, 'A' + assert.equal visible[1].label, 'B' + + describe 'SVG', -> + [containerWidth, containerHeight] = [1000, 280] + container = null + + before (done) -> + container = doc.createElement('DIV') + container.id = 'svg-container' + doc.body.appendChild(container) + d3.select('#svg-container').style + 'width': "#{containerWidth}px" + 'height': "#{containerHeight}px" + done() + + after (done) -> + doc.body.removeChild(container) + done() + + describe 'constructor', -> + it 'should create a new SVG when not given an element', -> + chart = new Epoch.Chart.SVG() + assert.ok chart.svg, "SVG not created" + + it 'should set the default width and height of the SVG', -> + chart = new Epoch.Chart.SVG() + assert.equal chart.svg.attr('width'), defaultWidth, "Default width not set" + assert.equal chart.svg.attr('height'), defaultHeight, "Default height not set" + + it 'should set custom dimensions for the SVG via options', -> + [customWidth, customHeight] = [500, 600] + chart = new Epoch.Chart.SVG({ width: customWidth, height: customHeight }) + assert.equal chart.svg.attr('width'), customWidth, "Custom width not set" + assert.equal chart.svg.attr('height'), customHeight, "Custom height not set" + + it 'should set the container dimensions for the SVG', -> + chart = new Epoch.Chart.SVG({ el: '#svg-container' }) + assert.equal chart.svg.attr('width'), containerWidth + assert.equal chart.svg.attr('height'), containerHeight + + describe 'dimensionsChanged', -> + [width, height, chart] = [200, 100, null] + + before (done) -> + d3.select(doc.body).append('div').attr('id', 'svgResize').style + width: width + 'px' + height: height + 'px' + chart = new Epoch.Chart.SVG { el: '#svgResize' } + done() + + after (done) -> + d3.select('#svgResize').remove() + done() + + it 'should resize the SVG element when the width option is changed', -> + newWidth = width + 500 + chart.option 'width', newWidth + assert.equal chart.svg.attr('width'), newWidth + + it 'should resize the SVG element when the height option is changed', -> + newHeight = height + 500 + chart.option 'height', newHeight + assert.equal chart.svg.attr('height'), newHeight + + describe 'Canvas', -> + [containerWidth, containerHeight] = [1000, 280] + container = null + container_id = 'canvas-container' + containedChart = null + + before (done) -> + container = doc.createElement('DIV') + container.id = container_id + doc.body.appendChild(container) + d3.select('#' + container_id).style + 'width': "#{containerWidth}px" + 'height': "#{containerHeight}px" + + containedChart = new Epoch.Chart.Canvas + el: '#' + container_id + pixelRatio: 1 + + done() + + after (done) -> + doc.body.removeChild(container) + done() + + describe 'constructor', -> + it 'should correctly detect the pixelRatio', -> + chart = new Epoch.Chart.Canvas() + assert.equal chart.pixelRatio, 2 + + it 'should allow the pixelRatio to be explicitly overriden', -> + customPixelRatio = 4.2 + chart = new Epoch.Chart.Canvas({ pixelRatio: customPixelRatio }) + assert.equal chart.pixelRatio, customPixelRatio + + it 'should create a child canvas', -> + chart = new Epoch.Chart.Canvas() + assert.ok chart.canvas, "Did not create canvas" + assert.equal chart.canvas.node().tagName.toLowerCase(), 'canvas', 'Did not create a canvas node' + + it 'should append the child canvas to the containing element', -> + assert.equal containedChart.canvas.node().parentNode.id, container_id + + it 'should set the default dimensions for the canvas', -> + chart = new Epoch.Chart.Canvas({ pixelRatio: 1 }) + assert.equal chart.canvas.attr('width'), defaultWidth + assert.equal chart.canvas.attr('height'), defaultHeight + + it 'should allow custom dimensions for the canvas', -> + [customWidth, customHeight] = [999, 888] + chart = new Epoch.Chart.Canvas + width: customWidth + height: customHeight + pixelRatio: 1 + assert.equal chart.canvas.attr('width'), customWidth + assert.equal chart.canvas.attr('height'), customHeight + + it 'should set container dimensions for the canvas', -> + assert.equal containedChart.canvas.attr('width'), containerWidth + assert.equal containedChart.canvas.attr('height'), containerHeight + + it 'should fetch a graphics context from the canvas', -> + assert.ok containedChart.ctx, "Did not fetch graphics context from canvas" + + it 'should take pixel ratio into account when setting canvas dimension attributes', -> + pixelRatio = 3 + chart = new Epoch.Chart.Canvas({ pixelRatio: pixelRatio }) + assert.equal chart.canvas.attr('width'), defaultWidth * pixelRatio + assert.equal chart.canvas.attr('height'), defaultHeight * pixelRatio + + it 'should not take pixel ratio into account when setting canvas dimension styles', -> + chart = new Epoch.Chart.Canvas({ pixelRatio: 2 }) + assert.equal +chart.canvas.style('width').replace('px', ''), defaultWidth + assert.equal +chart.canvas.style('height').replace('px', ''), defaultHeight + + describe 'getWidth', -> + it 'should take pixel ratio into account', -> + pixelRatio = 2 + chart = new Epoch.Chart.Canvas({ pixelRatio: pixelRatio }) + assert.equal chart.getWidth(), pixelRatio * defaultWidth + + describe 'getHeight', -> + it 'should take pixel ratio into account', -> + pixelRatio = 2 + chart = new Epoch.Chart.Canvas({ pixelRatio: pixelRatio }) + assert.equal chart.getHeight(), pixelRatio * defaultHeight + + describe 'dimensionsChanged', -> + [width, height, chart, pixelRatio] = [200, 100, null, 2] + + before (done) -> + d3.select(doc.body).append('div').attr('id', 'canvasResize').style + width: width + 'px' + height: height + 'px' + chart = new Epoch.Chart.Canvas { el: '#canvasResize', pixelRatio: pixelRatio } + done() + + after (done) -> + d3.select('#canvasResize').remove() + done() + + it 'should resize the canvas element when the width option is changed', -> + newWidth = width + 500 + chart.option 'width', newWidth + assert.equal chart.canvas.attr('width'), pixelRatio * newWidth + assert.equal chart.canvas.width(), newWidth + + it 'should resize the canvas element when the height option is changed', -> + newHeight = height + 500 + chart.option 'height', newHeight + assert.equal chart.canvas.attr('height'), pixelRatio * newHeight + assert.equal chart.canvas.height(), newHeight + + describe 'redraw', -> + chart = null + drawSpy = null + purgeSpy = null + + before -> + chart = new Epoch.Chart.Canvas() + + beforeEach -> + drawSpy = sinon.spy chart, 'draw' + purgeSpy = sinon.spy Epoch.QueryCSS, 'purge' + + afterEach -> + chart.draw.restore() + Epoch.QueryCSS.purge.restore() + + it 'should purge QueryCSS cache and redraw the canvas based chart with new styles', -> + chart.redraw() + + assert drawSpy.calledOnce + assert purgeSpy.calledOnce diff --git a/debian/missing-sources/epoch/tests/unit/core/copy.coffee b/debian/missing-sources/epoch/tests/unit/core/copy.coffee new file mode 100644 index 0000000..2043241 --- /dev/null +++ b/debian/missing-sources/epoch/tests/unit/core/copy.coffee @@ -0,0 +1,47 @@ +describe 'Epoch.Util', -> + describe 'copy', -> + it 'should correctly create a shallow copy', -> + object = + a: 20 + b: 'hello' + + copy = Epoch.Util.copy(object) + + assert.equal copy.a, object.a + assert.equal copy.b, object.b + + it 'should not recursively copy objects', -> + object = + a: + foo: 'bar' + + copy = Epoch.Util.copy(object) + object.a.foo = 'baz' + assert.equal object.a.foo, copy.a.foo + + describe 'defaults', -> + it 'should set default values when keys are missing', -> + options = {a: 'foo', b: 'bar'} + defaults = {c: 'baz'} + result = Epoch.Util.defaults(options, defaults) + assert.equal result.c, defaults.c + + it 'should not set default values when keys are present', -> + options = { a: 'foo', b: 'bar' } + defaults = { a: 'wow', b: 'neat' } + result = Epoch.Util.defaults(options, defaults) + assert.equal result.a, options.a + assert.equal result.b, options.b + + it 'should recursively set defaults from sub objects', -> + options = + a: + b: 'foo' + defaults = + a: + b: '' + c: 'bar' + result = Epoch.Util.defaults(options, defaults) + + assert.equal result.a.b, options.a.b + assert.equal result.a.c, defaults.a.c diff --git a/debian/missing-sources/epoch/tests/unit/core/css.coffee b/debian/missing-sources/epoch/tests/unit/core/css.coffee new file mode 100644 index 0000000..00cce68 --- /dev/null +++ b/debian/missing-sources/epoch/tests/unit/core/css.coffee @@ -0,0 +1,85 @@ +describe 'Epoch.QueryCSS', -> + styleMap = + '#container rect': + 'fill': 'blue' + 'stroke': 'red' + 'stroke-width': '5px' + '#container rect.a': + 'fill': 'green' + 'stroke': 'yellow' + 'stroke-width': '1px' + 'rect#byid': + 'fill': 'purple' + 'stroke': '#94105A' + 'stroke-width': '15px' + 'body.alt-color rect#byid': + 'fill': '#abcdef1' + 'stroke': '#48419A' + 'stroke-width': '2em' + + [container, svg, styleTag] = [null, null, null] + + makeStyleSheet = -> + cssStatements = [] + for selector, rules of styleMap + cssStatements.push (selector + "{" + ("#{k}: #{v}" for k, v of rules).join(';') + "}") + css = cssStatements.join('\n') + styleTag = addStyleSheet(css) + + makeContainer = -> + container = d3.select(doc.body).append('div') + .attr('id', 'container') + svg = container.append('svg') + .attr('width', 10) + .attr('height', 10) + + assertStyles = (object, selector) -> + unless object? + assert(false, "Object contains no styles") + + unless (mapping = styleMap[selector])? + assert(false, "Could not find styles with selector: #{selector}") + + for key, value of mapping + assert.equal object[key], value, "Style mismatch on rule '#{key}'" + + before (done) -> + makeStyleSheet() + makeContainer() + done() + + after (done) -> + doc.head.removeChild(styleTag) + doc.body.removeChild(container.node()) + done() + + describe 'getStyles', -> + it 'should find styles for an svg element', -> + styles = Epoch.QueryCSS.getStyles('rect', container) + assertStyles styles, '#container rect' + + it 'should find styles using a specific class name', -> + styles = Epoch.QueryCSS.getStyles('rect.a', container) + assertStyles styles, '#container rect.a' + + it 'should find styles using an id', -> + styles = Epoch.QueryCSS.getStyles('rect#byid', container) + assertStyles styles, 'rect#byid' + + describe 'purge', -> + before (done) -> + d3.select(doc.body).attr('class', 'alt-color') + done() + + after (done) -> + d3.select(doc.body).attr('class', null) + done() + + it 'should find cached styles before a purge', -> + styles = Epoch.QueryCSS.getStyles('rect#byid', container) + assertStyles styles, 'rect#byid' + + it 'should find new styles after purging the cache', -> + Epoch.QueryCSS.purge() + styles = Epoch.QueryCSS.getStyles('rect#byid', container) + assertStyles styles, 'body.alt-color rect#byid' diff --git a/debian/missing-sources/epoch/tests/unit/core/d3.coffee b/debian/missing-sources/epoch/tests/unit/core/d3.coffee new file mode 100644 index 0000000..1b65c55 --- /dev/null +++ b/debian/missing-sources/epoch/tests/unit/core/d3.coffee @@ -0,0 +1,40 @@ +describe 'd3.selection', -> + [width, height] = [345, 543, null] + [element, id] = [null, 'd3-element'] + + before (done) -> + element = doc.createElement('DIV') + element.id = id + doc.body.appendChild(element) + d3.select('#' + id).style + 'width': width + "px" + 'height': height + "px" + done() + + describe 'width', -> + it 'should return the width of an element', -> + assert.equal d3.select('#' + id).width(), width + + it 'should set the width of an element given a number', -> + widthNumber = 50 + d3.select('#'+id).width(widthNumber) + assert.equal d3.select('#'+id).width(), widthNumber + + it 'should set the width of an element given a css pixel length', -> + widthString = '500px' + d3.select('#'+id).width(widthString) + assert.equal d3.select('#'+id).width(), +widthString.replace('px', '') + + describe 'height', -> + it 'should return the height of an element', -> + assert.equal d3.select('#' + id).height(), height + + it 'should set the height of an element given a number', -> + heightNumber = 75 + d3.select('#'+id).height(heightNumber) + assert.equal d3.select('#'+id).height(), heightNumber + + it 'should set the height of an element given a css pixel length', -> + heightString = '343px' + d3.select('#'+id).height(heightString) + assert.equal d3.select('#'+id).height(), +heightString.replace('px', '') diff --git a/debian/missing-sources/epoch/tests/unit/core/events.coffee b/debian/missing-sources/epoch/tests/unit/core/events.coffee new file mode 100644 index 0000000..38d9356 --- /dev/null +++ b/debian/missing-sources/epoch/tests/unit/core/events.coffee @@ -0,0 +1,111 @@ +describe 'Epoch.Events', -> + eventsObject = null + + before (done) -> + eventsObject = new Epoch.Events() + done() + + it 'should execute callbacks when events are triggered', (done) -> + errorCallback = -> + assert false, 'Event callback never executed' + done() + timeout = setTimeout errorCallback, 1000 + eventsObject.on 'event', -> + clearTimeout(timeout) + done() + eventsObject.trigger 'event' + + it 'should not execute callbacks that have been removed', (done) -> + errorCallback = -> + assert false, 'Event callback still executed' + done() + eventsObject.on 'example', errorCallback + eventsObject.off 'example', errorCallback + eventsObject.trigger 'example' + done() + + it 'should execute all callbacks associated with an event name', (done) -> + total = 4 + + errorCallback = -> + assert false, 'Not all callbacks were executed' + done() + timeout = setTimeout errorCallback, 1000 + + makeCallback = -> -> + total-- + if total == 0 + clearTimeout(timeout) + done() + eventsObject.on('multi', makeCallback()) for i in [0...total] + eventsObject.trigger 'multi' + + it 'should remove all callbacks when using .off([String])', (done) -> + makeCallback = -> -> + assert false, "A callback was still executed" + done() + eventsObject.on('multi2', makeCallback()) for i in [0...4] + eventsObject.off('multi2') + eventsObject.trigger('multi2') + setTimeout (-> done()), 200 + + it 'should execute methods on the object when using .on([String], [String])', (done) -> + errorCallback = -> + assert false, 'Trigger did not call the appropriate method.' + done() + timeout = setTimeout(errorCallback, 1000) + + eventsObject.method = -> + clearTimeout(timeout) + done() + + eventsObject.on 'method-event', 'method' + eventsObject.trigger 'method-event' + + it 'should register all events when executing .onAll([Object])', (done) -> + errorCallback = -> + assert false, 'Not all events were triggered.' + done() + timeout = setTimeout(errorCallback, 1000) + + eventNames = ['multi:a', 'multi:b', 'multi:c', 'multi:d'] + total = 0 + + eventCallback = -> + total += 1 + if total == eventNames.length + clearTimeout(timeout) + done() + + eventMap = {} + eventMap[name] = eventCallback for name in eventNames + + eventsObject.onAll(eventMap) + eventsObject.trigger(name) for name in eventNames + + + it 'should remove all events when executing .offAll([Array])', -> + eventCallback = -> + assert false, 'A removed callback was still triggered.' + + eventNames = ['multi-off:a', 'multi-off:b', 'multi-off:c', 'multi-off:d'] + eventMap = {} + eventMap[name] = eventCallback for name in eventNames + + eventsObject.onAll(eventMap) + eventsObject.offAll(eventNames) + eventsObject.trigger(name) for name in eventNames + + + it 'should remove specific event callbacks when executing .offAll([Object])', (done) -> + makeEventCallback = -> -> + assert false, 'A removed callback was still triggered.' + + eventNames = ['multi-off:a', 'multi-off:b', 'multi-off:c', 'multi-off:d'] + eventMap = {} + eventMap[name] = makeEventCallback() for name in eventNames + + eventsObject.onAll(eventMap) + eventsObject.offAll(eventMap) + eventsObject.trigger(name) for name in eventNames + setTimeout (-> done()), 200 diff --git a/debian/missing-sources/epoch/tests/unit/core/format.coffee b/debian/missing-sources/epoch/tests/unit/core/format.coffee new file mode 100644 index 0000000..a645b49 --- /dev/null +++ b/debian/missing-sources/epoch/tests/unit/core/format.coffee @@ -0,0 +1,68 @@ +describe 'Epoch.Util', -> + describe 'formatSI', -> + it 'should produce the same number for integers < 1000', -> + number = 678 + assert.equal Epoch.Util.formatSI(number), number + + it 'should only set a fixed decimal for integers when instructed', -> + number = 20 + assert.equal Epoch.Util.formatSI(number), number + assert.equal Epoch.Util.formatSI(number, 1, true), "#{number}.0" + + it 'should set the appropriate number of fixed digits', -> + number = 3.1415 + for i in [1..5] + match = Epoch.Util.formatSI(number, i).split('.')[1] + assert.isNotNull match + assert.isString match + assert.equal match.length, i + + it 'should set the appropriate postfix based on the number\'s order of magnitude', -> + for i, postfix of ['K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'] + number = Math.pow(10, ((i|0)+1)*3) + assert.equal Epoch.Util.formatSI(number), "1 #{postfix}" + + + describe 'formatBytes', -> + it 'should postfix numbers < 1024 with "B"', -> + number = 512 + assert.equal Epoch.Util.formatBytes(number), "#{number} B" + + it 'should only set a fixed decimal for integers when instructed', -> + assert.equal Epoch.Util.formatBytes(128), '128 B' + assert.equal Epoch.Util.formatBytes(128, 1, true), '128.0 B' + assert.equal Epoch.Util.formatBytes(1024), '1 KB' + assert.equal Epoch.Util.formatBytes(1024, 1, true), '1.0 KB' + + it 'should set the appropriate number of fixed digits', -> + number = 3.1415 + for i in [1..5] + fixed = Epoch.Util.formatBytes(number, i).replace(/\sB$/, '') + assert.isString fixed + match = fixed.split('.')[1] + assert.isNotNull match + assert.equal match.length, i + + it 'should set the appropriate postfix based on the number\'s order of magnitude', -> + for i, postfix of ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] + number = Math.pow(1024, (i|0)+1) + regexp = new RegExp(" #{postfix}$") + assert.isNotNull Epoch.Util.formatBytes(number).match(regexp) + + +describe 'Epoch.Formats', -> + describe 'regular', -> + it 'should return what it was given', -> + assert.equal Epoch.Formats.regular(10), 10 + assert.equal Epoch.Formats.regular("hello"), "hello" + + describe 'percent', -> + it 'should return a percent given a number', -> + assert.equal Epoch.Formats.percent(0.1), '10.0%' + assert.equal Epoch.Formats.percent(0.5), '50.0%' + assert.equal Epoch.Formats.percent(1), '100.0%' + assert.equal Epoch.Formats.percent(23.245), '2324.5%' + + describe 'seconds', -> + it 'should return a well formatted date given a timestamp', -> + assert.match Epoch.Formats.seconds(1404385979), /\d{2}:\d{2}:\d{2} AM|PM/ diff --git a/debian/missing-sources/epoch/tests/unit/core/is.coffee b/debian/missing-sources/epoch/tests/unit/core/is.coffee new file mode 100644 index 0000000..af08eb2 --- /dev/null +++ b/debian/missing-sources/epoch/tests/unit/core/is.coffee @@ -0,0 +1,88 @@ +describe 'Epoch.Util', -> + describe 'isArray', -> + it 'should return true if given an array', -> + assert.ok Epoch.isArray([]) + assert.ok Epoch.isArray([1, 2, 3]) + + it 'should return false if not given an array', -> + assert.notOk Epoch.isArray(2) + assert.notOk Epoch.isArray("hello") + assert.notOk Epoch.isArray({}) + + describe 'isObject', -> + it 'should return true if given an flat object', -> + assert.ok Epoch.isObject({}) + + it 'should return false if given a number object', -> + assert.notOk Epoch.isObject(new Number()) + + it 'should return false if given a non-object', -> + assert.notOk Epoch.isObject([]) + assert.notOk Epoch.isObject(2) + assert.notOk Epoch.isObject("string") + + describe 'isString', -> + it 'should return true if given a string', -> + assert.ok Epoch.isString("example") + assert.ok Epoch.isString(new String()) + + it 'should return false if given a non-string', -> + assert.notOk Epoch.isString(2) + assert.notOk Epoch.isString([]) + assert.notOk Epoch.isString({}) + + describe 'isFunction', -> + it 'should return true if given a function', -> + assert.ok Epoch.isFunction(->) + + it 'should return false if given a non-function', -> + assert.notOk Epoch.isFunction([]) + assert.notOk Epoch.isFunction({}) + assert.notOk Epoch.isFunction(42) + assert.notOk Epoch.isFunction("cool") + + describe 'isNumber', -> + it 'should return true if given a number', -> + assert.ok Epoch.isNumber(new Number()) + + it 'should return true if given an integer literal', -> + assert.ok Epoch.isNumber(1983) + + it 'should return true if given a floating point literal', -> + assert.ok Epoch.isNumber(3.1415) + + it 'should return false if given a non-number', -> + assert.notOk Epoch.isNumber(->) + assert.notOk Epoch.isNumber([]) + assert.notOk Epoch.isNumber({}) + assert.notOk Epoch.isNumber("nan") + + describe 'isElement', -> + it 'should return true given an html element', -> + p = doc.createElement('P') + assert.ok Epoch.isElement(p) + + it 'should return false given a non-element', -> + assert.notOk Epoch.isElement(1) + assert.notOk Epoch.isElement("1") + assert.notOk Epoch.isElement({}) + assert.notOk Epoch.isElement([]) + assert.notOk Epoch.isElement(->) + + describe 'isNonEmptyArray', -> + it 'should return true given a non-empty array', -> + assert.ok Epoch.isNonEmptyArray([1]) + assert.ok Epoch.isNonEmptyArray([1, 3]) + assert.ok Epoch.isNonEmptyArray(["foo", 4, "bar"]) + + it 'should return false given a non-array', -> + assert.notOk Epoch.isNonEmptyArray(2) + assert.notOk Epoch.isNonEmptyArray("five") + assert.notOk Epoch.isNonEmptyArray({}) + assert.notOk Epoch.isNonEmptyArray(->) + + it 'should return false given a null value', -> + assert.notOk Epoch.isNonEmptyArray(null) + + it 'should return false given an empty array', -> + assert.notOk Epoch.isNonEmptyArray([]) diff --git a/debian/missing-sources/epoch/tests/unit/core/util.coffee b/debian/missing-sources/epoch/tests/unit/core/util.coffee new file mode 100644 index 0000000..e02280c --- /dev/null +++ b/debian/missing-sources/epoch/tests/unit/core/util.coffee @@ -0,0 +1,92 @@ +describe 'Epoch.Util', -> + describe 'trim', -> + it 'should return null unless given a string', -> + assert.isNotNull Epoch.Util.trim('test string') + assert.isNull Epoch.Util.trim(34) + + it 'should trim leading and trailing whitespace', -> + assert.equal Epoch.Util.trim("\t\n\r indeed \n\t\t\r"), 'indeed' + + it 'should leave inner whitespace', -> + assert.equal Epoch.Util.trim('Hello world'), 'Hello world' + + describe 'dasherize', -> + it 'should dasherize regular strings', -> + assert.equal Epoch.Util.dasherize('Hello World'), 'hello-world' + + it 'should trim leading and trailing whitespace before dasherizing', -> + assert.equal Epoch.Util.dasherize(' Airieee is KewL '), 'airieee-is-kewl' + + describe 'domain', -> + testLayers = [ + { values: [{x: 'A', y: 10}, {x: 'B', y: 20}, {x: 'C', y: 40}] } + ] + + testLayers2 = [ + { values: [{x: 'A', y: 10}, {x: 'B', y: 20}, {x: 'C', y: 40}] }, + { values: [{x: 'D', y: 15}, {x: 'E', y: 30}, {x: 'F', y: 90}] } + ] + + it 'should find the correct domain of a set of keys and values', -> + xDomain = Epoch.Util.domain(testLayers, 'x') + assert.sameMembers xDomain, ['A', 'B', 'C'] + yDomain = Epoch.Util.domain(testLayers, 'y') + assert.sameMembers yDomain, [10, 20, 40] + + it 'should find all the values across multiple layers', -> + xDomain = Epoch.Util.domain(testLayers2, 'x') + assert.sameMembers xDomain, ['A', 'B', 'C', 'D', 'E', 'F'] + yDomain = Epoch.Util.domain(testLayers2, 'y') + assert.sameMembers yDomain, [10, 20, 40, 15, 30, 90] + + describe 'toRGBA', -> + it 'should produce the correct rgba style when given an rgba color style', -> + assert.equal Epoch.Util.toRGBA('rgba(1, 2, 3, 0.4)', 0.1), 'rgba(1,2,3,0.1)' + + it 'should produce the correct rgba style when given any rgb color style', -> + assert.equal Epoch.Util.toRGBA('black', 0.25), 'rgba(0,0,0,0.25)' + assert.equal Epoch.Util.toRGBA('#FF0000', 0.9), 'rgba(255,0,0,0.9)' + assert.equal Epoch.Util.toRGBA('rgb(10, 20, 40)', 0.99), 'rgba(10,20,40,0.99)' + + describe 'getComputedStyle', -> + overrideStyles = + 'width': '320px' + 'height': '240px' + 'background-color': 'blue' + + [style, div] = [null, null] + + before (done) -> + style = addStyleSheet('#get-style-div { padding-left: 30px; background: green }') + div = doc.createElement('div') + div.id = 'get-style-div' + doc.body.appendChild(div) + d3.select('#get-style-div').style(overrideStyles) + done() + + after (done) -> + doc.body.removeChild(div) + doc.head.removeChild(style) + done() + + it 'should find