diff --git a/LICENSE.txt b/LICENSE.txt index 37ec93a1..e10841c5 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,191 +1,21 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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 - - http://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. +The MIT License (MIT) + +Copyright (c) 2017 Zalando SE + +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/README.md b/README.md index 3b3360ac..08ca487f 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,43 @@ -![ZalandoTechRadar icon](logo-medium.jpg) +# Tech Radar -. +At [Zalando](http://zalando.de), we maintain a public [Tech +Radar](http://zalando.github.io/tech-radar/) to help our delivery teams +align on technology choices. Is is based on the pioneering work +by [ThoughtWorks](https://www.thoughtworks.com/radar). -# Zalando Tech Radar +This repository contains the [visualization code](radar.js) +(js, based on [d3.js v4](https://d3js.org)). Feel free to adapt it +to your own purposes. -The **Zalando Tech Radar** is a tool to inspire and support teams to pick the best technologies for new projects. Based on the ideas of [ThoughtWorks](https://www.thoughtworks.com/radar), our Tech Radar sets out the changes in technologies that are interesting in software development: changes that we think our engineering teams should pay attention to and consider using in their projects. -This repository shares: +## Usage -* the *visualization* of the **[latest Zalando Tech Radar release](http://zalando.github.io/tech-radar/)**, including a short summary of what it includes and how we are using it; +See `docs/index.html` for sample usage. The current release version is +[radar-0.1.js](http://zalando.github.io/tech-radar/release/radar-0.1.js) -* *code* for generating the Tech Radar visualization from a simple tabular representation (tsv). The visualization code is based on the [Protovis JavaScript visualization library](http://mbostock.github.io/protovis/) and a fork of [Brett Dargan's Tech Radar visualization tool](https://github.com/bdargan/techradar). We've optimized the layout to make the chart and explanations fit on a double-sided sheet of A4 paper. - - -## Cool. How can I make my own? - -Create a Google doc with the following columns: - -* **Technology** (e.g. "Hystrix") -* **Quadrant** (Needs to be exactly and at least one of each quadrants: "Platforms & Infrastructure", "Data Mgt", "Languages", "Techniques; Frameworks & Tools") -* *[optional] Comments (e.g. "lib for fault tolerance")* -* **Score** as a float between 2.0 and -2.0 (e.g. "1.8") -* *[optional] Number of votes, for internal bookkeeping* -* *[optional] Consensus score, for internal bookkeeping* -* **Skip** — set to true if entry should not be visualized on chart - -Then follow the instructions below. - -Note: the score-to-ring mapping we use is not linear: - - score 2 ----- 1.5 --------------- 0 ---------- -1 ---------- -2 - ring ADOPT TRIAL ASSESS HOLD - -## How to generate a new chart - -1. run `gem install liquid` if necessary -1. on the master google doc, select `File > Download as > Tab-separated values` and store as `data/year_month.tsv` -1. open `data/year_month.tsv` and delete the first line (which contains the headers) -1. run `./transform.rb` to generate a new `radar_data.js` -1. open `index.html` in your browser to inspect the result -1. repeat the last two steps until you're happy with the arrangement :) -1. check everything in -1. merge `master` branch into `gh-pages` -1. push `gh-pages` to publish the new radar - - -### Notes - -* if your google doc is public, you can use `./download.sh` to automate steps 2 and 3 -* the last `.tsv` file (by lexical order) in `data/` is visualized. The next-to-last `.tsv` file (if it exists) is used to find out which blips have moved, relative to the previous radar. ## License -Apache 2.0 — same as [bdargan/techradar](https://github.com/bdargan/techradar) + +``` +The MIT License (MIT) + +Copyright (c) 2017 Zalando SE + +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. +``` \ No newline at end of file diff --git a/archive/Zalando_Tech_Radar_2016_10.pdf b/docs/archive/Zalando_Tech_Radar_2016_10.pdf similarity index 100% rename from archive/Zalando_Tech_Radar_2016_10.pdf rename to docs/archive/Zalando_Tech_Radar_2016_10.pdf diff --git a/archive/Zalando_Tech_Radar_2017_03.pdf b/docs/archive/Zalando_Tech_Radar_2017_03.pdf similarity index 100% rename from archive/Zalando_Tech_Radar_2017_03.pdf rename to docs/archive/Zalando_Tech_Radar_2017_03.pdf diff --git a/archive/Zalando_Tech_Radar_2017_07.pdf b/docs/archive/Zalando_Tech_Radar_2017_07.pdf similarity index 100% rename from archive/Zalando_Tech_Radar_2017_07.pdf rename to docs/archive/Zalando_Tech_Radar_2017_07.pdf diff --git a/data/2015_12.tsv b/docs/archive/data/2015_12.tsv similarity index 100% rename from data/2015_12.tsv rename to docs/archive/data/2015_12.tsv diff --git a/data/2016_04.tsv b/docs/archive/data/2016_04.tsv similarity index 100% rename from data/2016_04.tsv rename to docs/archive/data/2016_04.tsv diff --git a/data/2016_10.tsv b/docs/archive/data/2016_10.tsv similarity index 100% rename from data/2016_10.tsv rename to docs/archive/data/2016_10.tsv diff --git a/data/2017_03.tsv b/docs/archive/data/2017_03.tsv similarity index 100% rename from data/2017_03.tsv rename to docs/archive/data/2017_03.tsv diff --git a/data/2017_07.tsv b/docs/archive/data/2017_07.tsv similarity index 100% rename from data/2017_07.tsv rename to docs/archive/data/2017_07.tsv diff --git a/docs/favicon.ico b/docs/favicon.ico deleted file mode 100644 index 0e0c0197..00000000 Binary files a/docs/favicon.ico and /dev/null differ diff --git a/docs/index.html b/docs/index.html index f204d78b..5bc7f379 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,16 +1,12 @@ + Zalando Tech Radar - - + - - - - - - + + - + + + + + diff --git a/docs/lib/jasmine-1.0.1/jasmine-html.js b/docs/lib/jasmine-1.0.1/jasmine-html.js deleted file mode 100644 index 81402b9c..00000000 --- a/docs/lib/jasmine-1.0.1/jasmine-html.js +++ /dev/null @@ -1,188 +0,0 @@ -jasmine.TrivialReporter = function(doc) { - this.document = doc || document; - this.suiteDivs = {}; - this.logRunningSpecs = false; -}; - -jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) { - var el = document.createElement(type); - - for (var i = 2; i < arguments.length; i++) { - var child = arguments[i]; - - if (typeof child === 'string') { - el.appendChild(document.createTextNode(child)); - } else { - if (child) { el.appendChild(child); } - } - } - - for (var attr in attrs) { - if (attr == "className") { - el[attr] = attrs[attr]; - } else { - el.setAttribute(attr, attrs[attr]); - } - } - - return el; -}; - -jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { - var showPassed, showSkipped; - - this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' }, - this.createDom('div', { className: 'banner' }, - this.createDom('div', { className: 'logo' }, - this.createDom('a', { href: 'http://pivotal.github.com/jasmine/', target: "_blank" }, "Jasmine"), - this.createDom('span', { className: 'version' }, runner.env.versionString())), - this.createDom('div', { className: 'options' }, - "Show ", - showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }), - this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "), - showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }), - this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped") - ) - ), - - this.runnerDiv = this.createDom('div', { className: 'runner running' }, - this.createDom('a', { className: 'run_spec', href: '?' }, "run all"), - this.runnerMessageSpan = this.createDom('span', {}, "Running..."), - this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, "")) - ); - - this.document.body.appendChild(this.outerDiv); - - var suites = runner.suites(); - for (var i = 0; i < suites.length; i++) { - var suite = suites[i]; - var suiteDiv = this.createDom('div', { className: 'suite' }, - this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"), - this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description)); - this.suiteDivs[suite.id] = suiteDiv; - var parentDiv = this.outerDiv; - if (suite.parentSuite) { - parentDiv = this.suiteDivs[suite.parentSuite.id]; - } - parentDiv.appendChild(suiteDiv); - } - - this.startedAt = new Date(); - - var self = this; - showPassed.onclick = function(evt) { - if (showPassed.checked) { - self.outerDiv.className += ' show-passed'; - } else { - self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, ''); - } - }; - - showSkipped.onclick = function(evt) { - if (showSkipped.checked) { - self.outerDiv.className += ' show-skipped'; - } else { - self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, ''); - } - }; -}; - -jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) { - var results = runner.results(); - var className = (results.failedCount > 0) ? "runner failed" : "runner passed"; - this.runnerDiv.setAttribute("class", className); - //do it twice for IE - this.runnerDiv.setAttribute("className", className); - var specs = runner.specs(); - var specCount = 0; - for (var i = 0; i < specs.length; i++) { - if (this.specFilter(specs[i])) { - specCount++; - } - } - var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); - message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"; - this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild); - - this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString())); -}; - -jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { - var results = suite.results(); - var status = results.passed() ? 'passed' : 'failed'; - if (results.totalCount == 0) { // todo: change this to check results.skipped - status = 'skipped'; - } - this.suiteDivs[suite.id].className += " " + status; -}; - -jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) { - if (this.logRunningSpecs) { - this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...'); - } -}; - -jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { - var results = spec.results(); - var status = results.passed() ? 'passed' : 'failed'; - if (results.skipped) { - status = 'skipped'; - } - var specDiv = this.createDom('div', { className: 'spec ' + status }, - this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"), - this.createDom('a', { - className: 'description', - href: '?spec=' + encodeURIComponent(spec.getFullName()), - title: spec.getFullName() - }, spec.description)); - - - var resultItems = results.getItems(); - var messagesDiv = this.createDom('div', { className: 'messages' }); - for (var i = 0; i < resultItems.length; i++) { - var result = resultItems[i]; - - if (result.type == 'log') { - messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString())); - } else if (result.type == 'expect' && result.passed && !result.passed()) { - messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message)); - - if (result.trace.stack) { - messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack)); - } - } - } - - if (messagesDiv.childNodes.length > 0) { - specDiv.appendChild(messagesDiv); - } - - this.suiteDivs[spec.suite.id].appendChild(specDiv); -}; - -jasmine.TrivialReporter.prototype.log = function() { - var console = jasmine.getGlobal().console; - if (console && console.log) { - if (console.log.apply) { - console.log.apply(console, arguments); - } else { - console.log(arguments); // ie fix: console.log.apply doesn't exist on ie - } - } -}; - -jasmine.TrivialReporter.prototype.getLocation = function() { - return this.document.location; -}; - -jasmine.TrivialReporter.prototype.specFilter = function(spec) { - var paramMap = {}; - var params = this.getLocation().search.substring(1).split('&'); - for (var i = 0; i < params.length; i++) { - var p = params[i].split('='); - paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); - } - - if (!paramMap["spec"]) return true; - return spec.getFullName().indexOf(paramMap["spec"]) == 0; -}; diff --git a/docs/lib/jasmine-1.0.1/jasmine.css b/docs/lib/jasmine-1.0.1/jasmine.css deleted file mode 100644 index 6583fe7c..00000000 --- a/docs/lib/jasmine-1.0.1/jasmine.css +++ /dev/null @@ -1,166 +0,0 @@ -body { - font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; -} - - -.jasmine_reporter a:visited, .jasmine_reporter a { - color: #303; -} - -.jasmine_reporter a:hover, .jasmine_reporter a:active { - color: blue; -} - -.run_spec { - float:right; - padding-right: 5px; - font-size: .8em; - text-decoration: none; -} - -.jasmine_reporter { - margin: 0 5px; -} - -.banner { - color: #303; - background-color: #fef; - padding: 5px; -} - -.logo { - float: left; - font-size: 1.1em; - padding-left: 5px; -} - -.logo .version { - font-size: .6em; - padding-left: 1em; -} - -.runner.running { - background-color: yellow; -} - - -.options { - text-align: right; - font-size: .8em; -} - - - - -.suite { - border: 1px outset gray; - margin: 5px 0; - padding-left: 1em; -} - -.suite .suite { - margin: 5px; -} - -.suite.passed { - background-color: #dfd; -} - -.suite.failed { - background-color: #fdd; -} - -.spec { - margin: 5px; - padding-left: 1em; - clear: both; -} - -.spec.failed, .spec.passed, .spec.skipped { - padding-bottom: 5px; - border: 1px solid gray; -} - -.spec.failed { - background-color: #fbb; - border-color: red; -} - -.spec.passed { - background-color: #bfb; - border-color: green; -} - -.spec.skipped { - background-color: #bbb; -} - -.messages { - border-left: 1px dashed gray; - padding-left: 1em; - padding-right: 1em; -} - -.passed { - background-color: #cfc; - display: none; -} - -.failed { - background-color: #fbb; -} - -.skipped { - color: #777; - background-color: #eee; - display: none; -} - - -/*.resultMessage {*/ - /*white-space: pre;*/ -/*}*/ - -.resultMessage span.result { - display: block; - line-height: 2em; - color: black; -} - -.resultMessage .mismatch { - color: black; -} - -.stackTrace { - white-space: pre; - font-size: .8em; - margin-left: 10px; - max-height: 5em; - overflow: auto; - border: 1px inset red; - padding: 1em; - background: #eef; -} - -.finished-at { - padding-left: 1em; - font-size: .6em; -} - -.show-passed .passed, -.show-skipped .skipped { - display: block; -} - - -#jasmine_content { - position:fixed; - right: 100%; -} - -.runner { - border: 1px solid gray; - display: block; - margin: 5px 0; - padding: 2px 0 2px 10px; -} diff --git a/docs/lib/jasmine-1.0.1/jasmine.js b/docs/lib/jasmine-1.0.1/jasmine.js deleted file mode 100644 index 964f99ed..00000000 --- a/docs/lib/jasmine-1.0.1/jasmine.js +++ /dev/null @@ -1,2421 +0,0 @@ -/** - * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework. - * - * @namespace - */ -var jasmine = {}; - -/** - * @private - */ -jasmine.unimplementedMethod_ = function() { - throw new Error("unimplemented method"); -}; - -/** - * Use jasmine.undefined instead of undefined, since undefined is just - * a plain old variable and may be redefined by somebody else. - * - * @private - */ -jasmine.undefined = jasmine.___undefined___; - -/** - * Default interval in milliseconds for event loop yields (e.g. to allow network activity or to refresh the screen with the HTML-based runner). Small values here may result in slow test running. Zero means no updates until all tests have completed. - * - */ -jasmine.DEFAULT_UPDATE_INTERVAL = 250; - -/** - * Default timeout interval in milliseconds for waitsFor() blocks. - */ -jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; - -jasmine.getGlobal = function() { - function getGlobal() { - return this; - } - - return getGlobal(); -}; - -/** - * Allows for bound functions to be compared. Internal use only. - * - * @ignore - * @private - * @param base {Object} bound 'this' for the function - * @param name {Function} function to find - */ -jasmine.bindOriginal_ = function(base, name) { - var original = base[name]; - if (original.apply) { - return function() { - return original.apply(base, arguments); - }; - } else { - // IE support - return jasmine.getGlobal()[name]; - } -}; - -jasmine.setTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'setTimeout'); -jasmine.clearTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearTimeout'); -jasmine.setInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'setInterval'); -jasmine.clearInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearInterval'); - -jasmine.MessageResult = function(values) { - this.type = 'log'; - this.values = values; - this.trace = new Error(); // todo: test better -}; - -jasmine.MessageResult.prototype.toString = function() { - var text = ""; - for(var i = 0; i < this.values.length; i++) { - if (i > 0) text += " "; - if (jasmine.isString_(this.values[i])) { - text += this.values[i]; - } else { - text += jasmine.pp(this.values[i]); - } - } - return text; -}; - -jasmine.ExpectationResult = function(params) { - this.type = 'expect'; - this.matcherName = params.matcherName; - this.passed_ = params.passed; - this.expected = params.expected; - this.actual = params.actual; - - this.message = this.passed_ ? 'Passed.' : params.message; - this.trace = this.passed_ ? '' : new Error(this.message); -}; - -jasmine.ExpectationResult.prototype.toString = function () { - return this.message; -}; - -jasmine.ExpectationResult.prototype.passed = function () { - return this.passed_; -}; - -/** - * Getter for the Jasmine environment. Ensures one gets created - */ -jasmine.getEnv = function() { - return jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env(); -}; - -/** - * @ignore - * @private - * @param value - * @returns {Boolean} - */ -jasmine.isArray_ = function(value) { - return jasmine.isA_("Array", value); -}; - -/** - * @ignore - * @private - * @param value - * @returns {Boolean} - */ -jasmine.isString_ = function(value) { - return jasmine.isA_("String", value); -}; - -/** - * @ignore - * @private - * @param value - * @returns {Boolean} - */ -jasmine.isNumber_ = function(value) { - return jasmine.isA_("Number", value); -}; - -/** - * @ignore - * @private - * @param {String} typeName - * @param value - * @returns {Boolean} - */ -jasmine.isA_ = function(typeName, value) { - return Object.prototype.toString.apply(value) === '[object ' + typeName + ']'; -}; - -/** - * Pretty printer for expecations. Takes any object and turns it into a human-readable string. - * - * @param value {Object} an object to be outputted - * @returns {String} - */ -jasmine.pp = function(value) { - var stringPrettyPrinter = new jasmine.StringPrettyPrinter(); - stringPrettyPrinter.format(value); - return stringPrettyPrinter.string; -}; - -/** - * Returns true if the object is a DOM Node. - * - * @param {Object} obj object to check - * @returns {Boolean} - */ -jasmine.isDomNode = function(obj) { - return obj['nodeType'] > 0; -}; - -/** - * Returns a matchable 'generic' object of the class type. For use in expecations of type when values don't matter. - * - * @example - * // don't care about which function is passed in, as long as it's a function - * expect(mySpy).toHaveBeenCalledWith(jasmine.any(Function)); - * - * @param {Class} clazz - * @returns matchable object of the type clazz - */ -jasmine.any = function(clazz) { - return new jasmine.Matchers.Any(clazz); -}; - -/** - * Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks. - * - * Spies should be created in test setup, before expectations. They can then be checked, using the standard Jasmine - * expectation syntax. Spies can be checked if they were called or not and what the calling params were. - * - * A Spy has the following fields: wasCalled, callCount, mostRecentCall, and argsForCall (see docs). - * - * Spies are torn down at the end of every spec. - * - * Note: Do not call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj. - * - * @example - * // a stub - * var myStub = jasmine.createSpy('myStub'); // can be used anywhere - * - * // spy example - * var foo = { - * not: function(bool) { return !bool; } - * } - * - * // actual foo.not will not be called, execution stops - * spyOn(foo, 'not'); - - // foo.not spied upon, execution will continue to implementation - * spyOn(foo, 'not').andCallThrough(); - * - * // fake example - * var foo = { - * not: function(bool) { return !bool; } - * } - * - * // foo.not(val) will return val - * spyOn(foo, 'not').andCallFake(function(value) {return value;}); - * - * // mock example - * foo.not(7 == 7); - * expect(foo.not).toHaveBeenCalled(); - * expect(foo.not).toHaveBeenCalledWith(true); - * - * @constructor - * @see spyOn, jasmine.createSpy, jasmine.createSpyObj - * @param {String} name - */ -jasmine.Spy = function(name) { - /** - * The name of the spy, if provided. - */ - this.identity = name || 'unknown'; - /** - * Is this Object a spy? - */ - this.isSpy = true; - /** - * The actual function this spy stubs. - */ - this.plan = function() { - }; - /** - * Tracking of the most recent call to the spy. - * @example - * var mySpy = jasmine.createSpy('foo'); - * mySpy(1, 2); - * mySpy.mostRecentCall.args = [1, 2]; - */ - this.mostRecentCall = {}; - - /** - * Holds arguments for each call to the spy, indexed by call count - * @example - * var mySpy = jasmine.createSpy('foo'); - * mySpy(1, 2); - * mySpy(7, 8); - * mySpy.mostRecentCall.args = [7, 8]; - * mySpy.argsForCall[0] = [1, 2]; - * mySpy.argsForCall[1] = [7, 8]; - */ - this.argsForCall = []; - this.calls = []; -}; - -/** - * Tells a spy to call through to the actual implemenatation. - * - * @example - * var foo = { - * bar: function() { // do some stuff } - * } - * - * // defining a spy on an existing property: foo.bar - * spyOn(foo, 'bar').andCallThrough(); - */ -jasmine.Spy.prototype.andCallThrough = function() { - this.plan = this.originalValue; - return this; -}; - -/** - * For setting the return value of a spy. - * - * @example - * // defining a spy from scratch: foo() returns 'baz' - * var foo = jasmine.createSpy('spy on foo').andReturn('baz'); - * - * // defining a spy on an existing property: foo.bar() returns 'baz' - * spyOn(foo, 'bar').andReturn('baz'); - * - * @param {Object} value - */ -jasmine.Spy.prototype.andReturn = function(value) { - this.plan = function() { - return value; - }; - return this; -}; - -/** - * For throwing an exception when a spy is called. - * - * @example - * // defining a spy from scratch: foo() throws an exception w/ message 'ouch' - * var foo = jasmine.createSpy('spy on foo').andThrow('baz'); - * - * // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch' - * spyOn(foo, 'bar').andThrow('baz'); - * - * @param {String} exceptionMsg - */ -jasmine.Spy.prototype.andThrow = function(exceptionMsg) { - this.plan = function() { - throw exceptionMsg; - }; - return this; -}; - -/** - * Calls an alternate implementation when a spy is called. - * - * @example - * var baz = function() { - * // do some stuff, return something - * } - * // defining a spy from scratch: foo() calls the function baz - * var foo = jasmine.createSpy('spy on foo').andCall(baz); - * - * // defining a spy on an existing property: foo.bar() calls an anonymnous function - * spyOn(foo, 'bar').andCall(function() { return 'baz';} ); - * - * @param {Function} fakeFunc - */ -jasmine.Spy.prototype.andCallFake = function(fakeFunc) { - this.plan = fakeFunc; - return this; -}; - -/** - * Resets all of a spy's the tracking variables so that it can be used again. - * - * @example - * spyOn(foo, 'bar'); - * - * foo.bar(); - * - * expect(foo.bar.callCount).toEqual(1); - * - * foo.bar.reset(); - * - * expect(foo.bar.callCount).toEqual(0); - */ -jasmine.Spy.prototype.reset = function() { - this.wasCalled = false; - this.callCount = 0; - this.argsForCall = []; - this.calls = []; - this.mostRecentCall = {}; -}; - -jasmine.createSpy = function(name) { - - var spyObj = function() { - spyObj.wasCalled = true; - spyObj.callCount++; - var args = jasmine.util.argsToArray(arguments); - spyObj.mostRecentCall.object = this; - spyObj.mostRecentCall.args = args; - spyObj.argsForCall.push(args); - spyObj.calls.push({object: this, args: args}); - return spyObj.plan.apply(this, arguments); - }; - - var spy = new jasmine.Spy(name); - - for (var prop in spy) { - spyObj[prop] = spy[prop]; - } - - spyObj.reset(); - - return spyObj; -}; - -/** - * Determines whether an object is a spy. - * - * @param {jasmine.Spy|Object} putativeSpy - * @returns {Boolean} - */ -jasmine.isSpy = function(putativeSpy) { - return putativeSpy && putativeSpy.isSpy; -}; - -/** - * Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something - * large in one call. - * - * @param {String} baseName name of spy class - * @param {Array} methodNames array of names of methods to make spies - */ -jasmine.createSpyObj = function(baseName, methodNames) { - if (!jasmine.isArray_(methodNames) || methodNames.length == 0) { - throw new Error('createSpyObj requires a non-empty array of method names to create spies for'); - } - var obj = {}; - for (var i = 0; i < methodNames.length; i++) { - obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]); - } - return obj; -}; - -/** - * All parameters are pretty-printed and concatenated together, then written to the current spec's output. - * - * Be careful not to leave calls to jasmine.log in production code. - */ -jasmine.log = function() { - var spec = jasmine.getEnv().currentSpec; - spec.log.apply(spec, arguments); -}; - -/** - * Function that installs a spy on an existing object's method name. Used within a Spec to create a spy. - * - * @example - * // spy example - * var foo = { - * not: function(bool) { return !bool; } - * } - * spyOn(foo, 'not'); // actual foo.not will not be called, execution stops - * - * @see jasmine.createSpy - * @param obj - * @param methodName - * @returns a Jasmine spy that can be chained with all spy methods - */ -var spyOn = function(obj, methodName) { - return jasmine.getEnv().currentSpec.spyOn(obj, methodName); -}; - -/** - * Creates a Jasmine spec that will be added to the current suite. - * - * // TODO: pending tests - * - * @example - * it('should be true', function() { - * expect(true).toEqual(true); - * }); - * - * @param {String} desc description of this specification - * @param {Function} func defines the preconditions and expectations of the spec - */ -var it = function(desc, func) { - return jasmine.getEnv().it(desc, func); -}; - -/** - * Creates a disabled Jasmine spec. - * - * A convenience method that allows existing specs to be disabled temporarily during development. - * - * @param {String} desc description of this specification - * @param {Function} func defines the preconditions and expectations of the spec - */ -var xit = function(desc, func) { - return jasmine.getEnv().xit(desc, func); -}; - -/** - * Starts a chain for a Jasmine expectation. - * - * It is passed an Object that is the actual value and should chain to one of the many - * jasmine.Matchers functions. - * - * @param {Object} actual Actual value to test against and expected value - */ -var expect = function(actual) { - return jasmine.getEnv().currentSpec.expect(actual); -}; - -/** - * Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs. - * - * @param {Function} func Function that defines part of a jasmine spec. - */ -var runs = function(func) { - jasmine.getEnv().currentSpec.runs(func); -}; - -/** - * Waits a fixed time period before moving to the next block. - * - * @deprecated Use waitsFor() instead - * @param {Number} timeout milliseconds to wait - */ -var waits = function(timeout) { - jasmine.getEnv().currentSpec.waits(timeout); -}; - -/** - * Waits for the latchFunction to return true before proceeding to the next block. - * - * @param {Function} latchFunction - * @param {String} optional_timeoutMessage - * @param {Number} optional_timeout - */ -var waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) { - jasmine.getEnv().currentSpec.waitsFor.apply(jasmine.getEnv().currentSpec, arguments); -}; - -/** - * A function that is called before each spec in a suite. - * - * Used for spec setup, including validating assumptions. - * - * @param {Function} beforeEachFunction - */ -var beforeEach = function(beforeEachFunction) { - jasmine.getEnv().beforeEach(beforeEachFunction); -}; - -/** - * A function that is called after each spec in a suite. - * - * Used for restoring any state that is hijacked during spec execution. - * - * @param {Function} afterEachFunction - */ -var afterEach = function(afterEachFunction) { - jasmine.getEnv().afterEach(afterEachFunction); -}; - -/** - * Defines a suite of specifications. - * - * Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared - * are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization - * of setup in some tests. - * - * @example - * // TODO: a simple suite - * - * // TODO: a simple suite with a nested describe block - * - * @param {String} description A string, usually the class under test. - * @param {Function} specDefinitions function that defines several specs. - */ -var describe = function(description, specDefinitions) { - return jasmine.getEnv().describe(description, specDefinitions); -}; - -/** - * Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development. - * - * @param {String} description A string, usually the class under test. - * @param {Function} specDefinitions function that defines several specs. - */ -var xdescribe = function(description, specDefinitions) { - return jasmine.getEnv().xdescribe(description, specDefinitions); -}; - - -// Provide the XMLHttpRequest class for IE 5.x-6.x: -jasmine.XmlHttpRequest = (typeof XMLHttpRequest == "undefined") ? function() { - try { - return new ActiveXObject("Msxml2.XMLHTTP.6.0"); - } catch(e) { - } - try { - return new ActiveXObject("Msxml2.XMLHTTP.3.0"); - } catch(e) { - } - try { - return new ActiveXObject("Msxml2.XMLHTTP"); - } catch(e) { - } - try { - return new ActiveXObject("Microsoft.XMLHTTP"); - } catch(e) { - } - throw new Error("This browser does not support XMLHttpRequest."); -} : XMLHttpRequest; -/** - * @namespace - */ -jasmine.util = {}; - -/** - * Declare that a child class inherit it's prototype from the parent class. - * - * @private - * @param {Function} childClass - * @param {Function} parentClass - */ -jasmine.util.inherit = function(childClass, parentClass) { - /** - * @private - */ - var subclass = function() { - }; - subclass.prototype = parentClass.prototype; - childClass.prototype = new subclass; -}; - -jasmine.util.formatException = function(e) { - var lineNumber; - if (e.line) { - lineNumber = e.line; - } - else if (e.lineNumber) { - lineNumber = e.lineNumber; - } - - var file; - - if (e.sourceURL) { - file = e.sourceURL; - } - else if (e.fileName) { - file = e.fileName; - } - - var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString(); - - if (file && lineNumber) { - message += ' in ' + file + ' (line ' + lineNumber + ')'; - } - - return message; -}; - -jasmine.util.htmlEscape = function(str) { - if (!str) return str; - return str.replace(/&/g, '&') - .replace(//g, '>'); -}; - -jasmine.util.argsToArray = function(args) { - var arrayOfArgs = []; - for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]); - return arrayOfArgs; -}; - -jasmine.util.extend = function(destination, source) { - for (var property in source) destination[property] = source[property]; - return destination; -}; - -/** - * Environment for Jasmine - * - * @constructor - */ -jasmine.Env = function() { - this.currentSpec = null; - this.currentSuite = null; - this.currentRunner_ = new jasmine.Runner(this); - - this.reporter = new jasmine.MultiReporter(); - - this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL; - this.defaultTimeoutInterval = jasmine.DEFAULT_TIMEOUT_INTERVAL; - this.lastUpdate = 0; - this.specFilter = function() { - return true; - }; - - this.nextSpecId_ = 0; - this.nextSuiteId_ = 0; - this.equalityTesters_ = []; - - // wrap matchers - this.matchersClass = function() { - jasmine.Matchers.apply(this, arguments); - }; - jasmine.util.inherit(this.matchersClass, jasmine.Matchers); - - jasmine.Matchers.wrapInto_(jasmine.Matchers.prototype, this.matchersClass); -}; - - -jasmine.Env.prototype.setTimeout = jasmine.setTimeout; -jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout; -jasmine.Env.prototype.setInterval = jasmine.setInterval; -jasmine.Env.prototype.clearInterval = jasmine.clearInterval; - -/** - * @returns an object containing jasmine version build info, if set. - */ -jasmine.Env.prototype.version = function () { - if (jasmine.version_) { - return jasmine.version_; - } else { - throw new Error('Version not set'); - } -}; - -/** - * @returns string containing jasmine version build info, if set. - */ -jasmine.Env.prototype.versionString = function() { - if (jasmine.version_) { - var version = this.version(); - return version.major + "." + version.minor + "." + version.build + " revision " + version.revision; - } else { - return "version unknown"; - } -}; - -/** - * @returns a sequential integer starting at 0 - */ -jasmine.Env.prototype.nextSpecId = function () { - return this.nextSpecId_++; -}; - -/** - * @returns a sequential integer starting at 0 - */ -jasmine.Env.prototype.nextSuiteId = function () { - return this.nextSuiteId_++; -}; - -/** - * Register a reporter to receive status updates from Jasmine. - * @param {jasmine.Reporter} reporter An object which will receive status updates. - */ -jasmine.Env.prototype.addReporter = function(reporter) { - this.reporter.addReporter(reporter); -}; - -jasmine.Env.prototype.execute = function() { - this.currentRunner_.execute(); -}; - -jasmine.Env.prototype.describe = function(description, specDefinitions) { - var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite); - - var parentSuite = this.currentSuite; - if (parentSuite) { - parentSuite.add(suite); - } else { - this.currentRunner_.add(suite); - } - - this.currentSuite = suite; - - var declarationError = null; - try { - specDefinitions.call(suite); - } catch(e) { - declarationError = e; - } - - this.currentSuite = parentSuite; - - if (declarationError) { - this.it("encountered a declaration exception", function() { - throw declarationError; - }); - } - - return suite; -}; - -jasmine.Env.prototype.beforeEach = function(beforeEachFunction) { - if (this.currentSuite) { - this.currentSuite.beforeEach(beforeEachFunction); - } else { - this.currentRunner_.beforeEach(beforeEachFunction); - } -}; - -jasmine.Env.prototype.currentRunner = function () { - return this.currentRunner_; -}; - -jasmine.Env.prototype.afterEach = function(afterEachFunction) { - if (this.currentSuite) { - this.currentSuite.afterEach(afterEachFunction); - } else { - this.currentRunner_.afterEach(afterEachFunction); - } - -}; - -jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) { - return { - execute: function() { - } - }; -}; - -jasmine.Env.prototype.it = function(description, func) { - var spec = new jasmine.Spec(this, this.currentSuite, description); - this.currentSuite.add(spec); - this.currentSpec = spec; - - if (func) { - spec.runs(func); - } - - return spec; -}; - -jasmine.Env.prototype.xit = function(desc, func) { - return { - id: this.nextSpecId(), - runs: function() { - } - }; -}; - -jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) { - if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) { - return true; - } - - a.__Jasmine_been_here_before__ = b; - b.__Jasmine_been_here_before__ = a; - - var hasKey = function(obj, keyName) { - return obj != null && obj[keyName] !== jasmine.undefined; - }; - - for (var property in b) { - if (!hasKey(a, property) && hasKey(b, property)) { - mismatchKeys.push("expected has key '" + property + "', but missing from actual."); - } - } - for (property in a) { - if (!hasKey(b, property) && hasKey(a, property)) { - mismatchKeys.push("expected missing key '" + property + "', but present in actual."); - } - } - for (property in b) { - if (property == '__Jasmine_been_here_before__') continue; - if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) { - mismatchValues.push("'" + property + "' was '" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "' in expected, but was '" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "' in actual."); - } - } - - if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) { - mismatchValues.push("arrays were not the same length"); - } - - delete a.__Jasmine_been_here_before__; - delete b.__Jasmine_been_here_before__; - return (mismatchKeys.length == 0 && mismatchValues.length == 0); -}; - -jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) { - mismatchKeys = mismatchKeys || []; - mismatchValues = mismatchValues || []; - - for (var i = 0; i < this.equalityTesters_.length; i++) { - var equalityTester = this.equalityTesters_[i]; - var result = equalityTester(a, b, this, mismatchKeys, mismatchValues); - if (result !== jasmine.undefined) return result; - } - - if (a === b) return true; - - if (a === jasmine.undefined || a === null || b === jasmine.undefined || b === null) { - return (a == jasmine.undefined && b == jasmine.undefined); - } - - if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) { - return a === b; - } - - if (a instanceof Date && b instanceof Date) { - return a.getTime() == b.getTime(); - } - - if (a instanceof jasmine.Matchers.Any) { - return a.matches(b); - } - - if (b instanceof jasmine.Matchers.Any) { - return b.matches(a); - } - - if (jasmine.isString_(a) && jasmine.isString_(b)) { - return (a == b); - } - - if (jasmine.isNumber_(a) && jasmine.isNumber_(b)) { - return (a == b); - } - - if (typeof a === "object" && typeof b === "object") { - return this.compareObjects_(a, b, mismatchKeys, mismatchValues); - } - - //Straight check - return (a === b); -}; - -jasmine.Env.prototype.contains_ = function(haystack, needle) { - if (jasmine.isArray_(haystack)) { - for (var i = 0; i < haystack.length; i++) { - if (this.equals_(haystack[i], needle)) return true; - } - return false; - } - return haystack.indexOf(needle) >= 0; -}; - -jasmine.Env.prototype.addEqualityTester = function(equalityTester) { - this.equalityTesters_.push(equalityTester); -}; -/** No-op base class for Jasmine reporters. - * - * @constructor - */ -jasmine.Reporter = function() { -}; - -//noinspection JSUnusedLocalSymbols -jasmine.Reporter.prototype.reportRunnerStarting = function(runner) { -}; - -//noinspection JSUnusedLocalSymbols -jasmine.Reporter.prototype.reportRunnerResults = function(runner) { -}; - -//noinspection JSUnusedLocalSymbols -jasmine.Reporter.prototype.reportSuiteResults = function(suite) { -}; - -//noinspection JSUnusedLocalSymbols -jasmine.Reporter.prototype.reportSpecStarting = function(spec) { -}; - -//noinspection JSUnusedLocalSymbols -jasmine.Reporter.prototype.reportSpecResults = function(spec) { -}; - -//noinspection JSUnusedLocalSymbols -jasmine.Reporter.prototype.log = function(str) { -}; - -/** - * Blocks are functions with executable code that make up a spec. - * - * @constructor - * @param {jasmine.Env} env - * @param {Function} func - * @param {jasmine.Spec} spec - */ -jasmine.Block = function(env, func, spec) { - this.env = env; - this.func = func; - this.spec = spec; -}; - -jasmine.Block.prototype.execute = function(onComplete) { - try { - this.func.apply(this.spec); - } catch (e) { - this.spec.fail(e); - } - onComplete(); -}; -/** JavaScript API reporter. - * - * @constructor - */ -jasmine.JsApiReporter = function() { - this.started = false; - this.finished = false; - this.suites_ = []; - this.results_ = {}; -}; - -jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) { - this.started = true; - var suites = runner.topLevelSuites(); - for (var i = 0; i < suites.length; i++) { - var suite = suites[i]; - this.suites_.push(this.summarize_(suite)); - } -}; - -jasmine.JsApiReporter.prototype.suites = function() { - return this.suites_; -}; - -jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) { - var isSuite = suiteOrSpec instanceof jasmine.Suite; - var summary = { - id: suiteOrSpec.id, - name: suiteOrSpec.description, - type: isSuite ? 'suite' : 'spec', - children: [] - }; - - if (isSuite) { - var children = suiteOrSpec.children(); - for (var i = 0; i < children.length; i++) { - summary.children.push(this.summarize_(children[i])); - } - } - return summary; -}; - -jasmine.JsApiReporter.prototype.results = function() { - return this.results_; -}; - -jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) { - return this.results_[specId]; -}; - -//noinspection JSUnusedLocalSymbols -jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) { - this.finished = true; -}; - -//noinspection JSUnusedLocalSymbols -jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) { -}; - -//noinspection JSUnusedLocalSymbols -jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) { - this.results_[spec.id] = { - messages: spec.results().getItems(), - result: spec.results().failedCount > 0 ? "failed" : "passed" - }; -}; - -//noinspection JSUnusedLocalSymbols -jasmine.JsApiReporter.prototype.log = function(str) { -}; - -jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){ - var results = {}; - for (var i = 0; i < specIds.length; i++) { - var specId = specIds[i]; - results[specId] = this.summarizeResult_(this.results_[specId]); - } - return results; -}; - -jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){ - var summaryMessages = []; - var messagesLength = result.messages.length; - for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) { - var resultMessage = result.messages[messageIndex]; - summaryMessages.push({ - text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined, - passed: resultMessage.passed ? resultMessage.passed() : true, - type: resultMessage.type, - message: resultMessage.message, - trace: { - stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined - } - }); - } - - return { - result : result.result, - messages : summaryMessages - }; -}; - -/** - * @constructor - * @param {jasmine.Env} env - * @param actual - * @param {jasmine.Spec} spec - */ -jasmine.Matchers = function(env, actual, spec, opt_isNot) { - this.env = env; - this.actual = actual; - this.spec = spec; - this.isNot = opt_isNot || false; - this.reportWasCalled_ = false; -}; - -// todo: @deprecated as of Jasmine 0.11, remove soon [xw] -jasmine.Matchers.pp = function(str) { - throw new Error("jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!"); -}; - -// todo: @deprecated Deprecated as of Jasmine 0.10. Rewrite your custom matchers to return true or false. [xw] -jasmine.Matchers.prototype.report = function(result, failing_message, details) { - throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs"); -}; - -jasmine.Matchers.wrapInto_ = function(prototype, matchersClass) { - for (var methodName in prototype) { - if (methodName == 'report') continue; - var orig = prototype[methodName]; - matchersClass.prototype[methodName] = jasmine.Matchers.matcherFn_(methodName, orig); - } -}; - -jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) { - return function() { - var matcherArgs = jasmine.util.argsToArray(arguments); - var result = matcherFunction.apply(this, arguments); - - if (this.isNot) { - result = !result; - } - - if (this.reportWasCalled_) return result; - - var message; - if (!result) { - if (this.message) { - message = this.message.apply(this, arguments); - if (jasmine.isArray_(message)) { - message = message[this.isNot ? 1 : 0]; - } - } else { - var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); }); - message = "Expected " + jasmine.pp(this.actual) + (this.isNot ? " not " : " ") + englishyPredicate; - if (matcherArgs.length > 0) { - for (var i = 0; i < matcherArgs.length; i++) { - if (i > 0) message += ","; - message += " " + jasmine.pp(matcherArgs[i]); - } - } - message += "."; - } - } - var expectationResult = new jasmine.ExpectationResult({ - matcherName: matcherName, - passed: result, - expected: matcherArgs.length > 1 ? matcherArgs : matcherArgs[0], - actual: this.actual, - message: message - }); - this.spec.addMatcherResult(expectationResult); - return jasmine.undefined; - }; -}; - - - - -/** - * toBe: compares the actual to the expected using === - * @param expected - */ -jasmine.Matchers.prototype.toBe = function(expected) { - return this.actual === expected; -}; - -/** - * toNotBe: compares the actual to the expected using !== - * @param expected - * @deprecated as of 1.0. Use not.toBe() instead. - */ -jasmine.Matchers.prototype.toNotBe = function(expected) { - return this.actual !== expected; -}; - -/** - * toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc. - * - * @param expected - */ -jasmine.Matchers.prototype.toEqual = function(expected) { - return this.env.equals_(this.actual, expected); -}; - -/** - * toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual - * @param expected - * @deprecated as of 1.0. Use not.toNotEqual() instead. - */ -jasmine.Matchers.prototype.toNotEqual = function(expected) { - return !this.env.equals_(this.actual, expected); -}; - -/** - * Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes - * a pattern or a String. - * - * @param expected - */ -jasmine.Matchers.prototype.toMatch = function(expected) { - return new RegExp(expected).test(this.actual); -}; - -/** - * Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch - * @param expected - * @deprecated as of 1.0. Use not.toMatch() instead. - */ -jasmine.Matchers.prototype.toNotMatch = function(expected) { - return !(new RegExp(expected).test(this.actual)); -}; - -/** - * Matcher that compares the actual to jasmine.undefined. - */ -jasmine.Matchers.prototype.toBeDefined = function() { - return (this.actual !== jasmine.undefined); -}; - -/** - * Matcher that compares the actual to jasmine.undefined. - */ -jasmine.Matchers.prototype.toBeUndefined = function() { - return (this.actual === jasmine.undefined); -}; - -/** - * Matcher that compares the actual to null. - */ -jasmine.Matchers.prototype.toBeNull = function() { - return (this.actual === null); -}; - -/** - * Matcher that boolean not-nots the actual. - */ -jasmine.Matchers.prototype.toBeTruthy = function() { - return !!this.actual; -}; - - -/** - * Matcher that boolean nots the actual. - */ -jasmine.Matchers.prototype.toBeFalsy = function() { - return !this.actual; -}; - - -/** - * Matcher that checks to see if the actual, a Jasmine spy, was called. - */ -jasmine.Matchers.prototype.toHaveBeenCalled = function() { - if (arguments.length > 0) { - throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith'); - } - - if (!jasmine.isSpy(this.actual)) { - throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); - } - - this.message = function() { - return [ - "Expected spy " + this.actual.identity + " to have been called.", - "Expected spy " + this.actual.identity + " not to have been called." - ]; - }; - - return this.actual.wasCalled; -}; - -/** @deprecated Use expect(xxx).toHaveBeenCalled() instead */ -jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.prototype.toHaveBeenCalled; - -/** - * Matcher that checks to see if the actual, a Jasmine spy, was not called. - * - * @deprecated Use expect(xxx).not.toHaveBeenCalled() instead - */ -jasmine.Matchers.prototype.wasNotCalled = function() { - if (arguments.length > 0) { - throw new Error('wasNotCalled does not take arguments'); - } - - if (!jasmine.isSpy(this.actual)) { - throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); - } - - this.message = function() { - return [ - "Expected spy " + this.actual.identity + " to not have been called.", - "Expected spy " + this.actual.identity + " to have been called." - ]; - }; - - return !this.actual.wasCalled; -}; - -/** - * Matcher that checks to see if the actual, a Jasmine spy, was called with a set of parameters. - * - * @example - * - */ -jasmine.Matchers.prototype.toHaveBeenCalledWith = function() { - var expectedArgs = jasmine.util.argsToArray(arguments); - if (!jasmine.isSpy(this.actual)) { - throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); - } - this.message = function() { - if (this.actual.callCount == 0) { - // todo: what should the failure message for .not.toHaveBeenCalledWith() be? is this right? test better. [xw] - return [ - "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.", - "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was." - ]; - } else { - return [ - "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall), - "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall) - ]; - } - }; - - return this.env.contains_(this.actual.argsForCall, expectedArgs); -}; - -/** @deprecated Use expect(xxx).toHaveBeenCalledWith() instead */ -jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.prototype.toHaveBeenCalledWith; - -/** @deprecated Use expect(xxx).not.toHaveBeenCalledWith() instead */ -jasmine.Matchers.prototype.wasNotCalledWith = function() { - var expectedArgs = jasmine.util.argsToArray(arguments); - if (!jasmine.isSpy(this.actual)) { - throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); - } - - this.message = function() { - return [ - "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was", - "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was" - ] - }; - - return !this.env.contains_(this.actual.argsForCall, expectedArgs); -}; - -/** - * Matcher that checks that the expected item is an element in the actual Array. - * - * @param {Object} expected - */ -jasmine.Matchers.prototype.toContain = function(expected) { - return this.env.contains_(this.actual, expected); -}; - -/** - * Matcher that checks that the expected item is NOT an element in the actual Array. - * - * @param {Object} expected - * @deprecated as of 1.0. Use not.toNotContain() instead. - */ -jasmine.Matchers.prototype.toNotContain = function(expected) { - return !this.env.contains_(this.actual, expected); -}; - -jasmine.Matchers.prototype.toBeLessThan = function(expected) { - return this.actual < expected; -}; - -jasmine.Matchers.prototype.toBeGreaterThan = function(expected) { - return this.actual > expected; -}; - -/** - * Matcher that checks that the expected exception was thrown by the actual. - * - * @param {String} expected - */ -jasmine.Matchers.prototype.toThrow = function(expected) { - var result = false; - var exception; - if (typeof this.actual != 'function') { - throw new Error('Actual is not a function'); - } - try { - this.actual(); - } catch (e) { - exception = e; - } - if (exception) { - result = (expected === jasmine.undefined || this.env.equals_(exception.message || exception, expected.message || expected)); - } - - var not = this.isNot ? "not " : ""; - - this.message = function() { - if (exception && (expected === jasmine.undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) { - return ["Expected function " + not + "to throw", expected ? expected.message || expected : " an exception", ", but it threw", exception.message || exception].join(' '); - } else { - return "Expected function to throw an exception."; - } - }; - - return result; -}; - -jasmine.Matchers.Any = function(expectedClass) { - this.expectedClass = expectedClass; -}; - -jasmine.Matchers.Any.prototype.matches = function(other) { - if (this.expectedClass == String) { - return typeof other == 'string' || other instanceof String; - } - - if (this.expectedClass == Number) { - return typeof other == 'number' || other instanceof Number; - } - - if (this.expectedClass == Function) { - return typeof other == 'function' || other instanceof Function; - } - - if (this.expectedClass == Object) { - return typeof other == 'object'; - } - - return other instanceof this.expectedClass; -}; - -jasmine.Matchers.Any.prototype.toString = function() { - return ''; -}; - -/** - * @constructor - */ -jasmine.MultiReporter = function() { - this.subReporters_ = []; -}; -jasmine.util.inherit(jasmine.MultiReporter, jasmine.Reporter); - -jasmine.MultiReporter.prototype.addReporter = function(reporter) { - this.subReporters_.push(reporter); -}; - -(function() { - var functionNames = [ - "reportRunnerStarting", - "reportRunnerResults", - "reportSuiteResults", - "reportSpecStarting", - "reportSpecResults", - "log" - ]; - for (var i = 0; i < functionNames.length; i++) { - var functionName = functionNames[i]; - jasmine.MultiReporter.prototype[functionName] = (function(functionName) { - return function() { - for (var j = 0; j < this.subReporters_.length; j++) { - var subReporter = this.subReporters_[j]; - if (subReporter[functionName]) { - subReporter[functionName].apply(subReporter, arguments); - } - } - }; - })(functionName); - } -})(); -/** - * Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults - * - * @constructor - */ -jasmine.NestedResults = function() { - /** - * The total count of results - */ - this.totalCount = 0; - /** - * Number of passed results - */ - this.passedCount = 0; - /** - * Number of failed results - */ - this.failedCount = 0; - /** - * Was this suite/spec skipped? - */ - this.skipped = false; - /** - * @ignore - */ - this.items_ = []; -}; - -/** - * Roll up the result counts. - * - * @param result - */ -jasmine.NestedResults.prototype.rollupCounts = function(result) { - this.totalCount += result.totalCount; - this.passedCount += result.passedCount; - this.failedCount += result.failedCount; -}; - -/** - * Adds a log message. - * @param values Array of message parts which will be concatenated later. - */ -jasmine.NestedResults.prototype.log = function(values) { - this.items_.push(new jasmine.MessageResult(values)); -}; - -/** - * Getter for the results: message & results. - */ -jasmine.NestedResults.prototype.getItems = function() { - return this.items_; -}; - -/** - * Adds a result, tracking counts (total, passed, & failed) - * @param {jasmine.ExpectationResult|jasmine.NestedResults} result - */ -jasmine.NestedResults.prototype.addResult = function(result) { - if (result.type != 'log') { - if (result.items_) { - this.rollupCounts(result); - } else { - this.totalCount++; - if (result.passed()) { - this.passedCount++; - } else { - this.failedCount++; - } - } - } - this.items_.push(result); -}; - -/** - * @returns {Boolean} True if everything below passed - */ -jasmine.NestedResults.prototype.passed = function() { - return this.passedCount === this.totalCount; -}; -/** - * Base class for pretty printing for expectation results. - */ -jasmine.PrettyPrinter = function() { - this.ppNestLevel_ = 0; -}; - -/** - * Formats a value in a nice, human-readable string. - * - * @param value - */ -jasmine.PrettyPrinter.prototype.format = function(value) { - if (this.ppNestLevel_ > 40) { - throw new Error('jasmine.PrettyPrinter: format() nested too deeply!'); - } - - this.ppNestLevel_++; - try { - if (value === jasmine.undefined) { - this.emitScalar('undefined'); - } else if (value === null) { - this.emitScalar('null'); - } else if (value === jasmine.getGlobal()) { - this.emitScalar(''); - } else if (value instanceof jasmine.Matchers.Any) { - this.emitScalar(value.toString()); - } else if (typeof value === 'string') { - this.emitString(value); - } else if (jasmine.isSpy(value)) { - this.emitScalar("spy on " + value.identity); - } else if (value instanceof RegExp) { - this.emitScalar(value.toString()); - } else if (typeof value === 'function') { - this.emitScalar('Function'); - } else if (typeof value.nodeType === 'number') { - this.emitScalar('HTMLNode'); - } else if (value instanceof Date) { - this.emitScalar('Date(' + value + ')'); - } else if (value.__Jasmine_been_here_before__) { - this.emitScalar(''); - } else if (jasmine.isArray_(value) || typeof value == 'object') { - value.__Jasmine_been_here_before__ = true; - if (jasmine.isArray_(value)) { - this.emitArray(value); - } else { - this.emitObject(value); - } - delete value.__Jasmine_been_here_before__; - } else { - this.emitScalar(value.toString()); - } - } finally { - this.ppNestLevel_--; - } -}; - -jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) { - for (var property in obj) { - if (property == '__Jasmine_been_here_before__') continue; - fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) != null) : false); - } -}; - -jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_; -jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_; -jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_; -jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_; - -jasmine.StringPrettyPrinter = function() { - jasmine.PrettyPrinter.call(this); - - this.string = ''; -}; -jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter); - -jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) { - this.append(value); -}; - -jasmine.StringPrettyPrinter.prototype.emitString = function(value) { - this.append("'" + value + "'"); -}; - -jasmine.StringPrettyPrinter.prototype.emitArray = function(array) { - this.append('[ '); - for (var i = 0; i < array.length; i++) { - if (i > 0) { - this.append(', '); - } - this.format(array[i]); - } - this.append(' ]'); -}; - -jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) { - var self = this; - this.append('{ '); - var first = true; - - this.iterateObject(obj, function(property, isGetter) { - if (first) { - first = false; - } else { - self.append(', '); - } - - self.append(property); - self.append(' : '); - if (isGetter) { - self.append(''); - } else { - self.format(obj[property]); - } - }); - - this.append(' }'); -}; - -jasmine.StringPrettyPrinter.prototype.append = function(value) { - this.string += value; -}; -jasmine.Queue = function(env) { - this.env = env; - this.blocks = []; - this.running = false; - this.index = 0; - this.offset = 0; - this.abort = false; -}; - -jasmine.Queue.prototype.addBefore = function(block) { - this.blocks.unshift(block); -}; - -jasmine.Queue.prototype.add = function(block) { - this.blocks.push(block); -}; - -jasmine.Queue.prototype.insertNext = function(block) { - this.blocks.splice((this.index + this.offset + 1), 0, block); - this.offset++; -}; - -jasmine.Queue.prototype.start = function(onComplete) { - this.running = true; - this.onComplete = onComplete; - this.next_(); -}; - -jasmine.Queue.prototype.isRunning = function() { - return this.running; -}; - -jasmine.Queue.LOOP_DONT_RECURSE = true; - -jasmine.Queue.prototype.next_ = function() { - var self = this; - var goAgain = true; - - while (goAgain) { - goAgain = false; - - if (self.index < self.blocks.length && !this.abort) { - var calledSynchronously = true; - var completedSynchronously = false; - - var onComplete = function () { - if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) { - completedSynchronously = true; - return; - } - - if (self.blocks[self.index].abort) { - self.abort = true; - } - - self.offset = 0; - self.index++; - - var now = new Date().getTime(); - if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) { - self.env.lastUpdate = now; - self.env.setTimeout(function() { - self.next_(); - }, 0); - } else { - if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) { - goAgain = true; - } else { - self.next_(); - } - } - }; - self.blocks[self.index].execute(onComplete); - - calledSynchronously = false; - if (completedSynchronously) { - onComplete(); - } - - } else { - self.running = false; - if (self.onComplete) { - self.onComplete(); - } - } - } -}; - -jasmine.Queue.prototype.results = function() { - var results = new jasmine.NestedResults(); - for (var i = 0; i < this.blocks.length; i++) { - if (this.blocks[i].results) { - results.addResult(this.blocks[i].results()); - } - } - return results; -}; - - -/** - * Runner - * - * @constructor - * @param {jasmine.Env} env - */ -jasmine.Runner = function(env) { - var self = this; - self.env = env; - self.queue = new jasmine.Queue(env); - self.before_ = []; - self.after_ = []; - self.suites_ = []; -}; - -jasmine.Runner.prototype.execute = function() { - var self = this; - if (self.env.reporter.reportRunnerStarting) { - self.env.reporter.reportRunnerStarting(this); - } - self.queue.start(function () { - self.finishCallback(); - }); -}; - -jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) { - beforeEachFunction.typeName = 'beforeEach'; - this.before_.splice(0,0,beforeEachFunction); -}; - -jasmine.Runner.prototype.afterEach = function(afterEachFunction) { - afterEachFunction.typeName = 'afterEach'; - this.after_.splice(0,0,afterEachFunction); -}; - - -jasmine.Runner.prototype.finishCallback = function() { - this.env.reporter.reportRunnerResults(this); -}; - -jasmine.Runner.prototype.addSuite = function(suite) { - this.suites_.push(suite); -}; - -jasmine.Runner.prototype.add = function(block) { - if (block instanceof jasmine.Suite) { - this.addSuite(block); - } - this.queue.add(block); -}; - -jasmine.Runner.prototype.specs = function () { - var suites = this.suites(); - var specs = []; - for (var i = 0; i < suites.length; i++) { - specs = specs.concat(suites[i].specs()); - } - return specs; -}; - -jasmine.Runner.prototype.suites = function() { - return this.suites_; -}; - -jasmine.Runner.prototype.topLevelSuites = function() { - var topLevelSuites = []; - for (var i = 0; i < this.suites_.length; i++) { - if (!this.suites_[i].parentSuite) { - topLevelSuites.push(this.suites_[i]); - } - } - return topLevelSuites; -}; - -jasmine.Runner.prototype.results = function() { - return this.queue.results(); -}; -/** - * Internal representation of a Jasmine specification, or test. - * - * @constructor - * @param {jasmine.Env} env - * @param {jasmine.Suite} suite - * @param {String} description - */ -jasmine.Spec = function(env, suite, description) { - if (!env) { - throw new Error('jasmine.Env() required'); - } - if (!suite) { - throw new Error('jasmine.Suite() required'); - } - var spec = this; - spec.id = env.nextSpecId ? env.nextSpecId() : null; - spec.env = env; - spec.suite = suite; - spec.description = description; - spec.queue = new jasmine.Queue(env); - - spec.afterCallbacks = []; - spec.spies_ = []; - - spec.results_ = new jasmine.NestedResults(); - spec.results_.description = description; - spec.matchersClass = null; -}; - -jasmine.Spec.prototype.getFullName = function() { - return this.suite.getFullName() + ' ' + this.description + '.'; -}; - - -jasmine.Spec.prototype.results = function() { - return this.results_; -}; - -/** - * All parameters are pretty-printed and concatenated together, then written to the spec's output. - * - * Be careful not to leave calls to jasmine.log in production code. - */ -jasmine.Spec.prototype.log = function() { - return this.results_.log(arguments); -}; - -jasmine.Spec.prototype.runs = function (func) { - var block = new jasmine.Block(this.env, func, this); - this.addToQueue(block); - return this; -}; - -jasmine.Spec.prototype.addToQueue = function (block) { - if (this.queue.isRunning()) { - this.queue.insertNext(block); - } else { - this.queue.add(block); - } -}; - -/** - * @param {jasmine.ExpectationResult} result - */ -jasmine.Spec.prototype.addMatcherResult = function(result) { - this.results_.addResult(result); -}; - -jasmine.Spec.prototype.expect = function(actual) { - var positive = new (this.getMatchersClass_())(this.env, actual, this); - positive.not = new (this.getMatchersClass_())(this.env, actual, this, true); - return positive; -}; - -/** - * Waits a fixed time period before moving to the next block. - * - * @deprecated Use waitsFor() instead - * @param {Number} timeout milliseconds to wait - */ -jasmine.Spec.prototype.waits = function(timeout) { - var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this); - this.addToQueue(waitsFunc); - return this; -}; - -/** - * Waits for the latchFunction to return true before proceeding to the next block. - * - * @param {Function} latchFunction - * @param {String} optional_timeoutMessage - * @param {Number} optional_timeout - */ -jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) { - var latchFunction_ = null; - var optional_timeoutMessage_ = null; - var optional_timeout_ = null; - - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - switch (typeof arg) { - case 'function': - latchFunction_ = arg; - break; - case 'string': - optional_timeoutMessage_ = arg; - break; - case 'number': - optional_timeout_ = arg; - break; - } - } - - var waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this); - this.addToQueue(waitsForFunc); - return this; -}; - -jasmine.Spec.prototype.fail = function (e) { - var expectationResult = new jasmine.ExpectationResult({ - passed: false, - message: e ? jasmine.util.formatException(e) : 'Exception' - }); - this.results_.addResult(expectationResult); -}; - -jasmine.Spec.prototype.getMatchersClass_ = function() { - return this.matchersClass || this.env.matchersClass; -}; - -jasmine.Spec.prototype.addMatchers = function(matchersPrototype) { - var parent = this.getMatchersClass_(); - var newMatchersClass = function() { - parent.apply(this, arguments); - }; - jasmine.util.inherit(newMatchersClass, parent); - jasmine.Matchers.wrapInto_(matchersPrototype, newMatchersClass); - this.matchersClass = newMatchersClass; -}; - -jasmine.Spec.prototype.finishCallback = function() { - this.env.reporter.reportSpecResults(this); -}; - -jasmine.Spec.prototype.finish = function(onComplete) { - this.removeAllSpies(); - this.finishCallback(); - if (onComplete) { - onComplete(); - } -}; - -jasmine.Spec.prototype.after = function(doAfter) { - if (this.queue.isRunning()) { - this.queue.add(new jasmine.Block(this.env, doAfter, this)); - } else { - this.afterCallbacks.unshift(doAfter); - } -}; - -jasmine.Spec.prototype.execute = function(onComplete) { - var spec = this; - if (!spec.env.specFilter(spec)) { - spec.results_.skipped = true; - spec.finish(onComplete); - return; - } - - this.env.reporter.reportSpecStarting(this); - - spec.env.currentSpec = spec; - - spec.addBeforesAndAftersToQueue(); - - spec.queue.start(function () { - spec.finish(onComplete); - }); -}; - -jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() { - var runner = this.env.currentRunner(); - var i; - - for (var suite = this.suite; suite; suite = suite.parentSuite) { - for (i = 0; i < suite.before_.length; i++) { - this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this)); - } - } - for (i = 0; i < runner.before_.length; i++) { - this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this)); - } - for (i = 0; i < this.afterCallbacks.length; i++) { - this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this)); - } - for (suite = this.suite; suite; suite = suite.parentSuite) { - for (i = 0; i < suite.after_.length; i++) { - this.queue.add(new jasmine.Block(this.env, suite.after_[i], this)); - } - } - for (i = 0; i < runner.after_.length; i++) { - this.queue.add(new jasmine.Block(this.env, runner.after_[i], this)); - } -}; - -jasmine.Spec.prototype.explodes = function() { - throw 'explodes function should not have been called'; -}; - -jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) { - if (obj == jasmine.undefined) { - throw "spyOn could not find an object to spy upon for " + methodName + "()"; - } - - if (!ignoreMethodDoesntExist && obj[methodName] === jasmine.undefined) { - throw methodName + '() method does not exist'; - } - - if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) { - throw new Error(methodName + ' has already been spied upon'); - } - - var spyObj = jasmine.createSpy(methodName); - - this.spies_.push(spyObj); - spyObj.baseObj = obj; - spyObj.methodName = methodName; - spyObj.originalValue = obj[methodName]; - - obj[methodName] = spyObj; - - return spyObj; -}; - -jasmine.Spec.prototype.removeAllSpies = function() { - for (var i = 0; i < this.spies_.length; i++) { - var spy = this.spies_[i]; - spy.baseObj[spy.methodName] = spy.originalValue; - } - this.spies_ = []; -}; - -/** - * Internal representation of a Jasmine suite. - * - * @constructor - * @param {jasmine.Env} env - * @param {String} description - * @param {Function} specDefinitions - * @param {jasmine.Suite} parentSuite - */ -jasmine.Suite = function(env, description, specDefinitions, parentSuite) { - var self = this; - self.id = env.nextSuiteId ? env.nextSuiteId() : null; - self.description = description; - self.queue = new jasmine.Queue(env); - self.parentSuite = parentSuite; - self.env = env; - self.before_ = []; - self.after_ = []; - self.children_ = []; - self.suites_ = []; - self.specs_ = []; -}; - -jasmine.Suite.prototype.getFullName = function() { - var fullName = this.description; - for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) { - fullName = parentSuite.description + ' ' + fullName; - } - return fullName; -}; - -jasmine.Suite.prototype.finish = function(onComplete) { - this.env.reporter.reportSuiteResults(this); - this.finished = true; - if (typeof(onComplete) == 'function') { - onComplete(); - } -}; - -jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) { - beforeEachFunction.typeName = 'beforeEach'; - this.before_.unshift(beforeEachFunction); -}; - -jasmine.Suite.prototype.afterEach = function(afterEachFunction) { - afterEachFunction.typeName = 'afterEach'; - this.after_.unshift(afterEachFunction); -}; - -jasmine.Suite.prototype.results = function() { - return this.queue.results(); -}; - -jasmine.Suite.prototype.add = function(suiteOrSpec) { - this.children_.push(suiteOrSpec); - if (suiteOrSpec instanceof jasmine.Suite) { - this.suites_.push(suiteOrSpec); - this.env.currentRunner().addSuite(suiteOrSpec); - } else { - this.specs_.push(suiteOrSpec); - } - this.queue.add(suiteOrSpec); -}; - -jasmine.Suite.prototype.specs = function() { - return this.specs_; -}; - -jasmine.Suite.prototype.suites = function() { - return this.suites_; -}; - -jasmine.Suite.prototype.children = function() { - return this.children_; -}; - -jasmine.Suite.prototype.execute = function(onComplete) { - var self = this; - this.queue.start(function () { - self.finish(onComplete); - }); -}; -jasmine.WaitsBlock = function(env, timeout, spec) { - this.timeout = timeout; - jasmine.Block.call(this, env, null, spec); -}; - -jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block); - -jasmine.WaitsBlock.prototype.execute = function (onComplete) { - this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...'); - this.env.setTimeout(function () { - onComplete(); - }, this.timeout); -}; -/** - * A block which waits for some condition to become true, with timeout. - * - * @constructor - * @extends jasmine.Block - * @param {jasmine.Env} env The Jasmine environment. - * @param {Number} timeout The maximum time in milliseconds to wait for the condition to become true. - * @param {Function} latchFunction A function which returns true when the desired condition has been met. - * @param {String} message The message to display if the desired condition hasn't been met within the given time period. - * @param {jasmine.Spec} spec The Jasmine spec. - */ -jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) { - this.timeout = timeout || env.defaultTimeoutInterval; - this.latchFunction = latchFunction; - this.message = message; - this.totalTimeSpentWaitingForLatch = 0; - jasmine.Block.call(this, env, null, spec); -}; -jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block); - -jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 10; - -jasmine.WaitsForBlock.prototype.execute = function(onComplete) { - this.env.reporter.log('>> Jasmine waiting for ' + (this.message || 'something to happen')); - var latchFunctionResult; - try { - latchFunctionResult = this.latchFunction.apply(this.spec); - } catch (e) { - this.spec.fail(e); - onComplete(); - return; - } - - if (latchFunctionResult) { - onComplete(); - } else if (this.totalTimeSpentWaitingForLatch >= this.timeout) { - var message = 'timed out after ' + this.timeout + ' msec waiting for ' + (this.message || 'something to happen'); - this.spec.fail({ - name: 'timeout', - message: message - }); - - this.abort = true; - onComplete(); - } else { - this.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT; - var self = this; - this.env.setTimeout(function() { - self.execute(onComplete); - }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT); - } -}; -// Mock setTimeout, clearTimeout -// Contributed by Pivotal Computer Systems, www.pivotalsf.com - -jasmine.FakeTimer = function() { - this.reset(); - - var self = this; - self.setTimeout = function(funcToCall, millis) { - self.timeoutsMade++; - self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false); - return self.timeoutsMade; - }; - - self.setInterval = function(funcToCall, millis) { - self.timeoutsMade++; - self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true); - return self.timeoutsMade; - }; - - self.clearTimeout = function(timeoutKey) { - self.scheduledFunctions[timeoutKey] = jasmine.undefined; - }; - - self.clearInterval = function(timeoutKey) { - self.scheduledFunctions[timeoutKey] = jasmine.undefined; - }; - -}; - -jasmine.FakeTimer.prototype.reset = function() { - this.timeoutsMade = 0; - this.scheduledFunctions = {}; - this.nowMillis = 0; -}; - -jasmine.FakeTimer.prototype.tick = function(millis) { - var oldMillis = this.nowMillis; - var newMillis = oldMillis + millis; - this.runFunctionsWithinRange(oldMillis, newMillis); - this.nowMillis = newMillis; -}; - -jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) { - var scheduledFunc; - var funcsToRun = []; - for (var timeoutKey in this.scheduledFunctions) { - scheduledFunc = this.scheduledFunctions[timeoutKey]; - if (scheduledFunc != jasmine.undefined && - scheduledFunc.runAtMillis >= oldMillis && - scheduledFunc.runAtMillis <= nowMillis) { - funcsToRun.push(scheduledFunc); - this.scheduledFunctions[timeoutKey] = jasmine.undefined; - } - } - - if (funcsToRun.length > 0) { - funcsToRun.sort(function(a, b) { - return a.runAtMillis - b.runAtMillis; - }); - for (var i = 0; i < funcsToRun.length; ++i) { - try { - var funcToRun = funcsToRun[i]; - this.nowMillis = funcToRun.runAtMillis; - funcToRun.funcToCall(); - if (funcToRun.recurring) { - this.scheduleFunction(funcToRun.timeoutKey, - funcToRun.funcToCall, - funcToRun.millis, - true); - } - } catch(e) { - } - } - this.runFunctionsWithinRange(oldMillis, nowMillis); - } -}; - -jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) { - this.scheduledFunctions[timeoutKey] = { - runAtMillis: this.nowMillis + millis, - funcToCall: funcToCall, - recurring: recurring, - timeoutKey: timeoutKey, - millis: millis - }; -}; - -/** - * @namespace - */ -jasmine.Clock = { - defaultFakeTimer: new jasmine.FakeTimer(), - - reset: function() { - jasmine.Clock.assertInstalled(); - jasmine.Clock.defaultFakeTimer.reset(); - }, - - tick: function(millis) { - jasmine.Clock.assertInstalled(); - jasmine.Clock.defaultFakeTimer.tick(millis); - }, - - runFunctionsWithinRange: function(oldMillis, nowMillis) { - jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis); - }, - - scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) { - jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring); - }, - - useMock: function() { - if (!jasmine.Clock.isInstalled()) { - var spec = jasmine.getEnv().currentSpec; - spec.after(jasmine.Clock.uninstallMock); - - jasmine.Clock.installMock(); - } - }, - - installMock: function() { - jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer; - }, - - uninstallMock: function() { - jasmine.Clock.assertInstalled(); - jasmine.Clock.installed = jasmine.Clock.real; - }, - - real: { - setTimeout: jasmine.getGlobal().setTimeout, - clearTimeout: jasmine.getGlobal().clearTimeout, - setInterval: jasmine.getGlobal().setInterval, - clearInterval: jasmine.getGlobal().clearInterval - }, - - assertInstalled: function() { - if (!jasmine.Clock.isInstalled()) { - throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()"); - } - }, - - isInstalled: function() { - return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer; - }, - - installed: null -}; -jasmine.Clock.installed = jasmine.Clock.real; - -//else for IE support -jasmine.getGlobal().setTimeout = function(funcToCall, millis) { - if (jasmine.Clock.installed.setTimeout.apply) { - return jasmine.Clock.installed.setTimeout.apply(this, arguments); - } else { - return jasmine.Clock.installed.setTimeout(funcToCall, millis); - } -}; - -jasmine.getGlobal().setInterval = function(funcToCall, millis) { - if (jasmine.Clock.installed.setInterval.apply) { - return jasmine.Clock.installed.setInterval.apply(this, arguments); - } else { - return jasmine.Clock.installed.setInterval(funcToCall, millis); - } -}; - -jasmine.getGlobal().clearTimeout = function(timeoutKey) { - if (jasmine.Clock.installed.clearTimeout.apply) { - return jasmine.Clock.installed.clearTimeout.apply(this, arguments); - } else { - return jasmine.Clock.installed.clearTimeout(timeoutKey); - } -}; - -jasmine.getGlobal().clearInterval = function(timeoutKey) { - if (jasmine.Clock.installed.clearTimeout.apply) { - return jasmine.Clock.installed.clearInterval.apply(this, arguments); - } else { - return jasmine.Clock.installed.clearInterval(timeoutKey); - } -}; - - -jasmine.version_= { - "major": 1, - "minor": 0, - "build": 1, - "revision": 1286311016 -}; diff --git a/docs/lib/lodash.underscore.min.js b/docs/lib/lodash.underscore.min.js deleted file mode 100644 index e6591244..00000000 --- a/docs/lib/lodash.underscore.min.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @license - * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE - * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` - */ -;(function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++tf||typeof i=="undefined")return 1;if(it?0:t);++ee(r,i)&&o.push(i)}return o}function p(n,r,t,e){e=(e||0)-1;for(var u=n?n.length:0,o=[];++eu(f,l))&&(t&&f.push(l),i.push(a))}return i}function h(n){return function(r,t,e){var u={};t=X(t,e,3),e=-1;var o=r?r.length:0;if(typeof o=="number")for(;++eu&&(u=t); -else r=X(r,t,3),D(n,function(n,t,o){t=r(n,t,o),t>e&&(e=t,u=n)});return u}function W(n,r,t,e){if(!n)return t;var u=3>arguments.length;r=X(r,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(t=n[++o]);++oarguments.length;return r=X(r,e,4),I(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)}),t}function C(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return D(n,function(n){var t;t=++r,t=0+Sr(Wr()*(t-0+1)),e[r]=e[t],e[t]=n -}),e}function P(n,r,t){var e;r=X(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++te?Mr(0,u+e):e||0}else if(e)return e=J(r,t),r[e]===t?e:-1; -return n(r,t,e)}function H(n,r,t){if(typeof r!="number"&&null!=r){var u=0,o=-1,i=n?n.length:0;for(r=X(r,t,3);++o>>1,t(n[e])=y;m?(u&&(u=clearTimeout(u)),c=i,o=n.apply(f,e)):u||(u=setTimeout(v,y))}return m&&a?a=clearTimeout(a):a||r===p||(a=setTimeout(h,r)),t&&(m=true,o=n.apply(f,e)),!m||a||u||(e=f=null),o}}function X(n,r,t){var e=typeof n;if(null==n||"function"==e)return a(n,r,t);if("object"!=e)return nr(n);var u=Ur(n);return function(r){for(var t=u.length,e=false;t--&&(e=r[u[t]]===n[u[t]]););return e}}function Y(n){return n}function Z(n){D(x(n),function(r){var t=u[r]=n[r];u.prototype[r]=function(){var n=[this.__wrapped__]; -return Rr.apply(n,arguments),n=t.apply(u,n),this.__chain__?new o(n,true):n}})}function nr(n){return function(r){return r[n]}}var rr,tr=0,er={},ur=+new Date+"",or=/($^)/,ir=/['\n\r\t\u2028\u2029\\]/g,fr="[object Arguments]",ar="[object Array]",lr="[object Boolean]",cr="[object Date]",pr="[object Number]",sr="[object Object]",gr="[object RegExp]",hr="[object String]",vr={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},yr={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},mr=vr[typeof window]&&window||this,_r=vr[typeof exports]&&exports&&!exports.nodeType&&exports,dr=vr[typeof module]&&module&&!module.nodeType&&module,br=dr&&dr.exports===_r&&_r,wr=vr[typeof global]&&global; -!wr||wr.global!==wr&&wr.window!==wr||(mr=wr);var jr=[],xr=Object.prototype,Tr=mr._,Er=xr.toString,Ar=RegExp("^"+(Er+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),Or=Math.ceil,Sr=Math.floor,Nr=xr.hasOwnProperty,Rr=jr.push,kr=xr.propertyIsEnumerable,Br=_(Br=Object.create)&&Br,Fr=_(Fr=Array.isArray)&&Fr,qr=mr.isFinite,Dr=mr.isNaN,Ir=_(Ir=Object.keys)&&Ir,Mr=Math.max,$r=Math.min,Wr=Math.random;o.prototype=u.prototype;var zr={};!function(){var n={0:1,length:1};zr.spliceObjects=(jr.splice.call(n,0,1),!n[0]) -}(1),u.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Br||(f=function(){function n(){}return function(r){if(O(r)){n.prototype=r;var t=new n;n.prototype=null}return t||mr.Object()}}()),b(arguments)||(b=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Nr.call(n,"callee")&&!kr.call(n,"callee")||false});var Cr=Fr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Er.call(n)==ar||false},Pr=function(n){var r,t=[]; -if(!n||!vr[typeof n])return t;for(r in n)Nr.call(n,r)&&t.push(r);return t},Ur=Ir?function(n){return O(n)?Ir(n):[]}:Pr,Vr={"&":"&","<":"<",">":">",'"':""","'":"'"},Gr=T(Vr),Hr=RegExp("("+Ur(Gr).join("|")+")","g"),Jr=RegExp("["+Ur(Vr).join("")+"]","g"),Kr=function(n,r){var t;if(!n||!vr[typeof n])return n;for(t in n)if(r(n[t],t,n)===er)break;return n},Lr=function(n,r){var t;if(!n||!vr[typeof n])return n;for(t in n)if(Nr.call(n,t)&&r(n[t],t,n)===er)break;return n};A(/x/)&&(A=function(n){return typeof n=="function"&&"[object Function]"==Er.call(n) -});var Qr=h(function(n,r,t){Nr.call(n,t)?n[t]++:n[t]=1}),Xr=h(function(n,r,t){(Nr.call(n,t)?n[t]:n[t]=[]).push(r)}),Yr=h(function(n,r,t){n[t]=r}),Zr=M,nt=_(nt=Date.now)&&nt||function(){return(new Date).getTime()};u.after=function(n,r){if(!A(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},u.bind=L,u.bindAll=function(n){for(var r=1i(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},u.invert=T,u.invoke=function(n,r){var t=e(arguments,2),u=-1,o=typeof r=="function",i=n?n.length:0,f=Array(typeof i=="number"?i:0);return D(n,function(n){f[++u]=(o?r:n[r]).apply(n,t)}),f},u.keys=Ur,u.map=M,u.max=$,u.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):ur+arguments[0];return Nr.call(t,e)?t[e]:t[e]=n.apply(this,arguments) -}},u.min=function(n,r,t){var e=1/0,u=e;typeof r!="function"&&t&&t[r]===n&&(r=null);var o=-1,i=n?n.length:0;if(null==r&&typeof i=="number")for(;++or?0:r);++nt?Mr(0,e+t):$r(t,e-1))+1);e--;)if(n[e]===r)return e; -return-1},u.mixin=Z,u.noConflict=function(){return mr._=Tr,this},u.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Sr(Wr()*(r-n+1))},u.reduce=W,u.reduceRight=z,u.result=function(n,r){if(n){var t=n[r];return A(t)?n[r]():t}},u.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:Ur(n).length},u.some=P,u.sortedIndex=J,u.template=function(n,r,e){var o=u,i=o.templateSettings;n=(n||"")+"",e=j({},e,i);var f=0,a="__p+='",i=e.variable;n.replace(RegExp((e.escape||or).source+"|"+(e.interpolate||or).source+"|"+(e.evaluate||or).source+"|$","g"),function(r,e,u,o,i){return a+=n.slice(f,i).replace(ir,t),e&&(a+="'+_.escape("+e+")+'"),o&&(a+="';"+o+";\n__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r -}),a+="';",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}";try{var l=Function("_","return "+a)(o)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},u.unescape=function(n){return null==n?"":(n+"").replace(Hr,d)},u.uniqueId=function(n){var r=++tr+"";return n?n+r:r},u.all=B,u.any=P,u.detect=q,u.findWhere=function(n,r){return U(n,r,true)},u.foldl=W,u.foldr=z,u.include=k,u.inject=W,u.first=V,u.last=function(n,r,t){var u=0,o=n?n.length:0; -if(typeof r!="number"&&null!=r){var i=o;for(r=X(r,t,3);i--&&r(n[i],i,n);)u++}else if(u=r,null==u||t)return n?n[o-1]:rr;return e(n,Mr(0,o-u))},u.sample=function(n,r,t){return n&&typeof n.length!="number"&&(n=R(n)),null==r||t?n?n[0+Sr(Wr()*(n.length-1-0+1))]:rr:(n=C(n),n.length=$r(Mr(0,r),n.length),n)},u.take=V,u.head=V,Z(u),u.VERSION="2.4.1",u.prototype.chain=function(){return this.__chain__=true,this},u.prototype.value=function(){return this.__wrapped__},D("pop push reverse shift sort splice unshift".split(" "),function(n){var r=jr[n]; -u.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),zr.spliceObjects||0!==n.length||delete n[0],this}}),D(["concat","join","slice"],function(n){var r=jr[n];u.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new o(n),n.__chain__=true),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(mr._=u, define(function(){return u})):_r&&dr?br?(dr.exports=u)._=u:_r._=u:mr._=u}).call(this); \ No newline at end of file diff --git a/docs/lib/protovis-3.2/LICENSE b/docs/lib/protovis-3.2/LICENSE deleted file mode 100644 index a466ea26..00000000 --- a/docs/lib/protovis-3.2/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2010, Stanford Visualization Group -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * 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. - - * Neither the name of Stanford University 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. diff --git a/docs/lib/protovis-3.2/MIT.LICENSE b/docs/lib/protovis-3.2/MIT.LICENSE deleted file mode 100644 index 1eb9b49e..00000000 --- a/docs/lib/protovis-3.2/MIT.LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2008-2010 Pivotal Labs - -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/docs/lib/protovis-3.2/README b/docs/lib/protovis-3.2/README deleted file mode 100644 index 932acac4..00000000 --- a/docs/lib/protovis-3.2/README +++ /dev/null @@ -1,4 +0,0 @@ -Protovis v3.2 - -For documentation, see http://protovis.org. -For development, see http://gitorious.org/protovis. diff --git a/docs/lib/protovis-3.2/examples/antibiotics/antibiotics-scatter.html b/docs/lib/protovis-3.2/examples/antibiotics/antibiotics-scatter.html deleted file mode 100644 index 556e9aa6..00000000 --- a/docs/lib/protovis-3.2/examples/antibiotics/antibiotics-scatter.html +++ /dev/null @@ -1,113 +0,0 @@ - - - Antibiotic Effectiveness - - - - - -
- -
- diff --git a/docs/lib/protovis-3.2/examples/antibiotics/antibiotics.html b/docs/lib/protovis-3.2/examples/antibiotics/antibiotics.html deleted file mode 100644 index 82b80fc4..00000000 --- a/docs/lib/protovis-3.2/examples/antibiotics/antibiotics.html +++ /dev/null @@ -1,140 +0,0 @@ - - - Antibiotic Effectiveness - - - - - -
- - - diff --git a/docs/lib/protovis-3.2/examples/antibiotics/antibiotics.js b/docs/lib/protovis-3.2/examples/antibiotics/antibiotics.js deleted file mode 100644 index 45f5ced1..00000000 --- a/docs/lib/protovis-3.2/examples/antibiotics/antibiotics.js +++ /dev/null @@ -1,20 +0,0 @@ -var antibiotics = ["penicillin", "streptomycin", "neomycin"]; - -var bacteria = [ - {name: "Mycobacterium tuberculosis", penicillin: 800, streptomycin: 5, neomycin: 2, gram: "negative"}, - {name: "Salmonella schottmuelleri", penicillin: 10, streptomycin: 0.8, neomycin: 0.09, gram: "negative"}, - {name: "Proteus vulgaris", penicillin: 3, streptomycin: 0.1, neomycin: 0.1, gram: "negative"}, - {name: "Klebsiella pneumoniae", penicillin: 850, streptomycin: 1.2, neomycin: 1, gram: "negative"}, - {name: "Brucella abortus", penicillin: 1, streptomycin: 2, neomycin: 0.02, gram: "negative"}, - {name: "Pseudomonas aeruginosa", penicillin: 850, streptomycin: 2, neomycin: 0.4, gram: "negative"}, - {name: "Escherichia coli", penicillin: 100, streptomycin: 0.4, neomycin: 0.1, gram: "negative"}, - {name: "Salmonella (Eberthella) typhosa", penicillin: 1, streptomycin: 0.4, neomycin: 0.008, gram: "negative"}, - {name: "Aerobacter aerogenes", penicillin: 870, streptomycin: 1, neomycin: 1.6, gram: "negative"}, - {name: "Brucella antracis", penicillin: 0.001, streptomycin: 0.01, neomycin: 0.007, gram: "positive"}, - {name: "Streptococcus fecalis", penicillin: 1, streptomycin: 1, neomycin: 0.1, gram: "positive"}, - {name: "Staphylococcus aureus", penicillin: 0.03, streptomycin: 0.03, neomycin: 0.001, gram: "positive"}, - {name: "Staphylococcus albus", penicillin: 0.007, streptomycin: 0.1, neomycin: 0.001, gram: "positive"}, - {name: "Streptococcus hemolyticus", penicillin: 0.001, streptomycin: 14, neomycin: 10, gram: "positive"}, - {name: "Streptococcus viridans", penicillin: 0.005, streptomycin: 10, neomycin: 40, gram: "positive"}, - {name: "Diplococcus pneumoniae", penicillin: 0.005, streptomycin: 11, neomycin: 10, gram: "positive"} -]; diff --git a/docs/lib/protovis-3.2/examples/barley/barley.html b/docs/lib/protovis-3.2/examples/barley/barley.html deleted file mode 100644 index c5ea3e63..00000000 --- a/docs/lib/protovis-3.2/examples/barley/barley.html +++ /dev/null @@ -1,102 +0,0 @@ - - - Barley Yields - - - - - -
- -
- diff --git a/docs/lib/protovis-3.2/examples/barley/barley.js b/docs/lib/protovis-3.2/examples/barley/barley.js deleted file mode 100644 index 78af337e..00000000 --- a/docs/lib/protovis-3.2/examples/barley/barley.js +++ /dev/null @@ -1,122 +0,0 @@ -var barley = [ - { yield: 27.00000, variety: "Manchuria", year: 1931, site: "University Farm" }, - { yield: 48.86667, variety: "Manchuria", year: 1931, site: "Waseca" }, - { yield: 27.43334, variety: "Manchuria", year: 1931, site: "Morris" }, - { yield: 39.93333, variety: "Manchuria", year: 1931, site: "Crookston" }, - { yield: 32.96667, variety: "Manchuria", year: 1931, site: "Grand Rapids" }, - { yield: 28.96667, variety: "Manchuria", year: 1931, site: "Duluth" }, - { yield: 43.06666, variety: "Glabron", year: 1931, site: "University Farm" }, - { yield: 55.20000, variety: "Glabron", year: 1931, site: "Waseca" }, - { yield: 28.76667, variety: "Glabron", year: 1931, site: "Morris" }, - { yield: 38.13333, variety: "Glabron", year: 1931, site: "Crookston" }, - { yield: 29.13333, variety: "Glabron", year: 1931, site: "Grand Rapids" }, - { yield: 29.66667, variety: "Glabron", year: 1931, site: "Duluth" }, - { yield: 35.13333, variety: "Svansota", year: 1931, site: "University Farm" }, - { yield: 47.33333, variety: "Svansota", year: 1931, site: "Waseca" }, - { yield: 25.76667, variety: "Svansota", year: 1931, site: "Morris" }, - { yield: 40.46667, variety: "Svansota", year: 1931, site: "Crookston" }, - { yield: 29.66667, variety: "Svansota", year: 1931, site: "Grand Rapids" }, - { yield: 25.70000, variety: "Svansota", year: 1931, site: "Duluth" }, - { yield: 39.90000, variety: "Velvet", year: 1931, site: "University Farm" }, - { yield: 50.23333, variety: "Velvet", year: 1931, site: "Waseca" }, - { yield: 26.13333, variety: "Velvet", year: 1931, site: "Morris" }, - { yield: 41.33333, variety: "Velvet", year: 1931, site: "Crookston" }, - { yield: 23.03333, variety: "Velvet", year: 1931, site: "Grand Rapids" }, - { yield: 26.30000, variety: "Velvet", year: 1931, site: "Duluth" }, - { yield: 36.56666, variety: "Trebi", year: 1931, site: "University Farm" }, - { yield: 63.83330, variety: "Trebi", year: 1931, site: "Waseca" }, - { yield: 43.76667, variety: "Trebi", year: 1931, site: "Morris" }, - { yield: 46.93333, variety: "Trebi", year: 1931, site: "Crookston" }, - { yield: 29.76667, variety: "Trebi", year: 1931, site: "Grand Rapids" }, - { yield: 33.93333, variety: "Trebi", year: 1931, site: "Duluth" }, - { yield: 43.26667, variety: "No. 457", year: 1931, site: "University Farm" }, - { yield: 58.10000, variety: "No. 457", year: 1931, site: "Waseca" }, - { yield: 28.70000, variety: "No. 457", year: 1931, site: "Morris" }, - { yield: 45.66667, variety: "No. 457", year: 1931, site: "Crookston" }, - { yield: 32.16667, variety: "No. 457", year: 1931, site: "Grand Rapids" }, - { yield: 33.60000, variety: "No. 457", year: 1931, site: "Duluth" }, - { yield: 36.60000, variety: "No. 462", year: 1931, site: "University Farm" }, - { yield: 65.76670, variety: "No. 462", year: 1931, site: "Waseca" }, - { yield: 30.36667, variety: "No. 462", year: 1931, site: "Morris" }, - { yield: 48.56666, variety: "No. 462", year: 1931, site: "Crookston" }, - { yield: 24.93334, variety: "No. 462", year: 1931, site: "Grand Rapids" }, - { yield: 28.10000, variety: "No. 462", year: 1931, site: "Duluth" }, - { yield: 32.76667, variety: "Peatland", year: 1931, site: "University Farm" }, - { yield: 48.56666, variety: "Peatland", year: 1931, site: "Waseca" }, - { yield: 29.86667, variety: "Peatland", year: 1931, site: "Morris" }, - { yield: 41.60000, variety: "Peatland", year: 1931, site: "Crookston" }, - { yield: 34.70000, variety: "Peatland", year: 1931, site: "Grand Rapids" }, - { yield: 32.00000, variety: "Peatland", year: 1931, site: "Duluth" }, - { yield: 24.66667, variety: "No. 475", year: 1931, site: "University Farm" }, - { yield: 46.76667, variety: "No. 475", year: 1931, site: "Waseca" }, - { yield: 22.60000, variety: "No. 475", year: 1931, site: "Morris" }, - { yield: 44.10000, variety: "No. 475", year: 1931, site: "Crookston" }, - { yield: 19.70000, variety: "No. 475", year: 1931, site: "Grand Rapids" }, - { yield: 33.06666, variety: "No. 475", year: 1931, site: "Duluth" }, - { yield: 39.30000, variety: "Wisconsin No. 38", year: 1931, site: "University Farm" }, - { yield: 58.80000, variety: "Wisconsin No. 38", year: 1931, site: "Waseca" }, - { yield: 29.46667, variety: "Wisconsin No. 38", year: 1931, site: "Morris" }, - { yield: 49.86667, variety: "Wisconsin No. 38", year: 1931, site: "Crookston" }, - { yield: 34.46667, variety: "Wisconsin No. 38", year: 1931, site: "Grand Rapids" }, - { yield: 31.60000, variety: "Wisconsin No. 38", year: 1931, site: "Duluth" }, - { yield: 26.90000, variety: "Manchuria", year: 1932, site: "University Farm" }, - { yield: 33.46667, variety: "Manchuria", year: 1932, site: "Waseca" }, - { yield: 34.36666, variety: "Manchuria", year: 1932, site: "Morris" }, - { yield: 32.96667, variety: "Manchuria", year: 1932, site: "Crookston" }, - { yield: 22.13333, variety: "Manchuria", year: 1932, site: "Grand Rapids" }, - { yield: 22.56667, variety: "Manchuria", year: 1932, site: "Duluth" }, - { yield: 36.80000, variety: "Glabron", year: 1932, site: "University Farm" }, - { yield: 37.73333, variety: "Glabron", year: 1932, site: "Waseca" }, - { yield: 35.13333, variety: "Glabron", year: 1932, site: "Morris" }, - { yield: 26.16667, variety: "Glabron", year: 1932, site: "Crookston" }, - { yield: 14.43333, variety: "Glabron", year: 1932, site: "Grand Rapids" }, - { yield: 25.86667, variety: "Glabron", year: 1932, site: "Duluth" }, - { yield: 27.43334, variety: "Svansota", year: 1932, site: "University Farm" }, - { yield: 38.50000, variety: "Svansota", year: 1932, site: "Waseca" }, - { yield: 35.03333, variety: "Svansota", year: 1932, site: "Morris" }, - { yield: 20.63333, variety: "Svansota", year: 1932, site: "Crookston" }, - { yield: 16.63333, variety: "Svansota", year: 1932, site: "Grand Rapids" }, - { yield: 22.23333, variety: "Svansota", year: 1932, site: "Duluth" }, - { yield: 26.80000, variety: "Velvet", year: 1932, site: "University Farm" }, - { yield: 37.40000, variety: "Velvet", year: 1932, site: "Waseca" }, - { yield: 38.83333, variety: "Velvet", year: 1932, site: "Morris" }, - { yield: 32.06666, variety: "Velvet", year: 1932, site: "Crookston" }, - { yield: 32.23333, variety: "Velvet", year: 1932, site: "Grand Rapids" }, - { yield: 22.46667, variety: "Velvet", year: 1932, site: "Duluth" }, - { yield: 29.06667, variety: "Trebi", year: 1932, site: "University Farm" }, - { yield: 49.23330, variety: "Trebi", year: 1932, site: "Waseca" }, - { yield: 46.63333, variety: "Trebi", year: 1932, site: "Morris" }, - { yield: 41.83333, variety: "Trebi", year: 1932, site: "Crookston" }, - { yield: 20.63333, variety: "Trebi", year: 1932, site: "Grand Rapids" }, - { yield: 30.60000, variety: "Trebi", year: 1932, site: "Duluth" }, - { yield: 26.43334, variety: "No. 457", year: 1932, site: "University Farm" }, - { yield: 42.20000, variety: "No. 457", year: 1932, site: "Waseca" }, - { yield: 43.53334, variety: "No. 457", year: 1932, site: "Morris" }, - { yield: 34.33333, variety: "No. 457", year: 1932, site: "Crookston" }, - { yield: 19.46667, variety: "No. 457", year: 1932, site: "Grand Rapids" }, - { yield: 22.70000, variety: "No. 457", year: 1932, site: "Duluth" }, - { yield: 25.56667, variety: "No. 462", year: 1932, site: "University Farm" }, - { yield: 44.70000, variety: "No. 462", year: 1932, site: "Waseca" }, - { yield: 47.00000, variety: "No. 462", year: 1932, site: "Morris" }, - { yield: 30.53333, variety: "No. 462", year: 1932, site: "Crookston" }, - { yield: 19.90000, variety: "No. 462", year: 1932, site: "Grand Rapids" }, - { yield: 22.50000, variety: "No. 462", year: 1932, site: "Duluth" }, - { yield: 28.06667, variety: "Peatland", year: 1932, site: "University Farm" }, - { yield: 36.03333, variety: "Peatland", year: 1932, site: "Waseca" }, - { yield: 43.20000, variety: "Peatland", year: 1932, site: "Morris" }, - { yield: 25.23333, variety: "Peatland", year: 1932, site: "Crookston" }, - { yield: 26.76667, variety: "Peatland", year: 1932, site: "Grand Rapids" }, - { yield: 31.36667, variety: "Peatland", year: 1932, site: "Duluth" }, - { yield: 30.00000, variety: "No. 475", year: 1932, site: "University Farm" }, - { yield: 41.26667, variety: "No. 475", year: 1932, site: "Waseca" }, - { yield: 44.23333, variety: "No. 475", year: 1932, site: "Morris" }, - { yield: 32.13333, variety: "No. 475", year: 1932, site: "Crookston" }, - { yield: 15.23333, variety: "No. 475", year: 1932, site: "Grand Rapids" }, - { yield: 27.36667, variety: "No. 475", year: 1932, site: "Duluth" }, - { yield: 38.00000, variety: "Wisconsin No. 38", year: 1932, site: "University Farm" }, - { yield: 58.16667, variety: "Wisconsin No. 38", year: 1932, site: "Waseca" }, - { yield: 47.16667, variety: "Wisconsin No. 38", year: 1932, site: "Morris" }, - { yield: 35.90000, variety: "Wisconsin No. 38", year: 1932, site: "Crookston" }, - { yield: 20.66667, variety: "Wisconsin No. 38", year: 1932, site: "Grand Rapids" }, - { yield: 29.33333, variety: "Wisconsin No. 38", year: 1932, site: "Duluth" } -]; diff --git a/docs/lib/protovis-3.2/examples/cars/cars.html b/docs/lib/protovis-3.2/examples/cars/cars.html deleted file mode 100644 index 9eef0861..00000000 --- a/docs/lib/protovis-3.2/examples/cars/cars.html +++ /dev/null @@ -1,90 +0,0 @@ - - - Cars - - - - - -
- -
- diff --git a/docs/lib/protovis-3.2/examples/cars/cars.js b/docs/lib/protovis-3.2/examples/cars/cars.js deleted file mode 100644 index c5a95aeb..00000000 --- a/docs/lib/protovis-3.2/examples/cars/cars.js +++ /dev/null @@ -1,408 +0,0 @@ -var cars = [ -{name:"chevrolet chevelle malibu", mpg:18, cylinders:8, displacement:307, horsepower:130, weight:3504, acceleration:12, year:70, origin:1}, -{name:"buick skylark 320", mpg:15, cylinders:8, displacement:350, horsepower:165, weight:3693, acceleration:11.5, year:70, origin:1}, -{name:"plymouth satellite", mpg:18, cylinders:8, displacement:318, horsepower:150, weight:3436, acceleration:11, year:70, origin:1}, -{name:"amc rebel sst", mpg:16, cylinders:8, displacement:304, horsepower:150, weight:3433, acceleration:12, year:70, origin:1}, -{name:"ford torino", mpg:17, cylinders:8, displacement:302, horsepower:140, weight:3449, acceleration:10.5, year:70, origin:1}, -{name:"ford galaxie 500", mpg:15, cylinders:8, displacement:429, horsepower:198, weight:4341, acceleration:10, year:70, origin:1}, -{name:"chevrolet impala", mpg:14, cylinders:8, displacement:454, horsepower:220, weight:4354, acceleration:9, year:70, origin:1}, -{name:"plymouth fury iii", mpg:14, cylinders:8, displacement:440, horsepower:215, weight:4312, acceleration:8.5, year:70, origin:1}, -{name:"pontiac catalina", mpg:14, cylinders:8, displacement:455, horsepower:225, weight:4425, acceleration:10, year:70, origin:1}, -{name:"amc ambassador dpl", mpg:15, cylinders:8, displacement:390, horsepower:190, weight:3850, acceleration:8.5, year:70, origin:1}, -{name:"citroen ds-21 pallas", mpg:undefined, cylinders:4, displacement:133, horsepower:115, weight:3090, acceleration:17.5, year:70, origin:2}, -{name:"chevrolet chevelle concours (sw)", mpg:undefined, cylinders:8, displacement:350, horsepower:165, weight:4142, acceleration:11.5, year:70, origin:1}, -{name:"ford torino (sw)", mpg:undefined, cylinders:8, displacement:351, horsepower:153, weight:4034, acceleration:11, year:70, origin:1}, -{name:"plymouth satellite (sw)", mpg:undefined, cylinders:8, displacement:383, horsepower:175, weight:4166, acceleration:10.5, year:70, origin:1}, -{name:"amc rebel sst (sw)", mpg:undefined, cylinders:8, displacement:360, horsepower:175, weight:3850, acceleration:11, year:70, origin:1}, -{name:"dodge challenger se", mpg:15, cylinders:8, displacement:383, horsepower:170, weight:3563, acceleration:10, year:70, origin:1}, -{name:"plymouth 'cuda 340", mpg:14, cylinders:8, displacement:340, horsepower:160, weight:3609, acceleration:8, year:70, origin:1}, -{name:"ford mustang boss 302", mpg:undefined, cylinders:8, displacement:302, horsepower:140, weight:3353, acceleration:8, year:70, origin:1}, -{name:"chevrolet monte carlo", mpg:15, cylinders:8, displacement:400, horsepower:150, weight:3761, acceleration:9.5, year:70, origin:1}, -{name:"buick estate wagon (sw)", mpg:14, cylinders:8, displacement:455, horsepower:225, weight:3086, acceleration:10, year:70, origin:1}, -{name:"toyota corona mark ii", mpg:24, cylinders:4, displacement:113, horsepower:95, weight:2372, acceleration:15, year:70, origin:3}, -{name:"plymouth duster", mpg:22, cylinders:6, displacement:198, horsepower:95, weight:2833, acceleration:15.5, year:70, origin:1}, -{name:"amc hornet", mpg:18, cylinders:6, displacement:199, horsepower:97, weight:2774, acceleration:15.5, year:70, origin:1}, -{name:"ford maverick", mpg:21, cylinders:6, displacement:200, horsepower:85, weight:2587, acceleration:16, year:70, origin:1}, -{name:"datsun pl510", mpg:27, cylinders:4, displacement:97, horsepower:88, weight:2130, acceleration:14.5, year:70, origin:3}, -{name:"volkswagen 1131 deluxe sedan", mpg:26, cylinders:4, displacement:97, horsepower:46, weight:1835, acceleration:20.5, year:70, origin:2}, -{name:"peugeot 504", mpg:25, cylinders:4, displacement:110, horsepower:87, weight:2672, acceleration:17.5, year:70, origin:2}, -{name:"audi 100 ls", mpg:24, cylinders:4, displacement:107, horsepower:90, weight:2430, acceleration:14.5, year:70, origin:2}, -{name:"saab 99e", mpg:25, cylinders:4, displacement:104, horsepower:95, weight:2375, acceleration:17.5, year:70, origin:2}, -{name:"bmw 2002", mpg:26, cylinders:4, displacement:121, horsepower:113, weight:2234, acceleration:12.5, year:70, origin:2}, -{name:"amc gremlin", mpg:21, cylinders:6, displacement:199, horsepower:90, weight:2648, acceleration:15, year:70, origin:1}, -{name:"ford f250", mpg:10, cylinders:8, displacement:360, horsepower:215, weight:4615, acceleration:14, year:70, origin:1}, -{name:"chevy c20", mpg:10, cylinders:8, displacement:307, horsepower:200, weight:4376, acceleration:15, year:70, origin:1}, -{name:"dodge d200", mpg:11, cylinders:8, displacement:318, horsepower:210, weight:4382, acceleration:13.5, year:70, origin:1}, -{name:"hi 1200d", mpg:9, cylinders:8, displacement:304, horsepower:193, weight:4732, acceleration:18.5, year:70, origin:1}, -{name:"datsun pl510", mpg:27, cylinders:4, displacement:97, horsepower:88, weight:2130, acceleration:14.5, year:71, origin:3}, -{name:"chevrolet vega 2300", mpg:28, cylinders:4, displacement:140, horsepower:90, weight:2264, acceleration:15.5, year:71, origin:1}, -{name:"toyota corona", mpg:25, cylinders:4, displacement:113, horsepower:95, weight:2228, acceleration:14, year:71, origin:3}, -{name:"ford pinto", mpg:25, cylinders:4, displacement:98, horsepower:undefined, weight:2046, acceleration:19, year:71, origin:1}, -{name:"volkswagen super beetle 117", mpg:undefined, cylinders:4, displacement:97, horsepower:48, weight:1978, acceleration:20, year:71, origin:2}, -{name:"amc gremlin", mpg:19, cylinders:6, displacement:232, horsepower:100, weight:2634, acceleration:13, year:71, origin:1}, -{name:"plymouth satellite custom", mpg:16, cylinders:6, displacement:225, horsepower:105, weight:3439, acceleration:15.5, year:71, origin:1}, -{name:"chevrolet chevelle malibu", mpg:17, cylinders:6, displacement:250, horsepower:100, weight:3329, acceleration:15.5, year:71, origin:1}, -{name:"ford torino 500", mpg:19, cylinders:6, displacement:250, horsepower:88, weight:3302, acceleration:15.5, year:71, origin:1}, -{name:"amc matador", mpg:18, cylinders:6, displacement:232, horsepower:100, weight:3288, acceleration:15.5, year:71, origin:1}, -{name:"chevrolet impala", mpg:14, cylinders:8, displacement:350, horsepower:165, weight:4209, acceleration:12, year:71, origin:1}, -{name:"pontiac catalina brougham", mpg:14, cylinders:8, displacement:400, horsepower:175, weight:4464, acceleration:11.5, year:71, origin:1}, -{name:"ford galaxie 500", mpg:14, cylinders:8, displacement:351, horsepower:153, weight:4154, acceleration:13.5, year:71, origin:1}, -{name:"plymouth fury iii", mpg:14, cylinders:8, displacement:318, horsepower:150, weight:4096, acceleration:13, year:71, origin:1}, -{name:"dodge monaco (sw)", mpg:12, cylinders:8, displacement:383, horsepower:180, weight:4955, acceleration:11.5, year:71, origin:1}, -{name:"ford country squire (sw)", mpg:13, cylinders:8, displacement:400, horsepower:170, weight:4746, acceleration:12, year:71, origin:1}, -{name:"pontiac safari (sw)", mpg:13, cylinders:8, displacement:400, horsepower:175, weight:5140, acceleration:12, year:71, origin:1}, -{name:"amc hornet sportabout (sw)", mpg:18, cylinders:6, displacement:258, horsepower:110, weight:2962, acceleration:13.5, year:71, origin:1}, -{name:"chevrolet vega (sw)", mpg:22, cylinders:4, displacement:140, horsepower:72, weight:2408, acceleration:19, year:71, origin:1}, -{name:"pontiac firebird", mpg:19, cylinders:6, displacement:250, horsepower:100, weight:3282, acceleration:15, year:71, origin:1}, -{name:"ford mustang", mpg:18, cylinders:6, displacement:250, horsepower:88, weight:3139, acceleration:14.5, year:71, origin:1}, -{name:"mercury capri 2000", mpg:23, cylinders:4, displacement:122, horsepower:86, weight:2220, acceleration:14, year:71, origin:1}, -{name:"opel 1900", mpg:28, cylinders:4, displacement:116, horsepower:90, weight:2123, acceleration:14, year:71, origin:2}, -{name:"peugeot 304", mpg:30, cylinders:4, displacement:79, horsepower:70, weight:2074, acceleration:19.5, year:71, origin:2}, -{name:"fiat 124b", mpg:30, cylinders:4, displacement:88, horsepower:76, weight:2065, acceleration:14.5, year:71, origin:2}, -{name:"toyota corolla 1200", mpg:31, cylinders:4, displacement:71, horsepower:65, weight:1773, acceleration:19, year:71, origin:3}, -{name:"datsun 1200", mpg:35, cylinders:4, displacement:72, horsepower:69, weight:1613, acceleration:18, year:71, origin:3}, -{name:"volkswagen model 111", mpg:27, cylinders:4, displacement:97, horsepower:60, weight:1834, acceleration:19, year:71, origin:2}, -{name:"plymouth cricket", mpg:26, cylinders:4, displacement:91, horsepower:70, weight:1955, acceleration:20.5, year:71, origin:1}, -{name:"toyota corona hardtop", mpg:24, cylinders:4, displacement:113, horsepower:95, weight:2278, acceleration:15.5, year:72, origin:3}, -{name:"dodge colt hardtop", mpg:25, cylinders:4, displacement:97.5, horsepower:80, weight:2126, acceleration:17, year:72, origin:1}, -{name:"volkswagen type 3", mpg:23, cylinders:4, displacement:97, horsepower:54, weight:2254, acceleration:23.5, year:72, origin:2}, -{name:"chevrolet vega", mpg:20, cylinders:4, displacement:140, horsepower:90, weight:2408, acceleration:19.5, year:72, origin:1}, -{name:"ford pinto runabout", mpg:21, cylinders:4, displacement:122, horsepower:86, weight:2226, acceleration:16.5, year:72, origin:1}, -{name:"chevrolet impala", mpg:13, cylinders:8, displacement:350, horsepower:165, weight:4274, acceleration:12, year:72, origin:1}, -{name:"pontiac catalina", mpg:14, cylinders:8, displacement:400, horsepower:175, weight:4385, acceleration:12, year:72, origin:1}, -{name:"plymouth fury iii", mpg:15, cylinders:8, displacement:318, horsepower:150, weight:4135, acceleration:13.5, year:72, origin:1}, -{name:"ford galaxie 500", mpg:14, cylinders:8, displacement:351, horsepower:153, weight:4129, acceleration:13, year:72, origin:1}, -{name:"amc ambassador sst", mpg:17, cylinders:8, displacement:304, horsepower:150, weight:3672, acceleration:11.5, year:72, origin:1}, -{name:"mercury marquis", mpg:11, cylinders:8, displacement:429, horsepower:208, weight:4633, acceleration:11, year:72, origin:1}, -{name:"buick lesabre custom", mpg:13, cylinders:8, displacement:350, horsepower:155, weight:4502, acceleration:13.5, year:72, origin:1}, -{name:"oldsmobile delta 88 royale", mpg:12, cylinders:8, displacement:350, horsepower:160, weight:4456, acceleration:13.5, year:72, origin:1}, -{name:"chrysler newport royal", mpg:13, cylinders:8, displacement:400, horsepower:190, weight:4422, acceleration:12.5, year:72, origin:1}, -{name:"mazda rx2 coupe", mpg:19, cylinders:3, displacement:70, horsepower:97, weight:2330, acceleration:13.5, year:72, origin:3}, -{name:"amc matador (sw)", mpg:15, cylinders:8, displacement:304, horsepower:150, weight:3892, acceleration:12.5, year:72, origin:1}, -{name:"chevrolet chevelle concours (sw)", mpg:13, cylinders:8, displacement:307, horsepower:130, weight:4098, acceleration:14, year:72, origin:1}, -{name:"ford gran torino (sw)", mpg:13, cylinders:8, displacement:302, horsepower:140, weight:4294, acceleration:16, year:72, origin:1}, -{name:"plymouth satellite custom (sw)", mpg:14, cylinders:8, displacement:318, horsepower:150, weight:4077, acceleration:14, year:72, origin:1}, -{name:"volvo 145e (sw)", mpg:18, cylinders:4, displacement:121, horsepower:112, weight:2933, acceleration:14.5, year:72, origin:2}, -{name:"volkswagen 411 (sw)", mpg:22, cylinders:4, displacement:121, horsepower:76, weight:2511, acceleration:18, year:72, origin:2}, -{name:"peugeot 504 (sw)", mpg:21, cylinders:4, displacement:120, horsepower:87, weight:2979, acceleration:19.5, year:72, origin:2}, -{name:"renault 12 (sw)", mpg:26, cylinders:4, displacement:96, horsepower:69, weight:2189, acceleration:18, year:72, origin:2}, -{name:"ford pinto (sw)", mpg:22, cylinders:4, displacement:122, horsepower:86, weight:2395, acceleration:16, year:72, origin:1}, -{name:"datsun 510 (sw)", mpg:28, cylinders:4, displacement:97, horsepower:92, weight:2288, acceleration:17, year:72, origin:3}, -{name:"toyouta corona mark ii (sw)", mpg:23, cylinders:4, displacement:120, horsepower:97, weight:2506, acceleration:14.5, year:72, origin:3}, -{name:"dodge colt (sw)", mpg:28, cylinders:4, displacement:98, horsepower:80, weight:2164, acceleration:15, year:72, origin:1}, -{name:"toyota corolla 1600 (sw)", mpg:27, cylinders:4, displacement:97, horsepower:88, weight:2100, acceleration:16.5, year:72, origin:3}, -{name:"buick century 350", mpg:13, cylinders:8, displacement:350, horsepower:175, weight:4100, acceleration:13, year:73, origin:1}, -{name:"amc matador", mpg:14, cylinders:8, displacement:304, horsepower:150, weight:3672, acceleration:11.5, year:73, origin:1}, -{name:"chevrolet malibu", mpg:13, cylinders:8, displacement:350, horsepower:145, weight:3988, acceleration:13, year:73, origin:1}, -{name:"ford gran torino", mpg:14, cylinders:8, displacement:302, horsepower:137, weight:4042, acceleration:14.5, year:73, origin:1}, -{name:"dodge coronet custom", mpg:15, cylinders:8, displacement:318, horsepower:150, weight:3777, acceleration:12.5, year:73, origin:1}, -{name:"mercury marquis brougham", mpg:12, cylinders:8, displacement:429, horsepower:198, weight:4952, acceleration:11.5, year:73, origin:1}, -{name:"chevrolet caprice classic", mpg:13, cylinders:8, displacement:400, horsepower:150, weight:4464, acceleration:12, year:73, origin:1}, -{name:"ford ltd", mpg:13, cylinders:8, displacement:351, horsepower:158, weight:4363, acceleration:13, year:73, origin:1}, -{name:"plymouth fury gran sedan", mpg:14, cylinders:8, displacement:318, horsepower:150, weight:4237, acceleration:14.5, year:73, origin:1}, -{name:"chrysler new yorker brougham", mpg:13, cylinders:8, displacement:440, horsepower:215, weight:4735, acceleration:11, year:73, origin:1}, -{name:"buick electra 225 custom", mpg:12, cylinders:8, displacement:455, horsepower:225, weight:4951, acceleration:11, year:73, origin:1}, -{name:"amc ambassador brougham", mpg:13, cylinders:8, displacement:360, horsepower:175, weight:3821, acceleration:11, year:73, origin:1}, -{name:"plymouth valiant", mpg:18, cylinders:6, displacement:225, horsepower:105, weight:3121, acceleration:16.5, year:73, origin:1}, -{name:"chevrolet nova custom", mpg:16, cylinders:6, displacement:250, horsepower:100, weight:3278, acceleration:18, year:73, origin:1}, -{name:"amc hornet", mpg:18, cylinders:6, displacement:232, horsepower:100, weight:2945, acceleration:16, year:73, origin:1}, -{name:"ford maverick", mpg:18, cylinders:6, displacement:250, horsepower:88, weight:3021, acceleration:16.5, year:73, origin:1}, -{name:"plymouth duster", mpg:23, cylinders:6, displacement:198, horsepower:95, weight:2904, acceleration:16, year:73, origin:1}, -{name:"volkswagen super beetle", mpg:26, cylinders:4, displacement:97, horsepower:46, weight:1950, acceleration:21, year:73, origin:2}, -{name:"chevrolet impala", mpg:11, cylinders:8, displacement:400, horsepower:150, weight:4997, acceleration:14, year:73, origin:1}, -{name:"ford country", mpg:12, cylinders:8, displacement:400, horsepower:167, weight:4906, acceleration:12.5, year:73, origin:1}, -{name:"plymouth custom suburb", mpg:13, cylinders:8, displacement:360, horsepower:170, weight:4654, acceleration:13, year:73, origin:1}, -{name:"oldsmobile vista cruiser", mpg:12, cylinders:8, displacement:350, horsepower:180, weight:4499, acceleration:12.5, year:73, origin:1}, -{name:"amc gremlin", mpg:18, cylinders:6, displacement:232, horsepower:100, weight:2789, acceleration:15, year:73, origin:1}, -{name:"toyota carina", mpg:20, cylinders:4, displacement:97, horsepower:88, weight:2279, acceleration:19, year:73, origin:3}, -{name:"chevrolet vega", mpg:21, cylinders:4, displacement:140, horsepower:72, weight:2401, acceleration:19.5, year:73, origin:1}, -{name:"datsun 610", mpg:22, cylinders:4, displacement:108, horsepower:94, weight:2379, acceleration:16.5, year:73, origin:3}, -{name:"maxda rx3", mpg:18, cylinders:3, displacement:70, horsepower:90, weight:2124, acceleration:13.5, year:73, origin:3}, -{name:"ford pinto", mpg:19, cylinders:4, displacement:122, horsepower:85, weight:2310, acceleration:18.5, year:73, origin:1}, -{name:"mercury capri v6", mpg:21, cylinders:6, displacement:155, horsepower:107, weight:2472, acceleration:14, year:73, origin:1}, -{name:"fiat 124 sport coupe", mpg:26, cylinders:4, displacement:98, horsepower:90, weight:2265, acceleration:15.5, year:73, origin:2}, -{name:"chevrolet monte carlo s", mpg:15, cylinders:8, displacement:350, horsepower:145, weight:4082, acceleration:13, year:73, origin:1}, -{name:"pontiac grand prix", mpg:16, cylinders:8, displacement:400, horsepower:230, weight:4278, acceleration:9.5, year:73, origin:1}, -{name:"fiat 128", mpg:29, cylinders:4, displacement:68, horsepower:49, weight:1867, acceleration:19.5, year:73, origin:2}, -{name:"opel manta", mpg:24, cylinders:4, displacement:116, horsepower:75, weight:2158, acceleration:15.5, year:73, origin:2}, -{name:"audi 100ls", mpg:20, cylinders:4, displacement:114, horsepower:91, weight:2582, acceleration:14, year:73, origin:2}, -{name:"volvo 144ea", mpg:19, cylinders:4, displacement:121, horsepower:112, weight:2868, acceleration:15.5, year:73, origin:2}, -{name:"dodge dart custom", mpg:15, cylinders:8, displacement:318, horsepower:150, weight:3399, acceleration:11, year:73, origin:1}, -{name:"saab 99le", mpg:24, cylinders:4, displacement:121, horsepower:110, weight:2660, acceleration:14, year:73, origin:2}, -{name:"toyota mark ii", mpg:20, cylinders:6, displacement:156, horsepower:122, weight:2807, acceleration:13.5, year:73, origin:3}, -{name:"oldsmobile omega", mpg:11, cylinders:8, displacement:350, horsepower:180, weight:3664, acceleration:11, year:73, origin:1}, -{name:"plymouth duster", mpg:20, cylinders:6, displacement:198, horsepower:95, weight:3102, acceleration:16.5, year:74, origin:1}, -{name:"ford maverick", mpg:21, cylinders:6, displacement:200, horsepower:undefined, weight:2875, acceleration:17, year:74, origin:1}, -{name:"amc hornet", mpg:19, cylinders:6, displacement:232, horsepower:100, weight:2901, acceleration:16, year:74, origin:1}, -{name:"chevrolet nova", mpg:15, cylinders:6, displacement:250, horsepower:100, weight:3336, acceleration:17, year:74, origin:1}, -{name:"datsun b210", mpg:31, cylinders:4, displacement:79, horsepower:67, weight:1950, acceleration:19, year:74, origin:3}, -{name:"ford pinto", mpg:26, cylinders:4, displacement:122, horsepower:80, weight:2451, acceleration:16.5, year:74, origin:1}, -{name:"toyota corolla 1200", mpg:32, cylinders:4, displacement:71, horsepower:65, weight:1836, acceleration:21, year:74, origin:3}, -{name:"chevrolet vega", mpg:25, cylinders:4, displacement:140, horsepower:75, weight:2542, acceleration:17, year:74, origin:1}, -{name:"chevrolet chevelle malibu classic", mpg:16, cylinders:6, displacement:250, horsepower:100, weight:3781, acceleration:17, year:74, origin:1}, -{name:"amc matador", mpg:16, cylinders:6, displacement:258, horsepower:110, weight:3632, acceleration:18, year:74, origin:1}, -{name:"plymouth satellite sebring", mpg:18, cylinders:6, displacement:225, horsepower:105, weight:3613, acceleration:16.5, year:74, origin:1}, -{name:"ford gran torino", mpg:16, cylinders:8, displacement:302, horsepower:140, weight:4141, acceleration:14, year:74, origin:1}, -{name:"buick century luxus (sw)", mpg:13, cylinders:8, displacement:350, horsepower:150, weight:4699, acceleration:14.5, year:74, origin:1}, -{name:"dodge coronet custom (sw)", mpg:14, cylinders:8, displacement:318, horsepower:150, weight:4457, acceleration:13.5, year:74, origin:1}, -{name:"ford gran torino (sw)", mpg:14, cylinders:8, displacement:302, horsepower:140, weight:4638, acceleration:16, year:74, origin:1}, -{name:"amc matador (sw)", mpg:14, cylinders:8, displacement:304, horsepower:150, weight:4257, acceleration:15.5, year:74, origin:1}, -{name:"audi fox", mpg:29, cylinders:4, displacement:98, horsepower:83, weight:2219, acceleration:16.5, year:74, origin:2}, -{name:"volkswagen dasher", mpg:26, cylinders:4, displacement:79, horsepower:67, weight:1963, acceleration:15.5, year:74, origin:2}, -{name:"opel manta", mpg:26, cylinders:4, displacement:97, horsepower:78, weight:2300, acceleration:14.5, year:74, origin:2}, -{name:"toyota corona", mpg:31, cylinders:4, displacement:76, horsepower:52, weight:1649, acceleration:16.5, year:74, origin:3}, -{name:"datsun 710", mpg:32, cylinders:4, displacement:83, horsepower:61, weight:2003, acceleration:19, year:74, origin:3}, -{name:"dodge colt", mpg:28, cylinders:4, displacement:90, horsepower:75, weight:2125, acceleration:14.5, year:74, origin:1}, -{name:"fiat 128", mpg:24, cylinders:4, displacement:90, horsepower:75, weight:2108, acceleration:15.5, year:74, origin:2}, -{name:"fiat 124 tc", mpg:26, cylinders:4, displacement:116, horsepower:75, weight:2246, acceleration:14, year:74, origin:2}, -{name:"honda civic", mpg:24, cylinders:4, displacement:120, horsepower:97, weight:2489, acceleration:15, year:74, origin:3}, -{name:"subaru", mpg:26, cylinders:4, displacement:108, horsepower:93, weight:2391, acceleration:15.5, year:74, origin:3}, -{name:"fiat x1.9", mpg:31, cylinders:4, displacement:79, horsepower:67, weight:2000, acceleration:16, year:74, origin:2}, -{name:"plymouth valiant custom", mpg:19, cylinders:6, displacement:225, horsepower:95, weight:3264, acceleration:16, year:75, origin:1}, -{name:"chevrolet nova", mpg:18, cylinders:6, displacement:250, horsepower:105, weight:3459, acceleration:16, year:75, origin:1}, -{name:"mercury monarch", mpg:15, cylinders:6, displacement:250, horsepower:72, weight:3432, acceleration:21, year:75, origin:1}, -{name:"ford maverick", mpg:15, cylinders:6, displacement:250, horsepower:72, weight:3158, acceleration:19.5, year:75, origin:1}, -{name:"pontiac catalina", mpg:16, cylinders:8, displacement:400, horsepower:170, weight:4668, acceleration:11.5, year:75, origin:1}, -{name:"chevrolet bel air", mpg:15, cylinders:8, displacement:350, horsepower:145, weight:4440, acceleration:14, year:75, origin:1}, -{name:"plymouth grand fury", mpg:16, cylinders:8, displacement:318, horsepower:150, weight:4498, acceleration:14.5, year:75, origin:1}, -{name:"ford ltd", mpg:14, cylinders:8, displacement:351, horsepower:148, weight:4657, acceleration:13.5, year:75, origin:1}, -{name:"buick century", mpg:17, cylinders:6, displacement:231, horsepower:110, weight:3907, acceleration:21, year:75, origin:1}, -{name:"chevroelt chevelle malibu", mpg:16, cylinders:6, displacement:250, horsepower:105, weight:3897, acceleration:18.5, year:75, origin:1}, -{name:"amc matador", mpg:15, cylinders:6, displacement:258, horsepower:110, weight:3730, acceleration:19, year:75, origin:1}, -{name:"plymouth fury", mpg:18, cylinders:6, displacement:225, horsepower:95, weight:3785, acceleration:19, year:75, origin:1}, -{name:"buick skyhawk", mpg:21, cylinders:6, displacement:231, horsepower:110, weight:3039, acceleration:15, year:75, origin:1}, -{name:"chevrolet monza 2+2", mpg:20, cylinders:8, displacement:262, horsepower:110, weight:3221, acceleration:13.5, year:75, origin:1}, -{name:"ford mustang ii", mpg:13, cylinders:8, displacement:302, horsepower:129, weight:3169, acceleration:12, year:75, origin:1}, -{name:"toyota corolla", mpg:29, cylinders:4, displacement:97, horsepower:75, weight:2171, acceleration:16, year:75, origin:3}, -{name:"ford pinto", mpg:23, cylinders:4, displacement:140, horsepower:83, weight:2639, acceleration:17, year:75, origin:1}, -{name:"amc gremlin", mpg:20, cylinders:6, displacement:232, horsepower:100, weight:2914, acceleration:16, year:75, origin:1}, -{name:"pontiac astro", mpg:23, cylinders:4, displacement:140, horsepower:78, weight:2592, acceleration:18.5, year:75, origin:1}, -{name:"toyota corona", mpg:24, cylinders:4, displacement:134, horsepower:96, weight:2702, acceleration:13.5, year:75, origin:3}, -{name:"volkswagen dasher", mpg:25, cylinders:4, displacement:90, horsepower:71, weight:2223, acceleration:16.5, year:75, origin:2}, -{name:"datsun 710", mpg:24, cylinders:4, displacement:119, horsepower:97, weight:2545, acceleration:17, year:75, origin:3}, -{name:"ford pinto", mpg:18, cylinders:6, displacement:171, horsepower:97, weight:2984, acceleration:14.5, year:75, origin:1}, -{name:"volkswagen rabbit", mpg:29, cylinders:4, displacement:90, horsepower:70, weight:1937, acceleration:14, year:75, origin:2}, -{name:"amc pacer", mpg:19, cylinders:6, displacement:232, horsepower:90, weight:3211, acceleration:17, year:75, origin:1}, -{name:"audi 100ls", mpg:23, cylinders:4, displacement:115, horsepower:95, weight:2694, acceleration:15, year:75, origin:2}, -{name:"peugeot 504", mpg:23, cylinders:4, displacement:120, horsepower:88, weight:2957, acceleration:17, year:75, origin:2}, -{name:"volvo 244dl", mpg:22, cylinders:4, displacement:121, horsepower:98, weight:2945, acceleration:14.5, year:75, origin:2}, -{name:"saab 99le", mpg:25, cylinders:4, displacement:121, horsepower:115, weight:2671, acceleration:13.5, year:75, origin:2}, -{name:"honda civic cvcc", mpg:33, cylinders:4, displacement:91, horsepower:53, weight:1795, acceleration:17.5, year:75, origin:3}, -{name:"fiat 131", mpg:28, cylinders:4, displacement:107, horsepower:86, weight:2464, acceleration:15.5, year:76, origin:2}, -{name:"opel 1900", mpg:25, cylinders:4, displacement:116, horsepower:81, weight:2220, acceleration:16.9, year:76, origin:2}, -{name:"capri ii", mpg:25, cylinders:4, displacement:140, horsepower:92, weight:2572, acceleration:14.9, year:76, origin:1}, -{name:"dodge colt", mpg:26, cylinders:4, displacement:98, horsepower:79, weight:2255, acceleration:17.7, year:76, origin:1}, -{name:"renault 12tl", mpg:27, cylinders:4, displacement:101, horsepower:83, weight:2202, acceleration:15.3, year:76, origin:2}, -{name:"chevrolet chevelle malibu classic", mpg:17.5, cylinders:8, displacement:305, horsepower:140, weight:4215, acceleration:13, year:76, origin:1}, -{name:"dodge coronet brougham", mpg:16, cylinders:8, displacement:318, horsepower:150, weight:4190, acceleration:13, year:76, origin:1}, -{name:"amc matador", mpg:15.5, cylinders:8, displacement:304, horsepower:120, weight:3962, acceleration:13.9, year:76, origin:1}, -{name:"ford gran torino", mpg:14.5, cylinders:8, displacement:351, horsepower:152, weight:4215, acceleration:12.8, year:76, origin:1}, -{name:"plymouth valiant", mpg:22, cylinders:6, displacement:225, horsepower:100, weight:3233, acceleration:15.4, year:76, origin:1}, -{name:"chevrolet nova", mpg:22, cylinders:6, displacement:250, horsepower:105, weight:3353, acceleration:14.5, year:76, origin:1}, -{name:"ford maverick", mpg:24, cylinders:6, displacement:200, horsepower:81, weight:3012, acceleration:17.6, year:76, origin:1}, -{name:"amc hornet", mpg:22.5, cylinders:6, displacement:232, horsepower:90, weight:3085, acceleration:17.6, year:76, origin:1}, -{name:"chevrolet chevette", mpg:29, cylinders:4, displacement:85, horsepower:52, weight:2035, acceleration:22.2, year:76, origin:1}, -{name:"chevrolet woody", mpg:24.5, cylinders:4, displacement:98, horsepower:60, weight:2164, acceleration:22.1, year:76, origin:1}, -{name:"vw rabbit", mpg:29, cylinders:4, displacement:90, horsepower:70, weight:1937, acceleration:14.2, year:76, origin:2}, -{name:"honda civic", mpg:33, cylinders:4, displacement:91, horsepower:53, weight:1795, acceleration:17.4, year:76, origin:3}, -{name:"dodge aspen se", mpg:20, cylinders:6, displacement:225, horsepower:100, weight:3651, acceleration:17.7, year:76, origin:1}, -{name:"ford granada ghia", mpg:18, cylinders:6, displacement:250, horsepower:78, weight:3574, acceleration:21, year:76, origin:1}, -{name:"pontiac ventura sj", mpg:18.5, cylinders:6, displacement:250, horsepower:110, weight:3645, acceleration:16.2, year:76, origin:1}, -{name:"amc pacer d/l", mpg:17.5, cylinders:6, displacement:258, horsepower:95, weight:3193, acceleration:17.8, year:76, origin:1}, -{name:"volkswagen rabbit", mpg:29.5, cylinders:4, displacement:97, horsepower:71, weight:1825, acceleration:12.2, year:76, origin:2}, -{name:"datsun b-210", mpg:32, cylinders:4, displacement:85, horsepower:70, weight:1990, acceleration:17, year:76, origin:3}, -{name:"toyota corolla", mpg:28, cylinders:4, displacement:97, horsepower:75, weight:2155, acceleration:16.4, year:76, origin:3}, -{name:"ford pinto", mpg:26.5, cylinders:4, displacement:140, horsepower:72, weight:2565, acceleration:13.6, year:76, origin:1}, -{name:"volvo 245", mpg:20, cylinders:4, displacement:130, horsepower:102, weight:3150, acceleration:15.7, year:76, origin:2}, -{name:"plymouth volare premier v8", mpg:13, cylinders:8, displacement:318, horsepower:150, weight:3940, acceleration:13.2, year:76, origin:1}, -{name:"peugeot 504", mpg:19, cylinders:4, displacement:120, horsepower:88, weight:3270, acceleration:21.9, year:76, origin:2}, -{name:"toyota mark ii", mpg:19, cylinders:6, displacement:156, horsepower:108, weight:2930, acceleration:15.5, year:76, origin:3}, -{name:"mercedes-benz 280s", mpg:16.5, cylinders:6, displacement:168, horsepower:120, weight:3820, acceleration:16.7, year:76, origin:2}, -{name:"cadillac seville", mpg:16.5, cylinders:8, displacement:350, horsepower:180, weight:4380, acceleration:12.1, year:76, origin:1}, -{name:"chevy c10", mpg:13, cylinders:8, displacement:350, horsepower:145, weight:4055, acceleration:12, year:76, origin:1}, -{name:"ford f108", mpg:13, cylinders:8, displacement:302, horsepower:130, weight:3870, acceleration:15, year:76, origin:1}, -{name:"dodge d100", mpg:13, cylinders:8, displacement:318, horsepower:150, weight:3755, acceleration:14, year:76, origin:1}, -{name:"honda accord cvcc", mpg:31.5, cylinders:4, displacement:98, horsepower:68, weight:2045, acceleration:18.5, year:77, origin:3}, -{name:"buick opel isuzu deluxe", mpg:30, cylinders:4, displacement:111, horsepower:80, weight:2155, acceleration:14.8, year:77, origin:1}, -{name:"renault 5 gtl", mpg:36, cylinders:4, displacement:79, horsepower:58, weight:1825, acceleration:18.6, year:77, origin:2}, -{name:"plymouth arrow gs", mpg:25.5, cylinders:4, displacement:122, horsepower:96, weight:2300, acceleration:15.5, year:77, origin:1}, -{name:"datsun f-10 hatchback", mpg:33.5, cylinders:4, displacement:85, horsepower:70, weight:1945, acceleration:16.8, year:77, origin:3}, -{name:"chevrolet caprice classic", mpg:17.5, cylinders:8, displacement:305, horsepower:145, weight:3880, acceleration:12.5, year:77, origin:1}, -{name:"oldsmobile cutlass supreme", mpg:17, cylinders:8, displacement:260, horsepower:110, weight:4060, acceleration:19, year:77, origin:1}, -{name:"dodge monaco brougham", mpg:15.5, cylinders:8, displacement:318, horsepower:145, weight:4140, acceleration:13.7, year:77, origin:1}, -{name:"mercury cougar brougham", mpg:15, cylinders:8, displacement:302, horsepower:130, weight:4295, acceleration:14.9, year:77, origin:1}, -{name:"chevrolet concours", mpg:17.5, cylinders:6, displacement:250, horsepower:110, weight:3520, acceleration:16.4, year:77, origin:1}, -{name:"buick skylark", mpg:20.5, cylinders:6, displacement:231, horsepower:105, weight:3425, acceleration:16.9, year:77, origin:1}, -{name:"plymouth volare custom", mpg:19, cylinders:6, displacement:225, horsepower:100, weight:3630, acceleration:17.7, year:77, origin:1}, -{name:"ford granada", mpg:18.5, cylinders:6, displacement:250, horsepower:98, weight:3525, acceleration:19, year:77, origin:1}, -{name:"pontiac grand prix lj", mpg:16, cylinders:8, displacement:400, horsepower:180, weight:4220, acceleration:11.1, year:77, origin:1}, -{name:"chevrolet monte carlo landau", mpg:15.5, cylinders:8, displacement:350, horsepower:170, weight:4165, acceleration:11.4, year:77, origin:1}, -{name:"chrysler cordoba", mpg:15.5, cylinders:8, displacement:400, horsepower:190, weight:4325, acceleration:12.2, year:77, origin:1}, -{name:"ford thunderbird", mpg:16, cylinders:8, displacement:351, horsepower:149, weight:4335, acceleration:14.5, year:77, origin:1}, -{name:"volkswagen rabbit custom", mpg:29, cylinders:4, displacement:97, horsepower:78, weight:1940, acceleration:14.5, year:77, origin:2}, -{name:"pontiac sunbird coupe", mpg:24.5, cylinders:4, displacement:151, horsepower:88, weight:2740, acceleration:16, year:77, origin:1}, -{name:"toyota corolla liftback", mpg:26, cylinders:4, displacement:97, horsepower:75, weight:2265, acceleration:18.2, year:77, origin:3}, -{name:"ford mustang ii 2+2", mpg:25.5, cylinders:4, displacement:140, horsepower:89, weight:2755, acceleration:15.8, year:77, origin:1}, -{name:"chevrolet chevette", mpg:30.5, cylinders:4, displacement:98, horsepower:63, weight:2051, acceleration:17, year:77, origin:1}, -{name:"dodge colt m/m", mpg:33.5, cylinders:4, displacement:98, horsepower:83, weight:2075, acceleration:15.9, year:77, origin:1}, -{name:"subaru dl", mpg:30, cylinders:4, displacement:97, horsepower:67, weight:1985, acceleration:16.4, year:77, origin:3}, -{name:"volkswagen dasher", mpg:30.5, cylinders:4, displacement:97, horsepower:78, weight:2190, acceleration:14.1, year:77, origin:2}, -{name:"datsun 810", mpg:22, cylinders:6, displacement:146, horsepower:97, weight:2815, acceleration:14.5, year:77, origin:3}, -{name:"bmw 320i", mpg:21.5, cylinders:4, displacement:121, horsepower:110, weight:2600, acceleration:12.8, year:77, origin:2}, -{name:"mazda rx-4", mpg:21.5, cylinders:3, displacement:80, horsepower:110, weight:2720, acceleration:13.5, year:77, origin:3}, -{name:"volkswagen rabbit custom diesel", mpg:43.1, cylinders:4, displacement:90, horsepower:48, weight:1985, acceleration:21.5, year:78, origin:2}, -{name:"ford fiesta", mpg:36.1, cylinders:4, displacement:98, horsepower:66, weight:1800, acceleration:14.4, year:78, origin:1}, -{name:"mazda glc deluxe", mpg:32.8, cylinders:4, displacement:78, horsepower:52, weight:1985, acceleration:19.4, year:78, origin:3}, -{name:"datsun b210 gx", mpg:39.4, cylinders:4, displacement:85, horsepower:70, weight:2070, acceleration:18.6, year:78, origin:3}, -{name:"honda civic cvcc", mpg:36.1, cylinders:4, displacement:91, horsepower:60, weight:1800, acceleration:16.4, year:78, origin:3}, -{name:"oldsmobile cutlass salon brougham", mpg:19.9, cylinders:8, displacement:260, horsepower:110, weight:3365, acceleration:15.5, year:78, origin:1}, -{name:"dodge diplomat", mpg:19.4, cylinders:8, displacement:318, horsepower:140, weight:3735, acceleration:13.2, year:78, origin:1}, -{name:"mercury monarch ghia", mpg:20.2, cylinders:8, displacement:302, horsepower:139, weight:3570, acceleration:12.8, year:78, origin:1}, -{name:"pontiac phoenix lj", mpg:19.2, cylinders:6, displacement:231, horsepower:105, weight:3535, acceleration:19.2, year:78, origin:1}, -{name:"chevrolet malibu", mpg:20.5, cylinders:6, displacement:200, horsepower:95, weight:3155, acceleration:18.2, year:78, origin:1}, -{name:"ford fairmont (auto)", mpg:20.2, cylinders:6, displacement:200, horsepower:85, weight:2965, acceleration:15.8, year:78, origin:1}, -{name:"ford fairmont (man)", mpg:25.1, cylinders:4, displacement:140, horsepower:88, weight:2720, acceleration:15.4, year:78, origin:1}, -{name:"plymouth volare", mpg:20.5, cylinders:6, displacement:225, horsepower:100, weight:3430, acceleration:17.2, year:78, origin:1}, -{name:"amc concord", mpg:19.4, cylinders:6, displacement:232, horsepower:90, weight:3210, acceleration:17.2, year:78, origin:1}, -{name:"buick century special", mpg:20.6, cylinders:6, displacement:231, horsepower:105, weight:3380, acceleration:15.8, year:78, origin:1}, -{name:"mercury zephyr", mpg:20.8, cylinders:6, displacement:200, horsepower:85, weight:3070, acceleration:16.7, year:78, origin:1}, -{name:"dodge aspen", mpg:18.6, cylinders:6, displacement:225, horsepower:110, weight:3620, acceleration:18.7, year:78, origin:1}, -{name:"amc concord d/l", mpg:18.1, cylinders:6, displacement:258, horsepower:120, weight:3410, acceleration:15.1, year:78, origin:1}, -{name:"chevrolet monte carlo landau", mpg:19.2, cylinders:8, displacement:305, horsepower:145, weight:3425, acceleration:13.2, year:78, origin:1}, -{name:"buick regal sport coupe (turbo)", mpg:17.7, cylinders:6, displacement:231, horsepower:165, weight:3445, acceleration:13.4, year:78, origin:1}, -{name:"ford futura", mpg:18.1, cylinders:8, displacement:302, horsepower:139, weight:3205, acceleration:11.2, year:78, origin:1}, -{name:"dodge magnum xe", mpg:17.5, cylinders:8, displacement:318, horsepower:140, weight:4080, acceleration:13.7, year:78, origin:1}, -{name:"chevrolet chevette", mpg:30, cylinders:4, displacement:98, horsepower:68, weight:2155, acceleration:16.5, year:78, origin:1}, -{name:"toyota corona", mpg:27.5, cylinders:4, displacement:134, horsepower:95, weight:2560, acceleration:14.2, year:78, origin:3}, -{name:"datsun 510", mpg:27.2, cylinders:4, displacement:119, horsepower:97, weight:2300, acceleration:14.7, year:78, origin:3}, -{name:"dodge omni", mpg:30.9, cylinders:4, displacement:105, horsepower:75, weight:2230, acceleration:14.5, year:78, origin:1}, -{name:"toyota celica gt liftback", mpg:21.1, cylinders:4, displacement:134, horsepower:95, weight:2515, acceleration:14.8, year:78, origin:3}, -{name:"plymouth sapporo", mpg:23.2, cylinders:4, displacement:156, horsepower:105, weight:2745, acceleration:16.7, year:78, origin:1}, -{name:"oldsmobile starfire sx", mpg:23.8, cylinders:4, displacement:151, horsepower:85, weight:2855, acceleration:17.6, year:78, origin:1}, -{name:"datsun 200-sx", mpg:23.9, cylinders:4, displacement:119, horsepower:97, weight:2405, acceleration:14.9, year:78, origin:3}, -{name:"audi 5000", mpg:20.3, cylinders:5, displacement:131, horsepower:103, weight:2830, acceleration:15.9, year:78, origin:2}, -{name:"volvo 264gl", mpg:17, cylinders:6, displacement:163, horsepower:125, weight:3140, acceleration:13.6, year:78, origin:2}, -{name:"saab 99gle", mpg:21.6, cylinders:4, displacement:121, horsepower:115, weight:2795, acceleration:15.7, year:78, origin:2}, -{name:"peugeot 604sl", mpg:16.2, cylinders:6, displacement:163, horsepower:133, weight:3410, acceleration:15.8, year:78, origin:2}, -{name:"volkswagen scirocco", mpg:31.5, cylinders:4, displacement:89, horsepower:71, weight:1990, acceleration:14.9, year:78, origin:2}, -{name:"honda accord lx", mpg:29.5, cylinders:4, displacement:98, horsepower:68, weight:2135, acceleration:16.6, year:78, origin:3}, -{name:"pontiac lemans v6", mpg:21.5, cylinders:6, displacement:231, horsepower:115, weight:3245, acceleration:15.4, year:79, origin:1}, -{name:"mercury zephyr 6", mpg:19.8, cylinders:6, displacement:200, horsepower:85, weight:2990, acceleration:18.2, year:79, origin:1}, -{name:"ford fairmont 4", mpg:22.3, cylinders:4, displacement:140, horsepower:88, weight:2890, acceleration:17.3, year:79, origin:1}, -{name:"amc concord dl 6", mpg:20.2, cylinders:6, displacement:232, horsepower:90, weight:3265, acceleration:18.2, year:79, origin:1}, -{name:"dodge aspen 6", mpg:20.6, cylinders:6, displacement:225, horsepower:110, weight:3360, acceleration:16.6, year:79, origin:1}, -{name:"chevrolet caprice classic", mpg:17, cylinders:8, displacement:305, horsepower:130, weight:3840, acceleration:15.4, year:79, origin:1}, -{name:"ford ltd landau", mpg:17.6, cylinders:8, displacement:302, horsepower:129, weight:3725, acceleration:13.4, year:79, origin:1}, -{name:"mercury grand marquis", mpg:16.5, cylinders:8, displacement:351, horsepower:138, weight:3955, acceleration:13.2, year:79, origin:1}, -{name:"dodge st. regis", mpg:18.2, cylinders:8, displacement:318, horsepower:135, weight:3830, acceleration:15.2, year:79, origin:1}, -{name:"buick estate wagon (sw)", mpg:16.9, cylinders:8, displacement:350, horsepower:155, weight:4360, acceleration:14.9, year:79, origin:1}, -{name:"ford country squire (sw)", mpg:15.5, cylinders:8, displacement:351, horsepower:142, weight:4054, acceleration:14.3, year:79, origin:1}, -{name:"chevrolet malibu classic (sw)", mpg:19.2, cylinders:8, displacement:267, horsepower:125, weight:3605, acceleration:15, year:79, origin:1}, -{name:"chrysler lebaron town @ country (sw)", mpg:18.5, cylinders:8, displacement:360, horsepower:150, weight:3940, acceleration:13, year:79, origin:1}, -{name:"vw rabbit custom", mpg:31.9, cylinders:4, displacement:89, horsepower:71, weight:1925, acceleration:14, year:79, origin:2}, -{name:"maxda glc deluxe", mpg:34.1, cylinders:4, displacement:86, horsepower:65, weight:1975, acceleration:15.2, year:79, origin:3}, -{name:"dodge colt hatchback custom", mpg:35.7, cylinders:4, displacement:98, horsepower:80, weight:1915, acceleration:14.4, year:79, origin:1}, -{name:"amc spirit dl", mpg:27.4, cylinders:4, displacement:121, horsepower:80, weight:2670, acceleration:15, year:79, origin:1}, -{name:"mercedes benz 300d", mpg:25.4, cylinders:5, displacement:183, horsepower:77, weight:3530, acceleration:20.1, year:79, origin:2}, -{name:"cadillac eldorado", mpg:23, cylinders:8, displacement:350, horsepower:125, weight:3900, acceleration:17.4, year:79, origin:1}, -{name:"peugeot 504", mpg:27.2, cylinders:4, displacement:141, horsepower:71, weight:3190, acceleration:24.8, year:79, origin:2}, -{name:"oldsmobile cutlass salon brougham", mpg:23.9, cylinders:8, displacement:260, horsepower:90, weight:3420, acceleration:22.2, year:79, origin:1}, -{name:"plymouth horizon", mpg:34.2, cylinders:4, displacement:105, horsepower:70, weight:2200, acceleration:13.2, year:79, origin:1}, -{name:"plymouth horizon tc3", mpg:34.5, cylinders:4, displacement:105, horsepower:70, weight:2150, acceleration:14.9, year:79, origin:1}, -{name:"datsun 210", mpg:31.8, cylinders:4, displacement:85, horsepower:65, weight:2020, acceleration:19.2, year:79, origin:3}, -{name:"fiat strada custom", mpg:37.3, cylinders:4, displacement:91, horsepower:69, weight:2130, acceleration:14.7, year:79, origin:2}, -{name:"buick skylark limited", mpg:28.4, cylinders:4, displacement:151, horsepower:90, weight:2670, acceleration:16, year:79, origin:1}, -{name:"chevrolet citation", mpg:28.8, cylinders:6, displacement:173, horsepower:115, weight:2595, acceleration:11.3, year:79, origin:1}, -{name:"oldsmobile omega brougham", mpg:26.8, cylinders:6, displacement:173, horsepower:115, weight:2700, acceleration:12.9, year:79, origin:1}, -{name:"pontiac phoenix", mpg:33.5, cylinders:4, displacement:151, horsepower:90, weight:2556, acceleration:13.2, year:79, origin:1}, -{name:"vw rabbit", mpg:41.5, cylinders:4, displacement:98, horsepower:76, weight:2144, acceleration:14.7, year:80, origin:2}, -{name:"toyota corolla tercel", mpg:38.1, cylinders:4, displacement:89, horsepower:60, weight:1968, acceleration:18.8, year:80, origin:3}, -{name:"chevrolet chevette", mpg:32.1, cylinders:4, displacement:98, horsepower:70, weight:2120, acceleration:15.5, year:80, origin:1}, -{name:"datsun 310", mpg:37.2, cylinders:4, displacement:86, horsepower:65, weight:2019, acceleration:16.4, year:80, origin:3}, -{name:"chevrolet citation", mpg:28, cylinders:4, displacement:151, horsepower:90, weight:2678, acceleration:16.5, year:80, origin:1}, -{name:"ford fairmont", mpg:26.4, cylinders:4, displacement:140, horsepower:88, weight:2870, acceleration:18.1, year:80, origin:1}, -{name:"amc concord", mpg:24.3, cylinders:4, displacement:151, horsepower:90, weight:3003, acceleration:20.1, year:80, origin:1}, -{name:"dodge aspen", mpg:19.1, cylinders:6, displacement:225, horsepower:90, weight:3381, acceleration:18.7, year:80, origin:1}, -{name:"audi 4000", mpg:34.3, cylinders:4, displacement:97, horsepower:78, weight:2188, acceleration:15.8, year:80, origin:2}, -{name:"toyota corona liftback", mpg:29.8, cylinders:4, displacement:134, horsepower:90, weight:2711, acceleration:15.5, year:80, origin:3}, -{name:"mazda 626", mpg:31.3, cylinders:4, displacement:120, horsepower:75, weight:2542, acceleration:17.5, year:80, origin:3}, -{name:"datsun 510 hatchback", mpg:37, cylinders:4, displacement:119, horsepower:92, weight:2434, acceleration:15, year:80, origin:3}, -{name:"toyota corolla", mpg:32.2, cylinders:4, displacement:108, horsepower:75, weight:2265, acceleration:15.2, year:80, origin:3}, -{name:"mazda glc", mpg:46.6, cylinders:4, displacement:86, horsepower:65, weight:2110, acceleration:17.9, year:80, origin:3}, -{name:"dodge colt", mpg:27.9, cylinders:4, displacement:156, horsepower:105, weight:2800, acceleration:14.4, year:80, origin:1}, -{name:"datsun 210", mpg:40.8, cylinders:4, displacement:85, horsepower:65, weight:2110, acceleration:19.2, year:80, origin:3}, -{name:"vw rabbit c (diesel)", mpg:44.3, cylinders:4, displacement:90, horsepower:48, weight:2085, acceleration:21.7, year:80, origin:2}, -{name:"vw dasher (diesel)", mpg:43.4, cylinders:4, displacement:90, horsepower:48, weight:2335, acceleration:23.7, year:80, origin:2}, -{name:"audi 5000s (diesel)", mpg:36.4, cylinders:5, displacement:121, horsepower:67, weight:2950, acceleration:19.9, year:80, origin:2}, -{name:"mercedes-benz 240d", mpg:30, cylinders:4, displacement:146, horsepower:67, weight:3250, acceleration:21.8, year:80, origin:2}, -{name:"honda civic 1500 gl", mpg:44.6, cylinders:4, displacement:91, horsepower:67, weight:1850, acceleration:13.8, year:80, origin:3}, -{name:"renault lecar deluxe", mpg:40.9, cylinders:4, displacement:85, horsepower:undefined, weight:1835, acceleration:17.3, year:80, origin:2}, -{name:"subaru dl", mpg:33.8, cylinders:4, displacement:97, horsepower:67, weight:2145, acceleration:18, year:80, origin:3}, -{name:"vokswagen rabbit", mpg:29.8, cylinders:4, displacement:89, horsepower:62, weight:1845, acceleration:15.3, year:80, origin:2}, -{name:"datsun 280-zx", mpg:32.7, cylinders:6, displacement:168, horsepower:132, weight:2910, acceleration:11.4, year:80, origin:3}, -{name:"mazda rx-7 gs", mpg:23.7, cylinders:3, displacement:70, horsepower:100, weight:2420, acceleration:12.5, year:80, origin:3}, -{name:"triumph tr7 coupe", mpg:35, cylinders:4, displacement:122, horsepower:88, weight:2500, acceleration:15.1, year:80, origin:2}, -{name:"ford mustang cobra", mpg:23.6, cylinders:4, displacement:140, horsepower:undefined, weight:2905, acceleration:14.3, year:80, origin:1}, -{name:"honda accord", mpg:32.4, cylinders:4, displacement:107, horsepower:72, weight:2290, acceleration:17, year:80, origin:3}, -{name:"plymouth reliant", mpg:27.2, cylinders:4, displacement:135, horsepower:84, weight:2490, acceleration:15.7, year:81, origin:1}, -{name:"buick skylark", mpg:26.6, cylinders:4, displacement:151, horsepower:84, weight:2635, acceleration:16.4, year:81, origin:1}, -{name:"dodge aries wagon (sw)", mpg:25.8, cylinders:4, displacement:156, horsepower:92, weight:2620, acceleration:14.4, year:81, origin:1}, -{name:"chevrolet citation", mpg:23.5, cylinders:6, displacement:173, horsepower:110, weight:2725, acceleration:12.6, year:81, origin:1}, -{name:"plymouth reliant", mpg:30, cylinders:4, displacement:135, horsepower:84, weight:2385, acceleration:12.9, year:81, origin:1}, -{name:"toyota starlet", mpg:39.1, cylinders:4, displacement:79, horsepower:58, weight:1755, acceleration:16.9, year:81, origin:3}, -{name:"plymouth champ", mpg:39, cylinders:4, displacement:86, horsepower:64, weight:1875, acceleration:16.4, year:81, origin:1}, -{name:"honda civic 1300", mpg:35.1, cylinders:4, displacement:81, horsepower:60, weight:1760, acceleration:16.1, year:81, origin:3}, -{name:"subaru", mpg:32.3, cylinders:4, displacement:97, horsepower:67, weight:2065, acceleration:17.8, year:81, origin:3}, -{name:"datsun 210 mpg", mpg:37, cylinders:4, displacement:85, horsepower:65, weight:1975, acceleration:19.4, year:81, origin:3}, -{name:"toyota tercel", mpg:37.7, cylinders:4, displacement:89, horsepower:62, weight:2050, acceleration:17.3, year:81, origin:3}, -{name:"mazda glc 4", mpg:34.1, cylinders:4, displacement:91, horsepower:68, weight:1985, acceleration:16, year:81, origin:3}, -{name:"plymouth horizon 4", mpg:34.7, cylinders:4, displacement:105, horsepower:63, weight:2215, acceleration:14.9, year:81, origin:1}, -{name:"ford escort 4w", mpg:34.4, cylinders:4, displacement:98, horsepower:65, weight:2045, acceleration:16.2, year:81, origin:1}, -{name:"ford escort 2h", mpg:29.9, cylinders:4, displacement:98, horsepower:65, weight:2380, acceleration:20.7, year:81, origin:1}, -{name:"volkswagen jetta", mpg:33, cylinders:4, displacement:105, horsepower:74, weight:2190, acceleration:14.2, year:81, origin:2}, -{name:"renault 18i", mpg:34.5, cylinders:4, displacement:100, horsepower:undefined, weight:2320, acceleration:15.8, year:81, origin:2}, -{name:"honda prelude", mpg:33.7, cylinders:4, displacement:107, horsepower:75, weight:2210, acceleration:14.4, year:81, origin:3}, -{name:"toyota corolla", mpg:32.4, cylinders:4, displacement:108, horsepower:75, weight:2350, acceleration:16.8, year:81, origin:3}, -{name:"datsun 200sx", mpg:32.9, cylinders:4, displacement:119, horsepower:100, weight:2615, acceleration:14.8, year:81, origin:3}, -{name:"mazda 626", mpg:31.6, cylinders:4, displacement:120, horsepower:74, weight:2635, acceleration:18.3, year:81, origin:3}, -{name:"peugeot 505s turbo diesel", mpg:28.1, cylinders:4, displacement:141, horsepower:80, weight:3230, acceleration:20.4, year:81, origin:2}, -{name:"saab 900s", mpg:undefined, cylinders:4, displacement:121, horsepower:110, weight:2800, acceleration:15.4, year:81, origin:2}, -{name:"volvo diesel", mpg:30.7, cylinders:6, displacement:145, horsepower:76, weight:3160, acceleration:19.6, year:81, origin:2}, -{name:"toyota cressida", mpg:25.4, cylinders:6, displacement:168, horsepower:116, weight:2900, acceleration:12.6, year:81, origin:3}, -{name:"datsun 810 maxima", mpg:24.2, cylinders:6, displacement:146, horsepower:120, weight:2930, acceleration:13.8, year:81, origin:3}, -{name:"buick century", mpg:22.4, cylinders:6, displacement:231, horsepower:110, weight:3415, acceleration:15.8, year:81, origin:1}, -{name:"oldsmobile cutlass ls", mpg:26.6, cylinders:8, displacement:350, horsepower:105, weight:3725, acceleration:19, year:81, origin:1}, -{name:"ford granada gl", mpg:20.2, cylinders:6, displacement:200, horsepower:88, weight:3060, acceleration:17.1, year:81, origin:1}, -{name:"chrysler lebaron salon", mpg:17.6, cylinders:6, displacement:225, horsepower:85, weight:3465, acceleration:16.6, year:81, origin:1}, -{name:"chevrolet cavalier", mpg:28, cylinders:4, displacement:112, horsepower:88, weight:2605, acceleration:19.6, year:82, origin:1}, -{name:"chevrolet cavalier wagon", mpg:27, cylinders:4, displacement:112, horsepower:88, weight:2640, acceleration:18.6, year:82, origin:1}, -{name:"chevrolet cavalier 2-door", mpg:34, cylinders:4, displacement:112, horsepower:88, weight:2395, acceleration:18, year:82, origin:1}, -{name:"pontiac j2000 se hatchback", mpg:31, cylinders:4, displacement:112, horsepower:85, weight:2575, acceleration:16.2, year:82, origin:1}, -{name:"dodge aries se", mpg:29, cylinders:4, displacement:135, horsepower:84, weight:2525, acceleration:16, year:82, origin:1}, -{name:"pontiac phoenix", mpg:27, cylinders:4, displacement:151, horsepower:90, weight:2735, acceleration:18, year:82, origin:1}, -{name:"ford fairmont futura", mpg:24, cylinders:4, displacement:140, horsepower:92, weight:2865, acceleration:16.4, year:82, origin:1}, -{name:"amc concord dl", mpg:23, cylinders:4, displacement:151, horsepower:undefined, weight:3035, acceleration:20.5, year:82, origin:1}, -{name:"volkswagen rabbit l", mpg:36, cylinders:4, displacement:105, horsepower:74, weight:1980, acceleration:15.3, year:82, origin:2}, -{name:"mazda glc custom l", mpg:37, cylinders:4, displacement:91, horsepower:68, weight:2025, acceleration:18.2, year:82, origin:3}, -{name:"mazda glc custom", mpg:31, cylinders:4, displacement:91, horsepower:68, weight:1970, acceleration:17.6, year:82, origin:3}, -{name:"plymouth horizon miser", mpg:38, cylinders:4, displacement:105, horsepower:63, weight:2125, acceleration:14.7, year:82, origin:1}, -{name:"mercury lynx l", mpg:36, cylinders:4, displacement:98, horsepower:70, weight:2125, acceleration:17.3, year:82, origin:1}, -{name:"nissan stanza xe", mpg:36, cylinders:4, displacement:120, horsepower:88, weight:2160, acceleration:14.5, year:82, origin:3}, -{name:"honda accord", mpg:36, cylinders:4, displacement:107, horsepower:75, weight:2205, acceleration:14.5, year:82, origin:3}, -{name:"toyota corolla", mpg:34, cylinders:4, displacement:108, horsepower:70, weight:2245, acceleration:16.9, year:82, origin:3}, -{name:"honda civic", mpg:38, cylinders:4, displacement:91, horsepower:67, weight:1965, acceleration:15, year:82, origin:3}, -{name:"honda civic (auto)", mpg:32, cylinders:4, displacement:91, horsepower:67, weight:1965, acceleration:15.7, year:82, origin:3}, -{name:"datsun 310 gx", mpg:38, cylinders:4, displacement:91, horsepower:67, weight:1995, acceleration:16.2, year:82, origin:3}, -{name:"buick century limited", mpg:25, cylinders:6, displacement:181, horsepower:110, weight:2945, acceleration:16.4, year:82, origin:1}, -{name:"oldsmobile cutlass ciera (diesel)", mpg:38, cylinders:6, displacement:262, horsepower:85, weight:3015, acceleration:17, year:82, origin:1}, -{name:"chrysler lebaron medallion", mpg:26, cylinders:4, displacement:156, horsepower:92, weight:2585, acceleration:14.5, year:82, origin:1}, -{name:"ford granada l", mpg:22, cylinders:6, displacement:232, horsepower:112, weight:2835, acceleration:14.7, year:82, origin:1}, -{name:"toyota celica gt", mpg:32, cylinders:4, displacement:144, horsepower:96, weight:2665, acceleration:13.9, year:82, origin:3}, -{name:"dodge charger 2.2", mpg:36, cylinders:4, displacement:135, horsepower:84, weight:2370, acceleration:13, year:82, origin:1}, -{name:"chevrolet camaro", mpg:27, cylinders:4, displacement:151, horsepower:90, weight:2950, acceleration:17.3, year:82, origin:1}, -{name:"ford mustang gl", mpg:27, cylinders:4, displacement:140, horsepower:86, weight:2790, acceleration:15.6, year:82, origin:1}, -{name:"vw pickup", mpg:44, cylinders:4, displacement:97, horsepower:52, weight:2130, acceleration:24.6, year:82, origin:2}, -{name:"dodge rampage", mpg:32, cylinders:4, displacement:135, horsepower:84, weight:2295, acceleration:11.6, year:82, origin:1}, -{name:"ford ranger", mpg:28, cylinders:4, displacement:120, horsepower:79, weight:2625, acceleration:18.6, year:82, origin:1}, -{name:"chevy s-10", mpg:31, cylinders:4, displacement:119, horsepower:82, weight:2720, acceleration:19.4, year:82, origin:1} -]; diff --git a/docs/lib/protovis-3.2/examples/crimea/crimea-grouped-bar.html b/docs/lib/protovis-3.2/examples/crimea/crimea-grouped-bar.html deleted file mode 100644 index 78caa082..00000000 --- a/docs/lib/protovis-3.2/examples/crimea/crimea-grouped-bar.html +++ /dev/null @@ -1,65 +0,0 @@ - - - Crimean War - - - - - -
- -
- diff --git a/docs/lib/protovis-3.2/examples/crimea/crimea-line.html b/docs/lib/protovis-3.2/examples/crimea/crimea-line.html deleted file mode 100644 index 00ad74af..00000000 --- a/docs/lib/protovis-3.2/examples/crimea/crimea-line.html +++ /dev/null @@ -1,61 +0,0 @@ - - - Crimean War - - - - - -
- -
- diff --git a/docs/lib/protovis-3.2/examples/crimea/crimea-stacked-area.html b/docs/lib/protovis-3.2/examples/crimea/crimea-stacked-area.html deleted file mode 100644 index 22cc0135..00000000 --- a/docs/lib/protovis-3.2/examples/crimea/crimea-stacked-area.html +++ /dev/null @@ -1,61 +0,0 @@ - - - Crimean War - - - - - -
- -
- diff --git a/docs/lib/protovis-3.2/examples/crimea/crimea-stacked-bar.html b/docs/lib/protovis-3.2/examples/crimea/crimea-stacked-bar.html deleted file mode 100644 index b7ac5e6f..00000000 --- a/docs/lib/protovis-3.2/examples/crimea/crimea-stacked-bar.html +++ /dev/null @@ -1,60 +0,0 @@ - - - Crimean War - - - - - -
- -
- diff --git a/docs/lib/protovis-3.2/examples/crimea/crimea.html b/docs/lib/protovis-3.2/examples/crimea/crimea.html deleted file mode 100644 index 8c17c1e2..00000000 --- a/docs/lib/protovis-3.2/examples/crimea/crimea.html +++ /dev/null @@ -1,100 +0,0 @@ - - - Crimean War - - - - - -
-
- Diagram of the Causes of Mortality
- in the Army of the East -
- -
- The Areas of the blue, red, & black wedges are each measured from the - centre as the common vertex -

The blue wedges measured from the centre of the circle represent area - for area the deaths from Preventible or Mitigable Zymotic Diseases, the - red wedges measured from the center the deaths from wounds, & the - black wedges measured from the center the deaths from all other causes -

In October 1844, & April 1855, the black area coincides with the - red, in January & February 1856, the blue coincides with the black -

The entire areas may be compared by following the blue, the red & - the black lines enclosing them. -

-
- diff --git a/docs/lib/protovis-3.2/examples/crimea/crimea.js b/docs/lib/protovis-3.2/examples/crimea/crimea.js deleted file mode 100644 index 8578a734..00000000 --- a/docs/lib/protovis-3.2/examples/crimea/crimea.js +++ /dev/null @@ -1,33 +0,0 @@ -var causes = ["wounds", "other", "disease"]; - -var crimea = [ - { date: "4/1854", wounds: 0, other: 110, disease: 110 }, - { date: "5/1854", wounds: 0, other: 95, disease: 105 }, - { date: "6/1854", wounds: 0, other: 40, disease: 95 }, - { date: "7/1854", wounds: 0, other: 140, disease: 520 }, - { date: "8/1854", wounds: 20, other: 150, disease: 800 }, - { date: "9/1854", wounds: 220, other: 230, disease: 740 }, - { date: "10/1854", wounds: 305, other: 310, disease: 600 }, - { date: "11/1854", wounds: 480, other: 290, disease: 820 }, - { date: "12/1854", wounds: 295, other: 310, disease: 1100 }, - { date: "1/1855", wounds: 230, other: 460, disease: 1440 }, - { date: "2/1855", wounds: 180, other: 520, disease: 1270 }, - { date: "3/1855", wounds: 155, other: 350, disease: 935 }, - { date: "4/1855", wounds: 195, other: 195, disease: 560 }, - { date: "5/1855", wounds: 180, other: 155, disease: 550 }, - { date: "6/1855", wounds: 330, other: 130, disease: 650 }, - { date: "7/1855", wounds: 260, other: 130, disease: 430 }, - { date: "8/1855", wounds: 290, other: 110, disease: 490 }, - { date: "9/1855", wounds: 355, other: 100, disease: 290 }, - { date: "10/1855", wounds: 135, other: 95, disease: 245 }, - { date: "11/1855", wounds: 100, other: 140, disease: 325 }, - { date: "12/1855", wounds: 40, other: 120, disease: 215 }, - { date: "1/1856", wounds: 0, other: 160, disease: 160 }, - { date: "2/1856", wounds: 0, other: 100, disease: 100 }, - { date: "3/1856", wounds: 0, other: 125, disease: 90 } -]; - -(function() { - var format = pv.Format.date("%m/%y"); - crimea.forEach(function(d) { d.date = format.parse(d.date); }); -})(); diff --git a/docs/lib/protovis-3.2/jsdoc/files.html b/docs/lib/protovis-3.2/jsdoc/files.html deleted file mode 100644 index dffa3454..00000000 --- a/docs/lib/protovis-3.2/jsdoc/files.html +++ /dev/null @@ -1,1450 +0,0 @@ - - - - - - JsDoc Reference - File Index - - - - - - - - -
- -
-

Classes

- -
-
- -
-

File Index

- - -
-

src/behavior/Behavior.js

- -
- - - - -
-
-
- -
-

src/behavior/Drag.js

- -
- - - - -
-
-
- -
-

src/behavior/Pan.js

- -
- - - - -
-
-
- -
-

src/behavior/Point.js

- -
- - - - -
-
-
- -
-

src/behavior/Resize.js

- -
- - - - -
-
-
- -
-

src/behavior/Select.js

- -
- - - - -
-
-
- -
-

src/behavior/Zoom.js

- -
- - - - -
-
-
- -
-

src/color/Color.js

- -
- - - - -
-
-
- -
-

src/color/Colors.js

- -
- - - - -
-
-
- -
-

src/color/Ramp.js

- -
- - - - -
-
-
- -
-

src/data/Arrays.js

- -
- - - - -
-
-
- -
-

src/data/Dom.js

- -
- - - - -
-
-
- -
-

src/data/Flatten.js

- -
- - - - -
-
-
- -
-

src/data/Histogram.js

- -
- - - - -
-
-
- -
-

src/data/LinearScale.js

- -
- - - - -
-
-
- -
-

src/data/LogScale.js

- -
- - - - -
-
-
- -
-

src/data/Nest.js

- -
- - - - -
-
-
- -
-

src/data/Numbers.js

- -
- - - - -
-
-
- -
-

src/data/Objects.js

- -
- - - - -
-
-
- -
-

src/data/OrdinalScale.js

- -
- - - - -
-
-
- -
-

src/data/QuantileScale.js

- -
- - - - -
-
-
- -
-

src/data/QuantitativeScale.js

- -
- - - - -
-
-
- -
-

src/data/RootScale.js

- -
- - - - -
-
-
- -
-

src/data/Scale.js

- -
- - - - -
-
-
- -
-

src/data/Transform.js

- -
- - - - -
-
-
- -
-

src/data/Tree.js

- -
- - - - -
-
-
- -
-

src/data/Vector.js

- -
- - - - -
-
-
- -
-

src/geo/Geo.js

- -
- - - - -
-
-
- -
-

src/geo/GeoScale.js

- -
- - - - -
-
-
- -
-

src/geo/LatLng.js

- -
- - - - -
-
-
- -
-

src/geo/Projection.js

- -
- - - - -
-
-
- -
-

src/geo/Projections.js

- -
- - - - -
-
-
- -
-

src/lang/Array.js

- -
- - - - -
-
-
- -
-

src/lang/init.js

- -
- - - - -
-
-
- -
-

src/layout/Arc.js

- -
- - - - -
-
-
- -
-

src/layout/Bullet.js

- -
- - - - -
-
-
- -
-

src/layout/Cluster.js

- -
- - - - -
-
-
- -
-

src/layout/Force.js

- -
- - - - -
-
-
- -
-

src/layout/Grid.js

- -
- - - - -
-
-
- -
-

src/layout/Hierarchy.js

- -
- - - - -
-
-
- -
-

src/layout/Horizon.js

- -
- - - - -
-
-
- -
-

src/layout/Indent.js

- -
- - - - -
-
-
- -
-

src/layout/Layout.js

- -
- - - - -
-
-
- -
-

src/layout/Matrix.js

- -
- - - - -
-
-
- -
-

src/layout/Network.js

- -
- - - - -
-
-
- -
-

src/layout/Pack.js

- -
- - - - -
-
-
- -
-

src/layout/Partition.js

- -
- - - - -
-
-
- -
-

src/layout/Rollup.js

- -
- - - - -
-
-
- -
-

src/layout/Stack.js

- -
- - - - -
-
-
- -
-

src/layout/Tree.js

- -
- - - - -
-
-
- -
-

src/layout/Treemap.js

- -
- - - - -
-
-
- -
-

src/mark/Anchor.js

- -
- - - - -
-
-
- -
-

src/mark/Area.js

- -
- - - - -
-
-
- -
-

src/mark/Bar.js

- -
- - - - -
-
-
- -
-

src/mark/Dot.js

- -
- - - - -
-
-
- -
-

src/mark/Image.js

- -
- - - - -
-
-
- -
-

src/mark/Label.js

- -
- - - - -
-
-
- -
-

src/mark/Line.js

- -
- - - - -
-
-
- -
-

src/mark/Mark.js

- -
- - - - -
-
-
- -
-

src/mark/Panel.js

- -
- - - - -
-
-
- -
-

src/mark/Rule.js

- -
- - - - -
-
-
- -
-

src/mark/Wedge.js

- -
- - - - -
-
-
- -
-

src/physics/BoundConstraint.js

- -
- - - - -
-
-
- -
-

src/physics/ChargeForce.js

- -
- - - - -
-
-
- - -
- -
-

src/physics/Constraint.js

- -
- - - - -
-
-
- -
-

src/physics/DragForce.js

- -
- - - - -
-
-
- -
-

src/physics/Force.js

- -
- - - - -
-
-
- -
-

src/physics/Particle.js

- -
- - - - -
-
-
- - -
- -
-

src/physics/Quadtree.js

- -
- - - - -
-
-
- -
-

src/physics/Simulation.js

- -
- - - - -
-
-
- -
-

src/physics/SpringForce.js

- -
- - - - -
-
-
- -
-

src/pv-internals.js

- -
- - - - -
-
-
- -
-

src/pv.js

- -
- - - - -
-
-
- -
-

src/scene/SvgArea.js

- -
- - - - -
-
-
- -
-

src/scene/SvgBar.js

- -
- - - - -
-
-
- -
-

src/scene/SvgCurve.js

- -
- - - - -
-
-
- -
-

src/scene/SvgDot.js

- -
- - - - -
-
-
- -
-

src/scene/SvgImage.js

- -
- - - - -
-
-
- -
-

src/scene/SvgLabel.js

- -
- - - - -
-
-
- -
-

src/scene/SvgLine.js

- -
- - - - -
-
-
- -
-

src/scene/SvgPanel.js

- -
- - - - -
-
-
- -
-

src/scene/SvgRule.js

- -
- - - - -
-
-
- -
-

src/scene/SvgScene.js

- -
- - - - -
-
-
- -
-

src/scene/SvgWedge.js

- -
- - - - -
-
-
- -
-

src/text/DateFormat.js

- -
- - - - -
-
-
- -
-

src/text/Format.js

- -
- - - - -
-
-
- -
-

src/text/NumberFormat.js

- -
- - - - -
-
-
- -
-

src/text/TimeFormat.js

- -
- - - - -
-
-
- - -
-
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:30 GMT-0700 (PDT) -
- - \ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/index.html b/docs/lib/protovis-3.2/jsdoc/index.html deleted file mode 100644 index 0d685d74..00000000 --- a/docs/lib/protovis-3.2/jsdoc/index.html +++ /dev/null @@ -1,905 +0,0 @@ - - - - - - JsDoc Reference - Index - - - - - - - - -
- -
-

Classes

- -
-
- -
-

Class Index

- - -
-

_global_

- -
-
- -
-

Array

- The built-in Array class. -
-
- -
-

pv

- The top-level Protovis namespace, pv. -
-
- -
-

pv.Anchor

- Represents an anchor on a given mark. -
-
- -
-

pv.Area

- Represents an area mark: the solid area between two series of -connected line segments. -
-
- -
-

pv.Bar

- Represents a bar: an axis-aligned rectangle that can be stroked and -filled. -
-
- -
-

pv.Behavior

- Represents a reusable interaction; applies an interactive behavior to -a given mark. -
-
- -
-

pv.Behavior.drag

- Implements interactive dragging starting with mousedown events. -
-
- -
-

pv.Behavior.pan

- Implements interactive panning starting with mousedown events. -
-
- -
-

pv.Behavior.point

- Implements interactive fuzzy pointing, identifying marks that are in -close proximity to the mouse cursor. -
-
- -
-

pv.Behavior.resize

- Implements interactive resizing of a selection starting with mousedown -events. -
-
- -
-

pv.Behavior.select

- Implements interactive selecting starting with mousedown events. -
-
- -
-

pv.Behavior.zoom

- Implements interactive zooming using mousewheel events. -
-
- -
-

pv.Color

- Represents an abstract (possibly translucent) color. -
-
- -
-

pv.Color.Hsl

- Represents a color in HSL space. -
-
- -
-

pv.Color.Rgb

- Represents a color in RGB space. -
-
- -
-

pv.Colors

- A collection of standard color palettes for categorical encoding. -
-
- -
-

pv.Constraint

- Represents a constraint that acts on particles. -
-
- -
-

pv.Constraint.bound

- Constrains particles to within fixed rectangular bounds. -
-
- -
-

pv.Constraint.collision

- Constraints circles to avoid overlap. -
-
- -
-

pv.Constraint.position

- Constraints particles to a fixed position. -
-
- -
-

pv.Dom

- Represets a DOM operator for the specified map. -
-
- -
-

pv.Dom.Node

- Represents a Node in the W3C Document Object Model. -
-
- -
-

pv.Dot

- Represents a dot; a dot is simply a sized glyph centered at a given -point that can also be stroked and filled. -
-
- -
-

pv.Flatten

- Represents a flatten operator for the specified array. -
-
- -
-

pv.Force

- Represents a force that acts on particles. -
-
- -
-

pv.Force.charge

- An n-body force, as defined by Coulomb's law or Newton's law of -gravitation, inversely proportional to the square of the distance between -particles. -
-
- -
-

pv.Force.drag

- Implements a drag force, simulating friction. -
-
- -
-

pv.Force.spring

- Implements a spring force, per Hooke's law. -
-
- -
-

pv.Format

- Represents an abstract text formatter and parser. -
-
- -
-

pv.Format.date

- The format string is in the same format expected by the -strftime function in C. -
-
- -
-

pv.Format.number

- Represents a number format, converting between a number and a -string. -
-
- -
-

pv.Format.time

- Represents a time format, converting between a number -representing a duration in milliseconds, and a string. -
-
- -
-

pv.Geo.LatLng

- Represents a pair of geographic coordinates. -
-
- -
-

pv.Geo.Projection

- Represents a geographic projection. -
-
- - -
- -
-

pv.Geo.scale

- Represents a geographic scale; a mapping between latitude-longitude -coordinates and screen pixel coordinates. -
-
- -
-

pv.Geo.scale#ticks

- Tick functions for geographic scales. -
-
- -
-

pv.histogram

- Represents a histogram operator. -
-
- -
-

pv.histogram.Bin

- Represents a bin returned by the pv.histogram operator. -
-
- -
-

pv.Image

- Represents an image, either a static resource or a dynamically- -generated pixel buffer. -
-
- -
-

pv.Label

- Represents a text label, allowing textual annotation of other marks or -arbitrary text within the visualization. -
-
- -
-

pv.Layout

- Represents an abstract layout, encapsulating a visualization technique -such as a streamgraph or treemap. -
-
- -
-

pv.Layout.Arc

- Implements a layout for arc diagrams. -
-
- - -
- -
-

pv.Layout.Cluster

- Implements a hierarchical layout using the cluster (or dendrogram) -algorithm. -
-
- -
-

pv.Layout.Cluster.Fill

- A variant of cluster layout that is space-filling. -
-
- -
-

pv.Layout.Force

- Implements force-directed network layout as a node-link diagram. -
-
- -
-

pv.Layout.Grid

- Implements a grid layout with regularly-sized rows and columns. -
-
- -
-

pv.Layout.Hierarchy

- Represents an abstract layout for hierarchy diagrams. -
-
- -
-

pv.Layout.Horizon

- Implements a horizon layout, which is a variation of a single-series -area chart where the area is folded into multiple bands. -
-
- -
-

pv.Layout.Indent

- Implements a hierarchical layout using the indent algorithm. -
-
- -
-

pv.Layout.Matrix

- Implements a network visualization using a matrix view. -
-
- -
-

pv.Layout.Network

- Represents an abstract layout for network diagrams. -
-
- -
-

pv.Layout.Network.Link

- Represents a link in a network layout. -
-
- -
-

pv.Layout.Network.Node

- Represents a node in a network layout. -
-
- -
-

pv.Layout.Pack

- Implements a hierarchical layout using circle-packing. -
-
- -
-

pv.Layout.Partition

- Implemeents a hierarchical layout using the partition (or sunburst, -icicle) algorithm. -
-
- -
-

pv.Layout.Partition.Fill

- A variant of partition layout that is space-filling. -
-
- -
-

pv.Layout.Rollup

- Implements a network visualization using a node-link diagram where -nodes are rolled up along two dimensions. -
-
- -
-

pv.Layout.Stack

- Implements a layout for stacked visualizations, ranging from simple -stacked bar charts to more elaborate "streamgraphs" composed of stacked -areas. -
-
- -
-

pv.Layout.Tree

- Implements a node-link tree diagram using the Reingold-Tilford "tidy" -tree layout algorithm. -
-
- -
-

pv.Layout.Treemap

- Implements a space-filling rectangular layout, with the hierarchy -represented via containment. -
-
- -
-

pv.Line

- Represents a series of connected line segments, or polyline, -that can be stroked with a configurable color and thickness. -
-
- -
-

pv.Mark

- Represents a data-driven graphical mark. -
-
- -
-

pv.Nest

- Represents a Nest operator for the specified array. -
-
- -
-

pv.Panel

- Represents a container mark. -
-
- -
-

pv.Particle

- A weighted particle that can participate in a force simulation. -
-
- -
-

pv.Quadtree

- Represents a quadtree: a two-dimensional recursive spatial -subdivision. -
-
- -
-

pv.Quadtree.Node

- A node in a quadtree. -
-
- -
-

pv.Rule

- Represents a horizontal or vertical rule. -
-
- -
-

pv.Scale

- Represents a scale; a function that performs a transformation from -data domain to visual range. -
-
- -
-

pv.Scale.linear

- Represents a linear scale; a function that performs a linear -transformation. -
-
- -
-

pv.Scale.log

- Represents a log scale. -
-
- -
-

pv.Scale.ordinal

- Represents an ordinal scale. -
-
- -
-

pv.Scale.quantile

- Represents a quantile scale; a function that maps from a value within -a sortable domain to a quantized numeric range. -
-
- -
-

pv.Scale.quantitative

- Represents an abstract quantitative scale; a function that performs a -numeric transformation. -
-
- -
-

pv.Scale.root

- Represents a root scale; a function that performs a power -transformation. -
-
- -
-

pv.Simulation

- Represents a particle simulation. -
-
- -
-

pv.Transform

- Represents a transformation matrix. -
-
- -
-

pv.Tree

- Represents a tree operator for the specified array. -
-
- -
-

pv.Vector

- Represents a two-dimensional vector; a 2-tuple ⟨x, -y⟩. -
-
- -
-

pv.version

- Protovis major and minor version numbers. -
-
- -
-

pv.Wedge

- Represents a wedge, or pie slice. -
-
- - -
-
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:30 GMT-0700 (PDT) -
- - \ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/Array.html b/docs/lib/protovis-3.2/jsdoc/symbols/Array.html deleted file mode 100644 index 2a6348a3..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/Array.html +++ /dev/null @@ -1,688 +0,0 @@ - - - - - - - JsDoc Reference - Array - - - - - - - - - - - -
- - -
-

Classes

- -
- -
- -
- -

- - Built-In Class Array -

- - -

- - - - The built-in Array class. - - -

- - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
filter(f, o) -
-
Creates a new array with all elements that pass the test implemented by the -provided function.
-
  -
forEach(f, o) -
-
Executes a provided function once per array element.
-
  -
map(f, o) -
-
Creates a new array with the results of calling a provided function on every -element in this array.
-
  -
reduce(f, v) -
-
Apply a function against an accumulator and each value of the array (from -left-to-right) as to reduce it to a single value.
-
- - - - - - - - - - - - - - - -
- Method Detail -
- - -
- - - filter(f, o) - -
-
- Creates a new array with all elements that pass the test implemented by the -provided function. Implemented in Javascript 1.6. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
function to test each element of the array.
- -
- o - Optional -
-
object to use as this when executing f.
- -
- - - - - - - -
-
See:
- -
filter -documentation.
- -
- - -
- - -
- - - forEach(f, o) - -
-
- Executes a provided function once per array element. Implemented in -Javascript 1.6. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
function to execute for each element.
- -
- o - Optional -
-
object to use as this when executing f.
- -
- - - - - - - -
-
See:
- -
forEach -documentation.
- -
- - -
- - -
- - - map(f, o) - -
-
- Creates a new array with the results of calling a provided function on every -element in this array. Implemented in Javascript 1.6. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
function that produces an element of the new Array from -an element of the current one.
- -
- o - Optional -
-
object to use as this when executing f.
- -
- - - - - - - -
-
See:
- -
map -documentation.
- -
- - -
- - -
- - - reduce(f, v) - -
-
- Apply a function against an accumulator and each value of the array (from -left-to-right) as to reduce it to a single value. Implemented in Javascript -1.8. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
function to execute on each value in the array.
- -
- v - Optional -
-
object to use as the first argument to the first call of -t.
- -
- - - - - - - -
-
See:
- -
reduce -documentation.
- -
- - - - - - - - - -
- - - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:26 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/_global_.html b/docs/lib/protovis-3.2/jsdoc/symbols/_global_.html deleted file mode 100644 index 8e84a525..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/_global_.html +++ /dev/null @@ -1,415 +0,0 @@ - - - - - - - JsDoc Reference - _global_ - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Built-In Namespace _global_ -

- - -

- - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:26 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Anchor.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Anchor.html deleted file mode 100644 index 5cc4038f..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Anchor.html +++ /dev/null @@ -1,652 +0,0 @@ - - - - - - - JsDoc Reference - pv.Anchor - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Anchor -

- - -

- -
Extends - pv.Mark.
- - - Represents an anchor on a given mark. An anchor is itself a mark, but -without a visual representation. It serves only to provide useful default -properties that can be inherited by other marks. Each type of mark can define -any number of named anchors for convenience. If the concrete mark type does -not define an anchor implementation specifically, one will be inherited from -the mark's parent class. - -

For example, the bar mark provides anchors for its four sides: left, -right, top and bottom. Adding a label to the top anchor of a bar, - -

bar.anchor("top").add(pv.Label);
- -will render a text label on the top edge of the bar; the top anchor defines -the appropriate position properties (top and left), as well as text-rendering -properties for convenience (textAlign and textBaseline). - -

Note that anchors do not inherit from their targets; the positional -properties are copied from the scene graph, which guarantees that the anchors -are positioned correctly, even if the positional properties are not defined -deterministically. (In addition, it also improves performance by avoiding -re-evaluating expensive properties.) If you want the anchor to inherit from -the target, use pv.Mark#extend before adding. For example: - -

bar.anchor("top").extend(bar).add(pv.Label);
- -The anchor defines it's own positional properties, but other properties (such -as the title property, say) can be inherited using the above idiom. Also note -that you can override positional properties in the anchor for custom -behavior. - - -
Defined in: Anchor.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Anchor(target) -
-
Constructs a new mark anchor with default properties.
-
- - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- name -
-
The anchor name.
-
- - - -
-
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, defaults, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  - -
Returns the anchor target of this mark, if it is derived from an anchor; -otherwise returns null.
-
- - - -
-
Methods borrowed from class pv.Mark:
add, anchor, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Anchor(target) -
- -
- Constructs a new mark anchor with default properties. - -
- - - - - -
-
Parameters:
- -
- {pv.Mark} target - -
-
the anchor target.
- -
- - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {string} - name - -
-
- The anchor name. The set of supported anchor names is dependent on the -concrete mark type; see the mark type for details. For example, bars support -left, right, top and bottom anchors. - -

While anchor names are typically constants, the anchor name is a true -property, which means you can specify a function to compute the anchor name -dynamically. For instance, if you wanted to alternate top and bottom anchors, -saying - -

m.anchor(function() (this.index % 2) ? "top" : "bottom").add(pv.Dot);
- -would have the desired effect. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Mark} - anchorTarget() - -
-
- Returns the anchor target of this mark, if it is derived from an anchor; -otherwise returns null. For example, if a label is derived from a bar anchor, - -
bar.anchor("top").add(pv.Label);
- -then property functions on the label can refer to the bar via the -anchorTarget method. This method is also useful for mark types -defining properties on custom anchors. - - -
- - - - - - - - -
-
Returns:
- -
{pv.Mark} the anchor target of this mark; possibly null.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Area.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Area.html deleted file mode 100644 index c9c48afc..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Area.html +++ /dev/null @@ -1,953 +0,0 @@ - - - - - - - JsDoc Reference - pv.Area - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Area -

- - -

- -
Extends - pv.Mark.
- - - Represents an area mark: the solid area between two series of -connected line segments. Unsurprisingly, areas are used most frequently for -area charts. - -

Just as a line represents a polyline, the Area mark type -represents a polygon. However, an area is not an arbitrary polygon; -vertices are paired either horizontally or vertically into parallel -spans, and each span corresponds to an associated datum. Either the -width or the height must be specified, but not both; this determines whether -the area is horizontally-oriented or vertically-oriented. Like lines, areas -can be stroked and filled with arbitrary colors. - -

See also the Area guide. - - -
Defined in: Area.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Area() -
-
Constructs a new area mark with default properties.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- defaults -
-
Default properties for areas.
-
  -
- fillStyle -
-
The area fill style; if non-null, the interior of the polygon forming the -area is filled with the specified color.
-
  -
- height -
-
The height of a given span, in pixels; used for vertical spans.
-
  - -
How to interpolate between values.
-
  -
- lineWidth -
-
The width of stroked lines, in pixels; used in conjunction with -strokeStyle to stroke the perimeter of the area.
-
  -
- segmented -
-
Whether the area is segmented; whether variations in fill style, stroke -style, and the other properties are treated as fixed.
-
  - -
The style of stroked lines; used in conjunction with lineWidth to -stroke the perimeter of the area.
-
  -
- tension -
-
The tension of cardinal splines; used in conjunction with -interpolate("cardinal").
-
  -
- width -
-
The width of a given span, in pixels; used for horizontal spans.
-
- - - -
-
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
anchor(name) -
-
Constructs a new area anchor with default properties.
-
- - - -
-
Methods borrowed from class pv.Mark:
add, anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Area() -
- -
- Constructs a new area mark with default properties. Areas are not typically -constructed directly, but by adding to a panel or an existing mark via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {pv.Area} - defaults - -
-
- Default properties for areas. By default, there is no stroke and the fill -style is a categorical color. - - -
- - - - - - - - -
- - -
- - {string} - fillStyle - -
-
- The area fill style; if non-null, the interior of the polygon forming the -area is filled with the specified color. The default value of this property -is a categorical color. - -

This property is fixed for non-segmented areas. See -pv.Mark. - - -

- - - - - - -
-
See:
- -
pv.color
- -
- - - -
- - -
- - {number} - height - -
-
- The height of a given span, in pixels; used for vertical spans. If the height -is specified, the width property should be 0 (the default). Either the left -or right property should be used to space the spans horizontally, typically -as a multiple of the index. - - -
- - - - - - - - -
- - -
- - {string} - interpolate - -
-
- How to interpolate between values. Linear interpolation ("linear") is the -default, producing a straight line between points. For piecewise constant -functions (i.e., step functions), either "step-before" or "step-after" can be -specified. To draw open uniform b-splines, specify "basis". To draw cardinal -splines, specify "cardinal"; see also #tension. - -

This property is fixed. See pv.Mark. - - -

- - - - - - - - -
- - -
- - {number} - lineWidth - -
-
- The width of stroked lines, in pixels; used in conjunction with -strokeStyle to stroke the perimeter of the area. Unlike the -Line mark type, the entire perimeter is stroked, rather than just one -edge. The default value of this property is 1.5, but since the default stroke -style is null, area marks are not stroked by default. - -

This property is fixed for non-segmented areas. See -pv.Mark. - - -

- - - - - - - - -
- - -
- - {boolean} - segmented - -
-
- Whether the area is segmented; whether variations in fill style, stroke -style, and the other properties are treated as fixed. Rendering segmented -areas is noticeably slower than non-segmented areas. - -

This property is fixed. See pv.Mark. - - -

- - - - - - - - -
- - -
- - {string} - strokeStyle - -
-
- The style of stroked lines; used in conjunction with lineWidth to -stroke the perimeter of the area. Unlike the Line mark type, the -entire perimeter is stroked, rather than just one edge. The default value of -this property is null, meaning areas are not stroked by default. - -

This property is fixed for non-segmented areas. See -pv.Mark. - - -

- - - - - - -
-
See:
- -
pv.color
- -
- - - -
- - -
- - {number} - tension - -
-
- The tension of cardinal splines; used in conjunction with -interpolate("cardinal"). A value between 0 and 1 draws cardinal splines with -the given tension. In some sense, the tension can be interpreted as the -"length" of the tangent; a tension of 1 will yield all zero tangents (i.e., -linear interpolation), and a tension of 0 yields a Catmull-Rom spline. The -default value is 0.7. - -

This property is fixed. See pv.Mark. - - -

- - - - - - - - -
- - -
- - {number} - width - -
-
- The width of a given span, in pixels; used for horizontal spans. If the width -is specified, the height property should be 0 (the default). Either the top -or bottom property should be used to space the spans vertically, typically as -a multiple of the index. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Anchor} - anchor(name) - -
-
- Constructs a new area anchor with default properties. Areas support five -different anchors:In addition to positioning properties (left, right, top bottom), the -anchors support text rendering properties (text-align, text-baseline). Text -is rendered to appear inside the area. The area anchor also propagates the -interpolate, eccentricity, and tension properties such that an anchored area -or line will match positions between control points. - -

For consistency with the other mark types, the anchor positions are -defined in terms of their opposite edge. For example, the top anchor defines -the bottom property, such that an area added to the top anchor grows upward. - - -

- - - - -
-
Parameters:
- -
- {string} name - -
-
the anchor name; either a string or a property function.
- -
- - - - - -
-
Returns:
- -
{pv.Anchor}
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Bar.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Bar.html deleted file mode 100644 index 48c478c5..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Bar.html +++ /dev/null @@ -1,739 +0,0 @@ - - - - - - - JsDoc Reference - pv.Bar - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Bar -

- - -

- -
Extends - pv.Mark.
- - - Represents a bar: an axis-aligned rectangle that can be stroked and -filled. Bars are used for many chart types, including bar charts, histograms -and Gantt charts. Bars can also be used as decorations, for example to draw a -frame border around a panel; in fact, a panel is a special type (a subclass) -of bar. - -

Bars can be positioned in several ways. Most commonly, one of the four -corners is fixed using two margins, and then the width and height properties -determine the extent of the bar relative to this fixed location. For example, -using the bottom and left properties fixes the bottom-left corner; the width -then extends to the right, while the height extends to the top. As an -alternative to the four corners, a bar can be positioned exclusively using -margins; this is convenient as an inset from the containing panel, for -example. See pv.Mark for details on the prioritization of redundant -positioning properties. - -

See also the Bar guide. - - -
Defined in: Bar.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Bar() -
-
Constructs a new bar mark with default properties.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- defaults -
-
Default properties for bars.
-
  -
- fillStyle -
-
The bar fill style; if non-null, the interior of the bar is filled with the -specified color.
-
  -
- height -
-
The height of the bar, in pixels.
-
  -
- lineWidth -
-
The width of stroked lines, in pixels; used in conjunction with -strokeStyle to stroke the bar's border.
-
  - -
The style of stroked lines; used in conjunction with lineWidth to -stroke the bar's border.
-
  -
- width -
-
The width of the bar, in pixels.
-
- - - -
-
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - -
-
Methods borrowed from class pv.Mark:
add, anchor, anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Bar() -
- -
- Constructs a new bar mark with default properties. Bars are not typically -constructed directly, but by adding to a panel or an existing mark via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {pv.Bar} - defaults - -
-
- Default properties for bars. By default, there is no stroke and the fill -style is a categorical color. - - -
- - - - - - - - -
- - -
- - {string} - fillStyle - -
-
- The bar fill style; if non-null, the interior of the bar is filled with the -specified color. The default value of this property is a categorical color. - - -
- - - - - - -
-
See:
- -
pv.color
- -
- - - -
- - -
- - {number} - height - -
-
- The height of the bar, in pixels. If the bottom position is specified, the -bar extends upward from the bottom edge; if the top position is specified, -the bar extends downward from the top edge. - - -
- - - - - - - - -
- - -
- - {number} - lineWidth - -
-
- The width of stroked lines, in pixels; used in conjunction with -strokeStyle to stroke the bar's border. - - -
- - - - - - - - -
- - -
- - {string} - strokeStyle - -
-
- The style of stroked lines; used in conjunction with lineWidth to -stroke the bar's border. The default value of this property is null, meaning -bars are not stroked by default. - - -
- - - - - - -
-
See:
- -
pv.color
- -
- - - -
- - -
- - {number} - width - -
-
- The width of the bar, in pixels. If the left position is specified, the bar -extends rightward from the left edge; if the right position is specified, the -bar extends leftward from the right edge. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.drag.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.drag.html deleted file mode 100644 index 9e743272..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.drag.html +++ /dev/null @@ -1,534 +0,0 @@ - - - - - - - JsDoc Reference - pv.Behavior.drag - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Behavior.drag -

- - -

- -
Extends - pv.Behavior.
- - - Implements interactive dragging starting with mousedown events. -Register this behavior on marks that should be draggable by the user, such as -the selected region for brushing and linking. This behavior can be used in -tandom with pv.Behavior.select to allow the selected region to be -dragged interactively. - -

After the initial mousedown event is triggered, this behavior listens for -mousemove and mouseup events on the window. This allows dragging to continue -even if the mouse temporarily leaves the mark that is being dragged, or even -the root panel. - -

This behavior requires that the data associated with the mark being -dragged have x and y attributes that correspond to the -mark's location in pixels. The mark's positional properties are not set -directly by this behavior; instead, the positional properties should be -defined as: - -

    .left(function(d) d.x)
-    .top(function(d) d.y)
- -Thus, the behavior does not move the mark directly, but instead updates the -mark position by updating the underlying data. Note that if the positional -properties are defined with bottom and right (rather than top and left), the -drag behavior will be inverted, which will confuse users! - -

The drag behavior is bounded by the parent panel; the x and -y attributes are clamped such that the mark being dragged does not -extend outside the enclosing panel's bounds. To facilitate this, the drag -behavior also queries for dx and dy attributes on the -underlying data, to determine the dimensions of the bar being dragged. For -non-rectangular marks, the drag behavior simply treats the mark as a point, -which means that only the mark's center is bounded. - -

The mark being dragged is automatically re-rendered for each mouse event -as part of the drag operation. In addition, a fix attribute is -populated on the mark, which allows visual feedback for dragging. For -example, to change the mark fill color while dragging: - -

    .fillStyle(function(d) d.fix ? "#ff7f0e" : "#aec7e8")
- -In some cases, such as with network layouts, dragging the mark may cause -related marks to change, in which case additional marks may also need to be -rendered. This can be accomplished by listening for the drag -psuedo-events:For example, to render the parent panel while dragging, thus -re-rendering all sibling marks: - -
    .event("mousedown", pv.Behavior.drag())
-    .event("drag", function() this.parent)
- -This behavior may be enhanced in the future to allow more flexible -configuration of drag behavior. - - -
Defined in: Drag.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Returns a new drag behavior to be registered on mousedown events.
-
- - - - - - - - - - - - -
-
- Class Detail -
- -
- pv.Behavior.drag() -
- -
- Returns a new drag behavior to be registered on mousedown events. - -
- - - - - - - - - - - -
-
See:
- -
pv.Behavior
- -
pv.Behavior.select
- -
pv.Layout.force
- -
- - -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.html deleted file mode 100644 index 79f17bff..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.html +++ /dev/null @@ -1,501 +0,0 @@ - - - - - - - JsDoc Reference - pv.Behavior - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Behavior -

- - -

- -
Extends - function.
- - - Represents a reusable interaction; applies an interactive behavior to -a given mark. Behaviors are themselves functions designed to be used as event -handlers. For example, to add pan and zoom support to any panel, say: - -

    .event("mousedown", pv.Behavior.pan())
-    .event("mousewheel", pv.Behavior.zoom())
- -The behavior should be registered on the event that triggers the start of the -behavior. Typically, the behavior will take care of registering for any -additional events that are necessary. For example, dragging starts on -mousedown, while the drag behavior automatically listens for mousemove and -mouseup events on the window. By listening to the window, the behavior can -continue to receive mouse events even if the mouse briefly leaves the mark -being dragged, or even the root panel. - -

Each behavior implementation has specific requirements as to which events -it supports, and how it should be used. For example, the drag behavior -requires that the data associated with the mark be an object with x -and y attributes, such as a pv.Vector, storing the mark's -position. See an implementing class for details. - - -
Defined in: Behavior.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Behavior() -
-
Abstract; see an implementing class for details.
-
- - - - - - - - - - - - -
-
- Class Detail -
- -
- pv.Behavior() -
- -
- Abstract; see an implementing class for details. - -
- - - - - - - - - - - -
-
See:
- -
pv.Behavior.drag
- -
pv.Behavior.pan
- -
pv.Behavior.point
- -
pv.Behavior.select
- -
pv.Behavior.zoom
- -
- - -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.pan.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.pan.html deleted file mode 100644 index 08b290a6..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.pan.html +++ /dev/null @@ -1,592 +0,0 @@ - - - - - - - JsDoc Reference - pv.Behavior.pan - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Behavior.pan -

- - -

- -
Extends - pv.Behavior.
- - - Implements interactive panning starting with mousedown events. -Register this behavior on panels to allow panning. This behavior can be used -in tandem with pv.Behavior.zoom to allow both panning and zooming: - -

    .event("mousedown", pv.Behavior.pan())
-    .event("mousewheel", pv.Behavior.zoom())
- -The pan behavior currently supports only mouse events; support for keyboard -shortcuts to improve accessibility may be added in the future. - -

After the initial mousedown event is triggered, this behavior listens for -mousemove and mouseup events on the window. This allows panning to continue -even if the mouse temporarily leaves the panel that is being panned, or even -the root panel. - -

The implementation of this behavior relies on the panel's -transform property, which specifies a matrix transformation that is -applied to child marks. Note that the transform property only affects the -panel's children, but not the panel itself; therefore the panel's fill and -stroke will not change when the contents are panned. - -

Panels have transparent fill styles by default; this means that panels may -not receive the initial mousedown event to start panning. To fix this -problem, either given the panel a visible fill style (such as "white"), or -set the events property to "all" such that the panel receives events -despite its transparent fill. - -

The pan behavior has optional support for bounding. If enabled, the user -will not be able to pan the panel outside of the initial bounds. This feature -is designed to work in conjunction with the zoom behavior; otherwise, -bounding the panel effectively disables all panning. - - -
Defined in: Pan.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Returns a new pan behavior to be registered on mousedown events.
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
bound(x) -
-
Sets or gets the bound parameter.
-
- - - -
- -
- - - - - - - -
-
- Class Detail -
- -
- pv.Behavior.pan() -
- -
- Returns a new pan behavior to be registered on mousedown events. - -
- - - - - - - - - - - -
-
See:
- -
pv.Behavior.zoom
- -
pv.Panel#transform
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - {pv.Behavior.pan} - bound(x) - -
-
- Sets or gets the bound parameter. If bounding is enabled, the user will not -be able to pan outside the initial panel bounds; this typically applies -only when the pan behavior is used in tandem with the zoom behavior. -Bounding is not enabled by default. - -

Note: enabling bounding after panning has already occurred will not -immediately reset the transform. Bounding should be enabled before the -panning behavior is applied. - - -

- - - - -
-
Parameters:
- -
- {boolean} x - Optional -
-
the new bound parameter.
- -
- - - - - -
-
Returns:
- -
{pv.Behavior.pan} this, or the current bound parameter.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.point.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.point.html deleted file mode 100644 index d71446bd..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.point.html +++ /dev/null @@ -1,616 +0,0 @@ - - - - - - - JsDoc Reference - pv.Behavior.point - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Behavior.point -

- - -

- -
Extends - pv.Behavior.
- - - Implements interactive fuzzy pointing, identifying marks that are in -close proximity to the mouse cursor. This behavior is an alternative to the -native mouseover and mouseout events, improving usability. Rather than -requiring the user to mouseover a mark exactly, the mouse simply needs to -move near the given mark and a "point" event is triggered. In addition, if -multiple marks overlap, the point behavior can be used to identify the mark -instance closest to the cursor, as opposed to the one that is rendered on -top. - -

The point behavior can also identify the closest mark instance for marks -that produce a continuous graphic primitive. The point behavior can thus be -used to provide details-on-demand for both discrete marks (such as dots and -bars), as well as continuous marks (such as lines and areas). - -

This behavior is implemented by finding the closest mark instance to the -mouse cursor on every mousemove event. If this closest mark is within the -given radius threshold, which defaults to 30 pixels, a "point" psuedo-event -is dispatched to the given mark instance. If any mark were previously -pointed, it would receive a corresponding "unpoint" event. These two -psuedo-event types correspond to the native "mouseover" and "mouseout" -events, respectively. To increase the radius at which the point behavior can -be applied, specify an appropriate threshold to the constructor, up to -Infinity. - -

By default, the standard Cartesian distance is computed. However, with -some visualizations it is desirable to consider only a single dimension, such -as the x-dimension for an independent variable. In this case, the -collapse parameter can be set to collapse the y dimension: - -

    .event("mousemove", pv.Behavior.point(Infinity).collapse("y"))
- -

This behavior only listens to mousemove events on the assigned panel, -which is typically the root panel. The behavior will search recursively for -descendant marks to point. If the mouse leaves the assigned panel, the -behavior no longer receives mousemove events; an unpoint psuedo-event is -automatically dispatched to unpoint any pointed mark. Marks may be re-pointed -when the mouse reenters the panel. - -

Panels have transparent fill styles by default; this means that panels may -not receive the initial mousemove event to start pointing. To fix this -problem, either given the panel a visible fill style (such as "white"), or -set the events property to "all" such that the panel receives events -despite its transparent fill. - -

Note: this behavior does not currently wedge marks. - - -
Defined in: Point.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Returns a new point behavior to be registered on mousemove events.
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
collapse(x) -
-
Sets or gets the collapse parameter.
-
- - - -
- -
- - - - - - - -
-
- Class Detail -
- -
- pv.Behavior.point(r) -
- -
- Returns a new point behavior to be registered on mousemove events. - -
- - - - - -
-
Parameters:
- -
- {number} r - Optional -
-
the fuzzy radius threshold in pixels
- -
- - - - - - - -
-
See:
- -
"The Bubble Cursor: Enhancing Target Acquisition by Dynamic Resizing of the -Cursor's Activation Area" by T. Grossman & R. Balakrishnan, CHI 2005.
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - {pv.Behavior.point} - collapse(x) - -
-
- Sets or gets the collapse parameter. By default, the standard Cartesian -distance is computed. However, with some visualizations it is desirable to -consider only a single dimension, such as the x-dimension for an -independent variable. In this case, the collapse parameter can be set to -collapse the y dimension: - -
    .event("mousemove", pv.Behavior.point(Infinity).collapse("y"))
- - -
- - - - -
-
Parameters:
- -
- {string} x - Optional -
-
the new collapse parameter
- -
- - - - - -
-
Returns:
- -
{pv.Behavior.point} this, or the current collapse parameter.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.resize.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.resize.html deleted file mode 100644 index 4d1fdf10..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.resize.html +++ /dev/null @@ -1,536 +0,0 @@ - - - - - - - JsDoc Reference - pv.Behavior.resize - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Behavior.resize -

- - -

- -
Extends - pv.Behavior.
- - - Implements interactive resizing of a selection starting with mousedown -events. Register this behavior on selection handles that should be resizeable -by the user, such for brushing and linking. This behavior can be used in -tandom with pv.Behavior.select and pv.Behavior.drag to allow -the selected region to be selected and dragged interactively. - -

After the initial mousedown event is triggered, this behavior listens for -mousemove and mouseup events on the window. This allows resizing to continue -even if the mouse temporarily leaves the assigned panel, or even the root -panel. - -

This behavior requires that the data associated with the mark being -resized have x, y, dx and dy attributes -that correspond to the mark's location and dimensions in pixels. The mark's -positional properties are not set directly by this behavior; instead, the -positional properties should be defined as: - -

    .left(function(d) d.x)
-    .top(function(d) d.y)
-    .width(function(d) d.dx)
-    .height(function(d) d.dy)
- -Thus, the behavior does not resize the mark directly, but instead updates the -size by updating the assigned panel's underlying data. Note that if the -positional properties are defined with bottom and right (rather than top and -left), the resize behavior will be inverted, which will confuse users! - -

The resize behavior is bounded by the assigned mark's enclosing panel; the -positional attributes are clamped such that the selection does not extend -outside the panel's bounds. - -

The mark being resized is automatically re-rendered for each mouse event -as part of the resize operation. This behavior may be enhanced in the future -to allow more flexible configuration. In some cases, such as with parallel -coordinates, resizing the selection may cause related marks to change, in -which case additional marks may also need to be rendered. This can be -accomplished by listening for the select psuedo-events:

For example, to render the parent panel while resizing, thus -re-rendering all sibling marks: - -
    .event("mousedown", pv.Behavior.resize("left"))
-    .event("resize", function() this.parent)
- -This behavior may be enhanced in the future to allow more flexible -configuration of the selection behavior. - - -
Defined in: Resize.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Behavior.resize(side) -
-
Returns a new resize behavior to be registered on mousedown events.
-
- - - - - - - - - - - - -
-
- Class Detail -
- -
- pv.Behavior.resize(side) -
- -
- Returns a new resize behavior to be registered on mousedown events. - -
- - - - - -
-
Parameters:
- -
- side - -
-
- -
- - - - - - - -
-
See:
- -
pv.Behavior.select
- -
pv.Behavior.drag
- -
- - -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.select.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.select.html deleted file mode 100644 index a2bea66f..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.select.html +++ /dev/null @@ -1,523 +0,0 @@ - - - - - - - JsDoc Reference - pv.Behavior.select - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Behavior.select -

- - -

- -
Extends - pv.Behavior.
- - - Implements interactive selecting starting with mousedown events. -Register this behavior on panels that should be selectable by the user, such -for brushing and linking. This behavior can be used in tandom with -pv.Behavior.drag to allow the selected region to be dragged -interactively. - -

After the initial mousedown event is triggered, this behavior listens for -mousemove and mouseup events on the window. This allows selecting to continue -even if the mouse temporarily leaves the assigned panel, or even the root -panel. - -

This behavior requires that the data associated with the mark being -dragged have x, y, dx and dy attributes -that correspond to the mark's location and dimensions in pixels. The mark's -positional properties are not set directly by this behavior; instead, the -positional properties should be defined as: - -

    .left(function(d) d.x)
-    .top(function(d) d.y)
-    .width(function(d) d.dx)
-    .height(function(d) d.dy)
- -Thus, the behavior does not resize the mark directly, but instead updates the -selection by updating the assigned panel's underlying data. Note that if the -positional properties are defined with bottom and right (rather than top and -left), the drag behavior will be inverted, which will confuse users! - -

The select behavior is bounded by the assigned panel; the positional -attributes are clamped such that the selection does not extend outside the -panel's bounds. - -

The panel being selected is automatically re-rendered for each mouse event -as part of the drag operation. This behavior may be enhanced in the future to -allow more flexible configuration of select behavior. In some cases, such as -with parallel coordinates, making a selection may cause related marks to -change, in which case additional marks may also need to be rendered. This can -be accomplished by listening for the select psuedo-events:

For example, to render the parent panel while selecting, thus -re-rendering all sibling marks: - -
    .event("mousedown", pv.Behavior.drag())
-    .event("select", function() this.parent)
- -This behavior may be enhanced in the future to allow more flexible -configuration of the selection behavior. - - -
Defined in: Select.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Returns a new select behavior to be registered on mousedown events.
-
- - - - - - - - - - - - -
-
- Class Detail -
- -
- pv.Behavior.select() -
- -
- Returns a new select behavior to be registered on mousedown events. - -
- - - - - - - - - - - -
-
See:
- -
pv.Behavior.drag
- -
- - -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.zoom.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.zoom.html deleted file mode 100644 index 6ed10cf4..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Behavior.zoom.html +++ /dev/null @@ -1,602 +0,0 @@ - - - - - - - JsDoc Reference - pv.Behavior.zoom - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Behavior.zoom -

- - -

- -
Extends - pv.Behavior.
- - - Implements interactive zooming using mousewheel events. Register this -behavior on panels to allow zooming. This behavior can be used in tandem with -pv.Behavior.pan to allow both panning and zooming: - -

    .event("mousedown", pv.Behavior.pan())
-    .event("mousewheel", pv.Behavior.zoom())
- -The zoom behavior currently supports only mousewheel events; support for -keyboard shortcuts and gesture events to improve accessibility may be added -in the future. - -

The implementation of this behavior relies on the panel's -transform property, which specifies a matrix transformation that is -applied to child marks. Note that the transform property only affects the -panel's children, but not the panel itself; therefore the panel's fill and -stroke will not change when the contents are zoomed. The built-in support for -transforms only supports uniform scaling and translates, which is sufficient -for panning and zooming. Note that this is not a strict geometric -transformation, as the lineWidth property is scale-aware: strokes -are drawn at constant size independent of scale. - -

Panels have transparent fill styles by default; this means that panels may -not receive mousewheel events to zoom. To fix this problem, either given the -panel a visible fill style (such as "white"), or set the events -property to "all" such that the panel receives events despite its transparent -fill. - -

The zoom behavior has optional support for bounding. If enabled, the user -will not be able to zoom out farther than the initial bounds. This feature is -designed to work in conjunction with the pan behavior. - - -
Defined in: Zoom.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Behavior.zoom(speed) -
-
Returns a new zoom behavior to be registered on mousewheel events.
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
bound(x) -
-
Sets or gets the bound parameter.
-
- - - -
- -
- - - - - - - -
-
- Class Detail -
- -
- pv.Behavior.zoom(speed) -
- -
- Returns a new zoom behavior to be registered on mousewheel events. - -
- - - - - -
-
Parameters:
- -
- {number} speed - -
-
- -
- - - - - - - -
-
See:
- -
pv.Panel#transform
- -
pv.Mark#scale
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - {pv.Behavior.zoom} - bound(x) - -
-
- Sets or gets the bound parameter. If bounding is enabled, the user will not -be able to zoom out farther than the initial panel bounds. Bounding is not -enabled by default. If this behavior is used in tandem with the pan -behavior, both should use the same bound parameter. - -

Note: enabling bounding after zooming has already occurred will not -immediately reset the transform. Bounding should be enabled before the zoom -behavior is applied. - - -

- - - - -
-
Parameters:
- -
- {boolean} x - Optional -
-
the new bound parameter.
- -
- - - - - -
-
Returns:
- -
{pv.Behavior.zoom} this, or the current bound parameter.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Color.Hsl.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Color.Hsl.html deleted file mode 100644 index 0eff217e..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Color.Hsl.html +++ /dev/null @@ -1,907 +0,0 @@ - - - - - - - JsDoc Reference - pv.Color.Hsl - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Color.Hsl -

- - -

- -
Extends - pv.Color.
- - - Represents a color in HSL space. - - -
Defined in: Color.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Color.Hsl(h, s, l, a) -
-
Constructs a new HSL color with the specified values.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- a -
-
The opacity, a float in [0, 1].
-
  -
- h -
-
The hue, an integer in [0, 360].
-
  -
- l -
-
The lightness, a float in [0, 1].
-
  -
- s -
-
The saturation, a float in [0, 1].
-
- - - -
-
Fields borrowed from class pv.Color:
color, opacity
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
alpha(a) -
-
Constructs a new HSL color with the same hue, saturation and lightness as -this color, and the specified alpha.
-
  -
hue(h) -
-
Constructs a new HSL color with the same saturation, lightness and alpha as -this color, and the specified hue.
-
  -
lightness(l) -
-
Constructs a new HSL color with the same hue, saturation and alpha as this -color, and the specified lightness.
-
  -
rgb() -
-
Returns the RGB color equivalent to this HSL color.
-
  - -
Constructs a new HSL color with the same hue, lightness and alpha as this -color, and the specified saturation.
-
- - - -
-
Methods borrowed from class pv.Color:
brighter, darker
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Color.Hsl(h, s, l, a) -
- -
- Constructs a new HSL color with the specified values. - -
- - - - - -
-
Parameters:
- -
- {number} h - -
-
the hue, an integer in [0, 360].
- -
- {number} s - -
-
the saturation, a float in [0, 1].
- -
- {number} l - -
-
the lightness, a float in [0, 1].
- -
- {number} a - -
-
the opacity, a float in [0, 1].
- -
- - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {number} - a - -
-
- The opacity, a float in [0, 1]. - - -
- - - - - - - - -
- - -
- - {number} - h - -
-
- The hue, an integer in [0, 360]. - - -
- - - - - - - - -
- - -
- - {number} - l - -
-
- The lightness, a float in [0, 1]. - - -
- - - - - - - - -
- - -
- - {number} - s - -
-
- The saturation, a float in [0, 1]. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - - alpha(a) - -
-
- Constructs a new HSL color with the same hue, saturation and lightness as -this color, and the specified alpha. - - -
- - - - -
-
Parameters:
- -
- {number} a - -
-
the opacity, a float in [0, 1].
- -
- - - - - - - - -
- - -
- - - hue(h) - -
-
- Constructs a new HSL color with the same saturation, lightness and alpha as -this color, and the specified hue. - - -
- - - - -
-
Parameters:
- -
- {number} h - -
-
the hue, an integer in [0, 360].
- -
- - - - - - - - -
- - -
- - - lightness(l) - -
-
- Constructs a new HSL color with the same hue, saturation and alpha as this -color, and the specified lightness. - - -
- - - - -
-
Parameters:
- -
- {number} l - -
-
the lightness, a float in [0, 1].
- -
- - - - - - - - -
- - -
- - {pv.Color.Rgb} - rgb() - -
-
- Returns the RGB color equivalent to this HSL color. - - -
- - - - - - - - -
-
Returns:
- -
{pv.Color.Rgb} an RGB color.
- -
- - - - -
- - -
- - - saturation(s) - -
-
- Constructs a new HSL color with the same hue, lightness and alpha as this -color, and the specified saturation. - - -
- - - - -
-
Parameters:
- -
- {number} s - -
-
the saturation, a float in [0, 1].
- -
- - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Color.Rgb.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Color.Rgb.html deleted file mode 100644 index ad02f294..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Color.Rgb.html +++ /dev/null @@ -1,1033 +0,0 @@ - - - - - - - JsDoc Reference - pv.Color.Rgb - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Color.Rgb -

- - -

- -
Extends - pv.Color.
- - - Represents a color in RGB space. - - -
Defined in: Color.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Color.Rgb(r, g, b, a) -
-
Constructs a new RGB color with the specified channel values.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- a -
-
The alpha channel, a float in [0, 1].
-
  -
- b -
-
The blue channel, an integer in [0, 255].
-
  -
- g -
-
The green channel, an integer in [0, 255].
-
  -
- r -
-
The red channel, an integer in [0, 255].
-
- - - -
-
Fields borrowed from class pv.Color:
color, opacity
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
alpha(a) -
-
Constructs a new RGB color with the same red, green and blue channels as this -color, with the specified alpha channel.
-
  -
blue(b) -
-
Constructs a new RGB color with the same red, green and alpha channels as -this color, with the specified blue channel.
-
  -
brighter(k) -
-
Returns a new color that is a brighter version of this color.
-
  -
darker(k) -
-
Returns a new color that is a darker version of this color.
-
  -
green(g) -
-
Constructs a new RGB color with the same red, blue and alpha channels as this -color, with the specified green channel.
-
  -
red(r) -
-
Constructs a new RGB color with the same green, blue and alpha channels as -this color, with the specified red channel.
-
  -
rgb() -
-
Returns this.
-
- - - -
- -
- - - - - - - -
-
- Class Detail -
- -
- pv.Color.Rgb(r, g, b, a) -
- -
- Constructs a new RGB color with the specified channel values. - -
- - - - - -
-
Parameters:
- -
- {number} r - -
-
the red channel, an integer in [0,255].
- -
- {number} g - -
-
the green channel, an integer in [0,255].
- -
- {number} b - -
-
the blue channel, an integer in [0,255].
- -
- {number} a - -
-
the alpha channel, a float in [0,1].
- -
- - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {number} - a - -
-
- The alpha channel, a float in [0, 1]. - - -
- - - - - - - - -
- - -
- - {number} - b - -
-
- The blue channel, an integer in [0, 255]. - - -
- - - - - - - - -
- - -
- - {number} - g - -
-
- The green channel, an integer in [0, 255]. - - -
- - - - - - - - -
- - -
- - {number} - r - -
-
- The red channel, an integer in [0, 255]. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - - alpha(a) - -
-
- Constructs a new RGB color with the same red, green and blue channels as this -color, with the specified alpha channel. - - -
- - - - -
-
Parameters:
- -
- {number} a - -
-
the alpha channel, a float in [0,1].
- -
- - - - - - - - -
- - -
- - - blue(b) - -
-
- Constructs a new RGB color with the same red, green and alpha channels as -this color, with the specified blue channel. - - -
- - - - -
-
Parameters:
- -
- {number} b - -
-
the blue channel, an integer in [0,255].
- -
- - - - - - - - -
- - -
- - {pv.Color.Rgb} - brighter(k) - -
-
- Returns a new color that is a brighter version of this color. This method -applies an arbitrary scale factor to each of the three RGB components of this -color to create a brighter version of this color. Although brighter and -darker are inverse operations, the results of a series of invocations of -these two methods might be inconsistent because of rounding errors. - - -
- - - - -
-
Parameters:
- -
- k - Optional -
-
{number} an optional scale factor; defaults to 1.
- -
- - - - - -
-
Returns:
- -
{pv.Color.Rgb} a brighter color.
- -
- - - -
-
See:
- -
#darker
- -
- - -
- - -
- - {pv.Color.Rgb} - darker(k) - -
-
- Returns a new color that is a darker version of this color. This method -applies an arbitrary scale factor to each of the three RGB components of this -color to create a darker version of this color. Although brighter and darker -are inverse operations, the results of a series of invocations of these two -methods might be inconsistent because of rounding errors. - - -
- - - - -
-
Parameters:
- -
- k - Optional -
-
{number} an optional scale factor; defaults to 1.
- -
- - - - - -
-
Returns:
- -
{pv.Color.Rgb} a darker color.
- -
- - - -
-
See:
- -
#brighter
- -
- - -
- - -
- - - green(g) - -
-
- Constructs a new RGB color with the same red, blue and alpha channels as this -color, with the specified green channel. - - -
- - - - -
-
Parameters:
- -
- {number} g - -
-
the green channel, an integer in [0,255].
- -
- - - - - - - - -
- - -
- - - red(r) - -
-
- Constructs a new RGB color with the same green, blue and alpha channels as -this color, with the specified red channel. - - -
- - - - -
-
Parameters:
- -
- {number} r - -
-
the red channel, an integer in [0,255].
- -
- - - - - - - - -
- - -
- - {pv.Color.Rgb} - rgb() - -
-
- Returns this. - - -
- - - - - - - - -
-
Returns:
- -
{pv.Color.Rgb} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Color.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Color.html deleted file mode 100644 index f38d4135..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Color.html +++ /dev/null @@ -1,784 +0,0 @@ - - - - - - - JsDoc Reference - pv.Color - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Color -

- - -

- - - - Represents an abstract (possibly translucent) color. The color is -divided into two parts: the color attribute, an opaque color format -string, and the opacity attribute, a float in [0, 1]. The color -space is dependent on the implementing class; all colors support the -#rgb method to convert to RGB color space for interpolation. - -

See also the Color guide. - - -
Defined in: Color.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Color(color, opacity) -
-
Constructs a color with the specified color format string and opacity.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- color -
-
An opaque color format string, such as "#f00".
-
  -
- opacity -
-
The opacity, a float in [0, 1].
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
brighter(k) -
-
Returns a new color that is a brighter version of this color.
-
  -
darker(k) -
-
Returns a new color that is a brighter version of this color.
-
  -
rgb() -
-
Returns the RGB color equivalent to this color.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Color(color, opacity) -
- -
- Constructs a color with the specified color format string and opacity. This -constructor should not be invoked directly; use pv.color instead. - -
- - - - - -
-
Parameters:
- -
- {string} color - -
-
an opaque color format string, such as "#f00".
- -
- {number} opacity - -
-
the opacity, in [0,1].
- -
- - - - - - - -
-
See:
- -
pv.color
- -
- - -
- - - - -
- Field Detail -
- - -
- - {string} - color - -
-
- An opaque color format string, such as "#f00". - - -
- - - - - - -
-
See:
- -
SVG color -keywords
- -
CSS3 color module
- -
- - - -
- - -
- - {number} - opacity - -
-
- The opacity, a float in [0, 1]. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Color} - brighter(k) - -
-
- Returns a new color that is a brighter version of this color. The behavior of -this method may vary slightly depending on the underlying color space. -Although brighter and darker are inverse operations, the results of a series -of invocations of these two methods might be inconsistent because of rounding -errors. - - -
- - - - -
-
Parameters:
- -
- k - Optional -
-
{number} an optional scale factor; defaults to 1.
- -
- - - - - -
-
Returns:
- -
{pv.Color} a brighter color.
- -
- - - -
-
See:
- -
#darker
- -
- - -
- - -
- - {pv.Color} - darker(k) - -
-
- Returns a new color that is a brighter version of this color. The behavior of -this method may vary slightly depending on the underlying color space. -Although brighter and darker are inverse operations, the results of a series -of invocations of these two methods might be inconsistent because of rounding -errors. - - -
- - - - -
-
Parameters:
- -
- k - Optional -
-
{number} an optional scale factor; defaults to 1.
- -
- - - - - -
-
Returns:
- -
{pv.Color} a darker color.
- -
- - - -
-
See:
- -
#brighter
- -
- - -
- - -
- - {pv.Color.Rgb} - rgb() - -
-
- Returns the RGB color equivalent to this color. This method is abstract and -must be implemented by subclasses. - - -
- - - - - - - - -
-
Returns:
- -
{pv.Color.Rgb} an RGB color.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Colors.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Colors.html deleted file mode 100644 index 3884e11d..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Colors.html +++ /dev/null @@ -1,723 +0,0 @@ - - - - - - - JsDoc Reference - pv.Colors - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Namespace pv.Colors -

- - -

- - - - A collection of standard color palettes for categorical encoding. - - -
Defined in: Colors.js. - -

- - - - - - - - - - - - - - - - - -
Namespace Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Colors -
-
A collection of standard color palettes for categorical encoding.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
<static>   -
pv.Colors.category10() -
-
Returns a new 10-color scheme.
-
<static>   -
pv.Colors.category19() -
-
Returns a new alternative 19-color scheme.
-
<static>   -
pv.Colors.category20() -
-
Returns a new 20-color scheme.
-
- - - - - - - - - -
-
- Namespace Detail -
- -
- pv.Colors -
- -
- A collection of standard color palettes for categorical encoding. - -
- - - - - - - - - - - - -
- - - - - - - -
- Method Detail -
- - -
<static> - - {pv.Scale.ordinal} - pv.Colors.category10() - -
-
- Returns a new 10-color scheme. The arguments to this constructor are -optional, and equivalent to calling pv.Scale.OrdinalScale#domain. The -following colors are used: - -
#1f77b4
-
#ff7f0e
-
#2ca02c
-
#d62728
-
#9467bd
-
#8c564b
-
#e377c2
-
#7f7f7f
-
#bcbd22
-
#17becf
- - -
- - - - -
-
Parameters:
- -
- {number...} domain... - -
-
domain values.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.ordinal} a new ordinal color scale.
- -
- - - -
-
See:
- -
pv.color
- -
- - -
- - -
<static> - - {pv.Scale.ordinal} - pv.Colors.category19() - -
-
- Returns a new alternative 19-color scheme. The arguments to this constructor -are optional, and equivalent to calling -pv.Scale.OrdinalScale#domain. The following colors are used: - -
#9c9ede
-
#7375b5
-
#4a5584
-
#cedb9c
-
#b5cf6b
-
#8ca252
-
#637939
-
#e7cb94
-
#e7ba52
-
#bd9e39
-
#8c6d31
-
#e7969c
-
#d6616b
-
#ad494a
-
#843c39
-
#de9ed6
-
#ce6dbd
-
#a55194
-
#7b4173
- - -
- - - - -
-
Parameters:
- -
- {number...} domain... - -
-
domain values.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.ordinal} a new ordinal color scale.
- -
- - - -
-
See:
- -
pv.color
- -
- - -
- - -
<static> - - {pv.Scale.ordinal} - pv.Colors.category20() - -
-
- Returns a new 20-color scheme. The arguments to this constructor are -optional, and equivalent to calling pv.Scale.OrdinalScale#domain. The -following colors are used: - -
#1f77b4
-
#aec7e8
-
#ff7f0e
-
#ffbb78
-
#2ca02c
-
#98df8a
-
#d62728
-
#ff9896
-
#9467bd
-
#c5b0d5
-
#8c564b
-
#c49c94
-
#e377c2
-
#f7b6d2
-
#7f7f7f
-
#c7c7c7
-
#bcbd22
-
#dbdb8d
-
#17becf
-
#9edae5
- - -
- - - - -
-
Parameters:
- -
- {number...} domain... - -
-
domain values.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.ordinal} a new ordinal color scale.
- -
- - - -
-
See:
- -
pv.color
- -
- - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Constraint.bound.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Constraint.bound.html deleted file mode 100644 index 79befa93..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Constraint.bound.html +++ /dev/null @@ -1,672 +0,0 @@ - - - - - - - JsDoc Reference - pv.Constraint.bound - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Constraint.bound -

- - -

- -
Extends - pv.Constraint.
- - - Constrains particles to within fixed rectangular bounds. For example, -this constraint can be used to constrain particles in a physics simulation -within the bounds of an enclosing panel. - -

Note that the current implementation treats particles as points, with no -area. If the particles are rendered as dots, be sure to include some -additional padding to inset the bounds such that the edges of the dots do not -get clipped by the panel bounds. If the particles have different radii, this -constraint would need to be extended using a radius function, similar to -pv.Constraint.collision. - - -
Defined in: BoundConstraint.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new bound constraint.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
apply(particles) -
-
Applies this constraint to the specified particles.
-
  -
x(min, max) -
-
Sets or gets the bounds on the x-coordinate.
-
  -
y(min, max) -
-
Sets or gets the bounds on the y-coordinate.
-
- - - -
- -
- - - - - - - -
-
- Class Detail -
- -
- pv.Constraint.bound() -
- -
- Constructs a new bound constraint. Before the constraint can be used, the -#x and #y methods must be call to specify the bounds. - -
- - - - - - - - - - - -
-
See:
- -
pv.Layout.Force
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - - apply(particles) - -
-
- Applies this constraint to the specified particles. - - -
- - - - -
-
Parameters:
- -
- {pv.Particle} particles - -
-
particles to which to apply this constraint.
- -
- - - - - - - - -
- - -
- - {pv.Constraint.bound} - x(min, max) - -
-
- Sets or gets the bounds on the x-coordinate. - - -
- - - - -
-
Parameters:
- -
- {number} min - -
-
the minimum allowed x-coordinate.
- -
- {number} max - -
-
the maximum allowed x-coordinate.
- -
- - - - - -
-
Returns:
- -
{pv.Constraint.bound} this.
- -
- - - - -
- - -
- - {pv.Constraint.bound} - y(min, max) - -
-
- Sets or gets the bounds on the y-coordinate. - - -
- - - - -
-
Parameters:
- -
- {number} min - -
-
the minimum allowed y-coordinate.
- -
- {number} max - -
-
the maximum allowed y-coordinate.
- -
- - - - - -
-
Returns:
- -
{pv.Constraint.bound} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Constraint.collision.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Constraint.collision.html deleted file mode 100644 index e561ae76..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Constraint.collision.html +++ /dev/null @@ -1,624 +0,0 @@ - - - - - - - JsDoc Reference - pv.Constraint.collision - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Constraint.collision -

- - -

- - - - Constraints circles to avoid overlap. Each particle is treated as a -circle, with the radius of the particle computed using a specified function. -For example, if the particle has an r attribute storing the radius, -the radius function(d) d.r specifies a collision constraint using -this radius. The radius function is passed each pv.Particle as the -first argument. - -

To accelerate collision detection, this implementation uses a quadtree and -a search radius. The search radius is computed as the maximum radius of all -particles in the simulation. - - -
Defined in: CollisionConstraint.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new collision constraint.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
apply(particles, q) -
-
Applies this constraint to the specified particles.
-
  -
repeat(x) -
-
Sets or gets the repeat count.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Constraint.collision(radius) -
- -
- Constructs a new collision constraint. The default search radius is 10, and -the default repeat count is 1. A radius function must be specified to compute -the radius of particles. - -
- - - - - -
-
Parameters:
- -
- {function} radius - -
-
the radius function.
- -
- - - - - - - -
-
See:
- -
pv.Constraint
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - - apply(particles, q) - -
-
- Applies this constraint to the specified particles. - - -
- - - - -
-
Parameters:
- -
- {pv.Particle} particles - -
-
particles to which to apply this constraint.
- -
- {pv.Quadtree} q - -
-
a quadtree for spatial acceleration.
- -
- - - - - - - - -
- - -
- - {pv.Constraint.collision} - repeat(x) - -
-
- Sets or gets the repeat count. If the repeat count is greater than 1, the -constraint will be applied repeatedly; this is a form of the Gauss-Seidel -method for constraints relaxation. Repeating the collision constraint makes -the constraint have more of an effect when there is a potential for many -co-occurring collisions. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the number of times to repeat this constraint.
- -
- - - - - -
-
Returns:
- -
{pv.Constraint.collision} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Constraint.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Constraint.html deleted file mode 100644 index 36701bce..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Constraint.html +++ /dev/null @@ -1,565 +0,0 @@ - - - - - - - JsDoc Reference - pv.Constraint - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Constraint -

- - -

- - - - Represents a constraint that acts on particles. Note that this -interface does not specify how to bind a constraint to specific particles; in -general, constraints are applied globally to all particles. However, some -constraints may be applied to specific particles or between particles, such -as position constraints, through additional specialization. - - -
Defined in: Constraint.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Abstract; see an implementing class.
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
apply(particles, q) -
-
Applies this constraint to the specified particles.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Constraint() -
- -
- Abstract; see an implementing class. - -
- - - - - - - - - - - -
-
See:
- -
pv.Simulation
- -
pv.Particle
- -
pv.Constraint.bound
- -
pv.Constraint.collision
- -
pv.Constraint.position
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - {pv.Constraint} - apply(particles, q) - -
-
- Applies this constraint to the specified particles. - - -
- - - - -
-
Parameters:
- -
- {pv.Particle} particles - -
-
particles to which to apply this constraint.
- -
- {pv.Quadtree} q - -
-
a quadtree for spatial acceleration.
- -
- - - - - -
-
Returns:
- -
{pv.Constraint} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Constraint.position.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Constraint.position.html deleted file mode 100644 index e7127453..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Constraint.position.html +++ /dev/null @@ -1,619 +0,0 @@ - - - - - - - JsDoc Reference - pv.Constraint.position - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Constraint.position -

- - -

- - - - Constraints particles to a fixed position. The fixed position per -particle is determined using a given position function, which defaults to -function(d) d.fix. - -

If the position function returns null, then no position constraint is -applied to the given particle. Otherwise, the particle's position is set to -the returned position, as expressed by a pv.Vector. (Note: the -position does not need to be an instance of pv.Vector, but simply an -object with x and y attributes.) - -

This constraint also supports a configurable alpha parameter, which -defaults to 1. If the alpha parameter is in the range [0,1], then rather than -setting the particle's new position directly to the position returned by the -supplied position function, the particle's position is interpolated towards -the fixed position. This results is a smooth (exponential) drift towards the -fixed position, which can increase the stability of the physics simulation. -In addition, the alpha parameter can be decayed over time, relaxing the -position constraint, which helps to stabilize on an optimal solution. - - -
Defined in: PositionConstraint.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a default position constraint using the fix attribute.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
alpha(x) -
-
Sets or gets the alpha parameter for position interpolation.
-
  -
apply(particles) -
-
Applies this constraint to the specified particles.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Constraint.position(f) -
- -
- Constructs a default position constraint using the fix attribute. -An optional position function can be specified to determine how the fixed -position per-particle is determined. - -
- - - - - -
-
Parameters:
- -
- {function} f - Optional -
-
the position function.
- -
- - - - - - - - -
- - - - - - - -
- Method Detail -
- - -
- - {pv.Constraint.position} - alpha(x) - -
-
- Sets or gets the alpha parameter for position interpolation. If the alpha -parameter is in the range [0,1], then rather than setting the particle's -new position directly to the position returned by the supplied position -function, the particle's position is interpolated towards the fixed -position. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the new alpha parameter, in the range [0,1].
- -
- - - - - -
-
Returns:
- -
{pv.Constraint.position} this.
- -
- - - - -
- - -
- - - apply(particles) - -
-
- Applies this constraint to the specified particles. - - -
- - - - -
-
Parameters:
- -
- {pv.Particle} particles - -
-
particles to which to apply this constraint.
- -
- - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Dom.Node.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Dom.Node.html deleted file mode 100644 index a542f7f6..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Dom.Node.html +++ /dev/null @@ -1,1219 +0,0 @@ - - - - - - - JsDoc Reference - pv.Dom.Node - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Dom.Node -

- - -

- - - - Represents a Node in the W3C Document Object Model. - - -
Defined in: Dom.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Dom.Node(value) -
-
Constructs a DOM node for the specified value.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  - -
The first child, which is null for leaf nodes.
-
  -
- lastChild -
-
The last child, which is null for leaf nodes.
-
  - -
The next sibling node, which is null for the last child.
-
  - -
The parent node, which is null for root nodes.
-
  - -
The previous sibling node, which is null for the first child.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  - -
Appends the specified child node to this node.
-
  -
insertBefore(n, r) -
-
Inserts the specified child n before the given reference child -r of this node.
-
  -
nodes() -
-
Returns all descendants of this node in preorder traversal.
-
  - -
Removes the specified child node from this node.
-
  -
replaceChild(n, r) -
-
Replaces the specified child r of this node with the node n.
-
  -
reverse() -
-
Reverses all sibling nodes.
-
  -
sort(f) -
-
Sorts child nodes of this node, and all descendent nodes recursively, using -the specified comparator function f.
-
  -
toggle(recursive) -
-
Toggles the child nodes of this node.
-
  - -
Visits each node in the tree in postorder traversal, applying the specified -function f.
-
  - -
Visits each node in the tree in preorder traversal, applying the specified -function f.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Dom.Node(value) -
- -
- Constructs a DOM node for the specified value. Instances of this class are -not typically created directly; instead they are generated from a JavaScript -map using the pv.Dom operator. - -
- - - - - -
-
Parameters:
- -
- value - -
-
- -
- - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {pv.Dom.Node} - firstChild - -
-
- The first child, which is null for leaf nodes. - - -
- - - - - - - - -
- - -
- - {pv.Dom.Node} - lastChild - -
-
- The last child, which is null for leaf nodes. - - -
- - - - - - - - -
- - -
- - {pv.Dom.Node} - nextSibling - -
-
- The next sibling node, which is null for the last child. - - -
- - - - - - - - -
- - -
- - {pv.Dom.Node} - parentNode - -
-
- The parent node, which is null for root nodes. - - -
- - - - - - - - -
- - -
- - {pv.Dom.Node} - previousSibling - -
-
- The previous sibling node, which is null for the first child. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Dom.Node} - appendChild(n) - -
-
- Appends the specified child node to this node. If the specified child is -already part of the DOM, the child is first removed before being added to -this node. - - -
- - - - -
-
Parameters:
- -
- n - -
-
- -
- - - - - -
-
Returns:
- -
{pv.Dom.Node} the appended child.
- -
- - - - -
- - -
- - {pv.Dom.Node} - insertBefore(n, r) - -
-
- Inserts the specified child n before the given reference child -r of this node. If r is null, this method is equivalent to -#appendChild. If n is already part of the DOM, it is first -removed before being inserted. - - -
- - - - -
-
Parameters:
- -
- n - -
-
- -
- r - -
-
- -
- - - - -
-
Throws:
- -
- -
-
Error if r is non-null and not a child of this node.
- -
- - -
-
Returns:
- -
{pv.Dom.Node} the inserted child.
- -
- - - - -
- - -
- - - nodes() - -
-
- Returns all descendants of this node in preorder traversal. - - -
- - - - - - - - - - - -
- - -
- - {pv.Dom.Node} - removeChild(n) - -
-
- Removes the specified child node from this node. - - -
- - - - -
-
Parameters:
- -
- n - -
-
- -
- - - - -
-
Throws:
- -
- -
-
Error if the specified child is not a child of this node.
- -
- - -
-
Returns:
- -
{pv.Dom.Node} the removed child.
- -
- - - - -
- - -
- - - replaceChild(n, r) - -
-
- Replaces the specified child r of this node with the node n. If -n is already part of the DOM, it is first removed before being added. - - -
- - - - -
-
Parameters:
- -
- n - -
-
- -
- r - -
-
- -
- - - - -
-
Throws:
- -
- -
-
Error if r is not a child of this node.
- -
- - - - - -
- - -
- - - reverse() - -
-
- Reverses all sibling nodes. - - -
- - - - - - - - -
-
Returns:
- -
this.
- -
- - - - -
- - -
- - - sort(f) - -
-
- Sorts child nodes of this node, and all descendent nodes recursively, using -the specified comparator function f. The comparator function is -passed two nodes to compare. - -

Note: during the sort operation, the comparator function should not rely -on the tree being well-formed; the values of previousSibling and -nextSibling for the nodes being compared are not defined during the -sort operation. - - -

- - - - -
-
Parameters:
- -
- {function} f - -
-
a comparator function.
- -
- - - - - -
-
Returns:
- -
this.
- -
- - - - -
- - -
- - - toggle(recursive) - -
-
- Toggles the child nodes of this node. If this node is not yet toggled, this -method removes all child nodes and appends them to a new toggled -array attribute on this node. Otherwise, if this node is toggled, this method -re-adds all toggled child nodes and deletes the toggled attribute. - -

This method has no effect if the node has no child nodes. - - -

- - - - -
-
Parameters:
- -
- {boolean} recursive - Optional -
-
whether the toggle should apply to descendants.
- -
- - - - - - - - -
- - -
- - - visitAfter(f) - -
-
- Visits each node in the tree in postorder traversal, applying the specified -function f. The arguments to the function are:
    - -
  1. The current node. -
  2. The current depth, starting at 0 for the root node.
- - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
a function to apply to each node.
- -
- - - - - - - - -
- - -
- - - visitBefore(f) - -
-
- Visits each node in the tree in preorder traversal, applying the specified -function f. The arguments to the function are:
    - -
  1. The current node. -
  2. The current depth, starting at 0 for the root node.
- - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
a function to apply to each node.
- -
- - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Dom.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Dom.html deleted file mode 100644 index 8591116f..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Dom.html +++ /dev/null @@ -1,657 +0,0 @@ - - - - - - - JsDoc Reference - pv.Dom - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Dom -

- - -

- - - - Represets a DOM operator for the specified map. This allows easy -transformation of a hierarchical JavaScript object (such as a JSON map) to a -W3C Document Object Model hierarchy. For more information on which attributes -and methods from the specification are supported, see pv.Dom.Node. - -

Leaves in the map are determined using an associated leaf function; -see #leaf. By default, leaves are any value whose type is not -"object", such as numbers or strings. - - -
Defined in: Dom.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Dom(map) -
-
Constructs a DOM operator for the specified map.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
leaf(f) -
-
Sets or gets the leaf function for this DOM operator.
-
  -
nodes() -
-
Applies the DOM operator, returning the array of all nodes in preorder -traversal.
-
  -
root(nodeName) -
-
Applies the DOM operator, returning the root node.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Dom(map) -
- -
- Constructs a DOM operator for the specified map. This constructor should not -be invoked directly; use pv.dom instead. - -
- - - - - -
-
Parameters:
- -
- map - -
-
a map from which to construct a DOM.
- -
- - - - - - - - -
- - - - - - - -
- Method Detail -
- - -
- - - leaf(f) - -
-
- Sets or gets the leaf function for this DOM operator. The leaf function -identifies which values in the map are leaves, and which are internal nodes. -By default, objects are considered internal nodes, and primitives (such as -numbers and strings) are considered leaves. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
the new leaf function.
- -
- - - - - -
-
Returns:
- -
the current leaf function, or this.
- -
- - - - -
- - -
- - {array} - nodes() - -
-
- Applies the DOM operator, returning the array of all nodes in preorder -traversal. - - -
- - - - - - - - -
-
Returns:
- -
{array} the array of nodes in preorder traversal.
- -
- - - - -
- - -
- - {pv.Dom.Node} - root(nodeName) - -
-
- Applies the DOM operator, returning the root node. - - -
- - - - -
-
Parameters:
- -
- {string} nodeName - Optional -
-
optional node name for the root.
- -
- - - - - -
-
Returns:
- -
{pv.Dom.Node} the root node.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Dot.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Dot.html deleted file mode 100644 index 0f200743..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Dot.html +++ /dev/null @@ -1,913 +0,0 @@ - - - - - - - JsDoc Reference - pv.Dot - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Dot -

- - -

- -
Extends - pv.Mark.
- - - Represents a dot; a dot is simply a sized glyph centered at a given -point that can also be stroked and filled. The size property is -proportional to the area of the rendered glyph to encourage meaningful visual -encodings. Dots can visually encode up to eight dimensions of data, though -this may be unwise due to integrality. See pv.Mark for details on the -prioritization of redundant positioning properties. - -

See also the Dot guide. - - -
Defined in: Dot.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Dot() -
-
Constructs a new dot mark with default properties.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- angle -
-
The rotation angle, in radians.
-
  -
- defaults -
-
Default properties for dots.
-
  -
- fillStyle -
-
The fill style; if non-null, the interior of the dot is filled with the -specified color.
-
  -
- lineWidth -
-
The width of stroked lines, in pixels; used in conjunction with -strokeStyle to stroke the dot's shape.
-
  -
- radius -
-
The radius of the dot, in pixels.
-
  -
- shape -
-
The shape name.
-
  -
- size -
-
The size of the dot, in square pixels.
-
  - -
The style of stroked lines; used in conjunction with lineWidth to -stroke the dot's shape.
-
- - - -
-
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
anchor(name) -
-
Constructs a new dot anchor with default properties.
-
- - - -
-
Methods borrowed from class pv.Mark:
add, anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Dot() -
- -
- Constructs a new dot mark with default properties. Dots are not typically -constructed directly, but by adding to a panel or an existing mark via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {number} - angle - -
-
- The rotation angle, in radians. Used to rotate shapes, such as to turn a -cross into a plus. - - -
- - - - - - - - -
- - -
- - {pv.Dot} - defaults - -
-
- Default properties for dots. By default, there is no fill and the stroke -style is a categorical color. The default shape is "circle" with size 20. - - -
- - - - - - - - -
- - -
- - {string} - fillStyle - -
-
- The fill style; if non-null, the interior of the dot is filled with the -specified color. The default value of this property is null, meaning dots are -not filled by default. - - -
- - - - - - -
-
See:
- -
pv.color
- -
- - - -
- - -
- - {number} - lineWidth - -
-
- The width of stroked lines, in pixels; used in conjunction with -strokeStyle to stroke the dot's shape. - - -
- - - - - - - - -
- - -
- - {number} - radius - -
-
- The radius of the dot, in pixels. This is an alternative to using -#size. - - -
- - - - - - -
-
See:
- -
#size
- -
- - - -
- - -
- - {string} - shape - -
-
- The shape name. Several shapes are supported:These shapes can be further changed using the #angle property; -for instance, a cross can be turned into a plus by rotating. Similarly, the -tick, which is vertical by default, can be rotated horizontally. Note that -some shapes (cross and tick) do not have interior areas, and thus do not -support fill style meaningfully. - -

Note: it may be more natural to use the pv.Rule mark for -horizontal and vertical ticks. The tick shape is only necessary if angled -ticks are needed. - - -

- - - - - - - - -
- - -
- - {number} - size - -
-
- The size of the dot, in square pixels. Square pixels are used such that the -area of the dot is linearly proportional to the value of the size property, -facilitating representative encodings. - - -
- - - - - - -
-
See:
- -
#radius
- -
- - - -
- - -
- - {string} - strokeStyle - -
-
- The style of stroked lines; used in conjunction with lineWidth to -stroke the dot's shape. The default value of this property is a categorical -color. - - -
- - - - - - -
-
See:
- -
pv.color
- -
- - - - - - - - - -
- Method Detail -
- - -
- - {pv.Anchor} - anchor(name) - -
-
- Constructs a new dot anchor with default properties. Dots support five -different anchors:In addition to positioning properties (left, right, top bottom), the -anchors support text rendering properties (text-align, text-baseline). Text is -rendered to appear outside the dot. Note that this behavior is different from -other mark anchors, which default to rendering text inside the mark. - -

For consistency with the other mark types, the anchor positions are -defined in terms of their opposite edge. For example, the top anchor defines -the bottom property, such that a bar added to the top anchor grows upward. - - -

- - - - -
-
Parameters:
- -
- {string} name - -
-
the anchor name; either a string or a property function.
- -
- - - - - -
-
Returns:
- -
{pv.Anchor}
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Flatten.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Flatten.html deleted file mode 100644 index afb2fa0d..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Flatten.html +++ /dev/null @@ -1,699 +0,0 @@ - - - - - - - JsDoc Reference - pv.Flatten - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Flatten -

- - -

- - - - Represents a flatten operator for the specified array. Flattening -allows hierarchical maps to be flattened into an array. The levels in the -input tree are specified by key functions. - -

For example, consider the following hierarchical data structure of Barley -yields, from various sites in Minnesota during 1931-2: - -

{ 1931: {
-    Manchuria: {
-      "University Farm": 27.00,
-      "Waseca": 48.87,
-      "Morris": 27.43,
-      ... },
-    Glabron: {
-      "University Farm": 43.07,
-      "Waseca": 55.20,
-      ... } },
-  1932: {
-    ... } }
- -To facilitate visualization, it may be useful to flatten the tree into a -tabular array: - -
var array = pv.flatten(yields)
-    .key("year")
-    .key("variety")
-    .key("site")
-    .key("yield")
-    .array();
- -This returns an array of object elements. Each element in the array has -attributes corresponding to this flatten operator's keys: - -
{ site: "University Farm", variety: "Manchuria", year: 1931, yield: 27 },
-{ site: "Waseca", variety: "Manchuria", year: 1931, yield: 48.87 },
-{ site: "Morris", variety: "Manchuria", year: 1931, yield: 27.43 },
-{ site: "University Farm", variety: "Glabron", year: 1931, yield: 43.07 },
-{ site: "Waseca", variety: "Glabron", year: 1931, yield: 55.2 }, ...
- -

The flatten operator is roughly the inverse of the pv.Nest and -pv.Tree operators. - - -
Defined in: Flatten.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Flatten(map) -
-
Constructs a flatten operator for the specified map.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
array() -
-
Returns the flattened array.
-
  -
key(key, f) -
-
Flattens using the specified key function.
-
  -
leaf(f) -
-
Flattens using the specified leaf function.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Flatten(map) -
- -
- Constructs a flatten operator for the specified map. This constructor should -not be invoked directly; use pv.flatten instead. - -
- - - - - -
-
Parameters:
- -
- map - -
-
a map to flatten.
- -
- - - - - - - - -
- - - - - - - -
- Method Detail -
- - -
- - - array() - -
-
- Returns the flattened array. Each entry in the array is an object; each -object has attributes corresponding to this flatten operator's keys. - - -
- - - - - - - - -
-
Returns:
- -
an array of elements from the flattened map.
- -
- - - - -
- - -
- - {pv.Nest} - key(key, f) - -
-
- Flattens using the specified key function. Multiple keys may be added to the -flatten; the tiers of the underlying tree must correspond to the specified -keys, in order. The order of the returned array is undefined; however, you -can easily sort it. - - -
- - - - -
-
Parameters:
- -
- {string} key - -
-
the key name.
- -
- {function} f - Optional -
-
an optional value map function.
- -
- - - - - -
-
Returns:
- -
{pv.Nest} this.
- -
- - - - -
- - -
- - {pv.Nest} - leaf(f) - -
-
- Flattens using the specified leaf function. This is an alternative to -specifying an explicit set of keys; the tiers of the underlying tree will be -determined dynamically by recursing on the values, and the resulting keys -will be stored in the entries keys attribute. The leaf function must -return true for leaves, and false for internal nodes. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
a leaf function.
- -
- - - - - -
-
Returns:
- -
{pv.Nest} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Force.charge.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Force.charge.html deleted file mode 100644 index 5a2e8264..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Force.charge.html +++ /dev/null @@ -1,743 +0,0 @@ - - - - - - - JsDoc Reference - pv.Force.charge - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Force.charge -

- - -

- - - - An n-body force, as defined by Coulomb's law or Newton's law of -gravitation, inversely proportional to the square of the distance between -particles. Note that the force is independent of the mass of the -associated particles, and that the particles do not have charges of varying -magnitude; instead, the attraction or repulsion of all particles is globally -specified as the charge #constant. - -

This particular implementation uses the Barnes-Hut algorithm. For details, -see "A -hierarchical O(N log N) force-calculation algorithm", J. Barnes & -P. Hut, Nature 1986. - - -
Defined in: ChargeForce.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new charge force, with an optional charge constant.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
apply(particles, q) -
-
Applies this force to the specified particles.
-
  -
constant(x) -
-
Sets or gets the charge constant.
-
  -
domain(a, b) -
-
Sets or gets the domain; specifies the minimum and maximum domain within -which charge forces are applied.
-
  -
theta(x) -
-
Sets or gets the Barnes-Hut approximation factor.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Force.charge(k) -
- -
- Constructs a new charge force, with an optional charge constant. The charge -constant can be negative for repulsion (e.g., particles with electrical -charge of equal sign), or positive for attraction (e.g., massive particles -with mutual gravity). The default charge constant is -40. - -
- - - - - -
-
Parameters:
- -
- {number} k - Optional -
-
the charge constant.
- -
- - - - - - - - -
- - - - - - - -
- Method Detail -
- - -
- - - apply(particles, q) - -
-
- Applies this force to the specified particles. The force is applied between -all pairs of particles within the domain, using the specified quadtree to -accelerate n-body force calculation using the Barnes-Hut approximation -criterion. - - -
- - - - -
-
Parameters:
- -
- {pv.Particle} particles - -
-
particles to which to apply this force.
- -
- {pv.Quadtree} q - -
-
a quadtree for spatial acceleration.
- -
- - - - - - - - -
- - -
- - {pv.Force.charge} - constant(x) - -
-
- Sets or gets the charge constant. If an argument is specified, it is the -new charge constant. The charge constant can be negative for repulsion -(e.g., particles with electrical charge of equal sign), or positive for -attraction (e.g., massive particles with mutual gravity). The default -charge constant is -40. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the charge constant.
- -
- - - - - -
-
Returns:
- -
{pv.Force.charge} this.
- -
- - - - -
- - -
- - {pv.Force.charge} - domain(a, b) - -
-
- Sets or gets the domain; specifies the minimum and maximum domain within -which charge forces are applied. A minimum distance threshold avoids -applying forces that are two strong (due to granularity of the simulation's -numeric integration). A maximum distance threshold improves performance by -skipping force calculations for particles that are far apart. - -

The default domain is [2, 500]. - - -

- - - - -
-
Parameters:
- -
- {number} a - -
-
- -
- {number} b - -
-
- -
- - - - - -
-
Returns:
- -
{pv.Force.charge} this.
- -
- - - - -
- - -
- - {pv.Force.charge} - theta(x) - -
-
- Sets or gets the Barnes-Hut approximation factor. The Barnes-Hut -approximation criterion is the ratio of the size of the quadtree node to -the distance from the point to the node's center of mass is beneath some -threshold. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the new Barnes-Hut approximation factor.
- -
- - - - - -
-
Returns:
- -
{pv.Force.charge} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Force.drag.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Force.drag.html deleted file mode 100644 index d58524e7..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Force.drag.html +++ /dev/null @@ -1,615 +0,0 @@ - - - - - - - JsDoc Reference - pv.Force.drag - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Force.drag -

- - -

- -
Extends - pv.Force.
- - - Implements a drag force, simulating friction. The drag force is -applied in the opposite direction of the particle's velocity. Since Position -Verlet integration does not track velocities explicitly, the error term with -this estimate of velocity is fairly high, so the drag force may be -inaccurate. - - -
Defined in: DragForce.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Force.drag(k) -
-
Constructs a new drag force with the specified constant.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
apply(particles) -
-
Applies this force to the specified particles.
-
  -
constant(x) -
-
Sets or gets the drag constant, in the range [0,1].
-
- - - -
- -
- - - - - - - -
-
- Class Detail -
- -
- pv.Force.drag(k) -
- -
- Constructs a new drag force with the specified constant. - -
- - - - - -
-
Parameters:
- -
- {number} k - -
-
the drag constant.
- -
- - - - - - - -
-
See:
- -
#constant
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - - apply(particles) - -
-
- Applies this force to the specified particles. - - -
- - - - -
-
Parameters:
- -
- {pv.Particle} particles - -
-
particles to which to apply this force.
- -
- - - - - - - - -
- - -
- - {pv.Force.drag} - constant(x) - -
-
- Sets or gets the drag constant, in the range [0,1]. The default drag -constant is 0.1. The drag forces scales linearly with the particle's -velocity based on the given drag constant. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the new drag constant.
- -
- - - - - -
-
Returns:
- -
{pv.Force.drag} this, or the current drag constant.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Force.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Force.html deleted file mode 100644 index e6b69f56..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Force.html +++ /dev/null @@ -1,558 +0,0 @@ - - - - - - - JsDoc Reference - pv.Force - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Force -

- - -

- - - - Represents a force that acts on particles. Note that this interface -does not specify how to bind a force to specific particles; in general, -forces are applied globally to all particles. However, some forces may be -applied to specific particles or between particles, such as spring forces, -through additional specialization. - - -
Defined in: Force.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Force() -
-
Abstract; see an implementing class.
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
apply(particles, q) -
-
Applies this force to the specified particles.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Force() -
- -
- Abstract; see an implementing class. - -
- - - - - - - - - - - -
-
See:
- -
pv.Simulation
- -
pv.Particle
- -
pv.Force.charge
- -
pv.Force.drag
- -
pv.Force.spring
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - - apply(particles, q) - -
-
- Applies this force to the specified particles. - - -
- - - - -
-
Parameters:
- -
- {pv.Particle} particles - -
-
particles to which to apply this force.
- -
- {pv.Quadtree} q - -
-
a quadtree for spatial acceleration.
- -
- - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Force.spring.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Force.spring.html deleted file mode 100644 index 0e8cf878..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Force.spring.html +++ /dev/null @@ -1,791 +0,0 @@ - - - - - - - JsDoc Reference - pv.Force.spring - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Force.spring -

- - -

- -
Extends - pv.Force.
- - - Implements a spring force, per Hooke's law. The spring force can be -configured with a tension constant, rest length, and damping factor. The -tension and damping will automatically be normalized using the inverse square -root of the maximum link degree of attached nodes; this makes springs weaker -between nodes of high link degree. - -

Unlike other forces (such as charge and drag forces) which may be applied -globally, spring forces are only applied between linked particles. Therefore, -an array of links must be specified before this force can be applied; the -links should be an array of pv.Layout.Network.Links. See also -pv.Layout.Force for an example of using spring and charge forces for -network layout. - - -
Defined in: SpringForce.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new spring force with the specified constant.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
apply(particles) -
-
Applies this force to the specified particles.
-
  -
constant(x) -
-
Sets or gets the spring constant.
-
  -
damping(x) -
-
The spring damping factor, in the range [0,1].
-
  -
length(x) -
-
The spring rest length.
-
  -
links(x) -
-
Sets or gets the links associated with this spring force.
-
- - - -
- -
- - - - - - - -
-
- Class Detail -
- -
- pv.Force.spring(k) -
- -
- Constructs a new spring force with the specified constant. The links -associated with this spring force must be specified before the spring force -can be applied. - -
- - - - - -
-
Parameters:
- -
- {number} k - -
-
the spring constant.
- -
- - - - - - - -
-
See:
- -
#constant
- -
#links
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - - apply(particles) - -
-
- Applies this force to the specified particles. - - -
- - - - -
-
Parameters:
- -
- {pv.Particle} particles - -
-
particles to which to apply this force.
- -
- - - - - - - - -
- - -
- - {pv.Force.spring} - constant(x) - -
-
- Sets or gets the spring constant. The default value is 0.1; greater values -will result in stronger tension. The spring tension is automatically -normalized using the inverse square root of the maximum link degree of -attached nodes. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the new spring constant.
- -
- - - - - -
-
Returns:
- -
{pv.Force.spring} this, or the current spring constant.
- -
- - - - -
- - -
- - {pv.Force.spring} - damping(x) - -
-
- The spring damping factor, in the range [0,1]. Damping functions -identically to drag forces, damping spring bounciness by applying a force -in the opposite direction of attached nodes' velocities. The default value -is 0.1. The spring damping is automatically normalized using the inverse -square root of the maximum link degree of attached nodes. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the new spring damping factor.
- -
- - - - - -
-
Returns:
- -
{pv.Force.spring} this, or the current spring damping factor.
- -
- - - - -
- - -
- - {pv.Force.spring} - length(x) - -
-
- The spring rest length. The default value is 20 pixels. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the new spring rest length.
- -
- - - - - -
-
Returns:
- -
{pv.Force.spring} this, or the current spring rest length.
- -
- - - - -
- - -
- - {pv.Force.spring} - links(x) - -
-
- Sets or gets the links associated with this spring force. Unlike other -forces (such as charge and drag forces) which may be applied globally, -spring forces are only applied between linked particles. Therefore, an -array of links must be specified before this force can be applied; the -links should be an array of pv.Layout.Network.Links. - - -
- - - - -
-
Parameters:
- -
- {array} x - -
-
the new array of links.
- -
- - - - - -
-
Returns:
- -
{pv.Force.spring} this, or the current array of links.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Format.date.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Format.date.html deleted file mode 100644 index b10de0d8..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Format.date.html +++ /dev/null @@ -1,682 +0,0 @@ - - - - - - - JsDoc Reference - pv.Format.date - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Format.date -

- - -

- -
Extends - pv.Format.
- - - The format string is in the same format expected by the -strftime function in C. The following conversion specifications are -supported:

The following conversion specifications are currently unsupported -for formatting:In addition, the following conversion specifications are currently -unsupported for parsing: - - -
Defined in: DateFormat.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Format.date(pattern) -
-
Constructs a new date format with the specified string pattern.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
format(date) -
-
Converts a date to a string using the associated formatting pattern.
-
  -
parse(s) -
-
Parses a date from a string using the associated formatting pattern.
-
- - - -
- -
- - - - - - - -
-
- Class Detail -
- -
- pv.Format.date(pattern) -
- -
- Constructs a new date format with the specified string pattern. - -
- - - - - -
-
Parameters:
- -
- {string} pattern - -
-
the format pattern.
- -
- - - - - - - -
-
See:
- -
strftime -documentation.
- -
strptime -documentation.
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - {string} - format(date) - -
-
- Converts a date to a string using the associated formatting pattern. - - -
- - - - -
-
Parameters:
- -
- {Date} date - -
-
a date to format.
- -
- - - - - -
-
Returns:
- -
{string} the formatted date as a string.
- -
- - - - -
- - -
- - {Date} - parse(s) - -
-
- Parses a date from a string using the associated formatting pattern. - - -
- - - - -
-
Parameters:
- -
- {string} s - -
-
the string to parse as a date.
- -
- - - - - -
-
Returns:
- -
{Date} the parsed date.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Format.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Format.html deleted file mode 100644 index 4e336289..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Format.html +++ /dev/null @@ -1,627 +0,0 @@ - - - - - - - JsDoc Reference - pv.Format - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Format -

- - -

- - - - Represents an abstract text formatter and parser. A format is a -function that converts an object of a given type, such as a Date, to -a human-readable string representation. The format may also have a -#parse method for converting a string representation back to the -given object type. - -

Because formats are themselves functions, they can be used directly as -mark properties. For example, if the data associated with a label are dates, -a date format can be used as label text: - -

    .text(pv.Format.date("%m/%d/%y"))
- -And as with scales, if the format is used in multiple places, it can be -convenient to declare it as a global variable and then reference it from the -appropriate property functions. For example, if the data has a date -attribute, and format references a given date format: - -
    .text(function(d) format(d.date))
- -Similarly, to parse a string into a date: - -
var date = format.parse("4/30/2010");
- -Not all format implementations support parsing. See the implementing class -for details. - - -
Defined in: Format.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Format() -
-
Abstract; see an implementing class.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
format(x) -
-
Formats the specified object, returning the string representation.
-
  -
parse(x) -
-
Parses the specified string, returning the object representation.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Format() -
- -
- Abstract; see an implementing class. - -
- - - - - - - - - - - -
-
See:
- -
pv.Format.date
- -
pv.Format.number
- -
pv.Format.time
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - {string} - format(x) - -
-
- Formats the specified object, returning the string representation. - - -
- - - - -
-
Parameters:
- -
- {object} x - -
-
the object to format.
- -
- - - - - -
-
Returns:
- -
{string} the formatted string.
- -
- - - - -
- - -
- - {object} - parse(x) - -
-
- Parses the specified string, returning the object representation. - - -
- - - - -
-
Parameters:
- -
- {string} x - -
-
the string to parse.
- -
- - - - - -
-
Returns:
- -
{object} the parsed object.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Format.number.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Format.number.html deleted file mode 100644 index 1784c6ec..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Format.number.html +++ /dev/null @@ -1,741 +0,0 @@ - - - - - - - JsDoc Reference - pv.Format.number - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Format.number -

- - -

- - - - Represents a number format, converting between a number and a -string. This class allows numbers to be formatted with variable -precision (both for the integral and fractional part of the number), optional -thousands grouping, and optional padding. The thousands (",") and decimal -(".") separator can be customized. - - -
Defined in: NumberFormat.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Returns a default number format.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
format(x) -
-
-
  -
fractionDigits(min, max) -
-
Sets or gets the minimum and maximum number of fraction digits.
-
  -
integerDigits(min, max) -
-
Sets or gets the minimum and maximum number of integer digits.
-
  -
parse(x) -
-
Parses the specified string as a number.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Format.number() -
- -
- Returns a default number format. - -
- - - - - - - - - -
-
Returns:
- -
{pv.Format.number} a number format.
- -
- - - - -
- - - - - - - -
- Method Detail -
- - -
- - {string} - format(x) - -
-
- - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
- -
- - - - - -
-
Returns:
- -
{string}
- -
- - - - -
- - -
- - {pv.Format.number} - fractionDigits(min, max) - -
-
- Sets or gets the minimum and maximum number of fraction digits. The -controls the number of decimal digits to display after the decimal -separator for the fractional part of the number. If the number of digits is -smaller than the minimum, the digits are padded; if the number of digits is -larger, the fractional part is rounded, showing only the higher-order -digits. The default range is [0, 0]. - -

If only one argument is specified to this method, this value is used as -both the minimum and maximum number. If no arguments are specified, a -two-element array is returned containing the minimum and the maximum. - - -

- - - - -
-
Parameters:
- -
- {number} min - Optional -
-
the minimum fraction digits.
- -
- {number} max - Optional -
-
the maximum fraction digits.
- -
- - - - - -
-
Returns:
- -
{pv.Format.number} this, or the current fraction digits.
- -
- - - - -
- - -
- - {pv.Format.number} - integerDigits(min, max) - -
-
- Sets or gets the minimum and maximum number of integer digits. This -controls the number of decimal digits to display before the decimal -separator for the integral part of the number. If the number of digits is -smaller than the minimum, the digits are padded; if the number of digits is -larger, the digits are truncated, showing only the lower-order digits. The -default range is [0, Infinity]. - -

If only one argument is specified to this method, this value is used as -both the minimum and maximum number. If no arguments are specified, a -two-element array is returned containing the minimum and the maximum. - - -

- - - - -
-
Parameters:
- -
- {number} min - Optional -
-
the minimum integer digits.
- -
- {number} max - Optional -
-
the maximum integer digits.
- -
- - - - - -
-
Returns:
- -
{pv.Format.number} this, or the current integer digits.
- -
- - - - -
- - -
- - {number} - parse(x) - -
-
- Parses the specified string as a number. Before parsing, leading and -trailing padding is removed. Group separators are also removed, and the -decimal separator is replaced with the standard point ("."). The integer -part is truncated per the maximum integer digits, and the fraction part is -rounded per the maximum fraction digits. - - -
- - - - -
-
Parameters:
- -
- {string} x - -
-
the string to parse.
- -
- - - - - -
-
Returns:
- -
{number} the parsed number.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Format.time.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Format.time.html deleted file mode 100644 index c4b7565d..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Format.time.html +++ /dev/null @@ -1,613 +0,0 @@ - - - - - - - JsDoc Reference - pv.Format.time - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Format.time -

- - -

- -
Extends - pv.Format.
- - - Represents a time format, converting between a number -representing a duration in milliseconds, and a string. Two types of -time formats are supported: "short" and "long". The short format type -returns a string such as "3.3 days" or "12.1 minutes", while the long -format returns "13:04:12" or similar. - - -
Defined in: TimeFormat.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Format.time(type) -
-
Returns a time format of the given type, either "short" or "long".
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
format(t) -
-
Formats the specified time, returning the string representation.
-
  -
parse(s) -
-
Parses the specified string, returning the time in milliseconds.
-
- - - -
- -
- - - - - - - -
-
- Class Detail -
- -
- pv.Format.time(type) -
- -
- Returns a time format of the given type, either "short" or "long". - -
- - - - - -
-
Parameters:
- -
- {string} type - -
-
the type; "short" or "long".
- -
- - - - - - - - -
- - - - - - - -
- Method Detail -
- - -
- - {string} - format(t) - -
-
- Formats the specified time, returning the string representation. - - -
- - - - -
-
Parameters:
- -
- {number} t - -
-
the duration in milliseconds. May also be a Date.
- -
- - - - - -
-
Returns:
- -
{string} the formatted string.
- -
- - - - -
- - -
- - {number} - parse(s) - -
-
- Parses the specified string, returning the time in milliseconds. - - -
- - - - -
-
Parameters:
- -
- {string} s - -
-
a formatted string.
- -
- - - - - -
-
Returns:
- -
{number} the parsed duration in milliseconds.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.LatLng.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.LatLng.html deleted file mode 100644 index aec7b943..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.LatLng.html +++ /dev/null @@ -1,560 +0,0 @@ - - - - - - - JsDoc Reference - pv.Geo.LatLng - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Geo.LatLng -

- - -

- - - - Represents a pair of geographic coordinates. - - -
Defined in: LatLng.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Abstract; not implemented.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- lat -
-
The latitude coordinate in degrees; positive is North.
-
  -
- lng -
-
The longitude coordinate in degrees; positive is East.
-
- - - - - - - - - - - - -
-
- Class Detail -
- -
- pv.Geo.LatLng() -
- -
- Abstract; not implemented. There is no explicit constructor; this class -merely serves to document the representation used by pv.Geo.scale. - -
- - - - - - - - - - - -
-
See:
- -
pv.Geo.scale
- -
- - -
- - - - -
- Field Detail -
- - -
- - {number} - lat - -
-
- The latitude coordinate in degrees; positive is North. - - -
- - - - - - - - -
- - -
- - {number} - lng - -
-
- The longitude coordinate in degrees; positive is East. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.Projection.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.Projection.html deleted file mode 100644 index 97e180db..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.Projection.html +++ /dev/null @@ -1,616 +0,0 @@ - - - - - - - JsDoc Reference - pv.Geo.Projection - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Geo.Projection -

- - -

- - - - Represents a geographic projection. This class provides the core -implementation for pv.Geo.scales, mapping between geographic -coordinates (latitude and longitude) and normalized screen space in the range -[-1,1]. The remaining mapping between normalized screen space and actual -pixels is performed by pv.Geo.scale. - -

Many geographic projections have a point around which the projection is -centered. Rather than have each implementation add support for a -user-specified center point, the pv.Geo.scale translates the -geographic coordinates relative to the center point for both the forward and -inverse projection. - -

In general, this class should not be used directly, unless the desire is -to implement a new geographic projection. Instead, use pv.Geo.scale. -Implementations are not required to implement inverse projections, but are -needed for some forms of interactivity. Also note that some inverse -projections are ambiguous, such as the connecting points in Dymaxian maps. - - -
Defined in: Projection.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Abstract; not implemented.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
invert(xy) -
-
The inverse projection; optional.
-
  -
project(latlng) -
-
The forward projection.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Geo.Projection() -
- -
- Abstract; not implemented. There is no explicit constructor; this class -merely serves to document the representation used by pv.Geo.scale. - -
- - - - - - - - - - - -
-
See:
- -
pv.Geo.scale
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - {pv.Geo.LatLng} - invert(xy) - -
-
- The inverse projection; optional. - - -
- - - - -
-
Parameters:
- -
- {pv.Vector} xy - -
-
the x- and y-coordinates to invert.
- -
- - - - - -
-
Returns:
- -
{pv.Geo.LatLng} the latitude and longitude of the given point.
- -
- - - - -
- - -
- - {pv.Vector} - project(latlng) - -
-
- The forward projection. - - -
- - - - -
-
Parameters:
- -
- {pv.Geo.LatLng} latlng - -
-
the latitude and longitude to project.
- -
- - - - - -
-
Returns:
- -
{pv.Vector} the xy-coordinates of the given point.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.projections.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.projections.html deleted file mode 100644 index 324748b0..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.projections.html +++ /dev/null @@ -1,803 +0,0 @@ - - - - - - - JsDoc Reference - pv.Geo.projections - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Namespace pv.Geo.projections -

- - -

- - - - - - -
Defined in: Projections.js. - -

- - - - - - - - - - - - - - - - - -
Namespace Summary
Constructor AttributesConstructor Name and Description
  - -
The built-in projections.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
<static>   -
- pv.Geo.projections.aitoff -
-
-
<static>   -
- pv.Geo.projections.hammer -
-
-
<static>   -
- pv.Geo.projections.identity -
-
The identity or "none" projection.
-
<static>   -
- pv.Geo.projections.mercator -
-
-
<static>   -
- pv.Geo.projections.sinusoidal -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
<static>   -
pv.Geo.projections.invert(xy) -
-
-
<static>   -
pv.Geo.projections.project(latlng) -
-
-
- - - - - - - - - -
-
- Namespace Detail -
- -
- pv.Geo.projections -
- -
- The built-in projections. - -
- - - - - - - - - - - -
-
See:
- -
pv.Geo.Projection
- -
- - -
- - - - -
- Field Detail -
- - -
<static> - - - pv.Geo.projections.aitoff - -
-
- - - -
- - - - - - -
-
See:
- -
http://en.wikipedia.org/wiki/Aitoff_projection
- -
- - - -
- - -
<static> - - - pv.Geo.projections.hammer - -
-
- - - -
- - - - - - -
-
See:
- -
http://en.wikipedia.org/wiki/Hammer_projection
- -
- - - -
- - -
<static> - - - pv.Geo.projections.identity - -
-
- The identity or "none" projection. - - -
- - - - - - - - -
- - -
<static> - - - pv.Geo.projections.mercator - -
-
- - - -
- - - - - - -
-
See:
- -
http://en.wikipedia.org/wiki/Mercator_projection
- -
- - - -
- - -
<static> - - - pv.Geo.projections.sinusoidal - -
-
- - - -
- - - - - - -
-
See:
- -
http://en.wikipedia.org/wiki/Sinusoidal_projection
- -
- - - - - - - - - -
- Method Detail -
- - -
<static> - - - pv.Geo.projections.invert(xy) - -
-
- - - -
- - - - -
-
Parameters:
- -
- xy - -
-
- -
- - - - - - - - -
- - -
<static> - - - pv.Geo.projections.project(latlng) - -
-
- - - -
- - - - -
-
Parameters:
- -
- latlng - -
-
- -
- - - - - - - -
-
See:
- -
http://en.wikipedia.org/wiki/Gall-Peters_projection
- -
- - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.scale#ticks.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.scale#ticks.html deleted file mode 100644 index f997054a..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.scale#ticks.html +++ /dev/null @@ -1,616 +0,0 @@ - - - - - - - JsDoc Reference - pv.Geo.scale#ticks - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Namespace pv.Geo.scale#ticks -

- - -

- - - - Tick functions for geographic scales. Because geographic scales -represent two-dimensional transformations (as opposed to one-dimensional -transformations typical of other scales), the tick values are similarly -represented as two-dimensional coordinates in the input domain, i.e., -pv.Geo.LatLng objects. - -

Also, note that non-rectilinear projections, such as sinsuoidal and -aitoff, may not produce straight lines for constant longitude or constant -latitude. Therefore the returned array of ticks is a two-dimensional array, -sampling various latitudes as constant longitude, and vice versa. - -

The tick lines can therefore be approximated as polylines, either with -"linear" or "cardinal" interpolation. This is not as accurate as drawing -the true curve through the projection space, but is usually sufficient. - - -
Defined in: GeoScale.js. - -

- - - - - - - - - - - - - - - - - -
Namespace Summary
Constructor AttributesConstructor Name and Description
  - -
Abstract; this is a local namespace on a given geographic scale.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
lat(m) -
-
Returns latitude ticks.
-
  -
lng(m) -
-
Returns longitude ticks.
-
- - - - - - - - - -
-
- Namespace Detail -
- -
- pv.Geo.scale#ticks -
- -
- Abstract; this is a local namespace on a given geographic scale. - -
- - - - - - - - - - - -
-
See:
- -
pv.Geo.scale
- -
pv.Geo.LatLng
- -
pv.Line#interpolate
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - {array} - lat(m) - -
-
- Returns latitude ticks. - - -
- - - - -
-
Parameters:
- -
- {number} m - Optional -
-
the desired number of ticks.
- -
- - - - - -
-
Returns:
- -
{array} a nested array of pv.Geo.LatLng ticks.
- -
- - - - -
- - -
- - {array} - lng(m) - -
-
- Returns longitude ticks. - - -
- - - - -
-
Parameters:
- -
- {number} m - Optional -
-
the desired number of ticks.
- -
- - - - - -
-
Returns:
- -
{array} a nested array of pv.Geo.LatLng ticks.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.scale.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.scale.html deleted file mode 100644 index d0fe5658..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Geo.scale.html +++ /dev/null @@ -1,786 +0,0 @@ - - - - - - - JsDoc Reference - pv.Geo.scale - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Geo.scale -

- - -

- - - - Represents a geographic scale; a mapping between latitude-longitude -coordinates and screen pixel coordinates. By default, the domain is inferred -from the geographic coordinates, so that the domain fills the output range. - -

Note that geographic scales are two-dimensional transformations, rather -than the one-dimensional bidrectional mapping typical of other scales. -Rather than mapping (for example) between a numeric domain and a numeric -range, geographic scales map between two coordinate objects: {@link -pv.Geo.LatLng} and pv.Vector. - - -
Defined in: GeoScale.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Geo.scale(p) -
-
Returns a geographic scale.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
by(f) -
-
Returns a view of this scale by the specified accessor function f.
-
  -
domain() -
-
Sets or gets the input domain.
-
  -
invert(y) -
-
Inverts the specified value in the output range, returning the -corresponding value in the input domain.
-
  -
range() -
-
Sets or gets the output range.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Geo.scale(p) -
- -
- Returns a geographic scale. The arguments to this constructor are optional, -and equivalent to calling #projection. - -
- - - - - -
-
Parameters:
- -
- {pv.Geo.Projection} p - Optional -
-
optional projection.
- -
- - - - - - - -
-
See:
- -
pv.Geo.scale#ticks
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - {pv.Geo.scale} - by(f) - -
-
- Returns a view of this scale by the specified accessor function f. -Given a scale g, g.by(function(d) d.foo) is equivalent to -function(d) g(d.foo). This method should be used judiciously; it -is typically more clear to invoke the scale directly, passing in the value -to be scaled. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
an accessor function.
- -
- - - - - -
-
Returns:
- -
{pv.Geo.scale} a view of this scale by the specified accessor -function.
- -
- - - - -
- - -
- - {pv.Geo.scale} - domain() - -
-
- Sets or gets the input domain. Note that unlike quantitative scales, the -domain cannot be reduced to a simple rectangle (i.e., minimum and maximum -values for latitude and longitude). Instead, the domain values must be -projected to normalized space, effectively finding the domain in normalized -space rather than in terms of latitude and longitude. Thus, changing the -projection requires recomputing the normalized domain. - -

This method can be invoked several ways: - -

1. domain(values...) - -

Specifying the domain as a series of pv.Geo.LatLngs is the most -explicit and recommended approach. However, if the domain values are -derived from data, you may find the second method more appropriate. - -

2. domain(array, f) - -

Rather than enumerating the domain explicitly, you can specify a single -argument of an array. In addition, you can specify an optional accessor -function to extract the domain values (as pv.Geo.LatLngs) from the -array. If the specified array has fewer than two elements, this scale will -default to the full normalized domain. - -

2. domain() - -

Invoking the domain method with no arguments returns the -current domain as an array. - - -

- - - - -
-
Parameters:
- -
- {...} domain... - -
-
domain values.
- -
- - - - - -
-
Returns:
- -
{pv.Geo.scale} this, or the current domain.
- -
- - - - -
- - -
- - {number} - invert(y) - -
-
- Inverts the specified value in the output range, returning the -corresponding value in the input domain. This is frequently used to convert -the mouse location (see pv.Mark#mouse) to a value in the input -domain. Inversion is only supported for numeric ranges, and not colors. - -

Note that this method does not do any rounding or bounds checking. If -the input domain is discrete (e.g., an array index), the returned value -should be rounded. If the specified y value is outside the range, -the returned value may be equivalently outside the input domain. - - -

- - - - -
-
Parameters:
- -
- {number} y - -
-
a value in the output range (a pixel location).
- -
- - - - - -
-
Returns:
- -
{number} a value in the input domain.
- -
- - - - -
- - -
- - {pv.Geo.scale} - range() - -
-
- Sets or gets the output range. This method can be invoked several ways: - -

1. range(min, max) - -

If two objects are specified, the arguments should be pv.Vectors -which specify the minimum and maximum values of the x- and y-coordinates -explicitly. - -

2. range(width, height) - -

If two numbers are specified, the arguments specify the maximum values -of the x- and y-coordinates explicitly; the minimum values are implicitly -zero. - -

3. range() - -

Invoking the range method with no arguments returns the current -range as an array of two pv.Vectors: the minimum (top-left) and -maximum (bottom-right) values. - - -

- - - - -
-
Parameters:
- -
- {...} range... - -
-
range values.
- -
- - - - - -
-
Returns:
- -
{pv.Geo.scale} this, or the current range.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Image.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Image.html deleted file mode 100644 index 7ce70f1e..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Image.html +++ /dev/null @@ -1,742 +0,0 @@ - - - - - - - JsDoc Reference - pv.Image - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Image -

- - -

- -
Extends - pv.Bar.
- - - Represents an image, either a static resource or a dynamically- -generated pixel buffer. Images share the same layout and style properties as -bars. The external image resource is specified via the #url -property. The optional fill, if specified, appears beneath the image, while -the optional stroke appears above the image. - -

Dynamic images such as heatmaps are supported using the #image -psuedo-property. This function is passed the x and y index, in -addition to the current data stack. The return value is a pv.Color, -or null for transparent. A string can also be returned, which will be parsed -into a color; however, it is typically much faster to return an object with -r, g, b and a attributes, to avoid the -cost of parsing and object instantiation. - -

See pv.Bar for details on positioning properties. - - -
Defined in: Image.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Image() -
-
Constructs a new image with default properties.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- defaults -
-
Default properties for images.
-
  - -
The height of the image in pixels.
-
  - -
The width of the image in pixels.
-
  -
- url -
-
The URL of the image to display.
-
- - - -
-
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
image(f) -
-
Specifies the dynamic image function.
-
- - - -
-
Methods borrowed from class pv.Mark:
add, anchor, anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Image() -
- -
- Constructs a new image with default properties. Images are not typically -constructed directly, but by adding to a panel or an existing mark via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {pv.Image} - defaults - -
-
- Default properties for images. By default, there is no stroke or fill style. - - -
- - - - - - - - -
- - -
- - {number} - imageHeight - -
-
- The height of the image in pixels. For static images, this property is -computed implicitly from the loaded image resources. For dynamic images, this -property can be used to specify the height of the pixel buffer; otherwise, the -value is derived from the height property. - - -
- - - - - - - - -
- - -
- - {number} - imageWidth - -
-
- The width of the image in pixels. For static images, this property is -computed implicitly from the loaded image resources. For dynamic images, this -property can be used to specify the width of the pixel buffer; otherwise, the -value is derived from the width property. - - -
- - - - - - - - -
- - -
- - {string} - url - -
-
- The URL of the image to display. The set of supported image types is -browser-dependent; PNG and JPEG are recommended. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Layout.Pack} - image(f) - -
-
- Specifies the dynamic image function. By default, no image function is -specified and the url property is used to load a static image -resource. If an image function is specified, it will be invoked for each -pixel in the image, based on the related imageWidth and -imageHeight properties. - -

For example, given a two-dimensional array heatmap, containing -numbers in the range [0, 1] in row-major order, a simple monochrome heatmap -image can be specified as: - -

vis.add(pv.Image)
-    .imageWidth(heatmap[0].length)
-    .imageHeight(heatmap.length)
-    .image(pv.ramp("white", "black").by(function(x, y) heatmap[y][x]));
- -For fastest performance, use an ordinal scale which caches the fixed color -palette, or return an object literal with r, g, b -and a attributes. A pv.Color or string can also be returned, -though this typically results in slower performance. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
the new sizing function.
- -
- - - - - -
-
Returns:
- -
{pv.Layout.Pack} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Label.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Label.html deleted file mode 100644 index 82c2c31e..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Label.html +++ /dev/null @@ -1,903 +0,0 @@ - - - - - - - JsDoc Reference - pv.Label - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Label -

- - -

- -
Extends - pv.Mark.
- - - Represents a text label, allowing textual annotation of other marks or -arbitrary text within the visualization. The character data must be plain -text (unicode), though the text can be styled using the #font -property. If rich text is needed, external HTML elements can be overlaid on -the canvas by hand. - -

Labels are positioned using the box model, similarly to Dot. Thus, -a label has no width or height, but merely a text anchor location. The text -is positioned relative to this anchor location based on the -#textAlign, #textBaseline and #textMargin properties. -Furthermore, the text may be rotated using #textAngle. - -

Labels ignore events, so as to not interfere with event handlers on -underlying marks, such as bars. In the future, we may support event handlers -on labels. - -

See also the Label guide. - - -
Defined in: Label.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Label() -
-
Constructs a new label mark with default properties.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- defaults -
-
Default properties for labels.
-
  -
- font -
-
The font format, per the CSS Level 2 specification.
-
  -
- text -
-
The character data to render; a string.
-
  -
- textAlign -
-
The horizontal text alignment.
-
  -
- textAngle -
-
The rotation angle, in radians.
-
  - -
The vertical text alignment.
-
  - -
A list of decoration to be applied to text, per the CSS Text Level 3 -text-decoration property.
-
  - -
The text margin; may be specified in pixels, or in font-dependent units (such -as ".1ex").
-
  - -
A list of shadow effects to be applied to text, per the CSS Text Level 3 -text-shadow property.
-
  -
- textStyle -
-
The text color.
-
- - - -
-
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - -
-
Methods borrowed from class pv.Mark:
add, anchor, anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Label() -
- -
- Constructs a new label mark with default properties. Labels are not typically -constructed directly, but by adding to a panel or an existing mark via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {pv.Label} - defaults - -
-
- Default properties for labels. See the individual properties for the default -values. - - -
- - - - - - - - -
- - -
- - {string} - font - -
-
- The font format, per the CSS Level 2 specification. The default font is "10px -sans-serif", for consistency with the HTML 5 canvas element specification. -Note that since text is not wrapped, any line-height property will be -ignored. The other font-style, font-variant, font-weight, font-size and -font-family properties are supported. - - -
- - - - - - -
-
See:
- -
CSS2 fonts
- -
- - - -
- - -
- - {string} - text - -
-
- The character data to render; a string. The default value of the text -property is the identity function, meaning the label's associated datum will -be rendered using its toString. - - -
- - - - - - - - -
- - -
- - {string} - textAlign - -
-
- The horizontal text alignment. One of:The default horizontal alignment is left. - - -
- - - - - - - - -
- - -
- - {number} - textAngle - -
-
- The rotation angle, in radians. Text is rotated clockwise relative to the -anchor location. For example, with the default left alignment, an angle of -Math.PI / 2 causes text to proceed downwards. The default angle is zero. - - -
- - - - - - - - -
- - -
- - {string} - textBaseline - -
-
- The vertical text alignment. One of:The default vertical alignment is bottom. - - -
- - - - - - - - -
- - -
- - {string} - textDecoration - -
-
- A list of decoration to be applied to text, per the CSS Text Level 3 -text-decoration property. An example specification is "underline". - - -
- - - - - - -
-
See:
- -
CSS3 text
- -
- - - -
- - -
- - {number} - textMargin - -
-
- The text margin; may be specified in pixels, or in font-dependent units (such -as ".1ex"). The margin can be used to pad text away from its anchor location, -in a direction dependent on the horizontal and vertical alignment -properties. For example, if the text is left- and middle-aligned, the margin -shifts the text to the right. The default margin is 3 pixels. - - -
- - - - - - - - -
- - -
- - {string} - textShadow - -
-
- A list of shadow effects to be applied to text, per the CSS Text Level 3 -text-shadow property. An example specification is "0.1em 0.1em 0.1em -rgba(0,0,0,.5)"; the first length is the horizontal offset, the second the -vertical offset, and the third the blur radius. - - -
- - - - - - -
-
See:
- -
CSS3 text
- -
- - - -
- - -
- - {string} - textStyle - -
-
- The text color. The name "textStyle" is used for consistency with "fillStyle" -and "strokeStyle", although it might be better to rename this property (and -perhaps use the same name as "strokeStyle"). The default color is black. - - -
- - - - - - -
-
See:
- -
pv.color
- -
- - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Arc.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Arc.html deleted file mode 100644 index 55e25f6d..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Arc.html +++ /dev/null @@ -1,723 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Arc - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Arc -

- - -

- -
Extends - pv.Layout.Network.
- - - Implements a layout for arc diagrams. An arc diagram is a network -visualization with a one-dimensional layout of nodes, using circular arcs to -render links between nodes. For undirected networks, arcs are rendering on a -single side; this makes arc diagrams useful as annotations to other -two-dimensional network layouts, such as rollup, matrix or table layouts. For -directed networks, links in opposite directions can be rendered on opposite -sides using directed(true). - -

Arc layouts are particularly sensitive to node ordering; for best results, -order the nodes such that related nodes are close to each other. A poor -(e.g., random) order may result in large arcs with crossovers that impede -visual processing. A future improvement to this layout may include automatic -reordering using, e.g., spectral graph layout or simulated annealing. - -

This visualization technique is related to that developed by -M. Wattenberg, "Arc -Diagrams: Visualizing Structure in Strings" in IEEE InfoVis, 2002. -However, this implementation is limited to simple node-link networks, as -opposed to structures with hierarchical self-similarity (such as strings). - -

As with other network layouts, three mark prototypes are provided:

For more details on how this layout is structured and can be customized, -see pv.Layout.Network. - - -
Defined in: Arc.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty arc layout.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- defaults -
-
Default properties for arc layouts.
-
  -
- directed -
-
Whether this arc digram is directed (bidirectional); only applies to -non-radial orientations.
-
  -
- orient -
-
The orientation.
-
- - - -
-
Fields borrowed from class pv.Layout.Network:
label, link, node
Fields borrowed from class pv.Panel:
canvas, children, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
sort(f) -
-
Specifies an optional sort function.
-
- - - -
-
Methods borrowed from class pv.Layout.Network:
reset
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Arc() -
- -
- Constructs a new, empty arc layout. Layouts are not typically constructed -directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {pv.Layout.Arc} - defaults - -
-
- Default properties for arc layouts. By default, the orientation is "bottom". - - -
- - - - - - - - -
- - -
- - {boolean} - directed - -
-
- Whether this arc digram is directed (bidirectional); only applies to -non-radial orientations. By default, arc digrams are undirected, such that -all arcs appear on one side. If the arc digram is directed, then forward -links are drawn on the conventional side (the same as as undirected -links--right, left, bottom and top for left, right, top and bottom, -respectively), while reverse links are drawn on the opposite side. - - -
- - - - - - - - -
- - -
- - {string} - orient - -
-
- The orientation. The default orientation is "left", which means that nodes -will be positioned from left-to-right in the order they are specified in the -nodes property. The following orientations are supported: - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Layout.Arc} - sort(f) - -
-
- Specifies an optional sort function. The sort function follows the same -comparator contract required by pv.Dom.Node#sort. Specifying a sort -function provides an alternative to sort the nodes as they are specified by -the nodes property; the main advantage of doing this is that the -comparator function can access implicit fields populated by the network -layout, such as the linkDegree. - -

Note that arc diagrams are particularly sensitive to order. This is -referred to as the seriation problem, and many different techniques exist to -find good node orders that emphasize clusters, such as spectral layout and -simulated annealing. - - -

- - - - -
-
Parameters:
- -
- {function} f - -
-
comparator function for nodes.
- -
- - - - - -
-
Returns:
- -
{pv.Layout.Arc} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Bullet.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Bullet.html deleted file mode 100644 index 90b438ba..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Bullet.html +++ /dev/null @@ -1,793 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Bullet - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Bullet -

- - -

- -
Extends - pv.Layout.
- - - - - -
Defined in: Bullet.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty bullet layout.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- defaults -
-
Default properties for bullet layouts.
-
  -
- marker -
-
The marker prototype.
-
  -
- markers -
-
The array of marker values.
-
  -
- maximum -
-
Optional; the maximum range value.
-
  -
- measure -
-
The measure prototype.
-
  -
- measures -
-
The array of measure values.
-
  -
- orient -
-
The orientation.
-
  -
- range -
-
The range prototype.
-
  -
- ranges -
-
The array of range values.
-
- - - -
-
Fields borrowed from class pv.Panel:
canvas, children, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - -
-
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Bullet() -
- -
- Constructs a new, empty bullet layout. Layouts are not typically constructed -directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {pv.Layout.Bullet} - defaults - -
-
- Default properties for bullet layouts. - - -
- - - - - - - - -
- - -
- - {pv.Mark} - marker - -
-
- The marker prototype. - - -
- - - - - - - - -
- - -
- - {array} - markers - -
-
- The array of marker values. - - -
- - - - - - - - -
- - -
- - {number} - maximum - -
-
- Optional; the maximum range value. - - -
- - - - - - - - -
- - -
- - {pv.Mark} - measure - -
-
- The measure prototype. - - -
- - - - - - - - -
- - -
- - {array} - measures - -
-
- The array of measure values. - - -
- - - - - - - - -
- - -
- - {string} - orient - -
-
- The orientation. - - -
- - - - - - - - -
- - -
- - {pv.Mark} - range - -
-
- The range prototype. - - -
- - - - - - - - -
- - -
- - {array} - ranges - -
-
- The array of range values. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Cluster.Fill.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Cluster.Fill.html deleted file mode 100644 index 5f314a6d..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Cluster.Fill.html +++ /dev/null @@ -1,501 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Cluster.Fill - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Cluster.Fill -

- - -

- -
Extends - pv.Layout.Cluster.
- - - A variant of cluster layout that is space-filling. The meaning of the -exported mark prototypes changes slightly in the space-filling -implementation:

For more details on how to use this layout, see -pv.Layout.Cluster. - - -
Defined in: Cluster.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty space-filling cluster layout.
-
- - - - - - - - -
-
Fields borrowed from class pv.Layout.Cluster:
defaults, group, innerRadius, orient, outerRadius
Fields borrowed from class pv.Layout.Network:
label, link, node
Fields borrowed from class pv.Panel:
canvas, children, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - -
-
Methods borrowed from class pv.Layout.Network:
reset
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Cluster.Fill() -
- -
- Constructs a new, empty space-filling cluster layout. Layouts are not -typically constructed directly; instead, they are added to an existing panel -via pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Cluster.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Cluster.html deleted file mode 100644 index f3e88ea1..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Cluster.html +++ /dev/null @@ -1,707 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Cluster - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Cluster -

- - -

- -
Extends - pv.Layout.Hierarchy.
- - - Implements a hierarchical layout using the cluster (or dendrogram) -algorithm. This layout provides both node-link and space-filling -implementations of cluster diagrams. In many ways it is similar to -pv.Layout.Partition, except that leaf nodes are positioned at maximum -depth, and the depth of internal nodes is based on their distance from their -deepest descendant, rather than their distance from the root. - -

The cluster layout supports a "group" property, which if true causes -siblings to be positioned closer together than unrelated nodes at the same -depth. Unlike the partition layout, this layout does not support dynamic -sizing for leaf nodes; all leaf nodes are the same size. - -

For more details on how to use this layout, see -pv.Layout.Hierarchy. - - -
Defined in: Cluster.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty cluster layout.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- defaults -
-
Defaults for cluster layouts.
-
  -
- group -
-
The group parameter; defaults to 0, disabling grouping of siblings.
-
  - -
The inner radius; defaults to 0.
-
  -
- orient -
-
The orientation.
-
  - -
The outer radius; defaults to fill the containing panel, based on the height -and width of the layout.
-
- - - -
-
Fields borrowed from class pv.Layout.Network:
label, link, node
Fields borrowed from class pv.Panel:
canvas, children, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - -
-
Methods borrowed from class pv.Layout.Network:
reset
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Cluster() -
- -
- Constructs a new, empty cluster layout. Layouts are not typically -constructed directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - -
-
See:
- -
pv.Layout.Cluster.Fill
- -
- - -
- - - - -
- Field Detail -
- - -
- - {pv.Layout.Cluster} - defaults - -
-
- Defaults for cluster layouts. The default group parameter is 0 and the -default orientation is "top". - - -
- - - - - - - - -
- - -
- - {number} - group - -
-
- The group parameter; defaults to 0, disabling grouping of siblings. If this -parameter is set to a positive number (or true, which is equivalent to 1), -then additional space will be allotted between sibling groups. In other -words, siblings (nodes that share the same parent) will be positioned more -closely than nodes at the same depth that do not share a parent. - - -
- - - - - - - - -
- - -
- - {number} - innerRadius - -
-
- The inner radius; defaults to 0. This property applies only to radial -orientations, and can be used to compress the layout radially. Note that for -the node-link implementation, the root node is always at the center, -regardless of the value of this property; this property only affects internal -and leaf nodes. For the space-filling implementation, a non-zero value of -this property will result in the root node represented as a ring rather than -a circle. - - -
- - - - - - - - -
- - -
- - {string} - orient - -
-
- The orientation. The default orientation is "top", which means that the root -node is placed on the top edge, leaf nodes appear on the bottom edge, and -internal nodes are in-between. The following orientations are supported: - - -
- - - - - - - - -
- - -
- - {number} - outerRadius - -
-
- The outer radius; defaults to fill the containing panel, based on the height -and width of the layout. If the layout has no height and width specified, it -will extend to fill the enclosing panel. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Force.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Force.html deleted file mode 100644 index bab85f26..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Force.html +++ /dev/null @@ -1,1015 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Force - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Force -

- - -

- -
Extends - pv.Layout.Network.
- - - Implements force-directed network layout as a node-link diagram. This -layout uses the Fruchterman-Reingold algorithm, which applies an attractive -spring force between neighboring nodes, and a repulsive electrical charge -force between all nodes. An additional drag force improves stability of the -simulation. See pv.Force.spring, pv.Force.drag and {@link -pv.Force.charge} for more details; note that the n-body charge force is -approximated using the Barnes-Hut algorithm. - -

This layout is implemented on top of pv.Simulation, which can be -used directly for more control over simulation parameters. The simulation -uses Position Verlet integration, which does not compute velocities -explicitly, but allows for easy geometric constraints, such as bounding the -nodes within the layout panel. Many of the configuration properties supported -by this layout are simply passed through to the underlying forces and -constraints of the simulation. - -

Force layouts are typically interactive. The gradual movement of the nodes -as they stabilize to a local stress minimum can help reveal the structure of -the network, as can pv.Behavior.drag, which allows the user to pick -up nodes and reposition them while the physics simulation continues. This -layout can also be used with pan & zoom behaviors for interaction. - -

To facilitate interaction, this layout by default automatically re-renders -using a setInterval every 42 milliseconds. This can be disabled via -the iterations property, which if non-null specifies the number of -simulation iterations to run before the force-directed layout is finalized. -Be careful not to use too high an iteration count, as this can lead to an -annoying delay on page load. - -

As with other network layouts, the network data can be updated -dynamically, provided the property cache is reset. See -pv.Layout.Network for details. New nodes are initialized with random -positions near the center. Alternatively, positions can be specified manually -by setting the x and y attributes on nodes. - - -
Defined in: Force.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty force-directed layout.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- bound -
-
The bound parameter; true if nodes should be constrained within the layout -panel.
-
  - -
The charge constant, which should be a negative number.
-
  - -
The maximum distance at which charge forces are applied.
-
  - -
The minimum distance at which charge forces are applied.
-
  - -
The Barnes-Hut approximation factor.
-
  -
- defaults -
-
Default properties for force-directed layouts.
-
  - -
The drag constant, in the range [0,1].
-
  - -
The number of simulation iterations to run, or null if this layout is -interactive.
-
  - -
The spring constant, which should be a positive number.
-
  - -
The spring damping factor, in the range [0,1].
-
  - -
The spring rest length.
-
- - - -
-
Fields borrowed from class pv.Layout.Network:
label, link, node
Fields borrowed from class pv.Panel:
canvas, children, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - -
-
Methods borrowed from class pv.Layout.Network:
reset
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Force() -
- -
- Constructs a new, empty force-directed layout. Layouts are not typically -constructed directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - -
-
See:
- -
"Graph Drawing by Force-directed Placement" by T. Fruchterman & -E. Reingold, Software--Practice & Experience, November 1991.
- -
- - -
- - - - -
- Field Detail -
- - -
- - {boolean} - bound - -
-
- The bound parameter; true if nodes should be constrained within the layout -panel. Bounding is disabled by default. Currently the layout does not observe -the radius of the nodes; strictly speaking, only the center of the node is -constrained to be within the panel, with an additional 6-pixel offset for -padding. A future enhancement could extend the bound constraint to observe -the node's radius, which would also support bounding for variable-size nodes. - -

Note that if this layout is used in conjunction with pan & zoom -behaviors, those behaviors should have their bound parameter set to the same -value. - - -

- - - - - - - - -
- - -
- - {number} - chargeConstant - -
-
- The charge constant, which should be a negative number. The default value is --40; more negative values will result in a stronger repulsive force, which -may lead to faster convergence at the risk of instability. Too strong -repulsive charge forces can cause comparatively weak springs to be stretched -well beyond their rest length, emphasizing global structure over local -structure. A nonnegative value will break the Fruchterman-Reingold algorithm, -and is for entertainment purposes only. - - -
- - - - - - -
-
See:
- -
pv.Force.charge#constant
- -
- - - -
- - -
- - {number} - chargeMaxDistance - -
-
- The maximum distance at which charge forces are applied. This improves -performance by ignoring weak charge forces at great distances. Note that this -parameter is partly redundant, as the Barnes-Hut algorithm for n-body forces -already improves performance for far-away particles through approximation. - - -
- - - - - - -
-
See:
- -
pv.Force.charge#domain
- -
- - - -
- - -
- - {number} - chargeMinDistance - -
-
- The minimum distance at which charge forces are applied. The default minimum -distance of 2 avoids applying forces that are two strong; because the physics -simulation is run at discrete time intervals, it is possible for two same- -charged particles to become very close or even a singularity! Since the -charge force is inversely proportional to the square of the distance, very -small distances can break the simulation. - -

In rare cases, two particles can become stuck on top of each other, as a -minimum distance threshold will prevent the charge force from repelling them. -However, this occurs very rarely because other forces and momentum typically -cause the particles to become separated again, at which point the repulsive -charge force kicks in. - - -

- - - - - - -
-
See:
- -
pv.Force.charge#domain
- -
- - - -
- - -
- - {number} - chargeTheta - -
-
- The Barnes-Hut approximation factor. The Barnes-Hut approximation criterion -is the ratio of the size of the quadtree node to the distance from the point -to the node's center of mass is beneath some threshold. The default value is -0.9. - - -
- - - - - - -
-
See:
- -
pv.Force.charge#theta
- -
- - - -
- - -
- - {pv.Layout.Force} - defaults - -
-
- Default properties for force-directed layouts. The default drag constant is -0.1, the default charge constant is -40 (with a domain of [2, 500] and theta -of 0.9), and the default spring constant is 0.1 (with a damping of 0.3 and a -rest length of 20). - - -
- - - - - - - - -
- - -
- - {number} - dragConstant - -
-
- The drag constant, in the range [0,1]. A value of 0 means no drag (a -perfectly frictionless environment), while a value of 1 means friction -immediately cancels all momentum. The default value is 0.1, which provides a -minimum amount of drag that helps stabilize bouncy springs; lower values may -result in excessive bounciness, while higher values cause the simulation to -take longer to converge. - - -
- - - - - - -
-
See:
- -
pv.Force.drag#constant
- -
- - - -
- - -
- - {number} - iterations - -
-
- The number of simulation iterations to run, or null if this layout is -interactive. Force-directed layouts are interactive by default, using a -setInterval to advance the physics simulation and re-render -automatically. - - -
- - - - - - - - -
- - -
- - {number} - springConstant - -
-
- The spring constant, which should be a positive number. The default value is -0.1; greater values will result in a stronger attractive force, which may -lead to faster convergence at the risk of instability. Too strong spring -forces can cause comparatively weak charge forces to be ignored, emphasizing -local structure over global structure. A nonpositive value will break the -Fruchterman-Reingold algorithm, and is for entertainment purposes only. - -

The spring tension is automatically normalized using the inverse square -root of the maximum link degree of attached nodes. - - -

- - - - - - -
-
See:
- -
pv.Force.spring#constant
- -
- - - -
- - -
- - {number} - springDamping - -
-
- The spring damping factor, in the range [0,1]. Damping functions identically -to drag forces, damping spring bounciness by applying a force in the opposite -direction of attached nodes' velocities. The default value is 0.3. - -

The spring damping is automatically normalized using the inverse square -root of the maximum link degree of attached nodes. - - -

- - - - - - -
-
See:
- -
pv.Force.spring#damping
- -
- - - -
- - -
- - {number} - springLength - -
-
- The spring rest length. The default value is 20 pixels. Larger values may be -appropriate if the layout panel is larger, or if the nodes are rendered -larger than the default dot size of 20. - - -
- - - - - - -
-
See:
- -
pv.Force.spring#length
- -
- - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Grid.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Grid.html deleted file mode 100644 index 38993430..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Grid.html +++ /dev/null @@ -1,674 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Grid - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Grid -

- - -

- -
Extends - pv.Layout.
- - - Implements a grid layout with regularly-sized rows and columns. The -number of rows and columns are determined from their respective -properties. For example, the 2×3 array: - -

1 2 3
-4 5 6
- -can be represented using the rows property as: - -
[[1, 2, 3], [4, 5, 6]]
- -If your data is in column-major order, you can equivalently use the -columns property. If the rows property is an array, it -takes priority over the columns property. The data is implicitly -transposed, as if the pv.transpose operator were applied. - -

This layout exports a single cell mark prototype, which is -intended to be used with a bar, panel, layout, or subclass thereof. The data -property of the cell prototype is defined as the elements in the array. For -example, if the array is a two-dimensional array of values in the range -[0,1], a simple heatmap can be generated as: - -

vis.add(pv.Layout.Grid)
-    .rows(arrays)
-  .cell.add(pv.Bar)
-    .fillStyle(pv.ramp("white", "black"))
- -The grid subdivides the full width and height of the parent panel into equal -rectangles. Note, however, that for large, interactive, or animated heatmaps, -you may see significantly better performance through dynamic pv.Image -generation. - -

For irregular grids using value-based spatial partitioning, see {@link -pv.Layout.Treemap}. - - -
Defined in: Grid.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty grid layout.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- cell -
-
The cell prototype.
-
  -
- cols -
-
The number of columns.
-
  -
- defaults -
-
Default properties for grid layouts.
-
  -
- rows -
-
The number of rows.
-
- - - -
-
Fields borrowed from class pv.Panel:
canvas, children, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - -
-
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Grid() -
- -
- Constructs a new, empty grid layout. Layouts are not typically constructed -directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {pv.Mark} - cell - -
-
- The cell prototype. This prototype is intended to be used with a bar, -panel, or layout (or subclass thereof) to render the grid cells. - - -
- - - - - - - - -
- - -
- - {number} - cols - -
-
- The number of columns. This property can also be specified as the data in -column-major order; in this case, the cols property is implicitly set to the -length of the array, and the rows property is set to the length of the first -element in the array. - - -
- - - - - - - - -
- - -
- - {pv.Layout.Grid} - defaults - -
-
- Default properties for grid layouts. By default, there is one row and one -column, and the data is the propagated to the child cell. - - -
- - - - - - - - -
- - -
- - {number} - rows - -
-
- The number of rows. This property can also be specified as the data in -row-major order; in this case, the rows property is implicitly set to the -length of the array, and the cols property is set to the length of the first -element in the array. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Hierarchy.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Hierarchy.html deleted file mode 100644 index a8c31ca2..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Hierarchy.html +++ /dev/null @@ -1,575 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Hierarchy - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Hierarchy -

- - -

- -
Extends - pv.Layout.Network.
- - - Represents an abstract layout for hierarchy diagrams. This class is a -specialization of pv.Layout.Network, providing the basic structure -for both hierarchical node-link diagrams (such as Reingold-Tilford trees) and -space-filling hierarchy diagrams (such as sunbursts and treemaps). - -

Unlike general network layouts, the links property need not be -defined explicitly. Instead, the links are computed implicitly from the -parentNode attribute of the node objects, as defined by the -nodes property. This implementation is also available as -#links, for reuse with non-hierarchical layouts; for example, to -render a tree using force-directed layout. - -

Correspondingly, the nodes property is represented as a union of -pv.Layout.Network.Node and pv.Dom.Node. To construct a node -hierarchy from a simple JSON map, use the pv.Dom operator; this -operator also provides an easy way to sort nodes before passing them to the -layout. - -

For more details on how to use this layout, see -pv.Layout.Network. - - -
Defined in: Hierarchy.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty hierarchy layout.
-
- - - - - - - - -
-
Fields borrowed from class pv.Layout.Network:
label, link, node
Fields borrowed from class pv.Panel:
canvas, children, defaults, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
<static>   -
pv.Layout.Hierarchy.links() -
-
The implied links; computes links using the parentNode attribute.
-
- - - -
-
Methods borrowed from class pv.Layout.Network:
reset
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Hierarchy() -
- -
- Constructs a new, empty hierarchy layout. Layouts are not typically -constructed directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - -
-
See:
- -
pv.Layout.Cluster
- -
pv.Layout.Partition
- -
pv.Layout.Tree
- -
pv.Layout.Treemap
- -
pv.Layout.Indent
- -
pv.Layout.Pack
- -
- - -
- - - - - - - -
- Method Detail -
- - -
<static> - - - pv.Layout.Hierarchy.links() - -
-
- The implied links; computes links using the parentNode attribute. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Horizon.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Horizon.html deleted file mode 100644 index e1931dfb..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Horizon.html +++ /dev/null @@ -1,772 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Horizon - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Horizon -

- - -

- -
Extends - pv.Layout.
- - - Implements a horizon layout, which is a variation of a single-series -area chart where the area is folded into multiple bands. Color is used to -encode band, allowing the size of the chart to be reduced significantly -without impeding readability. This layout algorithm is based on the work of -J. Heer, N. Kong and M. Agrawala in "Sizing -the Horizon: The Effects of Chart Size and Layering on the Graphical -Perception of Time Series Visualizations", CHI 2009. - -

This layout exports a single band mark prototype, which is -intended to be used with an area mark. The band mark is contained in a panel -which is replicated per band (and for negative/positive bands). For example, -to create a simple horizon graph given an array of numbers: - -

vis.add(pv.Layout.Horizon)
-    .bands(n)
-  .band.add(pv.Area)
-    .data(data)
-    .left(function() this.index * 35)
-    .height(function(d) d * 40);
- -The layout can be further customized by changing the number of bands, and -toggling whether the negative bands are mirrored or offset. (See the -above-referenced paper for guidance.) - -

The fillStyle of the area can be overridden, though typically it -is easier to customize the layout's behavior through the custom -backgroundStyle, positiveStyle and negativeStyle -properties. By default, the background is white, positive bands are blue, and -negative bands are red. For the most accurate presentation, use fully-opaque -colors of equal intensity for the negative and positive bands. - - -
Defined in: Horizon.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty horizon layout.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  - -
The background color.
-
  -
- band -
-
The band prototype.
-
  -
- bands -
-
The number of bands.
-
  -
- defaults -
-
Default properties for horizon layouts.
-
  -
- mode -
-
The horizon mode: offset, mirror, or color.
-
  - -
The negative band color; if non-null, the interior of negative bands are -filled with the specified color.
-
  - -
The positive band color; if non-null, the interior of positive bands are -filled with the specified color.
-
- - - -
-
Fields borrowed from class pv.Panel:
canvas, children, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - -
-
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Horizon() -
- -
- Constructs a new, empty horizon layout. Layouts are not typically constructed -directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {pv.Color} - backgroundStyle - -
-
- The background color. The panel background is filled with the specified -color, and the negative and positive bands are filled with an interpolated -color between this color and the respective band color. The default value of -this property is white. For accurate blending, this color should be fully -opaque. - - -
- - - - - - - - -
- - -
- - {pv.Mark} - band - -
-
- The band prototype. This prototype is intended to be used with an Area -mark to render the horizon bands. - - -
- - - - - - - - -
- - -
- - {number} - bands - -
-
- The number of bands. Must be at least one. The default value is two. - - -
- - - - - - - - -
- - -
- - {pv.Layout.Horizon} - defaults - -
-
- Default properties for horizon layouts. By default, there are two bands, the -mode is "offset", the background style is "white", the positive style is -blue, negative style is red. - - -
- - - - - - - - -
- - -
- - {string} - mode - -
-
- The horizon mode: offset, mirror, or color. The default is "offset". - - -
- - - - - - - - -
- - -
- - {pv.Color} - negativeStyle - -
-
- The negative band color; if non-null, the interior of negative bands are -filled with the specified color. The default value of this property is red. -For accurate blending, this color should be fully opaque. - - -
- - - - - - - - -
- - -
- - {pv.Color} - positiveStyle - -
-
- The positive band color; if non-null, the interior of positive bands are -filled with the specified color. The default value of this property is blue. -For accurate blending, this color should be fully opaque. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Indent.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Indent.html deleted file mode 100644 index 0c41375c..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Indent.html +++ /dev/null @@ -1,619 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Indent - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Indent -

- - -

- -
Extends - pv.Layout.Hierarchy.
- - - Implements a hierarchical layout using the indent algorithm. This -layout implements a node-link diagram where the nodes are presented in -preorder traversal, and nodes are indented based on their depth from the -root. This technique is used ubiquitously by operating systems to represent -file directories; although it requires much vertical space, indented trees -allow efficient interactive exploration of trees to find a specific -node. In addition they allow rapid scanning of node labels, and multivariate -data such as file sizes can be displayed adjacent to the hierarchy. - -

The indent layout can be configured using the depth and -breadth properties, which control the increments in pixel space for -each indent and row in the layout. This layout does not support multiple -orientations; the root node is rendered in the top-left, while -breadth is a vertical offset from the top, and depth is a -horizontal offset from the left. - -

For more details on how to use this layout, see -pv.Layout.Hierarchy. - - -
Defined in: Indent.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty indent layout.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- breadth -
-
The vertical offset between nodes; defaults to 15.
-
  -
- defaults -
-
Default properties for indent layouts.
-
  -
- depth -
-
The horizontal offset between different levels of the tree; defaults to 15.
-
- - - -
-
Fields borrowed from class pv.Layout.Network:
label, link, node
Fields borrowed from class pv.Panel:
canvas, children, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - -
-
Methods borrowed from class pv.Layout.Network:
reset
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Indent() -
- -
- Constructs a new, empty indent layout. Layouts are not typically constructed -directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {number} - breadth - -
-
- The vertical offset between nodes; defaults to 15. - - -
- - - - - - - - -
- - -
- - {pv.Layout.Indent} - defaults - -
-
- Default properties for indent layouts. By default the depth and breadth -offsets are 15 pixels. - - -
- - - - - - - - -
- - -
- - {number} - depth - -
-
- The horizontal offset between different levels of the tree; defaults to 15. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Matrix.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Matrix.html deleted file mode 100644 index bec491a8..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Matrix.html +++ /dev/null @@ -1,656 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Matrix - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Matrix -

- - -

- -
Extends - pv.Layout.Network.
- - - Implements a network visualization using a matrix view. This is, in -effect, a visualization of the graph's adjacency matrix: the cell at -row i, column j, corresponds to the link from node i to -node j. The fill color of each cell is binary by default, and -corresponds to whether a link exists between the two nodes. If the underlying -graph has links with variable values, the fillStyle property can be -substited to use an appropriate color function, such as pv.ramp. - -

For undirected networks, the matrix is symmetric around the diagonal. For -directed networks, links in opposite directions can be rendered on opposite -sides of the diagonal using directed(true). The graph is assumed to -be undirected by default. - -

The mark prototypes for this network layout are slightly different than -other implementations:

For more details on how to use this layout, see -pv.Layout.Network. - - -
Defined in: Matrix.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty matrix network layout.
-
- - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- directed -
-
Whether this matrix visualization is directed (bidirectional).
-
- - - -
-
Fields borrowed from class pv.Layout.Network:
label, link, node
Fields borrowed from class pv.Panel:
canvas, children, defaults, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
sort(f) -
-
Specifies an optional sort function.
-
- - - -
-
Methods borrowed from class pv.Layout.Network:
reset
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Matrix() -
- -
- Constructs a new, empty matrix network layout. Layouts are not typically -constructed directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {boolean} - directed - -
-
- Whether this matrix visualization is directed (bidirectional). By default, -the graph is assumed to be undirected, such that the visualization is -symmetric across the matrix diagonal. If the network is directed, then -forward links are drawn above the diagonal, while reverse links are drawn -below. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Layout.Matrix} - sort(f) - -
-
- Specifies an optional sort function. The sort function follows the same -comparator contract required by pv.Dom.Node#sort. Specifying a sort -function provides an alternative to sort the nodes as they are specified by -the nodes property; the main advantage of doing this is that the -comparator function can access implicit fields populated by the network -layout, such as the linkDegree. - -

Note that matrix visualizations are particularly sensitive to order. This -is referred to as the seriation problem, and many different techniques exist -to find good node orders that emphasize clusters, such as spectral layout and -simulated annealing. - - -

- - - - -
-
Parameters:
- -
- {function} f - -
-
comparator function for nodes.
- -
- - - - - -
-
Returns:
- -
{pv.Layout.Matrix} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Network.Link.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Network.Link.html deleted file mode 100644 index ccd8ba2b..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Network.Link.html +++ /dev/null @@ -1,701 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Network.Link - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Network.Link -

- - -

- - - - Represents a link in a network layout. There is no explicit -constructor; this class merely serves to document the attributes that are -used on links in network layouts. For hierarchical layouts, this class is -used to represent the parent-child links. - - -
Defined in: Network.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- linkValue -
-
The link value, or weight; optional.
-
  -
- source -
-
Alias for sourceNode, as expressed by the index of the source node.
-
  - -
The link's source node.
-
  -
- target -
-
Alias for targetNode, as expressed by the index of the target node.
-
  - -
The link's target node.
-
  -
- value -
-
Alias for linkValue.
-
- - - - - - - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Network.Link() -
- -
- - -
- - - - - - - - - - - -
-
See:
- -
pv.Layout.Network
- -
- - -
- - - - -
- Field Detail -
- - -
- - {number} - linkValue - -
-
- The link value, or weight; optional. If not specified (or not a number), the -default value of 1 is used. - - -
- - - - - - - - -
- - -
- - {number} - source - -
-
- Alias for sourceNode, as expressed by the index of the source node. -This attribute is not populated automatically, but may be used as a more -convenient identification of the link's source, for example in a static JSON -representation. - - -
- - - - - - - - -
- - -
- - {pv.Layout.Network.Node} - sourceNode - -
-
- The link's source node. If not set, this value will be derived from the -source attribute index. - - -
- - - - - - - - -
- - -
- - {number} - target - -
-
- Alias for targetNode, as expressed by the index of the target node. -This attribute is not populated automatically, but may be used as a more -convenient identification of the link's target, for example in a static JSON -representation. - - -
- - - - - - - - -
- - -
- - {pv.Layout.Network.Node} - targetNode - -
-
- The link's target node. If not set, this value will be derived from the -target attribute index. - - -
- - - - - - - - -
- - -
- - {number} - value - -
-
- Alias for linkValue. This attribute is not populated automatically, -but may be used instead of the linkValue attribute when specifying -links. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Network.Node.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Network.Node.html deleted file mode 100644 index 1c71a73b..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Network.Node.html +++ /dev/null @@ -1,633 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Network.Node - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Network.Node -

- - -

- - - - Represents a node in a network layout. There is no explicit -constructor; this class merely serves to document the attributes that are -used on nodes in network layouts. (Note that hierarchical nodes place -additional requirements on node representation, vis pv.Dom.Node.) - - -
Defined in: Network.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- index -
-
The node index, zero-based.
-
  - -
The link degree; the sum of link values for all incoming and outgoing links.
-
  -
- nodeName -
-
The node name; optional.
-
  -
- nodeValue -
-
The node value; optional.
-
- - - - - - - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Network.Node() -
- -
- - -
- - - - - - - - - - - -
-
See:
- -
pv.Layout.Network
- -
- - -
- - - - -
- Field Detail -
- - -
- - {number} - index - -
-
- The node index, zero-based. This attribute is populated automatically based -on the index in the array returned by the nodes property. - - -
- - - - - - - - -
- - -
- - {number} - linkDegree - -
-
- The link degree; the sum of link values for all incoming and outgoing links. -This attribute is populated automatically. - - -
- - - - - - - - -
- - -
- - {string} - nodeName - -
-
- The node name; optional. If present, this attribute will be used to provide -the text for node labels. If not present, the label text will fallback to the -nodeValue attribute. - - -
- - - - - - - - -
- - -
- - {object} - nodeValue - -
-
- The node value; optional. If present, and no nodeName attribute is -present, the node value will be used as the label text. This attribute is -also automatically populated if the nodes are specified as an array of -primitives, such as strings or numbers. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Network.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Network.html deleted file mode 100644 index 9207d601..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Network.html +++ /dev/null @@ -1,750 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Network - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Network -

- - -

- -
Extends - pv.Layout.
- - - Represents an abstract layout for network diagrams. This class -provides the basic structure for both node-link diagrams (such as -force-directed graph layout) and space-filling network diagrams (such as -sunbursts and treemaps). Note that "network" here is a general term that -includes hierarchical structures; a tree is represented using links from -child to parent. - -

Network layouts require the graph data structure to be defined using two -properties:

- -

Three standard mark prototypes are provided:

Note that some network implementations may not support all three -standard mark prototypes; for example, space-filling hierarchical layouts -typically do not use a link prototype, as the parent-child links are -implied by the structure of the space-filling node marks. Check the -specific network layout for implementation details. - -

Network layout properties, including nodes and links, -are typically cached rather than re-evaluated with every call to render. This -is a performance optimization, as network layout algorithms can be -expensive. If the network structure changes, call #reset to clear the -cache before rendering. Note that although the network layout properties are -cached, child mark properties, such as the marks used to render the nodes and -links, are not. Therefore, non-structural changes to the network -layout, such as changing the color of a mark on mouseover, do not need to -reset the layout. - - -
Defined in: Network.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty network layout.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- label -
-
The node label prototype, which renders the node name adjacent to the node.
-
  -
- link -
-
The link prototype, which renders edges between source nodes and target -nodes.
-
  -
- node -
-
The node prototype.
-
- - - -
-
Fields borrowed from class pv.Panel:
canvas, children, defaults, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
reset() -
-
Resets the cache, such that changes to layout property definitions will be -visible on subsequent render.
-
- - - -
-
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Network() -
- -
- Constructs a new, empty network layout. Layouts are not typically constructed -directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - -
-
See:
- -
pv.Layout.Hierarchy
- -
pv.Layout.Force
- -
pv.Layout.Matrix
- -
pv.Layout.Arc
- -
pv.Layout.Rollup
- -
- - -
- - - - -
- Field Detail -
- - -
- - {pv.Mark} - label - -
-
- The node label prototype, which renders the node name adjacent to the node. -This prototype is provided as an alternative to using the anchor on the -node mark; it is primarily intended to be used with radial node-link -layouts, since it provides a convenient mechanism to set the text angle. - - -
- - - - - - - - -
- - -
- - {pv.Mark} - link - -
-
- The link prototype, which renders edges between source nodes and target -nodes. This prototype is intended to be used with a Line mark in -conjunction with the node prototype. - - -
- - - - - - - - -
- - -
- - {pv.Mark} - node - -
-
- The node prototype. This prototype is intended to be used with a Dot mark -in conjunction with the link prototype. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Layout.Network} - reset() - -
-
- Resets the cache, such that changes to layout property definitions will be -visible on subsequent render. Unlike normal marks (and normal layouts), -properties associated with network layouts are not automatically re-evaluated -on render; the properties are cached, and any expensive layout algorithms are -only run after the layout is explicitly reset. - - -
- - - - - - - - -
-
Returns:
- -
{pv.Layout.Network} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Pack.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Pack.html deleted file mode 100644 index 77adbc3b..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Pack.html +++ /dev/null @@ -1,732 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Pack - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Pack -

- - -

- -
Extends - pv.Layout.Hierarchy.
- - - Implements a hierarchical layout using circle-packing. The meaning of -the exported mark prototypes changes slightly in the space-filling -implementation:

The pack layout support dynamic sizing for leaf nodes, if a -#size psuedo-property is specified. The default size function returns -1, causing all leaf nodes to be sized equally, and all internal nodes to be -sized by the number of leaf nodes they have as descendants. - -

The size function can be used in conjunction with the order property, -which allows the nodes to the sorted by the computed size. Note: for sorting -based on other data attributes, simply use the default null for the -order property, and sort the nodes beforehand using the pv.Dom -operator. - -

For more details on how to use this layout, see -pv.Layout.Hierarchy. - - -
Defined in: Pack.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty circle-packing layout.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- defaults -
-
Default properties for circle-packing layouts.
-
  -
- order -
-
The sibling node order.
-
  -
- spacing -
-
The spacing parameter; defaults to 1, which provides a little bit of padding -between sibling nodes and the enclosing circle.
-
- - - -
-
Fields borrowed from class pv.Layout.Network:
label, link, node
Fields borrowed from class pv.Panel:
canvas, children, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
size(f) -
-
Specifies the sizing function.
-
- - - -
-
Methods borrowed from class pv.Layout.Network:
reset
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Pack() -
- -
- Constructs a new, empty circle-packing layout. Layouts are not typically -constructed directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - -
-
See:
- -
"Visualization of large hierarchical data by circle packing" by W. Wang, -H. Wang, G. Dai, and H. Wang, ACM CHI 2006.
- -
- - -
- - - - -
- Field Detail -
- - -
- - {pv.Layout.Pack} - defaults - -
-
- Default properties for circle-packing layouts. The default spacing parameter -is 1 and the default order is "ascending". - - -
- - - - - - - - -
- - -
- - {string} - order - -
-
- The sibling node order. The default order is null, which means to -use the sibling order specified by the nodes property as-is. A value of -"ascending" will sort siblings in ascending order of size, while "descending" -will do the reverse. For sorting based on data attributes other than size, -use the default null for the order property, and sort the nodes -beforehand using the pv.Dom operator. - - -
- - - - - - -
-
See:
- -
pv.Dom.Node#sort
- -
- - - -
- - -
- - {number} - spacing - -
-
- The spacing parameter; defaults to 1, which provides a little bit of padding -between sibling nodes and the enclosing circle. Larger values increase the -spacing, by making the sibling nodes smaller; a value of zero makes the leaf -nodes as large as possible, with no padding on enclosing circles. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Layout.Pack} - size(f) - -
-
- Specifies the sizing function. By default, a sizing function is disabled and -all nodes are given constant size. The sizing function is invoked for each -leaf node in the tree (passed to the constructor). - -

For example, if the tree data structure represents a file system, with -files as leaf nodes, and each file has a bytes attribute, you can -specify a size function as: - -

    .size(function(d) d.bytes)
- -As with other properties, a size function may specify additional arguments to -access the data associated with the layout and any enclosing panels. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
the new sizing function.
- -
- - - - - -
-
Returns:
- -
{pv.Layout.Pack} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Partition.Fill.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Partition.Fill.html deleted file mode 100644 index e171c8e3..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Partition.Fill.html +++ /dev/null @@ -1,501 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Partition.Fill - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Partition.Fill -

- - -

- -
Extends - pv.Layout.Partition.
- - - A variant of partition layout that is space-filling. The meaning of -the exported mark prototypes changes slightly in the space-filling -implementation:

For more details on how to use this layout, see -pv.Layout.Partition. - - -
Defined in: Partition.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty space-filling partition layout.
-
- - - - - - - - -
-
Fields borrowed from class pv.Layout.Partition:
defaults, innerRadius, order, orient, outerRadius
Fields borrowed from class pv.Layout.Network:
label, link, node
Fields borrowed from class pv.Panel:
canvas, children, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - -
-
Methods borrowed from class pv.Layout.Partition:
size
Methods borrowed from class pv.Layout.Network:
reset
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Partition.Fill() -
- -
- Constructs a new, empty space-filling partition layout. Layouts are not -typically constructed directly; instead, they are added to an existing panel -via pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Partition.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Partition.html deleted file mode 100644 index 823808e2..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Partition.html +++ /dev/null @@ -1,800 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Partition - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Partition -

- - -

- -
Extends - pv.Layout.Hierarchy.
- - - Implemeents a hierarchical layout using the partition (or sunburst, -icicle) algorithm. This layout provides both node-link and space-filling -implementations of partition diagrams. In many ways it is similar to -pv.Layout.Cluster, except that leaf nodes are positioned based on -their distance from the root. - -

The partition layout support dynamic sizing for leaf nodes, if a -#size psuedo-property is specified. The default size function returns -1, causing all leaf nodes to be sized equally, and all internal nodes to be -sized by the number of leaf nodes they have as descendants. - -

The size function can be used in conjunction with the order property, -which allows the nodes to the sorted by the computed size. Note: for sorting -based on other data attributes, simply use the default null for the -order property, and sort the nodes beforehand using the pv.Dom -operator. - -

For more details on how to use this layout, see -pv.Layout.Hierarchy. - - -
Defined in: Partition.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty partition layout.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- defaults -
-
Default properties for partition layouts.
-
  - -
The inner radius; defaults to 0.
-
  -
- order -
-
The sibling node order.
-
  -
- orient -
-
The orientation.
-
  - -
The outer radius; defaults to fill the containing panel, based on the height -and width of the layout.
-
- - - -
-
Fields borrowed from class pv.Layout.Network:
label, link, node
Fields borrowed from class pv.Panel:
canvas, children, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
size(f) -
-
Specifies the sizing function.
-
- - - -
-
Methods borrowed from class pv.Layout.Network:
reset
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Partition() -
- -
- Constructs a new, empty partition layout. Layouts are not typically -constructed directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - -
-
See:
- -
pv.Layout.Partition.Fill
- -
- - -
- - - - -
- Field Detail -
- - -
- - {pv.Layout.Partition} - defaults - -
-
- Default properties for partition layouts. The default orientation is "top". - - -
- - - - - - - - -
- - -
- - {number} - innerRadius - -
-
- The inner radius; defaults to 0. This property applies only to radial -orientations, and can be used to compress the layout radially. Note that for -the node-link implementation, the root node is always at the center, -regardless of the value of this property; this property only affects internal -and leaf nodes. For the space-filling implementation, a non-zero value of -this property will result in the root node represented as a ring rather than -a circle. - - -
- - - - - - - - -
- - -
- - {string} - order - -
-
- The sibling node order. The default order is null, which means to -use the sibling order specified by the nodes property as-is. A value of -"ascending" will sort siblings in ascending order of size, while "descending" -will do the reverse. For sorting based on data attributes other than size, -use the default null for the order property, and sort the nodes -beforehand using the pv.Dom operator. - - -
- - - - - - -
-
See:
- -
pv.Dom.Node#sort
- -
- - - -
- - -
- - {string} - orient - -
-
- The orientation. The default orientation is "top", which means that the root -node is placed on the top edge, leaf nodes appear at the bottom, and internal -nodes are in-between. The following orientations are supported: - - -
- - - - - - - - -
- - -
- - {number} - outerRadius - -
-
- The outer radius; defaults to fill the containing panel, based on the height -and width of the layout. If the layout has no height and width specified, it -will extend to fill the enclosing panel. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Layout.Partition} - size(f) - -
-
- Specifies the sizing function. By default, a sizing function is disabled and -all nodes are given constant size. The sizing function is invoked for each -leaf node in the tree (passed to the constructor). - -

For example, if the tree data structure represents a file system, with -files as leaf nodes, and each file has a bytes attribute, you can -specify a size function as: - -

    .size(function(d) d.bytes)
- -As with other properties, a size function may specify additional arguments to -access the data associated with the layout and any enclosing panels. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
the new sizing function.
- -
- - - - - -
-
Returns:
- -
{pv.Layout.Partition} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Rollup.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Rollup.html deleted file mode 100644 index 2f56da16..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Rollup.html +++ /dev/null @@ -1,734 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Rollup - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Rollup -

- - -

- -
Extends - pv.Layout.Network.
- - - Implements a network visualization using a node-link diagram where -nodes are rolled up along two dimensions. This implementation is based on the -"PivotGraph" designed by Martin Wattenberg: - -

The method is designed for graphs that are "multivariate", i.e., -where each node is associated with several attributes. Unlike visualizations -which emphasize global graph topology, PivotGraph uses a simple grid-based -approach to focus on the relationship between node attributes & -connections.
- -This layout requires two psuedo-properties to be specified, which assign node -positions along the two dimensions #x and #y, corresponding -to the left and top properties, respectively. Typically, these functions are -specified using an pv.Scale.ordinal. Nodes that share the same -position in x and y are "rolled up" into a meta-node, and -similarly links are aggregated between meta-nodes. For example, to construct -a rollup to analyze links by gender and affiliation, first define two ordinal -scales: - -
var x = pv.Scale.ordinal(nodes, function(d) d.gender).split(0, w),
-    y = pv.Scale.ordinal(nodes, function(d) d.aff).split(0, h);
- -Next, define the position psuedo-properties: - -
    .x(function(d) x(d.gender))
-    .y(function(d) y(d.aff))
- -Linear and other quantitative scales can alternatively be used to position -the nodes along either dimension. Note, however, that the rollup requires -that the positions match exactly, and thus ordinal scales are recommended to -avoid precision errors. - -

Note that because this layout provides a visualization of the rolled up -graph, the data properties for the mark prototypes (node, -link and label) are different from most other network -layouts: they reference the rolled-up nodes and links, rather than the nodes -and links of the full network. The underlying nodes and links for each -rolled-up node and link can be accessed via the nodes and -links attributes, respectively. The aggregated link values for -rolled-up links can similarly be accessed via the linkValue -attribute. - -

For undirected networks, links are duplicated in both directions. For -directed networks, use directed(true). The graph is assumed to be -undirected by default. - - -
Defined in: Rollup.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty rollup network layout.
-
- - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- directed -
-
Whether the underlying network is directed.
-
- - - -
-
Fields borrowed from class pv.Layout.Network:
label, link, node
Fields borrowed from class pv.Panel:
canvas, children, defaults, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
x(f) -
-
Specifies the x-position function used to rollup nodes.
-
  -
y(f) -
-
Specifies the y-position function used to rollup nodes.
-
- - - -
-
Methods borrowed from class pv.Layout.Network:
reset
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Rollup() -
- -
- Constructs a new, empty rollup network layout. Layouts are not typically -constructed directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - -
-
See:
- -
"Visual Exploration of Multivariate Graphs" by M. Wattenberg, CHI 2006.
- -
- - -
- - - - -
- Field Detail -
- - -
- - {boolean} - directed - -
-
- Whether the underlying network is directed. By default, the graph is assumed -to be undirected, and links are rendered in both directions. If the network -is directed, then forward links are drawn above the diagonal, while reverse -links are drawn below. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Layout.Rollup} - x(f) - -
-
- Specifies the x-position function used to rollup nodes. The rolled up -nodes are positioned horizontally using the return values from the given -function. Typically the function is specified as an ordinal scale. For -single-dimension rollups, a constant value can be specified. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
the x-position function.
- -
- - - - - -
-
Returns:
- -
{pv.Layout.Rollup} this.
- -
- - - -
-
See:
- -
pv.Scale.ordinal
- -
- - -
- - -
- - {pv.Layout.Rollup} - y(f) - -
-
- Specifies the y-position function used to rollup nodes. The rolled up -nodes are positioned vertically using the return values from the given -function. Typically the function is specified as an ordinal scale. For -single-dimension rollups, a constant value can be specified. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
the y-position function.
- -
- - - - - -
-
Returns:
- -
{pv.Layout.Rollup} this.
- -
- - - -
-
See:
- -
pv.Scale.ordinal
- -
- - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Stack.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Stack.html deleted file mode 100644 index 76dba31c..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Stack.html +++ /dev/null @@ -1,994 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Stack - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Stack -

- - -

- -
Extends - pv.Layout.
- - - Implements a layout for stacked visualizations, ranging from simple -stacked bar charts to more elaborate "streamgraphs" composed of stacked -areas. Stack layouts uses length as a visual encoding, as opposed to -position, as the layers do not share an aligned axis. - -

Marks can be stacked vertically or horizontally. For example, - -

vis.add(pv.Layout.Stack)
-    .layers([[1, 1.2, 1.7, 1.5, 1.7],
-             [.5, 1, .8, 1.1, 1.3],
-             [.2, .5, .8, .9, 1]])
-    .x(function() this.index * 35)
-    .y(function(d) d * 40)
-  .layer.add(pv.Area);
- -specifies a vertically-stacked area chart, using the default "bottom-left" -orientation with "zero" offset. This visualization can be easily changed into -a streamgraph using the "wiggle" offset, which attempts to minimize change in -slope weighted by layer thickness. See the #offset property for more -supported streamgraph algorithms. - -

In the simplest case, the layer data can be specified as a two-dimensional -array of numbers. The x and y psuedo-properties are used to -define the thickness of each layer at the given position, respectively; in -the above example of the "bottom-left" orientation, the x and -y psuedo-properties are equivalent to the left and -height properties that you might use if you implemented a stacked -area by hand. - -

The advantage of using the stack layout is that the baseline, i.e., the -bottom property is computed automatically using the specified offset -algorithm. In addition, the order of layers can be computed using a built-in -algorithm via the order property. - -

With the exception of the "expand" offset, the stack layout does -not perform any automatic scaling of data; the values returned from -x and y specify pixel sizes. To simplify scaling math, use -this layout in conjunction with pv.Scale.linear or similar. - -

In other cases, the values psuedo-property can be used to define -the data more flexibly. As with a typical panel & area, the -layers property corresponds to the data in the enclosing panel, -while the values psuedo-property corresponds to the data for the -area within the panel. For example, given an array of data values: - -

var crimea = [
- { date: "4/1854", wounds: 0, other: 110, disease: 110 },
- { date: "5/1854", wounds: 0, other: 95, disease: 105 },
- { date: "6/1854", wounds: 0, other: 40, disease: 95 },
- ...
- -and a corresponding array of series names: - -
var causes = ["wounds", "other", "disease"];
- -Separate layers can be defined for each cause like so: - -
vis.add(pv.Layout.Stack)
-    .layers(causes)
-    .values(crimea)
-    .x(function(d) x(d.date))
-    .y(function(d, p) y(d[p]))
-  .layer.add(pv.Area)
-    ...
- -As with the panel & area case, the datum that is passed to the -psuedo-properties x and y are the values (an element in -crimea); the second argument is the layer data (a string in -causes). Additional arguments specify the data of enclosing panels, -if any. - - -
Defined in: Stack.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty stack layout.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- defaults -
-
Default properties for stack layouts.
-
  -
- layer -
-
The layer prototype.
-
  -
- layers -
-
The layer data in row-major order.
-
  -
- offset -
-
The layer offset; the y-position of the bottom of the lowest layer.
-
  -
- order -
-
The layer order.
-
  -
- orient -
-
The layer orientation.
-
- - - -
-
Fields borrowed from class pv.Panel:
canvas, children, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
values(f) -
-
The values function; determines the values for a given layer.
-
  -
x(f) -
-
The x psuedo-property; determines the position of the value within the layer.
-
  -
y(f) -
-
The y psuedo-property; determines the thickness of the layer at the given -value.
-
- - - -
-
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Stack() -
- -
- Constructs a new, empty stack layout. Layouts are not typically constructed -directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {pv.Layout.Stack} - defaults - -
-
- Default properties for stack layouts. The default orientation is -"bottom-left", the default offset is "zero", and the default layers is -[[]]. - - -
- - - - - - - - -
- - -
- - {pv.Mark} - layer - -
-
- The layer prototype. This prototype is intended to be used with an area, -bar or panel mark (or subclass thereof). Other mark types may be possible, -though note that the stack layout is not currently designed to support -radial stacked visualizations using wedges. - -

The layer is not a direct child of the stack layout; a hidden panel is -used to replicate layers. - - -

- - - - - - - - -
- - -
- - {array[]} - layers - -
-
- The layer data in row-major order. The value of this property is typically a -two-dimensional (i.e., nested) array, but any array can be used, provided the -values psuedo-property is defined accordingly. - - -
- - - - - - - - -
- - -
- - {string} - offset - -
-
- The layer offset; the y-position of the bottom of the lowest layer. The -following values are supported:For details on these offset algorithms, refer to "Stacked Graphs -- -Geometry & Aesthetics" by L. Byron and M. Wattenberg, IEEE TVCG -November/December 2008. - - -
- - - - - - - - -
- - -
- - {string} - order - -
-
- The layer order. The following values are supported:For details on the inside-out order algorithm, refer to "Stacked Graphs --- Geometry & Aesthetics" by L. Byron and M. Wattenberg, IEEE TVCG -November/December 2008. - - -
- - - - - - - - -
- - -
- - {string} - orient - -
-
- The layer orientation. The following values are supported:. The default value is "bottom-left", which means that the layers will -be built from the bottom-up, and the values within layers will be laid out -from left-to-right. - -

Note that with non-zero baselines, some orientations may give similar -results. For example, offset("silohouette") centers the layers, resulting in -a streamgraph. Thus, the orientations "bottom-left" and "top-left" will -produce similar results, differing only in the layer order. - - -

- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Layout.Stack} - values(f) - -
-
- The values function; determines the values for a given layer. The default -value is the identity function, which assumes that the layers property is -specified as a two-dimensional (i.e., nested) array. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
the values function.
- -
- - - - - -
-
Returns:
- -
{pv.Layout.Stack} this.
- -
- - - - -
- - -
- - {pv.Layout.Stack} - x(f) - -
-
- The x psuedo-property; determines the position of the value within the layer. -This typically corresponds to the independent variable. For example, with the -default "bottom-left" orientation, this function defines the "left" property. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
the x function.
- -
- - - - - -
-
Returns:
- -
{pv.Layout.Stack} this.
- -
- - - - -
- - -
- - {pv.Layout.Stack} - y(f) - -
-
- The y psuedo-property; determines the thickness of the layer at the given -value. This typically corresponds to the dependent variable. For example, -with the default "bottom-left" orientation, this function defines the -"height" property. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
the y function.
- -
- - - - - -
-
Returns:
- -
{pv.Layout.Stack} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Tree.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Tree.html deleted file mode 100644 index 94518770..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Tree.html +++ /dev/null @@ -1,692 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Tree - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Tree -

- - -

- -
Extends - pv.Layout.Hierarchy.
- - - Implements a node-link tree diagram using the Reingold-Tilford "tidy" -tree layout algorithm. The specific algorithm used by this layout is based on -"Improving -Walker's Algorithm to Run in Linear Time" by C. Buchheim, M. Jünger -& S. Leipert, Graph Drawing 2002. This layout supports both cartesian and -radial orientations orientations for node-link diagrams. - -

The tree layout supports a "group" property, which if true causes siblings -to be positioned closer together than unrelated nodes at the same depth. The -layout can be configured using the depth and breadth -properties, which control the increments in pixel space between nodes in both -dimensions, similar to the indent layout. - -

For more details on how to use this layout, see -pv.Layout.Hierarchy. - - -
Defined in: Tree.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty tree layout.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- breadth -
-
The offset between siblings nodes; defaults to 15.
-
  -
- defaults -
-
Default properties for tree layouts.
-
  -
- depth -
-
The offset between parent and child nodes; defaults to 60.
-
  -
- group -
-
The sibling grouping, i.e.
-
  -
- orient -
-
The orientation.
-
- - - -
-
Fields borrowed from class pv.Layout.Network:
label, link, node
Fields borrowed from class pv.Panel:
canvas, children, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - -
-
Methods borrowed from class pv.Layout.Network:
reset
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Tree() -
- -
- Constructs a new, empty tree layout. Layouts are not typically constructed -directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {number} - breadth - -
-
- The offset between siblings nodes; defaults to 15. - - -
- - - - - - - - -
- - -
- - {pv.Layout.Tree} - defaults - -
-
- Default properties for tree layouts. The default orientation is "top", the -default group parameter is 1, and the default breadth and depth offsets are -15 and 60 respectively. - - -
- - - - - - - - -
- - -
- - {number} - depth - -
-
- The offset between parent and child nodes; defaults to 60. - - -
- - - - - - - - -
- - -
- - {number} - group - -
-
- The sibling grouping, i.e., whether differentiating space is placed between -sibling groups. The default is 1 (or true), causing sibling leaves to be -separated by one breadth offset. Setting this to false (or 0) causes -non-siblings to be adjacent. - - -
- - - - - - - - -
- - -
- - {string} - orient - -
-
- The orientation. The default orientation is "top", which means that the root -node is placed on the top edge, leaf nodes appear at the bottom, and internal -nodes are in-between. The following orientations are supported: - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Treemap.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Treemap.html deleted file mode 100644 index 601cce03..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.Treemap.html +++ /dev/null @@ -1,983 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout.Treemap - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout.Treemap -

- - -

- -
Extends - pv.Layout.Hierarchy.
- - - Implements a space-filling rectangular layout, with the hierarchy -represented via containment. Treemaps represent nodes as boxes, with child -nodes placed within parent boxes. The size of each box is proportional to the -size of the node in the tree. This particular algorithm is taken from Bruls, -D.M., C. Huizing, and J.J. van Wijk, "Squarified Treemaps" in -Data Visualization 2000, Proceedings of the Joint Eurographics and IEEE -TCVG Sumposium on Visualization, 2000, pp. 33-42. - -

The meaning of the exported mark prototypes changes slightly in the -space-filling implementation:

For more details on how to use this layout, see -pv.Layout.Hierarchy. - - -
Defined in: Treemap.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new, empty treemap layout.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- defaults -
-
Default propertiess for treemap layouts.
-
  -
- mode -
-
The treemap algorithm.
-
  -
- order -
-
The sibling node order.
-
  - -
The bottom inset between parent and child in pixels.
-
  - -
The left inset between parent add child in pixels.
-
  - -
The right inset between parent add child in pixels.
-
  - -
The top inset between parent and child in pixels.
-
  -
- round -
-
Whether node sizes should be rounded to integer values.
-
- - - -
-
Fields borrowed from class pv.Layout.Network:
label, link, node
Fields borrowed from class pv.Panel:
canvas, children, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
padding(n) -
-
Alias for setting the left, right, top and bottom padding properties -simultaneously.
-
  -
size(f) -
-
Specifies the sizing function.
-
- - - -
-
Methods borrowed from class pv.Layout.Network:
reset
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout.Treemap() -
- -
- Constructs a new, empty treemap layout. Layouts are not typically -constructed directly; instead, they are added to an existing panel via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {pv.Layout.Treemap} - defaults - -
-
- Default propertiess for treemap layouts. The default mode is "squarify" and -the default order is "ascending". - - -
- - - - - - - - -
- - -
- - {string} - mode - -
-
- The treemap algorithm. The default value is "squarify". The "slice-and-dice" -algorithm may also be used, which alternates between horizontal and vertical -slices for different depths. In addition, the "slice" and "dice" algorithms -may be specified explicitly to control whether horizontal or vertical slices -are used, which may be useful for nested treemap layouts. - - -
- - - - - - -
-
See:
- -
"Ordered Treemap Layouts" by B. Shneiderman & M. Wattenberg, IEEE -InfoVis 2001.
- -
- - - -
- - -
- - {string} - order - -
-
- The sibling node order. A null value means to use the sibling order -specified by the nodes property as-is; "reverse" will reverse the given -order. The default value "ascending" will sort siblings in ascending order of -size, while "descending" will do the reverse. For sorting based on data -attributes other than size, use the default null for the order -property, and sort the nodes beforehand using the pv.Dom operator. - - -
- - - - - - - - -
- - -
- - {number} - paddingBottom - -
-
- The bottom inset between parent and child in pixels. Defaults to 0. - - -
- - - - - - -
-
See:
- -
#padding
- -
- - - -
- - -
- - {number} - paddingLeft - -
-
- The left inset between parent add child in pixels. Defaults to 0. - - -
- - - - - - -
-
See:
- -
#padding
- -
- - - -
- - -
- - {number} - paddingRight - -
-
- The right inset between parent add child in pixels. Defaults to 0. - - -
- - - - - - -
-
See:
- -
#padding
- -
- - - -
- - -
- - {number} - paddingTop - -
-
- The top inset between parent and child in pixels. Defaults to 0. - - -
- - - - - - -
-
See:
- -
#padding
- -
- - - -
- - -
- - {boolean} - round - -
-
- Whether node sizes should be rounded to integer values. This has a similar -effect to setting antialias(false) for node values, but allows the -treemap algorithm to accumulate error related to pixel rounding. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Layout.Treemap} - padding(n) - -
-
- Alias for setting the left, right, top and bottom padding properties -simultaneously. - - -
- - - - -
-
Parameters:
- -
- n - -
-
- -
- - - - - -
-
Returns:
- -
{pv.Layout.Treemap} this.
- -
- - - -
-
See:
- -
#paddingLeft
- -
#paddingRight
- -
#paddingTop
- -
#paddingBottom
- -
- - -
- - -
- - {pv.Layout.Treemap} - size(f) - -
-
- Specifies the sizing function. By default, the size function uses the -nodeValue attribute of nodes as a numeric value: function(d) -Number(d.nodeValue). - -

The sizing function is invoked for each leaf node in the tree, per the -nodes property. For example, if the tree data structure represents a -file system, with files as leaf nodes, and each file has a bytes -attribute, you can specify a size function as: - -

    .size(function(d) d.bytes)
- - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
the new sizing function.
- -
- - - - - -
-
Returns:
- -
{pv.Layout.Treemap} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.html deleted file mode 100644 index 1c7933e2..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Layout.html +++ /dev/null @@ -1,512 +0,0 @@ - - - - - - - JsDoc Reference - pv.Layout - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Layout -

- - -

- -
Extends - pv.Panel.
- - - Represents an abstract layout, encapsulating a visualization technique -such as a streamgraph or treemap. Layouts are themselves containers, -extending from pv.Panel, and defining a set of mark prototypes as -children. These mark prototypes provide default properties that together -implement the given visualization technique. - -

Layouts do not initially contain any marks; any exported marks (such as a -network layout's link and node) are intended to be used as -prototypes. By adding a concrete mark, such as a pv.Bar, to the -appropriate mark prototype, the mark is added to the layout and inherits the -given properties. This approach allows further customization of the layout, -either by choosing a different mark type to add, or more simply by overriding -some of the layout's defined properties. - -

Each concrete layout, such as treemap or circle-packing, has different -behavior and may export different mark prototypes, depending on what marks -are typically needed to render the desired visualization. Therefore it is -important to understand how each layout is structured, such that the provided -mark prototypes are used appropriately. - -

In addition to the mark prototypes, layouts may define custom properties -that affect the overall behavior of the layout. For example, a treemap layout -might use a property to specify which layout algorithm to use. These -properties are just like other mark properties, and can be defined as -constants or as functions. As with panels, the data property can be used to -replicate layouts, and properties can be defined to in terms of layout data. - - -
Defined in: Layout.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Layout() -
-
Constructs a new, empty layout with default properties.
-
- - - - - - - - -
-
Fields borrowed from class pv.Panel:
canvas, children, defaults, overflow, transform
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - -
-
Methods borrowed from class pv.Panel:
add, anchor
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Layout() -
- -
- Constructs a new, empty layout with default properties. Layouts are not -typically constructed directly; instead, a concrete subclass is added to an -existing panel via pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Line.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Line.html deleted file mode 100644 index f79ee48e..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Line.html +++ /dev/null @@ -1,950 +0,0 @@ - - - - - - - JsDoc Reference - pv.Line - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Line -

- - -

- -
Extends - pv.Mark.
- - - Represents a series of connected line segments, or polyline, -that can be stroked with a configurable color and thickness. Each -articulation point in the line corresponds to a datum; for n points, -n-1 connected line segments are drawn. The point is positioned using -the box model. Arbitrary paths are also possible, allowing radar plots and -other custom visualizations. - -

Like areas, lines can be stroked and filled with arbitrary colors. In most -cases, lines are only stroked, but the fill style can be used to construct -arbitrary polygons. - -

See also the Line guide. - - -
Defined in: Line.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Line() -
-
Constructs a new line mark with default properties.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- defaults -
-
Default properties for lines.
-
  - -
The eccentricity of polar line segments; used in conjunction with -interpolate("polar").
-
  -
- fillStyle -
-
The line fill style; if non-null, the interior of the line is closed and -filled with the specified color.
-
  - -
How to interpolate between values.
-
  -
- lineJoin -
-
The type of corners where two lines meet.
-
  -
- lineWidth -
-
The width of stroked lines, in pixels; used in conjunction with -strokeStyle to stroke the line.
-
  -
- segmented -
-
Whether the line is segmented; whether variations in stroke style, line width -and the other properties are treated as fixed.
-
  - -
The style of stroked lines; used in conjunction with lineWidth to -stroke the line.
-
  -
- tension -
-
The tension of cardinal splines; used in conjunction with -interpolate("cardinal").
-
- - - -
-
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
anchor(name) -
-
Constructs a new line anchor with default properties.
-
- - - -
-
Methods borrowed from class pv.Mark:
add, anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Line() -
- -
- Constructs a new line mark with default properties. Lines are not typically -constructed directly, but by adding to a panel or an existing mark via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {pv.Line} - defaults - -
-
- Default properties for lines. By default, there is no fill and the stroke -style is a categorical color. The default interpolation is linear. - - -
- - - - - - - - -
- - -
- - {number} - eccentricity - -
-
- The eccentricity of polar line segments; used in conjunction with -interpolate("polar"). The default value of 0 means that line segments are -drawn as circular arcs. A value of 1 draws a straight line. A value between 0 -and 1 draws an elliptical arc with the given eccentricity. - - -
- - - - - - - - -
- - -
- - {string} - fillStyle - -
-
- The line fill style; if non-null, the interior of the line is closed and -filled with the specified color. The default value of this property is a -null, meaning that lines are not filled by default. - -

This property is fixed. See pv.Mark. - - -

- - - - - - -
-
See:
- -
pv.color
- -
- - - -
- - -
- - {string} - interpolate - -
-
- How to interpolate between values. Linear interpolation ("linear") is the -default, producing a straight line between points. For piecewise constant -functions (i.e., step functions), either "step-before" or "step-after" can be -specified. To draw a clockwise circular arc between points, specify "polar"; -to draw a counterclockwise circular arc between points, specify -"polar-reverse". To draw open uniform b-splines, specify "basis". To draw -cardinal splines, specify "cardinal"; see also #tension. - -

This property is fixed. See pv.Mark. - - -

- - - - - - - - -
- - -
- - {string} - lineJoin - -
-
- The type of corners where two lines meet. Accepted values are "bevel", -"round" and "miter". The default value is "miter". - -

For segmented lines, only "miter" joins and "linear" interpolation are -currently supported. Any other value, including null, will disable joins, -producing disjoint line segments. Note that the miter joins must be computed -manually (at least in the current SVG renderer); since this calculation may -be expensive and unnecessary for small lines, specifying null can improve -performance significantly. - -

This property is fixed. See pv.Mark. - - -

- - - - - - - - -
- - -
- - {number} - lineWidth - -
-
- The width of stroked lines, in pixels; used in conjunction with -strokeStyle to stroke the line. - - -
- - - - - - - - -
- - -
- - {boolean} - segmented - -
-
- Whether the line is segmented; whether variations in stroke style, line width -and the other properties are treated as fixed. Rendering segmented lines is -noticeably slower than non-segmented lines. - -

This property is fixed. See pv.Mark. - - -

- - - - - - - - -
- - -
- - {string} - strokeStyle - -
-
- The style of stroked lines; used in conjunction with lineWidth to -stroke the line. The default value of this property is a categorical color. - - -
- - - - - - -
-
See:
- -
pv.color
- -
- - - -
- - -
- - {number} - tension - -
-
- The tension of cardinal splines; used in conjunction with -interpolate("cardinal"). A value between 0 and 1 draws cardinal splines with -the given tension. In some sense, the tension can be interpreted as the -"length" of the tangent; a tension of 1 will yield all zero tangents (i.e., -linear interpolation), and a tension of 0 yields a Catmull-Rom spline. The -default value is 0.7. - -

This property is fixed. See pv.Mark. - - -

- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Anchor} - anchor(name) - -
-
- Constructs a new line anchor with default properties. Lines support five -different anchors:In addition to positioning properties (left, right, top bottom), the -anchors support text rendering properties (text-align, text-baseline). Text is -rendered to appear outside the line. Note that this behavior is different -from other mark anchors, which default to rendering text inside the -mark. - -

For consistency with the other mark types, the anchor positions are -defined in terms of their opposite edge. For example, the top anchor defines -the bottom property, such that a bar added to the top anchor grows upward. - - -

- - - - -
-
Parameters:
- -
- {string} name - -
-
the anchor name; either a string or a property function.
- -
- - - - - -
-
Returns:
- -
{pv.Anchor}
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Mark.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Mark.html deleted file mode 100644 index 7ed48c91..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Mark.html +++ /dev/null @@ -1,1801 +0,0 @@ - - - - - - - JsDoc Reference - pv.Mark - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Mark -

- - -

- - - - Represents a data-driven graphical mark. The Mark class is -the base class for all graphical marks in Protovis; it does not provide any -specific rendering functionality, but together with Panel establishes -the core framework. - -

Concrete mark types include familiar visual elements such as bars, lines -and labels. Although a bar mark may be used to construct a bar chart, marks -know nothing about charts; it is only through their specification and -composition that charts are produced. These building blocks permit many -combinatorial possibilities. - -

Marks are associated with data: a mark is generated once per -associated datum, mapping the datum to visual properties such as -position and color. Thus, a single mark specification represents a set of -visual elements that share the same data and visual encoding. The type of -mark defines the names of properties and their meaning. A property may be -static, ignoring the associated datum and returning a constant; or, it may be -dynamic, derived from the associated datum or index. Such dynamic encodings -can be specified succinctly using anonymous functions. Special properties -called event handlers can be registered to add interactivity. - -

Protovis uses inheritance to simplify the specification of related -marks: a new mark can be derived from an existing mark, inheriting its -properties. The new mark can then override properties to specify new -behavior, potentially in terms of the old behavior. In this way, the old mark -serves as the prototype for the new mark. Most mark types share the -same basic properties for consistency and to facilitate inheritance. - -

The prioritization of redundant properties is as follows:

    - -
  1. If the width property is not specified (i.e., null), its value -is the width of the parent panel, minus this mark's left and right margins; -the left and right margins are zero if not specified. - -
  2. Otherwise, if the right margin is not specified, its value is -the width of the parent panel, minus this mark's width and left margin; the -left margin is zero if not specified. - -
  3. Otherwise, if the left property is not specified, its value is -the width of the parent panel, minus this mark's width and the right margin. - -
This prioritization is then duplicated for the height, -bottom and top properties, respectively. - -

While most properties are variable, some mark types, such as lines -and areas, generate a single visual element rather than a distinct visual -element per datum. With these marks, some properties may be fixed. -Fixed properties can vary per mark, but not per datum! These -properties are evaluated solely for the first (0-index) datum, and typically -are specified as a constant. However, it is valid to use a function if the -property varies between panels or is dynamically generated. - -

See also the Protovis guide. - - -
Defined in: Mark.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Mark() -
-
Constructs a new mark with default properties.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- bottom -
-
The bottom margin; the distance, in pixels, between the bottom edge of the -enclosing panel and the bottom edge of this mark.
-
  - -
The child index.
-
  -
- cursor -
-
The cursor property; corresponds to the CSS cursor property.
-
  -
- data -
-
The data property; an array of objects.
-
  -
- defaults -
-
Default properties for all mark types.
-
  -
- events -
-
The events property; corresponds to the SVG pointer-events property, -specifying how the mark should participate in mouse events.
-
  -
- index -
-
The mark index.
-
  -
- left -
-
The left margin; the distance, in pixels, between the left edge of the -enclosing panel and the left edge of this mark.
-
  -
- parent -
-
The enclosing parent panel.
-
  -
- proto -
-
The mark prototype, possibly undefined, from which to inherit property -functions.
-
  -
- reverse -
-
The reverse property; a boolean determining whether marks are ordered from -front-to-back or back-to-front.
-
  -
- right -
-
The right margin; the distance, in pixels, between the right edge of the -enclosing panel and the right edge of this mark.
-
  -
- root -
-
The root parent panel.
-
  -
- scale -
-
The current scale factor, based on any enclosing transforms.
-
  -
- title -
-
The title property; corresponds to the HTML/SVG title property, allowing the -general of simple plain text tooltips.
-
  -
- top -
-
The top margin; the distance, in pixels, between the top edge of the -enclosing panel and the top edge of this mark.
-
  -
- type -
-
The mark type; a lower camelCase name.
-
  -
- visible -
-
The visible property; a boolean determining whether or not the mark instance -is visible.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
add(type) -
-
Adds a new mark of the specified type to the enclosing parent panel, whilst -simultaneously setting the prototype of the new mark to be this mark.
-
  -
anchor(name) -
-
Returns an anchor with the specified name.
-
  - -
Returns the anchor target of this mark, if it is derived from an anchor; -otherwise returns null.
-
  -
def(name, v) -
-
Defines a custom property on this mark.
-
  -
event(type, handler) -
-
Registers an event handler for the specified event type with this mark.
-
  -
extend(proto) -
-
Sets the prototype of this mark to the specified mark.
-
  -
margin(n) -
-
Alias for setting the left, right, top and bottom properties simultaneously.
-
  -
mouse() -
-
Returns the current location of the mouse (cursor) relative to this mark's -parent.
-
  -
render() -
-
Renders this mark, including recursively rendering all child marks if this is -a panel.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Mark() -
- -
- Constructs a new mark with default properties. Marks, with the exception of -the root panel, are not typically constructed directly; instead, they are -added to a panel or an existing mark via pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {number} - bottom - -
-
- The bottom margin; the distance, in pixels, between the bottom edge of the -enclosing panel and the bottom edge of this mark. Note that in some cases -this property may be redundant with the top property, or with the conjunction -of top and height. - - -
- - - - - - - - -
- - -
- - {number} - childIndex - -
-
- The child index. -1 if the enclosing parent panel is null; otherwise, the -zero-based index of this mark into the parent panel's children array. - - -
- - - - - - - - -
- - -
- - {string} - cursor - -
-
- The cursor property; corresponds to the CSS cursor property. This is -typically used in conjunction with event handlers to indicate interactivity. - - -
- - - - - - -
-
See:
- -
CSS2 cursor
- -
- - - -
- - -
- - {array} - data - -
-
- The data property; an array of objects. The size of the array determines the -number of marks that will be instantiated; each element in the array will be -passed to property functions to compute the property values. Typically, the -data property is specified as a constant array, such as - -
m.data([1, 2, 3, 4, 5]);
- -However, it is perfectly acceptable to define the data property as a -function. This function might compute the data dynamically, allowing -different data to be used per enclosing panel. For instance, in the stacked -area graph example (see #scene), the data function on the area mark -dereferences each series. - - -
- - - - - - - - -
- - -
- - {pv.Mark} - defaults - -
-
- Default properties for all mark types. By default, the data array is the -parent data as a single-element array; if the data property is not specified, -this causes each mark to be instantiated as a singleton with the parents -datum. The visible property is true by default, and the reverse property is -false. - - -
- - - - - - - - -
- - -
- - {string} - events - -
-
- The events property; corresponds to the SVG pointer-events property, -specifying how the mark should participate in mouse events. The default value -is "painted". Supported values are: - -

"painted": The given mark may receive events when the mouse is over a -"painted" area. The painted areas are the interior (i.e., fill) of the mark -if a 'fillStyle' is specified, and the perimeter (i.e., stroke) of the mark -if a 'strokeStyle' is specified. - -

"all": The given mark may receive events when the mouse is over either the -interior (i.e., fill) or the perimeter (i.e., stroke) of the mark, regardless -of the specified fillStyle and strokeStyle. - -

"none": The given mark may not receive events. - - -

- - - - - - - - -
- - -
- - {number} - index - -
-
- The mark index. The value of this field depends on which instance (i.e., -which element of the data array) is currently being evaluated. During the -build phase, the index is incremented over each datum; when handling events, -the index is set to the instance that triggered the event. - - -
- - - - - - - - -
- - -
- - {number} - left - -
-
- The left margin; the distance, in pixels, between the left edge of the -enclosing panel and the left edge of this mark. Note that in some cases this -property may be redundant with the right property, or with the conjunction of -right and width. - - -
- - - - - - - - -
- - -
- - {pv.Panel} - parent - -
-
- The enclosing parent panel. The parent panel is generally undefined only for -the root panel; however, it is possible to create "offscreen" marks that are -used only for inheritance purposes. - - -
- - - - - - - - -
- - -
- - {pv.Mark} - proto - -
-
- The mark prototype, possibly undefined, from which to inherit property -functions. The mark prototype is not necessarily of the same type as this -mark. Any properties defined on this mark will override properties inherited -either from the prototype or from the type-specific defaults. - - -
- - - - - - - - -
- - -
- - {boolean} - reverse - -
-
- The reverse property; a boolean determining whether marks are ordered from -front-to-back or back-to-front. SVG does not support explicit z-ordering; -shapes are rendered in the order they appear. Thus, by default, marks are -rendered in data order. Setting the reverse property to false reverses the -order in which they are rendered; however, the properties are still evaluated -(i.e., built) in forward order. - - -
- - - - - - - - -
- - -
- - {number} - right - -
-
- The right margin; the distance, in pixels, between the right edge of the -enclosing panel and the right edge of this mark. Note that in some cases this -property may be redundant with the left property, or with the conjunction of -left and width. - - -
- - - - - - - - -
- - -
- - {pv.Panel} - root - -
-
- The root parent panel. This may be undefined for "offscreen" marks that are -created for inheritance purposes only. - - -
- - - - - - - - -
- - -
- - {number} - scale - -
-
- The current scale factor, based on any enclosing transforms. The current -scale can be used to create scale-independent graphics. For example, to -define a dot that has a radius of 10 irrespective of any zooming, say: - -
dot.radius(function() 10 / this.scale)
- -Note that the stroke width and font size are defined irrespective of scale -(i.e., in screen space) already. Also note that when a transform is applied -to a panel, the scale affects only the child marks, not the panel itself. - - -
- - - - - - -
-
See:
- -
pv.Panel#transform
- -
- - - -
- - -
- - {string} - title - -
-
- The title property; corresponds to the HTML/SVG title property, allowing the -general of simple plain text tooltips. - - -
- - - - - - - - -
- - -
- - {number} - top - -
-
- The top margin; the distance, in pixels, between the top edge of the -enclosing panel and the top edge of this mark. Note that in some cases this -property may be redundant with the bottom property, or with the conjunction -of bottom and height. - - -
- - - - - - - - -
- - -
- - {string} - type - -
-
- The mark type; a lower camelCase name. The type name controls rendering -behavior, and unless the rendering engine is extended, must be one of the -built-in concrete mark types: area, bar, dot, image, label, line, panel, -rule, or wedge. - - -
- - - - - - - - -
- - -
- - {boolean} - visible - -
-
- The visible property; a boolean determining whether or not the mark instance -is visible. If a mark instance is not visible, its other properties will not -be evaluated. Similarly, for panels no child marks will be rendered. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Mark} - add(type) - -
-
- Adds a new mark of the specified type to the enclosing parent panel, whilst -simultaneously setting the prototype of the new mark to be this mark. - - -
- - - - -
-
Parameters:
- -
- {function} type - -
-
the type of mark to add; a constructor, such as -pv.Bar.
- -
- - - - - -
-
Returns:
- -
{pv.Mark} the new mark.
- -
- - - -
-
See:
- -
#extend
- -
- - -
- - -
- - {pv.Anchor} - anchor(name) - -
-
- Returns an anchor with the specified name. All marks support the five -standard anchor names:In addition to positioning properties (left, right, top bottom), the -anchors support text rendering properties (text-align, text-baseline). Text is -rendered to appear inside the mark by default. - -

To facilitate stacking, anchors are defined in terms of their opposite -edge. For example, the top anchor defines the bottom property, such that the -mark extends upwards; the bottom anchor instead defines the top property, -such that the mark extends downwards. See also pv.Layout.Stack. - -

While anchor names are typically constants, the anchor name is a true -property, which means you can specify a function to compute the anchor name -dynamically. See the pv.Anchor#name property for details. - - -

- - - - -
-
Parameters:
- -
- {string} name - -
-
the anchor name; either a string or a property function.
- -
- - - - - -
-
Returns:
- -
{pv.Anchor} the new anchor.
- -
- - - - -
- - -
- - {pv.Mark} - anchorTarget() - -
-
- Returns the anchor target of this mark, if it is derived from an anchor; -otherwise returns null. For example, if a label is derived from a bar anchor, - -
bar.anchor("top").add(pv.Label);
- -then property functions on the label can refer to the bar via the -anchorTarget method. This method is also useful for mark types -defining properties on custom anchors. - - -
- - - - - - - - -
-
Returns:
- -
{pv.Mark} the anchor target of this mark; possibly null.
- -
- - - - -
- - -
- - - def(name, v) - -
-
- Defines a custom property on this mark. Custom properties are currently -fixed, in that they are initialized once per mark set (i.e., per parent panel -instance). Custom properties can be used to store local state for the mark, -such as data needed by other properties (e.g., a custom scale) or interaction -state. - -

WARNING We plan on changing this feature in a future release to define -standard properties, as opposed to fixed properties that behave -idiosyncratically within event handlers. Furthermore, we recommend storing -state in an external data structure, rather than tying it to the -visualization specification as with defs. - - -

- - - - -
-
Parameters:
- -
- {string} name - -
-
the name of the local variable.
- -
- {function} v - Optional -
-
an optional initializer; may be a constant or a -function.
- -
- - - - - - - - -
- - -
- - {pv.Mark} - event(type, handler) - -
-
- Registers an event handler for the specified event type with this mark. When -an event of the specified type is triggered, the specified handler will be -invoked. The handler is invoked in a similar method to property functions: -the context is this mark instance, and the arguments are the full -data stack. Event handlers can use property methods to manipulate the display -properties of the mark: - -
m.event("click", function() this.fillStyle("red"));
- -Alternatively, the external data can be manipulated and the visualization -redrawn: - -
m.event("click", function(d) {
-    data = all.filter(function(k) k.name == d);
-    vis.render();
-  });
- -The return value of the event handler determines which mark gets re-rendered. -Use defs (#def) to set temporary state from event handlers. - -

The complete set of event types is defined by SVG; see the reference -below. The set of supported event types is:

Since Protovis does not specify any concept of focus, it does not -support key events; these should be handled outside the visualization using -standard JavaScript. In the future, support for interaction may be extended -to support additional event types, particularly those most relevant to -interactive visualization, such as selection. - -

TODO In the current implementation, event handlers are not inherited from -prototype marks. They must be defined explicitly on each interactive mark. In -addition, only one event handler for a given event type can be defined; when -specifying multiple event handlers for the same type, only the last one will -be used. - - -

- - - - -
-
Parameters:
- -
- {string} type - -
-
the event type.
- -
- {function} handler - -
-
the event handler.
- -
- - - - - -
-
Returns:
- -
{pv.Mark} this.
- -
- - - -
-
See:
- -
SVG events
- -
- - -
- - -
- - {pv.Mark} - extend(proto) - -
-
- Sets the prototype of this mark to the specified mark. Any properties not -defined on this mark may be inherited from the specified prototype mark, or -its prototype, and so on. The prototype mark need not be the same type of -mark as this mark. (Note that for inheritance to be useful, properties with -the same name on different mark types should have equivalent meaning.) - - -
- - - - -
-
Parameters:
- -
- {pv.Mark} proto - -
-
the new prototype.
- -
- - - - - -
-
Returns:
- -
{pv.Mark} this mark.
- -
- - - -
-
See:
- -
#add
- -
- - -
- - -
- - {pv.Mark} - margin(n) - -
-
- Alias for setting the left, right, top and bottom properties simultaneously. - - -
- - - - -
-
Parameters:
- -
- n - -
-
- -
- - - - - -
-
Returns:
- -
{pv.Mark} this.
- -
- - - -
-
See:
- -
#left
- -
#right
- -
#top
- -
#bottom
- -
- - -
- - -
- - {pv.Vector} - mouse() - -
-
- Returns the current location of the mouse (cursor) relative to this mark's -parent. The x coordinate corresponds to the left margin, while the -y coordinate corresponds to the top margin. - - -
- - - - - - - - -
-
Returns:
- -
{pv.Vector} the mouse location.
- -
- - - - -
- - -
- - - render() - -
-
- Renders this mark, including recursively rendering all child marks if this is -a panel. This method finds all instances of this mark and renders them. This -method descends recursively to the level of the mark to be rendered, finding -all visible instances of the mark. After the marks are rendered, the scene -and index attributes are removed from the mark to restore them to a clean -state. - -

If an enclosing panel has an index property set (as is the case inside in -an event handler), then only instances of this mark inside the given instance -of the panel will be rendered; otherwise, all visible instances of the mark -will be rendered. - - -

- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Nest.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Nest.html deleted file mode 100644 index 31ad5b4c..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Nest.html +++ /dev/null @@ -1,904 +0,0 @@ - - - - - - - JsDoc Reference - pv.Nest - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Nest -

- - -

- - - - Represents a Nest operator for the specified array. Nesting -allows elements in an array to be grouped into a hierarchical tree -structure. The levels in the tree are specified by key functions. The -leaf nodes of the tree can be sorted by value, while the internal nodes can -be sorted by key. Finally, the tree can be returned either has a -multidimensional array via #entries, or as a hierarchical map via -#map. The #rollup routine similarly returns a map, collapsing -the elements in each leaf node using a summary function. - -

For example, consider the following tabular data structure of Barley -yields, from various sites in Minnesota during 1931-2: - -

{ yield: 27.00, variety: "Manchuria", year: 1931, site: "University Farm" },
-{ yield: 48.87, variety: "Manchuria", year: 1931, site: "Waseca" },
-{ yield: 27.43, variety: "Manchuria", year: 1931, site: "Morris" }, ...
- -To facilitate visualization, it may be useful to nest the elements first by -year, and then by variety, as follows: - -
var nest = pv.nest(yields)
-    .key(function(d) d.year)
-    .key(function(d) d.variety)
-    .entries();
- -This returns a nested array. Each element of the outer array is a key-values -pair, listing the values for each distinct key: - -
{ key: 1931, values: [
-  { key: "Manchuria", values: [
-      { yield: 27.00, variety: "Manchuria", year: 1931, site: "University Farm" },
-      { yield: 48.87, variety: "Manchuria", year: 1931, site: "Waseca" },
-      { yield: 27.43, variety: "Manchuria", year: 1931, site: "Morris" },
-      ...
-    ] },
-  { key: "Glabron", values: [
-      { yield: 43.07, variety: "Glabron", year: 1931, site: "University Farm" },
-      { yield: 55.20, variety: "Glabron", year: 1931, site: "Waseca" },
-      ...
-    ] },
-  ] },
-{ key: 1932, values: ... }
- -Further details, including sorting and rollup, is provided below on the -corresponding methods. - - -
Defined in: Nest.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Nest(array) -
-
Constructs a nest operator for the specified array.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
entries() -
-
Returns a hierarchical nested array.
-
  -
key(key) -
-
Nests using the specified key function.
-
  -
map() -
-
Returns a hierarchical map of values.
-
  -
rollup(f) -
-
Returns a rollup map.
-
  -
sortKeys(order) -
-
Sorts the previously-added keys.
-
  -
sortValues(order) -
-
Sorts the leaf values.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Nest(array) -
- -
- Constructs a nest operator for the specified array. This constructor should -not be invoked directly; use pv.nest instead. - -
- - - - - -
-
Parameters:
- -
- {array} array - -
-
an array of elements to nest.
- -
- - - - - - - - -
- - - - - - - -
- Method Detail -
- - -
- - - entries() - -
-
- Returns a hierarchical nested array. This method is similar to -pv.entries, but works recursively on the entire hierarchy. Rather -than returning a map like #map, this method returns a nested -array. Each element of the array has a key and values -field. For leaf nodes, the values array will be a subset of the -underlying elements array; for non-leaf nodes, the values array will -contain more key-values pairs. - -

For an example usage, see the Nest constructor. - - -

- - - - - - - - -
-
Returns:
- -
a hierarchical nested array.
- -
- - - - -
- - -
- - {pv.Nest} - key(key) - -
-
- Nests using the specified key function. Multiple keys may be added to the -nest; the array elements will be nested in the order keys are specified. - - -
- - - - -
-
Parameters:
- -
- {function} key - -
-
a key function; must return a string or suitable map -key.
- -
- - - - - -
-
Returns:
- -
{pv.Nest} this.
- -
- - - - -
- - -
- - - map() - -
-
- Returns a hierarchical map of values. Each key adds one level to the -hierarchy. With only a single key, the returned map will have a key for each -distinct value of the key function; the correspond value with be an array of -elements with that key value. If a second key is added, this will be a nested -map. For example: - -
pv.nest(yields)
-    .key(function(d) d.variety)
-    .key(function(d) d.site)
-    .map()
- -returns a map m such that m[variety][site] is an array, a subset of -yields, with each element having the given variety and site. - - -
- - - - - - - - -
-
Returns:
- -
a hierarchical map of values.
- -
- - - - -
- - -
- - - rollup(f) - -
-
- Returns a rollup map. The behavior of this method is the same as -#map, except that the leaf values are replaced with the return value -of the specified rollup function f. For example, - -
pv.nest(yields)
-     .key(function(d) d.site)
-     .rollup(function(v) pv.median(v, function(d) d.yield))
- -first groups yield data by site, and then returns a map from site to median -yield for the given site. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
a rollup function.
- -
- - - - - -
-
Returns:
- -
a hierarchical map, with the leaf values computed by f.
- -
- - - -
-
See:
- -
#map
- -
- - -
- - -
- - {pv.Nest} - sortKeys(order) - -
-
- Sorts the previously-added keys. The natural sort order is used by default -(see pv.naturalOrder); if an alternative order is desired, -order should be a comparator function. If this method is not called -(i.e., keys are unsorted), keys will appear in the order they appear -in the underlying elements array. For example, - -
pv.nest(yields)
-    .key(function(d) d.year)
-    .key(function(d) d.variety)
-    .sortKeys()
-    .entries()
- -groups yield data by year, then variety, and sorts the variety groups -lexicographically (since the variety attribute is a string). - -

Key sort order is only used in conjunction with #entries, which -returns an array of key-values pairs. If the nest is used to construct a -#map instead, keys are unsorted. - - -

- - - - -
-
Parameters:
- -
- {function} order - Optional -
-
an optional comparator function.
- -
- - - - - -
-
Returns:
- -
{pv.Nest} this.
- -
- - - - -
- - -
- - {pv.Nest} - sortValues(order) - -
-
- Sorts the leaf values. The natural sort order is used by default (see -pv.naturalOrder); if an alternative order is desired, order -should be a comparator function. If this method is not called (i.e., values -are unsorted), values will appear in the order they appear in the -underlying elements array. For example, - -
pv.nest(yields)
-    .key(function(d) d.year)
-    .key(function(d) d.variety)
-    .sortValues(function(a, b) a.yield - b.yield)
-    .entries()
- -groups yield data by year, then variety, and sorts the values for each -variety group by yield. - -

Value sort order, unlike keys, applies to both #entries and -#map. It has no effect on #rollup. - - -

- - - - -
-
Parameters:
- -
- {function} order - Optional -
-
an optional comparator function.
- -
- - - - - -
-
Returns:
- -
{pv.Nest} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Panel.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Panel.html deleted file mode 100644 index 237606f4..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Panel.html +++ /dev/null @@ -1,857 +0,0 @@ - - - - - - - JsDoc Reference - pv.Panel - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Panel -

- - -

- -
Extends - pv.Bar.
- - - Represents a container mark. Panels allow repeated or nested -structures, commonly used in small multiple displays where a small -visualization is tiled to facilitate comparison across one or more -dimensions. Other types of visualizations may benefit from repeated and -possibly overlapping structure as well, such as stacked area charts. Panels -can also offset the position of marks to provide padding from surrounding -content. - -

All Protovis displays have at least one panel; this is the root panel to -which marks are rendered. The box model properties (four margins, width and -height) are used to offset the positions of contained marks. The data -property determines the panel count: a panel is generated once per associated -datum. When nested panels are used, property functions can declare additional -arguments to access the data associated with enclosing panels. - -

Panels can be rendered inline, facilitating the creation of sparklines. -This allows designers to reuse browser layout features, such as text flow and -tables; designers can also overlay HTML elements such as rich text and -images. - -

All panels have a children array (possibly empty) containing the -child marks in the order they were added. Panels also have a root -field which points to the root (outermost) panel; the root panel's root field -points to itself. - -

See also the Protovis guide. - - -
Defined in: Panel.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Panel() -
-
Constructs a new, empty panel with default properties.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- canvas -
-
The canvas element; either the string ID of the canvas element in the current -document, or a reference to the canvas element itself.
-
  -
- children -
-
The child marks; zero or more pv.Marks in the order they were -added.
-
  -
- defaults -
-
Default properties for panels.
-
  -
- overflow -
-
Specifies whether child marks are clipped when they overflow this panel.
-
  -
- transform -
-
The transform to be applied to child marks.
-
- - - -
-
Fields borrowed from class pv.Bar:
fillStyle, height, lineWidth, strokeStyle, width
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
add(type) -
-
Adds a new mark of the specified type to this panel.
-
  -
anchor(name) -
-
Returns an anchor with the specified name.
-
- - - -
-
Methods borrowed from class pv.Mark:
anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Panel() -
- -
- Constructs a new, empty panel with default properties. Panels, with the -exception of the root panel, are not typically constructed directly; instead, -they are added to an existing panel or mark via pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {string} - canvas - -
-
- The canvas element; either the string ID of the canvas element in the current -document, or a reference to the canvas element itself. If null, a canvas -element will be created and inserted into the document at the location of the -script element containing the current Protovis specification. This property -only applies to root panels and is ignored on nested panels. - -

Note: the "canvas" element here refers to a div (or other suitable -HTML container element), not a canvas element. The name of -this property is a historical anachronism from the first implementation that -used HTML 5 canvas, rather than SVG. - - -

- - - - - - - - -
- - -
- - {pv.Mark[]} - children - -
-
- The child marks; zero or more pv.Marks in the order they were -added. - - -
- - - - - - -
-
See:
- -
#add
- -
- - - -
- - -
- - {pv.Panel} - defaults - -
-
- Default properties for panels. By default, the margins are zero, the fill -style is transparent. - - -
- - - - - - - - -
- - -
- - {string} - overflow - -
-
- Specifies whether child marks are clipped when they overflow this panel. -This affects the clipping of all this panel's descendant marks. - - -
- - - - - - -
-
See:
- -
CSS2
- -
- - - -
- - -
- - {pv.Transform} - transform - -
-
- The transform to be applied to child marks. The default transform is -identity, which has no effect. Note that the panel's own fill and stroke are -not affected by the transform, and panel's transform only affects the -scale of child marks, not the panel itself. - - -
- - - - - - -
-
See:
- -
pv.Mark#scale
- -
- - - - - - - - - -
- Method Detail -
- - -
- - {pv.Mark} - add(type) - -
-
- Adds a new mark of the specified type to this panel. Unlike the normal -Mark#add behavior, adding a mark to a panel does not cause the mark -to inherit from the panel. Since the contained marks are offset by the panel -margins already, inheriting properties is generally undesirable; of course, -it is always possible to change this behavior by calling Mark#extend -explicitly. - - -
- - - - -
-
Parameters:
- -
- {function} type - -
-
the type of the new mark to add.
- -
- - - - - -
-
Returns:
- -
{pv.Mark} the new mark.
- -
- - - - -
- - -
- - {pv.Anchor} - anchor(name) - -
-
- Returns an anchor with the specified name. This method is overridden such -that adding to a panel's anchor adds to the panel, rather than to the panel's -parent. - - -
- - - - -
-
Parameters:
- -
- {string} name - -
-
the anchor name; either a string or a property function.
- -
- - - - - -
-
Returns:
- -
{pv.Anchor} the new anchor.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Particle.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Particle.html deleted file mode 100644 index 070be46e..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Particle.html +++ /dev/null @@ -1,778 +0,0 @@ - - - - - - - JsDoc Reference - pv.Particle - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Particle -

- - -

- - - - A weighted particle that can participate in a force simulation. - - -
Defined in: Particle.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Particle() -
-
Abstract; not implemented.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- fx -
-
The x-force on the particle.
-
  -
- fy -
-
The y-force on the particle.
-
  -
- next -
-
The next particle in the simulation.
-
  -
- px -
-
The x-position of the particle at -dt.
-
  -
- py -
-
The y-position of the particle at -dt.
-
  -
- vx -
-
The x-velocity of the particle.
-
  -
- vy -
-
The y-velocity of the particle.
-
  -
- x -
-
The x-position of the particle.
-
  -
- y -
-
The y-position of the particle.
-
- - - - - - - - - - - - -
-
- Class Detail -
- -
- pv.Particle() -
- -
- Abstract; not implemented. There is no explicit constructor; this class -merely serves to document the attributes that are used on particles in -physics simulations. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {number} - fx - -
-
- The x-force on the particle. - - -
- - - - - - - - -
- - -
- - {number} - fy - -
-
- The y-force on the particle. - - -
- - - - - - - - -
- - -
- - {pv.Particle} - next - -
-
- The next particle in the simulation. Particles form a singly-linked list. - - -
- - - - - - - - -
- - -
- - {number} - px - -
-
- The x-position of the particle at -dt. - - -
- - - - - - - - -
- - -
- - {number} - py - -
-
- The y-position of the particle at -dt. - - -
- - - - - - - - -
- - -
- - {number} - vx - -
-
- The x-velocity of the particle. - - -
- - - - - - - - -
- - -
- - {number} - vy - -
-
- The y-velocity of the particle. - - -
- - - - - - - - -
- - -
- - {number} - x - -
-
- The x-position of the particle. - - -
- - - - - - - - -
- - -
- - {number} - y - -
-
- The y-position of the particle. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Quadtree.Node.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Quadtree.Node.html deleted file mode 100644 index 302afde8..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Quadtree.Node.html +++ /dev/null @@ -1,658 +0,0 @@ - - - - - - - JsDoc Reference - pv.Quadtree.Node - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Quadtree.Node -

- - -

- - - - A node in a quadtree. - - -
Defined in: Quadtree.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a new node.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- c2 -
-
The child node for the second quadrant, if any.
-
  -
- c3 -
-
The child node for the third quadrant, if any.
-
  -
- c4 -
-
The child node for the fourth quadrant, if any.
-
  -
- leaf -
-
True if this node is a leaf node; i.e.
-
  -
- p -
-
The particle associated with this node, if any.
-
- - - - - - - - - - - - -
-
- Class Detail -
- -
- pv.Quadtree.Node() -
- -
- Constructs a new node. - -
- - - - - - - - - - - -
-
See:
- -
pv.Quadtree
- -
- - -
- - - - -
- Field Detail -
- - -
- - {pv.Quadtree.Node} - c2 - -
-
- The child node for the second quadrant, if any. - - -
- - - - - - - - -
- - -
- - {pv.Quadtree.Node} - c3 - -
-
- The child node for the third quadrant, if any. - - -
- - - - - - - - -
- - -
- - {pv.Quadtree.Node} - c4 - -
-
- The child node for the fourth quadrant, if any. - - -
- - - - - - - - -
- - -
- - {boolean} - leaf - -
-
- True if this node is a leaf node; i.e., it has no children. Note that both -leaf nodes and non-leaf (internal) nodes may have associated particles. If -this is a non-leaf node, then at least one of #c1, #c2, -#c3 or #c4 is guaranteed to be non-null. - - -
- - - - - - - - -
- - -
- - {pv.Particle} - p - -
-
- The particle associated with this node, if any. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Quadtree.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Quadtree.html deleted file mode 100644 index 5359ee84..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Quadtree.html +++ /dev/null @@ -1,676 +0,0 @@ - - - - - - - JsDoc Reference - pv.Quadtree - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Quadtree -

- - -

- - - - Represents a quadtree: a two-dimensional recursive spatial -subdivision. This particular implementation uses square partitions, dividing -each square into four equally-sized squares. Each particle exists in a unique -node; if multiple particles are in the same position, some particles may be -stored on internal nodes rather than leaf nodes. - -

This quadtree can be used to accelerate various spatial operations, such -as the Barnes-Hut approximation for computing n-body forces, or collision -detection. - - -
Defined in: Quadtree.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Quadtree(particles) -
-
Constructs a new quadtree for the specified array of particles.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- root -
-
The root node of the quadtree.
-
  -
- xMax -
-
The maximum x-coordinate value of all contained particles.
-
  -
- xMin -
-
The minimum x-coordinate value of all contained particles.
-
  -
- yMax -
-
The maximum y-coordinate value of all contained particles.
-
  -
- yMin -
-
The minimum y-coordinate value of all contained particles.
-
- - - - - - - - - - - - -
-
- Class Detail -
- -
- pv.Quadtree(particles) -
- -
- Constructs a new quadtree for the specified array of particles. - -
- - - - - -
-
Parameters:
- -
- {pv.Particle} particles - -
-
the linked list of particles.
- -
- - - - - - - -
-
See:
- -
pv.Force.charge
- -
pv.Constraint.collision
- -
- - -
- - - - -
- Field Detail -
- - -
- - {pv.Quadtree.Node} - root - -
-
- The root node of the quadtree. - - -
- - - - - - - - -
- - -
- - {number} - xMax - -
-
- The maximum x-coordinate value of all contained particles. - - -
- - - - - - - - -
- - -
- - {number} - xMin - -
-
- The minimum x-coordinate value of all contained particles. - - -
- - - - - - - - -
- - -
- - {number} - yMax - -
-
- The maximum y-coordinate value of all contained particles. - - -
- - - - - - - - -
- - -
- - {number} - yMin - -
-
- The minimum y-coordinate value of all contained particles. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Rule.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Rule.html deleted file mode 100644 index 4cf5c1b8..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Rule.html +++ /dev/null @@ -1,771 +0,0 @@ - - - - - - - JsDoc Reference - pv.Rule - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Rule -

- - -

- -
Extends - pv.Mark.
- - - Represents a horizontal or vertical rule. Rules are frequently used -for axes and grid lines. For example, specifying only the bottom property -draws horizontal rules, while specifying only the left draws vertical -rules. Rules can also be used as thin bars. The visual style is controlled in -the same manner as lines. - -

Rules are positioned exclusively the standard box model properties. The -following combinations of properties are supported: - - - - - - - - - - - - - - - - - - - - - -
PropertiesOrientation
leftvertical
rightvertical
left, bottom, topvertical
right, bottom, topvertical
tophorizontal
bottomhorizontal
top, left, righthorizontal
bottom, left, righthorizontal
left, top, heightvertical
left, bottom, heightvertical
right, top, heightvertical
right, bottom, heightvertical
left, top, widthhorizontal
left, bottom, widthhorizontal
right, top, widthhorizontal
right, bottom, widthhorizontal
- -

Small rules can be used as tick marks; alternatively, a Dot with -the "tick" shape can be used. - -

See also the Rule guide. - - -
Defined in: Rule.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Rule() -
-
Constructs a new rule with default properties.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- anchor -
-
Constructs a new rule anchor with default properties.
-
  -
- defaults -
-
Default properties for rules.
-
  -
- height -
-
The height of the rule, in pixels.
-
  -
- lineWidth -
-
The width of stroked lines, in pixels; used in conjunction with -strokeStyle to stroke the rule.
-
  - -
The style of stroked lines; used in conjunction with lineWidth to -stroke the rule.
-
  -
- width -
-
The width of the rule, in pixels.
-
- - - -
-
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - -
-
Methods borrowed from class pv.Mark:
add, anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Rule() -
- -
- Constructs a new rule with default properties. Rules are not typically -constructed directly, but by adding to a panel or an existing mark via -pv.Mark#add. - -
- - - - - - - - - - - -
-
See:
- -
pv.Line
- -
- - -
- - - - -
- Field Detail -
- - -
- - {pv.Anchor} - anchor - -
-
- Constructs a new rule anchor with default properties. Rules support five -different anchors:In addition to positioning properties (left, right, top bottom), the -anchors support text rendering properties (text-align, text-baseline). Text is -rendered to appear outside the rule. Note that this behavior is different -from other mark anchors, which default to rendering text inside the -mark. - -

For consistency with the other mark types, the anchor positions are -defined in terms of their opposite edge. For example, the top anchor defines -the bottom property, such that a bar added to the top anchor grows upward. - - -

- - - - - - - - -
- - -
- - {pv.Rule} - defaults - -
-
- Default properties for rules. By default, a single-pixel black line is -stroked. - - -
- - - - - - - - -
- - -
- - {number} - height - -
-
- The height of the rule, in pixels. If the bottom position is specified, the -rule extends upward from the bottom edge; if the top position is specified, -the rule extends downward from the top edge. - - -
- - - - - - - - -
- - -
- - {number} - lineWidth - -
-
- The width of stroked lines, in pixels; used in conjunction with -strokeStyle to stroke the rule. The default value is 1 pixel. - - -
- - - - - - - - -
- - -
- - {string} - strokeStyle - -
-
- The style of stroked lines; used in conjunction with lineWidth to -stroke the rule. The default value of this property is black. - - -
- - - - - - -
-
See:
- -
pv.color
- -
- - - -
- - -
- - {number} - width - -
-
- The width of the rule, in pixels. If the left position is specified, the rule -extends rightward from the left edge; if the right position is specified, the -rule extends leftward from the right edge. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.html deleted file mode 100644 index 31bd8beb..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.html +++ /dev/null @@ -1,590 +0,0 @@ - - - - - - - JsDoc Reference - pv.Scale - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Scale -

- - -

- -
Extends - function.
- - - Represents a scale; a function that performs a transformation from -data domain to visual range. For quantitative and quantile scales, the domain -is expressed as numbers; for ordinal scales, the domain is expressed as -strings (or equivalently objects with unique string representations). The -"visual range" may correspond to pixel space, colors, font sizes, and the -like. - -

Note that scales are functions, and thus can be used as properties -directly, assuming that the data associated with a mark is a number. While -this is convenient for single-use scales, frequently it is desirable to -define scales globally: - -

var y = pv.Scale.linear(0, 100).range(0, 640);
- -The y scale can now be equivalently referenced within a property: - -
    .height(function(d) y(d))
- -Alternatively, if the data are not simple numbers, the appropriate value can -be passed to the y scale (e.g., d.foo). The #by -method similarly allows the data to be mapped to a numeric value before -performing the linear transformation. - - -
Defined in: Scale.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Scale() -
-
Abstract; see the various scale implementations.
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
by(f) -
-
Returns a view of this scale by the specified accessor function f.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Scale() -
- -
- Abstract; see the various scale implementations. - -
- - - - - - - - - - - -
-
See:
- -
pv.Scale.quantitative
- -
pv.Scale.quantile
- -
pv.Scale.ordinal
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - {pv.Scale} - by(f) - -
-
- Returns a view of this scale by the specified accessor function f. -Given a scale y, y.by(function(d) d.foo) is equivalent to -function(d) y(d.foo). - -

This method is provided for convenience, such that scales can be -succinctly defined inline. For example, given an array of data elements that -have a score attribute with the domain [0, 1], the height property -could be specified as: - -

    .height(pv.Scale.linear().range(0, 480).by(function(d) d.score))
- -This is equivalent to: - -
    .height(function(d) d.score * 480)
- -This method should be used judiciously; it is typically more clear to invoke -the scale directly, passing in the value to be scaled. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
an accessor function.
- -
- - - - - -
-
Returns:
- -
{pv.Scale} a view of this scale by the specified accessor function.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.linear.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.linear.html deleted file mode 100644 index aad84666..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.linear.html +++ /dev/null @@ -1,528 +0,0 @@ - - - - - - - JsDoc Reference - pv.Scale.linear - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Scale.linear -

- - -

- -
Extends - pv.Scale.quantitative.
- - - Represents a linear scale; a function that performs a linear -transformation. Most -commonly, a linear scale represents a 1-dimensional linear transformation -from a numeric domain of input data [d0, -d1] to a numeric range of pixels [r0, -r1]. The equation for such a scale is: - -

f(x) = (x - d0) / (d1 - d0) * -(r1 - r0) + r0
- -For example, a linear scale from the domain [0, 100] to range [0, 640]: - -
f(x) = (x - 0) / (100 - 0) * (640 - 0) + 0
-f(x) = x / 100 * 640
-f(x) = x * 6.4
-
- -Thus, saying - -
    .height(function(d) d * 6.4)
- -is identical to - -
    .height(pv.Scale.linear(0, 100).range(0, 640))
- -Note that the scale is itself a function, and thus can be used as a property -directly, assuming that the data associated with a mark is a number. While -this is convenient for single-use scales, frequently it is desirable to -define scales globally: - -
var y = pv.Scale.linear(0, 100).range(0, 640);
- -The y scale can now be equivalently referenced within a property: - -
    .height(function(d) y(d))
- -Alternatively, if the data are not simple numbers, the appropriate value can -be passed to the y scale (e.g., d.foo). The #by -method similarly allows the data to be mapped to a numeric value before -performing the linear transformation. - - -
Defined in: LinearScale.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Returns a linear scale for the specified domain.
-
- - - - - - - - - - - -
-
Methods borrowed from class pv.Scale.quantitative:
by, domain, invert, nice, range, tickFormat, ticks
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Scale.linear() -
- -
- Returns a linear scale for the specified domain. The arguments to this -constructor are optional, and equivalent to calling #domain. -The default domain and range are [0,1]. - -
- - - - - -
-
Parameters:
- -
- {number...} domain... - -
-
optional domain values.
- -
- - - - - - - - -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.log.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.log.html deleted file mode 100644 index c4872fa4..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.log.html +++ /dev/null @@ -1,749 +0,0 @@ - - - - - - - JsDoc Reference - pv.Scale.log - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Scale.log -

- - -

- -
Extends - pv.Scale.quantitative.
- - - Represents a log scale. Most commonly, a log scale -represents a 1-dimensional log transformation from a numeric domain of input -data [d0, d1] to a numeric range of -pixels [r0, r1]. The equation for such a -scale is: - -

f(x) = (log(x) - log(d0)) / (log(d1) - -log(d0)) * (r1 - r0) + -r0
- -where log(x) represents the zero-symmetric logarthim of x using -the scale's associated base (default: 10, see pv.logSymmetric). For -example, a log scale from the domain [1, 100] to range [0, 640]: - -
f(x) = (log(x) - log(1)) / (log(100) - log(1)) * (640 - 0) + 0
-f(x) = log(x) / 2 * 640
-f(x) = log(x) * 320
-
- -Thus, saying - -
    .height(function(d) Math.log(d) * 138.974)
- -is equivalent to - -
    .height(pv.Scale.log(1, 100).range(0, 640))
- -Note that the scale is itself a function, and thus can be used as a property -directly, assuming that the data associated with a mark is a number. While -this is convenient for single-use scales, frequently it is desirable to -define scales globally: - -
var y = pv.Scale.log(1, 100).range(0, 640);
- -The y scale can now be equivalently referenced within a property: - -
    .height(function(d) y(d))
- -Alternatively, if the data are not simple numbers, the appropriate value can -be passed to the y scale (e.g., d.foo). The #by -method similarly allows the data to be mapped to a numeric value before -performing the log transformation. - - -
Defined in: LogScale.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Scale.log() -
-
Returns a log scale for the specified domain.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
base(v) -
-
Sets or gets the logarithm base.
-
  -
nice() -
-
"Nices" this scale, extending the bounds of the input domain to -evenly-rounded values.
-
  - -
Formats the specified tick value using the appropriate precision, assuming -base 10.
-
  -
ticks() -
-
Returns an array of evenly-spaced, suitably-rounded values in the input -domain.
-
- - - -
-
Methods borrowed from class pv.Scale.quantitative:
by, domain, invert, range
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Scale.log() -
- -
- Returns a log scale for the specified domain. The arguments to this -constructor are optional, and equivalent to calling #domain. -The default domain is [1,10] and the default range is [0,1]. - -
- - - - - -
-
Parameters:
- -
- {number...} domain... - -
-
optional domain values.
- -
- - - - - - - - -
- - - - - - - -
- Method Detail -
- - -
- - {pv.Scale.log} - base(v) - -
-
- Sets or gets the logarithm base. Defaults to 10. - - -
- - - - -
-
Parameters:
- -
- {number} v - Optional -
-
the new base.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.log} this, or the current base.
- -
- - - - -
- - -
- - {pv.Scale.log} - nice() - -
-
- "Nices" this scale, extending the bounds of the input domain to -evenly-rounded values. This method uses pv.logFloor and -pv.logCeil. Nicing is useful if the domain is computed dynamically -from data, and may be irregular. For example, given a domain of -[0.20147987687960267, 0.996679553296417], a call to nice() might -extend the domain to [0.1, 1]. - -

This method must be invoked each time after setting the domain (and -base). - - -

- - - - - - - - -
-
Returns:
- -
{pv.Scale.log} this.
- -
- - - - -
- - -
- - {string} - tickFormat(t) - -
-
- Formats the specified tick value using the appropriate precision, assuming -base 10. - - -
- - - - -
-
Parameters:
- -
- {number} t - -
-
a tick value.
- -
- - - - - -
-
Returns:
- -
{string} a formatted tick value.
- -
- - - - -
- - -
- - {number[]} - ticks() - -
-
- Returns an array of evenly-spaced, suitably-rounded values in the input -domain. These values are frequently used in conjunction with -pv.Rule to display tick marks or grid lines. - - -
- - - - - - - - -
-
Returns:
- -
{number[]} an array input domain values to use as ticks.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.ordinal.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.ordinal.html deleted file mode 100644 index f662a99a..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.ordinal.html +++ /dev/null @@ -1,991 +0,0 @@ - - - - - - - JsDoc Reference - pv.Scale.ordinal - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Scale.ordinal -

- - -

- -
Extends - pv.Scale.
- - - Represents an ordinal scale. An ordinal scale represents a -pairwise mapping from n discrete values in the input domain to -n discrete values in the output range. For example, an ordinal scale -might map a domain of species ["setosa", "versicolor", "virginica"] to colors -["red", "green", "blue"]. Thus, saying - -

    .fillStyle(function(d) {
-        switch (d.species) {
-          case "setosa": return "red";
-          case "versicolor": return "green";
-          case "virginica": return "blue";
-        }
-      })
- -is equivalent to - -
    .fillStyle(pv.Scale.ordinal("setosa", "versicolor", "virginica")
-        .range("red", "green", "blue")
-        .by(function(d) d.species))
- -If the mapping from species to color does not need to be specified -explicitly, the domain can be omitted. In this case it will be inferred -lazily from the data: - -
    .fillStyle(pv.colors("red", "green", "blue")
-        .by(function(d) d.species))
- -When the domain is inferred, the first time the scale is invoked, the first -element from the range will be returned. Subsequent calls with unique values -will return subsequent elements from the range. If the inferred domain grows -larger than the range, range values will be reused. However, it is strongly -recommended that the domain and the range contain the same number of -elements. - -

A range can be discretized from a continuous interval (e.g., for pixel -positioning) by using #split, #splitFlush or -#splitBanded after the domain has been set. For example, if -states is an array of the fifty U.S. state names, the state name can -be encoded in the left position: - -

    .left(pv.Scale.ordinal(states)
-        .split(0, 640)
-        .by(function(d) d.state))
- -

N.B.: ordinal scales are not invertible (at least not yet), since the -domain and range and discontinuous. A workaround is to use a linear scale. - - -
Defined in: OrdinalScale.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Returns an ordinal scale for the specified domain.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
by(f) -
-
Returns a view of this scale by the specified accessor function f.
-
  -
domain() -
-
Sets or gets the input domain.
-
  -
range() -
-
Sets or gets the output range.
-
  -
split(min, max) -
-
Sets the range from the given continuous interval.
-
  -
splitBanded(min, max, band) -
-
Sets the range from the given continuous interval.
-
  -
splitFlush(min, max) -
-
Sets the range from the given continuous interval.
-
- - - -
- -
- - - - - - - -
-
- Class Detail -
- -
- pv.Scale.ordinal() -
- -
- Returns an ordinal scale for the specified domain. The arguments to this -constructor are optional, and equivalent to calling #domain. - -
- - - - - -
-
Parameters:
- -
- {...} domain... - -
-
optional domain values.
- -
- - - - - - - -
-
See:
- -
pv.colors
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - {pv.Scale.ordinal} - by(f) - -
-
- Returns a view of this scale by the specified accessor function f. -Given a scale y, y.by(function(d) d.foo) is equivalent to -function(d) y(d.foo). This method should be used judiciously; it -is typically more clear to invoke the scale directly, passing in the value -to be scaled. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
an accessor function.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.ordinal} a view of this scale by the specified accessor -function.
- -
- - - - -
- - -
- - {pv.Scale.ordinal} - domain() - -
-
- Sets or gets the input domain. This method can be invoked several ways: - -

1. domain(values...) - -

Specifying the domain as a series of values is the most explicit and -recommended approach. However, if the domain values are derived from data, -you may find the second method more appropriate. - -

2. domain(array, f) - -

Rather than enumerating the domain values as explicit arguments to this -method, you can specify a single argument of an array. In addition, you can -specify an optional accessor function to extract the domain values from the -array. - -

3. domain() - -

Invoking the domain method with no arguments returns the -current domain as an array. - - -

- - - - -
-
Parameters:
- -
- {...} domain... - -
-
domain values.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.ordinal} this, or the current domain.
- -
- - - - -
- - -
- - {pv.Scale.ordinal} - range() - -
-
- Sets or gets the output range. This method can be invoked several ways: - -

1. range(values...) - -

Specifying the range as a series of values is the most explicit and -recommended approach. However, if the range values are derived from data, -you may find the second method more appropriate. - -

2. range(array, f) - -

Rather than enumerating the range values as explicit arguments to this -method, you can specify a single argument of an array. In addition, you can -specify an optional accessor function to extract the range values from the -array. - -

3. range() - -

Invoking the range method with no arguments returns the -current range as an array. - - -

- - - - -
-
Parameters:
- -
- {...} range... - -
-
range values.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.ordinal} this, or the current range.
- -
- - - - -
- - -
- - {pv.Scale.ordinal} - split(min, max) - -
-
- Sets the range from the given continuous interval. The interval -[min, max] is subdivided into n equispaced points, -where n is the number of (unique) values in the domain. The first -and last point are offset from the edge of the range by half the distance -between points. - -

This method must be called after the domain is set. - - -

- - - - -
-
Parameters:
- -
- {number} min - -
-
minimum value of the output range.
- -
- {number} max - -
-
maximum value of the output range.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.ordinal} this.
- -
- - - -
-
See:
- -
#splitFlush
- -
#splitBanded
- -
- - -
- - -
- - {pv.Scale.ordinal} - splitBanded(min, max, band) - -
-
- Sets the range from the given continuous interval. The interval -[min, max] is subdivided into n equispaced bands, -where n is the number of (unique) values in the domain. The first -and last band are offset from the edge of the range by the distance between -bands. - -

The band width argument, band, is typically in the range [0, 1] -and defaults to 1. This fraction corresponds to the amount of space in the -range to allocate to the bands, as opposed to padding. A value of 0.5 means -that the band width will be equal to the padding width. The computed -absolute band width can be retrieved from the range as -scale.range().band. - -

If the band width argument is negative, this method will allocate bands -of a fixed width -band, rather than a relative fraction of -the available space. - -

Tip: to inset the bands by a fixed amount p, specify a minimum -value of min + p (or simply p, if min is -0). Then set the mark width to scale.range().band - p. - -

This method must be called after the domain is set. - - -

- - - - -
-
Parameters:
- -
- {number} min - -
-
minimum value of the output range.
- -
- {number} max - -
-
maximum value of the output range.
- -
- {number} band - Optional -
-
the fractional band width in [0, 1]; defaults to 1.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.ordinal} this.
- -
- - - -
-
See:
- -
#split
- -
- - -
- - -
- - {pv.Scale.ordinal} - splitFlush(min, max) - -
-
- Sets the range from the given continuous interval. The interval -[min, max] is subdivided into n equispaced points, -where n is the number of (unique) values in the domain. The first -and last point are exactly on the edge of the range. - -

This method must be called after the domain is set. - - -

- - - - -
-
Parameters:
- -
- {number} min - -
-
minimum value of the output range.
- -
- {number} max - -
-
maximum value of the output range.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.ordinal} this.
- -
- - - -
-
See:
- -
#split
- -
- - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.quantile.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.quantile.html deleted file mode 100644 index 948e5c5b..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.quantile.html +++ /dev/null @@ -1,777 +0,0 @@ - - - - - - - JsDoc Reference - pv.Scale.quantile - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Scale.quantile -

- - -

- -
Extends - pv.Scale.
- - - Represents a quantile scale; a function that maps from a value within -a sortable domain to a quantized numeric range. Typically, the domain is a -set of numbers, but any sortable value (such as strings) can be used as the -domain of a quantile scale. The range defaults to [0,1], with 0 corresponding -to the smallest value in the domain, 1 the largest, .5 the median, etc. - -

By default, the number of quantiles in the range corresponds to the number -of values in the domain. The #quantiles method can be used to specify -an explicit number of quantiles; for example, quantiles(4) produces -a standard quartile scale. A quartile scale's range is a set of four discrete -values, such as [0, 1/3, 2/3, 1]. Calling the #range method will -scale these discrete values accordingly, similar to {@link -pv.Scale.ordinal#splitFlush}. - -

For example, given the strings ["c", "a", "b"], a default quantile scale: - -

pv.Scale.quantile("c", "a", "b")
- -will return 0 for "a", .5 for "b", and 1 for "c". - - -
Defined in: QuantileScale.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Constructs a default quantile scale.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
by(f) -
-
Returns a view of this scale by the specified accessor function f.
-
  -
domain() -
-
Sets or gets the input domain.
-
  -
quantiles(x) -
-
Sets or gets the quantile boundaries.
-
  -
range() -
-
Sets or gets the output range.
-
- - - -
- -
- - - - - - - -
-
- Class Detail -
- -
- pv.Scale.quantile() -
- -
- Constructs a default quantile scale. The arguments to this constructor are -optional, and equivalent to calling #domain. The default domain is -the empty set, and the default range is [0,1]. - -
- - - - - - - - - - - - -
- - - - - - - -
- Method Detail -
- - -
- - {pv.Scale.quantile} - by(f) - -
-
- Returns a view of this scale by the specified accessor function f. -Given a scale y, y.by(function(d) d.foo) is equivalent to -function(d) y(d.foo). - -

This method is provided for convenience, such that scales can be -succinctly defined inline. For example, given an array of data elements -that have a score attribute with the domain [0, 1], the height -property could be specified as: - -

.height(pv.Scale.linear().range(0, 480).by(function(d) d.score))
- -This is equivalent to: - -
.height(function(d) d.score * 480)
- -This method should be used judiciously; it is typically more clear to -invoke the scale directly, passing in the value to be scaled. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
an accessor function.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.quantile} a view of this scale by the specified -accessor function.
- -
- - - - -
- - -
- - {pv.Scale.quantile} - domain() - -
-
- Sets or gets the input domain. This method can be invoked several ways: - -

1. domain(values...) - -

Specifying the domain as a series of values is the most explicit and -recommended approach. However, if the domain values are derived from data, -you may find the second method more appropriate. - -

2. domain(array, f) - -

Rather than enumerating the domain values as explicit arguments to this -method, you can specify a single argument of an array. In addition, you can -specify an optional accessor function to extract the domain values from the -array. - -

3. domain() - -

Invoking the domain method with no arguments returns the -current domain as an array. - - -

- - - - -
-
Parameters:
- -
- {...} domain... - -
-
domain values.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.quantile} this, or the current domain.
- -
- - - - -
- - -
- - - quantiles(x) - -
-
- Sets or gets the quantile boundaries. By default, each element in the -domain is in its own quantile. If the argument to this method is a number, -it specifies the number of equal-sized quantiles by which to divide the -domain. - -

If no arguments are specified, this method returns the quantile -boundaries; the first element is always the minimum value of the domain, -and the last element is the maximum value of the domain. Thus, the length -of the returned array is always one greater than the number of quantiles. - - -

- - - - -
-
Parameters:
- -
- {number} x - -
-
the number of quantiles.
- -
- - - - - - - - -
- - -
- - {pv.Scale.quantile} - range() - -
-
- Sets or gets the output range. This method can be invoked several ways: - -

1. range(min, ..., max) - -

The range may be specified as a series of numbers or colors. Most -commonly, two numbers are specified: the minimum and maximum pixel values. -For a color scale, values may be specified as pv.Colors or -equivalent strings. For a diverging scale, or other subdivided non-uniform -scales, multiple values can be specified. For example: - -

    .range("red", "white", "green")
- -

Currently, only numbers and colors are supported as range values. The -number of range values must exactly match the number of domain values, or -the behavior of the scale is undefined. - -

2. range() - -

Invoking the range method with no arguments returns the current -range as an array of numbers or colors. - - -

- - - - -
-
Parameters:
- -
- {...} range... - -
-
range values.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.quantile} this, or the current range.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.quantitative.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.quantitative.html deleted file mode 100644 index ca54ff4b..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.quantitative.html +++ /dev/null @@ -1,1012 +0,0 @@ - - - - - - - JsDoc Reference - pv.Scale.quantitative - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Scale.quantitative -

- - -

- -
Extends - pv.Scale.
- - - Represents an abstract quantitative scale; a function that performs a -numeric transformation. This class is typically not used directly; see one of -the quantitative scale implementations (linear, log, root, etc.) -instead. A quantitative -scale represents a 1-dimensional transformation from a numeric domain of -input data [d0, d1] to a numeric range of -pixels [r0, r1]. In addition to -readability, scales offer several useful features: - -

1. The range can be expressed in colors, rather than pixels. For example: - -

    .fillStyle(pv.Scale.linear(0, 100).range("red", "green"))
- -will fill the marks "red" on an input value of 0, "green" on an input value -of 100, and some color in-between for intermediate values. - -

2. The domain and range can be subdivided for a non-uniform -transformation. For example, you may want a diverging color scale that is -increasingly red for negative values, and increasingly green for positive -values: - -

    .fillStyle(pv.Scale.linear(-1, 0, 1).range("red", "white", "green"))
- -The domain can be specified as a series of n monotonically-increasing -values; the range must also be specified as n values, resulting in -n - 1 contiguous linear scales. - -

3. Quantitative scales can be inverted for interaction. The -#invert method takes a value in the output range, and returns the -corresponding value in the input domain. This is frequently used to convert -the mouse location (see pv.Mark#mouse) to a value in the input -domain. Note that inversion is only supported for numeric ranges, and not -colors. - -

4. A scale can be queried for reasonable "tick" values. The #ticks -method provides a convenient way to get a series of evenly-spaced rounded -values in the input domain. Frequently these are used in conjunction with -pv.Rule to display tick marks or grid lines. - -

5. A scale can be "niced" to extend the domain to suitable rounded -numbers. If the minimum and maximum of the domain are messy because they are -derived from data, you can use #nice to round these values down and -up to even numbers. - - -
Defined in: QuantitativeScale.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Returns a default quantitative, linear, scale for the specified domain.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
by(f) -
-
Returns a view of this scale by the specified accessor function f.
-
  -
domain() -
-
Sets or gets the input domain.
-
  -
invert(y) -
-
Inverts the specified value in the output range, returning the -corresponding value in the input domain.
-
  -
nice() -
-
"Nices" this scale, extending the bounds of the input domain to -evenly-rounded values.
-
  -
range() -
-
Sets or gets the output range.
-
  - -
Formats the specified tick value using the appropriate precision, based on -the step interval between tick marks.
-
  -
ticks(m) -
-
Returns an array of evenly-spaced, suitably-rounded values in the input -domain.
-
- - - -
- -
- - - - - - - -
-
- Class Detail -
- -
- pv.Scale.quantitative() -
- -
- Returns a default quantitative, linear, scale for the specified domain. The -arguments to this constructor are optional, and equivalent to calling -#domain. The default domain and range are [0,1]. - -

This constructor is typically not used directly; see one of the -quantitative scale implementations instead. - -

- - - - - -
-
Parameters:
- -
- {number...} domain... - -
-
optional domain values.
- -
- - - - - - - -
-
See:
- -
pv.Scale.linear
- -
pv.Scale.log
- -
pv.Scale.root
- -
- - -
- - - - - - - -
- Method Detail -
- - -
- - {pv.Scale.quantitative} - by(f) - -
-
- Returns a view of this scale by the specified accessor function f. -Given a scale y, y.by(function(d) d.foo) is equivalent to -function(d) y(d.foo). - -

This method is provided for convenience, such that scales can be -succinctly defined inline. For example, given an array of data elements -that have a score attribute with the domain [0, 1], the height -property could be specified as: - -

    .height(pv.Scale.linear().range(0, 480).by(function(d) d.score))
- -This is equivalent to: - -
    .height(function(d) d.score * 480)
- -This method should be used judiciously; it is typically more clear to -invoke the scale directly, passing in the value to be scaled. - - -
- - - - -
-
Parameters:
- -
- {function} f - -
-
an accessor function.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.quantitative} a view of this scale by the specified -accessor function.
- -
- - - - -
- - -
- - {pv.Scale.quantitative} - domain() - -
-
- Sets or gets the input domain. This method can be invoked several ways: - -

1. domain(min, ..., max) - -

Specifying the domain as a series of numbers is the most explicit and -recommended approach. Most commonly, two numbers are specified: the minimum -and maximum value. However, for a diverging scale, or other subdivided -non-uniform scales, multiple values can be specified. Values can be derived -from data using pv.min and pv.max. For example: - -

    .domain(0, pv.max(array))
- -An alternative method for deriving minimum and maximum values from data -follows. - -

2. domain(array, minf, maxf) - -

When both the minimum and maximum value are derived from data, the -arguments to the domain method can be specified as the array of -data, followed by zero, one or two accessor functions. For example, if the -array of data is just an array of numbers: - -

    .domain(array)
- -On the other hand, if the array elements are objects representing stock -values per day, and the domain should consider the stock's daily low and -daily high: - -
    .domain(array, function(d) d.low, function(d) d.high)
- -The first method of setting the domain is preferred because it is more -explicit; setting the domain using this second method should be used only -if brevity is required. - -

3. domain() - -

Invoking the domain method with no arguments returns the -current domain as an array of numbers. - - -

- - - - -
-
Parameters:
- -
- {number...} domain... - -
-
domain values.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.quantitative} this, or the current domain.
- -
- - - - -
- - -
- - {number} - invert(y) - -
-
- Inverts the specified value in the output range, returning the -corresponding value in the input domain. This is frequently used to convert -the mouse location (see pv.Mark#mouse) to a value in the input -domain. Inversion is only supported for numeric ranges, and not colors. - -

Note that this method does not do any rounding or bounds checking. If -the input domain is discrete (e.g., an array index), the returned value -should be rounded. If the specified y value is outside the range, -the returned value may be equivalently outside the input domain. - - -

- - - - -
-
Parameters:
- -
- {number} y - -
-
a value in the output range (a pixel location).
- -
- - - - - -
-
Returns:
- -
{number} a value in the input domain.
- -
- - - - -
- - -
- - {pv.Scale.quantitative} - nice() - -
-
- "Nices" this scale, extending the bounds of the input domain to -evenly-rounded values. Nicing is useful if the domain is computed -dynamically from data, and may be irregular. For example, given a domain of -[0.20147987687960267, 0.996679553296417], a call to nice() might -extend the domain to [0.2, 1]. - -

This method must be invoked each time after setting the domain. - - -

- - - - - - - - -
-
Returns:
- -
{pv.Scale.quantitative} this.
- -
- - - - -
- - -
- - {pv.Scale.quantitative} - range() - -
-
- Sets or gets the output range. This method can be invoked several ways: - -

1. range(min, ..., max) - -

The range may be specified as a series of numbers or colors. Most -commonly, two numbers are specified: the minimum and maximum pixel values. -For a color scale, values may be specified as pv.Colors or -equivalent strings. For a diverging scale, or other subdivided non-uniform -scales, multiple values can be specified. For example: - -

    .range("red", "white", "green")
- -

Currently, only numbers and colors are supported as range values. The -number of range values must exactly match the number of domain values, or -the behavior of the scale is undefined. - -

2. range() - -

Invoking the range method with no arguments returns the current -range as an array of numbers or colors. - - -

- - - - -
-
Parameters:
- -
- {...} range... - -
-
range values.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.quantitative} this, or the current range.
- -
- - - - -
- - -
- - {string} - tickFormat(t) - -
-
- Formats the specified tick value using the appropriate precision, based on -the step interval between tick marks. If #ticks has not been called, -the argument is converted to a string, but no formatting is applied. - - -
- - - - -
-
Parameters:
- -
- {number} t - -
-
a tick value.
- -
- - - - - -
-
Returns:
- -
{string} a formatted tick value.
- -
- - - - -
- - -
- - {number[]} - ticks(m) - -
-
- Returns an array of evenly-spaced, suitably-rounded values in the input -domain. This method attempts to return between 5 and 10 tick values. These -values are frequently used in conjunction with pv.Rule to display -tick marks or grid lines. - - -
- - - - -
-
Parameters:
- -
- {number} m - Optional -
-
optional number of desired ticks.
- -
- - - - - -
-
Returns:
- -
{number[]} an array input domain values to use as ticks.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.root.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.root.html deleted file mode 100644 index c4ebc1ae..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Scale.root.html +++ /dev/null @@ -1,579 +0,0 @@ - - - - - - - JsDoc Reference - pv.Scale.root - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Scale.root -

- - -

- -
Extends - pv.Scale.quantitative.
- - - Represents a root scale; a function that performs a power -transformation. Most -commonly, a root scale represents a 1-dimensional root transformation from a -numeric domain of input data [d0, d1] to -a numeric range of pixels [r0, r1]. - -

Note that the scale is itself a function, and thus can be used as a -property directly, assuming that the data associated with a mark is a -number. While this is convenient for single-use scales, frequently it is -desirable to define scales globally: - -

var y = pv.Scale.root(0, 100).range(0, 640);
- -The y scale can now be equivalently referenced within a property: - -
    .height(function(d) y(d))
- -Alternatively, if the data are not simple numbers, the appropriate value can -be passed to the y scale (e.g., d.foo). The #by -method similarly allows the data to be mapped to a numeric value before -performing the root transformation. - - -
Defined in: RootScale.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
Returns a root scale for the specified domain.
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
power(v) -
-
Sets or gets the exponent; defaults to 2.
-
- - - -
-
Methods borrowed from class pv.Scale.quantitative:
by, domain, invert, nice, range, tickFormat, ticks
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Scale.root() -
- -
- Returns a root scale for the specified domain. The arguments to this -constructor are optional, and equivalent to calling #domain. -The default domain and range are [0,1]. - -
- - - - - -
-
Parameters:
- -
- {number...} domain... - -
-
optional domain values.
- -
- - - - - - - - -
- - - - - - - -
- Method Detail -
- - -
- - {pv.Scale.root} - power(v) - -
-
- Sets or gets the exponent; defaults to 2. - - -
- - - - -
-
Parameters:
- -
- {number} v - Optional -
-
the new exponent.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.root} this, or the current base.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Simulation.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Simulation.html deleted file mode 100644 index d8a371ea..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Simulation.html +++ /dev/null @@ -1,894 +0,0 @@ - - - - - - - JsDoc Reference - pv.Simulation - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Simulation -

- - -

- - - - Represents a particle simulation. Particles are massive points in -two-dimensional space. Forces can be applied to these particles, causing them -to move. Constraints can also be applied to restrict particle movement, for -example, constraining particles to a fixed position, or simulating collision -between circular particles with area. - -

The simulation uses Position Verlet -integration, due to the ease with which geometric constraints can be -implemented. For each time step, Verlet integration is performed, new forces -are accumulated, and then constraints are applied. - -

The simulation makes two simplifying assumptions: all particles are -equal-mass, and the time step of the simulation is fixed. It would be easy to -incorporate variable-mass particles as a future enhancement. Variable time -steps are also possible, but are likely to introduce instability in the -simulation. - -

This class can be used directly to simulate particle interaction. -Alternatively, for network diagrams, see pv.Layout.Force. - - -
Defined in: Simulation.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Simulation(particles) -
-
Constructs a new simulation for the specified particles.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  - -
The constraints in the simulation.
-
  -
- forces -
-
The forces in the simulation.
-
  -
- particles -
-
The particles in the simulation.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  - -
Adds the specified constraint to the simulation.
-
  -
force(f) -
-
Adds the specified force to the simulation.
-
  -
particle(p) -
-
Adds the specified particle to the simulation.
-
  -
stabilize(n) -
-
Apply constraints, and then set the velocities to zero.
-
  -
step() -
-
Advances the simulation one time-step.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Simulation(particles) -
- -
- Constructs a new simulation for the specified particles. - -
- - - - - -
-
Parameters:
- -
- {array} particles - -
-
an array of pv.Particles to simulate.
- -
- - - - - - - -
-
See:
- -
pv.Layout.Force
- -
pv.Force
- -
pv.Constraint
- -
- - -
- - - - -
- Field Detail -
- - -
- - {pv.Constraint} - constraints - -
-
- The constraints in the simulation. Constraints are stored as a linked list; -this field represents the first constraint in the simulation. - - -
- - - - - - - - -
- - -
- - {pv.Force} - forces - -
-
- The forces in the simulation. Forces are stored as a linked list; this field -represents the first force in the simulation. - - -
- - - - - - - - -
- - -
- - {pv.Particle} - particles - -
-
- The particles in the simulation. Particles are stored as a linked list; this -field represents the first particle in the simulation. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Simulation} - constraint(c) - -
-
- Adds the specified constraint to the simulation. - - -
- - - - -
-
Parameters:
- -
- {pv.Constraint} c - -
-
the new constraint.
- -
- - - - - -
-
Returns:
- -
{pv.Simulation} this.
- -
- - - - -
- - -
- - {pv.Simulation} - force(f) - -
-
- Adds the specified force to the simulation. - - -
- - - - -
-
Parameters:
- -
- {pv.Force} f - -
-
the new force.
- -
- - - - - -
-
Returns:
- -
{pv.Simulation} this.
- -
- - - - -
- - -
- - {pv.Simulation} - particle(p) - -
-
- Adds the specified particle to the simulation. - - -
- - - - -
-
Parameters:
- -
- {pv.Particle} p - -
-
the new particle.
- -
- - - - - -
-
Returns:
- -
{pv.Simulation} this.
- -
- - - - -
- - -
- - {pv.Simulation} - stabilize(n) - -
-
- Apply constraints, and then set the velocities to zero. - - -
- - - - -
-
Parameters:
- -
- n - -
-
- -
- - - - - -
-
Returns:
- -
{pv.Simulation} this.
- -
- - - - -
- - -
- - - step() - -
-
- Advances the simulation one time-step. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Transform.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Transform.html deleted file mode 100644 index 95353c81..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Transform.html +++ /dev/null @@ -1,816 +0,0 @@ - - - - - - - JsDoc Reference - pv.Transform - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Transform -

- - -

- - - - Represents a transformation matrix. The transformation matrix is -limited to expressing translate and uniform scale transforms only; shearing, -rotation, general affine, and other transforms are not supported. - -

The methods on this class treat the transform as immutable, returning a -copy of the transformation matrix with the specified transform applied. Note, -alternatively, that the matrix fields can be get and set directly. - - -
Defined in: Transform.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Transform() -
-
Returns a new identity transform.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- k -
-
The scale magnitude; defaults to 1.
-
  -
- x -
-
The x-offset; defaults to 0.
-
  -
- y -
-
The y-offset; defaults to 0.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
invert() -
-
Returns the inverse of this transformation matrix.
-
  -
scale(k) -
-
Returns a scaled copy of this transformation matrix.
-
  -
times(m) -
-
Returns this matrix post-multiplied by the specified matrix m.
-
  -
translate(x, y) -
-
Returns a translated copy of this transformation matrix.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Transform() -
- -
- Returns a new identity transform. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {number} - k - -
-
- The scale magnitude; defaults to 1. - - -
- - - - - - - - -
- - -
- - {number} - x - -
-
- The x-offset; defaults to 0. - - -
- - - - - - - - -
- - -
- - {number} - y - -
-
- The y-offset; defaults to 0. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
- - {pv.Transform} - invert() - -
-
- Returns the inverse of this transformation matrix. - - -
- - - - - - - - -
-
Returns:
- -
{pv.Transform} the inverted transformation matrix.
- -
- - - - -
- - -
- - {pv.Transform} - scale(k) - -
-
- Returns a scaled copy of this transformation matrix. - - -
- - - - -
-
Parameters:
- -
- {number} k - -
-
- -
- - - - - -
-
Returns:
- -
{pv.Transform} the scaled transformation matrix.
- -
- - - - -
- - -
- - {pv.Transform} - times(m) - -
-
- Returns this matrix post-multiplied by the specified matrix m. - - -
- - - - -
-
Parameters:
- -
- {pv.Transform} m - -
-
- -
- - - - - -
-
Returns:
- -
{pv.Transform} the post-multiplied transformation matrix.
- -
- - - - -
- - -
- - {pv.Transform} - translate(x, y) - -
-
- Returns a translated copy of this transformation matrix. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the x-offset.
- -
- {number} y - -
-
the y-offset.
- -
- - - - - -
-
Returns:
- -
{pv.Transform} the translated transformation matrix.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:29 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Tree.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Tree.html deleted file mode 100644 index 0a8fe8df..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Tree.html +++ /dev/null @@ -1,706 +0,0 @@ - - - - - - - JsDoc Reference - pv.Tree - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Tree -

- - -

- - - - Represents a tree operator for the specified array. The tree operator -allows a hierarchical map to be constructed from an array; it is similar to -the pv.Nest operator, except the hierarchy is derived dynamically -from the array elements. - -

For example, given an array of size information for ActionScript classes: - -

{ name: "flare.flex.FlareVis", size: 4116 },
-{ name: "flare.physics.DragForce", size: 1082 },
-{ name: "flare.physics.GravityForce", size: 1336 }, ...
- -To facilitate visualization, it may be useful to nest the elements by their -package hierarchy: - -
var tree = pv.tree(classes)
-    .keys(function(d) d.name.split("."))
-    .map();
- -The resulting tree is: - -
{ flare: {
-    flex: {
-      FlareVis: {
-        name: "flare.flex.FlareVis",
-        size: 4116 } },
-    physics: {
-      DragForce: {
-        name: "flare.physics.DragForce",
-        size: 1082 },
-      GravityForce: {
-        name: "flare.physics.GravityForce",
-        size: 1336 } },
-    ... } }
- -By specifying a value function, - -
var tree = pv.tree(classes)
-    .keys(function(d) d.name.split("."))
-    .value(function(d) d.size)
-    .map();
- -we can further eliminate redundant data: - -
{ flare: {
-    flex: {
-      FlareVis: 4116 },
-    physics: {
-      DragForce: 1082,
-      GravityForce: 1336 },
-  ... } }
- -For visualizations with large data sets, performance improvements may be seen -by storing the data in a tree format, and then flattening it into an array at -runtime with pv.Flatten. - - -
Defined in: Tree.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Tree(array) -
-
Constructs a tree operator for the specified array.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
keys(k) -
-
Assigns a keys function to this operator; required.
-
  -
map() -
-
Returns a hierarchical map of values.
-
  -
value(k) -
-
Assigns a value function to this operator; optional.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Tree(array) -
- -
- Constructs a tree operator for the specified array. This constructor should -not be invoked directly; use pv.tree instead. - -
- - - - - -
-
Parameters:
- -
- {array} array - -
-
an array from which to construct a tree.
- -
- - - - - - - - -
- - - - - - - -
- Method Detail -
- - -
- - {pv.Tree} - keys(k) - -
-
- Assigns a keys function to this operator; required. The keys function -returns an array of strings for each element in the associated -array; these keys determine how the elements are nested in the tree. The -returned keys should be unique for each element in the array; otherwise, the -behavior of this operator is undefined. - - -
- - - - -
-
Parameters:
- -
- {function} k - -
-
the keys function.
- -
- - - - - -
-
Returns:
- -
{pv.Tree} this.
- -
- - - - -
- - -
- - - map() - -
-
- Returns a hierarchical map of values. The hierarchy is determined by the keys -function; the values in the map are determined by the value function. - - -
- - - - - - - - -
-
Returns:
- -
a hierarchical map of values.
- -
- - - - -
- - -
- - {pv.Tree} - value(k) - -
-
- Assigns a value function to this operator; optional. The value -function specifies an optional transformation of the element in the array -before it is inserted into the map. If no value function is specified, it is -equivalent to using the identity function. - - -
- - - - -
-
Parameters:
- -
- {function} k - -
-
the value function.
- -
- - - - - -
-
Returns:
- -
{pv.Tree} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:30 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Vector.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Vector.html deleted file mode 100644 index acf0d2e8..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Vector.html +++ /dev/null @@ -1,874 +0,0 @@ - - - - - - - JsDoc Reference - pv.Vector - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Vector -

- - -

- - - - Represents a two-dimensional vector; a 2-tuple ⟨x, -y⟩. The intent of this class is to simplify vector math. Note that -in performance-sensitive cases it may be more efficient to represent 2D -vectors as simple objects with x and y attributes, rather -than using instances of this class. - - -
Defined in: Vector.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Vector(x, y) -
-
Constructs a pv.Vector for the specified x and y -coordinate.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
dot(x, y) -
-
Returns the dot product of this vector and the vector v: x * v.x + -y * v.y.
-
  -
length() -
-
Returns the magnitude of this vector, defined as sqrt(x * x + y * y).
-
  -
minus(x, y) -
-
Returns this vector minus the vector v: ⟨x - v.x, y - -v.y⟩.
-
  -
norm() -
-
Returns a normalized copy of this vector: a vector with the same direction, -but unit length.
-
  -
perp() -
-
Returns a vector perpendicular to this vector: ⟨-y, x⟩.
-
  -
plus(x, y) -
-
Returns this vector plus the vector v: ⟨x + v.x, y + -v.y⟩.
-
  -
times(k) -
-
Returns a scaled copy of this vector: ⟨x * k, y * k⟩.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.Vector(x, y) -
- -
- Constructs a pv.Vector for the specified x and y -coordinate. This constructor should not be invoked directly; use -pv.vector instead. - -
- - - - - -
-
Parameters:
- -
- {number} x - -
-
the x coordinate.
- -
- {number} y - -
-
the y coordinate.
- -
- - - - - - - - -
- - - - - - - -
- Method Detail -
- - -
- - {number} - dot(x, y) - -
-
- Returns the dot product of this vector and the vector v: x * v.x + -y * v.y. If only one argument is specified, it is interpreted as the -vector v. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the x coordinate to dot.
- -
- {number} y - -
-
the y coordinate to dot.
- -
- - - - - -
-
Returns:
- -
{number} a dot product.
- -
- - - - -
- - -
- - {number} - length() - -
-
- Returns the magnitude of this vector, defined as sqrt(x * x + y * y). - - -
- - - - - - - - -
-
Returns:
- -
{number} a length.
- -
- - - - -
- - -
- - {pv.Vector} - minus(x, y) - -
-
- Returns this vector minus the vector v: ⟨x - v.x, y - -v.y⟩. If only one argument is specified, it is interpreted as the -vector v. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the x coordinate to subtract.
- -
- {number} y - -
-
the y coordinate to subtract.
- -
- - - - - -
-
Returns:
- -
{pv.Vector} a new vector.
- -
- - - - -
- - -
- - {pv.Vector} - norm() - -
-
- Returns a normalized copy of this vector: a vector with the same direction, -but unit length. If this vector has zero length this method returns a copy of -this vector. - - -
- - - - - - - - -
-
Returns:
- -
{pv.Vector} a unit vector.
- -
- - - - -
- - -
- - {pv.Vector} - perp() - -
-
- Returns a vector perpendicular to this vector: ⟨-y, x⟩. - - -
- - - - - - - - -
-
Returns:
- -
{pv.Vector} a perpendicular vector.
- -
- - - - -
- - -
- - {pv.Vector} - plus(x, y) - -
-
- Returns this vector plus the vector v: ⟨x + v.x, y + -v.y⟩. If only one argument is specified, it is interpreted as the -vector v. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the x coordinate to add.
- -
- {number} y - -
-
the y coordinate to add.
- -
- - - - - -
-
Returns:
- -
{pv.Vector} a new vector.
- -
- - - - -
- - -
- - {pv.Vector} - times(k) - -
-
- Returns a scaled copy of this vector: ⟨x * k, y * k⟩. -To perform the equivalent divide operation, use 1 / k. - - -
- - - - -
-
Parameters:
- -
- {number} k - -
-
the scale factor.
- -
- - - - - -
-
Returns:
- -
{pv.Vector} a scaled vector.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:30 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Wedge.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.Wedge.html deleted file mode 100644 index 92bb0f61..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.Wedge.html +++ /dev/null @@ -1,1078 +0,0 @@ - - - - - - - JsDoc Reference - pv.Wedge - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.Wedge -

- - -

- -
Extends - pv.Mark.
- - - Represents a wedge, or pie slice. Specified in terms of start and end -angle, inner and outer radius, wedges can be used to construct donut charts -and polar bar charts as well. If the #angle property is used, the end -angle is implied by adding this value to start angle. By default, the start -angle is the previously-generated wedge's end angle. This design allows -explicit control over the wedge placement if desired, while offering -convenient defaults for the construction of radial graphs. - -

The center point of the circle is positioned using the standard box model. -The wedge can be stroked and filled, similar to pv.Bar. - -

See also the Wedge guide. - - -
Defined in: Wedge.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.Wedge() -
-
Constructs a new wedge with default properties.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- angle -
-
The angular span of the wedge, in radians.
-
  -
- defaults -
-
Default properties for wedges.
-
  -
- endAngle -
-
The end angle of the wedge, in radians.
-
  -
- fillStyle -
-
The wedge fill style; if non-null, the interior of the wedge is filled with -the specified color.
-
  - -
The inner radius of the wedge, in pixels.
-
  -
- lineWidth -
-
The width of stroked lines, in pixels; used in conjunction with -strokeStyle to stroke the wedge's border.
-
  - -
The outer radius of the wedge, in pixels.
-
  - -
The start angle of the wedge, in radians.
-
  - -
The style of stroked lines; used in conjunction with lineWidth to -stroke the wedge's border.
-
- - - -
-
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
anchor(name) -
-
Constructs a new wedge anchor with default properties.
-
  - -
Returns the mid-angle of the wedge, which is defined as half-way between the -start and end angles.
-
  - -
Returns the mid-radius of the wedge, which is defined as half-way between the -inner and outer radii.
-
<static>   -
pv.Wedge.upright(angle) -
-
Returns true if the specified angle is considered "upright", as in, text -rendered at that angle would appear upright.
-
- - - -
-
Methods borrowed from class pv.Mark:
add, anchorTarget, def, event, extend, margin, mouse, render
-
- - - - - - - -
-
- Class Detail -
- -
- pv.Wedge() -
- -
- Constructs a new wedge with default properties. Wedges are not typically -constructed directly, but by adding to a panel or an existing mark via -pv.Mark#add. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
- - {number} - angle - -
-
- The angular span of the wedge, in radians. This property is used if end angle -is not specified. - - -
- - - - - - - - -
- - -
- - {pv.Wedge} - defaults - -
-
- Default properties for wedges. By default, there is no stroke and the fill -style is a categorical color. - - -
- - - - - - - - -
- - -
- - {number} - endAngle - -
-
- The end angle of the wedge, in radians. If not specified, the end angle is -implied as the start angle plus the #angle. - - -
- - - - - - - - -
- - -
- - {string} - fillStyle - -
-
- The wedge fill style; if non-null, the interior of the wedge is filled with -the specified color. The default value of this property is a categorical -color. - - -
- - - - - - -
-
See:
- -
pv.color
- -
- - - -
- - -
- - {number} - innerRadius - -
-
- The inner radius of the wedge, in pixels. The default value of this property -is zero; a positive value will produce a donut slice rather than a pie slice. -The inner radius can vary per-wedge. - - -
- - - - - - - - -
- - -
- - {number} - lineWidth - -
-
- The width of stroked lines, in pixels; used in conjunction with -strokeStyle to stroke the wedge's border. - - -
- - - - - - - - -
- - -
- - {number} - outerRadius - -
-
- The outer radius of the wedge, in pixels. This property is required. For -pies, only this radius is required; for donuts, the inner radius must be -specified as well. The outer radius can vary per-wedge. - - -
- - - - - - - - -
- - -
- - {number} - startAngle - -
-
- The start angle of the wedge, in radians. The start angle is measured -clockwise from the 3 o'clock position. The default value of this property is -the end angle of the previous instance (the Mark#sibling), or -PI / 2 -for the first wedge; for pie and donut charts, typically only the -#angle property needs to be specified. - - -
- - - - - - - - -
- - -
- - {string} - strokeStyle - -
-
- The style of stroked lines; used in conjunction with lineWidth to -stroke the wedge's border. The default value of this property is null, -meaning wedges are not stroked by default. - - -
- - - - - - -
-
See:
- -
pv.color
- -
- - - - - - - - - -
- Method Detail -
- - -
- - {pv.Anchor} - anchor(name) - -
-
- Constructs a new wedge anchor with default properties. Wedges support five -different anchors:In addition to positioning properties (left, right, top bottom), the -anchors support text rendering properties (text-align, text-baseline, -textAngle). Text is rendered to appear inside the wedge. - - -
- - - - -
-
Parameters:
- -
- {string} name - -
-
the anchor name; either a string or a property function.
- -
- - - - - -
-
Returns:
- -
{pv.Anchor}
- -
- - - - -
- - -
- - {number} - midAngle() - -
-
- Returns the mid-angle of the wedge, which is defined as half-way between the -start and end angles. - - -
- - - - - - - - -
-
Returns:
- -
{number} the mid-angle, in radians.
- -
- - - -
-
See:
- -
#startAngle
- -
#endAngle
- -
- - -
- - -
- - {number} - midRadius() - -
-
- Returns the mid-radius of the wedge, which is defined as half-way between the -inner and outer radii. - - -
- - - - - - - - -
-
Returns:
- -
{number} the mid-radius, in pixels.
- -
- - - -
-
See:
- -
#innerRadius
- -
#outerRadius
- -
- - -
- - -
<static> - - {boolean} - pv.Wedge.upright(angle) - -
-
- Returns true if the specified angle is considered "upright", as in, text -rendered at that angle would appear upright. If the angle is not upright, -text is rotated 180 degrees to be upright, and the text alignment properties -are correspondingly changed. - - -
- - - - -
-
Parameters:
- -
- {number} angle - -
-
an angle, in radius.
- -
- - - - - -
-
Returns:
- -
{boolean} true if the specified angle is upright.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:30 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.histogram.Bin.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.histogram.Bin.html deleted file mode 100644 index b68008cd..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.histogram.Bin.html +++ /dev/null @@ -1,599 +0,0 @@ - - - - - - - JsDoc Reference - pv.histogram.Bin - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.histogram.Bin -

- - -

- -
Extends - array.
- - - Represents a bin returned by the pv.histogram operator. Bins -are themselves arrays containing the data elements present in the given bin -(prior to the accessor function being invoked to convert the data object to a -numeric value). These bin arrays have additional attributes with meta -information about the bin. - - -
Defined in: Histogram.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- dx -
-
The magnitude value of the bin's range; end - start.
-
  -
- x -
-
The start value of the bin's range.
-
  -
- y -
-
The frequency or probability of the bin, depending on how the histogram -operator was configured.
-
- - - - - - - - - - - - -
-
- Class Detail -
- -
- pv.histogram.Bin() -
- -
- - -
- - - - - - - - - - - -
-
See:
- -
pv.histogram
- -
- - -
- - - - -
- Field Detail -
- - -
- - {number} - dx - -
-
- The magnitude value of the bin's range; end - start. - - -
- - - - - - - - -
- - -
- - {number} - x - -
-
- The start value of the bin's range. - - -
- - - - - - - - -
- - -
- - {number} - y - -
-
- The frequency or probability of the bin, depending on how the histogram -operator was configured. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.histogram.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.histogram.html deleted file mode 100644 index 5f8de89c..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.histogram.html +++ /dev/null @@ -1,630 +0,0 @@ - - - - - - - JsDoc Reference - pv.histogram - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Class pv.histogram -

- - -

- - - - Represents a histogram operator. - - -
Defined in: Histogram.js. - -

- - - - - - - - - - - - - - - - - -
Class Summary
Constructor AttributesConstructor Name and Description
  -
- pv.histogram(data, f) -
-
Returns a histogram operator for the specified data, with an optional -accessor function.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
  -
bins(ticks) -
-
Returns the computed histogram bins.
-
  -
frequency(x) -
-
Sets or gets whether this histogram operator returns frequencies or -probabilities.
-
- - - - - - - - - -
-
- Class Detail -
- -
- pv.histogram(data, f) -
- -
- Returns a histogram operator for the specified data, with an optional -accessor function. If the data specified is not an array of numbers, an -accessor function must be specified to map the data to numeric values. - -
- - - - - -
-
Parameters:
- -
- {array} data - -
-
an array of numbers or objects.
- -
- {function} f - Optional -
-
an optional accessor function.
- -
- - - - - - - - -
- - - - - - - -
- Method Detail -
- - -
- - {array} - bins(ticks) - -
-
- Returns the computed histogram bins. An optional array of numbers, -ticks, may be specified as the break points. If the ticks are -not specified, default ticks will be computed using a linear scale on the -data domain. - -

The returned array contains pv.histogram.Bins. The x -attribute corresponds to the bin's start value (inclusive), while the -dx attribute stores the bin size (end - start). The y -attribute stores either the frequency count or probability, depending on -how the histogram operator has been configured. - -

The pv.histogram.Bin objects are themselves arrays, containing -the data elements present in each bin, i.e., the elements in the -data array (prior to invoking the accessor function, if any). -For example, if the data represented countries, and the accessor function -returned the GDP of each country, the returned bins would be arrays of -countries (not GDPs). - - -

- - - - -
-
Parameters:
- -
- {array} ticks - Optional -
-
- -
- - - - - -
-
Returns:
- -
{array}
- -
- - - - -
- - -
- - {pv.histogram} - frequency(x) - -
-
- Sets or gets whether this histogram operator returns frequencies or -probabilities. - - -
- - - - -
-
Parameters:
- -
- {boolean} x - Optional -
-
- -
- - - - - -
-
Returns:
- -
{pv.histogram} this.
- -
- - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.html deleted file mode 100644 index d8caa54f..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.html +++ /dev/null @@ -1,3613 +0,0 @@ - - - - - - - JsDoc Reference - pv - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Namespace pv -

- - -

- - - - The top-level Protovis namespace, pv. - - -
Defined in: pv.js. - -

- - - - - - - - - - - - - - - - - -
Namespace Summary
Constructor AttributesConstructor Name and Description
  -
- pv -
-
The top-level Protovis namespace.
-
- - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
<static>   -
- pv.event -
-
Stores the current event.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
<static>   -
pv.blend(arrays) -
-
Given the specified array of arrays, concatenates the arrays into a single -array.
-
<static>   -
pv.child() -
-
Returns this.childIndex.
-
<static>   -
pv.color(format) -
-
Returns the pv.Color for the specified color format string.
-
<static>   -
pv.colors() -
-
Returns a new categorical color encoding using the specified colors.
-
<static>   -
pv.cross(a, b) -
-
Given two arrays a and b, returns an array of all possible -pairs of elements [ai, bj].
-
<static>   -
pv.degrees(radians) -
-
Returns the number of degrees corresponding to the specified radians.
-
<static>   -
pv.deviation(array, f) -
-
Returns an unbiased estimation of the standard deviation of a population, -given the specified random sample.
-
<static>   -
pv.dict(keys, f) -
-
Returns a map constructed from the specified keys, using the -function f to compute the value for each key.
-
<static>   -
pv.dom(map) -
-
Returns a pv.Dom operator for the given map.
-
<static>   -
pv.entries(map) -
-
Returns all of the entries (key-value pairs) of the specified object (a -map).
-
<static>   -
pv.flatten(map) -
-
Returns a pv.Flatten operator for the specified map.
-
<static>   -
pv.hsl(h, s, l, a) -
-
Constructs a new HSL color with the specified values.
-
<static>   -
pv.identity(x) -
-
Returns the passed-in argument, x; the identity function.
-
<static>   -
pv.index() -
-
Returns this.index.
-
<static>   -
pv.keys(map) -
-
Returns all of the property names (keys) of the specified object (a map).
-
<static>   -
pv.log(x, b) -
-
Returns the logarithm with a given base value.
-
<static>   -
pv.logAdjusted(x, b) -
-
Computes a zero-symmetric logarithm, with adjustment to values between zero -and the logarithm base.
-
<static>   -
pv.logCeil(x, b) -
-
Rounds an input value up according to its logarithm.
-
<static>   -
pv.logFloor(x, b) -
-
Rounds an input value down according to its logarithm.
-
<static>   -
pv.logSymmetric(x, b) -
-
Computes a zero-symmetric logarithm.
-
<static>   -
pv.max(array, f) -
-
Returns the maximum value of the specified array.
-
<static>   -
pv.mean(array, f) -
-
Returns the arithmetic mean, or average, of the specified array.
-
<static>   -
pv.median(array, f) -
-
Returns the median of the specified array.
-
<static>   -
pv.min(array, f) -
-
Returns the minimum value of the specified array of numbers.
-
<static>   -
pv.naturalOrder(a, b) -
-
The comparator function for natural order.
-
<static>   -
pv.nest(array) -
-
Returns a pv.Nest operator for the specified array.
-
<static>   -
pv.nodes() -
-
Given a flat array of values, returns a simple DOM with each value wrapped by -a node that is a child of the root node.
-
<static>   -
pv.normalize(array, f) -
-
Returns a normalized copy of the specified array, such that the sum of the -returned elements sum to one.
-
<static>   -
pv.numerate(keys, f) -
-
Returns a map from key to index for the specified keys array.
-
<static>   -
pv.parent() -
-
Returns this.parent.index.
-
<static>   -
pv.permute(array, indexes, f) -
-
Returns a permutation of the specified array, using the specified array of -indexes.
-
<static>   -
pv.radians(degrees) -
-
Returns the number of radians corresponding to the specified degrees.
-
<static>   -
pv.ramp(start, end) -
-
Returns a linear color ramp from the specified start color to the -specified end color.
-
<static>   -
pv.random(start, stop, step) -
-
Returns a random number in the range [start, stop) that is -a multiple of step.
-
<static>   -
pv.range(start, stop, step) -
-
Returns an array of numbers, starting at start, incrementing by -step, until stop is reached.
-
<static>   -
pv.repeat(a, n) -
-
Concatenates the specified array with itself n times.
-
<static>   -
pv.reverseOrder(a, b) -
-
The comparator function for reverse natural order.
-
<static>   -
pv.rgb(r, g, b, a) -
-
Constructs a new RGB color with the specified channel values.
-
<static>   -
pv.search(array, value, f) -
-
Searches the specified array of numbers for the specified value using the -binary search algorithm.
-
<static>   -
pv.simulation(particles) -
-
Constructs a new empty simulation.
-
<static>   -
pv.sum(array, f) -
-
Returns the sum of the specified array.
-
<static>   -
pv.transpose(arrays) -
-
Given the specified array of arrays, transposes each element -arrayij with arrayji.
-
<static>   -
pv.tree(array) -
-
Returns a pv.Tree operator for the specified array.
-
<static>   -
pv.uniq(array, f) -
-
Returns the unique elements in the specified array, in the order they appear.
-
<static>   -
pv.values(map) -
-
Returns all of the values (attribute values) of the specified object (a -map).
-
<static>   -
pv.variance(array, f) -
-
Returns the unweighted variance of the specified array.
-
<static>   -
pv.vector(x, y) -
-
Returns a pv.Vector for the specified x and y -coordinate.
-
- - - - - - - - - -
-
- Namespace Detail -
- -
- pv -
- -
- The top-level Protovis namespace. All public methods and fields should be -registered on this object. Note that core Protovis source is surrounded by an -anonymous function, so any other declared globals will not be visible outside -of core methods. This also allows multiple versions of Protovis to coexist, -since each version will see their own pv namespace. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
<static> - - {Event} - pv.event - -
-
- Stores the current event. This field is only set within event handlers. - - -
- - - - - - - - - - - - - - -
- Method Detail -
- - -
<static> - - {array} - pv.blend(arrays) - -
-
- Given the specified array of arrays, concatenates the arrays into a single -array. If the individual arrays are explicitly known, an alternative to blend -is to use JavaScript's concat method directly. These two equivalent -expressions:return [1, 2, 3, "a", "b", "c"]. - -
- Defined in: Arrays.js. - - -
- - - - -
-
Parameters:
- -
- {array[]} arrays - -
-
an array of arrays.
- -
- - - - - -
-
Returns:
- -
{array} an array containing all the elements of each array in -arrays.
- -
- - - - -
- - -
<static> - - - pv.child() - -
-
- Returns this.childIndex. This method is provided for convenience for -use with scales. For example, to color bars by their child index, say: - -
.fillStyle(pv.Colors.category10().by(pv.child))
- -This method is equivalent to function() this.childIndex, but more -succinct. - - -
- - - - - - - - - - -
-
See:
- -
pv.Scale
- -
pv.Mark#childIndex
- -
- - -
- - -
<static> - - {pv.Color} - pv.color(format) - -
-
- Returns the pv.Color for the specified color format string. Colors -may have an associated opacity, or alpha channel. Color formats are specified -by CSS Color Modular Level 3, using either in RGB or HSL color space. For -example:The SVG 1.0 color keywords names are also supported, such as "aliceblue" -and "yellowgreen". The "transparent" keyword is supported for fully- -transparent black. - -

If the format argument is already an instance of Color, -the argument is returned with no further processing. - -
- Defined in: Color.js. - - -

- - - - -
-
Parameters:
- -
- {string} format - -
-
the color specification string, such as "#f00".
- -
- - - - - -
-
Returns:
- -
{pv.Color} the corresponding Color.
- -
- - - -
-
See:
- -
SVG color -keywords
- -
CSS3 color module
- -
- - -
- - -
<static> - - {pv.Scale.ordinal} - pv.colors() - -
-
- Returns a new categorical color encoding using the specified colors. The -arguments to this method are an array of colors; see pv.color. For -example, to create a categorical color encoding using the species -attribute: - -
pv.colors("red", "green", "blue").by(function(d) d.species)
- -The result of this expression can be used as a fill- or stroke-style -property. This assumes that the data's species attribute is a -string. - -
- Defined in: Colors.js. - - -
- - - - -
-
Parameters:
- -
- {string} colors... - -
-
categorical colors.
- -
- - - - - -
-
Returns:
- -
{pv.Scale.ordinal} an ordinal color scale.
- -
- - - -
-
See:
- -
pv.Scale.ordinal
- -
- - -
- - -
<static> - - {array} - pv.cross(a, b) - -
-
- Given two arrays a and b, returns an array of all possible -pairs of elements [ai, bj]. The outer loop is on array -a, while the inner loop is on b, such that the order of -returned elements is [a0, b0], [a0, -b1], ... [a0, bm], [a1, -b0], [a1, b1], ... [a1, -bm], ... [an, bm]. If either array is empty, -an empty array is returned. - -
- Defined in: Arrays.js. - - -
- - - - -
-
Parameters:
- -
- {array} a - -
-
an array.
- -
- {array} b - -
-
an array.
- -
- - - - - -
-
Returns:
- -
{array} an array of pairs of elements in a and b.
- -
- - - - -
- - -
<static> - - - pv.degrees(radians) - -
-
- Returns the number of degrees corresponding to the specified radians. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- radians - -
-
- -
- - - - - - - - -
- - -
<static> - - {number} - pv.deviation(array, f) - -
-
- Returns an unbiased estimation of the standard deviation of a population, -given the specified random sample. If the specified array is not an array of -numbers, an optional accessor function f can be specified to map the -elements to numbers. See #normalize for an example. Accessor -functions can refer to this.index. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- {array} array - -
-
an array of objects, or numbers.
- -
- {function} f - Optional -
-
an optional accessor function.
- -
- - - - - -
-
Returns:
- -
{number} the standard deviation of the specified array.
- -
- - - - -
- - -
<static> - - - pv.dict(keys, f) - -
-
- Returns a map constructed from the specified keys, using the -function f to compute the value for each key. The single argument to -the value function is the key. The callback is invoked only for indexes of -the array which have assigned values; it is not invoked for indexes which -have been deleted or which have never been assigned values. - -

For example, this expression creates a map from strings to string length: - -

pv.dict(["one", "three", "seventeen"], function(s) s.length)
- -The returned value is {one: 3, three: 5, seventeen: 9}. Accessor -functions can refer to this.index. - -
- Defined in: Objects.js. - - -
- - - - -
-
Parameters:
- -
- {array} keys - -
-
an array.
- -
- {function} f - -
-
a value function.
- -
- - - - - -
-
Returns:
- -
a map from keys to values.
- -
- - - - -
- - -
<static> - - {pv.Dom} - pv.dom(map) - -
-
- Returns a pv.Dom operator for the given map. This is a convenience -factory method, equivalent to new pv.Dom(map). To apply the operator -and retrieve the root node, call pv.Dom#root; to retrieve all nodes -flattened, use pv.Dom#nodes. - -
- Defined in: Dom.js. - - -
- - - - -
-
Parameters:
- -
- map - -
-
a map from which to construct a DOM.
- -
- - - - - -
-
Returns:
- -
{pv.Dom} a DOM operator for the specified map.
- -
- - - -
-
See:
- -
pv.Dom
- -
- - -
- - -
<static> - - {array} - pv.entries(map) - -
-
- Returns all of the entries (key-value pairs) of the specified object (a -map). The order of the returned array is not defined. Each key-value pair is -represented as an object with key and value attributes, -e.g., {key: "foo", value: 42}. - -
- Defined in: Objects.js. - - -
- - - - -
-
Parameters:
- -
- map - -
-
an object.
- -
- - - - - -
-
Returns:
- -
{array} an array of key-value pairs corresponding to the keys.
- -
- - - - -
- - -
<static> - - {pv.Flatten} - pv.flatten(map) - -
-
- Returns a pv.Flatten operator for the specified map. This is a -convenience factory method, equivalent to new pv.Flatten(map). - -
- Defined in: Flatten.js. - - -
- - - - -
-
Parameters:
- -
- map - -
-
a map to flatten.
- -
- - - - - -
-
Returns:
- -
{pv.Flatten} a flatten operator for the specified map.
- -
- - - -
-
See:
- -
pv.Flatten
- -
- - -
- - -
<static> - - - pv.hsl(h, s, l, a) - -
-
- Constructs a new HSL color with the specified values. - -
- Defined in: Color.js. - - -
- - - - -
-
Parameters:
- -
- {number} h - -
-
the hue, an integer in [0, 360].
- -
- {number} s - -
-
the saturation, a float in [0, 1].
- -
- {number} l - -
-
the lightness, a float in [0, 1].
- -
- {number} a - Optional -
-
the opacity, a float in [0, 1].
- -
- - - - - -
-
Returns:
- -
pv.Color.Hsl
- -
- - - - -
- - -
<static> - - - pv.identity(x) - -
-
- Returns the passed-in argument, x; the identity function. This method -is provided for convenience since it is used as the default behavior for a -number of property functions. - - -
- - - - -
-
Parameters:
- -
- x - -
-
a value.
- -
- - - - - -
-
Returns:
- -
the value x.
- -
- - - - -
- - -
<static> - - - pv.index() - -
-
- Returns this.index. This method is provided for convenience for use -with scales. For example, to color bars by their index, say: - -
.fillStyle(pv.Colors.category10().by(pv.index))
- -This method is equivalent to function() this.index, but more -succinct. Note that the index property is also supported for -accessor functions with pv.max, pv.min and other array -utility methods. - - -
- - - - - - - - - - -
-
See:
- -
pv.Scale
- -
pv.Mark#index
- -
- - -
- - -
<static> - - {string[]} - pv.keys(map) - -
-
- Returns all of the property names (keys) of the specified object (a map). The -order of the returned array is not defined. - -
- Defined in: Objects.js. - - -
- - - - -
-
Parameters:
- -
- map - -
-
an object.
- -
- - - - - -
-
Returns:
- -
{string[]} an array of strings corresponding to the keys.
- -
- - - -
-
See:
- -
#entries
- -
- - -
- - -
<static> - - {number} - pv.log(x, b) - -
-
- Returns the logarithm with a given base value. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the number for which to compute the logarithm.
- -
- {number} b - -
-
the base of the logarithm.
- -
- - - - - -
-
Returns:
- -
{number} the logarithm value.
- -
- - - - -
- - -
<static> - - {number} - pv.logAdjusted(x, b) - -
-
- Computes a zero-symmetric logarithm, with adjustment to values between zero -and the logarithm base. This adjustment introduces distortion for values less -than the base number, but enables simultaneous plotting of log-transformed -data involving both positive and negative numbers. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the number for which to compute the logarithm.
- -
- {number} b - -
-
the base of the logarithm.
- -
- - - - - -
-
Returns:
- -
{number} the adjusted, symmetric log value.
- -
- - - - -
- - -
<static> - - {number} - pv.logCeil(x, b) - -
-
- Rounds an input value up according to its logarithm. The method takes the -ceiling of the logarithm of the value and then uses the resulting value as an -exponent for the base value. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the number for which to compute the logarithm ceiling.
- -
- {number} b - -
-
the base of the logarithm.
- -
- - - - - -
-
Returns:
- -
{number} the rounded-by-logarithm value.
- -
- - - - -
- - -
<static> - - {number} - pv.logFloor(x, b) - -
-
- Rounds an input value down according to its logarithm. The method takes the -floor of the logarithm of the value and then uses the resulting value as an -exponent for the base value. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the number for which to compute the logarithm floor.
- -
- {number} b - -
-
the base of the logarithm.
- -
- - - - - -
-
Returns:
- -
{number} the rounded-by-logarithm value.
- -
- - - - -
- - -
<static> - - {number} - pv.logSymmetric(x, b) - -
-
- Computes a zero-symmetric logarithm. Computes the logarithm of the absolute -value of the input, and determines the sign of the output according to the -sign of the input value. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the number for which to compute the logarithm.
- -
- {number} b - -
-
the base of the logarithm.
- -
- - - - - -
-
Returns:
- -
{number} the symmetric log value.
- -
- - - - -
- - -
<static> - - {number} - pv.max(array, f) - -
-
- Returns the maximum value of the specified array. If the specified array is -not an array of numbers, an optional accessor function f can be -specified to map the elements to numbers. See #normalize for an -example. Accessor functions can refer to this.index. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- {array} array - -
-
an array of objects, or numbers.
- -
- {function} f - Optional -
-
an optional accessor function.
- -
- - - - - -
-
Returns:
- -
{number} the maximum value of the specified array.
- -
- - - - -
- - -
<static> - - {number} - pv.mean(array, f) - -
-
- Returns the arithmetic mean, or average, of the specified array. If the -specified array is not an array of numbers, an optional accessor function -f can be specified to map the elements to numbers. See -#normalize for an example. Accessor functions can refer to -this.index. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- {array} array - -
-
an array of objects, or numbers.
- -
- {function} f - Optional -
-
an optional accessor function.
- -
- - - - - -
-
Returns:
- -
{number} the mean of the specified array.
- -
- - - - -
- - -
<static> - - {number} - pv.median(array, f) - -
-
- Returns the median of the specified array. If the specified array is not an -array of numbers, an optional accessor function f can be specified -to map the elements to numbers. See #normalize for an example. -Accessor functions can refer to this.index. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- {array} array - -
-
an array of objects, or numbers.
- -
- {function} f - Optional -
-
an optional accessor function.
- -
- - - - - -
-
Returns:
- -
{number} the median of the specified array.
- -
- - - - -
- - -
<static> - - {number} - pv.min(array, f) - -
-
- Returns the minimum value of the specified array of numbers. If the specified -array is not an array of numbers, an optional accessor function f -can be specified to map the elements to numbers. See #normalize for -an example. Accessor functions can refer to this.index. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- {array} array - -
-
an array of objects, or numbers.
- -
- {function} f - Optional -
-
an optional accessor function.
- -
- - - - - -
-
Returns:
- -
{number} the minimum value of the specified array.
- -
- - - - -
- - -
<static> - - {number} - pv.naturalOrder(a, b) - -
-
- The comparator function for natural order. This can be used in conjunction with -the built-in array sort method to sort elements by their natural -order, ascending. Note that if no comparator function is specified to the -built-in sort method, the default order is lexicographic, not -natural! - -
- Defined in: Arrays.js. - - -
- - - - -
-
Parameters:
- -
- a - -
-
an element to compare.
- -
- b - -
-
an element to compare.
- -
- - - - - -
-
Returns:
- -
{number} negative if a < b; positive if a > b; otherwise 0.
- -
- - - -
-
See:
- -
Array.sort.
- -
- - -
- - -
<static> - - {pv.Nest} - pv.nest(array) - -
-
- Returns a pv.Nest operator for the specified array. This is a -convenience factory method, equivalent to new pv.Nest(array). - -
- Defined in: Nest.js. - - -
- - - - -
-
Parameters:
- -
- {array} array - -
-
an array of elements to nest.
- -
- - - - - -
-
Returns:
- -
{pv.Nest} a nest operator for the specified array.
- -
- - - -
-
See:
- -
pv.Nest
- -
- - -
- - -
<static> - - {array} - pv.nodes() - -
-
- Given a flat array of values, returns a simple DOM with each value wrapped by -a node that is a child of the root node. - -
- Defined in: Dom.js. - - -
- - - - -
-
Parameters:
- -
- {array} values. - -
-
- -
- - - - - -
-
Returns:
- -
{array} nodes.
- -
- - - - -
- - -
<static> - - {number[]} - pv.normalize(array, f) - -
-
- Returns a normalized copy of the specified array, such that the sum of the -returned elements sum to one. If the specified array is not an array of -numbers, an optional accessor function f can be specified to map the -elements to numbers. For example, if array is an array of objects, -and each object has a numeric property "foo", the expression - -
pv.normalize(array, function(d) d.foo)
- -returns a normalized array on the "foo" property. If an accessor function is -not specified, the identity function is used. Accessor functions can refer to -this.index. - -
- Defined in: Arrays.js. - - -
- - - - -
-
Parameters:
- -
- {array} array - -
-
an array of objects, or numbers.
- -
- {function} f - Optional -
-
an optional accessor function.
- -
- - - - - -
-
Returns:
- -
{number[]} an array of numbers that sums to one.
- -
- - - - -
- - -
<static> - - - pv.numerate(keys, f) - -
-
- Returns a map from key to index for the specified keys array. For -example, - -
pv.numerate(["a", "b", "c"])
- -returns {a: 0, b: 1, c: 2}. Note that since JavaScript maps only -support string keys, keys must contain strings, or other values that -naturally map to distinct string values. Alternatively, an optional accessor -function f can be specified to compute the string key for the given -element. Accessor functions can refer to this.index. - -
- Defined in: Arrays.js. - - -
- - - - -
-
Parameters:
- -
- {array} keys - -
-
an array, usually of string keys.
- -
- {function} f - Optional -
-
an optional key function.
- -
- - - - - -
-
Returns:
- -
a map from key to index.
- -
- - - - -
- - -
<static> - - - pv.parent() - -
-
- Returns this.parent.index. This method is provided for convenience -for use with scales. This method is provided for convenience for use with -scales. For example, to color bars by their parent index, say: - -
.fillStyle(pv.Colors.category10().by(pv.parent))
- -Tthis method is equivalent to function() this.parent.index, but more -succinct. - - -
- - - - - - - - - - -
-
See:
- -
pv.Scale
- -
pv.Mark#index
- -
- - -
- - -
<static> - - {array} - pv.permute(array, indexes, f) - -
-
- Returns a permutation of the specified array, using the specified array of -indexes. The returned array contains the corresponding element in -array for each index in indexes, in order. For example, - -
pv.permute(["a", "b", "c"], [1, 2, 0])
- -returns ["b", "c", "a"]. It is acceptable for the array of indexes -to be a different length from the array of elements, and for indexes to be -duplicated or omitted. The optional accessor function f can be used -to perform a simultaneous mapping of the array elements. Accessor functions -can refer to this.index. - -
- Defined in: Arrays.js. - - -
- - - - -
-
Parameters:
- -
- {array} array - -
-
an array.
- -
- {number[]} indexes - -
-
an array of indexes into array.
- -
- {function} f - Optional -
-
an optional accessor function.
- -
- - - - - -
-
Returns:
- -
{array} an array of elements from array; a permutation.
- -
- - - - -
- - -
<static> - - - pv.radians(degrees) - -
-
- Returns the number of radians corresponding to the specified degrees. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- degrees - -
-
- -
- - - - - - - - -
- - -
<static> - - {Function} - pv.ramp(start, end) - -
-
- Returns a linear color ramp from the specified start color to the -specified end color. The color arguments may be specified either as -strings or as pv.Colors. This is equivalent to: - -
    pv.Scale.linear().domain(0, 1).range(...)
- -
- Defined in: Ramp.js. - - -
- - - - -
-
Parameters:
- -
- {string} start - -
-
the start color; may be a pv.Color.
- -
- {string} end - -
-
the end color; may be a pv.Color.
- -
- - - - - -
-
Returns:
- -
{Function} a color ramp from start to end.
- -
- - - -
-
See:
- -
pv.Scale.linear
- -
- - -
- - -
<static> - - {number} - pv.random(start, stop, step) - -
-
- Returns a random number in the range [start, stop) that is -a multiple of step. More specifically, the returned number is of the -form start + n * step, where n is a -nonnegative integer. If step is not specified, it defaults to 1, -returning a random integer if start is also an integer. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- {number} start - Optional -
-
the start value value.
- -
- {number} stop - -
-
the stop value.
- -
- {number} step - Optional -
-
the step value.
- -
- - - - - -
-
Returns:
- -
{number} a random number between start and stop.
- -
- - - - -
- - -
<static> - - {number[]} - pv.range(start, stop, step) - -
-
- Returns an array of numbers, starting at start, incrementing by -step, until stop is reached. The stop value is -exclusive. If only a single argument is specified, this value is interpeted -as the stop value, with the start value as zero. If only two -arguments are specified, the step value is implied to be one. - -

The method is modeled after the built-in range method from -Python. See the Python documentation for more details. - -
- Defined in: Numbers.js. - - -

- - - - -
-
Parameters:
- -
- {number} start - Optional -
-
the start value.
- -
- {number} stop - -
-
the stop value.
- -
- {number} step - Optional -
-
the step value.
- -
- - - - - -
-
Returns:
- -
{number[]} an array of numbers.
- -
- - - -
-
See:
- -
Python range
- -
- - -
- - -
<static> - - {array} - pv.repeat(a, n) - -
-
- Concatenates the specified array with itself n times. For example, -pv.repeat([1, 2]) returns [1, 2, 1, 2]. - -
- Defined in: Arrays.js. - - -
- - - - -
-
Parameters:
- -
- {array} a - -
-
an array.
- -
- {number} n - Optional -
-
the number of times to repeat; defaults to two.
- -
- - - - - -
-
Returns:
- -
{array} an array that repeats the specified array.
- -
- - - - -
- - -
<static> - - {number} - pv.reverseOrder(a, b) - -
-
- The comparator function for reverse natural order. This can be used in -conjunction with the built-in array sort method to sort elements by -their natural order, descending. Note that if no comparator function is -specified to the built-in sort method, the default order is -lexicographic, not natural! - -
- Defined in: Arrays.js. - - -
- - - - -
-
Parameters:
- -
- a - -
-
an element to compare.
- -
- b - -
-
an element to compare.
- -
- - - - - -
-
Returns:
- -
{number} negative if a < b; positive if a > b; otherwise 0.
- -
- - - -
-
See:
- -
#naturalOrder
- -
- - -
- - -
<static> - - - pv.rgb(r, g, b, a) - -
-
- Constructs a new RGB color with the specified channel values. - -
- Defined in: Color.js. - - -
- - - - -
-
Parameters:
- -
- {number} r - -
-
the red channel, an integer in [0,255].
- -
- {number} g - -
-
the green channel, an integer in [0,255].
- -
- {number} b - -
-
the blue channel, an integer in [0,255].
- -
- {number} a - Optional -
-
the alpha channel, a float in [0,1].
- -
- - - - - -
-
Returns:
- -
pv.Color.Rgb
- -
- - - - -
- - -
<static> - - - pv.search(array, value, f) - -
-
- Searches the specified array of numbers for the specified value using the -binary search algorithm. The array must be sorted (as by the sort -method) prior to making this call. If it is not sorted, the results are -undefined. If the array contains multiple elements with the specified value, -there is no guarantee which one will be found. - -

The insertion point is defined as the point at which the value -would be inserted into the array: the index of the first element greater than -the value, or array.length, if all elements in the array are less -than the specified value. Note that this guarantees that the return value -will be nonnegative if and only if the value is found. - -
- Defined in: Arrays.js. - - -

- - - - -
-
Parameters:
- -
- {number[]} array - -
-
the array to be searched.
- -
- {number} value - -
-
the value to be searched for.
- -
- {function} f - Optional -
-
an optional key function.
- -
- - - - - -
-
Returns:
- -
the index of the search value, if it is contained in the array; -otherwise, (-(insertion point) - 1).
- -
- - - - -
- - -
<static> - - {pv.Simulation} - pv.simulation(particles) - -
-
- Constructs a new empty simulation. - -
- Defined in: Simulation.js. - - -
- - - - -
-
Parameters:
- -
- {array} particles - -
-
- -
- - - - - -
-
Returns:
- -
{pv.Simulation} a new simulation for the specified particles.
- -
- - - -
-
See:
- -
pv.Simulation
- -
- - -
- - -
<static> - - {number} - pv.sum(array, f) - -
-
- Returns the sum of the specified array. If the specified array is not an -array of numbers, an optional accessor function f can be specified -to map the elements to numbers. See #normalize for an example. -Accessor functions can refer to this.index. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- {array} array - -
-
an array of objects, or numbers.
- -
- {function} f - Optional -
-
an optional accessor function.
- -
- - - - - -
-
Returns:
- -
{number} the sum of the specified array.
- -
- - - - -
- - -
<static> - - {array[]} - pv.transpose(arrays) - -
-
- Given the specified array of arrays, transposes each element -arrayij with arrayji. If the array has dimensions -n×m, it will have dimensions m×n -after this method returns. This method transposes the elements of the array -in place, mutating the array, and returning a reference to the array. - -
- Defined in: Arrays.js. - - -
- - - - -
-
Parameters:
- -
- {array[]} arrays - -
-
an array of arrays.
- -
- - - - - -
-
Returns:
- -
{array[]} the passed-in array, after transposing the elements.
- -
- - - - -
- - -
<static> - - {pv.Tree} - pv.tree(array) - -
-
- Returns a pv.Tree operator for the specified array. This is a -convenience factory method, equivalent to new pv.Tree(array). - -
- Defined in: Tree.js. - - -
- - - - -
-
Parameters:
- -
- {array} array - -
-
an array from which to construct a tree.
- -
- - - - - -
-
Returns:
- -
{pv.Tree} a tree operator for the specified array.
- -
- - - -
-
See:
- -
pv.Tree
- -
- - -
- - -
<static> - - {array} - pv.uniq(array, f) - -
-
- Returns the unique elements in the specified array, in the order they appear. -Note that since JavaScript maps only support string keys, array must -contain strings, or other values that naturally map to distinct string -values. Alternatively, an optional accessor function f can be -specified to compute the string key for the given element. Accessor functions -can refer to this.index. - -
- Defined in: Arrays.js. - - -
- - - - -
-
Parameters:
- -
- {array} array - -
-
an array, usually of string keys.
- -
- {function} f - Optional -
-
an optional key function.
- -
- - - - - -
-
Returns:
- -
{array} the unique values.
- -
- - - - -
- - -
<static> - - {array} - pv.values(map) - -
-
- Returns all of the values (attribute values) of the specified object (a -map). The order of the returned array is not defined. - -
- Defined in: Objects.js. - - -
- - - - -
-
Parameters:
- -
- map - -
-
an object.
- -
- - - - - -
-
Returns:
- -
{array} an array of objects corresponding to the values.
- -
- - - -
-
See:
- -
#entries
- -
- - -
- - -
<static> - - {number} - pv.variance(array, f) - -
-
- Returns the unweighted variance of the specified array. If the specified -array is not an array of numbers, an optional accessor function f -can be specified to map the elements to numbers. See #normalize for -an example. Accessor functions can refer to this.index. - -
- Defined in: Numbers.js. - - -
- - - - -
-
Parameters:
- -
- {array} array - -
-
an array of objects, or numbers.
- -
- {function} f - Optional -
-
an optional accessor function.
- -
- - - - - -
-
Returns:
- -
{number} the variance of the specified array.
- -
- - - - -
- - -
<static> - - {pv.Vector} - pv.vector(x, y) - -
-
- Returns a pv.Vector for the specified x and y -coordinate. This is a convenience factory method, equivalent to new -pv.Vector(x, y). - -
- Defined in: Vector.js. - - -
- - - - -
-
Parameters:
- -
- {number} x - -
-
the x coordinate.
- -
- {number} y - -
-
the y coordinate.
- -
- - - - - -
-
Returns:
- -
{pv.Vector} a vector for the specified coordinates.
- -
- - - -
-
See:
- -
pv.Vector
- -
- - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:27 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/pv.version.html b/docs/lib/protovis-3.2/jsdoc/symbols/pv.version.html deleted file mode 100644 index 4032102c..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/pv.version.html +++ /dev/null @@ -1,552 +0,0 @@ - - - - - - - JsDoc Reference - pv.version - - - - - - - - - - - -
- -
Class Index -| File Index
-
-

Classes

- -
- -
- -
- -

- - Namespace pv.version -

- - -

- - - - Protovis major and minor version numbers. - - -
Defined in: pv.js. - -

- - - - - - - - - - - - - - - - - -
Namespace Summary
Constructor AttributesConstructor Name and Description
  - -
Protovis major and minor version numbers.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
<static> <constant>   -
- pv.version.major -
-
The major version number.
-
<static> <constant>   -
- pv.version.minor -
-
The minor version number.
-
- - - - - - - - - - - - -
-
- Namespace Detail -
- -
- pv.version -
- -
- Protovis major and minor version numbers. - -
- - - - - - - - - - - - -
- - - - -
- Field Detail -
- - -
<static> <constant> - - {number} - pv.version.major - -
-
- The major version number. - - -
- - - - - - - - -
- - -
<static> <constant> - - {number} - pv.version.minor - -
-
- The minor version number. - - -
- - - - - - - - - - - - - - - - - - -
-
- - - -
- - Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:30 GMT-0700 (PDT) -
- - diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Behavior.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Behavior.js.html deleted file mode 100644 index c32818d8..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Behavior.js.html +++ /dev/null @@ -1,40 +0,0 @@ -
  1 /**
-  2  * Abstract; see an implementing class for details.
-  3  *
-  4  * @class Represents a reusable interaction; applies an interactive behavior to
-  5  * a given mark. Behaviors are themselves functions designed to be used as event
-  6  * handlers. For example, to add pan and zoom support to any panel, say:
-  7  *
-  8  * <pre>    .event("mousedown", pv.Behavior.pan())
-  9  *     .event("mousewheel", pv.Behavior.zoom())</pre>
- 10  *
- 11  * The behavior should be registered on the event that triggers the start of the
- 12  * behavior. Typically, the behavior will take care of registering for any
- 13  * additional events that are necessary. For example, dragging starts on
- 14  * mousedown, while the drag behavior automatically listens for mousemove and
- 15  * mouseup events on the window. By listening to the window, the behavior can
- 16  * continue to receive mouse events even if the mouse briefly leaves the mark
- 17  * being dragged, or even the root panel.
- 18  *
- 19  * <p>Each behavior implementation has specific requirements as to which events
- 20  * it supports, and how it should be used. For example, the drag behavior
- 21  * requires that the data associated with the mark be an object with <tt>x</tt>
- 22  * and <tt>y</tt> attributes, such as a {@link pv.Vector}, storing the mark's
- 23  * position. See an implementing class for details.
- 24  *
- 25  * @see pv.Behavior.drag
- 26  * @see pv.Behavior.pan
- 27  * @see pv.Behavior.point
- 28  * @see pv.Behavior.select
- 29  * @see pv.Behavior.zoom
- 30  * @extends function
- 31  */
- 32 pv.Behavior = {};
- 33 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Drag.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Drag.js.html deleted file mode 100644 index 6e973c6f..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Drag.js.html +++ /dev/null @@ -1,120 +0,0 @@ -
  1 /**
-  2  * Returns a new drag behavior to be registered on mousedown events.
-  3  *
-  4  * @class Implements interactive dragging starting with mousedown events.
-  5  * Register this behavior on marks that should be draggable by the user, such as
-  6  * the selected region for brushing and linking. This behavior can be used in
-  7  * tandom with {@link pv.Behavior.select} to allow the selected region to be
-  8  * dragged interactively.
-  9  *
- 10  * <p>After the initial mousedown event is triggered, this behavior listens for
- 11  * mousemove and mouseup events on the window. This allows dragging to continue
- 12  * even if the mouse temporarily leaves the mark that is being dragged, or even
- 13  * the root panel.
- 14  *
- 15  * <p>This behavior requires that the data associated with the mark being
- 16  * dragged have <tt>x</tt> and <tt>y</tt> attributes that correspond to the
- 17  * mark's location in pixels. The mark's positional properties are not set
- 18  * directly by this behavior; instead, the positional properties should be
- 19  * defined as:
- 20  *
- 21  * <pre>    .left(function(d) d.x)
- 22  *     .top(function(d) d.y)</pre>
- 23  *
- 24  * Thus, the behavior does not move the mark directly, but instead updates the
- 25  * mark position by updating the underlying data. Note that if the positional
- 26  * properties are defined with bottom and right (rather than top and left), the
- 27  * drag behavior will be inverted, which will confuse users!
- 28  *
- 29  * <p>The drag behavior is bounded by the parent panel; the <tt>x</tt> and
- 30  * <tt>y</tt> attributes are clamped such that the mark being dragged does not
- 31  * extend outside the enclosing panel's bounds. To facilitate this, the drag
- 32  * behavior also queries for <tt>dx</tt> and <tt>dy</tt> attributes on the
- 33  * underlying data, to determine the dimensions of the bar being dragged. For
- 34  * non-rectangular marks, the drag behavior simply treats the mark as a point,
- 35  * which means that only the mark's center is bounded.
- 36  *
- 37  * <p>The mark being dragged is automatically re-rendered for each mouse event
- 38  * as part of the drag operation. In addition, a <tt>fix</tt> attribute is
- 39  * populated on the mark, which allows visual feedback for dragging. For
- 40  * example, to change the mark fill color while dragging:
- 41  *
- 42  * <pre>    .fillStyle(function(d) d.fix ? "#ff7f0e" : "#aec7e8")</pre>
- 43  *
- 44  * In some cases, such as with network layouts, dragging the mark may cause
- 45  * related marks to change, in which case additional marks may also need to be
- 46  * rendered. This can be accomplished by listening for the drag
- 47  * psuedo-events:<ul>
- 48  *
- 49  * <li>dragstart (on mousedown)
- 50  * <li>drag (on mousemove)
- 51  * <li>dragend (on mouseup)
- 52  *
- 53  * </ul>For example, to render the parent panel while dragging, thus
- 54  * re-rendering all sibling marks:
- 55  *
- 56  * <pre>    .event("mousedown", pv.Behavior.drag())
- 57  *     .event("drag", function() this.parent)</pre>
- 58  *
- 59  * This behavior may be enhanced in the future to allow more flexible
- 60  * configuration of drag behavior.
- 61  *
- 62  * @extends pv.Behavior
- 63  * @see pv.Behavior
- 64  * @see pv.Behavior.select
- 65  * @see pv.Layout.force
- 66  */
- 67 pv.Behavior.drag = function() {
- 68   var scene, // scene context
- 69       index, // scene context
- 70       p, // particle being dragged
- 71       v1, // initial mouse-particle offset
- 72       max;
- 73 
- 74   /** @private */
- 75   function mousedown(d) {
- 76     index = this.index;
- 77     scene = this.scene;
- 78     var m = this.mouse();
- 79     v1 = ((p = d).fix = pv.vector(d.x, d.y)).minus(m);
- 80     max = {
- 81       x: this.parent.width() - (d.dx || 0),
- 82       y: this.parent.height() - (d.dy || 0)
- 83     };
- 84     scene.mark.context(scene, index, function() { this.render(); });
- 85     pv.Mark.dispatch("dragstart", scene, index);
- 86   }
- 87 
- 88   /** @private */
- 89   function mousemove() {
- 90     if (!scene) return;
- 91     scene.mark.context(scene, index, function() {
- 92         var m = this.mouse();
- 93         p.x = p.fix.x = Math.max(0, Math.min(v1.x + m.x, max.x));
- 94         p.y = p.fix.y = Math.max(0, Math.min(v1.y + m.y, max.y));
- 95         this.render();
- 96       });
- 97     pv.Mark.dispatch("drag", scene, index);
- 98   }
- 99 
-100   /** @private */
-101   function mouseup() {
-102     if (!scene) return;
-103     p.fix = null;
-104     scene.mark.context(scene, index, function() { this.render(); });
-105     pv.Mark.dispatch("dragend", scene, index);
-106     scene = null;
-107   }
-108 
-109   pv.listen(window, "mousemove", mousemove);
-110   pv.listen(window, "mouseup", mouseup);
-111   return mousedown;
-112 };
-113 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Pan.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Pan.js.html deleted file mode 100644 index 8bf15657..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Pan.js.html +++ /dev/null @@ -1,118 +0,0 @@ -
  1 /**
-  2  * Returns a new pan behavior to be registered on mousedown events.
-  3  *
-  4  * @class Implements interactive panning starting with mousedown events.
-  5  * Register this behavior on panels to allow panning. This behavior can be used
-  6  * in tandem with {@link pv.Behavior.zoom} to allow both panning and zooming:
-  7  *
-  8  * <pre>    .event("mousedown", pv.Behavior.pan())
-  9  *     .event("mousewheel", pv.Behavior.zoom())</pre>
- 10  *
- 11  * The pan behavior currently supports only mouse events; support for keyboard
- 12  * shortcuts to improve accessibility may be added in the future.
- 13  *
- 14  * <p>After the initial mousedown event is triggered, this behavior listens for
- 15  * mousemove and mouseup events on the window. This allows panning to continue
- 16  * even if the mouse temporarily leaves the panel that is being panned, or even
- 17  * the root panel.
- 18  *
- 19  * <p>The implementation of this behavior relies on the panel's
- 20  * <tt>transform</tt> property, which specifies a matrix transformation that is
- 21  * applied to child marks. Note that the transform property only affects the
- 22  * panel's children, but not the panel itself; therefore the panel's fill and
- 23  * stroke will not change when the contents are panned.
- 24  *
- 25  * <p>Panels have transparent fill styles by default; this means that panels may
- 26  * not receive the initial mousedown event to start panning. To fix this
- 27  * problem, either given the panel a visible fill style (such as "white"), or
- 28  * set the <tt>events</tt> property to "all" such that the panel receives events
- 29  * despite its transparent fill.
- 30  *
- 31  * <p>The pan behavior has optional support for bounding. If enabled, the user
- 32  * will not be able to pan the panel outside of the initial bounds. This feature
- 33  * is designed to work in conjunction with the zoom behavior; otherwise,
- 34  * bounding the panel effectively disables all panning.
- 35  *
- 36  * @extends pv.Behavior
- 37  * @see pv.Behavior.zoom
- 38  * @see pv.Panel#transform
- 39  */
- 40 pv.Behavior.pan = function() {
- 41   var scene, // scene context
- 42       index, // scene context
- 43       m1, // transformation matrix at the start of panning
- 44       v1, // mouse location at the start of panning
- 45       k, // inverse scale
- 46       bound; // whether to bound to the panel
- 47 
- 48   /** @private */
- 49   function mousedown() {
- 50     index = this.index;
- 51     scene = this.scene;
- 52     v1 = pv.vector(pv.event.pageX, pv.event.pageY);
- 53     m1 = this.transform();
- 54     k = 1 / (m1.k * this.scale);
- 55     if (bound) {
- 56       bound = {
- 57         x: (1 - m1.k) * this.width(),
- 58         y: (1 - m1.k) * this.height()
- 59       };
- 60     }
- 61   }
- 62 
- 63   /** @private */
- 64   function mousemove() {
- 65     if (!scene) return;
- 66     scene.mark.context(scene, index, function() {
- 67         var x = (pv.event.pageX - v1.x) * k,
- 68             y = (pv.event.pageY - v1.y) * k,
- 69             m = m1.translate(x, y);
- 70         if (bound) {
- 71           m.x = Math.max(bound.x, Math.min(0, m.x));
- 72           m.y = Math.max(bound.y, Math.min(0, m.y));
- 73         }
- 74         this.transform(m).render();
- 75       });
- 76     pv.Mark.dispatch("pan", scene, index);
- 77   }
- 78 
- 79   /** @private */
- 80   function mouseup() {
- 81     scene = null;
- 82   }
- 83 
- 84   /**
- 85    * Sets or gets the bound parameter. If bounding is enabled, the user will not
- 86    * be able to pan outside the initial panel bounds; this typically applies
- 87    * only when the pan behavior is used in tandem with the zoom behavior.
- 88    * Bounding is not enabled by default.
- 89    *
- 90    * <p>Note: enabling bounding after panning has already occurred will not
- 91    * immediately reset the transform. Bounding should be enabled before the
- 92    * panning behavior is applied.
- 93    *
- 94    * @function
- 95    * @returns {pv.Behavior.pan} this, or the current bound parameter.
- 96    * @name pv.Behavior.pan.prototype.bound
- 97    * @param {boolean} [x] the new bound parameter.
- 98    */
- 99   mousedown.bound = function(x) {
-100     if (arguments.length) {
-101       bound = Boolean(x);
-102       return this;
-103     }
-104     return Boolean(bound);
-105   };
-106 
-107   pv.listen(window, "mousemove", mousemove);
-108   pv.listen(window, "mouseup", mouseup);
-109   return mousedown;
-110 };
-111 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Point.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Point.js.html deleted file mode 100644 index 7d7a695b..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Point.js.html +++ /dev/null @@ -1,165 +0,0 @@ -
  1 /**
-  2  * Returns a new point behavior to be registered on mousemove events.
-  3  *
-  4  * @class Implements interactive fuzzy pointing, identifying marks that are in
-  5  * close proximity to the mouse cursor. This behavior is an alternative to the
-  6  * native mouseover and mouseout events, improving usability. Rather than
-  7  * requiring the user to mouseover a mark exactly, the mouse simply needs to
-  8  * move near the given mark and a "point" event is triggered. In addition, if
-  9  * multiple marks overlap, the point behavior can be used to identify the mark
- 10  * instance closest to the cursor, as opposed to the one that is rendered on
- 11  * top.
- 12  *
- 13  * <p>The point behavior can also identify the closest mark instance for marks
- 14  * that produce a continuous graphic primitive. The point behavior can thus be
- 15  * used to provide details-on-demand for both discrete marks (such as dots and
- 16  * bars), as well as continuous marks (such as lines and areas).
- 17  *
- 18  * <p>This behavior is implemented by finding the closest mark instance to the
- 19  * mouse cursor on every mousemove event. If this closest mark is within the
- 20  * given radius threshold, which defaults to 30 pixels, a "point" psuedo-event
- 21  * is dispatched to the given mark instance. If any mark were previously
- 22  * pointed, it would receive a corresponding "unpoint" event. These two
- 23  * psuedo-event types correspond to the native "mouseover" and "mouseout"
- 24  * events, respectively. To increase the radius at which the point behavior can
- 25  * be applied, specify an appropriate threshold to the constructor, up to
- 26  * <tt>Infinity</tt>.
- 27  *
- 28  * <p>By default, the standard Cartesian distance is computed. However, with
- 29  * some visualizations it is desirable to consider only a single dimension, such
- 30  * as the <i>x</i>-dimension for an independent variable. In this case, the
- 31  * collapse parameter can be set to collapse the <i>y</i> dimension:
- 32  *
- 33  * <pre>    .event("mousemove", pv.Behavior.point(Infinity).collapse("y"))</pre>
- 34  *
- 35  * <p>This behavior only listens to mousemove events on the assigned panel,
- 36  * which is typically the root panel. The behavior will search recursively for
- 37  * descendant marks to point. If the mouse leaves the assigned panel, the
- 38  * behavior no longer receives mousemove events; an unpoint psuedo-event is
- 39  * automatically dispatched to unpoint any pointed mark. Marks may be re-pointed
- 40  * when the mouse reenters the panel.
- 41  *
- 42  * <p>Panels have transparent fill styles by default; this means that panels may
- 43  * not receive the initial mousemove event to start pointing. To fix this
- 44  * problem, either given the panel a visible fill style (such as "white"), or
- 45  * set the <tt>events</tt> property to "all" such that the panel receives events
- 46  * despite its transparent fill.
- 47  *
- 48  * <p>Note: this behavior does not currently wedge marks.
- 49  *
- 50  * @extends pv.Behavior
- 51  *
- 52  * @param {number} [r] the fuzzy radius threshold in pixels
- 53  * @see <a href="http://www.tovigrossman.com/papers/chi2005bubblecursor.pdf"
- 54  * >"The Bubble Cursor: Enhancing Target Acquisition by Dynamic Resizing of the
- 55  * Cursor's Activation Area"</a> by T. Grossman & R. Balakrishnan, CHI 2005.
- 56  */
- 57 pv.Behavior.point = function(r) {
- 58   var unpoint, // the current pointer target
- 59       collapse = null, // dimensions to collapse
- 60       kx = 1, // x-dimension cost scale
- 61       ky = 1, // y-dimension cost scale
- 62       r2 = arguments.length ? r * r : 900; // fuzzy radius
- 63 
- 64   /** @private Search for the mark closest to the mouse. */
- 65   function search(scene, index) {
- 66     var s = scene[index],
- 67         point = {cost: Infinity};
- 68     for (var i = 0, n = s.visible && s.children.length; i < n; i++) {
- 69       var child = s.children[i], mark = child.mark, p;
- 70       if (mark.type == "panel") {
- 71         mark.scene = child;
- 72         for (var j = 0, m = child.length; j < m; j++) {
- 73           mark.index = j;
- 74           p = search(child, j);
- 75           if (p.cost < point.cost) point = p;
- 76         }
- 77         delete mark.scene;
- 78         delete mark.index;
- 79       } else if (mark.$handlers.point) {
- 80         var v = mark.mouse();
- 81         for (var j = 0, m = child.length; j < m; j++) {
- 82           var c = child[j],
- 83               dx = v.x - c.left - (c.width || 0) / 2,
- 84               dy = v.y - c.top - (c.height || 0) / 2,
- 85               dd = kx * dx * dx + ky * dy * dy;
- 86           if (dd < point.cost) {
- 87             point.distance = dx * dx + dy * dy;
- 88             point.cost = dd;
- 89             point.scene = child;
- 90             point.index = j;
- 91           }
- 92         }
- 93       }
- 94     }
- 95     return point;
- 96   }
- 97 
- 98   /** @private */
- 99   function mousemove() {
-100     /* If the closest mark is far away, clear the current target. */
-101     var point = search(this.scene, this.index);
-102     if ((point.cost == Infinity) || (point.distance > r2)) point = null;
-103 
-104     /* Unpoint the old target, if it's not the new target. */
-105     if (unpoint) {
-106       if (point
-107           && (unpoint.scene == point.scene)
-108           && (unpoint.index == point.index)) return;
-109       pv.Mark.dispatch("unpoint", unpoint.scene, unpoint.index);
-110     }
-111 
-112     /* Point the new target, if there is one. */
-113     if (unpoint = point) {
-114       pv.Mark.dispatch("point", point.scene, point.index);
-115 
-116       /* Unpoint when the mouse leaves the root panel. */
-117       pv.listen(this.root.canvas(), "mouseout", mouseout);
-118     }
-119   }
-120 
-121   /** @private */
-122   function mouseout(e) {
-123     if (unpoint && !pv.ancestor(this, e.relatedTarget)) {
-124       pv.Mark.dispatch("unpoint", unpoint.scene, unpoint.index);
-125       unpoint = null;
-126     }
-127   }
-128 
-129   /**
-130    * Sets or gets the collapse parameter. By default, the standard Cartesian
-131    * distance is computed. However, with some visualizations it is desirable to
-132    * consider only a single dimension, such as the <i>x</i>-dimension for an
-133    * independent variable. In this case, the collapse parameter can be set to
-134    * collapse the <i>y</i> dimension:
-135    *
-136    * <pre>    .event("mousemove", pv.Behavior.point(Infinity).collapse("y"))</pre>
-137    *
-138    * @function
-139    * @returns {pv.Behavior.point} this, or the current collapse parameter.
-140    * @name pv.Behavior.point.prototype.collapse
-141    * @param {string} [x] the new collapse parameter
-142    */
-143   mousemove.collapse = function(x) {
-144     if (arguments.length) {
-145       collapse = String(x);
-146       switch (collapse) {
-147         case "y": kx = 1; ky = 0; break;
-148         case "x": kx = 0; ky = 1; break;
-149         default: kx = 1; ky = 1; break;
-150       }
-151       return mousemove;
-152     }
-153     return collapse;
-154   };
-155 
-156   return mousemove;
-157 };
-158 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Resize.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Resize.js.html deleted file mode 100644 index 51956e2c..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Resize.js.html +++ /dev/null @@ -1,112 +0,0 @@ -
  1 /**
-  2  * Returns a new resize behavior to be registered on mousedown events.
-  3  *
-  4  * @class Implements interactive resizing of a selection starting with mousedown
-  5  * events. Register this behavior on selection handles that should be resizeable
-  6  * by the user, such for brushing and linking. This behavior can be used in
-  7  * tandom with {@link pv.Behavior.select} and {@link pv.Behavior.drag} to allow
-  8  * the selected region to be selected and dragged interactively.
-  9  *
- 10  * <p>After the initial mousedown event is triggered, this behavior listens for
- 11  * mousemove and mouseup events on the window. This allows resizing to continue
- 12  * even if the mouse temporarily leaves the assigned panel, or even the root
- 13  * panel.
- 14  *
- 15  * <p>This behavior requires that the data associated with the mark being
- 16  * resized have <tt>x</tt>, <tt>y</tt>, <tt>dx</tt> and <tt>dy</tt> attributes
- 17  * that correspond to the mark's location and dimensions in pixels. The mark's
- 18  * positional properties are not set directly by this behavior; instead, the
- 19  * positional properties should be defined as:
- 20  *
- 21  * <pre>    .left(function(d) d.x)
- 22  *     .top(function(d) d.y)
- 23  *     .width(function(d) d.dx)
- 24  *     .height(function(d) d.dy)</pre>
- 25  *
- 26  * Thus, the behavior does not resize the mark directly, but instead updates the
- 27  * size by updating the assigned panel's underlying data. Note that if the
- 28  * positional properties are defined with bottom and right (rather than top and
- 29  * left), the resize behavior will be inverted, which will confuse users!
- 30  *
- 31  * <p>The resize behavior is bounded by the assigned mark's enclosing panel; the
- 32  * positional attributes are clamped such that the selection does not extend
- 33  * outside the panel's bounds.
- 34  *
- 35  * <p>The mark being resized is automatically re-rendered for each mouse event
- 36  * as part of the resize operation. This behavior may be enhanced in the future
- 37  * to allow more flexible configuration. In some cases, such as with parallel
- 38  * coordinates, resizing the selection may cause related marks to change, in
- 39  * which case additional marks may also need to be rendered. This can be
- 40  * accomplished by listening for the select psuedo-events:<ul>
- 41  *
- 42  * <li>resizestart (on mousedown)
- 43  * <li>resize (on mousemove)
- 44  * <li>resizeend (on mouseup)
- 45  *
- 46  * </ul>For example, to render the parent panel while resizing, thus
- 47  * re-rendering all sibling marks:
- 48  *
- 49  * <pre>    .event("mousedown", pv.Behavior.resize("left"))
- 50  *     .event("resize", function() this.parent)</pre>
- 51  *
- 52  * This behavior may be enhanced in the future to allow more flexible
- 53  * configuration of the selection behavior.
- 54  *
- 55  * @extends pv.Behavior
- 56  * @see pv.Behavior.select
- 57  * @see pv.Behavior.drag
- 58  */
- 59 pv.Behavior.resize = function(side) {
- 60   var scene, // scene context
- 61       index, // scene context
- 62       r, // region being selected
- 63       m1; // initial mouse position
- 64 
- 65   /** @private */
- 66   function mousedown(d) {
- 67     index = this.index;
- 68     scene = this.scene;
- 69     m1 = this.mouse();
- 70     r = d;
- 71     switch (side) {
- 72       case "left": m1.x = r.x + r.dx; break;
- 73       case "right": m1.x = r.x; break;
- 74       case "top": m1.y = r.y + r.dy; break;
- 75       case "bottom": m1.y = r.y; break;
- 76     }
- 77     pv.Mark.dispatch("resizestart", scene, index);
- 78   }
- 79 
- 80   /** @private */
- 81   function mousemove() {
- 82     if (!scene) return;
- 83     scene.mark.context(scene, index, function() {
- 84         var m2 = this.mouse();
- 85         r.x = Math.max(0, Math.min(m1.x, m2.x));
- 86         r.y = Math.max(0, Math.min(m1.y, m2.y));
- 87         r.dx = Math.min(this.parent.width(), Math.max(m2.x, m1.x)) - r.x;
- 88         r.dy = Math.min(this.parent.height(), Math.max(m2.y, m1.y)) - r.y;
- 89         this.render();
- 90       });
- 91     pv.Mark.dispatch("resize", scene, index);
- 92   }
- 93 
- 94   /** @private */
- 95   function mouseup() {
- 96     if (!scene) return;
- 97     pv.Mark.dispatch("resizeend", scene, index);
- 98     scene = null;
- 99   }
-100 
-101   pv.listen(window, "mousemove", mousemove);
-102   pv.listen(window, "mouseup", mouseup);
-103   return mousedown;
-104 };
-105 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Select.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Select.js.html deleted file mode 100644 index b59fd719..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Select.js.html +++ /dev/null @@ -1,108 +0,0 @@ -
  1 /**
-  2  * Returns a new select behavior to be registered on mousedown events.
-  3  *
-  4  * @class Implements interactive selecting starting with mousedown events.
-  5  * Register this behavior on panels that should be selectable by the user, such
-  6  * for brushing and linking. This behavior can be used in tandom with
-  7  * {@link pv.Behavior.drag} to allow the selected region to be dragged
-  8  * interactively.
-  9  *
- 10  * <p>After the initial mousedown event is triggered, this behavior listens for
- 11  * mousemove and mouseup events on the window. This allows selecting to continue
- 12  * even if the mouse temporarily leaves the assigned panel, or even the root
- 13  * panel.
- 14  *
- 15  * <p>This behavior requires that the data associated with the mark being
- 16  * dragged have <tt>x</tt>, <tt>y</tt>, <tt>dx</tt> and <tt>dy</tt> attributes
- 17  * that correspond to the mark's location and dimensions in pixels. The mark's
- 18  * positional properties are not set directly by this behavior; instead, the
- 19  * positional properties should be defined as:
- 20  *
- 21  * <pre>    .left(function(d) d.x)
- 22  *     .top(function(d) d.y)
- 23  *     .width(function(d) d.dx)
- 24  *     .height(function(d) d.dy)</pre>
- 25  *
- 26  * Thus, the behavior does not resize the mark directly, but instead updates the
- 27  * selection by updating the assigned panel's underlying data. Note that if the
- 28  * positional properties are defined with bottom and right (rather than top and
- 29  * left), the drag behavior will be inverted, which will confuse users!
- 30  *
- 31  * <p>The select behavior is bounded by the assigned panel; the positional
- 32  * attributes are clamped such that the selection does not extend outside the
- 33  * panel's bounds.
- 34  *
- 35  * <p>The panel being selected is automatically re-rendered for each mouse event
- 36  * as part of the drag operation. This behavior may be enhanced in the future to
- 37  * allow more flexible configuration of select behavior. In some cases, such as
- 38  * with parallel coordinates, making a selection may cause related marks to
- 39  * change, in which case additional marks may also need to be rendered. This can
- 40  * be accomplished by listening for the select psuedo-events:<ul>
- 41  *
- 42  * <li>selectstart (on mousedown)
- 43  * <li>select (on mousemove)
- 44  * <li>selectend (on mouseup)
- 45  *
- 46  * </ul>For example, to render the parent panel while selecting, thus
- 47  * re-rendering all sibling marks:
- 48  *
- 49  * <pre>    .event("mousedown", pv.Behavior.drag())
- 50  *     .event("select", function() this.parent)</pre>
- 51  *
- 52  * This behavior may be enhanced in the future to allow more flexible
- 53  * configuration of the selection behavior.
- 54  *
- 55  * @extends pv.Behavior
- 56  * @see pv.Behavior.drag
- 57  */
- 58 pv.Behavior.select = function() {
- 59   var scene, // scene context
- 60       index, // scene context
- 61       r, // region being selected
- 62       m1; // initial mouse position
- 63 
- 64   /** @private */
- 65   function mousedown(d) {
- 66     index = this.index;
- 67     scene = this.scene;
- 68     m1 = this.mouse();
- 69     r = d;
- 70     r.x = m1.x;
- 71     r.y = m1.y;
- 72     r.dx = r.dy = 0;
- 73     pv.Mark.dispatch("selectstart", scene, index);
- 74   }
- 75 
- 76   /** @private */
- 77   function mousemove() {
- 78     if (!scene) return;
- 79     scene.mark.context(scene, index, function() {
- 80         var m2 = this.mouse();
- 81         r.x = Math.max(0, Math.min(m1.x, m2.x));
- 82         r.y = Math.max(0, Math.min(m1.y, m2.y));
- 83         r.dx = Math.min(this.width(), Math.max(m2.x, m1.x)) - r.x;
- 84         r.dy = Math.min(this.height(), Math.max(m2.y, m1.y)) - r.y;
- 85         this.render();
- 86       });
- 87     pv.Mark.dispatch("select", scene, index);
- 88   }
- 89 
- 90   /** @private */
- 91   function mouseup() {
- 92     if (!scene) return;
- 93     pv.Mark.dispatch("selectend", scene, index);
- 94     scene = null;
- 95   }
- 96 
- 97   pv.listen(window, "mousemove", mousemove);
- 98   pv.listen(window, "mouseup", mouseup);
- 99   return mousedown;
-100 };
-101 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Zoom.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Zoom.js.html deleted file mode 100644 index 16875feb..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_behavior_Zoom.js.html +++ /dev/null @@ -1,93 +0,0 @@ -
  1 /**
-  2  * Returns a new zoom behavior to be registered on mousewheel events.
-  3  *
-  4  * @class Implements interactive zooming using mousewheel events. Register this
-  5  * behavior on panels to allow zooming. This behavior can be used in tandem with
-  6  * {@link pv.Behavior.pan} to allow both panning and zooming:
-  7  *
-  8  * <pre>    .event("mousedown", pv.Behavior.pan())
-  9  *     .event("mousewheel", pv.Behavior.zoom())</pre>
- 10  *
- 11  * The zoom behavior currently supports only mousewheel events; support for
- 12  * keyboard shortcuts and gesture events to improve accessibility may be added
- 13  * in the future.
- 14  *
- 15  * <p>The implementation of this behavior relies on the panel's
- 16  * <tt>transform</tt> property, which specifies a matrix transformation that is
- 17  * applied to child marks. Note that the transform property only affects the
- 18  * panel's children, but not the panel itself; therefore the panel's fill and
- 19  * stroke will not change when the contents are zoomed. The built-in support for
- 20  * transforms only supports uniform scaling and translates, which is sufficient
- 21  * for panning and zooming.  Note that this is not a strict geometric
- 22  * transformation, as the <tt>lineWidth</tt> property is scale-aware: strokes
- 23  * are drawn at constant size independent of scale.
- 24  *
- 25  * <p>Panels have transparent fill styles by default; this means that panels may
- 26  * not receive mousewheel events to zoom. To fix this problem, either given the
- 27  * panel a visible fill style (such as "white"), or set the <tt>events</tt>
- 28  * property to "all" such that the panel receives events despite its transparent
- 29  * fill.
- 30  *
- 31  * <p>The zoom behavior has optional support for bounding. If enabled, the user
- 32  * will not be able to zoom out farther than the initial bounds. This feature is
- 33  * designed to work in conjunction with the pan behavior.
- 34  *
- 35  * @extends pv.Behavior
- 36  * @see pv.Panel#transform
- 37  * @see pv.Mark#scale
- 38  * @param {number} speed
- 39  */
- 40 pv.Behavior.zoom = function(speed) {
- 41   var bound; // whether to bound to the panel
- 42 
- 43   if (!arguments.length) speed = 1 / 48;
- 44 
- 45   /** @private */
- 46   function mousewheel() {
- 47     var v = this.mouse(),
- 48         k = pv.event.wheel * speed,
- 49         m = this.transform().translate(v.x, v.y)
- 50             .scale((k < 0) ? (1e3 / (1e3 - k)) : ((1e3 + k) / 1e3))
- 51             .translate(-v.x, -v.y);
- 52     if (bound) {
- 53       m.k = Math.max(1, m.k);
- 54       m.x = Math.max((1 - m.k) * this.width(), Math.min(0, m.x));
- 55       m.y = Math.max((1 - m.k) * this.height(), Math.min(0, m.y));
- 56     }
- 57     this.transform(m).render();
- 58     pv.Mark.dispatch("zoom", this.scene, this.index);
- 59   }
- 60 
- 61   /**
- 62    * Sets or gets the bound parameter. If bounding is enabled, the user will not
- 63    * be able to zoom out farther than the initial panel bounds. Bounding is not
- 64    * enabled by default. If this behavior is used in tandem with the pan
- 65    * behavior, both should use the same bound parameter.
- 66    *
- 67    * <p>Note: enabling bounding after zooming has already occurred will not
- 68    * immediately reset the transform. Bounding should be enabled before the zoom
- 69    * behavior is applied.
- 70    *
- 71    * @function
- 72    * @returns {pv.Behavior.zoom} this, or the current bound parameter.
- 73    * @name pv.Behavior.zoom.prototype.bound
- 74    * @param {boolean} [x] the new bound parameter.
- 75    */
- 76   mousewheel.bound = function(x) {
- 77     if (arguments.length) {
- 78       bound = Boolean(x);
- 79       return this;
- 80     }
- 81     return Boolean(bound);
- 82   };
- 83 
- 84   return mousewheel;
- 85 };
- 86 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_color_Color.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_color_Color.js.html deleted file mode 100644 index d4241a2f..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_color_Color.js.html +++ /dev/null @@ -1,606 +0,0 @@ -
  1 /**
-  2  * Returns the {@link pv.Color} for the specified color format string. Colors
-  3  * may have an associated opacity, or alpha channel. Color formats are specified
-  4  * by CSS Color Modular Level 3, using either in RGB or HSL color space. For
-  5  * example:<ul>
-  6  *
-  7  * <li>#f00 // #rgb
-  8  * <li>#ff0000 // #rrggbb
-  9  * <li>rgb(255, 0, 0)
- 10  * <li>rgb(100%, 0%, 0%)
- 11  * <li>hsl(0, 100%, 50%)
- 12  * <li>rgba(0, 0, 255, 0.5)
- 13  * <li>hsla(120, 100%, 50%, 1)
- 14  *
- 15  * </ul>The SVG 1.0 color keywords names are also supported, such as "aliceblue"
- 16  * and "yellowgreen". The "transparent" keyword is supported for fully-
- 17  * transparent black.
- 18  *
- 19  * <p>If the <tt>format</tt> argument is already an instance of <tt>Color</tt>,
- 20  * the argument is returned with no further processing.
- 21  *
- 22  * @param {string} format the color specification string, such as "#f00".
- 23  * @returns {pv.Color} the corresponding <tt>Color</tt>.
- 24  * @see <a href="http://www.w3.org/TR/SVG/types.html#ColorKeywords">SVG color
- 25  * keywords</a>
- 26  * @see <a href="http://www.w3.org/TR/css3-color/">CSS3 color module</a>
- 27  */
- 28 pv.color = function(format) {
- 29   if (format.rgb) return format.rgb();
- 30 
- 31   /* Handle hsl, rgb. */
- 32   var m1 = /([a-z]+)\((.*)\)/i.exec(format);
- 33   if (m1) {
- 34     var m2 = m1[2].split(","), a = 1;
- 35     switch (m1[1]) {
- 36       case "hsla":
- 37       case "rgba": {
- 38         a = parseFloat(m2[3]);
- 39         if (!a) return pv.Color.transparent;
- 40         break;
- 41       }
- 42     }
- 43     switch (m1[1]) {
- 44       case "hsla":
- 45       case "hsl": {
- 46         var h = parseFloat(m2[0]), // degrees
- 47             s = parseFloat(m2[1]) / 100, // percentage
- 48             l = parseFloat(m2[2]) / 100; // percentage
- 49         return (new pv.Color.Hsl(h, s, l, a)).rgb();
- 50       }
- 51       case "rgba":
- 52       case "rgb": {
- 53         function parse(c) { // either integer or percentage
- 54           var f = parseFloat(c);
- 55           return (c[c.length - 1] == '%') ? Math.round(f * 2.55) : f;
- 56         }
- 57         var r = parse(m2[0]), g = parse(m2[1]), b = parse(m2[2]);
- 58         return pv.rgb(r, g, b, a);
- 59       }
- 60     }
- 61   }
- 62 
- 63   /* Named colors. */
- 64   var named = pv.Color.names[format];
- 65   if (named) return named;
- 66 
- 67   /* Hexadecimal colors: #rgb and #rrggbb. */
- 68   if (format.charAt(0) == "#") {
- 69     var r, g, b;
- 70     if (format.length == 4) {
- 71       r = format.charAt(1); r += r;
- 72       g = format.charAt(2); g += g;
- 73       b = format.charAt(3); b += b;
- 74     } else if (format.length == 7) {
- 75       r = format.substring(1, 3);
- 76       g = format.substring(3, 5);
- 77       b = format.substring(5, 7);
- 78     }
- 79     return pv.rgb(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1);
- 80   }
- 81 
- 82   /* Otherwise, pass-through unsupported colors. */
- 83   return new pv.Color(format, 1);
- 84 };
- 85 
- 86 /**
- 87  * Constructs a color with the specified color format string and opacity. This
- 88  * constructor should not be invoked directly; use {@link pv.color} instead.
- 89  *
- 90  * @class Represents an abstract (possibly translucent) color. The color is
- 91  * divided into two parts: the <tt>color</tt> attribute, an opaque color format
- 92  * string, and the <tt>opacity</tt> attribute, a float in [0, 1]. The color
- 93  * space is dependent on the implementing class; all colors support the
- 94  * {@link #rgb} method to convert to RGB color space for interpolation.
- 95  *
- 96  * <p>See also the <a href="../../api/Color.html">Color guide</a>.
- 97  *
- 98  * @param {string} color an opaque color format string, such as "#f00".
- 99  * @param {number} opacity the opacity, in [0,1].
-100  * @see pv.color
-101  */
-102 pv.Color = function(color, opacity) {
-103   /**
-104    * An opaque color format string, such as "#f00".
-105    *
-106    * @type string
-107    * @see <a href="http://www.w3.org/TR/SVG/types.html#ColorKeywords">SVG color
-108    * keywords</a>
-109    * @see <a href="http://www.w3.org/TR/css3-color/">CSS3 color module</a>
-110    */
-111   this.color = color;
-112 
-113   /**
-114    * The opacity, a float in [0, 1].
-115    *
-116    * @type number
-117    */
-118   this.opacity = opacity;
-119 };
-120 
-121 /**
-122  * Returns a new color that is a brighter version of this color. The behavior of
-123  * this method may vary slightly depending on the underlying color space.
-124  * Although brighter and darker are inverse operations, the results of a series
-125  * of invocations of these two methods might be inconsistent because of rounding
-126  * errors.
-127  *
-128  * @param [k] {number} an optional scale factor; defaults to 1.
-129  * @see #darker
-130  * @returns {pv.Color} a brighter color.
-131  */
-132 pv.Color.prototype.brighter = function(k) {
-133   return this.rgb().brighter(k);
-134 };
-135 
-136 /**
-137  * Returns a new color that is a brighter version of this color. The behavior of
-138  * this method may vary slightly depending on the underlying color space.
-139  * Although brighter and darker are inverse operations, the results of a series
-140  * of invocations of these two methods might be inconsistent because of rounding
-141  * errors.
-142  *
-143  * @param [k] {number} an optional scale factor; defaults to 1.
-144  * @see #brighter
-145  * @returns {pv.Color} a darker color.
-146  */
-147 pv.Color.prototype.darker = function(k) {
-148   return this.rgb().darker(k);
-149 };
-150 
-151 /**
-152  * Constructs a new RGB color with the specified channel values.
-153  *
-154  * @param {number} r the red channel, an integer in [0,255].
-155  * @param {number} g the green channel, an integer in [0,255].
-156  * @param {number} b the blue channel, an integer in [0,255].
-157  * @param {number} [a] the alpha channel, a float in [0,1].
-158  * @returns pv.Color.Rgb
-159  */
-160 pv.rgb = function(r, g, b, a) {
-161   return new pv.Color.Rgb(r, g, b, (arguments.length == 4) ? a : 1);
-162 };
-163 
-164 /**
-165  * Constructs a new RGB color with the specified channel values.
-166  *
-167  * @class Represents a color in RGB space.
-168  *
-169  * @param {number} r the red channel, an integer in [0,255].
-170  * @param {number} g the green channel, an integer in [0,255].
-171  * @param {number} b the blue channel, an integer in [0,255].
-172  * @param {number} a the alpha channel, a float in [0,1].
-173  * @extends pv.Color
-174  */
-175 pv.Color.Rgb = function(r, g, b, a) {
-176   pv.Color.call(this, a ? ("rgb(" + r + "," + g + "," + b + ")") : "none", a);
-177 
-178   /**
-179    * The red channel, an integer in [0, 255].
-180    *
-181    * @type number
-182    */
-183   this.r = r;
-184 
-185   /**
-186    * The green channel, an integer in [0, 255].
-187    *
-188    * @type number
-189    */
-190   this.g = g;
-191 
-192   /**
-193    * The blue channel, an integer in [0, 255].
-194    *
-195    * @type number
-196    */
-197   this.b = b;
-198 
-199   /**
-200    * The alpha channel, a float in [0, 1].
-201    *
-202    * @type number
-203    */
-204   this.a = a;
-205 };
-206 pv.Color.Rgb.prototype = pv.extend(pv.Color);
-207 
-208 /**
-209  * Constructs a new RGB color with the same green, blue and alpha channels as
-210  * this color, with the specified red channel.
-211  *
-212  * @param {number} r the red channel, an integer in [0,255].
-213  */
-214 pv.Color.Rgb.prototype.red = function(r) {
-215   return pv.rgb(r, this.g, this.b, this.a);
-216 };
-217 
-218 /**
-219  * Constructs a new RGB color with the same red, blue and alpha channels as this
-220  * color, with the specified green channel.
-221  *
-222  * @param {number} g the green channel, an integer in [0,255].
-223  */
-224 pv.Color.Rgb.prototype.green = function(g) {
-225   return pv.rgb(this.r, g, this.b, this.a);
-226 };
-227 
-228 /**
-229  * Constructs a new RGB color with the same red, green and alpha channels as
-230  * this color, with the specified blue channel.
-231  *
-232  * @param {number} b the blue channel, an integer in [0,255].
-233  */
-234 pv.Color.Rgb.prototype.blue = function(b) {
-235   return pv.rgb(this.r, this.g, b, this.a);
-236 };
-237 
-238 /**
-239  * Constructs a new RGB color with the same red, green and blue channels as this
-240  * color, with the specified alpha channel.
-241  *
-242  * @param {number} a the alpha channel, a float in [0,1].
-243  */
-244 pv.Color.Rgb.prototype.alpha = function(a) {
-245   return pv.rgb(this.r, this.g, this.b, a);
-246 };
-247 
-248 /**
-249  * Returns the RGB color equivalent to this color. This method is abstract and
-250  * must be implemented by subclasses.
-251  *
-252  * @returns {pv.Color.Rgb} an RGB color.
-253  * @function
-254  * @name pv.Color.prototype.rgb
-255  */
-256 
-257 /**
-258  * Returns this.
-259  *
-260  * @returns {pv.Color.Rgb} this.
-261  */
-262 pv.Color.Rgb.prototype.rgb = function() { return this; };
-263 
-264 /**
-265  * Returns a new color that is a brighter version of this color. This method
-266  * applies an arbitrary scale factor to each of the three RGB components of this
-267  * color to create a brighter version of this color. Although brighter and
-268  * darker are inverse operations, the results of a series of invocations of
-269  * these two methods might be inconsistent because of rounding errors.
-270  *
-271  * @param [k] {number} an optional scale factor; defaults to 1.
-272  * @see #darker
-273  * @returns {pv.Color.Rgb} a brighter color.
-274  */
-275 pv.Color.Rgb.prototype.brighter = function(k) {
-276   k = Math.pow(0.7, arguments.length ? k : 1);
-277   var r = this.r, g = this.g, b = this.b, i = 30;
-278   if (!r && !g && !b) return pv.rgb(i, i, i, this.a);
-279   if (r && (r < i)) r = i;
-280   if (g && (g < i)) g = i;
-281   if (b && (b < i)) b = i;
-282   return pv.rgb(
-283       Math.min(255, Math.floor(r / k)),
-284       Math.min(255, Math.floor(g / k)),
-285       Math.min(255, Math.floor(b / k)),
-286       this.a);
-287 };
-288 
-289 /**
-290  * Returns a new color that is a darker version of this color. This method
-291  * applies an arbitrary scale factor to each of the three RGB components of this
-292  * color to create a darker version of this color. Although brighter and darker
-293  * are inverse operations, the results of a series of invocations of these two
-294  * methods might be inconsistent because of rounding errors.
-295  *
-296  * @param [k] {number} an optional scale factor; defaults to 1.
-297  * @see #brighter
-298  * @returns {pv.Color.Rgb} a darker color.
-299  */
-300 pv.Color.Rgb.prototype.darker = function(k) {
-301   k = Math.pow(0.7, arguments.length ? k : 1);
-302   return pv.rgb(
-303       Math.max(0, Math.floor(k * this.r)),
-304       Math.max(0, Math.floor(k * this.g)),
-305       Math.max(0, Math.floor(k * this.b)),
-306       this.a);
-307 };
-308 
-309 /**
-310  * Constructs a new HSL color with the specified values.
-311  *
-312  * @param {number} h the hue, an integer in [0, 360].
-313  * @param {number} s the saturation, a float in [0, 1].
-314  * @param {number} l the lightness, a float in [0, 1].
-315  * @param {number} [a] the opacity, a float in [0, 1].
-316  * @returns pv.Color.Hsl
-317  */
-318 pv.hsl = function(h, s, l, a) {
-319   return new pv.Color.Hsl(h, s, l,  (arguments.length == 4) ? a : 1);
-320 };
-321 
-322 /**
-323  * Constructs a new HSL color with the specified values.
-324  *
-325  * @class Represents a color in HSL space.
-326  *
-327  * @param {number} h the hue, an integer in [0, 360].
-328  * @param {number} s the saturation, a float in [0, 1].
-329  * @param {number} l the lightness, a float in [0, 1].
-330  * @param {number} a the opacity, a float in [0, 1].
-331  * @extends pv.Color
-332  */
-333 pv.Color.Hsl = function(h, s, l, a) {
-334   pv.Color.call(this, "hsl(" + h + "," + (s * 100) + "%," + (l * 100) + "%)", a);
-335 
-336   /**
-337    * The hue, an integer in [0, 360].
-338    *
-339    * @type number
-340    */
-341   this.h = h;
-342 
-343   /**
-344    * The saturation, a float in [0, 1].
-345    *
-346    * @type number
-347    */
-348   this.s = s;
-349 
-350   /**
-351    * The lightness, a float in [0, 1].
-352    *
-353    * @type number
-354    */
-355   this.l = l;
-356 
-357   /**
-358    * The opacity, a float in [0, 1].
-359    *
-360    * @type number
-361    */
-362   this.a = a;
-363 };
-364 pv.Color.Hsl.prototype = pv.extend(pv.Color);
-365 
-366 /**
-367  * Constructs a new HSL color with the same saturation, lightness and alpha as
-368  * this color, and the specified hue.
-369  *
-370  * @param {number} h the hue, an integer in [0, 360].
-371  */
-372 pv.Color.Hsl.prototype.hue = function(h) {
-373   return pv.hsl(h, this.s, this.l, this.a);
-374 };
-375 
-376 /**
-377  * Constructs a new HSL color with the same hue, lightness and alpha as this
-378  * color, and the specified saturation.
-379  *
-380  * @param {number} s the saturation, a float in [0, 1].
-381  */
-382 pv.Color.Hsl.prototype.saturation = function(s) {
-383   return pv.hsl(this.h, s, this.l, this.a);
-384 };
-385 
-386 /**
-387  * Constructs a new HSL color with the same hue, saturation and alpha as this
-388  * color, and the specified lightness.
-389  *
-390  * @param {number} l the lightness, a float in [0, 1].
-391  */
-392 pv.Color.Hsl.prototype.lightness = function(l) {
-393   return pv.hsl(this.h, this.s, l, this.a);
-394 };
-395 
-396 /**
-397  * Constructs a new HSL color with the same hue, saturation and lightness as
-398  * this color, and the specified alpha.
-399  *
-400  * @param {number} a the opacity, a float in [0, 1].
-401  */
-402 pv.Color.Hsl.prototype.alpha = function(a) {
-403   return pv.hsl(this.h, this.s, this.l, a);
-404 };
-405 
-406 /**
-407  * Returns the RGB color equivalent to this HSL color.
-408  *
-409  * @returns {pv.Color.Rgb} an RGB color.
-410  */
-411 pv.Color.Hsl.prototype.rgb = function() {
-412   var h = this.h, s = this.s, l = this.l;
-413 
-414   /* Some simple corrections for h, s and l. */
-415   h = h % 360; if (h < 0) h += 360;
-416   s = Math.max(0, Math.min(s, 1));
-417   l = Math.max(0, Math.min(l, 1));
-418 
-419   /* From FvD 13.37, CSS Color Module Level 3 */
-420   var m2 = (l <= .5) ? (l * (1 + s)) : (l + s - l * s);
-421   var m1 = 2 * l - m2;
-422   function v(h) {
-423     if (h > 360) h -= 360;
-424     else if (h < 0) h += 360;
-425     if (h < 60) return m1 + (m2 - m1) * h / 60;
-426     if (h < 180) return m2;
-427     if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
-428     return m1;
-429   }
-430   function vv(h) {
-431     return Math.round(v(h) * 255);
-432   }
-433 
-434   return pv.rgb(vv(h + 120), vv(h), vv(h - 120), this.a);
-435 };
-436 
-437 /**
-438  * @private SVG color keywords, per CSS Color Module Level 3.
-439  *
-440  * @see <a href="http://www.w3.org/TR/SVG/types.html#ColorKeywords">SVG color
-441  * keywords</a>
-442  */
-443 pv.Color.names = {
-444   aliceblue: "#f0f8ff",
-445   antiquewhite: "#faebd7",
-446   aqua: "#00ffff",
-447   aquamarine: "#7fffd4",
-448   azure: "#f0ffff",
-449   beige: "#f5f5dc",
-450   bisque: "#ffe4c4",
-451   black: "#000000",
-452   blanchedalmond: "#ffebcd",
-453   blue: "#0000ff",
-454   blueviolet: "#8a2be2",
-455   brown: "#a52a2a",
-456   burlywood: "#deb887",
-457   cadetblue: "#5f9ea0",
-458   chartreuse: "#7fff00",
-459   chocolate: "#d2691e",
-460   coral: "#ff7f50",
-461   cornflowerblue: "#6495ed",
-462   cornsilk: "#fff8dc",
-463   crimson: "#dc143c",
-464   cyan: "#00ffff",
-465   darkblue: "#00008b",
-466   darkcyan: "#008b8b",
-467   darkgoldenrod: "#b8860b",
-468   darkgray: "#a9a9a9",
-469   darkgreen: "#006400",
-470   darkgrey: "#a9a9a9",
-471   darkkhaki: "#bdb76b",
-472   darkmagenta: "#8b008b",
-473   darkolivegreen: "#556b2f",
-474   darkorange: "#ff8c00",
-475   darkorchid: "#9932cc",
-476   darkred: "#8b0000",
-477   darksalmon: "#e9967a",
-478   darkseagreen: "#8fbc8f",
-479   darkslateblue: "#483d8b",
-480   darkslategray: "#2f4f4f",
-481   darkslategrey: "#2f4f4f",
-482   darkturquoise: "#00ced1",
-483   darkviolet: "#9400d3",
-484   deeppink: "#ff1493",
-485   deepskyblue: "#00bfff",
-486   dimgray: "#696969",
-487   dimgrey: "#696969",
-488   dodgerblue: "#1e90ff",
-489   firebrick: "#b22222",
-490   floralwhite: "#fffaf0",
-491   forestgreen: "#228b22",
-492   fuchsia: "#ff00ff",
-493   gainsboro: "#dcdcdc",
-494   ghostwhite: "#f8f8ff",
-495   gold: "#ffd700",
-496   goldenrod: "#daa520",
-497   gray: "#808080",
-498   green: "#008000",
-499   greenyellow: "#adff2f",
-500   grey: "#808080",
-501   honeydew: "#f0fff0",
-502   hotpink: "#ff69b4",
-503   indianred: "#cd5c5c",
-504   indigo: "#4b0082",
-505   ivory: "#fffff0",
-506   khaki: "#f0e68c",
-507   lavender: "#e6e6fa",
-508   lavenderblush: "#fff0f5",
-509   lawngreen: "#7cfc00",
-510   lemonchiffon: "#fffacd",
-511   lightblue: "#add8e6",
-512   lightcoral: "#f08080",
-513   lightcyan: "#e0ffff",
-514   lightgoldenrodyellow: "#fafad2",
-515   lightgray: "#d3d3d3",
-516   lightgreen: "#90ee90",
-517   lightgrey: "#d3d3d3",
-518   lightpink: "#ffb6c1",
-519   lightsalmon: "#ffa07a",
-520   lightseagreen: "#20b2aa",
-521   lightskyblue: "#87cefa",
-522   lightslategray: "#778899",
-523   lightslategrey: "#778899",
-524   lightsteelblue: "#b0c4de",
-525   lightyellow: "#ffffe0",
-526   lime: "#00ff00",
-527   limegreen: "#32cd32",
-528   linen: "#faf0e6",
-529   magenta: "#ff00ff",
-530   maroon: "#800000",
-531   mediumaquamarine: "#66cdaa",
-532   mediumblue: "#0000cd",
-533   mediumorchid: "#ba55d3",
-534   mediumpurple: "#9370db",
-535   mediumseagreen: "#3cb371",
-536   mediumslateblue: "#7b68ee",
-537   mediumspringgreen: "#00fa9a",
-538   mediumturquoise: "#48d1cc",
-539   mediumvioletred: "#c71585",
-540   midnightblue: "#191970",
-541   mintcream: "#f5fffa",
-542   mistyrose: "#ffe4e1",
-543   moccasin: "#ffe4b5",
-544   navajowhite: "#ffdead",
-545   navy: "#000080",
-546   oldlace: "#fdf5e6",
-547   olive: "#808000",
-548   olivedrab: "#6b8e23",
-549   orange: "#ffa500",
-550   orangered: "#ff4500",
-551   orchid: "#da70d6",
-552   palegoldenrod: "#eee8aa",
-553   palegreen: "#98fb98",
-554   paleturquoise: "#afeeee",
-555   palevioletred: "#db7093",
-556   papayawhip: "#ffefd5",
-557   peachpuff: "#ffdab9",
-558   peru: "#cd853f",
-559   pink: "#ffc0cb",
-560   plum: "#dda0dd",
-561   powderblue: "#b0e0e6",
-562   purple: "#800080",
-563   red: "#ff0000",
-564   rosybrown: "#bc8f8f",
-565   royalblue: "#4169e1",
-566   saddlebrown: "#8b4513",
-567   salmon: "#fa8072",
-568   sandybrown: "#f4a460",
-569   seagreen: "#2e8b57",
-570   seashell: "#fff5ee",
-571   sienna: "#a0522d",
-572   silver: "#c0c0c0",
-573   skyblue: "#87ceeb",
-574   slateblue: "#6a5acd",
-575   slategray: "#708090",
-576   slategrey: "#708090",
-577   snow: "#fffafa",
-578   springgreen: "#00ff7f",
-579   steelblue: "#4682b4",
-580   tan: "#d2b48c",
-581   teal: "#008080",
-582   thistle: "#d8bfd8",
-583   tomato: "#ff6347",
-584   turquoise: "#40e0d0",
-585   violet: "#ee82ee",
-586   wheat: "#f5deb3",
-587   white: "#ffffff",
-588   whitesmoke: "#f5f5f5",
-589   yellow: "#ffff00",
-590   yellowgreen: "#9acd32",
-591   transparent: pv.Color.transparent = pv.rgb(0, 0, 0, 0)
-592 };
-593 
-594 /* Initialized named colors. */
-595 (function() {
-596   var names = pv.Color.names;
-597   for (var name in names) names[name] = pv.color(names[name]);
-598 })();
-599 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_color_Colors.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_color_Colors.js.html deleted file mode 100644 index b3839b09..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_color_Colors.js.html +++ /dev/null @@ -1,143 +0,0 @@ -
  1 /**
-  2  * Returns a new categorical color encoding using the specified colors.  The
-  3  * arguments to this method are an array of colors; see {@link pv.color}. For
-  4  * example, to create a categorical color encoding using the <tt>species</tt>
-  5  * attribute:
-  6  *
-  7  * <pre>pv.colors("red", "green", "blue").by(function(d) d.species)</pre>
-  8  *
-  9  * The result of this expression can be used as a fill- or stroke-style
- 10  * property. This assumes that the data's <tt>species</tt> attribute is a
- 11  * string.
- 12  *
- 13  * @param {string} colors... categorical colors.
- 14  * @see pv.Scale.ordinal
- 15  * @returns {pv.Scale.ordinal} an ordinal color scale.
- 16  */
- 17 pv.colors = function() {
- 18   var scale = pv.Scale.ordinal();
- 19   scale.range.apply(scale, arguments);
- 20   return scale;
- 21 };
- 22 
- 23 /**
- 24  * A collection of standard color palettes for categorical encoding.
- 25  *
- 26  * @namespace A collection of standard color palettes for categorical encoding.
- 27  */
- 28 pv.Colors = {};
- 29 
- 30 /**
- 31  * Returns a new 10-color scheme. The arguments to this constructor are
- 32  * optional, and equivalent to calling {@link pv.Scale.OrdinalScale#domain}. The
- 33  * following colors are used:
- 34  *
- 35  * <div style="background:#1f77b4;">#1f77b4</div>
- 36  * <div style="background:#ff7f0e;">#ff7f0e</div>
- 37  * <div style="background:#2ca02c;">#2ca02c</div>
- 38  * <div style="background:#d62728;">#d62728</div>
- 39  * <div style="background:#9467bd;">#9467bd</div>
- 40  * <div style="background:#8c564b;">#8c564b</div>
- 41  * <div style="background:#e377c2;">#e377c2</div>
- 42  * <div style="background:#7f7f7f;">#7f7f7f</div>
- 43  * <div style="background:#bcbd22;">#bcbd22</div>
- 44  * <div style="background:#17becf;">#17becf</div>
- 45  *
- 46  * @param {number...} domain... domain values.
- 47  * @returns {pv.Scale.ordinal} a new ordinal color scale.
- 48  * @see pv.color
- 49  */
- 50 pv.Colors.category10 = function() {
- 51   var scale = pv.colors(
- 52       "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
- 53       "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf");
- 54   scale.domain.apply(scale, arguments);
- 55   return scale;
- 56 };
- 57 
- 58 /**
- 59  * Returns a new 20-color scheme. The arguments to this constructor are
- 60  * optional, and equivalent to calling {@link pv.Scale.OrdinalScale#domain}. The
- 61  * following colors are used:
- 62  *
- 63  * <div style="background:#1f77b4;">#1f77b4</div>
- 64  * <div style="background:#aec7e8;">#aec7e8</div>
- 65  * <div style="background:#ff7f0e;">#ff7f0e</div>
- 66  * <div style="background:#ffbb78;">#ffbb78</div>
- 67  * <div style="background:#2ca02c;">#2ca02c</div>
- 68  * <div style="background:#98df8a;">#98df8a</div>
- 69  * <div style="background:#d62728;">#d62728</div>
- 70  * <div style="background:#ff9896;">#ff9896</div>
- 71  * <div style="background:#9467bd;">#9467bd</div>
- 72  * <div style="background:#c5b0d5;">#c5b0d5</div>
- 73  * <div style="background:#8c564b;">#8c564b</div>
- 74  * <div style="background:#c49c94;">#c49c94</div>
- 75  * <div style="background:#e377c2;">#e377c2</div>
- 76  * <div style="background:#f7b6d2;">#f7b6d2</div>
- 77  * <div style="background:#7f7f7f;">#7f7f7f</div>
- 78  * <div style="background:#c7c7c7;">#c7c7c7</div>
- 79  * <div style="background:#bcbd22;">#bcbd22</div>
- 80  * <div style="background:#dbdb8d;">#dbdb8d</div>
- 81  * <div style="background:#17becf;">#17becf</div>
- 82  * <div style="background:#9edae5;">#9edae5</div>
- 83  *
- 84  * @param {number...} domain... domain values.
- 85  * @returns {pv.Scale.ordinal} a new ordinal color scale.
- 86  * @see pv.color
- 87 */
- 88 pv.Colors.category20 = function() {
- 89   var scale = pv.colors(
- 90       "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c",
- 91       "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5",
- 92       "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f",
- 93       "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5");
- 94   scale.domain.apply(scale, arguments);
- 95   return scale;
- 96 };
- 97 
- 98 /**
- 99  * Returns a new alternative 19-color scheme. The arguments to this constructor
-100  * are optional, and equivalent to calling
-101  * {@link pv.Scale.OrdinalScale#domain}. The following colors are used:
-102  *
-103  * <div style="background:#9c9ede;">#9c9ede</div>
-104  * <div style="background:#7375b5;">#7375b5</div>
-105  * <div style="background:#4a5584;">#4a5584</div>
-106  * <div style="background:#cedb9c;">#cedb9c</div>
-107  * <div style="background:#b5cf6b;">#b5cf6b</div>
-108  * <div style="background:#8ca252;">#8ca252</div>
-109  * <div style="background:#637939;">#637939</div>
-110  * <div style="background:#e7cb94;">#e7cb94</div>
-111  * <div style="background:#e7ba52;">#e7ba52</div>
-112  * <div style="background:#bd9e39;">#bd9e39</div>
-113  * <div style="background:#8c6d31;">#8c6d31</div>
-114  * <div style="background:#e7969c;">#e7969c</div>
-115  * <div style="background:#d6616b;">#d6616b</div>
-116  * <div style="background:#ad494a;">#ad494a</div>
-117  * <div style="background:#843c39;">#843c39</div>
-118  * <div style="background:#de9ed6;">#de9ed6</div>
-119  * <div style="background:#ce6dbd;">#ce6dbd</div>
-120  * <div style="background:#a55194;">#a55194</div>
-121  * <div style="background:#7b4173;">#7b4173</div>
-122  *
-123  * @param {number...} domain... domain values.
-124  * @returns {pv.Scale.ordinal} a new ordinal color scale.
-125  * @see pv.color
-126  */
-127 pv.Colors.category19 = function() {
-128   var scale = pv.colors(
-129       "#9c9ede", "#7375b5", "#4a5584", "#cedb9c", "#b5cf6b",
-130       "#8ca252", "#637939", "#e7cb94", "#e7ba52", "#bd9e39",
-131       "#8c6d31", "#e7969c", "#d6616b", "#ad494a", "#843c39",
-132       "#de9ed6", "#ce6dbd", "#a55194", "#7b4173");
-133   scale.domain.apply(scale, arguments);
-134   return scale;
-135 };
-136 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_color_Ramp.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_color_Ramp.js.html deleted file mode 100644 index 0a8ec84b..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_color_Ramp.js.html +++ /dev/null @@ -1,25 +0,0 @@ -
  1 /**
-  2  * Returns a linear color ramp from the specified <tt>start</tt> color to the
-  3  * specified <tt>end</tt> color. The color arguments may be specified either as
-  4  * <tt>string</tt>s or as {@link pv.Color}s. This is equivalent to:
-  5  *
-  6  * <pre>    pv.Scale.linear().domain(0, 1).range(...)</pre>
-  7  *
-  8  * @param {string} start the start color; may be a <tt>pv.Color</tt>.
-  9  * @param {string} end the end color; may be a <tt>pv.Color</tt>.
- 10  * @returns {Function} a color ramp from <tt>start</tt> to <tt>end</tt>.
- 11  * @see pv.Scale.linear
- 12  */
- 13 pv.ramp = function(start, end) {
- 14   var scale = pv.Scale.linear();
- 15   scale.range.apply(scale, arguments);
- 16   return scale;
- 17 };
- 18 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Arrays.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Arrays.js.html deleted file mode 100644 index f22b864e..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Arrays.js.html +++ /dev/null @@ -1,285 +0,0 @@ -
  1 /**
-  2  * @private A private variant of Array.prototype.map that supports the index
-  3  * property.
-  4  */
-  5 pv.map = function(array, f) {
-  6   var o = {};
-  7   return f
-  8       ? array.map(function(d, i) { o.index = i; return f.call(o, d); })
-  9       : array.slice();
- 10 };
- 11 
- 12 /**
- 13  * Concatenates the specified array with itself <i>n</i> times. For example,
- 14  * <tt>pv.repeat([1, 2])</tt> returns [1, 2, 1, 2].
- 15  *
- 16  * @param {array} a an array.
- 17  * @param {number} [n] the number of times to repeat; defaults to two.
- 18  * @returns {array} an array that repeats the specified array.
- 19  */
- 20 pv.repeat = function(array, n) {
- 21   if (arguments.length == 1) n = 2;
- 22   return pv.blend(pv.range(n).map(function() { return array; }));
- 23 };
- 24 
- 25 /**
- 26  * Given two arrays <tt>a</tt> and <tt>b</tt>, <style
- 27  * type="text/css">sub{line-height:0}</style> returns an array of all possible
- 28  * pairs of elements [a<sub>i</sub>, b<sub>j</sub>]. The outer loop is on array
- 29  * <i>a</i>, while the inner loop is on <i>b</i>, such that the order of
- 30  * returned elements is [a<sub>0</sub>, b<sub>0</sub>], [a<sub>0</sub>,
- 31  * b<sub>1</sub>], ... [a<sub>0</sub>, b<sub>m</sub>], [a<sub>1</sub>,
- 32  * b<sub>0</sub>], [a<sub>1</sub>, b<sub>1</sub>], ... [a<sub>1</sub>,
- 33  * b<sub>m</sub>], ... [a<sub>n</sub>, b<sub>m</sub>]. If either array is empty,
- 34  * an empty array is returned.
- 35  *
- 36  * @param {array} a an array.
- 37  * @param {array} b an array.
- 38  * @returns {array} an array of pairs of elements in <tt>a</tt> and <tt>b</tt>.
- 39  */
- 40 pv.cross = function(a, b) {
- 41   var array = [];
- 42   for (var i = 0, n = a.length, m = b.length; i < n; i++) {
- 43     for (var j = 0, x = a[i]; j < m; j++) {
- 44       array.push([x, b[j]]);
- 45     }
- 46   }
- 47   return array;
- 48 };
- 49 
- 50 /**
- 51  * Given the specified array of arrays, concatenates the arrays into a single
- 52  * array. If the individual arrays are explicitly known, an alternative to blend
- 53  * is to use JavaScript's <tt>concat</tt> method directly. These two equivalent
- 54  * expressions:<ul>
- 55  *
- 56  * <li><tt>pv.blend([[1, 2, 3], ["a", "b", "c"]])</tt>
- 57  * <li><tt>[1, 2, 3].concat(["a", "b", "c"])</tt>
- 58  *
- 59  * </ul>return [1, 2, 3, "a", "b", "c"].
- 60  *
- 61  * @param {array[]} arrays an array of arrays.
- 62  * @returns {array} an array containing all the elements of each array in
- 63  * <tt>arrays</tt>.
- 64  */
- 65 pv.blend = function(arrays) {
- 66   return Array.prototype.concat.apply([], arrays);
- 67 };
- 68 
- 69 /**
- 70  * Given the specified array of arrays, <style
- 71  * type="text/css">sub{line-height:0}</style> transposes each element
- 72  * array<sub>ij</sub> with array<sub>ji</sub>. If the array has dimensions
- 73  * <i>n</i>×<i>m</i>, it will have dimensions <i>m</i>×<i>n</i>
- 74  * after this method returns. This method transposes the elements of the array
- 75  * in place, mutating the array, and returning a reference to the array.
- 76  *
- 77  * @param {array[]} arrays an array of arrays.
- 78  * @returns {array[]} the passed-in array, after transposing the elements.
- 79  */
- 80 pv.transpose = function(arrays) {
- 81   var n = arrays.length, m = pv.max(arrays, function(d) { return d.length; });
- 82 
- 83   if (m > n) {
- 84     arrays.length = m;
- 85     for (var i = n; i < m; i++) {
- 86       arrays[i] = new Array(n);
- 87     }
- 88     for (var i = 0; i < n; i++) {
- 89       for (var j = i + 1; j < m; j++) {
- 90         var t = arrays[i][j];
- 91         arrays[i][j] = arrays[j][i];
- 92         arrays[j][i] = t;
- 93       }
- 94     }
- 95   } else {
- 96     for (var i = 0; i < m; i++) {
- 97       arrays[i].length = n;
- 98     }
- 99     for (var i = 0; i < n; i++) {
-100       for (var j = 0; j < i; j++) {
-101         var t = arrays[i][j];
-102         arrays[i][j] = arrays[j][i];
-103         arrays[j][i] = t;
-104       }
-105     }
-106   }
-107 
-108   arrays.length = m;
-109   for (var i = 0; i < m; i++) {
-110     arrays[i].length = n;
-111   }
-112 
-113   return arrays;
-114 };
-115 
-116 /**
-117  * Returns a normalized copy of the specified array, such that the sum of the
-118  * returned elements sum to one. If the specified array is not an array of
-119  * numbers, an optional accessor function <tt>f</tt> can be specified to map the
-120  * elements to numbers. For example, if <tt>array</tt> is an array of objects,
-121  * and each object has a numeric property "foo", the expression
-122  *
-123  * <pre>pv.normalize(array, function(d) d.foo)</pre>
-124  *
-125  * returns a normalized array on the "foo" property. If an accessor function is
-126  * not specified, the identity function is used. Accessor functions can refer to
-127  * <tt>this.index</tt>.
-128  *
-129  * @param {array} array an array of objects, or numbers.
-130  * @param {function} [f] an optional accessor function.
-131  * @returns {number[]} an array of numbers that sums to one.
-132  */
-133 pv.normalize = function(array, f) {
-134   var norm = pv.map(array, f), sum = pv.sum(norm);
-135   for (var i = 0; i < norm.length; i++) norm[i] /= sum;
-136   return norm;
-137 };
-138 
-139 /**
-140  * Returns a permutation of the specified array, using the specified array of
-141  * indexes. The returned array contains the corresponding element in
-142  * <tt>array</tt> for each index in <tt>indexes</tt>, in order. For example,
-143  *
-144  * <pre>pv.permute(["a", "b", "c"], [1, 2, 0])</pre>
-145  *
-146  * returns <tt>["b", "c", "a"]</tt>. It is acceptable for the array of indexes
-147  * to be a different length from the array of elements, and for indexes to be
-148  * duplicated or omitted. The optional accessor function <tt>f</tt> can be used
-149  * to perform a simultaneous mapping of the array elements. Accessor functions
-150  * can refer to <tt>this.index</tt>.
-151  *
-152  * @param {array} array an array.
-153  * @param {number[]} indexes an array of indexes into <tt>array</tt>.
-154  * @param {function} [f] an optional accessor function.
-155  * @returns {array} an array of elements from <tt>array</tt>; a permutation.
-156  */
-157 pv.permute = function(array, indexes, f) {
-158   if (!f) f = pv.identity;
-159   var p = new Array(indexes.length), o = {};
-160   indexes.forEach(function(j, i) { o.index = j; p[i] = f.call(o, array[j]); });
-161   return p;
-162 };
-163 
-164 /**
-165  * Returns a map from key to index for the specified <tt>keys</tt> array. For
-166  * example,
-167  *
-168  * <pre>pv.numerate(["a", "b", "c"])</pre>
-169  *
-170  * returns <tt>{a: 0, b: 1, c: 2}</tt>. Note that since JavaScript maps only
-171  * support string keys, <tt>keys</tt> must contain strings, or other values that
-172  * naturally map to distinct string values. Alternatively, an optional accessor
-173  * function <tt>f</tt> can be specified to compute the string key for the given
-174  * element. Accessor functions can refer to <tt>this.index</tt>.
-175  *
-176  * @param {array} keys an array, usually of string keys.
-177  * @param {function} [f] an optional key function.
-178  * @returns a map from key to index.
-179  */
-180 pv.numerate = function(keys, f) {
-181   if (!f) f = pv.identity;
-182   var map = {}, o = {};
-183   keys.forEach(function(x, i) { o.index = i; map[f.call(o, x)] = i; });
-184   return map;
-185 };
-186 
-187 /**
-188  * Returns the unique elements in the specified array, in the order they appear.
-189  * Note that since JavaScript maps only support string keys, <tt>array</tt> must
-190  * contain strings, or other values that naturally map to distinct string
-191  * values. Alternatively, an optional accessor function <tt>f</tt> can be
-192  * specified to compute the string key for the given element. Accessor functions
-193  * can refer to <tt>this.index</tt>.
-194  *
-195  * @param {array} array an array, usually of string keys.
-196  * @param {function} [f] an optional key function.
-197  * @returns {array} the unique values.
-198  */
-199 pv.uniq = function(array, f) {
-200   if (!f) f = pv.identity;
-201   var map = {}, keys = [], o = {}, y;
-202   array.forEach(function(x, i) {
-203     o.index = i;
-204     y = f.call(o, x);
-205     if (!(y in map)) map[y] = keys.push(y);
-206   });
-207   return keys;
-208 };
-209 
-210 /**
-211  * The comparator function for natural order. This can be used in conjunction with
-212  * the built-in array <tt>sort</tt> method to sort elements by their natural
-213  * order, ascending. Note that if no comparator function is specified to the
-214  * built-in <tt>sort</tt> method, the default order is lexicographic, <i>not</i>
-215  * natural!
-216  *
-217  * @see <a
-218  * href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/sort">Array.sort</a>.
-219  * @param a an element to compare.
-220  * @param b an element to compare.
-221  * @returns {number} negative if a < b; positive if a > b; otherwise 0.
-222  */
-223 pv.naturalOrder = function(a, b) {
-224   return (a < b) ? -1 : ((a > b) ? 1 : 0);
-225 };
-226 
-227 /**
-228  * The comparator function for reverse natural order. This can be used in
-229  * conjunction with the built-in array <tt>sort</tt> method to sort elements by
-230  * their natural order, descending. Note that if no comparator function is
-231  * specified to the built-in <tt>sort</tt> method, the default order is
-232  * lexicographic, <i>not</i> natural!
-233  *
-234  * @see #naturalOrder
-235  * @param a an element to compare.
-236  * @param b an element to compare.
-237  * @returns {number} negative if a < b; positive if a > b; otherwise 0.
-238  */
-239 pv.reverseOrder = function(b, a) {
-240   return (a < b) ? -1 : ((a > b) ? 1 : 0);
-241 };
-242 
-243 /**
-244  * Searches the specified array of numbers for the specified value using the
-245  * binary search algorithm. The array must be sorted (as by the <tt>sort</tt>
-246  * method) prior to making this call. If it is not sorted, the results are
-247  * undefined. If the array contains multiple elements with the specified value,
-248  * there is no guarantee which one will be found.
-249  *
-250  * <p>The <i>insertion point</i> is defined as the point at which the value
-251  * would be inserted into the array: the index of the first element greater than
-252  * the value, or <tt>array.length</tt>, if all elements in the array are less
-253  * than the specified value. Note that this guarantees that the return value
-254  * will be nonnegative if and only if the value is found.
-255  *
-256  * @param {number[]} array the array to be searched.
-257  * @param {number} value the value to be searched for.
-258  * @returns the index of the search value, if it is contained in the array;
-259  * otherwise, (-(<i>insertion point</i>) - 1).
-260  * @param {function} [f] an optional key function.
-261  */
-262 pv.search = function(array, value, f) {
-263   if (!f) f = pv.identity;
-264   var low = 0, high = array.length - 1;
-265   while (low <= high) {
-266     var mid = (low + high) >> 1, midValue = f(array[mid]);
-267     if (midValue < value) low = mid + 1;
-268     else if (midValue > value) high = mid - 1;
-269     else return mid;
-270   }
-271   return -low - 1;
-272 };
-273 
-274 pv.search.index = function(array, value, f) {
-275   var i = pv.search(array, value, f);
-276   return (i < 0) ? (-i - 1) : i;
-277 };
-278 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Dom.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Dom.js.html deleted file mode 100644 index 517374f7..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Dom.js.html +++ /dev/null @@ -1,388 +0,0 @@ -
  1 /**
-  2  * Returns a {@link pv.Dom} operator for the given map. This is a convenience
-  3  * factory method, equivalent to <tt>new pv.Dom(map)</tt>. To apply the operator
-  4  * and retrieve the root node, call {@link pv.Dom#root}; to retrieve all nodes
-  5  * flattened, use {@link pv.Dom#nodes}.
-  6  *
-  7  * @see pv.Dom
-  8  * @param map a map from which to construct a DOM.
-  9  * @returns {pv.Dom} a DOM operator for the specified map.
- 10  */
- 11 pv.dom = function(map) {
- 12   return new pv.Dom(map);
- 13 };
- 14 
- 15 /**
- 16  * Constructs a DOM operator for the specified map. This constructor should not
- 17  * be invoked directly; use {@link pv.dom} instead.
- 18  *
- 19  * @class Represets a DOM operator for the specified map. This allows easy
- 20  * transformation of a hierarchical JavaScript object (such as a JSON map) to a
- 21  * W3C Document Object Model hierarchy. For more information on which attributes
- 22  * and methods from the specification are supported, see {@link pv.Dom.Node}.
- 23  *
- 24  * <p>Leaves in the map are determined using an associated <i>leaf</i> function;
- 25  * see {@link #leaf}. By default, leaves are any value whose type is not
- 26  * "object", such as numbers or strings.
- 27  *
- 28  * @param map a map from which to construct a DOM.
- 29  */
- 30 pv.Dom = function(map) {
- 31   this.$map = map;
- 32 };
- 33 
- 34 /** @private The default leaf function. */
- 35 pv.Dom.prototype.$leaf = function(n) {
- 36   return typeof n != "object";
- 37 };
- 38 
- 39 /**
- 40  * Sets or gets the leaf function for this DOM operator. The leaf function
- 41  * identifies which values in the map are leaves, and which are internal nodes.
- 42  * By default, objects are considered internal nodes, and primitives (such as
- 43  * numbers and strings) are considered leaves.
- 44  *
- 45  * @param {function} f the new leaf function.
- 46  * @returns the current leaf function, or <tt>this</tt>.
- 47  */
- 48 pv.Dom.prototype.leaf = function(f) {
- 49   if (arguments.length) {
- 50     this.$leaf = f;
- 51     return this;
- 52   }
- 53   return this.$leaf;
- 54 };
- 55 
- 56 /**
- 57  * Applies the DOM operator, returning the root node.
- 58  *
- 59  * @returns {pv.Dom.Node} the root node.
- 60  * @param {string} [nodeName] optional node name for the root.
- 61  */
- 62 pv.Dom.prototype.root = function(nodeName) {
- 63   var leaf = this.$leaf, root = recurse(this.$map);
- 64 
- 65   /** @private */
- 66   function recurse(map) {
- 67     var n = new pv.Dom.Node();
- 68     for (var k in map) {
- 69       var v = map[k];
- 70       n.appendChild(leaf(v) ? new pv.Dom.Node(v) : recurse(v)).nodeName = k;
- 71     }
- 72     return n;
- 73   }
- 74 
- 75   root.nodeName = nodeName;
- 76   return root;
- 77 };
- 78 
- 79 /**
- 80  * Applies the DOM operator, returning the array of all nodes in preorder
- 81  * traversal.
- 82  *
- 83  * @returns {array} the array of nodes in preorder traversal.
- 84  */
- 85 pv.Dom.prototype.nodes = function() {
- 86   return this.root().nodes();
- 87 };
- 88 
- 89 /**
- 90  * Constructs a DOM node for the specified value. Instances of this class are
- 91  * not typically created directly; instead they are generated from a JavaScript
- 92  * map using the {@link pv.Dom} operator.
- 93  *
- 94  * @class Represents a <tt>Node</tt> in the W3C Document Object Model.
- 95  */
- 96 pv.Dom.Node = function(value) {
- 97   this.nodeValue = value;
- 98   this.childNodes = [];
- 99 };
-100 
-101 /**
-102  * The node name. When generated from a map, the node name corresponds to the
-103  * key at the given level in the map. Note that the root node has no associated
-104  * key, and thus has an undefined node name (and no <tt>parentNode</tt>).
-105  *
-106  * @type string
-107  * @field pv.Dom.Node.prototype.nodeName
-108  */
-109 
-110 /**
-111  * The node value. When generated from a map, node value corresponds to the leaf
-112  * value for leaf nodes, and is undefined for internal nodes.
-113  *
-114  * @field pv.Dom.Node.prototype.nodeValue
-115  */
-116 
-117 /**
-118  * The array of child nodes. This array is empty for leaf nodes. An easy way to
-119  * check if child nodes exist is to query <tt>firstChild</tt>.
-120  *
-121  * @type array
-122  * @field pv.Dom.Node.prototype.childNodes
-123  */
-124 
-125 /**
-126  * The parent node, which is null for root nodes.
-127  *
-128  * @type pv.Dom.Node
-129  */
-130 pv.Dom.Node.prototype.parentNode = null;
-131 
-132 /**
-133  * The first child, which is null for leaf nodes.
-134  *
-135  * @type pv.Dom.Node
-136  */
-137 pv.Dom.Node.prototype.firstChild = null;
-138 
-139 /**
-140  * The last child, which is null for leaf nodes.
-141  *
-142  * @type pv.Dom.Node
-143  */
-144 pv.Dom.Node.prototype.lastChild = null;
-145 
-146 /**
-147  * The previous sibling node, which is null for the first child.
-148  *
-149  * @type pv.Dom.Node
-150  */
-151 pv.Dom.Node.prototype.previousSibling = null;
-152 
-153 /**
-154  * The next sibling node, which is null for the last child.
-155  *
-156  * @type pv.Dom.Node
-157  */
-158 pv.Dom.Node.prototype.nextSibling = null;
-159 
-160 /**
-161  * Removes the specified child node from this node.
-162  *
-163  * @throws Error if the specified child is not a child of this node.
-164  * @returns {pv.Dom.Node} the removed child.
-165  */
-166 pv.Dom.Node.prototype.removeChild = function(n) {
-167   var i = this.childNodes.indexOf(n);
-168   if (i == -1) throw new Error("child not found");
-169   this.childNodes.splice(i, 1);
-170   if (n.previousSibling) n.previousSibling.nextSibling = n.nextSibling;
-171   else this.firstChild = n.nextSibling;
-172   if (n.nextSibling) n.nextSibling.previousSibling = n.previousSibling;
-173   else this.lastChild = n.previousSibling;
-174   delete n.nextSibling;
-175   delete n.previousSibling;
-176   delete n.parentNode;
-177   return n;
-178 };
-179 
-180 /**
-181  * Appends the specified child node to this node. If the specified child is
-182  * already part of the DOM, the child is first removed before being added to
-183  * this node.
-184  *
-185  * @returns {pv.Dom.Node} the appended child.
-186  */
-187 pv.Dom.Node.prototype.appendChild = function(n) {
-188   if (n.parentNode) n.parentNode.removeChild(n);
-189   n.parentNode = this;
-190   n.previousSibling = this.lastChild;
-191   if (this.lastChild) this.lastChild.nextSibling = n;
-192   else this.firstChild = n;
-193   this.lastChild = n;
-194   this.childNodes.push(n);
-195   return n;
-196 };
-197 
-198 /**
-199  * Inserts the specified child <i>n</i> before the given reference child
-200  * <i>r</i> of this node. If <i>r</i> is null, this method is equivalent to
-201  * {@link #appendChild}. If <i>n</i> is already part of the DOM, it is first
-202  * removed before being inserted.
-203  *
-204  * @throws Error if <i>r</i> is non-null and not a child of this node.
-205  * @returns {pv.Dom.Node} the inserted child.
-206  */
-207 pv.Dom.Node.prototype.insertBefore = function(n, r) {
-208   if (!r) return this.appendChild(n);
-209   var i = this.childNodes.indexOf(r);
-210   if (i == -1) throw new Error("child not found");
-211   if (n.parentNode) n.parentNode.removeChild(n);
-212   n.parentNode = this;
-213   n.nextSibling = r;
-214   n.previousSibling = r.previousSibling;
-215   if (r.previousSibling) {
-216     r.previousSibling.nextSibling = n;
-217   } else {
-218     if (r == this.lastChild) this.lastChild = n;
-219     this.firstChild = n;
-220   }
-221   this.childNodes.splice(i, 0, n);
-222   return n;
-223 };
-224 
-225 /**
-226  * Replaces the specified child <i>r</i> of this node with the node <i>n</i>. If
-227  * <i>n</i> is already part of the DOM, it is first removed before being added.
-228  *
-229  * @throws Error if <i>r</i> is not a child of this node.
-230  */
-231 pv.Dom.Node.prototype.replaceChild = function(n, r) {
-232   var i = this.childNodes.indexOf(r);
-233   if (i == -1) throw new Error("child not found");
-234   if (n.parentNode) n.parentNode.removeChild(n);
-235   n.parentNode = this;
-236   n.nextSibling = r.nextSibling;
-237   n.previousSibling = r.previousSibling;
-238   if (r.previousSibling) r.previousSibling.nextSibling = n;
-239   else this.firstChild = n;
-240   if (r.nextSibling) r.nextSibling.previousSibling = n;
-241   else this.lastChild = n;
-242   this.childNodes[i] = n;
-243   return r;
-244 };
-245 
-246 /**
-247  * Visits each node in the tree in preorder traversal, applying the specified
-248  * function <i>f</i>. The arguments to the function are:<ol>
-249  *
-250  * <li>The current node.
-251  * <li>The current depth, starting at 0 for the root node.</ol>
-252  *
-253  * @param {function} f a function to apply to each node.
-254  */
-255 pv.Dom.Node.prototype.visitBefore = function(f) {
-256   function visit(n, i) {
-257     f(n, i);
-258     for (var c = n.firstChild; c; c = c.nextSibling) {
-259       visit(c, i + 1);
-260     }
-261   }
-262   visit(this, 0);
-263 };
-264 
-265 /**
-266  * Visits each node in the tree in postorder traversal, applying the specified
-267  * function <i>f</i>. The arguments to the function are:<ol>
-268  *
-269  * <li>The current node.
-270  * <li>The current depth, starting at 0 for the root node.</ol>
-271  *
-272  * @param {function} f a function to apply to each node.
-273  */
-274 pv.Dom.Node.prototype.visitAfter = function(f) {
-275   function visit(n, i) {
-276     for (var c = n.firstChild; c; c = c.nextSibling) {
-277       visit(c, i + 1);
-278     }
-279     f(n, i);
-280   }
-281   visit(this, 0);
-282 };
-283 
-284 /**
-285  * Sorts child nodes of this node, and all descendent nodes recursively, using
-286  * the specified comparator function <tt>f</tt>. The comparator function is
-287  * passed two nodes to compare.
-288  *
-289  * <p>Note: during the sort operation, the comparator function should not rely
-290  * on the tree being well-formed; the values of <tt>previousSibling</tt> and
-291  * <tt>nextSibling</tt> for the nodes being compared are not defined during the
-292  * sort operation.
-293  *
-294  * @param {function} f a comparator function.
-295  * @returns this.
-296  */
-297 pv.Dom.Node.prototype.sort = function(f) {
-298   if (this.firstChild) {
-299     this.childNodes.sort(f);
-300     var p = this.firstChild = this.childNodes[0], c;
-301     delete p.previousSibling;
-302     for (var i = 1; i < this.childNodes.length; i++) {
-303       p.sort(f);
-304       c = this.childNodes[i];
-305       c.previousSibling = p;
-306       p = p.nextSibling = c;
-307     }
-308     this.lastChild = p;
-309     delete p.nextSibling;
-310     p.sort(f);
-311   }
-312   return this;
-313 };
-314 
-315 /**
-316  * Reverses all sibling nodes.
-317  *
-318  * @returns this.
-319  */
-320 pv.Dom.Node.prototype.reverse = function() {
-321   var childNodes = [];
-322   this.visitAfter(function(n) {
-323       while (n.lastChild) childNodes.push(n.removeChild(n.lastChild));
-324       for (var c; c = childNodes.pop();) n.insertBefore(c, n.firstChild);
-325     });
-326   return this;
-327 };
-328 
-329 /** Returns all descendants of this node in preorder traversal. */
-330 pv.Dom.Node.prototype.nodes = function() {
-331   var array = [];
-332 
-333   /** @private */
-334   function flatten(node) {
-335     array.push(node);
-336     node.childNodes.forEach(flatten);
-337   }
-338 
-339   flatten(this, array);
-340   return array;
-341 };
-342 
-343 /**
-344  * Toggles the child nodes of this node. If this node is not yet toggled, this
-345  * method removes all child nodes and appends them to a new <tt>toggled</tt>
-346  * array attribute on this node. Otherwise, if this node is toggled, this method
-347  * re-adds all toggled child nodes and deletes the <tt>toggled</tt> attribute.
-348  *
-349  * <p>This method has no effect if the node has no child nodes.
-350  *
-351  * @param {boolean} [recursive] whether the toggle should apply to descendants.
-352  */
-353 pv.Dom.Node.prototype.toggle = function(recursive) {
-354   if (recursive) return this.toggled
-355       ? this.visitBefore(function(n) { if (n.toggled) n.toggle(); })
-356       : this.visitAfter(function(n) { if (!n.toggled) n.toggle(); });
-357   var n = this;
-358   if (n.toggled) {
-359     for (var c; c = n.toggled.pop();) n.appendChild(c);
-360     delete n.toggled;
-361   } else if (n.lastChild) {
-362     n.toggled = [];
-363     while (n.lastChild) n.toggled.push(n.removeChild(n.lastChild));
-364   }
-365 };
-366 
-367 /**
-368  * Given a flat array of values, returns a simple DOM with each value wrapped by
-369  * a node that is a child of the root node.
-370  *
-371  * @param {array} values.
-372  * @returns {array} nodes.
-373  */
-374 pv.nodes = function(values) {
-375   var root = new pv.Dom.Node();
-376   for (var i = 0; i < values.length; i++) {
-377     root.appendChild(new pv.Dom.Node(values[i]));
-378   }
-379   return root.nodes();
-380 };
-381 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Flatten.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Flatten.js.html deleted file mode 100644 index 456aa87e..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Flatten.js.html +++ /dev/null @@ -1,154 +0,0 @@ -
  1 /**
-  2  * Returns a {@link pv.Flatten} operator for the specified map. This is a
-  3  * convenience factory method, equivalent to <tt>new pv.Flatten(map)</tt>.
-  4  *
-  5  * @see pv.Flatten
-  6  * @param map a map to flatten.
-  7  * @returns {pv.Flatten} a flatten operator for the specified map.
-  8  */
-  9 pv.flatten = function(map) {
- 10   return new pv.Flatten(map);
- 11 };
- 12 
- 13 /**
- 14  * Constructs a flatten operator for the specified map. This constructor should
- 15  * not be invoked directly; use {@link pv.flatten} instead.
- 16  *
- 17  * @class Represents a flatten operator for the specified array. Flattening
- 18  * allows hierarchical maps to be flattened into an array. The levels in the
- 19  * input tree are specified by <i>key</i> functions.
- 20  *
- 21  * <p>For example, consider the following hierarchical data structure of Barley
- 22  * yields, from various sites in Minnesota during 1931-2:
- 23  *
- 24  * <pre>{ 1931: {
- 25  *     Manchuria: {
- 26  *       "University Farm": 27.00,
- 27  *       "Waseca": 48.87,
- 28  *       "Morris": 27.43,
- 29  *       ... },
- 30  *     Glabron: {
- 31  *       "University Farm": 43.07,
- 32  *       "Waseca": 55.20,
- 33  *       ... } },
- 34  *   1932: {
- 35  *     ... } }</pre>
- 36  *
- 37  * To facilitate visualization, it may be useful to flatten the tree into a
- 38  * tabular array:
- 39  *
- 40  * <pre>var array = pv.flatten(yields)
- 41  *     .key("year")
- 42  *     .key("variety")
- 43  *     .key("site")
- 44  *     .key("yield")
- 45  *     .array();</pre>
- 46  *
- 47  * This returns an array of object elements. Each element in the array has
- 48  * attributes corresponding to this flatten operator's keys:
- 49  *
- 50  * <pre>{ site: "University Farm", variety: "Manchuria", year: 1931, yield: 27 },
- 51  * { site: "Waseca", variety: "Manchuria", year: 1931, yield: 48.87 },
- 52  * { site: "Morris", variety: "Manchuria", year: 1931, yield: 27.43 },
- 53  * { site: "University Farm", variety: "Glabron", year: 1931, yield: 43.07 },
- 54  * { site: "Waseca", variety: "Glabron", year: 1931, yield: 55.2 }, ...</pre>
- 55  *
- 56  * <p>The flatten operator is roughly the inverse of the {@link pv.Nest} and
- 57  * {@link pv.Tree} operators.
- 58  *
- 59  * @param map a map to flatten.
- 60  */
- 61 pv.Flatten = function(map) {
- 62   this.map = map;
- 63   this.keys = [];
- 64 };
- 65 
- 66 /**
- 67  * Flattens using the specified key function. Multiple keys may be added to the
- 68  * flatten; the tiers of the underlying tree must correspond to the specified
- 69  * keys, in order. The order of the returned array is undefined; however, you
- 70  * can easily sort it.
- 71  *
- 72  * @param {string} key the key name.
- 73  * @param {function} [f] an optional value map function.
- 74  * @returns {pv.Nest} this.
- 75  */
- 76 pv.Flatten.prototype.key = function(key, f) {
- 77   this.keys.push({name: key, value: f});
- 78   delete this.$leaf;
- 79   return this;
- 80 };
- 81 
- 82 /**
- 83  * Flattens using the specified leaf function. This is an alternative to
- 84  * specifying an explicit set of keys; the tiers of the underlying tree will be
- 85  * determined dynamically by recursing on the values, and the resulting keys
- 86  * will be stored in the entries <tt>keys</tt> attribute. The leaf function must
- 87  * return true for leaves, and false for internal nodes.
- 88  *
- 89  * @param {function} f a leaf function.
- 90  * @returns {pv.Nest} this.
- 91  */
- 92 pv.Flatten.prototype.leaf = function(f) {
- 93   this.keys.length = 0;
- 94   this.$leaf = f;
- 95   return this;
- 96 };
- 97 
- 98 /**
- 99  * Returns the flattened array. Each entry in the array is an object; each
-100  * object has attributes corresponding to this flatten operator's keys.
-101  *
-102  * @returns an array of elements from the flattened map.
-103  */
-104 pv.Flatten.prototype.array = function() {
-105   var entries = [], stack = [], keys = this.keys, leaf = this.$leaf;
-106 
-107   /* Recursively visit using the leaf function. */
-108   if (leaf) {
-109     function recurse(value, i) {
-110       if (leaf(value)) {
-111         entries.push({keys: stack.slice(), value: value});
-112       } else {
-113         for (var key in value) {
-114           stack.push(key);
-115           recurse(value[key], i + 1);
-116           stack.pop();
-117         }
-118       }
-119     }
-120     recurse(this.map, 0);
-121     return entries;
-122   }
-123 
-124   /* Recursively visits the specified value. */
-125   function visit(value, i) {
-126     if (i < keys.length - 1) {
-127       for (var key in value) {
-128         stack.push(key);
-129         visit(value[key], i + 1);
-130         stack.pop();
-131       }
-132     } else {
-133       entries.push(stack.concat(value));
-134     }
-135   }
-136 
-137   visit(this.map, 0);
-138   return entries.map(function(stack) {
-139       var m = {};
-140       for (var i = 0; i < keys.length; i++) {
-141         var k = keys[i], v = stack[i];
-142         m[k.name] = k.value ? k.value.call(null, v) : v;
-143       }
-144       return m;
-145     });
-146 };
-147 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Histogram.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Histogram.js.html deleted file mode 100644 index f69f9059..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Histogram.js.html +++ /dev/null @@ -1,128 +0,0 @@ -
  1 /**
-  2  * Returns a histogram operator for the specified data, with an optional
-  3  * accessor function. If the data specified is not an array of numbers, an
-  4  * accessor function must be specified to map the data to numeric values.
-  5  *
-  6  * @class Represents a histogram operator.
-  7  *
-  8  * @param {array} data an array of numbers or objects.
-  9  * @param {function} [f] an optional accessor function.
- 10  */
- 11 pv.histogram = function(data, f) {
- 12   var frequency = true;
- 13   return {
- 14 
- 15     /**
- 16      * Returns the computed histogram bins. An optional array of numbers,
- 17      * <tt>ticks</tt>, may be specified as the break points. If the ticks are
- 18      * not specified, default ticks will be computed using a linear scale on the
- 19      * data domain.
- 20      *
- 21      * <p>The returned array contains {@link pv.histogram.Bin}s. The <tt>x</tt>
- 22      * attribute corresponds to the bin's start value (inclusive), while the
- 23      * <tt>dx</tt> attribute stores the bin size (end - start). The <tt>y</tt>
- 24      * attribute stores either the frequency count or probability, depending on
- 25      * how the histogram operator has been configured.
- 26      *
- 27      * <p>The {@link pv.histogram.Bin} objects are themselves arrays, containing
- 28      * the data elements present in each bin, i.e., the elements in the
- 29      * <tt>data</tt> array (prior to invoking the accessor function, if any).
- 30      * For example, if the data represented countries, and the accessor function
- 31      * returned the GDP of each country, the returned bins would be arrays of
- 32      * countries (not GDPs).
- 33      *
- 34      * @function
- 35      * @name pv.histogram.prototype.bins
- 36      * @param {array} [ticks]
- 37      * @returns {array}
- 38      */ /** @private */
- 39     bins: function(ticks) {
- 40       var x = pv.map(data, f), bins = [];
- 41 
- 42       /* Initialize default ticks. */
- 43       if (!arguments.length) ticks = pv.Scale.linear(x).ticks();
- 44 
- 45       /* Initialize the bins. */
- 46       for (var i = 0; i < ticks.length - 1; i++) {
- 47         var bin = bins[i] = [];
- 48         bin.x = ticks[i];
- 49         bin.dx = ticks[i + 1] - ticks[i];
- 50         bin.y = 0;
- 51       }
- 52 
- 53       /* Count the number of samples per bin. */
- 54       for (var i = 0; i < x.length; i++) {
- 55         var j = pv.search.index(ticks, x[i]) - 1,
- 56             bin = bins[Math.max(0, Math.min(bins.length - 1, j))];
- 57         bin.y++;
- 58         bin.push(data[i]);
- 59       }
- 60 
- 61       /* Convert frequencies to probabilities. */
- 62       if (!frequency) for (var i = 0; i < bins.length; i++) {
- 63         bins[i].y /= x.length;
- 64       }
- 65 
- 66       return bins;
- 67     },
- 68 
- 69     /**
- 70      * Sets or gets whether this histogram operator returns frequencies or
- 71      * probabilities.
- 72      *
- 73      * @function
- 74      * @name pv.histogram.prototype.frequency
- 75      * @param {boolean} [x]
- 76      * @returns {pv.histogram} this.
- 77      */ /** @private */
- 78     frequency: function(x) {
- 79       if (arguments.length) {
- 80         frequency = Boolean(x);
- 81         return this;
- 82       }
- 83       return frequency;
- 84     }
- 85   };
- 86 };
- 87 
- 88 /**
- 89  * @class Represents a bin returned by the {@link pv.histogram} operator. Bins
- 90  * are themselves arrays containing the data elements present in the given bin
- 91  * (prior to the accessor function being invoked to convert the data object to a
- 92  * numeric value). These bin arrays have additional attributes with meta
- 93  * information about the bin.
- 94  *
- 95  * @name pv.histogram.Bin
- 96  * @extends array
- 97  * @see pv.histogram
- 98  */
- 99 
-100 /**
-101  * The start value of the bin's range.
-102  *
-103  * @type number
-104  * @name pv.histogram.Bin.prototype.x
-105  */
-106 
-107 /**
-108  * The magnitude value of the bin's range; end - start.
-109  *
-110  * @type number
-111  * @name pv.histogram.Bin.prototype.dx
-112  */
-113 
-114 /**
-115  * The frequency or probability of the bin, depending on how the histogram
-116  * operator was configured.
-117  *
-118  * @type number
-119  * @name pv.histogram.Bin.prototype.y
-120  */
-121 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_LinearScale.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_LinearScale.js.html deleted file mode 100644 index 5965f1b1..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_LinearScale.js.html +++ /dev/null @@ -1,62 +0,0 @@ -
  1 /**
-  2  * Returns a linear scale for the specified domain. The arguments to this
-  3  * constructor are optional, and equivalent to calling {@link #domain}.
-  4  * The default domain and range are [0,1].
-  5  *
-  6  * @class Represents a linear scale; a function that performs a linear
-  7  * transformation. <style type="text/css">sub{line-height:0}</style> Most
-  8  * commonly, a linear scale represents a 1-dimensional linear transformation
-  9  * from a numeric domain of input data [<i>d<sub>0</sub></i>,
- 10  * <i>d<sub>1</sub></i>] to a numeric range of pixels [<i>r<sub>0</sub></i>,
- 11  * <i>r<sub>1</sub></i>]. The equation for such a scale is:
- 12  *
- 13  * <blockquote><i>f(x) = (x - d<sub>0</sub>) / (d<sub>1</sub> - d<sub>0</sub>) *
- 14  * (r<sub>1</sub> - r<sub>0</sub>) + r<sub>0</sub></i></blockquote>
- 15  *
- 16  * For example, a linear scale from the domain [0, 100] to range [0, 640]:
- 17  *
- 18  * <blockquote><i>f(x) = (x - 0) / (100 - 0) * (640 - 0) + 0</i><br>
- 19  * <i>f(x) = x / 100 * 640</i><br>
- 20  * <i>f(x) = x * 6.4</i><br>
- 21  * </blockquote>
- 22  *
- 23  * Thus, saying
- 24  *
- 25  * <pre>    .height(function(d) d * 6.4)</pre>
- 26  *
- 27  * is identical to
- 28  *
- 29  * <pre>    .height(pv.Scale.linear(0, 100).range(0, 640))</pre>
- 30  *
- 31  * Note that the scale is itself a function, and thus can be used as a property
- 32  * directly, assuming that the data associated with a mark is a number. While
- 33  * this is convenient for single-use scales, frequently it is desirable to
- 34  * define scales globally:
- 35  *
- 36  * <pre>var y = pv.Scale.linear(0, 100).range(0, 640);</pre>
- 37  *
- 38  * The <tt>y</tt> scale can now be equivalently referenced within a property:
- 39  *
- 40  * <pre>    .height(function(d) y(d))</pre>
- 41  *
- 42  * Alternatively, if the data are not simple numbers, the appropriate value can
- 43  * be passed to the <tt>y</tt> scale (e.g., <tt>d.foo</tt>). The {@link #by}
- 44  * method similarly allows the data to be mapped to a numeric value before
- 45  * performing the linear transformation.
- 46  *
- 47  * @param {number...} domain... optional domain values.
- 48  * @extends pv.Scale.quantitative
- 49  */
- 50 pv.Scale.linear = function() {
- 51   var scale = pv.Scale.quantitative();
- 52   scale.domain.apply(scale, arguments);
- 53   return scale;
- 54 };
- 55 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_LogScale.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_LogScale.js.html deleted file mode 100644 index 27f62ca5..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_LogScale.js.html +++ /dev/null @@ -1,150 +0,0 @@ -
  1 /**
-  2  * Returns a log scale for the specified domain. The arguments to this
-  3  * constructor are optional, and equivalent to calling {@link #domain}.
-  4  * The default domain is [1,10] and the default range is [0,1].
-  5  *
-  6  * @class Represents a log scale. <style
-  7  * type="text/css">sub{line-height:0}</style> Most commonly, a log scale
-  8  * represents a 1-dimensional log transformation from a numeric domain of input
-  9  * data [<i>d<sub>0</sub></i>, <i>d<sub>1</sub></i>] to a numeric range of
- 10  * pixels [<i>r<sub>0</sub></i>, <i>r<sub>1</sub></i>]. The equation for such a
- 11  * scale is:
- 12  *
- 13  * <blockquote><i>f(x) = (log(x) - log(d<sub>0</sub>)) / (log(d<sub>1</sub>) -
- 14  * log(d<sub>0</sub>)) * (r<sub>1</sub> - r<sub>0</sub>) +
- 15  * r<sub>0</sub></i></blockquote>
- 16  *
- 17  * where <i>log(x)</i> represents the zero-symmetric logarthim of <i>x</i> using
- 18  * the scale's associated base (default: 10, see {@link pv.logSymmetric}). For
- 19  * example, a log scale from the domain [1, 100] to range [0, 640]:
- 20  *
- 21  * <blockquote><i>f(x) = (log(x) - log(1)) / (log(100) - log(1)) * (640 - 0) + 0</i><br>
- 22  * <i>f(x) = log(x) / 2 * 640</i><br>
- 23  * <i>f(x) = log(x) * 320</i><br>
- 24  * </blockquote>
- 25  *
- 26  * Thus, saying
- 27  *
- 28  * <pre>    .height(function(d) Math.log(d) * 138.974)</pre>
- 29  *
- 30  * is equivalent to
- 31  *
- 32  * <pre>    .height(pv.Scale.log(1, 100).range(0, 640))</pre>
- 33  *
- 34  * Note that the scale is itself a function, and thus can be used as a property
- 35  * directly, assuming that the data associated with a mark is a number. While
- 36  * this is convenient for single-use scales, frequently it is desirable to
- 37  * define scales globally:
- 38  *
- 39  * <pre>var y = pv.Scale.log(1, 100).range(0, 640);</pre>
- 40  *
- 41  * The <tt>y</tt> scale can now be equivalently referenced within a property:
- 42  *
- 43  * <pre>    .height(function(d) y(d))</pre>
- 44  *
- 45  * Alternatively, if the data are not simple numbers, the appropriate value can
- 46  * be passed to the <tt>y</tt> scale (e.g., <tt>d.foo</tt>). The {@link #by}
- 47  * method similarly allows the data to be mapped to a numeric value before
- 48  * performing the log transformation.
- 49  *
- 50  * @param {number...} domain... optional domain values.
- 51  * @extends pv.Scale.quantitative
- 52  */
- 53 pv.Scale.log = function() {
- 54   var scale = pv.Scale.quantitative(1, 10),
- 55       b, // logarithm base
- 56       p, // cached Math.log(b)
- 57       /** @ignore */ log = function(x) { return Math.log(x) / p; },
- 58       /** @ignore */ pow = function(y) { return Math.pow(b, y); };
- 59 
- 60   /**
- 61    * Returns an array of evenly-spaced, suitably-rounded values in the input
- 62    * domain. These values are frequently used in conjunction with
- 63    * {@link pv.Rule} to display tick marks or grid lines.
- 64    *
- 65    * @function
- 66    * @name pv.Scale.log.prototype.ticks
- 67    * @returns {number[]} an array input domain values to use as ticks.
- 68    */
- 69   scale.ticks = function() {
- 70     // TODO support non-uniform domains
- 71     var d = scale.domain(),
- 72         n = d[0] < 0,
- 73         i = Math.floor(n ? -log(-d[0]) : log(d[0])),
- 74         j = Math.ceil(n ? -log(-d[1]) : log(d[1])),
- 75         ticks = [];
- 76     if (n) {
- 77       ticks.push(-pow(-i));
- 78       for (; i++ < j;) for (var k = b - 1; k > 0; k--) ticks.push(-pow(-i) * k);
- 79     } else {
- 80       for (; i < j; i++) for (var k = 1; k < b; k++) ticks.push(pow(i) * k);
- 81       ticks.push(pow(i));
- 82     }
- 83     for (i = 0; ticks[i] < d[0]; i++); // strip small values
- 84     for (j = ticks.length; ticks[j - 1] > d[1]; j--); // strip big values
- 85     return ticks.slice(i, j);
- 86   };
- 87 
- 88   /**
- 89    * Formats the specified tick value using the appropriate precision, assuming
- 90    * base 10.
- 91    *
- 92    * @function
- 93    * @name pv.Scale.log.prototype.tickFormat
- 94    * @param {number} t a tick value.
- 95    * @returns {string} a formatted tick value.
- 96    */
- 97   scale.tickFormat = function(t) {
- 98     return t.toPrecision(1);
- 99   };
-100 
-101   /**
-102    * "Nices" this scale, extending the bounds of the input domain to
-103    * evenly-rounded values. This method uses {@link pv.logFloor} and
-104    * {@link pv.logCeil}. Nicing is useful if the domain is computed dynamically
-105    * from data, and may be irregular. For example, given a domain of
-106    * [0.20147987687960267, 0.996679553296417], a call to <tt>nice()</tt> might
-107    * extend the domain to [0.1, 1].
-108    *
-109    * <p>This method must be invoked each time after setting the domain (and
-110    * base).
-111    *
-112    * @function
-113    * @name pv.Scale.log.prototype.nice
-114    * @returns {pv.Scale.log} <tt>this</tt>.
-115    */
-116   scale.nice = function() {
-117     // TODO support non-uniform domains
-118     var d = scale.domain();
-119     return scale.domain(pv.logFloor(d[0], b), pv.logCeil(d[1], b));
-120   };
-121 
-122   /**
-123    * Sets or gets the logarithm base. Defaults to 10.
-124    *
-125    * @function
-126    * @name pv.Scale.log.prototype.base
-127    * @param {number} [v] the new base.
-128    * @returns {pv.Scale.log} <tt>this</tt>, or the current base.
-129    */
-130   scale.base = function(v) {
-131     if (arguments.length) {
-132       b = Number(v);
-133       p = Math.log(b);
-134       scale.transform(log, pow); // update transformed domain
-135       return this;
-136     }
-137     return b;
-138   };
-139 
-140   scale.domain.apply(scale, arguments);
-141   return scale.base(10);
-142 };
-143 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Nest.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Nest.js.html deleted file mode 100644 index 0b73d012..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Nest.js.html +++ /dev/null @@ -1,265 +0,0 @@ -
  1 /**
-  2  * Returns a {@link pv.Nest} operator for the specified array. This is a
-  3  * convenience factory method, equivalent to <tt>new pv.Nest(array)</tt>.
-  4  *
-  5  * @see pv.Nest
-  6  * @param {array} array an array of elements to nest.
-  7  * @returns {pv.Nest} a nest operator for the specified array.
-  8  */
-  9 pv.nest = function(array) {
- 10   return new pv.Nest(array);
- 11 };
- 12 
- 13 /**
- 14  * Constructs a nest operator for the specified array. This constructor should
- 15  * not be invoked directly; use {@link pv.nest} instead.
- 16  *
- 17  * @class Represents a {@link Nest} operator for the specified array. Nesting
- 18  * allows elements in an array to be grouped into a hierarchical tree
- 19  * structure. The levels in the tree are specified by <i>key</i> functions. The
- 20  * leaf nodes of the tree can be sorted by value, while the internal nodes can
- 21  * be sorted by key. Finally, the tree can be returned either has a
- 22  * multidimensional array via {@link #entries}, or as a hierarchical map via
- 23  * {@link #map}. The {@link #rollup} routine similarly returns a map, collapsing
- 24  * the elements in each leaf node using a summary function.
- 25  *
- 26  * <p>For example, consider the following tabular data structure of Barley
- 27  * yields, from various sites in Minnesota during 1931-2:
- 28  *
- 29  * <pre>{ yield: 27.00, variety: "Manchuria", year: 1931, site: "University Farm" },
- 30  * { yield: 48.87, variety: "Manchuria", year: 1931, site: "Waseca" },
- 31  * { yield: 27.43, variety: "Manchuria", year: 1931, site: "Morris" }, ...</pre>
- 32  *
- 33  * To facilitate visualization, it may be useful to nest the elements first by
- 34  * year, and then by variety, as follows:
- 35  *
- 36  * <pre>var nest = pv.nest(yields)
- 37  *     .key(function(d) d.year)
- 38  *     .key(function(d) d.variety)
- 39  *     .entries();</pre>
- 40  *
- 41  * This returns a nested array. Each element of the outer array is a key-values
- 42  * pair, listing the values for each distinct key:
- 43  *
- 44  * <pre>{ key: 1931, values: [
- 45  *   { key: "Manchuria", values: [
- 46  *       { yield: 27.00, variety: "Manchuria", year: 1931, site: "University Farm" },
- 47  *       { yield: 48.87, variety: "Manchuria", year: 1931, site: "Waseca" },
- 48  *       { yield: 27.43, variety: "Manchuria", year: 1931, site: "Morris" },
- 49  *       ...
- 50  *     ] },
- 51  *   { key: "Glabron", values: [
- 52  *       { yield: 43.07, variety: "Glabron", year: 1931, site: "University Farm" },
- 53  *       { yield: 55.20, variety: "Glabron", year: 1931, site: "Waseca" },
- 54  *       ...
- 55  *     ] },
- 56  *   ] },
- 57  * { key: 1932, values: ... }</pre>
- 58  *
- 59  * Further details, including sorting and rollup, is provided below on the
- 60  * corresponding methods.
- 61  *
- 62  * @param {array} array an array of elements to nest.
- 63  */
- 64 pv.Nest = function(array) {
- 65   this.array = array;
- 66   this.keys = [];
- 67 };
- 68 
- 69 /**
- 70  * Nests using the specified key function. Multiple keys may be added to the
- 71  * nest; the array elements will be nested in the order keys are specified.
- 72  *
- 73  * @param {function} key a key function; must return a string or suitable map
- 74  * key.
- 75  * @returns {pv.Nest} this.
- 76  */
- 77 pv.Nest.prototype.key = function(key) {
- 78   this.keys.push(key);
- 79   return this;
- 80 };
- 81 
- 82 /**
- 83  * Sorts the previously-added keys. The natural sort order is used by default
- 84  * (see {@link pv.naturalOrder}); if an alternative order is desired,
- 85  * <tt>order</tt> should be a comparator function. If this method is not called
- 86  * (i.e., keys are <i>unsorted</i>), keys will appear in the order they appear
- 87  * in the underlying elements array. For example,
- 88  *
- 89  * <pre>pv.nest(yields)
- 90  *     .key(function(d) d.year)
- 91  *     .key(function(d) d.variety)
- 92  *     .sortKeys()
- 93  *     .entries()</pre>
- 94  *
- 95  * groups yield data by year, then variety, and sorts the variety groups
- 96  * lexicographically (since the variety attribute is a string).
- 97  *
- 98  * <p>Key sort order is only used in conjunction with {@link #entries}, which
- 99  * returns an array of key-values pairs. If the nest is used to construct a
-100  * {@link #map} instead, keys are unsorted.
-101  *
-102  * @param {function} [order] an optional comparator function.
-103  * @returns {pv.Nest} this.
-104  */
-105 pv.Nest.prototype.sortKeys = function(order) {
-106   this.keys[this.keys.length - 1].order = order || pv.naturalOrder;
-107   return this;
-108 };
-109 
-110 /**
-111  * Sorts the leaf values. The natural sort order is used by default (see
-112  * {@link pv.naturalOrder}); if an alternative order is desired, <tt>order</tt>
-113  * should be a comparator function. If this method is not called (i.e., values
-114  * are <i>unsorted</i>), values will appear in the order they appear in the
-115  * underlying elements array. For example,
-116  *
-117  * <pre>pv.nest(yields)
-118  *     .key(function(d) d.year)
-119  *     .key(function(d) d.variety)
-120  *     .sortValues(function(a, b) a.yield - b.yield)
-121  *     .entries()</pre>
-122  *
-123  * groups yield data by year, then variety, and sorts the values for each
-124  * variety group by yield.
-125  *
-126  * <p>Value sort order, unlike keys, applies to both {@link #entries} and
-127  * {@link #map}. It has no effect on {@link #rollup}.
-128  *
-129  * @param {function} [order] an optional comparator function.
-130  * @returns {pv.Nest} this.
-131  */
-132 pv.Nest.prototype.sortValues = function(order) {
-133   this.order = order || pv.naturalOrder;
-134   return this;
-135 };
-136 
-137 /**
-138  * Returns a hierarchical map of values. Each key adds one level to the
-139  * hierarchy. With only a single key, the returned map will have a key for each
-140  * distinct value of the key function; the correspond value with be an array of
-141  * elements with that key value. If a second key is added, this will be a nested
-142  * map. For example:
-143  *
-144  * <pre>pv.nest(yields)
-145  *     .key(function(d) d.variety)
-146  *     .key(function(d) d.site)
-147  *     .map()</pre>
-148  *
-149  * returns a map <tt>m</tt> such that <tt>m[variety][site]</tt> is an array, a subset of
-150  * <tt>yields</tt>, with each element having the given variety and site.
-151  *
-152  * @returns a hierarchical map of values.
-153  */
-154 pv.Nest.prototype.map = function() {
-155   var map = {}, values = [];
-156 
-157   /* Build the map. */
-158   for (var i, j = 0; j < this.array.length; j++) {
-159     var x = this.array[j];
-160     var m = map;
-161     for (i = 0; i < this.keys.length - 1; i++) {
-162       var k = this.keys[i](x);
-163       if (!m[k]) m[k] = {};
-164       m = m[k];
-165     }
-166     k = this.keys[i](x);
-167     if (!m[k]) {
-168       var a = [];
-169       values.push(a);
-170       m[k] = a;
-171     }
-172     m[k].push(x);
-173   }
-174 
-175   /* Sort each leaf array. */
-176   if (this.order) {
-177     for (var i = 0; i < values.length; i++) {
-178       values[i].sort(this.order);
-179     }
-180   }
-181 
-182   return map;
-183 };
-184 
-185 /**
-186  * Returns a hierarchical nested array. This method is similar to
-187  * {@link pv.entries}, but works recursively on the entire hierarchy. Rather
-188  * than returning a map like {@link #map}, this method returns a nested
-189  * array. Each element of the array has a <tt>key</tt> and <tt>values</tt>
-190  * field. For leaf nodes, the <tt>values</tt> array will be a subset of the
-191  * underlying elements array; for non-leaf nodes, the <tt>values</tt> array will
-192  * contain more key-values pairs.
-193  *
-194  * <p>For an example usage, see the {@link Nest} constructor.
-195  *
-196  * @returns a hierarchical nested array.
-197  */
-198 pv.Nest.prototype.entries = function() {
-199 
-200   /** Recursively extracts the entries for the given map. */
-201   function entries(map) {
-202     var array = [];
-203     for (var k in map) {
-204       var v = map[k];
-205       array.push({ key: k, values: (v instanceof Array) ? v : entries(v) });
-206     };
-207     return array;
-208   }
-209 
-210   /** Recursively sorts the values for the given key-values array. */
-211   function sort(array, i) {
-212     var o = this.keys[i].order;
-213     if (o) array.sort(function(a, b) { return o(a.key, b.key); });
-214     if (++i < this.keys.length) {
-215       for (var j = 0; j < array.length; j++) {
-216         sort.call(this, array[j].values, i);
-217       }
-218     }
-219     return array;
-220   }
-221 
-222   return sort.call(this, entries(this.map()), 0);
-223 };
-224 
-225 /**
-226  * Returns a rollup map. The behavior of this method is the same as
-227  * {@link #map}, except that the leaf values are replaced with the return value
-228  * of the specified rollup function <tt>f</tt>. For example,
-229  *
-230  * <pre>pv.nest(yields)
-231  *      .key(function(d) d.site)
-232  *      .rollup(function(v) pv.median(v, function(d) d.yield))</pre>
-233  *
-234  * first groups yield data by site, and then returns a map from site to median
-235  * yield for the given site.
-236  *
-237  * @see #map
-238  * @param {function} f a rollup function.
-239  * @returns a hierarchical map, with the leaf values computed by <tt>f</tt>.
-240  */
-241 pv.Nest.prototype.rollup = function(f) {
-242 
-243   /** Recursively descends to the leaf nodes (arrays) and does rollup. */
-244   function rollup(map) {
-245     for (var key in map) {
-246       var value = map[key];
-247       if (value instanceof Array) {
-248         map[key] = f(value);
-249       } else {
-250         rollup(value);
-251       }
-252     }
-253     return map;
-254   }
-255 
-256   return rollup(this.map());
-257 };
-258 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Numbers.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Numbers.js.html deleted file mode 100644 index 8fd8fe17..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Numbers.js.html +++ /dev/null @@ -1,320 +0,0 @@ -
  1 /**
-  2  * Returns an array of numbers, starting at <tt>start</tt>, incrementing by
-  3  * <tt>step</tt>, until <tt>stop</tt> is reached. The stop value is
-  4  * exclusive. If only a single argument is specified, this value is interpeted
-  5  * as the <i>stop</i> value, with the <i>start</i> value as zero. If only two
-  6  * arguments are specified, the step value is implied to be one.
-  7  *
-  8  * <p>The method is modeled after the built-in <tt>range</tt> method from
-  9  * Python. See the Python documentation for more details.
- 10  *
- 11  * @see <a href="http://docs.python.org/library/functions.html#range">Python range</a>
- 12  * @param {number} [start] the start value.
- 13  * @param {number} stop the stop value.
- 14  * @param {number} [step] the step value.
- 15  * @returns {number[]} an array of numbers.
- 16  */
- 17 pv.range = function(start, stop, step) {
- 18   if (arguments.length == 1) {
- 19     stop = start;
- 20     start = 0;
- 21   }
- 22   if (step == undefined) step = 1;
- 23   if ((stop - start) / step == Infinity) throw new Error("range must be finite");
- 24   var array = [], i = 0, j;
- 25   if (step < 0) {
- 26     while ((j = start + step * i++) > stop) {
- 27       array.push(j);
- 28     }
- 29   } else {
- 30     while ((j = start + step * i++) < stop) {
- 31       array.push(j);
- 32     }
- 33   }
- 34   return array;
- 35 };
- 36 
- 37 /**
- 38  * Returns a random number in the range [<tt>start</tt>, <tt>stop</tt>) that is
- 39  * a multiple of <tt>step</tt>. More specifically, the returned number is of the
- 40  * form <tt>start</tt> + <i>n</i> * <tt>step</tt>, where <i>n</i> is a
- 41  * nonnegative integer. If <tt>step</tt> is not specified, it defaults to 1,
- 42  * returning a random integer if <tt>start</tt> is also an integer.
- 43  *
- 44  * @param {number} [start] the start value value.
- 45  * @param {number} stop the stop value.
- 46  * @param {number} [step] the step value.
- 47  * @returns {number} a random number between <i>start</i> and <i>stop</i>.
- 48  */
- 49 pv.random = function(start, stop, step) {
- 50   if (arguments.length == 1) {
- 51     stop = start;
- 52     start = 0;
- 53   }
- 54   if (step == undefined) step = 1;
- 55   return step
- 56       ? (Math.floor(Math.random() * (stop - start) / step) * step + start)
- 57       : (Math.random() * (stop - start) + start);
- 58 };
- 59 
- 60 /**
- 61  * Returns the sum of the specified array. If the specified array is not an
- 62  * array of numbers, an optional accessor function <tt>f</tt> can be specified
- 63  * to map the elements to numbers. See {@link #normalize} for an example.
- 64  * Accessor functions can refer to <tt>this.index</tt>.
- 65  *
- 66  * @param {array} array an array of objects, or numbers.
- 67  * @param {function} [f] an optional accessor function.
- 68  * @returns {number} the sum of the specified array.
- 69  */
- 70 pv.sum = function(array, f) {
- 71   var o = {};
- 72   return array.reduce(f
- 73       ? function(p, d, i) { o.index = i; return p + f.call(o, d); }
- 74       : function(p, d) { return p + d; }, 0);
- 75 };
- 76 
- 77 /**
- 78  * Returns the maximum value of the specified array. If the specified array is
- 79  * not an array of numbers, an optional accessor function <tt>f</tt> can be
- 80  * specified to map the elements to numbers. See {@link #normalize} for an
- 81  * example. Accessor functions can refer to <tt>this.index</tt>.
- 82  *
- 83  * @param {array} array an array of objects, or numbers.
- 84  * @param {function} [f] an optional accessor function.
- 85  * @returns {number} the maximum value of the specified array.
- 86  */
- 87 pv.max = function(array, f) {
- 88   if (f == pv.index) return array.length - 1;
- 89   return Math.max.apply(null, f ? pv.map(array, f) : array);
- 90 };
- 91 
- 92 /**
- 93  * Returns the index of the maximum value of the specified array. If the
- 94  * specified array is not an array of numbers, an optional accessor function
- 95  * <tt>f</tt> can be specified to map the elements to numbers. See
- 96  * {@link #normalize} for an example. Accessor functions can refer to
- 97  * <tt>this.index</tt>.
- 98  *
- 99  * @param {array} array an array of objects, or numbers.
-100  * @param {function} [f] an optional accessor function.
-101  * @returns {number} the index of the maximum value of the specified array.
-102  */
-103 pv.max.index = function(array, f) {
-104   if (!array.length) return -1;
-105   if (f == pv.index) return array.length - 1;
-106   if (!f) f = pv.identity;
-107   var maxi = 0, maxx = -Infinity, o = {};
-108   for (var i = 0; i < array.length; i++) {
-109     o.index = i;
-110     var x = f.call(o, array[i]);
-111     if (x > maxx) {
-112       maxx = x;
-113       maxi = i;
-114     }
-115   }
-116   return maxi;
-117 }
-118 
-119 /**
-120  * Returns the minimum value of the specified array of numbers. If the specified
-121  * array is not an array of numbers, an optional accessor function <tt>f</tt>
-122  * can be specified to map the elements to numbers. See {@link #normalize} for
-123  * an example. Accessor functions can refer to <tt>this.index</tt>.
-124  *
-125  * @param {array} array an array of objects, or numbers.
-126  * @param {function} [f] an optional accessor function.
-127  * @returns {number} the minimum value of the specified array.
-128  */
-129 pv.min = function(array, f) {
-130   if (f == pv.index) return 0;
-131   return Math.min.apply(null, f ? pv.map(array, f) : array);
-132 };
-133 
-134 /**
-135  * Returns the index of the minimum value of the specified array. If the
-136  * specified array is not an array of numbers, an optional accessor function
-137  * <tt>f</tt> can be specified to map the elements to numbers. See
-138  * {@link #normalize} for an example. Accessor functions can refer to
-139  * <tt>this.index</tt>.
-140  *
-141  * @param {array} array an array of objects, or numbers.
-142  * @param {function} [f] an optional accessor function.
-143  * @returns {number} the index of the minimum value of the specified array.
-144  */
-145 pv.min.index = function(array, f) {
-146   if (!array.length) return -1;
-147   if (f == pv.index) return 0;
-148   if (!f) f = pv.identity;
-149   var mini = 0, minx = Infinity, o = {};
-150   for (var i = 0; i < array.length; i++) {
-151     o.index = i;
-152     var x = f.call(o, array[i]);
-153     if (x < minx) {
-154       minx = x;
-155       mini = i;
-156     }
-157   }
-158   return mini;
-159 }
-160 
-161 /**
-162  * Returns the arithmetic mean, or average, of the specified array. If the
-163  * specified array is not an array of numbers, an optional accessor function
-164  * <tt>f</tt> can be specified to map the elements to numbers. See
-165  * {@link #normalize} for an example. Accessor functions can refer to
-166  * <tt>this.index</tt>.
-167  *
-168  * @param {array} array an array of objects, or numbers.
-169  * @param {function} [f] an optional accessor function.
-170  * @returns {number} the mean of the specified array.
-171  */
-172 pv.mean = function(array, f) {
-173   return pv.sum(array, f) / array.length;
-174 };
-175 
-176 /**
-177  * Returns the median of the specified array. If the specified array is not an
-178  * array of numbers, an optional accessor function <tt>f</tt> can be specified
-179  * to map the elements to numbers. See {@link #normalize} for an example.
-180  * Accessor functions can refer to <tt>this.index</tt>.
-181  *
-182  * @param {array} array an array of objects, or numbers.
-183  * @param {function} [f] an optional accessor function.
-184  * @returns {number} the median of the specified array.
-185  */
-186 pv.median = function(array, f) {
-187   if (f == pv.index) return (array.length - 1) / 2;
-188   array = pv.map(array, f).sort(pv.naturalOrder);
-189   if (array.length % 2) return array[Math.floor(array.length / 2)];
-190   var i = array.length / 2;
-191   return (array[i - 1] + array[i]) / 2;
-192 };
-193 
-194 /**
-195  * Returns the unweighted variance of the specified array. If the specified
-196  * array is not an array of numbers, an optional accessor function <tt>f</tt>
-197  * can be specified to map the elements to numbers. See {@link #normalize} for
-198  * an example. Accessor functions can refer to <tt>this.index</tt>.
-199  *
-200  * @param {array} array an array of objects, or numbers.
-201  * @param {function} [f] an optional accessor function.
-202  * @returns {number} the variance of the specified array.
-203  */
-204 pv.variance = function(array, f) {
-205   if (array.length < 1) return NaN;
-206   if (array.length == 1) return 0;
-207   var mean = pv.mean(array, f), sum = 0, o = {};
-208   if (!f) f = pv.identity;
-209   for (var i = 0; i < array.length; i++) {
-210     o.index = i;
-211     var d = f.call(o, array[i]) - mean;
-212     sum += d * d;
-213   }
-214   return sum;
-215 };
-216 
-217 /**
-218  * Returns an unbiased estimation of the standard deviation of a population,
-219  * given the specified random sample. If the specified array is not an array of
-220  * numbers, an optional accessor function <tt>f</tt> can be specified to map the
-221  * elements to numbers. See {@link #normalize} for an example. Accessor
-222  * functions can refer to <tt>this.index</tt>.
-223  *
-224  * @param {array} array an array of objects, or numbers.
-225  * @param {function} [f] an optional accessor function.
-226  * @returns {number} the standard deviation of the specified array.
-227  */
-228 pv.deviation = function(array, f) {
-229   return Math.sqrt(pv.variance(array, f) / (array.length - 1));
-230 };
-231 
-232 /**
-233  * Returns the logarithm with a given base value.
-234  *
-235  * @param {number} x the number for which to compute the logarithm.
-236  * @param {number} b the base of the logarithm.
-237  * @returns {number} the logarithm value.
-238  */
-239 pv.log = function(x, b) {
-240   return Math.log(x) / Math.log(b);
-241 };
-242 
-243 /**
-244  * Computes a zero-symmetric logarithm. Computes the logarithm of the absolute
-245  * value of the input, and determines the sign of the output according to the
-246  * sign of the input value.
-247  *
-248  * @param {number} x the number for which to compute the logarithm.
-249  * @param {number} b the base of the logarithm.
-250  * @returns {number} the symmetric log value.
-251  */
-252 pv.logSymmetric = function(x, b) {
-253   return (x == 0) ? 0 : ((x < 0) ? -pv.log(-x, b) : pv.log(x, b));
-254 };
-255 
-256 /**
-257  * Computes a zero-symmetric logarithm, with adjustment to values between zero
-258  * and the logarithm base. This adjustment introduces distortion for values less
-259  * than the base number, but enables simultaneous plotting of log-transformed
-260  * data involving both positive and negative numbers.
-261  *
-262  * @param {number} x the number for which to compute the logarithm.
-263  * @param {number} b the base of the logarithm.
-264  * @returns {number} the adjusted, symmetric log value.
-265  */
-266 pv.logAdjusted = function(x, b) {
-267   if (!isFinite(x)) return x;
-268   var negative = x < 0;
-269   if (x < b) x += (b - x) / b;
-270   return negative ? -pv.log(x, b) : pv.log(x, b);
-271 };
-272 
-273 /**
-274  * Rounds an input value down according to its logarithm. The method takes the
-275  * floor of the logarithm of the value and then uses the resulting value as an
-276  * exponent for the base value.
-277  *
-278  * @param {number} x the number for which to compute the logarithm floor.
-279  * @param {number} b the base of the logarithm.
-280  * @returns {number} the rounded-by-logarithm value.
-281  */
-282 pv.logFloor = function(x, b) {
-283   return (x > 0)
-284       ? Math.pow(b, Math.floor(pv.log(x, b)))
-285       : -Math.pow(b, -Math.floor(-pv.log(-x, b)));
-286 };
-287 
-288 /**
-289  * Rounds an input value up according to its logarithm. The method takes the
-290  * ceiling of the logarithm of the value and then uses the resulting value as an
-291  * exponent for the base value.
-292  *
-293  * @param {number} x the number for which to compute the logarithm ceiling.
-294  * @param {number} b the base of the logarithm.
-295  * @returns {number} the rounded-by-logarithm value.
-296  */
-297 pv.logCeil = function(x, b) {
-298   return (x > 0)
-299       ? Math.pow(b, Math.ceil(pv.log(x, b)))
-300       : -Math.pow(b, -Math.ceil(-pv.log(-x, b)));
-301 };
-302 
-303 (function() {
-304   var radians = Math.PI / 180,
-305       degrees = 180 / Math.PI;
-306 
-307   /** Returns the number of radians corresponding to the specified degrees. */
-308   pv.radians = function(degrees) { return radians * degrees; };
-309 
-310   /** Returns the number of degrees corresponding to the specified radians. */
-311   pv.degrees = function(radians) { return degrees * radians; };
-312 })();
-313 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Objects.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Objects.js.html deleted file mode 100644 index ce5b404f..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Objects.js.html +++ /dev/null @@ -1,86 +0,0 @@ -
  1 /**
-  2  * Returns all of the property names (keys) of the specified object (a map). The
-  3  * order of the returned array is not defined.
-  4  *
-  5  * @param map an object.
-  6  * @returns {string[]} an array of strings corresponding to the keys.
-  7  * @see #entries
-  8  */
-  9 pv.keys = function(map) {
- 10   var array = [];
- 11   for (var key in map) {
- 12     array.push(key);
- 13   }
- 14   return array;
- 15 };
- 16 
- 17 /**
- 18  * Returns all of the entries (key-value pairs) of the specified object (a
- 19  * map). The order of the returned array is not defined. Each key-value pair is
- 20  * represented as an object with <tt>key</tt> and <tt>value</tt> attributes,
- 21  * e.g., <tt>{key: "foo", value: 42}</tt>.
- 22  *
- 23  * @param map an object.
- 24  * @returns {array} an array of key-value pairs corresponding to the keys.
- 25  */
- 26 pv.entries = function(map) {
- 27   var array = [];
- 28   for (var key in map) {
- 29     array.push({ key: key, value: map[key] });
- 30   }
- 31   return array;
- 32 };
- 33 
- 34 /**
- 35  * Returns all of the values (attribute values) of the specified object (a
- 36  * map). The order of the returned array is not defined.
- 37  *
- 38  * @param map an object.
- 39  * @returns {array} an array of objects corresponding to the values.
- 40  * @see #entries
- 41  */
- 42 pv.values = function(map) {
- 43   var array = [];
- 44   for (var key in map) {
- 45     array.push(map[key]);
- 46   }
- 47   return array;
- 48 };
- 49 
- 50 /**
- 51  * Returns a map constructed from the specified <tt>keys</tt>, using the
- 52  * function <tt>f</tt> to compute the value for each key. The single argument to
- 53  * the value function is the key. The callback is invoked only for indexes of
- 54  * the array which have assigned values; it is not invoked for indexes which
- 55  * have been deleted or which have never been assigned values.
- 56  *
- 57  * <p>For example, this expression creates a map from strings to string length:
- 58  *
- 59  * <pre>pv.dict(["one", "three", "seventeen"], function(s) s.length)</pre>
- 60  *
- 61  * The returned value is <tt>{one: 3, three: 5, seventeen: 9}</tt>. Accessor
- 62  * functions can refer to <tt>this.index</tt>.
- 63  *
- 64  * @param {array} keys an array.
- 65  * @param {function} f a value function.
- 66  * @returns a map from keys to values.
- 67  */
- 68 pv.dict = function(keys, f) {
- 69   var m = {}, o = {};
- 70   for (var i = 0; i < keys.length; i++) {
- 71     if (i in keys) {
- 72       var k = keys[i];
- 73       o.index = i;
- 74       m[k] = f.call(o, k);
- 75     }
- 76   }
- 77   return m;
- 78 };
- 79 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_OrdinalScale.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_OrdinalScale.js.html deleted file mode 100644 index 1be3a61a..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_OrdinalScale.js.html +++ /dev/null @@ -1,275 +0,0 @@ -
  1 /**
-  2  * Returns an ordinal scale for the specified domain. The arguments to this
-  3  * constructor are optional, and equivalent to calling {@link #domain}.
-  4  *
-  5  * @class Represents an ordinal scale. <style
-  6  * type="text/css">sub{line-height:0}</style> An ordinal scale represents a
-  7  * pairwise mapping from <i>n</i> discrete values in the input domain to
-  8  * <i>n</i> discrete values in the output range. For example, an ordinal scale
-  9  * might map a domain of species ["setosa", "versicolor", "virginica"] to colors
- 10  * ["red", "green", "blue"]. Thus, saying
- 11  *
- 12  * <pre>    .fillStyle(function(d) {
- 13  *         switch (d.species) {
- 14  *           case "setosa": return "red";
- 15  *           case "versicolor": return "green";
- 16  *           case "virginica": return "blue";
- 17  *         }
- 18  *       })</pre>
- 19  *
- 20  * is equivalent to
- 21  *
- 22  * <pre>    .fillStyle(pv.Scale.ordinal("setosa", "versicolor", "virginica")
- 23  *         .range("red", "green", "blue")
- 24  *         .by(function(d) d.species))</pre>
- 25  *
- 26  * If the mapping from species to color does not need to be specified
- 27  * explicitly, the domain can be omitted. In this case it will be inferred
- 28  * lazily from the data:
- 29  *
- 30  * <pre>    .fillStyle(pv.colors("red", "green", "blue")
- 31  *         .by(function(d) d.species))</pre>
- 32  *
- 33  * When the domain is inferred, the first time the scale is invoked, the first
- 34  * element from the range will be returned. Subsequent calls with unique values
- 35  * will return subsequent elements from the range. If the inferred domain grows
- 36  * larger than the range, range values will be reused. However, it is strongly
- 37  * recommended that the domain and the range contain the same number of
- 38  * elements.
- 39  *
- 40  * <p>A range can be discretized from a continuous interval (e.g., for pixel
- 41  * positioning) by using {@link #split}, {@link #splitFlush} or
- 42  * {@link #splitBanded} after the domain has been set. For example, if
- 43  * <tt>states</tt> is an array of the fifty U.S. state names, the state name can
- 44  * be encoded in the left position:
- 45  *
- 46  * <pre>    .left(pv.Scale.ordinal(states)
- 47  *         .split(0, 640)
- 48  *         .by(function(d) d.state))</pre>
- 49  *
- 50  * <p>N.B.: ordinal scales are not invertible (at least not yet), since the
- 51  * domain and range and discontinuous. A workaround is to use a linear scale.
- 52  *
- 53  * @param {...} domain... optional domain values.
- 54  * @extends pv.Scale
- 55  * @see pv.colors
- 56  */
- 57 pv.Scale.ordinal = function() {
- 58   var d = [], i = {}, r = [], band = 0;
- 59 
- 60   /** @private */
- 61   function scale(x) {
- 62     if (!(x in i)) i[x] = d.push(x) - 1;
- 63     return r[i[x] % r.length];
- 64   }
- 65 
- 66   /**
- 67    * Sets or gets the input domain. This method can be invoked several ways:
- 68    *
- 69    * <p>1. <tt>domain(values...)</tt>
- 70    *
- 71    * <p>Specifying the domain as a series of values is the most explicit and
- 72    * recommended approach. However, if the domain values are derived from data,
- 73    * you may find the second method more appropriate.
- 74    *
- 75    * <p>2. <tt>domain(array, f)</tt>
- 76    *
- 77    * <p>Rather than enumerating the domain values as explicit arguments to this
- 78    * method, you can specify a single argument of an array. In addition, you can
- 79    * specify an optional accessor function to extract the domain values from the
- 80    * array.
- 81    *
- 82    * <p>3. <tt>domain()</tt>
- 83    *
- 84    * <p>Invoking the <tt>domain</tt> method with no arguments returns the
- 85    * current domain as an array.
- 86    *
- 87    * @function
- 88    * @name pv.Scale.ordinal.prototype.domain
- 89    * @param {...} domain... domain values.
- 90    * @returns {pv.Scale.ordinal} <tt>this</tt>, or the current domain.
- 91    */
- 92   scale.domain = function(array, f) {
- 93     if (arguments.length) {
- 94       array = (array instanceof Array)
- 95           ? ((arguments.length > 1) ? pv.map(array, f) : array)
- 96           : Array.prototype.slice.call(arguments);
- 97 
- 98       /* Filter the specified ordinals to their unique values. */
- 99       d = [];
-100       var seen = {};
-101       for (var j = 0; j < array.length; j++) {
-102         var o = array[j];
-103         if (!(o in seen)) {
-104           seen[o] = true;
-105           d.push(o);
-106         }
-107       }
-108 
-109       i = pv.numerate(d);
-110       return this;
-111     }
-112     return d;
-113   };
-114 
-115   /**
-116    * Sets or gets the output range. This method can be invoked several ways:
-117    *
-118    * <p>1. <tt>range(values...)</tt>
-119    *
-120    * <p>Specifying the range as a series of values is the most explicit and
-121    * recommended approach. However, if the range values are derived from data,
-122    * you may find the second method more appropriate.
-123    *
-124    * <p>2. <tt>range(array, f)</tt>
-125    *
-126    * <p>Rather than enumerating the range values as explicit arguments to this
-127    * method, you can specify a single argument of an array. In addition, you can
-128    * specify an optional accessor function to extract the range values from the
-129    * array.
-130    *
-131    * <p>3. <tt>range()</tt>
-132    *
-133    * <p>Invoking the <tt>range</tt> method with no arguments returns the
-134    * current range as an array.
-135    *
-136    * @function
-137    * @name pv.Scale.ordinal.prototype.range
-138    * @param {...} range... range values.
-139    * @returns {pv.Scale.ordinal} <tt>this</tt>, or the current range.
-140    */
-141   scale.range = function(array, f) {
-142     if (arguments.length) {
-143       r = (array instanceof Array)
-144           ? ((arguments.length > 1) ? pv.map(array, f) : array)
-145           : Array.prototype.slice.call(arguments);
-146       if (typeof r[0] == "string") r = r.map(pv.color);
-147       return this;
-148     }
-149     return r;
-150   };
-151 
-152   /**
-153    * Sets the range from the given continuous interval. The interval
-154    * [<i>min</i>, <i>max</i>] is subdivided into <i>n</i> equispaced points,
-155    * where <i>n</i> is the number of (unique) values in the domain. The first
-156    * and last point are offset from the edge of the range by half the distance
-157    * between points.
-158    *
-159    * <p>This method must be called <i>after</i> the domain is set.
-160    *
-161    * @function
-162    * @name pv.Scale.ordinal.prototype.split
-163    * @param {number} min minimum value of the output range.
-164    * @param {number} max maximum value of the output range.
-165    * @returns {pv.Scale.ordinal} <tt>this</tt>.
-166    * @see #splitFlush
-167    * @see #splitBanded
-168    */
-169   scale.split = function(min, max) {
-170     var step = (max - min) / this.domain().length;
-171     r = pv.range(min + step / 2, max, step);
-172     return this;
-173   };
-174 
-175   /**
-176    * Sets the range from the given continuous interval. The interval
-177    * [<i>min</i>, <i>max</i>] is subdivided into <i>n</i> equispaced points,
-178    * where <i>n</i> is the number of (unique) values in the domain. The first
-179    * and last point are exactly on the edge of the range.
-180    *
-181    * <p>This method must be called <i>after</i> the domain is set.
-182    *
-183    * @function
-184    * @name pv.Scale.ordinal.prototype.splitFlush
-185    * @param {number} min minimum value of the output range.
-186    * @param {number} max maximum value of the output range.
-187    * @returns {pv.Scale.ordinal} <tt>this</tt>.
-188    * @see #split
-189    */
-190   scale.splitFlush = function(min, max) {
-191     var n = this.domain().length, step = (max - min) / (n - 1);
-192     r = (n == 1) ? [(min + max) / 2]
-193         : pv.range(min, max + step / 2, step);
-194     return this;
-195   };
-196 
-197   /**
-198    * Sets the range from the given continuous interval. The interval
-199    * [<i>min</i>, <i>max</i>] is subdivided into <i>n</i> equispaced bands,
-200    * where <i>n</i> is the number of (unique) values in the domain. The first
-201    * and last band are offset from the edge of the range by the distance between
-202    * bands.
-203    *
-204    * <p>The band width argument, <tt>band</tt>, is typically in the range [0, 1]
-205    * and defaults to 1. This fraction corresponds to the amount of space in the
-206    * range to allocate to the bands, as opposed to padding. A value of 0.5 means
-207    * that the band width will be equal to the padding width. The computed
-208    * absolute band width can be retrieved from the range as
-209    * <tt>scale.range().band</tt>.
-210    *
-211    * <p>If the band width argument is negative, this method will allocate bands
-212    * of a <i>fixed</i> width <tt>-band</tt>, rather than a relative fraction of
-213    * the available space.
-214    *
-215    * <p>Tip: to inset the bands by a fixed amount <tt>p</tt>, specify a minimum
-216    * value of <tt>min + p</tt> (or simply <tt>p</tt>, if <tt>min</tt> is
-217    * 0). Then set the mark width to <tt>scale.range().band - p</tt>.
-218    *
-219    * <p>This method must be called <i>after</i> the domain is set.
-220    *
-221    * @function
-222    * @name pv.Scale.ordinal.prototype.splitBanded
-223    * @param {number} min minimum value of the output range.
-224    * @param {number} max maximum value of the output range.
-225    * @param {number} [band] the fractional band width in [0, 1]; defaults to 1.
-226    * @returns {pv.Scale.ordinal} <tt>this</tt>.
-227    * @see #split
-228    */
-229   scale.splitBanded = function(min, max, band) {
-230     if (arguments.length < 3) band = 1;
-231     if (band < 0) {
-232       var n = this.domain().length,
-233           total = -band * n,
-234           remaining = max - min - total,
-235           padding = remaining / (n + 1);
-236       r = pv.range(min + padding, max, padding - band);
-237       r.band = -band;
-238     } else {
-239       var step = (max - min) / (this.domain().length + (1 - band));
-240       r = pv.range(min + step * (1 - band), max, step);
-241       r.band = step * band;
-242     }
-243     return this;
-244   };
-245 
-246   /**
-247    * Returns a view of this scale by the specified accessor function <tt>f</tt>.
-248    * Given a scale <tt>y</tt>, <tt>y.by(function(d) d.foo)</tt> is equivalent to
-249    * <tt>function(d) y(d.foo)</tt>. This method should be used judiciously; it
-250    * is typically more clear to invoke the scale directly, passing in the value
-251    * to be scaled.
-252    *
-253    * @function
-254    * @name pv.Scale.ordinal.prototype.by
-255    * @param {function} f an accessor function.
-256    * @returns {pv.Scale.ordinal} a view of this scale by the specified accessor
-257    * function.
-258    */
-259   scale.by = function(f) {
-260     function by() { return scale(f.apply(this, arguments)); }
-261     for (var method in scale) by[method] = scale[method];
-262     return by;
-263   };
-264 
-265   scale.domain.apply(scale, arguments);
-266   return scale;
-267 };
-268 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_QuantileScale.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_QuantileScale.js.html deleted file mode 100644 index 49655118..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_QuantileScale.js.html +++ /dev/null @@ -1,188 +0,0 @@ -
  1 /**
-  2  * Constructs a default quantile scale. The arguments to this constructor are
-  3  * optional, and equivalent to calling {@link #domain}. The default domain is
-  4  * the empty set, and the default range is [0,1].
-  5  *
-  6  * @class Represents a quantile scale; a function that maps from a value within
-  7  * a sortable domain to a quantized numeric range. Typically, the domain is a
-  8  * set of numbers, but any sortable value (such as strings) can be used as the
-  9  * domain of a quantile scale. The range defaults to [0,1], with 0 corresponding
- 10  * to the smallest value in the domain, 1 the largest, .5 the median, etc.
- 11  *
- 12  * <p>By default, the number of quantiles in the range corresponds to the number
- 13  * of values in the domain. The {@link #quantiles} method can be used to specify
- 14  * an explicit number of quantiles; for example, <tt>quantiles(4)</tt> produces
- 15  * a standard quartile scale. A quartile scale's range is a set of four discrete
- 16  * values, such as [0, 1/3, 2/3, 1]. Calling the {@link #range} method will
- 17  * scale these discrete values accordingly, similar to {@link
- 18  * pv.Scale.ordinal#splitFlush}.
- 19  *
- 20  * <p>For example, given the strings ["c", "a", "b"], a default quantile scale:
- 21  *
- 22  * <pre>pv.Scale.quantile("c", "a", "b")</pre>
- 23  *
- 24  * will return 0 for "a", .5 for "b", and 1 for "c".
- 25  *
- 26  * @extends pv.Scale
- 27  */
- 28 pv.Scale.quantile = function() {
- 29   var n = -1, // number of quantiles
- 30       j = -1, // max quantile index
- 31       q = [], // quantile boundaries
- 32       d = [], // domain
- 33       y = pv.Scale.linear(); // range
- 34 
- 35   /** @private */
- 36   function scale(x) {
- 37     return y(Math.max(0, Math.min(j, pv.search.index(q, x) - 1)) / j);
- 38   }
- 39 
- 40   /**
- 41    * Sets or gets the quantile boundaries. By default, each element in the
- 42    * domain is in its own quantile. If the argument to this method is a number,
- 43    * it specifies the number of equal-sized quantiles by which to divide the
- 44    * domain.
- 45    *
- 46    * <p>If no arguments are specified, this method returns the quantile
- 47    * boundaries; the first element is always the minimum value of the domain,
- 48    * and the last element is the maximum value of the domain. Thus, the length
- 49    * of the returned array is always one greater than the number of quantiles.
- 50    *
- 51    * @function
- 52    * @name pv.Scale.quantile.prototype.quantiles
- 53    * @param {number} x the number of quantiles.
- 54    */
- 55   scale.quantiles = function(x) {
- 56     if (arguments.length) {
- 57       n = Number(x);
- 58       if (n < 0) {
- 59         q = [d[0]].concat(d);
- 60         j = d.length - 1;
- 61       } else {
- 62         q = [];
- 63         q[0] = d[0];
- 64         for (var i = 1; i <= n; i++) {
- 65           q[i] = d[~~(i * (d.length - 1) / n)];
- 66         }
- 67         j = n - 1;
- 68       }
- 69       return this;
- 70     }
- 71     return q;
- 72   };
- 73 
- 74   /**
- 75    * Sets or gets the input domain. This method can be invoked several ways:
- 76    *
- 77    * <p>1. <tt>domain(values...)</tt>
- 78    *
- 79    * <p>Specifying the domain as a series of values is the most explicit and
- 80    * recommended approach. However, if the domain values are derived from data,
- 81    * you may find the second method more appropriate.
- 82    *
- 83    * <p>2. <tt>domain(array, f)</tt>
- 84    *
- 85    * <p>Rather than enumerating the domain values as explicit arguments to this
- 86    * method, you can specify a single argument of an array. In addition, you can
- 87    * specify an optional accessor function to extract the domain values from the
- 88    * array.
- 89    *
- 90    * <p>3. <tt>domain()</tt>
- 91    *
- 92    * <p>Invoking the <tt>domain</tt> method with no arguments returns the
- 93    * current domain as an array.
- 94    *
- 95    * @function
- 96    * @name pv.Scale.quantile.prototype.domain
- 97    * @param {...} domain... domain values.
- 98    * @returns {pv.Scale.quantile} <tt>this</tt>, or the current domain.
- 99    */
-100   scale.domain = function(array, f) {
-101     if (arguments.length) {
-102       d = (array instanceof Array)
-103           ? pv.map(array, f)
-104           : Array.prototype.slice.call(arguments);
-105       d.sort(pv.naturalOrder);
-106       scale.quantiles(n); // recompute quantiles
-107       return this;
-108     }
-109     return d;
-110   };
-111 
-112   /**
-113    * Sets or gets the output range. This method can be invoked several ways:
-114    *
-115    * <p>1. <tt>range(min, ..., max)</tt>
-116    *
-117    * <p>The range may be specified as a series of numbers or colors. Most
-118    * commonly, two numbers are specified: the minimum and maximum pixel values.
-119    * For a color scale, values may be specified as {@link pv.Color}s or
-120    * equivalent strings. For a diverging scale, or other subdivided non-uniform
-121    * scales, multiple values can be specified. For example:
-122    *
-123    * <pre>    .range("red", "white", "green")</pre>
-124    *
-125    * <p>Currently, only numbers and colors are supported as range values. The
-126    * number of range values must exactly match the number of domain values, or
-127    * the behavior of the scale is undefined.
-128    *
-129    * <p>2. <tt>range()</tt>
-130    *
-131    * <p>Invoking the <tt>range</tt> method with no arguments returns the current
-132    * range as an array of numbers or colors.
-133    *
-134    * @function
-135    * @name pv.Scale.quantile.prototype.range
-136    * @param {...} range... range values.
-137    * @returns {pv.Scale.quantile} <tt>this</tt>, or the current range.
-138    */
-139   scale.range = function() {
-140     if (arguments.length) {
-141       y.range.apply(y, arguments);
-142       return this;
-143     }
-144     return y.range();
-145   };
-146 
-147   /**
-148    * Returns a view of this scale by the specified accessor function <tt>f</tt>.
-149    * Given a scale <tt>y</tt>, <tt>y.by(function(d) d.foo)</tt> is equivalent to
-150    * <tt>function(d) y(d.foo)</tt>.
-151    *
-152    * <p>This method is provided for convenience, such that scales can be
-153    * succinctly defined inline. For example, given an array of data elements
-154    * that have a <tt>score</tt> attribute with the domain [0, 1], the height
-155    * property could be specified as:
-156    *
-157    * <pre>.height(pv.Scale.linear().range(0, 480).by(function(d) d.score))</pre>
-158    *
-159    * This is equivalent to:
-160    *
-161    * <pre>.height(function(d) d.score * 480)</pre>
-162    *
-163    * This method should be used judiciously; it is typically more clear to
-164    * invoke the scale directly, passing in the value to be scaled.
-165    *
-166    * @function
-167    * @name pv.Scale.quantile.prototype.by
-168    * @param {function} f an accessor function.
-169    * @returns {pv.Scale.quantile} a view of this scale by the specified
-170    * accessor function.
-171    */
-172   scale.by = function(f) {
-173     function by() { return scale(f.apply(this, arguments)); }
-174     for (var method in scale) by[method] = scale[method];
-175     return by;
-176   };
-177 
-178   scale.domain.apply(scale, arguments);
-179   return scale;
-180 };
-181 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_QuantitativeScale.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_QuantitativeScale.js.html deleted file mode 100644 index c74cba33..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_QuantitativeScale.js.html +++ /dev/null @@ -1,448 +0,0 @@ -
  1 /**
-  2  * Returns a default quantitative, linear, scale for the specified domain. The
-  3  * arguments to this constructor are optional, and equivalent to calling
-  4  * {@link #domain}. The default domain and range are [0,1].
-  5  *
-  6  * <p>This constructor is typically not used directly; see one of the
-  7  * quantitative scale implementations instead.
-  8  *
-  9  * @class Represents an abstract quantitative scale; a function that performs a
- 10  * numeric transformation. This class is typically not used directly; see one of
- 11  * the quantitative scale implementations (linear, log, root, etc.)
- 12  * instead. <style type="text/css">sub{line-height:0}</style> A quantitative
- 13  * scale represents a 1-dimensional transformation from a numeric domain of
- 14  * input data [<i>d<sub>0</sub></i>, <i>d<sub>1</sub></i>] to a numeric range of
- 15  * pixels [<i>r<sub>0</sub></i>, <i>r<sub>1</sub></i>]. In addition to
- 16  * readability, scales offer several useful features:
- 17  *
- 18  * <p>1. The range can be expressed in colors, rather than pixels. For example:
- 19  *
- 20  * <pre>    .fillStyle(pv.Scale.linear(0, 100).range("red", "green"))</pre>
- 21  *
- 22  * will fill the marks "red" on an input value of 0, "green" on an input value
- 23  * of 100, and some color in-between for intermediate values.
- 24  *
- 25  * <p>2. The domain and range can be subdivided for a non-uniform
- 26  * transformation. For example, you may want a diverging color scale that is
- 27  * increasingly red for negative values, and increasingly green for positive
- 28  * values:
- 29  *
- 30  * <pre>    .fillStyle(pv.Scale.linear(-1, 0, 1).range("red", "white", "green"))</pre>
- 31  *
- 32  * The domain can be specified as a series of <i>n</i> monotonically-increasing
- 33  * values; the range must also be specified as <i>n</i> values, resulting in
- 34  * <i>n - 1</i> contiguous linear scales.
- 35  *
- 36  * <p>3. Quantitative scales can be inverted for interaction. The
- 37  * {@link #invert} method takes a value in the output range, and returns the
- 38  * corresponding value in the input domain. This is frequently used to convert
- 39  * the mouse location (see {@link pv.Mark#mouse}) to a value in the input
- 40  * domain. Note that inversion is only supported for numeric ranges, and not
- 41  * colors.
- 42  *
- 43  * <p>4. A scale can be queried for reasonable "tick" values. The {@link #ticks}
- 44  * method provides a convenient way to get a series of evenly-spaced rounded
- 45  * values in the input domain. Frequently these are used in conjunction with
- 46  * {@link pv.Rule} to display tick marks or grid lines.
- 47  *
- 48  * <p>5. A scale can be "niced" to extend the domain to suitable rounded
- 49  * numbers. If the minimum and maximum of the domain are messy because they are
- 50  * derived from data, you can use {@link #nice} to round these values down and
- 51  * up to even numbers.
- 52  *
- 53  * @param {number...} domain... optional domain values.
- 54  * @see pv.Scale.linear
- 55  * @see pv.Scale.log
- 56  * @see pv.Scale.root
- 57  * @extends pv.Scale
- 58  */
- 59 pv.Scale.quantitative = function() {
- 60   var d = [0, 1], // default domain
- 61       l = [0, 1], // default transformed domain
- 62       r = [0, 1], // default range
- 63       i = [pv.identity], // default interpolators
- 64       type = Number, // default type
- 65       n = false, // whether the domain is negative
- 66       f = pv.identity, // default forward transform
- 67       g = pv.identity, // default inverse transform
- 68       tickFormat = String; // default tick formatting function
- 69 
- 70   /** @private */
- 71   function newDate(x) {
- 72     return new Date(x);
- 73   }
- 74 
- 75   /** @private */
- 76   function scale(x) {
- 77     var j = pv.search(d, x);
- 78     if (j < 0) j = -j - 2;
- 79     j = Math.max(0, Math.min(i.length - 1, j));
- 80     return i[j]((f(x) - l[j]) / (l[j + 1] - l[j]));
- 81   }
- 82 
- 83   /** @private */
- 84   scale.transform = function(forward, inverse) {
- 85     /** @ignore */ f = function(x) { return n ? -forward(-x) : forward(x); };
- 86     /** @ignore */ g = function(y) { return n ? -inverse(-y) : inverse(y); };
- 87     l = d.map(f);
- 88     return this;
- 89   };
- 90 
- 91   /**
- 92    * Sets or gets the input domain. This method can be invoked several ways:
- 93    *
- 94    * <p>1. <tt>domain(min, ..., max)</tt>
- 95    *
- 96    * <p>Specifying the domain as a series of numbers is the most explicit and
- 97    * recommended approach. Most commonly, two numbers are specified: the minimum
- 98    * and maximum value. However, for a diverging scale, or other subdivided
- 99    * non-uniform scales, multiple values can be specified. Values can be derived
-100    * from data using {@link pv.min} and {@link pv.max}. For example:
-101    *
-102    * <pre>    .domain(0, pv.max(array))</pre>
-103    *
-104    * An alternative method for deriving minimum and maximum values from data
-105    * follows.
-106    *
-107    * <p>2. <tt>domain(array, minf, maxf)</tt>
-108    *
-109    * <p>When both the minimum and maximum value are derived from data, the
-110    * arguments to the <tt>domain</tt> method can be specified as the array of
-111    * data, followed by zero, one or two accessor functions. For example, if the
-112    * array of data is just an array of numbers:
-113    *
-114    * <pre>    .domain(array)</pre>
-115    *
-116    * On the other hand, if the array elements are objects representing stock
-117    * values per day, and the domain should consider the stock's daily low and
-118    * daily high:
-119    *
-120    * <pre>    .domain(array, function(d) d.low, function(d) d.high)</pre>
-121    *
-122    * The first method of setting the domain is preferred because it is more
-123    * explicit; setting the domain using this second method should be used only
-124    * if brevity is required.
-125    *
-126    * <p>3. <tt>domain()</tt>
-127    *
-128    * <p>Invoking the <tt>domain</tt> method with no arguments returns the
-129    * current domain as an array of numbers.
-130    *
-131    * @function
-132    * @name pv.Scale.quantitative.prototype.domain
-133    * @param {number...} domain... domain values.
-134    * @returns {pv.Scale.quantitative} <tt>this</tt>, or the current domain.
-135    */
-136   scale.domain = function(array, min, max) {
-137     if (arguments.length) {
-138       var o; // the object we use to infer the domain type
-139       if (array instanceof Array) {
-140         if (arguments.length < 2) min = pv.identity;
-141         if (arguments.length < 3) max = min;
-142         o = array.length && min(array[0]);
-143         d = array.length ? [pv.min(array, min), pv.max(array, max)] : [];
-144       } else {
-145         o = array;
-146         d = Array.prototype.slice.call(arguments).map(Number);
-147       }
-148       if (!d.length) d = [-Infinity, Infinity];
-149       else if (d.length == 1) d = [d[0], d[0]];
-150       n = (d[0] || d[d.length - 1]) < 0;
-151       l = d.map(f);
-152       type = (o instanceof Date) ? newDate : Number;
-153       return this;
-154     }
-155     return d.map(type);
-156   };
-157 
-158   /**
-159    * Sets or gets the output range. This method can be invoked several ways:
-160    *
-161    * <p>1. <tt>range(min, ..., max)</tt>
-162    *
-163    * <p>The range may be specified as a series of numbers or colors. Most
-164    * commonly, two numbers are specified: the minimum and maximum pixel values.
-165    * For a color scale, values may be specified as {@link pv.Color}s or
-166    * equivalent strings. For a diverging scale, or other subdivided non-uniform
-167    * scales, multiple values can be specified. For example:
-168    *
-169    * <pre>    .range("red", "white", "green")</pre>
-170    *
-171    * <p>Currently, only numbers and colors are supported as range values. The
-172    * number of range values must exactly match the number of domain values, or
-173    * the behavior of the scale is undefined.
-174    *
-175    * <p>2. <tt>range()</tt>
-176    *
-177    * <p>Invoking the <tt>range</tt> method with no arguments returns the current
-178    * range as an array of numbers or colors.
-179    *
-180    * @function
-181    * @name pv.Scale.quantitative.prototype.range
-182    * @param {...} range... range values.
-183    * @returns {pv.Scale.quantitative} <tt>this</tt>, or the current range.
-184    */
-185   scale.range = function() {
-186     if (arguments.length) {
-187       r = Array.prototype.slice.call(arguments);
-188       if (!r.length) r = [-Infinity, Infinity];
-189       else if (r.length == 1) r = [r[0], r[0]];
-190       i = [];
-191       for (var j = 0; j < r.length - 1; j++) {
-192         i.push(pv.Scale.interpolator(r[j], r[j + 1]));
-193       }
-194       return this;
-195     }
-196     return r;
-197   };
-198 
-199   /**
-200    * Inverts the specified value in the output range, returning the
-201    * corresponding value in the input domain. This is frequently used to convert
-202    * the mouse location (see {@link pv.Mark#mouse}) to a value in the input
-203    * domain. Inversion is only supported for numeric ranges, and not colors.
-204    *
-205    * <p>Note that this method does not do any rounding or bounds checking. If
-206    * the input domain is discrete (e.g., an array index), the returned value
-207    * should be rounded. If the specified <tt>y</tt> value is outside the range,
-208    * the returned value may be equivalently outside the input domain.
-209    *
-210    * @function
-211    * @name pv.Scale.quantitative.prototype.invert
-212    * @param {number} y a value in the output range (a pixel location).
-213    * @returns {number} a value in the input domain.
-214    */
-215   scale.invert = function(y) {
-216     var j = pv.search(r, y);
-217     if (j < 0) j = -j - 2;
-218     j = Math.max(0, Math.min(i.length - 1, j));
-219     return type(g(l[j] + (y - r[j]) / (r[j + 1] - r[j]) * (l[j + 1] - l[j])));
-220   };
-221 
-222   /**
-223    * Returns an array of evenly-spaced, suitably-rounded values in the input
-224    * domain. This method attempts to return between 5 and 10 tick values. These
-225    * values are frequently used in conjunction with {@link pv.Rule} to display
-226    * tick marks or grid lines.
-227    *
-228    * @function
-229    * @name pv.Scale.quantitative.prototype.ticks
-230    * @param {number} [m] optional number of desired ticks.
-231    * @returns {number[]} an array input domain values to use as ticks.
-232    */
-233   scale.ticks = function(m) {
-234     var start = d[0],
-235         end = d[d.length - 1],
-236         reverse = end < start,
-237         min = reverse ? end : start,
-238         max = reverse ? start : end,
-239         span = max - min;
-240 
-241     /* Special case: empty, invalid or infinite span. */
-242     if (!span || !isFinite(span)) {
-243       if (type == newDate) tickFormat = pv.Format.date("%x");
-244       return [type(min)];
-245     }
-246 
-247     /* Special case: dates. */
-248     if (type == newDate) {
-249       /* Floor the date d given the precision p. */
-250       function floor(d, p) {
-251         switch (p) {
-252           case 31536e6: d.setMonth(0);
-253           case 2592e6: d.setDate(1);
-254           case 6048e5: if (p == 6048e5) d.setDate(d.getDate() - d.getDay());
-255           case 864e5: d.setHours(0);
-256           case 36e5: d.setMinutes(0);
-257           case 6e4: d.setSeconds(0);
-258           case 1e3: d.setMilliseconds(0);
-259         }
-260       }
-261 
-262       var precision, format, increment, step = 1;
-263       if (span >= 3 * 31536e6) {
-264         precision = 31536e6;
-265         format = "%Y";
-266         /** @ignore */ increment = function(d) { d.setFullYear(d.getFullYear() + step); };
-267       } else if (span >= 3 * 2592e6) {
-268         precision = 2592e6;
-269         format = "%m/%Y";
-270         /** @ignore */ increment = function(d) { d.setMonth(d.getMonth() + step); };
-271       } else if (span >= 3 * 6048e5) {
-272         precision = 6048e5;
-273         format = "%m/%d";
-274         /** @ignore */ increment = function(d) { d.setDate(d.getDate() + 7 * step); };
-275       } else if (span >= 3 * 864e5) {
-276         precision = 864e5;
-277         format = "%m/%d";
-278         /** @ignore */ increment = function(d) { d.setDate(d.getDate() + step); };
-279       } else if (span >= 3 * 36e5) {
-280         precision = 36e5;
-281         format = "%I:%M %p";
-282         /** @ignore */ increment = function(d) { d.setHours(d.getHours() + step); };
-283       } else if (span >= 3 * 6e4) {
-284         precision = 6e4;
-285         format = "%I:%M %p";
-286         /** @ignore */ increment = function(d) { d.setMinutes(d.getMinutes() + step); };
-287       } else if (span >= 3 * 1e3) {
-288         precision = 1e3;
-289         format = "%I:%M:%S";
-290         /** @ignore */ increment = function(d) { d.setSeconds(d.getSeconds() + step); };
-291       } else {
-292         precision = 1;
-293         format = "%S.%Qs";
-294         /** @ignore */ increment = function(d) { d.setTime(d.getTime() + step); };
-295       }
-296       tickFormat = pv.Format.date(format);
-297 
-298       var date = new Date(min), dates = [];
-299       floor(date, precision);
-300 
-301       /* If we'd generate too many ticks, skip some!. */
-302       var n = span / precision;
-303       if (n > 10) {
-304         switch (precision) {
-305           case 36e5: {
-306             step = (n > 20) ? 6 : 3;
-307             date.setHours(Math.floor(date.getHours() / step) * step);
-308             break;
-309           }
-310           case 2592e6: {
-311             step = 3; // seasons
-312             date.setMonth(Math.floor(date.getMonth() / step) * step);
-313             break;
-314           }
-315           case 6e4: {
-316             step = (n > 30) ? 15 : ((n > 15) ? 10 : 5);
-317             date.setMinutes(Math.floor(date.getMinutes() / step) * step);
-318             break;
-319           }
-320           case 1e3: {
-321             step = (n > 90) ? 15 : ((n > 60) ? 10 : 5);
-322             date.setSeconds(Math.floor(date.getSeconds() / step) * step);
-323             break;
-324           }
-325           case 1: {
-326             step = (n > 1000) ? 250 : ((n > 200) ? 100 : ((n > 100) ? 50 : ((n > 50) ? 25 : 5)));
-327             date.setMilliseconds(Math.floor(date.getMilliseconds() / step) * step);
-328             break;
-329           }
-330           default: {
-331             step = pv.logCeil(n / 15, 10);
-332             if (n / step < 2) step /= 5;
-333             else if (n / step < 5) step /= 2;
-334             date.setFullYear(Math.floor(date.getFullYear() / step) * step);
-335             break;
-336           }
-337         }
-338       }
-339 
-340       while (true) {
-341         increment(date);
-342         if (date > max) break;
-343         dates.push(new Date(date));
-344       }
-345       return reverse ? dates.reverse() : dates;
-346     }
-347 
-348     /* Normal case: numbers. */
-349     if (!arguments.length) m = 10;
-350     var step = pv.logFloor(span / m, 10),
-351         err = m / (span / step);
-352     if (err <= .15) step *= 10;
-353     else if (err <= .35) step *= 5;
-354     else if (err <= .75) step *= 2;
-355     var start = Math.ceil(min / step) * step,
-356         end = Math.floor(max / step) * step;
-357     tickFormat = pv.Format.number()
-358         .fractionDigits(Math.max(0, -Math.floor(pv.log(step, 10) + .01)));
-359     var ticks = pv.range(start, end + step, step);
-360     return reverse ? ticks.reverse() : ticks;
-361   };
-362 
-363   /**
-364    * Formats the specified tick value using the appropriate precision, based on
-365    * the step interval between tick marks. If {@link #ticks} has not been called,
-366    * the argument is converted to a string, but no formatting is applied.
-367    *
-368    * @function
-369    * @name pv.Scale.quantitative.prototype.tickFormat
-370    * @param {number} t a tick value.
-371    * @returns {string} a formatted tick value.
-372    */
-373   scale.tickFormat = function (t) { return tickFormat(t); };
-374 
-375   /**
-376    * "Nices" this scale, extending the bounds of the input domain to
-377    * evenly-rounded values. Nicing is useful if the domain is computed
-378    * dynamically from data, and may be irregular. For example, given a domain of
-379    * [0.20147987687960267, 0.996679553296417], a call to <tt>nice()</tt> might
-380    * extend the domain to [0.2, 1].
-381    *
-382    * <p>This method must be invoked each time after setting the domain.
-383    *
-384    * @function
-385    * @name pv.Scale.quantitative.prototype.nice
-386    * @returns {pv.Scale.quantitative} <tt>this</tt>.
-387    */
-388   scale.nice = function() {
-389     if (d.length != 2) return this; // TODO support non-uniform domains
-390     var start = d[0],
-391         end = d[d.length - 1],
-392         reverse = end < start,
-393         min = reverse ? end : start,
-394         max = reverse ? start : end,
-395         span = max - min;
-396 
-397     /* Special case: empty, invalid or infinite span. */
-398     if (!span || !isFinite(span)) return this;
-399 
-400     var step = Math.pow(10, Math.round(Math.log(span) / Math.log(10)) - 1);
-401     d = [Math.floor(min / step) * step, Math.ceil(max / step) * step];
-402     if (reverse) d.reverse();
-403     l = d.map(f);
-404     return this;
-405   };
-406 
-407   /**
-408    * Returns a view of this scale by the specified accessor function <tt>f</tt>.
-409    * Given a scale <tt>y</tt>, <tt>y.by(function(d) d.foo)</tt> is equivalent to
-410    * <tt>function(d) y(d.foo)</tt>.
-411    *
-412    * <p>This method is provided for convenience, such that scales can be
-413    * succinctly defined inline. For example, given an array of data elements
-414    * that have a <tt>score</tt> attribute with the domain [0, 1], the height
-415    * property could be specified as:
-416    *
-417    * <pre>    .height(pv.Scale.linear().range(0, 480).by(function(d) d.score))</pre>
-418    *
-419    * This is equivalent to:
-420    *
-421    * <pre>    .height(function(d) d.score * 480)</pre>
-422    *
-423    * This method should be used judiciously; it is typically more clear to
-424    * invoke the scale directly, passing in the value to be scaled.
-425    *
-426    * @function
-427    * @name pv.Scale.quantitative.prototype.by
-428    * @param {function} f an accessor function.
-429    * @returns {pv.Scale.quantitative} a view of this scale by the specified
-430    * accessor function.
-431    */
-432   scale.by = function(f) {
-433     function by() { return scale(f.apply(this, arguments)); }
-434     for (var method in scale) by[method] = scale[method];
-435     return by;
-436   };
-437 
-438   scale.domain.apply(scale, arguments);
-439   return scale;
-440 };
-441 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_RootScale.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_RootScale.js.html deleted file mode 100644 index b74f9bac..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_RootScale.js.html +++ /dev/null @@ -1,63 +0,0 @@ -
  1 /**
-  2  * Returns a root scale for the specified domain. The arguments to this
-  3  * constructor are optional, and equivalent to calling {@link #domain}.
-  4  * The default domain and range are [0,1].
-  5  *
-  6  * @class Represents a root scale; a function that performs a power
-  7  * transformation. <style type="text/css">sub{line-height:0}</style> Most
-  8  * commonly, a root scale represents a 1-dimensional root transformation from a
-  9  * numeric domain of input data [<i>d<sub>0</sub></i>, <i>d<sub>1</sub></i>] to
- 10  * a numeric range of pixels [<i>r<sub>0</sub></i>, <i>r<sub>1</sub></i>].
- 11  *
- 12  * <p>Note that the scale is itself a function, and thus can be used as a
- 13  * property directly, assuming that the data associated with a mark is a
- 14  * number. While this is convenient for single-use scales, frequently it is
- 15  * desirable to define scales globally:
- 16  *
- 17  * <pre>var y = pv.Scale.root(0, 100).range(0, 640);</pre>
- 18  *
- 19  * The <tt>y</tt> scale can now be equivalently referenced within a property:
- 20  *
- 21  * <pre>    .height(function(d) y(d))</pre>
- 22  *
- 23  * Alternatively, if the data are not simple numbers, the appropriate value can
- 24  * be passed to the <tt>y</tt> scale (e.g., <tt>d.foo</tt>). The {@link #by}
- 25  * method similarly allows the data to be mapped to a numeric value before
- 26  * performing the root transformation.
- 27  *
- 28  * @param {number...} domain... optional domain values.
- 29  * @extends pv.Scale.quantitative
- 30  */
- 31 pv.Scale.root = function() {
- 32   var scale = pv.Scale.quantitative();
- 33 
- 34   /**
- 35    * Sets or gets the exponent; defaults to 2.
- 36    *
- 37    * @function
- 38    * @name pv.Scale.root.prototype.power
- 39    * @param {number} [v] the new exponent.
- 40    * @returns {pv.Scale.root} <tt>this</tt>, or the current base.
- 41    */
- 42   scale.power = function(v) {
- 43     if (arguments.length) {
- 44       var b = Number(v), p = 1 / b;
- 45       scale.transform(
- 46         function(x) { return Math.pow(x, p); },
- 47         function(y) { return Math.pow(y, b); });
- 48       return this;
- 49     }
- 50     return b;
- 51   };
- 52 
- 53   scale.domain.apply(scale, arguments);
- 54   return scale.power(2);
- 55 };
- 56 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Scale.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Scale.js.html deleted file mode 100644 index 232280fa..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Scale.js.html +++ /dev/null @@ -1,94 +0,0 @@ -
  1 /**
-  2  * Abstract; see the various scale implementations.
-  3  *
-  4  * @class Represents a scale; a function that performs a transformation from
-  5  * data domain to visual range. For quantitative and quantile scales, the domain
-  6  * is expressed as numbers; for ordinal scales, the domain is expressed as
-  7  * strings (or equivalently objects with unique string representations). The
-  8  * "visual range" may correspond to pixel space, colors, font sizes, and the
-  9  * like.
- 10  *
- 11  * <p>Note that scales are functions, and thus can be used as properties
- 12  * directly, assuming that the data associated with a mark is a number. While
- 13  * this is convenient for single-use scales, frequently it is desirable to
- 14  * define scales globally:
- 15  *
- 16  * <pre>var y = pv.Scale.linear(0, 100).range(0, 640);</pre>
- 17  *
- 18  * The <tt>y</tt> scale can now be equivalently referenced within a property:
- 19  *
- 20  * <pre>    .height(function(d) y(d))</pre>
- 21  *
- 22  * Alternatively, if the data are not simple numbers, the appropriate value can
- 23  * be passed to the <tt>y</tt> scale (e.g., <tt>d.foo</tt>). The {@link #by}
- 24  * method similarly allows the data to be mapped to a numeric value before
- 25  * performing the linear transformation.
- 26  *
- 27  * @see pv.Scale.quantitative
- 28  * @see pv.Scale.quantile
- 29  * @see pv.Scale.ordinal
- 30  * @extends function
- 31  */
- 32 pv.Scale = function() {};
- 33 
- 34 /**
- 35  * @private Returns a function that interpolators from the start value to the
- 36  * end value, given a parameter <i>t</i> in [0, 1].
- 37  *
- 38  * @param start the start value.
- 39  * @param end the end value.
- 40  */
- 41 pv.Scale.interpolator = function(start, end) {
- 42   if (typeof start == "number") {
- 43     return function(t) {
- 44       return t * (end - start) + start;
- 45     };
- 46   }
- 47 
- 48   /* For now, assume color. */
- 49   start = pv.color(start).rgb();
- 50   end = pv.color(end).rgb();
- 51   return function(t) {
- 52     var a = start.a * (1 - t) + end.a * t;
- 53     if (a < 1e-5) a = 0; // avoid scientific notation
- 54     return (start.a == 0) ? pv.rgb(end.r, end.g, end.b, a)
- 55         : ((end.a == 0) ? pv.rgb(start.r, start.g, start.b, a)
- 56         : pv.rgb(
- 57             Math.round(start.r * (1 - t) + end.r * t),
- 58             Math.round(start.g * (1 - t) + end.g * t),
- 59             Math.round(start.b * (1 - t) + end.b * t), a));
- 60   };
- 61 };
- 62 
- 63 /**
- 64  * Returns a view of this scale by the specified accessor function <tt>f</tt>.
- 65  * Given a scale <tt>y</tt>, <tt>y.by(function(d) d.foo)</tt> is equivalent to
- 66  * <tt>function(d) y(d.foo)</tt>.
- 67  *
- 68  * <p>This method is provided for convenience, such that scales can be
- 69  * succinctly defined inline. For example, given an array of data elements that
- 70  * have a <tt>score</tt> attribute with the domain [0, 1], the height property
- 71  * could be specified as:
- 72  *
- 73  * <pre>    .height(pv.Scale.linear().range(0, 480).by(function(d) d.score))</pre>
- 74  *
- 75  * This is equivalent to:
- 76  *
- 77  * <pre>    .height(function(d) d.score * 480)</pre>
- 78  *
- 79  * This method should be used judiciously; it is typically more clear to invoke
- 80  * the scale directly, passing in the value to be scaled.
- 81  *
- 82  * @function
- 83  * @name pv.Scale.prototype.by
- 84  * @param {function} f an accessor function.
- 85  * @returns {pv.Scale} a view of this scale by the specified accessor function.
- 86  */
- 87 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Transform.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Transform.js.html deleted file mode 100644 index add4eb0b..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Transform.js.html +++ /dev/null @@ -1,117 +0,0 @@ -
  1 /**
-  2  * Returns a new identity transform.
-  3  *
-  4  * @class Represents a transformation matrix. The transformation matrix is
-  5  * limited to expressing translate and uniform scale transforms only; shearing,
-  6  * rotation, general affine, and other transforms are not supported.
-  7  *
-  8  * <p>The methods on this class treat the transform as immutable, returning a
-  9  * copy of the transformation matrix with the specified transform applied. Note,
- 10  * alternatively, that the matrix fields can be get and set directly.
- 11  */
- 12 pv.Transform = function() {};
- 13 pv.Transform.prototype = {k: 1, x: 0, y: 0};
- 14 
- 15 /**
- 16  * The scale magnitude; defaults to 1.
- 17  *
- 18  * @type number
- 19  * @name pv.Transform.prototype.k
- 20  */
- 21 
- 22 /**
- 23  * The x-offset; defaults to 0.
- 24  *
- 25  * @type number
- 26  * @name pv.Transform.prototype.x
- 27  */
- 28 
- 29 /**
- 30  * The y-offset; defaults to 0.
- 31  *
- 32  * @type number
- 33  * @name pv.Transform.prototype.y
- 34  */
- 35 
- 36 /**
- 37  * @private The identity transform.
- 38  *
- 39  * @type pv.Transform
- 40  */
- 41 pv.Transform.identity = new pv.Transform();
- 42 
- 43 // k 0 x   1 0 a   k 0 ka+x
- 44 // 0 k y * 0 1 b = 0 k kb+y
- 45 // 0 0 1   0 0 1   0 0 1
- 46 
- 47 /**
- 48  * Returns a translated copy of this transformation matrix.
- 49  *
- 50  * @param {number} x the x-offset.
- 51  * @param {number} y the y-offset.
- 52  * @returns {pv.Transform} the translated transformation matrix.
- 53  */
- 54 pv.Transform.prototype.translate = function(x, y) {
- 55   var v = new pv.Transform();
- 56   v.k = this.k;
- 57   v.x = this.k * x + this.x;
- 58   v.y = this.k * y + this.y;
- 59   return v;
- 60 };
- 61 
- 62 // k 0 x   d 0 0   kd  0 x
- 63 // 0 k y * 0 d 0 =  0 kd y
- 64 // 0 0 1   0 0 1    0  0 1
- 65 
- 66 /**
- 67  * Returns a scaled copy of this transformation matrix.
- 68  *
- 69  * @param {number} k
- 70  * @returns {pv.Transform} the scaled transformation matrix.
- 71  */
- 72 pv.Transform.prototype.scale = function(k) {
- 73   var v = new pv.Transform();
- 74   v.k = this.k * k;
- 75   v.x = this.x;
- 76   v.y = this.y;
- 77   return v;
- 78 };
- 79 
- 80 /**
- 81  * Returns the inverse of this transformation matrix.
- 82  *
- 83  * @returns {pv.Transform} the inverted transformation matrix.
- 84  */
- 85 pv.Transform.prototype.invert = function() {
- 86   var v = new pv.Transform(), k = 1 / this.k;
- 87   v.k = k;
- 88   v.x = -this.x * k;
- 89   v.y = -this.y * k;
- 90   return v;
- 91 };
- 92 
- 93 // k 0 x   d 0 a   kd  0 ka+x
- 94 // 0 k y * 0 d b =  0 kd kb+y
- 95 // 0 0 1   0 0 1    0  0    1
- 96 
- 97 /**
- 98  * Returns this matrix post-multiplied by the specified matrix <i>m</i>.
- 99  *
-100  * @param {pv.Transform} m
-101  * @returns {pv.Transform} the post-multiplied transformation matrix.
-102  */
-103 pv.Transform.prototype.times = function(m) {
-104   var v = new pv.Transform();
-105   v.k = this.k * m.k;
-106   v.x = this.k * m.x + this.x;
-107   v.y = this.k * m.y + this.y;
-108   return v;
-109 };
-110 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Tree.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Tree.js.html deleted file mode 100644 index 31c7a91c..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Tree.js.html +++ /dev/null @@ -1,132 +0,0 @@ -
  1 /**
-  2  * Returns a {@link pv.Tree} operator for the specified array. This is a
-  3  * convenience factory method, equivalent to <tt>new pv.Tree(array)</tt>.
-  4  *
-  5  * @see pv.Tree
-  6  * @param {array} array an array from which to construct a tree.
-  7  * @returns {pv.Tree} a tree operator for the specified array.
-  8  */
-  9 pv.tree = function(array) {
- 10   return new pv.Tree(array);
- 11 };
- 12 
- 13 /**
- 14  * Constructs a tree operator for the specified array. This constructor should
- 15  * not be invoked directly; use {@link pv.tree} instead.
- 16  *
- 17  * @class Represents a tree operator for the specified array. The tree operator
- 18  * allows a hierarchical map to be constructed from an array; it is similar to
- 19  * the {@link pv.Nest} operator, except the hierarchy is derived dynamically
- 20  * from the array elements.
- 21  *
- 22  * <p>For example, given an array of size information for ActionScript classes:
- 23  *
- 24  * <pre>{ name: "flare.flex.FlareVis", size: 4116 },
- 25  * { name: "flare.physics.DragForce", size: 1082 },
- 26  * { name: "flare.physics.GravityForce", size: 1336 }, ...</pre>
- 27  *
- 28  * To facilitate visualization, it may be useful to nest the elements by their
- 29  * package hierarchy:
- 30  *
- 31  * <pre>var tree = pv.tree(classes)
- 32  *     .keys(function(d) d.name.split("."))
- 33  *     .map();</pre>
- 34  *
- 35  * The resulting tree is:
- 36  *
- 37  * <pre>{ flare: {
- 38  *     flex: {
- 39  *       FlareVis: {
- 40  *         name: "flare.flex.FlareVis",
- 41  *         size: 4116 } },
- 42  *     physics: {
- 43  *       DragForce: {
- 44  *         name: "flare.physics.DragForce",
- 45  *         size: 1082 },
- 46  *       GravityForce: {
- 47  *         name: "flare.physics.GravityForce",
- 48  *         size: 1336 } },
- 49  *     ... } }</pre>
- 50  *
- 51  * By specifying a value function,
- 52  *
- 53  * <pre>var tree = pv.tree(classes)
- 54  *     .keys(function(d) d.name.split("."))
- 55  *     .value(function(d) d.size)
- 56  *     .map();</pre>
- 57  *
- 58  * we can further eliminate redundant data:
- 59  *
- 60  * <pre>{ flare: {
- 61  *     flex: {
- 62  *       FlareVis: 4116 },
- 63  *     physics: {
- 64  *       DragForce: 1082,
- 65  *       GravityForce: 1336 },
- 66  *   ... } }</pre>
- 67  *
- 68  * For visualizations with large data sets, performance improvements may be seen
- 69  * by storing the data in a tree format, and then flattening it into an array at
- 70  * runtime with {@link pv.Flatten}.
- 71  *
- 72  * @param {array} array an array from which to construct a tree.
- 73  */
- 74 pv.Tree = function(array) {
- 75   this.array = array;
- 76 };
- 77 
- 78 /**
- 79  * Assigns a <i>keys</i> function to this operator; required. The keys function
- 80  * returns an array of <tt>string</tt>s for each element in the associated
- 81  * array; these keys determine how the elements are nested in the tree. The
- 82  * returned keys should be unique for each element in the array; otherwise, the
- 83  * behavior of this operator is undefined.
- 84  *
- 85  * @param {function} k the keys function.
- 86  * @returns {pv.Tree} this.
- 87  */
- 88 pv.Tree.prototype.keys = function(k) {
- 89   this.k = k;
- 90   return this;
- 91 };
- 92 
- 93 /**
- 94  * Assigns a <i>value</i> function to this operator; optional. The value
- 95  * function specifies an optional transformation of the element in the array
- 96  * before it is inserted into the map. If no value function is specified, it is
- 97  * equivalent to using the identity function.
- 98  *
- 99  * @param {function} k the value function.
-100  * @returns {pv.Tree} this.
-101  */
-102 pv.Tree.prototype.value = function(v) {
-103   this.v = v;
-104   return this;
-105 };
-106 
-107 /**
-108  * Returns a hierarchical map of values. The hierarchy is determined by the keys
-109  * function; the values in the map are determined by the value function.
-110  *
-111  * @returns a hierarchical map of values.
-112  */
-113 pv.Tree.prototype.map = function() {
-114   var map = {}, o = {};
-115   for (var i = 0; i < this.array.length; i++) {
-116     o.index = i;
-117     var value = this.array[i], keys = this.k.call(o, value), node = map;
-118     for (var j = 0; j < keys.length - 1; j++) {
-119       node = node[keys[j]] || (node[keys[j]] = {});
-120     }
-121     node[keys[j]] = this.v ? this.v.call(o, value) : value;
-122   }
-123   return map;
-124 };
-125 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Vector.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Vector.js.html deleted file mode 100644 index 6051d92d..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_data_Vector.js.html +++ /dev/null @@ -1,126 +0,0 @@ -
  1 /**
-  2  * Returns a {@link pv.Vector} for the specified <i>x</i> and <i>y</i>
-  3  * coordinate. This is a convenience factory method, equivalent to <tt>new
-  4  * pv.Vector(x, y)</tt>.
-  5  *
-  6  * @see pv.Vector
-  7  * @param {number} x the <i>x</i> coordinate.
-  8  * @param {number} y the <i>y</i> coordinate.
-  9  * @returns {pv.Vector} a vector for the specified coordinates.
- 10  */
- 11 pv.vector = function(x, y) {
- 12   return new pv.Vector(x, y);
- 13 };
- 14 
- 15 /**
- 16  * Constructs a {@link pv.Vector} for the specified <i>x</i> and <i>y</i>
- 17  * coordinate. This constructor should not be invoked directly; use
- 18  * {@link pv.vector} instead.
- 19  *
- 20  * @class Represents a two-dimensional vector; a 2-tuple <i>⟨x,
- 21  * y⟩</i>. The intent of this class is to simplify vector math. Note that
- 22  * in performance-sensitive cases it may be more efficient to represent 2D
- 23  * vectors as simple objects with <tt>x</tt> and <tt>y</tt> attributes, rather
- 24  * than using instances of this class.
- 25  *
- 26  * @param {number} x the <i>x</i> coordinate.
- 27  * @param {number} y the <i>y</i> coordinate.
- 28  */
- 29 pv.Vector = function(x, y) {
- 30   this.x = x;
- 31   this.y = y;
- 32 };
- 33 
- 34 /**
- 35  * Returns a vector perpendicular to this vector: <i>⟨-y, x⟩</i>.
- 36  *
- 37  * @returns {pv.Vector} a perpendicular vector.
- 38  */
- 39 pv.Vector.prototype.perp = function() {
- 40   return new pv.Vector(-this.y, this.x);
- 41 };
- 42 
- 43 /**
- 44  * Returns a normalized copy of this vector: a vector with the same direction,
- 45  * but unit length. If this vector has zero length this method returns a copy of
- 46  * this vector.
- 47  *
- 48  * @returns {pv.Vector} a unit vector.
- 49  */
- 50 pv.Vector.prototype.norm = function() {
- 51   var l = this.length();
- 52   return this.times(l ? (1 / l) : 1);
- 53 };
- 54 
- 55 /**
- 56  * Returns the magnitude of this vector, defined as <i>sqrt(x * x + y * y)</i>.
- 57  *
- 58  * @returns {number} a length.
- 59  */
- 60 pv.Vector.prototype.length = function() {
- 61   return Math.sqrt(this.x * this.x + this.y * this.y);
- 62 };
- 63 
- 64 /**
- 65  * Returns a scaled copy of this vector: <i>⟨x * k, y * k⟩</i>.
- 66  * To perform the equivalent divide operation, use <i>1 / k</i>.
- 67  *
- 68  * @param {number} k the scale factor.
- 69  * @returns {pv.Vector} a scaled vector.
- 70  */
- 71 pv.Vector.prototype.times = function(k) {
- 72   return new pv.Vector(this.x * k, this.y * k);
- 73 };
- 74 
- 75 /**
- 76  * Returns this vector plus the vector <i>v</i>: <i>⟨x + v.x, y +
- 77  * v.y⟩</i>. If only one argument is specified, it is interpreted as the
- 78  * vector <i>v</i>.
- 79  *
- 80  * @param {number} x the <i>x</i> coordinate to add.
- 81  * @param {number} y the <i>y</i> coordinate to add.
- 82  * @returns {pv.Vector} a new vector.
- 83  */
- 84 pv.Vector.prototype.plus = function(x, y) {
- 85   return (arguments.length == 1)
- 86       ? new pv.Vector(this.x + x.x, this.y + x.y)
- 87       : new pv.Vector(this.x + x, this.y + y);
- 88 };
- 89 
- 90 /**
- 91  * Returns this vector minus the vector <i>v</i>: <i>⟨x - v.x, y -
- 92  * v.y⟩</i>. If only one argument is specified, it is interpreted as the
- 93  * vector <i>v</i>.
- 94  *
- 95  * @param {number} x the <i>x</i> coordinate to subtract.
- 96  * @param {number} y the <i>y</i> coordinate to subtract.
- 97  * @returns {pv.Vector} a new vector.
- 98  */
- 99 pv.Vector.prototype.minus = function(x, y) {
-100   return (arguments.length == 1)
-101       ? new pv.Vector(this.x - x.x, this.y - x.y)
-102       : new pv.Vector(this.x - x, this.y - y);
-103 };
-104 
-105 /**
-106  * Returns the dot product of this vector and the vector <i>v</i>: <i>x * v.x +
-107  * y * v.y</i>. If only one argument is specified, it is interpreted as the
-108  * vector <i>v</i>.
-109  *
-110  * @param {number} x the <i>x</i> coordinate to dot.
-111  * @param {number} y the <i>y</i> coordinate to dot.
-112  * @returns {number} a dot product.
-113  */
-114 pv.Vector.prototype.dot = function(x, y) {
-115   return (arguments.length == 1)
-116       ? this.x * x.x + this.y * x.y
-117       : this.x * x + this.y * y;
-118 };
-119 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_Geo.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_Geo.js.html deleted file mode 100644 index 4f482b29..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_Geo.js.html +++ /dev/null @@ -1,13 +0,0 @@ -
  1 /**
-  2  * @ignore
-  3  * @namespace
-  4  */
-  5 pv.Geo = function() {};
-  6 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_GeoScale.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_GeoScale.js.html deleted file mode 100644 index 5a6a38ed..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_GeoScale.js.html +++ /dev/null @@ -1,315 +0,0 @@ -
  1 /**
-  2  * Returns a geographic scale. The arguments to this constructor are optional,
-  3  * and equivalent to calling {@link #projection}.
-  4  *
-  5  * @class Represents a geographic scale; a mapping between latitude-longitude
-  6  * coordinates and screen pixel coordinates. By default, the domain is inferred
-  7  * from the geographic coordinates, so that the domain fills the output range.
-  8  *
-  9  * <p>Note that geographic scales are two-dimensional transformations, rather
- 10  * than the one-dimensional bidrectional mapping typical of other scales.
- 11  * Rather than mapping (for example) between a numeric domain and a numeric
- 12  * range, geographic scales map between two coordinate objects: {@link
- 13  * pv.Geo.LatLng} and {@link pv.Vector}.
- 14  *
- 15  * @param {pv.Geo.Projection} [p] optional projection.
- 16  * @see pv.Geo.scale#ticks
- 17  */
- 18 pv.Geo.scale = function(p) {
- 19   var rmin = {x: 0, y: 0}, // default range minimum
- 20       rmax = {x: 1, y: 1}, // default range maximum
- 21       d = [], // default domain
- 22       j = pv.Geo.projections.identity, // domain <-> normalized range
- 23       x = pv.Scale.linear(-1, 1).range(0, 1), // normalized <-> range
- 24       y = pv.Scale.linear(-1, 1).range(1, 0), // normalized <-> range
- 25       c = {lng: 0, lat: 0}, // Center Point
- 26       lastLatLng, // cached latlng
- 27       lastPoint; // cached point
- 28 
- 29   /** @private */
- 30   function scale(latlng) {
- 31     if (!lastLatLng
- 32         || (latlng.lng != lastLatLng.lng)
- 33         || (latlng.lat != lastLatLng.lat)) {
- 34       lastLatLng = latlng;
- 35       var p = project(latlng);
- 36       lastPoint = {x: x(p.x), y: y(p.y)};
- 37     }
- 38     return lastPoint;
- 39   }
- 40 
- 41   /** @private */
- 42   function project(latlng) {
- 43     var offset = {lng: latlng.lng - c.lng, lat: latlng.lat};
- 44     return j.project(offset);
- 45   }
- 46 
- 47   /** @private */
- 48   function invert(xy) {
- 49     var latlng = j.invert(xy);
- 50     latlng.lng += c.lng;
- 51     return latlng;
- 52   }
- 53 
- 54   /** Returns the projected x-coordinate. */
- 55   scale.x = function(latlng) {
- 56     return scale(latlng).x;
- 57   };
- 58 
- 59   /** Returns the projected y-coordinate. */
- 60   scale.y = function(latlng) {
- 61     return scale(latlng).y;
- 62   };
- 63 
- 64   /**
- 65    * Abstract; this is a local namespace on a given geographic scale.
- 66    *
- 67    * @namespace Tick functions for geographic scales. Because geographic scales
- 68    * represent two-dimensional transformations (as opposed to one-dimensional
- 69    * transformations typical of other scales), the tick values are similarly
- 70    * represented as two-dimensional coordinates in the input domain, i.e.,
- 71    * {@link pv.Geo.LatLng} objects.
- 72    *
- 73    * <p>Also, note that non-rectilinear projections, such as sinsuoidal and
- 74    * aitoff, may not produce straight lines for constant longitude or constant
- 75    * latitude. Therefore the returned array of ticks is a two-dimensional array,
- 76    * sampling various latitudes as constant longitude, and vice versa.
- 77    *
- 78    * <p>The tick lines can therefore be approximated as polylines, either with
- 79    * "linear" or "cardinal" interpolation. This is not as accurate as drawing
- 80    * the true curve through the projection space, but is usually sufficient.
- 81    *
- 82    * @name pv.Geo.scale.prototype.ticks
- 83    * @see pv.Geo.scale
- 84    * @see pv.Geo.LatLng
- 85    * @see pv.Line#interpolate
- 86    */
- 87   scale.ticks = {
- 88 
- 89     /**
- 90      * Returns longitude ticks.
- 91      *
- 92      * @function
- 93      * @param {number} [m] the desired number of ticks.
- 94      * @returns {array} a nested array of <tt>pv.Geo.LatLng</tt> ticks.
- 95      * @name pv.Geo.scale.prototype.ticks.prototype.lng
- 96      */
- 97     lng: function(m) {
- 98       var lat, lng;
- 99       if (d.length > 1) {
-100         var s = pv.Scale.linear();
-101         if (m == undefined) m = 10;
-102         lat = s.domain(d, function(d) { return d.lat; }).ticks(m);
-103         lng = s.domain(d, function(d) { return d.lng; }).ticks(m);
-104       } else {
-105         lat = pv.range(-80, 81, 10);
-106         lng = pv.range(-180, 181, 10);
-107       }
-108       return lng.map(function(lng) {
-109         return lat.map(function(lat) {
-110           return {lat: lat, lng: lng};
-111         });
-112       });
-113     },
-114 
-115     /**
-116      * Returns latitude ticks.
-117      *
-118      * @function
-119      * @param {number} [m] the desired number of ticks.
-120      * @returns {array} a nested array of <tt>pv.Geo.LatLng</tt> ticks.
-121      * @name pv.Geo.scale.prototype.ticks.prototype.lat
-122      */
-123     lat: function(m) {
-124       return pv.transpose(scale.ticks.lng(m));
-125     }
-126   };
-127 
-128   /**
-129    * Inverts the specified value in the output range, returning the
-130    * corresponding value in the input domain. This is frequently used to convert
-131    * the mouse location (see {@link pv.Mark#mouse}) to a value in the input
-132    * domain. Inversion is only supported for numeric ranges, and not colors.
-133    *
-134    * <p>Note that this method does not do any rounding or bounds checking. If
-135    * the input domain is discrete (e.g., an array index), the returned value
-136    * should be rounded. If the specified <tt>y</tt> value is outside the range,
-137    * the returned value may be equivalently outside the input domain.
-138    *
-139    * @function
-140    * @name pv.Geo.scale.prototype.invert
-141    * @param {number} y a value in the output range (a pixel location).
-142    * @returns {number} a value in the input domain.
-143    */
-144   scale.invert = function(p) {
-145     return invert({x: x.invert(p.x), y: y.invert(p.y)});
-146   };
-147 
-148   /**
-149    * Sets or gets the input domain. Note that unlike quantitative scales, the
-150    * domain cannot be reduced to a simple rectangle (i.e., minimum and maximum
-151    * values for latitude and longitude). Instead, the domain values must be
-152    * projected to normalized space, effectively finding the domain in normalized
-153    * space rather than in terms of latitude and longitude. Thus, changing the
-154    * projection requires recomputing the normalized domain.
-155    *
-156    * <p>This method can be invoked several ways:
-157    *
-158    * <p>1. <tt>domain(values...)</tt>
-159    *
-160    * <p>Specifying the domain as a series of {@link pv.Geo.LatLng}s is the most
-161    * explicit and recommended approach. However, if the domain values are
-162    * derived from data, you may find the second method more appropriate.
-163    *
-164    * <p>2. <tt>domain(array, f)</tt>
-165    *
-166    * <p>Rather than enumerating the domain explicitly, you can specify a single
-167    * argument of an array. In addition, you can specify an optional accessor
-168    * function to extract the domain values (as {@link pv.Geo.LatLng}s) from the
-169    * array. If the specified array has fewer than two elements, this scale will
-170    * default to the full normalized domain.
-171    *
-172    * <p>2. <tt>domain()</tt>
-173    *
-174    * <p>Invoking the <tt>domain</tt> method with no arguments returns the
-175    * current domain as an array.
-176    *
-177    * @function
-178    * @name pv.Geo.scale.prototype.domain
-179    * @param {...} domain... domain values.
-180    * @returns {pv.Geo.scale} <tt>this</tt>, or the current domain.
-181    */
-182   scale.domain = function(array, f) {
-183     if (arguments.length) {
-184       d = (array instanceof Array)
-185           ? ((arguments.length > 1) ? pv.map(array, f) : array)
-186           : Array.prototype.slice.call(arguments);
-187       if (d.length > 1) {
-188         var lngs = d.map(function(c) { return c.lng; });
-189         var lats = d.map(function(c) { return c.lat; });
-190         c = {
-191           lng: (pv.max(lngs) + pv.min(lngs)) / 2,
-192           lat: (pv.max(lats) + pv.min(lats)) / 2
-193         };
-194         var n = d.map(project); // normalized domain
-195         x.domain(n, function(p) { return p.x; });
-196         y.domain(n, function(p) { return p.y; });
-197       } else {
-198         c = {lng: 0, lat: 0};
-199         x.domain(-1, 1);
-200         y.domain(-1, 1);
-201       }
-202       lastLatLng = null; // invalidate the cache
-203       return this;
-204     }
-205     return d;
-206   };
-207 
-208   /**
-209    * Sets or gets the output range. This method can be invoked several ways:
-210    *
-211    * <p>1. <tt>range(min, max)</tt>
-212    *
-213    * <p>If two objects are specified, the arguments should be {@link pv.Vector}s
-214    * which specify the minimum and maximum values of the x- and y-coordinates
-215    * explicitly.
-216    *
-217    * <p>2. <tt>range(width, height)</tt>
-218    *
-219    * <p>If two numbers are specified, the arguments specify the maximum values
-220    * of the x- and y-coordinates explicitly; the minimum values are implicitly
-221    * zero.
-222    *
-223    * <p>3. <tt>range()</tt>
-224    *
-225    * <p>Invoking the <tt>range</tt> method with no arguments returns the current
-226    * range as an array of two {@link pv.Vector}s: the minimum (top-left) and
-227    * maximum (bottom-right) values.
-228    *
-229    * @function
-230    * @name pv.Geo.scale.prototype.range
-231    * @param {...} range... range values.
-232    * @returns {pv.Geo.scale} <tt>this</tt>, or the current range.
-233    */
-234   scale.range = function(min, max) {
-235     if (arguments.length) {
-236       if (typeof min == "object") {
-237         rmin = {x: Number(min.x), y: Number(min.y)};
-238         rmax = {x: Number(max.x), y: Number(max.y)};
-239       } else {
-240         rmin = {x: 0, y: 0};
-241         rmax = {x: Number(min), y: Number(max)};
-242       }
-243       x.range(rmin.x, rmax.x);
-244       y.range(rmax.y, rmin.y); // XXX flipped?
-245       lastLatLng = null; // invalidate the cache
-246       return this;
-247     }
-248     return [rmin, rmax];
-249   };
-250 
-251   /**
-252    * Sets or gets the projection. This method can be invoked several ways:
-253    *
-254    * <p>1. <tt>projection(string)</tt>
-255    *
-256    * <p>Specifying a string sets the projection to the given named projection in
-257    * {@link pv.Geo.projections}. If no such projection is found, the identity
-258    * projection is used.
-259    *
-260    * <p>2. <tt>projection(object)</tt>
-261    *
-262    * <p>Specifying an object sets the projection to the given custom projection,
-263    * which must implement the <i>forward</i> and <i>inverse</i> methods per the
-264    * {@link pv.Geo.Projection} interface.
-265    *
-266    * <p>3. <tt>projection()</tt>
-267    *
-268    * <p>Invoking the <tt>projection</tt> method with no arguments returns the
-269    * current object that defined the projection.
-270    *
-271    * @function
-272    * @name pv.Scale.geo.prototype.projection
-273    * @param {...} range... range values.
-274    * @returns {pv.Scale.geo} <tt>this</tt>, or the current range.
-275    */
-276   scale.projection = function(p) {
-277     if (arguments.length) {
-278       j = typeof p == "string"
-279           ? pv.Geo.projections[p] || pv.Geo.projections.identity
-280           : p;
-281       return this.domain(d); // recompute normalized domain
-282     }
-283     return p;
-284   };
-285 
-286   /**
-287    * Returns a view of this scale by the specified accessor function <tt>f</tt>.
-288    * Given a scale <tt>g</tt>, <tt>g.by(function(d) d.foo)</tt> is equivalent to
-289    * <tt>function(d) g(d.foo)</tt>. This method should be used judiciously; it
-290    * is typically more clear to invoke the scale directly, passing in the value
-291    * to be scaled.
-292    *
-293    * @function
-294    * @name pv.Geo.scale.prototype.by
-295    * @param {function} f an accessor function.
-296    * @returns {pv.Geo.scale} a view of this scale by the specified accessor
-297    * function.
-298    */
-299   scale.by = function(f) {
-300     function by() { return scale(f.apply(this, arguments)); }
-301     for (var method in scale) by[method] = scale[method];
-302     return by;
-303   };
-304 
-305   if (arguments.length) scale.projection(p);
-306   return scale;
-307 };
-308 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_LatLng.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_LatLng.js.html deleted file mode 100644 index 429e721c..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_LatLng.js.html +++ /dev/null @@ -1,31 +0,0 @@ -
  1 /**
-  2  * Abstract; not implemented. There is no explicit constructor; this class
-  3  * merely serves to document the representation used by {@link pv.Geo.scale}.
-  4  *
-  5  * @class Represents a pair of geographic coordinates.
-  6  *
-  7  * @name pv.Geo.LatLng
-  8  * @see pv.Geo.scale
-  9  */
- 10 
- 11 /**
- 12  * The <i>latitude</i> coordinate in degrees; positive is North.
- 13  *
- 14  * @type number
- 15  * @name pv.Geo.LatLng.prototype.lat
- 16  */
- 17 
- 18 /**
- 19  * The <i>longitude</i> coordinate in degrees; positive is East.
- 20  *
- 21  * @type number
- 22  * @name pv.Geo.LatLng.prototype.lng
- 23  */
- 24 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_Projection.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_Projection.js.html deleted file mode 100644 index 8e08747a..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_Projection.js.html +++ /dev/null @@ -1,51 +0,0 @@ -
  1 /**
-  2  * Abstract; not implemented. There is no explicit constructor; this class
-  3  * merely serves to document the representation used by {@link pv.Geo.scale}.
-  4  *
-  5  * @class Represents a geographic projection. This class provides the core
-  6  * implementation for {@link pv.Geo.scale}s, mapping between geographic
-  7  * coordinates (latitude and longitude) and normalized screen space in the range
-  8  * [-1,1]. The remaining mapping between normalized screen space and actual
-  9  * pixels is performed by <tt>pv.Geo.scale</tt>.
- 10  *
- 11  * <p>Many geographic projections have a point around which the projection is
- 12  * centered. Rather than have each implementation add support for a
- 13  * user-specified center point, the <tt>pv.Geo.scale</tt> translates the
- 14  * geographic coordinates relative to the center point for both the forward and
- 15  * inverse projection.
- 16  *
- 17  * <p>In general, this class should not be used directly, unless the desire is
- 18  * to implement a new geographic projection. Instead, use <tt>pv.Geo.scale</tt>.
- 19  * Implementations are not required to implement inverse projections, but are
- 20  * needed for some forms of interactivity. Also note that some inverse
- 21  * projections are ambiguous, such as the connecting points in Dymaxian maps.
- 22  *
- 23  * @name pv.Geo.Projection
- 24  * @see pv.Geo.scale
- 25  */
- 26 
- 27 /**
- 28  * The <i>forward</i> projection.
- 29  *
- 30  * @function
- 31  * @name pv.Geo.Projection.prototype.project
- 32  * @param {pv.Geo.LatLng} latlng the latitude and longitude to project.
- 33  * @returns {pv.Vector} the xy-coordinates of the given point.
- 34  */
- 35 
- 36 /**
- 37  * The <i>inverse</i> projection; optional.
- 38  *
- 39  * @function
- 40  * @name pv.Geo.Projection.prototype.invert
- 41  * @param {pv.Vector} xy the x- and y-coordinates to invert.
- 42  * @returns {pv.Geo.LatLng} the latitude and longitude of the given point.
- 43  */
- 44 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_Projections.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_Projections.js.html deleted file mode 100644 index 5bb12791..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_geo_Projections.js.html +++ /dev/null @@ -1,125 +0,0 @@ -
  1 /**
-  2  * The built-in projections.
-  3  *
-  4  * @see pv.Geo.Projection
-  5  * @namespace
-  6  */
-  7 pv.Geo.projections = {
-  8 
-  9   /** @see http://en.wikipedia.org/wiki/Mercator_projection */
- 10   mercator: {
- 11     project: function(latlng) {
- 12       return {
- 13           x: latlng.lng / 180,
- 14           y: latlng.lat > 85 ? 1 : latlng.lat < -85 ? -1
- 15               : Math.log(Math.tan(Math.PI / 4
- 16               + pv.radians(latlng.lat) / 2)) / Math.PI
- 17         };
- 18     },
- 19     invert: function(xy) {
- 20       return {
- 21           lng: xy.x * 180,
- 22           lat: pv.degrees(2 * Math.atan(Math.exp(xy.y * Math.PI)) - Math.PI / 2)
- 23         };
- 24     }
- 25   },
- 26 
- 27   /** @see http://en.wikipedia.org/wiki/Gall-Peters_projection */
- 28   "gall-peters": {
- 29     project: function(latlng) {
- 30       return {
- 31           x: latlng.lng / 180,
- 32           y: Math.sin(pv.radians(latlng.lat))
- 33         };
- 34     },
- 35     invert: function(xy) {
- 36       return {
- 37           lng: xy.x * 180,
- 38           lat: pv.degrees(Math.asin(xy.y))
- 39         };
- 40     }
- 41   },
- 42 
- 43   /** @see http://en.wikipedia.org/wiki/Sinusoidal_projection */
- 44   sinusoidal: {
- 45     project: function(latlng) {
- 46       return {
- 47           x: pv.radians(latlng.lng) * Math.cos(pv.radians(latlng.lat)) / Math.PI,
- 48           y: latlng.lat / 90
- 49         };
- 50     },
- 51     invert: function(xy) {
- 52       return {
- 53           lng: pv.degrees((xy.x * Math.PI) / Math.cos(xy.y * Math.PI / 2)),
- 54           lat: xy.y * 90
- 55         };
- 56     }
- 57   },
- 58 
- 59   /** @see http://en.wikipedia.org/wiki/Aitoff_projection */
- 60   aitoff: {
- 61     project: function(latlng) {
- 62       var l = pv.radians(latlng.lng),
- 63           f = pv.radians(latlng.lat),
- 64           a = Math.acos(Math.cos(f) * Math.cos(l / 2));
- 65       return {
- 66           x: 2 * (a ? (Math.cos(f) * Math.sin(l / 2) * a / Math.sin(a)) : 0) / Math.PI,
- 67           y: 2 * (a ? (Math.sin(f) * a / Math.sin(a)) : 0) / Math.PI
- 68         };
- 69     },
- 70     invert: function(xy) {
- 71       var x = xy.x * Math.PI / 2,
- 72           y = xy.y * Math.PI / 2;
- 73       return {
- 74           lng: pv.degrees(x / Math.cos(y)),
- 75           lat: pv.degrees(y)
- 76         };
- 77     }
- 78   },
- 79 
- 80   /** @see http://en.wikipedia.org/wiki/Hammer_projection */
- 81   hammer: {
- 82     project: function(latlng) {
- 83       var l = pv.radians(latlng.lng),
- 84           f = pv.radians(latlng.lat),
- 85           c = Math.sqrt(1 + Math.cos(f) * Math.cos(l / 2));
- 86       return {
- 87           x: 2 * Math.SQRT2 * Math.cos(f) * Math.sin(l / 2) / c / 3,
- 88           y: Math.SQRT2 * Math.sin(f) / c / 1.5
- 89         };
- 90     },
- 91     invert: function(xy) {
- 92       var x = xy.x * 3,
- 93           y = xy.y * 1.5,
- 94           z = Math.sqrt(1 - x * x / 16 - y * y / 4);
- 95       return {
- 96           lng: pv.degrees(2 * Math.atan2(z * x, 2 * (2 * z * z - 1))),
- 97           lat: pv.degrees(Math.asin(z * y))
- 98         };
- 99     }
-100   },
-101 
-102   /** The identity or "none" projection. */
-103   identity: {
-104     project: function(latlng) {
-105       return {
-106           x: latlng.lng / 180,
-107           y: latlng.lat / 90
-108         };
-109     },
-110     invert: function(xy) {
-111       return {
-112           lng: xy.x * 180,
-113           lat: xy.y * 90
-114         };
-115     }
-116   }
-117 };
-118 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_lang_Array.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_lang_Array.js.html deleted file mode 100644 index ad68f3d0..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_lang_Array.js.html +++ /dev/null @@ -1,120 +0,0 @@ -
  1 /**
-  2  * @class The built-in Array class.
-  3  * @name Array
-  4  */
-  5 
-  6 /**
-  7  * Creates a new array with the results of calling a provided function on every
-  8  * element in this array. Implemented in Javascript 1.6.
-  9  *
- 10  * @function
- 11  * @name Array.prototype.map
- 12  * @see <a
- 13  * href="https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Objects/Array/Map">map</a>
- 14  * documentation.
- 15  * @param {function} f function that produces an element of the new Array from
- 16  * an element of the current one.
- 17  * @param [o] object to use as <tt>this</tt> when executing <tt>f</tt>.
- 18  */
- 19 if (!Array.prototype.map) Array.prototype.map = function(f, o) {
- 20   var n = this.length;
- 21   var result = new Array(n);
- 22   for (var i = 0; i < n; i++) {
- 23     if (i in this) {
- 24       result[i] = f.call(o, this[i], i, this);
- 25     }
- 26   }
- 27   return result;
- 28 };
- 29 
- 30 /**
- 31  * Creates a new array with all elements that pass the test implemented by the
- 32  * provided function. Implemented in Javascript 1.6.
- 33  *
- 34  * @function
- 35  * @name Array.prototype.filter
- 36  * @see <a
- 37  * href="https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Objects/Array/filter">filter</a>
- 38  * documentation.
- 39  * @param {function} f function to test each element of the array.
- 40  * @param [o] object to use as <tt>this</tt> when executing <tt>f</tt>.
- 41  */
- 42 if (!Array.prototype.filter) Array.prototype.filter = function(f, o) {
- 43   var n = this.length;
- 44   var result = new Array();
- 45   for (var i = 0; i < n; i++) {
- 46     if (i in this) {
- 47       var v = this[i];
- 48       if (f.call(o, v, i, this)) result.push(v);
- 49     }
- 50   }
- 51   return result;
- 52 };
- 53 
- 54 /**
- 55  * Executes a provided function once per array element. Implemented in
- 56  * Javascript 1.6.
- 57  *
- 58  * @function
- 59  * @name Array.prototype.forEach
- 60  * @see <a
- 61  * href="https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Objects/Array/ForEach">forEach</a>
- 62  * documentation.
- 63  * @param {function} f function to execute for each element.
- 64  * @param [o] object to use as <tt>this</tt> when executing <tt>f</tt>.
- 65  */
- 66 if (!Array.prototype.forEach) Array.prototype.forEach = function(f, o) {
- 67   var n = this.length >>> 0;
- 68   for (var i = 0; i < n; i++) {
- 69     if (i in this) f.call(o, this[i], i, this);
- 70   }
- 71 };
- 72 
- 73 /**
- 74  * Apply a function against an accumulator and each value of the array (from
- 75  * left-to-right) as to reduce it to a single value. Implemented in Javascript
- 76  * 1.8.
- 77  *
- 78  * @function
- 79  * @name Array.prototype.reduce
- 80  * @see <a
- 81  * href="https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Objects/Array/Reduce">reduce</a>
- 82  * documentation.
- 83  * @param {function} f function to execute on each value in the array.
- 84  * @param [v] object to use as the first argument to the first call of
- 85  * <tt>t</tt>.
- 86  */
- 87 if (!Array.prototype.reduce) Array.prototype.reduce = function(f, v) {
- 88   var len = this.length;
- 89   if (!len && (arguments.length == 1)) {
- 90     throw new Error("reduce: empty array, no initial value");
- 91   }
- 92 
- 93   var i = 0;
- 94   if (arguments.length < 2) {
- 95     while (true) {
- 96       if (i in this) {
- 97         v = this[i++];
- 98         break;
- 99       }
-100       if (++i >= len) {
-101         throw new Error("reduce: no values, no initial value");
-102       }
-103     }
-104   }
-105 
-106   for (; i < len; i++) {
-107     if (i in this) {
-108       v = f(v, this[i], i, this);
-109     }
-110   }
-111   return v;
-112 };
-113 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_lang_init.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_lang_init.js.html deleted file mode 100644 index 5e04a868..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_lang_init.js.html +++ /dev/null @@ -1,34 +0,0 @@ -
  1 /*
-  2  * Parses the Protovis specifications on load, allowing the use of JavaScript
-  3  * 1.8 function expressions on browsers that only support JavaScript 1.6.
-  4  *
-  5  * @see pv.parse
-  6  */
-  7 pv.listen(window, "load", function() {
-  8    /*
-  9     * Note: in Firefox any variables declared here are visible to the eval'd
- 10     * script below. Even worse, any global variables declared by the script
- 11     * could overwrite local variables here (such as the index, `i`)!  To protect
- 12     * against this, all variables are explicitly scoped on a pv.$ object.
- 13     */
- 14     pv.$ = {i:0, x:document.getElementsByTagName("script")};
- 15     for (; pv.$.i < pv.$.x.length; pv.$.i++) {
- 16       pv.$.s = pv.$.x[pv.$.i];
- 17       if (pv.$.s.type == "text/javascript+protovis") {
- 18         try {
- 19           window.eval(pv.parse(pv.$.s.text));
- 20         } catch (e) {
- 21           pv.error(e);
- 22         }
- 23       }
- 24     }
- 25     delete pv.$;
- 26   });
- 27 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Arc.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Arc.js.html deleted file mode 100644 index 7054173c..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Arc.js.html +++ /dev/null @@ -1,186 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty arc layout. Layouts are not typically constructed
-  3  * directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Implements a layout for arc diagrams. An arc diagram is a network
-  7  * visualization with a one-dimensional layout of nodes, using circular arcs to
-  8  * render links between nodes. For undirected networks, arcs are rendering on a
-  9  * single side; this makes arc diagrams useful as annotations to other
- 10  * two-dimensional network layouts, such as rollup, matrix or table layouts. For
- 11  * directed networks, links in opposite directions can be rendered on opposite
- 12  * sides using <tt>directed(true)</tt>.
- 13  *
- 14  * <p>Arc layouts are particularly sensitive to node ordering; for best results,
- 15  * order the nodes such that related nodes are close to each other. A poor
- 16  * (e.g., random) order may result in large arcs with crossovers that impede
- 17  * visual processing. A future improvement to this layout may include automatic
- 18  * reordering using, e.g., spectral graph layout or simulated annealing.
- 19  *
- 20  * <p>This visualization technique is related to that developed by
- 21  * M. Wattenberg, <a
- 22  * href="http://www.research.ibm.com/visual/papers/arc-diagrams.pdf">"Arc
- 23  * Diagrams: Visualizing Structure in Strings"</a> in <i>IEEE InfoVis</i>, 2002.
- 24  * However, this implementation is limited to simple node-link networks, as
- 25  * opposed to structures with hierarchical self-similarity (such as strings).
- 26  *
- 27  * <p>As with other network layouts, three mark prototypes are provided:<ul>
- 28  *
- 29  * <li><tt>node</tt> - for rendering nodes; typically a {@link pv.Dot}.
- 30  * <li><tt>link</tt> - for rendering links; typically a {@link pv.Line}.
- 31  * <li><tt>label</tt> - for rendering node labels; typically a {@link pv.Label}.
- 32  *
- 33  * </ul>For more details on how this layout is structured and can be customized,
- 34  * see {@link pv.Layout.Network}.
- 35  *
- 36  * @extends pv.Layout.Network
- 37  **/
- 38 pv.Layout.Arc = function() {
- 39   pv.Layout.Network.call(this);
- 40   var interpolate, // cached interpolate
- 41       directed, // cached directed
- 42       reverse, // cached reverse
- 43       buildImplied = this.buildImplied;
- 44 
- 45   /** @private Cache layout state to optimize properties. */
- 46   this.buildImplied = function(s) {
- 47     buildImplied.call(this, s);
- 48     directed = s.directed;
- 49     interpolate = s.orient == "radial" ? "linear" : "polar";
- 50     reverse = s.orient == "right" || s.orient == "top";
- 51   };
- 52 
- 53   /* Override link properties to handle directedness and orientation. */
- 54   this.link
- 55       .data(function(p) {
- 56           var s = p.sourceNode, t = p.targetNode;
- 57           return reverse != (directed || (s.breadth < t.breadth)) ? [s, t] : [t, s];
- 58         })
- 59       .interpolate(function() { return interpolate; });
- 60 };
- 61 
- 62 pv.Layout.Arc.prototype = pv.extend(pv.Layout.Network)
- 63     .property("orient", String)
- 64     .property("directed", Boolean);
- 65 
- 66 /**
- 67  * Default properties for arc layouts. By default, the orientation is "bottom".
- 68  *
- 69  * @type pv.Layout.Arc
- 70  */
- 71 pv.Layout.Arc.prototype.defaults = new pv.Layout.Arc()
- 72     .extend(pv.Layout.Network.prototype.defaults)
- 73     .orient("bottom");
- 74 
- 75 /**
- 76  * Specifies an optional sort function. The sort function follows the same
- 77  * comparator contract required by {@link pv.Dom.Node#sort}. Specifying a sort
- 78  * function provides an alternative to sort the nodes as they are specified by
- 79  * the <tt>nodes</tt> property; the main advantage of doing this is that the
- 80  * comparator function can access implicit fields populated by the network
- 81  * layout, such as the <tt>linkDegree</tt>.
- 82  *
- 83  * <p>Note that arc diagrams are particularly sensitive to order. This is
- 84  * referred to as the seriation problem, and many different techniques exist to
- 85  * find good node orders that emphasize clusters, such as spectral layout and
- 86  * simulated annealing.
- 87  *
- 88  * @param {function} f comparator function for nodes.
- 89  * @returns {pv.Layout.Arc} this.
- 90  */
- 91 pv.Layout.Arc.prototype.sort = function(f) {
- 92   this.$sort = f;
- 93   return this;
- 94 };
- 95 
- 96 /** @private Populates the x, y and angle attributes on the nodes. */
- 97 pv.Layout.Arc.prototype.buildImplied = function(s) {
- 98   if (pv.Layout.Network.prototype.buildImplied.call(this, s)) return;
- 99 
-100   var nodes = s.nodes,
-101       orient = s.orient,
-102       sort = this.$sort,
-103       index = pv.range(nodes.length),
-104       w = s.width,
-105       h = s.height,
-106       r = Math.min(w, h) / 2;
-107 
-108   /* Sort the nodes. */
-109   if (sort) index.sort(function(a, b) { return sort(nodes[a], nodes[b]); });
-110 
-111   /** @private Returns the mid-angle, given the breadth. */
-112   function midAngle(b) {
-113     switch (orient) {
-114       case "top": return -Math.PI / 2;
-115       case "bottom": return Math.PI / 2;
-116       case "left": return Math.PI;
-117       case "right": return 0;
-118       case "radial": return (b - .25) * 2 * Math.PI;
-119     }
-120   }
-121 
-122   /** @private Returns the x-position, given the breadth. */
-123   function x(b) {
-124     switch (orient) {
-125       case "top":
-126       case "bottom": return b * w;
-127       case "left": return 0;
-128       case "right": return w;
-129       case "radial": return w / 2 + r * Math.cos(midAngle(b));
-130     }
-131   }
-132 
-133   /** @private Returns the y-position, given the breadth. */
-134   function y(b) {
-135     switch (orient) {
-136       case "top": return 0;
-137       case "bottom": return h;
-138       case "left":
-139       case "right": return b * h;
-140       case "radial": return h / 2 + r * Math.sin(midAngle(b));
-141     }
-142   }
-143 
-144   /* Populate the x, y and mid-angle attributes. */
-145   for (var i = 0; i < nodes.length; i++) {
-146     var n = nodes[index[i]], b = n.breadth = (i + .5) / nodes.length;
-147     n.x = x(b);
-148     n.y = y(b);
-149     n.midAngle = midAngle(b);
-150   }
-151 };
-152 
-153 /**
-154  * The orientation. The default orientation is "left", which means that nodes
-155  * will be positioned from left-to-right in the order they are specified in the
-156  * <tt>nodes</tt> property. The following orientations are supported:<ul>
-157  *
-158  * <li>left - left-to-right.
-159  * <li>right - right-to-left.
-160  * <li>top - top-to-bottom.
-161  * <li>bottom - bottom-to-top.
-162  * <li>radial - radially, starting at 12 o'clock and proceeding clockwise.</ul>
-163  *
-164  * @type string
-165  * @name pv.Layout.Arc.prototype.orient
-166  */
-167 
-168 /**
-169  * Whether this arc digram is directed (bidirectional); only applies to
-170  * non-radial orientations. By default, arc digrams are undirected, such that
-171  * all arcs appear on one side. If the arc digram is directed, then forward
-172  * links are drawn on the conventional side (the same as as undirected
-173  * links--right, left, bottom and top for left, right, top and bottom,
-174  * respectively), while reverse links are drawn on the opposite side.
-175  *
-176  * @type boolean
-177  * @name pv.Layout.Arc.prototype.directed
-178  */
-179 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Bullet.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Bullet.js.html deleted file mode 100644 index 6b312db8..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Bullet.js.html +++ /dev/null @@ -1,172 +0,0 @@ -
  1 // ranges (bad, satisfactory, good)
-  2 // measures (actual, forecast)
-  3 // markers (previous, goal)
-  4 
-  5 /*
-  6  * Chart design based on the recommendations of Stephen Few. Implementation
-  7  * based on the work of Clint Ivy, Jamie Love, and Jason Davies.
-  8  * http://projects.instantcognition.com/protovis/bulletchart/
-  9  */
- 10 
- 11 /**
- 12  * Constructs a new, empty bullet layout. Layouts are not typically constructed
- 13  * directly; instead, they are added to an existing panel via
- 14  * {@link pv.Mark#add}.
- 15  *
- 16  * @class
- 17  * @extends pv.Layout
- 18  */
- 19 pv.Layout.Bullet = function() {
- 20   pv.Layout.call(this);
- 21   var that = this,
- 22       buildImplied = that.buildImplied,
- 23       scale = that.x = pv.Scale.linear(),
- 24       orient,
- 25       horizontal,
- 26       rangeColor,
- 27       measureColor,
- 28       x;
- 29 
- 30   /** @private Cache layout state to optimize properties. */
- 31   this.buildImplied = function(s) {
- 32     buildImplied.call(this, x = s);
- 33     orient = s.orient;
- 34     horizontal = /^left|right$/.test(orient);
- 35     rangeColor = pv.ramp("#bbb", "#eee")
- 36         .domain(0, Math.max(1, x.ranges.length - 1));
- 37     measureColor = pv.ramp("steelblue", "lightsteelblue")
- 38         .domain(0, Math.max(1, x.measures.length - 1));
- 39   };
- 40 
- 41   /**
- 42    * The range prototype.
- 43    *
- 44    * @type pv.Mark
- 45    * @name pv.Layout.Bullet.prototype.range
- 46    */
- 47   (this.range = new pv.Mark())
- 48       .data(function() { return x.ranges; })
- 49       .reverse(true)
- 50       .left(function() { return orient == "left" ? 0 : null; })
- 51       .top(function() { return orient == "top" ? 0 : null; })
- 52       .right(function() { return orient == "right" ? 0 : null; })
- 53       .bottom(function() { return orient == "bottom" ? 0 : null; })
- 54       .width(function(d) { return horizontal ? scale(d) : null; })
- 55       .height(function(d) { return horizontal ? null : scale(d); })
- 56       .fillStyle(function() { return rangeColor(this.index); })
- 57       .antialias(false)
- 58       .parent = that;
- 59 
- 60   /**
- 61    * The measure prototype.
- 62    *
- 63    * @type pv.Mark
- 64    * @name pv.Layout.Bullet.prototype.measure
- 65    */
- 66   (this.measure = new pv.Mark())
- 67       .extend(this.range)
- 68       .data(function() { return x.measures; })
- 69       .left(function() { return orient == "left" ? 0 : horizontal ? null : this.parent.width() / 3.25; })
- 70       .top(function() { return orient == "top" ? 0 : horizontal ? this.parent.height() / 3.25 : null; })
- 71       .right(function() { return orient == "right" ? 0 : horizontal ? null : this.parent.width() / 3.25; })
- 72       .bottom(function() { return orient == "bottom" ? 0 : horizontal ? this.parent.height() / 3.25 : null; })
- 73       .fillStyle(function() { return measureColor(this.index); })
- 74       .parent = that;
- 75 
- 76   /**
- 77    * The marker prototype.
- 78    *
- 79    * @type pv.Mark
- 80    * @name pv.Layout.Bullet.prototype.marker
- 81    */
- 82   (this.marker = new pv.Mark())
- 83       .data(function() { return x.markers; })
- 84       .left(function(d) { return orient == "left" ? scale(d) : horizontal ? null : this.parent.width() / 2; })
- 85       .top(function(d) { return orient == "top" ? scale(d) : horizontal ? this.parent.height() / 2 : null; })
- 86       .right(function(d) { return orient == "right" ? scale(d) : null; })
- 87       .bottom(function(d) { return orient == "bottom" ? scale(d) : null; })
- 88       .strokeStyle("black")
- 89       .shape("bar")
- 90       .angle(function() { return horizontal ? 0 : Math.PI / 2; })
- 91       .parent = that;
- 92 
- 93   (this.tick = new pv.Mark())
- 94       .data(function() { return scale.ticks(7); })
- 95       .left(function(d) { return orient == "left" ? scale(d) : null; })
- 96       .top(function(d) { return orient == "top" ? scale(d) : null; })
- 97       .right(function(d) { return orient == "right" ? scale(d) : horizontal ? null : -6; })
- 98       .bottom(function(d) { return orient == "bottom" ? scale(d) : horizontal ? -8 : null; })
- 99       .height(function() { return horizontal ? 6 : null; })
-100       .width(function() { return horizontal ? null : 6; })
-101       .parent = that;
-102 };
-103 
-104 pv.Layout.Bullet.prototype = pv.extend(pv.Layout)
-105     .property("orient", String) // left, right, top, bottom
-106     .property("ranges")
-107     .property("markers")
-108     .property("measures")
-109     .property("maximum", Number);
-110 
-111 /**
-112  * Default properties for bullet layouts.
-113  *
-114  * @type pv.Layout.Bullet
-115  */
-116 pv.Layout.Bullet.prototype.defaults = new pv.Layout.Bullet()
-117     .extend(pv.Layout.prototype.defaults)
-118     .orient("left")
-119     .ranges([])
-120     .markers([])
-121     .measures([]);
-122 
-123 /**
-124  * The orientation.
-125  *
-126  * @type string
-127  * @name pv.Layout.Bullet.prototype.orient
-128  */
-129 
-130 /**
-131  * The array of range values.
-132  *
-133  * @type array
-134  * @name pv.Layout.Bullet.prototype.ranges
-135  */
-136 
-137 /**
-138  * The array of marker values.
-139  *
-140  * @type array
-141  * @name pv.Layout.Bullet.prototype.markers
-142  */
-143 
-144 /**
-145  * The array of measure values.
-146  *
-147  * @type array
-148  * @name pv.Layout.Bullet.prototype.measures
-149  */
-150 
-151 /**
-152  * Optional; the maximum range value.
-153  *
-154  * @type number
-155  * @name pv.Layout.Bullet.prototype.maximum
-156  */
-157 
-158 /** @private */
-159 pv.Layout.Bullet.prototype.buildImplied = function(s) {
-160   pv.Layout.prototype.buildImplied.call(this, s);
-161   var size = this.parent[/^left|right$/.test(s.orient) ? "width" : "height"]();
-162   s.maximum = s.maximum || pv.max([].concat(s.ranges, s.markers, s.measures));
-163   this.x.domain(0, s.maximum).range(0, size);
-164 };
-165 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Cluster.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Cluster.js.html deleted file mode 100644 index 5425330c..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Cluster.js.html +++ /dev/null @@ -1,213 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty cluster layout. Layouts are not typically
-  3  * constructed directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Implements a hierarchical layout using the cluster (or dendrogram)
-  7  * algorithm. This layout provides both node-link and space-filling
-  8  * implementations of cluster diagrams. In many ways it is similar to
-  9  * {@link pv.Layout.Partition}, except that leaf nodes are positioned at maximum
- 10  * depth, and the depth of internal nodes is based on their distance from their
- 11  * deepest descendant, rather than their distance from the root.
- 12  *
- 13  * <p>The cluster layout supports a "group" property, which if true causes
- 14  * siblings to be positioned closer together than unrelated nodes at the same
- 15  * depth. Unlike the partition layout, this layout does not support dynamic
- 16  * sizing for leaf nodes; all leaf nodes are the same size.
- 17  *
- 18  * <p>For more details on how to use this layout, see
- 19  * {@link pv.Layout.Hierarchy}.
- 20  *
- 21  * @see pv.Layout.Cluster.Fill
- 22  * @extends pv.Layout.Hierarchy
- 23  */
- 24 pv.Layout.Cluster = function() {
- 25   pv.Layout.Hierarchy.call(this);
- 26   var interpolate, // cached interpolate
- 27       buildImplied = this.buildImplied;
- 28 
- 29   /** @private Cache layout state to optimize properties. */
- 30   this.buildImplied = function(s) {
- 31     buildImplied.call(this, s);
- 32     interpolate
- 33         = /^(top|bottom)$/.test(s.orient) ? "step-before"
- 34         : /^(left|right)$/.test(s.orient) ? "step-after"
- 35         : "linear";
- 36   };
- 37 
- 38   this.link.interpolate(function() { return interpolate; });
- 39 };
- 40 
- 41 pv.Layout.Cluster.prototype = pv.extend(pv.Layout.Hierarchy)
- 42     .property("group", Number)
- 43     .property("orient", String)
- 44     .property("innerRadius", Number)
- 45     .property("outerRadius", Number);
- 46 
- 47 /**
- 48  * The group parameter; defaults to 0, disabling grouping of siblings. If this
- 49  * parameter is set to a positive number (or true, which is equivalent to 1),
- 50  * then additional space will be allotted between sibling groups. In other
- 51  * words, siblings (nodes that share the same parent) will be positioned more
- 52  * closely than nodes at the same depth that do not share a parent.
- 53  *
- 54  * @type number
- 55  * @name pv.Layout.Cluster.prototype.group
- 56  */
- 57 
- 58 /**
- 59  * The orientation. The default orientation is "top", which means that the root
- 60  * node is placed on the top edge, leaf nodes appear on the bottom edge, and
- 61  * internal nodes are in-between. The following orientations are supported:<ul>
- 62  *
- 63  * <li>left - left-to-right.
- 64  * <li>right - right-to-left.
- 65  * <li>top - top-to-bottom.
- 66  * <li>bottom - bottom-to-top.
- 67  * <li>radial - radially, with the root at the center.</ul>
- 68  *
- 69  * @type string
- 70  * @name pv.Layout.Cluster.prototype.orient
- 71  */
- 72 
- 73 /**
- 74  * The inner radius; defaults to 0. This property applies only to radial
- 75  * orientations, and can be used to compress the layout radially. Note that for
- 76  * the node-link implementation, the root node is always at the center,
- 77  * regardless of the value of this property; this property only affects internal
- 78  * and leaf nodes. For the space-filling implementation, a non-zero value of
- 79  * this property will result in the root node represented as a ring rather than
- 80  * a circle.
- 81  *
- 82  * @type number
- 83  * @name pv.Layout.Cluster.prototype.innerRadius
- 84  */
- 85 
- 86 /**
- 87  * The outer radius; defaults to fill the containing panel, based on the height
- 88  * and width of the layout. If the layout has no height and width specified, it
- 89  * will extend to fill the enclosing panel.
- 90  *
- 91  * @type number
- 92  * @name pv.Layout.Cluster.prototype.outerRadius
- 93  */
- 94 
- 95 /**
- 96  * Defaults for cluster layouts. The default group parameter is 0 and the
- 97  * default orientation is "top".
- 98  *
- 99  * @type pv.Layout.Cluster
-100  */
-101 pv.Layout.Cluster.prototype.defaults = new pv.Layout.Cluster()
-102     .extend(pv.Layout.Hierarchy.prototype.defaults)
-103     .group(0)
-104     .orient("top");
-105 
-106 /** @private */
-107 pv.Layout.Cluster.prototype.buildImplied = function(s) {
-108   if (pv.Layout.Hierarchy.prototype.buildImplied.call(this, s)) return;
-109 
-110   var root = s.nodes[0],
-111       group = s.group,
-112       breadth,
-113       depth,
-114       leafCount = 0,
-115       leafIndex = .5 - group / 2;
-116 
-117   /* Count the leaf nodes and compute the depth of descendants. */
-118   var p = undefined;
-119   root.visitAfter(function(n) {
-120       if (n.firstChild) {
-121         n.depth = 1 + pv.max(n.childNodes, function(n) { return n.depth; });
-122       } else {
-123         if (group && (p != n.parentNode)) {
-124           p = n.parentNode;
-125           leafCount += group;
-126         }
-127         leafCount++;
-128         n.depth = 0;
-129       }
-130     });
-131   breadth = 1 / leafCount;
-132   depth = 1 / root.depth;
-133 
-134   /* Compute the unit breadth and depth of each node. */
-135   var p = undefined;
-136   root.visitAfter(function(n) {
-137       if (n.firstChild) {
-138         n.breadth = pv.mean(n.childNodes, function(n) { return n.breadth; });
-139       } else {
-140         if (group && (p != n.parentNode)) {
-141           p = n.parentNode;
-142           leafIndex += group;
-143         }
-144         n.breadth = breadth * leafIndex++;
-145       }
-146       n.depth = 1 - n.depth * depth;
-147     });
-148 
-149   /* Compute breadth and depth ranges for space-filling layouts. */
-150   root.visitAfter(function(n) {
-151       n.minBreadth = n.firstChild
-152           ? n.firstChild.minBreadth
-153           : (n.breadth - breadth / 2);
-154       n.maxBreadth = n.firstChild
-155           ? n.lastChild.maxBreadth
-156           : (n.breadth + breadth / 2);
-157     });
-158   root.visitBefore(function(n) {
-159       n.minDepth = n.parentNode
-160           ? n.parentNode.maxDepth
-161           : 0;
-162       n.maxDepth = n.parentNode
-163           ? (n.depth + root.depth)
-164           : (n.minDepth + 2 * root.depth);
-165     });
-166   root.minDepth = -depth;
-167 
-168   pv.Layout.Hierarchy.NodeLink.buildImplied.call(this, s);
-169 };
-170 
-171 /**
-172  * Constructs a new, empty space-filling cluster layout. Layouts are not
-173  * typically constructed directly; instead, they are added to an existing panel
-174  * via {@link pv.Mark#add}.
-175  *
-176  * @class A variant of cluster layout that is space-filling. The meaning of the
-177  * exported mark prototypes changes slightly in the space-filling
-178  * implementation:<ul>
-179  *
-180  * <li><tt>node</tt> - for rendering nodes; typically a {@link pv.Bar} for
-181  * non-radial orientations, and a {@link pv.Wedge} for radial orientations.
-182  *
-183  * <p><li><tt>link</tt> - unsupported; undefined. Links are encoded implicitly
-184  * in the arrangement of the space-filling nodes.
-185  *
-186  * <p><li><tt>label</tt> - for rendering node labels; typically a
-187  * {@link pv.Label}.
-188  *
-189  * </ul>For more details on how to use this layout, see
-190  * {@link pv.Layout.Cluster}.
-191  *
-192  * @extends pv.Layout.Cluster
-193  */
-194 pv.Layout.Cluster.Fill = function() {
-195   pv.Layout.Cluster.call(this);
-196   pv.Layout.Hierarchy.Fill.constructor.call(this);
-197 };
-198 
-199 pv.Layout.Cluster.Fill.prototype = pv.extend(pv.Layout.Cluster);
-200 
-201 /** @private */
-202 pv.Layout.Cluster.Fill.prototype.buildImplied = function(s) {
-203   if (pv.Layout.Cluster.prototype.buildImplied.call(this, s)) return;
-204   pv.Layout.Hierarchy.Fill.buildImplied.call(this, s);
-205 };
-206 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Force.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Force.js.html deleted file mode 100644 index 4245982f..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Force.js.html +++ /dev/null @@ -1,317 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty force-directed layout. Layouts are not typically
-  3  * constructed directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Implements force-directed network layout as a node-link diagram. This
-  7  * layout uses the Fruchterman-Reingold algorithm, which applies an attractive
-  8  * spring force between neighboring nodes, and a repulsive electrical charge
-  9  * force between all nodes. An additional drag force improves stability of the
- 10  * simulation. See {@link pv.Force.spring}, {@link pv.Force.drag} and {@link
- 11  * pv.Force.charge} for more details; note that the n-body charge force is
- 12  * approximated using the Barnes-Hut algorithm.
- 13  *
- 14  * <p>This layout is implemented on top of {@link pv.Simulation}, which can be
- 15  * used directly for more control over simulation parameters. The simulation
- 16  * uses Position Verlet integration, which does not compute velocities
- 17  * explicitly, but allows for easy geometric constraints, such as bounding the
- 18  * nodes within the layout panel. Many of the configuration properties supported
- 19  * by this layout are simply passed through to the underlying forces and
- 20  * constraints of the simulation.
- 21  *
- 22  * <p>Force layouts are typically interactive. The gradual movement of the nodes
- 23  * as they stabilize to a local stress minimum can help reveal the structure of
- 24  * the network, as can {@link pv.Behavior.drag}, which allows the user to pick
- 25  * up nodes and reposition them while the physics simulation continues. This
- 26  * layout can also be used with pan & zoom behaviors for interaction.
- 27  *
- 28  * <p>To facilitate interaction, this layout by default automatically re-renders
- 29  * using a <tt>setInterval</tt> every 42 milliseconds. This can be disabled via
- 30  * the <tt>iterations</tt> property, which if non-null specifies the number of
- 31  * simulation iterations to run before the force-directed layout is finalized.
- 32  * Be careful not to use too high an iteration count, as this can lead to an
- 33  * annoying delay on page load.
- 34  *
- 35  * <p>As with other network layouts, the network data can be updated
- 36  * dynamically, provided the property cache is reset. See
- 37  * {@link pv.Layout.Network} for details. New nodes are initialized with random
- 38  * positions near the center. Alternatively, positions can be specified manually
- 39  * by setting the <tt>x</tt> and <tt>y</tt> attributes on nodes.
- 40  *
- 41  * @extends pv.Layout.Network
- 42  * @see <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.13.8444&rep=rep1&type=pdf"
- 43  * >"Graph Drawing by Force-directed Placement"</a> by T. Fruchterman &
- 44  * E. Reingold, Software--Practice & Experience, November 1991.
- 45  */
- 46 pv.Layout.Force = function() {
- 47   pv.Layout.Network.call(this);
- 48 
- 49   /* Force-directed graphs can be messy, so reduce the link width. */
- 50   this.link.lineWidth(function(d, p) { return Math.sqrt(p.linkValue) * 1.5; });
- 51   this.label.textAlign("center");
- 52 };
- 53 
- 54 pv.Layout.Force.prototype = pv.extend(pv.Layout.Network)
- 55     .property("bound", Boolean)
- 56     .property("iterations", Number)
- 57     .property("dragConstant", Number)
- 58     .property("chargeConstant", Number)
- 59     .property("chargeMinDistance", Number)
- 60     .property("chargeMaxDistance", Number)
- 61     .property("chargeTheta", Number)
- 62     .property("springConstant", Number)
- 63     .property("springDamping", Number)
- 64     .property("springLength", Number);
- 65 
- 66 /**
- 67  * The bound parameter; true if nodes should be constrained within the layout
- 68  * panel. Bounding is disabled by default. Currently the layout does not observe
- 69  * the radius of the nodes; strictly speaking, only the center of the node is
- 70  * constrained to be within the panel, with an additional 6-pixel offset for
- 71  * padding. A future enhancement could extend the bound constraint to observe
- 72  * the node's radius, which would also support bounding for variable-size nodes.
- 73  *
- 74  * <p>Note that if this layout is used in conjunction with pan & zoom
- 75  * behaviors, those behaviors should have their bound parameter set to the same
- 76  * value.
- 77  *
- 78  * @type boolean
- 79  * @name pv.Layout.Force.prototype.bound
- 80  */
- 81 
- 82 /**
- 83  * The number of simulation iterations to run, or null if this layout is
- 84  * interactive. Force-directed layouts are interactive by default, using a
- 85  * <tt>setInterval</tt> to advance the physics simulation and re-render
- 86  * automatically.
- 87  *
- 88  * @type number
- 89  * @name pv.Layout.Force.prototype.iterations
- 90  */
- 91 
- 92 /**
- 93  * The drag constant, in the range [0,1]. A value of 0 means no drag (a
- 94  * perfectly frictionless environment), while a value of 1 means friction
- 95  * immediately cancels all momentum. The default value is 0.1, which provides a
- 96  * minimum amount of drag that helps stabilize bouncy springs; lower values may
- 97  * result in excessive bounciness, while higher values cause the simulation to
- 98  * take longer to converge.
- 99  *
-100  * @type number
-101  * @name pv.Layout.Force.prototype.dragConstant
-102  * @see pv.Force.drag#constant
-103  */
-104 
-105 /**
-106  * The charge constant, which should be a negative number. The default value is
-107  * -40; more negative values will result in a stronger repulsive force, which
-108  * may lead to faster convergence at the risk of instability. Too strong
-109  * repulsive charge forces can cause comparatively weak springs to be stretched
-110  * well beyond their rest length, emphasizing global structure over local
-111  * structure. A nonnegative value will break the Fruchterman-Reingold algorithm,
-112  * and is for entertainment purposes only.
-113  *
-114  * @type number
-115  * @name pv.Layout.Force.prototype.chargeConstant
-116  * @see pv.Force.charge#constant
-117  */
-118 
-119 /**
-120  * The minimum distance at which charge forces are applied. The default minimum
-121  * distance of 2 avoids applying forces that are two strong; because the physics
-122  * simulation is run at discrete time intervals, it is possible for two same-
-123  * charged particles to become very close or even a singularity! Since the
-124  * charge force is inversely proportional to the square of the distance, very
-125  * small distances can break the simulation.
-126  *
-127  * <p>In rare cases, two particles can become stuck on top of each other, as a
-128  * minimum distance threshold will prevent the charge force from repelling them.
-129  * However, this occurs very rarely because other forces and momentum typically
-130  * cause the particles to become separated again, at which point the repulsive
-131  * charge force kicks in.
-132  *
-133  * @type number
-134  * @name pv.Layout.Force.prototype.chargeMinDistance
-135  * @see pv.Force.charge#domain
-136  */
-137 
-138 /**
-139  * The maximum distance at which charge forces are applied. This improves
-140  * performance by ignoring weak charge forces at great distances. Note that this
-141  * parameter is partly redundant, as the Barnes-Hut algorithm for n-body forces
-142  * already improves performance for far-away particles through approximation.
-143  *
-144  * @type number
-145  * @name pv.Layout.Force.prototype.chargeMaxDistance
-146  * @see pv.Force.charge#domain
-147  */
-148 
-149 /**
-150  * The Barnes-Hut approximation factor. The Barnes-Hut approximation criterion
-151  * is the ratio of the size of the quadtree node to the distance from the point
-152  * to the node's center of mass is beneath some threshold. The default value is
-153  * 0.9.
-154  *
-155  * @type number
-156  * @name pv.Layout.Force.prototype.chargeTheta
-157  * @see pv.Force.charge#theta
-158  */
-159 
-160 /**
-161  * The spring constant, which should be a positive number. The default value is
-162  * 0.1; greater values will result in a stronger attractive force, which may
-163  * lead to faster convergence at the risk of instability. Too strong spring
-164  * forces can cause comparatively weak charge forces to be ignored, emphasizing
-165  * local structure over global structure. A nonpositive value will break the
-166  * Fruchterman-Reingold algorithm, and is for entertainment purposes only.
-167  *
-168  * <p>The spring tension is automatically normalized using the inverse square
-169  * root of the maximum link degree of attached nodes.
-170  *
-171  * @type number
-172  * @name pv.Layout.Force.prototype.springConstant
-173  * @see pv.Force.spring#constant
-174  */
-175 
-176 /**
-177  * The spring damping factor, in the range [0,1]. Damping functions identically
-178  * to drag forces, damping spring bounciness by applying a force in the opposite
-179  * direction of attached nodes' velocities. The default value is 0.3.
-180  *
-181  * <p>The spring damping is automatically normalized using the inverse square
-182  * root of the maximum link degree of attached nodes.
-183  *
-184  * @type number
-185  * @name pv.Layout.Force.prototype.springDamping
-186  * @see pv.Force.spring#damping
-187  */
-188 
-189 /**
-190  * The spring rest length. The default value is 20 pixels. Larger values may be
-191  * appropriate if the layout panel is larger, or if the nodes are rendered
-192  * larger than the default dot size of 20.
-193  *
-194  * @type number
-195  * @name pv.Layout.Force.prototype.springLength
-196  * @see pv.Force.spring#length
-197  */
-198 
-199 /**
-200  * Default properties for force-directed layouts. The default drag constant is
-201  * 0.1, the default charge constant is -40 (with a domain of [2, 500] and theta
-202  * of 0.9), and the default spring constant is 0.1 (with a damping of 0.3 and a
-203  * rest length of 20).
-204  *
-205  * @type pv.Layout.Force
-206  */
-207 pv.Layout.Force.prototype.defaults = new pv.Layout.Force()
-208     .extend(pv.Layout.Network.prototype.defaults)
-209     .dragConstant(.1)
-210     .chargeConstant(-40)
-211     .chargeMinDistance(2)
-212     .chargeMaxDistance(500)
-213     .chargeTheta(.9)
-214     .springConstant(.1)
-215     .springDamping(.3)
-216     .springLength(20);
-217 
-218 /** @private Initialize the physics simulation. */
-219 pv.Layout.Force.prototype.buildImplied = function(s) {
-220 
-221   /* Any cached interactive layouts need to be rebound for the timer. */
-222   if (pv.Layout.Network.prototype.buildImplied.call(this, s)) {
-223     var f = s.$force;
-224     if (f) {
-225       f.next = this.binds.$force;
-226       this.binds.$force = f;
-227     }
-228     return;
-229   }
-230 
-231   var that = this,
-232       nodes = s.nodes,
-233       links = s.links,
-234       k = s.iterations,
-235       w = s.width,
-236       h = s.height;
-237 
-238   /* Initialize positions randomly near the center. */
-239   for (var i = 0, n; i < nodes.length; i++) {
-240     n = nodes[i];
-241     if (isNaN(n.x)) n.x = w / 2 + 40 * Math.random() - 20;
-242     if (isNaN(n.y)) n.y = h / 2 + 40 * Math.random() - 20;
-243   }
-244 
-245   /* Initialize the simulation. */
-246   var sim = pv.simulation(nodes);
-247 
-248   /* Drag force. */
-249   sim.force(pv.Force.drag(s.dragConstant));
-250 
-251   /* Charge (repelling) force. */
-252   sim.force(pv.Force.charge(s.chargeConstant)
-253       .domain(s.chargeMinDistance, s.chargeMaxDistance)
-254       .theta(s.chargeTheta));
-255 
-256   /* Spring (attracting) force. */
-257   sim.force(pv.Force.spring(s.springConstant)
-258       .damping(s.springDamping)
-259       .length(s.springLength)
-260       .links(links));
-261 
-262   /* Position constraint (for interactive dragging). */
-263   sim.constraint(pv.Constraint.position());
-264 
-265   /* Optionally add bound constraint. TODO: better padding. */
-266   if (s.bound) {
-267     sim.constraint(pv.Constraint.bound().x(6, w - 6).y(6, h - 6));
-268   }
-269 
-270   /** @private Returns the speed of the given node, to determine cooling. */
-271   function speed(n) {
-272     return n.fix ? 1 : n.vx * n.vx + n.vy * n.vy;
-273   }
-274 
-275   /*
-276    * If the iterations property is null (the default), the layout is
-277    * interactive. The simulation is run until the fastest particle drops below
-278    * an arbitrary minimum speed. Although the timer keeps firing, this speed
-279    * calculation is fast so there is minimal CPU overhead. Note: if a particle
-280    * is fixed for interactivity, treat this as a high speed and resume
-281    * simulation.
-282    */
-283   if (k == null) {
-284     sim.step(); // compute initial previous velocities
-285     sim.step(); // compute initial velocities
-286 
-287     /* Add the simulation state to the bound list. */
-288     var force = s.$force = this.binds.$force = {
-289       next: this.binds.$force,
-290       nodes: nodes,
-291       min: 1e-4 * (links.length + 1),
-292       sim: sim
-293     };
-294 
-295     /* Start the timer, if not already started. */
-296     if (!this.$timer) this.$timer = setInterval(function() {
-297       var render = false;
-298       for (var f = that.binds.$force; f; f = f.next) {
-299         if (pv.max(f.nodes, speed) > f.min) {
-300           f.sim.step();
-301           render = true;
-302         }
-303       }
-304       if (render) that.render();
-305     }, 42);
-306   } else for (var i = 0; i < k; i++) {
-307     sim.step();
-308   }
-309 };
-310 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Grid.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Grid.js.html deleted file mode 100644 index bdc13a4b..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Grid.js.html +++ /dev/null @@ -1,127 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty grid layout. Layouts are not typically constructed
-  3  * directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Implements a grid layout with regularly-sized rows and columns. The
-  7  * number of rows and columns are determined from their respective
-  8  * properties. For example, the 2×3 array:
-  9  *
- 10  * <pre>1 2 3
- 11  * 4 5 6</pre>
- 12  *
- 13  * can be represented using the <tt>rows</tt> property as:
- 14  *
- 15  * <pre>[[1, 2, 3], [4, 5, 6]]</pre>
- 16  *
- 17  * If your data is in column-major order, you can equivalently use the
- 18  * <tt>columns</tt> property. If the <tt>rows</tt> property is an array, it
- 19  * takes priority over the <tt>columns</tt> property. The data is implicitly
- 20  * transposed, as if the {@link pv.transpose} operator were applied.
- 21  *
- 22  * <p>This layout exports a single <tt>cell</tt> mark prototype, which is
- 23  * intended to be used with a bar, panel, layout, or subclass thereof. The data
- 24  * property of the cell prototype is defined as the elements in the array. For
- 25  * example, if the array is a two-dimensional array of values in the range
- 26  * [0,1], a simple heatmap can be generated as:
- 27  *
- 28  * <pre>vis.add(pv.Layout.Grid)
- 29  *     .rows(arrays)
- 30  *   .cell.add(pv.Bar)
- 31  *     .fillStyle(pv.ramp("white", "black"))</pre>
- 32  *
- 33  * The grid subdivides the full width and height of the parent panel into equal
- 34  * rectangles. Note, however, that for large, interactive, or animated heatmaps,
- 35  * you may see significantly better performance through dynamic {@link pv.Image}
- 36  * generation.
- 37  *
- 38  * <p>For irregular grids using value-based spatial partitioning, see {@link
- 39  * pv.Layout.Treemap}.
- 40  *
- 41  * @extends pv.Layout
- 42  */
- 43 pv.Layout.Grid = function() {
- 44   pv.Layout.call(this);
- 45   var that = this;
- 46 
- 47   /**
- 48    * The cell prototype. This prototype is intended to be used with a bar,
- 49    * panel, or layout (or subclass thereof) to render the grid cells.
- 50    *
- 51    * @type pv.Mark
- 52    * @name pv.Layout.Grid.prototype.cell
- 53    */
- 54   (this.cell = new pv.Mark()
- 55       .data(function() {
- 56           return that.scene[that.index].$grid;
- 57         })
- 58       .width(function() {
- 59           return that.width() / that.cols();
- 60         })
- 61       .height(function() {
- 62           return that.height() / that.rows();
- 63         })
- 64       .left(function() {
- 65           return this.width() * (this.index % that.cols());
- 66         })
- 67       .top(function() {
- 68           return this.height() * Math.floor(this.index / that.cols());
- 69         })).parent = this;
- 70 };
- 71 
- 72 pv.Layout.Grid.prototype = pv.extend(pv.Layout)
- 73     .property("rows")
- 74     .property("cols");
- 75 
- 76 /**
- 77  * Default properties for grid layouts. By default, there is one row and one
- 78  * column, and the data is the propagated to the child cell.
- 79  *
- 80  * @type pv.Layout.Grid
- 81  */
- 82 pv.Layout.Grid.prototype.defaults = new pv.Layout.Grid()
- 83     .extend(pv.Layout.prototype.defaults)
- 84     .rows(1)
- 85     .cols(1);
- 86 
- 87 /** @private */
- 88 pv.Layout.Grid.prototype.buildImplied = function(s) {
- 89   pv.Layout.prototype.buildImplied.call(this, s);
- 90   var r = s.rows, c = s.cols;
- 91   if (typeof c == "object") r = pv.transpose(c);
- 92   if (typeof r == "object") {
- 93     s.$grid = pv.blend(r);
- 94     s.rows = r.length;
- 95     s.cols = r[0] ? r[0].length : 0;
- 96   } else {
- 97     s.$grid = pv.repeat([s.data], r * c);
- 98   }
- 99 };
-100 
-101 /**
-102  * The number of rows. This property can also be specified as the data in
-103  * row-major order; in this case, the rows property is implicitly set to the
-104  * length of the array, and the cols property is set to the length of the first
-105  * element in the array.
-106  *
-107  * @type number
-108  * @name pv.Layout.Grid.prototype.rows
-109  */
-110 
-111 /**
-112  * The number of columns. This property can also be specified as the data in
-113  * column-major order; in this case, the cols property is implicitly set to the
-114  * length of the array, and the rows property is set to the length of the first
-115  * element in the array.
-116  *
-117  * @type number
-118  * @name pv.Layout.Grid.prototype.cols
-119  */
-120 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Hierarchy.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Hierarchy.js.html deleted file mode 100644 index 269ee49d..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Hierarchy.js.html +++ /dev/null @@ -1,257 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty hierarchy layout. Layouts are not typically
-  3  * constructed directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Represents an abstract layout for hierarchy diagrams. This class is a
-  7  * specialization of {@link pv.Layout.Network}, providing the basic structure
-  8  * for both hierarchical node-link diagrams (such as Reingold-Tilford trees) and
-  9  * space-filling hierarchy diagrams (such as sunbursts and treemaps).
- 10  *
- 11  * <p>Unlike general network layouts, the <tt>links</tt> property need not be
- 12  * defined explicitly. Instead, the links are computed implicitly from the
- 13  * <tt>parentNode</tt> attribute of the node objects, as defined by the
- 14  * <tt>nodes</tt> property. This implementation is also available as
- 15  * {@link #links}, for reuse with non-hierarchical layouts; for example, to
- 16  * render a tree using force-directed layout.
- 17  *
- 18  * <p>Correspondingly, the <tt>nodes</tt> property is represented as a union of
- 19  * {@link pv.Layout.Network.Node} and {@link pv.Dom.Node}. To construct a node
- 20  * hierarchy from a simple JSON map, use the {@link pv.Dom} operator; this
- 21  * operator also provides an easy way to sort nodes before passing them to the
- 22  * layout.
- 23  *
- 24  * <p>For more details on how to use this layout, see
- 25  * {@link pv.Layout.Network}.
- 26  *
- 27  * @see pv.Layout.Cluster
- 28  * @see pv.Layout.Partition
- 29  * @see pv.Layout.Tree
- 30  * @see pv.Layout.Treemap
- 31  * @see pv.Layout.Indent
- 32  * @see pv.Layout.Pack
- 33  * @extends pv.Layout.Network
- 34  */
- 35 pv.Layout.Hierarchy = function() {
- 36   pv.Layout.Network.call(this);
- 37   this.link.strokeStyle("#ccc");
- 38 };
- 39 
- 40 pv.Layout.Hierarchy.prototype = pv.extend(pv.Layout.Network);
- 41 
- 42 /** @private Compute the implied links. (Links are null by default.) */
- 43 pv.Layout.Hierarchy.prototype.buildImplied = function(s) {
- 44   if (!s.links) s.links = pv.Layout.Hierarchy.links.call(this);
- 45   pv.Layout.Network.prototype.buildImplied.call(this, s);
- 46 };
- 47 
- 48 /** The implied links; computes links using the <tt>parentNode</tt> attribute. */
- 49 pv.Layout.Hierarchy.links = function() {
- 50   return this.nodes()
- 51       .filter(function(n) { return n.parentNode; })
- 52       .map(function(n) {
- 53           return {
- 54               sourceNode: n,
- 55               targetNode: n.parentNode,
- 56               linkValue: 1
- 57             };
- 58       });
- 59 };
- 60 
- 61 /** @private Provides standard node-link layout based on breadth & depth. */
- 62 pv.Layout.Hierarchy.NodeLink = {
- 63 
- 64   /** @private */
- 65   buildImplied: function(s) {
- 66     var nodes = s.nodes,
- 67         orient = s.orient,
- 68         horizontal = /^(top|bottom)$/.test(orient),
- 69         w = s.width,
- 70         h = s.height;
- 71 
- 72     /* Compute default inner and outer radius. */
- 73     if (orient == "radial") {
- 74       var ir = s.innerRadius, or = s.outerRadius;
- 75       if (ir == null) ir = 0;
- 76       if (or == null) or = Math.min(w, h) / 2;
- 77     }
- 78 
- 79     /** @private Returns the radius of the given node. */
- 80     function radius(n) {
- 81       return n.parentNode ? (n.depth * (or - ir) + ir) : 0;
- 82     }
- 83 
- 84     /** @private Returns the angle of the given node. */
- 85     function midAngle(n) {
- 86       return (n.parentNode ? (n.breadth - .25) * 2 * Math.PI : 0);
- 87     }
- 88 
- 89     /** @private */
- 90     function x(n) {
- 91       switch (orient) {
- 92         case "left": return n.depth * w;
- 93         case "right": return w - n.depth * w;
- 94         case "top": return n.breadth * w;
- 95         case "bottom": return w - n.breadth * w;
- 96         case "radial": return w / 2 + radius(n) * Math.cos(n.midAngle);
- 97       }
- 98     }
- 99 
-100     /** @private */
-101     function y(n) {
-102       switch (orient) {
-103         case "left": return n.breadth * h;
-104         case "right": return h - n.breadth * h;
-105         case "top": return n.depth * h;
-106         case "bottom": return h - n.depth * h;
-107         case "radial": return h / 2 + radius(n) * Math.sin(n.midAngle);
-108       }
-109     }
-110 
-111     for (var i = 0; i < nodes.length; i++) {
-112       var n = nodes[i];
-113       n.midAngle = orient == "radial" ? midAngle(n)
-114           : horizontal ? Math.PI / 2 : 0;
-115       n.x = x(n);
-116       n.y = y(n);
-117       if (n.firstChild) n.midAngle += Math.PI;
-118     }
-119   }
-120 };
-121 
-122 /** @private Provides standard space-filling layout based on breadth & depth. */
-123 pv.Layout.Hierarchy.Fill = {
-124 
-125   /** @private */
-126   constructor: function() {
-127     this.node
-128         .strokeStyle("#fff")
-129         .fillStyle("#ccc")
-130         .width(function(n) { return n.dx; })
-131         .height(function(n) { return n.dy; })
-132         .innerRadius(function(n) { return n.innerRadius; })
-133         .outerRadius(function(n) { return n.outerRadius; })
-134         .startAngle(function(n) { return n.startAngle; })
-135         .angle(function(n) { return n.angle; });
-136 
-137     this.label
-138         .textAlign("center")
-139         .left(function(n) { return n.x + (n.dx / 2); })
-140         .top(function(n) { return n.y + (n.dy / 2); });
-141 
-142     /* Hide unsupported link. */
-143     delete this.link;
-144   },
-145 
-146   /** @private */
-147   buildImplied: function(s) {
-148     var nodes = s.nodes,
-149         orient = s.orient,
-150         horizontal = /^(top|bottom)$/.test(orient),
-151         w = s.width,
-152         h = s.height,
-153         depth = -nodes[0].minDepth;
-154 
-155     /* Compute default inner and outer radius. */
-156     if (orient == "radial") {
-157       var ir = s.innerRadius, or = s.outerRadius;
-158       if (ir == null) ir = 0;
-159       if (ir) depth *= 2; // use full depth step for root
-160       if (or == null) or = Math.min(w, h) / 2;
-161     }
-162 
-163     /** @private Scales the specified depth for a space-filling layout. */
-164     function scale(d, depth) {
-165       return (d + depth) / (1 + depth);
-166     }
-167 
-168     /** @private */
-169     function x(n) {
-170       switch (orient) {
-171         case "left": return scale(n.minDepth, depth) * w;
-172         case "right": return (1 - scale(n.maxDepth, depth)) * w;
-173         case "top": return n.minBreadth * w;
-174         case "bottom": return (1 - n.maxBreadth) * w;
-175         case "radial": return w / 2;
-176       }
-177     }
-178 
-179     /** @private */
-180     function y(n) {
-181       switch (orient) {
-182         case "left": return n.minBreadth * h;
-183         case "right": return (1 - n.maxBreadth) * h;
-184         case "top": return scale(n.minDepth, depth) * h;
-185         case "bottom": return (1 - scale(n.maxDepth, depth)) * h;
-186         case "radial": return h / 2;
-187       }
-188     }
-189 
-190     /** @private */
-191     function dx(n) {
-192       switch (orient) {
-193         case "left":
-194         case "right": return (n.maxDepth - n.minDepth) / (1 + depth) * w;
-195         case "top":
-196         case "bottom": return (n.maxBreadth - n.minBreadth) * w;
-197         case "radial": return n.parentNode ? (n.innerRadius + n.outerRadius) * Math.cos(n.midAngle) : 0;
-198       }
-199     }
-200 
-201     /** @private */
-202     function dy(n) {
-203       switch (orient) {
-204         case "left":
-205         case "right": return (n.maxBreadth - n.minBreadth) * h;
-206         case "top":
-207         case "bottom": return (n.maxDepth - n.minDepth) / (1 + depth) * h;
-208         case "radial": return n.parentNode ? (n.innerRadius + n.outerRadius) * Math.sin(n.midAngle) : 0;
-209       }
-210     }
-211 
-212     /** @private */
-213     function innerRadius(n) {
-214       return Math.max(0, scale(n.minDepth, depth / 2)) * (or - ir) + ir;
-215     }
-216 
-217     /** @private */
-218     function outerRadius(n) {
-219       return scale(n.maxDepth, depth / 2) * (or - ir) + ir;
-220     }
-221 
-222     /** @private */
-223     function startAngle(n) {
-224       return (n.parentNode ? n.minBreadth - .25 : 0) * 2 * Math.PI;
-225     }
-226 
-227     /** @private */
-228     function angle(n) {
-229       return (n.parentNode ? n.maxBreadth - n.minBreadth : 1) * 2 * Math.PI;
-230     }
-231 
-232     for (var i = 0; i < nodes.length; i++) {
-233       var n = nodes[i];
-234       n.x = x(n);
-235       n.y = y(n);
-236       if (orient == "radial") {
-237         n.innerRadius = innerRadius(n);
-238         n.outerRadius = outerRadius(n);
-239         n.startAngle = startAngle(n);
-240         n.angle = angle(n);
-241         n.midAngle = n.startAngle + n.angle / 2;
-242       } else {
-243         n.midAngle = horizontal ? -Math.PI / 2 : 0;
-244       }
-245       n.dx = dx(n);
-246       n.dy = dy(n);
-247     }
-248   }
-249 };
-250 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Horizon.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Horizon.js.html deleted file mode 100644 index 0dcd31b9..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Horizon.js.html +++ /dev/null @@ -1,167 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty horizon layout. Layouts are not typically constructed
-  3  * directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Implements a horizon layout, which is a variation of a single-series
-  7  * area chart where the area is folded into multiple bands. Color is used to
-  8  * encode band, allowing the size of the chart to be reduced significantly
-  9  * without impeding readability. This layout algorithm is based on the work of
- 10  * J. Heer, N. Kong and M. Agrawala in <a
- 11  * href="http://hci.stanford.edu/publications/2009/heer-horizon-chi09.pdf">"Sizing
- 12  * the Horizon: The Effects of Chart Size and Layering on the Graphical
- 13  * Perception of Time Series Visualizations"</a>, CHI 2009.
- 14  *
- 15  * <p>This layout exports a single <tt>band</tt> mark prototype, which is
- 16  * intended to be used with an area mark. The band mark is contained in a panel
- 17  * which is replicated per band (and for negative/positive bands). For example,
- 18  * to create a simple horizon graph given an array of numbers:
- 19  *
- 20  * <pre>vis.add(pv.Layout.Horizon)
- 21  *     .bands(n)
- 22  *   .band.add(pv.Area)
- 23  *     .data(data)
- 24  *     .left(function() this.index * 35)
- 25  *     .height(function(d) d * 40);</pre>
- 26  *
- 27  * The layout can be further customized by changing the number of bands, and
- 28  * toggling whether the negative bands are mirrored or offset. (See the
- 29  * above-referenced paper for guidance.)
- 30  *
- 31  * <p>The <tt>fillStyle</tt> of the area can be overridden, though typically it
- 32  * is easier to customize the layout's behavior through the custom
- 33  * <tt>backgroundStyle</tt>, <tt>positiveStyle</tt> and <tt>negativeStyle</tt>
- 34  * properties. By default, the background is white, positive bands are blue, and
- 35  * negative bands are red. For the most accurate presentation, use fully-opaque
- 36  * colors of equal intensity for the negative and positive bands.
- 37  *
- 38  * @extends pv.Layout
- 39  */
- 40 pv.Layout.Horizon = function() {
- 41   pv.Layout.call(this);
- 42   var that = this,
- 43       bands, // cached bands
- 44       mode, // cached mode
- 45       size, // cached height
- 46       fill, // cached background style
- 47       red, // cached negative color (ramp)
- 48       blue, // cached positive color (ramp)
- 49       buildImplied = this.buildImplied;
- 50 
- 51   /** @private Cache the layout state to optimize properties. */
- 52   this.buildImplied = function(s) {
- 53     buildImplied.call(this, s);
- 54     bands = s.bands;
- 55     mode = s.mode;
- 56     size = Math.round((mode == "color" ? .5 : 1) * s.height);
- 57     fill = s.backgroundStyle;
- 58     red = pv.ramp(fill, s.negativeStyle).domain(0, bands);
- 59     blue = pv.ramp(fill, s.positiveStyle).domain(0, bands);
- 60   };
- 61 
- 62   var bands = new pv.Panel()
- 63       .data(function() { return pv.range(bands * 2); })
- 64       .overflow("hidden")
- 65       .height(function() { return size; })
- 66       .top(function(i) { return mode == "color" ? (i & 1) * size : 0; })
- 67       .fillStyle(function(i) { return i ? null : fill; });
- 68 
- 69   /**
- 70    * The band prototype. This prototype is intended to be used with an Area
- 71    * mark to render the horizon bands.
- 72    *
- 73    * @type pv.Mark
- 74    * @name pv.Layout.Horizon.prototype.band
- 75    */
- 76   this.band = new pv.Mark()
- 77       .top(function(d, i) {
- 78           return mode == "mirror" && i & 1
- 79               ? (i + 1 >> 1) * size
- 80               : null;
- 81         })
- 82       .bottom(function(d, i) {
- 83           return mode == "mirror"
- 84               ? (i & 1 ? null : (i + 1 >> 1) * -size)
- 85               : ((i & 1 || -1) * (i + 1 >> 1) * size);
- 86         })
- 87       .fillStyle(function(d, i) {
- 88           return (i & 1 ? red : blue)((i >> 1) + 1);
- 89         });
- 90 
- 91   this.band.add = function(type) {
- 92     return that.add(pv.Panel).extend(bands).add(type).extend(this);
- 93   };
- 94 };
- 95 
- 96 pv.Layout.Horizon.prototype = pv.extend(pv.Layout)
- 97     .property("bands", Number)
- 98     .property("mode", String)
- 99     .property("backgroundStyle", pv.color)
-100     .property("positiveStyle", pv.color)
-101     .property("negativeStyle", pv.color);
-102 
-103 /**
-104  * Default properties for horizon layouts. By default, there are two bands, the
-105  * mode is "offset", the background style is "white", the positive style is
-106  * blue, negative style is red.
-107  *
-108  * @type pv.Layout.Horizon
-109  */
-110 pv.Layout.Horizon.prototype.defaults = new pv.Layout.Horizon()
-111     .extend(pv.Layout.prototype.defaults)
-112     .bands(2)
-113     .mode("offset")
-114     .backgroundStyle("white")
-115     .positiveStyle("#1f77b4")
-116     .negativeStyle("#d62728");
-117 
-118 /**
-119  * The horizon mode: offset, mirror, or color. The default is "offset".
-120  *
-121  * @type string
-122  * @name pv.Layout.Horizon.prototype.mode
-123  */
-124 
-125 /**
-126  * The number of bands. Must be at least one. The default value is two.
-127  *
-128  * @type number
-129  * @name pv.Layout.Horizon.prototype.bands
-130  */
-131 
-132 /**
-133  * The positive band color; if non-null, the interior of positive bands are
-134  * filled with the specified color. The default value of this property is blue.
-135  * For accurate blending, this color should be fully opaque.
-136  *
-137  * @type pv.Color
-138  * @name pv.Layout.Horizon.prototype.positiveStyle
-139  */
-140 
-141 /**
-142  * The negative band color; if non-null, the interior of negative bands are
-143  * filled with the specified color. The default value of this property is red.
-144  * For accurate blending, this color should be fully opaque.
-145  *
-146  * @type pv.Color
-147  * @name pv.Layout.Horizon.prototype.negativeStyle
-148  */
-149 
-150 /**
-151  * The background color. The panel background is filled with the specified
-152  * color, and the negative and positive bands are filled with an interpolated
-153  * color between this color and the respective band color. The default value of
-154  * this property is white. For accurate blending, this color should be fully
-155  * opaque.
-156  *
-157  * @type pv.Color
-158  * @name pv.Layout.Horizon.prototype.backgroundStyle
-159  */
-160 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Indent.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Indent.js.html deleted file mode 100644 index 1f8ded48..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Indent.js.html +++ /dev/null @@ -1,91 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty indent layout. Layouts are not typically constructed
-  3  * directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Implements a hierarchical layout using the indent algorithm. This
-  7  * layout implements a node-link diagram where the nodes are presented in
-  8  * preorder traversal, and nodes are indented based on their depth from the
-  9  * root. This technique is used ubiquitously by operating systems to represent
- 10  * file directories; although it requires much vertical space, indented trees
- 11  * allow efficient <i>interactive</i> exploration of trees to find a specific
- 12  * node. In addition they allow rapid scanning of node labels, and multivariate
- 13  * data such as file sizes can be displayed adjacent to the hierarchy.
- 14  *
- 15  * <p>The indent layout can be configured using the <tt>depth</tt> and
- 16  * <tt>breadth</tt> properties, which control the increments in pixel space for
- 17  * each indent and row in the layout. This layout does not support multiple
- 18  * orientations; the root node is rendered in the top-left, while
- 19  * <tt>breadth</tt> is a vertical offset from the top, and <tt>depth</tt> is a
- 20  * horizontal offset from the left.
- 21  *
- 22  * <p>For more details on how to use this layout, see
- 23  * {@link pv.Layout.Hierarchy}.
- 24  *
- 25  * @extends pv.Layout.Hierarchy
- 26  */
- 27 pv.Layout.Indent = function() {
- 28   pv.Layout.Hierarchy.call(this);
- 29   this.link.interpolate("step-after");
- 30 };
- 31 
- 32 pv.Layout.Indent.prototype = pv.extend(pv.Layout.Hierarchy)
- 33     .property("depth", Number)
- 34     .property("breadth", Number);
- 35 
- 36 /**
- 37  * The horizontal offset between different levels of the tree; defaults to 15.
- 38  *
- 39  * @type number
- 40  * @name pv.Layout.Indent.prototype.depth
- 41  */
- 42 
- 43 /**
- 44  * The vertical offset between nodes; defaults to 15.
- 45  *
- 46  * @type number
- 47  * @name pv.Layout.Indent.prototype.breadth
- 48  */
- 49 
- 50 /**
- 51  * Default properties for indent layouts. By default the depth and breadth
- 52  * offsets are 15 pixels.
- 53  *
- 54  * @type pv.Layout.Indent
- 55  */
- 56 pv.Layout.Indent.prototype.defaults = new pv.Layout.Indent()
- 57     .extend(pv.Layout.Hierarchy.prototype.defaults)
- 58     .depth(15)
- 59     .breadth(15);
- 60 
- 61 /** @private */
- 62 pv.Layout.Indent.prototype.buildImplied = function(s) {
- 63   if (pv.Layout.Hierarchy.prototype.buildImplied.call(this, s)) return;
- 64 
- 65   var nodes = s.nodes,
- 66       bspace = s.breadth,
- 67       dspace = s.depth,
- 68       ax = 0,
- 69       ay = 0;
- 70 
- 71   /** @private */
- 72   function position(n, breadth, depth) {
- 73     n.x = ax + depth++ * dspace;
- 74     n.y = ay + breadth++ * bspace;
- 75     n.midAngle = 0;
- 76     for (var c = n.firstChild; c; c = c.nextSibling) {
- 77       breadth = position(c, breadth, depth);
- 78     }
- 79     return breadth;
- 80   }
- 81 
- 82   position(nodes[0], 1, 1);
- 83 };
- 84 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Layout.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Layout.js.html deleted file mode 100644 index 30d538b6..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Layout.js.html +++ /dev/null @@ -1,64 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty layout with default properties. Layouts are not
-  3  * typically constructed directly; instead, a concrete subclass is added to an
-  4  * existing panel via {@link pv.Mark#add}.
-  5  *
-  6  * @class Represents an abstract layout, encapsulating a visualization technique
-  7  * such as a streamgraph or treemap. Layouts are themselves containers,
-  8  * extending from {@link pv.Panel}, and defining a set of mark prototypes as
-  9  * children. These mark prototypes provide default properties that together
- 10  * implement the given visualization technique.
- 11  *
- 12  * <p>Layouts do not initially contain any marks; any exported marks (such as a
- 13  * network layout's <tt>link</tt> and <tt>node</tt>) are intended to be used as
- 14  * prototypes. By adding a concrete mark, such as a {@link pv.Bar}, to the
- 15  * appropriate mark prototype, the mark is added to the layout and inherits the
- 16  * given properties. This approach allows further customization of the layout,
- 17  * either by choosing a different mark type to add, or more simply by overriding
- 18  * some of the layout's defined properties.
- 19  *
- 20  * <p>Each concrete layout, such as treemap or circle-packing, has different
- 21  * behavior and may export different mark prototypes, depending on what marks
- 22  * are typically needed to render the desired visualization. Therefore it is
- 23  * important to understand how each layout is structured, such that the provided
- 24  * mark prototypes are used appropriately.
- 25  *
- 26  * <p>In addition to the mark prototypes, layouts may define custom properties
- 27  * that affect the overall behavior of the layout. For example, a treemap layout
- 28  * might use a property to specify which layout algorithm to use. These
- 29  * properties are just like other mark properties, and can be defined as
- 30  * constants or as functions. As with panels, the data property can be used to
- 31  * replicate layouts, and properties can be defined to in terms of layout data.
- 32  *
- 33  * @extends pv.Panel
- 34  */
- 35 pv.Layout = function() {
- 36   pv.Panel.call(this);
- 37 };
- 38 
- 39 pv.Layout.prototype = pv.extend(pv.Panel);
- 40 
- 41 /**
- 42  * @private Defines a local property with the specified name and cast. Note that
- 43  * although the property method is only defined locally, the cast function is
- 44  * global, which is necessary since properties are inherited!
- 45  *
- 46  * @param {string} name the property name.
- 47  * @param {function} [cast] the cast function for this property.
- 48  */
- 49 pv.Layout.prototype.property = function(name, cast) {
- 50   if (!this.hasOwnProperty("properties")) {
- 51     this.properties = pv.extend(this.properties);
- 52   }
- 53   this.properties[name] = true;
- 54   this.propertyMethod(name, false, pv.Mark.cast[name] = cast);
- 55   return this;
- 56 };
- 57 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Matrix.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Matrix.js.html deleted file mode 100644 index 90a87bba..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Matrix.js.html +++ /dev/null @@ -1,185 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty matrix network layout. Layouts are not typically
-  3  * constructed directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Implements a network visualization using a matrix view. This is, in
-  7  * effect, a visualization of the graph's <i>adjacency matrix</i>: the cell at
-  8  * row <i>i</i>, column <i>j</i>, corresponds to the link from node <i>i</i> to
-  9  * node <i>j</i>. The fill color of each cell is binary by default, and
- 10  * corresponds to whether a link exists between the two nodes. If the underlying
- 11  * graph has links with variable values, the <tt>fillStyle</tt> property can be
- 12  * substited to use an appropriate color function, such as {@link pv.ramp}.
- 13  *
- 14  * <p>For undirected networks, the matrix is symmetric around the diagonal. For
- 15  * directed networks, links in opposite directions can be rendered on opposite
- 16  * sides of the diagonal using <tt>directed(true)</tt>. The graph is assumed to
- 17  * be undirected by default.
- 18  *
- 19  * <p>The mark prototypes for this network layout are slightly different than
- 20  * other implementations:<ul>
- 21  *
- 22  * <li><tt>node</tt> - unsupported; undefined. No mark is needed to visualize
- 23  * nodes directly, as the nodes are implicit in the location (rows and columns)
- 24  * of the links.
- 25  *
- 26  * <p><li><tt>link</tt> - for rendering links; typically a {@link pv.Bar}. The
- 27  * link mark is added directly to the layout, with the data property defined as
- 28  * all possible pairs of nodes. Each pair is represented as a
- 29  * {@link pv.Network.Layout.Link}, though the <tt>linkValue</tt> attribute may
- 30  * be 0 if no link exists in the graph.
- 31  *
- 32  * <p><li><tt>label</tt> - for rendering node labels; typically a
- 33  * {@link pv.Label}. The label mark is added directly to the layout, with the
- 34  * data property defined via the layout's <tt>nodes</tt> property; note,
- 35  * however, that the nodes are duplicated so as to provide a label across the
- 36  * top and down the side. Properties such as <tt>strokeStyle</tt> and
- 37  * <tt>fillStyle</tt> can be overridden to compute properties from node data
- 38  * dynamically.
- 39  *
- 40  * </ul>For more details on how to use this layout, see
- 41  * {@link pv.Layout.Network}.
- 42  *
- 43  * @extends pv.Layout.Network
- 44  */
- 45 pv.Layout.Matrix = function() {
- 46   pv.Layout.Network.call(this);
- 47   var that = this,
- 48       n, // cached matrix size
- 49       dx, // cached cell width
- 50       dy, // cached cell height
- 51       labels, // cached labels (array of strings)
- 52       pairs, // cached pairs (array of links)
- 53       buildImplied = that.buildImplied;
- 54 
- 55   /** @private Cache layout state to optimize properties. */
- 56   this.buildImplied = function(s) {
- 57     buildImplied.call(this, s);
- 58     n = s.nodes.length;
- 59     dx = s.width / n;
- 60     dy = s.height / n;
- 61     labels = s.$matrix.labels;
- 62     pairs = s.$matrix.pairs;
- 63   };
- 64 
- 65   /* Links are all pairs of nodes. */
- 66   this.link
- 67       .data(function() { return pairs; })
- 68       .left(function() { return dx * (this.index % n); })
- 69       .top(function() { return dy * Math.floor(this.index / n); })
- 70       .width(function() { return dx; })
- 71       .height(function() { return dy; })
- 72       .lineWidth(1.5)
- 73       .strokeStyle("#fff")
- 74       .fillStyle(function(l) { return l.linkValue ? "#555" : "#eee"; })
- 75       .parent = this;
- 76 
- 77   /* No special add for links! */
- 78   delete this.link.add;
- 79 
- 80   /* Labels are duplicated for top & left. */
- 81   this.label
- 82       .data(function() { return labels; })
- 83       .left(function() { return this.index & 1 ? dx * ((this.index >> 1) + .5) : null; })
- 84       .top(function() { return this.index & 1 ? null : dy * ((this.index >> 1) + .5); })
- 85       .textMargin(4)
- 86       .textAlign(function() { return this.index & 1 ? "left" : "right"; })
- 87       .textAngle(function() { return this.index & 1 ? -Math.PI / 2 : 0; });
- 88 
- 89   /* The node mark is unused. */
- 90   delete this.node;
- 91 };
- 92 
- 93 pv.Layout.Matrix.prototype = pv.extend(pv.Layout.Network)
- 94     .property("directed", Boolean);
- 95 
- 96 /**
- 97  * Whether this matrix visualization is directed (bidirectional). By default,
- 98  * the graph is assumed to be undirected, such that the visualization is
- 99  * symmetric across the matrix diagonal. If the network is directed, then
-100  * forward links are drawn above the diagonal, while reverse links are drawn
-101  * below.
-102  *
-103  * @type boolean
-104  * @name pv.Layout.Matrix.prototype.directed
-105  */
-106 
-107 /**
-108  * Specifies an optional sort function. The sort function follows the same
-109  * comparator contract required by {@link pv.Dom.Node#sort}. Specifying a sort
-110  * function provides an alternative to sort the nodes as they are specified by
-111  * the <tt>nodes</tt> property; the main advantage of doing this is that the
-112  * comparator function can access implicit fields populated by the network
-113  * layout, such as the <tt>linkDegree</tt>.
-114  *
-115  * <p>Note that matrix visualizations are particularly sensitive to order. This
-116  * is referred to as the seriation problem, and many different techniques exist
-117  * to find good node orders that emphasize clusters, such as spectral layout and
-118  * simulated annealing.
-119  *
-120  * @param {function} f comparator function for nodes.
-121  * @returns {pv.Layout.Matrix} this.
-122  */
-123 pv.Layout.Matrix.prototype.sort = function(f) {
-124   this.$sort = f;
-125   return this;
-126 };
-127 
-128 /** @private */
-129 pv.Layout.Matrix.prototype.buildImplied = function(s) {
-130   if (pv.Layout.Network.prototype.buildImplied.call(this, s)) return;
-131 
-132   var nodes = s.nodes,
-133       links = s.links,
-134       sort = this.$sort,
-135       n = nodes.length,
-136       index = pv.range(n),
-137       labels = [],
-138       pairs = [],
-139       map = {};
-140 
-141   s.$matrix = {labels: labels, pairs: pairs};
-142 
-143   /* Sort the nodes. */
-144   if (sort) index.sort(function(a, b) { return sort(nodes[a], nodes[b]); });
-145 
-146   /* Create pairs. */
-147   for (var i = 0; i < n; i++) {
-148     for (var j = 0; j < n; j++) {
-149       var a = index[i],
-150           b = index[j],
-151           p = {
-152             row: i,
-153             col: j,
-154             sourceNode: nodes[a],
-155             targetNode: nodes[b],
-156             linkValue: 0
-157           };
-158       pairs.push(map[a + "." + b] = p);
-159     }
-160   }
-161 
-162   /* Create labels. */
-163   for (var i = 0; i < n; i++) {
-164     var a = index[i];
-165     labels.push(nodes[a], nodes[a]);
-166   }
-167 
-168   /* Accumulate link values. */
-169   for (var i = 0; i < links.length; i++) {
-170     var l = links[i],
-171         source = l.sourceNode.index,
-172         target = l.targetNode.index,
-173         value = l.linkValue;
-174     map[source + "." + target].linkValue += value;
-175     if (!s.directed) map[target + "." + source].linkValue += value;
-176   }
-177 };
-178 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Network.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Network.js.html deleted file mode 100644 index 4d8f43c0..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Network.js.html +++ /dev/null @@ -1,308 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty network layout. Layouts are not typically constructed
-  3  * directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Represents an abstract layout for network diagrams. This class
-  7  * provides the basic structure for both node-link diagrams (such as
-  8  * force-directed graph layout) and space-filling network diagrams (such as
-  9  * sunbursts and treemaps). Note that "network" here is a general term that
- 10  * includes hierarchical structures; a tree is represented using links from
- 11  * child to parent.
- 12  *
- 13  * <p>Network layouts require the graph data structure to be defined using two
- 14  * properties:<ul>
- 15  *
- 16  * <li><tt>nodes</tt> - an array of objects representing nodes. Objects in this
- 17  * array must conform to the {@link pv.Layout.Network.Node} interface; which is
- 18  * to say, be careful to avoid naming collisions with automatic attributes such
- 19  * as <tt>index</tt> and <tt>linkDegree</tt>. If the nodes property is defined
- 20  * as an array of primitives, such as numbers or strings, these primitives are
- 21  * automatically wrapped in an object; the resulting object's <tt>nodeValue</tt>
- 22  * attribute points to the original primitive value.
- 23  *
- 24  * <p><li><tt>links</tt> - an array of objects representing links. Objects in
- 25  * this array must conform to the {@link pv.Layout.Network.Link} interface; at a
- 26  * minimum, either <tt>source</tt> and <tt>target</tt> indexes or
- 27  * <tt>sourceNode</tt> and <tt>targetNode</tt> references must be set. Note that
- 28  * if the links property is defined after the nodes property, the links can be
- 29  * defined in terms of <tt>this.nodes()</tt>.
- 30  *
- 31  * </ul>
- 32  *
- 33  * <p>Three standard mark prototypes are provided:<ul>
- 34  *
- 35  * <li><tt>node</tt> - for rendering nodes; typically a {@link pv.Dot}. The node
- 36  * mark is added directly to the layout, with the data property defined via the
- 37  * layout's <tt>nodes</tt> property. Properties such as <tt>strokeStyle</tt> and
- 38  * <tt>fillStyle</tt> can be overridden to compute properties from node data
- 39  * dynamically.
- 40  *
- 41  * <p><li><tt>link</tt> - for rendering links; typically a {@link pv.Line}. The
- 42  * link mark is added to a child panel, whose data property is defined as
- 43  * layout's <tt>links</tt> property. The link's data property is then a
- 44  * two-element array of the source node and target node. Thus, poperties such as
- 45  * <tt>strokeStyle</tt> and <tt>fillStyle</tt> can be overridden to compute
- 46  * properties from either the node data (the first argument) or the link data
- 47  * (the second argument; the parent panel data) dynamically.
- 48  *
- 49  * <p><li><tt>label</tt> - for rendering node labels; typically a
- 50  * {@link pv.Label}. The label mark is added directly to the layout, with the
- 51  * data property defined via the layout's <tt>nodes</tt> property. Properties
- 52  * such as <tt>strokeStyle</tt> and <tt>fillStyle</tt> can be overridden to
- 53  * compute properties from node data dynamically.
- 54  *
- 55  * </ul>Note that some network implementations may not support all three
- 56  * standard mark prototypes; for example, space-filling hierarchical layouts
- 57  * typically do not use a <tt>link</tt> prototype, as the parent-child links are
- 58  * implied by the structure of the space-filling <tt>node</tt> marks.  Check the
- 59  * specific network layout for implementation details.
- 60  *
- 61  * <p>Network layout properties, including <tt>nodes</tt> and <tt>links</tt>,
- 62  * are typically cached rather than re-evaluated with every call to render. This
- 63  * is a performance optimization, as network layout algorithms can be
- 64  * expensive. If the network structure changes, call {@link #reset} to clear the
- 65  * cache before rendering. Note that although the network layout properties are
- 66  * cached, child mark properties, such as the marks used to render the nodes and
- 67  * links, <i>are not</i>. Therefore, non-structural changes to the network
- 68  * layout, such as changing the color of a mark on mouseover, do not need to
- 69  * reset the layout.
- 70  *
- 71  * @see pv.Layout.Hierarchy
- 72  * @see pv.Layout.Force
- 73  * @see pv.Layout.Matrix
- 74  * @see pv.Layout.Arc
- 75  * @see pv.Layout.Rollup
- 76  * @extends pv.Layout
- 77  */
- 78 pv.Layout.Network = function() {
- 79   pv.Layout.call(this);
- 80   var that = this;
- 81 
- 82   /* @private Version tracking to cache layout state, improving performance. */
- 83   this.$id = pv.id();
- 84 
- 85   /**
- 86    * The node prototype. This prototype is intended to be used with a Dot mark
- 87    * in conjunction with the link prototype.
- 88    *
- 89    * @type pv.Mark
- 90    * @name pv.Layout.Network.prototype.node
- 91    */
- 92   (this.node = new pv.Mark()
- 93       .data(function() { return that.nodes(); })
- 94       .strokeStyle("#1f77b4")
- 95       .fillStyle("#fff")
- 96       .left(function(n) { return n.x; })
- 97       .top(function(n) { return n.y; })).parent = this;
- 98 
- 99   /**
-100    * The link prototype, which renders edges between source nodes and target
-101    * nodes. This prototype is intended to be used with a Line mark in
-102    * conjunction with the node prototype.
-103    *
-104    * @type pv.Mark
-105    * @name pv.Layout.Network.prototype.link
-106    */
-107   this.link = new pv.Mark()
-108       .extend(this.node)
-109       .data(function(p) { return [p.sourceNode, p.targetNode]; })
-110       .fillStyle(null)
-111       .lineWidth(function(d, p) { return p.linkValue * 1.5; })
-112       .strokeStyle("rgba(0,0,0,.2)");
-113 
-114   this.link.add = function(type) {
-115     return that.add(pv.Panel)
-116         .data(function() { return that.links(); })
-117       .add(type)
-118         .extend(this);
-119   };
-120 
-121   /**
-122    * The node label prototype, which renders the node name adjacent to the node.
-123    * This prototype is provided as an alternative to using the anchor on the
-124    * node mark; it is primarily intended to be used with radial node-link
-125    * layouts, since it provides a convenient mechanism to set the text angle.
-126    *
-127    * @type pv.Mark
-128    * @name pv.Layout.Network.prototype.label
-129    */
-130   (this.label = new pv.Mark()
-131       .extend(this.node)
-132       .textMargin(7)
-133       .textBaseline("middle")
-134       .text(function(n) { return n.nodeName || n.nodeValue; })
-135       .textAngle(function(n) {
-136           var a = n.midAngle;
-137           return pv.Wedge.upright(a) ? a : (a + Math.PI);
-138         })
-139       .textAlign(function(n) {
-140           return pv.Wedge.upright(n.midAngle) ? "left" : "right";
-141         })).parent = this;
-142 };
-143 
-144 /**
-145  * @class Represents a node in a network layout. There is no explicit
-146  * constructor; this class merely serves to document the attributes that are
-147  * used on nodes in network layouts. (Note that hierarchical nodes place
-148  * additional requirements on node representation, vis {@link pv.Dom.Node}.)
-149  *
-150  * @see pv.Layout.Network
-151  * @name pv.Layout.Network.Node
-152  */
-153 
-154 /**
-155  * The node index, zero-based. This attribute is populated automatically based
-156  * on the index in the array returned by the <tt>nodes</tt> property.
-157  *
-158  * @type number
-159  * @name pv.Layout.Network.Node.prototype.index
-160  */
-161 
-162 /**
-163  * The link degree; the sum of link values for all incoming and outgoing links.
-164  * This attribute is populated automatically.
-165  *
-166  * @type number
-167  * @name pv.Layout.Network.Node.prototype.linkDegree
-168  */
-169 
-170 /**
-171  * The node name; optional. If present, this attribute will be used to provide
-172  * the text for node labels. If not present, the label text will fallback to the
-173  * <tt>nodeValue</tt> attribute.
-174  *
-175  * @type string
-176  * @name pv.Layout.Network.Node.prototype.nodeName
-177  */
-178 
-179 /**
-180  * The node value; optional. If present, and no <tt>nodeName</tt> attribute is
-181  * present, the node value will be used as the label text. This attribute is
-182  * also automatically populated if the nodes are specified as an array of
-183  * primitives, such as strings or numbers.
-184  *
-185  * @type object
-186  * @name pv.Layout.Network.Node.prototype.nodeValue
-187  */
-188 
-189 /**
-190  * @class Represents a link in a network layout. There is no explicit
-191  * constructor; this class merely serves to document the attributes that are
-192  * used on links in network layouts. For hierarchical layouts, this class is
-193  * used to represent the parent-child links.
-194  *
-195  * @see pv.Layout.Network
-196  * @name pv.Layout.Network.Link
-197  */
-198 
-199 /**
-200  * The link value, or weight; optional. If not specified (or not a number), the
-201  * default value of 1 is used.
-202  *
-203  * @type number
-204  * @name pv.Layout.Network.Link.prototype.linkValue
-205  */
-206 
-207 /**
-208  * The link's source node. If not set, this value will be derived from the
-209  * <tt>source</tt> attribute index.
-210  *
-211  * @type pv.Layout.Network.Node
-212  * @name pv.Layout.Network.Link.prototype.sourceNode
-213  */
-214 
-215 /**
-216  * The link's target node. If not set, this value will be derived from the
-217  * <tt>target</tt> attribute index.
-218  *
-219  * @type pv.Layout.Network.Node
-220  * @name pv.Layout.Network.Link.prototype.targetNode
-221  */
-222 
-223 /**
-224  * Alias for <tt>sourceNode</tt>, as expressed by the index of the source node.
-225  * This attribute is not populated automatically, but may be used as a more
-226  * convenient identification of the link's source, for example in a static JSON
-227  * representation.
-228  *
-229  * @type number
-230  * @name pv.Layout.Network.Link.prototype.source
-231  */
-232 
-233 /**
-234  * Alias for <tt>targetNode</tt>, as expressed by the index of the target node.
-235  * This attribute is not populated automatically, but may be used as a more
-236  * convenient identification of the link's target, for example in a static JSON
-237  * representation.
-238  *
-239  * @type number
-240  * @name pv.Layout.Network.Link.prototype.target
-241  */
-242 
-243 /**
-244  * Alias for <tt>linkValue</tt>. This attribute is not populated automatically,
-245  * but may be used instead of the <tt>linkValue</tt> attribute when specifying
-246  * links.
-247  *
-248  * @type number
-249  * @name pv.Layout.Network.Link.prototype.value
-250  */
-251 
-252 /** @private Transform nodes and links on cast. */
-253 pv.Layout.Network.prototype = pv.extend(pv.Layout)
-254     .property("nodes", function(v) {
-255         return v.map(function(d, i) {
-256             if (typeof d != "object") d = {nodeValue: d};
-257             d.index = i;
-258             d.linkDegree = 0;
-259             return d;
-260           });
-261       })
-262     .property("links", function(v) {
-263         return v.map(function(d) {
-264             if (isNaN(d.linkValue)) d.linkValue = isNaN(d.value) ? 1 : d.value;
-265             return d;
-266           });
-267       });
-268 
-269 /**
-270  * Resets the cache, such that changes to layout property definitions will be
-271  * visible on subsequent render. Unlike normal marks (and normal layouts),
-272  * properties associated with network layouts are not automatically re-evaluated
-273  * on render; the properties are cached, and any expensive layout algorithms are
-274  * only run after the layout is explicitly reset.
-275  *
-276  * @returns {pv.Layout.Network} this.
-277  */
-278 pv.Layout.Network.prototype.reset = function() {
-279   this.$id = pv.id();
-280   return this;
-281 };
-282 
-283 /** @private Skip evaluating properties if cached. */
-284 pv.Layout.Network.prototype.buildProperties = function(s, properties) {
-285   if ((s.$id || 0) < this.$id) {
-286     pv.Layout.prototype.buildProperties.call(this, s, properties);
-287   }
-288 };
-289 
-290 /** @private Compute link degrees; map source and target indexes to nodes. */
-291 pv.Layout.Network.prototype.buildImplied = function(s) {
-292   pv.Layout.prototype.buildImplied.call(this, s);
-293   if (s.$id >= this.$id) return true;
-294   s.$id = this.$id;
-295   s.links.forEach(function(d) {
-296       var v = d.linkValue;
-297       (d.sourceNode || (d.sourceNode = s.nodes[d.source])).linkDegree += v;
-298       (d.targetNode || (d.targetNode = s.nodes[d.target])).linkDegree += v;
-299     });
-300 };
-301 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Pack.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Pack.js.html deleted file mode 100644 index af21a318..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Pack.js.html +++ /dev/null @@ -1,331 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty circle-packing layout. Layouts are not typically
-  3  * constructed directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Implements a hierarchical layout using circle-packing. The meaning of
-  7  * the exported mark prototypes changes slightly in the space-filling
-  8  * implementation:<ul>
-  9  *
- 10  * <li><tt>node</tt> - for rendering nodes; typically a {@link pv.Dot}.
- 11  *
- 12  * <p><li><tt>link</tt> - unsupported; undefined. Links are encoded implicitly
- 13  * in the arrangement of the space-filling nodes.
- 14  *
- 15  * <p><li><tt>label</tt> - for rendering node labels; typically a
- 16  * {@link pv.Label}.
- 17  *
- 18  * </ul>The pack layout support dynamic sizing for leaf nodes, if a
- 19  * {@link #size} psuedo-property is specified. The default size function returns
- 20  * 1, causing all leaf nodes to be sized equally, and all internal nodes to be
- 21  * sized by the number of leaf nodes they have as descendants.
- 22  *
- 23  * <p>The size function can be used in conjunction with the order property,
- 24  * which allows the nodes to the sorted by the computed size. Note: for sorting
- 25  * based on other data attributes, simply use the default <tt>null</tt> for the
- 26  * order property, and sort the nodes beforehand using the {@link pv.Dom}
- 27  * operator.
- 28  *
- 29  * <p>For more details on how to use this layout, see
- 30  * {@link pv.Layout.Hierarchy}.
- 31  *
- 32  * @extends pv.Layout.Hierarchy
- 33  * @see <a href="http://portal.acm.org/citation.cfm?id=1124772.1124851"
- 34  * >"Visualization of large hierarchical data by circle packing"</a> by W. Wang,
- 35  * H. Wang, G. Dai, and H. Wang, ACM CHI 2006.
- 36  */
- 37 pv.Layout.Pack = function() {
- 38   pv.Layout.Hierarchy.call(this);
- 39 
- 40   this.node
- 41       .radius(function(n) { return n.radius; })
- 42       .strokeStyle("rgb(31, 119, 180)")
- 43       .fillStyle("rgba(31, 119, 180, .25)");
- 44 
- 45   this.label
- 46       .textAlign("center");
- 47 
- 48   /* Hide unsupported link. */
- 49   delete this.link;
- 50 };
- 51 
- 52 pv.Layout.Pack.prototype = pv.extend(pv.Layout.Hierarchy)
- 53     .property("spacing", Number)
- 54     .property("order", String); // ascending, descending, reverse, null
- 55 
- 56 /**
- 57  * Default properties for circle-packing layouts. The default spacing parameter
- 58  * is 1 and the default order is "ascending".
- 59  *
- 60  * @type pv.Layout.Pack
- 61  */
- 62 pv.Layout.Pack.prototype.defaults = new pv.Layout.Pack()
- 63     .extend(pv.Layout.Hierarchy.prototype.defaults)
- 64     .spacing(1)
- 65     .order("ascending");
- 66 
- 67 /**
- 68  * The spacing parameter; defaults to 1, which provides a little bit of padding
- 69  * between sibling nodes and the enclosing circle. Larger values increase the
- 70  * spacing, by making the sibling nodes smaller; a value of zero makes the leaf
- 71  * nodes as large as possible, with no padding on enclosing circles.
- 72  *
- 73  * @type number
- 74  * @name pv.Layout.Pack.prototype.spacing
- 75  */
- 76 
- 77 /**
- 78  * The sibling node order. The default order is <tt>null</tt>, which means to
- 79  * use the sibling order specified by the nodes property as-is. A value of
- 80  * "ascending" will sort siblings in ascending order of size, while "descending"
- 81  * will do the reverse. For sorting based on data attributes other than size,
- 82  * use the default <tt>null</tt> for the order property, and sort the nodes
- 83  * beforehand using the {@link pv.Dom} operator.
- 84  *
- 85  * @see pv.Dom.Node#sort
- 86  * @type string
- 87  * @name pv.Layout.Pack.prototype.order
- 88  */
- 89 
- 90 /** @private The default size function. */
- 91 pv.Layout.Pack.prototype.$radius = function() { return 1; };
- 92 
- 93 // TODO is it possible for spacing to operate in pixel space?
- 94 // Right now it appears to be multiples of the smallest radius.
- 95 
- 96 /**
- 97  * Specifies the sizing function. By default, a sizing function is disabled and
- 98  * all nodes are given constant size. The sizing function is invoked for each
- 99  * leaf node in the tree (passed to the constructor).
-100  *
-101  * <p>For example, if the tree data structure represents a file system, with
-102  * files as leaf nodes, and each file has a <tt>bytes</tt> attribute, you can
-103  * specify a size function as:
-104  *
-105  * <pre>    .size(function(d) d.bytes)</pre>
-106  *
-107  * As with other properties, a size function may specify additional arguments to
-108  * access the data associated with the layout and any enclosing panels.
-109  *
-110  * @param {function} f the new sizing function.
-111  * @returns {pv.Layout.Pack} this.
-112  */
-113 pv.Layout.Pack.prototype.size = function(f) {
-114   this.$radius = typeof f == "function"
-115       ? function() { return Math.sqrt(f.apply(this, arguments)); }
-116       : (f = Math.sqrt(f), function() { return f; });
-117   return this;
-118 };
-119 
-120 /** @private */
-121 pv.Layout.Pack.prototype.buildImplied = function(s) {
-122   if (pv.Layout.Hierarchy.prototype.buildImplied.call(this, s)) return;
-123 
-124   var that = this,
-125       nodes = s.nodes,
-126       root = nodes[0];
-127 
-128   /** @private Compute the radii of the leaf nodes. */
-129   function radii(nodes) {
-130     var stack = pv.Mark.stack;
-131     stack.unshift(null);
-132     for (var i = 0, n = nodes.length; i < n; i++) {
-133       var c = nodes[i];
-134       if (!c.firstChild) {
-135         c.radius = that.$radius.apply(that, (stack[0] = c, stack));
-136       }
-137     }
-138     stack.shift();
-139   }
-140 
-141   /** @private */
-142   function packTree(n) {
-143     var nodes = [];
-144     for (var c = n.firstChild; c; c = c.nextSibling) {
-145       if (c.firstChild) c.radius = packTree(c);
-146       c.n = c.p = c;
-147       nodes.push(c);
-148     }
-149 
-150     /* Sort. */
-151     switch (s.order) {
-152       case "ascending": {
-153         nodes.sort(function(a, b) { return a.radius - b.radius; });
-154         break;
-155       }
-156       case "descending": {
-157         nodes.sort(function(a, b) { return b.radius - a.radius; });
-158         break;
-159       }
-160       case "reverse": nodes.reverse(); break;
-161     }
-162 
-163     return packCircle(nodes);
-164   }
-165 
-166   /** @private */
-167   function packCircle(nodes) {
-168     var xMin = Infinity,
-169         xMax = -Infinity,
-170         yMin = Infinity,
-171         yMax = -Infinity,
-172         a, b, c, j, k;
-173 
-174     /** @private */
-175     function bound(n) {
-176       xMin = Math.min(n.x - n.radius, xMin);
-177       xMax = Math.max(n.x + n.radius, xMax);
-178       yMin = Math.min(n.y - n.radius, yMin);
-179       yMax = Math.max(n.y + n.radius, yMax);
-180     }
-181 
-182     /** @private */
-183     function insert(a, b) {
-184       var c = a.n;
-185       a.n = b;
-186       b.p = a;
-187       b.n = c;
-188       c.p = b;
-189     }
-190 
-191     /** @private */
-192     function splice(a, b) {
-193       a.n = b;
-194       b.p = a;
-195     }
-196 
-197     /** @private */
-198     function intersects(a, b) {
-199       var dx = b.x - a.x,
-200           dy = b.y - a.y,
-201           dr = a.radius + b.radius;
-202       return (dr * dr - dx * dx - dy * dy) > .001; // within epsilon
-203     }
-204 
-205     /* Create first node. */
-206     a = nodes[0];
-207     a.x = -a.radius;
-208     a.y = 0;
-209     bound(a);
-210 
-211     /* Create second node. */
-212     if (nodes.length > 1) {
-213       b = nodes[1];
-214       b.x = b.radius;
-215       b.y = 0;
-216       bound(b);
-217 
-218       /* Create third node and build chain. */
-219       if (nodes.length > 2) {
-220         c = nodes[2];
-221         place(a, b, c);
-222         bound(c);
-223         insert(a, c);
-224         a.p = c;
-225         insert(c, b);
-226         b = a.n;
-227 
-228         /* Now iterate through the rest. */
-229         for (var i = 3; i < nodes.length; i++) {
-230           place(a, b, c = nodes[i]);
-231 
-232           /* Search for the closest intersection. */
-233           var isect = 0, s1 = 1, s2 = 1;
-234           for (j = b.n; j != b; j = j.n, s1++) {
-235             if (intersects(j, c)) {
-236               isect = 1;
-237               break;
-238             }
-239           }
-240           if (isect == 1) {
-241             for (k = a.p; k != j.p; k = k.p, s2++) {
-242               if (intersects(k, c)) {
-243                 if (s2 < s1) {
-244                   isect = -1;
-245                   j = k;
-246                 }
-247                 break;
-248               }
-249             }
-250           }
-251 
-252           /* Update node chain. */
-253           if (isect == 0) {
-254             insert(a, c);
-255             b = c;
-256             bound(c);
-257           } else if (isect > 0) {
-258             splice(a, j);
-259             b = j;
-260             i--;
-261           } else if (isect < 0) {
-262             splice(j, b);
-263             a = j;
-264             i--;
-265           }
-266         }
-267       }
-268     }
-269 
-270     /* Re-center the circles and return the encompassing radius. */
-271     var cx = (xMin + xMax) / 2,
-272         cy = (yMin + yMax) / 2,
-273         cr = 0;
-274     for (var i = 0; i < nodes.length; i++) {
-275       var n = nodes[i];
-276       n.x -= cx;
-277       n.y -= cy;
-278       cr = Math.max(cr, n.radius + Math.sqrt(n.x * n.x + n.y * n.y));
-279     }
-280     return cr + s.spacing;
-281   }
-282 
-283   /** @private */
-284   function place(a, b, c) {
-285     var da = b.radius + c.radius,
-286         db = a.radius + c.radius,
-287         dx = b.x - a.x,
-288         dy = b.y - a.y,
-289         dc = Math.sqrt(dx * dx + dy * dy),
-290         cos = (db * db + dc * dc - da * da) / (2 * db * dc),
-291         theta = Math.acos(cos),
-292         x = cos * db,
-293         h = Math.sin(theta) * db;
-294     dx /= dc;
-295     dy /= dc;
-296     c.x = a.x + x * dx + h * dy;
-297     c.y = a.y + x * dy - h * dx;
-298   }
-299 
-300   /** @private */
-301   function transform(n, x, y, k) {
-302     for (var c = n.firstChild; c; c = c.nextSibling) {
-303       c.x += n.x;
-304       c.y += n.y;
-305       transform(c, x, y, k);
-306     }
-307     n.x = x + k * n.x;
-308     n.y = y + k * n.y;
-309     n.radius *= k;
-310   }
-311 
-312   radii(nodes);
-313 
-314   /* Recursively compute the layout. */
-315   root.x = 0;
-316   root.y = 0;
-317   root.radius = packTree(root);
-318 
-319   var w = this.width(),
-320       h = this.height(),
-321       k = 1 / Math.max(2 * root.radius / w, 2 * root.radius / h);
-322   transform(root, w / 2, h / 2, k);
-323 };
-324 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Partition.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Partition.js.html deleted file mode 100644 index 5b41067c..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Partition.js.html +++ /dev/null @@ -1,211 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty partition layout. Layouts are not typically
-  3  * constructed directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Implemeents a hierarchical layout using the partition (or sunburst,
-  7  * icicle) algorithm. This layout provides both node-link and space-filling
-  8  * implementations of partition diagrams. In many ways it is similar to
-  9  * {@link pv.Layout.Cluster}, except that leaf nodes are positioned based on
- 10  * their distance from the root.
- 11  *
- 12  * <p>The partition layout support dynamic sizing for leaf nodes, if a
- 13  * {@link #size} psuedo-property is specified. The default size function returns
- 14  * 1, causing all leaf nodes to be sized equally, and all internal nodes to be
- 15  * sized by the number of leaf nodes they have as descendants.
- 16  *
- 17  * <p>The size function can be used in conjunction with the order property,
- 18  * which allows the nodes to the sorted by the computed size. Note: for sorting
- 19  * based on other data attributes, simply use the default <tt>null</tt> for the
- 20  * order property, and sort the nodes beforehand using the {@link pv.Dom}
- 21  * operator.
- 22  *
- 23  * <p>For more details on how to use this layout, see
- 24  * {@link pv.Layout.Hierarchy}.
- 25  *
- 26  * @see pv.Layout.Partition.Fill
- 27  * @extends pv.Layout.Hierarchy
- 28  */
- 29 pv.Layout.Partition = function() {
- 30   pv.Layout.Hierarchy.call(this);
- 31 };
- 32 
- 33 pv.Layout.Partition.prototype = pv.extend(pv.Layout.Hierarchy)
- 34     .property("order", String) // null, ascending, descending?
- 35     .property("orient", String) // top, left, right, bottom, radial
- 36     .property("innerRadius", Number)
- 37     .property("outerRadius", Number);
- 38 
- 39 /**
- 40  * The sibling node order. The default order is <tt>null</tt>, which means to
- 41  * use the sibling order specified by the nodes property as-is. A value of
- 42  * "ascending" will sort siblings in ascending order of size, while "descending"
- 43  * will do the reverse. For sorting based on data attributes other than size,
- 44  * use the default <tt>null</tt> for the order property, and sort the nodes
- 45  * beforehand using the {@link pv.Dom} operator.
- 46  *
- 47  * @see pv.Dom.Node#sort
- 48  * @type string
- 49  * @name pv.Layout.Partition.prototype.order
- 50  */
- 51 
- 52 /**
- 53  * The orientation. The default orientation is "top", which means that the root
- 54  * node is placed on the top edge, leaf nodes appear at the bottom, and internal
- 55  * nodes are in-between. The following orientations are supported:<ul>
- 56  *
- 57  * <li>left - left-to-right.
- 58  * <li>right - right-to-left.
- 59  * <li>top - top-to-bottom.
- 60  * <li>bottom - bottom-to-top.
- 61  * <li>radial - radially, with the root at the center.</ul>
- 62  *
- 63  * @type string
- 64  * @name pv.Layout.Partition.prototype.orient
- 65  */
- 66 
- 67 /**
- 68  * The inner radius; defaults to 0. This property applies only to radial
- 69  * orientations, and can be used to compress the layout radially. Note that for
- 70  * the node-link implementation, the root node is always at the center,
- 71  * regardless of the value of this property; this property only affects internal
- 72  * and leaf nodes. For the space-filling implementation, a non-zero value of
- 73  * this property will result in the root node represented as a ring rather than
- 74  * a circle.
- 75  *
- 76  * @type number
- 77  * @name pv.Layout.Partition.prototype.innerRadius
- 78  */
- 79 
- 80 /**
- 81  * The outer radius; defaults to fill the containing panel, based on the height
- 82  * and width of the layout. If the layout has no height and width specified, it
- 83  * will extend to fill the enclosing panel.
- 84  *
- 85  * @type number
- 86  * @name pv.Layout.Partition.prototype.outerRadius
- 87  */
- 88 
- 89 /**
- 90  * Default properties for partition layouts. The default orientation is "top".
- 91  *
- 92  * @type pv.Layout.Partition
- 93  */
- 94 pv.Layout.Partition.prototype.defaults = new pv.Layout.Partition()
- 95     .extend(pv.Layout.Hierarchy.prototype.defaults)
- 96     .orient("top");
- 97 
- 98 /** @private */
- 99 pv.Layout.Partition.prototype.$size = function() { return 1; };
-100 
-101 /**
-102  * Specifies the sizing function. By default, a sizing function is disabled and
-103  * all nodes are given constant size. The sizing function is invoked for each
-104  * leaf node in the tree (passed to the constructor).
-105  *
-106  * <p>For example, if the tree data structure represents a file system, with
-107  * files as leaf nodes, and each file has a <tt>bytes</tt> attribute, you can
-108  * specify a size function as:
-109  *
-110  * <pre>    .size(function(d) d.bytes)</pre>
-111  *
-112  * As with other properties, a size function may specify additional arguments to
-113  * access the data associated with the layout and any enclosing panels.
-114  *
-115  * @param {function} f the new sizing function.
-116  * @returns {pv.Layout.Partition} this.
-117  */
-118 pv.Layout.Partition.prototype.size = function(f) {
-119   this.$size = f;
-120   return this;
-121 };
-122 
-123 /** @private */
-124 pv.Layout.Partition.prototype.buildImplied = function(s) {
-125   if (pv.Layout.Hierarchy.prototype.buildImplied.call(this, s)) return;
-126 
-127   var that = this,
-128       root = s.nodes[0],
-129       stack = pv.Mark.stack,
-130       maxDepth = 0;
-131 
-132   /* Recursively compute the tree depth and node size. */
-133   stack.unshift(null);
-134   root.visitAfter(function(n, i) {
-135       if (i > maxDepth) maxDepth = i;
-136       n.size = n.firstChild
-137           ? pv.sum(n.childNodes, function(n) { return n.size; })
-138           : that.$size.apply(that, (stack[0] = n, stack));
-139     });
-140   stack.shift();
-141 
-142   /* Order */
-143   switch (s.order) {
-144     case "ascending": root.sort(function(a, b) { return a.size - b.size; }); break;
-145     case "descending": root.sort(function(b, a) { return a.size - b.size; }); break;
-146   }
-147 
-148   /* Compute the unit breadth and depth of each node. */
-149   var ds = 1 / maxDepth;
-150   root.minBreadth = 0;
-151   root.breadth = .5;
-152   root.maxBreadth = 1;
-153   root.visitBefore(function(n) {
-154     var b = n.minBreadth, s = n.maxBreadth - b;
-155       for (var c = n.firstChild; c; c = c.nextSibling) {
-156         c.minBreadth = b;
-157         c.maxBreadth = b += (c.size / n.size) * s;
-158         c.breadth = (b + c.minBreadth) / 2;
-159       }
-160     });
-161   root.visitAfter(function(n, i) {
-162       n.minDepth = (i - 1) * ds;
-163       n.maxDepth = n.depth = i * ds;
-164     });
-165 
-166   pv.Layout.Hierarchy.NodeLink.buildImplied.call(this, s);
-167 };
-168 
-169 /**
-170  * Constructs a new, empty space-filling partition layout. Layouts are not
-171  * typically constructed directly; instead, they are added to an existing panel
-172  * via {@link pv.Mark#add}.
-173  *
-174  * @class A variant of partition layout that is space-filling. The meaning of
-175  * the exported mark prototypes changes slightly in the space-filling
-176  * implementation:<ul>
-177  *
-178  * <li><tt>node</tt> - for rendering nodes; typically a {@link pv.Bar} for
-179  * non-radial orientations, and a {@link pv.Wedge} for radial orientations.
-180  *
-181  * <p><li><tt>link</tt> - unsupported; undefined. Links are encoded implicitly
-182  * in the arrangement of the space-filling nodes.
-183  *
-184  * <p><li><tt>label</tt> - for rendering node labels; typically a
-185  * {@link pv.Label}.
-186  *
-187  * </ul>For more details on how to use this layout, see
-188  * {@link pv.Layout.Partition}.
-189  *
-190  * @extends pv.Layout.Partition
-191  */
-192 pv.Layout.Partition.Fill = function() {
-193   pv.Layout.Partition.call(this);
-194   pv.Layout.Hierarchy.Fill.constructor.call(this);
-195 };
-196 
-197 pv.Layout.Partition.Fill.prototype = pv.extend(pv.Layout.Partition);
-198 
-199 /** @private */
-200 pv.Layout.Partition.Fill.prototype.buildImplied = function(s) {
-201   if (pv.Layout.Partition.prototype.buildImplied.call(this, s)) return;
-202   pv.Layout.Hierarchy.Fill.buildImplied.call(this, s);
-203 };
-204 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Rollup.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Rollup.js.html deleted file mode 100644 index 0b602fed..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Rollup.js.html +++ /dev/null @@ -1,211 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty rollup network layout. Layouts are not typically
-  3  * constructed directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Implements a network visualization using a node-link diagram where
-  7  * nodes are rolled up along two dimensions. This implementation is based on the
-  8  * "PivotGraph" designed by Martin Wattenberg:
-  9  *
- 10  * <blockquote>The method is designed for graphs that are "multivariate", i.e.,
- 11  * where each node is associated with several attributes. Unlike visualizations
- 12  * which emphasize global graph topology, PivotGraph uses a simple grid-based
- 13  * approach to focus on the relationship between node attributes &
- 14  * connections.</blockquote>
- 15  *
- 16  * This layout requires two psuedo-properties to be specified, which assign node
- 17  * positions along the two dimensions {@link #x} and {@link #y}, corresponding
- 18  * to the left and top properties, respectively. Typically, these functions are
- 19  * specified using an {@link pv.Scale.ordinal}. Nodes that share the same
- 20  * position in <i>x</i> and <i>y</i> are "rolled up" into a meta-node, and
- 21  * similarly links are aggregated between meta-nodes. For example, to construct
- 22  * a rollup to analyze links by gender and affiliation, first define two ordinal
- 23  * scales:
- 24  *
- 25  * <pre>var x = pv.Scale.ordinal(nodes, function(d) d.gender).split(0, w),
- 26  *     y = pv.Scale.ordinal(nodes, function(d) d.aff).split(0, h);</pre>
- 27  *
- 28  * Next, define the position psuedo-properties:
- 29  *
- 30  * <pre>    .x(function(d) x(d.gender))
- 31  *     .y(function(d) y(d.aff))</pre>
- 32  *
- 33  * Linear and other quantitative scales can alternatively be used to position
- 34  * the nodes along either dimension. Note, however, that the rollup requires
- 35  * that the positions match exactly, and thus ordinal scales are recommended to
- 36  * avoid precision errors.
- 37  *
- 38  * <p>Note that because this layout provides a visualization of the rolled up
- 39  * graph, the data properties for the mark prototypes (<tt>node</tt>,
- 40  * <tt>link</tt> and <tt>label</tt>) are different from most other network
- 41  * layouts: they reference the rolled-up nodes and links, rather than the nodes
- 42  * and links of the full network. The underlying nodes and links for each
- 43  * rolled-up node and link can be accessed via the <tt>nodes</tt> and
- 44  * <tt>links</tt> attributes, respectively. The aggregated link values for
- 45  * rolled-up links can similarly be accessed via the <tt>linkValue</tt>
- 46  * attribute.
- 47  *
- 48  * <p>For undirected networks, links are duplicated in both directions. For
- 49  * directed networks, use <tt>directed(true)</tt>. The graph is assumed to be
- 50  * undirected by default.
- 51  *
- 52  * @extends pv.Layout.Network
- 53  * @see <a href="http://www.research.ibm.com/visual/papers/pivotgraph.pdf"
- 54  * >"Visual Exploration of Multivariate Graphs"</a> by M. Wattenberg, CHI 2006.
- 55  */
- 56 pv.Layout.Rollup = function() {
- 57   pv.Layout.Network.call(this);
- 58   var that = this,
- 59       nodes, // cached rollup nodes
- 60       links, // cached rollup links
- 61       buildImplied = that.buildImplied;
- 62 
- 63   /** @private Cache layout state to optimize properties. */
- 64   this.buildImplied = function(s) {
- 65     buildImplied.call(this, s);
- 66     nodes = s.$rollup.nodes;
- 67     links = s.$rollup.links;
- 68   };
- 69 
- 70   /* Render rollup nodes. */
- 71   this.node
- 72       .data(function() { return nodes; })
- 73       .size(function(d) { return d.nodes.length * 20; });
- 74 
- 75   /* Render rollup links. */
- 76   this.link
- 77       .interpolate("polar")
- 78       .eccentricity(.8);
- 79 
- 80   this.link.add = function(type) {
- 81     return that.add(pv.Panel)
- 82         .data(function() { return links; })
- 83       .add(type)
- 84         .extend(this);
- 85   };
- 86 };
- 87 
- 88 pv.Layout.Rollup.prototype = pv.extend(pv.Layout.Network)
- 89     .property("directed", Boolean);
- 90 
- 91 /**
- 92  * Whether the underlying network is directed. By default, the graph is assumed
- 93  * to be undirected, and links are rendered in both directions. If the network
- 94  * is directed, then forward links are drawn above the diagonal, while reverse
- 95  * links are drawn below.
- 96  *
- 97  * @type boolean
- 98  * @name pv.Layout.Rollup.prototype.directed
- 99  */
-100 
-101 /**
-102  * Specifies the <i>x</i>-position function used to rollup nodes. The rolled up
-103  * nodes are positioned horizontally using the return values from the given
-104  * function. Typically the function is specified as an ordinal scale. For
-105  * single-dimension rollups, a constant value can be specified.
-106  *
-107  * @param {function} f the <i>x</i>-position function.
-108  * @returns {pv.Layout.Rollup} this.
-109  * @see pv.Scale.ordinal
-110  */
-111 pv.Layout.Rollup.prototype.x = function(f) {
-112   this.$x = pv.functor(f);
-113   return this;
-114 };
-115 
-116 /**
-117  * Specifies the <i>y</i>-position function used to rollup nodes. The rolled up
-118  * nodes are positioned vertically using the return values from the given
-119  * function. Typically the function is specified as an ordinal scale. For
-120  * single-dimension rollups, a constant value can be specified.
-121  *
-122  * @param {function} f the <i>y</i>-position function.
-123  * @returns {pv.Layout.Rollup} this.
-124  * @see pv.Scale.ordinal
-125  */
-126 pv.Layout.Rollup.prototype.y = function(f) {
-127   this.$y = pv.functor(f);
-128   return this;
-129 };
-130 
-131 /** @private */
-132 pv.Layout.Rollup.prototype.buildImplied = function(s) {
-133   if (pv.Layout.Network.prototype.buildImplied.call(this, s)) return;
-134 
-135   var nodes = s.nodes,
-136       links = s.links,
-137       directed = s.directed,
-138       n = nodes.length,
-139       x = [],
-140       y = [],
-141       rnindex = 0,
-142       rnodes = {},
-143       rlinks = {};
-144 
-145   /** @private */
-146   function id(i) {
-147     return x[i] + "," + y[i];
-148   }
-149 
-150   /* Iterate over the data, evaluating the x and y functions. */
-151   var stack = pv.Mark.stack, o = {parent: this};
-152   stack.unshift(null);
-153   for (var i = 0; i < n; i++) {
-154     o.index = i;
-155     stack[0] = nodes[i];
-156     x[i] = this.$x.apply(o, stack);
-157     y[i] = this.$y.apply(o, stack);
-158   }
-159   stack.shift();
-160 
-161   /* Compute rollup nodes. */
-162   for (var i = 0; i < nodes.length; i++) {
-163     var nodeId = id(i),
-164         rn = rnodes[nodeId];
-165     if (!rn) {
-166       rn = rnodes[nodeId] = pv.extend(nodes[i]);
-167       rn.index = rnindex++;
-168       rn.x = x[i];
-169       rn.y = y[i];
-170       rn.nodes = [];
-171     }
-172     rn.nodes.push(nodes[i]);
-173   }
-174 
-175   /* Compute rollup links. */
-176   for (var i = 0; i < links.length; i++) {
-177     var source = links[i].sourceNode,
-178         target = links[i].targetNode,
-179         rsource = rnodes[id(source.index)],
-180         rtarget = rnodes[id(target.index)],
-181         reverse = !directed && rsource.index > rtarget.index,
-182         linkId = reverse
-183             ? rtarget.index + "," + rsource.index
-184             : rsource.index + "," + rtarget.index,
-185         rl = rlinks[linkId];
-186     if (!rl) {
-187       rl = rlinks[linkId] = {
-188         sourceNode: rsource,
-189         targetNode: rtarget,
-190         linkValue: 0,
-191         links: []
-192       };
-193     }
-194     rl.links.push(links[i]);
-195     rl.linkValue += links[i].linkValue;
-196   }
-197 
-198   /* Export the rolled up nodes and links to the scene. */
-199   s.$rollup = {
-200     nodes: pv.values(rnodes),
-201     links: pv.values(rlinks)
-202   };
-203 };
-204 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Stack.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Stack.js.html deleted file mode 100644 index 70d20eb5..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Stack.js.html +++ /dev/null @@ -1,399 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty stack layout. Layouts are not typically constructed
-  3  * directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Implements a layout for stacked visualizations, ranging from simple
-  7  * stacked bar charts to more elaborate "streamgraphs" composed of stacked
-  8  * areas. Stack layouts uses length as a visual encoding, as opposed to
-  9  * position, as the layers do not share an aligned axis.
- 10  *
- 11  * <p>Marks can be stacked vertically or horizontally. For example,
- 12  *
- 13  * <pre>vis.add(pv.Layout.Stack)
- 14  *     .layers([[1, 1.2, 1.7, 1.5, 1.7],
- 15  *              [.5, 1, .8, 1.1, 1.3],
- 16  *              [.2, .5, .8, .9, 1]])
- 17  *     .x(function() this.index * 35)
- 18  *     .y(function(d) d * 40)
- 19  *   .layer.add(pv.Area);</pre>
- 20  *
- 21  * specifies a vertically-stacked area chart, using the default "bottom-left"
- 22  * orientation with "zero" offset. This visualization can be easily changed into
- 23  * a streamgraph using the "wiggle" offset, which attempts to minimize change in
- 24  * slope weighted by layer thickness. See the {@link #offset} property for more
- 25  * supported streamgraph algorithms.
- 26  *
- 27  * <p>In the simplest case, the layer data can be specified as a two-dimensional
- 28  * array of numbers. The <tt>x</tt> and <tt>y</tt> psuedo-properties are used to
- 29  * define the thickness of each layer at the given position, respectively; in
- 30  * the above example of the "bottom-left" orientation, the <tt>x</tt> and
- 31  * <tt>y</tt> psuedo-properties are equivalent to the <tt>left</tt> and
- 32  * <tt>height</tt> properties that you might use if you implemented a stacked
- 33  * area by hand.
- 34  *
- 35  * <p>The advantage of using the stack layout is that the baseline, i.e., the
- 36  * <tt>bottom</tt> property is computed automatically using the specified offset
- 37  * algorithm. In addition, the order of layers can be computed using a built-in
- 38  * algorithm via the <tt>order</tt> property.
- 39  *
- 40  * <p>With the exception of the "expand" <tt>offset</tt>, the stack layout does
- 41  * not perform any automatic scaling of data; the values returned from
- 42  * <tt>x</tt> and <tt>y</tt> specify pixel sizes. To simplify scaling math, use
- 43  * this layout in conjunction with {@link pv.Scale.linear} or similar.
- 44  *
- 45  * <p>In other cases, the <tt>values</tt> psuedo-property can be used to define
- 46  * the data more flexibly. As with a typical panel & area, the
- 47  * <tt>layers</tt> property corresponds to the data in the enclosing panel,
- 48  * while the <tt>values</tt> psuedo-property corresponds to the data for the
- 49  * area within the panel. For example, given an array of data values:
- 50  *
- 51  * <pre>var crimea = [
- 52  *  { date: "4/1854", wounds: 0, other: 110, disease: 110 },
- 53  *  { date: "5/1854", wounds: 0, other: 95, disease: 105 },
- 54  *  { date: "6/1854", wounds: 0, other: 40, disease: 95 },
- 55  *  ...</pre>
- 56  *
- 57  * and a corresponding array of series names:
- 58  *
- 59  * <pre>var causes = ["wounds", "other", "disease"];</pre>
- 60  *
- 61  * Separate layers can be defined for each cause like so:
- 62  *
- 63  * <pre>vis.add(pv.Layout.Stack)
- 64  *     .layers(causes)
- 65  *     .values(crimea)
- 66  *     .x(function(d) x(d.date))
- 67  *     .y(function(d, p) y(d[p]))
- 68  *   .layer.add(pv.Area)
- 69  *     ...</pre>
- 70  *
- 71  * As with the panel & area case, the datum that is passed to the
- 72  * psuedo-properties <tt>x</tt> and <tt>y</tt> are the values (an element in
- 73  * <tt>crimea</tt>); the second argument is the layer data (a string in
- 74  * <tt>causes</tt>). Additional arguments specify the data of enclosing panels,
- 75  * if any.
- 76  *
- 77  * @extends pv.Layout
- 78  */
- 79 pv.Layout.Stack = function() {
- 80   pv.Layout.call(this);
- 81   var that = this,
- 82       /** @ignore */ none = function() { return null; },
- 83       prop = {t: none, l: none, r: none, b: none, w: none, h: none},
- 84       values,
- 85       buildImplied = that.buildImplied;
- 86 
- 87   /** @private Proxy the given property on the layer. */
- 88   function proxy(name) {
- 89     return function() {
- 90         return prop[name](this.parent.index, this.index);
- 91       };
- 92   }
- 93 
- 94   /** @private Compute the layout! */
- 95   this.buildImplied = function(s) {
- 96     buildImplied.call(this, s);
- 97 
- 98     var data = s.layers,
- 99         n = data.length,
-100         m,
-101         orient = s.orient,
-102         horizontal = /^(top|bottom)\b/.test(orient),
-103         h = this.parent[horizontal ? "height" : "width"](),
-104         x = [],
-105         y = [],
-106         dy = [];
-107 
-108     /*
-109      * Iterate over the data, evaluating the values, x and y functions. The
-110      * context in which the x and y psuedo-properties are evaluated is a
-111      * pseudo-mark that is a grandchild of this layout.
-112      */
-113     var stack = pv.Mark.stack, o = {parent: {parent: this}};
-114     stack.unshift(null);
-115     values = [];
-116     for (var i = 0; i < n; i++) {
-117       dy[i] = [];
-118       y[i] = [];
-119       o.parent.index = i;
-120       stack[0] = data[i];
-121       values[i] = this.$values.apply(o.parent, stack);
-122       if (!i) m = values[i].length;
-123       stack.unshift(null);
-124       for (var j = 0; j < m; j++) {
-125         stack[0] = values[i][j];
-126         o.index = j;
-127         if (!i) x[j] = this.$x.apply(o, stack);
-128         dy[i][j] = this.$y.apply(o, stack);
-129       }
-130       stack.shift();
-131     }
-132     stack.shift();
-133 
-134     /* order */
-135     var index;
-136     switch (s.order) {
-137       case "inside-out": {
-138         var max = dy.map(function(v) { return pv.max.index(v); }),
-139             map = pv.range(n).sort(function(a, b) { return max[a] - max[b]; }),
-140             sums = dy.map(function(v) { return pv.sum(v); }),
-141             top = 0,
-142             bottom = 0,
-143             tops = [],
-144             bottoms = [];
-145         for (var i = 0; i < n; i++) {
-146           var j = map[i];
-147           if (top < bottom) {
-148             top += sums[j];
-149             tops.push(j);
-150           } else {
-151             bottom += sums[j];
-152             bottoms.push(j);
-153           }
-154         }
-155         index = bottoms.reverse().concat(tops);
-156         break;
-157       }
-158       case "reverse": index = pv.range(n - 1, -1, -1); break;
-159       default: index = pv.range(n); break;
-160     }
-161 
-162     /* offset */
-163     switch (s.offset) {
-164       case "silohouette": {
-165         for (var j = 0; j < m; j++) {
-166           var o = 0;
-167           for (var i = 0; i < n; i++) o += dy[i][j];
-168           y[index[0]][j] = (h - o) / 2;
-169         }
-170         break;
-171       }
-172       case "wiggle": {
-173         var o = 0;
-174         for (var i = 0; i < n; i++) o += dy[i][0];
-175         y[index[0]][0] = o = (h - o) / 2;
-176         for (var j = 1; j < m; j++) {
-177           var s1 = 0, s2 = 0, dx = x[j] - x[j - 1];
-178           for (var i = 0; i < n; i++) s1 += dy[i][j];
-179           for (var i = 0; i < n; i++) {
-180             var s3 = (dy[index[i]][j] - dy[index[i]][j - 1]) / (2 * dx);
-181             for (var k = 0; k < i; k++) {
-182               s3 += (dy[index[k]][j] - dy[index[k]][j - 1]) / dx;
-183             }
-184             s2 += s3 * dy[index[i]][j];
-185           }
-186           y[index[0]][j] = o -= s1 ? s2 / s1 * dx : 0;
-187         }
-188         break;
-189       }
-190       case "expand": {
-191         for (var j = 0; j < m; j++) {
-192           y[index[0]][j] = 0;
-193           var k = 0;
-194           for (var i = 0; i < n; i++) k += dy[i][j];
-195           if (k) {
-196             k = h / k;
-197             for (var i = 0; i < n; i++) dy[i][j] *= k;
-198           } else {
-199             k = h / n;
-200             for (var i = 0; i < n; i++) dy[i][j] = k;
-201           }
-202         }
-203         break;
-204       }
-205       default: {
-206         for (var j = 0; j < m; j++) y[index[0]][j] = 0;
-207         break;
-208       }
-209     }
-210 
-211     /* Propagate the offset to the other series. */
-212     for (var j = 0; j < m; j++) {
-213       var o = y[index[0]][j];
-214       for (var i = 1; i < n; i++) {
-215         o += dy[index[i - 1]][j];
-216         y[index[i]][j] = o;
-217       }
-218     }
-219 
-220     /* Find the property definitions for dynamic substitution. */
-221     var i = orient.indexOf("-"),
-222         pdy = horizontal ? "h" : "w",
-223         px = i < 0 ? (horizontal ? "l" : "b") : orient.charAt(i + 1),
-224         py = orient.charAt(0);
-225     for (var p in prop) prop[p] = none;
-226     prop[px] = function(i, j) { return x[j]; };
-227     prop[py] = function(i, j) { return y[i][j]; };
-228     prop[pdy] = function(i, j) { return dy[i][j]; };
-229   };
-230 
-231   /**
-232    * The layer prototype. This prototype is intended to be used with an area,
-233    * bar or panel mark (or subclass thereof). Other mark types may be possible,
-234    * though note that the stack layout is not currently designed to support
-235    * radial stacked visualizations using wedges.
-236    *
-237    * <p>The layer is not a direct child of the stack layout; a hidden panel is
-238    * used to replicate layers.
-239    *
-240    * @type pv.Mark
-241    * @name pv.Layout.Stack.prototype.layer
-242    */
-243   this.layer = new pv.Mark()
-244       .data(function() { return values[this.parent.index]; })
-245       .top(proxy("t"))
-246       .left(proxy("l"))
-247       .right(proxy("r"))
-248       .bottom(proxy("b"))
-249       .width(proxy("w"))
-250       .height(proxy("h"));
-251 
-252   this.layer.add = function(type) {
-253     return that.add(pv.Panel)
-254         .data(function() { return that.layers(); })
-255       .add(type)
-256         .extend(this);
-257   };
-258 };
-259 
-260 pv.Layout.Stack.prototype = pv.extend(pv.Layout)
-261     .property("orient", String)
-262     .property("offset", String)
-263     .property("order", String)
-264     .property("layers");
-265 
-266 /**
-267  * Default properties for stack layouts. The default orientation is
-268  * "bottom-left", the default offset is "zero", and the default layers is
-269  * <tt>[[]]</tt>.
-270  *
-271  * @type pv.Layout.Stack
-272  */
-273 pv.Layout.Stack.prototype.defaults = new pv.Layout.Stack()
-274     .extend(pv.Layout.prototype.defaults)
-275     .orient("bottom-left")
-276     .offset("zero")
-277     .layers([[]]);
-278 
-279 /** @private */
-280 pv.Layout.Stack.prototype.$x
-281     = /** @private */ pv.Layout.Stack.prototype.$y
-282     = function() { return 0; };
-283 
-284 /**
-285  * The x psuedo-property; determines the position of the value within the layer.
-286  * This typically corresponds to the independent variable. For example, with the
-287  * default "bottom-left" orientation, this function defines the "left" property.
-288  *
-289  * @param {function} f the x function.
-290  * @returns {pv.Layout.Stack} this.
-291  */
-292 pv.Layout.Stack.prototype.x = function(f) {
-293   /** @private */ this.$x = pv.functor(f);
-294   return this;
-295 };
-296 
-297 /**
-298  * The y psuedo-property; determines the thickness of the layer at the given
-299  * value.  This typically corresponds to the dependent variable. For example,
-300  * with the default "bottom-left" orientation, this function defines the
-301  * "height" property.
-302  *
-303  * @param {function} f the y function.
-304  * @returns {pv.Layout.Stack} this.
-305  */
-306 pv.Layout.Stack.prototype.y = function(f) {
-307   /** @private */ this.$y = pv.functor(f);
-308   return this;
-309 };
-310 
-311 /** @private The default value function; identity. */
-312 pv.Layout.Stack.prototype.$values = pv.identity;
-313 
-314 /**
-315  * The values function; determines the values for a given layer. The default
-316  * value is the identity function, which assumes that the layers property is
-317  * specified as a two-dimensional (i.e., nested) array.
-318  *
-319  * @param {function} f the values function.
-320  * @returns {pv.Layout.Stack} this.
-321  */
-322 pv.Layout.Stack.prototype.values = function(f) {
-323   this.$values = pv.functor(f);
-324   return this;
-325 };
-326 
-327 /**
-328  * The layer data in row-major order. The value of this property is typically a
-329  * two-dimensional (i.e., nested) array, but any array can be used, provided the
-330  * values psuedo-property is defined accordingly.
-331  *
-332  * @type array[]
-333  * @name pv.Layout.Stack.prototype.layers
-334  */
-335 
-336 /**
-337  * The layer orientation. The following values are supported:<ul>
-338  *
-339  * <li>bottom-left == bottom
-340  * <li>bottom-right
-341  * <li>top-left == top
-342  * <li>top-right
-343  * <li>left-top
-344  * <li>left-bottom == left
-345  * <li>right-top
-346  * <li>right-bottom == right
-347  *
-348  * </ul>. The default value is "bottom-left", which means that the layers will
-349  * be built from the bottom-up, and the values within layers will be laid out
-350  * from left-to-right.
-351  *
-352  * <p>Note that with non-zero baselines, some orientations may give similar
-353  * results. For example, offset("silohouette") centers the layers, resulting in
-354  * a streamgraph. Thus, the orientations "bottom-left" and "top-left" will
-355  * produce similar results, differing only in the layer order.
-356  *
-357  * @type string
-358  * @name pv.Layout.Stack.prototype.orient
-359  */
-360 
-361 /**
-362  * The layer order. The following values are supported:<ul>
-363  *
-364  * <li><i>null</i> - use given layer order.
-365  * <li>inside-out - sort by maximum value, with balanced order.
-366  * <li>reverse - use reverse of given layer order.
-367  *
-368  * </ul>For details on the inside-out order algorithm, refer to "Stacked Graphs
-369  * -- Geometry & Aesthetics" by L. Byron and M. Wattenberg, IEEE TVCG
-370  * November/December 2008.
-371  *
-372  * @type string
-373  * @name pv.Layout.Stack.prototype.order
-374  */
-375 
-376 /**
-377  * The layer offset; the y-position of the bottom of the lowest layer. The
-378  * following values are supported:<ul>
-379  *
-380  * <li>zero - use a zero baseline, i.e., the y-axis.
-381  * <li>silohouette - center the stream, i.e., ThemeRiver.
-382  * <li>wiggle - minimize weighted change in slope.
-383  * <li>expand - expand layers to fill the enclosing layout dimensions.
-384  *
-385  * </ul>For details on these offset algorithms, refer to "Stacked Graphs --
-386  * Geometry & Aesthetics" by L. Byron and M. Wattenberg, IEEE TVCG
-387  * November/December 2008.
-388  *
-389  * @type string
-390  * @name pv.Layout.Stack.prototype.offset
-391  */
-392 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Tree.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Tree.js.html deleted file mode 100644 index b58f4206..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Tree.js.html +++ /dev/null @@ -1,290 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty tree layout. Layouts are not typically constructed
-  3  * directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Implements a node-link tree diagram using the Reingold-Tilford "tidy"
-  7  * tree layout algorithm. The specific algorithm used by this layout is based on
-  8  * <a href="http://citeseer.ist.psu.edu/buchheim02improving.html">"Improving
-  9  * Walker's Algorithm to Run in Linear Time"</A> by C. Buchheim, M. Jünger
- 10  * & S. Leipert, Graph Drawing 2002. This layout supports both cartesian and
- 11  * radial orientations orientations for node-link diagrams.
- 12  *
- 13  * <p>The tree layout supports a "group" property, which if true causes siblings
- 14  * to be positioned closer together than unrelated nodes at the same depth. The
- 15  * layout can be configured using the <tt>depth</tt> and <tt>breadth</tt>
- 16  * properties, which control the increments in pixel space between nodes in both
- 17  * dimensions, similar to the indent layout.
- 18  *
- 19  * <p>For more details on how to use this layout, see
- 20  * {@link pv.Layout.Hierarchy}.
- 21  *
- 22  * @extends pv.Layout.Hierarchy
- 23  */
- 24 pv.Layout.Tree = function() {
- 25   pv.Layout.Hierarchy.call(this);
- 26 };
- 27 
- 28 pv.Layout.Tree.prototype = pv.extend(pv.Layout.Hierarchy)
- 29     .property("group", Number)
- 30     .property("breadth", Number)
- 31     .property("depth", Number)
- 32     .property("orient", String);
- 33 
- 34 /**
- 35  * Default properties for tree layouts. The default orientation is "top", the
- 36  * default group parameter is 1, and the default breadth and depth offsets are
- 37  * 15 and 60 respectively.
- 38  *
- 39  * @type pv.Layout.Tree
- 40  */
- 41 pv.Layout.Tree.prototype.defaults = new pv.Layout.Tree()
- 42     .extend(pv.Layout.Hierarchy.prototype.defaults)
- 43     .group(1)
- 44     .breadth(15)
- 45     .depth(60)
- 46     .orient("top");
- 47 
- 48 /** @private */
- 49 pv.Layout.Tree.prototype.buildImplied = function(s) {
- 50   if (pv.Layout.Hierarchy.prototype.buildImplied.call(this, s)) return;
- 51 
- 52   var nodes = s.nodes,
- 53       orient = s.orient,
- 54       depth = s.depth,
- 55       breadth = s.breadth,
- 56       group = s.group,
- 57       w = s.width,
- 58       h = s.height;
- 59 
- 60   /** @private */
- 61   function firstWalk(v) {
- 62     var l, r, a;
- 63     if (!v.firstChild) {
- 64       if (l = v.previousSibling) {
- 65         v.prelim = l.prelim + distance(v.depth, true);
- 66       }
- 67     } else {
- 68       l = v.firstChild;
- 69       r = v.lastChild;
- 70       a = l; // default ancestor
- 71       for (var c = l; c; c = c.nextSibling) {
- 72         firstWalk(c);
- 73         a = apportion(c, a);
- 74       }
- 75       executeShifts(v);
- 76       var midpoint = .5 * (l.prelim + r.prelim);
- 77       if (l = v.previousSibling) {
- 78         v.prelim = l.prelim + distance(v.depth, true);
- 79         v.mod = v.prelim - midpoint;
- 80       } else {
- 81         v.prelim = midpoint;
- 82       }
- 83     }
- 84   }
- 85 
- 86   /** @private */
- 87   function secondWalk(v, m, depth) {
- 88     v.breadth = v.prelim + m;
- 89     m += v.mod;
- 90     for (var c = v.firstChild; c; c = c.nextSibling) {
- 91       secondWalk(c, m, depth);
- 92     }
- 93   }
- 94 
- 95   /** @private */
- 96   function apportion(v, a) {
- 97     var w = v.previousSibling;
- 98     if (w) {
- 99       var vip = v,
-100           vop = v,
-101           vim = w,
-102           vom = v.parentNode.firstChild,
-103           sip = vip.mod,
-104           sop = vop.mod,
-105           sim = vim.mod,
-106           som = vom.mod,
-107           nr = nextRight(vim),
-108           nl = nextLeft(vip);
-109       while (nr && nl) {
-110         vim = nr;
-111         vip = nl;
-112         vom = nextLeft(vom);
-113         vop = nextRight(vop);
-114         vop.ancestor = v;
-115         var shift = (vim.prelim + sim) - (vip.prelim + sip) + distance(vim.depth, false);
-116         if (shift > 0) {
-117           moveSubtree(ancestor(vim, v, a), v, shift);
-118           sip += shift;
-119           sop += shift;
-120         }
-121         sim += vim.mod;
-122         sip += vip.mod;
-123         som += vom.mod;
-124         sop += vop.mod;
-125         nr = nextRight(vim);
-126         nl = nextLeft(vip);
-127       }
-128       if (nr && !nextRight(vop)) {
-129         vop.thread = nr;
-130         vop.mod += sim - sop;
-131       }
-132       if (nl && !nextLeft(vom)) {
-133         vom.thread = nl;
-134         vom.mod += sip - som;
-135         a = v;
-136       }
-137     }
-138     return a;
-139   }
-140 
-141   /** @private */
-142   function nextLeft(v) {
-143     return v.firstChild || v.thread;
-144   }
-145 
-146   /** @private */
-147   function nextRight(v) {
-148     return v.lastChild || v.thread;
-149   }
-150 
-151   /** @private */
-152   function moveSubtree(wm, wp, shift) {
-153     var subtrees = wp.number - wm.number;
-154     wp.change -= shift / subtrees;
-155     wp.shift += shift;
-156     wm.change += shift / subtrees;
-157     wp.prelim += shift;
-158     wp.mod += shift;
-159   }
-160 
-161   /** @private */
-162   function executeShifts(v) {
-163     var shift = 0, change = 0;
-164     for (var c = v.lastChild; c; c = c.previousSibling) {
-165       c.prelim += shift;
-166       c.mod += shift;
-167       change += c.change;
-168       shift += c.shift + change;
-169     }
-170   }
-171 
-172   /** @private */
-173   function ancestor(vim, v, a) {
-174     return (vim.ancestor.parentNode == v.parentNode) ? vim.ancestor : a;
-175   }
-176 
-177   /** @private */
-178   function distance(depth, siblings) {
-179     return (siblings ? 1 : (group + 1)) / ((orient == "radial") ? depth : 1);
-180   }
-181 
-182   /* Initialize temporary layout variables. TODO: store separately. */
-183   var root = nodes[0];
-184   root.visitAfter(function(v, i) {
-185       v.ancestor = v;
-186       v.prelim = 0;
-187       v.mod = 0;
-188       v.change = 0;
-189       v.shift = 0;
-190       v.number = v.previousSibling ? (v.previousSibling.number + 1) : 0;
-191       v.depth = i;
-192     });
-193 
-194   /* Compute the layout using Buchheim et al.'s algorithm. */
-195   firstWalk(root);
-196   secondWalk(root, -root.prelim, 0);
-197 
-198   /** @private Returns the angle of the given node. */
-199   function midAngle(n) {
-200     return (orient == "radial") ? n.breadth / depth : 0;
-201   }
-202 
-203   /** @private */
-204   function x(n) {
-205     switch (orient) {
-206       case "left": return n.depth;
-207       case "right": return w - n.depth;
-208       case "top":
-209       case "bottom": return n.breadth + w / 2;
-210       case "radial": return w / 2 + n.depth * Math.cos(midAngle(n));
-211     }
-212   }
-213 
-214   /** @private */
-215   function y(n) {
-216     switch (orient) {
-217       case "left":
-218       case "right": return n.breadth + h / 2;
-219       case "top": return n.depth;
-220       case "bottom": return h - n.depth;
-221       case "radial": return h / 2 + n.depth * Math.sin(midAngle(n));
-222     }
-223   }
-224 
-225   /* Clear temporary layout variables; transform depth and breadth. */
-226   root.visitAfter(function(v) {
-227       v.breadth *= breadth;
-228       v.depth *= depth;
-229       v.midAngle = midAngle(v);
-230       v.x = x(v);
-231       v.y = y(v);
-232       if (v.firstChild) v.midAngle += Math.PI;
-233       delete v.breadth;
-234       delete v.depth;
-235       delete v.ancestor;
-236       delete v.prelim;
-237       delete v.mod;
-238       delete v.change;
-239       delete v.shift;
-240       delete v.number;
-241       delete v.thread;
-242     });
-243 };
-244 
-245 /**
-246  * The offset between siblings nodes; defaults to 15.
-247  *
-248  * @type number
-249  * @name pv.Layout.Tree.prototype.breadth
-250  */
-251 
-252 /**
-253  * The offset between parent and child nodes; defaults to 60.
-254  *
-255  * @type number
-256  * @name pv.Layout.Tree.prototype.depth
-257  */
-258 
-259 /**
-260  * The orientation. The default orientation is "top", which means that the root
-261  * node is placed on the top edge, leaf nodes appear at the bottom, and internal
-262  * nodes are in-between. The following orientations are supported:<ul>
-263  *
-264  * <li>left - left-to-right.
-265  * <li>right - right-to-left.
-266  * <li>top - top-to-bottom.
-267  * <li>bottom - bottom-to-top.
-268  * <li>radial - radially, with the root at the center.</ul>
-269  *
-270  * @type string
-271  * @name pv.Layout.Tree.prototype.orient
-272  */
-273 
-274 /**
-275  * The sibling grouping, i.e., whether differentiating space is placed between
-276  * sibling groups. The default is 1 (or true), causing sibling leaves to be
-277  * separated by one breadth offset. Setting this to false (or 0) causes
-278  * non-siblings to be adjacent.
-279  *
-280  * @type number
-281  * @name pv.Layout.Tree.prototype.group
-282  */
-283 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Treemap.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Treemap.js.html deleted file mode 100644 index 85ba0585..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_layout_Treemap.js.html +++ /dev/null @@ -1,355 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty treemap layout. Layouts are not typically
-  3  * constructed directly; instead, they are added to an existing panel via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Implements a space-filling rectangular layout, with the hierarchy
-  7  * represented via containment. Treemaps represent nodes as boxes, with child
-  8  * nodes placed within parent boxes. The size of each box is proportional to the
-  9  * size of the node in the tree. This particular algorithm is taken from Bruls,
- 10  * D.M., C. Huizing, and J.J. van Wijk, <a
- 11  * href="http://www.win.tue.nl/~vanwijk/stm.pdf">"Squarified Treemaps"</a> in
- 12  * <i>Data Visualization 2000, Proceedings of the Joint Eurographics and IEEE
- 13  * TCVG Sumposium on Visualization</i>, 2000, pp. 33-42.
- 14  *
- 15  * <p>The meaning of the exported mark prototypes changes slightly in the
- 16  * space-filling implementation:<ul>
- 17  *
- 18  * <li><tt>node</tt> - for rendering nodes; typically a {@link pv.Bar}. The node
- 19  * data is populated with <tt>dx</tt> and <tt>dy</tt> attributes, in addition to
- 20  * the standard <tt>x</tt> and <tt>y</tt> position attributes.
- 21  *
- 22  * <p><li><tt>leaf</tt> - for rendering leaf nodes only, with no fill or stroke
- 23  * style by default; typically a {@link pv.Panel} or another layout!
- 24  *
- 25  * <p><li><tt>link</tt> - unsupported; undefined. Links are encoded implicitly
- 26  * in the arrangement of the space-filling nodes.
- 27  *
- 28  * <p><li><tt>label</tt> - for rendering node labels; typically a
- 29  * {@link pv.Label}.
- 30  *
- 31  * </ul>For more details on how to use this layout, see
- 32  * {@link pv.Layout.Hierarchy}.
- 33  *
- 34  * @extends pv.Layout.Hierarchy
- 35  */
- 36 pv.Layout.Treemap = function() {
- 37   pv.Layout.Hierarchy.call(this);
- 38 
- 39   this.node
- 40       .strokeStyle("#fff")
- 41       .fillStyle("rgba(31, 119, 180, .25)")
- 42       .width(function(n) { return n.dx; })
- 43       .height(function(n) { return n.dy; });
- 44 
- 45   this.label
- 46       .visible(function(n) { return !n.firstChild; })
- 47       .left(function(n) { return n.x + (n.dx / 2); })
- 48       .top(function(n) { return n.y + (n.dy / 2); })
- 49       .textAlign("center")
- 50       .textAngle(function(n) { return n.dx > n.dy ? 0 : -Math.PI / 2; });
- 51 
- 52   (this.leaf = new pv.Mark()
- 53       .extend(this.node)
- 54       .fillStyle(null)
- 55       .strokeStyle(null)
- 56       .visible(function(n) { return !n.firstChild; })).parent = this;
- 57 
- 58   /* Hide unsupported link. */
- 59   delete this.link;
- 60 };
- 61 
- 62 pv.Layout.Treemap.prototype = pv.extend(pv.Layout.Hierarchy)
- 63     .property("round", Boolean)
- 64     .property("paddingLeft", Number)
- 65     .property("paddingRight", Number)
- 66     .property("paddingTop", Number)
- 67     .property("paddingBottom", Number)
- 68     .property("mode", String)
- 69     .property("order", String);
- 70 
- 71 /**
- 72  * Default propertiess for treemap layouts. The default mode is "squarify" and
- 73  * the default order is "ascending".
- 74  *
- 75  * @type pv.Layout.Treemap
- 76  */
- 77 pv.Layout.Treemap.prototype.defaults = new pv.Layout.Treemap()
- 78     .extend(pv.Layout.Hierarchy.prototype.defaults)
- 79     .mode("squarify") // squarify, slice-and-dice, slice, dice
- 80     .order("ascending"); // ascending, descending, reverse, null
- 81 
- 82 /**
- 83  * Whether node sizes should be rounded to integer values. This has a similar
- 84  * effect to setting <tt>antialias(false)</tt> for node values, but allows the
- 85  * treemap algorithm to accumulate error related to pixel rounding.
- 86  *
- 87  * @type boolean
- 88  * @name pv.Layout.Treemap.prototype.round
- 89  */
- 90 
- 91 /**
- 92  * The left inset between parent add child in pixels. Defaults to 0.
- 93  *
- 94  * @type number
- 95  * @name pv.Layout.Treemap.prototype.paddingLeft
- 96  * @see #padding
- 97  */
- 98 
- 99 /**
-100  * The right inset between parent add child in pixels. Defaults to 0.
-101  *
-102  * @type number
-103  * @name pv.Layout.Treemap.prototype.paddingRight
-104  * @see #padding
-105  */
-106 
-107 /**
-108  * The top inset between parent and child in pixels. Defaults to 0.
-109  *
-110  * @type number
-111  * @name pv.Layout.Treemap.prototype.paddingTop
-112  * @see #padding
-113  */
-114 
-115 /**
-116  * The bottom inset between parent and child in pixels. Defaults to 0.
-117  *
-118  * @type number
-119  * @name pv.Layout.Treemap.prototype.paddingBottom
-120  * @see #padding
-121  */
-122 
-123 /**
-124  * The treemap algorithm. The default value is "squarify". The "slice-and-dice"
-125  * algorithm may also be used, which alternates between horizontal and vertical
-126  * slices for different depths. In addition, the "slice" and "dice" algorithms
-127  * may be specified explicitly to control whether horizontal or vertical slices
-128  * are used, which may be useful for nested treemap layouts.
-129  *
-130  * @type string
-131  * @name pv.Layout.Treemap.prototype.mode
-132  * @see <a
-133  * href="ftp://ftp.cs.umd.edu/pub/hcil/Reports-Abstracts-Bibliography/2001-06html/2001-06.pdf"
-134  * >"Ordered Treemap Layouts"</a> by B. Shneiderman & M. Wattenberg, IEEE
-135  * InfoVis 2001.
-136  */
-137 
-138 /**
-139  * The sibling node order. A <tt>null</tt> value means to use the sibling order
-140  * specified by the nodes property as-is; "reverse" will reverse the given
-141  * order. The default value "ascending" will sort siblings in ascending order of
-142  * size, while "descending" will do the reverse. For sorting based on data
-143  * attributes other than size, use the default <tt>null</tt> for the order
-144  * property, and sort the nodes beforehand using the {@link pv.Dom} operator.
-145  *
-146  * @type string
-147  * @name pv.Layout.Treemap.prototype.order
-148  */
-149 
-150 /**
-151  * Alias for setting the left, right, top and bottom padding properties
-152  * simultaneously.
-153  *
-154  * @see #paddingLeft
-155  * @see #paddingRight
-156  * @see #paddingTop
-157  * @see #paddingBottom
-158  * @returns {pv.Layout.Treemap} this.
-159  */
-160 pv.Layout.Treemap.prototype.padding = function(n) {
-161   return this.paddingLeft(n).paddingRight(n).paddingTop(n).paddingBottom(n);
-162 };
-163 
-164 /** @private The default size function. */
-165 pv.Layout.Treemap.prototype.$size = function(d) {
-166   return Number(d.nodeValue);
-167 };
-168 
-169 /**
-170  * Specifies the sizing function. By default, the size function uses the
-171  * <tt>nodeValue</tt> attribute of nodes as a numeric value: <tt>function(d)
-172  * Number(d.nodeValue)</tt>.
-173  *
-174  * <p>The sizing function is invoked for each leaf node in the tree, per the
-175  * <tt>nodes</tt> property. For example, if the tree data structure represents a
-176  * file system, with files as leaf nodes, and each file has a <tt>bytes</tt>
-177  * attribute, you can specify a size function as:
-178  *
-179  * <pre>    .size(function(d) d.bytes)</pre>
-180  *
-181  * @param {function} f the new sizing function.
-182  * @returns {pv.Layout.Treemap} this.
-183  */
-184 pv.Layout.Treemap.prototype.size = function(f) {
-185   this.$size = pv.functor(f);
-186   return this;
-187 };
-188 
-189 /** @private */
-190 pv.Layout.Treemap.prototype.buildImplied = function(s) {
-191   if (pv.Layout.Hierarchy.prototype.buildImplied.call(this, s)) return;
-192 
-193   var that = this,
-194       nodes = s.nodes,
-195       root = nodes[0],
-196       stack = pv.Mark.stack,
-197       left = s.paddingLeft,
-198       right = s.paddingRight,
-199       top = s.paddingTop,
-200       bottom = s.paddingBottom,
-201       /** @ignore */ size = function(n) { return n.size; },
-202       round = s.round ? Math.round : Number,
-203       mode = s.mode;
-204 
-205   /** @private */
-206   function slice(row, sum, horizontal, x, y, w, h) {
-207     for (var i = 0, d = 0; i < row.length; i++) {
-208       var n = row[i];
-209       if (horizontal) {
-210         n.x = x + d;
-211         n.y = y;
-212         d += n.dx = round(w * n.size / sum);
-213         n.dy = h;
-214       } else {
-215         n.x = x;
-216         n.y = y + d;
-217         n.dx = w;
-218         d += n.dy = round(h * n.size / sum);
-219       }
-220     }
-221     if (n) { // correct on-axis rounding error
-222       if (horizontal) {
-223         n.dx += w - d;
-224       } else {
-225         n.dy += h - d;
-226       }
-227     }
-228   }
-229 
-230   /** @private */
-231   function ratio(row, l) {
-232     var rmax = -Infinity, rmin = Infinity, s = 0;
-233     for (var i = 0; i < row.length; i++) {
-234       var r = row[i].size;
-235       if (r < rmin) rmin = r;
-236       if (r > rmax) rmax = r;
-237       s += r;
-238     }
-239     s = s * s;
-240     l = l * l;
-241     return Math.max(l * rmax / s, s / (l * rmin));
-242   }
-243 
-244   /** @private */
-245   function layout(n, i) {
-246     var x = n.x + left,
-247         y = n.y + top,
-248         w = n.dx - left - right,
-249         h = n.dy - top - bottom;
-250 
-251     /* Assume squarify by default. */
-252     if (mode != "squarify") {
-253       slice(n.childNodes, n.size,
-254           mode == "slice" ? true
-255           : mode == "dice" ? false
-256           : i & 1, x, y, w, h);
-257       return;
-258     }
-259 
-260     var row = [],
-261         mink = Infinity,
-262         l = Math.min(w, h),
-263         k = w * h / n.size;
-264 
-265     /* Abort if the size is nonpositive. */
-266     if (n.size <= 0) return;
-267 
-268     /* Scale the sizes to fill the current subregion. */
-269     n.visitBefore(function(n) { n.size *= k; });
-270 
-271     /** @private Position the specified nodes along one dimension. */
-272     function position(row) {
-273       var horizontal = w == l,
-274           sum = pv.sum(row, size),
-275           r = l ? round(sum / l) : 0;
-276       slice(row, sum, horizontal, x, y, horizontal ? w : r, horizontal ? r : h);
-277       if (horizontal) {
-278         y += r;
-279         h -= r;
-280       } else {
-281         x += r;
-282         w -= r;
-283       }
-284       l = Math.min(w, h);
-285       return horizontal;
-286     }
-287 
-288     var children = n.childNodes.slice(); // copy
-289     while (children.length) {
-290       var child = children[children.length - 1];
-291       if (!child.size) {
-292         children.pop();
-293         continue;
-294       }
-295       row.push(child);
-296 
-297       var k = ratio(row, l);
-298       if (k <= mink) {
-299         children.pop();
-300         mink = k;
-301       } else {
-302         row.pop();
-303         position(row);
-304         row.length = 0;
-305         mink = Infinity;
-306       }
-307     }
-308 
-309     /* correct off-axis rounding error */
-310     if (position(row)) for (var i = 0; i < row.length; i++) {
-311       row[i].dy += h;
-312     } else for (var i = 0; i < row.length; i++) {
-313       row[i].dx += w;
-314     }
-315   }
-316 
-317   /* Recursively compute the node depth and size. */
-318   stack.unshift(null);
-319   root.visitAfter(function(n, i) {
-320       n.depth = i;
-321       n.x = n.y = n.dx = n.dy = 0;
-322       n.size = n.firstChild
-323           ? pv.sum(n.childNodes, function(n) { return n.size; })
-324           : that.$size.apply(that, (stack[0] = n, stack));
-325     });
-326   stack.shift();
-327 
-328   /* Sort. */
-329   switch (s.order) {
-330     case "ascending": {
-331       root.sort(function(a, b) { return a.size - b.size; });
-332       break;
-333     }
-334     case "descending": {
-335       root.sort(function(a, b) { return b.size - a.size; });
-336       break;
-337     }
-338     case "reverse": root.reverse(); break;
-339   }
-340 
-341   /* Recursively compute the layout. */
-342   root.x = 0;
-343   root.y = 0;
-344   root.dx = s.width;
-345   root.dy = s.height;
-346   root.visitBefore(layout);
-347 };
-348 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Anchor.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Anchor.js.html deleted file mode 100644 index 0327bd51..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Anchor.js.html +++ /dev/null @@ -1,86 +0,0 @@ -
  1 /**
-  2  * Constructs a new mark anchor with default properties.
-  3  *
-  4  * @class Represents an anchor on a given mark. An anchor is itself a mark, but
-  5  * without a visual representation. It serves only to provide useful default
-  6  * properties that can be inherited by other marks. Each type of mark can define
-  7  * any number of named anchors for convenience. If the concrete mark type does
-  8  * not define an anchor implementation specifically, one will be inherited from
-  9  * the mark's parent class.
- 10  *
- 11  * <p>For example, the bar mark provides anchors for its four sides: left,
- 12  * right, top and bottom. Adding a label to the top anchor of a bar,
- 13  *
- 14  * <pre>bar.anchor("top").add(pv.Label);</pre>
- 15  *
- 16  * will render a text label on the top edge of the bar; the top anchor defines
- 17  * the appropriate position properties (top and left), as well as text-rendering
- 18  * properties for convenience (textAlign and textBaseline).
- 19  *
- 20  * <p>Note that anchors do not <i>inherit</i> from their targets; the positional
- 21  * properties are copied from the scene graph, which guarantees that the anchors
- 22  * are positioned correctly, even if the positional properties are not defined
- 23  * deterministically. (In addition, it also improves performance by avoiding
- 24  * re-evaluating expensive properties.) If you want the anchor to inherit from
- 25  * the target, use {@link pv.Mark#extend} before adding. For example:
- 26  *
- 27  * <pre>bar.anchor("top").extend(bar).add(pv.Label);</pre>
- 28  *
- 29  * The anchor defines it's own positional properties, but other properties (such
- 30  * as the title property, say) can be inherited using the above idiom. Also note
- 31  * that you can override positional properties in the anchor for custom
- 32  * behavior.
- 33  *
- 34  * @extends pv.Mark
- 35  * @param {pv.Mark} target the anchor target.
- 36  */
- 37 pv.Anchor = function(target) {
- 38   pv.Mark.call(this);
- 39   this.target = target;
- 40   this.parent = target.parent;
- 41 };
- 42 
- 43 pv.Anchor.prototype = pv.extend(pv.Mark)
- 44     .property("name", String);
- 45 
- 46 /**
- 47  * The anchor name. The set of supported anchor names is dependent on the
- 48  * concrete mark type; see the mark type for details. For example, bars support
- 49  * left, right, top and bottom anchors.
- 50  *
- 51  * <p>While anchor names are typically constants, the anchor name is a true
- 52  * property, which means you can specify a function to compute the anchor name
- 53  * dynamically. For instance, if you wanted to alternate top and bottom anchors,
- 54  * saying
- 55  *
- 56  * <pre>m.anchor(function() (this.index % 2) ? "top" : "bottom").add(pv.Dot);</pre>
- 57  *
- 58  * would have the desired effect.
- 59  *
- 60  * @type string
- 61  * @name pv.Anchor.prototype.name
- 62  */
- 63 
- 64 /**
- 65  * Returns the anchor target of this mark, if it is derived from an anchor;
- 66  * otherwise returns null. For example, if a label is derived from a bar anchor,
- 67  *
- 68  * <pre>bar.anchor("top").add(pv.Label);</pre>
- 69  *
- 70  * then property functions on the label can refer to the bar via the
- 71  * <tt>anchorTarget</tt> method. This method is also useful for mark types
- 72  * defining properties on custom anchors.
- 73  *
- 74  * @returns {pv.Mark} the anchor target of this mark; possibly null.
- 75  */
- 76 pv.Anchor.prototype.anchorTarget = function() {
- 77   return this.target;
- 78 };
- 79 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Area.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Area.js.html deleted file mode 100644 index df3971c2..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Area.js.html +++ /dev/null @@ -1,279 +0,0 @@ -
  1 /**
-  2  * Constructs a new area mark with default properties. Areas are not typically
-  3  * constructed directly, but by adding to a panel or an existing mark via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Represents an area mark: the solid area between two series of
-  7  * connected line segments. Unsurprisingly, areas are used most frequently for
-  8  * area charts.
-  9  *
- 10  * <p>Just as a line represents a polyline, the <tt>Area</tt> mark type
- 11  * represents a <i>polygon</i>. However, an area is not an arbitrary polygon;
- 12  * vertices are paired either horizontally or vertically into parallel
- 13  * <i>spans</i>, and each span corresponds to an associated datum. Either the
- 14  * width or the height must be specified, but not both; this determines whether
- 15  * the area is horizontally-oriented or vertically-oriented.  Like lines, areas
- 16  * can be stroked and filled with arbitrary colors.
- 17  *
- 18  * <p>See also the <a href="../../api/Area.html">Area guide</a>.
- 19  *
- 20  * @extends pv.Mark
- 21  */
- 22 pv.Area = function() {
- 23   pv.Mark.call(this);
- 24 };
- 25 
- 26 pv.Area.prototype = pv.extend(pv.Mark)
- 27     .property("width", Number)
- 28     .property("height", Number)
- 29     .property("lineWidth", Number)
- 30     .property("strokeStyle", pv.color)
- 31     .property("fillStyle", pv.color)
- 32     .property("segmented", Boolean)
- 33     .property("interpolate", String)
- 34     .property("tension", Number);
- 35 
- 36 pv.Area.prototype.type = "area";
- 37 
- 38 /**
- 39  * The width of a given span, in pixels; used for horizontal spans. If the width
- 40  * is specified, the height property should be 0 (the default). Either the top
- 41  * or bottom property should be used to space the spans vertically, typically as
- 42  * a multiple of the index.
- 43  *
- 44  * @type number
- 45  * @name pv.Area.prototype.width
- 46  */
- 47 
- 48 /**
- 49  * The height of a given span, in pixels; used for vertical spans. If the height
- 50  * is specified, the width property should be 0 (the default). Either the left
- 51  * or right property should be used to space the spans horizontally, typically
- 52  * as a multiple of the index.
- 53  *
- 54  * @type number
- 55  * @name pv.Area.prototype.height
- 56  */
- 57 
- 58 /**
- 59  * The width of stroked lines, in pixels; used in conjunction with
- 60  * <tt>strokeStyle</tt> to stroke the perimeter of the area. Unlike the
- 61  * {@link Line} mark type, the entire perimeter is stroked, rather than just one
- 62  * edge. The default value of this property is 1.5, but since the default stroke
- 63  * style is null, area marks are not stroked by default.
- 64  *
- 65  * <p>This property is <i>fixed</i> for non-segmented areas. See
- 66  * {@link pv.Mark}.
- 67  *
- 68  * @type number
- 69  * @name pv.Area.prototype.lineWidth
- 70  */
- 71 
- 72 /**
- 73  * The style of stroked lines; used in conjunction with <tt>lineWidth</tt> to
- 74  * stroke the perimeter of the area. Unlike the {@link Line} mark type, the
- 75  * entire perimeter is stroked, rather than just one edge. The default value of
- 76  * this property is null, meaning areas are not stroked by default.
- 77  *
- 78  * <p>This property is <i>fixed</i> for non-segmented areas. See
- 79  * {@link pv.Mark}.
- 80  *
- 81  * @type string
- 82  * @name pv.Area.prototype.strokeStyle
- 83  * @see pv.color
- 84  */
- 85 
- 86 /**
- 87  * The area fill style; if non-null, the interior of the polygon forming the
- 88  * area is filled with the specified color. The default value of this property
- 89  * is a categorical color.
- 90  *
- 91  * <p>This property is <i>fixed</i> for non-segmented areas. See
- 92  * {@link pv.Mark}.
- 93  *
- 94  * @type string
- 95  * @name pv.Area.prototype.fillStyle
- 96  * @see pv.color
- 97  */
- 98 
- 99 /**
-100  * Whether the area is segmented; whether variations in fill style, stroke
-101  * style, and the other properties are treated as fixed. Rendering segmented
-102  * areas is noticeably slower than non-segmented areas.
-103  *
-104  * <p>This property is <i>fixed</i>. See {@link pv.Mark}.
-105  *
-106  * @type boolean
-107  * @name pv.Area.prototype.segmented
-108  */
-109 
-110 /**
-111  * How to interpolate between values. Linear interpolation ("linear") is the
-112  * default, producing a straight line between points. For piecewise constant
-113  * functions (i.e., step functions), either "step-before" or "step-after" can be
-114  * specified. To draw open uniform b-splines, specify "basis". To draw cardinal
-115  * splines, specify "cardinal"; see also {@link #tension}.
-116  *
-117  * <p>This property is <i>fixed</i>. See {@link pv.Mark}.
-118  *
-119  * @type string
-120  * @name pv.Area.prototype.interpolate
-121  */
-122 
-123 /**
-124  * The tension of cardinal splines; used in conjunction with
-125  * interpolate("cardinal"). A value between 0 and 1 draws cardinal splines with
-126  * the given tension. In some sense, the tension can be interpreted as the
-127  * "length" of the tangent; a tension of 1 will yield all zero tangents (i.e.,
-128  * linear interpolation), and a tension of 0 yields a Catmull-Rom spline. The
-129  * default value is 0.7.
-130  *
-131  * <p>This property is <i>fixed</i>. See {@link pv.Mark}.
-132  *
-133  * @type number
-134  * @name pv.Area.prototype.tension
-135  */
-136 
-137 /**
-138  * Default properties for areas. By default, there is no stroke and the fill
-139  * style is a categorical color.
-140  *
-141  * @type pv.Area
-142  */
-143 pv.Area.prototype.defaults = new pv.Area()
-144     .extend(pv.Mark.prototype.defaults)
-145     .lineWidth(1.5)
-146     .fillStyle(pv.Colors.category20().by(pv.parent))
-147     .interpolate("linear")
-148     .tension(.7);
-149 
-150 /** @private Sets width and height to zero if null. */
-151 pv.Area.prototype.buildImplied = function(s) {
-152   if (s.height == null) s.height = 0;
-153   if (s.width == null) s.width = 0;
-154   pv.Mark.prototype.buildImplied.call(this, s);
-155 };
-156 
-157 /** @private Records which properties may be fixed. */
-158 pv.Area.fixed = {
-159   lineWidth: 1,
-160   lineJoin: 1,
-161   strokeStyle: 1,
-162   fillStyle: 1,
-163   segmented: 1,
-164   interpolate: 1,
-165   tension: 1
-166 };
-167 
-168 /**
-169  * @private Make segmented required, such that this fixed property is always
-170  * evaluated, even if the first segment is not visible. Also cache which
-171  * properties are normally fixed.
-172  */
-173 pv.Area.prototype.bind = function() {
-174   pv.Mark.prototype.bind.call(this);
-175   var binds = this.binds,
-176       required = binds.required,
-177       optional = binds.optional;
-178   for (var i = 0, n = optional.length; i < n; i++) {
-179     var p = optional[i];
-180     p.fixed = p.name in pv.Area.fixed;
-181     if (p.name == "segmented") {
-182       required.push(p);
-183       optional.splice(i, 1);
-184       i--;
-185       n--;
-186     }
-187   }
-188 
-189   /* Cache the original arrays so they can be restored on build. */
-190   this.binds.$required = required;
-191   this.binds.$optional = optional;
-192 };
-193 
-194 /**
-195  * @private Override the default build behavior such that fixed properties are
-196  * determined dynamically, based on the value of the (always) fixed segmented
-197  * property. Any fixed properties are only evaluated on the first instance,
-198  * although their values are propagated to subsequent instances, so that they
-199  * are available for property chaining and the like.
-200  */
-201 pv.Area.prototype.buildInstance = function(s) {
-202   var binds = this.binds;
-203 
-204   /* Handle fixed properties on secondary instances. */
-205   if (this.index) {
-206     var fixed = binds.fixed;
-207 
-208     /* Determine which properties are fixed. */
-209     if (!fixed) {
-210       fixed = binds.fixed = [];
-211       function f(p) { return !p.fixed || (fixed.push(p), false); }
-212       binds.required = binds.required.filter(f);
-213       if (!this.scene[0].segmented) binds.optional = binds.optional.filter(f);
-214     }
-215 
-216     /* Copy fixed property values from the first instance. */
-217     for (var i = 0, n = fixed.length; i < n; i++) {
-218       var p = fixed[i].name;
-219       s[p] = this.scene[0][p];
-220     }
-221   }
-222 
-223   /* Evaluate all properties on the first instance. */
-224   else {
-225     binds.required = binds.$required;
-226     binds.optional = binds.$optional;
-227     binds.fixed = null;
-228   }
-229 
-230   pv.Mark.prototype.buildInstance.call(this, s);
-231 };
-232 
-233 /**
-234  * Constructs a new area anchor with default properties. Areas support five
-235  * different anchors:<ul>
-236  *
-237  * <li>top
-238  * <li>left
-239  * <li>center
-240  * <li>bottom
-241  * <li>right
-242  *
-243  * </ul>In addition to positioning properties (left, right, top bottom), the
-244  * anchors support text rendering properties (text-align, text-baseline). Text
-245  * is rendered to appear inside the area. The area anchor also propagates the
-246  * interpolate, eccentricity, and tension properties such that an anchored area
-247  * or line will match positions between control points.
-248  *
-249  * <p>For consistency with the other mark types, the anchor positions are
-250  * defined in terms of their opposite edge. For example, the top anchor defines
-251  * the bottom property, such that an area added to the top anchor grows upward.
-252  *
-253  * @param {string} name the anchor name; either a string or a property function.
-254  * @returns {pv.Anchor}
-255  */
-256 pv.Area.prototype.anchor = function(name) {
-257   var scene;
-258   return pv.Mark.prototype.anchor.call(this, name)
-259     .def("$area.anchor", function() {
-260         scene = this.scene.target;
-261       })
-262     .interpolate(function() {
-263        return scene[this.index].interpolate;
-264       })
-265     .eccentricity(function() {
-266        return scene[this.index].eccentricity;
-267       })
-268     .tension(function() {
-269         return scene[this.index].tension;
-270       });
-271 };
-272 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Bar.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Bar.js.html deleted file mode 100644 index 5a2a3627..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Bar.js.html +++ /dev/null @@ -1,101 +0,0 @@ -
  1 /**
-  2  * Constructs a new bar mark with default properties. Bars are not typically
-  3  * constructed directly, but by adding to a panel or an existing mark via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Represents a bar: an axis-aligned rectangle that can be stroked and
-  7  * filled. Bars are used for many chart types, including bar charts, histograms
-  8  * and Gantt charts. Bars can also be used as decorations, for example to draw a
-  9  * frame border around a panel; in fact, a panel is a special type (a subclass)
- 10  * of bar.
- 11  *
- 12  * <p>Bars can be positioned in several ways. Most commonly, one of the four
- 13  * corners is fixed using two margins, and then the width and height properties
- 14  * determine the extent of the bar relative to this fixed location. For example,
- 15  * using the bottom and left properties fixes the bottom-left corner; the width
- 16  * then extends to the right, while the height extends to the top. As an
- 17  * alternative to the four corners, a bar can be positioned exclusively using
- 18  * margins; this is convenient as an inset from the containing panel, for
- 19  * example. See {@link pv.Mark} for details on the prioritization of redundant
- 20  * positioning properties.
- 21  *
- 22  * <p>See also the <a href="../../api/Bar.html">Bar guide</a>.
- 23  *
- 24  * @extends pv.Mark
- 25  */
- 26 pv.Bar = function() {
- 27   pv.Mark.call(this);
- 28 };
- 29 
- 30 pv.Bar.prototype = pv.extend(pv.Mark)
- 31     .property("width", Number)
- 32     .property("height", Number)
- 33     .property("lineWidth", Number)
- 34     .property("strokeStyle", pv.color)
- 35     .property("fillStyle", pv.color);
- 36 
- 37 pv.Bar.prototype.type = "bar";
- 38 
- 39 /**
- 40  * The width of the bar, in pixels. If the left position is specified, the bar
- 41  * extends rightward from the left edge; if the right position is specified, the
- 42  * bar extends leftward from the right edge.
- 43  *
- 44  * @type number
- 45  * @name pv.Bar.prototype.width
- 46  */
- 47 
- 48 /**
- 49  * The height of the bar, in pixels. If the bottom position is specified, the
- 50  * bar extends upward from the bottom edge; if the top position is specified,
- 51  * the bar extends downward from the top edge.
- 52  *
- 53  * @type number
- 54  * @name pv.Bar.prototype.height
- 55  */
- 56 
- 57 /**
- 58  * The width of stroked lines, in pixels; used in conjunction with
- 59  * <tt>strokeStyle</tt> to stroke the bar's border.
- 60  *
- 61  * @type number
- 62  * @name pv.Bar.prototype.lineWidth
- 63  */
- 64 
- 65 /**
- 66  * The style of stroked lines; used in conjunction with <tt>lineWidth</tt> to
- 67  * stroke the bar's border. The default value of this property is null, meaning
- 68  * bars are not stroked by default.
- 69  *
- 70  * @type string
- 71  * @name pv.Bar.prototype.strokeStyle
- 72  * @see pv.color
- 73  */
- 74 
- 75 /**
- 76  * The bar fill style; if non-null, the interior of the bar is filled with the
- 77  * specified color. The default value of this property is a categorical color.
- 78  *
- 79  * @type string
- 80  * @name pv.Bar.prototype.fillStyle
- 81  * @see pv.color
- 82  */
- 83 
- 84 /**
- 85  * Default properties for bars. By default, there is no stroke and the fill
- 86  * style is a categorical color.
- 87  *
- 88  * @type pv.Bar
- 89  */
- 90 pv.Bar.prototype.defaults = new pv.Bar()
- 91     .extend(pv.Mark.prototype.defaults)
- 92     .lineWidth(1.5)
- 93     .fillStyle(pv.Colors.category20().by(pv.parent));
- 94 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Dot.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Dot.js.html deleted file mode 100644 index 09e7503f..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Dot.js.html +++ /dev/null @@ -1,214 +0,0 @@ -
  1 /**
-  2  * Constructs a new dot mark with default properties. Dots are not typically
-  3  * constructed directly, but by adding to a panel or an existing mark via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Represents a dot; a dot is simply a sized glyph centered at a given
-  7  * point that can also be stroked and filled. The <tt>size</tt> property is
-  8  * proportional to the area of the rendered glyph to encourage meaningful visual
-  9  * encodings. Dots can visually encode up to eight dimensions of data, though
- 10  * this may be unwise due to integrality. See {@link pv.Mark} for details on the
- 11  * prioritization of redundant positioning properties.
- 12  *
- 13  * <p>See also the <a href="../../api/Dot.html">Dot guide</a>.
- 14  *
- 15  * @extends pv.Mark
- 16  */
- 17 pv.Dot = function() {
- 18   pv.Mark.call(this);
- 19 };
- 20 
- 21 pv.Dot.prototype = pv.extend(pv.Mark)
- 22     .property("size", Number)
- 23     .property("radius", Number)
- 24     .property("shape", String)
- 25     .property("angle", Number)
- 26     .property("lineWidth", Number)
- 27     .property("strokeStyle", pv.color)
- 28     .property("fillStyle", pv.color);
- 29 
- 30 pv.Dot.prototype.type = "dot";
- 31 
- 32 /**
- 33  * The size of the dot, in square pixels. Square pixels are used such that the
- 34  * area of the dot is linearly proportional to the value of the size property,
- 35  * facilitating representative encodings.
- 36  *
- 37  * @see #radius
- 38  * @type number
- 39  * @name pv.Dot.prototype.size
- 40  */
- 41 
- 42 /**
- 43  * The radius of the dot, in pixels. This is an alternative to using
- 44  * {@link #size}.
- 45  *
- 46  * @see #size
- 47  * @type number
- 48  * @name pv.Dot.prototype.radius
- 49  */
- 50 
- 51 /**
- 52  * The shape name. Several shapes are supported:<ul>
- 53  *
- 54  * <li>cross
- 55  * <li>triangle
- 56  * <li>diamond
- 57  * <li>square
- 58  * <li>circle
- 59  * <li>tick
- 60  * <li>bar
- 61  *
- 62  * </ul>These shapes can be further changed using the {@link #angle} property;
- 63  * for instance, a cross can be turned into a plus by rotating. Similarly, the
- 64  * tick, which is vertical by default, can be rotated horizontally. Note that
- 65  * some shapes (cross and tick) do not have interior areas, and thus do not
- 66  * support fill style meaningfully.
- 67  *
- 68  * <p>Note: it may be more natural to use the {@link pv.Rule} mark for
- 69  * horizontal and vertical ticks. The tick shape is only necessary if angled
- 70  * ticks are needed.
- 71  *
- 72  * @type string
- 73  * @name pv.Dot.prototype.shape
- 74  */
- 75 
- 76 /**
- 77  * The rotation angle, in radians. Used to rotate shapes, such as to turn a
- 78  * cross into a plus.
- 79  *
- 80  * @type number
- 81  * @name pv.Dot.prototype.angle
- 82  */
- 83 
- 84 /**
- 85  * The width of stroked lines, in pixels; used in conjunction with
- 86  * <tt>strokeStyle</tt> to stroke the dot's shape.
- 87  *
- 88  * @type number
- 89  * @name pv.Dot.prototype.lineWidth
- 90  */
- 91 
- 92 /**
- 93  * The style of stroked lines; used in conjunction with <tt>lineWidth</tt> to
- 94  * stroke the dot's shape. The default value of this property is a categorical
- 95  * color.
- 96  *
- 97  * @type string
- 98  * @name pv.Dot.prototype.strokeStyle
- 99  * @see pv.color
-100  */
-101 
-102 /**
-103  * The fill style; if non-null, the interior of the dot is filled with the
-104  * specified color. The default value of this property is null, meaning dots are
-105  * not filled by default.
-106  *
-107  * @type string
-108  * @name pv.Dot.prototype.fillStyle
-109  * @see pv.color
-110  */
-111 
-112 /**
-113  * Default properties for dots. By default, there is no fill and the stroke
-114  * style is a categorical color. The default shape is "circle" with size 20.
-115  *
-116  * @type pv.Dot
-117  */
-118 pv.Dot.prototype.defaults = new pv.Dot()
-119     .extend(pv.Mark.prototype.defaults)
-120     .size(20)
-121     .shape("circle")
-122     .lineWidth(1.5)
-123     .strokeStyle(pv.Colors.category10().by(pv.parent));
-124 
-125 /**
-126  * Constructs a new dot anchor with default properties. Dots support five
-127  * different anchors:<ul>
-128  *
-129  * <li>top
-130  * <li>left
-131  * <li>center
-132  * <li>bottom
-133  * <li>right
-134  *
-135  * </ul>In addition to positioning properties (left, right, top bottom), the
-136  * anchors support text rendering properties (text-align, text-baseline). Text is
-137  * rendered to appear outside the dot. Note that this behavior is different from
-138  * other mark anchors, which default to rendering text <i>inside</i> the mark.
-139  *
-140  * <p>For consistency with the other mark types, the anchor positions are
-141  * defined in terms of their opposite edge. For example, the top anchor defines
-142  * the bottom property, such that a bar added to the top anchor grows upward.
-143  *
-144  * @param {string} name the anchor name; either a string or a property function.
-145  * @returns {pv.Anchor}
-146  */
-147 pv.Dot.prototype.anchor = function(name) {
-148   var scene;
-149   return pv.Mark.prototype.anchor.call(this, name)
-150     .def("$wedge.anchor", function() {
-151         scene = this.scene.target;
-152       })
-153     .left(function() {
-154         var s = scene[this.index];
-155         switch (this.name()) {
-156           case "bottom":
-157           case "top":
-158           case "center": return s.left;
-159           case "left": return null;
-160         }
-161         return s.left + s.radius;
-162       })
-163     .right(function() {
-164         var s = scene[this.index];
-165         return this.name() == "left" ? s.right + s.radius : null;
-166       })
-167     .top(function() {
-168         var s = scene[this.index];
-169         switch (this.name()) {
-170           case "left":
-171           case "right":
-172           case "center": return s.top;
-173           case "top": return null;
-174         }
-175         return s.top + s.radius;
-176       })
-177     .bottom(function() {
-178         var s = scene[this.index];
-179         return this.name() == "top" ? s.bottom + s.radius : null;
-180       })
-181     .textAlign(function() {
-182         switch (this.name()) {
-183           case "left": return "right";
-184           case "bottom":
-185           case "top":
-186           case "center": return "center";
-187         }
-188         return "left";
-189       })
-190     .textBaseline(function() {
-191         switch (this.name()) {
-192           case "right":
-193           case "left":
-194           case "center": return "middle";
-195           case "bottom": return "top";
-196         }
-197         return "bottom";
-198       });
-199 };
-200 
-201 /** @private Sets radius based on size or vice versa. */
-202 pv.Dot.prototype.buildImplied = function(s) {
-203   if (s.radius == null) s.radius = Math.sqrt(s.size);
-204   else if (s.size == null) s.size = s.radius * s.radius;
-205   pv.Mark.prototype.buildImplied.call(this, s);
-206 };
-207 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Image.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Image.js.html deleted file mode 100644 index 587eed53..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Image.js.html +++ /dev/null @@ -1,162 +0,0 @@ -
  1 /**
-  2  * Constructs a new image with default properties. Images are not typically
-  3  * constructed directly, but by adding to a panel or an existing mark via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Represents an image, either a static resource or a dynamically-
-  7  * generated pixel buffer. Images share the same layout and style properties as
-  8  * bars. The external image resource is specified via the {@link #url}
-  9  * property. The optional fill, if specified, appears beneath the image, while
- 10  * the optional stroke appears above the image.
- 11  *
- 12  * <p>Dynamic images such as heatmaps are supported using the {@link #image}
- 13  * psuedo-property. This function is passed the <i>x</i> and <i>y</i> index, in
- 14  * addition to the current data stack. The return value is a {@link pv.Color},
- 15  * or null for transparent. A string can also be returned, which will be parsed
- 16  * into a color; however, it is typically much faster to return an object with
- 17  * <tt>r</tt>, <tt>g</tt>, <tt>b</tt> and <tt>a</tt> attributes, to avoid the
- 18  * cost of parsing and object instantiation.
- 19  *
- 20  * <p>See {@link pv.Bar} for details on positioning properties.
- 21  *
- 22  * @extends pv.Bar
- 23  */
- 24 pv.Image = function() {
- 25   pv.Bar.call(this);
- 26 };
- 27 
- 28 pv.Image.prototype = pv.extend(pv.Bar)
- 29     .property("url", String)
- 30     .property("imageWidth", Number)
- 31     .property("imageHeight", Number);
- 32 
- 33 pv.Image.prototype.type = "image";
- 34 
- 35 /**
- 36  * The URL of the image to display. The set of supported image types is
- 37  * browser-dependent; PNG and JPEG are recommended.
- 38  *
- 39  * @type string
- 40  * @name pv.Image.prototype.url
- 41  */
- 42 
- 43 /**
- 44  * The width of the image in pixels. For static images, this property is
- 45  * computed implicitly from the loaded image resources. For dynamic images, this
- 46  * property can be used to specify the width of the pixel buffer; otherwise, the
- 47  * value is derived from the <tt>width</tt> property.
- 48  *
- 49  * @type number
- 50  * @name pv.Image.prototype.imageWidth
- 51  */
- 52 
- 53 /**
- 54  * The height of the image in pixels. For static images, this property is
- 55  * computed implicitly from the loaded image resources. For dynamic images, this
- 56  * property can be used to specify the height of the pixel buffer; otherwise, the
- 57  * value is derived from the <tt>height</tt> property.
- 58  *
- 59  * @type number
- 60  * @name pv.Image.prototype.imageHeight
- 61  */
- 62 
- 63 /**
- 64  * Default properties for images. By default, there is no stroke or fill style.
- 65  *
- 66  * @type pv.Image
- 67  */
- 68 pv.Image.prototype.defaults = new pv.Image()
- 69     .extend(pv.Bar.prototype.defaults)
- 70     .fillStyle(null);
- 71 
- 72 /**
- 73  * Specifies the dynamic image function. By default, no image function is
- 74  * specified and the <tt>url</tt> property is used to load a static image
- 75  * resource. If an image function is specified, it will be invoked for each
- 76  * pixel in the image, based on the related <tt>imageWidth</tt> and
- 77  * <tt>imageHeight</tt> properties.
- 78  *
- 79  * <p>For example, given a two-dimensional array <tt>heatmap</tt>, containing
- 80  * numbers in the range [0, 1] in row-major order, a simple monochrome heatmap
- 81  * image can be specified as:
- 82  *
- 83  * <pre>vis.add(pv.Image)
- 84  *     .imageWidth(heatmap[0].length)
- 85  *     .imageHeight(heatmap.length)
- 86  *     .image(pv.ramp("white", "black").by(function(x, y) heatmap[y][x]));</pre>
- 87  *
- 88  * For fastest performance, use an ordinal scale which caches the fixed color
- 89  * palette, or return an object literal with <tt>r</tt>, <tt>g</tt>, <tt>b</tt>
- 90  * and <tt>a</tt> attributes. A {@link pv.Color} or string can also be returned,
- 91  * though this typically results in slower performance.
- 92  *
- 93  * @param {function} f the new sizing function.
- 94  * @returns {pv.Layout.Pack} this.
- 95  */
- 96 pv.Image.prototype.image = function(f) {
- 97   /** @private */
- 98   this.$image = function() {
- 99       var c = f.apply(this, arguments);
-100       return c == null ? pv.Color.transparent
-101           : typeof c == "string" ? pv.color(c)
-102           : c;
-103     };
-104   return this;
-105 };
-106 
-107 /** @private Scan the proto chain for an image function. */
-108 pv.Image.prototype.bind = function() {
-109   pv.Bar.prototype.bind.call(this);
-110   var binds = this.binds, mark = this;
-111   do {
-112     binds.image = mark.$image;
-113   } while (!binds.image && (mark = mark.proto));
-114 };
-115 
-116 /** @private */
-117 pv.Image.prototype.buildImplied = function(s) {
-118   pv.Bar.prototype.buildImplied.call(this, s);
-119   if (!s.visible) return;
-120 
-121   /* Compute the implied image dimensions. */
-122   if (s.imageWidth == null) s.imageWidth = s.width;
-123   if (s.imageHeight == null) s.imageHeight = s.height;
-124 
-125   /* Compute the pixel values. */
-126   if ((s.url == null) && this.binds.image) {
-127 
-128     /* Cache the canvas element to reuse across renders. */
-129     var canvas = this.$canvas || (this.$canvas = document.createElement("canvas")),
-130         context = canvas.getContext("2d"),
-131         w = s.imageWidth,
-132         h = s.imageHeight,
-133         stack = pv.Mark.stack,
-134         data;
-135 
-136     /* Evaluate the image function, storing into a CanvasPixelArray. */
-137     canvas.width = w;
-138     canvas.height = h;
-139     data = (s.image = context.createImageData(w, h)).data;
-140     stack.unshift(null, null);
-141     for (var y = 0, p = 0; y < h; y++) {
-142       stack[1] = y;
-143       for (var x = 0; x < w; x++) {
-144         stack[0] = x;
-145         var color = this.binds.image.apply(this, stack);
-146         data[p++] = color.r;
-147         data[p++] = color.g;
-148         data[p++] = color.b;
-149         data[p++] = 255 * color.a;
-150       }
-151     }
-152     stack.splice(0, 2);
-153   }
-154 };
-155 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Label.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Label.js.html deleted file mode 100644 index 90373fe3..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Label.js.html +++ /dev/null @@ -1,163 +0,0 @@ -
  1 /**
-  2  * Constructs a new label mark with default properties. Labels are not typically
-  3  * constructed directly, but by adding to a panel or an existing mark via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Represents a text label, allowing textual annotation of other marks or
-  7  * arbitrary text within the visualization. The character data must be plain
-  8  * text (unicode), though the text can be styled using the {@link #font}
-  9  * property. If rich text is needed, external HTML elements can be overlaid on
- 10  * the canvas by hand.
- 11  *
- 12  * <p>Labels are positioned using the box model, similarly to {@link Dot}. Thus,
- 13  * a label has no width or height, but merely a text anchor location. The text
- 14  * is positioned relative to this anchor location based on the
- 15  * {@link #textAlign}, {@link #textBaseline} and {@link #textMargin} properties.
- 16  * Furthermore, the text may be rotated using {@link #textAngle}.
- 17  *
- 18  * <p>Labels ignore events, so as to not interfere with event handlers on
- 19  * underlying marks, such as bars. In the future, we may support event handlers
- 20  * on labels.
- 21  *
- 22  * <p>See also the <a href="../../api/Label.html">Label guide</a>.
- 23  *
- 24  * @extends pv.Mark
- 25  */
- 26 pv.Label = function() {
- 27   pv.Mark.call(this);
- 28 };
- 29 
- 30 pv.Label.prototype = pv.extend(pv.Mark)
- 31     .property("text", String)
- 32     .property("font", String)
- 33     .property("textAngle", Number)
- 34     .property("textStyle", pv.color)
- 35     .property("textAlign", String)
- 36     .property("textBaseline", String)
- 37     .property("textMargin", Number)
- 38     .property("textDecoration", String)
- 39     .property("textShadow", String);
- 40 
- 41 pv.Label.prototype.type = "label";
- 42 
- 43 /**
- 44  * The character data to render; a string. The default value of the text
- 45  * property is the identity function, meaning the label's associated datum will
- 46  * be rendered using its <tt>toString</tt>.
- 47  *
- 48  * @type string
- 49  * @name pv.Label.prototype.text
- 50  */
- 51 
- 52 /**
- 53  * The font format, per the CSS Level 2 specification. The default font is "10px
- 54  * sans-serif", for consistency with the HTML 5 canvas element specification.
- 55  * Note that since text is not wrapped, any line-height property will be
- 56  * ignored. The other font-style, font-variant, font-weight, font-size and
- 57  * font-family properties are supported.
- 58  *
- 59  * @see <a href="http://www.w3.org/TR/CSS2/fonts.html#font-shorthand">CSS2 fonts</a>
- 60  * @type string
- 61  * @name pv.Label.prototype.font
- 62  */
- 63 
- 64 /**
- 65  * The rotation angle, in radians. Text is rotated clockwise relative to the
- 66  * anchor location. For example, with the default left alignment, an angle of
- 67  * Math.PI / 2 causes text to proceed downwards. The default angle is zero.
- 68  *
- 69  * @type number
- 70  * @name pv.Label.prototype.textAngle
- 71  */
- 72 
- 73 /**
- 74  * The text color. The name "textStyle" is used for consistency with "fillStyle"
- 75  * and "strokeStyle", although it might be better to rename this property (and
- 76  * perhaps use the same name as "strokeStyle"). The default color is black.
- 77  *
- 78  * @type string
- 79  * @name pv.Label.prototype.textStyle
- 80  * @see pv.color
- 81  */
- 82 
- 83 /**
- 84  * The horizontal text alignment. One of:<ul>
- 85  *
- 86  * <li>left
- 87  * <li>center
- 88  * <li>right
- 89  *
- 90  * </ul>The default horizontal alignment is left.
- 91  *
- 92  * @type string
- 93  * @name pv.Label.prototype.textAlign
- 94  */
- 95 
- 96 /**
- 97  * The vertical text alignment. One of:<ul>
- 98  *
- 99  * <li>top
-100  * <li>middle
-101  * <li>bottom
-102  *
-103  * </ul>The default vertical alignment is bottom.
-104  *
-105  * @type string
-106  * @name pv.Label.prototype.textBaseline
-107  */
-108 
-109 /**
-110  * The text margin; may be specified in pixels, or in font-dependent units (such
-111  * as ".1ex"). The margin can be used to pad text away from its anchor location,
-112  * in a direction dependent on the horizontal and vertical alignment
-113  * properties. For example, if the text is left- and middle-aligned, the margin
-114  * shifts the text to the right. The default margin is 3 pixels.
-115  *
-116  * @type number
-117  * @name pv.Label.prototype.textMargin
-118  */
-119 
-120 /**
-121  * A list of shadow effects to be applied to text, per the CSS Text Level 3
-122  * text-shadow property. An example specification is "0.1em 0.1em 0.1em
-123  * rgba(0,0,0,.5)"; the first length is the horizontal offset, the second the
-124  * vertical offset, and the third the blur radius.
-125  *
-126  * @see <a href="http://www.w3.org/TR/css3-text/#text-shadow">CSS3 text</a>
-127  * @type string
-128  * @name pv.Label.prototype.textShadow
-129  */
-130 
-131 /**
-132  * A list of decoration to be applied to text, per the CSS Text Level 3
-133  * text-decoration property. An example specification is "underline".
-134  *
-135  * @see <a href="http://www.w3.org/TR/css3-text/#text-decoration">CSS3 text</a>
-136  * @type string
-137  * @name pv.Label.prototype.textDecoration
-138  */
-139 
-140 /**
-141  * Default properties for labels. See the individual properties for the default
-142  * values.
-143  *
-144  * @type pv.Label
-145  */
-146 pv.Label.prototype.defaults = new pv.Label()
-147     .extend(pv.Mark.prototype.defaults)
-148     .events("none")
-149     .text(pv.identity)
-150     .font("10px sans-serif")
-151     .textAngle(0)
-152     .textStyle("black")
-153     .textAlign("left")
-154     .textBaseline("bottom")
-155     .textMargin(3);
-156 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Line.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Line.js.html deleted file mode 100644 index 899aba7a..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Line.js.html +++ /dev/null @@ -1,203 +0,0 @@ -
  1 /**
-  2  * Constructs a new line mark with default properties. Lines are not typically
-  3  * constructed directly, but by adding to a panel or an existing mark via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Represents a series of connected line segments, or <i>polyline</i>,
-  7  * that can be stroked with a configurable color and thickness. Each
-  8  * articulation point in the line corresponds to a datum; for <i>n</i> points,
-  9  * <i>n</i>-1 connected line segments are drawn. The point is positioned using
- 10  * the box model. Arbitrary paths are also possible, allowing radar plots and
- 11  * other custom visualizations.
- 12  *
- 13  * <p>Like areas, lines can be stroked and filled with arbitrary colors. In most
- 14  * cases, lines are only stroked, but the fill style can be used to construct
- 15  * arbitrary polygons.
- 16  *
- 17  * <p>See also the <a href="../../api/Line.html">Line guide</a>.
- 18  *
- 19  * @extends pv.Mark
- 20  */
- 21 pv.Line = function() {
- 22   pv.Mark.call(this);
- 23 };
- 24 
- 25 pv.Line.prototype = pv.extend(pv.Mark)
- 26     .property("lineWidth", Number)
- 27     .property("lineJoin", String)
- 28     .property("strokeStyle", pv.color)
- 29     .property("fillStyle", pv.color)
- 30     .property("segmented", Boolean)
- 31     .property("interpolate", String)
- 32     .property("eccentricity", Number)
- 33     .property("tension", Number);
- 34 
- 35 pv.Line.prototype.type = "line";
- 36 
- 37 /**
- 38  * The width of stroked lines, in pixels; used in conjunction with
- 39  * <tt>strokeStyle</tt> to stroke the line.
- 40  *
- 41  * @type number
- 42  * @name pv.Line.prototype.lineWidth
- 43  */
- 44 
- 45 /**
- 46  * The style of stroked lines; used in conjunction with <tt>lineWidth</tt> to
- 47  * stroke the line. The default value of this property is a categorical color.
- 48  *
- 49  * @type string
- 50  * @name pv.Line.prototype.strokeStyle
- 51  * @see pv.color
- 52  */
- 53 
- 54 /**
- 55  * The type of corners where two lines meet. Accepted values are "bevel",
- 56  * "round" and "miter". The default value is "miter".
- 57  *
- 58  * <p>For segmented lines, only "miter" joins and "linear" interpolation are
- 59  * currently supported. Any other value, including null, will disable joins,
- 60  * producing disjoint line segments. Note that the miter joins must be computed
- 61  * manually (at least in the current SVG renderer); since this calculation may
- 62  * be expensive and unnecessary for small lines, specifying null can improve
- 63  * performance significantly.
- 64  *
- 65  * <p>This property is <i>fixed</i>. See {@link pv.Mark}.
- 66  *
- 67  * @type string
- 68  * @name pv.Line.prototype.lineJoin
- 69  */
- 70 
- 71 /**
- 72  * The line fill style; if non-null, the interior of the line is closed and
- 73  * filled with the specified color. The default value of this property is a
- 74  * null, meaning that lines are not filled by default.
- 75  *
- 76  * <p>This property is <i>fixed</i>. See {@link pv.Mark}.
- 77  *
- 78  * @type string
- 79  * @name pv.Line.prototype.fillStyle
- 80  * @see pv.color
- 81  */
- 82 
- 83 /**
- 84  * Whether the line is segmented; whether variations in stroke style, line width
- 85  * and the other properties are treated as fixed. Rendering segmented lines is
- 86  * noticeably slower than non-segmented lines.
- 87  *
- 88  * <p>This property is <i>fixed</i>. See {@link pv.Mark}.
- 89  *
- 90  * @type boolean
- 91  * @name pv.Line.prototype.segmented
- 92  */
- 93 
- 94 /**
- 95  * How to interpolate between values. Linear interpolation ("linear") is the
- 96  * default, producing a straight line between points. For piecewise constant
- 97  * functions (i.e., step functions), either "step-before" or "step-after" can be
- 98  * specified. To draw a clockwise circular arc between points, specify "polar";
- 99  * to draw a counterclockwise circular arc between points, specify
-100  * "polar-reverse". To draw open uniform b-splines, specify "basis". To draw
-101  * cardinal splines, specify "cardinal"; see also {@link #tension}.
-102  *
-103  * <p>This property is <i>fixed</i>. See {@link pv.Mark}.
-104  *
-105  * @type string
-106  * @name pv.Line.prototype.interpolate
-107  */
-108 
-109 /**
-110  * The eccentricity of polar line segments; used in conjunction with
-111  * interpolate("polar"). The default value of 0 means that line segments are
-112  * drawn as circular arcs. A value of 1 draws a straight line. A value between 0
-113  * and 1 draws an elliptical arc with the given eccentricity.
-114  *
-115  * @type number
-116  * @name pv.Line.prototype.eccentricity
-117  */
-118 
-119 /**
-120  * The tension of cardinal splines; used in conjunction with
-121  * interpolate("cardinal"). A value between 0 and 1 draws cardinal splines with
-122  * the given tension. In some sense, the tension can be interpreted as the
-123  * "length" of the tangent; a tension of 1 will yield all zero tangents (i.e.,
-124  * linear interpolation), and a tension of 0 yields a Catmull-Rom spline. The
-125  * default value is 0.7.
-126  *
-127  * <p>This property is <i>fixed</i>. See {@link pv.Mark}.
-128  *
-129  * @type number
-130  * @name pv.Line.prototype.tension
-131  */
-132 
-133 /**
-134  * Default properties for lines. By default, there is no fill and the stroke
-135  * style is a categorical color. The default interpolation is linear.
-136  *
-137  * @type pv.Line
-138  */
-139 pv.Line.prototype.defaults = new pv.Line()
-140     .extend(pv.Mark.prototype.defaults)
-141     .lineJoin("miter")
-142     .lineWidth(1.5)
-143     .strokeStyle(pv.Colors.category10().by(pv.parent))
-144     .interpolate("linear")
-145     .eccentricity(0)
-146     .tension(.7);
-147 
-148 /** @private Reuse Area's implementation for segmented bind & build. */
-149 pv.Line.prototype.bind = pv.Area.prototype.bind;
-150 pv.Line.prototype.buildInstance = pv.Area.prototype.buildInstance;
-151 
-152 /**
-153  * Constructs a new line anchor with default properties. Lines support five
-154  * different anchors:<ul>
-155  *
-156  * <li>top
-157  * <li>left
-158  * <li>center
-159  * <li>bottom
-160  * <li>right
-161  *
-162  * </ul>In addition to positioning properties (left, right, top bottom), the
-163  * anchors support text rendering properties (text-align, text-baseline). Text is
-164  * rendered to appear outside the line. Note that this behavior is different
-165  * from other mark anchors, which default to rendering text <i>inside</i> the
-166  * mark.
-167  *
-168  * <p>For consistency with the other mark types, the anchor positions are
-169  * defined in terms of their opposite edge. For example, the top anchor defines
-170  * the bottom property, such that a bar added to the top anchor grows upward.
-171  *
-172  * @param {string} name the anchor name; either a string or a property function.
-173  * @returns {pv.Anchor}
-174  */
-175 pv.Line.prototype.anchor = function(name) {
-176   return pv.Area.prototype.anchor.call(this, name)
-177     .textAlign(function(d) {
-178         switch (this.name()) {
-179           case "left": return "right";
-180           case "bottom":
-181           case "top":
-182           case "center": return "center";
-183           case "right": return "left";
-184         }
-185       })
-186     .textBaseline(function(d) {
-187         switch (this.name()) {
-188           case "right":
-189           case "left":
-190           case "center": return "middle";
-191           case "top": return "bottom";
-192           case "bottom": return "top";
-193         }
-194       });
-195 };
-196 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Mark.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Mark.js.html deleted file mode 100644 index f3b014e8..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Mark.js.html +++ /dev/null @@ -1,1219 +0,0 @@ -
  1 /**
-  2  * Constructs a new mark with default properties. Marks, with the exception of
-  3  * the root panel, are not typically constructed directly; instead, they are
-  4  * added to a panel or an existing mark via {@link pv.Mark#add}.
-  5  *
-  6  * @class Represents a data-driven graphical mark. The <tt>Mark</tt> class is
-  7  * the base class for all graphical marks in Protovis; it does not provide any
-  8  * specific rendering functionality, but together with {@link Panel} establishes
-  9  * the core framework.
- 10  *
- 11  * <p>Concrete mark types include familiar visual elements such as bars, lines
- 12  * and labels. Although a bar mark may be used to construct a bar chart, marks
- 13  * know nothing about charts; it is only through their specification and
- 14  * composition that charts are produced. These building blocks permit many
- 15  * combinatorial possibilities.
- 16  *
- 17  * <p>Marks are associated with <b>data</b>: a mark is generated once per
- 18  * associated datum, mapping the datum to visual <b>properties</b> such as
- 19  * position and color. Thus, a single mark specification represents a set of
- 20  * visual elements that share the same data and visual encoding. The type of
- 21  * mark defines the names of properties and their meaning. A property may be
- 22  * static, ignoring the associated datum and returning a constant; or, it may be
- 23  * dynamic, derived from the associated datum or index. Such dynamic encodings
- 24  * can be specified succinctly using anonymous functions. Special properties
- 25  * called event handlers can be registered to add interactivity.
- 26  *
- 27  * <p>Protovis uses <b>inheritance</b> to simplify the specification of related
- 28  * marks: a new mark can be derived from an existing mark, inheriting its
- 29  * properties. The new mark can then override properties to specify new
- 30  * behavior, potentially in terms of the old behavior. In this way, the old mark
- 31  * serves as the <b>prototype</b> for the new mark. Most mark types share the
- 32  * same basic properties for consistency and to facilitate inheritance.
- 33  *
- 34  * <p>The prioritization of redundant properties is as follows:<ol>
- 35  *
- 36  * <li>If the <tt>width</tt> property is not specified (i.e., null), its value
- 37  * is the width of the parent panel, minus this mark's left and right margins;
- 38  * the left and right margins are zero if not specified.
- 39  *
- 40  * <li>Otherwise, if the <tt>right</tt> margin is not specified, its value is
- 41  * the width of the parent panel, minus this mark's width and left margin; the
- 42  * left margin is zero if not specified.
- 43  *
- 44  * <li>Otherwise, if the <tt>left</tt> property is not specified, its value is
- 45  * the width of the parent panel, minus this mark's width and the right margin.
- 46  *
- 47  * </ol>This prioritization is then duplicated for the <tt>height</tt>,
- 48  * <tt>bottom</tt> and <tt>top</tt> properties, respectively.
- 49  *
- 50  * <p>While most properties are <i>variable</i>, some mark types, such as lines
- 51  * and areas, generate a single visual element rather than a distinct visual
- 52  * element per datum. With these marks, some properties may be <b>fixed</b>.
- 53  * Fixed properties can vary per mark, but not <i>per datum</i>! These
- 54  * properties are evaluated solely for the first (0-index) datum, and typically
- 55  * are specified as a constant. However, it is valid to use a function if the
- 56  * property varies between panels or is dynamically generated.
- 57  *
- 58  * <p>See also the <a href="../../api/">Protovis guide</a>.
- 59  */
- 60 pv.Mark = function() {
- 61   /*
- 62    * TYPE 0 constant defs
- 63    * TYPE 1 function defs
- 64    * TYPE 2 constant properties
- 65    * TYPE 3 function properties
- 66    * in order of evaluation!
- 67    */
- 68   this.$properties = [];
- 69   this.$handlers = {};
- 70 };
- 71 
- 72 /** @private Records which properties are defined on this mark type. */
- 73 pv.Mark.prototype.properties = {};
- 74 
- 75 /** @private Records the cast function for each property. */
- 76 pv.Mark.cast = {};
- 77 
- 78 /**
- 79  * @private Defines and registers a property method for the property with the
- 80  * given name.  This method should be called on a mark class prototype to define
- 81  * each exposed property. (Note this refers to the JavaScript
- 82  * <tt>prototype</tt>, not the Protovis mark prototype, which is the {@link
- 83  * #proto} field.)
- 84  *
- 85  * <p>The created property method supports several modes of invocation: <ol>
- 86  *
- 87  * <li>If invoked with a <tt>Function</tt> argument, this function is evaluated
- 88  * for each associated datum. The return value of the function is used as the
- 89  * computed property value. The context of the function (<tt>this</tt>) is this
- 90  * mark. The arguments to the function are the associated data of this mark and
- 91  * any enclosing panels. For example, a linear encoding of numerical data to
- 92  * height is specified as
- 93  *
- 94  * <pre>m.height(function(d) d * 100);</pre>
- 95  *
- 96  * The expression <tt>d * 100</tt> will be evaluated for the height property of
- 97  * each mark instance. The return value of the property method (e.g.,
- 98  * <tt>m.height</tt>) is this mark (<tt>m</tt>)).<p>
- 99  *
-100  * <li>If invoked with a non-function argument, the property is treated as a
-101  * constant. The return value of the property method (e.g., <tt>m.height</tt>)
-102  * is this mark.<p>
-103  *
-104  * <li>If invoked with no arguments, the computed property value for the current
-105  * mark instance in the scene graph is returned. This facilitates <i>property
-106  * chaining</i>, where one mark's properties are defined in terms of another's.
-107  * For example, to offset a mark's location from its prototype, you might say
-108  *
-109  * <pre>m.top(function() this.proto.top() + 10);</pre>
-110  *
-111  * Note that the index of the mark being evaluated (in the above example,
-112  * <tt>this.proto</tt>) is inherited from the <tt>Mark</tt> class and set by
-113  * this mark. So, if the fifth element's top property is being evaluated, the
-114  * fifth instance of <tt>this.proto</tt> will similarly be queried for the value
-115  * of its top property. If the mark being evaluated has a different number of
-116  * instances, or its data is unrelated, the behavior of this method is
-117  * undefined. In these cases it may be better to index the <tt>scene</tt>
-118  * explicitly to specify the exact instance.
-119  *
-120  * </ol><p>Property names should follow standard JavaScript method naming
-121  * conventions, using lowerCamel-style capitalization.
-122  *
-123  * <p>In addition to creating the property method, every property is registered
-124  * in the {@link #properties} map on the <tt>prototype</tt>. Although this is an
-125  * instance field, it is considered immutable and shared by all instances of a
-126  * given mark type. The <tt>properties</tt> map can be queried to see if a mark
-127  * type defines a particular property, such as width or height.
-128  *
-129  * @param {string} name the property name.
-130  * @param {function} [cast] the cast function for this property.
-131  */
-132 pv.Mark.prototype.property = function(name, cast) {
-133   if (!this.hasOwnProperty("properties")) {
-134     this.properties = pv.extend(this.properties);
-135   }
-136   this.properties[name] = true;
-137 
-138   /*
-139    * Define the setter-getter globally, since the default behavior should be the
-140    * same for all properties, and since the Protovis inheritance chain is
-141    * independent of the JavaScript inheritance chain. For example, anchors
-142    * define a "name" property that is evaluated on derived marks, even though
-143    * those marks don't normally have a name.
-144    */
-145   pv.Mark.prototype.propertyMethod(name, false, pv.Mark.cast[name] = cast);
-146   return this;
-147 };
-148 
-149 /**
-150  * @private Defines a setter-getter for the specified property.
-151  *
-152  * <p>If a cast function has been assigned to the specified property name, the
-153  * property function is wrapped by the cast function, or, if a constant is
-154  * specified, the constant is immediately cast. Note, however, that if the
-155  * property value is null, the cast function is not invoked.
-156  *
-157  * @param {string} name the property name.
-158  * @param {boolean} [def] whether is a property or a def.
-159  * @param {function} [cast] the cast function for this property.
-160  */
-161 pv.Mark.prototype.propertyMethod = function(name, def, cast) {
-162   if (!cast) cast = pv.Mark.cast[name];
-163   this[name] = function(v) {
-164 
-165       /* If this is a def, use it rather than property. */
-166       if (def && this.scene) {
-167         var defs = this.scene.defs;
-168         if (arguments.length) {
-169           defs[name] = {
-170             id: (v == null) ? 0 : pv.id(),
-171             value: ((v != null) && cast) ? cast(v) : v
-172           };
-173           return this;
-174         }
-175         return defs[name] ? defs[name].value : null;
-176       }
-177 
-178       /* If arguments are specified, set the property value. */
-179       if (arguments.length) {
-180         var type = !def << 1 | (typeof v == "function");
-181         this.propertyValue(name, (type & 1 && cast) ? function() {
-182             var x = v.apply(this, arguments);
-183             return (x != null) ? cast(x) : null;
-184           } : (((v != null) && cast) ? cast(v) : v)).type = type;
-185         return this;
-186       }
-187 
-188       return this.instance()[name];
-189     };
-190 };
-191 
-192 /** @private Sets the value of the property <i>name</i> to <i>v</i>. */
-193 pv.Mark.prototype.propertyValue = function(name, v) {
-194   var properties = this.$properties, p = {name: name, id: pv.id(), value: v};
-195   for (var i = 0; i < properties.length; i++) {
-196     if (properties[i].name == name) {
-197       properties.splice(i, 1);
-198       break;
-199     }
-200   }
-201   properties.push(p);
-202   return p;
-203 };
-204 
-205 /* Define all global properties. */
-206 pv.Mark.prototype
-207     .property("data")
-208     .property("visible", Boolean)
-209     .property("left", Number)
-210     .property("right", Number)
-211     .property("top", Number)
-212     .property("bottom", Number)
-213     .property("cursor", String)
-214     .property("title", String)
-215     .property("reverse", Boolean)
-216     .property("antialias", Boolean)
-217     .property("events", String);
-218 
-219 /**
-220  * The mark type; a lower camelCase name. The type name controls rendering
-221  * behavior, and unless the rendering engine is extended, must be one of the
-222  * built-in concrete mark types: area, bar, dot, image, label, line, panel,
-223  * rule, or wedge.
-224  *
-225  * @type string
-226  * @name pv.Mark.prototype.type
-227  */
-228 
-229 /**
-230  * The mark prototype, possibly undefined, from which to inherit property
-231  * functions. The mark prototype is not necessarily of the same type as this
-232  * mark. Any properties defined on this mark will override properties inherited
-233  * either from the prototype or from the type-specific defaults.
-234  *
-235  * @type pv.Mark
-236  * @name pv.Mark.prototype.proto
-237  */
-238 
-239 /**
-240  * The enclosing parent panel. The parent panel is generally undefined only for
-241  * the root panel; however, it is possible to create "offscreen" marks that are
-242  * used only for inheritance purposes.
-243  *
-244  * @type pv.Panel
-245  * @name pv.Mark.prototype.parent
-246  */
-247 
-248 /**
-249  * The child index. -1 if the enclosing parent panel is null; otherwise, the
-250  * zero-based index of this mark into the parent panel's <tt>children</tt> array.
-251  *
-252  * @type number
-253  */
-254 pv.Mark.prototype.childIndex = -1;
-255 
-256 /**
-257  * The mark index. The value of this field depends on which instance (i.e.,
-258  * which element of the data array) is currently being evaluated. During the
-259  * build phase, the index is incremented over each datum; when handling events,
-260  * the index is set to the instance that triggered the event.
-261  *
-262  * @type number
-263  */
-264 pv.Mark.prototype.index = -1;
-265 
-266 /**
-267  * The current scale factor, based on any enclosing transforms. The current
-268  * scale can be used to create scale-independent graphics. For example, to
-269  * define a dot that has a radius of 10 irrespective of any zooming, say:
-270  *
-271  * <pre>dot.radius(function() 10 / this.scale)</pre>
-272  *
-273  * Note that the stroke width and font size are defined irrespective of scale
-274  * (i.e., in screen space) already. Also note that when a transform is applied
-275  * to a panel, the scale affects only the child marks, not the panel itself.
-276  *
-277  * @type number
-278  * @see pv.Panel#transform
-279  */
-280 pv.Mark.prototype.scale = 1;
-281 
-282 /**
-283  * @private The scene graph. The scene graph is an array of objects; each object
-284  * (or "node") corresponds to an instance of this mark and an element in the
-285  * data array. The scene graph can be traversed to lookup previously-evaluated
-286  * properties.
-287  *
-288  * @name pv.Mark.prototype.scene
-289  */
-290 
-291 /**
-292  * The root parent panel. This may be undefined for "offscreen" marks that are
-293  * created for inheritance purposes only.
-294  *
-295  * @type pv.Panel
-296  * @name pv.Mark.prototype.root
-297  */
-298 
-299 /**
-300  * The data property; an array of objects. The size of the array determines the
-301  * number of marks that will be instantiated; each element in the array will be
-302  * passed to property functions to compute the property values. Typically, the
-303  * data property is specified as a constant array, such as
-304  *
-305  * <pre>m.data([1, 2, 3, 4, 5]);</pre>
-306  *
-307  * However, it is perfectly acceptable to define the data property as a
-308  * function. This function might compute the data dynamically, allowing
-309  * different data to be used per enclosing panel. For instance, in the stacked
-310  * area graph example (see {@link #scene}), the data function on the area mark
-311  * dereferences each series.
-312  *
-313  * @type array
-314  * @name pv.Mark.prototype.data
-315  */
-316 
-317 /**
-318  * The visible property; a boolean determining whether or not the mark instance
-319  * is visible. If a mark instance is not visible, its other properties will not
-320  * be evaluated. Similarly, for panels no child marks will be rendered.
-321  *
-322  * @type boolean
-323  * @name pv.Mark.prototype.visible
-324  */
-325 
-326 /**
-327  * The left margin; the distance, in pixels, between the left edge of the
-328  * enclosing panel and the left edge of this mark. Note that in some cases this
-329  * property may be redundant with the right property, or with the conjunction of
-330  * right and width.
-331  *
-332  * @type number
-333  * @name pv.Mark.prototype.left
-334  */
-335 
-336 /**
-337  * The right margin; the distance, in pixels, between the right edge of the
-338  * enclosing panel and the right edge of this mark. Note that in some cases this
-339  * property may be redundant with the left property, or with the conjunction of
-340  * left and width.
-341  *
-342  * @type number
-343  * @name pv.Mark.prototype.right
-344  */
-345 
-346 /**
-347  * The top margin; the distance, in pixels, between the top edge of the
-348  * enclosing panel and the top edge of this mark. Note that in some cases this
-349  * property may be redundant with the bottom property, or with the conjunction
-350  * of bottom and height.
-351  *
-352  * @type number
-353  * @name pv.Mark.prototype.top
-354  */
-355 
-356 /**
-357  * The bottom margin; the distance, in pixels, between the bottom edge of the
-358  * enclosing panel and the bottom edge of this mark. Note that in some cases
-359  * this property may be redundant with the top property, or with the conjunction
-360  * of top and height.
-361  *
-362  * @type number
-363  * @name pv.Mark.prototype.bottom
-364  */
-365 
-366 /**
-367  * The cursor property; corresponds to the CSS cursor property. This is
-368  * typically used in conjunction with event handlers to indicate interactivity.
-369  *
-370  * @type string
-371  * @name pv.Mark.prototype.cursor
-372  * @see <a href="http://www.w3.org/TR/CSS2/ui.html#propdef-cursor">CSS2 cursor</a>
-373  */
-374 
-375 /**
-376  * The title property; corresponds to the HTML/SVG title property, allowing the
-377  * general of simple plain text tooltips.
-378  *
-379  * @type string
-380  * @name pv.Mark.prototype.title
-381  */
-382 
-383 /**
-384  * The events property; corresponds to the SVG pointer-events property,
-385  * specifying how the mark should participate in mouse events. The default value
-386  * is "painted". Supported values are:
-387  *
-388  * <p>"painted": The given mark may receive events when the mouse is over a
-389  * "painted" area. The painted areas are the interior (i.e., fill) of the mark
-390  * if a 'fillStyle' is specified, and the perimeter (i.e., stroke) of the mark
-391  * if a 'strokeStyle' is specified.
-392  *
-393  * <p>"all": The given mark may receive events when the mouse is over either the
-394  * interior (i.e., fill) or the perimeter (i.e., stroke) of the mark, regardless
-395  * of the specified fillStyle and strokeStyle.
-396  *
-397  * <p>"none": The given mark may not receive events.
-398  *
-399  * @type string
-400  * @name pv.Mark.prototype.events
-401  */
-402 
-403 /**
-404  * The reverse property; a boolean determining whether marks are ordered from
-405  * front-to-back or back-to-front. SVG does not support explicit z-ordering;
-406  * shapes are rendered in the order they appear. Thus, by default, marks are
-407  * rendered in data order. Setting the reverse property to false reverses the
-408  * order in which they are rendered; however, the properties are still evaluated
-409  * (i.e., built) in forward order.
-410  *
-411  * @type boolean
-412  * @name pv.Mark.prototype.reverse
-413  */
-414 
-415 /**
-416  * Default properties for all mark types. By default, the data array is the
-417  * parent data as a single-element array; if the data property is not specified,
-418  * this causes each mark to be instantiated as a singleton with the parents
-419  * datum. The visible property is true by default, and the reverse property is
-420  * false.
-421  *
-422  * @type pv.Mark
-423  */
-424 pv.Mark.prototype.defaults = new pv.Mark()
-425     .data(function(d) { return [d]; })
-426     .visible(true)
-427     .antialias(true)
-428     .events("painted");
-429 
-430 /**
-431  * Sets the prototype of this mark to the specified mark. Any properties not
-432  * defined on this mark may be inherited from the specified prototype mark, or
-433  * its prototype, and so on. The prototype mark need not be the same type of
-434  * mark as this mark. (Note that for inheritance to be useful, properties with
-435  * the same name on different mark types should have equivalent meaning.)
-436  *
-437  * @param {pv.Mark} proto the new prototype.
-438  * @returns {pv.Mark} this mark.
-439  * @see #add
-440  */
-441 pv.Mark.prototype.extend = function(proto) {
-442   this.proto = proto;
-443   return this;
-444 };
-445 
-446 /**
-447  * Adds a new mark of the specified type to the enclosing parent panel, whilst
-448  * simultaneously setting the prototype of the new mark to be this mark.
-449  *
-450  * @param {function} type the type of mark to add; a constructor, such as
-451  * <tt>pv.Bar</tt>.
-452  * @returns {pv.Mark} the new mark.
-453  * @see #extend
-454  */
-455 pv.Mark.prototype.add = function(type) {
-456   return this.parent.add(type).extend(this);
-457 };
-458 
-459 /**
-460  * Defines a custom property on this mark. Custom properties are currently
-461  * fixed, in that they are initialized once per mark set (i.e., per parent panel
-462  * instance). Custom properties can be used to store local state for the mark,
-463  * such as data needed by other properties (e.g., a custom scale) or interaction
-464  * state.
-465  *
-466  * <p>WARNING We plan on changing this feature in a future release to define
-467  * standard properties, as opposed to <i>fixed</i> properties that behave
-468  * idiosyncratically within event handlers. Furthermore, we recommend storing
-469  * state in an external data structure, rather than tying it to the
-470  * visualization specification as with defs.
-471  *
-472  * @param {string} name the name of the local variable.
-473  * @param {function} [v] an optional initializer; may be a constant or a
-474  * function.
-475  */
-476 pv.Mark.prototype.def = function(name, v) {
-477   this.propertyMethod(name, true);
-478   return this[name](arguments.length > 1 ? v : null);
-479 };
-480 
-481 /**
-482  * Returns an anchor with the specified name. All marks support the five
-483  * standard anchor names:<ul>
-484  *
-485  * <li>top
-486  * <li>left
-487  * <li>center
-488  * <li>bottom
-489  * <li>right
-490  *
-491  * </ul>In addition to positioning properties (left, right, top bottom), the
-492  * anchors support text rendering properties (text-align, text-baseline). Text is
-493  * rendered to appear inside the mark by default.
-494  *
-495  * <p>To facilitate stacking, anchors are defined in terms of their opposite
-496  * edge. For example, the top anchor defines the bottom property, such that the
-497  * mark extends upwards; the bottom anchor instead defines the top property,
-498  * such that the mark extends downwards. See also {@link pv.Layout.Stack}.
-499  *
-500  * <p>While anchor names are typically constants, the anchor name is a true
-501  * property, which means you can specify a function to compute the anchor name
-502  * dynamically. See the {@link pv.Anchor#name} property for details.
-503  *
-504  * @param {string} name the anchor name; either a string or a property function.
-505  * @returns {pv.Anchor} the new anchor.
-506  */
-507 pv.Mark.prototype.anchor = function(name) {
-508   var target = this, scene;
-509 
-510   /* Default anchor name. */
-511   if (!name) name = "center";
-512 
-513   /** @private Find the instances of target that match source. */
-514   function instances(source) {
-515     var mark = target, index = [];
-516 
-517     /* Mirrored descent. */
-518     while (!(scene = mark.scene)) {
-519       source = source.parent;
-520       index.push({index: source.index, childIndex: mark.childIndex});
-521       mark = mark.parent;
-522     }
-523     while (index.length) {
-524       var i = index.pop();
-525       scene = scene[i.index].children[i.childIndex];
-526     }
-527 
-528     /*
-529      * When the anchor target is also an ancestor, as in the case of adding
-530      * to a panel anchor, only generate one instance per panel. Also, set
-531      * the margins to zero, since they are offset by the enclosing panel.
-532      */
-533     if (target.hasOwnProperty("index")) {
-534       var s = pv.extend(scene[target.index]);
-535       s.right = s.top = s.left = s.bottom = 0;
-536       return [s];
-537     }
-538     return scene;
-539   }
-540 
-541   return new pv.Anchor(this)
-542     .name(name)
-543     .def("$mark.anchor", function() {
-544         scene = this.scene.target = instances(this);
-545       })
-546     .data(function() {
-547         return scene.map(function(s) { return s.data; });
-548       })
-549     .visible(function() {
-550         return scene[this.index].visible;
-551       })
-552     .left(function() {
-553         var s = scene[this.index], w = s.width || 0;
-554         switch (this.name()) {
-555           case "bottom":
-556           case "top":
-557           case "center": return s.left + w / 2;
-558           case "left": return null;
-559         }
-560         return s.left + w;
-561       })
-562     .top(function() {
-563         var s = scene[this.index], h = s.height || 0;
-564         switch (this.name()) {
-565           case "left":
-566           case "right":
-567           case "center": return s.top + h / 2;
-568           case "top": return null;
-569         }
-570         return s.top + h;
-571       })
-572     .right(function() {
-573         var s = scene[this.index];
-574         return this.name() == "left" ? s.right + (s.width || 0) : null;
-575       })
-576     .bottom(function() {
-577         var s = scene[this.index];
-578         return this.name() == "top" ? s.bottom + (s.height || 0) : null;
-579       })
-580     .textAlign(function() {
-581         switch (this.name()) {
-582           case "bottom":
-583           case "top":
-584           case "center": return "center";
-585           case "right": return "right";
-586         }
-587         return "left";
-588       })
-589     .textBaseline(function() {
-590         switch (this.name()) {
-591           case "right":
-592           case "left":
-593           case "center": return "middle";
-594           case "top": return "top";
-595         }
-596         return "bottom";
-597       });
-598 };
-599 
-600 /**
-601  * Returns the anchor target of this mark, if it is derived from an anchor;
-602  * otherwise returns null. For example, if a label is derived from a bar anchor,
-603  *
-604  * <pre>bar.anchor("top").add(pv.Label);</pre>
-605  *
-606  * then property functions on the label can refer to the bar via the
-607  * <tt>anchorTarget</tt> method. This method is also useful for mark types
-608  * defining properties on custom anchors.
-609  *
-610  * @returns {pv.Mark} the anchor target of this mark; possibly null.
-611  */
-612 pv.Mark.prototype.anchorTarget = function() {
-613   return this.proto.anchorTarget();
-614 };
-615 
-616 /**
-617  * Alias for setting the left, right, top and bottom properties simultaneously.
-618  *
-619  * @see #left
-620  * @see #right
-621  * @see #top
-622  * @see #bottom
-623  * @returns {pv.Mark} this.
-624  */
-625 pv.Mark.prototype.margin = function(n) {
-626   return this.left(n).right(n).top(n).bottom(n);
-627 };
-628 
-629 /**
-630  * @private Returns the current instance of this mark in the scene graph. This
-631  * is typically equivalent to <tt>this.scene[this.index]</tt>, however if the
-632  * scene or index is unset, the default instance of the mark is returned. If no
-633  * default is set, the default is the last instance. Similarly, if the scene or
-634  * index of the parent panel is unset, the default instance of this mark in the
-635  * last instance of the enclosing panel is returned, and so on.
-636  *
-637  * @returns a node in the scene graph.
-638  */
-639 pv.Mark.prototype.instance = function(defaultIndex) {
-640   var scene = this.scene || this.parent.instance(-1).children[this.childIndex],
-641       index = !arguments.length || this.hasOwnProperty("index") ? this.index : defaultIndex;
-642   return scene[index < 0 ? scene.length - 1 : index];
-643 };
-644 
-645 /**
-646  * @private Returns the first instance of this mark in the scene graph. This
-647  * method can only be called when the mark is bound to the scene graph (for
-648  * example, from an event handler, or within a property function).
-649  *
-650  * @returns a node in the scene graph.
-651  */
-652 pv.Mark.prototype.first = function() {
-653   return this.scene[0];
-654 };
-655 
-656 /**
-657  * @private Returns the last instance of this mark in the scene graph. This
-658  * method can only be called when the mark is bound to the scene graph (for
-659  * example, from an event handler, or within a property function). In addition,
-660  * note that mark instances are built sequentially, so the last instance of this
-661  * mark may not yet be constructed.
-662  *
-663  * @returns a node in the scene graph.
-664  */
-665 pv.Mark.prototype.last = function() {
-666   return this.scene[this.scene.length - 1];
-667 };
-668 
-669 /**
-670  * @private Returns the previous instance of this mark in the scene graph, or
-671  * null if this is the first instance.
-672  *
-673  * @returns a node in the scene graph, or null.
-674  */
-675 pv.Mark.prototype.sibling = function() {
-676   return (this.index == 0) ? null : this.scene[this.index - 1];
-677 };
-678 
-679 /**
-680  * @private Returns the current instance in the scene graph of this mark, in the
-681  * previous instance of the enclosing parent panel. May return null if this
-682  * instance could not be found.
-683  *
-684  * @returns a node in the scene graph, or null.
-685  */
-686 pv.Mark.prototype.cousin = function() {
-687   var p = this.parent, s = p && p.sibling();
-688   return (s && s.children) ? s.children[this.childIndex][this.index] : null;
-689 };
-690 
-691 /**
-692  * Renders this mark, including recursively rendering all child marks if this is
-693  * a panel. This method finds all instances of this mark and renders them. This
-694  * method descends recursively to the level of the mark to be rendered, finding
-695  * all visible instances of the mark. After the marks are rendered, the scene
-696  * and index attributes are removed from the mark to restore them to a clean
-697  * state.
-698  *
-699  * <p>If an enclosing panel has an index property set (as is the case inside in
-700  * an event handler), then only instances of this mark inside the given instance
-701  * of the panel will be rendered; otherwise, all visible instances of the mark
-702  * will be rendered.
-703  */
-704 pv.Mark.prototype.render = function() {
-705   var parent = this.parent,
-706       stack = pv.Mark.stack;
-707 
-708   /* For the first render, take it from the top. */
-709   if (parent && !this.root.scene) {
-710     this.root.render();
-711     return;
-712   }
-713 
-714   /* Record the path to this mark. */
-715   var indexes = [];
-716   for (var mark = this; mark.parent; mark = mark.parent) {
-717     indexes.unshift(mark.childIndex);
-718   }
-719 
-720   /** @private */
-721   function render(mark, depth, scale) {
-722     mark.scale = scale;
-723     if (depth < indexes.length) {
-724       stack.unshift(null);
-725       if (mark.hasOwnProperty("index")) {
-726         renderInstance(mark, depth, scale);
-727       } else {
-728         for (var i = 0, n = mark.scene.length; i < n; i++) {
-729           mark.index = i;
-730           renderInstance(mark, depth, scale);
-731         }
-732         delete mark.index;
-733       }
-734       stack.shift();
-735     } else {
-736       mark.build();
-737 
-738       /*
-739        * In the update phase, the scene is rendered by creating and updating
-740        * elements and attributes in the SVG image. No properties are evaluated
-741        * during the update phase; instead the values computed previously in the
-742        * build phase are simply translated into SVG. The update phase is
-743        * decoupled (see pv.Scene) to allow different rendering engines.
-744        */
-745       pv.Scene.scale = scale;
-746       pv.Scene.updateAll(mark.scene);
-747     }
-748     delete mark.scale;
-749   }
-750 
-751   /**
-752    * @private Recursively renders the current instance of the specified mark.
-753    * This is slightly tricky because `index` and `scene` properties may or may
-754    * not already be set; if they are set, it means we are rendering only a
-755    * specific instance; if they are unset, we are rendering all instances.
-756    * Furthermore, we must preserve the original context of these properties when
-757    * rendering completes.
-758    *
-759    * <p>Another tricky aspect is that the `scene` attribute should be set for
-760    * any preceding children, so as to allow property chaining. This is
-761    * consistent with first-pass rendering.
-762    */
-763   function renderInstance(mark, depth, scale) {
-764     var s = mark.scene[mark.index], i;
-765     if (s.visible) {
-766       var childIndex = indexes[depth],
-767           child = mark.children[childIndex];
-768 
-769       /* Set preceding child scenes. */
-770       for (i = 0; i < childIndex; i++) {
-771         mark.children[i].scene = s.children[i];
-772       }
-773 
-774       /* Set current child scene, if necessary. */
-775       stack[0] = s.data;
-776       if (child.scene) {
-777         render(child, depth + 1, scale * s.transform.k);
-778       } else {
-779         child.scene = s.children[childIndex];
-780         render(child, depth + 1, scale * s.transform.k);
-781         delete child.scene;
-782       }
-783 
-784       /* Clear preceding child scenes. */
-785       for (i = 0; i < childIndex; i++) {
-786         delete mark.children[i].scene;
-787       }
-788     }
-789   }
-790 
-791   /* Bind this mark's property definitions. */
-792   this.bind();
-793 
-794   /* The render context is the first ancestor with an explicit index. */
-795   while (parent && !parent.hasOwnProperty("index")) parent = parent.parent;
-796 
-797   /* Recursively render all instances of this mark. */
-798   this.context(
-799       parent ? parent.scene : undefined,
-800       parent ? parent.index : -1,
-801       function() { render(this.root, 0, 1); });
-802 };
-803 
-804 /** @private Stores the current data stack. */
-805 pv.Mark.stack = [];
-806 
-807 /**
-808  * @private In the bind phase, inherited property definitions are cached so they
-809  * do not need to be queried during build.
-810  */
-811 pv.Mark.prototype.bind = function() {
-812   var seen = {}, types = [[], [], [], []], data, visible;
-813 
-814   /** Scans the proto chain for the specified mark. */
-815   function bind(mark) {
-816     do {
-817       var properties = mark.$properties;
-818       for (var i = properties.length - 1; i >= 0 ; i--) {
-819         var p = properties[i];
-820         if (!(p.name in seen)) {
-821           seen[p.name] = p;
-822           switch (p.name) {
-823             case "data": data = p; break;
-824             case "visible": visible = p; break;
-825             default: types[p.type].push(p); break;
-826           }
-827         }
-828       }
-829     } while (mark = mark.proto);
-830   }
-831 
-832   /* Scan the proto chain for all defined properties. */
-833   bind(this);
-834   bind(this.defaults);
-835   types[1].reverse();
-836   types[3].reverse();
-837 
-838   /* Any undefined properties are null. */
-839   var mark = this;
-840   do for (var name in mark.properties) {
-841     if (!(name in seen)) {
-842       types[2].push(seen[name] = {name: name, type: 2, value: null});
-843     }
-844   } while (mark = mark.proto);
-845 
-846   /* Define setter-getter for inherited defs. */
-847   var defs = types[0].concat(types[1]);
-848   for (var i = 0; i < defs.length; i++) {
-849     this.propertyMethod(defs[i].name, true);
-850   }
-851 
-852   /* Setup binds to evaluate constants before functions. */
-853   this.binds = {
-854     properties: seen,
-855     data: data,
-856     defs: defs,
-857     required: [visible],
-858     optional: pv.blend(types)
-859   };
-860 };
-861 
-862 /**
-863  * @private Evaluates properties and computes implied properties. Properties are
-864  * stored in the {@link #scene} array for each instance of this mark.
-865  *
-866  * <p>As marks are built recursively, the {@link #index} property is updated to
-867  * match the current index into the data array for each mark. Note that the
-868  * index property is only set for the mark currently being built and its
-869  * enclosing parent panels. The index property for other marks is unset, but is
-870  * inherited from the global <tt>Mark</tt> class prototype. This allows mark
-871  * properties to refer to properties on other marks <i>in the same panel</i>
-872  * conveniently; however, in general it is better to reference mark instances
-873  * specifically through the scene graph rather than depending on the magical
-874  * behavior of {@link #index}.
-875  *
-876  * <p>The root scene array has a special property, <tt>data</tt>, which stores
-877  * the current data stack. The first element in this stack is the current datum,
-878  * followed by the datum of the enclosing parent panel, and so on. The data
-879  * stack should not be accessed directly; instead, property functions are passed
-880  * the current data stack as arguments.
-881  *
-882  * <p>The evaluation of the <tt>data</tt> and <tt>visible</tt> properties is
-883  * special. The <tt>data</tt> property is evaluated first; unlike the other
-884  * properties, the data stack is from the parent panel, rather than the current
-885  * mark, since the data is not defined until the data property is evaluated.
-886  * The <tt>visisble</tt> property is subsequently evaluated for each instance;
-887  * only if true will the {@link #buildInstance} method be called, evaluating
-888  * other properties and recursively building the scene graph.
-889  *
-890  * <p>If this mark is being re-built, any old instances of this mark that no
-891  * longer exist (because the new data array contains fewer elements) will be
-892  * cleared using {@link #clearInstance}.
-893  *
-894  * @param parent the instance of the parent panel from the scene graph.
-895  */
-896 pv.Mark.prototype.build = function() {
-897   var scene = this.scene, stack = pv.Mark.stack;
-898   if (!scene) {
-899     scene = this.scene = [];
-900     scene.mark = this;
-901     scene.type = this.type;
-902     scene.childIndex = this.childIndex;
-903     if (this.parent) {
-904       scene.parent = this.parent.scene;
-905       scene.parentIndex = this.parent.index;
-906     }
-907   }
-908 
-909   /* Evaluate defs. */
-910   if (this.binds.defs.length) {
-911     var defs = scene.defs;
-912     if (!defs) scene.defs = defs = {};
-913     for (var i = 0; i < this.binds.defs.length; i++) {
-914       var p = this.binds.defs[i], d = defs[p.name];
-915       if (!d || (p.id > d.id)) {
-916         defs[p.name] = {
-917           id: 0, // this def will be re-evaluated on next build
-918           value: (p.type & 1) ? p.value.apply(this, stack) : p.value
-919         };
-920       }
-921     }
-922   }
-923 
-924   /* Evaluate special data property. */
-925   var data = this.binds.data;
-926   data = data.type & 1 ? data.value.apply(this, stack) : data.value;
-927 
-928   /* Create, update and delete scene nodes. */
-929   stack.unshift(null);
-930   scene.length = data.length;
-931   for (var i = 0; i < data.length; i++) {
-932     pv.Mark.prototype.index = this.index = i;
-933     var s = scene[i];
-934     if (!s) scene[i] = s = {};
-935     s.data = stack[0] = data[i];
-936     this.buildInstance(s);
-937   }
-938   pv.Mark.prototype.index = -1;
-939   delete this.index;
-940   stack.shift();
-941 
-942   return this;
-943 };
-944 
-945 /**
-946  * @private Evaluates the specified array of properties for the specified
-947  * instance <tt>s</tt> in the scene graph.
-948  *
-949  * @param s a node in the scene graph; the instance of the mark to build.
-950  * @param properties an array of properties.
-951  */
-952 pv.Mark.prototype.buildProperties = function(s, properties) {
-953   for (var i = 0, n = properties.length; i < n; i++) {
-954     var p = properties[i], v = p.value; // assume case 2 (constant)
-955     switch (p.type) {
-956       case 0:
-957       case 1: v = this.scene.defs[p.name].value; break;
-958       case 3: v = v.apply(this, pv.Mark.stack); break;
-959     }
-960     s[p.name] = v;
-961   }
-962 };
-963 
-964 /**
-965  * @private Evaluates all of the properties for this mark for the specified
-966  * instance <tt>s</tt> in the scene graph. The set of properties to evaluate is
-967  * retrieved from the {@link #properties} array for this mark type (see {@link
-968  * #type}).  After these properties are evaluated, any <b>implied</b> properties
-969  * may be computed by the mark and set on the scene graph; see
-970  * {@link #buildImplied}.
-971  *
-972  * <p>For panels, this method recursively builds the scene graph for all child
-973  * marks as well. In general, this method should not need to be overridden by
-974  * concrete mark types.
-975  *
-976  * @param s a node in the scene graph; the instance of the mark to build.
-977  */
-978 pv.Mark.prototype.buildInstance = function(s) {
-979   this.buildProperties(s, this.binds.required);
-980   if (s.visible) {
-981     this.buildProperties(s, this.binds.optional);
-982     this.buildImplied(s);
-983   }
-984 };
-985 
-986 /**
-987  * @private Computes the implied properties for this mark for the specified
-988  * instance <tt>s</tt> in the scene graph. Implied properties are those with
-989  * dependencies on multiple other properties; for example, the width property
-990  * may be implied if the left and right properties are set. This method can be
-991  * overridden by concrete mark types to define new implied properties, if
-992  * necessary.
-993  *
-994  * @param s a node in the scene graph; the instance of the mark to build.
-995  */
-996 pv.Mark.prototype.buildImplied = function(s) {
-997   var l = s.left;
-998   var r = s.right;
-999   var t = s.top;
-1000   var b = s.bottom;
-1001 
-1002   /* Assume width and height are zero if not supported by this mark type. */
-1003   var p = this.properties;
-1004   var w = p.width ? s.width : 0;
-1005   var h = p.height ? s.height : 0;
-1006 
-1007   /* Compute implied width, right and left. */
-1008   var width = this.parent ? this.parent.width() : (w + l + r);
-1009   if (w == null) {
-1010     w = width - (r = r || 0) - (l = l || 0);
-1011   } else if (r == null) {
-1012     r = width - w - (l = l || 0);
-1013   } else if (l == null) {
-1014     l = width - w - (r = r || 0);
-1015   }
-1016 
-1017   /* Compute implied height, bottom and top. */
-1018   var height = this.parent ? this.parent.height() : (h + t + b);
-1019   if (h == null) {
-1020     h = height - (t = t || 0) - (b = b || 0);
-1021   } else if (b == null) {
-1022     b = height - h - (t = t || 0);
-1023   } else if (t == null) {
-1024     t = height - h - (b = b || 0);
-1025   }
-1026 
-1027   s.left = l;
-1028   s.right = r;
-1029   s.top = t;
-1030   s.bottom = b;
-1031 
-1032   /* Only set width and height if they are supported by this mark type. */
-1033   if (p.width) s.width = w;
-1034   if (p.height) s.height = h;
-1035 
-1036   /* Set any null colors to pv.Color.transparent. */
-1037   if (p.textStyle && !s.textStyle) s.textStyle = pv.Color.transparent;
-1038   if (p.fillStyle && !s.fillStyle) s.fillStyle = pv.Color.transparent;
-1039   if (p.strokeStyle && !s.strokeStyle) s.strokeStyle = pv.Color.transparent;
-1040 };
-1041 
-1042 /**
-1043  * Returns the current location of the mouse (cursor) relative to this mark's
-1044  * parent. The <i>x</i> coordinate corresponds to the left margin, while the
-1045  * <i>y</i> coordinate corresponds to the top margin.
-1046  *
-1047  * @returns {pv.Vector} the mouse location.
-1048  */
-1049 pv.Mark.prototype.mouse = function() {
-1050 
-1051   /* Compute xy-coordinates relative to the panel. */
-1052   var x = pv.event.pageX || 0,
-1053       y = pv.event.pageY || 0,
-1054       n = this.root.canvas();
-1055   do {
-1056     x -= n.offsetLeft;
-1057     y -= n.offsetTop;
-1058   } while (n = n.offsetParent);
-1059 
-1060   /* Compute the inverse transform of all enclosing panels. */
-1061   var t = pv.Transform.identity,
-1062       p = this.properties.transform ? this : this.parent,
-1063       pz = [];
-1064   do { pz.push(p); } while (p = p.parent);
-1065   while (p = pz.pop()) t = t.translate(p.left(), p.top()).times(p.transform());
-1066   t = t.invert();
-1067 
-1068   return pv.vector(x * t.k + t.x, y * t.k + t.y);
-1069 };
-1070 
-1071 /**
-1072  * Registers an event handler for the specified event type with this mark. When
-1073  * an event of the specified type is triggered, the specified handler will be
-1074  * invoked. The handler is invoked in a similar method to property functions:
-1075  * the context is <tt>this</tt> mark instance, and the arguments are the full
-1076  * data stack. Event handlers can use property methods to manipulate the display
-1077  * properties of the mark:
-1078  *
-1079  * <pre>m.event("click", function() this.fillStyle("red"));</pre>
-1080  *
-1081  * Alternatively, the external data can be manipulated and the visualization
-1082  * redrawn:
-1083  *
-1084  * <pre>m.event("click", function(d) {
-1085  *     data = all.filter(function(k) k.name == d);
-1086  *     vis.render();
-1087  *   });</pre>
-1088  *
-1089  * The return value of the event handler determines which mark gets re-rendered.
-1090  * Use defs ({@link #def}) to set temporary state from event handlers.
-1091  *
-1092  * <p>The complete set of event types is defined by SVG; see the reference
-1093  * below. The set of supported event types is:<ul>
-1094  *
-1095  * <li>click
-1096  * <li>mousedown
-1097  * <li>mouseup
-1098  * <li>mouseover
-1099  * <li>mousemove
-1100  * <li>mouseout
-1101  *
-1102  * </ul>Since Protovis does not specify any concept of focus, it does not
-1103  * support key events; these should be handled outside the visualization using
-1104  * standard JavaScript. In the future, support for interaction may be extended
-1105  * to support additional event types, particularly those most relevant to
-1106  * interactive visualization, such as selection.
-1107  *
-1108  * <p>TODO In the current implementation, event handlers are not inherited from
-1109  * prototype marks. They must be defined explicitly on each interactive mark. In
-1110  * addition, only one event handler for a given event type can be defined; when
-1111  * specifying multiple event handlers for the same type, only the last one will
-1112  * be used.
-1113  *
-1114  * @see <a href="http://www.w3.org/TR/SVGTiny12/interact.html#SVGEvents">SVG events</a>
-1115  * @param {string} type the event type.
-1116  * @param {function} handler the event handler.
-1117  * @returns {pv.Mark} this.
-1118  */
-1119 pv.Mark.prototype.event = function(type, handler) {
-1120   this.$handlers[type] = pv.functor(handler);
-1121   return this;
-1122 };
-1123 
-1124 /** @private Evaluates the function <i>f</i> with the specified context. */
-1125 pv.Mark.prototype.context = function(scene, index, f) {
-1126   var proto = pv.Mark.prototype,
-1127       stack = pv.Mark.stack,
-1128       oscene = pv.Mark.scene,
-1129       oindex = proto.index;
-1130 
-1131   /** @private Sets the context. */
-1132   function apply(scene, index) {
-1133     pv.Mark.scene = scene;
-1134     proto.index = index;
-1135     if (!scene) return;
-1136 
-1137     var that = scene.mark,
-1138         mark = that,
-1139         ancestors = [];
-1140 
-1141     /* Set ancestors' scene and index; populate data stack. */
-1142     do {
-1143       ancestors.push(mark);
-1144       stack.push(scene[index].data);
-1145       mark.index = index;
-1146       mark.scene = scene;
-1147       index = scene.parentIndex;
-1148       scene = scene.parent;
-1149     } while (mark = mark.parent);
-1150 
-1151     /* Set ancestors' scale; requires top-down. */
-1152     for (var i = ancestors.length - 1, k = 1; i > 0; i--) {
-1153       mark = ancestors[i];
-1154       mark.scale = k;
-1155       k *= mark.scene[mark.index].transform.k;
-1156     }
-1157 
-1158     /* Set children's scene and scale. */
-1159     if (that.children) for (var i = 0, n = that.children.length; i < n; i++) {
-1160       mark = that.children[i];
-1161       mark.scene = that.scene[that.index].children[i];
-1162       mark.scale = k;
-1163     }
-1164   }
-1165 
-1166   /** @private Clears the context. */
-1167   function clear(scene, index) {
-1168     if (!scene) return;
-1169     var that = scene.mark,
-1170         mark;
-1171 
-1172     /* Reset children. */
-1173     if (that.children) for (var i = 0, n = that.children.length; i < n; i++) {
-1174       mark = that.children[i];
-1175       delete mark.scene;
-1176       delete mark.scale;
-1177     }
-1178 
-1179     /* Reset ancestors. */
-1180     mark = that;
-1181     do {
-1182       stack.pop();
-1183       if (mark.parent) {
-1184         delete mark.scene;
-1185         delete mark.scale;
-1186       }
-1187       delete mark.index;
-1188     } while (mark = mark.parent);
-1189   }
-1190 
-1191   /* Context switch, invoke the function, then switch back. */
-1192   clear(oscene, oindex);
-1193   apply(scene, index);
-1194   try {
-1195     f.apply(this, stack);
-1196   } finally {
-1197     clear(scene, index);
-1198     apply(oscene, oindex);
-1199   }
-1200 };
-1201 
-1202 /** @private Execute the event listener, then re-render. */
-1203 pv.Mark.dispatch = function(type, scene, index) {
-1204   var m = scene.mark, p = scene.parent, l = m.$handlers[type];
-1205   if (!l) return p && pv.Mark.dispatch(type, p, scene.parentIndex);
-1206   m.context(scene, index, function() {
-1207       m = l.apply(m, pv.Mark.stack);
-1208       if (m && m.render) m.render();
-1209     });
-1210   return true;
-1211 };
-1212 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Panel.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Panel.js.html deleted file mode 100644 index 3b0a4899..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Panel.js.html +++ /dev/null @@ -1,281 +0,0 @@ -
  1 /**
-  2  * Constructs a new, empty panel with default properties. Panels, with the
-  3  * exception of the root panel, are not typically constructed directly; instead,
-  4  * they are added to an existing panel or mark via {@link pv.Mark#add}.
-  5  *
-  6  * @class Represents a container mark. Panels allow repeated or nested
-  7  * structures, commonly used in small multiple displays where a small
-  8  * visualization is tiled to facilitate comparison across one or more
-  9  * dimensions. Other types of visualizations may benefit from repeated and
- 10  * possibly overlapping structure as well, such as stacked area charts. Panels
- 11  * can also offset the position of marks to provide padding from surrounding
- 12  * content.
- 13  *
- 14  * <p>All Protovis displays have at least one panel; this is the root panel to
- 15  * which marks are rendered. The box model properties (four margins, width and
- 16  * height) are used to offset the positions of contained marks. The data
- 17  * property determines the panel count: a panel is generated once per associated
- 18  * datum. When nested panels are used, property functions can declare additional
- 19  * arguments to access the data associated with enclosing panels.
- 20  *
- 21  * <p>Panels can be rendered inline, facilitating the creation of sparklines.
- 22  * This allows designers to reuse browser layout features, such as text flow and
- 23  * tables; designers can also overlay HTML elements such as rich text and
- 24  * images.
- 25  *
- 26  * <p>All panels have a <tt>children</tt> array (possibly empty) containing the
- 27  * child marks in the order they were added. Panels also have a <tt>root</tt>
- 28  * field which points to the root (outermost) panel; the root panel's root field
- 29  * points to itself.
- 30  *
- 31  * <p>See also the <a href="../../api/">Protovis guide</a>.
- 32  *
- 33  * @extends pv.Bar
- 34  */
- 35 pv.Panel = function() {
- 36   pv.Bar.call(this);
- 37 
- 38   /**
- 39    * The child marks; zero or more {@link pv.Mark}s in the order they were
- 40    * added.
- 41    *
- 42    * @see #add
- 43    * @type pv.Mark[]
- 44    */
- 45   this.children = [];
- 46   this.root = this;
- 47 
- 48   /**
- 49    * The internal $dom field is set by the Protovis loader; see lang/init.js. It
- 50    * refers to the script element that contains the Protovis specification, so
- 51    * that the panel knows where in the DOM to insert the generated SVG element.
- 52    *
- 53    * @private
- 54    */
- 55   this.$dom = pv.$ && pv.$.s;
- 56 };
- 57 
- 58 pv.Panel.prototype = pv.extend(pv.Bar)
- 59     .property("transform")
- 60     .property("overflow", String)
- 61     .property("canvas", function(c) {
- 62         return (typeof c == "string")
- 63             ? document.getElementById(c)
- 64             : c; // assume that c is the passed-in element
- 65       });
- 66 
- 67 pv.Panel.prototype.type = "panel";
- 68 
- 69 /**
- 70  * The canvas element; either the string ID of the canvas element in the current
- 71  * document, or a reference to the canvas element itself. If null, a canvas
- 72  * element will be created and inserted into the document at the location of the
- 73  * script element containing the current Protovis specification. This property
- 74  * only applies to root panels and is ignored on nested panels.
- 75  *
- 76  * <p>Note: the "canvas" element here refers to a <tt>div</tt> (or other suitable
- 77  * HTML container element), <i>not</i> a <tt>canvas</tt> element. The name of
- 78  * this property is a historical anachronism from the first implementation that
- 79  * used HTML 5 canvas, rather than SVG.
- 80  *
- 81  * @type string
- 82  * @name pv.Panel.prototype.canvas
- 83  */
- 84 
- 85 /**
- 86  * Specifies whether child marks are clipped when they overflow this panel.
- 87  * This affects the clipping of all this panel's descendant marks.
- 88  *
- 89  * @type string
- 90  * @name pv.Panel.prototype.overflow
- 91  * @see <a href="http://www.w3.org/TR/CSS2/visufx.html#overflow">CSS2</a>
- 92  */
- 93 
- 94 /**
- 95  * The transform to be applied to child marks. The default transform is
- 96  * identity, which has no effect. Note that the panel's own fill and stroke are
- 97  * not affected by the transform, and panel's transform only affects the
- 98  * <tt>scale</tt> of child marks, not the panel itself.
- 99  *
-100  * @type pv.Transform
-101  * @name pv.Panel.prototype.transform
-102  * @see pv.Mark#scale
-103  */
-104 
-105 /**
-106  * Default properties for panels. By default, the margins are zero, the fill
-107  * style is transparent.
-108  *
-109  * @type pv.Panel
-110  */
-111 pv.Panel.prototype.defaults = new pv.Panel()
-112     .extend(pv.Bar.prototype.defaults)
-113     .fillStyle(null) // override Bar default
-114     .overflow("visible");
-115 
-116 /**
-117  * Returns an anchor with the specified name. This method is overridden such
-118  * that adding to a panel's anchor adds to the panel, rather than to the panel's
-119  * parent.
-120  *
-121  * @param {string} name the anchor name; either a string or a property function.
-122  * @returns {pv.Anchor} the new anchor.
-123  */
-124 pv.Panel.prototype.anchor = function(name) {
-125   var anchor = pv.Bar.prototype.anchor.call(this, name);
-126   anchor.parent = this;
-127   return anchor;
-128 };
-129 
-130 /**
-131  * Adds a new mark of the specified type to this panel. Unlike the normal
-132  * {@link Mark#add} behavior, adding a mark to a panel does not cause the mark
-133  * to inherit from the panel. Since the contained marks are offset by the panel
-134  * margins already, inheriting properties is generally undesirable; of course,
-135  * it is always possible to change this behavior by calling {@link Mark#extend}
-136  * explicitly.
-137  *
-138  * @param {function} type the type of the new mark to add.
-139  * @returns {pv.Mark} the new mark.
-140  */
-141 pv.Panel.prototype.add = function(type) {
-142   var child = new type();
-143   child.parent = this;
-144   child.root = this.root;
-145   child.childIndex = this.children.length;
-146   this.children.push(child);
-147   return child;
-148 };
-149 
-150 /** @private Bind this panel, then any child marks recursively. */
-151 pv.Panel.prototype.bind = function() {
-152   pv.Mark.prototype.bind.call(this);
-153   for (var i = 0; i < this.children.length; i++) {
-154     this.children[i].bind();
-155   }
-156 };
-157 
-158 /**
-159  * @private Evaluates all of the properties for this panel for the specified
-160  * instance <tt>s</tt> in the scene graph, including recursively building the
-161  * scene graph for child marks.
-162  *
-163  * @param s a node in the scene graph; the instance of the panel to build.
-164  * @see Mark#scene
-165  */
-166 pv.Panel.prototype.buildInstance = function(s) {
-167   pv.Bar.prototype.buildInstance.call(this, s);
-168   if (!s.visible) return;
-169   if (!s.children) s.children = [];
-170 
-171   /*
-172    * Multiply the current scale factor by this panel's transform. Also clear the
-173    * default index as we recurse into child marks; it will be reset to the
-174    * current index when the next panel instance is built.
-175    */
-176   var scale = this.scale * s.transform.k, child, n = this.children.length;
-177   pv.Mark.prototype.index = -1;
-178 
-179   /*
-180    * Build each child, passing in the parent (this panel) scene graph node. The
-181    * child mark's scene is initialized from the corresponding entry in the
-182    * existing scene graph, such that properties from the previous build can be
-183    * reused; this is largely to facilitate the recycling of SVG elements.
-184    */
-185   for (var i = 0; i < n; i++) {
-186     child = this.children[i];
-187     child.scene = s.children[i]; // possibly undefined
-188     child.scale = scale;
-189     child.build();
-190   }
-191 
-192   /*
-193    * Once the child marks have been built, the new scene graph nodes are removed
-194    * from the child marks and placed into the scene graph. The nodes cannot
-195    * remain on the child nodes because this panel (or a parent panel) may be
-196    * instantiated multiple times!
-197    */
-198   for (var i = 0; i < n; i++) {
-199     child = this.children[i];
-200     s.children[i] = child.scene;
-201     delete child.scene;
-202     delete child.scale;
-203   }
-204 
-205   /* Delete any expired child scenes. */
-206   s.children.length = n;
-207 };
-208 
-209 /**
-210  * @private Computes the implied properties for this panel for the specified
-211  * instance <tt>s</tt> in the scene graph. Panels have two implied
-212  * properties:<ul>
-213  *
-214  * <li>The <tt>canvas</tt> property references the DOM element, typically a DIV,
-215  * that contains the SVG element that is used to display the visualization. This
-216  * property may be specified as a string, referring to the unique ID of the
-217  * element in the DOM. The string is converted to a reference to the DOM
-218  * element. The width and height of the SVG element is inferred from this DOM
-219  * element. If no canvas property is specified, a new SVG element is created and
-220  * inserted into the document, using the panel dimensions; see
-221  * {@link #createCanvas}.
-222  *
-223  * <li>The <tt>children</tt> array, while not a property per se, contains the
-224  * scene graph for each child mark. This array is initialized to be empty, and
-225  * is populated above in {@link #buildInstance}.
-226  *
-227  * </ul>The current implementation creates the SVG element, if necessary, during
-228  * the build phase; in the future, it may be preferrable to move this to the
-229  * update phase, although then the canvas property would be undefined. In
-230  * addition, DOM inspection is necessary to define the implied width and height
-231  * properties that may be inferred from the DOM.
-232  *
-233  * @param s a node in the scene graph; the instance of the panel to build.
-234  */
-235 pv.Panel.prototype.buildImplied = function(s) {
-236   if (!this.parent) {
-237     var c = s.canvas;
-238     if (c) {
-239       /* Clear the container if it's not associated with this panel. */
-240       if (c.$panel != this) {
-241         c.$panel = this;
-242         while (c.lastChild) c.removeChild(c.lastChild);
-243       }
-244 
-245       /* If width and height weren't specified, inspect the container. */
-246       var w, h;
-247       if (s.width == null) {
-248         w = parseFloat(pv.css(c, "width"));
-249         s.width = w - s.left - s.right;
-250       }
-251       if (s.height == null) {
-252         h = parseFloat(pv.css(c, "height"));
-253         s.height = h - s.top - s.bottom;
-254       }
-255     } else {
-256       var cache = this.$canvas || (this.$canvas = []);
-257       if (!(c = cache[this.index])) {
-258         c = cache[this.index] = document.createElement("span");
-259         if (this.$dom) { // script element for text/javascript+protovis
-260           this.$dom.parentNode.insertBefore(c, this.$dom);
-261         } else { // find the last element in the body
-262           var n = document.body;
-263           while (n.lastChild && n.lastChild.tagName) n = n.lastChild;
-264           if (n != document.body) n = n.parentNode;
-265           n.appendChild(c);
-266         }
-267       }
-268     }
-269     s.canvas = c;
-270   }
-271   if (!s.transform) s.transform = pv.Transform.identity;
-272   pv.Mark.prototype.buildImplied.call(this, s);
-273 };
-274 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Rule.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Rule.js.html deleted file mode 100644 index 628cb1ba..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Rule.js.html +++ /dev/null @@ -1,151 +0,0 @@ -
  1 /**
-  2  * Constructs a new rule with default properties. Rules are not typically
-  3  * constructed directly, but by adding to a panel or an existing mark via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Represents a horizontal or vertical rule. Rules are frequently used
-  7  * for axes and grid lines. For example, specifying only the bottom property
-  8  * draws horizontal rules, while specifying only the left draws vertical
-  9  * rules. Rules can also be used as thin bars. The visual style is controlled in
- 10  * the same manner as lines.
- 11  *
- 12  * <p>Rules are positioned exclusively the standard box model properties. The
- 13  * following combinations of properties are supported:
- 14  *
- 15  * <table>
- 16  * <thead><th style="width:12em;">Properties</th><th>Orientation</th></thead>
- 17  * <tbody>
- 18  * <tr><td>left</td><td>vertical</td></tr>
- 19  * <tr><td>right</td><td>vertical</td></tr>
- 20  * <tr><td>left, bottom, top</td><td>vertical</td></tr>
- 21  * <tr><td>right, bottom, top</td><td>vertical</td></tr>
- 22  * <tr><td>top</td><td>horizontal</td></tr>
- 23  * <tr><td>bottom</td><td>horizontal</td></tr>
- 24  * <tr><td>top, left, right</td><td>horizontal</td></tr>
- 25  * <tr><td>bottom, left, right</td><td>horizontal</td></tr>
- 26  * <tr><td>left, top, height</td><td>vertical</td></tr>
- 27  * <tr><td>left, bottom, height</td><td>vertical</td></tr>
- 28  * <tr><td>right, top, height</td><td>vertical</td></tr>
- 29  * <tr><td>right, bottom, height</td><td>vertical</td></tr>
- 30  * <tr><td>left, top, width</td><td>horizontal</td></tr>
- 31  * <tr><td>left, bottom, width</td><td>horizontal</td></tr>
- 32  * <tr><td>right, top, width</td><td>horizontal</td></tr>
- 33  * <tr><td>right, bottom, width</td><td>horizontal</td></tr>
- 34  * </tbody>
- 35  * </table>
- 36  *
- 37  * <p>Small rules can be used as tick marks; alternatively, a {@link Dot} with
- 38  * the "tick" shape can be used.
- 39  *
- 40  * <p>See also the <a href="../../api/Rule.html">Rule guide</a>.
- 41  *
- 42  * @see pv.Line
- 43  * @extends pv.Mark
- 44  */
- 45 pv.Rule = function() {
- 46   pv.Mark.call(this);
- 47 };
- 48 
- 49 pv.Rule.prototype = pv.extend(pv.Mark)
- 50     .property("width", Number)
- 51     .property("height", Number)
- 52     .property("lineWidth", Number)
- 53     .property("strokeStyle", pv.color);
- 54 
- 55 pv.Rule.prototype.type = "rule";
- 56 
- 57 /**
- 58  * The width of the rule, in pixels. If the left position is specified, the rule
- 59  * extends rightward from the left edge; if the right position is specified, the
- 60  * rule extends leftward from the right edge.
- 61  *
- 62  * @type number
- 63  * @name pv.Rule.prototype.width
- 64  */
- 65 
- 66 /**
- 67  * The height of the rule, in pixels. If the bottom position is specified, the
- 68  * rule extends upward from the bottom edge; if the top position is specified,
- 69  * the rule extends downward from the top edge.
- 70  *
- 71  * @type number
- 72  * @name pv.Rule.prototype.height
- 73  */
- 74 
- 75 /**
- 76  * The width of stroked lines, in pixels; used in conjunction with
- 77  * <tt>strokeStyle</tt> to stroke the rule. The default value is 1 pixel.
- 78  *
- 79  * @type number
- 80  * @name pv.Rule.prototype.lineWidth
- 81  */
- 82 
- 83 /**
- 84  * The style of stroked lines; used in conjunction with <tt>lineWidth</tt> to
- 85  * stroke the rule. The default value of this property is black.
- 86  *
- 87  * @type string
- 88  * @name pv.Rule.prototype.strokeStyle
- 89  * @see pv.color
- 90  */
- 91 
- 92 /**
- 93  * Default properties for rules. By default, a single-pixel black line is
- 94  * stroked.
- 95  *
- 96  * @type pv.Rule
- 97  */
- 98 pv.Rule.prototype.defaults = new pv.Rule()
- 99     .extend(pv.Mark.prototype.defaults)
-100     .lineWidth(1)
-101     .strokeStyle("black")
-102     .antialias(false);
-103 
-104 /**
-105  * Constructs a new rule anchor with default properties. Rules support five
-106  * different anchors:<ul>
-107  *
-108  * <li>top
-109  * <li>left
-110  * <li>center
-111  * <li>bottom
-112  * <li>right
-113  *
-114  * </ul>In addition to positioning properties (left, right, top bottom), the
-115  * anchors support text rendering properties (text-align, text-baseline). Text is
-116  * rendered to appear outside the rule. Note that this behavior is different
-117  * from other mark anchors, which default to rendering text <i>inside</i> the
-118  * mark.
-119  *
-120  * <p>For consistency with the other mark types, the anchor positions are
-121  * defined in terms of their opposite edge. For example, the top anchor defines
-122  * the bottom property, such that a bar added to the top anchor grows upward.
-123  *
-124  * @param {string} name the anchor name; either a string or a property function.
-125  * @returns {pv.Anchor}
-126  */
-127 pv.Rule.prototype.anchor = pv.Line.prototype.anchor;
-128 
-129 /** @private Sets width or height based on orientation. */
-130 pv.Rule.prototype.buildImplied = function(s) {
-131   var l = s.left, r = s.right, t = s.top, b = s.bottom;
-132 
-133   /* Determine horizontal or vertical orientation. */
-134   if ((s.width != null)
-135       || ((l == null) && (r == null))
-136       || ((r != null) && (l != null))) {
-137     s.height = 0;
-138   } else {
-139     s.width = 0;
-140   }
-141 
-142   pv.Mark.prototype.buildImplied.call(this, s);
-143 };
-144 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Wedge.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Wedge.js.html deleted file mode 100644 index de83a55c..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_mark_Wedge.js.html +++ /dev/null @@ -1,256 +0,0 @@ -
  1 /**
-  2  * Constructs a new wedge with default properties. Wedges are not typically
-  3  * constructed directly, but by adding to a panel or an existing mark via
-  4  * {@link pv.Mark#add}.
-  5  *
-  6  * @class Represents a wedge, or pie slice. Specified in terms of start and end
-  7  * angle, inner and outer radius, wedges can be used to construct donut charts
-  8  * and polar bar charts as well. If the {@link #angle} property is used, the end
-  9  * angle is implied by adding this value to start angle. By default, the start
- 10  * angle is the previously-generated wedge's end angle. This design allows
- 11  * explicit control over the wedge placement if desired, while offering
- 12  * convenient defaults for the construction of radial graphs.
- 13  *
- 14  * <p>The center point of the circle is positioned using the standard box model.
- 15  * The wedge can be stroked and filled, similar to {@link pv.Bar}.
- 16  *
- 17  * <p>See also the <a href="../../api/Wedge.html">Wedge guide</a>.
- 18  *
- 19  * @extends pv.Mark
- 20  */
- 21 pv.Wedge = function() {
- 22   pv.Mark.call(this);
- 23 };
- 24 
- 25 pv.Wedge.prototype = pv.extend(pv.Mark)
- 26     .property("startAngle", Number)
- 27     .property("endAngle", Number)
- 28     .property("angle", Number)
- 29     .property("innerRadius", Number)
- 30     .property("outerRadius", Number)
- 31     .property("lineWidth", Number)
- 32     .property("strokeStyle", pv.color)
- 33     .property("fillStyle", pv.color);
- 34 
- 35 pv.Wedge.prototype.type = "wedge";
- 36 
- 37 /**
- 38  * The start angle of the wedge, in radians. The start angle is measured
- 39  * clockwise from the 3 o'clock position. The default value of this property is
- 40  * the end angle of the previous instance (the {@link Mark#sibling}), or -PI / 2
- 41  * for the first wedge; for pie and donut charts, typically only the
- 42  * {@link #angle} property needs to be specified.
- 43  *
- 44  * @type number
- 45  * @name pv.Wedge.prototype.startAngle
- 46  */
- 47 
- 48 /**
- 49  * The end angle of the wedge, in radians. If not specified, the end angle is
- 50  * implied as the start angle plus the {@link #angle}.
- 51  *
- 52  * @type number
- 53  * @name pv.Wedge.prototype.endAngle
- 54  */
- 55 
- 56 /**
- 57  * The angular span of the wedge, in radians. This property is used if end angle
- 58  * is not specified.
- 59  *
- 60  * @type number
- 61  * @name pv.Wedge.prototype.angle
- 62  */
- 63 
- 64 /**
- 65  * The inner radius of the wedge, in pixels. The default value of this property
- 66  * is zero; a positive value will produce a donut slice rather than a pie slice.
- 67  * The inner radius can vary per-wedge.
- 68  *
- 69  * @type number
- 70  * @name pv.Wedge.prototype.innerRadius
- 71  */
- 72 
- 73 /**
- 74  * The outer radius of the wedge, in pixels. This property is required. For
- 75  * pies, only this radius is required; for donuts, the inner radius must be
- 76  * specified as well. The outer radius can vary per-wedge.
- 77  *
- 78  * @type number
- 79  * @name pv.Wedge.prototype.outerRadius
- 80  */
- 81 
- 82 /**
- 83  * The width of stroked lines, in pixels; used in conjunction with
- 84  * <tt>strokeStyle</tt> to stroke the wedge's border.
- 85  *
- 86  * @type number
- 87  * @name pv.Wedge.prototype.lineWidth
- 88  */
- 89 
- 90 /**
- 91  * The style of stroked lines; used in conjunction with <tt>lineWidth</tt> to
- 92  * stroke the wedge's border. The default value of this property is null,
- 93  * meaning wedges are not stroked by default.
- 94  *
- 95  * @type string
- 96  * @name pv.Wedge.prototype.strokeStyle
- 97  * @see pv.color
- 98  */
- 99 
-100 /**
-101  * The wedge fill style; if non-null, the interior of the wedge is filled with
-102  * the specified color. The default value of this property is a categorical
-103  * color.
-104  *
-105  * @type string
-106  * @name pv.Wedge.prototype.fillStyle
-107  * @see pv.color
-108  */
-109 
-110 /**
-111  * Default properties for wedges. By default, there is no stroke and the fill
-112  * style is a categorical color.
-113  *
-114  * @type pv.Wedge
-115  */
-116 pv.Wedge.prototype.defaults = new pv.Wedge()
-117     .extend(pv.Mark.prototype.defaults)
-118     .startAngle(function() {
-119         var s = this.sibling();
-120         return s ? s.endAngle : -Math.PI / 2;
-121       })
-122     .innerRadius(0)
-123     .lineWidth(1.5)
-124     .strokeStyle(null)
-125     .fillStyle(pv.Colors.category20().by(pv.index));
-126 
-127 /**
-128  * Returns the mid-radius of the wedge, which is defined as half-way between the
-129  * inner and outer radii.
-130  *
-131  * @see #innerRadius
-132  * @see #outerRadius
-133  * @returns {number} the mid-radius, in pixels.
-134  */
-135 pv.Wedge.prototype.midRadius = function() {
-136   return (this.innerRadius() + this.outerRadius()) / 2;
-137 };
-138 
-139 /**
-140  * Returns the mid-angle of the wedge, which is defined as half-way between the
-141  * start and end angles.
-142  *
-143  * @see #startAngle
-144  * @see #endAngle
-145  * @returns {number} the mid-angle, in radians.
-146  */
-147 pv.Wedge.prototype.midAngle = function() {
-148   return (this.startAngle() + this.endAngle()) / 2;
-149 };
-150 
-151 /**
-152  * Constructs a new wedge anchor with default properties. Wedges support five
-153  * different anchors:<ul>
-154  *
-155  * <li>outer
-156  * <li>inner
-157  * <li>center
-158  * <li>start
-159  * <li>end
-160  *
-161  * </ul>In addition to positioning properties (left, right, top bottom), the
-162  * anchors support text rendering properties (text-align, text-baseline,
-163  * textAngle). Text is rendered to appear inside the wedge.
-164  *
-165  * @param {string} name the anchor name; either a string or a property function.
-166  * @returns {pv.Anchor}
-167  */
-168 pv.Wedge.prototype.anchor = function(name) {
-169   function partial(s) { return s.innerRadius || s.angle < 2 * Math.PI; }
-170   function midRadius(s) { return (s.innerRadius + s.outerRadius) / 2; }
-171   function midAngle(s) { return (s.startAngle + s.endAngle) / 2; }
-172   var scene;
-173   return pv.Mark.prototype.anchor.call(this, name)
-174     .def("$wedge.anchor", function() {
-175         scene = this.scene.target;
-176       })
-177     .left(function() {
-178         var s = scene[this.index];
-179         if (partial(s)) switch (this.name()) {
-180           case "outer": return s.left + s.outerRadius * Math.cos(midAngle(s));
-181           case "inner": return s.left + s.innerRadius * Math.cos(midAngle(s));
-182           case "start": return s.left + midRadius(s) * Math.cos(s.startAngle);
-183           case "center": return s.left + midRadius(s) * Math.cos(midAngle(s));
-184           case "end": return s.left + midRadius(s) * Math.cos(s.endAngle);
-185         }
-186         return s.left;
-187       })
-188     .top(function() {
-189         var s = scene[this.index];
-190         if (partial(s)) switch (this.name()) {
-191           case "outer": return s.top + s.outerRadius * Math.sin(midAngle(s));
-192           case "inner": return s.top + s.innerRadius * Math.sin(midAngle(s));
-193           case "start": return s.top + midRadius(s) * Math.sin(s.startAngle);
-194           case "center": return s.top + midRadius(s) * Math.sin(midAngle(s));
-195           case "end": return s.top + midRadius(s) * Math.sin(s.endAngle);
-196         }
-197         return s.top;
-198       })
-199     .textAlign(function() {
-200         var s = scene[this.index];
-201         if (partial(s)) switch (this.name()) {
-202           case "outer": return pv.Wedge.upright(midAngle(s)) ? "right" : "left";
-203           case "inner": return pv.Wedge.upright(midAngle(s)) ? "left" : "right";
-204         }
-205         return "center";
-206       })
-207     .textBaseline(function() {
-208         var s = scene[this.index];
-209         if (partial(s)) switch (this.name()) {
-210           case "start": return pv.Wedge.upright(s.startAngle) ? "top" : "bottom";
-211           case "end": return pv.Wedge.upright(s.endAngle) ? "bottom" : "top";
-212         }
-213         return "middle";
-214       })
-215     .textAngle(function() {
-216         var s = scene[this.index], a = 0;
-217         if (partial(s)) switch (this.name()) {
-218           case "center":
-219           case "inner":
-220           case "outer": a = midAngle(s); break;
-221           case "start": a = s.startAngle; break;
-222           case "end": a = s.endAngle; break;
-223         }
-224         return pv.Wedge.upright(a) ? a : (a + Math.PI);
-225       });
-226 };
-227 
-228 /**
-229  * Returns true if the specified angle is considered "upright", as in, text
-230  * rendered at that angle would appear upright. If the angle is not upright,
-231  * text is rotated 180 degrees to be upright, and the text alignment properties
-232  * are correspondingly changed.
-233  *
-234  * @param {number} angle an angle, in radius.
-235  * @returns {boolean} true if the specified angle is upright.
-236  */
-237 pv.Wedge.upright = function(angle) {
-238   angle = angle % (2 * Math.PI);
-239   angle = (angle < 0) ? (2 * Math.PI + angle) : angle;
-240   return (angle < Math.PI / 2) || (angle >= 3 * Math.PI / 2);
-241 };
-242 
-243 /** @private Sets angle based on endAngle or vice versa. */
-244 pv.Wedge.prototype.buildImplied = function(s) {
-245   if (s.angle == null) s.angle = s.endAngle - s.startAngle;
-246   else if (s.endAngle == null) s.endAngle = s.startAngle + s.angle;
-247   pv.Mark.prototype.buildImplied.call(this, s);
-248 };
-249 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_BoundConstraint.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_BoundConstraint.js.html deleted file mode 100644 index 965d107e..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_BoundConstraint.js.html +++ /dev/null @@ -1,83 +0,0 @@ -
  1 /**
-  2  * Constructs a new bound constraint. Before the constraint can be used, the
-  3  * {@link #x} and {@link #y} methods must be call to specify the bounds.
-  4  *
-  5  * @class Constrains particles to within fixed rectangular bounds. For example,
-  6  * this constraint can be used to constrain particles in a physics simulation
-  7  * within the bounds of an enclosing panel.
-  8  *
-  9  * <p>Note that the current implementation treats particles as points, with no
- 10  * area. If the particles are rendered as dots, be sure to include some
- 11  * additional padding to inset the bounds such that the edges of the dots do not
- 12  * get clipped by the panel bounds. If the particles have different radii, this
- 13  * constraint would need to be extended using a radius function, similar to
- 14  * {@link pv.Constraint.collision}.
- 15  *
- 16  * @see pv.Layout.Force
- 17  * @extends pv.Constraint
- 18  */
- 19 pv.Constraint.bound = function() {
- 20   var constraint = {},
- 21       x,
- 22       y;
- 23 
- 24   /**
- 25    * Sets or gets the bounds on the x-coordinate.
- 26    *
- 27    * @function
- 28    * @name pv.Constraint.bound.prototype.x
- 29    * @param {number} min the minimum allowed x-coordinate.
- 30    * @param {number} max the maximum allowed x-coordinate.
- 31    * @returns {pv.Constraint.bound} this.
- 32    */
- 33   constraint.x = function(min, max) {
- 34     if (arguments.length) {
- 35       x = {min: Math.min(min, max), max: Math.max(min, max)};
- 36       return this;
- 37     }
- 38     return x;
- 39   };
- 40 
- 41   /**
- 42    * Sets or gets the bounds on the y-coordinate.
- 43    *
- 44    * @function
- 45    * @name pv.Constraint.bound.prototype.y
- 46    * @param {number} min the minimum allowed y-coordinate.
- 47    * @param {number} max the maximum allowed y-coordinate.
- 48    * @returns {pv.Constraint.bound} this.
- 49    */
- 50   constraint.y = function(min, max) {
- 51     if (arguments.length) {
- 52       y = {min: Math.min(min, max), max: Math.max(min, max)};
- 53       return this;
- 54     }
- 55     return y;
- 56   };
- 57 
- 58   /**
- 59    * Applies this constraint to the specified particles.
- 60    *
- 61    * @function
- 62    * @name pv.Constraint.bound.prototype.apply
- 63    * @param {pv.Particle} particles particles to which to apply this constraint.
- 64    */
- 65   constraint.apply = function(particles) {
- 66     if (x) for (var p = particles; p; p = p.next) {
- 67       p.x = p.x < x.min ? x.min : (p.x > x.max ? x.max : p.x);
- 68     }
- 69     if (y) for (var p = particles; p; p = p.next) {
- 70       p.y = p.y < y.min ? y.min : (p.y > y.max ? y.max : p.y);
- 71     }
- 72   };
- 73 
- 74   return constraint;
- 75 };
- 76 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_ChargeForce.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_ChargeForce.js.html deleted file mode 100644 index 0f9543f4..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_ChargeForce.js.html +++ /dev/null @@ -1,192 +0,0 @@ -
  1 /**
-  2  * Constructs a new charge force, with an optional charge constant. The charge
-  3  * constant can be negative for repulsion (e.g., particles with electrical
-  4  * charge of equal sign), or positive for attraction (e.g., massive particles
-  5  * with mutual gravity). The default charge constant is -40.
-  6  *
-  7  * @class An n-body force, as defined by Coulomb's law or Newton's law of
-  8  * gravitation, inversely proportional to the square of the distance between
-  9  * particles. Note that the force is independent of the <i>mass</i> of the
- 10  * associated particles, and that the particles do not have charges of varying
- 11  * magnitude; instead, the attraction or repulsion of all particles is globally
- 12  * specified as the charge {@link #constant}.
- 13  *
- 14  * <p>This particular implementation uses the Barnes-Hut algorithm. For details,
- 15  * see <a
- 16  * href="http://www.nature.com/nature/journal/v324/n6096/abs/324446a0.html">"A
- 17  * hierarchical O(N log N) force-calculation algorithm"</a>, J. Barnes &
- 18  * P. Hut, <i>Nature</i> 1986.
- 19  *
- 20  * @name pv.Force.charge
- 21  * @param {number} [k] the charge constant.
- 22  */
- 23 pv.Force.charge = function(k) {
- 24   var min = 2, // minimum distance at which to observe forces
- 25       min1 = 1 / min,
- 26       max = 500, // maximum distance at which to observe forces
- 27       max1 = 1 / max,
- 28       theta = .9, // Barnes-Hut theta approximation constant
- 29       force = {};
- 30 
- 31   if (!arguments.length) k = -40; // default charge constant (repulsion)
- 32 
- 33   /**
- 34    * Sets or gets the charge constant. If an argument is specified, it is the
- 35    * new charge constant. The charge constant can be negative for repulsion
- 36    * (e.g., particles with electrical charge of equal sign), or positive for
- 37    * attraction (e.g., massive particles with mutual gravity). The default
- 38    * charge constant is -40.
- 39    *
- 40    * @function
- 41    * @name pv.Force.charge.prototype.constant
- 42    * @param {number} x the charge constant.
- 43    * @returns {pv.Force.charge} this.
- 44    */
- 45   force.constant = function(x) {
- 46     if (arguments.length) {
- 47       k = Number(x);
- 48       return force;
- 49     }
- 50     return k;
- 51   };
- 52 
- 53   /**
- 54    * Sets or gets the domain; specifies the minimum and maximum domain within
- 55    * which charge forces are applied. A minimum distance threshold avoids
- 56    * applying forces that are two strong (due to granularity of the simulation's
- 57    * numeric integration). A maximum distance threshold improves performance by
- 58    * skipping force calculations for particles that are far apart.
- 59    *
- 60    * <p>The default domain is [2, 500].
- 61    *
- 62    * @function
- 63    * @name pv.Force.charge.prototype.domain
- 64    * @param {number} a
- 65    * @param {number} b
- 66    * @returns {pv.Force.charge} this.
- 67    */
- 68   force.domain = function(a, b) {
- 69     if (arguments.length) {
- 70       min = Number(a);
- 71       min1 = 1 / min;
- 72       max = Number(b);
- 73       max1 = 1 / max;
- 74       return force;
- 75     }
- 76     return [min, max];
- 77   };
- 78 
- 79   /**
- 80    * Sets or gets the Barnes-Hut approximation factor. The Barnes-Hut
- 81    * approximation criterion is the ratio of the size of the quadtree node to
- 82    * the distance from the point to the node's center of mass is beneath some
- 83    * threshold.
- 84    *
- 85    * @function
- 86    * @name pv.Force.charge.prototype.theta
- 87    * @param {number} x the new Barnes-Hut approximation factor.
- 88    * @returns {pv.Force.charge} this.
- 89    */
- 90   force.theta = function(x) {
- 91     if (arguments.length) {
- 92       theta = Number(x);
- 93       return force;
- 94     }
- 95     return theta;
- 96   };
- 97 
- 98   /**
- 99    * @ignore Recursively computes the center of charge for each node in the
-100    * quadtree. This is equivalent to the center of mass, assuming that all
-101    * particles have unit weight.
-102    */
-103   function accumulate(n) {
-104     var cx = 0, cy = 0;
-105     n.cn = 0;
-106     function accumulateChild(c) {
-107       accumulate(c);
-108       n.cn += c.cn;
-109       cx += c.cn * c.cx;
-110       cy += c.cn * c.cy;
-111     }
-112     if (!n.leaf) {
-113       if (n.c1) accumulateChild(n.c1);
-114       if (n.c2) accumulateChild(n.c2);
-115       if (n.c3) accumulateChild(n.c3);
-116       if (n.c4) accumulateChild(n.c4);
-117     }
-118     if (n.p) {
-119       n.cn += k;
-120       cx += k * n.p.x;
-121       cy += k * n.p.y;
-122     }
-123     n.cx = cx / n.cn;
-124     n.cy = cy / n.cn;
-125   }
-126 
-127   /**
-128    * @ignore Recursively computes forces on the given particle using the given
-129    * quadtree node. The Barnes-Hut approximation criterion is the ratio of the
-130    * size of the quadtree node to the distance from the point to the node's
-131    * center of mass is beneath some threshold.
-132    */
-133   function forces(n, p, x1, y1, x2, y2) {
-134     var dx = n.cx - p.x,
-135         dy = n.cy - p.y,
-136         dn = 1 / Math.sqrt(dx * dx + dy * dy);
-137 
-138     /* Barnes-Hut criterion. */
-139     if ((n.leaf && (n.p != p)) || ((x2 - x1) * dn < theta)) {
-140       if (dn < max1) return;
-141       if (dn > min1) dn = min1;
-142       var kc = n.cn * dn * dn * dn,
-143           fx = dx * kc,
-144           fy = dy * kc;
-145       p.fx += fx;
-146       p.fy += fy;
-147     } else if (!n.leaf) {
-148       var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5;
-149       if (n.c1) forces(n.c1, p, x1, y1, sx, sy);
-150       if (n.c2) forces(n.c2, p, sx, y1, x2, sy);
-151       if (n.c3) forces(n.c3, p, x1, sy, sx, y2);
-152       if (n.c4) forces(n.c4, p, sx, sy, x2, y2);
-153       if (dn < max1) return;
-154       if (dn > min1) dn = min1;
-155       if (n.p && (n.p != p)) {
-156         var kc = k * dn * dn * dn,
-157             fx = dx * kc,
-158             fy = dy * kc;
-159         p.fx += fx;
-160         p.fy += fy;
-161       }
-162     }
-163   }
-164 
-165   /**
-166    * Applies this force to the specified particles. The force is applied between
-167    * all pairs of particles within the domain, using the specified quadtree to
-168    * accelerate n-body force calculation using the Barnes-Hut approximation
-169    * criterion.
-170    *
-171    * @function
-172    * @name pv.Force.charge.prototype.apply
-173    * @param {pv.Particle} particles particles to which to apply this force.
-174    * @param {pv.Quadtree} q a quadtree for spatial acceleration.
-175    */
-176   force.apply = function(particles, q) {
-177     accumulate(q.root);
-178     for (var p = particles; p; p = p.next) {
-179       forces(q.root, p, q.xMin, q.yMin, q.xMax, q.yMax);
-180     }
-181   };
-182 
-183   return force;
-184 };
-185 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_CollisionConstraint.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_CollisionConstraint.js.html deleted file mode 100644 index e885c4d8..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_CollisionConstraint.js.html +++ /dev/null @@ -1,121 +0,0 @@ -
  1 /**
-  2  * Constructs a new collision constraint. The default search radius is 10, and
-  3  * the default repeat count is 1. A radius function must be specified to compute
-  4  * the radius of particles.
-  5  *
-  6  * @class Constraints circles to avoid overlap. Each particle is treated as a
-  7  * circle, with the radius of the particle computed using a specified function.
-  8  * For example, if the particle has an <tt>r</tt> attribute storing the radius,
-  9  * the radius <tt>function(d) d.r</tt> specifies a collision constraint using
- 10  * this radius. The radius function is passed each {@link pv.Particle} as the
- 11  * first argument.
- 12  *
- 13  * <p>To accelerate collision detection, this implementation uses a quadtree and
- 14  * a search radius. The search radius is computed as the maximum radius of all
- 15  * particles in the simulation.
- 16  *
- 17  * @see pv.Constraint
- 18  * @param {function} radius the radius function.
- 19  */
- 20 pv.Constraint.collision = function(radius) {
- 21   var n = 1, // number of times to repeat the constraint
- 22       r1,
- 23       px1,
- 24       py1,
- 25       px2,
- 26       py2,
- 27       constraint = {};
- 28 
- 29   if (!arguments.length) r1 = 10; // default search radius
- 30 
- 31   /**
- 32    * Sets or gets the repeat count. If the repeat count is greater than 1, the
- 33    * constraint will be applied repeatedly; this is a form of the Gauss-Seidel
- 34    * method for constraints relaxation. Repeating the collision constraint makes
- 35    * the constraint have more of an effect when there is a potential for many
- 36    * co-occurring collisions.
- 37    *
- 38    * @function
- 39    * @name pv.Constraint.collision.prototype.repeat
- 40    * @param {number} x the number of times to repeat this constraint.
- 41    * @returns {pv.Constraint.collision} this.
- 42    */
- 43   constraint.repeat = function(x) {
- 44     if (arguments.length) {
- 45       n = Number(x);
- 46       return constraint;
- 47     }
- 48     return n;
- 49   };
- 50 
- 51   /** @private */
- 52   function constrain(n, p, x1, y1, x2, y2) {
- 53     if (!n.leaf) {
- 54       var sx = (x1 + x2) * .5,
- 55           sy = (y1 + y2) * .5,
- 56           top = sy > py1,
- 57           bottom = sy < py2,
- 58           left = sx > px1,
- 59           right = sx < px2;
- 60       if (top) {
- 61         if (n.c1 && left) constrain(n.c1, p, x1, y1, sx, sy);
- 62         if (n.c2 && right) constrain(n.c2, p, sx, y1, x2, sy);
- 63       }
- 64       if (bottom) {
- 65         if (n.c3 && left) constrain(n.c3, p, x1, sy, sx, y2);
- 66         if (n.c4 && right) constrain(n.c4, p, sx, sy, x2, y2);
- 67       }
- 68     }
- 69     if (n.p && (n.p != p)) {
- 70       var dx = p.x - n.p.x,
- 71           dy = p.y - n.p.y,
- 72           l = Math.sqrt(dx * dx + dy * dy),
- 73           d = r1 + radius(n.p);
- 74       if (l < d) {
- 75         var k = (l - d) / l * .5;
- 76         dx *= k;
- 77         dy *= k;
- 78         p.x -= dx;
- 79         p.y -= dy;
- 80         n.p.x += dx;
- 81         n.p.y += dy;
- 82       }
- 83     }
- 84   }
- 85 
- 86   /**
- 87    * Applies this constraint to the specified particles.
- 88    *
- 89    * @function
- 90    * @name pv.Constraint.collision.prototype.apply
- 91    * @param {pv.Particle} particles particles to which to apply this constraint.
- 92    * @param {pv.Quadtree} q a quadtree for spatial acceleration.
- 93    */
- 94   constraint.apply = function(particles, q) {
- 95     var p, r, max = -Infinity;
- 96     for (p = particles; p; p = p.next) {
- 97       r = radius(p);
- 98       if (r > max) max = r;
- 99     }
-100     for (var i = 0; i < n; i++) {
-101       for (p = particles; p; p = p.next) {
-102         r = (r1 = radius(p)) + max;
-103         px1 = p.x - r;
-104         px2 = p.x + r;
-105         py1 = p.y - r;
-106         py2 = p.y + r;
-107         constrain(q.root, p, q.xMin, q.yMin, q.xMax, q.yMax);
-108       }
-109     }
-110   };
-111 
-112   return constraint;
-113 };
-114 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Constraint.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Constraint.js.html deleted file mode 100644 index a3f574c6..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Constraint.js.html +++ /dev/null @@ -1,34 +0,0 @@ -
  1 /**
-  2  * Abstract; see an implementing class.
-  3  *
-  4  * @class Represents a constraint that acts on particles. Note that this
-  5  * interface does not specify how to bind a constraint to specific particles; in
-  6  * general, constraints are applied globally to all particles. However, some
-  7  * constraints may be applied to specific particles or between particles, such
-  8  * as position constraints, through additional specialization.
-  9  *
- 10  * @see pv.Simulation
- 11  * @see pv.Particle
- 12  * @see pv.Constraint.bound
- 13  * @see pv.Constraint.collision
- 14  * @see pv.Constraint.position
- 15  */
- 16 pv.Constraint = {};
- 17 
- 18 /**
- 19  * Applies this constraint to the specified particles.
- 20  *
- 21  * @function
- 22  * @name pv.Constraint.prototype.apply
- 23  * @param {pv.Particle} particles particles to which to apply this constraint.
- 24  * @param {pv.Quadtree} q a quadtree for spatial acceleration.
- 25  * @returns {pv.Constraint} this.
- 26  */
- 27 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_DragForce.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_DragForce.js.html deleted file mode 100644 index 710d7206..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_DragForce.js.html +++ /dev/null @@ -1,57 +0,0 @@ -
  1 /**
-  2  * Constructs a new drag force with the specified constant.
-  3  *
-  4  * @class Implements a drag force, simulating friction. The drag force is
-  5  * applied in the opposite direction of the particle's velocity. Since Position
-  6  * Verlet integration does not track velocities explicitly, the error term with
-  7  * this estimate of velocity is fairly high, so the drag force may be
-  8  * inaccurate.
-  9  *
- 10  * @extends pv.Force
- 11  * @param {number} k the drag constant.
- 12  * @see #constant
- 13  */
- 14 pv.Force.drag = function(k) {
- 15   var force = {};
- 16 
- 17   if (!arguments.length) k = .1; // default drag constant
- 18 
- 19   /**
- 20    * Sets or gets the drag constant, in the range [0,1]. The default drag
- 21    * constant is 0.1. The drag forces scales linearly with the particle's
- 22    * velocity based on the given drag constant.
- 23    *
- 24    * @function
- 25    * @name pv.Force.drag.prototype.constant
- 26    * @param {number} x the new drag constant.
- 27    * @returns {pv.Force.drag} this, or the current drag constant.
- 28    */
- 29   force.constant = function(x) {
- 30     if (arguments.length) { k = x; return force; }
- 31     return k;
- 32   };
- 33 
- 34   /**
- 35    * Applies this force to the specified particles.
- 36    *
- 37    * @function
- 38    * @name pv.Force.drag.prototype.apply
- 39    * @param {pv.Particle} particles particles to which to apply this force.
- 40    */
- 41   force.apply = function(particles) {
- 42     if (k) for (var p = particles; p; p = p.next) {
- 43       p.fx -= k * p.vx;
- 44       p.fy -= k * p.vy;
- 45     }
- 46   };
- 47 
- 48   return force;
- 49 };
- 50 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Force.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Force.js.html deleted file mode 100644 index 0ef965bc..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Force.js.html +++ /dev/null @@ -1,33 +0,0 @@ -
  1 /**
-  2  * Abstract; see an implementing class.
-  3  *
-  4  * @class Represents a force that acts on particles. Note that this interface
-  5  * does not specify how to bind a force to specific particles; in general,
-  6  * forces are applied globally to all particles. However, some forces may be
-  7  * applied to specific particles or between particles, such as spring forces,
-  8  * through additional specialization.
-  9  *
- 10  * @see pv.Simulation
- 11  * @see pv.Particle
- 12  * @see pv.Force.charge
- 13  * @see pv.Force.drag
- 14  * @see pv.Force.spring
- 15  */
- 16 pv.Force = {};
- 17 
- 18 /**
- 19  * Applies this force to the specified particles.
- 20  *
- 21  * @function
- 22  * @name pv.Force.prototype.apply
- 23  * @param {pv.Particle} particles particles to which to apply this force.
- 24  * @param {pv.Quadtree} q a quadtree for spatial acceleration.
- 25  */
- 26 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Particle.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Particle.js.html deleted file mode 100644 index 4b149e99..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Particle.js.html +++ /dev/null @@ -1,89 +0,0 @@ -
  1 /**
-  2  * Abstract; not implemented. There is no explicit constructor; this class
-  3  * merely serves to document the attributes that are used on particles in
-  4  * physics simulations.
-  5  *
-  6  * @class A weighted particle that can participate in a force simulation.
-  7  *
-  8  * @name pv.Particle
-  9  */
- 10 
- 11 /**
- 12  * The next particle in the simulation. Particles form a singly-linked list.
- 13  *
- 14  * @field
- 15  * @type pv.Particle
- 16  * @name pv.Particle.prototype.next
- 17  */
- 18 
- 19 /**
- 20  * The <i>x</i>-position of the particle.
- 21  *
- 22  * @field
- 23  * @type number
- 24  * @name pv.Particle.prototype.x
- 25  */
- 26 
- 27 /**
- 28  * The <i>y</i>-position of the particle.
- 29  *
- 30  * @field
- 31  * @type number
- 32  * @name pv.Particle.prototype.y
- 33  */
- 34 
- 35 /**
- 36  * The <i>x</i>-velocity of the particle.
- 37  *
- 38  * @field
- 39  * @type number
- 40  * @name pv.Particle.prototype.vx
- 41  */
- 42 
- 43 /**
- 44  * The <i>y</i>-velocity of the particle.
- 45  *
- 46  * @field
- 47  * @type number
- 48  * @name pv.Particle.prototype.vy
- 49  */
- 50 
- 51 /**
- 52  * The <i>x</i>-position of the particle at -dt.
- 53  *
- 54  * @field
- 55  * @type number
- 56  * @name pv.Particle.prototype.px
- 57  */
- 58 
- 59 /**
- 60  * The <i>y</i>-position of the particle at -dt.
- 61  *
- 62  * @field
- 63  * @type number
- 64  * @name pv.Particle.prototype.py
- 65  */
- 66 
- 67 /**
- 68  * The <i>x</i>-force on the particle.
- 69  *
- 70  * @field
- 71  * @type number
- 72  * @name pv.Particle.prototype.fx
- 73  */
- 74 
- 75 /**
- 76  * The <i>y</i>-force on the particle.
- 77  *
- 78  * @field
- 79  * @type number
- 80  * @name pv.Particle.prototype.fy
- 81  */
- 82 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_PositionConstraint.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_PositionConstraint.js.html deleted file mode 100644 index d3191d43..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_PositionConstraint.js.html +++ /dev/null @@ -1,80 +0,0 @@ -
  1 /**
-  2  * Constructs a default position constraint using the <tt>fix</tt> attribute.
-  3  * An optional position function can be specified to determine how the fixed
-  4  * position per-particle is determined.
-  5  *
-  6  * @class Constraints particles to a fixed position. The fixed position per
-  7  * particle is determined using a given position function, which defaults to
-  8  * <tt>function(d) d.fix</tt>.
-  9  *
- 10  * <p>If the position function returns null, then no position constraint is
- 11  * applied to the given particle. Otherwise, the particle's position is set to
- 12  * the returned position, as expressed by a {@link pv.Vector}. (Note: the
- 13  * position does not need to be an instance of <tt>pv.Vector</tt>, but simply an
- 14  * object with <tt>x</tt> and <tt>y</tt> attributes.)
- 15  *
- 16  * <p>This constraint also supports a configurable alpha parameter, which
- 17  * defaults to 1. If the alpha parameter is in the range [0,1], then rather than
- 18  * setting the particle's new position directly to the position returned by the
- 19  * supplied position function, the particle's position is interpolated towards
- 20  * the fixed position. This results is a smooth (exponential) drift towards the
- 21  * fixed position, which can increase the stability of the physics simulation.
- 22  * In addition, the alpha parameter can be decayed over time, relaxing the
- 23  * position constraint, which helps to stabilize on an optimal solution.
- 24  *
- 25  * @param {function} [f] the position function.
- 26  */
- 27 pv.Constraint.position = function(f) {
- 28   var a = 1, // default alpha
- 29       constraint = {};
- 30 
- 31   if (!arguments.length) /** @ignore */ f = function(p) { return p.fix; };
- 32 
- 33   /**
- 34    * Sets or gets the alpha parameter for position interpolation. If the alpha
- 35    * parameter is in the range [0,1], then rather than setting the particle's
- 36    * new position directly to the position returned by the supplied position
- 37    * function, the particle's position is interpolated towards the fixed
- 38    * position.
- 39    *
- 40    * @function
- 41    * @name pv.Constraint.position.prototype.alpha
- 42    * @param {number} x the new alpha parameter, in the range [0,1].
- 43    * @returns {pv.Constraint.position} this.
- 44    */
- 45   constraint.alpha = function(x) {
- 46     if (arguments.length) {
- 47       a = Number(x);
- 48       return constraint;
- 49     }
- 50     return a;
- 51   };
- 52 
- 53   /**
- 54    * Applies this constraint to the specified particles.
- 55    *
- 56    * @function
- 57    * @name pv.Constraint.position.prototype.apply
- 58    * @param {pv.Particle} particles particles to which to apply this constraint.
- 59    */
- 60   constraint.apply = function(particles) {
- 61     for (var p = particles; p; p = p.next) {
- 62       var v = f(p);
- 63       if (v) {
- 64         p.x += (v.x - p.x) * a;
- 65         p.y += (v.y - p.y) * a;
- 66         p.fx = p.fy = p.vx = p.vy = 0;
- 67       }
- 68     }
- 69   };
- 70 
- 71   return constraint;
- 72 };
- 73 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Quadtree.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Quadtree.js.html deleted file mode 100644 index 865c21c2..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Quadtree.js.html +++ /dev/null @@ -1,203 +0,0 @@ -
  1 /**
-  2  * Constructs a new quadtree for the specified array of particles.
-  3  *
-  4  * @class Represents a quadtree: a two-dimensional recursive spatial
-  5  * subdivision. This particular implementation uses square partitions, dividing
-  6  * each square into four equally-sized squares. Each particle exists in a unique
-  7  * node; if multiple particles are in the same position, some particles may be
-  8  * stored on internal nodes rather than leaf nodes.
-  9  *
- 10  * <p>This quadtree can be used to accelerate various spatial operations, such
- 11  * as the Barnes-Hut approximation for computing n-body forces, or collision
- 12  * detection.
- 13  *
- 14  * @see pv.Force.charge
- 15  * @see pv.Constraint.collision
- 16  * @param {pv.Particle} particles the linked list of particles.
- 17  */
- 18 pv.Quadtree = function(particles) {
- 19   var p;
- 20 
- 21   /* Compute bounds. */
- 22   var x1 = Number.POSITIVE_INFINITY, y1 = x1,
- 23       x2 = Number.NEGATIVE_INFINITY, y2 = x2;
- 24   for (p = particles; p; p = p.next) {
- 25     if (p.x < x1) x1 = p.x;
- 26     if (p.y < y1) y1 = p.y;
- 27     if (p.x > x2) x2 = p.x;
- 28     if (p.y > y2) y2 = p.y;
- 29   }
- 30 
- 31   /* Squarify the bounds. */
- 32   var dx = x2 - x1, dy = y2 - y1;
- 33   if (dx > dy) y2 = y1 + dx;
- 34   else x2 = x1 + dy;
- 35   this.xMin = x1;
- 36   this.yMin = y1;
- 37   this.xMax = x2;
- 38   this.yMax = y2;
- 39 
- 40   /**
- 41    * @ignore Recursively inserts the specified particle <i>p</i> at the node
- 42    * <i>n</i> or one of its descendants. The bounds are defined by [<i>x1</i>,
- 43    * <i>x2</i>] and [<i>y1</i>, <i>y2</i>].
- 44    */
- 45   function insert(n, p, x1, y1, x2, y2) {
- 46     if (isNaN(p.x) || isNaN(p.y)) return; // ignore invalid particles
- 47     if (n.leaf) {
- 48       if (n.p) {
- 49         /*
- 50          * If the particle at this leaf node is at the same position as the new
- 51          * particle we are adding, we leave the particle associated with the
- 52          * internal node while adding the new particle to a child node. This
- 53          * avoids infinite recursion.
- 54          */
- 55         if ((Math.abs(n.p.x - p.x) + Math.abs(n.p.y - p.y)) < .01) {
- 56           insertChild(n, p, x1, y1, x2, y2);
- 57         } else {
- 58           var v = n.p;
- 59           n.p = null;
- 60           insertChild(n, v, x1, y1, x2, y2);
- 61           insertChild(n, p, x1, y1, x2, y2);
- 62         }
- 63       } else {
- 64         n.p = p;
- 65       }
- 66     } else {
- 67       insertChild(n, p, x1, y1, x2, y2);
- 68     }
- 69   }
- 70 
- 71   /**
- 72    * @ignore Recursively inserts the specified particle <i>p</i> into a
- 73    * descendant of node <i>n</i>. The bounds are defined by [<i>x1</i>,
- 74    * <i>x2</i>] and [<i>y1</i>, <i>y2</i>].
- 75    */
- 76   function insertChild(n, p, x1, y1, x2, y2) {
- 77     /* Compute the split point, and the quadrant in which to insert p. */
- 78     var sx = (x1 + x2) * .5,
- 79         sy = (y1 + y2) * .5,
- 80         right = p.x >= sx,
- 81         bottom = p.y >= sy;
- 82 
- 83     /* Recursively insert into the child node. */
- 84     n.leaf = false;
- 85     switch ((bottom << 1) + right) {
- 86       case 0: n = n.c1 || (n.c1 = new pv.Quadtree.Node()); break;
- 87       case 1: n = n.c2 || (n.c2 = new pv.Quadtree.Node()); break;
- 88       case 2: n = n.c3 || (n.c3 = new pv.Quadtree.Node()); break;
- 89       case 3: n = n.c4 || (n.c4 = new pv.Quadtree.Node()); break;
- 90     }
- 91 
- 92     /* Update the bounds as we recurse. */
- 93     if (right) x1 = sx; else x2 = sx;
- 94     if (bottom) y1 = sy; else y2 = sy;
- 95     insert(n, p, x1, y1, x2, y2);
- 96   }
- 97 
- 98   /* Insert all particles. */
- 99   this.root = new pv.Quadtree.Node();
-100   for (p = particles; p; p = p.next) insert(this.root, p, x1, y1, x2, y2);
-101 };
-102 
-103 /**
-104  * The root node of the quadtree.
-105  *
-106  * @type pv.Quadtree.Node
-107  * @name pv.Quadtree.prototype.root
-108  */
-109 
-110 /**
-111  * The minimum x-coordinate value of all contained particles.
-112  *
-113  * @type number
-114  * @name pv.Quadtree.prototype.xMin
-115  */
-116 
-117 /**
-118  * The maximum x-coordinate value of all contained particles.
-119  *
-120  * @type number
-121  * @name pv.Quadtree.prototype.xMax
-122  */
-123 
-124 /**
-125  * The minimum y-coordinate value of all contained particles.
-126  *
-127  * @type number
-128  * @name pv.Quadtree.prototype.yMin
-129  */
-130 
-131 /**
-132  * The maximum y-coordinate value of all contained particles.
-133  *
-134  * @type number
-135  * @name pv.Quadtree.prototype.yMax
-136  */
-137 
-138 /**
-139  * Constructs a new node.
-140  *
-141  * @class A node in a quadtree.
-142  *
-143  * @see pv.Quadtree
-144  */
-145 pv.Quadtree.Node = function() {
-146   /*
-147    * Prepopulating all attributes significantly increases performance! Also,
-148    * letting the language interpreter manage garbage collection was moderately
-149    * faster than creating a cache pool.
-150    */
-151   this.leaf = true;
-152   this.c1 = null;
-153   this.c2 = null;
-154   this.c3 = null;
-155   this.c4 = null;
-156   this.p = null;
-157 };
-158 
-159 /**
-160  * True if this node is a leaf node; i.e., it has no children. Note that both
-161  * leaf nodes and non-leaf (internal) nodes may have associated particles. If
-162  * this is a non-leaf node, then at least one of {@link #c1}, {@link #c2},
-163  * {@link #c3} or {@link #c4} is guaranteed to be non-null.
-164  *
-165  * @type boolean
-166  * @name pv.Quadtree.Node.prototype.leaf
-167  */
-168 
-169 /**
-170  * The particle associated with this node, if any.
-171  *
-172  * @type pv.Particle
-173  * @name pv.Quadtree.Node.prototype.p
-174  */
-175 
-176 /**
-177  * The child node for the second quadrant, if any.
-178  *
-179  * @type pv.Quadtree.Node
-180  * @name pv.Quadtree.Node.prototype.c2
-181  */
-182 
-183 /**
-184  * The child node for the third quadrant, if any.
-185  *
-186  * @type pv.Quadtree.Node
-187  * @name pv.Quadtree.Node.prototype.c3
-188  */
-189 
-190 /**
-191  * The child node for the fourth quadrant, if any.
-192  *
-193  * @type pv.Quadtree.Node
-194  * @name pv.Quadtree.Node.prototype.c4
-195  */
-196 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Simulation.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Simulation.js.html deleted file mode 100644 index a62f0601..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_Simulation.js.html +++ /dev/null @@ -1,167 +0,0 @@ -
  1 /**
-  2  * Constructs a new empty simulation.
-  3  *
-  4  * @param {array} particles
-  5  * @returns {pv.Simulation} a new simulation for the specified particles.
-  6  * @see pv.Simulation
-  7  */
-  8 pv.simulation = function(particles) {
-  9   return new pv.Simulation(particles);
- 10 };
- 11 
- 12 /**
- 13  * Constructs a new simulation for the specified particles.
- 14  *
- 15  * @class Represents a particle simulation. Particles are massive points in
- 16  * two-dimensional space. Forces can be applied to these particles, causing them
- 17  * to move. Constraints can also be applied to restrict particle movement, for
- 18  * example, constraining particles to a fixed position, or simulating collision
- 19  * between circular particles with area.
- 20  *
- 21  * <p>The simulation uses <a
- 22  * href="http://en.wikipedia.org/wiki/Verlet_integration">Position Verlet</a>
- 23  * integration, due to the ease with which <a
- 24  * href="http://www.teknikus.dk/tj/gdc2001.htm">geometric constraints</a> can be
- 25  * implemented. For each time step, Verlet integration is performed, new forces
- 26  * are accumulated, and then constraints are applied.
- 27  *
- 28  * <p>The simulation makes two simplifying assumptions: all particles are
- 29  * equal-mass, and the time step of the simulation is fixed. It would be easy to
- 30  * incorporate variable-mass particles as a future enhancement. Variable time
- 31  * steps are also possible, but are likely to introduce instability in the
- 32  * simulation.
- 33  *
- 34  * <p>This class can be used directly to simulate particle interaction.
- 35  * Alternatively, for network diagrams, see {@link pv.Layout.Force}.
- 36  *
- 37  * @param {array} particles an array of {@link pv.Particle}s to simulate.
- 38  * @see pv.Layout.Force
- 39  * @see pv.Force
- 40  * @see pv.Constraint
- 41  */
- 42 pv.Simulation = function(particles) {
- 43   for (var i = 0; i < particles.length; i++) this.particle(particles[i]);
- 44 };
- 45 
- 46 /**
- 47  * The particles in the simulation. Particles are stored as a linked list; this
- 48  * field represents the first particle in the simulation.
- 49  *
- 50  * @field
- 51  * @type pv.Particle
- 52  * @name pv.Simulation.prototype.particles
- 53  */
- 54 
- 55 /**
- 56  * The forces in the simulation. Forces are stored as a linked list; this field
- 57  * represents the first force in the simulation.
- 58  *
- 59  * @field
- 60  * @type pv.Force
- 61  * @name pv.Simulation.prototype.forces
- 62  */
- 63 
- 64 /**
- 65  * The constraints in the simulation. Constraints are stored as a linked list;
- 66  * this field represents the first constraint in the simulation.
- 67  *
- 68  * @field
- 69  * @type pv.Constraint
- 70  * @name pv.Simulation.prototype.constraints
- 71  */
- 72 
- 73 /**
- 74  * Adds the specified particle to the simulation.
- 75  *
- 76  * @param {pv.Particle} p the new particle.
- 77  * @returns {pv.Simulation} this.
- 78  */
- 79 pv.Simulation.prototype.particle = function(p) {
- 80   p.next = this.particles;
- 81   /* Default velocities and forces to zero if unset. */
- 82   if (isNaN(p.px)) p.px = p.x;
- 83   if (isNaN(p.py)) p.py = p.y;
- 84   if (isNaN(p.fx)) p.fx = 0;
- 85   if (isNaN(p.fy)) p.fy = 0;
- 86   this.particles = p;
- 87   return this;
- 88 };
- 89 
- 90 /**
- 91  * Adds the specified force to the simulation.
- 92  *
- 93  * @param {pv.Force} f the new force.
- 94  * @returns {pv.Simulation} this.
- 95  */
- 96 pv.Simulation.prototype.force = function(f) {
- 97   f.next = this.forces;
- 98   this.forces = f;
- 99   return this;
-100 };
-101 
-102 /**
-103  * Adds the specified constraint to the simulation.
-104  *
-105  * @param {pv.Constraint} c the new constraint.
-106  * @returns {pv.Simulation} this.
-107  */
-108 pv.Simulation.prototype.constraint = function(c) {
-109   c.next = this.constraints;
-110   this.constraints = c;
-111   return this;
-112 };
-113 
-114 /**
-115  * Apply constraints, and then set the velocities to zero.
-116  *
-117  * @returns {pv.Simulation} this.
-118  */
-119 pv.Simulation.prototype.stabilize = function(n) {
-120   var c;
-121   if (!arguments.length) n = 3; // TODO use cooling schedule
-122   for (var i = 0; i < n; i++) {
-123     var q = new pv.Quadtree(this.particles);
-124     for (c = this.constraints; c; c = c.next) c.apply(this.particles, q);
-125   }
-126   for (var p = this.particles; p; p = p.next) {
-127     p.px = p.x;
-128     p.py = p.y;
-129   }
-130   return this;
-131 };
-132 
-133 /**
-134  * Advances the simulation one time-step.
-135  */
-136 pv.Simulation.prototype.step = function() {
-137   var p, f, c;
-138 
-139   /*
-140    * Assumptions:
-141    * - The mass (m) of every particles is 1.
-142    * - The time step (dt) is 1.
-143    */
-144 
-145   /* Position Verlet integration. */
-146   for (p = this.particles; p; p = p.next) {
-147     var px = p.px, py = p.py;
-148     p.px = p.x;
-149     p.py = p.y;
-150     p.x += p.vx = ((p.x - px) + p.fx);
-151     p.y += p.vy = ((p.y - py) + p.fy);
-152   }
-153 
-154   /* Apply constraints, then accumulate new forces. */
-155   var q = new pv.Quadtree(this.particles);
-156   for (c = this.constraints; c; c = c.next) c.apply(this.particles, q);
-157   for (p = this.particles; p; p = p.next) p.fx = p.fy = 0;
-158   for (f = this.forces; f; f = f.next) f.apply(this.particles, q);
-159 };
-160 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_SpringForce.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_SpringForce.js.html deleted file mode 100644 index 26ecba88..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_physics_SpringForce.js.html +++ /dev/null @@ -1,149 +0,0 @@ -
  1 /**
-  2  * Constructs a new spring force with the specified constant. The links
-  3  * associated with this spring force must be specified before the spring force
-  4  * can be applied.
-  5  *
-  6  * @class Implements a spring force, per Hooke's law. The spring force can be
-  7  * configured with a tension constant, rest length, and damping factor. The
-  8  * tension and damping will automatically be normalized using the inverse square
-  9  * root of the maximum link degree of attached nodes; this makes springs weaker
- 10  * between nodes of high link degree.
- 11  *
- 12  * <p>Unlike other forces (such as charge and drag forces) which may be applied
- 13  * globally, spring forces are only applied between linked particles. Therefore,
- 14  * an array of links must be specified before this force can be applied; the
- 15  * links should be an array of {@link pv.Layout.Network.Link}s. See also
- 16  * {@link pv.Layout.Force} for an example of using spring and charge forces for
- 17  * network layout.
- 18  *
- 19  * @extends pv.Force
- 20  * @param {number} k the spring constant.
- 21  * @see #constant
- 22  * @see #links
- 23  */
- 24 pv.Force.spring = function(k) {
- 25   var d = .1, // default damping factor
- 26       l = 20, // default rest length
- 27       links, // links on which to apply spring forces
- 28       kl, // per-spring normalization
- 29       force = {};
- 30 
- 31   if (!arguments.length) k = .1; // default spring constant (tension)
- 32 
- 33   /**
- 34    * Sets or gets the links associated with this spring force. Unlike other
- 35    * forces (such as charge and drag forces) which may be applied globally,
- 36    * spring forces are only applied between linked particles. Therefore, an
- 37    * array of links must be specified before this force can be applied; the
- 38    * links should be an array of {@link pv.Layout.Network.Link}s.
- 39    *
- 40    * @function
- 41    * @name pv.Force.spring.prototype.links
- 42    * @param {array} x the new array of links.
- 43    * @returns {pv.Force.spring} this, or the current array of links.
- 44    */
- 45   force.links = function(x) {
- 46     if (arguments.length) {
- 47       links = x;
- 48       kl = x.map(function(l) {
- 49           return 1 / Math.sqrt(Math.max(
- 50               l.sourceNode.linkDegree,
- 51               l.targetNode.linkDegree));
- 52         });
- 53       return force;
- 54     }
- 55     return links;
- 56   };
- 57 
- 58   /**
- 59    * Sets or gets the spring constant. The default value is 0.1; greater values
- 60    * will result in stronger tension. The spring tension is automatically
- 61    * normalized using the inverse square root of the maximum link degree of
- 62    * attached nodes.
- 63    *
- 64    * @function
- 65    * @name pv.Force.spring.prototype.constant
- 66    * @param {number} x the new spring constant.
- 67    * @returns {pv.Force.spring} this, or the current spring constant.
- 68    */
- 69   force.constant = function(x) {
- 70     if (arguments.length) {
- 71       k = Number(x);
- 72       return force;
- 73     }
- 74     return k;
- 75   };
- 76 
- 77   /**
- 78    * The spring damping factor, in the range [0,1]. Damping functions
- 79    * identically to drag forces, damping spring bounciness by applying a force
- 80    * in the opposite direction of attached nodes' velocities. The default value
- 81    * is 0.1. The spring damping is automatically normalized using the inverse
- 82    * square root of the maximum link degree of attached nodes.
- 83    *
- 84    * @function
- 85    * @name pv.Force.spring.prototype.damping
- 86    * @param {number} x the new spring damping factor.
- 87    * @returns {pv.Force.spring} this, or the current spring damping factor.
- 88    */
- 89   force.damping = function(x) {
- 90     if (arguments.length) {
- 91       d = Number(x);
- 92       return force;
- 93     }
- 94     return d;
- 95   };
- 96 
- 97   /**
- 98    * The spring rest length. The default value is 20 pixels.
- 99    *
-100    * @function
-101    * @name pv.Force.spring.prototype.length
-102    * @param {number} x the new spring rest length.
-103    * @returns {pv.Force.spring} this, or the current spring rest length.
-104    */
-105   force.length = function(x) {
-106     if (arguments.length) {
-107       l = Number(x);
-108       return force;
-109     }
-110     return l;
-111   };
-112 
-113   /**
-114    * Applies this force to the specified particles.
-115    *
-116    * @function
-117    * @name pv.Force.spring.prototype.apply
-118    * @param {pv.Particle} particles particles to which to apply this force.
-119    */
-120   force.apply = function(particles) {
-121     for (var i = 0; i < links.length; i++) {
-122       var a = links[i].sourceNode,
-123           b = links[i].targetNode,
-124           dx = a.x - b.x,
-125           dy = a.y - b.y,
-126           dn = Math.sqrt(dx * dx + dy * dy),
-127           dd = dn ? (1 / dn) : 1,
-128           ks = k * kl[i], // normalized tension
-129           kd = d * kl[i], // normalized damping
-130           kk = (ks * (dn - l) + kd * (dx * (a.vx - b.vx) + dy * (a.vy - b.vy)) * dd) * dd,
-131           fx = -kk * (dn ? dx : (.01 * (.5 - Math.random()))),
-132           fy = -kk * (dn ? dy : (.01 * (.5 - Math.random())));
-133       a.fx += fx;
-134       a.fy += fy;
-135       b.fx -= fx;
-136       b.fy -= fy;
-137     }
-138   };
-139 
-140   return force;
-141 };
-142 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_pv-internals.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_pv-internals.js.html deleted file mode 100644 index 9689d319..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_pv-internals.js.html +++ /dev/null @@ -1,162 +0,0 @@ -
  1 /**
-  2  * @private Returns a prototype object suitable for extending the given class
-  3  * <tt>f</tt>. Rather than constructing a new instance of <tt>f</tt> to serve as
-  4  * the prototype (which unnecessarily runs the constructor on the created
-  5  * prototype object, potentially polluting it), an anonymous function is
-  6  * generated internally that shares the same prototype:
-  7  *
-  8  * <pre>function g() {}
-  9  * g.prototype = f.prototype;
- 10  * return new g();</pre>
- 11  *
- 12  * For more details, see Douglas Crockford's essay on prototypal inheritance.
- 13  *
- 14  * @param {function} f a constructor.
- 15  * @returns a suitable prototype object.
- 16  * @see Douglas Crockford's essay on <a
- 17  * href="http://javascript.crockford.com/prototypal.html">prototypal
- 18  * inheritance</a>.
- 19  */
- 20 pv.extend = function(f) {
- 21   function g() {}
- 22   g.prototype = f.prototype || f;
- 23   return new g();
- 24 };
- 25 
- 26 try {
- 27   eval("pv.parse = function(x) x;"); // native support
- 28 } catch (e) {
- 29 
- 30 /**
- 31  * @private Parses a Protovis specification, which may use JavaScript 1.8
- 32  * function expresses, replacing those function expressions with proper
- 33  * functions such that the code can be run by a JavaScript 1.6 interpreter. This
- 34  * hack only supports function expressions (using clumsy regular expressions, no
- 35  * less), and not other JavaScript 1.8 features such as let expressions.
- 36  *
- 37  * @param {string} s a Protovis specification (i.e., a string of JavaScript 1.8
- 38  * source code).
- 39  * @returns {string} a conformant JavaScript 1.6 source code.
- 40  */
- 41   pv.parse = function(js) { // hacky regex support
- 42     var re = new RegExp("function\\s*(\\b\\w+)?\\s*\\([^)]*\\)\\s*", "mg"), m, d, i = 0, s = "";
- 43     while (m = re.exec(js)) {
- 44       var j = m.index + m[0].length;
- 45       if (js.charAt(j) != '{') {
- 46         s += js.substring(i, j) + "{return ";
- 47         i = j;
- 48         for (var p = 0; p >= 0 && j < js.length; j++) {
- 49           var c = js.charAt(j);
- 50           switch (c) {
- 51             case '"': case '\'': {
- 52               while (++j < js.length && (d = js.charAt(j)) != c) {
- 53                 if (d == '\\') j++;
- 54               }
- 55               break;
- 56             }
- 57             case '[': case '(': p++; break;
- 58             case ']': case ')': p--; break;
- 59             case ';':
- 60             case ',': if (p == 0) p--; break;
- 61           }
- 62         }
- 63         s += pv.parse(js.substring(i, --j)) + ";}";
- 64         i = j;
- 65       }
- 66       re.lastIndex = j;
- 67     }
- 68     s += js.substring(i);
- 69     return s;
- 70   };
- 71 }
- 72 
- 73 /**
- 74  * @private Computes the value of the specified CSS property <tt>p</tt> on the
- 75  * specified element <tt>e</tt>.
- 76  *
- 77  * @param {string} p the name of the CSS property.
- 78  * @param e the element on which to compute the CSS property.
- 79  */
- 80 pv.css = function(e, p) {
- 81   return window.getComputedStyle
- 82       ? window.getComputedStyle(e, null).getPropertyValue(p)
- 83       : e.currentStyle[p];
- 84 };
- 85 
- 86 /**
- 87  * @private Reports the specified error to the JavaScript console. Mozilla only
- 88  * allows logging to the console for privileged code; if the console is
- 89  * unavailable, the alert dialog box is used instead.
- 90  *
- 91  * @param e the exception that triggered the error.
- 92  */
- 93 pv.error = function(e) {
- 94   (typeof console == "undefined") ? alert(e) : console.error(e);
- 95 };
- 96 
- 97 /**
- 98  * @private Registers the specified listener for events of the specified type on
- 99  * the specified target. For standards-compliant browsers, this method uses
-100  * <tt>addEventListener</tt>; for Internet Explorer, <tt>attachEvent</tt>.
-101  *
-102  * @param target a DOM element.
-103  * @param {string} type the type of event, such as "click".
-104  * @param {function} the event handler callback.
-105  */
-106 pv.listen = function(target, type, listener) {
-107   listener = pv.listener(listener);
-108   return target.addEventListener
-109       ? target.addEventListener(type, listener, false)
-110       : target.attachEvent("on" + type, listener);
-111 };
-112 
-113 /**
-114  * @private Returns a wrapper for the specified listener function such that the
-115  * {@link pv.event} is set for the duration of the listener's invocation. The
-116  * wrapper is cached on the returned function, such that duplicate registrations
-117  * of the wrapped event handler are ignored.
-118  *
-119  * @param {function} f an event handler.
-120  * @returns {function} the wrapped event handler.
-121  */
-122 pv.listener = function(f) {
-123   return f.$listener || (f.$listener = function(e) {
-124       try {
-125         pv.event = e;
-126         return f.call(this, e);
-127       } finally {
-128         delete pv.event;
-129       }
-130     });
-131 };
-132 
-133 /**
-134  * @private Returns true iff <i>a</i> is an ancestor of <i>e</i>. This is useful
-135  * for ignoring mouseout and mouseover events that are contained within the
-136  * target element.
-137  */
-138 pv.ancestor = function(a, e) {
-139   while (e) {
-140     if (e == a) return true;
-141     e = e.parentNode;
-142   }
-143   return false;
-144 };
-145 
-146 /** @private Returns a locally-unique positive id. */
-147 pv.id = function() {
-148   var id = 1; return function() { return id++; };
-149 }();
-150 
-151 /** @private Returns a function wrapping the specified constant. */
-152 pv.functor = function(v) {
-153   return typeof v == "function" ? v : function() { return v; };
-154 };
-155 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_pv.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_pv.js.html deleted file mode 100644 index cf0f4d87..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_pv.js.html +++ /dev/null @@ -1,103 +0,0 @@ -
  1 /**
-  2  * The top-level Protovis namespace. All public methods and fields should be
-  3  * registered on this object. Note that core Protovis source is surrounded by an
-  4  * anonymous function, so any other declared globals will not be visible outside
-  5  * of core methods. This also allows multiple versions of Protovis to coexist,
-  6  * since each version will see their own <tt>pv</tt> namespace.
-  7  *
-  8  * @namespace The top-level Protovis namespace, <tt>pv</tt>.
-  9  */
- 10 var pv = {};
- 11 
- 12 /**
- 13  * Protovis major and minor version numbers.
- 14  *
- 15  * @namespace Protovis major and minor version numbers.
- 16  */
- 17 pv.version = {
- 18   /**
- 19    * The major version number.
- 20    *
- 21    * @type number
- 22    * @constant
- 23    */
- 24   major: 3,
- 25 
- 26   /**
- 27    * The minor version number.
- 28    *
- 29    * @type number
- 30    * @constant
- 31    */
- 32   minor: 2
- 33 };
- 34 
- 35 /**
- 36  * Returns the passed-in argument, <tt>x</tt>; the identity function. This method
- 37  * is provided for convenience since it is used as the default behavior for a
- 38  * number of property functions.
- 39  *
- 40  * @param x a value.
- 41  * @returns the value <tt>x</tt>.
- 42  */
- 43 pv.identity = function(x) { return x; };
- 44 
- 45 /**
- 46  * Returns <tt>this.index</tt>. This method is provided for convenience for use
- 47  * with scales. For example, to color bars by their index, say:
- 48  *
- 49  * <pre>.fillStyle(pv.Colors.category10().by(pv.index))</pre>
- 50  *
- 51  * This method is equivalent to <tt>function() this.index</tt>, but more
- 52  * succinct. Note that the <tt>index</tt> property is also supported for
- 53  * accessor functions with {@link pv.max}, {@link pv.min} and other array
- 54  * utility methods.
- 55  *
- 56  * @see pv.Scale
- 57  * @see pv.Mark#index
- 58  */
- 59 pv.index = function() { return this.index; };
- 60 
- 61 /**
- 62  * Returns <tt>this.childIndex</tt>. This method is provided for convenience for
- 63  * use with scales. For example, to color bars by their child index, say:
- 64  *
- 65  * <pre>.fillStyle(pv.Colors.category10().by(pv.child))</pre>
- 66  *
- 67  * This method is equivalent to <tt>function() this.childIndex</tt>, but more
- 68  * succinct.
- 69  *
- 70  * @see pv.Scale
- 71  * @see pv.Mark#childIndex
- 72  */
- 73 pv.child = function() { return this.childIndex; };
- 74 
- 75 /**
- 76  * Returns <tt>this.parent.index</tt>. This method is provided for convenience
- 77  * for use with scales. This method is provided for convenience for use with
- 78  * scales. For example, to color bars by their parent index, say:
- 79  *
- 80  * <pre>.fillStyle(pv.Colors.category10().by(pv.parent))</pre>
- 81  *
- 82  * Tthis method is equivalent to <tt>function() this.parent.index</tt>, but more
- 83  * succinct.
- 84  *
- 85  * @see pv.Scale
- 86  * @see pv.Mark#index
- 87  */
- 88 pv.parent = function() { return this.parent.index; };
- 89 
- 90 /**
- 91  * Stores the current event. This field is only set within event handlers.
- 92  *
- 93  * @type Event
- 94  * @name pv.event
- 95  */
- 96 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgArea.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgArea.js.html deleted file mode 100644 index 0f5f689d..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgArea.js.html +++ /dev/null @@ -1,180 +0,0 @@ -
  1 pv.SvgScene.area = function(scenes) {
-  2   var e = scenes.$g.firstChild;
-  3   if (!scenes.length) return e;
-  4   var s = scenes[0];
-  5 
-  6   /* segmented */
-  7   if (s.segmented) return this.areaSegment(scenes);
-  8 
-  9   /* visible */
- 10   if (!s.visible) return e;
- 11   var fill = s.fillStyle, stroke = s.strokeStyle;
- 12   if (!fill.opacity && !stroke.opacity) return e;
- 13 
- 14   /** @private Computes the straight path for the range [i, j]. */
- 15   function path(i, j) {
- 16     var p1 = [], p2 = [];
- 17     for (var k = j; i <= k; i++, j--) {
- 18       var si = scenes[i],
- 19           sj = scenes[j],
- 20           pi = si.left + "," + si.top,
- 21           pj = (sj.left + sj.width) + "," + (sj.top + sj.height);
- 22 
- 23       /* interpolate */
- 24       if (i < k) {
- 25         var sk = scenes[i + 1], sl = scenes[j - 1];
- 26         switch (s.interpolate) {
- 27           case "step-before": {
- 28             pi += "V" + sk.top;
- 29             pj += "H" + (sl.left + sl.width);
- 30             break;
- 31           }
- 32           case "step-after": {
- 33             pi += "H" + sk.left;
- 34             pj += "V" + (sl.top + sl.height);
- 35             break;
- 36           }
- 37         }
- 38       }
- 39 
- 40       p1.push(pi);
- 41       p2.push(pj);
- 42     }
- 43     return p1.concat(p2).join("L");
- 44   }
- 45 
- 46   /** @private Computes the curved path for the range [i, j]. */
- 47   function pathCurve(i, j) {
- 48     var pointsT = [], pointsB = [], pathT, pathB;
- 49 
- 50     for (var k = j; i <= k; i++, j--) {
- 51       var sj = scenes[j];
- 52       pointsT.push(scenes[i]);
- 53       pointsB.push({left: sj.left + sj.width, top: sj.top + sj.height});
- 54     }
- 55 
- 56     if (s.interpolate == "basis") {
- 57       pathT = pv.SvgScene.curveBasis(pointsT);
- 58       pathB = pv.SvgScene.curveBasis(pointsB);
- 59     } else if (s.interpolate == "cardinal") {
- 60       pathT = pv.SvgScene.curveCardinal(pointsT, s.tension);
- 61       pathB = pv.SvgScene.curveCardinal(pointsB, s.tension);
- 62     } else { // monotone
- 63       pathT = pv.SvgScene.curveMonotone(pointsT);
- 64       pathB = pv.SvgScene.curveMonotone(pointsB);
- 65     }
- 66 
- 67     return pointsT[0].left + "," + pointsT[0].top + pathT
- 68          + "L" + pointsB[0].left + "," + pointsB[0].top + pathB;
- 69   }
- 70 
- 71   /* points */
- 72   var d = [], si, sj;
- 73   for (var i = 0; i < scenes.length; i++) {
- 74     si = scenes[i]; if (!si.width && !si.height) continue;
- 75     for (var j = i + 1; j < scenes.length; j++) {
- 76       sj = scenes[j]; if (!sj.width && !sj.height) break;
- 77     }
- 78     if (i && (s.interpolate != "step-after")) i--;
- 79     if ((j < scenes.length) && (s.interpolate != "step-before")) j++;
- 80     d.push(((j - i > 2
- 81         && (s.interpolate == "basis"
- 82         || s.interpolate == "cardinal"
- 83         || s.interpolate == "monotone"))
- 84         ? pathCurve : path)(i, j - 1));
- 85     i = j - 1;
- 86   }
- 87   if (!d.length) return e;
- 88 
- 89   e = this.expect(e, "path", {
- 90       "shape-rendering": s.antialias ? null : "crispEdges",
- 91       "pointer-events": s.events,
- 92       "cursor": s.cursor,
- 93       "d": "M" + d.join("ZM") + "Z",
- 94       "fill": fill.color,
- 95       "fill-opacity": fill.opacity || null,
- 96       "stroke": stroke.color,
- 97       "stroke-opacity": stroke.opacity || null,
- 98       "stroke-width": stroke.opacity ? s.lineWidth / this.scale : null
- 99     });
-100   return this.append(e, scenes, 0);
-101 };
-102 
-103 pv.SvgScene.areaSegment = function(scenes) {
-104   var e = scenes.$g.firstChild, s = scenes[0], pathsT, pathsB;
-105   if (s.interpolate == "basis"
-106       || s.interpolate == "cardinal"
-107       || s.interpolate == "monotone") {
-108     var pointsT = [], pointsB = [];
-109 
-110     for (var i = 0, n = scenes.length; i < n; i++) {
-111       var sj = scenes[n - i - 1];
-112       pointsT.push(scenes[i]);
-113       pointsB.push({left: sj.left + sj.width, top: sj.top + sj.height});
-114     }
-115 
-116     if (s.interpolate == "basis") {
-117       pathsT = this.curveBasisSegments(pointsT);
-118       pathsB = this.curveBasisSegments(pointsB);
-119     } else if (s.interpolate == "cardinal") {
-120       pathsT = this.curveCardinalSegments(pointsT, s.tension);
-121       pathsB = this.curveCardinalSegments(pointsB, s.tension);
-122     } else { // monotone
-123       pathsT = this.curveMonotoneSegments(pointsT);
-124       pathsB = this.curveMonotoneSegments(pointsB);
-125     }
-126   }
-127 
-128   for (var i = 0, n = scenes.length - 1; i < n; i++) {
-129     var s1 = scenes[i], s2 = scenes[i + 1];
-130 
-131     /* visible */
-132     if (!s1.visible || !s2.visible) continue;
-133     var fill = s1.fillStyle, stroke = s1.strokeStyle;
-134     if (!fill.opacity && !stroke.opacity) continue;
-135 
-136     var d;
-137     if (pathsT) {
-138       var pathT = pathsT[i],
-139           pathB = "L" + pathsB[n - i - 1].substr(1);
-140 
-141       d = pathT + pathB + "Z";
-142     } else {
-143       /* interpolate */
-144       var si = s1, sj = s2;
-145       switch (s1.interpolate) {
-146         case "step-before": si = s2; break;
-147         case "step-after": sj = s1; break;
-148       }
-149 
-150       /* path */
-151       d = "M" + s1.left + "," + si.top
-152         + "L" + s2.left + "," + sj.top
-153         + "L" + (s2.left + s2.width) + "," + (sj.top + sj.height)
-154         + "L" + (s1.left + s1.width) + "," + (si.top + si.height)
-155         + "Z";
-156     }
-157 
-158     e = this.expect(e, "path", {
-159         "shape-rendering": s1.antialias ? null : "crispEdges",
-160         "pointer-events": s1.events,
-161         "cursor": s1.cursor,
-162         "d": d,
-163         "fill": fill.color,
-164         "fill-opacity": fill.opacity || null,
-165         "stroke": stroke.color,
-166         "stroke-opacity": stroke.opacity || null,
-167         "stroke-width": stroke.opacity ? s1.lineWidth / this.scale : null
-168       });
-169     e = this.append(e, scenes, i);
-170   }
-171   return e;
-172 };
-173 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgBar.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgBar.js.html deleted file mode 100644 index 7c0a5bfd..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgBar.js.html +++ /dev/null @@ -1,36 +0,0 @@ -
  1 pv.SvgScene.bar = function(scenes) {
-  2   var e = scenes.$g.firstChild;
-  3   for (var i = 0; i < scenes.length; i++) {
-  4     var s = scenes[i];
-  5 
-  6     /* visible */
-  7     if (!s.visible) continue;
-  8     var fill = s.fillStyle, stroke = s.strokeStyle;
-  9     if (!fill.opacity && !stroke.opacity) continue;
- 10 
- 11     e = this.expect(e, "rect", {
- 12         "shape-rendering": s.antialias ? null : "crispEdges",
- 13         "pointer-events": s.events,
- 14         "cursor": s.cursor,
- 15         "x": s.left,
- 16         "y": s.top,
- 17         "width": Math.max(1E-10, s.width),
- 18         "height": Math.max(1E-10, s.height),
- 19         "fill": fill.color,
- 20         "fill-opacity": fill.opacity || null,
- 21         "stroke": stroke.color,
- 22         "stroke-opacity": stroke.opacity || null,
- 23         "stroke-width": stroke.opacity ? s.lineWidth / this.scale : null
- 24       });
- 25     e = this.append(e, scenes, i);
- 26   }
- 27   return e;
- 28 };
- 29 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgCurve.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgCurve.js.html deleted file mode 100644 index 68682c66..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgCurve.js.html +++ /dev/null @@ -1,362 +0,0 @@ -
  1 /**
-  2  * @private Converts the specified b-spline curve segment to a bezier curve
-  3  * compatible with SVG "C".
-  4  *
-  5  * @param p0 the first control point.
-  6  * @param p1 the second control point.
-  7  * @param p2 the third control point.
-  8  * @param p3 the fourth control point.
-  9  */
- 10 pv.SvgScene.pathBasis = (function() {
- 11 
- 12   /**
- 13    * Matrix to transform basis (b-spline) control points to bezier control
- 14    * points. Derived from FvD 11.2.8.
- 15    */
- 16   var basis = [
- 17     [ 1/6, 2/3, 1/6,   0 ],
- 18     [   0, 2/3, 1/3,   0 ],
- 19     [   0, 1/3, 2/3,   0 ],
- 20     [   0, 1/6, 2/3, 1/6 ]
- 21   ];
- 22 
- 23   /**
- 24    * Returns the point that is the weighted sum of the specified control points,
- 25    * using the specified weights. This method requires that there are four
- 26    * weights and four control points.
- 27    */
- 28   function weight(w, p0, p1, p2, p3) {
- 29     return {
- 30       x: w[0] * p0.left + w[1] * p1.left + w[2] * p2.left + w[3] * p3.left,
- 31       y: w[0] * p0.top  + w[1] * p1.top  + w[2] * p2.top  + w[3] * p3.top
- 32     };
- 33   }
- 34 
- 35   var convert = function(p0, p1, p2, p3) {
- 36     var b1 = weight(basis[1], p0, p1, p2, p3),
- 37         b2 = weight(basis[2], p0, p1, p2, p3),
- 38         b3 = weight(basis[3], p0, p1, p2, p3);
- 39     return "C" + b1.x + "," + b1.y
- 40          + "," + b2.x + "," + b2.y
- 41          + "," + b3.x + "," + b3.y;
- 42   };
- 43 
- 44   convert.segment = function(p0, p1, p2, p3) {
- 45     var b0 = weight(basis[0], p0, p1, p2, p3),
- 46         b1 = weight(basis[1], p0, p1, p2, p3),
- 47         b2 = weight(basis[2], p0, p1, p2, p3),
- 48         b3 = weight(basis[3], p0, p1, p2, p3);
- 49     return "M" + b0.x + "," + b0.y
- 50          + "C" + b1.x + "," + b1.y
- 51          + "," + b2.x + "," + b2.y
- 52          + "," + b3.x + "," + b3.y;
- 53   };
- 54 
- 55   return convert;
- 56 })();
- 57 
- 58 /**
- 59  * @private Interpolates the given points using the basis spline interpolation.
- 60  * Returns an SVG path without the leading M instruction to allow path
- 61  * appending.
- 62  *
- 63  * @param points the array of points.
- 64  */
- 65 pv.SvgScene.curveBasis = function(points) {
- 66   if (points.length <= 2) return "";
- 67   var path = "",
- 68       p0 = points[0],
- 69       p1 = p0,
- 70       p2 = p0,
- 71       p3 = points[1];
- 72   path += this.pathBasis(p0, p1, p2, p3);
- 73   for (var i = 2; i < points.length; i++) {
- 74     p0 = p1;
- 75     p1 = p2;
- 76     p2 = p3;
- 77     p3 = points[i];
- 78     path += this.pathBasis(p0, p1, p2, p3);
- 79   }
- 80   /* Cycle through to get the last point. */
- 81   path += this.pathBasis(p1, p2, p3, p3);
- 82   path += this.pathBasis(p2, p3, p3, p3);
- 83   return path;
- 84 };
- 85 
- 86 /**
- 87  * @private Interpolates the given points using the basis spline interpolation.
- 88  * If points.length == tangents.length then a regular Hermite interpolation is
- 89  * performed, if points.length == tangents.length + 2 then the first and last
- 90  * segments are filled in with cubic bazier segments.  Returns an array of path
- 91  * strings.
- 92  *
- 93  * @param points the array of points.
- 94  */
- 95 pv.SvgScene.curveBasisSegments = function(points) {
- 96   if (points.length <= 2) return "";
- 97   var paths = [],
- 98       p0 = points[0],
- 99       p1 = p0,
-100       p2 = p0,
-101       p3 = points[1],
-102       firstPath = this.pathBasis.segment(p0, p1, p2, p3);
-103 
-104   p0 = p1;
-105   p1 = p2;
-106   p2 = p3;
-107   p3 = points[2];
-108   paths.push(firstPath + this.pathBasis(p0, p1, p2, p3)); // merge first & second path
-109   for (var i = 3; i < points.length; i++) {
-110     p0 = p1;
-111     p1 = p2;
-112     p2 = p3;
-113     p3 = points[i];
-114     paths.push(this.pathBasis.segment(p0, p1, p2, p3));
-115   }
-116 
-117   // merge last & second-to-last path
-118   paths.push(this.pathBasis.segment(p1, p2, p3, p3) + this.pathBasis(p2, p3, p3, p3));
-119   return paths;
-120 };
-121 
-122 /**
-123  * @private Interpolates the given points with respective tangents using the cubic
-124  * Hermite spline interpolation. If points.length == tangents.length then a regular
-125  * Hermite interpolation is performed, if points.length == tangents.length + 2 then
-126  * the first and last segments are filled in with cubic bazier segments.
-127  * Returns an SVG path without the leading M instruction to allow path appending.
-128  *
-129  * @param points the array of points.
-130  * @param tangents the array of tangent vectors.
-131  */
-132 pv.SvgScene.curveHermite = function(points, tangents) {
-133   if (tangents.length < 1
-134       || (points.length != tangents.length
-135       && points.length != tangents.length + 2)) return "";
-136   var quad = points.length != tangents.length,
-137       path = "",
-138       p0 = points[0],
-139       p = points[1],
-140       t0 = tangents[0],
-141       t = t0,
-142       pi = 1;
-143 
-144   if (quad) {
-145     path += "Q" + (p.left - t0.x * 2 / 3) + ","  + (p.top - t0.y * 2 / 3)
-146         + "," + p.left + "," + p.top;
-147     p0 = points[1];
-148     pi = 2;
-149   }
-150 
-151   if (tangents.length > 1) {
-152     t = tangents[1];
-153     p = points[pi];
-154     pi++;
-155     path += "C" + (p0.left + t0.x) + "," + (p0.top + t0.y)
-156         + "," + (p.left - t.x) + "," + (p.top - t.y)
-157         + "," + p.left + "," + p.top;
-158     for (var i = 2; i < tangents.length; i++, pi++) {
-159       p = points[pi];
-160       t = tangents[i];
-161       path += "S" + (p.left - t.x) + "," + (p.top - t.y)
-162           + "," + p.left + "," + p.top;
-163     }
-164   }
-165 
-166   if (quad) {
-167     var lp = points[pi];
-168     path += "Q" + (p.left + t.x * 2 / 3) + ","  + (p.top + t.y * 2 / 3) + ","
-169         + lp.left + "," + lp.top;
-170   }
-171 
-172   return path;
-173 };
-174 
-175 /**
-176  * @private Interpolates the given points with respective tangents using the
-177  * cubic Hermite spline interpolation. Returns an array of path strings.
-178  *
-179  * @param points the array of points.
-180  * @param tangents the array of tangent vectors.
-181  */
-182 pv.SvgScene.curveHermiteSegments = function(points, tangents) {
-183   if (tangents.length < 1
-184       || (points.length != tangents.length
-185       && points.length != tangents.length + 2)) return [];
-186   var quad = points.length != tangents.length,
-187       paths = [],
-188       p0 = points[0],
-189       p = p0,
-190       t0 = tangents[0],
-191       t = t0,
-192       pi = 1;
-193 
-194   if (quad) {
-195     p = points[1];
-196     paths.push("M" + p0.left + "," + p0.top
-197         + "Q" + (p.left - t.x * 2 / 3) + "," + (p.top - t.y * 2 / 3)
-198         + "," + p.left + "," + p.top);
-199     pi = 2;
-200   }
-201 
-202   for (var i = 1; i < tangents.length; i++, pi++) {
-203     p0 = p;
-204     t0 = t;
-205     p = points[pi];
-206     t = tangents[i];
-207     paths.push("M" + p0.left + "," + p0.top
-208         + "C" + (p0.left + t0.x) + "," + (p0.top + t0.y)
-209         + "," + (p.left - t.x) + "," + (p.top - t.y)
-210         + "," + p.left + "," + p.top);
-211   }
-212 
-213   if (quad) {
-214     var lp = points[pi];
-215     paths.push("M" + p.left + "," + p.top
-216         + "Q" + (p.left + t.x * 2 / 3) + ","  + (p.top + t.y * 2 / 3) + ","
-217         + lp.left + "," + lp.top);
-218   }
-219 
-220   return paths;
-221 };
-222 
-223 /**
-224  * @private Computes the tangents for the given points needed for cardinal
-225  * spline interpolation. Returns an array of tangent vectors. Note: that for n
-226  * points only the n-2 well defined tangents are returned.
-227  *
-228  * @param points the array of points.
-229  * @param tension the tension of hte cardinal spline.
-230  */
-231 pv.SvgScene.cardinalTangents = function(points, tension) {
-232   var tangents = [],
-233       a = (1 - tension) / 2,
-234       p0 = points[0],
-235       p1 = points[1],
-236       p2 = points[2];
-237 
-238   for (var i = 3; i < points.length; i++) {
-239     tangents.push({x: a * (p2.left - p0.left), y: a * (p2.top - p0.top)});
-240     p0 = p1;
-241     p1 = p2;
-242     p2 = points[i];
-243   }
-244 
-245   tangents.push({x: a * (p2.left - p0.left), y: a * (p2.top - p0.top)});
-246   return tangents;
-247 };
-248 
-249 /**
-250  * @private Interpolates the given points using cardinal spline interpolation.
-251  * Returns an SVG path without the leading M instruction to allow path
-252  * appending.
-253  *
-254  * @param points the array of points.
-255  * @param tension the tension of hte cardinal spline.
-256  */
-257 pv.SvgScene.curveCardinal = function(points, tension) {
-258   if (points.length <= 2) return "";
-259   return this.curveHermite(points, this.cardinalTangents(points, tension));
-260 };
-261 
-262 /**
-263  * @private Interpolates the given points using cardinal spline interpolation.
-264  * Returns an array of path strings.
-265  *
-266  * @param points the array of points.
-267  * @param tension the tension of hte cardinal spline.
-268  */
-269 pv.SvgScene.curveCardinalSegments = function(points, tension) {
-270   if (points.length <= 2) return "";
-271   return this.curveHermiteSegments(points, this.cardinalTangents(points, tension));
-272 };
-273 
-274 /**
-275  * @private Interpolates the given points using Fritsch-Carlson Monotone cubic
-276  * Hermite interpolation. Returns an array of tangent vectors.
-277  *
-278  * @param points the array of points.
-279  */
-280 pv.SvgScene.monotoneTangents = function(points) {
-281   var tangents = [],
-282       d = [],
-283       m = [],
-284       dx = [],
-285       k = 0;
-286 
-287   /* Compute the slopes of the secant lines between successive points. */
-288   for (k = 0; k < points.length-1; k++) {
-289     d[k] = (points[k+1].top - points[k].top)/(points[k+1].left - points[k].left);
-290   }
-291 
-292   /* Initialize the tangents at every point as the average of the secants. */
-293   m[0] = d[0];
-294   dx[0] = points[1].left - points[0].left;
-295   for (k = 1; k < points.length - 1; k++) {
-296     m[k] = (d[k-1]+d[k])/2;
-297     dx[k] = (points[k+1].left - points[k-1].left)/2;
-298   }
-299   m[k] = d[k-1];
-300   dx[k] = (points[k].left - points[k-1].left);
-301 
-302   /* Step 3. Very important, step 3. Yep. Wouldn't miss it. */
-303   for (k = 0; k < points.length - 1; k++) {
-304     if (d[k] == 0) {
-305       m[ k ] = 0;
-306       m[k+1] = 0;
-307     }
-308   }
-309 
-310   /* Step 4 + 5. Out of 5 or more steps. */
-311   for (k = 0; k < points.length - 1; k++) {
-312     if ((Math.abs(m[k]) < 1e-5) || (Math.abs(m[k+1]) < 1e-5)) continue;
-313     var ak = m[k] / d[k],
-314         bk = m[k + 1] / d[k],
-315         s = ak * ak + bk * bk; // monotone constant (?)
-316     if (s > 9) {
-317       var tk = 3 / Math.sqrt(s);
-318       m[k] = tk * ak * d[k];
-319       m[k + 1] = tk * bk * d[k];
-320     }
-321   }
-322 
-323   var len;
-324   for (var i = 0; i < points.length; i++) {
-325     len = 1 + m[i] * m[i]; // pv.vector(1, m[i]).norm().times(dx[i]/3)
-326     tangents.push({x: dx[i] / 3 / len, y: m[i] * dx[i] / 3 / len});
-327   }
-328 
-329   return tangents;
-330 };
-331 
-332 /**
-333  * @private Interpolates the given points using Fritsch-Carlson Monotone cubic
-334  * Hermite interpolation. Returns an SVG path without the leading M instruction
-335  * to allow path appending.
-336  *
-337  * @param points the array of points.
-338  */
-339 pv.SvgScene.curveMonotone = function(points) {
-340   if (points.length <= 2) return "";
-341   return this.curveHermite(points, this.monotoneTangents(points));
-342 }
-343 
-344 /**
-345  * @private Interpolates the given points using Fritsch-Carlson Monotone cubic
-346  * Hermite interpolation.
-347  * Returns an array of path strings.
-348  *
-349  * @param points the array of points.
-350  */
-351 pv.SvgScene.curveMonotoneSegments = function(points) {
-352   if (points.length <= 2) return "";
-353   return this.curveHermiteSegments(points, this.monotoneTangents(points));
-354 };
-355 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgDot.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgDot.js.html deleted file mode 100644 index 0d957597..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgDot.js.html +++ /dev/null @@ -1,89 +0,0 @@ -
  1 pv.SvgScene.dot = function(scenes) {
-  2   var e = scenes.$g.firstChild;
-  3   for (var i = 0; i < scenes.length; i++) {
-  4     var s = scenes[i];
-  5 
-  6     /* visible */
-  7     if (!s.visible) continue;
-  8     var fill = s.fillStyle, stroke = s.strokeStyle;
-  9     if (!fill.opacity && !stroke.opacity) continue;
- 10 
- 11     /* points */
- 12     var radius = s.radius, path = null;
- 13     switch (s.shape) {
- 14       case "cross": {
- 15         path = "M" + -radius + "," + -radius
- 16             + "L" + radius + "," + radius
- 17             + "M" + radius + "," + -radius
- 18             + "L" + -radius + "," + radius;
- 19         break;
- 20       }
- 21       case "triangle": {
- 22         var h = radius, w = radius * 1.1547; // 2 / Math.sqrt(3)
- 23         path = "M0," + h
- 24             + "L" + w +"," + -h
- 25             + " " + -w + "," + -h
- 26             + "Z";
- 27         break;
- 28       }
- 29       case "diamond": {
- 30         radius *= Math.SQRT2;
- 31         path = "M0," + -radius
- 32             + "L" + radius + ",0"
- 33             + " 0," + radius
- 34             + " " + -radius + ",0"
- 35             + "Z";
- 36         break;
- 37       }
- 38       case "square": {
- 39         path = "M" + -radius + "," + -radius
- 40             + "L" + radius + "," + -radius
- 41             + " " + radius + "," + radius
- 42             + " " + -radius + "," + radius
- 43             + "Z";
- 44         break;
- 45       }
- 46       case "tick": {
- 47         path = "M0,0L0," + -s.size;
- 48         break;
- 49       }
- 50       case "bar": {
- 51         path = "M0," + (s.size / 2) + "L0," + -(s.size / 2);
- 52         break;
- 53       }
- 54     }
- 55 
- 56     /* Use <circle> for circles, <path> for everything else. */
- 57     var svg = {
- 58       "shape-rendering": s.antialias ? null : "crispEdges",
- 59       "pointer-events": s.events,
- 60       "cursor": s.cursor,
- 61       "fill": fill.color,
- 62       "fill-opacity": fill.opacity || null,
- 63       "stroke": stroke.color,
- 64       "stroke-opacity": stroke.opacity || null,
- 65       "stroke-width": stroke.opacity ? s.lineWidth / this.scale : null
- 66     };
- 67     if (path) {
- 68       svg.transform = "translate(" + s.left + "," + s.top + ")";
- 69       if (s.angle) svg.transform += " rotate(" + 180 * s.angle / Math.PI + ")";
- 70       svg.d = path;
- 71       e = this.expect(e, "path", svg);
- 72     } else {
- 73       svg.cx = s.left;
- 74       svg.cy = s.top;
- 75       svg.r = radius;
- 76       e = this.expect(e, "circle", svg);
- 77     }
- 78     e = this.append(e, scenes, i);
- 79   }
- 80   return e;
- 81 };
- 82 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgImage.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgImage.js.html deleted file mode 100644 index 97f93544..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgImage.js.html +++ /dev/null @@ -1,53 +0,0 @@ -
  1 pv.SvgScene.image = function(scenes) {
-  2   var e = scenes.$g.firstChild;
-  3   for (var i = 0; i < scenes.length; i++) {
-  4     var s = scenes[i];
-  5 
-  6     /* visible */
-  7     if (!s.visible) continue;
-  8 
-  9     /* fill */
- 10     e = this.fill(e, scenes, i);
- 11 
- 12     /* image */
- 13     if (s.image) {
- 14       e = this.expect(e, "foreignObject", {
- 15           "cursor": s.cursor,
- 16           "x": s.left,
- 17           "y": s.top,
- 18           "width": s.width,
- 19           "height": s.height
- 20         });
- 21       var c = e.firstChild || e.appendChild(document.createElementNS(this.xhtml, "canvas"));
- 22       c.$scene = {scenes:scenes, index:i};
- 23       c.style.width = s.width;
- 24       c.style.height = s.height;
- 25       c.width = s.imageWidth;
- 26       c.height = s.imageHeight;
- 27       c.getContext("2d").putImageData(s.image, 0, 0);
- 28     } else {
- 29       e = this.expect(e, "image", {
- 30           "preserveAspectRatio": "none",
- 31           "cursor": s.cursor,
- 32           "x": s.left,
- 33           "y": s.top,
- 34           "width": s.width,
- 35           "height": s.height
- 36         });
- 37       e.setAttributeNS(this.xlink, "href", s.url);
- 38     }
- 39     e = this.append(e, scenes, i);
- 40 
- 41     /* stroke */
- 42     e = this.stroke(e, scenes, i);
- 43   }
- 44   return e;
- 45 };
- 46 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgLabel.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgLabel.js.html deleted file mode 100644 index 602cb796..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgLabel.js.html +++ /dev/null @@ -1,54 +0,0 @@ -
  1 pv.SvgScene.label = function(scenes) {
-  2   var e = scenes.$g.firstChild;
-  3   for (var i = 0; i < scenes.length; i++) {
-  4     var s = scenes[i];
-  5 
-  6     /* visible */
-  7     if (!s.visible) continue;
-  8     var fill = s.textStyle;
-  9     if (!fill.opacity || !s.text) continue;
- 10 
- 11     /* text-baseline, text-align */
- 12     var x = 0, y = 0, dy = 0, anchor = "start";
- 13     switch (s.textBaseline) {
- 14       case "middle": dy = ".35em"; break;
- 15       case "top": dy = ".71em"; y = s.textMargin; break;
- 16       case "bottom": y = "-" + s.textMargin; break;
- 17     }
- 18     switch (s.textAlign) {
- 19       case "right": anchor = "end"; x = "-" + s.textMargin; break;
- 20       case "center": anchor = "middle"; break;
- 21       case "left": x = s.textMargin; break;
- 22     }
- 23 
- 24     e = this.expect(e, "text", {
- 25         "pointer-events": s.events,
- 26         "cursor": s.cursor,
- 27         "x": x,
- 28         "y": y,
- 29         "dy": dy,
- 30         "transform": "translate(" + s.left + "," + s.top + ")"
- 31             + (s.textAngle ? " rotate(" + 180 * s.textAngle / Math.PI + ")" : "")
- 32             + (this.scale != 1 ? " scale(" + 1 / this.scale + ")" : ""),
- 33         "fill": fill.color,
- 34         "fill-opacity": fill.opacity || null,
- 35         "text-anchor": anchor
- 36       }, {
- 37         "font": s.font,
- 38         "text-shadow": s.textShadow,
- 39         "text-decoration": s.textDecoration
- 40       });
- 41     if (e.firstChild) e.firstChild.nodeValue = s.text;
- 42     else e.appendChild(document.createTextNode(s.text));
- 43     e = this.append(e, scenes, i);
- 44   }
- 45   return e;
- 46 };
- 47 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgLine.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgLine.js.html deleted file mode 100644 index 74a7dba0..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgLine.js.html +++ /dev/null @@ -1,167 +0,0 @@ -
  1 pv.SvgScene.line = function(scenes) {
-  2   var e = scenes.$g.firstChild;
-  3   if (scenes.length < 2) return e;
-  4   var s = scenes[0];
-  5 
-  6   /* segmented */
-  7   if (s.segmented) return this.lineSegment(scenes);
-  8 
-  9   /* visible */
- 10   if (!s.visible) return e;
- 11   var fill = s.fillStyle, stroke = s.strokeStyle;
- 12   if (!fill.opacity && !stroke.opacity) return e;
- 13 
- 14   /* points */
- 15   var d = "M" + s.left + "," + s.top;
- 16 
- 17   if (scenes.length > 2 && (s.interpolate == "basis" || s.interpolate == "cardinal" || s.interpolate == "monotone")) {
- 18     switch (s.interpolate) {
- 19       case "basis": d += this.curveBasis(scenes); break;
- 20       case "cardinal": d += this.curveCardinal(scenes, s.tension); break;
- 21       case "monotone": d += this.curveMonotone(scenes); break;
- 22     }
- 23   } else {
- 24     for (var i = 1; i < scenes.length; i++) {
- 25       d += this.pathSegment(scenes[i - 1], scenes[i]);
- 26     }
- 27   }
- 28 
- 29   e = this.expect(e, "path", {
- 30       "shape-rendering": s.antialias ? null : "crispEdges",
- 31       "pointer-events": s.events,
- 32       "cursor": s.cursor,
- 33       "d": d,
- 34       "fill": fill.color,
- 35       "fill-opacity": fill.opacity || null,
- 36       "stroke": stroke.color,
- 37       "stroke-opacity": stroke.opacity || null,
- 38       "stroke-width": stroke.opacity ? s.lineWidth / this.scale : null,
- 39       "stroke-linejoin": s.lineJoin
- 40     });
- 41   return this.append(e, scenes, 0);
- 42 };
- 43 
- 44 pv.SvgScene.lineSegment = function(scenes) {
- 45   var e = scenes.$g.firstChild;
- 46 
- 47   var s = scenes[0];
- 48   var paths;
- 49   switch (s.interpolate) {
- 50     case "basis": paths = this.curveBasisSegments(scenes); break;
- 51     case "cardinal": paths = this.curveCardinalSegments(scenes, s.tension); break;
- 52     case "monotone": paths = this.curveMonotoneSegments(scenes); break;
- 53   }
- 54 
- 55   for (var i = 0, n = scenes.length - 1; i < n; i++) {
- 56     var s1 = scenes[i], s2 = scenes[i + 1];
- 57 
- 58     /* visible */
- 59     if (!s1.visible || !s2.visible) continue;
- 60     var stroke = s1.strokeStyle, fill = pv.Color.transparent;
- 61     if (!stroke.opacity) continue;
- 62 
- 63     /* interpolate */
- 64     var d;
- 65     if ((s1.interpolate == "linear") && (s1.lineJoin == "miter")) {
- 66       fill = stroke;
- 67       stroke = pv.Color.transparent;
- 68       d = this.pathJoin(scenes[i - 1], s1, s2, scenes[i + 2]);
- 69     } else if(paths) {
- 70       d = paths[i];
- 71     } else {
- 72       d = "M" + s1.left + "," + s1.top + this.pathSegment(s1, s2);
- 73     }
- 74 
- 75     e = this.expect(e, "path", {
- 76         "shape-rendering": s1.antialias ? null : "crispEdges",
- 77         "pointer-events": s1.events,
- 78         "cursor": s1.cursor,
- 79         "d": d,
- 80         "fill": fill.color,
- 81         "fill-opacity": fill.opacity || null,
- 82         "stroke": stroke.color,
- 83         "stroke-opacity": stroke.opacity || null,
- 84         "stroke-width": stroke.opacity ? s1.lineWidth / this.scale : null,
- 85         "stroke-linejoin": s1.lineJoin
- 86       });
- 87     e = this.append(e, scenes, i);
- 88   }
- 89   return e;
- 90 };
- 91 
- 92 /** @private Returns the path segment for the specified points. */
- 93 pv.SvgScene.pathSegment = function(s1, s2) {
- 94   var l = 1; // sweep-flag
- 95   switch (s1.interpolate) {
- 96     case "polar-reverse":
- 97       l = 0;
- 98     case "polar": {
- 99       var dx = s2.left - s1.left,
-100           dy = s2.top - s1.top,
-101           e = 1 - s1.eccentricity,
-102           r = Math.sqrt(dx * dx + dy * dy) / (2 * e);
-103       if ((e <= 0) || (e > 1)) break; // draw a straight line
-104       return "A" + r + "," + r + " 0 0," + l + " " + s2.left + "," + s2.top;
-105     }
-106     case "step-before": return "V" + s2.top + "H" + s2.left;
-107     case "step-after": return "H" + s2.left + "V" + s2.top;
-108   }
-109   return "L" + s2.left + "," + s2.top;
-110 };
-111 
-112 /** @private Line-line intersection, per Akenine-Moller 16.16.1. */
-113 pv.SvgScene.lineIntersect = function(o1, d1, o2, d2) {
-114   return o1.plus(d1.times(o2.minus(o1).dot(d2.perp()) / d1.dot(d2.perp())));
-115 }
-116 
-117 /** @private Returns the miter join path for the specified points. */
-118 pv.SvgScene.pathJoin = function(s0, s1, s2, s3) {
-119   /*
-120    * P1-P2 is the current line segment. V is a vector that is perpendicular to
-121    * the line segment, and has length lineWidth / 2. ABCD forms the initial
-122    * bounding box of the line segment (i.e., the line segment if we were to do
-123    * no joins).
-124    */
-125   var p1 = pv.vector(s1.left, s1.top),
-126       p2 = pv.vector(s2.left, s2.top),
-127       p = p2.minus(p1),
-128       v = p.perp().norm(),
-129       w = v.times(s1.lineWidth / (2 * this.scale)),
-130       a = p1.plus(w),
-131       b = p2.plus(w),
-132       c = p2.minus(w),
-133       d = p1.minus(w);
-134 
-135   /*
-136    * Start join. P0 is the previous line segment's start point. We define the
-137    * cutting plane as the average of the vector perpendicular to P0-P1, and
-138    * the vector perpendicular to P1-P2. This insures that the cross-section of
-139    * the line on the cutting plane is equal if the line-width is unchanged.
-140    * Note that we don't implement miter limits, so these can get wild.
-141    */
-142   if (s0 && s0.visible) {
-143     var v1 = p1.minus(s0.left, s0.top).perp().norm().plus(v);
-144     d = this.lineIntersect(p1, v1, d, p);
-145     a = this.lineIntersect(p1, v1, a, p);
-146   }
-147 
-148   /* Similarly, for end join. */
-149   if (s3 && s3.visible) {
-150     var v2 = pv.vector(s3.left, s3.top).minus(p2).perp().norm().plus(v);
-151     c = this.lineIntersect(p2, v2, c, p);
-152     b = this.lineIntersect(p2, v2, b, p);
-153   }
-154 
-155   return "M" + a.x + "," + a.y
-156        + "L" + b.x + "," + b.y
-157        + " " + c.x + "," + c.y
-158        + " " + d.x + "," + d.y;
-159 };
-160 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgPanel.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgPanel.js.html deleted file mode 100644 index c88fed4c..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgPanel.js.html +++ /dev/null @@ -1,134 +0,0 @@ -
  1 pv.SvgScene.panel = function(scenes) {
-  2   var g = scenes.$g, e = g && g.firstChild;
-  3   for (var i = 0; i < scenes.length; i++) {
-  4     var s = scenes[i];
-  5 
-  6     /* visible */
-  7     if (!s.visible) continue;
-  8 
-  9     /* svg */
- 10     if (!scenes.parent) {
- 11       s.canvas.style.display = "inline-block";
- 12       if (g && (g.parentNode != s.canvas)) {
- 13         g = s.canvas.firstChild;
- 14         e = g && g.firstChild;
- 15       }
- 16       if (!g) {
- 17         g = s.canvas.appendChild(this.create("svg"));
- 18         g.setAttribute("font-size", "10px");
- 19         g.setAttribute("font-family", "sans-serif");
- 20         g.setAttribute("fill", "none");
- 21         g.setAttribute("stroke", "none");
- 22         g.setAttribute("stroke-width", 1.5);
- 23         for (var j = 0; j < this.events.length; j++) {
- 24           g.addEventListener(this.events[j], this.dispatch, false);
- 25         }
- 26         e = g.firstChild;
- 27       }
- 28       scenes.$g = g;
- 29       g.setAttribute("width", s.width + s.left + s.right);
- 30       g.setAttribute("height", s.height + s.top + s.bottom);
- 31     }
- 32 
- 33     /* clip (nest children) */
- 34     if (s.overflow == "hidden") {
- 35       var id = pv.id().toString(36),
- 36           c = this.expect(e, "g", {"clip-path": "url(#" + id + ")"});
- 37       if (!c.parentNode) g.appendChild(c);
- 38       scenes.$g = g = c;
- 39       e = c.firstChild;
- 40 
- 41       e = this.expect(e, "clipPath", {"id": id});
- 42       var r = e.firstChild || e.appendChild(this.create("rect"));
- 43       r.setAttribute("x", s.left);
- 44       r.setAttribute("y", s.top);
- 45       r.setAttribute("width", s.width);
- 46       r.setAttribute("height", s.height);
- 47       if (!e.parentNode) g.appendChild(e);
- 48       e = e.nextSibling;
- 49     }
- 50 
- 51     /* fill */
- 52     e = this.fill(e, scenes, i);
- 53 
- 54     /* transform (push) */
- 55     var k = this.scale,
- 56         t = s.transform,
- 57         x = s.left + t.x,
- 58         y = s.top + t.y;
- 59     this.scale *= t.k;
- 60 
- 61     /* children */
- 62     for (var j = 0; j < s.children.length; j++) {
- 63       s.children[j].$g = e = this.expect(e, "g", {
- 64           "transform": "translate(" + x + "," + y + ")"
- 65               + (t.k != 1 ? " scale(" + t.k + ")" : "")
- 66         });
- 67       this.updateAll(s.children[j]);
- 68       if (!e.parentNode) g.appendChild(e);
- 69       e = e.nextSibling;
- 70     }
- 71 
- 72     /* transform (pop) */
- 73     this.scale = k;
- 74 
- 75     /* stroke */
- 76     e = this.stroke(e, scenes, i);
- 77 
- 78     /* clip (restore group) */
- 79     if (s.overflow == "hidden") {
- 80       scenes.$g = g = c.parentNode;
- 81       e = c.nextSibling;
- 82     }
- 83   }
- 84   return e;
- 85 };
- 86 
- 87 pv.SvgScene.fill = function(e, scenes, i) {
- 88   var s = scenes[i], fill = s.fillStyle;
- 89   if (fill.opacity || s.events == "all") {
- 90     e = this.expect(e, "rect", {
- 91         "shape-rendering": s.antialias ? null : "crispEdges",
- 92         "pointer-events": s.events,
- 93         "cursor": s.cursor,
- 94         "x": s.left,
- 95         "y": s.top,
- 96         "width": s.width,
- 97         "height": s.height,
- 98         "fill": fill.color,
- 99         "fill-opacity": fill.opacity,
-100         "stroke": null
-101       });
-102     e = this.append(e, scenes, i);
-103   }
-104   return e;
-105 };
-106 
-107 pv.SvgScene.stroke = function(e, scenes, i) {
-108   var s = scenes[i], stroke = s.strokeStyle;
-109   if (stroke.opacity || s.events == "all") {
-110     e = this.expect(e, "rect", {
-111         "shape-rendering": s.antialias ? null : "crispEdges",
-112         "pointer-events": s.events == "all" ? "stroke" : s.events,
-113         "cursor": s.cursor,
-114         "x": s.left,
-115         "y": s.top,
-116         "width": Math.max(1E-10, s.width),
-117         "height": Math.max(1E-10, s.height),
-118         "fill": null,
-119         "stroke": stroke.color,
-120         "stroke-opacity": stroke.opacity,
-121         "stroke-width": s.lineWidth / this.scale
-122       });
-123     e = this.append(e, scenes, i);
-124   }
-125   return e;
-126 };
-127 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgRule.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgRule.js.html deleted file mode 100644 index e9d61463..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgRule.js.html +++ /dev/null @@ -1,34 +0,0 @@ -
  1 pv.SvgScene.rule = function(scenes) {
-  2   var e = scenes.$g.firstChild;
-  3   for (var i = 0; i < scenes.length; i++) {
-  4     var s = scenes[i];
-  5 
-  6     /* visible */
-  7     if (!s.visible) continue;
-  8     var stroke = s.strokeStyle;
-  9     if (!stroke.opacity) continue;
- 10 
- 11     e = this.expect(e, "line", {
- 12         "shape-rendering": s.antialias ? null : "crispEdges",
- 13         "pointer-events": s.events,
- 14         "cursor": s.cursor,
- 15         "x1": s.left,
- 16         "y1": s.top,
- 17         "x2": s.left + s.width,
- 18         "y2": s.top + s.height,
- 19         "stroke": stroke.color,
- 20         "stroke-opacity": stroke.opacity,
- 21         "stroke-width": s.lineWidth / this.scale
- 22       });
- 23     e = this.append(e, scenes, i);
- 24   }
- 25   return e;
- 26 };
- 27 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgScene.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgScene.js.html deleted file mode 100644 index 4ff7c73f..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgScene.js.html +++ /dev/null @@ -1,193 +0,0 @@ -
  1 /**
-  2  * @private
-  3  * @namespace
-  4  */
-  5 pv.Scene = pv.SvgScene = {
-  6   /* Various namespaces. */
-  7   svg: "http://www.w3.org/2000/svg",
-  8   xmlns: "http://www.w3.org/2000/xmlns",
-  9   xlink: "http://www.w3.org/1999/xlink",
- 10   xhtml: "http://www.w3.org/1999/xhtml",
- 11 
- 12   /** The pre-multipled scale, based on any enclosing transforms. */
- 13   scale: 1,
- 14 
- 15   /** The set of supported events. */
- 16   events: [
- 17     "DOMMouseScroll", // for Firefox
- 18     "mousewheel",
- 19     "mousedown",
- 20     "mouseup",
- 21     "mouseover",
- 22     "mouseout",
- 23     "mousemove",
- 24     "click",
- 25     "dblclick"
- 26   ],
- 27 
- 28   /** Implicit values for SVG and CSS properties. */
- 29   implicit: {
- 30     svg: {
- 31       "shape-rendering": "auto",
- 32       "pointer-events": "painted",
- 33       "x": 0,
- 34       "y": 0,
- 35       "dy": 0,
- 36       "text-anchor": "start",
- 37       "transform": "translate(0,0)",
- 38       "fill": "none",
- 39       "fill-opacity": 1,
- 40       "stroke": "none",
- 41       "stroke-opacity": 1,
- 42       "stroke-width": 1.5,
- 43       "stroke-linejoin": "miter"
- 44     },
- 45     css: {
- 46       "font": "10px sans-serif"
- 47     }
- 48   }
- 49 };
- 50 
- 51 /**
- 52  * Updates the display for the specified array of scene nodes.
- 53  *
- 54  * @param scenes {array} an array of scene nodes.
- 55  */
- 56 pv.SvgScene.updateAll = function(scenes) {
- 57   if (scenes.length
- 58       && scenes[0].reverse
- 59       && (scenes.type != "line")
- 60       && (scenes.type != "area")) {
- 61     var reversed = pv.extend(scenes);
- 62     for (var i = 0, j = scenes.length - 1; j >= 0; i++, j--) {
- 63       reversed[i] = scenes[j];
- 64     }
- 65     scenes = reversed;
- 66   }
- 67   this.removeSiblings(this[scenes.type](scenes));
- 68 };
- 69 
- 70 /**
- 71  * Creates a new SVG element of the specified type.
- 72  *
- 73  * @param type {string} an SVG element type, such as "rect".
- 74  * @returns a new SVG element.
- 75  */
- 76 pv.SvgScene.create = function(type) {
- 77   return document.createElementNS(this.svg, type);
- 78 };
- 79 
- 80 /**
- 81  * Expects the element <i>e</i> to be the specified type. If the element does
- 82  * not exist, a new one is created. If the element does exist but is the wrong
- 83  * type, it is replaced with the specified element.
- 84  *
- 85  * @param e the current SVG element.
- 86  * @param type {string} an SVG element type, such as "rect".
- 87  * @param attributes an optional attribute map.
- 88  * @param style an optional style map.
- 89  * @returns a new SVG element.
- 90  */
- 91 pv.SvgScene.expect = function(e, type, attributes, style) {
- 92   if (e) {
- 93     if (e.tagName == "a") e = e.firstChild;
- 94     if (e.tagName != type) {
- 95       var n = this.create(type);
- 96       e.parentNode.replaceChild(n, e);
- 97       e = n;
- 98     }
- 99   } else {
-100     e = this.create(type);
-101   }
-102   for (var name in attributes) {
-103     var value = attributes[name];
-104     if (value == this.implicit.svg[name]) value = null;
-105     if (value == null) e.removeAttribute(name);
-106     else e.setAttribute(name, value);
-107   }
-108   for (var name in style) {
-109     var value = style[name];
-110     if (value == this.implicit.css[name]) value = null;
-111     if (value == null) e.style.removeProperty(name);
-112     else e.style[name] = value;
-113   }
-114   return e;
-115 };
-116 
-117 /** TODO */
-118 pv.SvgScene.append = function(e, scenes, index) {
-119   e.$scene = {scenes:scenes, index:index};
-120   e = this.title(e, scenes[index]);
-121   if (!e.parentNode) scenes.$g.appendChild(e);
-122   return e.nextSibling;
-123 };
-124 
-125 /**
-126  * Applies a title tooltip to the specified element <tt>e</tt>, using the
-127  * <tt>title</tt> property of the specified scene node <tt>s</tt>. Note that
-128  * this implementation does not create an SVG <tt>title</tt> element as a child
-129  * of <tt>e</tt>; although this is the recommended standard, it is only
-130  * supported in Opera. Instead, an anchor element is created around the element
-131  * <tt>e</tt>, and the <tt>xlink:title</tt> attribute is set accordingly.
-132  *
-133  * @param e an SVG element.
-134  * @param s a scene node.
-135  */
-136 pv.SvgScene.title = function(e, s) {
-137   var a = e.parentNode;
-138   if (a && (a.tagName != "a")) a = null;
-139   if (s.title) {
-140     if (!a) {
-141       a = this.create("a");
-142       if (e.parentNode) e.parentNode.replaceChild(a, e);
-143       a.appendChild(e);
-144     }
-145     a.setAttributeNS(this.xlink, "title", s.title);
-146     return a;
-147   }
-148   if (a) a.parentNode.replaceChild(e, a);
-149   return e;
-150 };
-151 
-152 /** TODO */
-153 pv.SvgScene.dispatch = pv.listener(function(e) {
-154   var t = e.target.$scene;
-155   if (t) {
-156     var type = e.type;
-157 
-158     /* Fixes for mousewheel support on Firefox & Opera. */
-159     switch (type) {
-160       case "DOMMouseScroll": {
-161         type = "mousewheel";
-162         e.wheel = -480 * e.detail;
-163         break;
-164       }
-165       case "mousewheel": {
-166         e.wheel = (window.opera ? 12 : 1) * e.wheelDelta;
-167         break;
-168       }
-169     }
-170 
-171     if (pv.Mark.dispatch(type, t.scenes, t.index)) e.preventDefault();
-172   }
-173 });
-174 
-175 /** @private Remove siblings following element <i>e</i>. */
-176 pv.SvgScene.removeSiblings = function(e) {
-177   while (e) {
-178     var n = e.nextSibling;
-179     e.parentNode.removeChild(e);
-180     e = n;
-181   }
-182 };
-183 
-184 /** @private Do nothing when rendering undefined mark types. */
-185 pv.SvgScene.undefined = function() {};
-186 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgWedge.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgWedge.js.html deleted file mode 100644 index 6cbfd124..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_scene_SvgWedge.js.html +++ /dev/null @@ -1,74 +0,0 @@ -
  1 pv.SvgScene.wedge = function(scenes) {
-  2   var e = scenes.$g.firstChild;
-  3   for (var i = 0; i < scenes.length; i++) {
-  4     var s = scenes[i];
-  5 
-  6     /* visible */
-  7     if (!s.visible) continue;
-  8     var fill = s.fillStyle, stroke = s.strokeStyle;
-  9     if (!fill.opacity && !stroke.opacity) continue;
- 10 
- 11     /* points */
- 12     var r1 = s.innerRadius, r2 = s.outerRadius, a = Math.abs(s.angle), p;
- 13     if (a >= 2 * Math.PI) {
- 14       if (r1) {
- 15         p = "M0," + r2
- 16             + "A" + r2 + "," + r2 + " 0 1,1 0," + (-r2)
- 17             + "A" + r2 + "," + r2 + " 0 1,1 0," + r2
- 18             + "M0," + r1
- 19             + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1)
- 20             + "A" + r1 + "," + r1 + " 0 1,1 0," + r1
- 21             + "Z";
- 22       } else {
- 23         p = "M0," + r2
- 24             + "A" + r2 + "," + r2 + " 0 1,1 0," + (-r2)
- 25             + "A" + r2 + "," + r2 + " 0 1,1 0," + r2
- 26             + "Z";
- 27       }
- 28     } else {
- 29       var sa = Math.min(s.startAngle, s.endAngle),
- 30           ea = Math.max(s.startAngle, s.endAngle),
- 31           c1 = Math.cos(sa), c2 = Math.cos(ea),
- 32           s1 = Math.sin(sa), s2 = Math.sin(ea);
- 33       if (r1) {
- 34         p = "M" + r2 * c1 + "," + r2 * s1
- 35             + "A" + r2 + "," + r2 + " 0 "
- 36             + ((a < Math.PI) ? "0" : "1") + ",1 "
- 37             + r2 * c2 + "," + r2 * s2
- 38             + "L" + r1 * c2 + "," + r1 * s2
- 39             + "A" + r1 + "," + r1 + " 0 "
- 40             + ((a < Math.PI) ? "0" : "1") + ",0 "
- 41             + r1 * c1 + "," + r1 * s1 + "Z";
- 42       } else {
- 43         p = "M" + r2 * c1 + "," + r2 * s1
- 44             + "A" + r2 + "," + r2 + " 0 "
- 45             + ((a < Math.PI) ? "0" : "1") + ",1 "
- 46             + r2 * c2 + "," + r2 * s2 + "L0,0Z";
- 47       }
- 48     }
- 49 
- 50     e = this.expect(e, "path", {
- 51         "shape-rendering": s.antialias ? null : "crispEdges",
- 52         "pointer-events": s.events,
- 53         "cursor": s.cursor,
- 54         "transform": "translate(" + s.left + "," + s.top + ")",
- 55         "d": p,
- 56         "fill": fill.color,
- 57         "fill-rule": "evenodd",
- 58         "fill-opacity": fill.opacity || null,
- 59         "stroke": stroke.color,
- 60         "stroke-opacity": stroke.opacity || null,
- 61         "stroke-width": stroke.opacity ? s.lineWidth / this.scale : null
- 62       });
- 63     e = this.append(e, scenes, i);
- 64   }
- 65   return e;
- 66 };
- 67 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_text_DateFormat.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_text_DateFormat.js.html deleted file mode 100644 index c264921a..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_text_DateFormat.js.html +++ /dev/null @@ -1,270 +0,0 @@ -
  1 /**
-  2  * Constructs a new date format with the specified string pattern.
-  3  *
-  4  * @class The format string is in the same format expected by the
-  5  * <tt>strftime</tt> function in C. The following conversion specifications are
-  6  * supported:<ul>
-  7  *
-  8  * <li>%a - abbreviated weekday name.</li>
-  9  * <li>%A - full weekday name.</li>
- 10  * <li>%b - abbreviated month names.</li>
- 11  * <li>%B - full month names.</li>
- 12  * <li>%c - locale's appropriate date and time.</li>
- 13  * <li>%C - century number.</li>
- 14  * <li>%d - day of month [01,31] (zero padded).</li>
- 15  * <li>%D - same as %m/%d/%y.</li>
- 16  * <li>%e - day of month [ 1,31] (space padded).</li>
- 17  * <li>%h - same as %b.</li>
- 18  * <li>%H - hour (24-hour clock) [00,23] (zero padded).</li>
- 19  * <li>%I - hour (12-hour clock) [01,12] (zero padded).</li>
- 20  * <li>%m - month number [01,12] (zero padded).</li>
- 21  * <li>%M - minute [0,59] (zero padded).</li>
- 22  * <li>%n - newline character.</li>
- 23  * <li>%p - locale's equivalent of a.m. or p.m.</li>
- 24  * <li>%r - same as %I:%M:%S %p.</li>
- 25  * <li>%R - same as %H:%M.</li>
- 26  * <li>%S - second [00,61] (zero padded).</li>
- 27  * <li>%t - tab character.</li>
- 28  * <li>%T - same as %H:%M:%S.</li>
- 29  * <li>%x - same as %m/%d/%y.</li>
- 30  * <li>%X - same as %I:%M:%S %p.</li>
- 31  * <li>%y - year with century [00,99] (zero padded).</li>
- 32  * <li>%Y - year including century.</li>
- 33  * <li>%% - %.</li>
- 34  *
- 35  * </ul>The following conversion specifications are currently <i>unsupported</i>
- 36  * for formatting:<ul>
- 37  *
- 38  * <li>%j - day number [1,366].</li>
- 39  * <li>%u - weekday number [1,7].</li>
- 40  * <li>%U - week number [00,53].</li>
- 41  * <li>%V - week number [01,53].</li>
- 42  * <li>%w - weekday number [0,6].</li>
- 43  * <li>%W - week number [00,53].</li>
- 44  * <li>%Z - timezone name or abbreviation.</li>
- 45  *
- 46  * </ul>In addition, the following conversion specifications are currently
- 47  * <i>unsupported</i> for parsing:<ul>
- 48  *
- 49  * <li>%a - day of week, either abbreviated or full name.</li>
- 50  * <li>%A - same as %a.</li>
- 51  * <li>%c - locale's appropriate date and time.</li>
- 52  * <li>%C - century number.</li>
- 53  * <li>%D - same as %m/%d/%y.</li>
- 54  * <li>%I - hour (12-hour clock) [1,12].</li>
- 55  * <li>%n - any white space.</li>
- 56  * <li>%p - locale's equivalent of a.m. or p.m.</li>
- 57  * <li>%r - same as %I:%M:%S %p.</li>
- 58  * <li>%R - same as %H:%M.</li>
- 59  * <li>%t - same as %n.</li>
- 60  * <li>%T - same as %H:%M:%S.</li>
- 61  * <li>%x - locale's equivalent to %m/%d/%y.</li>
- 62  * <li>%X - locale's equivalent to %I:%M:%S %p.</li>
- 63  *
- 64  * </ul>
- 65  *
- 66  * @see <a
- 67  * href="http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html">strftime</a>
- 68  * documentation.
- 69  * @see <a
- 70  * href="http://www.opengroup.org/onlinepubs/007908799/xsh/strptime.html">strptime</a>
- 71  * documentation.
- 72  * @extends pv.Format
- 73  * @param {string} pattern the format pattern.
- 74  */
- 75 pv.Format.date = function(pattern) {
- 76   var pad = pv.Format.pad;
- 77 
- 78   /** @private */
- 79   function format(d) {
- 80     return pattern.replace(/%[a-zA-Z0-9]/g, function(s) {
- 81         switch (s) {
- 82           case '%a': return [
- 83               "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
- 84             ][d.getDay()];
- 85           case '%A': return [
- 86               "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
- 87               "Saturday"
- 88             ][d.getDay()];
- 89           case '%h':
- 90           case '%b': return [
- 91               "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
- 92               "Oct", "Nov", "Dec"
- 93             ][d.getMonth()];
- 94           case '%B': return [
- 95               "January", "February", "March", "April", "May", "June", "July",
- 96               "August", "September", "October", "November", "December"
- 97             ][d.getMonth()];
- 98           case '%c': return d.toLocaleString();
- 99           case '%C': return pad("0", 2, Math.floor(d.getFullYear() / 100) % 100);
-100           case '%d': return pad("0", 2, d.getDate());
-101           case '%x':
-102           case '%D': return pad("0", 2, d.getMonth() + 1)
-103                     + "/" + pad("0", 2, d.getDate())
-104                     + "/" + pad("0", 2, d.getFullYear() % 100);
-105           case '%e': return pad(" ", 2, d.getDate());
-106           case '%H': return pad("0", 2, d.getHours());
-107           case '%I': {
-108             var h = d.getHours() % 12;
-109             return h ? pad("0", 2, h) : 12;
-110           }
-111           // TODO %j: day of year as a decimal number [001,366]
-112           case '%m': return pad("0", 2, d.getMonth() + 1);
-113           case '%M': return pad("0", 2, d.getMinutes());
-114           case '%n': return "\n";
-115           case '%p': return d.getHours() < 12 ? "AM" : "PM";
-116           case '%T':
-117           case '%X':
-118           case '%r': {
-119             var h = d.getHours() % 12;
-120             return (h ? pad("0", 2, h) : 12)
-121                     + ":" + pad("0", 2, d.getMinutes())
-122                     + ":" + pad("0", 2, d.getSeconds())
-123                     + " " + (d.getHours() < 12 ? "AM" : "PM");
-124           }
-125           case '%R': return pad("0", 2, d.getHours()) + ":" + pad("0", 2, d.getMinutes());
-126           case '%S': return pad("0", 2, d.getSeconds());
-127           case '%Q': return pad("0", 3, d.getMilliseconds());
-128           case '%t': return "\t";
-129           case '%u': {
-130             var w = d.getDay();
-131             return w ? w : 1;
-132           }
-133           // TODO %U: week number (sunday first day) [00,53]
-134           // TODO %V: week number (monday first day) [01,53] ... with weirdness
-135           case '%w': return d.getDay();
-136           // TODO %W: week number (monday first day) [00,53] ... with weirdness
-137           case '%y': return pad("0", 2, d.getFullYear() % 100);
-138           case '%Y': return d.getFullYear();
-139           // TODO %Z: timezone name or abbreviation
-140           case '%%': return "%";
-141         }
-142         return s;
-143       });
-144   }
-145 
-146   /**
-147    * Converts a date to a string using the associated formatting pattern.
-148    *
-149    * @function
-150    * @name pv.Format.date.prototype.format
-151    * @param {Date} date a date to format.
-152    * @returns {string} the formatted date as a string.
-153    */
-154   format.format = format;
-155 
-156   /**
-157    * Parses a date from a string using the associated formatting pattern.
-158    *
-159    * @function
-160    * @name pv.Format.date.prototype.parse
-161    * @param {string} s the string to parse as a date.
-162    * @returns {Date} the parsed date.
-163    */
-164   format.parse = function(s) {
-165     var year = 1970, month = 0, date = 1, hour = 0, minute = 0, second = 0;
-166     var fields = [function() {}];
-167 
-168     /* Register callbacks for each field in the format pattern. */
-169     var re = pv.Format.re(pattern).replace(/%[a-zA-Z0-9]/g, function(s) {
-170         switch (s) {
-171           // TODO %a: day of week, either abbreviated or full name
-172           // TODO %A: same as %a
-173           case '%b': {
-174             fields.push(function(x) { month = {
-175                   Jan: 0, Feb: 1, Mar: 2, Apr: 3, May: 4, Jun: 5, Jul: 6, Aug: 7,
-176                   Sep: 8, Oct: 9, Nov: 10, Dec: 11
-177                 }[x]; });
-178             return "([A-Za-z]+)";
-179           }
-180           case '%h':
-181           case '%B': {
-182             fields.push(function(x) { month = {
-183                   January: 0, February: 1, March: 2, April: 3, May: 4, June: 5,
-184                   July: 6, August: 7, September: 8, October: 9, November: 10,
-185                   December: 11
-186                 }[x]; });
-187             return "([A-Za-z]+)";
-188           }
-189           // TODO %c: locale's appropriate date and time
-190           // TODO %C: century number[0,99]
-191           case '%e':
-192           case '%d': {
-193             fields.push(function(x) { date = x; });
-194             return "([0-9]+)";
-195           }
-196           // TODO %D: same as %m/%d/%y
-197           case '%I':
-198           case '%H': {
-199             fields.push(function(x) { hour = x; });
-200             return "([0-9]+)";
-201           }
-202           // TODO %j: day number [1,366]
-203           case '%m': {
-204             fields.push(function(x) { month = x - 1; });
-205             return "([0-9]+)";
-206           }
-207           case '%M': {
-208             fields.push(function(x) { minute = x; });
-209             return "([0-9]+)";
-210           }
-211           // TODO %n: any white space
-212           // TODO %p: locale's equivalent of a.m. or p.m.
-213           case '%p': { // TODO this is a hack
-214             fields.push(function(x) {
-215               if (hour == 12) {
-216                 if (x == "am") hour = 0;
-217               } else if (x == "pm") {
-218                 hour = Number(hour) + 12;
-219               }
-220             });
-221             return "(am|pm)";
-222           }
-223           // TODO %r: %I:%M:%S %p
-224           // TODO %R: %H:%M
-225           case '%S': {
-226             fields.push(function(x) { second = x; });
-227             return "([0-9]+)";
-228           }
-229           // TODO %t: any white space
-230           // TODO %T: %H:%M:%S
-231           // TODO %U: week number [00,53]
-232           // TODO %w: weekday [0,6]
-233           // TODO %W: week number [00, 53]
-234           // TODO %x: locale date (%m/%d/%y)
-235           // TODO %X: locale time (%I:%M:%S %p)
-236           case '%y': {
-237             fields.push(function(x) {
-238                 x = Number(x);
-239                 year = x + (((0 <= x) && (x < 69)) ? 2000
-240                     : (((x >= 69) && (x < 100) ? 1900 : 0)));
-241               });
-242             return "([0-9]+)";
-243           }
-244           case '%Y': {
-245             fields.push(function(x) { year = x; });
-246             return "([0-9]+)";
-247           }
-248           case '%%': {
-249             fields.push(function() {});
-250             return "%";
-251           }
-252         }
-253         return s;
-254       });
-255 
-256     var match = s.match(re);
-257     if (match) match.forEach(function(m, i) { fields[i](m); });
-258     return new Date(year, month, date, hour, minute, second);
-259   };
-260 
-261   return format;
-262 };
-263 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_text_Format.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_text_Format.js.html deleted file mode 100644 index 11af959e..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_text_Format.js.html +++ /dev/null @@ -1,86 +0,0 @@ -
  1 /**
-  2  * Abstract; see an implementing class.
-  3  *
-  4  * @class Represents an abstract text formatter and parser. A <i>format</i> is a
-  5  * function that converts an object of a given type, such as a <tt>Date</tt>, to
-  6  * a human-readable string representation. The format may also have a
-  7  * {@link #parse} method for converting a string representation back to the
-  8  * given object type.
-  9  *
- 10  * <p>Because formats are themselves functions, they can be used directly as
- 11  * mark properties. For example, if the data associated with a label are dates,
- 12  * a date format can be used as label text:
- 13  *
- 14  * <pre>    .text(pv.Format.date("%m/%d/%y"))</pre>
- 15  *
- 16  * And as with scales, if the format is used in multiple places, it can be
- 17  * convenient to declare it as a global variable and then reference it from the
- 18  * appropriate property functions. For example, if the data has a <tt>date</tt>
- 19  * attribute, and <tt>format</tt> references a given date format:
- 20  *
- 21  * <pre>    .text(function(d) format(d.date))</pre>
- 22  *
- 23  * Similarly, to parse a string into a date:
- 24  *
- 25  * <pre>var date = format.parse("4/30/2010");</pre>
- 26  *
- 27  * Not all format implementations support parsing. See the implementing class
- 28  * for details.
- 29  *
- 30  * @see pv.Format.date
- 31  * @see pv.Format.number
- 32  * @see pv.Format.time
- 33  */
- 34 pv.Format = {};
- 35 
- 36 /**
- 37  * Formats the specified object, returning the string representation.
- 38  *
- 39  * @function
- 40  * @name pv.Format.prototype.format
- 41  * @param {object} x the object to format.
- 42  * @returns {string} the formatted string.
- 43  */
- 44 
- 45 /**
- 46  * Parses the specified string, returning the object representation.
- 47  *
- 48  * @function
- 49  * @name pv.Format.prototype.parse
- 50  * @param {string} x the string to parse.
- 51  * @returns {object} the parsed object.
- 52  */
- 53 
- 54 /**
- 55  * @private Given a string that may be used as part of a regular expression,
- 56  * this methods returns an appropriately quoted version of the specified string,
- 57  * with any special characters escaped.
- 58  *
- 59  * @param {string} s a string to quote.
- 60  * @returns {string} the quoted string.
- 61  */
- 62 pv.Format.re = function(s) {
- 63   return s.replace(/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g, "\\$&");
- 64 };
- 65 
- 66 /**
- 67  * @private Optionally pads the specified string <i>s</i> so that it is at least
- 68  * <i>n</i> characters long, using the padding character <i>c</i>.
- 69  *
- 70  * @param {string} c the padding character.
- 71  * @param {number} n the minimum string length.
- 72  * @param {string} s the string to pad.
- 73  * @returns {string} the padded string.
- 74  */
- 75 pv.Format.pad = function(c, n, s) {
- 76   var m = n - String(s).length;
- 77   return (m < 1) ? s : new Array(m + 1).join(c) + s;
- 78 };
- 79 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_text_NumberFormat.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_text_NumberFormat.js.html deleted file mode 100644 index d6bd59eb..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_text_NumberFormat.js.html +++ /dev/null @@ -1,216 +0,0 @@ -
  1 /**
-  2  * Returns a default number format.
-  3  *
-  4  * @class Represents a number format, converting between a <tt>number</tt> and a
-  5  * <tt>string</tt>. This class allows numbers to be formatted with variable
-  6  * precision (both for the integral and fractional part of the number), optional
-  7  * thousands grouping, and optional padding. The thousands (",") and decimal
-  8  * (".") separator can be customized.
-  9  *
- 10  * @returns {pv.Format.number} a number format.
- 11  */
- 12 pv.Format.number = function() {
- 13   var mini = 0, // default minimum integer digits
- 14       maxi = Infinity, // default maximum integer digits
- 15       mins = 0, // mini, including group separators
- 16       minf = 0, // default minimum fraction digits
- 17       maxf = 0, // default maximum fraction digits
- 18       maxk = 1, // 10^maxf
- 19       padi = "0", // default integer pad
- 20       padf = "0", // default fraction pad
- 21       padg = true, // whether group separator affects integer padding
- 22       decimal = ".", // default decimal separator
- 23       group = ","; // default group separator
- 24 
- 25   /** @private */
- 26   function format(x) {
- 27     /* Round the fractional part, and split on decimal separator. */
- 28     if (Infinity > maxf) x = Math.round(x * maxk) / maxk;
- 29     var s = String(Math.abs(x)).split(".");
- 30 
- 31     /* Pad, truncate and group the integral part. */
- 32     var i = s[0], n = (x < 0) ? "-" : "";
- 33     if (i.length > maxi) i = i.substring(i.length - maxi);
- 34     if (padg && (i.length < mini)) i = n + new Array(mini - i.length + 1).join(padi) + i;
- 35     if (i.length > 3) i = i.replace(/\B(?=(?:\d{3})+(?!\d))/g, group);
- 36     if (!padg && (i.length < mins)) i = new Array(mins - i.length + 1).join(padi) + n + i;
- 37     s[0] = i;
- 38 
- 39     /* Pad the fractional part. */
- 40     var f = s[1] || "";
- 41     if (f.length < minf) s[1] = f + new Array(minf - f.length + 1).join(padf);
- 42 
- 43     return s.join(decimal);
- 44   }
- 45 
- 46   /**
- 47    * @function
- 48    * @name pv.Format.number.prototype.format
- 49    * @param {number} x
- 50    * @returns {string}
- 51    */
- 52   format.format = format;
- 53 
- 54   /**
- 55    * Parses the specified string as a number. Before parsing, leading and
- 56    * trailing padding is removed. Group separators are also removed, and the
- 57    * decimal separator is replaced with the standard point ("."). The integer
- 58    * part is truncated per the maximum integer digits, and the fraction part is
- 59    * rounded per the maximum fraction digits.
- 60    *
- 61    * @function
- 62    * @name pv.Format.number.prototype.parse
- 63    * @param {string} x the string to parse.
- 64    * @returns {number} the parsed number.
- 65    */
- 66   format.parse = function(x) {
- 67     var re = pv.Format.re;
- 68 
- 69     /* Remove leading and trailing padding. Split on the decimal separator. */
- 70     var s = String(x)
- 71         .replace(new RegExp("^(" + re(padi) + ")*"), "")
- 72         .replace(new RegExp("(" + re(padf) + ")*$"), "")
- 73         .split(decimal);
- 74 
- 75     /* Remove grouping and truncate the integral part. */
- 76     var i = s[0].replace(new RegExp(re(group), "g"), "");
- 77     if (i.length > maxi) i = i.substring(i.length - maxi);
- 78 
- 79     /* Round the fractional part. */
- 80     var f = s[1] ? Number("0." + s[1]) : 0;
- 81     if (Infinity > maxf) f = Math.round(f * maxk) / maxk;
- 82 
- 83     return Math.round(i) + f;
- 84   };
- 85 
- 86   /**
- 87    * Sets or gets the minimum and maximum number of integer digits. This
- 88    * controls the number of decimal digits to display before the decimal
- 89    * separator for the integral part of the number. If the number of digits is
- 90    * smaller than the minimum, the digits are padded; if the number of digits is
- 91    * larger, the digits are truncated, showing only the lower-order digits. The
- 92    * default range is [0, Infinity].
- 93    *
- 94    * <p>If only one argument is specified to this method, this value is used as
- 95    * both the minimum and maximum number. If no arguments are specified, a
- 96    * two-element array is returned containing the minimum and the maximum.
- 97    *
- 98    * @function
- 99    * @name pv.Format.number.prototype.integerDigits
-100    * @param {number} [min] the minimum integer digits.
-101    * @param {number} [max] the maximum integer digits.
-102    * @returns {pv.Format.number} <tt>this</tt>, or the current integer digits.
-103    */
-104   format.integerDigits = function(min, max) {
-105     if (arguments.length) {
-106       mini = Number(min);
-107       maxi = (arguments.length > 1) ? Number(max) : mini;
-108       mins = mini + Math.floor(mini / 3) * group.length;
-109       return this;
-110     }
-111     return [mini, maxi];
-112   };
-113 
-114   /**
-115    * Sets or gets the minimum and maximum number of fraction digits. The
-116    * controls the number of decimal digits to display after the decimal
-117    * separator for the fractional part of the number. If the number of digits is
-118    * smaller than the minimum, the digits are padded; if the number of digits is
-119    * larger, the fractional part is rounded, showing only the higher-order
-120    * digits. The default range is [0, 0].
-121    *
-122    * <p>If only one argument is specified to this method, this value is used as
-123    * both the minimum and maximum number. If no arguments are specified, a
-124    * two-element array is returned containing the minimum and the maximum.
-125    *
-126    * @function
-127    * @name pv.Format.number.prototype.fractionDigits
-128    * @param {number} [min] the minimum fraction digits.
-129    * @param {number} [max] the maximum fraction digits.
-130    * @returns {pv.Format.number} <tt>this</tt>, or the current fraction digits.
-131    */
-132   format.fractionDigits = function(min, max) {
-133     if (arguments.length) {
-134       minf = Number(min);
-135       maxf = (arguments.length > 1) ? Number(max) : minf;
-136       maxk = Math.pow(10, maxf);
-137       return this;
-138     }
-139     return [minf, maxf];
-140   };
-141 
-142   /**
-143    * Sets or gets the character used to pad the integer part. The integer pad is
-144    * used when the number of integer digits is smaller than the minimum. The
-145    * default pad character is "0" (zero).
-146    *
-147    * @param {string} [x] the new pad character.
-148    * @returns {pv.Format.number} <tt>this</tt> or the current pad character.
-149    */
-150   format.integerPad = function(x) {
-151     if (arguments.length) {
-152       padi = String(x);
-153       padg = /\d/.test(padi);
-154       return this;
-155     }
-156     return padi;
-157   };
-158 
-159   /**
-160    * Sets or gets the character used to pad the fration part. The fraction pad
-161    * is used when the number of fraction digits is smaller than the minimum. The
-162    * default pad character is "0" (zero).
-163    *
-164    * @param {string} [x] the new pad character.
-165    * @returns {pv.Format.number} <tt>this</tt> or the current pad character.
-166    */
-167   format.fractionPad = function(x) {
-168     if (arguments.length) {
-169       padf = String(x);
-170       return this;
-171     }
-172     return padf;
-173   };
-174 
-175   /**
-176    * Sets or gets the character used as the decimal point, separating the
-177    * integer and fraction parts of the number. The default decimal point is ".".
-178    *
-179    * @param {string} [x] the new decimal separator.
-180    * @returns {pv.Format.number} <tt>this</tt> or the current decimal separator.
-181    */
-182   format.decimal = function(x) {
-183     if (arguments.length) {
-184       decimal = String(x);
-185       return this;
-186     }
-187     return decimal;
-188   };
-189 
-190   /**
-191    * Sets or gets the character used as the group separator, grouping integer
-192    * digits by thousands. The default decimal point is ",". Grouping can be
-193    * disabled by using "" for the separator.
-194    *
-195    * @param {string} [x] the new group separator.
-196    * @returns {pv.Format.number} <tt>this</tt> or the current group separator.
-197    */
-198   format.group = function(x) {
-199     if (arguments.length) {
-200       group = x ? String(x) : "";
-201       mins = mini + Math.floor(mini / 3) * group.length;
-202       return this;
-203     }
-204     return group;
-205   };
-206 
-207   return format;
-208 };
-209 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_text_TimeFormat.js.html b/docs/lib/protovis-3.2/jsdoc/symbols/src/src_text_TimeFormat.js.html deleted file mode 100644 index 2317835f..00000000 --- a/docs/lib/protovis-3.2/jsdoc/symbols/src/src_text_TimeFormat.js.html +++ /dev/null @@ -1,123 +0,0 @@ -
  1 /**
-  2  * Returns a time format of the given type, either "short" or "long".
-  3  *
-  4  * @class Represents a time format, converting between a <tt>number</tt>
-  5  * representing a duration in milliseconds, and a <tt>string</tt>. Two types of
-  6  * time formats are supported: "short" and "long". The <i>short</i> format type
-  7  * returns a string such as "3.3 days" or "12.1 minutes", while the <i>long</i>
-  8  * format returns "13:04:12" or similar.
-  9  *
- 10  * @extends pv.Format
- 11  * @param {string} type the type; "short" or "long".
- 12  */
- 13 pv.Format.time = function(type) {
- 14   var pad = pv.Format.pad;
- 15 
- 16   /*
- 17    * MILLISECONDS = 1
- 18    * SECONDS = 1e3
- 19    * MINUTES = 6e4
- 20    * HOURS = 36e5
- 21    * DAYS = 864e5
- 22    * WEEKS = 6048e5
- 23    * MONTHS = 2592e6
- 24    * YEARS = 31536e6
- 25    */
- 26 
- 27   /** @private */
- 28   function format(t) {
- 29     t = Number(t); // force conversion from Date
- 30     switch (type) {
- 31       case "short": {
- 32         if (t >= 31536e6) {
- 33           return (t / 31536e6).toFixed(1) + " years";
- 34         } else if (t >= 6048e5) {
- 35           return (t / 6048e5).toFixed(1) + " weeks";
- 36         } else if (t >= 864e5) {
- 37           return (t / 864e5).toFixed(1) + " days";
- 38         } else if (t >= 36e5) {
- 39           return (t / 36e5).toFixed(1) + " hours";
- 40         } else if (t >= 6e4) {
- 41           return (t / 6e4).toFixed(1) + " minutes";
- 42         }
- 43         return (t / 1e3).toFixed(1) + " seconds";
- 44       }
- 45       case "long": {
- 46         var a = [],
- 47             s = ((t % 6e4) / 1e3) >> 0,
- 48             m = ((t % 36e5) / 6e4) >> 0;
- 49         a.push(pad("0", 2, s));
- 50         if (t >= 36e5) {
- 51           var h = ((t % 864e5) / 36e5) >> 0;
- 52           a.push(pad("0", 2, m));
- 53           if (t >= 864e5) {
- 54             a.push(pad("0", 2, h));
- 55             a.push(Math.floor(t / 864e5).toFixed());
- 56           } else {
- 57             a.push(h.toFixed());
- 58           }
- 59         } else {
- 60           a.push(m.toFixed());
- 61         }
- 62         return a.reverse().join(":");
- 63       }
- 64     }
- 65   }
- 66 
- 67   /**
- 68    * Formats the specified time, returning the string representation.
- 69    *
- 70    * @function
- 71    * @name pv.Format.time.prototype.format
- 72    * @param {number} t the duration in milliseconds. May also be a <tt>Date</tt>.
- 73    * @returns {string} the formatted string.
- 74    */
- 75   format.format = format;
- 76 
- 77   /**
- 78    * Parses the specified string, returning the time in milliseconds.
- 79    *
- 80    * @function
- 81    * @name pv.Format.time.prototype.parse
- 82    * @param {string} s a formatted string.
- 83    * @returns {number} the parsed duration in milliseconds.
- 84    */
- 85   format.parse = function(s) {
- 86     switch (type) {
- 87       case "short": {
- 88         var re = /([0-9,.]+)\s*([a-z]+)/g, a, t = 0;
- 89         while (a = re.exec(s)) {
- 90           var f = parseFloat(a[0].replace(",", "")), u = 0;
- 91           switch (a[2].toLowerCase()) {
- 92             case "year": case "years": u = 31536e6; break;
- 93             case "week": case "weeks": u = 6048e5; break;
- 94             case "day": case "days": u = 864e5; break;
- 95             case "hour": case "hours": u = 36e5; break;
- 96             case "minute": case "minutes": u = 6e4; break;
- 97             case "second": case "seconds": u = 1e3; break;
- 98           }
- 99           t += f * u;
-100         }
-101         return t;
-102       }
-103       case "long": {
-104         var a = s.replace(",", "").split(":").reverse(), t = 0;
-105         if (a.length) t += parseFloat(a[0]) * 1e3;
-106         if (a.length > 1) t += parseFloat(a[1]) * 6e4;
-107         if (a.length > 2) t += parseFloat(a[2]) * 36e5;
-108         if (a.length > 3) t += parseFloat(a[3]) * 864e5;
-109         return t;
-110       }
-111     }
-112   }
-113 
-114   return format;
-115 };
-116 
\ No newline at end of file diff --git a/docs/lib/protovis-3.2/protovis-d3.2.js b/docs/lib/protovis-3.2/protovis-d3.2.js deleted file mode 100644 index 255e21d3..00000000 --- a/docs/lib/protovis-3.2/protovis-d3.2.js +++ /dev/null @@ -1,15326 +0,0 @@ -// fba9dc272a443cf9fdb984676a7732a6a082f4c0 -/** - * @class The built-in Array class. - * @name Array - */ - -/** - * Creates a new array with the results of calling a provided function on every - * element in this array. Implemented in Javascript 1.6. - * - * @function - * @name Array.prototype.map - * @see map - * documentation. - * @param {function} f function that produces an element of the new Array from - * an element of the current one. - * @param [o] object to use as this when executing f. - */ -if (!Array.prototype.map) Array.prototype.map = function(f, o) { - var n = this.length; - var result = new Array(n); - for (var i = 0; i < n; i++) { - if (i in this) { - result[i] = f.call(o, this[i], i, this); - } - } - return result; -}; - -/** - * Creates a new array with all elements that pass the test implemented by the - * provided function. Implemented in Javascript 1.6. - * - * @function - * @name Array.prototype.filter - * @see filter - * documentation. - * @param {function} f function to test each element of the array. - * @param [o] object to use as this when executing f. - */ -if (!Array.prototype.filter) Array.prototype.filter = function(f, o) { - var n = this.length; - var result = new Array(); - for (var i = 0; i < n; i++) { - if (i in this) { - var v = this[i]; - if (f.call(o, v, i, this)) result.push(v); - } - } - return result; -}; - -/** - * Executes a provided function once per array element. Implemented in - * Javascript 1.6. - * - * @function - * @name Array.prototype.forEach - * @see forEach - * documentation. - * @param {function} f function to execute for each element. - * @param [o] object to use as this when executing f. - */ -if (!Array.prototype.forEach) Array.prototype.forEach = function(f, o) { - var n = this.length >>> 0; - for (var i = 0; i < n; i++) { - if (i in this) f.call(o, this[i], i, this); - } -}; - -/** - * Apply a function against an accumulator and each value of the array (from - * left-to-right) as to reduce it to a single value. Implemented in Javascript - * 1.8. - * - * @function - * @name Array.prototype.reduce - * @see reduce - * documentation. - * @param {function} f function to execute on each value in the array. - * @param [v] object to use as the first argument to the first call of - * t. - */ -if (!Array.prototype.reduce) Array.prototype.reduce = function(f, v) { - var len = this.length; - if (!len && (arguments.length == 1)) { - throw new Error("reduce: empty array, no initial value"); - } - - var i = 0; - if (arguments.length < 2) { - while (true) { - if (i in this) { - v = this[i++]; - break; - } - if (++i >= len) { - throw new Error("reduce: no values, no initial value"); - } - } - } - - for (; i < len; i++) { - if (i in this) { - v = f(v, this[i], i, this); - } - } - return v; -}; -/** - * The top-level Protovis namespace. All public methods and fields should be - * registered on this object. Note that core Protovis source is surrounded by an - * anonymous function, so any other declared globals will not be visible outside - * of core methods. This also allows multiple versions of Protovis to coexist, - * since each version will see their own pv namespace. - * - * @namespace The top-level Protovis namespace, pv. - */ -var pv = {}; - -/** - * Protovis major and minor version numbers. - * - * @namespace Protovis major and minor version numbers. - */ -pv.version = { - /** - * The major version number. - * - * @type number - * @constant - */ - major: 3, - - /** - * The minor version number. - * - * @type number - * @constant - */ - minor: 2 -}; - -/** - * Returns the passed-in argument, x; the identity function. This method - * is provided for convenience since it is used as the default behavior for a - * number of property functions. - * - * @param x a value. - * @returns the value x. - */ -pv.identity = function(x) { return x; }; - -/** - * Returns this.index. This method is provided for convenience for use - * with scales. For example, to color bars by their index, say: - * - *
.fillStyle(pv.Colors.category10().by(pv.index))
- * - * This method is equivalent to function() this.index, but more - * succinct. Note that the index property is also supported for - * accessor functions with {@link pv.max}, {@link pv.min} and other array - * utility methods. - * - * @see pv.Scale - * @see pv.Mark#index - */ -pv.index = function() { return this.index; }; - -/** - * Returns this.childIndex. This method is provided for convenience for - * use with scales. For example, to color bars by their child index, say: - * - *
.fillStyle(pv.Colors.category10().by(pv.child))
- * - * This method is equivalent to function() this.childIndex, but more - * succinct. - * - * @see pv.Scale - * @see pv.Mark#childIndex - */ -pv.child = function() { return this.childIndex; }; - -/** - * Returns this.parent.index. This method is provided for convenience - * for use with scales. This method is provided for convenience for use with - * scales. For example, to color bars by their parent index, say: - * - *
.fillStyle(pv.Colors.category10().by(pv.parent))
- * - * Tthis method is equivalent to function() this.parent.index, but more - * succinct. - * - * @see pv.Scale - * @see pv.Mark#index - */ -pv.parent = function() { return this.parent.index; }; - -/** - * Stores the current event. This field is only set within event handlers. - * - * @type Event - * @name pv.event - */ -/** - * @private Returns a prototype object suitable for extending the given class - * f. Rather than constructing a new instance of f to serve as - * the prototype (which unnecessarily runs the constructor on the created - * prototype object, potentially polluting it), an anonymous function is - * generated internally that shares the same prototype: - * - *
function g() {}
- * g.prototype = f.prototype;
- * return new g();
- * - * For more details, see Douglas Crockford's essay on prototypal inheritance. - * - * @param {function} f a constructor. - * @returns a suitable prototype object. - * @see Douglas Crockford's essay on prototypal - * inheritance. - */ -pv.extend = function(f) { - function g() {} - g.prototype = f.prototype || f; - return new g(); -}; - -try { - eval("pv.parse = function(x) x;"); // native support -} catch (e) { - -/** - * @private Parses a Protovis specification, which may use JavaScript 1.8 - * function expresses, replacing those function expressions with proper - * functions such that the code can be run by a JavaScript 1.6 interpreter. This - * hack only supports function expressions (using clumsy regular expressions, no - * less), and not other JavaScript 1.8 features such as let expressions. - * - * @param {string} s a Protovis specification (i.e., a string of JavaScript 1.8 - * source code). - * @returns {string} a conformant JavaScript 1.6 source code. - */ - pv.parse = function(js) { // hacky regex support - var re = new RegExp("function\\s*(\\b\\w+)?\\s*\\([^)]*\\)\\s*", "mg"), m, d, i = 0, s = ""; - while (m = re.exec(js)) { - var j = m.index + m[0].length; - if (js.charAt(j) != '{') { - s += js.substring(i, j) + "{return "; - i = j; - for (var p = 0; p >= 0 && j < js.length; j++) { - var c = js.charAt(j); - switch (c) { - case '"': case '\'': { - while (++j < js.length && (d = js.charAt(j)) != c) { - if (d == '\\') j++; - } - break; - } - case '[': case '(': p++; break; - case ']': case ')': p--; break; - case ';': - case ',': if (p == 0) p--; break; - } - } - s += pv.parse(js.substring(i, --j)) + ";}"; - i = j; - } - re.lastIndex = j; - } - s += js.substring(i); - return s; - }; -} - -/** - * @private Computes the value of the specified CSS property p on the - * specified element e. - * - * @param {string} p the name of the CSS property. - * @param e the element on which to compute the CSS property. - */ -pv.css = function(e, p) { - return window.getComputedStyle - ? window.getComputedStyle(e, null).getPropertyValue(p) - : e.currentStyle[p]; -}; - -/** - * @private Reports the specified error to the JavaScript console. Mozilla only - * allows logging to the console for privileged code; if the console is - * unavailable, the alert dialog box is used instead. - * - * @param e the exception that triggered the error. - */ -pv.error = function(e) { - (typeof console == "undefined") ? alert(e) : console.error(e); -}; - -/** - * @private Registers the specified listener for events of the specified type on - * the specified target. For standards-compliant browsers, this method uses - * addEventListener; for Internet Explorer, attachEvent. - * - * @param target a DOM element. - * @param {string} type the type of event, such as "click". - * @param {function} the event handler callback. - */ -pv.listen = function(target, type, listener) { - listener = pv.listener(listener); - return target.addEventListener - ? target.addEventListener(type, listener, false) - : target.attachEvent("on" + type, listener); -}; - -/** - * @private Returns a wrapper for the specified listener function such that the - * {@link pv.event} is set for the duration of the listener's invocation. The - * wrapper is cached on the returned function, such that duplicate registrations - * of the wrapped event handler are ignored. - * - * @param {function} f an event handler. - * @returns {function} the wrapped event handler. - */ -pv.listener = function(f) { - return f.$listener || (f.$listener = function(e) { - try { - pv.event = e; - return f.call(this, e); - } finally { - delete pv.event; - } - }); -}; - -/** - * @private Returns true iff a is an ancestor of e. This is useful - * for ignoring mouseout and mouseover events that are contained within the - * target element. - */ -pv.ancestor = function(a, e) { - while (e) { - if (e == a) return true; - e = e.parentNode; - } - return false; -}; - -/** @private Returns a locally-unique positive id. */ -pv.id = function() { - var id = 1; return function() { return id++; }; -}(); - -/** @private Returns a function wrapping the specified constant. */ -pv.functor = function(v) { - return typeof v == "function" ? v : function() { return v; }; -}; -/* - * Parses the Protovis specifications on load, allowing the use of JavaScript - * 1.8 function expressions on browsers that only support JavaScript 1.6. - * - * @see pv.parse - */ -pv.listen(window, "load", function() { - /* - * Note: in Firefox any variables declared here are visible to the eval'd - * script below. Even worse, any global variables declared by the script - * could overwrite local variables here (such as the index, `i`)! To protect - * against this, all variables are explicitly scoped on a pv.$ object. - */ - pv.$ = {i:0, x:document.getElementsByTagName("script")}; - for (; pv.$.i < pv.$.x.length; pv.$.i++) { - pv.$.s = pv.$.x[pv.$.i]; - if (pv.$.s.type == "text/javascript+protovis") { - try { - window.eval(pv.parse(pv.$.s.text)); - } catch (e) { - pv.error(e); - } - } - } - delete pv.$; - }); -/** - * Abstract; see an implementing class. - * - * @class Represents an abstract text formatter and parser. A format is a - * function that converts an object of a given type, such as a Date, to - * a human-readable string representation. The format may also have a - * {@link #parse} method for converting a string representation back to the - * given object type. - * - *

Because formats are themselves functions, they can be used directly as - * mark properties. For example, if the data associated with a label are dates, - * a date format can be used as label text: - * - *

    .text(pv.Format.date("%m/%d/%y"))
- * - * And as with scales, if the format is used in multiple places, it can be - * convenient to declare it as a global variable and then reference it from the - * appropriate property functions. For example, if the data has a date - * attribute, and format references a given date format: - * - *
    .text(function(d) format(d.date))
- * - * Similarly, to parse a string into a date: - * - *
var date = format.parse("4/30/2010");
- * - * Not all format implementations support parsing. See the implementing class - * for details. - * - * @see pv.Format.date - * @see pv.Format.number - * @see pv.Format.time - */ -pv.Format = {}; - -/** - * Formats the specified object, returning the string representation. - * - * @function - * @name pv.Format.prototype.format - * @param {object} x the object to format. - * @returns {string} the formatted string. - */ - -/** - * Parses the specified string, returning the object representation. - * - * @function - * @name pv.Format.prototype.parse - * @param {string} x the string to parse. - * @returns {object} the parsed object. - */ - -/** - * @private Given a string that may be used as part of a regular expression, - * this methods returns an appropriately quoted version of the specified string, - * with any special characters escaped. - * - * @param {string} s a string to quote. - * @returns {string} the quoted string. - */ -pv.Format.re = function(s) { - return s.replace(/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g, "\\$&"); -}; - -/** - * @private Optionally pads the specified string s so that it is at least - * n characters long, using the padding character c. - * - * @param {string} c the padding character. - * @param {number} n the minimum string length. - * @param {string} s the string to pad. - * @returns {string} the padded string. - */ -pv.Format.pad = function(c, n, s) { - var m = n - String(s).length; - return (m < 1) ? s : new Array(m + 1).join(c) + s; -}; -/** - * Constructs a new date format with the specified string pattern. - * - * @class The format string is in the same format expected by the - * strftime function in C. The following conversion specifications are - * supported:The following conversion specifications are currently unsupported - * for formatting:In addition, the following conversion specifications are currently - * unsupported for parsing: - * - * @see strftime - * documentation. - * @see strptime - * documentation. - * @extends pv.Format - * @param {string} pattern the format pattern. - */ -pv.Format.date = function(pattern) { - var pad = pv.Format.pad; - - /** @private */ - function format(d) { - return pattern.replace(/%[a-zA-Z0-9]/g, function(s) { - switch (s) { - case '%a': return [ - "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" - ][d.getDay()]; - case '%A': return [ - "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", - "Saturday" - ][d.getDay()]; - case '%h': - case '%b': return [ - "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", - "Oct", "Nov", "Dec" - ][d.getMonth()]; - case '%B': return [ - "January", "February", "March", "April", "May", "June", "July", - "August", "September", "October", "November", "December" - ][d.getMonth()]; - case '%c': return d.toLocaleString(); - case '%C': return pad("0", 2, Math.floor(d.getFullYear() / 100) % 100); - case '%d': return pad("0", 2, d.getDate()); - case '%x': - case '%D': return pad("0", 2, d.getMonth() + 1) - + "/" + pad("0", 2, d.getDate()) - + "/" + pad("0", 2, d.getFullYear() % 100); - case '%e': return pad(" ", 2, d.getDate()); - case '%H': return pad("0", 2, d.getHours()); - case '%I': { - var h = d.getHours() % 12; - return h ? pad("0", 2, h) : 12; - } - // TODO %j: day of year as a decimal number [001,366] - case '%m': return pad("0", 2, d.getMonth() + 1); - case '%M': return pad("0", 2, d.getMinutes()); - case '%n': return "\n"; - case '%p': return d.getHours() < 12 ? "AM" : "PM"; - case '%T': - case '%X': - case '%r': { - var h = d.getHours() % 12; - return (h ? pad("0", 2, h) : 12) - + ":" + pad("0", 2, d.getMinutes()) - + ":" + pad("0", 2, d.getSeconds()) - + " " + (d.getHours() < 12 ? "AM" : "PM"); - } - case '%R': return pad("0", 2, d.getHours()) + ":" + pad("0", 2, d.getMinutes()); - case '%S': return pad("0", 2, d.getSeconds()); - case '%Q': return pad("0", 3, d.getMilliseconds()); - case '%t': return "\t"; - case '%u': { - var w = d.getDay(); - return w ? w : 1; - } - // TODO %U: week number (sunday first day) [00,53] - // TODO %V: week number (monday first day) [01,53] ... with weirdness - case '%w': return d.getDay(); - // TODO %W: week number (monday first day) [00,53] ... with weirdness - case '%y': return pad("0", 2, d.getFullYear() % 100); - case '%Y': return d.getFullYear(); - // TODO %Z: timezone name or abbreviation - case '%%': return "%"; - } - return s; - }); - } - - /** - * Converts a date to a string using the associated formatting pattern. - * - * @function - * @name pv.Format.date.prototype.format - * @param {Date} date a date to format. - * @returns {string} the formatted date as a string. - */ - format.format = format; - - /** - * Parses a date from a string using the associated formatting pattern. - * - * @function - * @name pv.Format.date.prototype.parse - * @param {string} s the string to parse as a date. - * @returns {Date} the parsed date. - */ - format.parse = function(s) { - var year = 1970, month = 0, date = 1, hour = 0, minute = 0, second = 0; - var fields = [function() {}]; - - /* Register callbacks for each field in the format pattern. */ - var re = pv.Format.re(pattern).replace(/%[a-zA-Z0-9]/g, function(s) { - switch (s) { - // TODO %a: day of week, either abbreviated or full name - // TODO %A: same as %a - case '%b': { - fields.push(function(x) { month = { - Jan: 0, Feb: 1, Mar: 2, Apr: 3, May: 4, Jun: 5, Jul: 6, Aug: 7, - Sep: 8, Oct: 9, Nov: 10, Dec: 11 - }[x]; }); - return "([A-Za-z]+)"; - } - case '%h': - case '%B': { - fields.push(function(x) { month = { - January: 0, February: 1, March: 2, April: 3, May: 4, June: 5, - July: 6, August: 7, September: 8, October: 9, November: 10, - December: 11 - }[x]; }); - return "([A-Za-z]+)"; - } - // TODO %c: locale's appropriate date and time - // TODO %C: century number[0,99] - case '%e': - case '%d': { - fields.push(function(x) { date = x; }); - return "([0-9]+)"; - } - // TODO %D: same as %m/%d/%y - case '%I': - case '%H': { - fields.push(function(x) { hour = x; }); - return "([0-9]+)"; - } - // TODO %j: day number [1,366] - case '%m': { - fields.push(function(x) { month = x - 1; }); - return "([0-9]+)"; - } - case '%M': { - fields.push(function(x) { minute = x; }); - return "([0-9]+)"; - } - // TODO %n: any white space - // TODO %p: locale's equivalent of a.m. or p.m. - case '%p': { // TODO this is a hack - fields.push(function(x) { - if (hour == 12) { - if (x == "am") hour = 0; - } else if (x == "pm") { - hour = Number(hour) + 12; - } - }); - return "(am|pm)"; - } - // TODO %r: %I:%M:%S %p - // TODO %R: %H:%M - case '%S': { - fields.push(function(x) { second = x; }); - return "([0-9]+)"; - } - // TODO %t: any white space - // TODO %T: %H:%M:%S - // TODO %U: week number [00,53] - // TODO %w: weekday [0,6] - // TODO %W: week number [00, 53] - // TODO %x: locale date (%m/%d/%y) - // TODO %X: locale time (%I:%M:%S %p) - case '%y': { - fields.push(function(x) { - x = Number(x); - year = x + (((0 <= x) && (x < 69)) ? 2000 - : (((x >= 69) && (x < 100) ? 1900 : 0))); - }); - return "([0-9]+)"; - } - case '%Y': { - fields.push(function(x) { year = x; }); - return "([0-9]+)"; - } - case '%%': { - fields.push(function() {}); - return "%"; - } - } - return s; - }); - - var match = s.match(re); - if (match) match.forEach(function(m, i) { fields[i](m); }); - return new Date(year, month, date, hour, minute, second); - }; - - return format; -}; -/** - * Returns a time format of the given type, either "short" or "long". - * - * @class Represents a time format, converting between a number - * representing a duration in milliseconds, and a string. Two types of - * time formats are supported: "short" and "long". The short format type - * returns a string such as "3.3 days" or "12.1 minutes", while the long - * format returns "13:04:12" or similar. - * - * @extends pv.Format - * @param {string} type the type; "short" or "long". - */ -pv.Format.time = function(type) { - var pad = pv.Format.pad; - - /* - * MILLISECONDS = 1 - * SECONDS = 1e3 - * MINUTES = 6e4 - * HOURS = 36e5 - * DAYS = 864e5 - * WEEKS = 6048e5 - * MONTHS = 2592e6 - * YEARS = 31536e6 - */ - - /** @private */ - function format(t) { - t = Number(t); // force conversion from Date - switch (type) { - case "short": { - if (t >= 31536e6) { - return (t / 31536e6).toFixed(1) + " years"; - } else if (t >= 6048e5) { - return (t / 6048e5).toFixed(1) + " weeks"; - } else if (t >= 864e5) { - return (t / 864e5).toFixed(1) + " days"; - } else if (t >= 36e5) { - return (t / 36e5).toFixed(1) + " hours"; - } else if (t >= 6e4) { - return (t / 6e4).toFixed(1) + " minutes"; - } - return (t / 1e3).toFixed(1) + " seconds"; - } - case "long": { - var a = [], - s = ((t % 6e4) / 1e3) >> 0, - m = ((t % 36e5) / 6e4) >> 0; - a.push(pad("0", 2, s)); - if (t >= 36e5) { - var h = ((t % 864e5) / 36e5) >> 0; - a.push(pad("0", 2, m)); - if (t >= 864e5) { - a.push(pad("0", 2, h)); - a.push(Math.floor(t / 864e5).toFixed()); - } else { - a.push(h.toFixed()); - } - } else { - a.push(m.toFixed()); - } - return a.reverse().join(":"); - } - } - } - - /** - * Formats the specified time, returning the string representation. - * - * @function - * @name pv.Format.time.prototype.format - * @param {number} t the duration in milliseconds. May also be a Date. - * @returns {string} the formatted string. - */ - format.format = format; - - /** - * Parses the specified string, returning the time in milliseconds. - * - * @function - * @name pv.Format.time.prototype.parse - * @param {string} s a formatted string. - * @returns {number} the parsed duration in milliseconds. - */ - format.parse = function(s) { - switch (type) { - case "short": { - var re = /([0-9,.]+)\s*([a-z]+)/g, a, t = 0; - while (a = re.exec(s)) { - var f = parseFloat(a[0].replace(",", "")), u = 0; - switch (a[2].toLowerCase()) { - case "year": case "years": u = 31536e6; break; - case "week": case "weeks": u = 6048e5; break; - case "day": case "days": u = 864e5; break; - case "hour": case "hours": u = 36e5; break; - case "minute": case "minutes": u = 6e4; break; - case "second": case "seconds": u = 1e3; break; - } - t += f * u; - } - return t; - } - case "long": { - var a = s.replace(",", "").split(":").reverse(), t = 0; - if (a.length) t += parseFloat(a[0]) * 1e3; - if (a.length > 1) t += parseFloat(a[1]) * 6e4; - if (a.length > 2) t += parseFloat(a[2]) * 36e5; - if (a.length > 3) t += parseFloat(a[3]) * 864e5; - return t; - } - } - } - - return format; -}; -/** - * Returns a default number format. - * - * @class Represents a number format, converting between a number and a - * string. This class allows numbers to be formatted with variable - * precision (both for the integral and fractional part of the number), optional - * thousands grouping, and optional padding. The thousands (",") and decimal - * (".") separator can be customized. - * - * @returns {pv.Format.number} a number format. - */ -pv.Format.number = function() { - var mini = 0, // default minimum integer digits - maxi = Infinity, // default maximum integer digits - mins = 0, // mini, including group separators - minf = 0, // default minimum fraction digits - maxf = 0, // default maximum fraction digits - maxk = 1, // 10^maxf - padi = "0", // default integer pad - padf = "0", // default fraction pad - padg = true, // whether group separator affects integer padding - decimal = ".", // default decimal separator - group = ","; // default group separator - - /** @private */ - function format(x) { - /* Round the fractional part, and split on decimal separator. */ - if (Infinity > maxf) x = Math.round(x * maxk) / maxk; - var s = String(Math.abs(x)).split("."); - - /* Pad, truncate and group the integral part. */ - var i = s[0], n = (x < 0) ? "-" : ""; - if (i.length > maxi) i = i.substring(i.length - maxi); - if (padg && (i.length < mini)) i = n + new Array(mini - i.length + 1).join(padi) + i; - if (i.length > 3) i = i.replace(/\B(?=(?:\d{3})+(?!\d))/g, group); - if (!padg && (i.length < mins)) i = new Array(mins - i.length + 1).join(padi) + n + i; - s[0] = i; - - /* Pad the fractional part. */ - var f = s[1] || ""; - if (f.length < minf) s[1] = f + new Array(minf - f.length + 1).join(padf); - - return s.join(decimal); - } - - /** - * @function - * @name pv.Format.number.prototype.format - * @param {number} x - * @returns {string} - */ - format.format = format; - - /** - * Parses the specified string as a number. Before parsing, leading and - * trailing padding is removed. Group separators are also removed, and the - * decimal separator is replaced with the standard point ("."). The integer - * part is truncated per the maximum integer digits, and the fraction part is - * rounded per the maximum fraction digits. - * - * @function - * @name pv.Format.number.prototype.parse - * @param {string} x the string to parse. - * @returns {number} the parsed number. - */ - format.parse = function(x) { - var re = pv.Format.re; - - /* Remove leading and trailing padding. Split on the decimal separator. */ - var s = String(x) - .replace(new RegExp("^(" + re(padi) + ")*"), "") - .replace(new RegExp("(" + re(padf) + ")*$"), "") - .split(decimal); - - /* Remove grouping and truncate the integral part. */ - var i = s[0].replace(new RegExp(re(group), "g"), ""); - if (i.length > maxi) i = i.substring(i.length - maxi); - - /* Round the fractional part. */ - var f = s[1] ? Number("0." + s[1]) : 0; - if (Infinity > maxf) f = Math.round(f * maxk) / maxk; - - return Math.round(i) + f; - }; - - /** - * Sets or gets the minimum and maximum number of integer digits. This - * controls the number of decimal digits to display before the decimal - * separator for the integral part of the number. If the number of digits is - * smaller than the minimum, the digits are padded; if the number of digits is - * larger, the digits are truncated, showing only the lower-order digits. The - * default range is [0, Infinity]. - * - *

If only one argument is specified to this method, this value is used as - * both the minimum and maximum number. If no arguments are specified, a - * two-element array is returned containing the minimum and the maximum. - * - * @function - * @name pv.Format.number.prototype.integerDigits - * @param {number} [min] the minimum integer digits. - * @param {number} [max] the maximum integer digits. - * @returns {pv.Format.number} this, or the current integer digits. - */ - format.integerDigits = function(min, max) { - if (arguments.length) { - mini = Number(min); - maxi = (arguments.length > 1) ? Number(max) : mini; - mins = mini + Math.floor(mini / 3) * group.length; - return this; - } - return [mini, maxi]; - }; - - /** - * Sets or gets the minimum and maximum number of fraction digits. The - * controls the number of decimal digits to display after the decimal - * separator for the fractional part of the number. If the number of digits is - * smaller than the minimum, the digits are padded; if the number of digits is - * larger, the fractional part is rounded, showing only the higher-order - * digits. The default range is [0, 0]. - * - *

If only one argument is specified to this method, this value is used as - * both the minimum and maximum number. If no arguments are specified, a - * two-element array is returned containing the minimum and the maximum. - * - * @function - * @name pv.Format.number.prototype.fractionDigits - * @param {number} [min] the minimum fraction digits. - * @param {number} [max] the maximum fraction digits. - * @returns {pv.Format.number} this, or the current fraction digits. - */ - format.fractionDigits = function(min, max) { - if (arguments.length) { - minf = Number(min); - maxf = (arguments.length > 1) ? Number(max) : minf; - maxk = Math.pow(10, maxf); - return this; - } - return [minf, maxf]; - }; - - /** - * Sets or gets the character used to pad the integer part. The integer pad is - * used when the number of integer digits is smaller than the minimum. The - * default pad character is "0" (zero). - * - * @param {string} [x] the new pad character. - * @returns {pv.Format.number} this or the current pad character. - */ - format.integerPad = function(x) { - if (arguments.length) { - padi = String(x); - padg = /\d/.test(padi); - return this; - } - return padi; - }; - - /** - * Sets or gets the character used to pad the fration part. The fraction pad - * is used when the number of fraction digits is smaller than the minimum. The - * default pad character is "0" (zero). - * - * @param {string} [x] the new pad character. - * @returns {pv.Format.number} this or the current pad character. - */ - format.fractionPad = function(x) { - if (arguments.length) { - padf = String(x); - return this; - } - return padf; - }; - - /** - * Sets or gets the character used as the decimal point, separating the - * integer and fraction parts of the number. The default decimal point is ".". - * - * @param {string} [x] the new decimal separator. - * @returns {pv.Format.number} this or the current decimal separator. - */ - format.decimal = function(x) { - if (arguments.length) { - decimal = String(x); - return this; - } - return decimal; - }; - - /** - * Sets or gets the character used as the group separator, grouping integer - * digits by thousands. The default decimal point is ",". Grouping can be - * disabled by using "" for the separator. - * - * @param {string} [x] the new group separator. - * @returns {pv.Format.number} this or the current group separator. - */ - format.group = function(x) { - if (arguments.length) { - group = x ? String(x) : ""; - mins = mini + Math.floor(mini / 3) * group.length; - return this; - } - return group; - }; - - return format; -}; -/** - * @private A private variant of Array.prototype.map that supports the index - * property. - */ -pv.map = function(array, f) { - var o = {}; - return f - ? array.map(function(d, i) { o.index = i; return f.call(o, d); }) - : array.slice(); -}; - -/** - * Concatenates the specified array with itself n times. For example, - * pv.repeat([1, 2]) returns [1, 2, 1, 2]. - * - * @param {array} a an array. - * @param {number} [n] the number of times to repeat; defaults to two. - * @returns {array} an array that repeats the specified array. - */ -pv.repeat = function(array, n) { - if (arguments.length == 1) n = 2; - return pv.blend(pv.range(n).map(function() { return array; })); -}; - -/** - * Given two arrays a and b, returns an array of all possible - * pairs of elements [ai, bj]. The outer loop is on array - * a, while the inner loop is on b, such that the order of - * returned elements is [a0, b0], [a0, - * b1], ... [a0, bm], [a1, - * b0], [a1, b1], ... [a1, - * bm], ... [an, bm]. If either array is empty, - * an empty array is returned. - * - * @param {array} a an array. - * @param {array} b an array. - * @returns {array} an array of pairs of elements in a and b. - */ -pv.cross = function(a, b) { - var array = []; - for (var i = 0, n = a.length, m = b.length; i < n; i++) { - for (var j = 0, x = a[i]; j < m; j++) { - array.push([x, b[j]]); - } - } - return array; -}; - -/** - * Given the specified array of arrays, concatenates the arrays into a single - * array. If the individual arrays are explicitly known, an alternative to blend - * is to use JavaScript's concat method directly. These two equivalent - * expressions:

return [1, 2, 3, "a", "b", "c"]. - * - * @param {array[]} arrays an array of arrays. - * @returns {array} an array containing all the elements of each array in - * arrays. - */ -pv.blend = function(arrays) { - return Array.prototype.concat.apply([], arrays); -}; - -/** - * Given the specified array of arrays, transposes each element - * arrayij with arrayji. If the array has dimensions - * n×m, it will have dimensions m×n - * after this method returns. This method transposes the elements of the array - * in place, mutating the array, and returning a reference to the array. - * - * @param {array[]} arrays an array of arrays. - * @returns {array[]} the passed-in array, after transposing the elements. - */ -pv.transpose = function(arrays) { - var n = arrays.length, m = pv.max(arrays, function(d) { return d.length; }); - - if (m > n) { - arrays.length = m; - for (var i = n; i < m; i++) { - arrays[i] = new Array(n); - } - for (var i = 0; i < n; i++) { - for (var j = i + 1; j < m; j++) { - var t = arrays[i][j]; - arrays[i][j] = arrays[j][i]; - arrays[j][i] = t; - } - } - } else { - for (var i = 0; i < m; i++) { - arrays[i].length = n; - } - for (var i = 0; i < n; i++) { - for (var j = 0; j < i; j++) { - var t = arrays[i][j]; - arrays[i][j] = arrays[j][i]; - arrays[j][i] = t; - } - } - } - - arrays.length = m; - for (var i = 0; i < m; i++) { - arrays[i].length = n; - } - - return arrays; -}; - -/** - * Returns a normalized copy of the specified array, such that the sum of the - * returned elements sum to one. If the specified array is not an array of - * numbers, an optional accessor function f can be specified to map the - * elements to numbers. For example, if array is an array of objects, - * and each object has a numeric property "foo", the expression - * - *
pv.normalize(array, function(d) d.foo)
- * - * returns a normalized array on the "foo" property. If an accessor function is - * not specified, the identity function is used. Accessor functions can refer to - * this.index. - * - * @param {array} array an array of objects, or numbers. - * @param {function} [f] an optional accessor function. - * @returns {number[]} an array of numbers that sums to one. - */ -pv.normalize = function(array, f) { - var norm = pv.map(array, f), sum = pv.sum(norm); - for (var i = 0; i < norm.length; i++) norm[i] /= sum; - return norm; -}; - -/** - * Returns a permutation of the specified array, using the specified array of - * indexes. The returned array contains the corresponding element in - * array for each index in indexes, in order. For example, - * - *
pv.permute(["a", "b", "c"], [1, 2, 0])
- * - * returns ["b", "c", "a"]. It is acceptable for the array of indexes - * to be a different length from the array of elements, and for indexes to be - * duplicated or omitted. The optional accessor function f can be used - * to perform a simultaneous mapping of the array elements. Accessor functions - * can refer to this.index. - * - * @param {array} array an array. - * @param {number[]} indexes an array of indexes into array. - * @param {function} [f] an optional accessor function. - * @returns {array} an array of elements from array; a permutation. - */ -pv.permute = function(array, indexes, f) { - if (!f) f = pv.identity; - var p = new Array(indexes.length), o = {}; - indexes.forEach(function(j, i) { o.index = j; p[i] = f.call(o, array[j]); }); - return p; -}; - -/** - * Returns a map from key to index for the specified keys array. For - * example, - * - *
pv.numerate(["a", "b", "c"])
- * - * returns {a: 0, b: 1, c: 2}. Note that since JavaScript maps only - * support string keys, keys must contain strings, or other values that - * naturally map to distinct string values. Alternatively, an optional accessor - * function f can be specified to compute the string key for the given - * element. Accessor functions can refer to this.index. - * - * @param {array} keys an array, usually of string keys. - * @param {function} [f] an optional key function. - * @returns a map from key to index. - */ -pv.numerate = function(keys, f) { - if (!f) f = pv.identity; - var map = {}, o = {}; - keys.forEach(function(x, i) { o.index = i; map[f.call(o, x)] = i; }); - return map; -}; - -/** - * Returns the unique elements in the specified array, in the order they appear. - * Note that since JavaScript maps only support string keys, array must - * contain strings, or other values that naturally map to distinct string - * values. Alternatively, an optional accessor function f can be - * specified to compute the string key for the given element. Accessor functions - * can refer to this.index. - * - * @param {array} array an array, usually of string keys. - * @param {function} [f] an optional key function. - * @returns {array} the unique values. - */ -pv.uniq = function(array, f) { - if (!f) f = pv.identity; - var map = {}, keys = [], o = {}, y; - array.forEach(function(x, i) { - o.index = i; - y = f.call(o, x); - if (!(y in map)) map[y] = keys.push(y); - }); - return keys; -}; - -/** - * The comparator function for natural order. This can be used in conjunction with - * the built-in array sort method to sort elements by their natural - * order, ascending. Note that if no comparator function is specified to the - * built-in sort method, the default order is lexicographic, not - * natural! - * - * @see Array.sort. - * @param a an element to compare. - * @param b an element to compare. - * @returns {number} negative if a < b; positive if a > b; otherwise 0. - */ -pv.naturalOrder = function(a, b) { - return (a < b) ? -1 : ((a > b) ? 1 : 0); -}; - -/** - * The comparator function for reverse natural order. This can be used in - * conjunction with the built-in array sort method to sort elements by - * their natural order, descending. Note that if no comparator function is - * specified to the built-in sort method, the default order is - * lexicographic, not natural! - * - * @see #naturalOrder - * @param a an element to compare. - * @param b an element to compare. - * @returns {number} negative if a < b; positive if a > b; otherwise 0. - */ -pv.reverseOrder = function(b, a) { - return (a < b) ? -1 : ((a > b) ? 1 : 0); -}; - -/** - * Searches the specified array of numbers for the specified value using the - * binary search algorithm. The array must be sorted (as by the sort - * method) prior to making this call. If it is not sorted, the results are - * undefined. If the array contains multiple elements with the specified value, - * there is no guarantee which one will be found. - * - *

The insertion point is defined as the point at which the value - * would be inserted into the array: the index of the first element greater than - * the value, or array.length, if all elements in the array are less - * than the specified value. Note that this guarantees that the return value - * will be nonnegative if and only if the value is found. - * - * @param {number[]} array the array to be searched. - * @param {number} value the value to be searched for. - * @returns the index of the search value, if it is contained in the array; - * otherwise, (-(insertion point) - 1). - * @param {function} [f] an optional key function. - */ -pv.search = function(array, value, f) { - if (!f) f = pv.identity; - var low = 0, high = array.length - 1; - while (low <= high) { - var mid = (low + high) >> 1, midValue = f(array[mid]); - if (midValue < value) low = mid + 1; - else if (midValue > value) high = mid - 1; - else return mid; - } - return -low - 1; -}; - -pv.search.index = function(array, value, f) { - var i = pv.search(array, value, f); - return (i < 0) ? (-i - 1) : i; -}; -/** - * Returns an array of numbers, starting at start, incrementing by - * step, until stop is reached. The stop value is - * exclusive. If only a single argument is specified, this value is interpeted - * as the stop value, with the start value as zero. If only two - * arguments are specified, the step value is implied to be one. - * - *

The method is modeled after the built-in range method from - * Python. See the Python documentation for more details. - * - * @see Python range - * @param {number} [start] the start value. - * @param {number} stop the stop value. - * @param {number} [step] the step value. - * @returns {number[]} an array of numbers. - */ -pv.range = function(start, stop, step) { - if (arguments.length == 1) { - stop = start; - start = 0; - } - if (step == undefined) step = 1; - if ((stop - start) / step == Infinity) throw new Error("range must be finite"); - var array = [], i = 0, j; - if (step < 0) { - while ((j = start + step * i++) > stop) { - array.push(j); - } - } else { - while ((j = start + step * i++) < stop) { - array.push(j); - } - } - return array; -}; - -/** - * Returns a random number in the range [start, stop) that is - * a multiple of step. More specifically, the returned number is of the - * form start + n * step, where n is a - * nonnegative integer. If step is not specified, it defaults to 1, - * returning a random integer if start is also an integer. - * - * @param {number} [start] the start value value. - * @param {number} stop the stop value. - * @param {number} [step] the step value. - * @returns {number} a random number between start and stop. - */ -pv.random = function(start, stop, step) { - if (arguments.length == 1) { - stop = start; - start = 0; - } - if (step == undefined) step = 1; - return step - ? (Math.floor(Math.random() * (stop - start) / step) * step + start) - : (Math.random() * (stop - start) + start); -}; - -/** - * Returns the sum of the specified array. If the specified array is not an - * array of numbers, an optional accessor function f can be specified - * to map the elements to numbers. See {@link #normalize} for an example. - * Accessor functions can refer to this.index. - * - * @param {array} array an array of objects, or numbers. - * @param {function} [f] an optional accessor function. - * @returns {number} the sum of the specified array. - */ -pv.sum = function(array, f) { - var o = {}; - return array.reduce(f - ? function(p, d, i) { o.index = i; return p + f.call(o, d); } - : function(p, d) { return p + d; }, 0); -}; - -/** - * Returns the maximum value of the specified array. If the specified array is - * not an array of numbers, an optional accessor function f can be - * specified to map the elements to numbers. See {@link #normalize} for an - * example. Accessor functions can refer to this.index. - * - * @param {array} array an array of objects, or numbers. - * @param {function} [f] an optional accessor function. - * @returns {number} the maximum value of the specified array. - */ -pv.max = function(array, f) { - if (f == pv.index) return array.length - 1; - return Math.max.apply(null, f ? pv.map(array, f) : array); -}; - -/** - * Returns the index of the maximum value of the specified array. If the - * specified array is not an array of numbers, an optional accessor function - * f can be specified to map the elements to numbers. See - * {@link #normalize} for an example. Accessor functions can refer to - * this.index. - * - * @param {array} array an array of objects, or numbers. - * @param {function} [f] an optional accessor function. - * @returns {number} the index of the maximum value of the specified array. - */ -pv.max.index = function(array, f) { - if (!array.length) return -1; - if (f == pv.index) return array.length - 1; - if (!f) f = pv.identity; - var maxi = 0, maxx = -Infinity, o = {}; - for (var i = 0; i < array.length; i++) { - o.index = i; - var x = f.call(o, array[i]); - if (x > maxx) { - maxx = x; - maxi = i; - } - } - return maxi; -} - -/** - * Returns the minimum value of the specified array of numbers. If the specified - * array is not an array of numbers, an optional accessor function f - * can be specified to map the elements to numbers. See {@link #normalize} for - * an example. Accessor functions can refer to this.index. - * - * @param {array} array an array of objects, or numbers. - * @param {function} [f] an optional accessor function. - * @returns {number} the minimum value of the specified array. - */ -pv.min = function(array, f) { - if (f == pv.index) return 0; - return Math.min.apply(null, f ? pv.map(array, f) : array); -}; - -/** - * Returns the index of the minimum value of the specified array. If the - * specified array is not an array of numbers, an optional accessor function - * f can be specified to map the elements to numbers. See - * {@link #normalize} for an example. Accessor functions can refer to - * this.index. - * - * @param {array} array an array of objects, or numbers. - * @param {function} [f] an optional accessor function. - * @returns {number} the index of the minimum value of the specified array. - */ -pv.min.index = function(array, f) { - if (!array.length) return -1; - if (f == pv.index) return 0; - if (!f) f = pv.identity; - var mini = 0, minx = Infinity, o = {}; - for (var i = 0; i < array.length; i++) { - o.index = i; - var x = f.call(o, array[i]); - if (x < minx) { - minx = x; - mini = i; - } - } - return mini; -} - -/** - * Returns the arithmetic mean, or average, of the specified array. If the - * specified array is not an array of numbers, an optional accessor function - * f can be specified to map the elements to numbers. See - * {@link #normalize} for an example. Accessor functions can refer to - * this.index. - * - * @param {array} array an array of objects, or numbers. - * @param {function} [f] an optional accessor function. - * @returns {number} the mean of the specified array. - */ -pv.mean = function(array, f) { - return pv.sum(array, f) / array.length; -}; - -/** - * Returns the median of the specified array. If the specified array is not an - * array of numbers, an optional accessor function f can be specified - * to map the elements to numbers. See {@link #normalize} for an example. - * Accessor functions can refer to this.index. - * - * @param {array} array an array of objects, or numbers. - * @param {function} [f] an optional accessor function. - * @returns {number} the median of the specified array. - */ -pv.median = function(array, f) { - if (f == pv.index) return (array.length - 1) / 2; - array = pv.map(array, f).sort(pv.naturalOrder); - if (array.length % 2) return array[Math.floor(array.length / 2)]; - var i = array.length / 2; - return (array[i - 1] + array[i]) / 2; -}; - -/** - * Returns the unweighted variance of the specified array. If the specified - * array is not an array of numbers, an optional accessor function f - * can be specified to map the elements to numbers. See {@link #normalize} for - * an example. Accessor functions can refer to this.index. - * - * @param {array} array an array of objects, or numbers. - * @param {function} [f] an optional accessor function. - * @returns {number} the variance of the specified array. - */ -pv.variance = function(array, f) { - if (array.length < 1) return NaN; - if (array.length == 1) return 0; - var mean = pv.mean(array, f), sum = 0, o = {}; - if (!f) f = pv.identity; - for (var i = 0; i < array.length; i++) { - o.index = i; - var d = f.call(o, array[i]) - mean; - sum += d * d; - } - return sum; -}; - -/** - * Returns an unbiased estimation of the standard deviation of a population, - * given the specified random sample. If the specified array is not an array of - * numbers, an optional accessor function f can be specified to map the - * elements to numbers. See {@link #normalize} for an example. Accessor - * functions can refer to this.index. - * - * @param {array} array an array of objects, or numbers. - * @param {function} [f] an optional accessor function. - * @returns {number} the standard deviation of the specified array. - */ -pv.deviation = function(array, f) { - return Math.sqrt(pv.variance(array, f) / (array.length - 1)); -}; - -/** - * Returns the logarithm with a given base value. - * - * @param {number} x the number for which to compute the logarithm. - * @param {number} b the base of the logarithm. - * @returns {number} the logarithm value. - */ -pv.log = function(x, b) { - return Math.log(x) / Math.log(b); -}; - -/** - * Computes a zero-symmetric logarithm. Computes the logarithm of the absolute - * value of the input, and determines the sign of the output according to the - * sign of the input value. - * - * @param {number} x the number for which to compute the logarithm. - * @param {number} b the base of the logarithm. - * @returns {number} the symmetric log value. - */ -pv.logSymmetric = function(x, b) { - return (x == 0) ? 0 : ((x < 0) ? -pv.log(-x, b) : pv.log(x, b)); -}; - -/** - * Computes a zero-symmetric logarithm, with adjustment to values between zero - * and the logarithm base. This adjustment introduces distortion for values less - * than the base number, but enables simultaneous plotting of log-transformed - * data involving both positive and negative numbers. - * - * @param {number} x the number for which to compute the logarithm. - * @param {number} b the base of the logarithm. - * @returns {number} the adjusted, symmetric log value. - */ -pv.logAdjusted = function(x, b) { - if (!isFinite(x)) return x; - var negative = x < 0; - if (x < b) x += (b - x) / b; - return negative ? -pv.log(x, b) : pv.log(x, b); -}; - -/** - * Rounds an input value down according to its logarithm. The method takes the - * floor of the logarithm of the value and then uses the resulting value as an - * exponent for the base value. - * - * @param {number} x the number for which to compute the logarithm floor. - * @param {number} b the base of the logarithm. - * @returns {number} the rounded-by-logarithm value. - */ -pv.logFloor = function(x, b) { - return (x > 0) - ? Math.pow(b, Math.floor(pv.log(x, b))) - : -Math.pow(b, -Math.floor(-pv.log(-x, b))); -}; - -/** - * Rounds an input value up according to its logarithm. The method takes the - * ceiling of the logarithm of the value and then uses the resulting value as an - * exponent for the base value. - * - * @param {number} x the number for which to compute the logarithm ceiling. - * @param {number} b the base of the logarithm. - * @returns {number} the rounded-by-logarithm value. - */ -pv.logCeil = function(x, b) { - return (x > 0) - ? Math.pow(b, Math.ceil(pv.log(x, b))) - : -Math.pow(b, -Math.ceil(-pv.log(-x, b))); -}; - -(function() { - var radians = Math.PI / 180, - degrees = 180 / Math.PI; - - /** Returns the number of radians corresponding to the specified degrees. */ - pv.radians = function(degrees) { return radians * degrees; }; - - /** Returns the number of degrees corresponding to the specified radians. */ - pv.degrees = function(radians) { return degrees * radians; }; -})(); -/** - * Returns all of the property names (keys) of the specified object (a map). The - * order of the returned array is not defined. - * - * @param map an object. - * @returns {string[]} an array of strings corresponding to the keys. - * @see #entries - */ -pv.keys = function(map) { - var array = []; - for (var key in map) { - array.push(key); - } - return array; -}; - -/** - * Returns all of the entries (key-value pairs) of the specified object (a - * map). The order of the returned array is not defined. Each key-value pair is - * represented as an object with key and value attributes, - * e.g., {key: "foo", value: 42}. - * - * @param map an object. - * @returns {array} an array of key-value pairs corresponding to the keys. - */ -pv.entries = function(map) { - var array = []; - for (var key in map) { - array.push({ key: key, value: map[key] }); - } - return array; -}; - -/** - * Returns all of the values (attribute values) of the specified object (a - * map). The order of the returned array is not defined. - * - * @param map an object. - * @returns {array} an array of objects corresponding to the values. - * @see #entries - */ -pv.values = function(map) { - var array = []; - for (var key in map) { - array.push(map[key]); - } - return array; -}; - -/** - * Returns a map constructed from the specified keys, using the - * function f to compute the value for each key. The single argument to - * the value function is the key. The callback is invoked only for indexes of - * the array which have assigned values; it is not invoked for indexes which - * have been deleted or which have never been assigned values. - * - *

For example, this expression creates a map from strings to string length: - * - *

pv.dict(["one", "three", "seventeen"], function(s) s.length)
- * - * The returned value is {one: 3, three: 5, seventeen: 9}. Accessor - * functions can refer to this.index. - * - * @param {array} keys an array. - * @param {function} f a value function. - * @returns a map from keys to values. - */ -pv.dict = function(keys, f) { - var m = {}, o = {}; - for (var i = 0; i < keys.length; i++) { - if (i in keys) { - var k = keys[i]; - o.index = i; - m[k] = f.call(o, k); - } - } - return m; -}; -/** - * Returns a {@link pv.Dom} operator for the given map. This is a convenience - * factory method, equivalent to new pv.Dom(map). To apply the operator - * and retrieve the root node, call {@link pv.Dom#root}; to retrieve all nodes - * flattened, use {@link pv.Dom#nodes}. - * - * @see pv.Dom - * @param map a map from which to construct a DOM. - * @returns {pv.Dom} a DOM operator for the specified map. - */ -pv.dom = function(map) { - return new pv.Dom(map); -}; - -/** - * Constructs a DOM operator for the specified map. This constructor should not - * be invoked directly; use {@link pv.dom} instead. - * - * @class Represets a DOM operator for the specified map. This allows easy - * transformation of a hierarchical JavaScript object (such as a JSON map) to a - * W3C Document Object Model hierarchy. For more information on which attributes - * and methods from the specification are supported, see {@link pv.Dom.Node}. - * - *

Leaves in the map are determined using an associated leaf function; - * see {@link #leaf}. By default, leaves are any value whose type is not - * "object", such as numbers or strings. - * - * @param map a map from which to construct a DOM. - */ -pv.Dom = function(map) { - this.$map = map; -}; - -/** @private The default leaf function. */ -pv.Dom.prototype.$leaf = function(n) { - return typeof n != "object"; -}; - -/** - * Sets or gets the leaf function for this DOM operator. The leaf function - * identifies which values in the map are leaves, and which are internal nodes. - * By default, objects are considered internal nodes, and primitives (such as - * numbers and strings) are considered leaves. - * - * @param {function} f the new leaf function. - * @returns the current leaf function, or this. - */ -pv.Dom.prototype.leaf = function(f) { - if (arguments.length) { - this.$leaf = f; - return this; - } - return this.$leaf; -}; - -/** - * Applies the DOM operator, returning the root node. - * - * @returns {pv.Dom.Node} the root node. - * @param {string} [nodeName] optional node name for the root. - */ -pv.Dom.prototype.root = function(nodeName) { - var leaf = this.$leaf, root = recurse(this.$map); - - /** @private */ - function recurse(map) { - var n = new pv.Dom.Node(); - for (var k in map) { - var v = map[k]; - n.appendChild(leaf(v) ? new pv.Dom.Node(v) : recurse(v)).nodeName = k; - } - return n; - } - - root.nodeName = nodeName; - return root; -}; - -/** - * Applies the DOM operator, returning the array of all nodes in preorder - * traversal. - * - * @returns {array} the array of nodes in preorder traversal. - */ -pv.Dom.prototype.nodes = function() { - return this.root().nodes(); -}; - -/** - * Constructs a DOM node for the specified value. Instances of this class are - * not typically created directly; instead they are generated from a JavaScript - * map using the {@link pv.Dom} operator. - * - * @class Represents a Node in the W3C Document Object Model. - */ -pv.Dom.Node = function(value) { - this.nodeValue = value; - this.childNodes = []; -}; - -/** - * The node name. When generated from a map, the node name corresponds to the - * key at the given level in the map. Note that the root node has no associated - * key, and thus has an undefined node name (and no parentNode). - * - * @type string - * @field pv.Dom.Node.prototype.nodeName - */ - -/** - * The node value. When generated from a map, node value corresponds to the leaf - * value for leaf nodes, and is undefined for internal nodes. - * - * @field pv.Dom.Node.prototype.nodeValue - */ - -/** - * The array of child nodes. This array is empty for leaf nodes. An easy way to - * check if child nodes exist is to query firstChild. - * - * @type array - * @field pv.Dom.Node.prototype.childNodes - */ - -/** - * The parent node, which is null for root nodes. - * - * @type pv.Dom.Node - */ -pv.Dom.Node.prototype.parentNode = null; - -/** - * The first child, which is null for leaf nodes. - * - * @type pv.Dom.Node - */ -pv.Dom.Node.prototype.firstChild = null; - -/** - * The last child, which is null for leaf nodes. - * - * @type pv.Dom.Node - */ -pv.Dom.Node.prototype.lastChild = null; - -/** - * The previous sibling node, which is null for the first child. - * - * @type pv.Dom.Node - */ -pv.Dom.Node.prototype.previousSibling = null; - -/** - * The next sibling node, which is null for the last child. - * - * @type pv.Dom.Node - */ -pv.Dom.Node.prototype.nextSibling = null; - -/** - * Removes the specified child node from this node. - * - * @throws Error if the specified child is not a child of this node. - * @returns {pv.Dom.Node} the removed child. - */ -pv.Dom.Node.prototype.removeChild = function(n) { - var i = this.childNodes.indexOf(n); - if (i == -1) throw new Error("child not found"); - this.childNodes.splice(i, 1); - if (n.previousSibling) n.previousSibling.nextSibling = n.nextSibling; - else this.firstChild = n.nextSibling; - if (n.nextSibling) n.nextSibling.previousSibling = n.previousSibling; - else this.lastChild = n.previousSibling; - delete n.nextSibling; - delete n.previousSibling; - delete n.parentNode; - return n; -}; - -/** - * Appends the specified child node to this node. If the specified child is - * already part of the DOM, the child is first removed before being added to - * this node. - * - * @returns {pv.Dom.Node} the appended child. - */ -pv.Dom.Node.prototype.appendChild = function(n) { - if (n.parentNode) n.parentNode.removeChild(n); - n.parentNode = this; - n.previousSibling = this.lastChild; - if (this.lastChild) this.lastChild.nextSibling = n; - else this.firstChild = n; - this.lastChild = n; - this.childNodes.push(n); - return n; -}; - -/** - * Inserts the specified child n before the given reference child - * r of this node. If r is null, this method is equivalent to - * {@link #appendChild}. If n is already part of the DOM, it is first - * removed before being inserted. - * - * @throws Error if r is non-null and not a child of this node. - * @returns {pv.Dom.Node} the inserted child. - */ -pv.Dom.Node.prototype.insertBefore = function(n, r) { - if (!r) return this.appendChild(n); - var i = this.childNodes.indexOf(r); - if (i == -1) throw new Error("child not found"); - if (n.parentNode) n.parentNode.removeChild(n); - n.parentNode = this; - n.nextSibling = r; - n.previousSibling = r.previousSibling; - if (r.previousSibling) { - r.previousSibling.nextSibling = n; - } else { - if (r == this.lastChild) this.lastChild = n; - this.firstChild = n; - } - this.childNodes.splice(i, 0, n); - return n; -}; - -/** - * Replaces the specified child r of this node with the node n. If - * n is already part of the DOM, it is first removed before being added. - * - * @throws Error if r is not a child of this node. - */ -pv.Dom.Node.prototype.replaceChild = function(n, r) { - var i = this.childNodes.indexOf(r); - if (i == -1) throw new Error("child not found"); - if (n.parentNode) n.parentNode.removeChild(n); - n.parentNode = this; - n.nextSibling = r.nextSibling; - n.previousSibling = r.previousSibling; - if (r.previousSibling) r.previousSibling.nextSibling = n; - else this.firstChild = n; - if (r.nextSibling) r.nextSibling.previousSibling = n; - else this.lastChild = n; - this.childNodes[i] = n; - return r; -}; - -/** - * Visits each node in the tree in preorder traversal, applying the specified - * function f. The arguments to the function are:

    - * - *
  1. The current node. - *
  2. The current depth, starting at 0 for the root node.
- * - * @param {function} f a function to apply to each node. - */ -pv.Dom.Node.prototype.visitBefore = function(f) { - function visit(n, i) { - f(n, i); - for (var c = n.firstChild; c; c = c.nextSibling) { - visit(c, i + 1); - } - } - visit(this, 0); -}; - -/** - * Visits each node in the tree in postorder traversal, applying the specified - * function f. The arguments to the function are:
    - * - *
  1. The current node. - *
  2. The current depth, starting at 0 for the root node.
- * - * @param {function} f a function to apply to each node. - */ -pv.Dom.Node.prototype.visitAfter = function(f) { - function visit(n, i) { - for (var c = n.firstChild; c; c = c.nextSibling) { - visit(c, i + 1); - } - f(n, i); - } - visit(this, 0); -}; - -/** - * Sorts child nodes of this node, and all descendent nodes recursively, using - * the specified comparator function f. The comparator function is - * passed two nodes to compare. - * - *

Note: during the sort operation, the comparator function should not rely - * on the tree being well-formed; the values of previousSibling and - * nextSibling for the nodes being compared are not defined during the - * sort operation. - * - * @param {function} f a comparator function. - * @returns this. - */ -pv.Dom.Node.prototype.sort = function(f) { - if (this.firstChild) { - this.childNodes.sort(f); - var p = this.firstChild = this.childNodes[0], c; - delete p.previousSibling; - for (var i = 1; i < this.childNodes.length; i++) { - p.sort(f); - c = this.childNodes[i]; - c.previousSibling = p; - p = p.nextSibling = c; - } - this.lastChild = p; - delete p.nextSibling; - p.sort(f); - } - return this; -}; - -/** - * Reverses all sibling nodes. - * - * @returns this. - */ -pv.Dom.Node.prototype.reverse = function() { - var childNodes = []; - this.visitAfter(function(n) { - while (n.lastChild) childNodes.push(n.removeChild(n.lastChild)); - for (var c; c = childNodes.pop();) n.insertBefore(c, n.firstChild); - }); - return this; -}; - -/** Returns all descendants of this node in preorder traversal. */ -pv.Dom.Node.prototype.nodes = function() { - var array = []; - - /** @private */ - function flatten(node) { - array.push(node); - node.childNodes.forEach(flatten); - } - - flatten(this, array); - return array; -}; - -/** - * Toggles the child nodes of this node. If this node is not yet toggled, this - * method removes all child nodes and appends them to a new toggled - * array attribute on this node. Otherwise, if this node is toggled, this method - * re-adds all toggled child nodes and deletes the toggled attribute. - * - *

This method has no effect if the node has no child nodes. - * - * @param {boolean} [recursive] whether the toggle should apply to descendants. - */ -pv.Dom.Node.prototype.toggle = function(recursive) { - if (recursive) return this.toggled - ? this.visitBefore(function(n) { if (n.toggled) n.toggle(); }) - : this.visitAfter(function(n) { if (!n.toggled) n.toggle(); }); - var n = this; - if (n.toggled) { - for (var c; c = n.toggled.pop();) n.appendChild(c); - delete n.toggled; - } else if (n.lastChild) { - n.toggled = []; - while (n.lastChild) n.toggled.push(n.removeChild(n.lastChild)); - } -}; - -/** - * Given a flat array of values, returns a simple DOM with each value wrapped by - * a node that is a child of the root node. - * - * @param {array} values. - * @returns {array} nodes. - */ -pv.nodes = function(values) { - var root = new pv.Dom.Node(); - for (var i = 0; i < values.length; i++) { - root.appendChild(new pv.Dom.Node(values[i])); - } - return root.nodes(); -}; -/** - * Returns a {@link pv.Tree} operator for the specified array. This is a - * convenience factory method, equivalent to new pv.Tree(array). - * - * @see pv.Tree - * @param {array} array an array from which to construct a tree. - * @returns {pv.Tree} a tree operator for the specified array. - */ -pv.tree = function(array) { - return new pv.Tree(array); -}; - -/** - * Constructs a tree operator for the specified array. This constructor should - * not be invoked directly; use {@link pv.tree} instead. - * - * @class Represents a tree operator for the specified array. The tree operator - * allows a hierarchical map to be constructed from an array; it is similar to - * the {@link pv.Nest} operator, except the hierarchy is derived dynamically - * from the array elements. - * - *

For example, given an array of size information for ActionScript classes: - * - *

{ name: "flare.flex.FlareVis", size: 4116 },
- * { name: "flare.physics.DragForce", size: 1082 },
- * { name: "flare.physics.GravityForce", size: 1336 }, ...
- * - * To facilitate visualization, it may be useful to nest the elements by their - * package hierarchy: - * - *
var tree = pv.tree(classes)
- *     .keys(function(d) d.name.split("."))
- *     .map();
- * - * The resulting tree is: - * - *
{ flare: {
- *     flex: {
- *       FlareVis: {
- *         name: "flare.flex.FlareVis",
- *         size: 4116 } },
- *     physics: {
- *       DragForce: {
- *         name: "flare.physics.DragForce",
- *         size: 1082 },
- *       GravityForce: {
- *         name: "flare.physics.GravityForce",
- *         size: 1336 } },
- *     ... } }
- * - * By specifying a value function, - * - *
var tree = pv.tree(classes)
- *     .keys(function(d) d.name.split("."))
- *     .value(function(d) d.size)
- *     .map();
- * - * we can further eliminate redundant data: - * - *
{ flare: {
- *     flex: {
- *       FlareVis: 4116 },
- *     physics: {
- *       DragForce: 1082,
- *       GravityForce: 1336 },
- *   ... } }
- * - * For visualizations with large data sets, performance improvements may be seen - * by storing the data in a tree format, and then flattening it into an array at - * runtime with {@link pv.Flatten}. - * - * @param {array} array an array from which to construct a tree. - */ -pv.Tree = function(array) { - this.array = array; -}; - -/** - * Assigns a keys function to this operator; required. The keys function - * returns an array of strings for each element in the associated - * array; these keys determine how the elements are nested in the tree. The - * returned keys should be unique for each element in the array; otherwise, the - * behavior of this operator is undefined. - * - * @param {function} k the keys function. - * @returns {pv.Tree} this. - */ -pv.Tree.prototype.keys = function(k) { - this.k = k; - return this; -}; - -/** - * Assigns a value function to this operator; optional. The value - * function specifies an optional transformation of the element in the array - * before it is inserted into the map. If no value function is specified, it is - * equivalent to using the identity function. - * - * @param {function} k the value function. - * @returns {pv.Tree} this. - */ -pv.Tree.prototype.value = function(v) { - this.v = v; - return this; -}; - -/** - * Returns a hierarchical map of values. The hierarchy is determined by the keys - * function; the values in the map are determined by the value function. - * - * @returns a hierarchical map of values. - */ -pv.Tree.prototype.map = function() { - var map = {}, o = {}; - for (var i = 0; i < this.array.length; i++) { - o.index = i; - var value = this.array[i], keys = this.k.call(o, value), node = map; - for (var j = 0; j < keys.length - 1; j++) { - node = node[keys[j]] || (node[keys[j]] = {}); - } - node[keys[j]] = this.v ? this.v.call(o, value) : value; - } - return map; -}; -/** - * Returns a {@link pv.Nest} operator for the specified array. This is a - * convenience factory method, equivalent to new pv.Nest(array). - * - * @see pv.Nest - * @param {array} array an array of elements to nest. - * @returns {pv.Nest} a nest operator for the specified array. - */ -pv.nest = function(array) { - return new pv.Nest(array); -}; - -/** - * Constructs a nest operator for the specified array. This constructor should - * not be invoked directly; use {@link pv.nest} instead. - * - * @class Represents a {@link Nest} operator for the specified array. Nesting - * allows elements in an array to be grouped into a hierarchical tree - * structure. The levels in the tree are specified by key functions. The - * leaf nodes of the tree can be sorted by value, while the internal nodes can - * be sorted by key. Finally, the tree can be returned either has a - * multidimensional array via {@link #entries}, or as a hierarchical map via - * {@link #map}. The {@link #rollup} routine similarly returns a map, collapsing - * the elements in each leaf node using a summary function. - * - *

For example, consider the following tabular data structure of Barley - * yields, from various sites in Minnesota during 1931-2: - * - *

{ yield: 27.00, variety: "Manchuria", year: 1931, site: "University Farm" },
- * { yield: 48.87, variety: "Manchuria", year: 1931, site: "Waseca" },
- * { yield: 27.43, variety: "Manchuria", year: 1931, site: "Morris" }, ...
- * - * To facilitate visualization, it may be useful to nest the elements first by - * year, and then by variety, as follows: - * - *
var nest = pv.nest(yields)
- *     .key(function(d) d.year)
- *     .key(function(d) d.variety)
- *     .entries();
- * - * This returns a nested array. Each element of the outer array is a key-values - * pair, listing the values for each distinct key: - * - *
{ key: 1931, values: [
- *   { key: "Manchuria", values: [
- *       { yield: 27.00, variety: "Manchuria", year: 1931, site: "University Farm" },
- *       { yield: 48.87, variety: "Manchuria", year: 1931, site: "Waseca" },
- *       { yield: 27.43, variety: "Manchuria", year: 1931, site: "Morris" },
- *       ...
- *     ] },
- *   { key: "Glabron", values: [
- *       { yield: 43.07, variety: "Glabron", year: 1931, site: "University Farm" },
- *       { yield: 55.20, variety: "Glabron", year: 1931, site: "Waseca" },
- *       ...
- *     ] },
- *   ] },
- * { key: 1932, values: ... }
- * - * Further details, including sorting and rollup, is provided below on the - * corresponding methods. - * - * @param {array} array an array of elements to nest. - */ -pv.Nest = function(array) { - this.array = array; - this.keys = []; -}; - -/** - * Nests using the specified key function. Multiple keys may be added to the - * nest; the array elements will be nested in the order keys are specified. - * - * @param {function} key a key function; must return a string or suitable map - * key. - * @returns {pv.Nest} this. - */ -pv.Nest.prototype.key = function(key) { - this.keys.push(key); - return this; -}; - -/** - * Sorts the previously-added keys. The natural sort order is used by default - * (see {@link pv.naturalOrder}); if an alternative order is desired, - * order should be a comparator function. If this method is not called - * (i.e., keys are unsorted), keys will appear in the order they appear - * in the underlying elements array. For example, - * - *
pv.nest(yields)
- *     .key(function(d) d.year)
- *     .key(function(d) d.variety)
- *     .sortKeys()
- *     .entries()
- * - * groups yield data by year, then variety, and sorts the variety groups - * lexicographically (since the variety attribute is a string). - * - *

Key sort order is only used in conjunction with {@link #entries}, which - * returns an array of key-values pairs. If the nest is used to construct a - * {@link #map} instead, keys are unsorted. - * - * @param {function} [order] an optional comparator function. - * @returns {pv.Nest} this. - */ -pv.Nest.prototype.sortKeys = function(order) { - this.keys[this.keys.length - 1].order = order || pv.naturalOrder; - return this; -}; - -/** - * Sorts the leaf values. The natural sort order is used by default (see - * {@link pv.naturalOrder}); if an alternative order is desired, order - * should be a comparator function. If this method is not called (i.e., values - * are unsorted), values will appear in the order they appear in the - * underlying elements array. For example, - * - *

pv.nest(yields)
- *     .key(function(d) d.year)
- *     .key(function(d) d.variety)
- *     .sortValues(function(a, b) a.yield - b.yield)
- *     .entries()
- * - * groups yield data by year, then variety, and sorts the values for each - * variety group by yield. - * - *

Value sort order, unlike keys, applies to both {@link #entries} and - * {@link #map}. It has no effect on {@link #rollup}. - * - * @param {function} [order] an optional comparator function. - * @returns {pv.Nest} this. - */ -pv.Nest.prototype.sortValues = function(order) { - this.order = order || pv.naturalOrder; - return this; -}; - -/** - * Returns a hierarchical map of values. Each key adds one level to the - * hierarchy. With only a single key, the returned map will have a key for each - * distinct value of the key function; the correspond value with be an array of - * elements with that key value. If a second key is added, this will be a nested - * map. For example: - * - *

pv.nest(yields)
- *     .key(function(d) d.variety)
- *     .key(function(d) d.site)
- *     .map()
- * - * returns a map m such that m[variety][site] is an array, a subset of - * yields, with each element having the given variety and site. - * - * @returns a hierarchical map of values. - */ -pv.Nest.prototype.map = function() { - var map = {}, values = []; - - /* Build the map. */ - for (var i, j = 0; j < this.array.length; j++) { - var x = this.array[j]; - var m = map; - for (i = 0; i < this.keys.length - 1; i++) { - var k = this.keys[i](x); - if (!m[k]) m[k] = {}; - m = m[k]; - } - k = this.keys[i](x); - if (!m[k]) { - var a = []; - values.push(a); - m[k] = a; - } - m[k].push(x); - } - - /* Sort each leaf array. */ - if (this.order) { - for (var i = 0; i < values.length; i++) { - values[i].sort(this.order); - } - } - - return map; -}; - -/** - * Returns a hierarchical nested array. This method is similar to - * {@link pv.entries}, but works recursively on the entire hierarchy. Rather - * than returning a map like {@link #map}, this method returns a nested - * array. Each element of the array has a key and values - * field. For leaf nodes, the values array will be a subset of the - * underlying elements array; for non-leaf nodes, the values array will - * contain more key-values pairs. - * - *

For an example usage, see the {@link Nest} constructor. - * - * @returns a hierarchical nested array. - */ -pv.Nest.prototype.entries = function() { - - /** Recursively extracts the entries for the given map. */ - function entries(map) { - var array = []; - for (var k in map) { - var v = map[k]; - array.push({ key: k, values: (v instanceof Array) ? v : entries(v) }); - }; - return array; - } - - /** Recursively sorts the values for the given key-values array. */ - function sort(array, i) { - var o = this.keys[i].order; - if (o) array.sort(function(a, b) { return o(a.key, b.key); }); - if (++i < this.keys.length) { - for (var j = 0; j < array.length; j++) { - sort.call(this, array[j].values, i); - } - } - return array; - } - - return sort.call(this, entries(this.map()), 0); -}; - -/** - * Returns a rollup map. The behavior of this method is the same as - * {@link #map}, except that the leaf values are replaced with the return value - * of the specified rollup function f. For example, - * - *

pv.nest(yields)
- *      .key(function(d) d.site)
- *      .rollup(function(v) pv.median(v, function(d) d.yield))
- * - * first groups yield data by site, and then returns a map from site to median - * yield for the given site. - * - * @see #map - * @param {function} f a rollup function. - * @returns a hierarchical map, with the leaf values computed by f. - */ -pv.Nest.prototype.rollup = function(f) { - - /** Recursively descends to the leaf nodes (arrays) and does rollup. */ - function rollup(map) { - for (var key in map) { - var value = map[key]; - if (value instanceof Array) { - map[key] = f(value); - } else { - rollup(value); - } - } - return map; - } - - return rollup(this.map()); -}; -/** - * Returns a {@link pv.Flatten} operator for the specified map. This is a - * convenience factory method, equivalent to new pv.Flatten(map). - * - * @see pv.Flatten - * @param map a map to flatten. - * @returns {pv.Flatten} a flatten operator for the specified map. - */ -pv.flatten = function(map) { - return new pv.Flatten(map); -}; - -/** - * Constructs a flatten operator for the specified map. This constructor should - * not be invoked directly; use {@link pv.flatten} instead. - * - * @class Represents a flatten operator for the specified array. Flattening - * allows hierarchical maps to be flattened into an array. The levels in the - * input tree are specified by key functions. - * - *

For example, consider the following hierarchical data structure of Barley - * yields, from various sites in Minnesota during 1931-2: - * - *

{ 1931: {
- *     Manchuria: {
- *       "University Farm": 27.00,
- *       "Waseca": 48.87,
- *       "Morris": 27.43,
- *       ... },
- *     Glabron: {
- *       "University Farm": 43.07,
- *       "Waseca": 55.20,
- *       ... } },
- *   1932: {
- *     ... } }
- * - * To facilitate visualization, it may be useful to flatten the tree into a - * tabular array: - * - *
var array = pv.flatten(yields)
- *     .key("year")
- *     .key("variety")
- *     .key("site")
- *     .key("yield")
- *     .array();
- * - * This returns an array of object elements. Each element in the array has - * attributes corresponding to this flatten operator's keys: - * - *
{ site: "University Farm", variety: "Manchuria", year: 1931, yield: 27 },
- * { site: "Waseca", variety: "Manchuria", year: 1931, yield: 48.87 },
- * { site: "Morris", variety: "Manchuria", year: 1931, yield: 27.43 },
- * { site: "University Farm", variety: "Glabron", year: 1931, yield: 43.07 },
- * { site: "Waseca", variety: "Glabron", year: 1931, yield: 55.2 }, ...
- * - *

The flatten operator is roughly the inverse of the {@link pv.Nest} and - * {@link pv.Tree} operators. - * - * @param map a map to flatten. - */ -pv.Flatten = function(map) { - this.map = map; - this.keys = []; -}; - -/** - * Flattens using the specified key function. Multiple keys may be added to the - * flatten; the tiers of the underlying tree must correspond to the specified - * keys, in order. The order of the returned array is undefined; however, you - * can easily sort it. - * - * @param {string} key the key name. - * @param {function} [f] an optional value map function. - * @returns {pv.Nest} this. - */ -pv.Flatten.prototype.key = function(key, f) { - this.keys.push({name: key, value: f}); - delete this.$leaf; - return this; -}; - -/** - * Flattens using the specified leaf function. This is an alternative to - * specifying an explicit set of keys; the tiers of the underlying tree will be - * determined dynamically by recursing on the values, and the resulting keys - * will be stored in the entries keys attribute. The leaf function must - * return true for leaves, and false for internal nodes. - * - * @param {function} f a leaf function. - * @returns {pv.Nest} this. - */ -pv.Flatten.prototype.leaf = function(f) { - this.keys.length = 0; - this.$leaf = f; - return this; -}; - -/** - * Returns the flattened array. Each entry in the array is an object; each - * object has attributes corresponding to this flatten operator's keys. - * - * @returns an array of elements from the flattened map. - */ -pv.Flatten.prototype.array = function() { - var entries = [], stack = [], keys = this.keys, leaf = this.$leaf; - - /* Recursively visit using the leaf function. */ - if (leaf) { - function recurse(value, i) { - if (leaf(value)) { - entries.push({keys: stack.slice(), value: value}); - } else { - for (var key in value) { - stack.push(key); - recurse(value[key], i + 1); - stack.pop(); - } - } - } - recurse(this.map, 0); - return entries; - } - - /* Recursively visits the specified value. */ - function visit(value, i) { - if (i < keys.length - 1) { - for (var key in value) { - stack.push(key); - visit(value[key], i + 1); - stack.pop(); - } - } else { - entries.push(stack.concat(value)); - } - } - - visit(this.map, 0); - return entries.map(function(stack) { - var m = {}; - for (var i = 0; i < keys.length; i++) { - var k = keys[i], v = stack[i]; - m[k.name] = k.value ? k.value.call(null, v) : v; - } - return m; - }); -}; -/** - * Returns a {@link pv.Vector} for the specified x and y - * coordinate. This is a convenience factory method, equivalent to new - * pv.Vector(x, y). - * - * @see pv.Vector - * @param {number} x the x coordinate. - * @param {number} y the y coordinate. - * @returns {pv.Vector} a vector for the specified coordinates. - */ -pv.vector = function(x, y) { - return new pv.Vector(x, y); -}; - -/** - * Constructs a {@link pv.Vector} for the specified x and y - * coordinate. This constructor should not be invoked directly; use - * {@link pv.vector} instead. - * - * @class Represents a two-dimensional vector; a 2-tuple ⟨x, - * y⟩. The intent of this class is to simplify vector math. Note that - * in performance-sensitive cases it may be more efficient to represent 2D - * vectors as simple objects with x and y attributes, rather - * than using instances of this class. - * - * @param {number} x the x coordinate. - * @param {number} y the y coordinate. - */ -pv.Vector = function(x, y) { - this.x = x; - this.y = y; -}; - -/** - * Returns a vector perpendicular to this vector: ⟨-y, x⟩. - * - * @returns {pv.Vector} a perpendicular vector. - */ -pv.Vector.prototype.perp = function() { - return new pv.Vector(-this.y, this.x); -}; - -/** - * Returns a normalized copy of this vector: a vector with the same direction, - * but unit length. If this vector has zero length this method returns a copy of - * this vector. - * - * @returns {pv.Vector} a unit vector. - */ -pv.Vector.prototype.norm = function() { - var l = this.length(); - return this.times(l ? (1 / l) : 1); -}; - -/** - * Returns the magnitude of this vector, defined as sqrt(x * x + y * y). - * - * @returns {number} a length. - */ -pv.Vector.prototype.length = function() { - return Math.sqrt(this.x * this.x + this.y * this.y); -}; - -/** - * Returns a scaled copy of this vector: ⟨x * k, y * k⟩. - * To perform the equivalent divide operation, use 1 / k. - * - * @param {number} k the scale factor. - * @returns {pv.Vector} a scaled vector. - */ -pv.Vector.prototype.times = function(k) { - return new pv.Vector(this.x * k, this.y * k); -}; - -/** - * Returns this vector plus the vector v: ⟨x + v.x, y + - * v.y⟩. If only one argument is specified, it is interpreted as the - * vector v. - * - * @param {number} x the x coordinate to add. - * @param {number} y the y coordinate to add. - * @returns {pv.Vector} a new vector. - */ -pv.Vector.prototype.plus = function(x, y) { - return (arguments.length == 1) - ? new pv.Vector(this.x + x.x, this.y + x.y) - : new pv.Vector(this.x + x, this.y + y); -}; - -/** - * Returns this vector minus the vector v: ⟨x - v.x, y - - * v.y⟩. If only one argument is specified, it is interpreted as the - * vector v. - * - * @param {number} x the x coordinate to subtract. - * @param {number} y the y coordinate to subtract. - * @returns {pv.Vector} a new vector. - */ -pv.Vector.prototype.minus = function(x, y) { - return (arguments.length == 1) - ? new pv.Vector(this.x - x.x, this.y - x.y) - : new pv.Vector(this.x - x, this.y - y); -}; - -/** - * Returns the dot product of this vector and the vector v: x * v.x + - * y * v.y. If only one argument is specified, it is interpreted as the - * vector v. - * - * @param {number} x the x coordinate to dot. - * @param {number} y the y coordinate to dot. - * @returns {number} a dot product. - */ -pv.Vector.prototype.dot = function(x, y) { - return (arguments.length == 1) - ? this.x * x.x + this.y * x.y - : this.x * x + this.y * y; -}; -/** - * Returns a new identity transform. - * - * @class Represents a transformation matrix. The transformation matrix is - * limited to expressing translate and uniform scale transforms only; shearing, - * rotation, general affine, and other transforms are not supported. - * - *

The methods on this class treat the transform as immutable, returning a - * copy of the transformation matrix with the specified transform applied. Note, - * alternatively, that the matrix fields can be get and set directly. - */ -pv.Transform = function() {}; -pv.Transform.prototype = {k: 1, x: 0, y: 0}; - -/** - * The scale magnitude; defaults to 1. - * - * @type number - * @name pv.Transform.prototype.k - */ - -/** - * The x-offset; defaults to 0. - * - * @type number - * @name pv.Transform.prototype.x - */ - -/** - * The y-offset; defaults to 0. - * - * @type number - * @name pv.Transform.prototype.y - */ - -/** - * @private The identity transform. - * - * @type pv.Transform - */ -pv.Transform.identity = new pv.Transform(); - -// k 0 x 1 0 a k 0 ka+x -// 0 k y * 0 1 b = 0 k kb+y -// 0 0 1 0 0 1 0 0 1 - -/** - * Returns a translated copy of this transformation matrix. - * - * @param {number} x the x-offset. - * @param {number} y the y-offset. - * @returns {pv.Transform} the translated transformation matrix. - */ -pv.Transform.prototype.translate = function(x, y) { - var v = new pv.Transform(); - v.k = this.k; - v.x = this.k * x + this.x; - v.y = this.k * y + this.y; - return v; -}; - -// k 0 x d 0 0 kd 0 x -// 0 k y * 0 d 0 = 0 kd y -// 0 0 1 0 0 1 0 0 1 - -/** - * Returns a scaled copy of this transformation matrix. - * - * @param {number} k - * @returns {pv.Transform} the scaled transformation matrix. - */ -pv.Transform.prototype.scale = function(k) { - var v = new pv.Transform(); - v.k = this.k * k; - v.x = this.x; - v.y = this.y; - return v; -}; - -/** - * Returns the inverse of this transformation matrix. - * - * @returns {pv.Transform} the inverted transformation matrix. - */ -pv.Transform.prototype.invert = function() { - var v = new pv.Transform(), k = 1 / this.k; - v.k = k; - v.x = -this.x * k; - v.y = -this.y * k; - return v; -}; - -// k 0 x d 0 a kd 0 ka+x -// 0 k y * 0 d b = 0 kd kb+y -// 0 0 1 0 0 1 0 0 1 - -/** - * Returns this matrix post-multiplied by the specified matrix m. - * - * @param {pv.Transform} m - * @returns {pv.Transform} the post-multiplied transformation matrix. - */ -pv.Transform.prototype.times = function(m) { - var v = new pv.Transform(); - v.k = this.k * m.k; - v.x = this.k * m.x + this.x; - v.y = this.k * m.y + this.y; - return v; -}; -/** - * Abstract; see the various scale implementations. - * - * @class Represents a scale; a function that performs a transformation from - * data domain to visual range. For quantitative and quantile scales, the domain - * is expressed as numbers; for ordinal scales, the domain is expressed as - * strings (or equivalently objects with unique string representations). The - * "visual range" may correspond to pixel space, colors, font sizes, and the - * like. - * - *

Note that scales are functions, and thus can be used as properties - * directly, assuming that the data associated with a mark is a number. While - * this is convenient for single-use scales, frequently it is desirable to - * define scales globally: - * - *

var y = pv.Scale.linear(0, 100).range(0, 640);
- * - * The y scale can now be equivalently referenced within a property: - * - *
    .height(function(d) y(d))
- * - * Alternatively, if the data are not simple numbers, the appropriate value can - * be passed to the y scale (e.g., d.foo). The {@link #by} - * method similarly allows the data to be mapped to a numeric value before - * performing the linear transformation. - * - * @see pv.Scale.quantitative - * @see pv.Scale.quantile - * @see pv.Scale.ordinal - * @extends function - */ -pv.Scale = function() {}; - -/** - * @private Returns a function that interpolators from the start value to the - * end value, given a parameter t in [0, 1]. - * - * @param start the start value. - * @param end the end value. - */ -pv.Scale.interpolator = function(start, end) { - if (typeof start == "number") { - return function(t) { - return t * (end - start) + start; - }; - } - - /* For now, assume color. */ - start = pv.color(start).rgb(); - end = pv.color(end).rgb(); - return function(t) { - var a = start.a * (1 - t) + end.a * t; - if (a < 1e-5) a = 0; // avoid scientific notation - return (start.a == 0) ? pv.rgb(end.r, end.g, end.b, a) - : ((end.a == 0) ? pv.rgb(start.r, start.g, start.b, a) - : pv.rgb( - Math.round(start.r * (1 - t) + end.r * t), - Math.round(start.g * (1 - t) + end.g * t), - Math.round(start.b * (1 - t) + end.b * t), a)); - }; -}; - -/** - * Returns a view of this scale by the specified accessor function f. - * Given a scale y, y.by(function(d) d.foo) is equivalent to - * function(d) y(d.foo). - * - *

This method is provided for convenience, such that scales can be - * succinctly defined inline. For example, given an array of data elements that - * have a score attribute with the domain [0, 1], the height property - * could be specified as: - * - *

    .height(pv.Scale.linear().range(0, 480).by(function(d) d.score))
- * - * This is equivalent to: - * - *
    .height(function(d) d.score * 480)
- * - * This method should be used judiciously; it is typically more clear to invoke - * the scale directly, passing in the value to be scaled. - * - * @function - * @name pv.Scale.prototype.by - * @param {function} f an accessor function. - * @returns {pv.Scale} a view of this scale by the specified accessor function. - */ -/** - * Returns a default quantitative, linear, scale for the specified domain. The - * arguments to this constructor are optional, and equivalent to calling - * {@link #domain}. The default domain and range are [0,1]. - * - *

This constructor is typically not used directly; see one of the - * quantitative scale implementations instead. - * - * @class Represents an abstract quantitative scale; a function that performs a - * numeric transformation. This class is typically not used directly; see one of - * the quantitative scale implementations (linear, log, root, etc.) - * instead. A quantitative - * scale represents a 1-dimensional transformation from a numeric domain of - * input data [d0, d1] to a numeric range of - * pixels [r0, r1]. In addition to - * readability, scales offer several useful features: - * - *

1. The range can be expressed in colors, rather than pixels. For example: - * - *

    .fillStyle(pv.Scale.linear(0, 100).range("red", "green"))
- * - * will fill the marks "red" on an input value of 0, "green" on an input value - * of 100, and some color in-between for intermediate values. - * - *

2. The domain and range can be subdivided for a non-uniform - * transformation. For example, you may want a diverging color scale that is - * increasingly red for negative values, and increasingly green for positive - * values: - * - *

    .fillStyle(pv.Scale.linear(-1, 0, 1).range("red", "white", "green"))
- * - * The domain can be specified as a series of n monotonically-increasing - * values; the range must also be specified as n values, resulting in - * n - 1 contiguous linear scales. - * - *

3. Quantitative scales can be inverted for interaction. The - * {@link #invert} method takes a value in the output range, and returns the - * corresponding value in the input domain. This is frequently used to convert - * the mouse location (see {@link pv.Mark#mouse}) to a value in the input - * domain. Note that inversion is only supported for numeric ranges, and not - * colors. - * - *

4. A scale can be queried for reasonable "tick" values. The {@link #ticks} - * method provides a convenient way to get a series of evenly-spaced rounded - * values in the input domain. Frequently these are used in conjunction with - * {@link pv.Rule} to display tick marks or grid lines. - * - *

5. A scale can be "niced" to extend the domain to suitable rounded - * numbers. If the minimum and maximum of the domain are messy because they are - * derived from data, you can use {@link #nice} to round these values down and - * up to even numbers. - * - * @param {number...} domain... optional domain values. - * @see pv.Scale.linear - * @see pv.Scale.log - * @see pv.Scale.root - * @extends pv.Scale - */ -pv.Scale.quantitative = function() { - var d = [0, 1], // default domain - l = [0, 1], // default transformed domain - r = [0, 1], // default range - i = [pv.identity], // default interpolators - type = Number, // default type - n = false, // whether the domain is negative - f = pv.identity, // default forward transform - g = pv.identity, // default inverse transform - tickFormat = String; // default tick formatting function - - /** @private */ - function newDate(x) { - return new Date(x); - } - - /** @private */ - function scale(x) { - var j = pv.search(d, x); - if (j < 0) j = -j - 2; - j = Math.max(0, Math.min(i.length - 1, j)); - return i[j]((f(x) - l[j]) / (l[j + 1] - l[j])); - } - - /** @private */ - scale.transform = function(forward, inverse) { - /** @ignore */ f = function(x) { return n ? -forward(-x) : forward(x); }; - /** @ignore */ g = function(y) { return n ? -inverse(-y) : inverse(y); }; - l = d.map(f); - return this; - }; - - /** - * Sets or gets the input domain. This method can be invoked several ways: - * - *

1. domain(min, ..., max) - * - *

Specifying the domain as a series of numbers is the most explicit and - * recommended approach. Most commonly, two numbers are specified: the minimum - * and maximum value. However, for a diverging scale, or other subdivided - * non-uniform scales, multiple values can be specified. Values can be derived - * from data using {@link pv.min} and {@link pv.max}. For example: - * - *

    .domain(0, pv.max(array))
- * - * An alternative method for deriving minimum and maximum values from data - * follows. - * - *

2. domain(array, minf, maxf) - * - *

When both the minimum and maximum value are derived from data, the - * arguments to the domain method can be specified as the array of - * data, followed by zero, one or two accessor functions. For example, if the - * array of data is just an array of numbers: - * - *

    .domain(array)
- * - * On the other hand, if the array elements are objects representing stock - * values per day, and the domain should consider the stock's daily low and - * daily high: - * - *
    .domain(array, function(d) d.low, function(d) d.high)
- * - * The first method of setting the domain is preferred because it is more - * explicit; setting the domain using this second method should be used only - * if brevity is required. - * - *

3. domain() - * - *

Invoking the domain method with no arguments returns the - * current domain as an array of numbers. - * - * @function - * @name pv.Scale.quantitative.prototype.domain - * @param {number...} domain... domain values. - * @returns {pv.Scale.quantitative} this, or the current domain. - */ - scale.domain = function(array, min, max) { - if (arguments.length) { - var o; // the object we use to infer the domain type - if (array instanceof Array) { - if (arguments.length < 2) min = pv.identity; - if (arguments.length < 3) max = min; - o = array.length && min(array[0]); - d = array.length ? [pv.min(array, min), pv.max(array, max)] : []; - } else { - o = array; - d = Array.prototype.slice.call(arguments).map(Number); - } - if (!d.length) d = [-Infinity, Infinity]; - else if (d.length == 1) d = [d[0], d[0]]; - n = (d[0] || d[d.length - 1]) < 0; - l = d.map(f); - type = (o instanceof Date) ? newDate : Number; - return this; - } - return d.map(type); - }; - - /** - * Sets or gets the output range. This method can be invoked several ways: - * - *

1. range(min, ..., max) - * - *

The range may be specified as a series of numbers or colors. Most - * commonly, two numbers are specified: the minimum and maximum pixel values. - * For a color scale, values may be specified as {@link pv.Color}s or - * equivalent strings. For a diverging scale, or other subdivided non-uniform - * scales, multiple values can be specified. For example: - * - *

    .range("red", "white", "green")
- * - *

Currently, only numbers and colors are supported as range values. The - * number of range values must exactly match the number of domain values, or - * the behavior of the scale is undefined. - * - *

2. range() - * - *

Invoking the range method with no arguments returns the current - * range as an array of numbers or colors. - * - * @function - * @name pv.Scale.quantitative.prototype.range - * @param {...} range... range values. - * @returns {pv.Scale.quantitative} this, or the current range. - */ - scale.range = function() { - if (arguments.length) { - r = Array.prototype.slice.call(arguments); - if (!r.length) r = [-Infinity, Infinity]; - else if (r.length == 1) r = [r[0], r[0]]; - i = []; - for (var j = 0; j < r.length - 1; j++) { - i.push(pv.Scale.interpolator(r[j], r[j + 1])); - } - return this; - } - return r; - }; - - /** - * Inverts the specified value in the output range, returning the - * corresponding value in the input domain. This is frequently used to convert - * the mouse location (see {@link pv.Mark#mouse}) to a value in the input - * domain. Inversion is only supported for numeric ranges, and not colors. - * - *

Note that this method does not do any rounding or bounds checking. If - * the input domain is discrete (e.g., an array index), the returned value - * should be rounded. If the specified y value is outside the range, - * the returned value may be equivalently outside the input domain. - * - * @function - * @name pv.Scale.quantitative.prototype.invert - * @param {number} y a value in the output range (a pixel location). - * @returns {number} a value in the input domain. - */ - scale.invert = function(y) { - var j = pv.search(r, y); - if (j < 0) j = -j - 2; - j = Math.max(0, Math.min(i.length - 1, j)); - return type(g(l[j] + (y - r[j]) / (r[j + 1] - r[j]) * (l[j + 1] - l[j]))); - }; - - /** - * Returns an array of evenly-spaced, suitably-rounded values in the input - * domain. This method attempts to return between 5 and 10 tick values. These - * values are frequently used in conjunction with {@link pv.Rule} to display - * tick marks or grid lines. - * - * @function - * @name pv.Scale.quantitative.prototype.ticks - * @param {number} [m] optional number of desired ticks. - * @returns {number[]} an array input domain values to use as ticks. - */ - scale.ticks = function(m) { - var start = d[0], - end = d[d.length - 1], - reverse = end < start, - min = reverse ? end : start, - max = reverse ? start : end, - span = max - min; - - /* Special case: empty, invalid or infinite span. */ - if (!span || !isFinite(span)) { - if (type == newDate) tickFormat = pv.Format.date("%x"); - return [type(min)]; - } - - /* Special case: dates. */ - if (type == newDate) { - /* Floor the date d given the precision p. */ - function floor(d, p) { - switch (p) { - case 31536e6: d.setMonth(0); - case 2592e6: d.setDate(1); - case 6048e5: if (p == 6048e5) d.setDate(d.getDate() - d.getDay()); - case 864e5: d.setHours(0); - case 36e5: d.setMinutes(0); - case 6e4: d.setSeconds(0); - case 1e3: d.setMilliseconds(0); - } - } - - var precision, format, increment, step = 1; - if (span >= 3 * 31536e6) { - precision = 31536e6; - format = "%Y"; - /** @ignore */ increment = function(d) { d.setFullYear(d.getFullYear() + step); }; - } else if (span >= 3 * 2592e6) { - precision = 2592e6; - format = "%m/%Y"; - /** @ignore */ increment = function(d) { d.setMonth(d.getMonth() + step); }; - } else if (span >= 3 * 6048e5) { - precision = 6048e5; - format = "%m/%d"; - /** @ignore */ increment = function(d) { d.setDate(d.getDate() + 7 * step); }; - } else if (span >= 3 * 864e5) { - precision = 864e5; - format = "%m/%d"; - /** @ignore */ increment = function(d) { d.setDate(d.getDate() + step); }; - } else if (span >= 3 * 36e5) { - precision = 36e5; - format = "%I:%M %p"; - /** @ignore */ increment = function(d) { d.setHours(d.getHours() + step); }; - } else if (span >= 3 * 6e4) { - precision = 6e4; - format = "%I:%M %p"; - /** @ignore */ increment = function(d) { d.setMinutes(d.getMinutes() + step); }; - } else if (span >= 3 * 1e3) { - precision = 1e3; - format = "%I:%M:%S"; - /** @ignore */ increment = function(d) { d.setSeconds(d.getSeconds() + step); }; - } else { - precision = 1; - format = "%S.%Qs"; - /** @ignore */ increment = function(d) { d.setTime(d.getTime() + step); }; - } - tickFormat = pv.Format.date(format); - - var date = new Date(min), dates = []; - floor(date, precision); - - /* If we'd generate too many ticks, skip some!. */ - var n = span / precision; - if (n > 10) { - switch (precision) { - case 36e5: { - step = (n > 20) ? 6 : 3; - date.setHours(Math.floor(date.getHours() / step) * step); - break; - } - case 2592e6: { - step = 3; // seasons - date.setMonth(Math.floor(date.getMonth() / step) * step); - break; - } - case 6e4: { - step = (n > 30) ? 15 : ((n > 15) ? 10 : 5); - date.setMinutes(Math.floor(date.getMinutes() / step) * step); - break; - } - case 1e3: { - step = (n > 90) ? 15 : ((n > 60) ? 10 : 5); - date.setSeconds(Math.floor(date.getSeconds() / step) * step); - break; - } - case 1: { - step = (n > 1000) ? 250 : ((n > 200) ? 100 : ((n > 100) ? 50 : ((n > 50) ? 25 : 5))); - date.setMilliseconds(Math.floor(date.getMilliseconds() / step) * step); - break; - } - default: { - step = pv.logCeil(n / 15, 10); - if (n / step < 2) step /= 5; - else if (n / step < 5) step /= 2; - date.setFullYear(Math.floor(date.getFullYear() / step) * step); - break; - } - } - } - - while (true) { - increment(date); - if (date > max) break; - dates.push(new Date(date)); - } - return reverse ? dates.reverse() : dates; - } - - /* Normal case: numbers. */ - if (!arguments.length) m = 10; - var step = pv.logFloor(span / m, 10), - err = m / (span / step); - if (err <= .15) step *= 10; - else if (err <= .35) step *= 5; - else if (err <= .75) step *= 2; - var start = Math.ceil(min / step) * step, - end = Math.floor(max / step) * step; - tickFormat = pv.Format.number() - .fractionDigits(Math.max(0, -Math.floor(pv.log(step, 10) + .01))); - var ticks = pv.range(start, end + step, step); - return reverse ? ticks.reverse() : ticks; - }; - - /** - * Formats the specified tick value using the appropriate precision, based on - * the step interval between tick marks. If {@link #ticks} has not been called, - * the argument is converted to a string, but no formatting is applied. - * - * @function - * @name pv.Scale.quantitative.prototype.tickFormat - * @param {number} t a tick value. - * @returns {string} a formatted tick value. - */ - scale.tickFormat = function (t) { return tickFormat(t); }; - - /** - * "Nices" this scale, extending the bounds of the input domain to - * evenly-rounded values. Nicing is useful if the domain is computed - * dynamically from data, and may be irregular. For example, given a domain of - * [0.20147987687960267, 0.996679553296417], a call to nice() might - * extend the domain to [0.2, 1]. - * - *

This method must be invoked each time after setting the domain. - * - * @function - * @name pv.Scale.quantitative.prototype.nice - * @returns {pv.Scale.quantitative} this. - */ - scale.nice = function() { - if (d.length != 2) return this; // TODO support non-uniform domains - var start = d[0], - end = d[d.length - 1], - reverse = end < start, - min = reverse ? end : start, - max = reverse ? start : end, - span = max - min; - - /* Special case: empty, invalid or infinite span. */ - if (!span || !isFinite(span)) return this; - - var step = Math.pow(10, Math.round(Math.log(span) / Math.log(10)) - 1); - d = [Math.floor(min / step) * step, Math.ceil(max / step) * step]; - if (reverse) d.reverse(); - l = d.map(f); - return this; - }; - - /** - * Returns a view of this scale by the specified accessor function f. - * Given a scale y, y.by(function(d) d.foo) is equivalent to - * function(d) y(d.foo). - * - *

This method is provided for convenience, such that scales can be - * succinctly defined inline. For example, given an array of data elements - * that have a score attribute with the domain [0, 1], the height - * property could be specified as: - * - *

    .height(pv.Scale.linear().range(0, 480).by(function(d) d.score))
- * - * This is equivalent to: - * - *
    .height(function(d) d.score * 480)
- * - * This method should be used judiciously; it is typically more clear to - * invoke the scale directly, passing in the value to be scaled. - * - * @function - * @name pv.Scale.quantitative.prototype.by - * @param {function} f an accessor function. - * @returns {pv.Scale.quantitative} a view of this scale by the specified - * accessor function. - */ - scale.by = function(f) { - function by() { return scale(f.apply(this, arguments)); } - for (var method in scale) by[method] = scale[method]; - return by; - }; - - scale.domain.apply(scale, arguments); - return scale; -}; -/** - * Returns a linear scale for the specified domain. The arguments to this - * constructor are optional, and equivalent to calling {@link #domain}. - * The default domain and range are [0,1]. - * - * @class Represents a linear scale; a function that performs a linear - * transformation. Most - * commonly, a linear scale represents a 1-dimensional linear transformation - * from a numeric domain of input data [d0, - * d1] to a numeric range of pixels [r0, - * r1]. The equation for such a scale is: - * - *
f(x) = (x - d0) / (d1 - d0) * - * (r1 - r0) + r0
- * - * For example, a linear scale from the domain [0, 100] to range [0, 640]: - * - *
f(x) = (x - 0) / (100 - 0) * (640 - 0) + 0
- * f(x) = x / 100 * 640
- * f(x) = x * 6.4
- *
- * - * Thus, saying - * - *
    .height(function(d) d * 6.4)
- * - * is identical to - * - *
    .height(pv.Scale.linear(0, 100).range(0, 640))
- * - * Note that the scale is itself a function, and thus can be used as a property - * directly, assuming that the data associated with a mark is a number. While - * this is convenient for single-use scales, frequently it is desirable to - * define scales globally: - * - *
var y = pv.Scale.linear(0, 100).range(0, 640);
- * - * The y scale can now be equivalently referenced within a property: - * - *
    .height(function(d) y(d))
- * - * Alternatively, if the data are not simple numbers, the appropriate value can - * be passed to the y scale (e.g., d.foo). The {@link #by} - * method similarly allows the data to be mapped to a numeric value before - * performing the linear transformation. - * - * @param {number...} domain... optional domain values. - * @extends pv.Scale.quantitative - */ -pv.Scale.linear = function() { - var scale = pv.Scale.quantitative(); - scale.domain.apply(scale, arguments); - return scale; -}; -/** - * Returns a log scale for the specified domain. The arguments to this - * constructor are optional, and equivalent to calling {@link #domain}. - * The default domain is [1,10] and the default range is [0,1]. - * - * @class Represents a log scale. Most commonly, a log scale - * represents a 1-dimensional log transformation from a numeric domain of input - * data [d0, d1] to a numeric range of - * pixels [r0, r1]. The equation for such a - * scale is: - * - *
f(x) = (log(x) - log(d0)) / (log(d1) - - * log(d0)) * (r1 - r0) + - * r0
- * - * where log(x) represents the zero-symmetric logarthim of x using - * the scale's associated base (default: 10, see {@link pv.logSymmetric}). For - * example, a log scale from the domain [1, 100] to range [0, 640]: - * - *
f(x) = (log(x) - log(1)) / (log(100) - log(1)) * (640 - 0) + 0
- * f(x) = log(x) / 2 * 640
- * f(x) = log(x) * 320
- *
- * - * Thus, saying - * - *
    .height(function(d) Math.log(d) * 138.974)
- * - * is equivalent to - * - *
    .height(pv.Scale.log(1, 100).range(0, 640))
- * - * Note that the scale is itself a function, and thus can be used as a property - * directly, assuming that the data associated with a mark is a number. While - * this is convenient for single-use scales, frequently it is desirable to - * define scales globally: - * - *
var y = pv.Scale.log(1, 100).range(0, 640);
- * - * The y scale can now be equivalently referenced within a property: - * - *
    .height(function(d) y(d))
- * - * Alternatively, if the data are not simple numbers, the appropriate value can - * be passed to the y scale (e.g., d.foo). The {@link #by} - * method similarly allows the data to be mapped to a numeric value before - * performing the log transformation. - * - * @param {number...} domain... optional domain values. - * @extends pv.Scale.quantitative - */ -pv.Scale.log = function() { - var scale = pv.Scale.quantitative(1, 10), - b, // logarithm base - p, // cached Math.log(b) - /** @ignore */ log = function(x) { return Math.log(x) / p; }, - /** @ignore */ pow = function(y) { return Math.pow(b, y); }; - - /** - * Returns an array of evenly-spaced, suitably-rounded values in the input - * domain. These values are frequently used in conjunction with - * {@link pv.Rule} to display tick marks or grid lines. - * - * @function - * @name pv.Scale.log.prototype.ticks - * @returns {number[]} an array input domain values to use as ticks. - */ - scale.ticks = function() { - // TODO support non-uniform domains - var d = scale.domain(), - n = d[0] < 0, - i = Math.floor(n ? -log(-d[0]) : log(d[0])), - j = Math.ceil(n ? -log(-d[1]) : log(d[1])), - ticks = []; - if (n) { - ticks.push(-pow(-i)); - for (; i++ < j;) for (var k = b - 1; k > 0; k--) ticks.push(-pow(-i) * k); - } else { - for (; i < j; i++) for (var k = 1; k < b; k++) ticks.push(pow(i) * k); - ticks.push(pow(i)); - } - for (i = 0; ticks[i] < d[0]; i++); // strip small values - for (j = ticks.length; ticks[j - 1] > d[1]; j--); // strip big values - return ticks.slice(i, j); - }; - - /** - * Formats the specified tick value using the appropriate precision, assuming - * base 10. - * - * @function - * @name pv.Scale.log.prototype.tickFormat - * @param {number} t a tick value. - * @returns {string} a formatted tick value. - */ - scale.tickFormat = function(t) { - return t.toPrecision(1); - }; - - /** - * "Nices" this scale, extending the bounds of the input domain to - * evenly-rounded values. This method uses {@link pv.logFloor} and - * {@link pv.logCeil}. Nicing is useful if the domain is computed dynamically - * from data, and may be irregular. For example, given a domain of - * [0.20147987687960267, 0.996679553296417], a call to nice() might - * extend the domain to [0.1, 1]. - * - *

This method must be invoked each time after setting the domain (and - * base). - * - * @function - * @name pv.Scale.log.prototype.nice - * @returns {pv.Scale.log} this. - */ - scale.nice = function() { - // TODO support non-uniform domains - var d = scale.domain(); - return scale.domain(pv.logFloor(d[0], b), pv.logCeil(d[1], b)); - }; - - /** - * Sets or gets the logarithm base. Defaults to 10. - * - * @function - * @name pv.Scale.log.prototype.base - * @param {number} [v] the new base. - * @returns {pv.Scale.log} this, or the current base. - */ - scale.base = function(v) { - if (arguments.length) { - b = Number(v); - p = Math.log(b); - scale.transform(log, pow); // update transformed domain - return this; - } - return b; - }; - - scale.domain.apply(scale, arguments); - return scale.base(10); -}; -/** - * Returns a root scale for the specified domain. The arguments to this - * constructor are optional, and equivalent to calling {@link #domain}. - * The default domain and range are [0,1]. - * - * @class Represents a root scale; a function that performs a power - * transformation. Most - * commonly, a root scale represents a 1-dimensional root transformation from a - * numeric domain of input data [d0, d1] to - * a numeric range of pixels [r0, r1]. - * - *

Note that the scale is itself a function, and thus can be used as a - * property directly, assuming that the data associated with a mark is a - * number. While this is convenient for single-use scales, frequently it is - * desirable to define scales globally: - * - *

var y = pv.Scale.root(0, 100).range(0, 640);
- * - * The y scale can now be equivalently referenced within a property: - * - *
    .height(function(d) y(d))
- * - * Alternatively, if the data are not simple numbers, the appropriate value can - * be passed to the y scale (e.g., d.foo). The {@link #by} - * method similarly allows the data to be mapped to a numeric value before - * performing the root transformation. - * - * @param {number...} domain... optional domain values. - * @extends pv.Scale.quantitative - */ -pv.Scale.root = function() { - var scale = pv.Scale.quantitative(); - - /** - * Sets or gets the exponent; defaults to 2. - * - * @function - * @name pv.Scale.root.prototype.power - * @param {number} [v] the new exponent. - * @returns {pv.Scale.root} this, or the current base. - */ - scale.power = function(v) { - if (arguments.length) { - var b = Number(v), p = 1 / b; - scale.transform( - function(x) { return Math.pow(x, p); }, - function(y) { return Math.pow(y, b); }); - return this; - } - return b; - }; - - scale.domain.apply(scale, arguments); - return scale.power(2); -}; -/** - * Returns an ordinal scale for the specified domain. The arguments to this - * constructor are optional, and equivalent to calling {@link #domain}. - * - * @class Represents an ordinal scale. An ordinal scale represents a - * pairwise mapping from n discrete values in the input domain to - * n discrete values in the output range. For example, an ordinal scale - * might map a domain of species ["setosa", "versicolor", "virginica"] to colors - * ["red", "green", "blue"]. Thus, saying - * - *
    .fillStyle(function(d) {
- *         switch (d.species) {
- *           case "setosa": return "red";
- *           case "versicolor": return "green";
- *           case "virginica": return "blue";
- *         }
- *       })
- * - * is equivalent to - * - *
    .fillStyle(pv.Scale.ordinal("setosa", "versicolor", "virginica")
- *         .range("red", "green", "blue")
- *         .by(function(d) d.species))
- * - * If the mapping from species to color does not need to be specified - * explicitly, the domain can be omitted. In this case it will be inferred - * lazily from the data: - * - *
    .fillStyle(pv.colors("red", "green", "blue")
- *         .by(function(d) d.species))
- * - * When the domain is inferred, the first time the scale is invoked, the first - * element from the range will be returned. Subsequent calls with unique values - * will return subsequent elements from the range. If the inferred domain grows - * larger than the range, range values will be reused. However, it is strongly - * recommended that the domain and the range contain the same number of - * elements. - * - *

A range can be discretized from a continuous interval (e.g., for pixel - * positioning) by using {@link #split}, {@link #splitFlush} or - * {@link #splitBanded} after the domain has been set. For example, if - * states is an array of the fifty U.S. state names, the state name can - * be encoded in the left position: - * - *

    .left(pv.Scale.ordinal(states)
- *         .split(0, 640)
- *         .by(function(d) d.state))
- * - *

N.B.: ordinal scales are not invertible (at least not yet), since the - * domain and range and discontinuous. A workaround is to use a linear scale. - * - * @param {...} domain... optional domain values. - * @extends pv.Scale - * @see pv.colors - */ -pv.Scale.ordinal = function() { - var d = [], i = {}, r = [], band = 0; - - /** @private */ - function scale(x) { - if (!(x in i)) i[x] = d.push(x) - 1; - return r[i[x] % r.length]; - } - - /** - * Sets or gets the input domain. This method can be invoked several ways: - * - *

1. domain(values...) - * - *

Specifying the domain as a series of values is the most explicit and - * recommended approach. However, if the domain values are derived from data, - * you may find the second method more appropriate. - * - *

2. domain(array, f) - * - *

Rather than enumerating the domain values as explicit arguments to this - * method, you can specify a single argument of an array. In addition, you can - * specify an optional accessor function to extract the domain values from the - * array. - * - *

3. domain() - * - *

Invoking the domain method with no arguments returns the - * current domain as an array. - * - * @function - * @name pv.Scale.ordinal.prototype.domain - * @param {...} domain... domain values. - * @returns {pv.Scale.ordinal} this, or the current domain. - */ - scale.domain = function(array, f) { - if (arguments.length) { - array = (array instanceof Array) - ? ((arguments.length > 1) ? pv.map(array, f) : array) - : Array.prototype.slice.call(arguments); - - /* Filter the specified ordinals to their unique values. */ - d = []; - var seen = {}; - for (var j = 0; j < array.length; j++) { - var o = array[j]; - if (!(o in seen)) { - seen[o] = true; - d.push(o); - } - } - - i = pv.numerate(d); - return this; - } - return d; - }; - - /** - * Sets or gets the output range. This method can be invoked several ways: - * - *

1. range(values...) - * - *

Specifying the range as a series of values is the most explicit and - * recommended approach. However, if the range values are derived from data, - * you may find the second method more appropriate. - * - *

2. range(array, f) - * - *

Rather than enumerating the range values as explicit arguments to this - * method, you can specify a single argument of an array. In addition, you can - * specify an optional accessor function to extract the range values from the - * array. - * - *

3. range() - * - *

Invoking the range method with no arguments returns the - * current range as an array. - * - * @function - * @name pv.Scale.ordinal.prototype.range - * @param {...} range... range values. - * @returns {pv.Scale.ordinal} this, or the current range. - */ - scale.range = function(array, f) { - if (arguments.length) { - r = (array instanceof Array) - ? ((arguments.length > 1) ? pv.map(array, f) : array) - : Array.prototype.slice.call(arguments); - if (typeof r[0] == "string") r = r.map(pv.color); - return this; - } - return r; - }; - - /** - * Sets the range from the given continuous interval. The interval - * [min, max] is subdivided into n equispaced points, - * where n is the number of (unique) values in the domain. The first - * and last point are offset from the edge of the range by half the distance - * between points. - * - *

This method must be called after the domain is set. - * - * @function - * @name pv.Scale.ordinal.prototype.split - * @param {number} min minimum value of the output range. - * @param {number} max maximum value of the output range. - * @returns {pv.Scale.ordinal} this. - * @see #splitFlush - * @see #splitBanded - */ - scale.split = function(min, max) { - var step = (max - min) / this.domain().length; - r = pv.range(min + step / 2, max, step); - return this; - }; - - /** - * Sets the range from the given continuous interval. The interval - * [min, max] is subdivided into n equispaced points, - * where n is the number of (unique) values in the domain. The first - * and last point are exactly on the edge of the range. - * - *

This method must be called after the domain is set. - * - * @function - * @name pv.Scale.ordinal.prototype.splitFlush - * @param {number} min minimum value of the output range. - * @param {number} max maximum value of the output range. - * @returns {pv.Scale.ordinal} this. - * @see #split - */ - scale.splitFlush = function(min, max) { - var n = this.domain().length, step = (max - min) / (n - 1); - r = (n == 1) ? [(min + max) / 2] - : pv.range(min, max + step / 2, step); - return this; - }; - - /** - * Sets the range from the given continuous interval. The interval - * [min, max] is subdivided into n equispaced bands, - * where n is the number of (unique) values in the domain. The first - * and last band are offset from the edge of the range by the distance between - * bands. - * - *

The band width argument, band, is typically in the range [0, 1] - * and defaults to 1. This fraction corresponds to the amount of space in the - * range to allocate to the bands, as opposed to padding. A value of 0.5 means - * that the band width will be equal to the padding width. The computed - * absolute band width can be retrieved from the range as - * scale.range().band. - * - *

If the band width argument is negative, this method will allocate bands - * of a fixed width -band, rather than a relative fraction of - * the available space. - * - *

Tip: to inset the bands by a fixed amount p, specify a minimum - * value of min + p (or simply p, if min is - * 0). Then set the mark width to scale.range().band - p. - * - *

This method must be called after the domain is set. - * - * @function - * @name pv.Scale.ordinal.prototype.splitBanded - * @param {number} min minimum value of the output range. - * @param {number} max maximum value of the output range. - * @param {number} [band] the fractional band width in [0, 1]; defaults to 1. - * @returns {pv.Scale.ordinal} this. - * @see #split - */ - scale.splitBanded = function(min, max, band) { - if (arguments.length < 3) band = 1; - if (band < 0) { - var n = this.domain().length, - total = -band * n, - remaining = max - min - total, - padding = remaining / (n + 1); - r = pv.range(min + padding, max, padding - band); - r.band = -band; - } else { - var step = (max - min) / (this.domain().length + (1 - band)); - r = pv.range(min + step * (1 - band), max, step); - r.band = step * band; - } - return this; - }; - - /** - * Returns a view of this scale by the specified accessor function f. - * Given a scale y, y.by(function(d) d.foo) is equivalent to - * function(d) y(d.foo). This method should be used judiciously; it - * is typically more clear to invoke the scale directly, passing in the value - * to be scaled. - * - * @function - * @name pv.Scale.ordinal.prototype.by - * @param {function} f an accessor function. - * @returns {pv.Scale.ordinal} a view of this scale by the specified accessor - * function. - */ - scale.by = function(f) { - function by() { return scale(f.apply(this, arguments)); } - for (var method in scale) by[method] = scale[method]; - return by; - }; - - scale.domain.apply(scale, arguments); - return scale; -}; -/** - * Constructs a default quantile scale. The arguments to this constructor are - * optional, and equivalent to calling {@link #domain}. The default domain is - * the empty set, and the default range is [0,1]. - * - * @class Represents a quantile scale; a function that maps from a value within - * a sortable domain to a quantized numeric range. Typically, the domain is a - * set of numbers, but any sortable value (such as strings) can be used as the - * domain of a quantile scale. The range defaults to [0,1], with 0 corresponding - * to the smallest value in the domain, 1 the largest, .5 the median, etc. - * - *

By default, the number of quantiles in the range corresponds to the number - * of values in the domain. The {@link #quantiles} method can be used to specify - * an explicit number of quantiles; for example, quantiles(4) produces - * a standard quartile scale. A quartile scale's range is a set of four discrete - * values, such as [0, 1/3, 2/3, 1]. Calling the {@link #range} method will - * scale these discrete values accordingly, similar to {@link - * pv.Scale.ordinal#splitFlush}. - * - *

For example, given the strings ["c", "a", "b"], a default quantile scale: - * - *

pv.Scale.quantile("c", "a", "b")
- * - * will return 0 for "a", .5 for "b", and 1 for "c". - * - * @extends pv.Scale - */ -pv.Scale.quantile = function() { - var n = -1, // number of quantiles - j = -1, // max quantile index - q = [], // quantile boundaries - d = [], // domain - y = pv.Scale.linear(); // range - - /** @private */ - function scale(x) { - return y(Math.max(0, Math.min(j, pv.search.index(q, x) - 1)) / j); - } - - /** - * Sets or gets the quantile boundaries. By default, each element in the - * domain is in its own quantile. If the argument to this method is a number, - * it specifies the number of equal-sized quantiles by which to divide the - * domain. - * - *

If no arguments are specified, this method returns the quantile - * boundaries; the first element is always the minimum value of the domain, - * and the last element is the maximum value of the domain. Thus, the length - * of the returned array is always one greater than the number of quantiles. - * - * @function - * @name pv.Scale.quantile.prototype.quantiles - * @param {number} x the number of quantiles. - */ - scale.quantiles = function(x) { - if (arguments.length) { - n = Number(x); - if (n < 0) { - q = [d[0]].concat(d); - j = d.length - 1; - } else { - q = []; - q[0] = d[0]; - for (var i = 1; i <= n; i++) { - q[i] = d[~~(i * (d.length - 1) / n)]; - } - j = n - 1; - } - return this; - } - return q; - }; - - /** - * Sets or gets the input domain. This method can be invoked several ways: - * - *

1. domain(values...) - * - *

Specifying the domain as a series of values is the most explicit and - * recommended approach. However, if the domain values are derived from data, - * you may find the second method more appropriate. - * - *

2. domain(array, f) - * - *

Rather than enumerating the domain values as explicit arguments to this - * method, you can specify a single argument of an array. In addition, you can - * specify an optional accessor function to extract the domain values from the - * array. - * - *

3. domain() - * - *

Invoking the domain method with no arguments returns the - * current domain as an array. - * - * @function - * @name pv.Scale.quantile.prototype.domain - * @param {...} domain... domain values. - * @returns {pv.Scale.quantile} this, or the current domain. - */ - scale.domain = function(array, f) { - if (arguments.length) { - d = (array instanceof Array) - ? pv.map(array, f) - : Array.prototype.slice.call(arguments); - d.sort(pv.naturalOrder); - scale.quantiles(n); // recompute quantiles - return this; - } - return d; - }; - - /** - * Sets or gets the output range. This method can be invoked several ways: - * - *

1. range(min, ..., max) - * - *

The range may be specified as a series of numbers or colors. Most - * commonly, two numbers are specified: the minimum and maximum pixel values. - * For a color scale, values may be specified as {@link pv.Color}s or - * equivalent strings. For a diverging scale, or other subdivided non-uniform - * scales, multiple values can be specified. For example: - * - *

    .range("red", "white", "green")
- * - *

Currently, only numbers and colors are supported as range values. The - * number of range values must exactly match the number of domain values, or - * the behavior of the scale is undefined. - * - *

2. range() - * - *

Invoking the range method with no arguments returns the current - * range as an array of numbers or colors. - * - * @function - * @name pv.Scale.quantile.prototype.range - * @param {...} range... range values. - * @returns {pv.Scale.quantile} this, or the current range. - */ - scale.range = function() { - if (arguments.length) { - y.range.apply(y, arguments); - return this; - } - return y.range(); - }; - - /** - * Returns a view of this scale by the specified accessor function f. - * Given a scale y, y.by(function(d) d.foo) is equivalent to - * function(d) y(d.foo). - * - *

This method is provided for convenience, such that scales can be - * succinctly defined inline. For example, given an array of data elements - * that have a score attribute with the domain [0, 1], the height - * property could be specified as: - * - *

.height(pv.Scale.linear().range(0, 480).by(function(d) d.score))
- * - * This is equivalent to: - * - *
.height(function(d) d.score * 480)
- * - * This method should be used judiciously; it is typically more clear to - * invoke the scale directly, passing in the value to be scaled. - * - * @function - * @name pv.Scale.quantile.prototype.by - * @param {function} f an accessor function. - * @returns {pv.Scale.quantile} a view of this scale by the specified - * accessor function. - */ - scale.by = function(f) { - function by() { return scale(f.apply(this, arguments)); } - for (var method in scale) by[method] = scale[method]; - return by; - }; - - scale.domain.apply(scale, arguments); - return scale; -}; -/** - * Returns a histogram operator for the specified data, with an optional - * accessor function. If the data specified is not an array of numbers, an - * accessor function must be specified to map the data to numeric values. - * - * @class Represents a histogram operator. - * - * @param {array} data an array of numbers or objects. - * @param {function} [f] an optional accessor function. - */ -pv.histogram = function(data, f) { - var frequency = true; - return { - - /** - * Returns the computed histogram bins. An optional array of numbers, - * ticks, may be specified as the break points. If the ticks are - * not specified, default ticks will be computed using a linear scale on the - * data domain. - * - *

The returned array contains {@link pv.histogram.Bin}s. The x - * attribute corresponds to the bin's start value (inclusive), while the - * dx attribute stores the bin size (end - start). The y - * attribute stores either the frequency count or probability, depending on - * how the histogram operator has been configured. - * - *

The {@link pv.histogram.Bin} objects are themselves arrays, containing - * the data elements present in each bin, i.e., the elements in the - * data array (prior to invoking the accessor function, if any). - * For example, if the data represented countries, and the accessor function - * returned the GDP of each country, the returned bins would be arrays of - * countries (not GDPs). - * - * @function - * @name pv.histogram.prototype.bins - * @param {array} [ticks] - * @returns {array} - */ /** @private */ - bins: function(ticks) { - var x = pv.map(data, f), bins = []; - - /* Initialize default ticks. */ - if (!arguments.length) ticks = pv.Scale.linear(x).ticks(); - - /* Initialize the bins. */ - for (var i = 0; i < ticks.length - 1; i++) { - var bin = bins[i] = []; - bin.x = ticks[i]; - bin.dx = ticks[i + 1] - ticks[i]; - bin.y = 0; - } - - /* Count the number of samples per bin. */ - for (var i = 0; i < x.length; i++) { - var j = pv.search.index(ticks, x[i]) - 1, - bin = bins[Math.max(0, Math.min(bins.length - 1, j))]; - bin.y++; - bin.push(data[i]); - } - - /* Convert frequencies to probabilities. */ - if (!frequency) for (var i = 0; i < bins.length; i++) { - bins[i].y /= x.length; - } - - return bins; - }, - - /** - * Sets or gets whether this histogram operator returns frequencies or - * probabilities. - * - * @function - * @name pv.histogram.prototype.frequency - * @param {boolean} [x] - * @returns {pv.histogram} this. - */ /** @private */ - frequency: function(x) { - if (arguments.length) { - frequency = Boolean(x); - return this; - } - return frequency; - } - }; -}; - -/** - * @class Represents a bin returned by the {@link pv.histogram} operator. Bins - * are themselves arrays containing the data elements present in the given bin - * (prior to the accessor function being invoked to convert the data object to a - * numeric value). These bin arrays have additional attributes with meta - * information about the bin. - * - * @name pv.histogram.Bin - * @extends array - * @see pv.histogram - */ - -/** - * The start value of the bin's range. - * - * @type number - * @name pv.histogram.Bin.prototype.x - */ - -/** - * The magnitude value of the bin's range; end - start. - * - * @type number - * @name pv.histogram.Bin.prototype.dx - */ - -/** - * The frequency or probability of the bin, depending on how the histogram - * operator was configured. - * - * @type number - * @name pv.histogram.Bin.prototype.y - */ -/** - * Returns the {@link pv.Color} for the specified color format string. Colors - * may have an associated opacity, or alpha channel. Color formats are specified - * by CSS Color Modular Level 3, using either in RGB or HSL color space. For - * example:

The SVG 1.0 color keywords names are also supported, such as "aliceblue" - * and "yellowgreen". The "transparent" keyword is supported for fully- - * transparent black. - * - *

If the format argument is already an instance of Color, - * the argument is returned with no further processing. - * - * @param {string} format the color specification string, such as "#f00". - * @returns {pv.Color} the corresponding Color. - * @see SVG color - * keywords - * @see CSS3 color module - */ -pv.color = function(format) { - if (format.rgb) return format.rgb(); - - /* Handle hsl, rgb. */ - var m1 = /([a-z]+)\((.*)\)/i.exec(format); - if (m1) { - var m2 = m1[2].split(","), a = 1; - switch (m1[1]) { - case "hsla": - case "rgba": { - a = parseFloat(m2[3]); - if (!a) return pv.Color.transparent; - break; - } - } - switch (m1[1]) { - case "hsla": - case "hsl": { - var h = parseFloat(m2[0]), // degrees - s = parseFloat(m2[1]) / 100, // percentage - l = parseFloat(m2[2]) / 100; // percentage - return (new pv.Color.Hsl(h, s, l, a)).rgb(); - } - case "rgba": - case "rgb": { - function parse(c) { // either integer or percentage - var f = parseFloat(c); - return (c[c.length - 1] == '%') ? Math.round(f * 2.55) : f; - } - var r = parse(m2[0]), g = parse(m2[1]), b = parse(m2[2]); - return pv.rgb(r, g, b, a); - } - } - } - - /* Named colors. */ - var named = pv.Color.names[format]; - if (named) return named; - - /* Hexadecimal colors: #rgb and #rrggbb. */ - if (format.charAt(0) == "#") { - var r, g, b; - if (format.length == 4) { - r = format.charAt(1); r += r; - g = format.charAt(2); g += g; - b = format.charAt(3); b += b; - } else if (format.length == 7) { - r = format.substring(1, 3); - g = format.substring(3, 5); - b = format.substring(5, 7); - } - return pv.rgb(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1); - } - - /* Otherwise, pass-through unsupported colors. */ - return new pv.Color(format, 1); -}; - -/** - * Constructs a color with the specified color format string and opacity. This - * constructor should not be invoked directly; use {@link pv.color} instead. - * - * @class Represents an abstract (possibly translucent) color. The color is - * divided into two parts: the color attribute, an opaque color format - * string, and the opacity attribute, a float in [0, 1]. The color - * space is dependent on the implementing class; all colors support the - * {@link #rgb} method to convert to RGB color space for interpolation. - * - *

See also the Color guide. - * - * @param {string} color an opaque color format string, such as "#f00". - * @param {number} opacity the opacity, in [0,1]. - * @see pv.color - */ -pv.Color = function(color, opacity) { - /** - * An opaque color format string, such as "#f00". - * - * @type string - * @see SVG color - * keywords - * @see CSS3 color module - */ - this.color = color; - - /** - * The opacity, a float in [0, 1]. - * - * @type number - */ - this.opacity = opacity; -}; - -/** - * Returns a new color that is a brighter version of this color. The behavior of - * this method may vary slightly depending on the underlying color space. - * Although brighter and darker are inverse operations, the results of a series - * of invocations of these two methods might be inconsistent because of rounding - * errors. - * - * @param [k] {number} an optional scale factor; defaults to 1. - * @see #darker - * @returns {pv.Color} a brighter color. - */ -pv.Color.prototype.brighter = function(k) { - return this.rgb().brighter(k); -}; - -/** - * Returns a new color that is a brighter version of this color. The behavior of - * this method may vary slightly depending on the underlying color space. - * Although brighter and darker are inverse operations, the results of a series - * of invocations of these two methods might be inconsistent because of rounding - * errors. - * - * @param [k] {number} an optional scale factor; defaults to 1. - * @see #brighter - * @returns {pv.Color} a darker color. - */ -pv.Color.prototype.darker = function(k) { - return this.rgb().darker(k); -}; - -/** - * Constructs a new RGB color with the specified channel values. - * - * @param {number} r the red channel, an integer in [0,255]. - * @param {number} g the green channel, an integer in [0,255]. - * @param {number} b the blue channel, an integer in [0,255]. - * @param {number} [a] the alpha channel, a float in [0,1]. - * @returns pv.Color.Rgb - */ -pv.rgb = function(r, g, b, a) { - return new pv.Color.Rgb(r, g, b, (arguments.length == 4) ? a : 1); -}; - -/** - * Constructs a new RGB color with the specified channel values. - * - * @class Represents a color in RGB space. - * - * @param {number} r the red channel, an integer in [0,255]. - * @param {number} g the green channel, an integer in [0,255]. - * @param {number} b the blue channel, an integer in [0,255]. - * @param {number} a the alpha channel, a float in [0,1]. - * @extends pv.Color - */ -pv.Color.Rgb = function(r, g, b, a) { - pv.Color.call(this, a ? ("rgb(" + r + "," + g + "," + b + ")") : "none", a); - - /** - * The red channel, an integer in [0, 255]. - * - * @type number - */ - this.r = r; - - /** - * The green channel, an integer in [0, 255]. - * - * @type number - */ - this.g = g; - - /** - * The blue channel, an integer in [0, 255]. - * - * @type number - */ - this.b = b; - - /** - * The alpha channel, a float in [0, 1]. - * - * @type number - */ - this.a = a; -}; -pv.Color.Rgb.prototype = pv.extend(pv.Color); - -/** - * Constructs a new RGB color with the same green, blue and alpha channels as - * this color, with the specified red channel. - * - * @param {number} r the red channel, an integer in [0,255]. - */ -pv.Color.Rgb.prototype.red = function(r) { - return pv.rgb(r, this.g, this.b, this.a); -}; - -/** - * Constructs a new RGB color with the same red, blue and alpha channels as this - * color, with the specified green channel. - * - * @param {number} g the green channel, an integer in [0,255]. - */ -pv.Color.Rgb.prototype.green = function(g) { - return pv.rgb(this.r, g, this.b, this.a); -}; - -/** - * Constructs a new RGB color with the same red, green and alpha channels as - * this color, with the specified blue channel. - * - * @param {number} b the blue channel, an integer in [0,255]. - */ -pv.Color.Rgb.prototype.blue = function(b) { - return pv.rgb(this.r, this.g, b, this.a); -}; - -/** - * Constructs a new RGB color with the same red, green and blue channels as this - * color, with the specified alpha channel. - * - * @param {number} a the alpha channel, a float in [0,1]. - */ -pv.Color.Rgb.prototype.alpha = function(a) { - return pv.rgb(this.r, this.g, this.b, a); -}; - -/** - * Returns the RGB color equivalent to this color. This method is abstract and - * must be implemented by subclasses. - * - * @returns {pv.Color.Rgb} an RGB color. - * @function - * @name pv.Color.prototype.rgb - */ - -/** - * Returns this. - * - * @returns {pv.Color.Rgb} this. - */ -pv.Color.Rgb.prototype.rgb = function() { return this; }; - -/** - * Returns a new color that is a brighter version of this color. This method - * applies an arbitrary scale factor to each of the three RGB components of this - * color to create a brighter version of this color. Although brighter and - * darker are inverse operations, the results of a series of invocations of - * these two methods might be inconsistent because of rounding errors. - * - * @param [k] {number} an optional scale factor; defaults to 1. - * @see #darker - * @returns {pv.Color.Rgb} a brighter color. - */ -pv.Color.Rgb.prototype.brighter = function(k) { - k = Math.pow(0.7, arguments.length ? k : 1); - var r = this.r, g = this.g, b = this.b, i = 30; - if (!r && !g && !b) return pv.rgb(i, i, i, this.a); - if (r && (r < i)) r = i; - if (g && (g < i)) g = i; - if (b && (b < i)) b = i; - return pv.rgb( - Math.min(255, Math.floor(r / k)), - Math.min(255, Math.floor(g / k)), - Math.min(255, Math.floor(b / k)), - this.a); -}; - -/** - * Returns a new color that is a darker version of this color. This method - * applies an arbitrary scale factor to each of the three RGB components of this - * color to create a darker version of this color. Although brighter and darker - * are inverse operations, the results of a series of invocations of these two - * methods might be inconsistent because of rounding errors. - * - * @param [k] {number} an optional scale factor; defaults to 1. - * @see #brighter - * @returns {pv.Color.Rgb} a darker color. - */ -pv.Color.Rgb.prototype.darker = function(k) { - k = Math.pow(0.7, arguments.length ? k : 1); - return pv.rgb( - Math.max(0, Math.floor(k * this.r)), - Math.max(0, Math.floor(k * this.g)), - Math.max(0, Math.floor(k * this.b)), - this.a); -}; - -/** - * Constructs a new HSL color with the specified values. - * - * @param {number} h the hue, an integer in [0, 360]. - * @param {number} s the saturation, a float in [0, 1]. - * @param {number} l the lightness, a float in [0, 1]. - * @param {number} [a] the opacity, a float in [0, 1]. - * @returns pv.Color.Hsl - */ -pv.hsl = function(h, s, l, a) { - return new pv.Color.Hsl(h, s, l, (arguments.length == 4) ? a : 1); -}; - -/** - * Constructs a new HSL color with the specified values. - * - * @class Represents a color in HSL space. - * - * @param {number} h the hue, an integer in [0, 360]. - * @param {number} s the saturation, a float in [0, 1]. - * @param {number} l the lightness, a float in [0, 1]. - * @param {number} a the opacity, a float in [0, 1]. - * @extends pv.Color - */ -pv.Color.Hsl = function(h, s, l, a) { - pv.Color.call(this, "hsl(" + h + "," + (s * 100) + "%," + (l * 100) + "%)", a); - - /** - * The hue, an integer in [0, 360]. - * - * @type number - */ - this.h = h; - - /** - * The saturation, a float in [0, 1]. - * - * @type number - */ - this.s = s; - - /** - * The lightness, a float in [0, 1]. - * - * @type number - */ - this.l = l; - - /** - * The opacity, a float in [0, 1]. - * - * @type number - */ - this.a = a; -}; -pv.Color.Hsl.prototype = pv.extend(pv.Color); - -/** - * Constructs a new HSL color with the same saturation, lightness and alpha as - * this color, and the specified hue. - * - * @param {number} h the hue, an integer in [0, 360]. - */ -pv.Color.Hsl.prototype.hue = function(h) { - return pv.hsl(h, this.s, this.l, this.a); -}; - -/** - * Constructs a new HSL color with the same hue, lightness and alpha as this - * color, and the specified saturation. - * - * @param {number} s the saturation, a float in [0, 1]. - */ -pv.Color.Hsl.prototype.saturation = function(s) { - return pv.hsl(this.h, s, this.l, this.a); -}; - -/** - * Constructs a new HSL color with the same hue, saturation and alpha as this - * color, and the specified lightness. - * - * @param {number} l the lightness, a float in [0, 1]. - */ -pv.Color.Hsl.prototype.lightness = function(l) { - return pv.hsl(this.h, this.s, l, this.a); -}; - -/** - * Constructs a new HSL color with the same hue, saturation and lightness as - * this color, and the specified alpha. - * - * @param {number} a the opacity, a float in [0, 1]. - */ -pv.Color.Hsl.prototype.alpha = function(a) { - return pv.hsl(this.h, this.s, this.l, a); -}; - -/** - * Returns the RGB color equivalent to this HSL color. - * - * @returns {pv.Color.Rgb} an RGB color. - */ -pv.Color.Hsl.prototype.rgb = function() { - var h = this.h, s = this.s, l = this.l; - - /* Some simple corrections for h, s and l. */ - h = h % 360; if (h < 0) h += 360; - s = Math.max(0, Math.min(s, 1)); - l = Math.max(0, Math.min(l, 1)); - - /* From FvD 13.37, CSS Color Module Level 3 */ - var m2 = (l <= .5) ? (l * (1 + s)) : (l + s - l * s); - var 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 pv.rgb(vv(h + 120), vv(h), vv(h - 120), this.a); -}; - -/** - * @private SVG color keywords, per CSS Color Module Level 3. - * - * @see SVG color - * keywords - */ -pv.Color.names = { - aliceblue: "#f0f8ff", - antiquewhite: "#faebd7", - aqua: "#00ffff", - aquamarine: "#7fffd4", - azure: "#f0ffff", - beige: "#f5f5dc", - bisque: "#ffe4c4", - black: "#000000", - blanchedalmond: "#ffebcd", - blue: "#0000ff", - blueviolet: "#8a2be2", - brown: "#a52a2a", - burlywood: "#deb887", - cadetblue: "#5f9ea0", - chartreuse: "#7fff00", - chocolate: "#d2691e", - coral: "#ff7f50", - cornflowerblue: "#6495ed", - cornsilk: "#fff8dc", - crimson: "#dc143c", - cyan: "#00ffff", - darkblue: "#00008b", - darkcyan: "#008b8b", - darkgoldenrod: "#b8860b", - darkgray: "#a9a9a9", - darkgreen: "#006400", - darkgrey: "#a9a9a9", - darkkhaki: "#bdb76b", - darkmagenta: "#8b008b", - darkolivegreen: "#556b2f", - darkorange: "#ff8c00", - darkorchid: "#9932cc", - darkred: "#8b0000", - darksalmon: "#e9967a", - darkseagreen: "#8fbc8f", - darkslateblue: "#483d8b", - darkslategray: "#2f4f4f", - darkslategrey: "#2f4f4f", - darkturquoise: "#00ced1", - darkviolet: "#9400d3", - deeppink: "#ff1493", - deepskyblue: "#00bfff", - dimgray: "#696969", - dimgrey: "#696969", - dodgerblue: "#1e90ff", - firebrick: "#b22222", - floralwhite: "#fffaf0", - forestgreen: "#228b22", - fuchsia: "#ff00ff", - gainsboro: "#dcdcdc", - ghostwhite: "#f8f8ff", - gold: "#ffd700", - goldenrod: "#daa520", - gray: "#808080", - green: "#008000", - greenyellow: "#adff2f", - grey: "#808080", - honeydew: "#f0fff0", - hotpink: "#ff69b4", - indianred: "#cd5c5c", - indigo: "#4b0082", - ivory: "#fffff0", - khaki: "#f0e68c", - lavender: "#e6e6fa", - lavenderblush: "#fff0f5", - lawngreen: "#7cfc00", - lemonchiffon: "#fffacd", - lightblue: "#add8e6", - lightcoral: "#f08080", - lightcyan: "#e0ffff", - lightgoldenrodyellow: "#fafad2", - lightgray: "#d3d3d3", - lightgreen: "#90ee90", - lightgrey: "#d3d3d3", - lightpink: "#ffb6c1", - lightsalmon: "#ffa07a", - lightseagreen: "#20b2aa", - lightskyblue: "#87cefa", - lightslategray: "#778899", - lightslategrey: "#778899", - lightsteelblue: "#b0c4de", - lightyellow: "#ffffe0", - lime: "#00ff00", - limegreen: "#32cd32", - linen: "#faf0e6", - magenta: "#ff00ff", - maroon: "#800000", - mediumaquamarine: "#66cdaa", - mediumblue: "#0000cd", - mediumorchid: "#ba55d3", - mediumpurple: "#9370db", - mediumseagreen: "#3cb371", - mediumslateblue: "#7b68ee", - mediumspringgreen: "#00fa9a", - mediumturquoise: "#48d1cc", - mediumvioletred: "#c71585", - midnightblue: "#191970", - mintcream: "#f5fffa", - mistyrose: "#ffe4e1", - moccasin: "#ffe4b5", - navajowhite: "#ffdead", - navy: "#000080", - oldlace: "#fdf5e6", - olive: "#808000", - olivedrab: "#6b8e23", - orange: "#ffa500", - orangered: "#ff4500", - orchid: "#da70d6", - palegoldenrod: "#eee8aa", - palegreen: "#98fb98", - paleturquoise: "#afeeee", - palevioletred: "#db7093", - papayawhip: "#ffefd5", - peachpuff: "#ffdab9", - peru: "#cd853f", - pink: "#ffc0cb", - plum: "#dda0dd", - powderblue: "#b0e0e6", - purple: "#800080", - red: "#ff0000", - rosybrown: "#bc8f8f", - royalblue: "#4169e1", - saddlebrown: "#8b4513", - salmon: "#fa8072", - sandybrown: "#f4a460", - seagreen: "#2e8b57", - seashell: "#fff5ee", - sienna: "#a0522d", - silver: "#c0c0c0", - skyblue: "#87ceeb", - slateblue: "#6a5acd", - slategray: "#708090", - slategrey: "#708090", - snow: "#fffafa", - springgreen: "#00ff7f", - steelblue: "#4682b4", - tan: "#d2b48c", - teal: "#008080", - thistle: "#d8bfd8", - tomato: "#ff6347", - turquoise: "#40e0d0", - violet: "#ee82ee", - wheat: "#f5deb3", - white: "#ffffff", - whitesmoke: "#f5f5f5", - yellow: "#ffff00", - yellowgreen: "#9acd32", - transparent: pv.Color.transparent = pv.rgb(0, 0, 0, 0) -}; - -/* Initialized named colors. */ -(function() { - var names = pv.Color.names; - for (var name in names) names[name] = pv.color(names[name]); -})(); -/** - * Returns a new categorical color encoding using the specified colors. The - * arguments to this method are an array of colors; see {@link pv.color}. For - * example, to create a categorical color encoding using the species - * attribute: - * - *

pv.colors("red", "green", "blue").by(function(d) d.species)
- * - * The result of this expression can be used as a fill- or stroke-style - * property. This assumes that the data's species attribute is a - * string. - * - * @param {string} colors... categorical colors. - * @see pv.Scale.ordinal - * @returns {pv.Scale.ordinal} an ordinal color scale. - */ -pv.colors = function() { - var scale = pv.Scale.ordinal(); - scale.range.apply(scale, arguments); - return scale; -}; - -/** - * A collection of standard color palettes for categorical encoding. - * - * @namespace A collection of standard color palettes for categorical encoding. - */ -pv.Colors = {}; - -/** - * Returns a new 10-color scheme. The arguments to this constructor are - * optional, and equivalent to calling {@link pv.Scale.OrdinalScale#domain}. The - * following colors are used: - * - *
#1f77b4
- *
#ff7f0e
- *
#2ca02c
- *
#d62728
- *
#9467bd
- *
#8c564b
- *
#e377c2
- *
#7f7f7f
- *
#bcbd22
- *
#17becf
- * - * @param {number...} domain... domain values. - * @returns {pv.Scale.ordinal} a new ordinal color scale. - * @see pv.color - */ -pv.Colors.category10 = function() { - var scale = pv.colors( - "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", - "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"); - scale.domain.apply(scale, arguments); - return scale; -}; - -/** - * Returns a new 20-color scheme. The arguments to this constructor are - * optional, and equivalent to calling {@link pv.Scale.OrdinalScale#domain}. The - * following colors are used: - * - *
#1f77b4
- *
#aec7e8
- *
#ff7f0e
- *
#ffbb78
- *
#2ca02c
- *
#98df8a
- *
#d62728
- *
#ff9896
- *
#9467bd
- *
#c5b0d5
- *
#8c564b
- *
#c49c94
- *
#e377c2
- *
#f7b6d2
- *
#7f7f7f
- *
#c7c7c7
- *
#bcbd22
- *
#dbdb8d
- *
#17becf
- *
#9edae5
- * - * @param {number...} domain... domain values. - * @returns {pv.Scale.ordinal} a new ordinal color scale. - * @see pv.color -*/ -pv.Colors.category20 = function() { - var scale = pv.colors( - "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", - "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", - "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", - "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5"); - scale.domain.apply(scale, arguments); - return scale; -}; - -/** - * Returns a new alternative 19-color scheme. The arguments to this constructor - * are optional, and equivalent to calling - * {@link pv.Scale.OrdinalScale#domain}. The following colors are used: - * - *
#9c9ede
- *
#7375b5
- *
#4a5584
- *
#cedb9c
- *
#b5cf6b
- *
#8ca252
- *
#637939
- *
#e7cb94
- *
#e7ba52
- *
#bd9e39
- *
#8c6d31
- *
#e7969c
- *
#d6616b
- *
#ad494a
- *
#843c39
- *
#de9ed6
- *
#ce6dbd
- *
#a55194
- *
#7b4173
- * - * @param {number...} domain... domain values. - * @returns {pv.Scale.ordinal} a new ordinal color scale. - * @see pv.color - */ -pv.Colors.category19 = function() { - var scale = pv.colors( - "#9c9ede", "#7375b5", "#4a5584", "#cedb9c", "#b5cf6b", - "#8ca252", "#637939", "#e7cb94", "#e7ba52", "#bd9e39", - "#8c6d31", "#e7969c", "#d6616b", "#ad494a", "#843c39", - "#de9ed6", "#ce6dbd", "#a55194", "#7b4173"); - scale.domain.apply(scale, arguments); - return scale; -}; -/** - * Returns a linear color ramp from the specified start color to the - * specified end color. The color arguments may be specified either as - * strings or as {@link pv.Color}s. This is equivalent to: - * - *
    pv.Scale.linear().domain(0, 1).range(...)
- * - * @param {string} start the start color; may be a pv.Color. - * @param {string} end the end color; may be a pv.Color. - * @returns {Function} a color ramp from start to end. - * @see pv.Scale.linear - */ -pv.ramp = function(start, end) { - var scale = pv.Scale.linear(); - scale.range.apply(scale, arguments); - return scale; -}; -/** - * @private - * @namespace - */ -pv.Scene = pv.SvgScene = { - /* Various namespaces. */ - svg: "http://www.w3.org/2000/svg", - xmlns: "http://www.w3.org/2000/xmlns", - xlink: "http://www.w3.org/1999/xlink", - xhtml: "http://www.w3.org/1999/xhtml", - - /** The pre-multipled scale, based on any enclosing transforms. */ - scale: 1, - - /** The set of supported events. */ - events: [ - "DOMMouseScroll", // for Firefox - "mousewheel", - "mousedown", - "mouseup", - "mouseover", - "mouseout", - "mousemove", - "click", - "dblclick" - ], - - /** Implicit values for SVG and CSS properties. */ - implicit: { - svg: { - "shape-rendering": "auto", - "pointer-events": "painted", - "x": 0, - "y": 0, - "dy": 0, - "text-anchor": "start", - "transform": "translate(0,0)", - "fill": "none", - "fill-opacity": 1, - "stroke": "none", - "stroke-opacity": 1, - "stroke-width": 1.5, - "stroke-linejoin": "miter" - }, - css: { - "font": "10px sans-serif" - } - } -}; - -/** - * Updates the display for the specified array of scene nodes. - * - * @param scenes {array} an array of scene nodes. - */ -pv.SvgScene.updateAll = function(scenes) { - if (scenes.length - && scenes[0].reverse - && (scenes.type != "line") - && (scenes.type != "area")) { - var reversed = pv.extend(scenes); - for (var i = 0, j = scenes.length - 1; j >= 0; i++, j--) { - reversed[i] = scenes[j]; - } - scenes = reversed; - } - this.removeSiblings(this[scenes.type](scenes)); -}; - -/** - * Creates a new SVG element of the specified type. - * - * @param type {string} an SVG element type, such as "rect". - * @returns a new SVG element. - */ -pv.SvgScene.create = function(type) { - return document.createElementNS(this.svg, type); -}; - -/** - * Expects the element e to be the specified type. If the element does - * not exist, a new one is created. If the element does exist but is the wrong - * type, it is replaced with the specified element. - * - * @param e the current SVG element. - * @param type {string} an SVG element type, such as "rect". - * @param attributes an optional attribute map. - * @param style an optional style map. - * @returns a new SVG element. - */ -pv.SvgScene.expect = function(e, type, attributes, style) { - if (e) { - if (e.tagName == "a") e = e.firstChild; - if (e.tagName != type) { - var n = this.create(type); - e.parentNode.replaceChild(n, e); - e = n; - } - } else { - e = this.create(type); - } - for (var name in attributes) { - var value = attributes[name]; - if (value == this.implicit.svg[name]) value = null; - if (value == null) e.removeAttribute(name); - else e.setAttribute(name, value); - } - for (var name in style) { - var value = style[name]; - if (value == this.implicit.css[name]) value = null; - if (value == null) e.style.removeProperty(name); - else e.style[name] = value; - } - return e; -}; - -/** TODO */ -pv.SvgScene.append = function(e, scenes, index) { - e.$scene = {scenes:scenes, index:index}; - e = this.title(e, scenes[index]); - if (!e.parentNode) scenes.$g.appendChild(e); - return e.nextSibling; -}; - -/** - * Applies a title tooltip to the specified element e, using the - * title property of the specified scene node s. Note that - * this implementation does not create an SVG title element as a child - * of e; although this is the recommended standard, it is only - * supported in Opera. Instead, an anchor element is created around the element - * e, and the xlink:title attribute is set accordingly. - * - * @param e an SVG element. - * @param s a scene node. - */ -pv.SvgScene.title = function(e, s) { - var a = e.parentNode; - if (a && (a.tagName != "a")) a = null; - if (s.title) { - if (!a) { - a = this.create("a"); - if (e.parentNode) e.parentNode.replaceChild(a, e); - a.appendChild(e); - } - a.setAttributeNS(this.xlink, "title", s.title); - return a; - } - if (a) a.parentNode.replaceChild(e, a); - return e; -}; - -/** TODO */ -pv.SvgScene.dispatch = pv.listener(function(e) { - var t = e.target.$scene; - if (t) { - var type = e.type; - - /* Fixes for mousewheel support on Firefox & Opera. */ - switch (type) { - case "DOMMouseScroll": { - type = "mousewheel"; - e.wheel = -480 * e.detail; - break; - } - case "mousewheel": { - e.wheel = (window.opera ? 12 : 1) * e.wheelDelta; - break; - } - } - - if (pv.Mark.dispatch(type, t.scenes, t.index)) e.preventDefault(); - } -}); - -/** @private Remove siblings following element e. */ -pv.SvgScene.removeSiblings = function(e) { - while (e) { - var n = e.nextSibling; - e.parentNode.removeChild(e); - e = n; - } -}; - -/** @private Do nothing when rendering undefined mark types. */ -pv.SvgScene.undefined = function() {}; -/** - * @private Converts the specified b-spline curve segment to a bezier curve - * compatible with SVG "C". - * - * @param p0 the first control point. - * @param p1 the second control point. - * @param p2 the third control point. - * @param p3 the fourth control point. - */ -pv.SvgScene.pathBasis = (function() { - - /** - * Matrix to transform basis (b-spline) control points to bezier control - * points. Derived from FvD 11.2.8. - */ - var basis = [ - [ 1/6, 2/3, 1/6, 0 ], - [ 0, 2/3, 1/3, 0 ], - [ 0, 1/3, 2/3, 0 ], - [ 0, 1/6, 2/3, 1/6 ] - ]; - - /** - * Returns the point that is the weighted sum of the specified control points, - * using the specified weights. This method requires that there are four - * weights and four control points. - */ - function weight(w, p0, p1, p2, p3) { - return { - x: w[0] * p0.left + w[1] * p1.left + w[2] * p2.left + w[3] * p3.left, - y: w[0] * p0.top + w[1] * p1.top + w[2] * p2.top + w[3] * p3.top - }; - } - - var convert = function(p0, p1, p2, p3) { - var b1 = weight(basis[1], p0, p1, p2, p3), - b2 = weight(basis[2], p0, p1, p2, p3), - b3 = weight(basis[3], p0, p1, p2, p3); - return "C" + b1.x + "," + b1.y - + "," + b2.x + "," + b2.y - + "," + b3.x + "," + b3.y; - }; - - convert.segment = function(p0, p1, p2, p3) { - var b0 = weight(basis[0], p0, p1, p2, p3), - b1 = weight(basis[1], p0, p1, p2, p3), - b2 = weight(basis[2], p0, p1, p2, p3), - b3 = weight(basis[3], p0, p1, p2, p3); - return "M" + b0.x + "," + b0.y - + "C" + b1.x + "," + b1.y - + "," + b2.x + "," + b2.y - + "," + b3.x + "," + b3.y; - }; - - return convert; -})(); - -/** - * @private Interpolates the given points using the basis spline interpolation. - * Returns an SVG path without the leading M instruction to allow path - * appending. - * - * @param points the array of points. - */ -pv.SvgScene.curveBasis = function(points) { - if (points.length <= 2) return ""; - var path = "", - p0 = points[0], - p1 = p0, - p2 = p0, - p3 = points[1]; - path += this.pathBasis(p0, p1, p2, p3); - for (var i = 2; i < points.length; i++) { - p0 = p1; - p1 = p2; - p2 = p3; - p3 = points[i]; - path += this.pathBasis(p0, p1, p2, p3); - } - /* Cycle through to get the last point. */ - path += this.pathBasis(p1, p2, p3, p3); - path += this.pathBasis(p2, p3, p3, p3); - return path; -}; - -/** - * @private Interpolates the given points using the basis spline interpolation. - * If points.length == tangents.length then a regular Hermite interpolation is - * performed, if points.length == tangents.length + 2 then the first and last - * segments are filled in with cubic bazier segments. Returns an array of path - * strings. - * - * @param points the array of points. - */ -pv.SvgScene.curveBasisSegments = function(points) { - if (points.length <= 2) return ""; - var paths = [], - p0 = points[0], - p1 = p0, - p2 = p0, - p3 = points[1], - firstPath = this.pathBasis.segment(p0, p1, p2, p3); - - p0 = p1; - p1 = p2; - p2 = p3; - p3 = points[2]; - paths.push(firstPath + this.pathBasis(p0, p1, p2, p3)); // merge first & second path - for (var i = 3; i < points.length; i++) { - p0 = p1; - p1 = p2; - p2 = p3; - p3 = points[i]; - paths.push(this.pathBasis.segment(p0, p1, p2, p3)); - } - - // merge last & second-to-last path - paths.push(this.pathBasis.segment(p1, p2, p3, p3) + this.pathBasis(p2, p3, p3, p3)); - return paths; -}; - -/** - * @private Interpolates the given points with respective tangents using the cubic - * Hermite spline interpolation. If points.length == tangents.length then a regular - * Hermite interpolation is performed, if points.length == tangents.length + 2 then - * the first and last segments are filled in with cubic bazier segments. - * Returns an SVG path without the leading M instruction to allow path appending. - * - * @param points the array of points. - * @param tangents the array of tangent vectors. - */ -pv.SvgScene.curveHermite = function(points, tangents) { - if (tangents.length < 1 - || (points.length != tangents.length - && points.length != tangents.length + 2)) return ""; - 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.left - t0.x * 2 / 3) + "," + (p.top - t0.y * 2 / 3) - + "," + p.left + "," + p.top; - p0 = points[1]; - pi = 2; - } - - if (tangents.length > 1) { - t = tangents[1]; - p = points[pi]; - pi++; - path += "C" + (p0.left + t0.x) + "," + (p0.top + t0.y) - + "," + (p.left - t.x) + "," + (p.top - t.y) - + "," + p.left + "," + p.top; - for (var i = 2; i < tangents.length; i++, pi++) { - p = points[pi]; - t = tangents[i]; - path += "S" + (p.left - t.x) + "," + (p.top - t.y) - + "," + p.left + "," + p.top; - } - } - - if (quad) { - var lp = points[pi]; - path += "Q" + (p.left + t.x * 2 / 3) + "," + (p.top + t.y * 2 / 3) + "," - + lp.left + "," + lp.top; - } - - return path; -}; - -/** - * @private Interpolates the given points with respective tangents using the - * cubic Hermite spline interpolation. Returns an array of path strings. - * - * @param points the array of points. - * @param tangents the array of tangent vectors. - */ -pv.SvgScene.curveHermiteSegments = function(points, tangents) { - if (tangents.length < 1 - || (points.length != tangents.length - && points.length != tangents.length + 2)) return []; - var quad = points.length != tangents.length, - paths = [], - p0 = points[0], - p = p0, - t0 = tangents[0], - t = t0, - pi = 1; - - if (quad) { - p = points[1]; - paths.push("M" + p0.left + "," + p0.top - + "Q" + (p.left - t.x * 2 / 3) + "," + (p.top - t.y * 2 / 3) - + "," + p.left + "," + p.top); - pi = 2; - } - - for (var i = 1; i < tangents.length; i++, pi++) { - p0 = p; - t0 = t; - p = points[pi]; - t = tangents[i]; - paths.push("M" + p0.left + "," + p0.top - + "C" + (p0.left + t0.x) + "," + (p0.top + t0.y) - + "," + (p.left - t.x) + "," + (p.top - t.y) - + "," + p.left + "," + p.top); - } - - if (quad) { - var lp = points[pi]; - paths.push("M" + p.left + "," + p.top - + "Q" + (p.left + t.x * 2 / 3) + "," + (p.top + t.y * 2 / 3) + "," - + lp.left + "," + lp.top); - } - - return paths; -}; - -/** - * @private Computes the tangents for the given points needed for cardinal - * spline interpolation. Returns an array of tangent vectors. Note: that for n - * points only the n-2 well defined tangents are returned. - * - * @param points the array of points. - * @param tension the tension of hte cardinal spline. - */ -pv.SvgScene.cardinalTangents = function(points, tension) { - var tangents = [], - a = (1 - tension) / 2, - p0 = points[0], - p1 = points[1], - p2 = points[2]; - - for (var i = 3; i < points.length; i++) { - tangents.push({x: a * (p2.left - p0.left), y: a * (p2.top - p0.top)}); - p0 = p1; - p1 = p2; - p2 = points[i]; - } - - tangents.push({x: a * (p2.left - p0.left), y: a * (p2.top - p0.top)}); - return tangents; -}; - -/** - * @private Interpolates the given points using cardinal spline interpolation. - * Returns an SVG path without the leading M instruction to allow path - * appending. - * - * @param points the array of points. - * @param tension the tension of hte cardinal spline. - */ -pv.SvgScene.curveCardinal = function(points, tension) { - if (points.length <= 2) return ""; - return this.curveHermite(points, this.cardinalTangents(points, tension)); -}; - -/** - * @private Interpolates the given points using cardinal spline interpolation. - * Returns an array of path strings. - * - * @param points the array of points. - * @param tension the tension of hte cardinal spline. - */ -pv.SvgScene.curveCardinalSegments = function(points, tension) { - if (points.length <= 2) return ""; - return this.curveHermiteSegments(points, this.cardinalTangents(points, tension)); -}; - -/** - * @private Interpolates the given points using Fritsch-Carlson Monotone cubic - * Hermite interpolation. Returns an array of tangent vectors. - * - * @param points the array of points. - */ -pv.SvgScene.monotoneTangents = function(points) { - var tangents = [], - d = [], - m = [], - dx = [], - k = 0; - - /* Compute the slopes of the secant lines between successive points. */ - for (k = 0; k < points.length-1; k++) { - d[k] = (points[k+1].top - points[k].top)/(points[k+1].left - points[k].left); - } - - /* Initialize the tangents at every point as the average of the secants. */ - m[0] = d[0]; - dx[0] = points[1].left - points[0].left; - for (k = 1; k < points.length - 1; k++) { - m[k] = (d[k-1]+d[k])/2; - dx[k] = (points[k+1].left - points[k-1].left)/2; - } - m[k] = d[k-1]; - dx[k] = (points[k].left - points[k-1].left); - - /* Step 3. Very important, step 3. Yep. Wouldn't miss it. */ - for (k = 0; k < points.length - 1; k++) { - if (d[k] == 0) { - m[ k ] = 0; - m[k+1] = 0; - } - } - - /* Step 4 + 5. Out of 5 or more steps. */ - for (k = 0; k < points.length - 1; k++) { - if ((Math.abs(m[k]) < 1e-5) || (Math.abs(m[k+1]) < 1e-5)) continue; - var ak = m[k] / d[k], - bk = m[k + 1] / d[k], - s = ak * ak + bk * bk; // monotone constant (?) - if (s > 9) { - var tk = 3 / Math.sqrt(s); - m[k] = tk * ak * d[k]; - m[k + 1] = tk * bk * d[k]; - } - } - - var len; - for (var i = 0; i < points.length; i++) { - len = 1 + m[i] * m[i]; // pv.vector(1, m[i]).norm().times(dx[i]/3) - tangents.push({x: dx[i] / 3 / len, y: m[i] * dx[i] / 3 / len}); - } - - return tangents; -}; - -/** - * @private Interpolates the given points using Fritsch-Carlson Monotone cubic - * Hermite interpolation. Returns an SVG path without the leading M instruction - * to allow path appending. - * - * @param points the array of points. - */ -pv.SvgScene.curveMonotone = function(points) { - if (points.length <= 2) return ""; - return this.curveHermite(points, this.monotoneTangents(points)); -} - -/** - * @private Interpolates the given points using Fritsch-Carlson Monotone cubic - * Hermite interpolation. - * Returns an array of path strings. - * - * @param points the array of points. - */ -pv.SvgScene.curveMonotoneSegments = function(points) { - if (points.length <= 2) return ""; - return this.curveHermiteSegments(points, this.monotoneTangents(points)); -}; -pv.SvgScene.area = function(scenes) { - var e = scenes.$g.firstChild; - if (!scenes.length) return e; - var s = scenes[0]; - - /* segmented */ - if (s.segmented) return this.areaSegment(scenes); - - /* visible */ - if (!s.visible) return e; - var fill = s.fillStyle, stroke = s.strokeStyle; - if (!fill.opacity && !stroke.opacity) return e; - - /** @private Computes the straight path for the range [i, j]. */ - function path(i, j) { - var p1 = [], p2 = []; - for (var k = j; i <= k; i++, j--) { - var si = scenes[i], - sj = scenes[j], - pi = si.left + "," + si.top, - pj = (sj.left + sj.width) + "," + (sj.top + sj.height); - - /* interpolate */ - if (i < k) { - var sk = scenes[i + 1], sl = scenes[j - 1]; - switch (s.interpolate) { - case "step-before": { - pi += "V" + sk.top; - pj += "H" + (sl.left + sl.width); - break; - } - case "step-after": { - pi += "H" + sk.left; - pj += "V" + (sl.top + sl.height); - break; - } - } - } - - p1.push(pi); - p2.push(pj); - } - return p1.concat(p2).join("L"); - } - - /** @private Computes the curved path for the range [i, j]. */ - function pathCurve(i, j) { - var pointsT = [], pointsB = [], pathT, pathB; - - for (var k = j; i <= k; i++, j--) { - var sj = scenes[j]; - pointsT.push(scenes[i]); - pointsB.push({left: sj.left + sj.width, top: sj.top + sj.height}); - } - - if (s.interpolate == "basis") { - pathT = pv.SvgScene.curveBasis(pointsT); - pathB = pv.SvgScene.curveBasis(pointsB); - } else if (s.interpolate == "cardinal") { - pathT = pv.SvgScene.curveCardinal(pointsT, s.tension); - pathB = pv.SvgScene.curveCardinal(pointsB, s.tension); - } else { // monotone - pathT = pv.SvgScene.curveMonotone(pointsT); - pathB = pv.SvgScene.curveMonotone(pointsB); - } - - return pointsT[0].left + "," + pointsT[0].top + pathT - + "L" + pointsB[0].left + "," + pointsB[0].top + pathB; - } - - /* points */ - var d = [], si, sj; - for (var i = 0; i < scenes.length; i++) { - si = scenes[i]; if (!si.width && !si.height) continue; - for (var j = i + 1; j < scenes.length; j++) { - sj = scenes[j]; if (!sj.width && !sj.height) break; - } - if (i && (s.interpolate != "step-after")) i--; - if ((j < scenes.length) && (s.interpolate != "step-before")) j++; - d.push(((j - i > 2 - && (s.interpolate == "basis" - || s.interpolate == "cardinal" - || s.interpolate == "monotone")) - ? pathCurve : path)(i, j - 1)); - i = j - 1; - } - if (!d.length) return e; - - e = this.expect(e, "path", { - "shape-rendering": s.antialias ? null : "crispEdges", - "pointer-events": s.events, - "cursor": s.cursor, - "d": "M" + d.join("ZM") + "Z", - "fill": fill.color, - "fill-opacity": fill.opacity || null, - "stroke": stroke.color, - "stroke-opacity": stroke.opacity || null, - "stroke-width": stroke.opacity ? s.lineWidth / this.scale : null - }); - return this.append(e, scenes, 0); -}; - -pv.SvgScene.areaSegment = function(scenes) { - var e = scenes.$g.firstChild, s = scenes[0], pathsT, pathsB; - if (s.interpolate == "basis" - || s.interpolate == "cardinal" - || s.interpolate == "monotone") { - var pointsT = [], pointsB = []; - - for (var i = 0, n = scenes.length; i < n; i++) { - var sj = scenes[n - i - 1]; - pointsT.push(scenes[i]); - pointsB.push({left: sj.left + sj.width, top: sj.top + sj.height}); - } - - if (s.interpolate == "basis") { - pathsT = this.curveBasisSegments(pointsT); - pathsB = this.curveBasisSegments(pointsB); - } else if (s.interpolate == "cardinal") { - pathsT = this.curveCardinalSegments(pointsT, s.tension); - pathsB = this.curveCardinalSegments(pointsB, s.tension); - } else { // monotone - pathsT = this.curveMonotoneSegments(pointsT); - pathsB = this.curveMonotoneSegments(pointsB); - } - } - - for (var i = 0, n = scenes.length - 1; i < n; i++) { - var s1 = scenes[i], s2 = scenes[i + 1]; - - /* visible */ - if (!s1.visible || !s2.visible) continue; - var fill = s1.fillStyle, stroke = s1.strokeStyle; - if (!fill.opacity && !stroke.opacity) continue; - - var d; - if (pathsT) { - var pathT = pathsT[i], - pathB = "L" + pathsB[n - i - 1].substr(1); - - d = pathT + pathB + "Z"; - } else { - /* interpolate */ - var si = s1, sj = s2; - switch (s1.interpolate) { - case "step-before": si = s2; break; - case "step-after": sj = s1; break; - } - - /* path */ - d = "M" + s1.left + "," + si.top - + "L" + s2.left + "," + sj.top - + "L" + (s2.left + s2.width) + "," + (sj.top + sj.height) - + "L" + (s1.left + s1.width) + "," + (si.top + si.height) - + "Z"; - } - - e = this.expect(e, "path", { - "shape-rendering": s1.antialias ? null : "crispEdges", - "pointer-events": s1.events, - "cursor": s1.cursor, - "d": d, - "fill": fill.color, - "fill-opacity": fill.opacity || null, - "stroke": stroke.color, - "stroke-opacity": stroke.opacity || null, - "stroke-width": stroke.opacity ? s1.lineWidth / this.scale : null - }); - e = this.append(e, scenes, i); - } - return e; -}; -pv.SvgScene.bar = function(scenes) { - var e = scenes.$g.firstChild; - for (var i = 0; i < scenes.length; i++) { - var s = scenes[i]; - - /* visible */ - if (!s.visible) continue; - var fill = s.fillStyle, stroke = s.strokeStyle; - if (!fill.opacity && !stroke.opacity) continue; - - e = this.expect(e, "rect", { - "shape-rendering": s.antialias ? null : "crispEdges", - "pointer-events": s.events, - "cursor": s.cursor, - "x": s.left, - "y": s.top, - "width": Math.max(1E-10, s.width), - "height": Math.max(1E-10, s.height), - "fill": fill.color, - "fill-opacity": fill.opacity || null, - "stroke": stroke.color, - "stroke-opacity": stroke.opacity || null, - "stroke-width": stroke.opacity ? s.lineWidth / this.scale : null - }); - e = this.append(e, scenes, i); - } - return e; -}; -pv.SvgScene.dot = function(scenes) { - var e = scenes.$g.firstChild; - for (var i = 0; i < scenes.length; i++) { - var s = scenes[i]; - - /* visible */ - if (!s.visible) continue; - var fill = s.fillStyle, stroke = s.strokeStyle; - if (!fill.opacity && !stroke.opacity) continue; - - /* points */ - var radius = s.radius, path = null; - switch (s.shape) { - case "cross": { - path = "M" + -radius + "," + -radius - + "L" + radius + "," + radius - + "M" + radius + "," + -radius - + "L" + -radius + "," + radius; - break; - } - case "triangle": { - var h1 = radius * 1.3333, - h2 = radius * 0.6666, - w = radius * 1.1547; // 2 / Math.sqrt(3) - path = "M0," + h1 - + "L" + w +"," + -h2 - + " " + -w + "," + -h2 - + "Z"; - break; - } - case "diamond": { - radius *= Math.SQRT2; - path = "M0," + -radius - + "L" + radius + ",0" - + " 0," + radius - + " " + -radius + ",0" - + "Z"; - break; - } - case "square": { - path = "M" + -radius + "," + -radius - + "L" + radius + "," + -radius - + " " + radius + "," + radius - + " " + -radius + "," + radius - + "Z"; - break; - } - case "tick": { - path = "M0,0L0," + -s.size; - break; - } - case "bar": { - path = "M0," + (s.size / 2) + "L0," + -(s.size / 2); - break; - } - } - - /* Use for circles, for everything else. */ - var svg = { - "shape-rendering": s.antialias ? null : "crispEdges", - "pointer-events": s.events, - "cursor": s.cursor, - "fill": fill.color, - "fill-opacity": fill.opacity || null, - "stroke": stroke.color, - "stroke-opacity": stroke.opacity || null, - "stroke-width": stroke.opacity ? s.lineWidth / this.scale : null - }; - if (path) { - svg.transform = "translate(" + s.left + "," + s.top + ")"; - if (s.angle) svg.transform += " rotate(" + 180 * s.angle / Math.PI + ")"; - svg.d = path; - e = this.expect(e, "path", svg); - } else { - svg.cx = s.left; - svg.cy = s.top; - svg.r = radius; - e = this.expect(e, "circle", svg); - } - e = this.append(e, scenes, i); - } - return e; -}; -pv.SvgScene.image = function(scenes) { - var e = scenes.$g.firstChild; - for (var i = 0; i < scenes.length; i++) { - var s = scenes[i]; - - /* visible */ - if (!s.visible) continue; - - /* fill */ - e = this.fill(e, scenes, i); - - /* image */ - if (s.image) { - e = this.expect(e, "foreignObject", { - "cursor": s.cursor, - "x": s.left, - "y": s.top, - "width": s.width, - "height": s.height - }); - var c = e.firstChild || e.appendChild(document.createElementNS(this.xhtml, "canvas")); - c.$scene = {scenes:scenes, index:i}; - c.style.width = s.width; - c.style.height = s.height; - c.width = s.imageWidth; - c.height = s.imageHeight; - c.getContext("2d").putImageData(s.image, 0, 0); - } else { - e = this.expect(e, "image", { - "preserveAspectRatio": "none", - "cursor": s.cursor, - "x": s.left, - "y": s.top, - "width": s.width, - "height": s.height - }); - e.setAttributeNS(this.xlink, "href", s.url); - } - e = this.append(e, scenes, i); - - /* stroke */ - e = this.stroke(e, scenes, i); - } - return e; -}; -pv.SvgScene.label = function(scenes) { - var e = scenes.$g.firstChild; - for (var i = 0; i < scenes.length; i++) { - var s = scenes[i]; - - /* visible */ - if (!s.visible) continue; - var fill = s.textStyle; - if (!fill.opacity || !s.text) continue; - - /* text-baseline, text-align */ - var x = 0, y = 0, dy = 0, anchor = "start"; - switch (s.textBaseline) { - case "middle": dy = ".35em"; break; - case "top": dy = ".71em"; y = s.textMargin; break; - case "bottom": y = "-" + s.textMargin; break; - } - switch (s.textAlign) { - case "right": anchor = "end"; x = "-" + s.textMargin; break; - case "center": anchor = "middle"; break; - case "left": x = s.textMargin; break; - } - - e = this.expect(e, "text", { - "pointer-events": s.events, - "cursor": s.cursor, - "x": x, - "y": y, - "dy": dy, - "transform": "translate(" + s.left + "," + s.top + ")" - + (s.textAngle ? " rotate(" + 180 * s.textAngle / Math.PI + ")" : "") - + (this.scale != 1 ? " scale(" + 1 / this.scale + ")" : ""), - "fill": fill.color, - "fill-opacity": fill.opacity || null, - "text-anchor": anchor - }, { - "font": s.font, - "text-shadow": s.textShadow, - "text-decoration": s.textDecoration - }); - if (e.firstChild) e.firstChild.nodeValue = s.text; - else e.appendChild(document.createTextNode(s.text)); - e = this.append(e, scenes, i); - } - return e; -}; -pv.SvgScene.line = function(scenes) { - var e = scenes.$g.firstChild; - if (scenes.length < 2) return e; - var s = scenes[0]; - - /* segmented */ - if (s.segmented) return this.lineSegment(scenes); - - /* visible */ - if (!s.visible) return e; - var fill = s.fillStyle, stroke = s.strokeStyle; - if (!fill.opacity && !stroke.opacity) return e; - - /* points */ - var d = "M" + s.left + "," + s.top; - - if (scenes.length > 2 && (s.interpolate == "basis" || s.interpolate == "cardinal" || s.interpolate == "monotone")) { - switch (s.interpolate) { - case "basis": d += this.curveBasis(scenes); break; - case "cardinal": d += this.curveCardinal(scenes, s.tension); break; - case "monotone": d += this.curveMonotone(scenes); break; - } - } else { - for (var i = 1; i < scenes.length; i++) { - d += this.pathSegment(scenes[i - 1], scenes[i]); - } - } - - e = this.expect(e, "path", { - "shape-rendering": s.antialias ? null : "crispEdges", - "pointer-events": s.events, - "cursor": s.cursor, - "d": d, - "fill": fill.color, - "fill-opacity": fill.opacity || null, - "stroke": stroke.color, - "stroke-opacity": stroke.opacity || null, - "stroke-width": stroke.opacity ? s.lineWidth / this.scale : null, - "stroke-linejoin": s.lineJoin - }); - return this.append(e, scenes, 0); -}; - -pv.SvgScene.lineSegment = function(scenes) { - var e = scenes.$g.firstChild; - - var s = scenes[0]; - var paths; - switch (s.interpolate) { - case "basis": paths = this.curveBasisSegments(scenes); break; - case "cardinal": paths = this.curveCardinalSegments(scenes, s.tension); break; - case "monotone": paths = this.curveMonotoneSegments(scenes); break; - } - - for (var i = 0, n = scenes.length - 1; i < n; i++) { - var s1 = scenes[i], s2 = scenes[i + 1]; - - /* visible */ - if (!s1.visible || !s2.visible) continue; - var stroke = s1.strokeStyle, fill = pv.Color.transparent; - if (!stroke.opacity) continue; - - /* interpolate */ - var d; - if ((s1.interpolate == "linear") && (s1.lineJoin == "miter")) { - fill = stroke; - stroke = pv.Color.transparent; - d = this.pathJoin(scenes[i - 1], s1, s2, scenes[i + 2]); - } else if(paths) { - d = paths[i]; - } else { - d = "M" + s1.left + "," + s1.top + this.pathSegment(s1, s2); - } - - e = this.expect(e, "path", { - "shape-rendering": s1.antialias ? null : "crispEdges", - "pointer-events": s1.events, - "cursor": s1.cursor, - "d": d, - "fill": fill.color, - "fill-opacity": fill.opacity || null, - "stroke": stroke.color, - "stroke-opacity": stroke.opacity || null, - "stroke-width": stroke.opacity ? s1.lineWidth / this.scale : null, - "stroke-linejoin": s1.lineJoin - }); - e = this.append(e, scenes, i); - } - return e; -}; - -/** @private Returns the path segment for the specified points. */ -pv.SvgScene.pathSegment = function(s1, s2) { - var l = 1; // sweep-flag - switch (s1.interpolate) { - case "polar-reverse": - l = 0; - case "polar": { - var dx = s2.left - s1.left, - dy = s2.top - s1.top, - e = 1 - s1.eccentricity, - r = Math.sqrt(dx * dx + dy * dy) / (2 * e); - if ((e <= 0) || (e > 1)) break; // draw a straight line - return "A" + r + "," + r + " 0 0," + l + " " + s2.left + "," + s2.top; - } - case "step-before": return "V" + s2.top + "H" + s2.left; - case "step-after": return "H" + s2.left + "V" + s2.top; - } - return "L" + s2.left + "," + s2.top; -}; - -/** @private Line-line intersection, per Akenine-Moller 16.16.1. */ -pv.SvgScene.lineIntersect = function(o1, d1, o2, d2) { - return o1.plus(d1.times(o2.minus(o1).dot(d2.perp()) / d1.dot(d2.perp()))); -} - -/** @private Returns the miter join path for the specified points. */ -pv.SvgScene.pathJoin = function(s0, s1, s2, s3) { - /* - * P1-P2 is the current line segment. V is a vector that is perpendicular to - * the line segment, and has length lineWidth / 2. ABCD forms the initial - * bounding box of the line segment (i.e., the line segment if we were to do - * no joins). - */ - var p1 = pv.vector(s1.left, s1.top), - p2 = pv.vector(s2.left, s2.top), - p = p2.minus(p1), - v = p.perp().norm(), - w = v.times(s1.lineWidth / (2 * this.scale)), - a = p1.plus(w), - b = p2.plus(w), - c = p2.minus(w), - d = p1.minus(w); - - /* - * Start join. P0 is the previous line segment's start point. We define the - * cutting plane as the average of the vector perpendicular to P0-P1, and - * the vector perpendicular to P1-P2. This insures that the cross-section of - * the line on the cutting plane is equal if the line-width is unchanged. - * Note that we don't implement miter limits, so these can get wild. - */ - if (s0 && s0.visible) { - var v1 = p1.minus(s0.left, s0.top).perp().norm().plus(v); - d = this.lineIntersect(p1, v1, d, p); - a = this.lineIntersect(p1, v1, a, p); - } - - /* Similarly, for end join. */ - if (s3 && s3.visible) { - var v2 = pv.vector(s3.left, s3.top).minus(p2).perp().norm().plus(v); - c = this.lineIntersect(p2, v2, c, p); - b = this.lineIntersect(p2, v2, b, p); - } - - return "M" + a.x + "," + a.y - + "L" + b.x + "," + b.y - + " " + c.x + "," + c.y - + " " + d.x + "," + d.y; -}; -pv.SvgScene.panel = function(scenes) { - var g = scenes.$g, e = g && g.firstChild; - for (var i = 0; i < scenes.length; i++) { - var s = scenes[i]; - - /* visible */ - if (!s.visible) continue; - - /* svg */ - if (!scenes.parent) { - s.canvas.style.display = "inline-block"; - if (g && (g.parentNode != s.canvas)) { - g = s.canvas.firstChild; - e = g && g.firstChild; - } - if (!g) { - g = s.canvas.appendChild(this.create("svg")); - g.setAttribute("font-size", "10px"); - g.setAttribute("font-family", "sans-serif"); - g.setAttribute("fill", "none"); - g.setAttribute("stroke", "none"); - g.setAttribute("stroke-width", 1.5); - for (var j = 0; j < this.events.length; j++) { - g.addEventListener(this.events[j], this.dispatch, false); - } - e = g.firstChild; - } - scenes.$g = g; - g.setAttribute("width", s.width + s.left + s.right); - g.setAttribute("height", s.height + s.top + s.bottom); - } - - /* clip (nest children) */ - if (s.overflow == "hidden") { - var id = pv.id().toString(36), - c = this.expect(e, "g", {"clip-path": "url(#" + id + ")"}); - if (!c.parentNode) g.appendChild(c); - scenes.$g = g = c; - e = c.firstChild; - - e = this.expect(e, "clipPath", {"id": id}); - var r = e.firstChild || e.appendChild(this.create("rect")); - r.setAttribute("x", s.left); - r.setAttribute("y", s.top); - r.setAttribute("width", s.width); - r.setAttribute("height", s.height); - if (!e.parentNode) g.appendChild(e); - e = e.nextSibling; - } - - /* fill */ - e = this.fill(e, scenes, i); - - /* transform (push) */ - var k = this.scale, - t = s.transform, - x = s.left + t.x, - y = s.top + t.y; - this.scale *= t.k; - - /* children */ - for (var j = 0; j < s.children.length; j++) { - s.children[j].$g = e = this.expect(e, "g", { - "transform": "translate(" + x + "," + y + ")" - + (t.k != 1 ? " scale(" + t.k + ")" : "") - }); - this.updateAll(s.children[j]); - if (!e.parentNode) g.appendChild(e); - e = e.nextSibling; - } - - /* transform (pop) */ - this.scale = k; - - /* stroke */ - e = this.stroke(e, scenes, i); - - /* clip (restore group) */ - if (s.overflow == "hidden") { - scenes.$g = g = c.parentNode; - e = c.nextSibling; - } - } - return e; -}; - -pv.SvgScene.fill = function(e, scenes, i) { - var s = scenes[i], fill = s.fillStyle; - if (fill.opacity || s.events == "all") { - e = this.expect(e, "rect", { - "shape-rendering": s.antialias ? null : "crispEdges", - "pointer-events": s.events, - "cursor": s.cursor, - "x": s.left, - "y": s.top, - "width": s.width, - "height": s.height, - "fill": fill.color, - "fill-opacity": fill.opacity, - "stroke": null - }); - e = this.append(e, scenes, i); - } - return e; -}; - -pv.SvgScene.stroke = function(e, scenes, i) { - var s = scenes[i], stroke = s.strokeStyle; - if (stroke.opacity || s.events == "all") { - e = this.expect(e, "rect", { - "shape-rendering": s.antialias ? null : "crispEdges", - "pointer-events": s.events == "all" ? "stroke" : s.events, - "cursor": s.cursor, - "x": s.left, - "y": s.top, - "width": Math.max(1E-10, s.width), - "height": Math.max(1E-10, s.height), - "fill": null, - "stroke": stroke.color, - "stroke-opacity": stroke.opacity, - "stroke-width": s.lineWidth / this.scale - }); - e = this.append(e, scenes, i); - } - return e; -}; -pv.SvgScene.rule = function(scenes) { - var e = scenes.$g.firstChild; - for (var i = 0; i < scenes.length; i++) { - var s = scenes[i]; - - /* visible */ - if (!s.visible) continue; - var stroke = s.strokeStyle; - if (!stroke.opacity) continue; - - e = this.expect(e, "line", { - "shape-rendering": s.antialias ? null : "crispEdges", - "pointer-events": s.events, - "cursor": s.cursor, - "x1": s.left, - "y1": s.top, - "x2": s.left + s.width, - "y2": s.top + s.height, - "stroke": stroke.color, - "stroke-opacity": stroke.opacity, - "stroke-width": s.lineWidth / this.scale - }); - e = this.append(e, scenes, i); - } - return e; -}; -pv.SvgScene.wedge = function(scenes) { - var e = scenes.$g.firstChild; - for (var i = 0; i < scenes.length; i++) { - var s = scenes[i]; - - /* visible */ - if (!s.visible) continue; - var fill = s.fillStyle, stroke = s.strokeStyle; - if (!fill.opacity && !stroke.opacity) continue; - - /* points */ - var r1 = s.innerRadius, r2 = s.outerRadius, a = Math.abs(s.angle), p; - if (a >= 2 * Math.PI) { - if (r1) { - p = "M0," + r2 - + "A" + r2 + "," + r2 + " 0 1,1 0," + (-r2) - + "A" + r2 + "," + r2 + " 0 1,1 0," + r2 - + "M0," + r1 - + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) - + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 - + "Z"; - } else { - p = "M0," + r2 - + "A" + r2 + "," + r2 + " 0 1,1 0," + (-r2) - + "A" + r2 + "," + r2 + " 0 1,1 0," + r2 - + "Z"; - } - } else { - var sa = Math.min(s.startAngle, s.endAngle), - ea = Math.max(s.startAngle, s.endAngle), - c1 = Math.cos(sa), c2 = Math.cos(ea), - s1 = Math.sin(sa), s2 = Math.sin(ea); - if (r1) { - p = "M" + r2 * c1 + "," + r2 * s1 - + "A" + r2 + "," + r2 + " 0 " - + ((a < Math.PI) ? "0" : "1") + ",1 " - + r2 * c2 + "," + r2 * s2 - + "L" + r1 * c2 + "," + r1 * s2 - + "A" + r1 + "," + r1 + " 0 " - + ((a < Math.PI) ? "0" : "1") + ",0 " - + r1 * c1 + "," + r1 * s1 + "Z"; - } else { - p = "M" + r2 * c1 + "," + r2 * s1 - + "A" + r2 + "," + r2 + " 0 " - + ((a < Math.PI) ? "0" : "1") + ",1 " - + r2 * c2 + "," + r2 * s2 + "L0,0Z"; - } - } - - e = this.expect(e, "path", { - "shape-rendering": s.antialias ? null : "crispEdges", - "pointer-events": s.events, - "cursor": s.cursor, - "transform": "translate(" + s.left + "," + s.top + ")", - "d": p, - "fill": fill.color, - "fill-rule": "evenodd", - "fill-opacity": fill.opacity || null, - "stroke": stroke.color, - "stroke-opacity": stroke.opacity || null, - "stroke-width": stroke.opacity ? s.lineWidth / this.scale : null - }); - e = this.append(e, scenes, i); - } - return e; -}; -/** - * Constructs a new mark with default properties. Marks, with the exception of - * the root panel, are not typically constructed directly; instead, they are - * added to a panel or an existing mark via {@link pv.Mark#add}. - * - * @class Represents a data-driven graphical mark. The Mark class is - * the base class for all graphical marks in Protovis; it does not provide any - * specific rendering functionality, but together with {@link Panel} establishes - * the core framework. - * - *

Concrete mark types include familiar visual elements such as bars, lines - * and labels. Although a bar mark may be used to construct a bar chart, marks - * know nothing about charts; it is only through their specification and - * composition that charts are produced. These building blocks permit many - * combinatorial possibilities. - * - *

Marks are associated with data: a mark is generated once per - * associated datum, mapping the datum to visual properties such as - * position and color. Thus, a single mark specification represents a set of - * visual elements that share the same data and visual encoding. The type of - * mark defines the names of properties and their meaning. A property may be - * static, ignoring the associated datum and returning a constant; or, it may be - * dynamic, derived from the associated datum or index. Such dynamic encodings - * can be specified succinctly using anonymous functions. Special properties - * called event handlers can be registered to add interactivity. - * - *

Protovis uses inheritance to simplify the specification of related - * marks: a new mark can be derived from an existing mark, inheriting its - * properties. The new mark can then override properties to specify new - * behavior, potentially in terms of the old behavior. In this way, the old mark - * serves as the prototype for the new mark. Most mark types share the - * same basic properties for consistency and to facilitate inheritance. - * - *

The prioritization of redundant properties is as follows:

    - * - *
  1. If the width property is not specified (i.e., null), its value - * is the width of the parent panel, minus this mark's left and right margins; - * the left and right margins are zero if not specified. - * - *
  2. Otherwise, if the right margin is not specified, its value is - * the width of the parent panel, minus this mark's width and left margin; the - * left margin is zero if not specified. - * - *
  3. Otherwise, if the left property is not specified, its value is - * the width of the parent panel, minus this mark's width and the right margin. - * - *
This prioritization is then duplicated for the height, - * bottom and top properties, respectively. - * - *

While most properties are variable, some mark types, such as lines - * and areas, generate a single visual element rather than a distinct visual - * element per datum. With these marks, some properties may be fixed. - * Fixed properties can vary per mark, but not per datum! These - * properties are evaluated solely for the first (0-index) datum, and typically - * are specified as a constant. However, it is valid to use a function if the - * property varies between panels or is dynamically generated. - * - *

See also the Protovis guide. - */ -pv.Mark = function() { - /* - * TYPE 0 constant defs - * TYPE 1 function defs - * TYPE 2 constant properties - * TYPE 3 function properties - * in order of evaluation! - */ - this.$properties = []; - this.$handlers = {}; -}; - -/** @private Records which properties are defined on this mark type. */ -pv.Mark.prototype.properties = {}; - -/** @private Records the cast function for each property. */ -pv.Mark.cast = {}; - -/** - * @private Defines and registers a property method for the property with the - * given name. This method should be called on a mark class prototype to define - * each exposed property. (Note this refers to the JavaScript - * prototype, not the Protovis mark prototype, which is the {@link - * #proto} field.) - * - *

The created property method supports several modes of invocation:

    - * - *
  1. If invoked with a Function argument, this function is evaluated - * for each associated datum. The return value of the function is used as the - * computed property value. The context of the function (this) is this - * mark. The arguments to the function are the associated data of this mark and - * any enclosing panels. For example, a linear encoding of numerical data to - * height is specified as - * - *
    m.height(function(d) d * 100);
    - * - * The expression d * 100 will be evaluated for the height property of - * each mark instance. The return value of the property method (e.g., - * m.height) is this mark (m)).

    - * - *

  2. If invoked with a non-function argument, the property is treated as a - * constant. The return value of the property method (e.g., m.height) - * is this mark.

    - * - *

  3. If invoked with no arguments, the computed property value for the current - * mark instance in the scene graph is returned. This facilitates property - * chaining, where one mark's properties are defined in terms of another's. - * For example, to offset a mark's location from its prototype, you might say - * - *
    m.top(function() this.proto.top() + 10);
    - * - * Note that the index of the mark being evaluated (in the above example, - * this.proto) is inherited from the Mark class and set by - * this mark. So, if the fifth element's top property is being evaluated, the - * fifth instance of this.proto will similarly be queried for the value - * of its top property. If the mark being evaluated has a different number of - * instances, or its data is unrelated, the behavior of this method is - * undefined. In these cases it may be better to index the scene - * explicitly to specify the exact instance. - * - *

Property names should follow standard JavaScript method naming - * conventions, using lowerCamel-style capitalization. - * - *

In addition to creating the property method, every property is registered - * in the {@link #properties} map on the prototype. Although this is an - * instance field, it is considered immutable and shared by all instances of a - * given mark type. The properties map can be queried to see if a mark - * type defines a particular property, such as width or height. - * - * @param {string} name the property name. - * @param {function} [cast] the cast function for this property. - */ -pv.Mark.prototype.property = function(name, cast) { - if (!this.hasOwnProperty("properties")) { - this.properties = pv.extend(this.properties); - } - this.properties[name] = true; - - /* - * Define the setter-getter globally, since the default behavior should be the - * same for all properties, and since the Protovis inheritance chain is - * independent of the JavaScript inheritance chain. For example, anchors - * define a "name" property that is evaluated on derived marks, even though - * those marks don't normally have a name. - */ - pv.Mark.prototype.propertyMethod(name, false, pv.Mark.cast[name] = cast); - return this; -}; - -/** - * @private Defines a setter-getter for the specified property. - * - *

If a cast function has been assigned to the specified property name, the - * property function is wrapped by the cast function, or, if a constant is - * specified, the constant is immediately cast. Note, however, that if the - * property value is null, the cast function is not invoked. - * - * @param {string} name the property name. - * @param {boolean} [def] whether is a property or a def. - * @param {function} [cast] the cast function for this property. - */ -pv.Mark.prototype.propertyMethod = function(name, def, cast) { - if (!cast) cast = pv.Mark.cast[name]; - this[name] = function(v) { - - /* If this is a def, use it rather than property. */ - if (def && this.scene) { - var defs = this.scene.defs; - if (arguments.length) { - defs[name] = { - id: (v == null) ? 0 : pv.id(), - value: ((v != null) && cast) ? cast(v) : v - }; - return this; - } - return defs[name] ? defs[name].value : null; - } - - /* If arguments are specified, set the property value. */ - if (arguments.length) { - var type = !def << 1 | (typeof v == "function"); - this.propertyValue(name, (type & 1 && cast) ? function() { - var x = v.apply(this, arguments); - return (x != null) ? cast(x) : null; - } : (((v != null) && cast) ? cast(v) : v)).type = type; - return this; - } - - return this.instance()[name]; - }; -}; - -/** @private Sets the value of the property name to v. */ -pv.Mark.prototype.propertyValue = function(name, v) { - var properties = this.$properties, p = {name: name, id: pv.id(), value: v}; - for (var i = 0; i < properties.length; i++) { - if (properties[i].name == name) { - properties.splice(i, 1); - break; - } - } - properties.push(p); - return p; -}; - -/* Define all global properties. */ -pv.Mark.prototype - .property("data") - .property("visible", Boolean) - .property("left", Number) - .property("right", Number) - .property("top", Number) - .property("bottom", Number) - .property("cursor", String) - .property("title", String) - .property("reverse", Boolean) - .property("antialias", Boolean) - .property("events", String); - -/** - * The mark type; a lower camelCase name. The type name controls rendering - * behavior, and unless the rendering engine is extended, must be one of the - * built-in concrete mark types: area, bar, dot, image, label, line, panel, - * rule, or wedge. - * - * @type string - * @name pv.Mark.prototype.type - */ - -/** - * The mark prototype, possibly undefined, from which to inherit property - * functions. The mark prototype is not necessarily of the same type as this - * mark. Any properties defined on this mark will override properties inherited - * either from the prototype or from the type-specific defaults. - * - * @type pv.Mark - * @name pv.Mark.prototype.proto - */ - -/** - * The enclosing parent panel. The parent panel is generally undefined only for - * the root panel; however, it is possible to create "offscreen" marks that are - * used only for inheritance purposes. - * - * @type pv.Panel - * @name pv.Mark.prototype.parent - */ - -/** - * The child index. -1 if the enclosing parent panel is null; otherwise, the - * zero-based index of this mark into the parent panel's children array. - * - * @type number - */ -pv.Mark.prototype.childIndex = -1; - -/** - * The mark index. The value of this field depends on which instance (i.e., - * which element of the data array) is currently being evaluated. During the - * build phase, the index is incremented over each datum; when handling events, - * the index is set to the instance that triggered the event. - * - * @type number - */ -pv.Mark.prototype.index = -1; - -/** - * The current scale factor, based on any enclosing transforms. The current - * scale can be used to create scale-independent graphics. For example, to - * define a dot that has a radius of 10 irrespective of any zooming, say: - * - *

dot.radius(function() 10 / this.scale)
- * - * Note that the stroke width and font size are defined irrespective of scale - * (i.e., in screen space) already. Also note that when a transform is applied - * to a panel, the scale affects only the child marks, not the panel itself. - * - * @type number - * @see pv.Panel#transform - */ -pv.Mark.prototype.scale = 1; - -/** - * @private The scene graph. The scene graph is an array of objects; each object - * (or "node") corresponds to an instance of this mark and an element in the - * data array. The scene graph can be traversed to lookup previously-evaluated - * properties. - * - * @name pv.Mark.prototype.scene - */ - -/** - * The root parent panel. This may be undefined for "offscreen" marks that are - * created for inheritance purposes only. - * - * @type pv.Panel - * @name pv.Mark.prototype.root - */ - -/** - * The data property; an array of objects. The size of the array determines the - * number of marks that will be instantiated; each element in the array will be - * passed to property functions to compute the property values. Typically, the - * data property is specified as a constant array, such as - * - *
m.data([1, 2, 3, 4, 5]);
- * - * However, it is perfectly acceptable to define the data property as a - * function. This function might compute the data dynamically, allowing - * different data to be used per enclosing panel. For instance, in the stacked - * area graph example (see {@link #scene}), the data function on the area mark - * dereferences each series. - * - * @type array - * @name pv.Mark.prototype.data - */ - -/** - * The visible property; a boolean determining whether or not the mark instance - * is visible. If a mark instance is not visible, its other properties will not - * be evaluated. Similarly, for panels no child marks will be rendered. - * - * @type boolean - * @name pv.Mark.prototype.visible - */ - -/** - * The left margin; the distance, in pixels, between the left edge of the - * enclosing panel and the left edge of this mark. Note that in some cases this - * property may be redundant with the right property, or with the conjunction of - * right and width. - * - * @type number - * @name pv.Mark.prototype.left - */ - -/** - * The right margin; the distance, in pixels, between the right edge of the - * enclosing panel and the right edge of this mark. Note that in some cases this - * property may be redundant with the left property, or with the conjunction of - * left and width. - * - * @type number - * @name pv.Mark.prototype.right - */ - -/** - * The top margin; the distance, in pixels, between the top edge of the - * enclosing panel and the top edge of this mark. Note that in some cases this - * property may be redundant with the bottom property, or with the conjunction - * of bottom and height. - * - * @type number - * @name pv.Mark.prototype.top - */ - -/** - * The bottom margin; the distance, in pixels, between the bottom edge of the - * enclosing panel and the bottom edge of this mark. Note that in some cases - * this property may be redundant with the top property, or with the conjunction - * of top and height. - * - * @type number - * @name pv.Mark.prototype.bottom - */ - -/** - * The cursor property; corresponds to the CSS cursor property. This is - * typically used in conjunction with event handlers to indicate interactivity. - * - * @type string - * @name pv.Mark.prototype.cursor - * @see CSS2 cursor - */ - -/** - * The title property; corresponds to the HTML/SVG title property, allowing the - * general of simple plain text tooltips. - * - * @type string - * @name pv.Mark.prototype.title - */ - -/** - * The events property; corresponds to the SVG pointer-events property, - * specifying how the mark should participate in mouse events. The default value - * is "painted". Supported values are: - * - *

"painted": The given mark may receive events when the mouse is over a - * "painted" area. The painted areas are the interior (i.e., fill) of the mark - * if a 'fillStyle' is specified, and the perimeter (i.e., stroke) of the mark - * if a 'strokeStyle' is specified. - * - *

"all": The given mark may receive events when the mouse is over either the - * interior (i.e., fill) or the perimeter (i.e., stroke) of the mark, regardless - * of the specified fillStyle and strokeStyle. - * - *

"none": The given mark may not receive events. - * - * @type string - * @name pv.Mark.prototype.events - */ - -/** - * The reverse property; a boolean determining whether marks are ordered from - * front-to-back or back-to-front. SVG does not support explicit z-ordering; - * shapes are rendered in the order they appear. Thus, by default, marks are - * rendered in data order. Setting the reverse property to false reverses the - * order in which they are rendered; however, the properties are still evaluated - * (i.e., built) in forward order. - * - * @type boolean - * @name pv.Mark.prototype.reverse - */ - -/** - * Default properties for all mark types. By default, the data array is the - * parent data as a single-element array; if the data property is not specified, - * this causes each mark to be instantiated as a singleton with the parents - * datum. The visible property is true by default, and the reverse property is - * false. - * - * @type pv.Mark - */ -pv.Mark.prototype.defaults = new pv.Mark() - .data(function(d) { return [d]; }) - .visible(true) - .antialias(true) - .events("painted"); - -/** - * Sets the prototype of this mark to the specified mark. Any properties not - * defined on this mark may be inherited from the specified prototype mark, or - * its prototype, and so on. The prototype mark need not be the same type of - * mark as this mark. (Note that for inheritance to be useful, properties with - * the same name on different mark types should have equivalent meaning.) - * - * @param {pv.Mark} proto the new prototype. - * @returns {pv.Mark} this mark. - * @see #add - */ -pv.Mark.prototype.extend = function(proto) { - this.proto = proto; - return this; -}; - -/** - * Adds a new mark of the specified type to the enclosing parent panel, whilst - * simultaneously setting the prototype of the new mark to be this mark. - * - * @param {function} type the type of mark to add; a constructor, such as - * pv.Bar. - * @returns {pv.Mark} the new mark. - * @see #extend - */ -pv.Mark.prototype.add = function(type) { - return this.parent.add(type).extend(this); -}; - -/** - * Defines a custom property on this mark. Custom properties are currently - * fixed, in that they are initialized once per mark set (i.e., per parent panel - * instance). Custom properties can be used to store local state for the mark, - * such as data needed by other properties (e.g., a custom scale) or interaction - * state. - * - *

WARNING We plan on changing this feature in a future release to define - * standard properties, as opposed to fixed properties that behave - * idiosyncratically within event handlers. Furthermore, we recommend storing - * state in an external data structure, rather than tying it to the - * visualization specification as with defs. - * - * @param {string} name the name of the local variable. - * @param {function} [v] an optional initializer; may be a constant or a - * function. - */ -pv.Mark.prototype.def = function(name, v) { - this.propertyMethod(name, true); - return this[name](arguments.length > 1 ? v : null); -}; - -/** - * Returns an anchor with the specified name. All marks support the five - * standard anchor names:

In addition to positioning properties (left, right, top bottom), the - * anchors support text rendering properties (text-align, text-baseline). Text is - * rendered to appear inside the mark by default. - * - *

To facilitate stacking, anchors are defined in terms of their opposite - * edge. For example, the top anchor defines the bottom property, such that the - * mark extends upwards; the bottom anchor instead defines the top property, - * such that the mark extends downwards. See also {@link pv.Layout.Stack}. - * - *

While anchor names are typically constants, the anchor name is a true - * property, which means you can specify a function to compute the anchor name - * dynamically. See the {@link pv.Anchor#name} property for details. - * - * @param {string} name the anchor name; either a string or a property function. - * @returns {pv.Anchor} the new anchor. - */ -pv.Mark.prototype.anchor = function(name) { - var target = this, scene; - - /* Default anchor name. */ - if (!name) name = "center"; - - /** @private Find the instances of target that match source. */ - function instances(source) { - var mark = target, index = []; - - /* Mirrored descent. */ - while (!(scene = mark.scene)) { - source = source.parent; - index.push({index: source.index, childIndex: mark.childIndex}); - mark = mark.parent; - } - while (index.length) { - var i = index.pop(); - scene = scene[i.index].children[i.childIndex]; - } - - /* - * When the anchor target is also an ancestor, as in the case of adding - * to a panel anchor, only generate one instance per panel. Also, set - * the margins to zero, since they are offset by the enclosing panel. - */ - if (target.hasOwnProperty("index")) { - var s = pv.extend(scene[target.index]); - s.right = s.top = s.left = s.bottom = 0; - return [s]; - } - return scene; - } - - return new pv.Anchor(this) - .name(name) - .def("$mark.anchor", function() { - scene = this.scene.target = instances(this); - }) - .data(function() { - return scene.map(function(s) { return s.data; }); - }) - .visible(function() { - return scene[this.index].visible; - }) - .left(function() { - var s = scene[this.index], w = s.width || 0; - switch (this.name()) { - case "bottom": - case "top": - case "center": return s.left + w / 2; - case "left": return null; - } - return s.left + w; - }) - .top(function() { - var s = scene[this.index], h = s.height || 0; - switch (this.name()) { - case "left": - case "right": - case "center": return s.top + h / 2; - case "top": return null; - } - return s.top + h; - }) - .right(function() { - var s = scene[this.index]; - return this.name() == "left" ? s.right + (s.width || 0) : null; - }) - .bottom(function() { - var s = scene[this.index]; - return this.name() == "top" ? s.bottom + (s.height || 0) : null; - }) - .textAlign(function() { - switch (this.name()) { - case "bottom": - case "top": - case "center": return "center"; - case "right": return "right"; - } - return "left"; - }) - .textBaseline(function() { - switch (this.name()) { - case "right": - case "left": - case "center": return "middle"; - case "top": return "top"; - } - return "bottom"; - }); -}; - -/** - * Returns the anchor target of this mark, if it is derived from an anchor; - * otherwise returns null. For example, if a label is derived from a bar anchor, - * - *

bar.anchor("top").add(pv.Label);
- * - * then property functions on the label can refer to the bar via the - * anchorTarget method. This method is also useful for mark types - * defining properties on custom anchors. - * - * @returns {pv.Mark} the anchor target of this mark; possibly null. - */ -pv.Mark.prototype.anchorTarget = function() { - return this.proto.anchorTarget(); -}; - -/** - * Alias for setting the left, right, top and bottom properties simultaneously. - * - * @see #left - * @see #right - * @see #top - * @see #bottom - * @returns {pv.Mark} this. - */ -pv.Mark.prototype.margin = function(n) { - return this.left(n).right(n).top(n).bottom(n); -}; - -/** - * @private Returns the current instance of this mark in the scene graph. This - * is typically equivalent to this.scene[this.index], however if the - * scene or index is unset, the default instance of the mark is returned. If no - * default is set, the default is the last instance. Similarly, if the scene or - * index of the parent panel is unset, the default instance of this mark in the - * last instance of the enclosing panel is returned, and so on. - * - * @returns a node in the scene graph. - */ -pv.Mark.prototype.instance = function(defaultIndex) { - var scene = this.scene || this.parent.instance(-1).children[this.childIndex], - index = !arguments.length || this.hasOwnProperty("index") ? this.index : defaultIndex; - return scene[index < 0 ? scene.length - 1 : index]; -}; - -/** - * @private Returns the first instance of this mark in the scene graph. This - * method can only be called when the mark is bound to the scene graph (for - * example, from an event handler, or within a property function). - * - * @returns a node in the scene graph. - */ -pv.Mark.prototype.first = function() { - return this.scene[0]; -}; - -/** - * @private Returns the last instance of this mark in the scene graph. This - * method can only be called when the mark is bound to the scene graph (for - * example, from an event handler, or within a property function). In addition, - * note that mark instances are built sequentially, so the last instance of this - * mark may not yet be constructed. - * - * @returns a node in the scene graph. - */ -pv.Mark.prototype.last = function() { - return this.scene[this.scene.length - 1]; -}; - -/** - * @private Returns the previous instance of this mark in the scene graph, or - * null if this is the first instance. - * - * @returns a node in the scene graph, or null. - */ -pv.Mark.prototype.sibling = function() { - return (this.index == 0) ? null : this.scene[this.index - 1]; -}; - -/** - * @private Returns the current instance in the scene graph of this mark, in the - * previous instance of the enclosing parent panel. May return null if this - * instance could not be found. - * - * @returns a node in the scene graph, or null. - */ -pv.Mark.prototype.cousin = function() { - var p = this.parent, s = p && p.sibling(); - return (s && s.children) ? s.children[this.childIndex][this.index] : null; -}; - -/** - * Renders this mark, including recursively rendering all child marks if this is - * a panel. This method finds all instances of this mark and renders them. This - * method descends recursively to the level of the mark to be rendered, finding - * all visible instances of the mark. After the marks are rendered, the scene - * and index attributes are removed from the mark to restore them to a clean - * state. - * - *

If an enclosing panel has an index property set (as is the case inside in - * an event handler), then only instances of this mark inside the given instance - * of the panel will be rendered; otherwise, all visible instances of the mark - * will be rendered. - */ -pv.Mark.prototype.render = function() { - var parent = this.parent, - stack = pv.Mark.stack; - - /* For the first render, take it from the top. */ - if (parent && !this.root.scene) { - this.root.render(); - return; - } - - /* Record the path to this mark. */ - var indexes = []; - for (var mark = this; mark.parent; mark = mark.parent) { - indexes.unshift(mark.childIndex); - } - - /** @private */ - function render(mark, depth, scale) { - mark.scale = scale; - if (depth < indexes.length) { - stack.unshift(null); - if (mark.hasOwnProperty("index")) { - renderInstance(mark, depth, scale); - } else { - for (var i = 0, n = mark.scene.length; i < n; i++) { - mark.index = i; - renderInstance(mark, depth, scale); - } - delete mark.index; - } - stack.shift(); - } else { - mark.build(); - - /* - * In the update phase, the scene is rendered by creating and updating - * elements and attributes in the SVG image. No properties are evaluated - * during the update phase; instead the values computed previously in the - * build phase are simply translated into SVG. The update phase is - * decoupled (see pv.Scene) to allow different rendering engines. - */ - pv.Scene.scale = scale; - pv.Scene.updateAll(mark.scene); - } - delete mark.scale; - } - - /** - * @private Recursively renders the current instance of the specified mark. - * This is slightly tricky because `index` and `scene` properties may or may - * not already be set; if they are set, it means we are rendering only a - * specific instance; if they are unset, we are rendering all instances. - * Furthermore, we must preserve the original context of these properties when - * rendering completes. - * - *

Another tricky aspect is that the `scene` attribute should be set for - * any preceding children, so as to allow property chaining. This is - * consistent with first-pass rendering. - */ - function renderInstance(mark, depth, scale) { - var s = mark.scene[mark.index], i; - if (s.visible) { - var childIndex = indexes[depth], - child = mark.children[childIndex]; - - /* Set preceding child scenes. */ - for (i = 0; i < childIndex; i++) { - mark.children[i].scene = s.children[i]; - } - - /* Set current child scene, if necessary. */ - stack[0] = s.data; - if (child.scene) { - render(child, depth + 1, scale * s.transform.k); - } else { - child.scene = s.children[childIndex]; - render(child, depth + 1, scale * s.transform.k); - delete child.scene; - } - - /* Clear preceding child scenes. */ - for (i = 0; i < childIndex; i++) { - delete mark.children[i].scene; - } - } - } - - /* Bind this mark's property definitions. */ - this.bind(); - - /* The render context is the first ancestor with an explicit index. */ - while (parent && !parent.hasOwnProperty("index")) parent = parent.parent; - - /* Recursively render all instances of this mark. */ - this.context( - parent ? parent.scene : undefined, - parent ? parent.index : -1, - function() { render(this.root, 0, 1); }); -}; - -/** @private Stores the current data stack. */ -pv.Mark.stack = []; - -/** - * @private In the bind phase, inherited property definitions are cached so they - * do not need to be queried during build. - */ -pv.Mark.prototype.bind = function() { - var seen = {}, types = [[], [], [], []], data, visible; - - /** Scans the proto chain for the specified mark. */ - function bind(mark) { - do { - var properties = mark.$properties; - for (var i = properties.length - 1; i >= 0 ; i--) { - var p = properties[i]; - if (!(p.name in seen)) { - seen[p.name] = p; - switch (p.name) { - case "data": data = p; break; - case "visible": visible = p; break; - default: types[p.type].push(p); break; - } - } - } - } while (mark = mark.proto); - } - - /* Scan the proto chain for all defined properties. */ - bind(this); - bind(this.defaults); - types[1].reverse(); - types[3].reverse(); - - /* Any undefined properties are null. */ - var mark = this; - do for (var name in mark.properties) { - if (!(name in seen)) { - types[2].push(seen[name] = {name: name, type: 2, value: null}); - } - } while (mark = mark.proto); - - /* Define setter-getter for inherited defs. */ - var defs = types[0].concat(types[1]); - for (var i = 0; i < defs.length; i++) { - this.propertyMethod(defs[i].name, true); - } - - /* Setup binds to evaluate constants before functions. */ - this.binds = { - properties: seen, - data: data, - defs: defs, - required: [visible], - optional: pv.blend(types) - }; -}; - -/** - * @private Evaluates properties and computes implied properties. Properties are - * stored in the {@link #scene} array for each instance of this mark. - * - *

As marks are built recursively, the {@link #index} property is updated to - * match the current index into the data array for each mark. Note that the - * index property is only set for the mark currently being built and its - * enclosing parent panels. The index property for other marks is unset, but is - * inherited from the global Mark class prototype. This allows mark - * properties to refer to properties on other marks in the same panel - * conveniently; however, in general it is better to reference mark instances - * specifically through the scene graph rather than depending on the magical - * behavior of {@link #index}. - * - *

The root scene array has a special property, data, which stores - * the current data stack. The first element in this stack is the current datum, - * followed by the datum of the enclosing parent panel, and so on. The data - * stack should not be accessed directly; instead, property functions are passed - * the current data stack as arguments. - * - *

The evaluation of the data and visible properties is - * special. The data property is evaluated first; unlike the other - * properties, the data stack is from the parent panel, rather than the current - * mark, since the data is not defined until the data property is evaluated. - * The visisble property is subsequently evaluated for each instance; - * only if true will the {@link #buildInstance} method be called, evaluating - * other properties and recursively building the scene graph. - * - *

If this mark is being re-built, any old instances of this mark that no - * longer exist (because the new data array contains fewer elements) will be - * cleared using {@link #clearInstance}. - * - * @param parent the instance of the parent panel from the scene graph. - */ -pv.Mark.prototype.build = function() { - var scene = this.scene, stack = pv.Mark.stack; - if (!scene) { - scene = this.scene = []; - scene.mark = this; - scene.type = this.type; - scene.childIndex = this.childIndex; - if (this.parent) { - scene.parent = this.parent.scene; - scene.parentIndex = this.parent.index; - } - } - - /* Evaluate defs. */ - if (this.binds.defs.length) { - var defs = scene.defs; - if (!defs) scene.defs = defs = {}; - for (var i = 0; i < this.binds.defs.length; i++) { - var p = this.binds.defs[i], d = defs[p.name]; - if (!d || (p.id > d.id)) { - defs[p.name] = { - id: 0, // this def will be re-evaluated on next build - value: (p.type & 1) ? p.value.apply(this, stack) : p.value - }; - } - } - } - - /* Evaluate special data property. */ - var data = this.binds.data; - data = data.type & 1 ? data.value.apply(this, stack) : data.value; - - /* Create, update and delete scene nodes. */ - stack.unshift(null); - scene.length = data.length; - for (var i = 0; i < data.length; i++) { - pv.Mark.prototype.index = this.index = i; - var s = scene[i]; - if (!s) scene[i] = s = {}; - s.data = stack[0] = data[i]; - this.buildInstance(s); - } - pv.Mark.prototype.index = -1; - delete this.index; - stack.shift(); - - return this; -}; - -/** - * @private Evaluates the specified array of properties for the specified - * instance s in the scene graph. - * - * @param s a node in the scene graph; the instance of the mark to build. - * @param properties an array of properties. - */ -pv.Mark.prototype.buildProperties = function(s, properties) { - for (var i = 0, n = properties.length; i < n; i++) { - var p = properties[i], v = p.value; // assume case 2 (constant) - switch (p.type) { - case 0: - case 1: v = this.scene.defs[p.name].value; break; - case 3: v = v.apply(this, pv.Mark.stack); break; - } - s[p.name] = v; - } -}; - -/** - * @private Evaluates all of the properties for this mark for the specified - * instance s in the scene graph. The set of properties to evaluate is - * retrieved from the {@link #properties} array for this mark type (see {@link - * #type}). After these properties are evaluated, any implied properties - * may be computed by the mark and set on the scene graph; see - * {@link #buildImplied}. - * - *

For panels, this method recursively builds the scene graph for all child - * marks as well. In general, this method should not need to be overridden by - * concrete mark types. - * - * @param s a node in the scene graph; the instance of the mark to build. - */ -pv.Mark.prototype.buildInstance = function(s) { - this.buildProperties(s, this.binds.required); - if (s.visible) { - this.buildProperties(s, this.binds.optional); - this.buildImplied(s); - } -}; - -/** - * @private Computes the implied properties for this mark for the specified - * instance s in the scene graph. Implied properties are those with - * dependencies on multiple other properties; for example, the width property - * may be implied if the left and right properties are set. This method can be - * overridden by concrete mark types to define new implied properties, if - * necessary. - * - * @param s a node in the scene graph; the instance of the mark to build. - */ -pv.Mark.prototype.buildImplied = function(s) { - var l = s.left; - var r = s.right; - var t = s.top; - var b = s.bottom; - - /* Assume width and height are zero if not supported by this mark type. */ - var p = this.properties; - var w = p.width ? s.width : 0; - var h = p.height ? s.height : 0; - - /* Compute implied width, right and left. */ - var width = this.parent ? this.parent.width() : (w + l + r); - if (w == null) { - w = width - (r = r || 0) - (l = l || 0); - } else if (r == null) { - r = width - w - (l = l || 0); - } else if (l == null) { - l = width - w - (r = r || 0); - } - - /* Compute implied height, bottom and top. */ - var height = this.parent ? this.parent.height() : (h + t + b); - if (h == null) { - h = height - (t = t || 0) - (b = b || 0); - } else if (b == null) { - b = height - h - (t = t || 0); - } else if (t == null) { - t = height - h - (b = b || 0); - } - - s.left = l; - s.right = r; - s.top = t; - s.bottom = b; - - /* Only set width and height if they are supported by this mark type. */ - if (p.width) s.width = w; - if (p.height) s.height = h; - - /* Set any null colors to pv.Color.transparent. */ - if (p.textStyle && !s.textStyle) s.textStyle = pv.Color.transparent; - if (p.fillStyle && !s.fillStyle) s.fillStyle = pv.Color.transparent; - if (p.strokeStyle && !s.strokeStyle) s.strokeStyle = pv.Color.transparent; -}; - -/** - * Returns the current location of the mouse (cursor) relative to this mark's - * parent. The x coordinate corresponds to the left margin, while the - * y coordinate corresponds to the top margin. - * - * @returns {pv.Vector} the mouse location. - */ -pv.Mark.prototype.mouse = function() { - - /* Compute xy-coordinates relative to the panel. */ - var x = pv.event.pageX || 0, - y = pv.event.pageY || 0, - n = this.root.canvas(); - do { - x -= n.offsetLeft; - y -= n.offsetTop; - } while (n = n.offsetParent); - - /* Compute the inverse transform of all enclosing panels. */ - var t = pv.Transform.identity, - p = this.properties.transform ? this : this.parent, - pz = []; - do { pz.push(p); } while (p = p.parent); - while (p = pz.pop()) t = t.translate(p.left(), p.top()).times(p.transform()); - t = t.invert(); - - return pv.vector(x * t.k + t.x, y * t.k + t.y); -}; - -/** - * Registers an event handler for the specified event type with this mark. When - * an event of the specified type is triggered, the specified handler will be - * invoked. The handler is invoked in a similar method to property functions: - * the context is this mark instance, and the arguments are the full - * data stack. Event handlers can use property methods to manipulate the display - * properties of the mark: - * - *

m.event("click", function() this.fillStyle("red"));
- * - * Alternatively, the external data can be manipulated and the visualization - * redrawn: - * - *
m.event("click", function(d) {
- *     data = all.filter(function(k) k.name == d);
- *     vis.render();
- *   });
- * - * The return value of the event handler determines which mark gets re-rendered. - * Use defs ({@link #def}) to set temporary state from event handlers. - * - *

The complete set of event types is defined by SVG; see the reference - * below. The set of supported event types is:

Since Protovis does not specify any concept of focus, it does not - * support key events; these should be handled outside the visualization using - * standard JavaScript. In the future, support for interaction may be extended - * to support additional event types, particularly those most relevant to - * interactive visualization, such as selection. - * - *

TODO In the current implementation, event handlers are not inherited from - * prototype marks. They must be defined explicitly on each interactive mark. In - * addition, only one event handler for a given event type can be defined; when - * specifying multiple event handlers for the same type, only the last one will - * be used. - * - * @see SVG events - * @param {string} type the event type. - * @param {function} handler the event handler. - * @returns {pv.Mark} this. - */ -pv.Mark.prototype.event = function(type, handler) { - this.$handlers[type] = pv.functor(handler); - return this; -}; - -/** @private Evaluates the function f with the specified context. */ -pv.Mark.prototype.context = function(scene, index, f) { - var proto = pv.Mark.prototype, - stack = pv.Mark.stack, - oscene = pv.Mark.scene, - oindex = proto.index; - - /** @private Sets the context. */ - function apply(scene, index) { - pv.Mark.scene = scene; - proto.index = index; - if (!scene) return; - - var that = scene.mark, - mark = that, - ancestors = []; - - /* Set ancestors' scene and index; populate data stack. */ - do { - ancestors.push(mark); - stack.push(scene[index].data); - mark.index = index; - mark.scene = scene; - index = scene.parentIndex; - scene = scene.parent; - } while (mark = mark.parent); - - /* Set ancestors' scale; requires top-down. */ - for (var i = ancestors.length - 1, k = 1; i > 0; i--) { - mark = ancestors[i]; - mark.scale = k; - k *= mark.scene[mark.index].transform.k; - } - - /* Set children's scene and scale. */ - if (that.children) for (var i = 0, n = that.children.length; i < n; i++) { - mark = that.children[i]; - mark.scene = that.scene[that.index].children[i]; - mark.scale = k; - } - } - - /** @private Clears the context. */ - function clear(scene, index) { - if (!scene) return; - var that = scene.mark, - mark; - - /* Reset children. */ - if (that.children) for (var i = 0, n = that.children.length; i < n; i++) { - mark = that.children[i]; - delete mark.scene; - delete mark.scale; - } - - /* Reset ancestors. */ - mark = that; - do { - stack.pop(); - if (mark.parent) { - delete mark.scene; - delete mark.scale; - } - delete mark.index; - } while (mark = mark.parent); - } - - /* Context switch, invoke the function, then switch back. */ - clear(oscene, oindex); - apply(scene, index); - try { - f.apply(this, stack); - } finally { - clear(scene, index); - apply(oscene, oindex); - } -}; - -/** @private Execute the event listener, then re-render. */ -pv.Mark.dispatch = function(type, scene, index) { - var m = scene.mark, p = scene.parent, l = m.$handlers[type]; - if (!l) return p && pv.Mark.dispatch(type, p, scene.parentIndex); - m.context(scene, index, function() { - m = l.apply(m, pv.Mark.stack); - if (m && m.render) m.render(); - }); - return true; -}; -/** - * Constructs a new mark anchor with default properties. - * - * @class Represents an anchor on a given mark. An anchor is itself a mark, but - * without a visual representation. It serves only to provide useful default - * properties that can be inherited by other marks. Each type of mark can define - * any number of named anchors for convenience. If the concrete mark type does - * not define an anchor implementation specifically, one will be inherited from - * the mark's parent class. - * - *

For example, the bar mark provides anchors for its four sides: left, - * right, top and bottom. Adding a label to the top anchor of a bar, - * - *

bar.anchor("top").add(pv.Label);
- * - * will render a text label on the top edge of the bar; the top anchor defines - * the appropriate position properties (top and left), as well as text-rendering - * properties for convenience (textAlign and textBaseline). - * - *

Note that anchors do not inherit from their targets; the positional - * properties are copied from the scene graph, which guarantees that the anchors - * are positioned correctly, even if the positional properties are not defined - * deterministically. (In addition, it also improves performance by avoiding - * re-evaluating expensive properties.) If you want the anchor to inherit from - * the target, use {@link pv.Mark#extend} before adding. For example: - * - *

bar.anchor("top").extend(bar).add(pv.Label);
- * - * The anchor defines it's own positional properties, but other properties (such - * as the title property, say) can be inherited using the above idiom. Also note - * that you can override positional properties in the anchor for custom - * behavior. - * - * @extends pv.Mark - * @param {pv.Mark} target the anchor target. - */ -pv.Anchor = function(target) { - pv.Mark.call(this); - this.target = target; - this.parent = target.parent; -}; - -pv.Anchor.prototype = pv.extend(pv.Mark) - .property("name", String); - -/** - * The anchor name. The set of supported anchor names is dependent on the - * concrete mark type; see the mark type for details. For example, bars support - * left, right, top and bottom anchors. - * - *

While anchor names are typically constants, the anchor name is a true - * property, which means you can specify a function to compute the anchor name - * dynamically. For instance, if you wanted to alternate top and bottom anchors, - * saying - * - *

m.anchor(function() (this.index % 2) ? "top" : "bottom").add(pv.Dot);
- * - * would have the desired effect. - * - * @type string - * @name pv.Anchor.prototype.name - */ - -/** - * Returns the anchor target of this mark, if it is derived from an anchor; - * otherwise returns null. For example, if a label is derived from a bar anchor, - * - *
bar.anchor("top").add(pv.Label);
- * - * then property functions on the label can refer to the bar via the - * anchorTarget method. This method is also useful for mark types - * defining properties on custom anchors. - * - * @returns {pv.Mark} the anchor target of this mark; possibly null. - */ -pv.Anchor.prototype.anchorTarget = function() { - return this.target; -}; -/** - * Constructs a new area mark with default properties. Areas are not typically - * constructed directly, but by adding to a panel or an existing mark via - * {@link pv.Mark#add}. - * - * @class Represents an area mark: the solid area between two series of - * connected line segments. Unsurprisingly, areas are used most frequently for - * area charts. - * - *

Just as a line represents a polyline, the Area mark type - * represents a polygon. However, an area is not an arbitrary polygon; - * vertices are paired either horizontally or vertically into parallel - * spans, and each span corresponds to an associated datum. Either the - * width or the height must be specified, but not both; this determines whether - * the area is horizontally-oriented or vertically-oriented. Like lines, areas - * can be stroked and filled with arbitrary colors. - * - *

See also the Area guide. - * - * @extends pv.Mark - */ -pv.Area = function() { - pv.Mark.call(this); -}; - -pv.Area.prototype = pv.extend(pv.Mark) - .property("width", Number) - .property("height", Number) - .property("lineWidth", Number) - .property("strokeStyle", pv.color) - .property("fillStyle", pv.color) - .property("segmented", Boolean) - .property("interpolate", String) - .property("tension", Number); - -pv.Area.prototype.type = "area"; - -/** - * The width of a given span, in pixels; used for horizontal spans. If the width - * is specified, the height property should be 0 (the default). Either the top - * or bottom property should be used to space the spans vertically, typically as - * a multiple of the index. - * - * @type number - * @name pv.Area.prototype.width - */ - -/** - * The height of a given span, in pixels; used for vertical spans. If the height - * is specified, the width property should be 0 (the default). Either the left - * or right property should be used to space the spans horizontally, typically - * as a multiple of the index. - * - * @type number - * @name pv.Area.prototype.height - */ - -/** - * The width of stroked lines, in pixels; used in conjunction with - * strokeStyle to stroke the perimeter of the area. Unlike the - * {@link Line} mark type, the entire perimeter is stroked, rather than just one - * edge. The default value of this property is 1.5, but since the default stroke - * style is null, area marks are not stroked by default. - * - *

This property is fixed for non-segmented areas. See - * {@link pv.Mark}. - * - * @type number - * @name pv.Area.prototype.lineWidth - */ - -/** - * The style of stroked lines; used in conjunction with lineWidth to - * stroke the perimeter of the area. Unlike the {@link Line} mark type, the - * entire perimeter is stroked, rather than just one edge. The default value of - * this property is null, meaning areas are not stroked by default. - * - *

This property is fixed for non-segmented areas. See - * {@link pv.Mark}. - * - * @type string - * @name pv.Area.prototype.strokeStyle - * @see pv.color - */ - -/** - * The area fill style; if non-null, the interior of the polygon forming the - * area is filled with the specified color. The default value of this property - * is a categorical color. - * - *

This property is fixed for non-segmented areas. See - * {@link pv.Mark}. - * - * @type string - * @name pv.Area.prototype.fillStyle - * @see pv.color - */ - -/** - * Whether the area is segmented; whether variations in fill style, stroke - * style, and the other properties are treated as fixed. Rendering segmented - * areas is noticeably slower than non-segmented areas. - * - *

This property is fixed. See {@link pv.Mark}. - * - * @type boolean - * @name pv.Area.prototype.segmented - */ - -/** - * How to interpolate between values. Linear interpolation ("linear") is the - * default, producing a straight line between points. For piecewise constant - * functions (i.e., step functions), either "step-before" or "step-after" can be - * specified. To draw open uniform b-splines, specify "basis". To draw cardinal - * splines, specify "cardinal"; see also {@link #tension}. - * - *

This property is fixed. See {@link pv.Mark}. - * - * @type string - * @name pv.Area.prototype.interpolate - */ - -/** - * The tension of cardinal splines; used in conjunction with - * interpolate("cardinal"). A value between 0 and 1 draws cardinal splines with - * the given tension. In some sense, the tension can be interpreted as the - * "length" of the tangent; a tension of 1 will yield all zero tangents (i.e., - * linear interpolation), and a tension of 0 yields a Catmull-Rom spline. The - * default value is 0.7. - * - *

This property is fixed. See {@link pv.Mark}. - * - * @type number - * @name pv.Area.prototype.tension - */ - -/** - * Default properties for areas. By default, there is no stroke and the fill - * style is a categorical color. - * - * @type pv.Area - */ -pv.Area.prototype.defaults = new pv.Area() - .extend(pv.Mark.prototype.defaults) - .lineWidth(1.5) - .fillStyle(pv.Colors.category20().by(pv.parent)) - .interpolate("linear") - .tension(.7); - -/** @private Sets width and height to zero if null. */ -pv.Area.prototype.buildImplied = function(s) { - if (s.height == null) s.height = 0; - if (s.width == null) s.width = 0; - pv.Mark.prototype.buildImplied.call(this, s); -}; - -/** @private Records which properties may be fixed. */ -pv.Area.fixed = { - lineWidth: 1, - lineJoin: 1, - strokeStyle: 1, - fillStyle: 1, - segmented: 1, - interpolate: 1, - tension: 1 -}; - -/** - * @private Make segmented required, such that this fixed property is always - * evaluated, even if the first segment is not visible. Also cache which - * properties are normally fixed. - */ -pv.Area.prototype.bind = function() { - pv.Mark.prototype.bind.call(this); - var binds = this.binds, - required = binds.required, - optional = binds.optional; - for (var i = 0, n = optional.length; i < n; i++) { - var p = optional[i]; - p.fixed = p.name in pv.Area.fixed; - if (p.name == "segmented") { - required.push(p); - optional.splice(i, 1); - i--; - n--; - } - } - - /* Cache the original arrays so they can be restored on build. */ - this.binds.$required = required; - this.binds.$optional = optional; -}; - -/** - * @private Override the default build behavior such that fixed properties are - * determined dynamically, based on the value of the (always) fixed segmented - * property. Any fixed properties are only evaluated on the first instance, - * although their values are propagated to subsequent instances, so that they - * are available for property chaining and the like. - */ -pv.Area.prototype.buildInstance = function(s) { - var binds = this.binds; - - /* Handle fixed properties on secondary instances. */ - if (this.index) { - var fixed = binds.fixed; - - /* Determine which properties are fixed. */ - if (!fixed) { - fixed = binds.fixed = []; - function f(p) { return !p.fixed || (fixed.push(p), false); } - binds.required = binds.required.filter(f); - if (!this.scene[0].segmented) binds.optional = binds.optional.filter(f); - } - - /* Copy fixed property values from the first instance. */ - for (var i = 0, n = fixed.length; i < n; i++) { - var p = fixed[i].name; - s[p] = this.scene[0][p]; - } - } - - /* Evaluate all properties on the first instance. */ - else { - binds.required = binds.$required; - binds.optional = binds.$optional; - binds.fixed = null; - } - - pv.Mark.prototype.buildInstance.call(this, s); -}; - -/** - * Constructs a new area anchor with default properties. Areas support five - * different anchors:

In addition to positioning properties (left, right, top bottom), the - * anchors support text rendering properties (text-align, text-baseline). Text - * is rendered to appear inside the area. The area anchor also propagates the - * interpolate, eccentricity, and tension properties such that an anchored area - * or line will match positions between control points. - * - *

For consistency with the other mark types, the anchor positions are - * defined in terms of their opposite edge. For example, the top anchor defines - * the bottom property, such that an area added to the top anchor grows upward. - * - * @param {string} name the anchor name; either a string or a property function. - * @returns {pv.Anchor} - */ -pv.Area.prototype.anchor = function(name) { - var scene; - return pv.Mark.prototype.anchor.call(this, name) - .def("$area.anchor", function() { - scene = this.scene.target; - }) - .interpolate(function() { - return scene[this.index].interpolate; - }) - .eccentricity(function() { - return scene[this.index].eccentricity; - }) - .tension(function() { - return scene[this.index].tension; - }); -}; -/** - * Constructs a new bar mark with default properties. Bars are not typically - * constructed directly, but by adding to a panel or an existing mark via - * {@link pv.Mark#add}. - * - * @class Represents a bar: an axis-aligned rectangle that can be stroked and - * filled. Bars are used for many chart types, including bar charts, histograms - * and Gantt charts. Bars can also be used as decorations, for example to draw a - * frame border around a panel; in fact, a panel is a special type (a subclass) - * of bar. - * - *

Bars can be positioned in several ways. Most commonly, one of the four - * corners is fixed using two margins, and then the width and height properties - * determine the extent of the bar relative to this fixed location. For example, - * using the bottom and left properties fixes the bottom-left corner; the width - * then extends to the right, while the height extends to the top. As an - * alternative to the four corners, a bar can be positioned exclusively using - * margins; this is convenient as an inset from the containing panel, for - * example. See {@link pv.Mark} for details on the prioritization of redundant - * positioning properties. - * - *

See also the Bar guide. - * - * @extends pv.Mark - */ -pv.Bar = function() { - pv.Mark.call(this); -}; - -pv.Bar.prototype = pv.extend(pv.Mark) - .property("width", Number) - .property("height", Number) - .property("lineWidth", Number) - .property("strokeStyle", pv.color) - .property("fillStyle", pv.color); - -pv.Bar.prototype.type = "bar"; - -/** - * The width of the bar, in pixels. If the left position is specified, the bar - * extends rightward from the left edge; if the right position is specified, the - * bar extends leftward from the right edge. - * - * @type number - * @name pv.Bar.prototype.width - */ - -/** - * The height of the bar, in pixels. If the bottom position is specified, the - * bar extends upward from the bottom edge; if the top position is specified, - * the bar extends downward from the top edge. - * - * @type number - * @name pv.Bar.prototype.height - */ - -/** - * The width of stroked lines, in pixels; used in conjunction with - * strokeStyle to stroke the bar's border. - * - * @type number - * @name pv.Bar.prototype.lineWidth - */ - -/** - * The style of stroked lines; used in conjunction with lineWidth to - * stroke the bar's border. The default value of this property is null, meaning - * bars are not stroked by default. - * - * @type string - * @name pv.Bar.prototype.strokeStyle - * @see pv.color - */ - -/** - * The bar fill style; if non-null, the interior of the bar is filled with the - * specified color. The default value of this property is a categorical color. - * - * @type string - * @name pv.Bar.prototype.fillStyle - * @see pv.color - */ - -/** - * Default properties for bars. By default, there is no stroke and the fill - * style is a categorical color. - * - * @type pv.Bar - */ -pv.Bar.prototype.defaults = new pv.Bar() - .extend(pv.Mark.prototype.defaults) - .lineWidth(1.5) - .fillStyle(pv.Colors.category20().by(pv.parent)); -/** - * Constructs a new dot mark with default properties. Dots are not typically - * constructed directly, but by adding to a panel or an existing mark via - * {@link pv.Mark#add}. - * - * @class Represents a dot; a dot is simply a sized glyph centered at a given - * point that can also be stroked and filled. The size property is - * proportional to the area of the rendered glyph to encourage meaningful visual - * encodings. Dots can visually encode up to eight dimensions of data, though - * this may be unwise due to integrality. See {@link pv.Mark} for details on the - * prioritization of redundant positioning properties. - * - *

See also the Dot guide. - * - * @extends pv.Mark - */ -pv.Dot = function() { - pv.Mark.call(this); -}; - -pv.Dot.prototype = pv.extend(pv.Mark) - .property("size", Number) - .property("radius", Number) - .property("shape", String) - .property("angle", Number) - .property("lineWidth", Number) - .property("strokeStyle", pv.color) - .property("fillStyle", pv.color); - -pv.Dot.prototype.type = "dot"; - -/** - * The size of the dot, in square pixels. Square pixels are used such that the - * area of the dot is linearly proportional to the value of the size property, - * facilitating representative encodings. - * - * @see #radius - * @type number - * @name pv.Dot.prototype.size - */ - -/** - * The radius of the dot, in pixels. This is an alternative to using - * {@link #size}. - * - * @see #size - * @type number - * @name pv.Dot.prototype.radius - */ - -/** - * The shape name. Several shapes are supported:

These shapes can be further changed using the {@link #angle} property; - * for instance, a cross can be turned into a plus by rotating. Similarly, the - * tick, which is vertical by default, can be rotated horizontally. Note that - * some shapes (cross and tick) do not have interior areas, and thus do not - * support fill style meaningfully. - * - *

Note: it may be more natural to use the {@link pv.Rule} mark for - * horizontal and vertical ticks. The tick shape is only necessary if angled - * ticks are needed. - * - * @type string - * @name pv.Dot.prototype.shape - */ - -/** - * The rotation angle, in radians. Used to rotate shapes, such as to turn a - * cross into a plus. - * - * @type number - * @name pv.Dot.prototype.angle - */ - -/** - * The width of stroked lines, in pixels; used in conjunction with - * strokeStyle to stroke the dot's shape. - * - * @type number - * @name pv.Dot.prototype.lineWidth - */ - -/** - * The style of stroked lines; used in conjunction with lineWidth to - * stroke the dot's shape. The default value of this property is a categorical - * color. - * - * @type string - * @name pv.Dot.prototype.strokeStyle - * @see pv.color - */ - -/** - * The fill style; if non-null, the interior of the dot is filled with the - * specified color. The default value of this property is null, meaning dots are - * not filled by default. - * - * @type string - * @name pv.Dot.prototype.fillStyle - * @see pv.color - */ - -/** - * Default properties for dots. By default, there is no fill and the stroke - * style is a categorical color. The default shape is "circle" with size 20. - * - * @type pv.Dot - */ -pv.Dot.prototype.defaults = new pv.Dot() - .extend(pv.Mark.prototype.defaults) - .size(20) - .shape("circle") - .lineWidth(1.5) - .strokeStyle(pv.Colors.category10().by(pv.parent)); - -/** - * Constructs a new dot anchor with default properties. Dots support five - * different anchors:

In addition to positioning properties (left, right, top bottom), the - * anchors support text rendering properties (text-align, text-baseline). Text is - * rendered to appear outside the dot. Note that this behavior is different from - * other mark anchors, which default to rendering text inside the mark. - * - *

For consistency with the other mark types, the anchor positions are - * defined in terms of their opposite edge. For example, the top anchor defines - * the bottom property, such that a bar added to the top anchor grows upward. - * - * @param {string} name the anchor name; either a string or a property function. - * @returns {pv.Anchor} - */ -pv.Dot.prototype.anchor = function(name) { - var scene; - return pv.Mark.prototype.anchor.call(this, name) - .def("$wedge.anchor", function() { - scene = this.scene.target; - }) - .left(function() { - var s = scene[this.index]; - switch (this.name()) { - case "bottom": - case "top": - case "center": return s.left; - case "left": return null; - } - return s.left + s.radius; - }) - .right(function() { - var s = scene[this.index]; - return this.name() == "left" ? s.right + s.radius : null; - }) - .top(function() { - var s = scene[this.index]; - switch (this.name()) { - case "left": - case "right": - case "center": return s.top; - case "top": return null; - } - return s.top + s.radius; - }) - .bottom(function() { - var s = scene[this.index]; - return this.name() == "top" ? s.bottom + s.radius : null; - }) - .textAlign(function() { - switch (this.name()) { - case "left": return "right"; - case "bottom": - case "top": - case "center": return "center"; - } - return "left"; - }) - .textBaseline(function() { - switch (this.name()) { - case "right": - case "left": - case "center": return "middle"; - case "bottom": return "top"; - } - return "bottom"; - }); -}; - -/** @private Sets radius based on size or vice versa. */ -pv.Dot.prototype.buildImplied = function(s) { - if (s.radius == null) s.radius = Math.sqrt(s.size); - else if (s.size == null) s.size = s.radius * s.radius; - pv.Mark.prototype.buildImplied.call(this, s); -}; -/** - * Constructs a new label mark with default properties. Labels are not typically - * constructed directly, but by adding to a panel or an existing mark via - * {@link pv.Mark#add}. - * - * @class Represents a text label, allowing textual annotation of other marks or - * arbitrary text within the visualization. The character data must be plain - * text (unicode), though the text can be styled using the {@link #font} - * property. If rich text is needed, external HTML elements can be overlaid on - * the canvas by hand. - * - *

Labels are positioned using the box model, similarly to {@link Dot}. Thus, - * a label has no width or height, but merely a text anchor location. The text - * is positioned relative to this anchor location based on the - * {@link #textAlign}, {@link #textBaseline} and {@link #textMargin} properties. - * Furthermore, the text may be rotated using {@link #textAngle}. - * - *

Labels ignore events, so as to not interfere with event handlers on - * underlying marks, such as bars. In the future, we may support event handlers - * on labels. - * - *

See also the Label guide. - * - * @extends pv.Mark - */ -pv.Label = function() { - pv.Mark.call(this); -}; - -pv.Label.prototype = pv.extend(pv.Mark) - .property("text", String) - .property("font", String) - .property("textAngle", Number) - .property("textStyle", pv.color) - .property("textAlign", String) - .property("textBaseline", String) - .property("textMargin", Number) - .property("textDecoration", String) - .property("textShadow", String); - -pv.Label.prototype.type = "label"; - -/** - * The character data to render; a string. The default value of the text - * property is the identity function, meaning the label's associated datum will - * be rendered using its toString. - * - * @type string - * @name pv.Label.prototype.text - */ - -/** - * The font format, per the CSS Level 2 specification. The default font is "10px - * sans-serif", for consistency with the HTML 5 canvas element specification. - * Note that since text is not wrapped, any line-height property will be - * ignored. The other font-style, font-variant, font-weight, font-size and - * font-family properties are supported. - * - * @see CSS2 fonts - * @type string - * @name pv.Label.prototype.font - */ - -/** - * The rotation angle, in radians. Text is rotated clockwise relative to the - * anchor location. For example, with the default left alignment, an angle of - * Math.PI / 2 causes text to proceed downwards. The default angle is zero. - * - * @type number - * @name pv.Label.prototype.textAngle - */ - -/** - * The text color. The name "textStyle" is used for consistency with "fillStyle" - * and "strokeStyle", although it might be better to rename this property (and - * perhaps use the same name as "strokeStyle"). The default color is black. - * - * @type string - * @name pv.Label.prototype.textStyle - * @see pv.color - */ - -/** - * The horizontal text alignment. One of:

The default horizontal alignment is left. - * - * @type string - * @name pv.Label.prototype.textAlign - */ - -/** - * The vertical text alignment. One of:The default vertical alignment is bottom. - * - * @type string - * @name pv.Label.prototype.textBaseline - */ - -/** - * The text margin; may be specified in pixels, or in font-dependent units (such - * as ".1ex"). The margin can be used to pad text away from its anchor location, - * in a direction dependent on the horizontal and vertical alignment - * properties. For example, if the text is left- and middle-aligned, the margin - * shifts the text to the right. The default margin is 3 pixels. - * - * @type number - * @name pv.Label.prototype.textMargin - */ - -/** - * A list of shadow effects to be applied to text, per the CSS Text Level 3 - * text-shadow property. An example specification is "0.1em 0.1em 0.1em - * rgba(0,0,0,.5)"; the first length is the horizontal offset, the second the - * vertical offset, and the third the blur radius. - * - * @see CSS3 text - * @type string - * @name pv.Label.prototype.textShadow - */ - -/** - * A list of decoration to be applied to text, per the CSS Text Level 3 - * text-decoration property. An example specification is "underline". - * - * @see CSS3 text - * @type string - * @name pv.Label.prototype.textDecoration - */ - -/** - * Default properties for labels. See the individual properties for the default - * values. - * - * @type pv.Label - */ -pv.Label.prototype.defaults = new pv.Label() - .extend(pv.Mark.prototype.defaults) - .events("none") - .text(pv.identity) - .font("10px sans-serif") - .textAngle(0) - .textStyle("black") - .textAlign("left") - .textBaseline("bottom") - .textMargin(3); -/** - * Constructs a new line mark with default properties. Lines are not typically - * constructed directly, but by adding to a panel or an existing mark via - * {@link pv.Mark#add}. - * - * @class Represents a series of connected line segments, or polyline, - * that can be stroked with a configurable color and thickness. Each - * articulation point in the line corresponds to a datum; for n points, - * n-1 connected line segments are drawn. The point is positioned using - * the box model. Arbitrary paths are also possible, allowing radar plots and - * other custom visualizations. - * - *

Like areas, lines can be stroked and filled with arbitrary colors. In most - * cases, lines are only stroked, but the fill style can be used to construct - * arbitrary polygons. - * - *

See also the Line guide. - * - * @extends pv.Mark - */ -pv.Line = function() { - pv.Mark.call(this); -}; - -pv.Line.prototype = pv.extend(pv.Mark) - .property("lineWidth", Number) - .property("lineJoin", String) - .property("strokeStyle", pv.color) - .property("fillStyle", pv.color) - .property("segmented", Boolean) - .property("interpolate", String) - .property("eccentricity", Number) - .property("tension", Number); - -pv.Line.prototype.type = "line"; - -/** - * The width of stroked lines, in pixels; used in conjunction with - * strokeStyle to stroke the line. - * - * @type number - * @name pv.Line.prototype.lineWidth - */ - -/** - * The style of stroked lines; used in conjunction with lineWidth to - * stroke the line. The default value of this property is a categorical color. - * - * @type string - * @name pv.Line.prototype.strokeStyle - * @see pv.color - */ - -/** - * The type of corners where two lines meet. Accepted values are "bevel", - * "round" and "miter". The default value is "miter". - * - *

For segmented lines, only "miter" joins and "linear" interpolation are - * currently supported. Any other value, including null, will disable joins, - * producing disjoint line segments. Note that the miter joins must be computed - * manually (at least in the current SVG renderer); since this calculation may - * be expensive and unnecessary for small lines, specifying null can improve - * performance significantly. - * - *

This property is fixed. See {@link pv.Mark}. - * - * @type string - * @name pv.Line.prototype.lineJoin - */ - -/** - * The line fill style; if non-null, the interior of the line is closed and - * filled with the specified color. The default value of this property is a - * null, meaning that lines are not filled by default. - * - *

This property is fixed. See {@link pv.Mark}. - * - * @type string - * @name pv.Line.prototype.fillStyle - * @see pv.color - */ - -/** - * Whether the line is segmented; whether variations in stroke style, line width - * and the other properties are treated as fixed. Rendering segmented lines is - * noticeably slower than non-segmented lines. - * - *

This property is fixed. See {@link pv.Mark}. - * - * @type boolean - * @name pv.Line.prototype.segmented - */ - -/** - * How to interpolate between values. Linear interpolation ("linear") is the - * default, producing a straight line between points. For piecewise constant - * functions (i.e., step functions), either "step-before" or "step-after" can be - * specified. To draw a clockwise circular arc between points, specify "polar"; - * to draw a counterclockwise circular arc between points, specify - * "polar-reverse". To draw open uniform b-splines, specify "basis". To draw - * cardinal splines, specify "cardinal"; see also {@link #tension}. - * - *

This property is fixed. See {@link pv.Mark}. - * - * @type string - * @name pv.Line.prototype.interpolate - */ - -/** - * The eccentricity of polar line segments; used in conjunction with - * interpolate("polar"). The default value of 0 means that line segments are - * drawn as circular arcs. A value of 1 draws a straight line. A value between 0 - * and 1 draws an elliptical arc with the given eccentricity. - * - * @type number - * @name pv.Line.prototype.eccentricity - */ - -/** - * The tension of cardinal splines; used in conjunction with - * interpolate("cardinal"). A value between 0 and 1 draws cardinal splines with - * the given tension. In some sense, the tension can be interpreted as the - * "length" of the tangent; a tension of 1 will yield all zero tangents (i.e., - * linear interpolation), and a tension of 0 yields a Catmull-Rom spline. The - * default value is 0.7. - * - *

This property is fixed. See {@link pv.Mark}. - * - * @type number - * @name pv.Line.prototype.tension - */ - -/** - * Default properties for lines. By default, there is no fill and the stroke - * style is a categorical color. The default interpolation is linear. - * - * @type pv.Line - */ -pv.Line.prototype.defaults = new pv.Line() - .extend(pv.Mark.prototype.defaults) - .lineJoin("miter") - .lineWidth(1.5) - .strokeStyle(pv.Colors.category10().by(pv.parent)) - .interpolate("linear") - .eccentricity(0) - .tension(.7); - -/** @private Reuse Area's implementation for segmented bind & build. */ -pv.Line.prototype.bind = pv.Area.prototype.bind; -pv.Line.prototype.buildInstance = pv.Area.prototype.buildInstance; - -/** - * Constructs a new line anchor with default properties. Lines support five - * different anchors:

In addition to positioning properties (left, right, top bottom), the - * anchors support text rendering properties (text-align, text-baseline). Text is - * rendered to appear outside the line. Note that this behavior is different - * from other mark anchors, which default to rendering text inside the - * mark. - * - *

For consistency with the other mark types, the anchor positions are - * defined in terms of their opposite edge. For example, the top anchor defines - * the bottom property, such that a bar added to the top anchor grows upward. - * - * @param {string} name the anchor name; either a string or a property function. - * @returns {pv.Anchor} - */ -pv.Line.prototype.anchor = function(name) { - return pv.Area.prototype.anchor.call(this, name) - .textAlign(function(d) { - switch (this.name()) { - case "left": return "right"; - case "bottom": - case "top": - case "center": return "center"; - case "right": return "left"; - } - }) - .textBaseline(function(d) { - switch (this.name()) { - case "right": - case "left": - case "center": return "middle"; - case "top": return "bottom"; - case "bottom": return "top"; - } - }); -}; -/** - * Constructs a new rule with default properties. Rules are not typically - * constructed directly, but by adding to a panel or an existing mark via - * {@link pv.Mark#add}. - * - * @class Represents a horizontal or vertical rule. Rules are frequently used - * for axes and grid lines. For example, specifying only the bottom property - * draws horizontal rules, while specifying only the left draws vertical - * rules. Rules can also be used as thin bars. The visual style is controlled in - * the same manner as lines. - * - *

Rules are positioned exclusively the standard box model properties. The - * following combinations of properties are supported: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
PropertiesOrientation
leftvertical
rightvertical
left, bottom, topvertical
right, bottom, topvertical
tophorizontal
bottomhorizontal
top, left, righthorizontal
bottom, left, righthorizontal
left, top, heightvertical
left, bottom, heightvertical
right, top, heightvertical
right, bottom, heightvertical
left, top, widthhorizontal
left, bottom, widthhorizontal
right, top, widthhorizontal
right, bottom, widthhorizontal
- * - *

Small rules can be used as tick marks; alternatively, a {@link Dot} with - * the "tick" shape can be used. - * - *

See also the Rule guide. - * - * @see pv.Line - * @extends pv.Mark - */ -pv.Rule = function() { - pv.Mark.call(this); -}; - -pv.Rule.prototype = pv.extend(pv.Mark) - .property("width", Number) - .property("height", Number) - .property("lineWidth", Number) - .property("strokeStyle", pv.color); - -pv.Rule.prototype.type = "rule"; - -/** - * The width of the rule, in pixels. If the left position is specified, the rule - * extends rightward from the left edge; if the right position is specified, the - * rule extends leftward from the right edge. - * - * @type number - * @name pv.Rule.prototype.width - */ - -/** - * The height of the rule, in pixels. If the bottom position is specified, the - * rule extends upward from the bottom edge; if the top position is specified, - * the rule extends downward from the top edge. - * - * @type number - * @name pv.Rule.prototype.height - */ - -/** - * The width of stroked lines, in pixels; used in conjunction with - * strokeStyle to stroke the rule. The default value is 1 pixel. - * - * @type number - * @name pv.Rule.prototype.lineWidth - */ - -/** - * The style of stroked lines; used in conjunction with lineWidth to - * stroke the rule. The default value of this property is black. - * - * @type string - * @name pv.Rule.prototype.strokeStyle - * @see pv.color - */ - -/** - * Default properties for rules. By default, a single-pixel black line is - * stroked. - * - * @type pv.Rule - */ -pv.Rule.prototype.defaults = new pv.Rule() - .extend(pv.Mark.prototype.defaults) - .lineWidth(1) - .strokeStyle("black") - .antialias(false); - -/** - * Constructs a new rule anchor with default properties. Rules support five - * different anchors:

In addition to positioning properties (left, right, top bottom), the - * anchors support text rendering properties (text-align, text-baseline). Text is - * rendered to appear outside the rule. Note that this behavior is different - * from other mark anchors, which default to rendering text inside the - * mark. - * - *

For consistency with the other mark types, the anchor positions are - * defined in terms of their opposite edge. For example, the top anchor defines - * the bottom property, such that a bar added to the top anchor grows upward. - * - * @param {string} name the anchor name; either a string or a property function. - * @returns {pv.Anchor} - */ -pv.Rule.prototype.anchor = pv.Line.prototype.anchor; - -/** @private Sets width or height based on orientation. */ -pv.Rule.prototype.buildImplied = function(s) { - var l = s.left, r = s.right, t = s.top, b = s.bottom; - - /* Determine horizontal or vertical orientation. */ - if ((s.width != null) - || ((l == null) && (r == null)) - || ((r != null) && (l != null))) { - s.height = 0; - } else { - s.width = 0; - } - - pv.Mark.prototype.buildImplied.call(this, s); -}; -/** - * Constructs a new, empty panel with default properties. Panels, with the - * exception of the root panel, are not typically constructed directly; instead, - * they are added to an existing panel or mark via {@link pv.Mark#add}. - * - * @class Represents a container mark. Panels allow repeated or nested - * structures, commonly used in small multiple displays where a small - * visualization is tiled to facilitate comparison across one or more - * dimensions. Other types of visualizations may benefit from repeated and - * possibly overlapping structure as well, such as stacked area charts. Panels - * can also offset the position of marks to provide padding from surrounding - * content. - * - *

All Protovis displays have at least one panel; this is the root panel to - * which marks are rendered. The box model properties (four margins, width and - * height) are used to offset the positions of contained marks. The data - * property determines the panel count: a panel is generated once per associated - * datum. When nested panels are used, property functions can declare additional - * arguments to access the data associated with enclosing panels. - * - *

Panels can be rendered inline, facilitating the creation of sparklines. - * This allows designers to reuse browser layout features, such as text flow and - * tables; designers can also overlay HTML elements such as rich text and - * images. - * - *

All panels have a children array (possibly empty) containing the - * child marks in the order they were added. Panels also have a root - * field which points to the root (outermost) panel; the root panel's root field - * points to itself. - * - *

See also the Protovis guide. - * - * @extends pv.Bar - */ -pv.Panel = function() { - pv.Bar.call(this); - - /** - * The child marks; zero or more {@link pv.Mark}s in the order they were - * added. - * - * @see #add - * @type pv.Mark[] - */ - this.children = []; - this.root = this; - - /** - * The internal $dom field is set by the Protovis loader; see lang/init.js. It - * refers to the script element that contains the Protovis specification, so - * that the panel knows where in the DOM to insert the generated SVG element. - * - * @private - */ - this.$dom = pv.$ && pv.$.s; -}; - -pv.Panel.prototype = pv.extend(pv.Bar) - .property("transform") - .property("overflow", String) - .property("canvas", function(c) { - return (typeof c == "string") - ? document.getElementById(c) - : c; // assume that c is the passed-in element - }); - -pv.Panel.prototype.type = "panel"; - -/** - * The canvas element; either the string ID of the canvas element in the current - * document, or a reference to the canvas element itself. If null, a canvas - * element will be created and inserted into the document at the location of the - * script element containing the current Protovis specification. This property - * only applies to root panels and is ignored on nested panels. - * - *

Note: the "canvas" element here refers to a div (or other suitable - * HTML container element), not a canvas element. The name of - * this property is a historical anachronism from the first implementation that - * used HTML 5 canvas, rather than SVG. - * - * @type string - * @name pv.Panel.prototype.canvas - */ - -/** - * Specifies whether child marks are clipped when they overflow this panel. - * This affects the clipping of all this panel's descendant marks. - * - * @type string - * @name pv.Panel.prototype.overflow - * @see CSS2 - */ - -/** - * The transform to be applied to child marks. The default transform is - * identity, which has no effect. Note that the panel's own fill and stroke are - * not affected by the transform, and panel's transform only affects the - * scale of child marks, not the panel itself. - * - * @type pv.Transform - * @name pv.Panel.prototype.transform - * @see pv.Mark#scale - */ - -/** - * Default properties for panels. By default, the margins are zero, the fill - * style is transparent. - * - * @type pv.Panel - */ -pv.Panel.prototype.defaults = new pv.Panel() - .extend(pv.Bar.prototype.defaults) - .fillStyle(null) // override Bar default - .overflow("visible"); - -/** - * Returns an anchor with the specified name. This method is overridden such - * that adding to a panel's anchor adds to the panel, rather than to the panel's - * parent. - * - * @param {string} name the anchor name; either a string or a property function. - * @returns {pv.Anchor} the new anchor. - */ -pv.Panel.prototype.anchor = function(name) { - var anchor = pv.Bar.prototype.anchor.call(this, name); - anchor.parent = this; - return anchor; -}; - -/** - * Adds a new mark of the specified type to this panel. Unlike the normal - * {@link Mark#add} behavior, adding a mark to a panel does not cause the mark - * to inherit from the panel. Since the contained marks are offset by the panel - * margins already, inheriting properties is generally undesirable; of course, - * it is always possible to change this behavior by calling {@link Mark#extend} - * explicitly. - * - * @param {function} type the type of the new mark to add. - * @returns {pv.Mark} the new mark. - */ -pv.Panel.prototype.add = function(type) { - var child = new type(); - child.parent = this; - child.root = this.root; - child.childIndex = this.children.length; - this.children.push(child); - return child; -}; - -/** @private Bind this panel, then any child marks recursively. */ -pv.Panel.prototype.bind = function() { - pv.Mark.prototype.bind.call(this); - for (var i = 0; i < this.children.length; i++) { - this.children[i].bind(); - } -}; - -/** - * @private Evaluates all of the properties for this panel for the specified - * instance s in the scene graph, including recursively building the - * scene graph for child marks. - * - * @param s a node in the scene graph; the instance of the panel to build. - * @see Mark#scene - */ -pv.Panel.prototype.buildInstance = function(s) { - pv.Bar.prototype.buildInstance.call(this, s); - if (!s.visible) return; - if (!s.children) s.children = []; - - /* - * Multiply the current scale factor by this panel's transform. Also clear the - * default index as we recurse into child marks; it will be reset to the - * current index when the next panel instance is built. - */ - var scale = this.scale * s.transform.k, child, n = this.children.length; - pv.Mark.prototype.index = -1; - - /* - * Build each child, passing in the parent (this panel) scene graph node. The - * child mark's scene is initialized from the corresponding entry in the - * existing scene graph, such that properties from the previous build can be - * reused; this is largely to facilitate the recycling of SVG elements. - */ - for (var i = 0; i < n; i++) { - child = this.children[i]; - child.scene = s.children[i]; // possibly undefined - child.scale = scale; - child.build(); - } - - /* - * Once the child marks have been built, the new scene graph nodes are removed - * from the child marks and placed into the scene graph. The nodes cannot - * remain on the child nodes because this panel (or a parent panel) may be - * instantiated multiple times! - */ - for (var i = 0; i < n; i++) { - child = this.children[i]; - s.children[i] = child.scene; - delete child.scene; - delete child.scale; - } - - /* Delete any expired child scenes. */ - s.children.length = n; -}; - -/** - * @private Computes the implied properties for this panel for the specified - * instance s in the scene graph. Panels have two implied - * properties:

The current implementation creates the SVG element, if necessary, during - * the build phase; in the future, it may be preferrable to move this to the - * update phase, although then the canvas property would be undefined. In - * addition, DOM inspection is necessary to define the implied width and height - * properties that may be inferred from the DOM. - * - * @param s a node in the scene graph; the instance of the panel to build. - */ -pv.Panel.prototype.buildImplied = function(s) { - if (!this.parent) { - var c = s.canvas; - if (c) { - /* Clear the container if it's not associated with this panel. */ - if (c.$panel != this) { - c.$panel = this; - while (c.lastChild) c.removeChild(c.lastChild); - } - - /* If width and height weren't specified, inspect the container. */ - var w, h; - if (s.width == null) { - w = parseFloat(pv.css(c, "width")); - s.width = w - s.left - s.right; - } - if (s.height == null) { - h = parseFloat(pv.css(c, "height")); - s.height = h - s.top - s.bottom; - } - } else { - var cache = this.$canvas || (this.$canvas = []); - if (!(c = cache[this.index])) { - c = cache[this.index] = document.createElement("span"); - if (this.$dom) { // script element for text/javascript+protovis - this.$dom.parentNode.insertBefore(c, this.$dom); - } else { // find the last element in the body - var n = document.body; - while (n.lastChild && n.lastChild.tagName) n = n.lastChild; - if (n != document.body) n = n.parentNode; - n.appendChild(c); - } - } - } - s.canvas = c; - } - if (!s.transform) s.transform = pv.Transform.identity; - pv.Mark.prototype.buildImplied.call(this, s); -}; -/** - * Constructs a new image with default properties. Images are not typically - * constructed directly, but by adding to a panel or an existing mark via - * {@link pv.Mark#add}. - * - * @class Represents an image, either a static resource or a dynamically- - * generated pixel buffer. Images share the same layout and style properties as - * bars. The external image resource is specified via the {@link #url} - * property. The optional fill, if specified, appears beneath the image, while - * the optional stroke appears above the image. - * - *

Dynamic images such as heatmaps are supported using the {@link #image} - * psuedo-property. This function is passed the x and y index, in - * addition to the current data stack. The return value is a {@link pv.Color}, - * or null for transparent. A string can also be returned, which will be parsed - * into a color; however, it is typically much faster to return an object with - * r, g, b and a attributes, to avoid the - * cost of parsing and object instantiation. - * - *

See {@link pv.Bar} for details on positioning properties. - * - * @extends pv.Bar - */ -pv.Image = function() { - pv.Bar.call(this); -}; - -pv.Image.prototype = pv.extend(pv.Bar) - .property("url", String) - .property("imageWidth", Number) - .property("imageHeight", Number); - -pv.Image.prototype.type = "image"; - -/** - * The URL of the image to display. The set of supported image types is - * browser-dependent; PNG and JPEG are recommended. - * - * @type string - * @name pv.Image.prototype.url - */ - -/** - * The width of the image in pixels. For static images, this property is - * computed implicitly from the loaded image resources. For dynamic images, this - * property can be used to specify the width of the pixel buffer; otherwise, the - * value is derived from the width property. - * - * @type number - * @name pv.Image.prototype.imageWidth - */ - -/** - * The height of the image in pixels. For static images, this property is - * computed implicitly from the loaded image resources. For dynamic images, this - * property can be used to specify the height of the pixel buffer; otherwise, the - * value is derived from the height property. - * - * @type number - * @name pv.Image.prototype.imageHeight - */ - -/** - * Default properties for images. By default, there is no stroke or fill style. - * - * @type pv.Image - */ -pv.Image.prototype.defaults = new pv.Image() - .extend(pv.Bar.prototype.defaults) - .fillStyle(null); - -/** - * Specifies the dynamic image function. By default, no image function is - * specified and the url property is used to load a static image - * resource. If an image function is specified, it will be invoked for each - * pixel in the image, based on the related imageWidth and - * imageHeight properties. - * - *

For example, given a two-dimensional array heatmap, containing - * numbers in the range [0, 1] in row-major order, a simple monochrome heatmap - * image can be specified as: - * - *

vis.add(pv.Image)
- *     .imageWidth(heatmap[0].length)
- *     .imageHeight(heatmap.length)
- *     .image(pv.ramp("white", "black").by(function(x, y) heatmap[y][x]));
- * - * For fastest performance, use an ordinal scale which caches the fixed color - * palette, or return an object literal with r, g, b - * and a attributes. A {@link pv.Color} or string can also be returned, - * though this typically results in slower performance. - * - * @param {function} f the new sizing function. - * @returns {pv.Layout.Pack} this. - */ -pv.Image.prototype.image = function(f) { - /** @private */ - this.$image = function() { - var c = f.apply(this, arguments); - return c == null ? pv.Color.transparent - : typeof c == "string" ? pv.color(c) - : c; - }; - return this; -}; - -/** @private Scan the proto chain for an image function. */ -pv.Image.prototype.bind = function() { - pv.Bar.prototype.bind.call(this); - var binds = this.binds, mark = this; - do { - binds.image = mark.$image; - } while (!binds.image && (mark = mark.proto)); -}; - -/** @private */ -pv.Image.prototype.buildImplied = function(s) { - pv.Bar.prototype.buildImplied.call(this, s); - if (!s.visible) return; - - /* Compute the implied image dimensions. */ - if (s.imageWidth == null) s.imageWidth = s.width; - if (s.imageHeight == null) s.imageHeight = s.height; - - /* Compute the pixel values. */ - if ((s.url == null) && this.binds.image) { - - /* Cache the canvas element to reuse across renders. */ - var canvas = this.$canvas || (this.$canvas = document.createElement("canvas")), - context = canvas.getContext("2d"), - w = s.imageWidth, - h = s.imageHeight, - stack = pv.Mark.stack, - data; - - /* Evaluate the image function, storing into a CanvasPixelArray. */ - canvas.width = w; - canvas.height = h; - data = (s.image = context.createImageData(w, h)).data; - stack.unshift(null, null); - for (var y = 0, p = 0; y < h; y++) { - stack[1] = y; - for (var x = 0; x < w; x++) { - stack[0] = x; - var color = this.binds.image.apply(this, stack); - data[p++] = color.r; - data[p++] = color.g; - data[p++] = color.b; - data[p++] = 255 * color.a; - } - } - stack.splice(0, 2); - } -}; -/** - * Constructs a new wedge with default properties. Wedges are not typically - * constructed directly, but by adding to a panel or an existing mark via - * {@link pv.Mark#add}. - * - * @class Represents a wedge, or pie slice. Specified in terms of start and end - * angle, inner and outer radius, wedges can be used to construct donut charts - * and polar bar charts as well. If the {@link #angle} property is used, the end - * angle is implied by adding this value to start angle. By default, the start - * angle is the previously-generated wedge's end angle. This design allows - * explicit control over the wedge placement if desired, while offering - * convenient defaults for the construction of radial graphs. - * - *

The center point of the circle is positioned using the standard box model. - * The wedge can be stroked and filled, similar to {@link pv.Bar}. - * - *

See also the Wedge guide. - * - * @extends pv.Mark - */ -pv.Wedge = function() { - pv.Mark.call(this); -}; - -pv.Wedge.prototype = pv.extend(pv.Mark) - .property("startAngle", Number) - .property("endAngle", Number) - .property("angle", Number) - .property("innerRadius", Number) - .property("outerRadius", Number) - .property("lineWidth", Number) - .property("strokeStyle", pv.color) - .property("fillStyle", pv.color); - -pv.Wedge.prototype.type = "wedge"; - -/** - * The start angle of the wedge, in radians. The start angle is measured - * clockwise from the 3 o'clock position. The default value of this property is - * the end angle of the previous instance (the {@link Mark#sibling}), or -PI / 2 - * for the first wedge; for pie and donut charts, typically only the - * {@link #angle} property needs to be specified. - * - * @type number - * @name pv.Wedge.prototype.startAngle - */ - -/** - * The end angle of the wedge, in radians. If not specified, the end angle is - * implied as the start angle plus the {@link #angle}. - * - * @type number - * @name pv.Wedge.prototype.endAngle - */ - -/** - * The angular span of the wedge, in radians. This property is used if end angle - * is not specified. - * - * @type number - * @name pv.Wedge.prototype.angle - */ - -/** - * The inner radius of the wedge, in pixels. The default value of this property - * is zero; a positive value will produce a donut slice rather than a pie slice. - * The inner radius can vary per-wedge. - * - * @type number - * @name pv.Wedge.prototype.innerRadius - */ - -/** - * The outer radius of the wedge, in pixels. This property is required. For - * pies, only this radius is required; for donuts, the inner radius must be - * specified as well. The outer radius can vary per-wedge. - * - * @type number - * @name pv.Wedge.prototype.outerRadius - */ - -/** - * The width of stroked lines, in pixels; used in conjunction with - * strokeStyle to stroke the wedge's border. - * - * @type number - * @name pv.Wedge.prototype.lineWidth - */ - -/** - * The style of stroked lines; used in conjunction with lineWidth to - * stroke the wedge's border. The default value of this property is null, - * meaning wedges are not stroked by default. - * - * @type string - * @name pv.Wedge.prototype.strokeStyle - * @see pv.color - */ - -/** - * The wedge fill style; if non-null, the interior of the wedge is filled with - * the specified color. The default value of this property is a categorical - * color. - * - * @type string - * @name pv.Wedge.prototype.fillStyle - * @see pv.color - */ - -/** - * Default properties for wedges. By default, there is no stroke and the fill - * style is a categorical color. - * - * @type pv.Wedge - */ -pv.Wedge.prototype.defaults = new pv.Wedge() - .extend(pv.Mark.prototype.defaults) - .startAngle(function() { - var s = this.sibling(); - return s ? s.endAngle : -Math.PI / 2; - }) - .innerRadius(0) - .lineWidth(1.5) - .strokeStyle(null) - .fillStyle(pv.Colors.category20().by(pv.index)); - -/** - * Returns the mid-radius of the wedge, which is defined as half-way between the - * inner and outer radii. - * - * @see #innerRadius - * @see #outerRadius - * @returns {number} the mid-radius, in pixels. - */ -pv.Wedge.prototype.midRadius = function() { - return (this.innerRadius() + this.outerRadius()) / 2; -}; - -/** - * Returns the mid-angle of the wedge, which is defined as half-way between the - * start and end angles. - * - * @see #startAngle - * @see #endAngle - * @returns {number} the mid-angle, in radians. - */ -pv.Wedge.prototype.midAngle = function() { - return (this.startAngle() + this.endAngle()) / 2; -}; - -/** - * Constructs a new wedge anchor with default properties. Wedges support five - * different anchors:

In addition to positioning properties (left, right, top bottom), the - * anchors support text rendering properties (text-align, text-baseline, - * textAngle). Text is rendered to appear inside the wedge. - * - * @param {string} name the anchor name; either a string or a property function. - * @returns {pv.Anchor} - */ -pv.Wedge.prototype.anchor = function(name) { - function partial(s) { return s.innerRadius || s.angle < 2 * Math.PI; } - function midRadius(s) { return (s.innerRadius + s.outerRadius) / 2; } - function midAngle(s) { return (s.startAngle + s.endAngle) / 2; } - var scene; - return pv.Mark.prototype.anchor.call(this, name) - .def("$wedge.anchor", function() { - scene = this.scene.target; - }) - .left(function() { - var s = scene[this.index]; - if (partial(s)) switch (this.name()) { - case "outer": return s.left + s.outerRadius * Math.cos(midAngle(s)); - case "inner": return s.left + s.innerRadius * Math.cos(midAngle(s)); - case "start": return s.left + midRadius(s) * Math.cos(s.startAngle); - case "center": return s.left + midRadius(s) * Math.cos(midAngle(s)); - case "end": return s.left + midRadius(s) * Math.cos(s.endAngle); - } - return s.left; - }) - .top(function() { - var s = scene[this.index]; - if (partial(s)) switch (this.name()) { - case "outer": return s.top + s.outerRadius * Math.sin(midAngle(s)); - case "inner": return s.top + s.innerRadius * Math.sin(midAngle(s)); - case "start": return s.top + midRadius(s) * Math.sin(s.startAngle); - case "center": return s.top + midRadius(s) * Math.sin(midAngle(s)); - case "end": return s.top + midRadius(s) * Math.sin(s.endAngle); - } - return s.top; - }) - .textAlign(function() { - var s = scene[this.index]; - if (partial(s)) switch (this.name()) { - case "outer": return pv.Wedge.upright(midAngle(s)) ? "right" : "left"; - case "inner": return pv.Wedge.upright(midAngle(s)) ? "left" : "right"; - } - return "center"; - }) - .textBaseline(function() { - var s = scene[this.index]; - if (partial(s)) switch (this.name()) { - case "start": return pv.Wedge.upright(s.startAngle) ? "top" : "bottom"; - case "end": return pv.Wedge.upright(s.endAngle) ? "bottom" : "top"; - } - return "middle"; - }) - .textAngle(function() { - var s = scene[this.index], a = 0; - if (partial(s)) switch (this.name()) { - case "center": - case "inner": - case "outer": a = midAngle(s); break; - case "start": a = s.startAngle; break; - case "end": a = s.endAngle; break; - } - return pv.Wedge.upright(a) ? a : (a + Math.PI); - }); -}; - -/** - * Returns true if the specified angle is considered "upright", as in, text - * rendered at that angle would appear upright. If the angle is not upright, - * text is rotated 180 degrees to be upright, and the text alignment properties - * are correspondingly changed. - * - * @param {number} angle an angle, in radius. - * @returns {boolean} true if the specified angle is upright. - */ -pv.Wedge.upright = function(angle) { - angle = angle % (2 * Math.PI); - angle = (angle < 0) ? (2 * Math.PI + angle) : angle; - return (angle < Math.PI / 2) || (angle >= 3 * Math.PI / 2); -}; - -/** @private Sets angle based on endAngle or vice versa. */ -pv.Wedge.prototype.buildImplied = function(s) { - if (s.angle == null) s.angle = s.endAngle - s.startAngle; - else if (s.endAngle == null) s.endAngle = s.startAngle + s.angle; - pv.Mark.prototype.buildImplied.call(this, s); -}; -/** - * Abstract; not implemented. There is no explicit constructor; this class - * merely serves to document the attributes that are used on particles in - * physics simulations. - * - * @class A weighted particle that can participate in a force simulation. - * - * @name pv.Particle - */ - -/** - * The next particle in the simulation. Particles form a singly-linked list. - * - * @field - * @type pv.Particle - * @name pv.Particle.prototype.next - */ - -/** - * The x-position of the particle. - * - * @field - * @type number - * @name pv.Particle.prototype.x - */ - -/** - * The y-position of the particle. - * - * @field - * @type number - * @name pv.Particle.prototype.y - */ - -/** - * The x-velocity of the particle. - * - * @field - * @type number - * @name pv.Particle.prototype.vx - */ - -/** - * The y-velocity of the particle. - * - * @field - * @type number - * @name pv.Particle.prototype.vy - */ - -/** - * The x-position of the particle at -dt. - * - * @field - * @type number - * @name pv.Particle.prototype.px - */ - -/** - * The y-position of the particle at -dt. - * - * @field - * @type number - * @name pv.Particle.prototype.py - */ - -/** - * The x-force on the particle. - * - * @field - * @type number - * @name pv.Particle.prototype.fx - */ - -/** - * The y-force on the particle. - * - * @field - * @type number - * @name pv.Particle.prototype.fy - */ -/** - * Constructs a new empty simulation. - * - * @param {array} particles - * @returns {pv.Simulation} a new simulation for the specified particles. - * @see pv.Simulation - */ -pv.simulation = function(particles) { - return new pv.Simulation(particles); -}; - -/** - * Constructs a new simulation for the specified particles. - * - * @class Represents a particle simulation. Particles are massive points in - * two-dimensional space. Forces can be applied to these particles, causing them - * to move. Constraints can also be applied to restrict particle movement, for - * example, constraining particles to a fixed position, or simulating collision - * between circular particles with area. - * - *

The simulation uses Position Verlet - * integration, due to the ease with which geometric constraints can be - * implemented. For each time step, Verlet integration is performed, new forces - * are accumulated, and then constraints are applied. - * - *

The simulation makes two simplifying assumptions: all particles are - * equal-mass, and the time step of the simulation is fixed. It would be easy to - * incorporate variable-mass particles as a future enhancement. Variable time - * steps are also possible, but are likely to introduce instability in the - * simulation. - * - *

This class can be used directly to simulate particle interaction. - * Alternatively, for network diagrams, see {@link pv.Layout.Force}. - * - * @param {array} particles an array of {@link pv.Particle}s to simulate. - * @see pv.Layout.Force - * @see pv.Force - * @see pv.Constraint - */ -pv.Simulation = function(particles) { - for (var i = 0; i < particles.length; i++) this.particle(particles[i]); -}; - -/** - * The particles in the simulation. Particles are stored as a linked list; this - * field represents the first particle in the simulation. - * - * @field - * @type pv.Particle - * @name pv.Simulation.prototype.particles - */ - -/** - * The forces in the simulation. Forces are stored as a linked list; this field - * represents the first force in the simulation. - * - * @field - * @type pv.Force - * @name pv.Simulation.prototype.forces - */ - -/** - * The constraints in the simulation. Constraints are stored as a linked list; - * this field represents the first constraint in the simulation. - * - * @field - * @type pv.Constraint - * @name pv.Simulation.prototype.constraints - */ - -/** - * Adds the specified particle to the simulation. - * - * @param {pv.Particle} p the new particle. - * @returns {pv.Simulation} this. - */ -pv.Simulation.prototype.particle = function(p) { - p.next = this.particles; - /* Default velocities and forces to zero if unset. */ - if (isNaN(p.px)) p.px = p.x; - if (isNaN(p.py)) p.py = p.y; - if (isNaN(p.fx)) p.fx = 0; - if (isNaN(p.fy)) p.fy = 0; - this.particles = p; - return this; -}; - -/** - * Adds the specified force to the simulation. - * - * @param {pv.Force} f the new force. - * @returns {pv.Simulation} this. - */ -pv.Simulation.prototype.force = function(f) { - f.next = this.forces; - this.forces = f; - return this; -}; - -/** - * Adds the specified constraint to the simulation. - * - * @param {pv.Constraint} c the new constraint. - * @returns {pv.Simulation} this. - */ -pv.Simulation.prototype.constraint = function(c) { - c.next = this.constraints; - this.constraints = c; - return this; -}; - -/** - * Apply constraints, and then set the velocities to zero. - * - * @returns {pv.Simulation} this. - */ -pv.Simulation.prototype.stabilize = function(n) { - var c; - if (!arguments.length) n = 3; // TODO use cooling schedule - for (var i = 0; i < n; i++) { - var q = new pv.Quadtree(this.particles); - for (c = this.constraints; c; c = c.next) c.apply(this.particles, q); - } - for (var p = this.particles; p; p = p.next) { - p.px = p.x; - p.py = p.y; - } - return this; -}; - -/** - * Advances the simulation one time-step. - */ -pv.Simulation.prototype.step = function() { - var p, f, c; - - /* - * Assumptions: - * - The mass (m) of every particles is 1. - * - The time step (dt) is 1. - */ - - /* Position Verlet integration. */ - for (p = this.particles; p; p = p.next) { - var px = p.px, py = p.py; - p.px = p.x; - p.py = p.y; - p.x += p.vx = ((p.x - px) + p.fx); - p.y += p.vy = ((p.y - py) + p.fy); - } - - /* Apply constraints, then accumulate new forces. */ - var q = new pv.Quadtree(this.particles); - for (c = this.constraints; c; c = c.next) c.apply(this.particles, q); - for (p = this.particles; p; p = p.next) p.fx = p.fy = 0; - for (f = this.forces; f; f = f.next) f.apply(this.particles, q); -}; -/** - * Constructs a new quadtree for the specified array of particles. - * - * @class Represents a quadtree: a two-dimensional recursive spatial - * subdivision. This particular implementation uses square partitions, dividing - * each square into four equally-sized squares. Each particle exists in a unique - * node; if multiple particles are in the same position, some particles may be - * stored on internal nodes rather than leaf nodes. - * - *

This quadtree can be used to accelerate various spatial operations, such - * as the Barnes-Hut approximation for computing n-body forces, or collision - * detection. - * - * @see pv.Force.charge - * @see pv.Constraint.collision - * @param {pv.Particle} particles the linked list of particles. - */ -pv.Quadtree = function(particles) { - var p; - - /* Compute bounds. */ - var x1 = Number.POSITIVE_INFINITY, y1 = x1, - x2 = Number.NEGATIVE_INFINITY, y2 = x2; - for (p = particles; p; p = p.next) { - if (p.x < x1) x1 = p.x; - if (p.y < y1) y1 = p.y; - if (p.x > x2) x2 = p.x; - if (p.y > y2) y2 = p.y; - } - - /* Squarify the bounds. */ - var dx = x2 - x1, dy = y2 - y1; - if (dx > dy) y2 = y1 + dx; - else x2 = x1 + dy; - this.xMin = x1; - this.yMin = y1; - this.xMax = x2; - this.yMax = y2; - - /** - * @ignore Recursively inserts the specified particle p at the node - * n or one of its descendants. The bounds are defined by [x1, - * x2] and [y1, y2]. - */ - function insert(n, p, x1, y1, x2, y2) { - if (isNaN(p.x) || isNaN(p.y)) return; // ignore invalid particles - if (n.leaf) { - if (n.p) { - /* - * If the particle at this leaf node is at the same position as the new - * particle we are adding, we leave the particle associated with the - * internal node while adding the new particle to a child node. This - * avoids infinite recursion. - */ - if ((Math.abs(n.p.x - p.x) + Math.abs(n.p.y - p.y)) < .01) { - insertChild(n, p, x1, y1, x2, y2); - } else { - var v = n.p; - n.p = null; - insertChild(n, v, x1, y1, x2, y2); - insertChild(n, p, x1, y1, x2, y2); - } - } else { - n.p = p; - } - } else { - insertChild(n, p, x1, y1, x2, y2); - } - } - - /** - * @ignore Recursively inserts the specified particle p into a - * descendant of node n. The bounds are defined by [x1, - * x2] and [y1, y2]. - */ - function insertChild(n, p, x1, y1, x2, y2) { - /* Compute the split point, and the quadrant in which to insert p. */ - var sx = (x1 + x2) * .5, - sy = (y1 + y2) * .5, - right = p.x >= sx, - bottom = p.y >= sy; - - /* Recursively insert into the child node. */ - n.leaf = false; - switch ((bottom << 1) + right) { - case 0: n = n.c1 || (n.c1 = new pv.Quadtree.Node()); break; - case 1: n = n.c2 || (n.c2 = new pv.Quadtree.Node()); break; - case 2: n = n.c3 || (n.c3 = new pv.Quadtree.Node()); break; - case 3: n = n.c4 || (n.c4 = new pv.Quadtree.Node()); break; - } - - /* Update the bounds as we recurse. */ - if (right) x1 = sx; else x2 = sx; - if (bottom) y1 = sy; else y2 = sy; - insert(n, p, x1, y1, x2, y2); - } - - /* Insert all particles. */ - this.root = new pv.Quadtree.Node(); - for (p = particles; p; p = p.next) insert(this.root, p, x1, y1, x2, y2); -}; - -/** - * The root node of the quadtree. - * - * @type pv.Quadtree.Node - * @name pv.Quadtree.prototype.root - */ - -/** - * The minimum x-coordinate value of all contained particles. - * - * @type number - * @name pv.Quadtree.prototype.xMin - */ - -/** - * The maximum x-coordinate value of all contained particles. - * - * @type number - * @name pv.Quadtree.prototype.xMax - */ - -/** - * The minimum y-coordinate value of all contained particles. - * - * @type number - * @name pv.Quadtree.prototype.yMin - */ - -/** - * The maximum y-coordinate value of all contained particles. - * - * @type number - * @name pv.Quadtree.prototype.yMax - */ - -/** - * Constructs a new node. - * - * @class A node in a quadtree. - * - * @see pv.Quadtree - */ -pv.Quadtree.Node = function() { - /* - * Prepopulating all attributes significantly increases performance! Also, - * letting the language interpreter manage garbage collection was moderately - * faster than creating a cache pool. - */ - this.leaf = true; - this.c1 = null; - this.c2 = null; - this.c3 = null; - this.c4 = null; - this.p = null; -}; - -/** - * True if this node is a leaf node; i.e., it has no children. Note that both - * leaf nodes and non-leaf (internal) nodes may have associated particles. If - * this is a non-leaf node, then at least one of {@link #c1}, {@link #c2}, - * {@link #c3} or {@link #c4} is guaranteed to be non-null. - * - * @type boolean - * @name pv.Quadtree.Node.prototype.leaf - */ - -/** - * The particle associated with this node, if any. - * - * @type pv.Particle - * @name pv.Quadtree.Node.prototype.p - */ - -/** - * The child node for the second quadrant, if any. - * - * @type pv.Quadtree.Node - * @name pv.Quadtree.Node.prototype.c2 - */ - -/** - * The child node for the third quadrant, if any. - * - * @type pv.Quadtree.Node - * @name pv.Quadtree.Node.prototype.c3 - */ - -/** - * The child node for the fourth quadrant, if any. - * - * @type pv.Quadtree.Node - * @name pv.Quadtree.Node.prototype.c4 - */ -/** - * Abstract; see an implementing class. - * - * @class Represents a force that acts on particles. Note that this interface - * does not specify how to bind a force to specific particles; in general, - * forces are applied globally to all particles. However, some forces may be - * applied to specific particles or between particles, such as spring forces, - * through additional specialization. - * - * @see pv.Simulation - * @see pv.Particle - * @see pv.Force.charge - * @see pv.Force.drag - * @see pv.Force.spring - */ -pv.Force = {}; - -/** - * Applies this force to the specified particles. - * - * @function - * @name pv.Force.prototype.apply - * @param {pv.Particle} particles particles to which to apply this force. - * @param {pv.Quadtree} q a quadtree for spatial acceleration. - */ -/** - * Constructs a new charge force, with an optional charge constant. The charge - * constant can be negative for repulsion (e.g., particles with electrical - * charge of equal sign), or positive for attraction (e.g., massive particles - * with mutual gravity). The default charge constant is -40. - * - * @class An n-body force, as defined by Coulomb's law or Newton's law of - * gravitation, inversely proportional to the square of the distance between - * particles. Note that the force is independent of the mass of the - * associated particles, and that the particles do not have charges of varying - * magnitude; instead, the attraction or repulsion of all particles is globally - * specified as the charge {@link #constant}. - * - *

This particular implementation uses the Barnes-Hut algorithm. For details, - * see "A - * hierarchical O(N log N) force-calculation algorithm", J. Barnes & - * P. Hut, Nature 1986. - * - * @name pv.Force.charge - * @param {number} [k] the charge constant. - */ -pv.Force.charge = function(k) { - var min = 2, // minimum distance at which to observe forces - min1 = 1 / min, - max = 500, // maximum distance at which to observe forces - max1 = 1 / max, - theta = .9, // Barnes-Hut theta approximation constant - force = {}; - - if (!arguments.length) k = -40; // default charge constant (repulsion) - - /** - * Sets or gets the charge constant. If an argument is specified, it is the - * new charge constant. The charge constant can be negative for repulsion - * (e.g., particles with electrical charge of equal sign), or positive for - * attraction (e.g., massive particles with mutual gravity). The default - * charge constant is -40. - * - * @function - * @name pv.Force.charge.prototype.constant - * @param {number} x the charge constant. - * @returns {pv.Force.charge} this. - */ - force.constant = function(x) { - if (arguments.length) { - k = Number(x); - return force; - } - return k; - }; - - /** - * Sets or gets the domain; specifies the minimum and maximum domain within - * which charge forces are applied. A minimum distance threshold avoids - * applying forces that are two strong (due to granularity of the simulation's - * numeric integration). A maximum distance threshold improves performance by - * skipping force calculations for particles that are far apart. - * - *

The default domain is [2, 500]. - * - * @function - * @name pv.Force.charge.prototype.domain - * @param {number} a - * @param {number} b - * @returns {pv.Force.charge} this. - */ - force.domain = function(a, b) { - if (arguments.length) { - min = Number(a); - min1 = 1 / min; - max = Number(b); - max1 = 1 / max; - return force; - } - return [min, max]; - }; - - /** - * Sets or gets the Barnes-Hut approximation factor. The Barnes-Hut - * approximation criterion is the ratio of the size of the quadtree node to - * the distance from the point to the node's center of mass is beneath some - * threshold. - * - * @function - * @name pv.Force.charge.prototype.theta - * @param {number} x the new Barnes-Hut approximation factor. - * @returns {pv.Force.charge} this. - */ - force.theta = function(x) { - if (arguments.length) { - theta = Number(x); - return force; - } - return theta; - }; - - /** - * @ignore Recursively computes the center of charge for each node in the - * quadtree. This is equivalent to the center of mass, assuming that all - * particles have unit weight. - */ - function accumulate(n) { - var cx = 0, cy = 0; - n.cn = 0; - function accumulateChild(c) { - accumulate(c); - n.cn += c.cn; - cx += c.cn * c.cx; - cy += c.cn * c.cy; - } - if (!n.leaf) { - if (n.c1) accumulateChild(n.c1); - if (n.c2) accumulateChild(n.c2); - if (n.c3) accumulateChild(n.c3); - if (n.c4) accumulateChild(n.c4); - } - if (n.p) { - n.cn += k; - cx += k * n.p.x; - cy += k * n.p.y; - } - n.cx = cx / n.cn; - n.cy = cy / n.cn; - } - - /** - * @ignore Recursively computes forces on the given particle using the given - * quadtree node. The Barnes-Hut approximation criterion is the ratio of the - * size of the quadtree node to the distance from the point to the node's - * center of mass is beneath some threshold. - */ - function forces(n, p, x1, y1, x2, y2) { - var dx = n.cx - p.x, - dy = n.cy - p.y, - dn = 1 / Math.sqrt(dx * dx + dy * dy); - - /* Barnes-Hut criterion. */ - if ((n.leaf && (n.p != p)) || ((x2 - x1) * dn < theta)) { - if (dn < max1) return; - if (dn > min1) dn = min1; - var kc = n.cn * dn * dn * dn, - fx = dx * kc, - fy = dy * kc; - p.fx += fx; - p.fy += fy; - } else if (!n.leaf) { - var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5; - if (n.c1) forces(n.c1, p, x1, y1, sx, sy); - if (n.c2) forces(n.c2, p, sx, y1, x2, sy); - if (n.c3) forces(n.c3, p, x1, sy, sx, y2); - if (n.c4) forces(n.c4, p, sx, sy, x2, y2); - if (dn < max1) return; - if (dn > min1) dn = min1; - if (n.p && (n.p != p)) { - var kc = k * dn * dn * dn, - fx = dx * kc, - fy = dy * kc; - p.fx += fx; - p.fy += fy; - } - } - } - - /** - * Applies this force to the specified particles. The force is applied between - * all pairs of particles within the domain, using the specified quadtree to - * accelerate n-body force calculation using the Barnes-Hut approximation - * criterion. - * - * @function - * @name pv.Force.charge.prototype.apply - * @param {pv.Particle} particles particles to which to apply this force. - * @param {pv.Quadtree} q a quadtree for spatial acceleration. - */ - force.apply = function(particles, q) { - accumulate(q.root); - for (var p = particles; p; p = p.next) { - forces(q.root, p, q.xMin, q.yMin, q.xMax, q.yMax); - } - }; - - return force; -}; -/** - * Constructs a new drag force with the specified constant. - * - * @class Implements a drag force, simulating friction. The drag force is - * applied in the opposite direction of the particle's velocity. Since Position - * Verlet integration does not track velocities explicitly, the error term with - * this estimate of velocity is fairly high, so the drag force may be - * inaccurate. - * - * @extends pv.Force - * @param {number} k the drag constant. - * @see #constant - */ -pv.Force.drag = function(k) { - var force = {}; - - if (!arguments.length) k = .1; // default drag constant - - /** - * Sets or gets the drag constant, in the range [0,1]. The default drag - * constant is 0.1. The drag forces scales linearly with the particle's - * velocity based on the given drag constant. - * - * @function - * @name pv.Force.drag.prototype.constant - * @param {number} x the new drag constant. - * @returns {pv.Force.drag} this, or the current drag constant. - */ - force.constant = function(x) { - if (arguments.length) { k = x; return force; } - return k; - }; - - /** - * Applies this force to the specified particles. - * - * @function - * @name pv.Force.drag.prototype.apply - * @param {pv.Particle} particles particles to which to apply this force. - */ - force.apply = function(particles) { - if (k) for (var p = particles; p; p = p.next) { - p.fx -= k * p.vx; - p.fy -= k * p.vy; - } - }; - - return force; -}; -/** - * Constructs a new spring force with the specified constant. The links - * associated with this spring force must be specified before the spring force - * can be applied. - * - * @class Implements a spring force, per Hooke's law. The spring force can be - * configured with a tension constant, rest length, and damping factor. The - * tension and damping will automatically be normalized using the inverse square - * root of the maximum link degree of attached nodes; this makes springs weaker - * between nodes of high link degree. - * - *

Unlike other forces (such as charge and drag forces) which may be applied - * globally, spring forces are only applied between linked particles. Therefore, - * an array of links must be specified before this force can be applied; the - * links should be an array of {@link pv.Layout.Network.Link}s. See also - * {@link pv.Layout.Force} for an example of using spring and charge forces for - * network layout. - * - * @extends pv.Force - * @param {number} k the spring constant. - * @see #constant - * @see #links - */ -pv.Force.spring = function(k) { - var d = .1, // default damping factor - l = 20, // default rest length - links, // links on which to apply spring forces - kl, // per-spring normalization - force = {}; - - if (!arguments.length) k = .1; // default spring constant (tension) - - /** - * Sets or gets the links associated with this spring force. Unlike other - * forces (such as charge and drag forces) which may be applied globally, - * spring forces are only applied between linked particles. Therefore, an - * array of links must be specified before this force can be applied; the - * links should be an array of {@link pv.Layout.Network.Link}s. - * - * @function - * @name pv.Force.spring.prototype.links - * @param {array} x the new array of links. - * @returns {pv.Force.spring} this, or the current array of links. - */ - force.links = function(x) { - if (arguments.length) { - links = x; - kl = x.map(function(l) { - return 1 / Math.sqrt(Math.max( - l.sourceNode.linkDegree, - l.targetNode.linkDegree)); - }); - return force; - } - return links; - }; - - /** - * Sets or gets the spring constant. The default value is 0.1; greater values - * will result in stronger tension. The spring tension is automatically - * normalized using the inverse square root of the maximum link degree of - * attached nodes. - * - * @function - * @name pv.Force.spring.prototype.constant - * @param {number} x the new spring constant. - * @returns {pv.Force.spring} this, or the current spring constant. - */ - force.constant = function(x) { - if (arguments.length) { - k = Number(x); - return force; - } - return k; - }; - - /** - * The spring damping factor, in the range [0,1]. Damping functions - * identically to drag forces, damping spring bounciness by applying a force - * in the opposite direction of attached nodes' velocities. The default value - * is 0.1. The spring damping is automatically normalized using the inverse - * square root of the maximum link degree of attached nodes. - * - * @function - * @name pv.Force.spring.prototype.damping - * @param {number} x the new spring damping factor. - * @returns {pv.Force.spring} this, or the current spring damping factor. - */ - force.damping = function(x) { - if (arguments.length) { - d = Number(x); - return force; - } - return d; - }; - - /** - * The spring rest length. The default value is 20 pixels. - * - * @function - * @name pv.Force.spring.prototype.length - * @param {number} x the new spring rest length. - * @returns {pv.Force.spring} this, or the current spring rest length. - */ - force.length = function(x) { - if (arguments.length) { - l = Number(x); - return force; - } - return l; - }; - - /** - * Applies this force to the specified particles. - * - * @function - * @name pv.Force.spring.prototype.apply - * @param {pv.Particle} particles particles to which to apply this force. - */ - force.apply = function(particles) { - for (var i = 0; i < links.length; i++) { - var a = links[i].sourceNode, - b = links[i].targetNode, - dx = a.x - b.x, - dy = a.y - b.y, - dn = Math.sqrt(dx * dx + dy * dy), - dd = dn ? (1 / dn) : 1, - ks = k * kl[i], // normalized tension - kd = d * kl[i], // normalized damping - kk = (ks * (dn - l) + kd * (dx * (a.vx - b.vx) + dy * (a.vy - b.vy)) * dd) * dd, - fx = -kk * (dn ? dx : (.01 * (.5 - Math.random()))), - fy = -kk * (dn ? dy : (.01 * (.5 - Math.random()))); - a.fx += fx; - a.fy += fy; - b.fx -= fx; - b.fy -= fy; - } - }; - - return force; -}; -/** - * Abstract; see an implementing class. - * - * @class Represents a constraint that acts on particles. Note that this - * interface does not specify how to bind a constraint to specific particles; in - * general, constraints are applied globally to all particles. However, some - * constraints may be applied to specific particles or between particles, such - * as position constraints, through additional specialization. - * - * @see pv.Simulation - * @see pv.Particle - * @see pv.Constraint.bound - * @see pv.Constraint.collision - * @see pv.Constraint.position - */ -pv.Constraint = {}; - -/** - * Applies this constraint to the specified particles. - * - * @function - * @name pv.Constraint.prototype.apply - * @param {pv.Particle} particles particles to which to apply this constraint. - * @param {pv.Quadtree} q a quadtree for spatial acceleration. - * @returns {pv.Constraint} this. - */ -/** - * Constructs a new collision constraint. The default search radius is 10, and - * the default repeat count is 1. A radius function must be specified to compute - * the radius of particles. - * - * @class Constraints circles to avoid overlap. Each particle is treated as a - * circle, with the radius of the particle computed using a specified function. - * For example, if the particle has an r attribute storing the radius, - * the radius function(d) d.r specifies a collision constraint using - * this radius. The radius function is passed each {@link pv.Particle} as the - * first argument. - * - *

To accelerate collision detection, this implementation uses a quadtree and - * a search radius. The search radius is computed as the maximum radius of all - * particles in the simulation. - * - * @see pv.Constraint - * @param {function} radius the radius function. - */ -pv.Constraint.collision = function(radius) { - var n = 1, // number of times to repeat the constraint - r1, - px1, - py1, - px2, - py2, - constraint = {}; - - if (!arguments.length) r1 = 10; // default search radius - - /** - * Sets or gets the repeat count. If the repeat count is greater than 1, the - * constraint will be applied repeatedly; this is a form of the Gauss-Seidel - * method for constraints relaxation. Repeating the collision constraint makes - * the constraint have more of an effect when there is a potential for many - * co-occurring collisions. - * - * @function - * @name pv.Constraint.collision.prototype.repeat - * @param {number} x the number of times to repeat this constraint. - * @returns {pv.Constraint.collision} this. - */ - constraint.repeat = function(x) { - if (arguments.length) { - n = Number(x); - return constraint; - } - return n; - }; - - /** @private */ - function constrain(n, p, x1, y1, x2, y2) { - if (!n.leaf) { - var sx = (x1 + x2) * .5, - sy = (y1 + y2) * .5, - top = sy > py1, - bottom = sy < py2, - left = sx > px1, - right = sx < px2; - if (top) { - if (n.c1 && left) constrain(n.c1, p, x1, y1, sx, sy); - if (n.c2 && right) constrain(n.c2, p, sx, y1, x2, sy); - } - if (bottom) { - if (n.c3 && left) constrain(n.c3, p, x1, sy, sx, y2); - if (n.c4 && right) constrain(n.c4, p, sx, sy, x2, y2); - } - } - if (n.p && (n.p != p)) { - var dx = p.x - n.p.x, - dy = p.y - n.p.y, - l = Math.sqrt(dx * dx + dy * dy), - d = r1 + radius(n.p); - if (l < d) { - var k = (l - d) / l * .5; - dx *= k; - dy *= k; - p.x -= dx; - p.y -= dy; - n.p.x += dx; - n.p.y += dy; - } - } - } - - /** - * Applies this constraint to the specified particles. - * - * @function - * @name pv.Constraint.collision.prototype.apply - * @param {pv.Particle} particles particles to which to apply this constraint. - * @param {pv.Quadtree} q a quadtree for spatial acceleration. - */ - constraint.apply = function(particles, q) { - var p, r, max = -Infinity; - for (p = particles; p; p = p.next) { - r = radius(p); - if (r > max) max = r; - } - for (var i = 0; i < n; i++) { - for (p = particles; p; p = p.next) { - r = (r1 = radius(p)) + max; - px1 = p.x - r; - px2 = p.x + r; - py1 = p.y - r; - py2 = p.y + r; - constrain(q.root, p, q.xMin, q.yMin, q.xMax, q.yMax); - } - } - }; - - return constraint; -}; -/** - * Constructs a default position constraint using the fix attribute. - * An optional position function can be specified to determine how the fixed - * position per-particle is determined. - * - * @class Constraints particles to a fixed position. The fixed position per - * particle is determined using a given position function, which defaults to - * function(d) d.fix. - * - *

If the position function returns null, then no position constraint is - * applied to the given particle. Otherwise, the particle's position is set to - * the returned position, as expressed by a {@link pv.Vector}. (Note: the - * position does not need to be an instance of pv.Vector, but simply an - * object with x and y attributes.) - * - *

This constraint also supports a configurable alpha parameter, which - * defaults to 1. If the alpha parameter is in the range [0,1], then rather than - * setting the particle's new position directly to the position returned by the - * supplied position function, the particle's position is interpolated towards - * the fixed position. This results is a smooth (exponential) drift towards the - * fixed position, which can increase the stability of the physics simulation. - * In addition, the alpha parameter can be decayed over time, relaxing the - * position constraint, which helps to stabilize on an optimal solution. - * - * @param {function} [f] the position function. - */ -pv.Constraint.position = function(f) { - var a = 1, // default alpha - constraint = {}; - - if (!arguments.length) /** @ignore */ f = function(p) { return p.fix; }; - - /** - * Sets or gets the alpha parameter for position interpolation. If the alpha - * parameter is in the range [0,1], then rather than setting the particle's - * new position directly to the position returned by the supplied position - * function, the particle's position is interpolated towards the fixed - * position. - * - * @function - * @name pv.Constraint.position.prototype.alpha - * @param {number} x the new alpha parameter, in the range [0,1]. - * @returns {pv.Constraint.position} this. - */ - constraint.alpha = function(x) { - if (arguments.length) { - a = Number(x); - return constraint; - } - return a; - }; - - /** - * Applies this constraint to the specified particles. - * - * @function - * @name pv.Constraint.position.prototype.apply - * @param {pv.Particle} particles particles to which to apply this constraint. - */ - constraint.apply = function(particles) { - for (var p = particles; p; p = p.next) { - var v = f(p); - if (v) { - p.x += (v.x - p.x) * a; - p.y += (v.y - p.y) * a; - p.fx = p.fy = p.vx = p.vy = 0; - } - } - }; - - return constraint; -}; -/** - * Constructs a new bound constraint. Before the constraint can be used, the - * {@link #x} and {@link #y} methods must be call to specify the bounds. - * - * @class Constrains particles to within fixed rectangular bounds. For example, - * this constraint can be used to constrain particles in a physics simulation - * within the bounds of an enclosing panel. - * - *

Note that the current implementation treats particles as points, with no - * area. If the particles are rendered as dots, be sure to include some - * additional padding to inset the bounds such that the edges of the dots do not - * get clipped by the panel bounds. If the particles have different radii, this - * constraint would need to be extended using a radius function, similar to - * {@link pv.Constraint.collision}. - * - * @see pv.Layout.Force - * @extends pv.Constraint - */ -pv.Constraint.bound = function() { - var constraint = {}, - x, - y; - - /** - * Sets or gets the bounds on the x-coordinate. - * - * @function - * @name pv.Constraint.bound.prototype.x - * @param {number} min the minimum allowed x-coordinate. - * @param {number} max the maximum allowed x-coordinate. - * @returns {pv.Constraint.bound} this. - */ - constraint.x = function(min, max) { - if (arguments.length) { - x = {min: Math.min(min, max), max: Math.max(min, max)}; - return this; - } - return x; - }; - - /** - * Sets or gets the bounds on the y-coordinate. - * - * @function - * @name pv.Constraint.bound.prototype.y - * @param {number} min the minimum allowed y-coordinate. - * @param {number} max the maximum allowed y-coordinate. - * @returns {pv.Constraint.bound} this. - */ - constraint.y = function(min, max) { - if (arguments.length) { - y = {min: Math.min(min, max), max: Math.max(min, max)}; - return this; - } - return y; - }; - - /** - * Applies this constraint to the specified particles. - * - * @function - * @name pv.Constraint.bound.prototype.apply - * @param {pv.Particle} particles particles to which to apply this constraint. - */ - constraint.apply = function(particles) { - if (x) for (var p = particles; p; p = p.next) { - p.x = p.x < x.min ? x.min : (p.x > x.max ? x.max : p.x); - } - if (y) for (var p = particles; p; p = p.next) { - p.y = p.y < y.min ? y.min : (p.y > y.max ? y.max : p.y); - } - }; - - return constraint; -}; -/** - * Constructs a new, empty layout with default properties. Layouts are not - * typically constructed directly; instead, a concrete subclass is added to an - * existing panel via {@link pv.Mark#add}. - * - * @class Represents an abstract layout, encapsulating a visualization technique - * such as a streamgraph or treemap. Layouts are themselves containers, - * extending from {@link pv.Panel}, and defining a set of mark prototypes as - * children. These mark prototypes provide default properties that together - * implement the given visualization technique. - * - *

Layouts do not initially contain any marks; any exported marks (such as a - * network layout's link and node) are intended to be used as - * prototypes. By adding a concrete mark, such as a {@link pv.Bar}, to the - * appropriate mark prototype, the mark is added to the layout and inherits the - * given properties. This approach allows further customization of the layout, - * either by choosing a different mark type to add, or more simply by overriding - * some of the layout's defined properties. - * - *

Each concrete layout, such as treemap or circle-packing, has different - * behavior and may export different mark prototypes, depending on what marks - * are typically needed to render the desired visualization. Therefore it is - * important to understand how each layout is structured, such that the provided - * mark prototypes are used appropriately. - * - *

In addition to the mark prototypes, layouts may define custom properties - * that affect the overall behavior of the layout. For example, a treemap layout - * might use a property to specify which layout algorithm to use. These - * properties are just like other mark properties, and can be defined as - * constants or as functions. As with panels, the data property can be used to - * replicate layouts, and properties can be defined to in terms of layout data. - * - * @extends pv.Panel - */ -pv.Layout = function() { - pv.Panel.call(this); -}; - -pv.Layout.prototype = pv.extend(pv.Panel); - -/** - * @private Defines a local property with the specified name and cast. Note that - * although the property method is only defined locally, the cast function is - * global, which is necessary since properties are inherited! - * - * @param {string} name the property name. - * @param {function} [cast] the cast function for this property. - */ -pv.Layout.prototype.property = function(name, cast) { - if (!this.hasOwnProperty("properties")) { - this.properties = pv.extend(this.properties); - } - this.properties[name] = true; - this.propertyMethod(name, false, pv.Mark.cast[name] = cast); - return this; -}; -/** - * Constructs a new, empty network layout. Layouts are not typically constructed - * directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Represents an abstract layout for network diagrams. This class - * provides the basic structure for both node-link diagrams (such as - * force-directed graph layout) and space-filling network diagrams (such as - * sunbursts and treemaps). Note that "network" here is a general term that - * includes hierarchical structures; a tree is represented using links from - * child to parent. - * - *

Network layouts require the graph data structure to be defined using two - * properties:

- * - *

Three standard mark prototypes are provided:

Note that some network implementations may not support all three - * standard mark prototypes; for example, space-filling hierarchical layouts - * typically do not use a link prototype, as the parent-child links are - * implied by the structure of the space-filling node marks. Check the - * specific network layout for implementation details. - * - *

Network layout properties, including nodes and links, - * are typically cached rather than re-evaluated with every call to render. This - * is a performance optimization, as network layout algorithms can be - * expensive. If the network structure changes, call {@link #reset} to clear the - * cache before rendering. Note that although the network layout properties are - * cached, child mark properties, such as the marks used to render the nodes and - * links, are not. Therefore, non-structural changes to the network - * layout, such as changing the color of a mark on mouseover, do not need to - * reset the layout. - * - * @see pv.Layout.Hierarchy - * @see pv.Layout.Force - * @see pv.Layout.Matrix - * @see pv.Layout.Arc - * @see pv.Layout.Rollup - * @extends pv.Layout - */ -pv.Layout.Network = function() { - pv.Layout.call(this); - var that = this; - - /* @private Version tracking to cache layout state, improving performance. */ - this.$id = pv.id(); - - /** - * The node prototype. This prototype is intended to be used with a Dot mark - * in conjunction with the link prototype. - * - * @type pv.Mark - * @name pv.Layout.Network.prototype.node - */ - (this.node = new pv.Mark() - .data(function() { return that.nodes(); }) - .strokeStyle("#1f77b4") - .fillStyle("#fff") - .left(function(n) { return n.x; }) - .top(function(n) { return n.y; })).parent = this; - - /** - * The link prototype, which renders edges between source nodes and target - * nodes. This prototype is intended to be used with a Line mark in - * conjunction with the node prototype. - * - * @type pv.Mark - * @name pv.Layout.Network.prototype.link - */ - this.link = new pv.Mark() - .extend(this.node) - .data(function(p) { return [p.sourceNode, p.targetNode]; }) - .fillStyle(null) - .lineWidth(function(d, p) { return p.linkValue * 1.5; }) - .strokeStyle("rgba(0,0,0,.2)"); - - this.link.add = function(type) { - return that.add(pv.Panel) - .data(function() { return that.links(); }) - .add(type) - .extend(this); - }; - - /** - * The node label prototype, which renders the node name adjacent to the node. - * This prototype is provided as an alternative to using the anchor on the - * node mark; it is primarily intended to be used with radial node-link - * layouts, since it provides a convenient mechanism to set the text angle. - * - * @type pv.Mark - * @name pv.Layout.Network.prototype.label - */ - (this.label = new pv.Mark() - .extend(this.node) - .textMargin(7) - .textBaseline("middle") - .text(function(n) { return n.nodeName || n.nodeValue; }) - .textAngle(function(n) { - var a = n.midAngle; - return pv.Wedge.upright(a) ? a : (a + Math.PI); - }) - .textAlign(function(n) { - return pv.Wedge.upright(n.midAngle) ? "left" : "right"; - })).parent = this; -}; - -/** - * @class Represents a node in a network layout. There is no explicit - * constructor; this class merely serves to document the attributes that are - * used on nodes in network layouts. (Note that hierarchical nodes place - * additional requirements on node representation, vis {@link pv.Dom.Node}.) - * - * @see pv.Layout.Network - * @name pv.Layout.Network.Node - */ - -/** - * The node index, zero-based. This attribute is populated automatically based - * on the index in the array returned by the nodes property. - * - * @type number - * @name pv.Layout.Network.Node.prototype.index - */ - -/** - * The link degree; the sum of link values for all incoming and outgoing links. - * This attribute is populated automatically. - * - * @type number - * @name pv.Layout.Network.Node.prototype.linkDegree - */ - -/** - * The node name; optional. If present, this attribute will be used to provide - * the text for node labels. If not present, the label text will fallback to the - * nodeValue attribute. - * - * @type string - * @name pv.Layout.Network.Node.prototype.nodeName - */ - -/** - * The node value; optional. If present, and no nodeName attribute is - * present, the node value will be used as the label text. This attribute is - * also automatically populated if the nodes are specified as an array of - * primitives, such as strings or numbers. - * - * @type object - * @name pv.Layout.Network.Node.prototype.nodeValue - */ - -/** - * @class Represents a link in a network layout. There is no explicit - * constructor; this class merely serves to document the attributes that are - * used on links in network layouts. For hierarchical layouts, this class is - * used to represent the parent-child links. - * - * @see pv.Layout.Network - * @name pv.Layout.Network.Link - */ - -/** - * The link value, or weight; optional. If not specified (or not a number), the - * default value of 1 is used. - * - * @type number - * @name pv.Layout.Network.Link.prototype.linkValue - */ - -/** - * The link's source node. If not set, this value will be derived from the - * source attribute index. - * - * @type pv.Layout.Network.Node - * @name pv.Layout.Network.Link.prototype.sourceNode - */ - -/** - * The link's target node. If not set, this value will be derived from the - * target attribute index. - * - * @type pv.Layout.Network.Node - * @name pv.Layout.Network.Link.prototype.targetNode - */ - -/** - * Alias for sourceNode, as expressed by the index of the source node. - * This attribute is not populated automatically, but may be used as a more - * convenient identification of the link's source, for example in a static JSON - * representation. - * - * @type number - * @name pv.Layout.Network.Link.prototype.source - */ - -/** - * Alias for targetNode, as expressed by the index of the target node. - * This attribute is not populated automatically, but may be used as a more - * convenient identification of the link's target, for example in a static JSON - * representation. - * - * @type number - * @name pv.Layout.Network.Link.prototype.target - */ - -/** - * Alias for linkValue. This attribute is not populated automatically, - * but may be used instead of the linkValue attribute when specifying - * links. - * - * @type number - * @name pv.Layout.Network.Link.prototype.value - */ - -/** @private Transform nodes and links on cast. */ -pv.Layout.Network.prototype = pv.extend(pv.Layout) - .property("nodes", function(v) { - return v.map(function(d, i) { - if (typeof d != "object") d = {nodeValue: d}; - d.index = i; - d.linkDegree = 0; - return d; - }); - }) - .property("links", function(v) { - return v.map(function(d) { - if (isNaN(d.linkValue)) d.linkValue = isNaN(d.value) ? 1 : d.value; - return d; - }); - }); - -/** - * Resets the cache, such that changes to layout property definitions will be - * visible on subsequent render. Unlike normal marks (and normal layouts), - * properties associated with network layouts are not automatically re-evaluated - * on render; the properties are cached, and any expensive layout algorithms are - * only run after the layout is explicitly reset. - * - * @returns {pv.Layout.Network} this. - */ -pv.Layout.Network.prototype.reset = function() { - this.$id = pv.id(); - return this; -}; - -/** @private Skip evaluating properties if cached. */ -pv.Layout.Network.prototype.buildProperties = function(s, properties) { - if ((s.$id || 0) < this.$id) { - pv.Layout.prototype.buildProperties.call(this, s, properties); - } -}; - -/** @private Compute link degrees; map source and target indexes to nodes. */ -pv.Layout.Network.prototype.buildImplied = function(s) { - pv.Layout.prototype.buildImplied.call(this, s); - if (s.$id >= this.$id) return true; - s.$id = this.$id; - s.links.forEach(function(d) { - var v = d.linkValue; - (d.sourceNode || (d.sourceNode = s.nodes[d.source])).linkDegree += v; - (d.targetNode || (d.targetNode = s.nodes[d.target])).linkDegree += v; - }); -}; -/** - * Constructs a new, empty hierarchy layout. Layouts are not typically - * constructed directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Represents an abstract layout for hierarchy diagrams. This class is a - * specialization of {@link pv.Layout.Network}, providing the basic structure - * for both hierarchical node-link diagrams (such as Reingold-Tilford trees) and - * space-filling hierarchy diagrams (such as sunbursts and treemaps). - * - *

Unlike general network layouts, the links property need not be - * defined explicitly. Instead, the links are computed implicitly from the - * parentNode attribute of the node objects, as defined by the - * nodes property. This implementation is also available as - * {@link #links}, for reuse with non-hierarchical layouts; for example, to - * render a tree using force-directed layout. - * - *

Correspondingly, the nodes property is represented as a union of - * {@link pv.Layout.Network.Node} and {@link pv.Dom.Node}. To construct a node - * hierarchy from a simple JSON map, use the {@link pv.Dom} operator; this - * operator also provides an easy way to sort nodes before passing them to the - * layout. - * - *

For more details on how to use this layout, see - * {@link pv.Layout.Network}. - * - * @see pv.Layout.Cluster - * @see pv.Layout.Partition - * @see pv.Layout.Tree - * @see pv.Layout.Treemap - * @see pv.Layout.Indent - * @see pv.Layout.Pack - * @extends pv.Layout.Network - */ -pv.Layout.Hierarchy = function() { - pv.Layout.Network.call(this); - this.link.strokeStyle("#ccc"); -}; - -pv.Layout.Hierarchy.prototype = pv.extend(pv.Layout.Network); - -/** @private Compute the implied links. (Links are null by default.) */ -pv.Layout.Hierarchy.prototype.buildImplied = function(s) { - if (!s.links) s.links = pv.Layout.Hierarchy.links.call(this); - pv.Layout.Network.prototype.buildImplied.call(this, s); -}; - -/** The implied links; computes links using the parentNode attribute. */ -pv.Layout.Hierarchy.links = function() { - return this.nodes() - .filter(function(n) { return n.parentNode; }) - .map(function(n) { - return { - sourceNode: n, - targetNode: n.parentNode, - linkValue: 1 - }; - }); -}; - -/** @private Provides standard node-link layout based on breadth & depth. */ -pv.Layout.Hierarchy.NodeLink = { - - /** @private */ - buildImplied: function(s) { - var nodes = s.nodes, - orient = s.orient, - horizontal = /^(top|bottom)$/.test(orient), - w = s.width, - h = s.height; - - /* Compute default inner and outer radius. */ - if (orient == "radial") { - var ir = s.innerRadius, or = s.outerRadius; - if (ir == null) ir = 0; - if (or == null) or = Math.min(w, h) / 2; - } - - /** @private Returns the radius of the given node. */ - function radius(n) { - return n.parentNode ? (n.depth * (or - ir) + ir) : 0; - } - - /** @private Returns the angle of the given node. */ - function midAngle(n) { - return (n.parentNode ? (n.breadth - .25) * 2 * Math.PI : 0); - } - - /** @private */ - function x(n) { - switch (orient) { - case "left": return n.depth * w; - case "right": return w - n.depth * w; - case "top": return n.breadth * w; - case "bottom": return w - n.breadth * w; - case "radial": return w / 2 + radius(n) * Math.cos(n.midAngle); - } - } - - /** @private */ - function y(n) { - switch (orient) { - case "left": return n.breadth * h; - case "right": return h - n.breadth * h; - case "top": return n.depth * h; - case "bottom": return h - n.depth * h; - case "radial": return h / 2 + radius(n) * Math.sin(n.midAngle); - } - } - - for (var i = 0; i < nodes.length; i++) { - var n = nodes[i]; - n.midAngle = orient == "radial" ? midAngle(n) - : horizontal ? Math.PI / 2 : 0; - n.x = x(n); - n.y = y(n); - if (n.firstChild) n.midAngle += Math.PI; - } - } -}; - -/** @private Provides standard space-filling layout based on breadth & depth. */ -pv.Layout.Hierarchy.Fill = { - - /** @private */ - constructor: function() { - this.node - .strokeStyle("#fff") - .fillStyle("#ccc") - .width(function(n) { return n.dx; }) - .height(function(n) { return n.dy; }) - .innerRadius(function(n) { return n.innerRadius; }) - .outerRadius(function(n) { return n.outerRadius; }) - .startAngle(function(n) { return n.startAngle; }) - .angle(function(n) { return n.angle; }); - - this.label - .textAlign("center") - .left(function(n) { return n.x + (n.dx / 2); }) - .top(function(n) { return n.y + (n.dy / 2); }); - - /* Hide unsupported link. */ - delete this.link; - }, - - /** @private */ - buildImplied: function(s) { - var nodes = s.nodes, - orient = s.orient, - horizontal = /^(top|bottom)$/.test(orient), - w = s.width, - h = s.height, - depth = -nodes[0].minDepth; - - /* Compute default inner and outer radius. */ - if (orient == "radial") { - var ir = s.innerRadius, or = s.outerRadius; - if (ir == null) ir = 0; - if (ir) depth *= 2; // use full depth step for root - if (or == null) or = Math.min(w, h) / 2; - } - - /** @private Scales the specified depth for a space-filling layout. */ - function scale(d, depth) { - return (d + depth) / (1 + depth); - } - - /** @private */ - function x(n) { - switch (orient) { - case "left": return scale(n.minDepth, depth) * w; - case "right": return (1 - scale(n.maxDepth, depth)) * w; - case "top": return n.minBreadth * w; - case "bottom": return (1 - n.maxBreadth) * w; - case "radial": return w / 2; - } - } - - /** @private */ - function y(n) { - switch (orient) { - case "left": return n.minBreadth * h; - case "right": return (1 - n.maxBreadth) * h; - case "top": return scale(n.minDepth, depth) * h; - case "bottom": return (1 - scale(n.maxDepth, depth)) * h; - case "radial": return h / 2; - } - } - - /** @private */ - function dx(n) { - switch (orient) { - case "left": - case "right": return (n.maxDepth - n.minDepth) / (1 + depth) * w; - case "top": - case "bottom": return (n.maxBreadth - n.minBreadth) * w; - case "radial": return n.parentNode ? (n.innerRadius + n.outerRadius) * Math.cos(n.midAngle) : 0; - } - } - - /** @private */ - function dy(n) { - switch (orient) { - case "left": - case "right": return (n.maxBreadth - n.minBreadth) * h; - case "top": - case "bottom": return (n.maxDepth - n.minDepth) / (1 + depth) * h; - case "radial": return n.parentNode ? (n.innerRadius + n.outerRadius) * Math.sin(n.midAngle) : 0; - } - } - - /** @private */ - function innerRadius(n) { - return Math.max(0, scale(n.minDepth, depth / 2)) * (or - ir) + ir; - } - - /** @private */ - function outerRadius(n) { - return scale(n.maxDepth, depth / 2) * (or - ir) + ir; - } - - /** @private */ - function startAngle(n) { - return (n.parentNode ? n.minBreadth - .25 : 0) * 2 * Math.PI; - } - - /** @private */ - function angle(n) { - return (n.parentNode ? n.maxBreadth - n.minBreadth : 1) * 2 * Math.PI; - } - - for (var i = 0; i < nodes.length; i++) { - var n = nodes[i]; - n.x = x(n); - n.y = y(n); - if (orient == "radial") { - n.innerRadius = innerRadius(n); - n.outerRadius = outerRadius(n); - n.startAngle = startAngle(n); - n.angle = angle(n); - n.midAngle = n.startAngle + n.angle / 2; - } else { - n.midAngle = horizontal ? -Math.PI / 2 : 0; - } - n.dx = dx(n); - n.dy = dy(n); - } - } -}; -/** - * Constructs a new, empty grid layout. Layouts are not typically constructed - * directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Implements a grid layout with regularly-sized rows and columns. The - * number of rows and columns are determined from their respective - * properties. For example, the 2×3 array: - * - *

1 2 3
- * 4 5 6
- * - * can be represented using the rows property as: - * - *
[[1, 2, 3], [4, 5, 6]]
- * - * If your data is in column-major order, you can equivalently use the - * columns property. If the rows property is an array, it - * takes priority over the columns property. The data is implicitly - * transposed, as if the {@link pv.transpose} operator were applied. - * - *

This layout exports a single cell mark prototype, which is - * intended to be used with a bar, panel, layout, or subclass thereof. The data - * property of the cell prototype is defined as the elements in the array. For - * example, if the array is a two-dimensional array of values in the range - * [0,1], a simple heatmap can be generated as: - * - *

vis.add(pv.Layout.Grid)
- *     .rows(arrays)
- *   .cell.add(pv.Bar)
- *     .fillStyle(pv.ramp("white", "black"))
- * - * The grid subdivides the full width and height of the parent panel into equal - * rectangles. Note, however, that for large, interactive, or animated heatmaps, - * you may see significantly better performance through dynamic {@link pv.Image} - * generation. - * - *

For irregular grids using value-based spatial partitioning, see {@link - * pv.Layout.Treemap}. - * - * @extends pv.Layout - */ -pv.Layout.Grid = function() { - pv.Layout.call(this); - var that = this; - - /** - * The cell prototype. This prototype is intended to be used with a bar, - * panel, or layout (or subclass thereof) to render the grid cells. - * - * @type pv.Mark - * @name pv.Layout.Grid.prototype.cell - */ - (this.cell = new pv.Mark() - .data(function() { - return that.scene[that.index].$grid; - }) - .width(function() { - return that.width() / that.cols(); - }) - .height(function() { - return that.height() / that.rows(); - }) - .left(function() { - return this.width() * (this.index % that.cols()); - }) - .top(function() { - return this.height() * Math.floor(this.index / that.cols()); - })).parent = this; -}; - -pv.Layout.Grid.prototype = pv.extend(pv.Layout) - .property("rows") - .property("cols"); - -/** - * Default properties for grid layouts. By default, there is one row and one - * column, and the data is the propagated to the child cell. - * - * @type pv.Layout.Grid - */ -pv.Layout.Grid.prototype.defaults = new pv.Layout.Grid() - .extend(pv.Layout.prototype.defaults) - .rows(1) - .cols(1); - -/** @private */ -pv.Layout.Grid.prototype.buildImplied = function(s) { - pv.Layout.prototype.buildImplied.call(this, s); - var r = s.rows, c = s.cols; - if (typeof c == "object") r = pv.transpose(c); - if (typeof r == "object") { - s.$grid = pv.blend(r); - s.rows = r.length; - s.cols = r[0] ? r[0].length : 0; - } else { - s.$grid = pv.repeat([s.data], r * c); - } -}; - -/** - * The number of rows. This property can also be specified as the data in - * row-major order; in this case, the rows property is implicitly set to the - * length of the array, and the cols property is set to the length of the first - * element in the array. - * - * @type number - * @name pv.Layout.Grid.prototype.rows - */ - -/** - * The number of columns. This property can also be specified as the data in - * column-major order; in this case, the cols property is implicitly set to the - * length of the array, and the rows property is set to the length of the first - * element in the array. - * - * @type number - * @name pv.Layout.Grid.prototype.cols - */ -/** - * Constructs a new, empty stack layout. Layouts are not typically constructed - * directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Implements a layout for stacked visualizations, ranging from simple - * stacked bar charts to more elaborate "streamgraphs" composed of stacked - * areas. Stack layouts uses length as a visual encoding, as opposed to - * position, as the layers do not share an aligned axis. - * - *

Marks can be stacked vertically or horizontally. For example, - * - *

vis.add(pv.Layout.Stack)
- *     .layers([[1, 1.2, 1.7, 1.5, 1.7],
- *              [.5, 1, .8, 1.1, 1.3],
- *              [.2, .5, .8, .9, 1]])
- *     .x(function() this.index * 35)
- *     .y(function(d) d * 40)
- *   .layer.add(pv.Area);
- * - * specifies a vertically-stacked area chart, using the default "bottom-left" - * orientation with "zero" offset. This visualization can be easily changed into - * a streamgraph using the "wiggle" offset, which attempts to minimize change in - * slope weighted by layer thickness. See the {@link #offset} property for more - * supported streamgraph algorithms. - * - *

In the simplest case, the layer data can be specified as a two-dimensional - * array of numbers. The x and y psuedo-properties are used to - * define the thickness of each layer at the given position, respectively; in - * the above example of the "bottom-left" orientation, the x and - * y psuedo-properties are equivalent to the left and - * height properties that you might use if you implemented a stacked - * area by hand. - * - *

The advantage of using the stack layout is that the baseline, i.e., the - * bottom property is computed automatically using the specified offset - * algorithm. In addition, the order of layers can be computed using a built-in - * algorithm via the order property. - * - *

With the exception of the "expand" offset, the stack layout does - * not perform any automatic scaling of data; the values returned from - * x and y specify pixel sizes. To simplify scaling math, use - * this layout in conjunction with {@link pv.Scale.linear} or similar. - * - *

In other cases, the values psuedo-property can be used to define - * the data more flexibly. As with a typical panel & area, the - * layers property corresponds to the data in the enclosing panel, - * while the values psuedo-property corresponds to the data for the - * area within the panel. For example, given an array of data values: - * - *

var crimea = [
- *  { date: "4/1854", wounds: 0, other: 110, disease: 110 },
- *  { date: "5/1854", wounds: 0, other: 95, disease: 105 },
- *  { date: "6/1854", wounds: 0, other: 40, disease: 95 },
- *  ...
- * - * and a corresponding array of series names: - * - *
var causes = ["wounds", "other", "disease"];
- * - * Separate layers can be defined for each cause like so: - * - *
vis.add(pv.Layout.Stack)
- *     .layers(causes)
- *     .values(crimea)
- *     .x(function(d) x(d.date))
- *     .y(function(d, p) y(d[p]))
- *   .layer.add(pv.Area)
- *     ...
- * - * As with the panel & area case, the datum that is passed to the - * psuedo-properties x and y are the values (an element in - * crimea); the second argument is the layer data (a string in - * causes). Additional arguments specify the data of enclosing panels, - * if any. - * - * @extends pv.Layout - */ -pv.Layout.Stack = function() { - pv.Layout.call(this); - var that = this, - /** @ignore */ none = function() { return null; }, - prop = {t: none, l: none, r: none, b: none, w: none, h: none}, - values, - buildImplied = that.buildImplied; - - /** @private Proxy the given property on the layer. */ - function proxy(name) { - return function() { - return prop[name](this.parent.index, this.index); - }; - } - - /** @private Compute the layout! */ - this.buildImplied = function(s) { - buildImplied.call(this, s); - - var data = s.layers, - n = data.length, - m, - orient = s.orient, - horizontal = /^(top|bottom)\b/.test(orient), - h = this.parent[horizontal ? "height" : "width"](), - x = [], - y = [], - dy = []; - - /* - * Iterate over the data, evaluating the values, x and y functions. The - * context in which the x and y psuedo-properties are evaluated is a - * pseudo-mark that is a grandchild of this layout. - */ - var stack = pv.Mark.stack, o = {parent: {parent: this}}; - stack.unshift(null); - values = []; - for (var i = 0; i < n; i++) { - dy[i] = []; - y[i] = []; - o.parent.index = i; - stack[0] = data[i]; - values[i] = this.$values.apply(o.parent, stack); - if (!i) m = values[i].length; - stack.unshift(null); - for (var j = 0; j < m; j++) { - stack[0] = values[i][j]; - o.index = j; - if (!i) x[j] = this.$x.apply(o, stack); - dy[i][j] = this.$y.apply(o, stack); - } - stack.shift(); - } - stack.shift(); - - /* order */ - var index; - switch (s.order) { - case "inside-out": { - var max = dy.map(function(v) { return pv.max.index(v); }), - map = pv.range(n).sort(function(a, b) { return max[a] - max[b]; }), - sums = dy.map(function(v) { return pv.sum(v); }), - top = 0, - bottom = 0, - tops = [], - bottoms = []; - for (var i = 0; i < n; i++) { - var j = map[i]; - if (top < bottom) { - top += sums[j]; - tops.push(j); - } else { - bottom += sums[j]; - bottoms.push(j); - } - } - index = bottoms.reverse().concat(tops); - break; - } - case "reverse": index = pv.range(n - 1, -1, -1); break; - default: index = pv.range(n); break; - } - - /* offset */ - switch (s.offset) { - case "silohouette": { - for (var j = 0; j < m; j++) { - var o = 0; - for (var i = 0; i < n; i++) o += dy[i][j]; - y[index[0]][j] = (h - o) / 2; - } - break; - } - case "wiggle": { - var o = 0; - for (var i = 0; i < n; i++) o += dy[i][0]; - y[index[0]][0] = o = (h - o) / 2; - for (var j = 1; j < m; j++) { - var s1 = 0, s2 = 0, dx = x[j] - x[j - 1]; - for (var i = 0; i < n; i++) s1 += dy[i][j]; - for (var i = 0; i < n; i++) { - var s3 = (dy[index[i]][j] - dy[index[i]][j - 1]) / (2 * dx); - for (var k = 0; k < i; k++) { - s3 += (dy[index[k]][j] - dy[index[k]][j - 1]) / dx; - } - s2 += s3 * dy[index[i]][j]; - } - y[index[0]][j] = o -= s1 ? s2 / s1 * dx : 0; - } - break; - } - case "expand": { - for (var j = 0; j < m; j++) { - y[index[0]][j] = 0; - var k = 0; - for (var i = 0; i < n; i++) k += dy[i][j]; - if (k) { - k = h / k; - for (var i = 0; i < n; i++) dy[i][j] *= k; - } else { - k = h / n; - for (var i = 0; i < n; i++) dy[i][j] = k; - } - } - break; - } - default: { - for (var j = 0; j < m; j++) y[index[0]][j] = 0; - break; - } - } - - /* Propagate the offset to the other series. */ - for (var j = 0; j < m; j++) { - var o = y[index[0]][j]; - for (var i = 1; i < n; i++) { - o += dy[index[i - 1]][j]; - y[index[i]][j] = o; - } - } - - /* Find the property definitions for dynamic substitution. */ - var i = orient.indexOf("-"), - pdy = horizontal ? "h" : "w", - px = i < 0 ? (horizontal ? "l" : "b") : orient.charAt(i + 1), - py = orient.charAt(0); - for (var p in prop) prop[p] = none; - prop[px] = function(i, j) { return x[j]; }; - prop[py] = function(i, j) { return y[i][j]; }; - prop[pdy] = function(i, j) { return dy[i][j]; }; - }; - - /** - * The layer prototype. This prototype is intended to be used with an area, - * bar or panel mark (or subclass thereof). Other mark types may be possible, - * though note that the stack layout is not currently designed to support - * radial stacked visualizations using wedges. - * - *

The layer is not a direct child of the stack layout; a hidden panel is - * used to replicate layers. - * - * @type pv.Mark - * @name pv.Layout.Stack.prototype.layer - */ - this.layer = new pv.Mark() - .data(function() { return values[this.parent.index]; }) - .top(proxy("t")) - .left(proxy("l")) - .right(proxy("r")) - .bottom(proxy("b")) - .width(proxy("w")) - .height(proxy("h")); - - this.layer.add = function(type) { - return that.add(pv.Panel) - .data(function() { return that.layers(); }) - .add(type) - .extend(this); - }; -}; - -pv.Layout.Stack.prototype = pv.extend(pv.Layout) - .property("orient", String) - .property("offset", String) - .property("order", String) - .property("layers"); - -/** - * Default properties for stack layouts. The default orientation is - * "bottom-left", the default offset is "zero", and the default layers is - * [[]]. - * - * @type pv.Layout.Stack - */ -pv.Layout.Stack.prototype.defaults = new pv.Layout.Stack() - .extend(pv.Layout.prototype.defaults) - .orient("bottom-left") - .offset("zero") - .layers([[]]); - -/** @private */ -pv.Layout.Stack.prototype.$x - = /** @private */ pv.Layout.Stack.prototype.$y - = function() { return 0; }; - -/** - * The x psuedo-property; determines the position of the value within the layer. - * This typically corresponds to the independent variable. For example, with the - * default "bottom-left" orientation, this function defines the "left" property. - * - * @param {function} f the x function. - * @returns {pv.Layout.Stack} this. - */ -pv.Layout.Stack.prototype.x = function(f) { - /** @private */ this.$x = pv.functor(f); - return this; -}; - -/** - * The y psuedo-property; determines the thickness of the layer at the given - * value. This typically corresponds to the dependent variable. For example, - * with the default "bottom-left" orientation, this function defines the - * "height" property. - * - * @param {function} f the y function. - * @returns {pv.Layout.Stack} this. - */ -pv.Layout.Stack.prototype.y = function(f) { - /** @private */ this.$y = pv.functor(f); - return this; -}; - -/** @private The default value function; identity. */ -pv.Layout.Stack.prototype.$values = pv.identity; - -/** - * The values function; determines the values for a given layer. The default - * value is the identity function, which assumes that the layers property is - * specified as a two-dimensional (i.e., nested) array. - * - * @param {function} f the values function. - * @returns {pv.Layout.Stack} this. - */ -pv.Layout.Stack.prototype.values = function(f) { - this.$values = pv.functor(f); - return this; -}; - -/** - * The layer data in row-major order. The value of this property is typically a - * two-dimensional (i.e., nested) array, but any array can be used, provided the - * values psuedo-property is defined accordingly. - * - * @type array[] - * @name pv.Layout.Stack.prototype.layers - */ - -/** - * The layer orientation. The following values are supported:

. The default value is "bottom-left", which means that the layers will - * be built from the bottom-up, and the values within layers will be laid out - * from left-to-right. - * - *

Note that with non-zero baselines, some orientations may give similar - * results. For example, offset("silohouette") centers the layers, resulting in - * a streamgraph. Thus, the orientations "bottom-left" and "top-left" will - * produce similar results, differing only in the layer order. - * - * @type string - * @name pv.Layout.Stack.prototype.orient - */ - -/** - * The layer order. The following values are supported:

For details on the inside-out order algorithm, refer to "Stacked Graphs - * -- Geometry & Aesthetics" by L. Byron and M. Wattenberg, IEEE TVCG - * November/December 2008. - * - * @type string - * @name pv.Layout.Stack.prototype.order - */ - -/** - * The layer offset; the y-position of the bottom of the lowest layer. The - * following values are supported:For details on these offset algorithms, refer to "Stacked Graphs -- - * Geometry & Aesthetics" by L. Byron and M. Wattenberg, IEEE TVCG - * November/December 2008. - * - * @type string - * @name pv.Layout.Stack.prototype.offset - */ -/** - * Constructs a new, empty treemap layout. Layouts are not typically - * constructed directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Implements a space-filling rectangular layout, with the hierarchy - * represented via containment. Treemaps represent nodes as boxes, with child - * nodes placed within parent boxes. The size of each box is proportional to the - * size of the node in the tree. This particular algorithm is taken from Bruls, - * D.M., C. Huizing, and J.J. van Wijk, "Squarified Treemaps" in - * Data Visualization 2000, Proceedings of the Joint Eurographics and IEEE - * TCVG Sumposium on Visualization, 2000, pp. 33-42. - * - *

The meaning of the exported mark prototypes changes slightly in the - * space-filling implementation:

For more details on how to use this layout, see - * {@link pv.Layout.Hierarchy}. - * - * @extends pv.Layout.Hierarchy - */ -pv.Layout.Treemap = function() { - pv.Layout.Hierarchy.call(this); - - this.node - .strokeStyle("#fff") - .fillStyle("rgba(31, 119, 180, .25)") - .width(function(n) { return n.dx; }) - .height(function(n) { return n.dy; }); - - this.label - .visible(function(n) { return !n.firstChild; }) - .left(function(n) { return n.x + (n.dx / 2); }) - .top(function(n) { return n.y + (n.dy / 2); }) - .textAlign("center") - .textAngle(function(n) { return n.dx > n.dy ? 0 : -Math.PI / 2; }); - - (this.leaf = new pv.Mark() - .extend(this.node) - .fillStyle(null) - .strokeStyle(null) - .visible(function(n) { return !n.firstChild; })).parent = this; - - /* Hide unsupported link. */ - delete this.link; -}; - -pv.Layout.Treemap.prototype = pv.extend(pv.Layout.Hierarchy) - .property("round", Boolean) - .property("paddingLeft", Number) - .property("paddingRight", Number) - .property("paddingTop", Number) - .property("paddingBottom", Number) - .property("mode", String) - .property("order", String); - -/** - * Default propertiess for treemap layouts. The default mode is "squarify" and - * the default order is "ascending". - * - * @type pv.Layout.Treemap - */ -pv.Layout.Treemap.prototype.defaults = new pv.Layout.Treemap() - .extend(pv.Layout.Hierarchy.prototype.defaults) - .mode("squarify") // squarify, slice-and-dice, slice, dice - .order("ascending"); // ascending, descending, reverse, null - -/** - * Whether node sizes should be rounded to integer values. This has a similar - * effect to setting antialias(false) for node values, but allows the - * treemap algorithm to accumulate error related to pixel rounding. - * - * @type boolean - * @name pv.Layout.Treemap.prototype.round - */ - -/** - * The left inset between parent add child in pixels. Defaults to 0. - * - * @type number - * @name pv.Layout.Treemap.prototype.paddingLeft - * @see #padding - */ - -/** - * The right inset between parent add child in pixels. Defaults to 0. - * - * @type number - * @name pv.Layout.Treemap.prototype.paddingRight - * @see #padding - */ - -/** - * The top inset between parent and child in pixels. Defaults to 0. - * - * @type number - * @name pv.Layout.Treemap.prototype.paddingTop - * @see #padding - */ - -/** - * The bottom inset between parent and child in pixels. Defaults to 0. - * - * @type number - * @name pv.Layout.Treemap.prototype.paddingBottom - * @see #padding - */ - -/** - * The treemap algorithm. The default value is "squarify". The "slice-and-dice" - * algorithm may also be used, which alternates between horizontal and vertical - * slices for different depths. In addition, the "slice" and "dice" algorithms - * may be specified explicitly to control whether horizontal or vertical slices - * are used, which may be useful for nested treemap layouts. - * - * @type string - * @name pv.Layout.Treemap.prototype.mode - * @see "Ordered Treemap Layouts" by B. Shneiderman & M. Wattenberg, IEEE - * InfoVis 2001. - */ - -/** - * The sibling node order. A null value means to use the sibling order - * specified by the nodes property as-is; "reverse" will reverse the given - * order. The default value "ascending" will sort siblings in ascending order of - * size, while "descending" will do the reverse. For sorting based on data - * attributes other than size, use the default null for the order - * property, and sort the nodes beforehand using the {@link pv.Dom} operator. - * - * @type string - * @name pv.Layout.Treemap.prototype.order - */ - -/** - * Alias for setting the left, right, top and bottom padding properties - * simultaneously. - * - * @see #paddingLeft - * @see #paddingRight - * @see #paddingTop - * @see #paddingBottom - * @returns {pv.Layout.Treemap} this. - */ -pv.Layout.Treemap.prototype.padding = function(n) { - return this.paddingLeft(n).paddingRight(n).paddingTop(n).paddingBottom(n); -}; - -/** @private The default size function. */ -pv.Layout.Treemap.prototype.$size = function(d) { - return Number(d.nodeValue); -}; - -/** - * Specifies the sizing function. By default, the size function uses the - * nodeValue attribute of nodes as a numeric value: function(d) - * Number(d.nodeValue). - * - *

The sizing function is invoked for each leaf node in the tree, per the - * nodes property. For example, if the tree data structure represents a - * file system, with files as leaf nodes, and each file has a bytes - * attribute, you can specify a size function as: - * - *

    .size(function(d) d.bytes)
- * - * @param {function} f the new sizing function. - * @returns {pv.Layout.Treemap} this. - */ -pv.Layout.Treemap.prototype.size = function(f) { - this.$size = pv.functor(f); - return this; -}; - -/** @private */ -pv.Layout.Treemap.prototype.buildImplied = function(s) { - if (pv.Layout.Hierarchy.prototype.buildImplied.call(this, s)) return; - - var that = this, - nodes = s.nodes, - root = nodes[0], - stack = pv.Mark.stack, - left = s.paddingLeft, - right = s.paddingRight, - top = s.paddingTop, - bottom = s.paddingBottom, - /** @ignore */ size = function(n) { return n.size; }, - round = s.round ? Math.round : Number, - mode = s.mode; - - /** @private */ - function slice(row, sum, horizontal, x, y, w, h) { - for (var i = 0, d = 0; i < row.length; i++) { - var n = row[i]; - if (horizontal) { - n.x = x + d; - n.y = y; - d += n.dx = round(w * n.size / sum); - n.dy = h; - } else { - n.x = x; - n.y = y + d; - n.dx = w; - d += n.dy = round(h * n.size / sum); - } - } - if (n) { // correct on-axis rounding error - if (horizontal) { - n.dx += w - d; - } else { - n.dy += h - d; - } - } - } - - /** @private */ - function ratio(row, l) { - var rmax = -Infinity, rmin = Infinity, s = 0; - for (var i = 0; i < row.length; i++) { - var r = row[i].size; - if (r < rmin) rmin = r; - if (r > rmax) rmax = r; - s += r; - } - s = s * s; - l = l * l; - return Math.max(l * rmax / s, s / (l * rmin)); - } - - /** @private */ - function layout(n, i) { - var x = n.x + left, - y = n.y + top, - w = n.dx - left - right, - h = n.dy - top - bottom; - - /* Assume squarify by default. */ - if (mode != "squarify") { - slice(n.childNodes, n.size, - mode == "slice" ? true - : mode == "dice" ? false - : i & 1, x, y, w, h); - return; - } - - var row = [], - mink = Infinity, - l = Math.min(w, h), - k = w * h / n.size; - - /* Abort if the size is nonpositive. */ - if (n.size <= 0) return; - - /* Scale the sizes to fill the current subregion. */ - n.visitBefore(function(n) { n.size *= k; }); - - /** @private Position the specified nodes along one dimension. */ - function position(row) { - var horizontal = w == l, - sum = pv.sum(row, size), - r = l ? round(sum / l) : 0; - slice(row, sum, horizontal, x, y, horizontal ? w : r, horizontal ? r : h); - if (horizontal) { - y += r; - h -= r; - } else { - x += r; - w -= r; - } - l = Math.min(w, h); - return horizontal; - } - - var children = n.childNodes.slice(); // copy - while (children.length) { - var child = children[children.length - 1]; - if (!child.size) { - children.pop(); - continue; - } - row.push(child); - - var k = ratio(row, l); - if (k <= mink) { - children.pop(); - mink = k; - } else { - row.pop(); - position(row); - row.length = 0; - mink = Infinity; - } - } - - /* correct off-axis rounding error */ - if (position(row)) for (var i = 0; i < row.length; i++) { - row[i].dy += h; - } else for (var i = 0; i < row.length; i++) { - row[i].dx += w; - } - } - - /* Recursively compute the node depth and size. */ - stack.unshift(null); - root.visitAfter(function(n, i) { - n.depth = i; - n.x = n.y = n.dx = n.dy = 0; - n.size = n.firstChild - ? pv.sum(n.childNodes, function(n) { return n.size; }) - : that.$size.apply(that, (stack[0] = n, stack)); - }); - stack.shift(); - - /* Sort. */ - switch (s.order) { - case "ascending": { - root.sort(function(a, b) { return a.size - b.size; }); - break; - } - case "descending": { - root.sort(function(a, b) { return b.size - a.size; }); - break; - } - case "reverse": root.reverse(); break; - } - - /* Recursively compute the layout. */ - root.x = 0; - root.y = 0; - root.dx = s.width; - root.dy = s.height; - root.visitBefore(layout); -}; -/** - * Constructs a new, empty tree layout. Layouts are not typically constructed - * directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Implements a node-link tree diagram using the Reingold-Tilford "tidy" - * tree layout algorithm. The specific algorithm used by this layout is based on - * "Improving - * Walker's Algorithm to Run in Linear Time" by C. Buchheim, M. Jünger - * & S. Leipert, Graph Drawing 2002. This layout supports both cartesian and - * radial orientations orientations for node-link diagrams. - * - *

The tree layout supports a "group" property, which if true causes siblings - * to be positioned closer together than unrelated nodes at the same depth. The - * layout can be configured using the depth and breadth - * properties, which control the increments in pixel space between nodes in both - * dimensions, similar to the indent layout. - * - *

For more details on how to use this layout, see - * {@link pv.Layout.Hierarchy}. - * - * @extends pv.Layout.Hierarchy - */ -pv.Layout.Tree = function() { - pv.Layout.Hierarchy.call(this); -}; - -pv.Layout.Tree.prototype = pv.extend(pv.Layout.Hierarchy) - .property("group", Number) - .property("breadth", Number) - .property("depth", Number) - .property("orient", String); - -/** - * Default properties for tree layouts. The default orientation is "top", the - * default group parameter is 1, and the default breadth and depth offsets are - * 15 and 60 respectively. - * - * @type pv.Layout.Tree - */ -pv.Layout.Tree.prototype.defaults = new pv.Layout.Tree() - .extend(pv.Layout.Hierarchy.prototype.defaults) - .group(1) - .breadth(15) - .depth(60) - .orient("top"); - -/** @private */ -pv.Layout.Tree.prototype.buildImplied = function(s) { - if (pv.Layout.Hierarchy.prototype.buildImplied.call(this, s)) return; - - var nodes = s.nodes, - orient = s.orient, - depth = s.depth, - breadth = s.breadth, - group = s.group, - w = s.width, - h = s.height; - - /** @private */ - function firstWalk(v) { - var l, r, a; - if (!v.firstChild) { - if (l = v.previousSibling) { - v.prelim = l.prelim + distance(v.depth, true); - } - } else { - l = v.firstChild; - r = v.lastChild; - a = l; // default ancestor - for (var c = l; c; c = c.nextSibling) { - firstWalk(c); - a = apportion(c, a); - } - executeShifts(v); - var midpoint = .5 * (l.prelim + r.prelim); - if (l = v.previousSibling) { - v.prelim = l.prelim + distance(v.depth, true); - v.mod = v.prelim - midpoint; - } else { - v.prelim = midpoint; - } - } - } - - /** @private */ - function secondWalk(v, m, depth) { - v.breadth = v.prelim + m; - m += v.mod; - for (var c = v.firstChild; c; c = c.nextSibling) { - secondWalk(c, m, depth); - } - } - - /** @private */ - function apportion(v, a) { - var w = v.previousSibling; - if (w) { - var vip = v, - vop = v, - vim = w, - vom = v.parentNode.firstChild, - sip = vip.mod, - sop = vop.mod, - sim = vim.mod, - som = vom.mod, - nr = nextRight(vim), - nl = nextLeft(vip); - while (nr && nl) { - vim = nr; - vip = nl; - vom = nextLeft(vom); - vop = nextRight(vop); - vop.ancestor = v; - var shift = (vim.prelim + sim) - (vip.prelim + sip) + distance(vim.depth, false); - if (shift > 0) { - moveSubtree(ancestor(vim, v, a), v, shift); - sip += shift; - sop += shift; - } - sim += vim.mod; - sip += vip.mod; - som += vom.mod; - sop += vop.mod; - nr = nextRight(vim); - nl = nextLeft(vip); - } - if (nr && !nextRight(vop)) { - vop.thread = nr; - vop.mod += sim - sop; - } - if (nl && !nextLeft(vom)) { - vom.thread = nl; - vom.mod += sip - som; - a = v; - } - } - return a; - } - - /** @private */ - function nextLeft(v) { - return v.firstChild || v.thread; - } - - /** @private */ - function nextRight(v) { - return v.lastChild || v.thread; - } - - /** @private */ - function moveSubtree(wm, wp, shift) { - var subtrees = wp.number - wm.number; - wp.change -= shift / subtrees; - wp.shift += shift; - wm.change += shift / subtrees; - wp.prelim += shift; - wp.mod += shift; - } - - /** @private */ - function executeShifts(v) { - var shift = 0, change = 0; - for (var c = v.lastChild; c; c = c.previousSibling) { - c.prelim += shift; - c.mod += shift; - change += c.change; - shift += c.shift + change; - } - } - - /** @private */ - function ancestor(vim, v, a) { - return (vim.ancestor.parentNode == v.parentNode) ? vim.ancestor : a; - } - - /** @private */ - function distance(depth, siblings) { - return (siblings ? 1 : (group + 1)) / ((orient == "radial") ? depth : 1); - } - - /* Initialize temporary layout variables. TODO: store separately. */ - var root = nodes[0]; - root.visitAfter(function(v, i) { - v.ancestor = v; - v.prelim = 0; - v.mod = 0; - v.change = 0; - v.shift = 0; - v.number = v.previousSibling ? (v.previousSibling.number + 1) : 0; - v.depth = i; - }); - - /* Compute the layout using Buchheim et al.'s algorithm. */ - firstWalk(root); - secondWalk(root, -root.prelim, 0); - - /** @private Returns the angle of the given node. */ - function midAngle(n) { - return (orient == "radial") ? n.breadth / depth : 0; - } - - /** @private */ - function x(n) { - switch (orient) { - case "left": return n.depth; - case "right": return w - n.depth; - case "top": - case "bottom": return n.breadth + w / 2; - case "radial": return w / 2 + n.depth * Math.cos(midAngle(n)); - } - } - - /** @private */ - function y(n) { - switch (orient) { - case "left": - case "right": return n.breadth + h / 2; - case "top": return n.depth; - case "bottom": return h - n.depth; - case "radial": return h / 2 + n.depth * Math.sin(midAngle(n)); - } - } - - /* Clear temporary layout variables; transform depth and breadth. */ - root.visitAfter(function(v) { - v.breadth *= breadth; - v.depth *= depth; - v.midAngle = midAngle(v); - v.x = x(v); - v.y = y(v); - if (v.firstChild) v.midAngle += Math.PI; - delete v.breadth; - delete v.depth; - delete v.ancestor; - delete v.prelim; - delete v.mod; - delete v.change; - delete v.shift; - delete v.number; - delete v.thread; - }); -}; - -/** - * The offset between siblings nodes; defaults to 15. - * - * @type number - * @name pv.Layout.Tree.prototype.breadth - */ - -/** - * The offset between parent and child nodes; defaults to 60. - * - * @type number - * @name pv.Layout.Tree.prototype.depth - */ - -/** - * The orientation. The default orientation is "top", which means that the root - * node is placed on the top edge, leaf nodes appear at the bottom, and internal - * nodes are in-between. The following orientations are supported:

- * - * @type string - * @name pv.Layout.Tree.prototype.orient - */ - -/** - * The sibling grouping, i.e., whether differentiating space is placed between - * sibling groups. The default is 1 (or true), causing sibling leaves to be - * separated by one breadth offset. Setting this to false (or 0) causes - * non-siblings to be adjacent. - * - * @type number - * @name pv.Layout.Tree.prototype.group - */ -/** - * Constructs a new, empty indent layout. Layouts are not typically constructed - * directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Implements a hierarchical layout using the indent algorithm. This - * layout implements a node-link diagram where the nodes are presented in - * preorder traversal, and nodes are indented based on their depth from the - * root. This technique is used ubiquitously by operating systems to represent - * file directories; although it requires much vertical space, indented trees - * allow efficient interactive exploration of trees to find a specific - * node. In addition they allow rapid scanning of node labels, and multivariate - * data such as file sizes can be displayed adjacent to the hierarchy. - * - *

The indent layout can be configured using the depth and - * breadth properties, which control the increments in pixel space for - * each indent and row in the layout. This layout does not support multiple - * orientations; the root node is rendered in the top-left, while - * breadth is a vertical offset from the top, and depth is a - * horizontal offset from the left. - * - *

For more details on how to use this layout, see - * {@link pv.Layout.Hierarchy}. - * - * @extends pv.Layout.Hierarchy - */ -pv.Layout.Indent = function() { - pv.Layout.Hierarchy.call(this); - this.link.interpolate("step-after"); -}; - -pv.Layout.Indent.prototype = pv.extend(pv.Layout.Hierarchy) - .property("depth", Number) - .property("breadth", Number); - -/** - * The horizontal offset between different levels of the tree; defaults to 15. - * - * @type number - * @name pv.Layout.Indent.prototype.depth - */ - -/** - * The vertical offset between nodes; defaults to 15. - * - * @type number - * @name pv.Layout.Indent.prototype.breadth - */ - -/** - * Default properties for indent layouts. By default the depth and breadth - * offsets are 15 pixels. - * - * @type pv.Layout.Indent - */ -pv.Layout.Indent.prototype.defaults = new pv.Layout.Indent() - .extend(pv.Layout.Hierarchy.prototype.defaults) - .depth(15) - .breadth(15); - -/** @private */ -pv.Layout.Indent.prototype.buildImplied = function(s) { - if (pv.Layout.Hierarchy.prototype.buildImplied.call(this, s)) return; - - var nodes = s.nodes, - bspace = s.breadth, - dspace = s.depth, - ax = 0, - ay = 0; - - /** @private */ - function position(n, breadth, depth) { - n.x = ax + depth++ * dspace; - n.y = ay + breadth++ * bspace; - n.midAngle = 0; - for (var c = n.firstChild; c; c = c.nextSibling) { - breadth = position(c, breadth, depth); - } - return breadth; - } - - position(nodes[0], 1, 1); -}; -/** - * Constructs a new, empty circle-packing layout. Layouts are not typically - * constructed directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Implements a hierarchical layout using circle-packing. The meaning of - * the exported mark prototypes changes slightly in the space-filling - * implementation:

The pack layout support dynamic sizing for leaf nodes, if a - * {@link #size} psuedo-property is specified. The default size function returns - * 1, causing all leaf nodes to be sized equally, and all internal nodes to be - * sized by the number of leaf nodes they have as descendants. - * - *

The size function can be used in conjunction with the order property, - * which allows the nodes to the sorted by the computed size. Note: for sorting - * based on other data attributes, simply use the default null for the - * order property, and sort the nodes beforehand using the {@link pv.Dom} - * operator. - * - *

For more details on how to use this layout, see - * {@link pv.Layout.Hierarchy}. - * - * @extends pv.Layout.Hierarchy - * @see "Visualization of large hierarchical data by circle packing" by W. Wang, - * H. Wang, G. Dai, and H. Wang, ACM CHI 2006. - */ -pv.Layout.Pack = function() { - pv.Layout.Hierarchy.call(this); - - this.node - .radius(function(n) { return n.radius; }) - .strokeStyle("rgb(31, 119, 180)") - .fillStyle("rgba(31, 119, 180, .25)"); - - this.label - .textAlign("center"); - - /* Hide unsupported link. */ - delete this.link; -}; - -pv.Layout.Pack.prototype = pv.extend(pv.Layout.Hierarchy) - .property("spacing", Number) - .property("order", String); // ascending, descending, reverse, null - -/** - * Default properties for circle-packing layouts. The default spacing parameter - * is 1 and the default order is "ascending". - * - * @type pv.Layout.Pack - */ -pv.Layout.Pack.prototype.defaults = new pv.Layout.Pack() - .extend(pv.Layout.Hierarchy.prototype.defaults) - .spacing(1) - .order("ascending"); - -/** - * The spacing parameter; defaults to 1, which provides a little bit of padding - * between sibling nodes and the enclosing circle. Larger values increase the - * spacing, by making the sibling nodes smaller; a value of zero makes the leaf - * nodes as large as possible, with no padding on enclosing circles. - * - * @type number - * @name pv.Layout.Pack.prototype.spacing - */ - -/** - * The sibling node order. The default order is null, which means to - * use the sibling order specified by the nodes property as-is. A value of - * "ascending" will sort siblings in ascending order of size, while "descending" - * will do the reverse. For sorting based on data attributes other than size, - * use the default null for the order property, and sort the nodes - * beforehand using the {@link pv.Dom} operator. - * - * @see pv.Dom.Node#sort - * @type string - * @name pv.Layout.Pack.prototype.order - */ - -/** @private The default size function. */ -pv.Layout.Pack.prototype.$radius = function() { return 1; }; - -// TODO is it possible for spacing to operate in pixel space? -// Right now it appears to be multiples of the smallest radius. - -/** - * Specifies the sizing function. By default, a sizing function is disabled and - * all nodes are given constant size. The sizing function is invoked for each - * leaf node in the tree (passed to the constructor). - * - *

For example, if the tree data structure represents a file system, with - * files as leaf nodes, and each file has a bytes attribute, you can - * specify a size function as: - * - *

    .size(function(d) d.bytes)
- * - * As with other properties, a size function may specify additional arguments to - * access the data associated with the layout and any enclosing panels. - * - * @param {function} f the new sizing function. - * @returns {pv.Layout.Pack} this. - */ -pv.Layout.Pack.prototype.size = function(f) { - this.$radius = typeof f == "function" - ? function() { return Math.sqrt(f.apply(this, arguments)); } - : (f = Math.sqrt(f), function() { return f; }); - return this; -}; - -/** @private */ -pv.Layout.Pack.prototype.buildImplied = function(s) { - if (pv.Layout.Hierarchy.prototype.buildImplied.call(this, s)) return; - - var that = this, - nodes = s.nodes, - root = nodes[0]; - - /** @private Compute the radii of the leaf nodes. */ - function radii(nodes) { - var stack = pv.Mark.stack; - stack.unshift(null); - for (var i = 0, n = nodes.length; i < n; i++) { - var c = nodes[i]; - if (!c.firstChild) { - c.radius = that.$radius.apply(that, (stack[0] = c, stack)); - } - } - stack.shift(); - } - - /** @private */ - function packTree(n) { - var nodes = []; - for (var c = n.firstChild; c; c = c.nextSibling) { - if (c.firstChild) c.radius = packTree(c); - c.n = c.p = c; - nodes.push(c); - } - - /* Sort. */ - switch (s.order) { - case "ascending": { - nodes.sort(function(a, b) { return a.radius - b.radius; }); - break; - } - case "descending": { - nodes.sort(function(a, b) { return b.radius - a.radius; }); - break; - } - case "reverse": nodes.reverse(); break; - } - - return packCircle(nodes); - } - - /** @private */ - function packCircle(nodes) { - var xMin = Infinity, - xMax = -Infinity, - yMin = Infinity, - yMax = -Infinity, - a, b, c, j, k; - - /** @private */ - function bound(n) { - xMin = Math.min(n.x - n.radius, xMin); - xMax = Math.max(n.x + n.radius, xMax); - yMin = Math.min(n.y - n.radius, yMin); - yMax = Math.max(n.y + n.radius, yMax); - } - - /** @private */ - function insert(a, b) { - var c = a.n; - a.n = b; - b.p = a; - b.n = c; - c.p = b; - } - - /** @private */ - function splice(a, b) { - a.n = b; - b.p = a; - } - - /** @private */ - function intersects(a, b) { - var dx = b.x - a.x, - dy = b.y - a.y, - dr = a.radius + b.radius; - return (dr * dr - dx * dx - dy * dy) > .001; // within epsilon - } - - /* Create first node. */ - a = nodes[0]; - a.x = -a.radius; - a.y = 0; - bound(a); - - /* Create second node. */ - if (nodes.length > 1) { - b = nodes[1]; - b.x = b.radius; - b.y = 0; - bound(b); - - /* Create third node and build chain. */ - if (nodes.length > 2) { - c = nodes[2]; - place(a, b, c); - bound(c); - insert(a, c); - a.p = c; - insert(c, b); - b = a.n; - - /* Now iterate through the rest. */ - for (var i = 3; i < nodes.length; i++) { - place(a, b, c = nodes[i]); - - /* Search for the closest intersection. */ - var isect = 0, s1 = 1, s2 = 1; - for (j = b.n; j != b; j = j.n, s1++) { - if (intersects(j, c)) { - isect = 1; - break; - } - } - if (isect == 1) { - for (k = a.p; k != j.p; k = k.p, s2++) { - if (intersects(k, c)) { - if (s2 < s1) { - isect = -1; - j = k; - } - break; - } - } - } - - /* Update node chain. */ - if (isect == 0) { - insert(a, c); - b = c; - bound(c); - } else if (isect > 0) { - splice(a, j); - b = j; - i--; - } else if (isect < 0) { - splice(j, b); - a = j; - i--; - } - } - } - } - - /* Re-center the circles and return the encompassing radius. */ - var cx = (xMin + xMax) / 2, - cy = (yMin + yMax) / 2, - cr = 0; - for (var i = 0; i < nodes.length; i++) { - var n = nodes[i]; - n.x -= cx; - n.y -= cy; - cr = Math.max(cr, n.radius + Math.sqrt(n.x * n.x + n.y * n.y)); - } - return cr + s.spacing; - } - - /** @private */ - function place(a, b, c) { - var da = b.radius + c.radius, - db = a.radius + c.radius, - dx = b.x - a.x, - dy = b.y - a.y, - dc = Math.sqrt(dx * dx + dy * dy), - cos = (db * db + dc * dc - da * da) / (2 * db * dc), - theta = Math.acos(cos), - x = cos * db, - h = Math.sin(theta) * db; - dx /= dc; - dy /= dc; - c.x = a.x + x * dx + h * dy; - c.y = a.y + x * dy - h * dx; - } - - /** @private */ - function transform(n, x, y, k) { - for (var c = n.firstChild; c; c = c.nextSibling) { - c.x += n.x; - c.y += n.y; - transform(c, x, y, k); - } - n.x = x + k * n.x; - n.y = y + k * n.y; - n.radius *= k; - } - - radii(nodes); - - /* Recursively compute the layout. */ - root.x = 0; - root.y = 0; - root.radius = packTree(root); - - var w = this.width(), - h = this.height(), - k = 1 / Math.max(2 * root.radius / w, 2 * root.radius / h); - transform(root, w / 2, h / 2, k); -}; -/** - * Constructs a new, empty force-directed layout. Layouts are not typically - * constructed directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Implements force-directed network layout as a node-link diagram. This - * layout uses the Fruchterman-Reingold algorithm, which applies an attractive - * spring force between neighboring nodes, and a repulsive electrical charge - * force between all nodes. An additional drag force improves stability of the - * simulation. See {@link pv.Force.spring}, {@link pv.Force.drag} and {@link - * pv.Force.charge} for more details; note that the n-body charge force is - * approximated using the Barnes-Hut algorithm. - * - *

This layout is implemented on top of {@link pv.Simulation}, which can be - * used directly for more control over simulation parameters. The simulation - * uses Position Verlet integration, which does not compute velocities - * explicitly, but allows for easy geometric constraints, such as bounding the - * nodes within the layout panel. Many of the configuration properties supported - * by this layout are simply passed through to the underlying forces and - * constraints of the simulation. - * - *

Force layouts are typically interactive. The gradual movement of the nodes - * as they stabilize to a local stress minimum can help reveal the structure of - * the network, as can {@link pv.Behavior.drag}, which allows the user to pick - * up nodes and reposition them while the physics simulation continues. This - * layout can also be used with pan & zoom behaviors for interaction. - * - *

To facilitate interaction, this layout by default automatically re-renders - * using a setInterval every 42 milliseconds. This can be disabled via - * the iterations property, which if non-null specifies the number of - * simulation iterations to run before the force-directed layout is finalized. - * Be careful not to use too high an iteration count, as this can lead to an - * annoying delay on page load. - * - *

As with other network layouts, the network data can be updated - * dynamically, provided the property cache is reset. See - * {@link pv.Layout.Network} for details. New nodes are initialized with random - * positions near the center. Alternatively, positions can be specified manually - * by setting the x and y attributes on nodes. - * - * @extends pv.Layout.Network - * @see "Graph Drawing by Force-directed Placement" by T. Fruchterman & - * E. Reingold, Software--Practice & Experience, November 1991. - */ -pv.Layout.Force = function() { - pv.Layout.Network.call(this); - - /* Force-directed graphs can be messy, so reduce the link width. */ - this.link.lineWidth(function(d, p) { return Math.sqrt(p.linkValue) * 1.5; }); - this.label.textAlign("center"); -}; - -pv.Layout.Force.prototype = pv.extend(pv.Layout.Network) - .property("bound", Boolean) - .property("iterations", Number) - .property("dragConstant", Number) - .property("chargeConstant", Number) - .property("chargeMinDistance", Number) - .property("chargeMaxDistance", Number) - .property("chargeTheta", Number) - .property("springConstant", Number) - .property("springDamping", Number) - .property("springLength", Number); - -/** - * The bound parameter; true if nodes should be constrained within the layout - * panel. Bounding is disabled by default. Currently the layout does not observe - * the radius of the nodes; strictly speaking, only the center of the node is - * constrained to be within the panel, with an additional 6-pixel offset for - * padding. A future enhancement could extend the bound constraint to observe - * the node's radius, which would also support bounding for variable-size nodes. - * - *

Note that if this layout is used in conjunction with pan & zoom - * behaviors, those behaviors should have their bound parameter set to the same - * value. - * - * @type boolean - * @name pv.Layout.Force.prototype.bound - */ - -/** - * The number of simulation iterations to run, or null if this layout is - * interactive. Force-directed layouts are interactive by default, using a - * setInterval to advance the physics simulation and re-render - * automatically. - * - * @type number - * @name pv.Layout.Force.prototype.iterations - */ - -/** - * The drag constant, in the range [0,1]. A value of 0 means no drag (a - * perfectly frictionless environment), while a value of 1 means friction - * immediately cancels all momentum. The default value is 0.1, which provides a - * minimum amount of drag that helps stabilize bouncy springs; lower values may - * result in excessive bounciness, while higher values cause the simulation to - * take longer to converge. - * - * @type number - * @name pv.Layout.Force.prototype.dragConstant - * @see pv.Force.drag#constant - */ - -/** - * The charge constant, which should be a negative number. The default value is - * -40; more negative values will result in a stronger repulsive force, which - * may lead to faster convergence at the risk of instability. Too strong - * repulsive charge forces can cause comparatively weak springs to be stretched - * well beyond their rest length, emphasizing global structure over local - * structure. A nonnegative value will break the Fruchterman-Reingold algorithm, - * and is for entertainment purposes only. - * - * @type number - * @name pv.Layout.Force.prototype.chargeConstant - * @see pv.Force.charge#constant - */ - -/** - * The minimum distance at which charge forces are applied. The default minimum - * distance of 2 avoids applying forces that are two strong; because the physics - * simulation is run at discrete time intervals, it is possible for two same- - * charged particles to become very close or even a singularity! Since the - * charge force is inversely proportional to the square of the distance, very - * small distances can break the simulation. - * - *

In rare cases, two particles can become stuck on top of each other, as a - * minimum distance threshold will prevent the charge force from repelling them. - * However, this occurs very rarely because other forces and momentum typically - * cause the particles to become separated again, at which point the repulsive - * charge force kicks in. - * - * @type number - * @name pv.Layout.Force.prototype.chargeMinDistance - * @see pv.Force.charge#domain - */ - -/** - * The maximum distance at which charge forces are applied. This improves - * performance by ignoring weak charge forces at great distances. Note that this - * parameter is partly redundant, as the Barnes-Hut algorithm for n-body forces - * already improves performance for far-away particles through approximation. - * - * @type number - * @name pv.Layout.Force.prototype.chargeMaxDistance - * @see pv.Force.charge#domain - */ - -/** - * The Barnes-Hut approximation factor. The Barnes-Hut approximation criterion - * is the ratio of the size of the quadtree node to the distance from the point - * to the node's center of mass is beneath some threshold. The default value is - * 0.9. - * - * @type number - * @name pv.Layout.Force.prototype.chargeTheta - * @see pv.Force.charge#theta - */ - -/** - * The spring constant, which should be a positive number. The default value is - * 0.1; greater values will result in a stronger attractive force, which may - * lead to faster convergence at the risk of instability. Too strong spring - * forces can cause comparatively weak charge forces to be ignored, emphasizing - * local structure over global structure. A nonpositive value will break the - * Fruchterman-Reingold algorithm, and is for entertainment purposes only. - * - *

The spring tension is automatically normalized using the inverse square - * root of the maximum link degree of attached nodes. - * - * @type number - * @name pv.Layout.Force.prototype.springConstant - * @see pv.Force.spring#constant - */ - -/** - * The spring damping factor, in the range [0,1]. Damping functions identically - * to drag forces, damping spring bounciness by applying a force in the opposite - * direction of attached nodes' velocities. The default value is 0.3. - * - *

The spring damping is automatically normalized using the inverse square - * root of the maximum link degree of attached nodes. - * - * @type number - * @name pv.Layout.Force.prototype.springDamping - * @see pv.Force.spring#damping - */ - -/** - * The spring rest length. The default value is 20 pixels. Larger values may be - * appropriate if the layout panel is larger, or if the nodes are rendered - * larger than the default dot size of 20. - * - * @type number - * @name pv.Layout.Force.prototype.springLength - * @see pv.Force.spring#length - */ - -/** - * Default properties for force-directed layouts. The default drag constant is - * 0.1, the default charge constant is -40 (with a domain of [2, 500] and theta - * of 0.9), and the default spring constant is 0.1 (with a damping of 0.3 and a - * rest length of 20). - * - * @type pv.Layout.Force - */ -pv.Layout.Force.prototype.defaults = new pv.Layout.Force() - .extend(pv.Layout.Network.prototype.defaults) - .dragConstant(.1) - .chargeConstant(-40) - .chargeMinDistance(2) - .chargeMaxDistance(500) - .chargeTheta(.9) - .springConstant(.1) - .springDamping(.3) - .springLength(20); - -/** @private Initialize the physics simulation. */ -pv.Layout.Force.prototype.buildImplied = function(s) { - - /* Any cached interactive layouts need to be rebound for the timer. */ - if (pv.Layout.Network.prototype.buildImplied.call(this, s)) { - var f = s.$force; - if (f) { - f.next = this.binds.$force; - this.binds.$force = f; - } - return; - } - - var that = this, - nodes = s.nodes, - links = s.links, - k = s.iterations, - w = s.width, - h = s.height; - - /* Initialize positions randomly near the center. */ - for (var i = 0, n; i < nodes.length; i++) { - n = nodes[i]; - if (isNaN(n.x)) n.x = w / 2 + 40 * Math.random() - 20; - if (isNaN(n.y)) n.y = h / 2 + 40 * Math.random() - 20; - } - - /* Initialize the simulation. */ - var sim = pv.simulation(nodes); - - /* Drag force. */ - sim.force(pv.Force.drag(s.dragConstant)); - - /* Charge (repelling) force. */ - sim.force(pv.Force.charge(s.chargeConstant) - .domain(s.chargeMinDistance, s.chargeMaxDistance) - .theta(s.chargeTheta)); - - /* Spring (attracting) force. */ - sim.force(pv.Force.spring(s.springConstant) - .damping(s.springDamping) - .length(s.springLength) - .links(links)); - - /* Position constraint (for interactive dragging). */ - sim.constraint(pv.Constraint.position()); - - /* Optionally add bound constraint. TODO: better padding. */ - if (s.bound) { - sim.constraint(pv.Constraint.bound().x(6, w - 6).y(6, h - 6)); - } - - /** @private Returns the speed of the given node, to determine cooling. */ - function speed(n) { - return n.fix ? 1 : n.vx * n.vx + n.vy * n.vy; - } - - /* - * If the iterations property is null (the default), the layout is - * interactive. The simulation is run until the fastest particle drops below - * an arbitrary minimum speed. Although the timer keeps firing, this speed - * calculation is fast so there is minimal CPU overhead. Note: if a particle - * is fixed for interactivity, treat this as a high speed and resume - * simulation. - */ - if (k == null) { - sim.step(); // compute initial previous velocities - sim.step(); // compute initial velocities - - /* Add the simulation state to the bound list. */ - var force = s.$force = this.binds.$force = { - next: this.binds.$force, - nodes: nodes, - min: 1e-4 * (links.length + 1), - sim: sim - }; - - /* Start the timer, if not already started. */ - if (!this.$timer) this.$timer = setInterval(function() { - var render = false; - for (var f = that.binds.$force; f; f = f.next) { - if (pv.max(f.nodes, speed) > f.min) { - f.sim.step(); - render = true; - } - } - if (render) that.render(); - }, 42); - } else for (var i = 0; i < k; i++) { - sim.step(); - } -}; -/** - * Constructs a new, empty cluster layout. Layouts are not typically - * constructed directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Implements a hierarchical layout using the cluster (or dendrogram) - * algorithm. This layout provides both node-link and space-filling - * implementations of cluster diagrams. In many ways it is similar to - * {@link pv.Layout.Partition}, except that leaf nodes are positioned at maximum - * depth, and the depth of internal nodes is based on their distance from their - * deepest descendant, rather than their distance from the root. - * - *

The cluster layout supports a "group" property, which if true causes - * siblings to be positioned closer together than unrelated nodes at the same - * depth. Unlike the partition layout, this layout does not support dynamic - * sizing for leaf nodes; all leaf nodes are the same size. - * - *

For more details on how to use this layout, see - * {@link pv.Layout.Hierarchy}. - * - * @see pv.Layout.Cluster.Fill - * @extends pv.Layout.Hierarchy - */ -pv.Layout.Cluster = function() { - pv.Layout.Hierarchy.call(this); - var interpolate, // cached interpolate - buildImplied = this.buildImplied; - - /** @private Cache layout state to optimize properties. */ - this.buildImplied = function(s) { - buildImplied.call(this, s); - interpolate - = /^(top|bottom)$/.test(s.orient) ? "step-before" - : /^(left|right)$/.test(s.orient) ? "step-after" - : "linear"; - }; - - this.link.interpolate(function() { return interpolate; }); -}; - -pv.Layout.Cluster.prototype = pv.extend(pv.Layout.Hierarchy) - .property("group", Number) - .property("orient", String) - .property("innerRadius", Number) - .property("outerRadius", Number); - -/** - * The group parameter; defaults to 0, disabling grouping of siblings. If this - * parameter is set to a positive number (or true, which is equivalent to 1), - * then additional space will be allotted between sibling groups. In other - * words, siblings (nodes that share the same parent) will be positioned more - * closely than nodes at the same depth that do not share a parent. - * - * @type number - * @name pv.Layout.Cluster.prototype.group - */ - -/** - * The orientation. The default orientation is "top", which means that the root - * node is placed on the top edge, leaf nodes appear on the bottom edge, and - * internal nodes are in-between. The following orientations are supported:

- * - * @type string - * @name pv.Layout.Cluster.prototype.orient - */ - -/** - * The inner radius; defaults to 0. This property applies only to radial - * orientations, and can be used to compress the layout radially. Note that for - * the node-link implementation, the root node is always at the center, - * regardless of the value of this property; this property only affects internal - * and leaf nodes. For the space-filling implementation, a non-zero value of - * this property will result in the root node represented as a ring rather than - * a circle. - * - * @type number - * @name pv.Layout.Cluster.prototype.innerRadius - */ - -/** - * The outer radius; defaults to fill the containing panel, based on the height - * and width of the layout. If the layout has no height and width specified, it - * will extend to fill the enclosing panel. - * - * @type number - * @name pv.Layout.Cluster.prototype.outerRadius - */ - -/** - * Defaults for cluster layouts. The default group parameter is 0 and the - * default orientation is "top". - * - * @type pv.Layout.Cluster - */ -pv.Layout.Cluster.prototype.defaults = new pv.Layout.Cluster() - .extend(pv.Layout.Hierarchy.prototype.defaults) - .group(0) - .orient("top"); - -/** @private */ -pv.Layout.Cluster.prototype.buildImplied = function(s) { - if (pv.Layout.Hierarchy.prototype.buildImplied.call(this, s)) return; - - var root = s.nodes[0], - group = s.group, - breadth, - depth, - leafCount = 0, - leafIndex = .5 - group / 2; - - /* Count the leaf nodes and compute the depth of descendants. */ - var p = undefined; - root.visitAfter(function(n) { - if (n.firstChild) { - n.depth = 1 + pv.max(n.childNodes, function(n) { return n.depth; }); - } else { - if (group && (p != n.parentNode)) { - p = n.parentNode; - leafCount += group; - } - leafCount++; - n.depth = 0; - } - }); - breadth = 1 / leafCount; - depth = 1 / root.depth; - - /* Compute the unit breadth and depth of each node. */ - var p = undefined; - root.visitAfter(function(n) { - if (n.firstChild) { - n.breadth = pv.mean(n.childNodes, function(n) { return n.breadth; }); - } else { - if (group && (p != n.parentNode)) { - p = n.parentNode; - leafIndex += group; - } - n.breadth = breadth * leafIndex++; - } - n.depth = 1 - n.depth * depth; - }); - - /* Compute breadth and depth ranges for space-filling layouts. */ - root.visitAfter(function(n) { - n.minBreadth = n.firstChild - ? n.firstChild.minBreadth - : (n.breadth - breadth / 2); - n.maxBreadth = n.firstChild - ? n.lastChild.maxBreadth - : (n.breadth + breadth / 2); - }); - root.visitBefore(function(n) { - n.minDepth = n.parentNode - ? n.parentNode.maxDepth - : 0; - n.maxDepth = n.parentNode - ? (n.depth + root.depth) - : (n.minDepth + 2 * root.depth); - }); - root.minDepth = -depth; - - pv.Layout.Hierarchy.NodeLink.buildImplied.call(this, s); -}; - -/** - * Constructs a new, empty space-filling cluster layout. Layouts are not - * typically constructed directly; instead, they are added to an existing panel - * via {@link pv.Mark#add}. - * - * @class A variant of cluster layout that is space-filling. The meaning of the - * exported mark prototypes changes slightly in the space-filling - * implementation:For more details on how to use this layout, see - * {@link pv.Layout.Cluster}. - * - * @extends pv.Layout.Cluster - */ -pv.Layout.Cluster.Fill = function() { - pv.Layout.Cluster.call(this); - pv.Layout.Hierarchy.Fill.constructor.call(this); -}; - -pv.Layout.Cluster.Fill.prototype = pv.extend(pv.Layout.Cluster); - -/** @private */ -pv.Layout.Cluster.Fill.prototype.buildImplied = function(s) { - if (pv.Layout.Cluster.prototype.buildImplied.call(this, s)) return; - pv.Layout.Hierarchy.Fill.buildImplied.call(this, s); -}; -/** - * Constructs a new, empty partition layout. Layouts are not typically - * constructed directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Implemeents a hierarchical layout using the partition (or sunburst, - * icicle) algorithm. This layout provides both node-link and space-filling - * implementations of partition diagrams. In many ways it is similar to - * {@link pv.Layout.Cluster}, except that leaf nodes are positioned based on - * their distance from the root. - * - *

The partition layout support dynamic sizing for leaf nodes, if a - * {@link #size} psuedo-property is specified. The default size function returns - * 1, causing all leaf nodes to be sized equally, and all internal nodes to be - * sized by the number of leaf nodes they have as descendants. - * - *

The size function can be used in conjunction with the order property, - * which allows the nodes to the sorted by the computed size. Note: for sorting - * based on other data attributes, simply use the default null for the - * order property, and sort the nodes beforehand using the {@link pv.Dom} - * operator. - * - *

For more details on how to use this layout, see - * {@link pv.Layout.Hierarchy}. - * - * @see pv.Layout.Partition.Fill - * @extends pv.Layout.Hierarchy - */ -pv.Layout.Partition = function() { - pv.Layout.Hierarchy.call(this); -}; - -pv.Layout.Partition.prototype = pv.extend(pv.Layout.Hierarchy) - .property("order", String) // null, ascending, descending? - .property("orient", String) // top, left, right, bottom, radial - .property("innerRadius", Number) - .property("outerRadius", Number); - -/** - * The sibling node order. The default order is null, which means to - * use the sibling order specified by the nodes property as-is. A value of - * "ascending" will sort siblings in ascending order of size, while "descending" - * will do the reverse. For sorting based on data attributes other than size, - * use the default null for the order property, and sort the nodes - * beforehand using the {@link pv.Dom} operator. - * - * @see pv.Dom.Node#sort - * @type string - * @name pv.Layout.Partition.prototype.order - */ - -/** - * The orientation. The default orientation is "top", which means that the root - * node is placed on the top edge, leaf nodes appear at the bottom, and internal - * nodes are in-between. The following orientations are supported:

- * - * @type string - * @name pv.Layout.Partition.prototype.orient - */ - -/** - * The inner radius; defaults to 0. This property applies only to radial - * orientations, and can be used to compress the layout radially. Note that for - * the node-link implementation, the root node is always at the center, - * regardless of the value of this property; this property only affects internal - * and leaf nodes. For the space-filling implementation, a non-zero value of - * this property will result in the root node represented as a ring rather than - * a circle. - * - * @type number - * @name pv.Layout.Partition.prototype.innerRadius - */ - -/** - * The outer radius; defaults to fill the containing panel, based on the height - * and width of the layout. If the layout has no height and width specified, it - * will extend to fill the enclosing panel. - * - * @type number - * @name pv.Layout.Partition.prototype.outerRadius - */ - -/** - * Default properties for partition layouts. The default orientation is "top". - * - * @type pv.Layout.Partition - */ -pv.Layout.Partition.prototype.defaults = new pv.Layout.Partition() - .extend(pv.Layout.Hierarchy.prototype.defaults) - .orient("top"); - -/** @private */ -pv.Layout.Partition.prototype.$size = function() { return 1; }; - -/** - * Specifies the sizing function. By default, a sizing function is disabled and - * all nodes are given constant size. The sizing function is invoked for each - * leaf node in the tree (passed to the constructor). - * - *

For example, if the tree data structure represents a file system, with - * files as leaf nodes, and each file has a bytes attribute, you can - * specify a size function as: - * - *

    .size(function(d) d.bytes)
- * - * As with other properties, a size function may specify additional arguments to - * access the data associated with the layout and any enclosing panels. - * - * @param {function} f the new sizing function. - * @returns {pv.Layout.Partition} this. - */ -pv.Layout.Partition.prototype.size = function(f) { - this.$size = f; - return this; -}; - -/** @private */ -pv.Layout.Partition.prototype.buildImplied = function(s) { - if (pv.Layout.Hierarchy.prototype.buildImplied.call(this, s)) return; - - var that = this, - root = s.nodes[0], - stack = pv.Mark.stack, - maxDepth = 0; - - /* Recursively compute the tree depth and node size. */ - stack.unshift(null); - root.visitAfter(function(n, i) { - if (i > maxDepth) maxDepth = i; - n.size = n.firstChild - ? pv.sum(n.childNodes, function(n) { return n.size; }) - : that.$size.apply(that, (stack[0] = n, stack)); - }); - stack.shift(); - - /* Order */ - switch (s.order) { - case "ascending": root.sort(function(a, b) { return a.size - b.size; }); break; - case "descending": root.sort(function(b, a) { return a.size - b.size; }); break; - } - - /* Compute the unit breadth and depth of each node. */ - var ds = 1 / maxDepth; - root.minBreadth = 0; - root.breadth = .5; - root.maxBreadth = 1; - root.visitBefore(function(n) { - var b = n.minBreadth, s = n.maxBreadth - b; - for (var c = n.firstChild; c; c = c.nextSibling) { - c.minBreadth = b; - c.maxBreadth = b += (c.size / n.size) * s; - c.breadth = (b + c.minBreadth) / 2; - } - }); - root.visitAfter(function(n, i) { - n.minDepth = (i - 1) * ds; - n.maxDepth = n.depth = i * ds; - }); - - pv.Layout.Hierarchy.NodeLink.buildImplied.call(this, s); -}; - -/** - * Constructs a new, empty space-filling partition layout. Layouts are not - * typically constructed directly; instead, they are added to an existing panel - * via {@link pv.Mark#add}. - * - * @class A variant of partition layout that is space-filling. The meaning of - * the exported mark prototypes changes slightly in the space-filling - * implementation:For more details on how to use this layout, see - * {@link pv.Layout.Partition}. - * - * @extends pv.Layout.Partition - */ -pv.Layout.Partition.Fill = function() { - pv.Layout.Partition.call(this); - pv.Layout.Hierarchy.Fill.constructor.call(this); -}; - -pv.Layout.Partition.Fill.prototype = pv.extend(pv.Layout.Partition); - -/** @private */ -pv.Layout.Partition.Fill.prototype.buildImplied = function(s) { - if (pv.Layout.Partition.prototype.buildImplied.call(this, s)) return; - pv.Layout.Hierarchy.Fill.buildImplied.call(this, s); -}; -/** - * Constructs a new, empty arc layout. Layouts are not typically constructed - * directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Implements a layout for arc diagrams. An arc diagram is a network - * visualization with a one-dimensional layout of nodes, using circular arcs to - * render links between nodes. For undirected networks, arcs are rendering on a - * single side; this makes arc diagrams useful as annotations to other - * two-dimensional network layouts, such as rollup, matrix or table layouts. For - * directed networks, links in opposite directions can be rendered on opposite - * sides using directed(true). - * - *

Arc layouts are particularly sensitive to node ordering; for best results, - * order the nodes such that related nodes are close to each other. A poor - * (e.g., random) order may result in large arcs with crossovers that impede - * visual processing. A future improvement to this layout may include automatic - * reordering using, e.g., spectral graph layout or simulated annealing. - * - *

This visualization technique is related to that developed by - * M. Wattenberg, "Arc - * Diagrams: Visualizing Structure in Strings" in IEEE InfoVis, 2002. - * However, this implementation is limited to simple node-link networks, as - * opposed to structures with hierarchical self-similarity (such as strings). - * - *

As with other network layouts, three mark prototypes are provided:

For more details on how this layout is structured and can be customized, - * see {@link pv.Layout.Network}. - * - * @extends pv.Layout.Network - **/ -pv.Layout.Arc = function() { - pv.Layout.Network.call(this); - var interpolate, // cached interpolate - directed, // cached directed - reverse, // cached reverse - buildImplied = this.buildImplied; - - /** @private Cache layout state to optimize properties. */ - this.buildImplied = function(s) { - buildImplied.call(this, s); - directed = s.directed; - interpolate = s.orient == "radial" ? "linear" : "polar"; - reverse = s.orient == "right" || s.orient == "top"; - }; - - /* Override link properties to handle directedness and orientation. */ - this.link - .data(function(p) { - var s = p.sourceNode, t = p.targetNode; - return reverse != (directed || (s.breadth < t.breadth)) ? [s, t] : [t, s]; - }) - .interpolate(function() { return interpolate; }); -}; - -pv.Layout.Arc.prototype = pv.extend(pv.Layout.Network) - .property("orient", String) - .property("directed", Boolean); - -/** - * Default properties for arc layouts. By default, the orientation is "bottom". - * - * @type pv.Layout.Arc - */ -pv.Layout.Arc.prototype.defaults = new pv.Layout.Arc() - .extend(pv.Layout.Network.prototype.defaults) - .orient("bottom"); - -/** - * Specifies an optional sort function. The sort function follows the same - * comparator contract required by {@link pv.Dom.Node#sort}. Specifying a sort - * function provides an alternative to sort the nodes as they are specified by - * the nodes property; the main advantage of doing this is that the - * comparator function can access implicit fields populated by the network - * layout, such as the linkDegree. - * - *

Note that arc diagrams are particularly sensitive to order. This is - * referred to as the seriation problem, and many different techniques exist to - * find good node orders that emphasize clusters, such as spectral layout and - * simulated annealing. - * - * @param {function} f comparator function for nodes. - * @returns {pv.Layout.Arc} this. - */ -pv.Layout.Arc.prototype.sort = function(f) { - this.$sort = f; - return this; -}; - -/** @private Populates the x, y and angle attributes on the nodes. */ -pv.Layout.Arc.prototype.buildImplied = function(s) { - if (pv.Layout.Network.prototype.buildImplied.call(this, s)) return; - - var nodes = s.nodes, - orient = s.orient, - sort = this.$sort, - index = pv.range(nodes.length), - w = s.width, - h = s.height, - r = Math.min(w, h) / 2; - - /* Sort the nodes. */ - if (sort) index.sort(function(a, b) { return sort(nodes[a], nodes[b]); }); - - /** @private Returns the mid-angle, given the breadth. */ - function midAngle(b) { - switch (orient) { - case "top": return -Math.PI / 2; - case "bottom": return Math.PI / 2; - case "left": return Math.PI; - case "right": return 0; - case "radial": return (b - .25) * 2 * Math.PI; - } - } - - /** @private Returns the x-position, given the breadth. */ - function x(b) { - switch (orient) { - case "top": - case "bottom": return b * w; - case "left": return 0; - case "right": return w; - case "radial": return w / 2 + r * Math.cos(midAngle(b)); - } - } - - /** @private Returns the y-position, given the breadth. */ - function y(b) { - switch (orient) { - case "top": return 0; - case "bottom": return h; - case "left": - case "right": return b * h; - case "radial": return h / 2 + r * Math.sin(midAngle(b)); - } - } - - /* Populate the x, y and mid-angle attributes. */ - for (var i = 0; i < nodes.length; i++) { - var n = nodes[index[i]], b = n.breadth = (i + .5) / nodes.length; - n.x = x(b); - n.y = y(b); - n.midAngle = midAngle(b); - } -}; - -/** - * The orientation. The default orientation is "left", which means that nodes - * will be positioned from left-to-right in the order they are specified in the - * nodes property. The following orientations are supported:

- * - * @type string - * @name pv.Layout.Arc.prototype.orient - */ - -/** - * Whether this arc digram is directed (bidirectional); only applies to - * non-radial orientations. By default, arc digrams are undirected, such that - * all arcs appear on one side. If the arc digram is directed, then forward - * links are drawn on the conventional side (the same as as undirected - * links--right, left, bottom and top for left, right, top and bottom, - * respectively), while reverse links are drawn on the opposite side. - * - * @type boolean - * @name pv.Layout.Arc.prototype.directed - */ -/** - * Constructs a new, empty horizon layout. Layouts are not typically constructed - * directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Implements a horizon layout, which is a variation of a single-series - * area chart where the area is folded into multiple bands. Color is used to - * encode band, allowing the size of the chart to be reduced significantly - * without impeding readability. This layout algorithm is based on the work of - * J. Heer, N. Kong and M. Agrawala in "Sizing - * the Horizon: The Effects of Chart Size and Layering on the Graphical - * Perception of Time Series Visualizations", CHI 2009. - * - *

This layout exports a single band mark prototype, which is - * intended to be used with an area mark. The band mark is contained in a panel - * which is replicated per band (and for negative/positive bands). For example, - * to create a simple horizon graph given an array of numbers: - * - *

vis.add(pv.Layout.Horizon)
- *     .bands(n)
- *   .band.add(pv.Area)
- *     .data(data)
- *     .left(function() this.index * 35)
- *     .height(function(d) d * 40);
- * - * The layout can be further customized by changing the number of bands, and - * toggling whether the negative bands are mirrored or offset. (See the - * above-referenced paper for guidance.) - * - *

The fillStyle of the area can be overridden, though typically it - * is easier to customize the layout's behavior through the custom - * backgroundStyle, positiveStyle and negativeStyle - * properties. By default, the background is white, positive bands are blue, and - * negative bands are red. For the most accurate presentation, use fully-opaque - * colors of equal intensity for the negative and positive bands. - * - * @extends pv.Layout - */ -pv.Layout.Horizon = function() { - pv.Layout.call(this); - var that = this, - bands, // cached bands - mode, // cached mode - size, // cached height - fill, // cached background style - red, // cached negative color (ramp) - blue, // cached positive color (ramp) - buildImplied = this.buildImplied; - - /** @private Cache the layout state to optimize properties. */ - this.buildImplied = function(s) { - buildImplied.call(this, s); - bands = s.bands; - mode = s.mode; - size = Math.round((mode == "color" ? .5 : 1) * s.height); - fill = s.backgroundStyle; - red = pv.ramp(fill, s.negativeStyle).domain(0, bands); - blue = pv.ramp(fill, s.positiveStyle).domain(0, bands); - }; - - var bands = new pv.Panel() - .data(function() { return pv.range(bands * 2); }) - .overflow("hidden") - .height(function() { return size; }) - .top(function(i) { return mode == "color" ? (i & 1) * size : 0; }) - .fillStyle(function(i) { return i ? null : fill; }); - - /** - * The band prototype. This prototype is intended to be used with an Area - * mark to render the horizon bands. - * - * @type pv.Mark - * @name pv.Layout.Horizon.prototype.band - */ - this.band = new pv.Mark() - .top(function(d, i) { - return mode == "mirror" && i & 1 - ? (i + 1 >> 1) * size - : null; - }) - .bottom(function(d, i) { - return mode == "mirror" - ? (i & 1 ? null : (i + 1 >> 1) * -size) - : ((i & 1 || -1) * (i + 1 >> 1) * size); - }) - .fillStyle(function(d, i) { - return (i & 1 ? red : blue)((i >> 1) + 1); - }); - - this.band.add = function(type) { - return that.add(pv.Panel).extend(bands).add(type).extend(this); - }; -}; - -pv.Layout.Horizon.prototype = pv.extend(pv.Layout) - .property("bands", Number) - .property("mode", String) - .property("backgroundStyle", pv.color) - .property("positiveStyle", pv.color) - .property("negativeStyle", pv.color); - -/** - * Default properties for horizon layouts. By default, there are two bands, the - * mode is "offset", the background style is "white", the positive style is - * blue, negative style is red. - * - * @type pv.Layout.Horizon - */ -pv.Layout.Horizon.prototype.defaults = new pv.Layout.Horizon() - .extend(pv.Layout.prototype.defaults) - .bands(2) - .mode("offset") - .backgroundStyle("white") - .positiveStyle("#1f77b4") - .negativeStyle("#d62728"); - -/** - * The horizon mode: offset, mirror, or color. The default is "offset". - * - * @type string - * @name pv.Layout.Horizon.prototype.mode - */ - -/** - * The number of bands. Must be at least one. The default value is two. - * - * @type number - * @name pv.Layout.Horizon.prototype.bands - */ - -/** - * The positive band color; if non-null, the interior of positive bands are - * filled with the specified color. The default value of this property is blue. - * For accurate blending, this color should be fully opaque. - * - * @type pv.Color - * @name pv.Layout.Horizon.prototype.positiveStyle - */ - -/** - * The negative band color; if non-null, the interior of negative bands are - * filled with the specified color. The default value of this property is red. - * For accurate blending, this color should be fully opaque. - * - * @type pv.Color - * @name pv.Layout.Horizon.prototype.negativeStyle - */ - -/** - * The background color. The panel background is filled with the specified - * color, and the negative and positive bands are filled with an interpolated - * color between this color and the respective band color. The default value of - * this property is white. For accurate blending, this color should be fully - * opaque. - * - * @type pv.Color - * @name pv.Layout.Horizon.prototype.backgroundStyle - */ -/** - * Constructs a new, empty rollup network layout. Layouts are not typically - * constructed directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Implements a network visualization using a node-link diagram where - * nodes are rolled up along two dimensions. This implementation is based on the - * "PivotGraph" designed by Martin Wattenberg: - * - *

The method is designed for graphs that are "multivariate", i.e., - * where each node is associated with several attributes. Unlike visualizations - * which emphasize global graph topology, PivotGraph uses a simple grid-based - * approach to focus on the relationship between node attributes & - * connections.
- * - * This layout requires two psuedo-properties to be specified, which assign node - * positions along the two dimensions {@link #x} and {@link #y}, corresponding - * to the left and top properties, respectively. Typically, these functions are - * specified using an {@link pv.Scale.ordinal}. Nodes that share the same - * position in x and y are "rolled up" into a meta-node, and - * similarly links are aggregated between meta-nodes. For example, to construct - * a rollup to analyze links by gender and affiliation, first define two ordinal - * scales: - * - *
var x = pv.Scale.ordinal(nodes, function(d) d.gender).split(0, w),
- *     y = pv.Scale.ordinal(nodes, function(d) d.aff).split(0, h);
- * - * Next, define the position psuedo-properties: - * - *
    .x(function(d) x(d.gender))
- *     .y(function(d) y(d.aff))
- * - * Linear and other quantitative scales can alternatively be used to position - * the nodes along either dimension. Note, however, that the rollup requires - * that the positions match exactly, and thus ordinal scales are recommended to - * avoid precision errors. - * - *

Note that because this layout provides a visualization of the rolled up - * graph, the data properties for the mark prototypes (node, - * link and label) are different from most other network - * layouts: they reference the rolled-up nodes and links, rather than the nodes - * and links of the full network. The underlying nodes and links for each - * rolled-up node and link can be accessed via the nodes and - * links attributes, respectively. The aggregated link values for - * rolled-up links can similarly be accessed via the linkValue - * attribute. - * - *

For undirected networks, links are duplicated in both directions. For - * directed networks, use directed(true). The graph is assumed to be - * undirected by default. - * - * @extends pv.Layout.Network - * @see "Visual Exploration of Multivariate Graphs" by M. Wattenberg, CHI 2006. - */ -pv.Layout.Rollup = function() { - pv.Layout.Network.call(this); - var that = this, - nodes, // cached rollup nodes - links, // cached rollup links - buildImplied = that.buildImplied; - - /** @private Cache layout state to optimize properties. */ - this.buildImplied = function(s) { - buildImplied.call(this, s); - nodes = s.$rollup.nodes; - links = s.$rollup.links; - }; - - /* Render rollup nodes. */ - this.node - .data(function() { return nodes; }) - .size(function(d) { return d.nodes.length * 20; }); - - /* Render rollup links. */ - this.link - .interpolate("polar") - .eccentricity(.8); - - this.link.add = function(type) { - return that.add(pv.Panel) - .data(function() { return links; }) - .add(type) - .extend(this); - }; -}; - -pv.Layout.Rollup.prototype = pv.extend(pv.Layout.Network) - .property("directed", Boolean); - -/** - * Whether the underlying network is directed. By default, the graph is assumed - * to be undirected, and links are rendered in both directions. If the network - * is directed, then forward links are drawn above the diagonal, while reverse - * links are drawn below. - * - * @type boolean - * @name pv.Layout.Rollup.prototype.directed - */ - -/** - * Specifies the x-position function used to rollup nodes. The rolled up - * nodes are positioned horizontally using the return values from the given - * function. Typically the function is specified as an ordinal scale. For - * single-dimension rollups, a constant value can be specified. - * - * @param {function} f the x-position function. - * @returns {pv.Layout.Rollup} this. - * @see pv.Scale.ordinal - */ -pv.Layout.Rollup.prototype.x = function(f) { - this.$x = pv.functor(f); - return this; -}; - -/** - * Specifies the y-position function used to rollup nodes. The rolled up - * nodes are positioned vertically using the return values from the given - * function. Typically the function is specified as an ordinal scale. For - * single-dimension rollups, a constant value can be specified. - * - * @param {function} f the y-position function. - * @returns {pv.Layout.Rollup} this. - * @see pv.Scale.ordinal - */ -pv.Layout.Rollup.prototype.y = function(f) { - this.$y = pv.functor(f); - return this; -}; - -/** @private */ -pv.Layout.Rollup.prototype.buildImplied = function(s) { - if (pv.Layout.Network.prototype.buildImplied.call(this, s)) return; - - var nodes = s.nodes, - links = s.links, - directed = s.directed, - n = nodes.length, - x = [], - y = [], - rnindex = 0, - rnodes = {}, - rlinks = {}; - - /** @private */ - function id(i) { - return x[i] + "," + y[i]; - } - - /* Iterate over the data, evaluating the x and y functions. */ - var stack = pv.Mark.stack, o = {parent: this}; - stack.unshift(null); - for (var i = 0; i < n; i++) { - o.index = i; - stack[0] = nodes[i]; - x[i] = this.$x.apply(o, stack); - y[i] = this.$y.apply(o, stack); - } - stack.shift(); - - /* Compute rollup nodes. */ - for (var i = 0; i < nodes.length; i++) { - var nodeId = id(i), - rn = rnodes[nodeId]; - if (!rn) { - rn = rnodes[nodeId] = pv.extend(nodes[i]); - rn.index = rnindex++; - rn.x = x[i]; - rn.y = y[i]; - rn.nodes = []; - } - rn.nodes.push(nodes[i]); - } - - /* Compute rollup links. */ - for (var i = 0; i < links.length; i++) { - var source = links[i].sourceNode, - target = links[i].targetNode, - rsource = rnodes[id(source.index)], - rtarget = rnodes[id(target.index)], - reverse = !directed && rsource.index > rtarget.index, - linkId = reverse - ? rtarget.index + "," + rsource.index - : rsource.index + "," + rtarget.index, - rl = rlinks[linkId]; - if (!rl) { - rl = rlinks[linkId] = { - sourceNode: rsource, - targetNode: rtarget, - linkValue: 0, - links: [] - }; - } - rl.links.push(links[i]); - rl.linkValue += links[i].linkValue; - } - - /* Export the rolled up nodes and links to the scene. */ - s.$rollup = { - nodes: pv.values(rnodes), - links: pv.values(rlinks) - }; -}; -/** - * Constructs a new, empty matrix network layout. Layouts are not typically - * constructed directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class Implements a network visualization using a matrix view. This is, in - * effect, a visualization of the graph's adjacency matrix: the cell at - * row i, column j, corresponds to the link from node i to - * node j. The fill color of each cell is binary by default, and - * corresponds to whether a link exists between the two nodes. If the underlying - * graph has links with variable values, the fillStyle property can be - * substited to use an appropriate color function, such as {@link pv.ramp}. - * - *

For undirected networks, the matrix is symmetric around the diagonal. For - * directed networks, links in opposite directions can be rendered on opposite - * sides of the diagonal using directed(true). The graph is assumed to - * be undirected by default. - * - *

The mark prototypes for this network layout are slightly different than - * other implementations:

For more details on how to use this layout, see - * {@link pv.Layout.Network}. - * - * @extends pv.Layout.Network - */ -pv.Layout.Matrix = function() { - pv.Layout.Network.call(this); - var that = this, - n, // cached matrix size - dx, // cached cell width - dy, // cached cell height - labels, // cached labels (array of strings) - pairs, // cached pairs (array of links) - buildImplied = that.buildImplied; - - /** @private Cache layout state to optimize properties. */ - this.buildImplied = function(s) { - buildImplied.call(this, s); - n = s.nodes.length; - dx = s.width / n; - dy = s.height / n; - labels = s.$matrix.labels; - pairs = s.$matrix.pairs; - }; - - /* Links are all pairs of nodes. */ - this.link - .data(function() { return pairs; }) - .left(function() { return dx * (this.index % n); }) - .top(function() { return dy * Math.floor(this.index / n); }) - .width(function() { return dx; }) - .height(function() { return dy; }) - .lineWidth(1.5) - .strokeStyle("#fff") - .fillStyle(function(l) { return l.linkValue ? "#555" : "#eee"; }) - .parent = this; - - /* No special add for links! */ - delete this.link.add; - - /* Labels are duplicated for top & left. */ - this.label - .data(function() { return labels; }) - .left(function() { return this.index & 1 ? dx * ((this.index >> 1) + .5) : null; }) - .top(function() { return this.index & 1 ? null : dy * ((this.index >> 1) + .5); }) - .textMargin(4) - .textAlign(function() { return this.index & 1 ? "left" : "right"; }) - .textAngle(function() { return this.index & 1 ? -Math.PI / 2 : 0; }); - - /* The node mark is unused. */ - delete this.node; -}; - -pv.Layout.Matrix.prototype = pv.extend(pv.Layout.Network) - .property("directed", Boolean); - -/** - * Whether this matrix visualization is directed (bidirectional). By default, - * the graph is assumed to be undirected, such that the visualization is - * symmetric across the matrix diagonal. If the network is directed, then - * forward links are drawn above the diagonal, while reverse links are drawn - * below. - * - * @type boolean - * @name pv.Layout.Matrix.prototype.directed - */ - -/** - * Specifies an optional sort function. The sort function follows the same - * comparator contract required by {@link pv.Dom.Node#sort}. Specifying a sort - * function provides an alternative to sort the nodes as they are specified by - * the nodes property; the main advantage of doing this is that the - * comparator function can access implicit fields populated by the network - * layout, such as the linkDegree. - * - *

Note that matrix visualizations are particularly sensitive to order. This - * is referred to as the seriation problem, and many different techniques exist - * to find good node orders that emphasize clusters, such as spectral layout and - * simulated annealing. - * - * @param {function} f comparator function for nodes. - * @returns {pv.Layout.Matrix} this. - */ -pv.Layout.Matrix.prototype.sort = function(f) { - this.$sort = f; - return this; -}; - -/** @private */ -pv.Layout.Matrix.prototype.buildImplied = function(s) { - if (pv.Layout.Network.prototype.buildImplied.call(this, s)) return; - - var nodes = s.nodes, - links = s.links, - sort = this.$sort, - n = nodes.length, - index = pv.range(n), - labels = [], - pairs = [], - map = {}; - - s.$matrix = {labels: labels, pairs: pairs}; - - /* Sort the nodes. */ - if (sort) index.sort(function(a, b) { return sort(nodes[a], nodes[b]); }); - - /* Create pairs. */ - for (var i = 0; i < n; i++) { - for (var j = 0; j < n; j++) { - var a = index[i], - b = index[j], - p = { - row: i, - col: j, - sourceNode: nodes[a], - targetNode: nodes[b], - linkValue: 0 - }; - pairs.push(map[a + "." + b] = p); - } - } - - /* Create labels. */ - for (var i = 0; i < n; i++) { - var a = index[i]; - labels.push(nodes[a], nodes[a]); - } - - /* Accumulate link values. */ - for (var i = 0; i < links.length; i++) { - var l = links[i], - source = l.sourceNode.index, - target = l.targetNode.index, - value = l.linkValue; - map[source + "." + target].linkValue += value; - if (!s.directed) map[target + "." + source].linkValue += value; - } -}; -// ranges (bad, satisfactory, good) -// measures (actual, forecast) -// markers (previous, goal) - -/* - * Chart design based on the recommendations of Stephen Few. Implementation - * based on the work of Clint Ivy, Jamie Love, and Jason Davies. - * http://projects.instantcognition.com/protovis/bulletchart/ - */ - -/** - * Constructs a new, empty bullet layout. Layouts are not typically constructed - * directly; instead, they are added to an existing panel via - * {@link pv.Mark#add}. - * - * @class - * @extends pv.Layout - */ -pv.Layout.Bullet = function() { - pv.Layout.call(this); - var that = this, - buildImplied = that.buildImplied, - scale = that.x = pv.Scale.linear(), - orient, - horizontal, - rangeColor, - measureColor, - x; - - /** @private Cache layout state to optimize properties. */ - this.buildImplied = function(s) { - buildImplied.call(this, x = s); - orient = s.orient; - horizontal = /^left|right$/.test(orient); - rangeColor = pv.ramp("#bbb", "#eee") - .domain(0, Math.max(1, x.ranges.length - 1)); - measureColor = pv.ramp("steelblue", "lightsteelblue") - .domain(0, Math.max(1, x.measures.length - 1)); - }; - - /** - * The range prototype. - * - * @type pv.Mark - * @name pv.Layout.Bullet.prototype.range - */ - (this.range = new pv.Mark()) - .data(function() { return x.ranges; }) - .reverse(true) - .left(function() { return orient == "left" ? 0 : null; }) - .top(function() { return orient == "top" ? 0 : null; }) - .right(function() { return orient == "right" ? 0 : null; }) - .bottom(function() { return orient == "bottom" ? 0 : null; }) - .width(function(d) { return horizontal ? scale(d) : null; }) - .height(function(d) { return horizontal ? null : scale(d); }) - .fillStyle(function() { return rangeColor(this.index); }) - .antialias(false) - .parent = that; - - /** - * The measure prototype. - * - * @type pv.Mark - * @name pv.Layout.Bullet.prototype.measure - */ - (this.measure = new pv.Mark()) - .extend(this.range) - .data(function() { return x.measures; }) - .left(function() { return orient == "left" ? 0 : horizontal ? null : this.parent.width() / 3.25; }) - .top(function() { return orient == "top" ? 0 : horizontal ? this.parent.height() / 3.25 : null; }) - .right(function() { return orient == "right" ? 0 : horizontal ? null : this.parent.width() / 3.25; }) - .bottom(function() { return orient == "bottom" ? 0 : horizontal ? this.parent.height() / 3.25 : null; }) - .fillStyle(function() { return measureColor(this.index); }) - .parent = that; - - /** - * The marker prototype. - * - * @type pv.Mark - * @name pv.Layout.Bullet.prototype.marker - */ - (this.marker = new pv.Mark()) - .data(function() { return x.markers; }) - .left(function(d) { return orient == "left" ? scale(d) : horizontal ? null : this.parent.width() / 2; }) - .top(function(d) { return orient == "top" ? scale(d) : horizontal ? this.parent.height() / 2 : null; }) - .right(function(d) { return orient == "right" ? scale(d) : null; }) - .bottom(function(d) { return orient == "bottom" ? scale(d) : null; }) - .strokeStyle("black") - .shape("bar") - .angle(function() { return horizontal ? 0 : Math.PI / 2; }) - .parent = that; - - (this.tick = new pv.Mark()) - .data(function() { return scale.ticks(7); }) - .left(function(d) { return orient == "left" ? scale(d) : null; }) - .top(function(d) { return orient == "top" ? scale(d) : null; }) - .right(function(d) { return orient == "right" ? scale(d) : horizontal ? null : -6; }) - .bottom(function(d) { return orient == "bottom" ? scale(d) : horizontal ? -8 : null; }) - .height(function() { return horizontal ? 6 : null; }) - .width(function() { return horizontal ? null : 6; }) - .parent = that; -}; - -pv.Layout.Bullet.prototype = pv.extend(pv.Layout) - .property("orient", String) // left, right, top, bottom - .property("ranges") - .property("markers") - .property("measures") - .property("maximum", Number); - -/** - * Default properties for bullet layouts. - * - * @type pv.Layout.Bullet - */ -pv.Layout.Bullet.prototype.defaults = new pv.Layout.Bullet() - .extend(pv.Layout.prototype.defaults) - .orient("left") - .ranges([]) - .markers([]) - .measures([]); - -/** - * The orientation. - * - * @type string - * @name pv.Layout.Bullet.prototype.orient - */ - -/** - * The array of range values. - * - * @type array - * @name pv.Layout.Bullet.prototype.ranges - */ - -/** - * The array of marker values. - * - * @type array - * @name pv.Layout.Bullet.prototype.markers - */ - -/** - * The array of measure values. - * - * @type array - * @name pv.Layout.Bullet.prototype.measures - */ - -/** - * Optional; the maximum range value. - * - * @type number - * @name pv.Layout.Bullet.prototype.maximum - */ - -/** @private */ -pv.Layout.Bullet.prototype.buildImplied = function(s) { - pv.Layout.prototype.buildImplied.call(this, s); - var size = this.parent[/^left|right$/.test(s.orient) ? "width" : "height"](); - s.maximum = s.maximum || pv.max([].concat(s.ranges, s.markers, s.measures)); - this.x.domain(0, s.maximum).range(0, size); -}; -/** - * Abstract; see an implementing class for details. - * - * @class Represents a reusable interaction; applies an interactive behavior to - * a given mark. Behaviors are themselves functions designed to be used as event - * handlers. For example, to add pan and zoom support to any panel, say: - * - *

    .event("mousedown", pv.Behavior.pan())
- *     .event("mousewheel", pv.Behavior.zoom())
- * - * The behavior should be registered on the event that triggers the start of the - * behavior. Typically, the behavior will take care of registering for any - * additional events that are necessary. For example, dragging starts on - * mousedown, while the drag behavior automatically listens for mousemove and - * mouseup events on the window. By listening to the window, the behavior can - * continue to receive mouse events even if the mouse briefly leaves the mark - * being dragged, or even the root panel. - * - *

Each behavior implementation has specific requirements as to which events - * it supports, and how it should be used. For example, the drag behavior - * requires that the data associated with the mark be an object with x - * and y attributes, such as a {@link pv.Vector}, storing the mark's - * position. See an implementing class for details. - * - * @see pv.Behavior.drag - * @see pv.Behavior.pan - * @see pv.Behavior.point - * @see pv.Behavior.select - * @see pv.Behavior.zoom - * @extends function - */ -pv.Behavior = {}; -/** - * Returns a new drag behavior to be registered on mousedown events. - * - * @class Implements interactive dragging starting with mousedown events. - * Register this behavior on marks that should be draggable by the user, such as - * the selected region for brushing and linking. This behavior can be used in - * tandom with {@link pv.Behavior.select} to allow the selected region to be - * dragged interactively. - * - *

After the initial mousedown event is triggered, this behavior listens for - * mousemove and mouseup events on the window. This allows dragging to continue - * even if the mouse temporarily leaves the mark that is being dragged, or even - * the root panel. - * - *

This behavior requires that the data associated with the mark being - * dragged have x and y attributes that correspond to the - * mark's location in pixels. The mark's positional properties are not set - * directly by this behavior; instead, the positional properties should be - * defined as: - * - *

    .left(function(d) d.x)
- *     .top(function(d) d.y)
- * - * Thus, the behavior does not move the mark directly, but instead updates the - * mark position by updating the underlying data. Note that if the positional - * properties are defined with bottom and right (rather than top and left), the - * drag behavior will be inverted, which will confuse users! - * - *

The drag behavior is bounded by the parent panel; the x and - * y attributes are clamped such that the mark being dragged does not - * extend outside the enclosing panel's bounds. To facilitate this, the drag - * behavior also queries for dx and dy attributes on the - * underlying data, to determine the dimensions of the bar being dragged. For - * non-rectangular marks, the drag behavior simply treats the mark as a point, - * which means that only the mark's center is bounded. - * - *

The mark being dragged is automatically re-rendered for each mouse event - * as part of the drag operation. In addition, a fix attribute is - * populated on the mark, which allows visual feedback for dragging. For - * example, to change the mark fill color while dragging: - * - *

    .fillStyle(function(d) d.fix ? "#ff7f0e" : "#aec7e8")
- * - * In some cases, such as with network layouts, dragging the mark may cause - * related marks to change, in which case additional marks may also need to be - * rendered. This can be accomplished by listening for the drag - * psuedo-events:For example, to render the parent panel while dragging, thus - * re-rendering all sibling marks: - * - *
    .event("mousedown", pv.Behavior.drag())
- *     .event("drag", function() this.parent)
- * - * This behavior may be enhanced in the future to allow more flexible - * configuration of drag behavior. - * - * @extends pv.Behavior - * @see pv.Behavior - * @see pv.Behavior.select - * @see pv.Layout.force - */ -pv.Behavior.drag = function() { - var scene, // scene context - index, // scene context - p, // particle being dragged - v1, // initial mouse-particle offset - max; - - /** @private */ - function mousedown(d) { - index = this.index; - scene = this.scene; - var m = this.mouse(); - v1 = ((p = d).fix = pv.vector(d.x, d.y)).minus(m); - max = { - x: this.parent.width() - (d.dx || 0), - y: this.parent.height() - (d.dy || 0) - }; - scene.mark.context(scene, index, function() { this.render(); }); - pv.Mark.dispatch("dragstart", scene, index); - } - - /** @private */ - function mousemove() { - if (!scene) return; - scene.mark.context(scene, index, function() { - var m = this.mouse(); - p.x = p.fix.x = Math.max(0, Math.min(v1.x + m.x, max.x)); - p.y = p.fix.y = Math.max(0, Math.min(v1.y + m.y, max.y)); - this.render(); - }); - pv.Mark.dispatch("drag", scene, index); - } - - /** @private */ - function mouseup() { - if (!scene) return; - p.fix = null; - scene.mark.context(scene, index, function() { this.render(); }); - pv.Mark.dispatch("dragend", scene, index); - scene = null; - } - - pv.listen(window, "mousemove", mousemove); - pv.listen(window, "mouseup", mouseup); - return mousedown; -}; -/** - * Returns a new point behavior to be registered on mousemove events. - * - * @class Implements interactive fuzzy pointing, identifying marks that are in - * close proximity to the mouse cursor. This behavior is an alternative to the - * native mouseover and mouseout events, improving usability. Rather than - * requiring the user to mouseover a mark exactly, the mouse simply needs to - * move near the given mark and a "point" event is triggered. In addition, if - * multiple marks overlap, the point behavior can be used to identify the mark - * instance closest to the cursor, as opposed to the one that is rendered on - * top. - * - *

The point behavior can also identify the closest mark instance for marks - * that produce a continuous graphic primitive. The point behavior can thus be - * used to provide details-on-demand for both discrete marks (such as dots and - * bars), as well as continuous marks (such as lines and areas). - * - *

This behavior is implemented by finding the closest mark instance to the - * mouse cursor on every mousemove event. If this closest mark is within the - * given radius threshold, which defaults to 30 pixels, a "point" psuedo-event - * is dispatched to the given mark instance. If any mark were previously - * pointed, it would receive a corresponding "unpoint" event. These two - * psuedo-event types correspond to the native "mouseover" and "mouseout" - * events, respectively. To increase the radius at which the point behavior can - * be applied, specify an appropriate threshold to the constructor, up to - * Infinity. - * - *

By default, the standard Cartesian distance is computed. However, with - * some visualizations it is desirable to consider only a single dimension, such - * as the x-dimension for an independent variable. In this case, the - * collapse parameter can be set to collapse the y dimension: - * - *

    .event("mousemove", pv.Behavior.point(Infinity).collapse("y"))
- * - *

This behavior only listens to mousemove events on the assigned panel, - * which is typically the root panel. The behavior will search recursively for - * descendant marks to point. If the mouse leaves the assigned panel, the - * behavior no longer receives mousemove events; an unpoint psuedo-event is - * automatically dispatched to unpoint any pointed mark. Marks may be re-pointed - * when the mouse reenters the panel. - * - *

Panels have transparent fill styles by default; this means that panels may - * not receive the initial mousemove event to start pointing. To fix this - * problem, either given the panel a visible fill style (such as "white"), or - * set the events property to "all" such that the panel receives events - * despite its transparent fill. - * - *

Note: this behavior does not currently wedge marks. - * - * @extends pv.Behavior - * - * @param {number} [r] the fuzzy radius threshold in pixels - * @see "The Bubble Cursor: Enhancing Target Acquisition by Dynamic Resizing of the - * Cursor's Activation Area" by T. Grossman & R. Balakrishnan, CHI 2005. - */ -pv.Behavior.point = function(r) { - var unpoint, // the current pointer target - collapse = null, // dimensions to collapse - kx = 1, // x-dimension cost scale - ky = 1, // y-dimension cost scale - r2 = arguments.length ? r * r : 900; // fuzzy radius - - /** @private Search for the mark closest to the mouse. */ - function search(scene, index) { - var s = scene[index], - point = {cost: Infinity}; - for (var i = 0, n = s.visible && s.children.length; i < n; i++) { - var child = s.children[i], mark = child.mark, p; - if (mark.type == "panel") { - mark.scene = child; - for (var j = 0, m = child.length; j < m; j++) { - mark.index = j; - p = search(child, j); - if (p.cost < point.cost) point = p; - } - delete mark.scene; - delete mark.index; - } else if (mark.$handlers.point) { - var v = mark.mouse(); - for (var j = 0, m = child.length; j < m; j++) { - var c = child[j], - dx = v.x - c.left - (c.width || 0) / 2, - dy = v.y - c.top - (c.height || 0) / 2, - dd = kx * dx * dx + ky * dy * dy; - if (dd < point.cost) { - point.distance = dx * dx + dy * dy; - point.cost = dd; - point.scene = child; - point.index = j; - } - } - } - } - return point; - } - - /** @private */ - function mousemove() { - /* If the closest mark is far away, clear the current target. */ - var point = search(this.scene, this.index); - if ((point.cost == Infinity) || (point.distance > r2)) point = null; - - /* Unpoint the old target, if it's not the new target. */ - if (unpoint) { - if (point - && (unpoint.scene == point.scene) - && (unpoint.index == point.index)) return; - pv.Mark.dispatch("unpoint", unpoint.scene, unpoint.index); - } - - /* Point the new target, if there is one. */ - if (unpoint = point) { - pv.Mark.dispatch("point", point.scene, point.index); - - /* Unpoint when the mouse leaves the root panel. */ - pv.listen(this.root.canvas(), "mouseout", mouseout); - } - } - - /** @private */ - function mouseout(e) { - if (unpoint && !pv.ancestor(this, e.relatedTarget)) { - pv.Mark.dispatch("unpoint", unpoint.scene, unpoint.index); - unpoint = null; - } - } - - /** - * Sets or gets the collapse parameter. By default, the standard Cartesian - * distance is computed. However, with some visualizations it is desirable to - * consider only a single dimension, such as the x-dimension for an - * independent variable. In this case, the collapse parameter can be set to - * collapse the y dimension: - * - *

    .event("mousemove", pv.Behavior.point(Infinity).collapse("y"))
- * - * @function - * @returns {pv.Behavior.point} this, or the current collapse parameter. - * @name pv.Behavior.point.prototype.collapse - * @param {string} [x] the new collapse parameter - */ - mousemove.collapse = function(x) { - if (arguments.length) { - collapse = String(x); - switch (collapse) { - case "y": kx = 1; ky = 0; break; - case "x": kx = 0; ky = 1; break; - default: kx = 1; ky = 1; break; - } - return mousemove; - } - return collapse; - }; - - return mousemove; -}; -/** - * Returns a new select behavior to be registered on mousedown events. - * - * @class Implements interactive selecting starting with mousedown events. - * Register this behavior on panels that should be selectable by the user, such - * for brushing and linking. This behavior can be used in tandom with - * {@link pv.Behavior.drag} to allow the selected region to be dragged - * interactively. - * - *

After the initial mousedown event is triggered, this behavior listens for - * mousemove and mouseup events on the window. This allows selecting to continue - * even if the mouse temporarily leaves the assigned panel, or even the root - * panel. - * - *

This behavior requires that the data associated with the mark being - * dragged have x, y, dx and dy attributes - * that correspond to the mark's location and dimensions in pixels. The mark's - * positional properties are not set directly by this behavior; instead, the - * positional properties should be defined as: - * - *

    .left(function(d) d.x)
- *     .top(function(d) d.y)
- *     .width(function(d) d.dx)
- *     .height(function(d) d.dy)
- * - * Thus, the behavior does not resize the mark directly, but instead updates the - * selection by updating the assigned panel's underlying data. Note that if the - * positional properties are defined with bottom and right (rather than top and - * left), the drag behavior will be inverted, which will confuse users! - * - *

The select behavior is bounded by the assigned panel; the positional - * attributes are clamped such that the selection does not extend outside the - * panel's bounds. - * - *

The panel being selected is automatically re-rendered for each mouse event - * as part of the drag operation. This behavior may be enhanced in the future to - * allow more flexible configuration of select behavior. In some cases, such as - * with parallel coordinates, making a selection may cause related marks to - * change, in which case additional marks may also need to be rendered. This can - * be accomplished by listening for the select psuedo-events:

For example, to render the parent panel while selecting, thus - * re-rendering all sibling marks: - * - *
    .event("mousedown", pv.Behavior.drag())
- *     .event("select", function() this.parent)
- * - * This behavior may be enhanced in the future to allow more flexible - * configuration of the selection behavior. - * - * @extends pv.Behavior - * @see pv.Behavior.drag - */ -pv.Behavior.select = function() { - var scene, // scene context - index, // scene context - r, // region being selected - m1; // initial mouse position - - /** @private */ - function mousedown(d) { - index = this.index; - scene = this.scene; - m1 = this.mouse(); - r = d; - r.x = m1.x; - r.y = m1.y; - r.dx = r.dy = 0; - pv.Mark.dispatch("selectstart", scene, index); - } - - /** @private */ - function mousemove() { - if (!scene) return; - scene.mark.context(scene, index, function() { - var m2 = this.mouse(); - r.x = Math.max(0, Math.min(m1.x, m2.x)); - r.y = Math.max(0, Math.min(m1.y, m2.y)); - r.dx = Math.min(this.width(), Math.max(m2.x, m1.x)) - r.x; - r.dy = Math.min(this.height(), Math.max(m2.y, m1.y)) - r.y; - this.render(); - }); - pv.Mark.dispatch("select", scene, index); - } - - /** @private */ - function mouseup() { - if (!scene) return; - pv.Mark.dispatch("selectend", scene, index); - scene = null; - } - - pv.listen(window, "mousemove", mousemove); - pv.listen(window, "mouseup", mouseup); - return mousedown; -}; -/** - * Returns a new resize behavior to be registered on mousedown events. - * - * @class Implements interactive resizing of a selection starting with mousedown - * events. Register this behavior on selection handles that should be resizeable - * by the user, such for brushing and linking. This behavior can be used in - * tandom with {@link pv.Behavior.select} and {@link pv.Behavior.drag} to allow - * the selected region to be selected and dragged interactively. - * - *

After the initial mousedown event is triggered, this behavior listens for - * mousemove and mouseup events on the window. This allows resizing to continue - * even if the mouse temporarily leaves the assigned panel, or even the root - * panel. - * - *

This behavior requires that the data associated with the mark being - * resized have x, y, dx and dy attributes - * that correspond to the mark's location and dimensions in pixels. The mark's - * positional properties are not set directly by this behavior; instead, the - * positional properties should be defined as: - * - *

    .left(function(d) d.x)
- *     .top(function(d) d.y)
- *     .width(function(d) d.dx)
- *     .height(function(d) d.dy)
- * - * Thus, the behavior does not resize the mark directly, but instead updates the - * size by updating the assigned panel's underlying data. Note that if the - * positional properties are defined with bottom and right (rather than top and - * left), the resize behavior will be inverted, which will confuse users! - * - *

The resize behavior is bounded by the assigned mark's enclosing panel; the - * positional attributes are clamped such that the selection does not extend - * outside the panel's bounds. - * - *

The mark being resized is automatically re-rendered for each mouse event - * as part of the resize operation. This behavior may be enhanced in the future - * to allow more flexible configuration. In some cases, such as with parallel - * coordinates, resizing the selection may cause related marks to change, in - * which case additional marks may also need to be rendered. This can be - * accomplished by listening for the select psuedo-events:

For example, to render the parent panel while resizing, thus - * re-rendering all sibling marks: - * - *
    .event("mousedown", pv.Behavior.resize("left"))
- *     .event("resize", function() this.parent)
- * - * This behavior may be enhanced in the future to allow more flexible - * configuration of the selection behavior. - * - * @extends pv.Behavior - * @see pv.Behavior.select - * @see pv.Behavior.drag - */ -pv.Behavior.resize = function(side) { - var scene, // scene context - index, // scene context - r, // region being selected - m1; // initial mouse position - - /** @private */ - function mousedown(d) { - index = this.index; - scene = this.scene; - m1 = this.mouse(); - r = d; - switch (side) { - case "left": m1.x = r.x + r.dx; break; - case "right": m1.x = r.x; break; - case "top": m1.y = r.y + r.dy; break; - case "bottom": m1.y = r.y; break; - } - pv.Mark.dispatch("resizestart", scene, index); - } - - /** @private */ - function mousemove() { - if (!scene) return; - scene.mark.context(scene, index, function() { - var m2 = this.mouse(); - r.x = Math.max(0, Math.min(m1.x, m2.x)); - r.y = Math.max(0, Math.min(m1.y, m2.y)); - r.dx = Math.min(this.parent.width(), Math.max(m2.x, m1.x)) - r.x; - r.dy = Math.min(this.parent.height(), Math.max(m2.y, m1.y)) - r.y; - this.render(); - }); - pv.Mark.dispatch("resize", scene, index); - } - - /** @private */ - function mouseup() { - if (!scene) return; - pv.Mark.dispatch("resizeend", scene, index); - scene = null; - } - - pv.listen(window, "mousemove", mousemove); - pv.listen(window, "mouseup", mouseup); - return mousedown; -}; -/** - * Returns a new pan behavior to be registered on mousedown events. - * - * @class Implements interactive panning starting with mousedown events. - * Register this behavior on panels to allow panning. This behavior can be used - * in tandem with {@link pv.Behavior.zoom} to allow both panning and zooming: - * - *
    .event("mousedown", pv.Behavior.pan())
- *     .event("mousewheel", pv.Behavior.zoom())
- * - * The pan behavior currently supports only mouse events; support for keyboard - * shortcuts to improve accessibility may be added in the future. - * - *

After the initial mousedown event is triggered, this behavior listens for - * mousemove and mouseup events on the window. This allows panning to continue - * even if the mouse temporarily leaves the panel that is being panned, or even - * the root panel. - * - *

The implementation of this behavior relies on the panel's - * transform property, which specifies a matrix transformation that is - * applied to child marks. Note that the transform property only affects the - * panel's children, but not the panel itself; therefore the panel's fill and - * stroke will not change when the contents are panned. - * - *

Panels have transparent fill styles by default; this means that panels may - * not receive the initial mousedown event to start panning. To fix this - * problem, either given the panel a visible fill style (such as "white"), or - * set the events property to "all" such that the panel receives events - * despite its transparent fill. - * - *

The pan behavior has optional support for bounding. If enabled, the user - * will not be able to pan the panel outside of the initial bounds. This feature - * is designed to work in conjunction with the zoom behavior; otherwise, - * bounding the panel effectively disables all panning. - * - * @extends pv.Behavior - * @see pv.Behavior.zoom - * @see pv.Panel#transform - */ -pv.Behavior.pan = function() { - var scene, // scene context - index, // scene context - m1, // transformation matrix at the start of panning - v1, // mouse location at the start of panning - k, // inverse scale - bound; // whether to bound to the panel - - /** @private */ - function mousedown() { - index = this.index; - scene = this.scene; - v1 = pv.vector(pv.event.pageX, pv.event.pageY); - m1 = this.transform(); - k = 1 / (m1.k * this.scale); - if (bound) { - bound = { - x: (1 - m1.k) * this.width(), - y: (1 - m1.k) * this.height() - }; - } - } - - /** @private */ - function mousemove() { - if (!scene) return; - scene.mark.context(scene, index, function() { - var x = (pv.event.pageX - v1.x) * k, - y = (pv.event.pageY - v1.y) * k, - m = m1.translate(x, y); - if (bound) { - m.x = Math.max(bound.x, Math.min(0, m.x)); - m.y = Math.max(bound.y, Math.min(0, m.y)); - } - this.transform(m).render(); - }); - pv.Mark.dispatch("pan", scene, index); - } - - /** @private */ - function mouseup() { - scene = null; - } - - /** - * Sets or gets the bound parameter. If bounding is enabled, the user will not - * be able to pan outside the initial panel bounds; this typically applies - * only when the pan behavior is used in tandem with the zoom behavior. - * Bounding is not enabled by default. - * - *

Note: enabling bounding after panning has already occurred will not - * immediately reset the transform. Bounding should be enabled before the - * panning behavior is applied. - * - * @function - * @returns {pv.Behavior.pan} this, or the current bound parameter. - * @name pv.Behavior.pan.prototype.bound - * @param {boolean} [x] the new bound parameter. - */ - mousedown.bound = function(x) { - if (arguments.length) { - bound = Boolean(x); - return this; - } - return Boolean(bound); - }; - - pv.listen(window, "mousemove", mousemove); - pv.listen(window, "mouseup", mouseup); - return mousedown; -}; -/** - * Returns a new zoom behavior to be registered on mousewheel events. - * - * @class Implements interactive zooming using mousewheel events. Register this - * behavior on panels to allow zooming. This behavior can be used in tandem with - * {@link pv.Behavior.pan} to allow both panning and zooming: - * - *

    .event("mousedown", pv.Behavior.pan())
- *     .event("mousewheel", pv.Behavior.zoom())
- * - * The zoom behavior currently supports only mousewheel events; support for - * keyboard shortcuts and gesture events to improve accessibility may be added - * in the future. - * - *

The implementation of this behavior relies on the panel's - * transform property, which specifies a matrix transformation that is - * applied to child marks. Note that the transform property only affects the - * panel's children, but not the panel itself; therefore the panel's fill and - * stroke will not change when the contents are zoomed. The built-in support for - * transforms only supports uniform scaling and translates, which is sufficient - * for panning and zooming. Note that this is not a strict geometric - * transformation, as the lineWidth property is scale-aware: strokes - * are drawn at constant size independent of scale. - * - *

Panels have transparent fill styles by default; this means that panels may - * not receive mousewheel events to zoom. To fix this problem, either given the - * panel a visible fill style (such as "white"), or set the events - * property to "all" such that the panel receives events despite its transparent - * fill. - * - *

The zoom behavior has optional support for bounding. If enabled, the user - * will not be able to zoom out farther than the initial bounds. This feature is - * designed to work in conjunction with the pan behavior. - * - * @extends pv.Behavior - * @see pv.Panel#transform - * @see pv.Mark#scale - * @param {number} speed - */ -pv.Behavior.zoom = function(speed) { - var bound; // whether to bound to the panel - - if (!arguments.length) speed = 1 / 48; - - /** @private */ - function mousewheel() { - var v = this.mouse(), - k = pv.event.wheel * speed, - m = this.transform().translate(v.x, v.y) - .scale((k < 0) ? (1e3 / (1e3 - k)) : ((1e3 + k) / 1e3)) - .translate(-v.x, -v.y); - if (bound) { - m.k = Math.max(1, m.k); - m.x = Math.max((1 - m.k) * this.width(), Math.min(0, m.x)); - m.y = Math.max((1 - m.k) * this.height(), Math.min(0, m.y)); - } - this.transform(m).render(); - pv.Mark.dispatch("zoom", this.scene, this.index); - } - - /** - * Sets or gets the bound parameter. If bounding is enabled, the user will not - * be able to zoom out farther than the initial panel bounds. Bounding is not - * enabled by default. If this behavior is used in tandem with the pan - * behavior, both should use the same bound parameter. - * - *

Note: enabling bounding after zooming has already occurred will not - * immediately reset the transform. Bounding should be enabled before the zoom - * behavior is applied. - * - * @function - * @returns {pv.Behavior.zoom} this, or the current bound parameter. - * @name pv.Behavior.zoom.prototype.bound - * @param {boolean} [x] the new bound parameter. - */ - mousewheel.bound = function(x) { - if (arguments.length) { - bound = Boolean(x); - return this; - } - return Boolean(bound); - }; - - return mousewheel; -}; -/** - * @ignore - * @namespace - */ -pv.Geo = function() {}; -/** - * Abstract; not implemented. There is no explicit constructor; this class - * merely serves to document the representation used by {@link pv.Geo.scale}. - * - * @class Represents a pair of geographic coordinates. - * - * @name pv.Geo.LatLng - * @see pv.Geo.scale - */ - -/** - * The latitude coordinate in degrees; positive is North. - * - * @type number - * @name pv.Geo.LatLng.prototype.lat - */ - -/** - * The longitude coordinate in degrees; positive is East. - * - * @type number - * @name pv.Geo.LatLng.prototype.lng - */ -/** - * Abstract; not implemented. There is no explicit constructor; this class - * merely serves to document the representation used by {@link pv.Geo.scale}. - * - * @class Represents a geographic projection. This class provides the core - * implementation for {@link pv.Geo.scale}s, mapping between geographic - * coordinates (latitude and longitude) and normalized screen space in the range - * [-1,1]. The remaining mapping between normalized screen space and actual - * pixels is performed by pv.Geo.scale. - * - *

Many geographic projections have a point around which the projection is - * centered. Rather than have each implementation add support for a - * user-specified center point, the pv.Geo.scale translates the - * geographic coordinates relative to the center point for both the forward and - * inverse projection. - * - *

In general, this class should not be used directly, unless the desire is - * to implement a new geographic projection. Instead, use pv.Geo.scale. - * Implementations are not required to implement inverse projections, but are - * needed for some forms of interactivity. Also note that some inverse - * projections are ambiguous, such as the connecting points in Dymaxian maps. - * - * @name pv.Geo.Projection - * @see pv.Geo.scale - */ - -/** - * The forward projection. - * - * @function - * @name pv.Geo.Projection.prototype.project - * @param {pv.Geo.LatLng} latlng the latitude and longitude to project. - * @returns {pv.Vector} the xy-coordinates of the given point. - */ - -/** - * The inverse projection; optional. - * - * @function - * @name pv.Geo.Projection.prototype.invert - * @param {pv.Vector} xy the x- and y-coordinates to invert. - * @returns {pv.Geo.LatLng} the latitude and longitude of the given point. - */ -/** - * The built-in projections. - * - * @see pv.Geo.Projection - * @namespace - */ -pv.Geo.projections = { - - /** @see http://en.wikipedia.org/wiki/Mercator_projection */ - mercator: { - project: function(latlng) { - return { - x: latlng.lng / 180, - y: latlng.lat > 85 ? 1 : latlng.lat < -85 ? -1 - : Math.log(Math.tan(Math.PI / 4 - + pv.radians(latlng.lat) / 2)) / Math.PI - }; - }, - invert: function(xy) { - return { - lng: xy.x * 180, - lat: pv.degrees(2 * Math.atan(Math.exp(xy.y * Math.PI)) - Math.PI / 2) - }; - } - }, - - /** @see http://en.wikipedia.org/wiki/Gall-Peters_projection */ - "gall-peters": { - project: function(latlng) { - return { - x: latlng.lng / 180, - y: Math.sin(pv.radians(latlng.lat)) - }; - }, - invert: function(xy) { - return { - lng: xy.x * 180, - lat: pv.degrees(Math.asin(xy.y)) - }; - } - }, - - /** @see http://en.wikipedia.org/wiki/Sinusoidal_projection */ - sinusoidal: { - project: function(latlng) { - return { - x: pv.radians(latlng.lng) * Math.cos(pv.radians(latlng.lat)) / Math.PI, - y: latlng.lat / 90 - }; - }, - invert: function(xy) { - return { - lng: pv.degrees((xy.x * Math.PI) / Math.cos(xy.y * Math.PI / 2)), - lat: xy.y * 90 - }; - } - }, - - /** @see http://en.wikipedia.org/wiki/Aitoff_projection */ - aitoff: { - project: function(latlng) { - var l = pv.radians(latlng.lng), - f = pv.radians(latlng.lat), - a = Math.acos(Math.cos(f) * Math.cos(l / 2)); - return { - x: 2 * (a ? (Math.cos(f) * Math.sin(l / 2) * a / Math.sin(a)) : 0) / Math.PI, - y: 2 * (a ? (Math.sin(f) * a / Math.sin(a)) : 0) / Math.PI - }; - }, - invert: function(xy) { - var x = xy.x * Math.PI / 2, - y = xy.y * Math.PI / 2; - return { - lng: pv.degrees(x / Math.cos(y)), - lat: pv.degrees(y) - }; - } - }, - - /** @see http://en.wikipedia.org/wiki/Hammer_projection */ - hammer: { - project: function(latlng) { - var l = pv.radians(latlng.lng), - f = pv.radians(latlng.lat), - c = Math.sqrt(1 + Math.cos(f) * Math.cos(l / 2)); - return { - x: 2 * Math.SQRT2 * Math.cos(f) * Math.sin(l / 2) / c / 3, - y: Math.SQRT2 * Math.sin(f) / c / 1.5 - }; - }, - invert: function(xy) { - var x = xy.x * 3, - y = xy.y * 1.5, - z = Math.sqrt(1 - x * x / 16 - y * y / 4); - return { - lng: pv.degrees(2 * Math.atan2(z * x, 2 * (2 * z * z - 1))), - lat: pv.degrees(Math.asin(z * y)) - }; - } - }, - - /** The identity or "none" projection. */ - identity: { - project: function(latlng) { - return { - x: latlng.lng / 180, - y: latlng.lat / 90 - }; - }, - invert: function(xy) { - return { - lng: xy.x * 180, - lat: xy.y * 90 - }; - } - } -}; -/** - * Returns a geographic scale. The arguments to this constructor are optional, - * and equivalent to calling {@link #projection}. - * - * @class Represents a geographic scale; a mapping between latitude-longitude - * coordinates and screen pixel coordinates. By default, the domain is inferred - * from the geographic coordinates, so that the domain fills the output range. - * - *

Note that geographic scales are two-dimensional transformations, rather - * than the one-dimensional bidrectional mapping typical of other scales. - * Rather than mapping (for example) between a numeric domain and a numeric - * range, geographic scales map between two coordinate objects: {@link - * pv.Geo.LatLng} and {@link pv.Vector}. - * - * @param {pv.Geo.Projection} [p] optional projection. - * @see pv.Geo.scale#ticks - */ -pv.Geo.scale = function(p) { - var rmin = {x: 0, y: 0}, // default range minimum - rmax = {x: 1, y: 1}, // default range maximum - d = [], // default domain - j = pv.Geo.projections.identity, // domain <-> normalized range - x = pv.Scale.linear(-1, 1).range(0, 1), // normalized <-> range - y = pv.Scale.linear(-1, 1).range(1, 0), // normalized <-> range - c = {lng: 0, lat: 0}, // Center Point - lastLatLng, // cached latlng - lastPoint; // cached point - - /** @private */ - function scale(latlng) { - if (!lastLatLng - || (latlng.lng != lastLatLng.lng) - || (latlng.lat != lastLatLng.lat)) { - lastLatLng = latlng; - var p = project(latlng); - lastPoint = {x: x(p.x), y: y(p.y)}; - } - return lastPoint; - } - - /** @private */ - function project(latlng) { - var offset = {lng: latlng.lng - c.lng, lat: latlng.lat}; - return j.project(offset); - } - - /** @private */ - function invert(xy) { - var latlng = j.invert(xy); - latlng.lng += c.lng; - return latlng; - } - - /** Returns the projected x-coordinate. */ - scale.x = function(latlng) { - return scale(latlng).x; - }; - - /** Returns the projected y-coordinate. */ - scale.y = function(latlng) { - return scale(latlng).y; - }; - - /** - * Abstract; this is a local namespace on a given geographic scale. - * - * @namespace Tick functions for geographic scales. Because geographic scales - * represent two-dimensional transformations (as opposed to one-dimensional - * transformations typical of other scales), the tick values are similarly - * represented as two-dimensional coordinates in the input domain, i.e., - * {@link pv.Geo.LatLng} objects. - * - *

Also, note that non-rectilinear projections, such as sinsuoidal and - * aitoff, may not produce straight lines for constant longitude or constant - * latitude. Therefore the returned array of ticks is a two-dimensional array, - * sampling various latitudes as constant longitude, and vice versa. - * - *

The tick lines can therefore be approximated as polylines, either with - * "linear" or "cardinal" interpolation. This is not as accurate as drawing - * the true curve through the projection space, but is usually sufficient. - * - * @name pv.Geo.scale.prototype.ticks - * @see pv.Geo.scale - * @see pv.Geo.LatLng - * @see pv.Line#interpolate - */ - scale.ticks = { - - /** - * Returns longitude ticks. - * - * @function - * @param {number} [m] the desired number of ticks. - * @returns {array} a nested array of pv.Geo.LatLng ticks. - * @name pv.Geo.scale.prototype.ticks.prototype.lng - */ - lng: function(m) { - var lat, lng; - if (d.length > 1) { - var s = pv.Scale.linear(); - if (m == undefined) m = 10; - lat = s.domain(d, function(d) { return d.lat; }).ticks(m); - lng = s.domain(d, function(d) { return d.lng; }).ticks(m); - } else { - lat = pv.range(-80, 81, 10); - lng = pv.range(-180, 181, 10); - } - return lng.map(function(lng) { - return lat.map(function(lat) { - return {lat: lat, lng: lng}; - }); - }); - }, - - /** - * Returns latitude ticks. - * - * @function - * @param {number} [m] the desired number of ticks. - * @returns {array} a nested array of pv.Geo.LatLng ticks. - * @name pv.Geo.scale.prototype.ticks.prototype.lat - */ - lat: function(m) { - return pv.transpose(scale.ticks.lng(m)); - } - }; - - /** - * Inverts the specified value in the output range, returning the - * corresponding value in the input domain. This is frequently used to convert - * the mouse location (see {@link pv.Mark#mouse}) to a value in the input - * domain. Inversion is only supported for numeric ranges, and not colors. - * - *

Note that this method does not do any rounding or bounds checking. If - * the input domain is discrete (e.g., an array index), the returned value - * should be rounded. If the specified y value is outside the range, - * the returned value may be equivalently outside the input domain. - * - * @function - * @name pv.Geo.scale.prototype.invert - * @param {number} y a value in the output range (a pixel location). - * @returns {number} a value in the input domain. - */ - scale.invert = function(p) { - return invert({x: x.invert(p.x), y: y.invert(p.y)}); - }; - - /** - * Sets or gets the input domain. Note that unlike quantitative scales, the - * domain cannot be reduced to a simple rectangle (i.e., minimum and maximum - * values for latitude and longitude). Instead, the domain values must be - * projected to normalized space, effectively finding the domain in normalized - * space rather than in terms of latitude and longitude. Thus, changing the - * projection requires recomputing the normalized domain. - * - *

This method can be invoked several ways: - * - *

1. domain(values...) - * - *

Specifying the domain as a series of {@link pv.Geo.LatLng}s is the most - * explicit and recommended approach. However, if the domain values are - * derived from data, you may find the second method more appropriate. - * - *

2. domain(array, f) - * - *

Rather than enumerating the domain explicitly, you can specify a single - * argument of an array. In addition, you can specify an optional accessor - * function to extract the domain values (as {@link pv.Geo.LatLng}s) from the - * array. If the specified array has fewer than two elements, this scale will - * default to the full normalized domain. - * - *

2. domain() - * - *

Invoking the domain method with no arguments returns the - * current domain as an array. - * - * @function - * @name pv.Geo.scale.prototype.domain - * @param {...} domain... domain values. - * @returns {pv.Geo.scale} this, or the current domain. - */ - scale.domain = function(array, f) { - if (arguments.length) { - d = (array instanceof Array) - ? ((arguments.length > 1) ? pv.map(array, f) : array) - : Array.prototype.slice.call(arguments); - if (d.length > 1) { - var lngs = d.map(function(c) { return c.lng; }); - var lats = d.map(function(c) { return c.lat; }); - c = { - lng: (pv.max(lngs) + pv.min(lngs)) / 2, - lat: (pv.max(lats) + pv.min(lats)) / 2 - }; - var n = d.map(project); // normalized domain - x.domain(n, function(p) { return p.x; }); - y.domain(n, function(p) { return p.y; }); - } else { - c = {lng: 0, lat: 0}; - x.domain(-1, 1); - y.domain(-1, 1); - } - lastLatLng = null; // invalidate the cache - return this; - } - return d; - }; - - /** - * Sets or gets the output range. This method can be invoked several ways: - * - *

1. range(min, max) - * - *

If two objects are specified, the arguments should be {@link pv.Vector}s - * which specify the minimum and maximum values of the x- and y-coordinates - * explicitly. - * - *

2. range(width, height) - * - *

If two numbers are specified, the arguments specify the maximum values - * of the x- and y-coordinates explicitly; the minimum values are implicitly - * zero. - * - *

3. range() - * - *

Invoking the range method with no arguments returns the current - * range as an array of two {@link pv.Vector}s: the minimum (top-left) and - * maximum (bottom-right) values. - * - * @function - * @name pv.Geo.scale.prototype.range - * @param {...} range... range values. - * @returns {pv.Geo.scale} this, or the current range. - */ - scale.range = function(min, max) { - if (arguments.length) { - if (typeof min == "object") { - rmin = {x: Number(min.x), y: Number(min.y)}; - rmax = {x: Number(max.x), y: Number(max.y)}; - } else { - rmin = {x: 0, y: 0}; - rmax = {x: Number(min), y: Number(max)}; - } - x.range(rmin.x, rmax.x); - y.range(rmax.y, rmin.y); // XXX flipped? - lastLatLng = null; // invalidate the cache - return this; - } - return [rmin, rmax]; - }; - - /** - * Sets or gets the projection. This method can be invoked several ways: - * - *

1. projection(string) - * - *

Specifying a string sets the projection to the given named projection in - * {@link pv.Geo.projections}. If no such projection is found, the identity - * projection is used. - * - *

2. projection(object) - * - *

Specifying an object sets the projection to the given custom projection, - * which must implement the forward and inverse methods per the - * {@link pv.Geo.Projection} interface. - * - *

3. projection() - * - *

Invoking the projection method with no arguments returns the - * current object that defined the projection. - * - * @function - * @name pv.Scale.geo.prototype.projection - * @param {...} range... range values. - * @returns {pv.Scale.geo} this, or the current range. - */ - scale.projection = function(p) { - if (arguments.length) { - j = typeof p == "string" - ? pv.Geo.projections[p] || pv.Geo.projections.identity - : p; - return this.domain(d); // recompute normalized domain - } - return p; - }; - - /** - * Returns a view of this scale by the specified accessor function f. - * Given a scale g, g.by(function(d) d.foo) is equivalent to - * function(d) g(d.foo). This method should be used judiciously; it - * is typically more clear to invoke the scale directly, passing in the value - * to be scaled. - * - * @function - * @name pv.Geo.scale.prototype.by - * @param {function} f an accessor function. - * @returns {pv.Geo.scale} a view of this scale by the specified accessor - * function. - */ - scale.by = function(f) { - function by() { return scale(f.apply(this, arguments)); } - for (var method in scale) by[method] = scale[method]; - return by; - }; - - if (arguments.length) scale.projection(p); - return scale; -}; diff --git a/docs/lib/protovis-3.2/protovis-r3.2.js b/docs/lib/protovis-3.2/protovis-r3.2.js deleted file mode 100644 index 95bb3be0..00000000 --- a/docs/lib/protovis-3.2/protovis-r3.2.js +++ /dev/null @@ -1,277 +0,0 @@ -// fba9dc2 -var a;if(!Array.prototype.map)Array.prototype.map=function(b,c){for(var d=this.length,f=new Array(d),g=0;g>>0,f=0;f=d)throw new Error("reduce: no values, no initial value");}for(;f=0&&d=69&&m<100?1900:0)});return"([0-9]+)";case "%Y":q.push(function(m){g=m});return"([0-9]+)";case "%%":q.push(function(){}); -return"%"}return n});(f=f.match(o))&&f.forEach(function(n,m){q[m](n)});return new Date(g,h,i,j,l,k)};return c}; -pv.Format.time=function(b){function c(f){f=Number(f);switch(b){case "short":if(f>=31536E6)return(f/31536E6).toFixed(1)+" years";else if(f>=6048E5)return(f/6048E5).toFixed(1)+" weeks";else if(f>=864E5)return(f/864E5).toFixed(1)+" days";else if(f>=36E5)return(f/36E5).toFixed(1)+" hours";else if(f>=6E4)return(f/6E4).toFixed(1)+" minutes";return(f/1E3).toFixed(1)+" seconds";case "long":var g=[],h=f%36E5/6E4>>0;g.push(d("0",2,f%6E4/1E3>>0));if(f>=36E5){var i=f%864E5/36E5>>0;g.push(d("0",2,h));if(f>=864E5){g.push(d("0", -2,i));g.push(Math.floor(f/864E5).toFixed())}else g.push(i.toFixed())}else g.push(h.toFixed());return g.reverse().join(":")}}var d=pv.Format.pad;c.format=c;c.parse=function(f){switch(b){case "short":for(var g=/([0-9,.]+)\s*([a-z]+)/g,h,i=0;h=g.exec(f);){var j=parseFloat(h[0].replace(",","")),l=0;switch(h[2].toLowerCase()){case "year":case "years":l=31536E6;break;case "week":case "weeks":l=6048E5;break;case "day":case "days":l=864E5;break;case "hour":case "hours":l=36E5;break;case "minute":case "minutes":l= -6E4;break;case "second":case "seconds":l=1E3;break}i+=j*l}return i;case "long":h=f.replace(",","").split(":").reverse();i=0;if(h.length)i+=parseFloat(h[0])*1E3;if(h.length>1)i+=parseFloat(h[1])*6E4;if(h.length>2)i+=parseFloat(h[2])*36E5;if(h.length>3)i+=parseFloat(h[3])*864E5;return i}};return c}; -pv.Format.number=function(){function b(n){if(Infinity>h)n=Math.round(n*i)/i;var m=String(Math.abs(n)).split("."),r=m[0];n=n<0?"-":"";if(r.length>d)r=r.substring(r.length-d);if(k&&r.length3)r=r.replace(/\B(?=(?:\d{3})+(?!\d))/g,o);if(!k&&r.lengthd)m=m.substring(m.length-d);n=n[1]?Number("0."+n[1]):0;if(Infinity>h)n=Math.round(n*i)/i;return Math.round(m)+n};b.integerDigits=function(n,m){if(arguments.length){c=Number(n);d=arguments.length>1?Number(m):c;f=c+Math.floor(c/3)*o.length;return this}return[c,d]};b.fractionDigits=function(n,m){if(arguments.length){g= -Number(n);h=arguments.length>1?Number(m):g;i=Math.pow(10,h);return this}return[g,h]};b.integerPad=function(n){if(arguments.length){j=String(n);k=/\d/.test(j);return this}return j};b.fractionPad=function(n){if(arguments.length){l=String(n);return this}return l};b.decimal=function(n){if(arguments.length){q=String(n);return this}return q};b.group=function(n){if(arguments.length){o=n?String(n):"";f=c+Math.floor(c/3)*o.length;return this}return o};return b}; -pv.map=function(b,c){var d={};return c?b.map(function(f,g){d.index=g;return c.call(d,f)}):b.slice()};pv.repeat=function(b,c){if(arguments.length==1)c=2;return pv.blend(pv.range(c).map(function(){return b}))};pv.cross=function(b,c){for(var d=[],f=0,g=b.length,h=c.length;fc){b.length=d;for(var f=c;fc?1:0}; -pv.reverseOrder=function(b,c){return cb?1:0};pv.search=function(b,c,d){if(!d)d=pv.identity;for(var f=0,g=b.length-1;f<=g;){var h=f+g>>1,i=d(b[h]);if(ic)g=h-1;else return h}return-f-1};pv.search.index=function(b,c,d){b=pv.search(b,c,d);return b<0?-b-1:b}; -pv.range=function(b,c,d){if(arguments.length==1){c=b;b=0}if(d==undefined)d=1;if((c-b)/d==Infinity)throw new Error("range must be finite");var f=[],g=0,h;if(d<0)for(;(h=b+d*g++)>c;)f.push(h);else for(;(h=b+d*g++)f){f=i;d=h}}return d}; -pv.min=function(b,c){if(c==pv.index)return 0;return Math.min.apply(null,c?pv.map(b,c):b)};pv.min.index=function(b,c){if(!b.length)return-1;if(c==pv.index)return 0;if(!c)c=pv.identity;for(var d=0,f=Infinity,g={},h=0;h0?Math.pow(c,Math.floor(pv.log(b,c))):-Math.pow(c,-Math.floor(-pv.log(-b,c)))};pv.logCeil=function(b,c){return b>0?Math.pow(c,Math.ceil(pv.log(b,c))):-Math.pow(c,-Math.ceil(-pv.log(-b,c)))}; -(function(){var b=Math.PI/180,c=180/Math.PI;pv.radians=function(d){return b*d};pv.degrees=function(d){return c*d}})();pv.keys=function(b){var c=[];for(var d in b)c.push(d);return c};pv.entries=function(b){var c=[];for(var d in b)c.push({key:d,value:b[d]});return c};pv.values=function(b){var c=[];for(var d in b)c.push(b[d]);return c};pv.dict=function(b,c){for(var d={},f={},g=0;g=94608E6){n=31536E6;t="%Y";p=function(w){w.setFullYear(w.getFullYear()+v)}}else if(u>=7776E6){n=2592E6;t="%m/%Y";p=function(w){w.setMonth(w.getMonth()+v)}}else if(u>=18144E5){n=6048E5;t="%m/%d";p=function(w){w.setDate(w.getDate()+7*v)}}else if(u>=2592E5){n=864E5;t="%m/%d";p=function(w){w.setDate(w.getDate()+v)}}else if(u>=108E5){n=36E5;t="%I:%M %p";p=function(w){w.setHours(w.getHours()+ -v)}}else if(u>=18E4){n=6E4;t="%I:%M %p";p=function(w){w.setMinutes(w.getMinutes()+v)}}else if(u>=3E3){n=1E3;t="%I:%M:%S";p=function(w){w.setSeconds(w.getSeconds()+v)}}else{n=1;t="%S.%Qs";p=function(w){w.setTime(w.getTime()+v)}}q=pv.Format.date(t);s=new Date(s);t=[];x(s,n);u=u/n;if(u>10)switch(n){case 36E5:v=u>20?6:3;s.setHours(Math.floor(s.getHours()/v)*v);break;case 2592E6:v=3;s.setMonth(Math.floor(s.getMonth()/v)*v);break;case 6E4:v=u>30?15:u>15?10:5;s.setMinutes(Math.floor(s.getMinutes()/v)*v); -break;case 1E3:v=u>90?15:u>60?10:5;s.setSeconds(Math.floor(s.getSeconds()/v)*v);break;case 1:v=u>1E3?250:u>200?100:u>100?50:u>50?25:5;s.setMilliseconds(Math.floor(s.getMilliseconds()/v)*v);break;default:v=pv.logCeil(u/15,10);if(u/v<2)v/=5;else if(u/v<5)v/=2;s.setFullYear(Math.floor(s.getFullYear()/v)*v);break}for(;;){p(s);if(s>m)break;t.push(new Date(s))}return r?t.reverse():t}arguments.length||(o=10);v=pv.logFloor(u/o,10);n=o/(u/v);if(n<=0.15)v*=10;else if(n<=0.35)v*=5;else if(n<=0.75)v*=2;n=Math.ceil(s/ -v)*v;m=Math.floor(m/v)*v;q=pv.Format.number().fractionDigits(Math.max(0,-Math.floor(pv.log(v,10)+0.01)));m=pv.range(n,m+v,v);return r?m.reverse():m};c.tickFormat=function(o){return q(o)};c.nice=function(){if(d.length!=2)return this;var o=d[0],n=d[d.length-1],m=n0;i--)k.push(-g(-j)*i);else{for(;jh[1];l--);return k.slice(j,l)};b.tickFormat=function(h){return h.toPrecision(1)}; -b.nice=function(){var h=b.domain();return b.domain(pv.logFloor(h[0],c),pv.logCeil(h[1],c))};b.base=function(h){if(arguments.length){c=Number(h);d=Math.log(c);b.transform(f,g);return this}return c};b.domain.apply(b,arguments);return b.base(10)};pv.Scale.root=function(){var b=pv.Scale.quantitative();b.power=function(c){if(arguments.length){var d=Number(c),f=1/d;b.transform(function(g){return Math.pow(g,f)},function(g){return Math.pow(g,d)});return this}return d};b.domain.apply(b,arguments);return b.power(2)}; -pv.Scale.ordinal=function(){function b(g){g in d||(d[g]=c.push(g)-1);return f[d[g]%f.length]}var c=[],d={},f=[];b.domain=function(g,h){if(arguments.length){g=g instanceof Array?arguments.length>1?pv.map(g,h):g:Array.prototype.slice.call(arguments);c=[];for(var i={},j=0;j1?pv.map(g,h):g:Array.prototype.slice.call(arguments); -if(typeof f[0]=="string")f=f.map(pv.color);return this}return f};b.split=function(g,h){var i=(h-g)/this.domain().length;f=pv.range(g+i/2,h,i);return this};b.splitFlush=function(g,h){var i=this.domain().length,j=(h-g)/(i-1);f=i==1?[(g+h)/2]:pv.range(g,h+j/2,j);return this};b.splitBanded=function(g,h,i){if(arguments.length<3)i=1;if(i<0){var j=this.domain().length;j=(h-g- -i*j)/(j+1);f=pv.range(g+j,h,j-i);f.band=-i}else{j=(h-g)/(this.domain().length+(1-i));f=pv.range(g+j*(1-i),h,j);f.band=j*i}return this}; -b.by=function(g){function h(){return b(g.apply(this,arguments))}for(var i in b)h[i]=b[i];return h};b.domain.apply(b,arguments);return b}; -pv.Scale.quantile=function(){function b(i){return h(Math.max(0,Math.min(d,pv.search.index(f,i)-1))/d)}var c=-1,d=-1,f=[],g=[],h=pv.Scale.linear();b.quantiles=function(i){if(arguments.length){c=Number(i);if(c<0){f=[g[0]].concat(g);d=g.length-1}else{f=[];f[0]=g[0];for(var j=1;j<=c;j++)f[j]=g[~~(j*(g.length-1)/c)];d=c-1}return this}return f};b.domain=function(i,j){if(arguments.length){g=i instanceof Array?pv.map(i,j):Array.prototype.slice.call(arguments);g.sort(pv.naturalOrder);b.quantiles(c);return this}return g}; -b.range=function(){if(arguments.length){h.range.apply(h,arguments);return this}return h.range()};b.by=function(i){function j(){return b(i.apply(this,arguments))}for(var l in b)j[l]=b[l];return j};b.domain.apply(b,arguments);return b}; -pv.histogram=function(b,c){var d=true;return{bins:function(f){var g=pv.map(b,c),h=[];arguments.length||(f=pv.Scale.linear(g).ticks());for(var i=0;i360)j-=360;else if(j<0)j+=360;if(j<60)return i+(h-i)*j/60;if(j<180)return h;if(j<240)return i+(h-i)*(240-j)/60;return i}function c(j){return Math.round(b(j)*255)}var d=this.h,f=this.s,g=this.l;d%=360;if(d<0)d+=360;f=Math.max(0,Math.min(f,1));g=Math.max(0,Math.min(g,1));var h=g<=0.5?g*(1+f):g+f-g*f,i=2*g-h;return pv.rgb(c(d+120),c(d),c(d-120),this.a)}; -pv.Color.names={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400", -darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc", -ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a", -lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1", -moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57", -seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32",transparent:pv.Color.transparent=pv.rgb(0,0,0,0)};(function(){var b=pv.Color.names;for(var c in b)b[c]=pv.color(b[c])})(); -pv.colors=function(){var b=pv.Scale.ordinal();b.range.apply(b,arguments);return b};pv.Colors={};pv.Colors.category10=function(){var b=pv.colors("#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf");b.domain.apply(b,arguments);return b}; -pv.Colors.category20=function(){var b=pv.colors("#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5");b.domain.apply(b,arguments);return b}; -pv.Colors.category19=function(){var b=pv.colors("#9c9ede","#7375b5","#4a5584","#cedb9c","#b5cf6b","#8ca252","#637939","#e7cb94","#e7ba52","#bd9e39","#8c6d31","#e7969c","#d6616b","#ad494a","#843c39","#de9ed6","#ce6dbd","#a55194","#7b4173");b.domain.apply(b,arguments);return b};pv.ramp=function(){var b=pv.Scale.linear();b.range.apply(b,arguments);return b}; -pv.Scene=pv.SvgScene={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml",scale:1,events:["DOMMouseScroll","mousewheel","mousedown","mouseup","mouseover","mouseout","mousemove","click","dblclick"],implicit:{svg:{"shape-rendering":"auto","pointer-events":"painted",x:0,y:0,dy:0,"text-anchor":"start",transform:"translate(0,0)",fill:"none","fill-opacity":1,stroke:"none","stroke-opacity":1,"stroke-width":1.5,"stroke-linejoin":"miter"}, -css:{font:"10px sans-serif"}}};pv.SvgScene.updateAll=function(b){if(b.length&&b[0].reverse&&b.type!="line"&&b.type!="area"){for(var c=pv.extend(b),d=0,f=b.length-1;f>=0;d++,f--)c[d]=b[f];b=c}this.removeSiblings(this[b.type](b))};pv.SvgScene.create=function(b){return document.createElementNS(this.svg,b)}; -pv.SvgScene.expect=function(b,c,d,f){if(b){if(b.tagName=="a")b=b.firstChild;if(b.tagName!=c){c=this.create(c);b.parentNode.replaceChild(c,b);b=c}}else b=this.create(c);for(var g in d){c=d[g];if(c==this.implicit.svg[g])c=null;c==null?b.removeAttribute(g):b.setAttribute(g,c)}for(g in f){c=f[g];if(c==this.implicit.css[g])c=null;if(c==null)b.style.removeProperty(g);else b.style[g]=c}return b}; -pv.SvgScene.append=function(b,c,d){b.$scene={scenes:c,index:d};b=this.title(b,c[d]);b.parentNode||c.$g.appendChild(b);return b.nextSibling};pv.SvgScene.title=function(b,c){var d=b.parentNode;if(d&&d.tagName!="a")d=null;if(c.title){if(!d){d=this.create("a");b.parentNode&&b.parentNode.replaceChild(d,b);d.appendChild(b)}d.setAttributeNS(this.xlink,"title",c.title);return d}d&&d.parentNode.replaceChild(b,d);return b}; -pv.SvgScene.dispatch=pv.listener(function(b){var c=b.target.$scene;if(c){var d=b.type;switch(d){case "DOMMouseScroll":d="mousewheel";b.wheel=-480*b.detail;break;case "mousewheel":b.wheel=(window.opera?12:1)*b.wheelDelta;break}pv.Mark.dispatch(d,c.scenes,c.index)&&b.preventDefault()}});pv.SvgScene.removeSiblings=function(b){for(;b;){var c=b.nextSibling;b.parentNode.removeChild(b);b=c}};pv.SvgScene.undefined=function(){}; -pv.SvgScene.pathBasis=function(){function b(f,g,h,i,j){return{x:f[0]*g.left+f[1]*h.left+f[2]*i.left+f[3]*j.left,y:f[0]*g.top+f[1]*h.top+f[2]*i.top+f[3]*j.top}}var c=[[1/6,2/3,1/6,0],[0,2/3,1/3,0],[0,1/3,2/3,0],[0,1/6,2/3,1/6]],d=function(f,g,h,i){var j=b(c[1],f,g,h,i),l=b(c[2],f,g,h,i);f=b(c[3],f,g,h,i);return"C"+j.x+","+j.y+","+l.x+","+l.y+","+f.x+","+f.y};d.segment=function(f,g,h,i){var j=b(c[0],f,g,h,i),l=b(c[1],f,g,h,i),k=b(c[2],f,g,h,i);f=b(c[3],f,g,h,i);return"M"+j.x+","+j.y+"C"+l.x+","+l.y+ -","+k.x+","+k.y+","+f.x+","+f.y};return d}();pv.SvgScene.curveBasis=function(b){if(b.length<=2)return"";var c="",d=b[0],f=d,g=d,h=b[1];c+=this.pathBasis(d,f,g,h);for(var i=2;i1){j=c[1];h=b[l];l++;f+="C"+(g.left+i.x)+","+(g.top+i.y)+","+(h.left-j.x)+","+(h.top-j.y)+","+h.left+","+h.top;for(g=2;g9){l=3/Math.sqrt(l);f[h]= -l*i*d[h];f[h+1]=l*j*d[h]}}for(h=0;h2&&(g.interpolate=="basis"||g.interpolate=="cardinal"||g.interpolate=="monotone")?d:c)(k,q-1));k=q-1}}if(!j.length)return f;f=this.expect(f,"path",{"shape-rendering":g.antialias?null:"crispEdges","pointer-events":g.events,cursor:g.cursor,d:"M"+j.join("ZM")+"Z",fill:h.color,"fill-opacity":h.opacity|| -null,stroke:i.color,"stroke-opacity":i.opacity||null,"stroke-width":i.opacity?g.lineWidth/this.scale:null});return this.append(f,b,0)}; -pv.SvgScene.areaSegment=function(b){var c=b.$g.firstChild,d=b[0],f,g;if(d.interpolate=="basis"||d.interpolate=="cardinal"||d.interpolate=="monotone"){f=[];g=[];for(var h=0,i=b.length;h2&&(d.interpolate=="basis"||d.interpolate=="cardinal"||d.interpolate=="monotone"))switch(d.interpolate){case "basis":h+=this.curveBasis(b);break;case "cardinal":h+=this.curveCardinal(b,d.tension);break;case "monotone":h+=this.curveMonotone(b); -break}else for(var i=1;i1)break;return"A"+f+","+f+" 0 0,"+d+" "+c.left+","+c.top;case "step-before":return"V"+c.top+"H"+c.left;case "step-after":return"H"+c.left+"V"+c.top}return"L"+c.left+","+c.top};pv.SvgScene.lineIntersect=function(b,c,d,f){return b.plus(c.times(d.minus(b).dot(f.perp())/c.dot(f.perp())))}; -pv.SvgScene.pathJoin=function(b,c,d,f){var g=pv.vector(c.left,c.top);d=pv.vector(d.left,d.top);var h=d.minus(g),i=h.perp().norm(),j=i.times(c.lineWidth/(2*this.scale));c=g.plus(j);var l=d.plus(j),k=d.minus(j);j=g.minus(j);if(b&&b.visible){b=g.minus(b.left,b.top).perp().norm().plus(i);j=this.lineIntersect(g,b,j,h);c=this.lineIntersect(g,b,c,h)}if(f&&f.visible){f=pv.vector(f.left,f.top).minus(d).perp().norm().plus(i);k=this.lineIntersect(d,f,k,h);l=this.lineIntersect(d,f,l,h)}return"M"+c.x+","+c.y+ -"L"+l.x+","+l.y+" "+k.x+","+k.y+" "+j.x+","+j.y}; -pv.SvgScene.panel=function(b){for(var c=b.$g,d=c&&c.firstChild,f=0;f=2*Math.PI)i=i?"M0,"+j+"A"+j+","+j+" 0 1,1 0,"+-j+"A"+j+","+j+" 0 1,1 0,"+j+"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"Z":"M0,"+j+"A"+j+","+j+" 0 1,1 0,"+-j+"A"+j+","+j+" 0 1,1 0,"+j+"Z";else{var k=Math.min(f.startAngle,f.endAngle),q=Math.max(f.startAngle,f.endAngle), -o=Math.cos(k),n=Math.cos(q);k=Math.sin(k);q=Math.sin(q);i=i?"M"+j*o+","+j*k+"A"+j+","+j+" 0 "+(l1?c:null)}; -a.anchor=function(b){function c(g){for(var h=d,i=[];!(f=h.scene);){g=g.parent;i.push({index:g.index,childIndex:h.childIndex});h=h.parent}for(;i.length;){g=i.pop();f=f[g.index].children[g.childIndex]}if(d.hasOwnProperty("index")){i=pv.extend(f[d.index]);i.right=i.top=i.left=i.bottom=0;return[i]}return f}var d=this,f;b||(b="center");return(new pv.Anchor(this)).name(b).def("$mark.anchor",function(){f=this.scene.target=c(this)}).data(function(){return f.map(function(g){return g.data})}).visible(function(){return f[this.index].visible}).left(function(){var g= -f[this.index],h=g.width||0;switch(this.name()){case "bottom":case "top":case "center":return g.left+h/2;case "left":return null}return g.left+h}).top(function(){var g=f[this.index],h=g.height||0;switch(this.name()){case "left":case "right":case "center":return g.top+h/2;case "top":return null}return g.top+h}).right(function(){var g=f[this.index];return this.name()=="left"?g.right+(g.width||0):null}).bottom(function(){var g=f[this.index];return this.name()=="top"?g.bottom+(g.height||0):null}).textAlign(function(){switch(this.name()){case "bottom":case "top":case "center":return"center"; -case "right":return"right"}return"left"}).textBaseline(function(){switch(this.name()){case "right":case "left":case "center":return"middle";case "top":return"top"}return"bottom"})};a.anchorTarget=function(){return this.proto.anchorTarget()};a.margin=function(b){return this.left(b).right(b).top(b).bottom(b)};a.instance=function(b){var c=this.scene||this.parent.instance(-1).children[this.childIndex],d=!arguments.length||this.hasOwnProperty("index")?this.index:b;return c[d<0?c.length-1:d]};a.first=function(){return this.scene[0]}; -a.last=function(){return this.scene[this.scene.length-1]};a.sibling=function(){return this.index==0?null:this.scene[this.index-1]};a.cousin=function(){var b=this.parent;return(b=b&&b.sibling())&&b.children?b.children[this.childIndex][this.index]:null}; -a.render=function(){function b(i,j,l){i.scale=l;if(j=0;k--){var q=l[k];if(!(q.name in c)){c[q.name]=q;switch(q.name){case "data":f=q;break;case "visible":g=q;break;default:d[q.type].push(q);break}}}while(j=j.proto)}var c={},d=[[],[],[],[]],f,g;b(this);b(this.defaults);d[1].reverse();d[3].reverse();var h=this;do for(var i in h.properties)i in c||d[2].push(c[i]={name:i,type:2,value:null});while(h=h.proto);h=d[0].concat(d[1]);for(i=0;ih.id)d[g.name]={id:0,value:g.type&1?g.value.apply(this,c):g.value}}}d=this.binds.data;d=d.type&1?d.value.apply(this,c):d.value;c.unshift(null); -b.length=d.length;for(f=0;f0;k--){n=m[k];n.scale=q;q*=n.scene[n.index].transform.k}if(o.children){k=0;for(m=o.children.length;k=3*Math.PI/2};pv.Wedge.prototype.buildImplied=function(b){if(b.angle==null)b.angle=b.endAngle-b.startAngle;else if(b.endAngle==null)b.endAngle=b.startAngle+b.angle;pv.Mark.prototype.buildImplied.call(this,b)};pv.simulation=function(b){return new pv.Simulation(b)};pv.Simulation=function(b){for(var c=0;c=s,t=q.y>=u;k.leaf=false;switch((t<<1)+x){case 0:k=k.c1||(k.c1=new pv.Quadtree.Node);break;case 1:k=k.c2||(k.c2=new pv.Quadtree.Node);break;case 2:k=k.c3||(k.c3=new pv.Quadtree.Node);break;case 3:k=k.c4||(k.c4=new pv.Quadtree.Node); -break}if(x)o=s;else m=s;if(t)n=u;else r=u;c(k,q,o,n,m,r)}var f,g=Number.POSITIVE_INFINITY,h=g,i=Number.NEGATIVE_INFINITY,j=i;for(f=b;f;f=f.next){if(f.xi)i=f.x;if(f.y>j)j=f.y}f=i-g;var l=j-h;if(f>l)j=h+f;else i=g+l;this.xMin=g;this.yMin=h;this.xMax=i;this.yMax=j;this.root=new pv.Quadtree.Node;for(f=b;f;f=f.next)c(this.root,f,g,h,i,j)};pv.Quadtree.Node=function(){this.leaf=true;this.p=this.c4=this.c3=this.c2=this.c1=null};pv.Force={}; -pv.Force.charge=function(b){function c(k){function q(m){c(m);k.cn+=m.cn;o+=m.cn*m.cx;n+=m.cn*m.cy}var o=0,n=0;k.cn=0;if(!k.leaf){k.c1&&q(k.c1);k.c2&&q(k.c2);k.c3&&q(k.c3);k.c4&&q(k.c4)}if(k.p){k.cn+=b;o+=b*k.p.x;n+=b*k.p.y}k.cx=o/k.cn;k.cy=n/k.cn}function d(k,q,o,n,m,r){var s=k.cx-q.x,u=k.cy-q.y,x=1/Math.sqrt(s*s+u*u);if(k.leaf&&k.p!=q||(m-o)*xg)x=g;k=k.cn*x*x*x;s=s*k;u=u*k;q.fx+=s;q.fy+=u}}else if(!k.leaf){var t=(o+m)*0.5,p=(n+r)*0.5;k.c1&&d(k.c1,q,o,n,t,p);k.c2&&d(k.c2,q,t,n, -m,p);k.c3&&d(k.c3,q,o,p,t,r);k.c4&&d(k.c4,q,t,p,m,r);if(!(xg)x=g;if(k.p&&k.p!=q){k=b*x*x*x;s=s*k;u=u*k;q.fx+=s;q.fy+=u}}}}var f=2,g=1/f,h=500,i=1/h,j=0.9,l={};arguments.length||(b=-40);l.constant=function(k){if(arguments.length){b=Number(k);return l}return b};l.domain=function(k,q){if(arguments.length){f=Number(k);g=1/f;h=Number(q);i=1/h;return l}return[f,h]};l.theta=function(k){if(arguments.length){j=Number(k);return l}return j};l.apply=function(k,q){c(q.root);for(k=k;k;k=k.next)d(q.root, -k,q.xMin,q.yMin,q.xMax,q.yMax)};return l};pv.Force.drag=function(b){var c={};arguments.length||(b=0.1);c.constant=function(d){if(arguments.length){b=d;return c}return b};c.apply=function(d){if(b)for(d=d;d;d=d.next){d.fx-=b*d.vx;d.fy-=b*d.vy}};return c}; -pv.Force.spring=function(b){var c=0.1,d=20,f,g,h={};arguments.length||(b=0.1);h.links=function(i){if(arguments.length){f=i;g=i.map(function(j){return 1/Math.sqrt(Math.max(j.sourceNode.linkDegree,j.targetNode.linkDegree))});return h}return f};h.constant=function(i){if(arguments.length){b=Number(i);return h}return b};h.damping=function(i){if(arguments.length){c=Number(i);return h}return c};h.length=function(i){if(arguments.length){d=Number(i);return h}return d};h.apply=function(){for(var i=0;ig,p=sh){k.c1&&t&&c(k.c1,q,o,n,s,u);k.c2&&p&&c(k.c2,q,s,n,m,u)}if(x){k.c3&&t&&c(k.c3,q,o,u,s,r);k.c4&&p&&c(k.c4,q,s,u,m,r)}}if(k.p&&k.p!=q){o=q.x-k.p.x;n=q.y-k.p.y;m=Math.sqrt(o*o+n*n);r=f+b(k.p);if(mm)m=n}for(var r=0;rc.max?c.max:g.x;if(d)for(g=f;g;g=g.next)g.y=g.yd.max?d.max:g.y};return b};pv.Layout=function(){pv.Panel.call(this)};pv.Layout.prototype=pv.extend(pv.Panel); -pv.Layout.prototype.property=function(b,c){if(!this.hasOwnProperty("properties"))this.properties=pv.extend(this.properties);this.properties[b]=true;this.propertyMethod(b,false,pv.Mark.cast[b]=c);return this}; -pv.Layout.Network=function(){pv.Layout.call(this);var b=this;this.$id=pv.id();(this.node=(new pv.Mark).data(function(){return b.nodes()}).strokeStyle("#1f77b4").fillStyle("#fff").left(function(c){return c.x}).top(function(c){return c.y})).parent=this;this.link=(new pv.Mark).extend(this.node).data(function(c){return[c.sourceNode,c.targetNode]}).fillStyle(null).lineWidth(function(c,d){return d.linkValue*1.5}).strokeStyle("rgba(0,0,0,.2)");this.link.add=function(c){return b.add(pv.Panel).data(function(){return b.links()}).add(c).extend(this)}; -(this.label=(new pv.Mark).extend(this.node).textMargin(7).textBaseline("middle").text(function(c){return c.nodeName||c.nodeValue}).textAngle(function(c){c=c.midAngle;return pv.Wedge.upright(c)?c:c+Math.PI}).textAlign(function(c){return pv.Wedge.upright(c.midAngle)?"left":"right"})).parent=this}; -pv.Layout.Network.prototype=pv.extend(pv.Layout).property("nodes",function(b){return b.map(function(c,d){if(typeof c!="object")c={nodeValue:c};c.index=d;c.linkDegree=0;return c})}).property("links",function(b){return b.map(function(c){if(isNaN(c.linkValue))c.linkValue=isNaN(c.value)?1:c.value;return c})});pv.Layout.Network.prototype.reset=function(){this.$id=pv.id();return this}; -pv.Layout.Network.prototype.buildProperties=function(b,c){if((b.$id||0)=this.$id)return true;b.$id=this.$id;b.links.forEach(function(c){var d=c.linkValue;(c.sourceNode||(c.sourceNode=b.nodes[c.source])).linkDegree+=d;(c.targetNode||(c.targetNode=b.nodes[c.target])).linkDegree+=d})}; -pv.Layout.Hierarchy=function(){pv.Layout.Network.call(this);this.link.strokeStyle("#ccc")};pv.Layout.Hierarchy.prototype=pv.extend(pv.Layout.Network);pv.Layout.Hierarchy.prototype.buildImplied=function(b){if(!b.links)b.links=pv.Layout.Hierarchy.links.call(this);pv.Layout.Network.prototype.buildImplied.call(this,b)};pv.Layout.Hierarchy.links=function(){return this.nodes().filter(function(b){return b.parentNode}).map(function(b){return{sourceNode:b,targetNode:b.parentNode,linkValue:1}})}; -pv.Layout.Hierarchy.NodeLink={buildImplied:function(b){function c(m){return m.parentNode?m.depth*(o-q)+q:0}function d(m){return m.parentNode?(m.breadth-0.25)*2*Math.PI:0}function f(m){switch(i){case "left":return m.depth*l;case "right":return l-m.depth*l;case "top":return m.breadth*l;case "bottom":return l-m.breadth*l;case "radial":return l/2+c(m)*Math.cos(m.midAngle)}}function g(m){switch(i){case "left":return m.breadth*k;case "right":return k-m.breadth*k;case "top":return m.depth*k;case "bottom":return k- -m.depth*k;case "radial":return k/2+c(m)*Math.sin(m.midAngle)}}var h=b.nodes,i=b.orient,j=/^(top|bottom)$/.test(i),l=b.width,k=b.height;if(i=="radial"){var q=b.innerRadius,o=b.outerRadius;if(q==null)q=0;if(o==null)o=Math.min(l,k)/2}for(b=0;bb.dy?0:-Math.PI/2});(this.leaf=(new pv.Mark).extend(this.node).fillStyle(null).strokeStyle(null).visible(function(b){return!b.firstChild})).parent= -this;delete this.link};pv.Layout.Treemap.prototype=pv.extend(pv.Layout.Hierarchy).property("round",Boolean).property("paddingLeft",Number).property("paddingRight",Number).property("paddingTop",Number).property("paddingBottom",Number).property("mode",String).property("order",String);a=pv.Layout.Treemap.prototype;a.defaults=(new pv.Layout.Treemap).extend(pv.Layout.Hierarchy.prototype.defaults).mode("squarify").order("ascending");a.padding=function(b){return this.paddingLeft(b).paddingRight(b).paddingTop(b).paddingBottom(b)}; -a.$size=function(b){return Number(b.nodeValue)};a.size=function(b){this.$size=pv.functor(b);return this}; -a.buildImplied=function(b){function c(r,s,u,x,t,p,v){for(var w=0,y=0;wu)u=v;t+=v}t*=t;s*=s;return Math.max(s*u/t,t/(s*x))}function f(r,s){function u(A){var D=p==y,G=pv.sum(A,o),E=y?n(G/y):0;c(A,G,D,x,t,D?p:E,D?E:v);if(D){t+=E;v-=E}else{x+= -E;p-=E}y=Math.min(p,v);return D}var x=r.x+j,t=r.y+k,p=r.dx-j-l,v=r.dy-k-q;if(m!="squarify")c(r.childNodes,r.size,m=="slice"?true:m=="dice"?false:s&1,x,t,p,v);else{var w=[];s=Infinity;var y=Math.min(p,v),z=p*v/r.size;if(!(r.size<=0)){r.visitBefore(function(A){A.size*=z});for(r=r.childNodes.slice();r.length;){var C=r[r.length-1];if(C.size){w.push(C);z=d(w,y);if(z<=s){r.pop();s=z}else{w.pop();u(w);w.length=0;s=Infinity}}else r.pop()}if(u(w))for(s=0;s0){i(l(C,p,v),p,B);A+=B;D+=B}G+=C.mod;A+=y.mod;E+=w.mod;D+=z.mod;C=h(C);y=g(y)}if(C&&!h(z)){z.thread=C;z.mod+=G-D}if(y&&!g(w)){w.thread=y;w.mod+=A-E;v=p}}return v}function g(p){return p.firstChild||p.thread}function h(p){return p.lastChild||p.thread}function i(p,v,w){var y=v.number-p.number;v.change-=w/y;v.shift+=w;p.change+= -w/y;v.prelim+=w;v.mod+=w}function j(p){var v=0,w=0;for(p=p.lastChild;p;p=p.previousSibling){p.prelim+=v;p.mod+=v;w+=p.change;v+=p.shift+w}}function l(p,v,w){return p.ancestor.parentNode==v.parentNode?p.ancestor:w}function k(p,v){return(v?1:u+1)/(m=="radial"?p:1)}function q(p){return m=="radial"?p.breadth/r:0}function o(p){switch(m){case "left":return p.depth;case "right":return x-p.depth;case "top":case "bottom":return p.breadth+x/2;case "radial":return x/2+p.depth*Math.cos(q(p))}}function n(p){switch(m){case "left":case "right":return p.breadth+ -t/2;case "top":return p.depth;case "bottom":return t-p.depth;case "radial":return t/2+p.depth*Math.sin(q(p))}}if(!pv.Layout.Hierarchy.prototype.buildImplied.call(this,b)){var m=b.orient,r=b.depth,s=b.breadth,u=b.group,x=b.width,t=b.height;b=b.nodes[0];b.visitAfter(function(p,v){p.ancestor=p;p.prelim=0;p.mod=0;p.change=0;p.shift=0;p.number=p.previousSibling?p.previousSibling.number+1:0;p.depth=v});c(b);d(b,-b.prelim,0);b.visitAfter(function(p){p.breadth*=s;p.depth*=r;p.midAngle=q(p);p.x=o(p);p.y=n(p); -if(p.firstChild)p.midAngle+=Math.PI;delete p.breadth;delete p.depth;delete p.ancestor;delete p.prelim;delete p.mod;delete p.change;delete p.shift;delete p.number;delete p.thread})}};pv.Layout.Indent=function(){pv.Layout.Hierarchy.call(this);this.link.interpolate("step-after")};pv.Layout.Indent.prototype=pv.extend(pv.Layout.Hierarchy).property("depth",Number).property("breadth",Number);pv.Layout.Indent.prototype.defaults=(new pv.Layout.Indent).extend(pv.Layout.Hierarchy.prototype.defaults).depth(15).breadth(15); -pv.Layout.Indent.prototype.buildImplied=function(b){function c(i,j,l){i.x=g+l++*f;i.y=h+j++*d;i.midAngle=0;for(i=i.firstChild;i;i=i.nextSibling)j=c(i,j,l);return j}if(!pv.Layout.Hierarchy.prototype.buildImplied.call(this,b)){var d=b.breadth,f=b.depth,g=0,h=0;c(b.nodes[0],1,1)}};pv.Layout.Pack=function(){pv.Layout.Hierarchy.call(this);this.node.radius(function(b){return b.radius}).strokeStyle("rgb(31, 119, 180)").fillStyle("rgba(31, 119, 180, .25)");this.label.textAlign("center");delete this.link}; -pv.Layout.Pack.prototype=pv.extend(pv.Layout.Hierarchy).property("spacing",Number).property("order",String);pv.Layout.Pack.prototype.defaults=(new pv.Layout.Pack).extend(pv.Layout.Hierarchy.prototype.defaults).spacing(1).order("ascending");pv.Layout.Pack.prototype.$radius=function(){return 1};pv.Layout.Pack.prototype.size=function(b){this.$radius=typeof b=="function"?function(){return Math.sqrt(b.apply(this,arguments))}:(b=Math.sqrt(b),function(){return b});return this}; -pv.Layout.Pack.prototype.buildImplied=function(b){function c(o){var n=pv.Mark.stack;n.unshift(null);for(var m=0,r=o.length;m0.0010}var u=Infinity,x=-Infinity,t=Infinity,p=-Infinity,v,w,y,z,C;v=o[0];v.x=-v.radius;v.y=0;n(v);if(o.length>1){w=o[1];w.x=w.radius;w.y=0;n(w);if(o.length>2){y=o[2];g(v,w,y);n(y);m(v,y);v.p= -y;m(y,w);w=v.n;for(var A=3;A0){r(v,z);w=z;A--}else if(D<0){r(z,w);v=z;A--}}}}v=(u+x)/2;w=(t+p)/2;for(A=y=0;Ao.min){o.sim.step(); -q=true}q&&d.render()},42)}else for(l=0;lg)g=j;i.size=i.firstChild?pv.sum(i.childNodes,function(l){return l.size}):c.$size.apply(c,(f[0]=i,f))});f.shift();switch(b.order){case "ascending":d.sort(function(i,j){return i.size-j.size});break;case "descending":d.sort(function(i,j){return j.size-i.size});break}var h=1/g;d.minBreadth=0;d.breadth= -0.5;d.maxBreadth=1;d.visitBefore(function(i){for(var j=i.minBreadth,l=i.maxBreadth-j,k=i.firstChild;k;k=k.nextSibling){k.minBreadth=j;k.maxBreadth=j+=k.size/i.size*l;k.breadth=(j+k.minBreadth)/2}});d.visitAfter(function(i,j){i.minDepth=(j-1)*h;i.maxDepth=i.depth=j*h});pv.Layout.Hierarchy.NodeLink.buildImplied.call(this,b)}};pv.Layout.Partition.Fill=function(){pv.Layout.Partition.call(this);pv.Layout.Hierarchy.Fill.constructor.call(this)};pv.Layout.Partition.Fill.prototype=pv.extend(pv.Layout.Partition); -pv.Layout.Partition.Fill.prototype.buildImplied=function(b){pv.Layout.Partition.prototype.buildImplied.call(this,b)||pv.Layout.Hierarchy.Fill.buildImplied.call(this,b)};pv.Layout.Arc=function(){pv.Layout.Network.call(this);var b,c,d,f=this.buildImplied;this.buildImplied=function(g){f.call(this,g);c=g.directed;b=g.orient=="radial"?"linear":"polar";d=g.orient=="right"||g.orient=="top"};this.link.data(function(g){var h=g.sourceNode;g=g.targetNode;return d!=(c||h.breadth>1)*f:null}).bottom(function(l,k){return d=="mirror"?k&1?null:(k+1>>1)*-f:(k&1||-1)*(k+1>>1)*f}).fillStyle(function(l,k){return(k&1?h:i)((k>>1)+1)});this.band.add=function(l){return b.add(pv.Panel).extend(c).add(l).extend(this)}};pv.Layout.Horizon.prototype=pv.extend(pv.Layout).property("bands",Number).property("mode",String).property("backgroundStyle",pv.color).property("positiveStyle",pv.color).property("negativeStyle",pv.color); -pv.Layout.Horizon.prototype.defaults=(new pv.Layout.Horizon).extend(pv.Layout.prototype.defaults).bands(2).mode("offset").backgroundStyle("white").positiveStyle("#1f77b4").negativeStyle("#d62728"); -pv.Layout.Rollup=function(){pv.Layout.Network.call(this);var b=this,c,d,f=b.buildImplied;this.buildImplied=function(g){f.call(this,g);c=g.$rollup.nodes;d=g.$rollup.links};this.node.data(function(){return c}).size(function(g){return g.nodes.length*20});this.link.interpolate("polar").eccentricity(0.8);this.link.add=function(g){return b.add(pv.Panel).data(function(){return d}).add(g).extend(this)}};pv.Layout.Rollup.prototype=pv.extend(pv.Layout.Network).property("directed",Boolean); -pv.Layout.Rollup.prototype.x=function(b){this.$x=pv.functor(b);return this};pv.Layout.Rollup.prototype.y=function(b){this.$y=pv.functor(b);return this}; -pv.Layout.Rollup.prototype.buildImplied=function(b){function c(r){return i[r]+","+j[r]}if(!pv.Layout.Network.prototype.buildImplied.call(this,b)){var d=b.nodes,f=b.links,g=b.directed,h=d.length,i=[],j=[],l=0,k={},q={},o=pv.Mark.stack,n={parent:this};o.unshift(null);for(var m=0;ml.index?l.index+","+d.index:d.index+","+l.index;(o=q[h])||(o=q[h]={sourceNode:d,targetNode:l,linkValue:0,links:[]});o.links.push(f[m]);o.linkValue+=f[m].linkValue}b.$rollup={nodes:pv.values(k),links:pv.values(q)}}}; -pv.Layout.Matrix=function(){pv.Layout.Network.call(this);var b,c,d,f,g,h=this.buildImplied;this.buildImplied=function(i){h.call(this,i);b=i.nodes.length;c=i.width/b;d=i.height/b;f=i.$matrix.labels;g=i.$matrix.pairs};this.link.data(function(){return g}).left(function(){return c*(this.index%b)}).top(function(){return d*Math.floor(this.index/b)}).width(function(){return c}).height(function(){return d}).lineWidth(1.5).strokeStyle("#fff").fillStyle(function(i){return i.linkValue?"#555":"#eee"}).parent= -this;delete this.link.add;this.label.data(function(){return f}).left(function(){return this.index&1?c*((this.index>>1)+0.5):null}).top(function(){return this.index&1?null:d*((this.index>>1)+0.5)}).textMargin(4).textAlign(function(){return this.index&1?"left":"right"}).textAngle(function(){return this.index&1?-Math.PI/2:0});delete this.node};pv.Layout.Matrix.prototype=pv.extend(pv.Layout.Network).property("directed",Boolean);pv.Layout.Matrix.prototype.sort=function(b){this.$sort=b;return this}; -pv.Layout.Matrix.prototype.buildImplied=function(b){if(!pv.Layout.Network.prototype.buildImplied.call(this,b)){var c=b.nodes,d=b.links,f=this.$sort,g=c.length,h=pv.range(g),i=[],j=[],l={};b.$matrix={labels:i,pairs:j};f&&h.sort(function(m,r){return f(c[m],c[r])});for(var k=0;kl)k=null;if(g){if(k&&g.scene==k.scene&&g.index==k.index)return;pv.Mark.dispatch("unpoint",g.scene,g.index)}if(g=k){pv.Mark.dispatch("point",k.scene,k.index);pv.listen(this.root.canvas(),"mouseout",f)}}function f(k){if(g&&!pv.ancestor(this,k.relatedTarget)){pv.Mark.dispatch("unpoint",g.scene,g.index);g=null}}var g,h=null,i=1,j=1,l=arguments.length?b*b:900;d.collapse=function(k){if(arguments.length){h=String(k);switch(h){case "y":i= -1;j=0;break;case "x":i=0;j=1;break;default:j=i=1;break}return d}return h};return d}; -pv.Behavior.select=function(){function b(j){g=this.index;f=this.scene;i=this.mouse();h=j;h.x=i.x;h.y=i.y;h.dx=h.dy=0;pv.Mark.dispatch("selectstart",f,g)}function c(){if(f){f.mark.context(f,g,function(){var j=this.mouse();h.x=Math.max(0,Math.min(i.x,j.x));h.y=Math.max(0,Math.min(i.y,j.y));h.dx=Math.min(this.width(),Math.max(j.x,i.x))-h.x;h.dy=Math.min(this.height(),Math.max(j.y,i.y))-h.y;this.render()});pv.Mark.dispatch("select",f,g)}}function d(){if(f){pv.Mark.dispatch("selectend",f,g);f=null}}var f, -g,h,i;pv.listen(window,"mousemove",c);pv.listen(window,"mouseup",d);return b}; -pv.Behavior.resize=function(b){function c(l){h=this.index;g=this.scene;j=this.mouse();i=l;switch(b){case "left":j.x=i.x+i.dx;break;case "right":j.x=i.x;break;case "top":j.y=i.y+i.dy;break;case "bottom":j.y=i.y;break}pv.Mark.dispatch("resizestart",g,h)}function d(){if(g){g.mark.context(g,h,function(){var l=this.mouse();i.x=Math.max(0,Math.min(j.x,l.x));i.y=Math.max(0,Math.min(j.y,l.y));i.dx=Math.min(this.parent.width(),Math.max(l.x,j.x))-i.x;i.dy=Math.min(this.parent.height(),Math.max(l.y,j.y))-i.y; -this.render()});pv.Mark.dispatch("resize",g,h)}}function f(){if(g){pv.Mark.dispatch("resizeend",g,h);g=null}}var g,h,i,j;pv.listen(window,"mousemove",d);pv.listen(window,"mouseup",f);return c}; -pv.Behavior.pan=function(){function b(){g=this.index;f=this.scene;i=pv.vector(pv.event.pageX,pv.event.pageY);h=this.transform();j=1/(h.k*this.scale);if(l)l={x:(1-h.k)*this.width(),y:(1-h.k)*this.height()}}function c(){if(f){f.mark.context(f,g,function(){var k=h.translate((pv.event.pageX-i.x)*j,(pv.event.pageY-i.y)*j);if(l){k.x=Math.max(l.x,Math.min(0,k.x));k.y=Math.max(l.y,Math.min(0,k.y))}this.transform(k).render()});pv.Mark.dispatch("pan",f,g)}}function d(){f=null}var f,g,h,i,j,l;b.bound=function(k){if(arguments.length){l= -Boolean(k);return this}return Boolean(l)};pv.listen(window,"mousemove",c);pv.listen(window,"mouseup",d);return b}; -pv.Behavior.zoom=function(b){function c(){var f=this.mouse(),g=pv.event.wheel*b;f=this.transform().translate(f.x,f.y).scale(g<0?1E3/(1E3-g):(1E3+g)/1E3).translate(-f.x,-f.y);if(d){f.k=Math.max(1,f.k);f.x=Math.max((1-f.k)*this.width(),Math.min(0,f.x));f.y=Math.max((1-f.k)*this.height(),Math.min(0,f.y))}this.transform(f).render();pv.Mark.dispatch("zoom",this.scene,this.index)}var d;arguments.length||(b=1/48);c.bound=function(f){if(arguments.length){d=Boolean(f);return this}return Boolean(d)};return c}; -pv.Geo=function(){}; -pv.Geo.projections={mercator:{project:function(b){return{x:b.lng/180,y:b.lat>85?1:b.lat<-85?-1:Math.log(Math.tan(Math.PI/4+pv.radians(b.lat)/2))/Math.PI}},invert:function(b){return{lng:b.x*180,lat:pv.degrees(2*Math.atan(Math.exp(b.y*Math.PI))-Math.PI/2)}}},"gall-peters":{project:function(b){return{x:b.lng/180,y:Math.sin(pv.radians(b.lat))}},invert:function(b){return{lng:b.x*180,lat:pv.degrees(Math.asin(b.y))}}},sinusoidal:{project:function(b){return{x:pv.radians(b.lng)*Math.cos(pv.radians(b.lat))/Math.PI, -y:b.lat/90}},invert:function(b){return{lng:pv.degrees(b.x*Math.PI/Math.cos(b.y*Math.PI/2)),lat:b.y*90}}},aitoff:{project:function(b){var c=pv.radians(b.lng);b=pv.radians(b.lat);var d=Math.acos(Math.cos(b)*Math.cos(c/2));return{x:2*(d?Math.cos(b)*Math.sin(c/2)*d/Math.sin(d):0)/Math.PI,y:2*(d?Math.sin(b)*d/Math.sin(d):0)/Math.PI}},invert:function(b){var c=b.y*Math.PI/2;return{lng:pv.degrees(b.x*Math.PI/2/Math.cos(c)),lat:pv.degrees(c)}}},hammer:{project:function(b){var c=pv.radians(b.lng);b=pv.radians(b.lat); -var d=Math.sqrt(1+Math.cos(b)*Math.cos(c/2));return{x:2*Math.SQRT2*Math.cos(b)*Math.sin(c/2)/d/3,y:Math.SQRT2*Math.sin(b)/d/1.5}},invert:function(b){var c=b.x*3;b=b.y*1.5;var d=Math.sqrt(1-c*c/16-b*b/4);return{lng:pv.degrees(2*Math.atan2(d*c,2*(2*d*d-1))),lat:pv.degrees(Math.asin(d*b))}}},identity:{project:function(b){return{x:b.lng/180,y:b.lat/90}},invert:function(b){return{lng:b.x*180,lat:b.y*90}}}}; -pv.Geo.scale=function(b){function c(m){if(!o||m.lng!=o.lng||m.lat!=o.lat){o=m;m=d(m);n={x:l(m.x),y:k(m.y)}}return n}function d(m){return j.project({lng:m.lng-q.lng,lat:m.lat})}function f(m){m=j.invert(m);m.lng+=q.lng;return m}var g={x:0,y:0},h={x:1,y:1},i=[],j=pv.Geo.projections.identity,l=pv.Scale.linear(-1,1).range(0,1),k=pv.Scale.linear(-1,1).range(1,0),q={lng:0,lat:0},o,n;c.x=function(m){return c(m).x};c.y=function(m){return c(m).y};c.ticks={lng:function(m){var r;if(i.length>1){var s=pv.Scale.linear(); -if(m==undefined)m=10;r=s.domain(i,function(u){return u.lat}).ticks(m);m=s.domain(i,function(u){return u.lng}).ticks(m)}else{r=pv.range(-80,81,10);m=pv.range(-180,181,10)}return m.map(function(u){return r.map(function(x){return{lat:x,lng:u}})})},lat:function(m){return pv.transpose(c.ticks.lng(m))}};c.invert=function(m){return f({x:l.invert(m.x),y:k.invert(m.y)})};c.domain=function(m,r){if(arguments.length){i=m instanceof Array?arguments.length>1?pv.map(m,r):m:Array.prototype.slice.call(arguments); -if(i.length>1){var s=i.map(function(x){return x.lng}),u=i.map(function(x){return x.lat});q={lng:(pv.max(s)+pv.min(s))/2,lat:(pv.max(u)+pv.min(u))/2};s=i.map(d);l.domain(s,function(x){return x.x});k.domain(s,function(x){return x.y})}else{q={lng:0,lat:0};l.domain(-1,1);k.domain(-1,1)}o=null;return this}return i};c.range=function(m,r){if(arguments.length){if(typeof m=="object"){g={x:Number(m.x),y:Number(m.y)};h={x:Number(r.x),y:Number(r.y)}}else{g={x:0,y:0};h={x:Number(m),y:Number(r)}}l.range(g.x,h.x); -k.range(h.y,g.y);o=null;return this}return[g,h]};c.projection=function(m){if(arguments.length){j=typeof m=="string"?pv.Geo.projections[m]||pv.Geo.projections.identity:m;return this.domain(i)}return m};c.by=function(m){function r(){return c(m.apply(this,arguments))}for(var s in c)r[s]=c[s];return r};arguments.length&&c.projection(b);return c}; diff --git a/docs/lib/utils.js b/docs/lib/utils.js deleted file mode 100644 index b261082c..00000000 --- a/docs/lib/utils.js +++ /dev/null @@ -1,25 +0,0 @@ - -function polar_to_cartesian(r,t) { - //radians to degrees, requires the t*pi/180 - var x = r * Math.cos((t*Math.PI/180)); - var y = r * Math.sin((t*Math.PI/180)); - return [x,y]; -} - -function cartesian_to_raster(x,y) { - var rx = w/2 + x; - var ry = h/2 + y; - return [rx,ry]; -} - -function raster_to_cartesian(rx,ry) { - var x = rx - w/2; - var y = ry - h/2; - return [x,y]; -} - -function polar_to_raster(r,t) { - var xy= polar_to_cartesian(r,t); - return cartesian_to_raster(xy[0], xy[1]); -} - diff --git a/docs/lib/utils_test.js b/docs/lib/utils_test.js deleted file mode 100644 index f79c0fdb..00000000 --- a/docs/lib/utils_test.js +++ /dev/null @@ -1,60 +0,0 @@ - - describe("Radar", function() { - describe("Cartesian to Raster Co-ordinate Transformation functions", function() { - it("cartesian_to_raster_origin", function() { - expect(cartesian_to_raster(0,0)).toEqual([w/2,h/2]); - }); - - it("cartesian_to_raster_bounds", function() { - expect(cartesian_to_raster(-500,-500)).toEqual([0,0]); - expect(cartesian_to_raster(500,500)).toEqual([w,h]); - expect(cartesian_to_raster(-500,500)).toEqual([0,h]); - expect(cartesian_to_raster(500,0)).toEqual([w,h/2]); - }); - }); - - describe("Polar to Cartesian Co-ordinate Transformation functions", function() { - - it("polar origin ", function() { - var r = 0, t = 0; - expect(Math.round(polar_to_cartesian(r,t)[0])).toEqual(0); - expect(Math.round(polar_to_cartesian(r,t)[1])).toEqual(0); - }); - - it("polar to cartesian 1,90", function() { - var r = 1, t = 90; - expect(Math.round(polar_to_cartesian(r,t)[0])).toEqual(0); - expect(Math.round(polar_to_cartesian(r,t)[1])).toEqual(1); - }); - - it("polar to cartesian 20,90", function() { - var r = 20; - var t = 90; - expect(Math.round(polar_to_cartesian(r,t)[0])).toEqual(0); - expect(Math.round(polar_to_cartesian(r,t)[1])).toEqual(r); - }); - - it("polar to cartesian 20, 180", function() { - var r = 20, t = 180; - expect(Math.round(polar_to_cartesian(r,t)[0])).toEqual(-20); - expect(Math.round(polar_to_cartesian(r,t)[1])).toEqual(0); - }); - - it("polar to cartesian, 20, 270", function() { - var r = 20, t = 270; - expect(Math.round(polar_to_cartesian(r,t)[0])).toEqual(0); - expect(Math.round(polar_to_cartesian(r,t)[1])).toEqual(-20); - }); - - }); - - describe("Raster to Cartesian Co-ordinate Transformation functions", function() { - it("Raster to cartesian", function() { - expect(raster_to_cartesian(0,0)).toEqual([-500,-500]); - expect(raster_to_cartesian(1000,1000)).toEqual([500,500]); - }); - - }); -}); - jasmine.getEnv().addReporter(new jasmine.TrivialReporter());; - jasmine.getEnv().execute(); diff --git a/docs/radar.js b/docs/radar.js deleted file mode 100644 index 9caea677..00000000 --- a/docs/radar.js +++ /dev/null @@ -1,193 +0,0 @@ -function init(h,w) { - -var radar = new pv.Panel() - .width(w) - .height(h) - .canvas('radar'); - -// headline -radar.add(pv.Label) - .left(40) - .top(78) - .text("Zalando Tech Radar — 2017.07") - .font("40px sans-serif"); - -// contact info -radar.add(pv.Label) - .top(875) - .right(40) - .textAlign("right") - .text("Questions? Comments? Ideas?") - .font("28px sans-serif") - .add(pv.Label) - .top(910) - .text("tech-guild-technologists@zalando.de") - .textStyle("blue") - .font("22px monospace") - .add(pv.Label) - .top(940) - .text("#guild-technologists") - .textStyle("blue") - .font("22px monospace"); - -// legend -radar.add(pv.Dot) - .top(940) - .left(50) - .shape("circle") - .fillStyle("grey") - .strokeStyle("grey") - .size(16) - .anchor("right") - .add(pv.Label) - .text("unchanged") - .textStyle("black") -radar.add(pv.Dot) - .top(940) - .left(126) - .shape("triangle") - .fillStyle("grey") - .strokeStyle("grey") - .size(16) - .angle(45) - .anchor("right") - .add(pv.Label) - .text("changed since last edition (2017.03)") - .textStyle("black"); - - -//quadrant lines -- vertical -radar.add(pv.Line) - .data([(h/2-radar_arcs[radar_arcs.length-1].r),h-(h/2-radar_arcs[radar_arcs.length-1].r)]) - .lineWidth(1) - .left(w/2) - .bottom(function(d) {return d;}) - .strokeStyle("#bbb"); - -//quadrant lines -- horizontal -radar.add(pv.Line) - .data([(w/2-radar_arcs[radar_arcs.length-1].r),w-(w/2-radar_arcs[radar_arcs.length-1].r)]) - .lineWidth(1) - .bottom(h/2) - .left(function(d) {return d;}) - .strokeStyle("#bbb"); - -// arcs -radar.add(pv.Dot) - .data(radar_arcs) - .left(w/2) - .bottom(h/2) - .radius(function(d) { return d.r; }) - .strokeStyle("#ccc") - .anchor("top") - .add(pv.Label) - .textBaseline("top") - .textMargin(40) - .text(function(d) { return d.name; }) - .textStyle("#ccc") - .font("bold 40px sans-serif"); - -//Quadrant Ledgends -var radar_quadrant_ctr=1; -var quadrantFontSize = 18; -var headingFontSize = 14; -var stageHeadingCount = 0; -var lastRadius = 0; -var lastQuadrant=''; -var spacer = 16; -var fontSize = 10; -var total_index = 1; - - -for (var i = 0; i < radar_data.length; i++) { - - // quadrant title - if (lastQuadrant != radar_data[i].quadrant) { - lastQuadrant = radar_data[i].quadrant; - radar.add(pv.Label) - .left(radar_data[i].left) - .top(radar_data[i].top) - .text(radar_data[i].quadrant) - .strokeStyle(radar_data[i].color) - .fillStyle(radar_data[i].color) - .font(quadrantFontSize + "px sans-serif"); - } - - // re-order the items by radius, in order to logically group by ring - var itemsByStage = _.groupBy(radar_data[i].items, function(item) { - if (item.pc.r <= radar_arcs[0].r) return 0; - if (item.pc.r <= radar_arcs[1].r) return 1; - if (item.pc.r <= radar_arcs[2].r) return 2; - return 3; - }); - var offsetIndex = 0; - var midIndex = -1; - - for (var stageIndex in itemsByStage) { - if (stageIndex > 0 && _.has(itemsByStage, stageIndex-1)) { - offsetIndex = offsetIndex + itemsByStage[stageIndex-1].length + 1; - } - if ((stageIndex > 1) && (midIndex < 0)) { - midIndex = offsetIndex; - } - - var left = radar_data[i].left; - var top = radar_data[i].top + quadrantFontSize + spacer + (stageIndex * headingFontSize) + (offsetIndex * fontSize); - if (stageIndex > 1) { - left = left + 130; - top = top - (2 * headingFontSize) - (midIndex * fontSize); - } - - // stage label - radar.add(pv.Label) - .left(left + headingFontSize) - .top(top - headingFontSize / 2) - .text(radar_arcs[stageIndex].name) - .strokeStyle("#ccc") - .fillStyle("#ccc") - .font(headingFontSize + "px Courier New"); - - // legend label - radar.add(pv.Label) - .left(left) - .top(top) - .strokeStyle(radar_data[i].color) - .fillStyle(radar_data[i].color) - .add(pv.Dot) - .def("i", top) - .data(itemsByStage[stageIndex]) - .top(function() { return ( this.i() + (this.index * fontSize) );}) - .shape(function(d) {return (d.movement === 't' ? "triangle" : "circle");}) - .cursor(function(d) { return ( d.url !== undefined ? "pointer" : "auto" ); }) - .event("click", function(d) { if ( d.url !== undefined ){self.location = d.url}}) - .size(fontSize) - .angle(45) - .anchor("right") - .add(pv.Label) - .text(function(d) {return radar_quadrant_ctr++ + ". " + d.name;} ); - - // the blip itself - radar.add(pv.Dot) - .def("active", false) - .data(itemsByStage[stageIndex]) - .size(function(d) { return (d.blipSize !== undefined ? d.blipSize : 70); }) - .left(function(d) { return polar_to_raster(d.pc.r, d.pc.t)[0]; }) - .bottom(function(d) { return polar_to_raster(d.pc.r, d.pc.t)[1]; }) - .title(function(d) { return d.name; }) - .cursor(function(d) { return ( d.url !== undefined ? "pointer" : "auto" ); }) - .event("click", function(d) { if ( d.url !== undefined ){self.location = d.url}}) - .angle(Math.PI) // 180 degrees in radians - .strokeStyle(radar_data[i].color) - .fillStyle(radar_data[i].color) - .shape(function(d) { return (d.movement === 't' ? "triangle" : "circle"); }) - .anchor("center") - .add(pv.Label) - .text(function(d) {return total_index++;}) - .textBaseline("middle") - .textStyle("white"); - } - } - - radar.anchor('radar'); - radar.render(); -}; \ No newline at end of file diff --git a/docs/radar_data.js b/docs/radar_data.js deleted file mode 100644 index 45b754ec..00000000 --- a/docs/radar_data.js +++ /dev/null @@ -1,928 +0,0 @@ -var h = 1000; -var w = 1450; - -var radar_arcs = [ - { - "name": "ADOPT", - "r": 130 - }, - { - "name": "TRIAL", - "r": 220 - }, - { - "name": "ASSESS", - "r": 310 - }, - { - "name": "HOLD", - "r": 400 - } -]; - -// movement: -// t = moved (triangle) -// c = stayed put (circle) -// -// blipSize: -// This is optional, if you omit this property, then blip size will be 70. -// -// url: -// This is optional, if you add it then blips will be clickable to some URL. -// -// pc: (polar coordinates) -// r = distance away from origin ("radial coordinate") -// - Each level is 100 points away from origin -// t = angle of the point from origin ("angular coordinate") -// - 0 degrees is due east -// -var radar_data = [ - { - "quadrant": "Techniques; Frameworks & Tools", - "left" : 45, - "top" : 188, - "color" : "#8FA227", - "items" : [ - { - "name": "Akka (Scala)", - "pc": { - "r": 78, - "t": 126 - }, - "movement": "c" - }, - { - "name": "Node.js ", - "pc": { - "r": 56, - "t": 152 - }, - "movement": "c" - }, - { - "name": "OpenAPI (Swagger)", - "pc": { - "r": 95, - "t": 113 - }, - "movement": "c" - }, - { - "name": "Play (Scala)", - "pc": { - "r": 98, - "t": 165 - }, - "movement": "c" - }, - { - "name": "ReactJS", - "pc": { - "r": 71, - "t": 139 - }, - "movement": "c" - }, - { - "name": "RxJava (Android)", - "pc": { - "r": 116, - "t": 100 - }, - "movement": "t" - }, - { - "name": "scikit-learn", - "pc": { - "r": 72, - "t": 158 - }, - "movement": "c" - }, - { - "name": "Spring", - "pc": { - "r": 78, - "t": 106 - }, - "movement": "c" - }, - { - "name": "Akka-Http", - "pc": { - "r": 284, - "t": 156 - }, - "movement": "t" - }, - { - "name": "Aurelia", - "pc": { - "r": 240, - "t": 116 - }, - "movement": "c" - }, - { - "name": "Ember.js", - "pc": { - "r": 231, - "t": 166 - }, - "movement": "c" - }, - { - "name": "Flux", - "pc": { - "r": 299, - "t": 96 - }, - "movement": "c" - }, - { - "name": "gRPC", - "pc": { - "r": 236, - "t": 106 - }, - "movement": "c" - }, - { - "name": "Http4s", - "pc": { - "r": 297, - "t": 126 - }, - "movement": "t" - }, - { - "name": "Play (Java)", - "pc": { - "r": 265, - "t": 146 - }, - "movement": "c" - }, - { - "name": "Vert.x", - "pc": { - "r": 245, - "t": 136 - }, - "movement": "c" - }, - { - "name": "Activiti", - "pc": { - "r": 327, - "t": 110 - }, - "movement": "c" - }, - { - "name": "AngularJS 1.x", - "pc": { - "r": 343, - "t": 174 - }, - "movement": "c" - }, - { - "name": "BackboneJS", - "pc": { - "r": 345, - "t": 158 - }, - "movement": "c" - }, - { - "name": "Drools", - "pc": { - "r": 361, - "t": 150 - }, - "movement": "c" - }, - { - "name": "Spray", - "pc": { - "r": 342, - "t": 142 - }, - "movement": "t" - }, - { - "name": "Angular", - "pc": { - "r": 173, - "t": 122 - }, - "movement": "c" - }, - { - "name": "Apache Camel", - "pc": { - "r": 183, - "t": 170 - }, - "movement": "c" - }, - { - "name": "AspectJ", - "pc": { - "r": 164, - "t": 110 - }, - "movement": "c" - }, - { - "name": "Camunda BPMN Engine", - "pc": { - "r": 155, - "t": 158 - }, - "movement": "c" - }, - { - "name": "OpenNLP", - "pc": { - "r": 152, - "t": 98 - }, - "movement": "c" - }, - { - "name": "Thymeleaf", - "pc": { - "r": 143, - "t": 146 - }, - "movement": "c" - } -] - }, - { - "quadrant": "Data Management", - "left": w-300+30, - "top" : 188, - "color" : "#587486", - "items" : [ - { - "name": "AWS EMR", - "pc": { - "r": 53, - "t": 75 - }, - "movement": "c" - }, - { - "name": "AWS S3", - "pc": { - "r": 80, - "t": 23 - }, - "movement": "c" - }, - { - "name": "AWS SNS", - "pc": { - "r": 114, - "t": 62 - }, - "movement": "c" - }, - { - "name": "AWS SQS", - "pc": { - "r": 118, - "t": 49 - }, - "movement": "c" - }, - { - "name": "Cassandra", - "pc": { - "r": 52, - "t": 10 - }, - "movement": "c" - }, - { - "name": "ElasticSearch", - "pc": { - "r": 120, - "t": 36 - }, - "movement": "c" - }, - { - "name": "Kafka", - "pc": { - "r": 100, - "t": 55 - }, - "movement": "c" - }, - { - "name": "Nakadi", - "pc": { - "r": 109, - "t": 42 - }, - "movement": "c" - }, - { - "name": "PostgreSQL", - "pc": { - "r": 78, - "t": 68 - }, - "movement": "c" - }, - { - "name": "Redis", - "pc": { - "r": 118, - "t": 29 - }, - "movement": "c" - }, - { - "name": "Solr", - "pc": { - "r": 114, - "t": 16 - }, - "movement": "c" - }, - { - "name": "Spark", - "pc": { - "r": 97, - "t": 8 - }, - "movement": "c" - }, - { - "name": "AWS Kinesis", - "pc": { - "r": 288, - "t": 46 - }, - "movement": "c" - }, - { - "name": "Google BigTable", - "pc": { - "r": 252, - "t": 26 - }, - "movement": "c" - }, - { - "name": "Hadoop/MR", - "pc": { - "r": 264, - "t": 56 - }, - "movement": "c" - }, - { - "name": "Hadoop/YARN", - "pc": { - "r": 258, - "t": 76 - }, - "movement": "c" - }, - { - "name": "ActiveMQ", - "pc": { - "r": 371, - "t": 12 - }, - "movement": "c" - }, - { - "name": "Aerospike", - "pc": { - "r": 334, - "t": 84 - }, - "movement": "c" - }, - { - "name": "Apache Artemis", - "pc": { - "r": 388, - "t": 76 - }, - "movement": "c" - }, - { - "name": "CouchBase", - "pc": { - "r": 351, - "t": 60 - }, - "movement": "c" - }, - { - "name": "Esper CEP", - "pc": { - "r": 335, - "t": 52 - }, - "movement": "c" - }, - { - "name": "Graphite", - "pc": { - "r": 348, - "t": 44 - }, - "movement": "c" - }, - { - "name": "Hadoop/HBase", - "pc": { - "r": 370, - "t": 36 - }, - "movement": "c" - }, - { - "name": "HornetQueue", - "pc": { - "r": 383, - "t": 20 - }, - "movement": "c" - }, - { - "name": "InfluxDB", - "pc": { - "r": 323, - "t": 4 - }, - "movement": "c" - }, - { - "name": "MemCached", - "pc": { - "r": 343, - "t": 28 - }, - "movement": "c" - }, - { - "name": "MongoDB", - "pc": { - "r": 322, - "t": 68 - }, - "movement": "c" - }, - { - "name": "MySQL", - "pc": { - "r": 332, - "t": 48 - }, - "movement": "c" - }, - { - "name": "Neo4j", - "pc": { - "r": 336, - "t": 32 - }, - "movement": "c" - }, - { - "name": "Oracle DB", - "pc": { - "r": 342, - "t": 16 - }, - "movement": "c" - }, - { - "name": "RabbitMQ", - "pc": { - "r": 374, - "t": 80 - }, - "movement": "c" - }, - { - "name": "Riak", - "pc": { - "r": 386, - "t": 64 - }, - "movement": "c" - }, - { - "name": "AWS DynamoDB", - "pc": { - "r": 173, - "t": 44 - }, - "movement": "c" - }, - { - "name": "Flink", - "pc": { - "r": 171, - "t": 8 - }, - "movement": "c" - }, - { - "name": "Google BigQuery", - "pc": { - "r": 166, - "t": 56 - }, - "movement": "c" - }, - { - "name": "Hadoop/HDFS", - "pc": { - "r": 208, - "t": 20 - }, - "movement": "c" - }, - { - "name": "Kairos", - "pc": { - "r": 169, - "t": 80 - }, - "movement": "c" - }, - { - "name": "Presto", - "pc": { - "r": 176, - "t": 32 - }, - "movement": "t" - } -] - }, - { - "quadrant": "Platforms & Infrastructure", - "left" :45, - "top" : (h/2 + 38), - "color" : "#DC6F1D", - "items" : [ - { - "name": "Docker", - "pc": { - "r": 120, - "t": 242 - }, - "movement": "c" - }, - { - "name": "etcd", - "pc": { - "r": 97, - "t": 229 - }, - "movement": "c" - }, - { - "name": "HAProxy", - "pc": { - "r": 79, - "t": 190 - }, - "movement": "c" - }, - { - "name": "Hystrix", - "pc": { - "r": 106, - "t": 200 - }, - "movement": "c" - }, - { - "name": "Jetty", - "pc": { - "r": 60, - "t": 255 - }, - "movement": "c" - }, - { - "name": "Nginx", - "pc": { - "r": 58, - "t": 216 - }, - "movement": "c" - }, - { - "name": "STUPS", - "pc": { - "r": 108, - "t": 209 - }, - "movement": "c" - }, - { - "name": "Tomcat", - "pc": { - "r": 115, - "t": 252 - }, - "movement": "c" - }, - { - "name": "ZMON", - "pc": { - "r": 72, - "t": 222 - }, - "movement": "c" - }, - { - "name": "AWS Lambda", - "pc": { - "r": 236, - "t": 206 - }, - "movement": "c" - }, - { - "name": "Consul", - "pc": { - "r": 273, - "t": 236 - }, - "movement": "c" - }, - { - "name": "Grizzly", - "pc": { - "r": 321, - "t": 256 - }, - "movement": "c" - }, - { - "name": "JBoss", - "pc": { - "r": 327, - "t": 240 - }, - "movement": "c" - }, - { - "name": "Mesos", - "pc": { - "r": 370, - "t": 200 - }, - "movement": "c" - }, - { - "name": "Puppet", - "pc": { - "r": 355, - "t": 184 - }, - "movement": "c" - }, - { - "name": "saltstack", - "pc": { - "r": 324, - "t": 192 - }, - "movement": "c" - }, - { - "name": "Kubernetes", - "pc": { - "r": 163, - "t": 200 - }, - "movement": "c" - }, - { - "name": "Undertow", - "pc": { - "r": 206, - "t": 260 - }, - "movement": "c" - }, - { - "name": "Zookeeper", - "pc": { - "r": 155, - "t": 188 - }, - "movement": "c" - } -] - }, - { - "quadrant": "Languages", - "color" : "#B70062", - "left" : (w-300+30), - "top" : (h/2 + 38), - "items" : [ - { - "name": "Go", - "pc": { - "r": 109, - "t": 332 - }, - "movement": "c" - }, - { - "name": "Java", - "pc": { - "r": 109, - "t": 345 - }, - "movement": "c" - }, - { - "name": "Javascript", - "pc": { - "r": 65, - "t": 306 - }, - "movement": "c" - }, - { - "name": "Python", - "pc": { - "r": 105, - "t": 293 - }, - "movement": "c" - }, - { - "name": "Scala", - "pc": { - "r": 110, - "t": 319 - }, - "movement": "c" - }, - { - "name": "Swift", - "pc": { - "r": 94, - "t": 280 - }, - "movement": "c" - }, - { - "name": "Elm", - "pc": { - "r": 263, - "t": 336 - }, - "movement": "c" - }, - { - "name": "Haskell", - "pc": { - "r": 284, - "t": 276 - }, - "movement": "t" - }, - { - "name": "Kotlin", - "pc": { - "r": 248, - "t": 316 - }, - "movement": "c" - }, - { - "name": "R", - "pc": { - "r": 298, - "t": 306 - }, - "movement": "c" - }, - { - "name": "Rust", - "pc": { - "r": 273, - "t": 286 - }, - "movement": "c" - }, - { - "name": ".NET / languages", - "pc": { - "r": 367, - "t": 322 - }, - "movement": "c" - }, - { - "name": "C/C++", - "pc": { - "r": 372, - "t": 330 - }, - "movement": "c" - }, - { - "name": "Coffeescript", - "pc": { - "r": 326, - "t": 290 - }, - "movement": "c" - }, - { - "name": "Erlang", - "pc": { - "r": 337, - "t": 282 - }, - "movement": "c" - }, - { - "name": "Groovy", - "pc": { - "r": 380, - "t": 306 - }, - "movement": "c" - }, - { - "name": "JRuby", - "pc": { - "r": 356, - "t": 274 - }, - "movement": "c" - }, - { - "name": "Jython", - "pc": { - "r": 343, - "t": 314 - }, - "movement": "c" - }, - { - "name": "Perl", - "pc": { - "r": 358, - "t": 354 - }, - "movement": "c" - }, - { - "name": "PHP", - "pc": { - "r": 350, - "t": 346 - }, - "movement": "c" - }, - { - "name": "Ruby", - "pc": { - "r": 353, - "t": 338 - }, - "movement": "c" - }, - { - "name": "Clojure", - "pc": { - "r": 180, - "t": 326 - }, - "movement": "c" - }, - { - "name": "Typescript", - "pc": { - "r": 154, - "t": 278 - }, - "movement": "c" - } -] - } -]; diff --git a/docs/release/radar-0.1.js b/docs/release/radar-0.1.js new file mode 100644 index 00000000..35c046a2 --- /dev/null +++ b/docs/release/radar-0.1.js @@ -0,0 +1,386 @@ +// The MIT License (MIT) + +// Copyright (c) 2017 Zalando SE + +// 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. + + +function radar_visualization(config) { + + // custom random number generator, to make random sequence reproducible + // source: https://stackoverflow.com/questions/521295 + var seed = 42; + function random() { + var x = Math.sin(seed++) * 10000; + return x - Math.floor(x); + } + + function random_between(min, max) { + return min + random() * (max - min); + } + + function normal_between(min, max) { + return min + (random() + random()) * 0.5 * (max - min); + } + + // radial_min / radial_max are multiples of PI + const quadrants = [ + { radial_min: 0, radial_max: 0.5, factor_x: 1, factor_y: 1 }, + { radial_min: 0.5, radial_max: 1, factor_x: -1, factor_y: 1 }, + { radial_min: -1, radial_max: -0.5, factor_x: -1, factor_y: -1 }, + { radial_min: -0.5, radial_max: 0, factor_x: 1, factor_y: -1 } + ]; + + const rings = [ + { radius: 130 }, + { radius: 220 }, + { radius: 310 }, + { radius: 400 } + ]; + + const title_offset = + { x: -675, y: -420 }; + + const legend_offset = [ + { x: 450, y: 90 }, + { x: -675, y: 90 }, + { x: -675, y: -310 }, + { x: 450, y: -310 } + ]; + + function polar(cartesian) { + var x = cartesian.x; + var y = cartesian.y; + return { + t: Math.atan2(y, x), + r: Math.sqrt(x * x + y * y) + } + } + + function cartesian(polar) { + return { + x: polar.r * Math.cos(polar.t), + y: polar.r * Math.sin(polar.t) + } + } + + function bounded_interval(value, min, max) { + var low = Math.min(min, max); + var high = Math.max(min, max); + return Math.min(Math.max(value, low), high); + } + + + function bounded_ring(polar, r_min, r_max) { + return { + t: polar.t, + r: bounded_interval(polar.r, r_min, r_max) + } + } + + function bounded_box(point, min, max) { + return { + x: bounded_interval(point.x, min.x, max.x), + y: bounded_interval(point.y, min.y, max.y) + } + } + + function segment(quadrant, ring) { + var polar_min = { + t: quadrants[quadrant].radial_min * Math.PI, + r: ring == 0 ? 30 : rings[ring - 1].radius + }; + var polar_max = { + t: quadrants[quadrant].radial_max * Math.PI, + r: rings[ring].radius + }; + var cartesian_min = { + x: 15 * quadrants[quadrant].factor_x, + y: 15 * quadrants[quadrant].factor_y + }; + var cartesian_max = { + x: rings[3].radius * quadrants[quadrant].factor_x, + y: rings[3].radius * quadrants[quadrant].factor_y + }; + return { + clipx: function(d) { + var c = bounded_box(d, cartesian_min, cartesian_max); + var p = bounded_ring(polar(c), polar_min.r + 15, polar_max.r - 15); + d.x = cartesian(p).x; // adjust data too! + return d.x; + }, + clipy: function(d) { + var c = bounded_box(d, cartesian_min, cartesian_max); + var p = bounded_ring(polar(c), polar_min.r + 15, polar_max.r - 15); + d.y = cartesian(p).y; // adjust data too! + return d.y; + }, + random: function() { + return cartesian({ + t: random_between(polar_min.t, polar_max.t), + r: normal_between(polar_min.r, polar_max.r) + }); + } + } + } + + // position each entry randomly in its segment + for (var i = 0; i < config.entries.length; i++) { + var entry = config.entries[i]; + entry.segment = segment(entry.quadrant, entry.ring); + var point = entry.segment.random(); + entry.x = point.x; + entry.y = point.y; + entry.color = entry.active || config.print_layout ? + config.rings[entry.ring].color : config.colors.inactive; + } + + // partition entries according to segments + var segmented = new Array(4); + for (var quadrant = 0; quadrant < 4; quadrant++) { + segmented[quadrant] = new Array(4); + for (var ring = 0; ring < 4; ring++) { + segmented[quadrant][ring] = []; + } + } + for (var i=0; i 0) { + blip.append("path") + .attr("d", "M -10,5 10,5 0,-12 z") // triangle pointing up + .style("fill", d.color); + } else if (d.moved < 0) { + blip.append("path") + .attr("d", "M -10,-5 10,-5 0,12 z") // triangle pointing down + .style("fill", d.color); + } else { + blip.append("circle") + .attr("r", 8) + .attr("fill", d.color); + } + }); + + if (config.print_layout) { + blips + .append("text") + .text(function(d) { return d.id; }) + .attr("x", function(d) { return -2.3 * d.id.length; }) + .attr("y", 3) + .style("fill", "#fff") + .style("font-family", "Arial, Helvetica") + .style("font-size", "8") + .style("pointer-events", "none") + .style("user-select", "none"); + } + + // make sure that blips stay inside their segment + function ticked() { + blips.attr("transform", function(d) { + return translate(d.segment.clipx(d), d.segment.clipy(d)); + }) + } + + // distribute blips, while avoiding collisions + d3.forceSimulation() + .nodes(config.entries) + .velocityDecay(0.19) // magic number (found by experimentation) + .force("collision", d3.forceCollide().radius(12).strength(0.85)) + .on("tick", ticked); +} diff --git a/download.sh b/download.sh deleted file mode 100755 index edc5d73a..00000000 --- a/download.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -MONTH=`date +%m` -YEAR=`date +%Y` -FILE="data/${YEAR}_${MONTH}.tsv" - -curl "https://docs.google.com/spreadsheets/d/1HvsbibsBTBvZXDaJZWYyHwTxuA7a4eEbgcIKaPhuoxs/export?gid=0&format=tsv" -o "$FILE" - -#remove first row -tail -n +2 "$FILE" > "$FILE.tmp" && mv "$FILE.tmp" "$FILE" diff --git a/logo-medium.jpg b/logo-medium.jpg deleted file mode 100644 index 486f3e05..00000000 Binary files a/logo-medium.jpg and /dev/null differ diff --git a/radar.js b/radar.js new file mode 100644 index 00000000..35c046a2 --- /dev/null +++ b/radar.js @@ -0,0 +1,386 @@ +// The MIT License (MIT) + +// Copyright (c) 2017 Zalando SE + +// 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. + + +function radar_visualization(config) { + + // custom random number generator, to make random sequence reproducible + // source: https://stackoverflow.com/questions/521295 + var seed = 42; + function random() { + var x = Math.sin(seed++) * 10000; + return x - Math.floor(x); + } + + function random_between(min, max) { + return min + random() * (max - min); + } + + function normal_between(min, max) { + return min + (random() + random()) * 0.5 * (max - min); + } + + // radial_min / radial_max are multiples of PI + const quadrants = [ + { radial_min: 0, radial_max: 0.5, factor_x: 1, factor_y: 1 }, + { radial_min: 0.5, radial_max: 1, factor_x: -1, factor_y: 1 }, + { radial_min: -1, radial_max: -0.5, factor_x: -1, factor_y: -1 }, + { radial_min: -0.5, radial_max: 0, factor_x: 1, factor_y: -1 } + ]; + + const rings = [ + { radius: 130 }, + { radius: 220 }, + { radius: 310 }, + { radius: 400 } + ]; + + const title_offset = + { x: -675, y: -420 }; + + const legend_offset = [ + { x: 450, y: 90 }, + { x: -675, y: 90 }, + { x: -675, y: -310 }, + { x: 450, y: -310 } + ]; + + function polar(cartesian) { + var x = cartesian.x; + var y = cartesian.y; + return { + t: Math.atan2(y, x), + r: Math.sqrt(x * x + y * y) + } + } + + function cartesian(polar) { + return { + x: polar.r * Math.cos(polar.t), + y: polar.r * Math.sin(polar.t) + } + } + + function bounded_interval(value, min, max) { + var low = Math.min(min, max); + var high = Math.max(min, max); + return Math.min(Math.max(value, low), high); + } + + + function bounded_ring(polar, r_min, r_max) { + return { + t: polar.t, + r: bounded_interval(polar.r, r_min, r_max) + } + } + + function bounded_box(point, min, max) { + return { + x: bounded_interval(point.x, min.x, max.x), + y: bounded_interval(point.y, min.y, max.y) + } + } + + function segment(quadrant, ring) { + var polar_min = { + t: quadrants[quadrant].radial_min * Math.PI, + r: ring == 0 ? 30 : rings[ring - 1].radius + }; + var polar_max = { + t: quadrants[quadrant].radial_max * Math.PI, + r: rings[ring].radius + }; + var cartesian_min = { + x: 15 * quadrants[quadrant].factor_x, + y: 15 * quadrants[quadrant].factor_y + }; + var cartesian_max = { + x: rings[3].radius * quadrants[quadrant].factor_x, + y: rings[3].radius * quadrants[quadrant].factor_y + }; + return { + clipx: function(d) { + var c = bounded_box(d, cartesian_min, cartesian_max); + var p = bounded_ring(polar(c), polar_min.r + 15, polar_max.r - 15); + d.x = cartesian(p).x; // adjust data too! + return d.x; + }, + clipy: function(d) { + var c = bounded_box(d, cartesian_min, cartesian_max); + var p = bounded_ring(polar(c), polar_min.r + 15, polar_max.r - 15); + d.y = cartesian(p).y; // adjust data too! + return d.y; + }, + random: function() { + return cartesian({ + t: random_between(polar_min.t, polar_max.t), + r: normal_between(polar_min.r, polar_max.r) + }); + } + } + } + + // position each entry randomly in its segment + for (var i = 0; i < config.entries.length; i++) { + var entry = config.entries[i]; + entry.segment = segment(entry.quadrant, entry.ring); + var point = entry.segment.random(); + entry.x = point.x; + entry.y = point.y; + entry.color = entry.active || config.print_layout ? + config.rings[entry.ring].color : config.colors.inactive; + } + + // partition entries according to segments + var segmented = new Array(4); + for (var quadrant = 0; quadrant < 4; quadrant++) { + segmented[quadrant] = new Array(4); + for (var ring = 0; ring < 4; ring++) { + segmented[quadrant][ring] = []; + } + } + for (var i=0; i 0) { + blip.append("path") + .attr("d", "M -10,5 10,5 0,-12 z") // triangle pointing up + .style("fill", d.color); + } else if (d.moved < 0) { + blip.append("path") + .attr("d", "M -10,-5 10,-5 0,12 z") // triangle pointing down + .style("fill", d.color); + } else { + blip.append("circle") + .attr("r", 8) + .attr("fill", d.color); + } + }); + + if (config.print_layout) { + blips + .append("text") + .text(function(d) { return d.id; }) + .attr("x", function(d) { return -2.3 * d.id.length; }) + .attr("y", 3) + .style("fill", "#fff") + .style("font-family", "Arial, Helvetica") + .style("font-size", "8") + .style("pointer-events", "none") + .style("user-select", "none"); + } + + // make sure that blips stay inside their segment + function ticked() { + blips.attr("transform", function(d) { + return translate(d.segment.clipx(d), d.segment.clipy(d)); + }) + } + + // distribute blips, while avoiding collisions + d3.forceSimulation() + .nodes(config.entries) + .velocityDecay(0.19) // magic number (found by experimentation) + .force("collision", d3.forceCollide().radius(12).strength(0.85)) + .on("tick", ticked); +} diff --git a/radar_data.js.liquid b/radar_data.js.liquid deleted file mode 100644 index 8049301a..00000000 --- a/radar_data.js.liquid +++ /dev/null @@ -1,51 +0,0 @@ -var h = 1000; -var w = 1450; - -var radar_arcs = {{ arcs }}; - -// movement: -// t = moved (triangle) -// c = stayed put (circle) -// -// blipSize: -// This is optional, if you omit this property, then blip size will be 70. -// -// url: -// This is optional, if you add it then blips will be clickable to some URL. -// -// pc: (polar coordinates) -// r = distance away from origin ("radial coordinate") -// - Each level is 100 points away from origin -// t = angle of the point from origin ("angular coordinate") -// - 0 degrees is due east -// -var radar_data = [ - { - "quadrant": "Techniques; Frameworks & Tools", - "left" : 45, - "top" : 188, - "color" : "#8FA227", - "items" : {{ techniques }} - }, - { - "quadrant": "Data Management", - "left": w-300+30, - "top" : 188, - "color" : "#587486", - "items" : {{ data }} - }, - { - "quadrant": "Platforms & Infrastructure", - "left" :45, - "top" : (h/2 + 38), - "color" : "#DC6F1D", - "items" : {{ platforms }} - }, - { - "quadrant": "Languages", - "color" : "#B70062", - "left" : (w-300+30), - "top" : (h/2 + 38), - "items" : {{ languages }} - } -]; diff --git a/test.html b/test.html deleted file mode 100644 index 06d24526..00000000 --- a/test.html +++ /dev/null @@ -1,18 +0,0 @@ - - - -Radar Test - - - - - - - - - -

- - diff --git a/transform.rb b/transform.rb deleted file mode 100755 index 6531e841..00000000 --- a/transform.rb +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env ruby - -require "json" -require "liquid" - - -class Hash - def remap(hash={}) - each { |k,v| yield hash, k, v } - hash - end -end - - -ARCS = [ - { name: "ADOPT", r: 130 }, - { name: "TRIAL", r: 220 }, - { name: "ASSESS", r: 310 }, - { name: "HOLD", r: 400 } -] - -class Layout - - OFFSET = { - "Data Mgt" => 0, - "Techniques; Frameworks & Tools" => 90, - "Platforms & Infrastructure" => 180, - "Languages" => 270, - } - - def self.angles(start, step) - Proc.new do - Range.new(start, 90-start).step(step).to_a.shuffle + - Range.new(start + (step * 0.5).to_i, 90-start).step(step).to_a.shuffle - end - end - - ANGLES = { - adopt: angles(10, 13), - trial: angles(8, 12), - assess: angles(6, 10), - hold: angles(4, 8), - } - - def self.instance(quadrant, ring) - @instances ||= {} - @instances["#{quadrant}:#{ring.to_s}"] ||= Layout.new(quadrant, ring) - end - - def initialize(quadrant, ring) - @offset = OFFSET[quadrant] - @angles = ANGLES[ring].call - end - - def next_angle - @offset + @angles.shift.to_i - end -end - - -class Blip - attr_reader :name, :quadrant, :score - - def initialize(name, quadrant, score) - @name, @quadrant, @score = name, quadrant, score - @moved = false - end - - def moved! - @moved = true - end - - def ring - return :adopt if score >= 1.5 - return :trial if score >= 0 - return :assess if score >= -1 - return :hold - end - - def radius - return (50..ARCS[0][:r]-10).to_a.sample if ring == :adopt - return (ARCS[0][:r]+10..ARCS[1][:r]-10).to_a.sample if ring == :trial - return (ARCS[1][:r]+10..ARCS[2][:r]-10).to_a.sample if ring == :assess - return (ARCS[2][:r]+10..ARCS[3][:r]-10).to_a.sample - end - - def angle - Layout.instance(quadrant, ring).next_angle - end - - def movement - @moved ? "t" : "c" - end - - def sortkey - [ ring, name.downcase ] - end - - def as_json - { name: name, pc: { r: radius, t: angle }, movement: movement } - end -end - - -class Radar - def initialize(path) - @blips = Radar.parse(path) - end - - def [](name) - @blips[name] - end - - def track_moves(previous) - @blips.each do |name, blip| - prev_ring = previous[name].ring rescue "nil" - if prev_ring != blip.ring - puts "#{name}: #{prev_ring.upcase} --> #{blip.ring.upcase}" - blip.moved! - end - end - end - - # render blips as json into js template - def render - snippets = @blips.values.group_by(&:quadrant).remap do |hash, key, value| - short_key = key.scan(/\w+/).first.downcase - hash[short_key] = JSON.pretty_generate(value.sort_by(&:sortkey).map(&:as_json)) - end - snippets["arcs"] = JSON.pretty_generate(ARCS) - template = Liquid::Template.parse(open("radar_data.js.liquid").read) - open("radar_data.js", "w") do |out| - out.puts template.render(snippets) - end - end - - # parse tab-separated data (exported from google doc) - def self.parse(path) - blips = {} - open(path).each do |line| - cols = line.split("\t") - name, quadrant, score = cols[0], cols[1], cols[3] - raise "PLEASE DELETE HEADER LINE: #{path}" if score == "AVG" - next if score.nil? || score.strip.empty? - blip = Blip.new(name, quadrant, score.to_f) - blips[blip.name] = blip - end - blips - end -end - -files = Dir["data/*.tsv"] -radar = Radar.new(files.pop) -previous = files.pop -radar.track_moves(Radar.new(previous)) if previous -radar.render -