diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 18f482d..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 356e55b..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index dc9a1d1..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '42 6 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -164,7 +155,7 @@ function onRender( html ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/base/ctor/examples/index.js b/base/ctor/examples/index.js deleted file mode 100644 index 2cc86a1..0000000 --- a/base/ctor/examples/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var Plot = require( './../lib' ); - -// Create a new plot: -var plot = new Plot({ - 'width': 600, - 'height': 480, - 'xScale': 'time', - 'xTickFormat': '%H:%M', - 'renderFormat': 'html' -}); - -console.log( plot.toString() ); diff --git a/base/ctor/lib/defaults.js b/base/ctor/lib/defaults.js deleted file mode 100644 index 4d0e929..0000000 --- a/base/ctor/lib/defaults.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNodeREPL = require( '@stdlib/assert/is-node-repl' ); - - -// MAIN // - -/** -* Returns default options. -* -* @private -* @returns {Object} default options -*/ -function defaults() { - var isREPL; - var o; - - isREPL = isNodeREPL(); - o = {}; - - // Boolean indicating whether to re-render on a change event: - o.autoRender = false; - - // Boolean indicating whether to generate an updated view on a render event: - o.autoView = false; - - // Plot description: - o.description = ''; - - // Rendering engine: - o.engine = 'svg'; - - // Plot height: - o.height = 400; // px - - // Data labels: - o.labels = []; - - // Line opacity: - o.lineOpacity = 0.9; // [0,1] - - // Line style: - o.lineStyle = '-'; - - // Data line width(s): - o.lineWidth = 2; // px - - // FIXME: padding props depend on orientation (may require using `null` to flag) - - // Bottom padding: - o.paddingBottom = 80; // px - - // Left padding: - o.paddingLeft = 90; // px - - // Right padding: - o.paddingRight = 20; // px - - // Top padding: - o.paddingTop = 80; // px - - // Render format: - o.renderFormat = 'vdom'; - - // Plot title: - o.title = ''; - - // Plot viewer: - if ( isREPL ) { - o.viewer = 'window'; - } else { - o.viewer = 'none'; - } - // Plot width: - o.width = 400; // px - - // x-axis orientation: - o.xAxisOrient = 'bottom'; - - // x-axis label: - o.xLabel = 'x'; - - // Maximum value of x-axis domain: - o.xMax = null; - - // Minimum value of x-axis domain: - o.xMin = null; - - // Number of x-axis tick marks: - o.xNumTicks = 5; - - // x-axis tick format: - o.xTickFormat = null; - - // y-axis orientation: - o.yAxisOrient = 'left'; - - // y-axis label: - o.yLabel = 'y'; - - // Maximum value of y-axis domain: - o.yMax = null; - - // Minimum value of y-axis domain: - o.yMin = null; - - // Number of y-axis tick marks: - o.yNumTicks = 5; - - // y-axis tick format: - o.yTickFormat = null; - - return o; -} - - -// EXPORTS // - -module.exports = defaults; diff --git a/base/ctor/lib/index.js b/base/ctor/lib/index.js deleted file mode 100644 index 3ca3c3f..0000000 --- a/base/ctor/lib/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Base constructor for a 2-dimensional plot. -* -* @module @stdlib/plot/base/ctor -* -* @example -* var Plot = require( '@stdlib/plot/base/ctor' ); -* -* var plot = new Plot(); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/ctor/lib/main.js b/base/ctor/lib/main.js deleted file mode 100644 index d06d83c..0000000 --- a/base/ctor/lib/main.js +++ /dev/null @@ -1,1251 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var inherit = require( '@stdlib/utils/inherit' ); -var copy = require( '@stdlib/utils/copy' ); -var mergeFcn = require( '@stdlib/utils/merge' ).factory; -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var minstd = require( '@stdlib/random/base/minstd' ); -var format = require( '@stdlib/string/format' ); -var defaults = require( './defaults.js' ); -var view = require( './view' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var setAutoView = require( './props/auto-view/set.js' ); -var getAutoView = require( './props/auto-view/get.js' ); -var setDescription = require( './props/description/set.js' ); -var getDescription = require( './props/description/get.js' ); -var setEngine = require( './props/engine/set.js' ); -var getEngine = require( './props/engine/get.js' ); -var getGraphHeight = require( './props/graph-height/get.js' ); -var getGraphWidth = require( './props/graph-width/get.js' ); -var setHeight = require( './props/height/set.js' ); -var getHeight = require( './props/height/get.js' ); -var setLabels = require( './props/labels/set.js' ); -var getLabels = require( './props/labels/get.js' ); -var setLineOpacity = require( './props/line-opacity/set.js' ); -var getLineOpacity = require( './props/line-opacity/get.js' ); -var setLineStyle = require( './props/line-style/set.js' ); -var getLineStyle = require( './props/line-style/get.js' ); -var setLineWidth = require( './props/line-width/set.js' ); -var getLineWidth = require( './props/line-width/get.js' ); -var setPaddingBottom = require( './props/padding-bottom/set.js' ); -var getPaddingBottom = require( './props/padding-bottom/get.js' ); -var setPaddingLeft = require( './props/padding-left/set.js' ); -var getPaddingLeft = require( './props/padding-left/get.js' ); -var setPaddingRight = require( './props/padding-right/set.js' ); -var getPaddingRight = require( './props/padding-right/get.js' ); -var setPaddingTop = require( './props/padding-top/set.js' ); -var getPaddingTop = require( './props/padding-top/get.js' ); -var render = require( './render' ); -var stub = require( './render/stub.js' ); -var setRenderFormat = require( './props/render-format/set.js' ); -var getRenderFormat = require( './props/render-format/get.js' ); -var setTitle = require( './props/title/set.js' ); -var getTitle = require( './props/title/get.js' ); -var setViewer = require( './props/viewer/set.js' ); -var getViewer = require( './props/viewer/get.js' ); -var setWidth = require( './props/width/set.js' ); -var getWidth = require( './props/width/get.js' ); -var setXAxisOrient = require( './props/x-axis-orient/set.js' ); -var getXAxisOrient = require( './props/x-axis-orient/get.js' ); -var getXDomain = require( './props/x-domain/get.js' ); -var setXLabel = require( './props/x-label/set.js' ); -var getXLabel = require( './props/x-label/get.js' ); -var setXNumTicks = require( './props/x-num-ticks/set.js' ); -var getXNumTicks = require( './props/x-num-ticks/get.js' ); -var getXPos = require( './props/x-pos/get.js' ); -var getXRange = require( './props/x-range/get.js' ); -var setXTickFormat = require( './props/x-tick-format/set.js' ); -var getXTickFormat = require( './props/x-tick-format/get.js' ); -var setYAxisOrient = require( './props/y-axis-orient/set.js' ); -var getYAxisOrient = require( './props/y-axis-orient/get.js' ); -var getYDomain = require( './props/y-domain/get.js' ); -var setYLabel = require( './props/y-label/set.js' ); -var getYLabel = require( './props/y-label/get.js' ); -var setYNumTicks = require( './props/y-num-ticks/set.js' ); -var getYNumTicks = require( './props/y-num-ticks/get.js' ); -var getYPos = require( './props/y-pos/get.js' ); -var getYRange = require( './props/y-range/get.js' ); -var setYTickFormat = require( './props/y-tick-format/set.js' ); -var getYTickFormat = require( './props/y-tick-format/get.js' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:main' ); -var PRIVATE_PROPS = [ - '_autoRender', - '_autoView', - '_description', - '_engine', - '_height', - '_isDefined', - '_labels', - '_lineOpacity', - '_lineStyle', - '_lineWidth', - '_paddingBottom', - '_paddingLeft', - '_paddingRight', - '_paddingTop', - '_renderFormat', - '_title', - '_viewer', - '_width', - '_xAxisOrient', - '_xData', - '_xLabel', - '_xMax', - '_xMin', - '_xNumTicks', - '_xScale', - '_xTickFormat', - '_yAxisOrient', - '_yData', - '_yLabel', - '_yMax', - '_yMin', - '_yNumTicks', - '_yScale', - '_yTickFormat' -]; - - -// FUNCTIONS // - -var merge = mergeFcn({ - 'extend': false -}); - - -// MAIN // - -/** -* Base plot constructor. -* -* @constructor -* @param {Array} [x] - x values -* @param {Array} [y] - y values -* @param {Options} [options] - constructor options -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @param {boolean} [options.autoView=false] - indicates whether to generate an updated view on a render event -* @param {string} [options.description=''] - description -* @param {string} [options.engine='svg'] - render engine -* @param {PositiveNumber} [options.height=400] - plot height -* @param {(StringArray|EmptyArray)} [options.labels] - data labels -* @param {(number|NumberArray)} [options.lineOpacity=0.9] - line opacity -* @param {(string|StringArray)} [options.lineStyle='-'] - line style(s) -* @param {(NonNegativeInteger|Array)} [options.lineWidth=2] - line width(s) -* @param {NonNegativeInteger} [options.paddingBottom=80] - bottom padding -* @param {NonNegativeInteger} [options.paddingLeft=90] - left padding -* @param {NonNegativeInteger} [options.paddingRight=20] - right padding -* @param {NonNegativeInteger} [options.paddingTop=80] - top padding -* @param {string} [options.renderFormat='vdom'] - render format -* @param {string} [options.title=''] - title -* @param {string} [options.viewer='none'] - viewer -* @param {PositiveNumber} [options.width=400] - plot width -* @param {string} [options.xAxisOrient='bottom'] - x-axis orientation -* @param {string} [options.xLabel='x'] - x-axis label -* @param {(Date|FiniteNumber|null)} [options.xMax=null] - maximum value of x-axis domain -* @param {(Date|FiniteNumber|null)} [options.xMin=null] - minimum value of x-axis domain -* @param {(NonNegativeInteger|null)} [options.xNumTicks=5] - number of x-axis tick marks -* @param {(string|null)} [options.xTickFormat=null] - x-axis tick format -* @param {string} [options.yAxisOrient='left'] - y-axis orientation -* @param {string} [options.yLabel='y'] - y-axis label -* @param {(FiniteNumber|null)} [options.yMax=null] - maximum value of y-axis domain -* @param {(FiniteNumber|null)} [options.yMin=null] - minimum value of y-axis domain -* @param {(NonNegativeInteger|null)} [options.yNumTicks=5] - number of y-axis tick marks -* @param {(string|null)} [options.yTickFormat=null] - y-axis tick format -* @throws {TypeError} must provide valid options -* @returns {Plot} Plot instance -* -* @example -* var plot = new Plot(); -*/ -function Plot() { - var options; - var nargs; - var keys; - var self; - var opts; - var key; - var i; - - nargs = arguments.length; - if ( !(this instanceof Plot) ) { - if ( nargs === 0 ) { - return new Plot(); - } - if ( nargs === 1 ) { - return new Plot( arguments[0] ); - } - if ( nargs === 2 ) { - return new Plot( arguments[0], arguments[1] ); - } - return new Plot( arguments[0], arguments[1], arguments[2] ); - } - self = this; - - opts = defaults(); - if ( nargs === 0 ) { - options = {}; - } else if ( nargs === 1 ) { - options = arguments[ 0 ]; - if ( !isObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - } else if ( nargs === 2 ) { - options = {}; - } else if ( nargs > 2 ) { - if ( !isObject( arguments[ 2 ] ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', arguments[2] ) ); - } - options = copy( arguments[ 2 ] ); // avoid mutation - } - opts = merge( opts, options ); - - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { - defineProperty( this, PRIVATE_PROPS[i], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - }); - } - // Set a clipping path id: - defineProperty( this, '_clipPathId', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': minstd().toString() // TODO: uuid - }); - - // Initialize an internal cache for renderers... - defineProperty( this, '$', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': {} - }); - defineProperty( this.$, 'svg', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': {} - }); - - // Set options... - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - this[ key ] = opts[ key ]; - } - - // Add event listeners: - this.on( 'change', onChange ); - this.on( 'render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - /* eslint-disable no-underscore-dangle */ - debug( 'Received a change event.' ); - if ( self._autoRender ) { - self.render(); - } - } - - /** - * Callback invoked upon receiving a render event. - * - * @private - * @param {*} plot - rendered plot - */ - function onRender( plot ) { - /* eslint-disable no-underscore-dangle */ - debug( 'Received a render event.' ); - if ( self._autoView ) { - debug( 'Viewer: %s.', self._viewer ); - debug( 'Generating view...' ); - view( self, self._viewer, plot ); - } - } -} - -/* -* Inherit from the `EventEmitter` prototype. -*/ -inherit( Plot, EventEmitter ); - -/** -* Rendering mode. -* -* ## Notes -* -* - If `true`, an instance re-renders on each `'change'` event. -* -* @name autoRender -* @memberof Plot.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default true -* -* @example -* var plot = new Plot({ -* 'autoRender': true -* }); -* -* var mode = plot.autoRender; -* // returns true -*/ -defineProperty( Plot.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Viewer mode. -* -* ## Notes -* -* - If `true`, an instance generates an updated view on each render event. -* -* @name autoView -* @memberof Plot.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var plot = new Plot({ -* 'autoView': false -* }); -* -* var mode = plot.autoView; -* // returns false -*/ -defineProperty( Plot.prototype, 'autoView', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoView, - 'get': getAutoView -}); - -/** -* Plot description. -* -* @name description -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default '' -* -* @example -* var plot = new Plot(); -* plot.description = 'A plot description.'; -* -* @example -* var plot = new Plot({ -* 'description': 'A plot description.' -* }); -* var desc = plot.description; -* // returns 'A plot description.' -*/ -defineProperty( Plot.prototype, 'description', { - 'configurable': false, - 'enumerable': true, - 'set': setDescription, - 'get': getDescription -}); - -/** -* Render engine. -* -* @name engine -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a recognized engine -* @default 'svg' -* -* @example -* var plot = new Plot(); -* plot.engine = 'svg'; -* -* @example -* var plot = new Plot({ -* 'engine': 'svg' -* }); -* var engine = plot.engine; -* // returns 'svg' -*/ -defineProperty( Plot.prototype, 'engine', { - 'configurable': false, - 'enumerable': true, - 'set': setEngine, - 'get': getEngine -}); - -/** -* Expected graph height. -* -* @name graphHeight -* @memberof Plot.prototype -* @type {number} -* -* @example -* var plot = new Plot({ -* 'height': 100, -* 'paddingTop': 10, -* 'paddingBottom': 20 -* }); -* var height = plot.graphHeight; -* // returns 70 -*/ -defineProperty( Plot.prototype, 'graphHeight', { - 'configurable': false, - 'enumerable': true, - 'get': getGraphHeight -}); - -/** -* Expected graph width. -* -* @name graphWidth -* @memberof Plot.prototype -* @type {number} -* -* @example -* var plot = new Plot({ -* 'width': 100, -* 'paddingLeft': 10, -* 'paddingRight': 10 -* }); -* var width = plot.graphWidth; -* // returns 80 -*/ -defineProperty( Plot.prototype, 'graphWidth', { - 'configurable': false, - 'enumerable': true, - 'get': getGraphWidth -}); - -/** -* Plot height. -* -* @name height -* @memberof Plot.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 (px) -* -* @example -* var plot = new Plot(); -* plot.height = 100; -* -* @example -* var plot = new Plot({ -* 'height': 360 -* }); -* var height = plot.height; -* // returns 360 -*/ -defineProperty( Plot.prototype, 'height', { - 'configurable': false, - 'enumerable': true, - 'set': setHeight, - 'get': getHeight -}); - -/** -* Data labels. -* -* @name labels -* @memberof Plot.prototype -* @type {(StringArray|EmptyArray)} -* @throws {TypeError} must be either an array of strings or an empty array -* @default [] -* -* @example -* var plot = new Plot(); -* plot.labels = [ 'beep', 'boop' ]; -* -* @example -* var plot = new Plot({ -* 'labels': [ 'beep', 'boop' ] -* }); -* var labels = plot.labels; -* // returns [ 'beep', 'boop' ] -*/ -defineProperty( Plot.prototype, 'labels', { - 'configurable': false, - 'enumerable': true, - 'set': setLabels, - 'get': getLabels -}); - -/** -* Line opacity. -* -* ## Notes -* -* - When retrieved, the returned value is always an `array`. -* -* @name lineOpacity -* @memberof Plot.prototype -* @type {(number|NumberArray)} -* @throws {TypeError} must be a number or number array -* @throws {RangeError} must be a number on the interval `[0,1]` -* @default '0.9' -* -* @example -* var plot = new Plot(); -* plot.lineOpacity = [ 1.0, 0.5 ]; -* -* @example -* var plot = new Plot({ -* 'lineOpacity': 0.5 -* }); -* var opacity = plot.lineOpacity; -* // returns [ 0.5 ] -*/ -defineProperty( Plot.prototype, 'lineOpacity', { - 'configurable': false, - 'enumerable': true, - 'set': setLineOpacity, - 'get': getLineOpacity -}); - -/** -* Line style(s). -* -* ## Notes -* -* - When retrieved, the returned value is always an `array`. -* -* @name lineStyle -* @memberof Plot.prototype -* @type {(string|StringArray)} -* @throws {TypeError} must be a string or string array -* @throws {Error} must be a supported line style -* @default '-' -* -* @example -* var plot = new Plot(); -* plot.lineStyle = [ '-', 'none' ]; -* -* @example -* var plot = new Plot({ -* 'lineStyle': 'none' -* }); -* var lineStyle = plot.lineStyle; -* // returns [ 'none' ] -*/ -defineProperty( Plot.prototype, 'lineStyle', { - 'configurable': false, - 'enumerable': true, - 'set': setLineStyle, - 'get': getLineStyle -}); - -/** -* Line width. -* -* ## Notes -* -* - When retrieved, the returned value is always an `array`. -* -* @name lineWidth -* @memberof Plot.prototype -* @type {(NonNegativeInteger|NonNegativeIntegerArray)} -* @throws {TypeError} must be a nonnegative integer or nonnegative integer array -* @default 2 -* -* @example -* var plot = new Plot(); -* plot.lineWidth = 1; -* -* @example -* var plot = new Plot({ -* 'lineWidth': [ 1, 3 ] -* }); -* var width = plot.lineWidth; -* // returns [ 1, 3 ] -*/ -defineProperty( Plot.prototype, 'lineWidth', { - 'configurable': false, - 'enumerable': true, - 'set': setLineWidth, - 'get': getLineWidth -}); - -/** -* Plot bottom padding. -* -* ## Notes -* -* - Typically used to create space for a bottom-oriented y-axis. -* -* @name paddingBottom -* @memberof Plot.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 80 (px) -* -* @example -* var plot = new Plot(); -* plot.paddingBottom = 100; -* -* @example -* var plot = new Plot({ -* 'paddingBottom': 100 -* }); -* var padding = plot.paddingBottom; -* // returns 100 -*/ -defineProperty( Plot.prototype, 'paddingBottom', { - 'configurable': false, - 'enumerable': true, - 'set': setPaddingBottom, - 'get': getPaddingBottom -}); - -/** -* Plot left padding. -* -* ## Notes -* -* - Typically used to create space for a left-oriented y-axis. -* -* @name paddingLeft -* @memberof Plot.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 90 (px) -* -* @example -* var plot = new Plot(); -* plot.paddingLeft = 100; -* -* @example -* var plot = new Plot({ -* 'paddingLeft': 100 -* }); -* var padding = plot.paddingLeft; -* // returns 100 -*/ -defineProperty( Plot.prototype, 'paddingLeft', { - 'configurable': false, - 'enumerable': true, - 'set': setPaddingLeft, - 'get': getPaddingLeft -}); - -/** -* Plot right padding. -* -* ## Notes -* -* - Typically used to create space for a right-oriented y-axis. -* -* @name paddingRight -* @memberof Plot.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 20 (px) -* -* @example -* var plot = new Plot(); -* plot.paddingRight = 100; -* -* @example -* var plot = new Plot({ -* 'paddingRight': 100 -* }); -* var padding = plot.paddingRight; -* // returns 100 -*/ -defineProperty( Plot.prototype, 'paddingRight', { - 'configurable': false, - 'enumerable': true, - 'set': setPaddingRight, - 'get': getPaddingRight -}); - -/** -* Plot top padding. -* -* ## Notes -* -* - Typically used to create space for a title or top-oriented x-axis. -* -* @name paddingTop -* @memberof Plot.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 80 (px) -* -* @example -* var plot = new Plot(); -* plot.paddingTop = 100; -* -* @example -* var plot = new Plot({ -* 'paddingTop': 100 -* }); -* var padding = plot.paddingTop; -* // returns 100 -*/ -defineProperty( Plot.prototype, 'paddingTop', { - 'configurable': false, - 'enumerable': true, - 'set': setPaddingTop, - 'get': getPaddingTop -}); - -/** -* Renders a plot. -* -* @name render -* @memberof Plot.prototype -* @type {Function} -* @param {string} [format] - render format -* @throws {TypeError} must provide a recognized format -* @returns {(VTree|string)} virtual tree or string -* -* @example -* var plot = new Plot(); -* var out = plot.render(); -* -* @example -* var plot = new Plot(); -* var out = plot.render( 'html' ); -*/ -setReadOnly( Plot.prototype, 'render', render ); - -/** -* Renders a plot. -* -* ## Notes -* -* - This method **should** be implemented by descendants. -* -* @private -* @name _render -* @memberof Plot.prototype -* @type {Function} -* @param {string} format - render format -* @returns {(VTree|string)} rendered plot -*/ -setReadOnly( Plot.prototype, '_render', stub ); - -/** -* Render format. -* -* @name renderFormat -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a recognized format -* @default 'vdom' -* -* @example -* var plot = new Plot(); -* plot.renderFormat = 'vdom'; -* -* @example -* var plot = new Plot({ -* 'renderFormat': 'html' -* }); -* var fmt = plot.renderFormat; -* // returns 'html' -*/ -defineProperty( Plot.prototype, 'renderFormat', { - 'configurable': false, - 'enumerable': true, - 'set': setRenderFormat, - 'get': getRenderFormat -}); - -/** -* Plot title. -* -* @name title -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default '' -* -* @example -* var plot = new Plot(); -* plot.title = 'Plot'; -* -* @example -* var plot = new Plot({ -* 'title': 'Plot' -* }); -* var t = plot.title; -* // returns 'Plot' -*/ -defineProperty( Plot.prototype, 'title', { - 'configurable': false, - 'enumerable': true, - 'set': setTitle, - 'get': getTitle -}); - -/** -* Plot viewer. -* -* @name viewer -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a recognized viewer -* @default 'none' -* -* @example -* var plot = new Plot(); -* plot.viewer = 'none'; -* -* @example -* var plot = new Plot({ -* 'viewer': 'none' -* }); -* var viewer = plot.viewer; -* // returns 'none' -*/ -defineProperty( Plot.prototype, 'viewer', { - 'configurable': false, - 'enumerable': true, - 'set': setViewer, - 'get': getViewer -}); - -/** -* Plot width. -* -* @name width -* @memberof Plot.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 (px) -* -* @example -* var plot = new Plot(); -* plot.width = 100; -* -* @example -* var plot = new Plot({ -* 'width': 480 -* }); -* var width = plot.width; -* // returns 480 -*/ -defineProperty( Plot.prototype, 'width', { - 'configurable': false, - 'enumerable': true, - 'set': setWidth, - 'get': getWidth -}); - -/** -* x-axis orientation. -* -* @name xAxisOrient -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be either `'top'` or `'bottom'` -* @default 'bottom' -* -* @example -* var plot = new Plot(); -* plot.xAxisOrient = 'bottom'; -* -* @example -* var plot = new Plot({ -* 'xAxisOrient': 'bottom' -* }); -* var orientation = plot.xAxisOrient; -* // returns 'bottom' -*/ -defineProperty( Plot.prototype, 'xAxisOrient', { - 'configurable': false, - 'enumerable': true, - 'set': setXAxisOrient, - 'get': getXAxisOrient -}); - -/** -* x-axis domain. -* -* @name xDomain -* @memberof Plot.prototype -* @type {Array} -* -* @example -* var plot = new Plot({ -* 'xMin': 0, -* 'xMax': 100 -* }); -* var domain = plot.xDomain; -* // returns [ 0, 100 ] -*/ -defineProperty( Plot.prototype, 'xDomain', { - 'configurable': false, - 'enumerable': true, - 'get': getXDomain -}); - -/** -* x-axis label. -* -* @name xLabel -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default 'x' -* -* @example -* var plot = new Plot(); -* plot.xLabel = 'time'; -* -* @example -* var plot = new Plot({ -* 'xLabel': 'time' -* }); -* var xLabel = plot.xLabel; -* // returns 'time' -*/ -defineProperty( Plot.prototype, 'xLabel', { - 'configurable': false, - 'enumerable': true, - 'set': setXLabel, - 'get': getXLabel -}); - -/** -* Number of x-axis tick marks. -* -* @name xNumTicks -* @memberof Plot.prototype -* @type {(NonNegativeInteger|null)} -* @throws {TypeError} must be a nonnegative integer or null -* @default 5 -* -* @example -* var plot = new Plot(); -* plot.xNumTicks = 10; -* -* @example -* var plot = new Plot({ -* 'xNumTicks': 10 -* }); -* var ticks = plot.xNumTicks; -* // returns 10 -*/ -defineProperty( Plot.prototype, 'xNumTicks', { - 'configurable': false, - 'enumerable': true, - 'set': setXNumTicks, - 'get': getXNumTicks -}); - -/** -* Function to map values to x-axis coordinate values. -* -* @name xPos -* @memberof Plot.prototype -* @type {Function} -* -* @example -* var plot = new Plot(); -* var xPos = plot.xPos; -* // returns -*/ -defineProperty( Plot.prototype, 'xPos', { - 'configurable': false, - 'enumerable': true, - 'get': getXPos -}); - -/** -* x-axis range. -* -* @name xRange -* @memberof Plot.prototype -* @type {NumberArray} -* -* @example -* var plot = new Plot({ -* 'width': 100, -* 'paddingLeft': 10, -* 'paddingRight': 10 -* }); -* var range = plot.xRange; -* // returns [ 0, 80 ] -*/ -defineProperty( Plot.prototype, 'xRange', { - 'configurable': false, - 'enumerable': true, - 'get': getXRange -}); - -/** -* x-axis tick format. -* -* ## Notes -* -* - When retrieved, if the value is not `null`, the returned value is a formatting function. -* -* @name xTickFormat -* @memberof Plot.prototype -* @type {(string|null)} -* @throws {TypeError} must be a string or null -* @default null -* -* @example -* var plot = new Plot(); -* plot.xScale = 'time'; -* plot.xTickFormat = '%H:%M'; -* -* @example -* var plot = new Plot({ -* 'xScale': 'time', -* 'xTickFormat': '%H:%M' -* }); -* var fmt = plot.xTickFormat; -* // returns -*/ -defineProperty( Plot.prototype, 'xTickFormat', { - 'configurable': false, - 'enumerable': true, - 'set': setXTickFormat, - 'get': getXTickFormat -}); - -/** -* y-axis orientation. -* -* @name yAxisOrient -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be either `'left'` or `'right'` -* @default 'left' -* -* @example -* var plot = new Plot(); -* plot.yAxisOrient = 'left'; -* -* @example -* var plot = new Plot({ -* 'yAxisOrient': 'left' -* }); -* var orientation = plot.yAxisOrient; -* // returns 'left' -*/ -defineProperty( Plot.prototype, 'yAxisOrient', { - 'configurable': false, - 'enumerable': true, - 'set': setYAxisOrient, - 'get': getYAxisOrient -}); - -/** -* y-axis domain. -* -* @name yDomain -* @memberof Plot.prototype -* @type {Array} -* -* @example -* var plot = new Plot({ -* 'yMin': 0, -* 'yMax': 100 -* }); -* var domain = plot.yDomain; -* // returns [ 0, 100 ] -*/ -defineProperty( Plot.prototype, 'yDomain', { - 'configurable': false, - 'enumerable': true, - 'get': getYDomain -}); - -/** -* y-axis label. -* -* @name yLabel -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default 'y' -* -* @example -* var plot = new Plot(); -* plot.yLabel = 'value'; -* -* @example -* var plot = new Plot({ -* 'yLabel': 'value' -* }); -* var yLabel = plot.yLabel; -* // returns 'value' -*/ -defineProperty( Plot.prototype, 'yLabel', { - 'configurable': false, - 'enumerable': true, - 'set': setYLabel, - 'get': getYLabel -}); - -/** -* Number of y-axis tick marks. -* -* @name yNumTicks -* @memberof Plot.prototype -* @type {(NonNegativeInteger|null)} -* @throws {TypeError} must be a nonnegative integer or null -* @default 5 -* -* @example -* var plot = new Plot(); -* plot.yNumTicks = 10; -* -* @example -* var plot = new Plot({ -* 'yNumTicks': 10 -* }); -* var ticks = plot.yNumTicks; -* // returns 10 -*/ -defineProperty( Plot.prototype, 'yNumTicks', { - 'configurable': false, - 'enumerable': true, - 'set': setYNumTicks, - 'get': getYNumTicks -}); - -/** -* Function to map values to y-axis coordinate values. -* -* @name yPos -* @memberof Plot.prototype -* @type {Function} -* -* @example -* var plot = new Plot(); -* var yPos = plot.yPos; -* // returns -*/ -defineProperty( Plot.prototype, 'yPos', { - 'configurable': false, - 'enumerable': true, - 'get': getYPos -}); - -/** -* y-axis range. -* -* @name yRange -* @memberof Plot.prototype -* @type {NumberArray} -* -* @example -* var plot = new Plot({ -* 'height': 100, -* 'paddingTop': 10, -* 'paddingBottom': 20 -* }); -* var range = plot.yRange; -* // returns [ 70, 0 ] -*/ -defineProperty( Plot.prototype, 'yRange', { - 'configurable': false, - 'enumerable': true, - 'get': getYRange -}); - -/** -* y-axis tick format. -* -* ## Notes -* -* - If the value is not `null`, when retrieved, the returned value is a formatting function. -* -* @name yTickFormat -* @memberof Plot.prototype -* @type {(string|null)} -* @throws {TypeError} must be a string or null -* @default null -* -* @example -* var plot = new Plot(); -* plot.yTickFormat = '.0%'; -* -* @example -* var plot = new Plot({ -* 'yTickFormat': '.0%' -* }); -* var fmt = plot.yTickFormat; -* // returns -*/ -defineProperty( Plot.prototype, 'yTickFormat', { - 'configurable': false, - 'enumerable': true, - 'set': setYTickFormat, - 'get': getYTickFormat -}); - -/** -* Generates a plot view. -* -* @name view -* @memberof Plot.prototype -* @type {Function} -* @param {string} [viewer] - viewer -* @throws {TypeError} must provide a recognized viewer -* -* @example -* var plot = new Plot(); -* plot.x = [ [ 1, 2, 3 ] ]; -* plot.view( 'stdout' ); -*/ -setReadOnly( Plot.prototype, 'view', view ); - - -// EXPORTS // - -module.exports = Plot; diff --git a/base/ctor/lib/props/auto-render/get.js b/base/ctor/lib/props/auto-render/get.js deleted file mode 100644 index 7df40de..0000000 --- a/base/ctor/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/auto-render/set.js b/base/ctor/lib/props/auto-render/set.js deleted file mode 100644 index de3b2bd..0000000 --- a/base/ctor/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:auto-render' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); - } - if ( bool !== this._autoRender ) { - debug( 'Current value: %s.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %s.', this._autoRender ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/auto-view/get.js b/base/ctor/lib/props/auto-view/get.js deleted file mode 100644 index 5b414b9..0000000 --- a/base/ctor/lib/props/auto-view/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the viewing mode. -* -* @private -* @returns {boolean} viewing mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoView; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/auto-view/set.js b/base/ctor/lib/props/auto-view/set.js deleted file mode 100644 index 3200d91..0000000 --- a/base/ctor/lib/props/auto-view/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:auto-view' ); - - -// MAIN // - -/** -* Sets the viewing mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to generate an updated view on a render event -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoView', bool ) ); - } - if ( bool !== this._autoView ) { - debug( 'Current value: %s.', this._autoView ); - - this._autoView = bool; - debug( 'New Value: %s.', this._autoView ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/description/get.js b/base/ctor/lib/props/description/get.js deleted file mode 100644 index d67c978..0000000 --- a/base/ctor/lib/props/description/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the description. -* -* @private -* @returns {string} description -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._description; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/description/set.js b/base/ctor/lib/props/description/set.js deleted file mode 100644 index 1f20f56..0000000 --- a/base/ctor/lib/props/description/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:description' ); - - -// MAIN // - -/** -* Sets the description. -* -* @private -* @param {string} str - description -* @throws {TypeError} must be a string -*/ -function set( str ) { - /* eslint-disable no-invalid-this */ - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'description', str ) ); - } - if ( str !== this._description ) { - debug( 'Current value: %s.', this._description ); - - this._description = str; - debug( 'New value: %s.', this._description ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/engine/engines.json b/base/ctor/lib/props/engine/engines.json deleted file mode 100644 index 00a90eb..0000000 --- a/base/ctor/lib/props/engine/engines.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "svg" -] diff --git a/base/ctor/lib/props/engine/get.js b/base/ctor/lib/props/engine/get.js deleted file mode 100644 index adcb427..0000000 --- a/base/ctor/lib/props/engine/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the render engine. -* -* @private -* @returns {string} engine -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._engine; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/engine/set.js b/base/ctor/lib/props/engine/set.js deleted file mode 100644 index a830f48..0000000 --- a/base/ctor/lib/props/engine/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var contains = require( '@stdlib/assert/contains' ); -var format = require( '@stdlib/string/format' ); -var ENGINES = require( './engines.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:engine' ); - - -// MAIN // - -/** -* Sets the engine. -* -* @private -* @param {string} engine - engine -* @throws {TypeError} must be a recognized engine -*/ -function set( engine ) { - /* eslint-disable no-invalid-this */ - if ( !contains( ENGINES, engine ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'engine', ENGINES.join( '", "' ), engine ) ); - } - if ( engine !== this._engine ) { - debug( 'Current value: %s.', this._engine ); - - this._engine = engine; - debug( 'New value: %s.', this._engine ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/graph-height/get.js b/base/ctor/lib/props/graph-height/get.js deleted file mode 100644 index a3da4e0..0000000 --- a/base/ctor/lib/props/graph-height/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the expected graph height. -* -* @private -* @returns {number} graph height -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._height - this._paddingTop - this._paddingBottom; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/graph-width/get.js b/base/ctor/lib/props/graph-width/get.js deleted file mode 100644 index 21a60f9..0000000 --- a/base/ctor/lib/props/graph-width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the expected graph width. -* -* @private -* @returns {number} graph width -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._width - this._paddingLeft - this._paddingRight; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/height/get.js b/base/ctor/lib/props/height/get.js deleted file mode 100644 index 64bcb89..0000000 --- a/base/ctor/lib/props/height/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the height. -* -* @private -* @returns {number} height -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._height; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/height/set.js b/base/ctor/lib/props/height/set.js deleted file mode 100644 index d965f9d..0000000 --- a/base/ctor/lib/props/height/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:height' ); - - -// MAIN // - -/** -* Sets the height. -* -* @private -* @param {PositiveNumber} height - height -* @throws {TypeError} must be a positive number -*/ -function set( height ) { - /* eslint-disable no-invalid-this */ - if ( !isPositiveNumber( height ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'height', height ) ); - } - if ( height !== this._height ) { - debug( 'Current value: %d.', this._height ); - - this._height = height; - debug( 'New Value: %d.', this._height ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/labels/get.js b/base/ctor/lib/props/labels/get.js deleted file mode 100644 index 8188d4f..0000000 --- a/base/ctor/lib/props/labels/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the data labels. -* -* @private -* @returns {(EmptyArray|StringArray)} labels -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._labels.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/labels/set.js b/base/ctor/lib/props/labels/set.js deleted file mode 100644 index 6d680d5..0000000 --- a/base/ctor/lib/props/labels/set.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isEmptyArray = require( '@stdlib/assert/is-empty-array' ); -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:labels' ); - - -// MAIN // - -/** -* Sets the data labels. -* -* @private -* @param {(StringArray|EmptyArray)} labels - data labels -* @throws {TypeError} must be either an array of strings or an empty array -*/ -function set( labels ) { - /* eslint-disable no-invalid-this */ - if ( !isEmptyArray( labels ) && !isStringArray( labels ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be an array of strings or an empty array. Value: `%s`.', 'labels', labels ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._labels ) ); - - this._labels = labels.slice(); - debug( 'New Value: %s.', JSON.stringify( this._labels ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/line-opacity/get.js b/base/ctor/lib/props/line-opacity/get.js deleted file mode 100644 index b679366..0000000 --- a/base/ctor/lib/props/line-opacity/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the line opacity. -* -* @private -* @returns {NumberArray} line opacity -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._lineOpacity.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/line-opacity/set.js b/base/ctor/lib/props/line-opacity/set.js deleted file mode 100644 index 35abfb4..0000000 --- a/base/ctor/lib/props/line-opacity/set.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isNumberArray = require( '@stdlib/assert/is-number-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:line-opacity' ); - - -// MAIN // - -/** -* Sets the line opacity. -* -* @private -* @param {(number|NumberArray)} v - opacity -* @throws {TypeError} must be a number or number array -* @throws {RangeError} must be a number on the interval `[0,1]` -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isNum = isNumber( v ); - var i; - if ( !isNum && !isNumberArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number or an array of numbers. Value: `%s`.', 'lineOpacity', v ) ); - } - if ( isNum ) { - v = [ v ]; - } else { - v = v.slice(); - } - for ( i = 0; i < v.length; i++ ) { - if ( v[ i ] < 0.0 || v[ i ] > 1.0 ) { - throw new RangeError( format( 'invalid assignment. A `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'lineOpacity', v[i] ) ); - } - } - debug( 'Current value: %s.', JSON.stringify( this._lineOpacity ) ); - - this._lineOpacity = v; - debug( 'New Value: %s.', JSON.stringify( this._lineOpacity ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/line-style/get.js b/base/ctor/lib/props/line-style/get.js deleted file mode 100644 index 61d078c..0000000 --- a/base/ctor/lib/props/line-style/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the line style(s). -* -* @private -* @returns {StringArray} line style(s) -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._lineStyle.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/line-style/line_styles.json b/base/ctor/lib/props/line-style/line_styles.json deleted file mode 100644 index 94d97ef..0000000 --- a/base/ctor/lib/props/line-style/line_styles.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "-", - "--", - ":", - "-.", - "none" -] diff --git a/base/ctor/lib/props/line-style/set.js b/base/ctor/lib/props/line-style/set.js deleted file mode 100644 index f539119..0000000 --- a/base/ctor/lib/props/line-style/set.js +++ /dev/null @@ -1,74 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var format = require( '@stdlib/string/format' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var LINESTYLES = require( './line_styles.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:line-style' ); - - -// MAIN // - -/** -* Sets the line style(s). -* -* @private -* @param {(string|StringArray)} v - line style(s) -* @throws {TypeError} must be a string or string array -* @throws {Error} must be a supported line style -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isStr = isString( v ); - var i; - if ( !isStr && !isStringArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.', 'lineStyle', v ) ); - } - if ( isStr ) { - v = [ v ]; - } else { - v = v.slice(); - } - for ( i = 0; i < v.length; i++ ) { - if ( indexOf( LINESTYLES, v[i] ) === -1 ) { - throw new Error( format( 'invalid assignment. Unsupported/unrecognized line style. Must be one of the following: "%s". Value: `%s`.', LINESTYLES.join( '", "' ), v[i] ) ); - } - } - debug( 'Current value: %s.', JSON.stringify( this._lineStyle ) ); - - this._lineStyle = v; - debug( 'New Value: %s.', JSON.stringify( this._lineStyle ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/line-width/get.js b/base/ctor/lib/props/line-width/get.js deleted file mode 100644 index 4a44698..0000000 --- a/base/ctor/lib/props/line-width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the line width. -* -* @private -* @returns {Array} line width(s) -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._lineWidth.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/line-width/set.js b/base/ctor/lib/props/line-width/set.js deleted file mode 100644 index 54fbe80..0000000 --- a/base/ctor/lib/props/line-width/set.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isNonNegativeIntegerArray = require( '@stdlib/assert/is-nonnegative-integer-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:line-width' ); - - -// MAIN // - -/** -* Sets the line width(s). -* -* @private -* @param {(NonNegativeInteger|Array)} v - width -* @throws {TypeError} must be a nonnegative integer or nonnegative integer array -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isInt = isNonNegativeInteger( v ); - if ( !isInt && !isNonNegativeIntegerArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or an array of nonnegative integers. Value: `%s`.', 'lineWidth', v ) ); - } - if ( isInt ) { - v = [ v ]; - } else { - v = v.slice(); - } - debug( 'Current value: %s.', JSON.stringify( this._lineWidth ) ); - - this._lineWidth = v; - debug( 'New Value: %s.', JSON.stringify( this._lineWidth ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/padding-bottom/get.js b/base/ctor/lib/props/padding-bottom/get.js deleted file mode 100644 index af214a0..0000000 --- a/base/ctor/lib/props/padding-bottom/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the bottom padding. -* -* @private -* @returns {number} padding -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._paddingBottom; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/padding-bottom/set.js b/base/ctor/lib/props/padding-bottom/set.js deleted file mode 100644 index fa8027b..0000000 --- a/base/ctor/lib/props/padding-bottom/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:padding-bottom' ); - - -// MAIN // - -/** -* Sets the bottom padding. -* -* @private -* @param {NonNegativeInteger} padding - padding -* @throws {TypeError} must be a nonnegative integer -*/ -function set( padding ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( padding ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingBottom', padding ) ); - } - if ( padding !== this._paddingBottom ) { - debug( 'Current value: %d.', this._paddingBottom ); - - this._paddingBottom = padding; - debug( 'New value: %d.', this._paddingBottom ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/padding-left/get.js b/base/ctor/lib/props/padding-left/get.js deleted file mode 100644 index 162c41b..0000000 --- a/base/ctor/lib/props/padding-left/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the left padding. -* -* @private -* @returns {number} padding -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._paddingLeft; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/padding-left/set.js b/base/ctor/lib/props/padding-left/set.js deleted file mode 100644 index 1de72a8..0000000 --- a/base/ctor/lib/props/padding-left/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:padding-left' ); - - -// MAIN // - -/** -* Sets the left padding. -* -* @private -* @param {NonNegativeInteger} padding - padding -* @throws {TypeError} must be a nonnegative integer -*/ -function set( padding ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( padding ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingLeft', padding ) ); - } - if ( padding !== this._paddingLeft ) { - debug( 'Current value: %d.', this._paddingLeft ); - - this._paddingLeft = padding; - debug( 'New value: %d.', this._paddingLeft ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/padding-right/get.js b/base/ctor/lib/props/padding-right/get.js deleted file mode 100644 index 3da30d1..0000000 --- a/base/ctor/lib/props/padding-right/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the right padding. -* -* @private -* @returns {number} padding -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._paddingRight; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/padding-right/set.js b/base/ctor/lib/props/padding-right/set.js deleted file mode 100644 index 82ae5a6..0000000 --- a/base/ctor/lib/props/padding-right/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:padding-right' ); - - -// MAIN // - -/** -* Sets the right padding. -* -* @private -* @param {NonNegativeInteger} padding - padding -* @throws {TypeError} must be a nonnegative integer -*/ -function set( padding ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( padding ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingRight', padding ) ); - } - if ( padding !== this._paddingRight ) { - debug( 'Current value: %d.', this._paddingRight ); - - this._paddingRight = padding; - debug( 'New value: %d.', this._paddingRight ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/padding-top/get.js b/base/ctor/lib/props/padding-top/get.js deleted file mode 100644 index 4afa617..0000000 --- a/base/ctor/lib/props/padding-top/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the top padding. -* -* @private -* @returns {number} padding -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._paddingTop; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/padding-top/set.js b/base/ctor/lib/props/padding-top/set.js deleted file mode 100644 index c20f63e..0000000 --- a/base/ctor/lib/props/padding-top/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:padding-top' ); - - -// MAIN // - -/** -* Sets the top padding. -* -* @private -* @param {NonNegativeInteger} padding - padding -* @throws {TypeError} must be a nonnegative integer -*/ -function set( padding ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( padding ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingTop', padding ) ); - } - if ( padding !== this._paddingTop ) { - debug( 'Current value: %d.', this._paddingTop ); - - this._paddingTop = padding; - debug( 'New value: %d.', this._paddingTop ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/render-format/formats.json b/base/ctor/lib/props/render-format/formats.json deleted file mode 100644 index 7479e77..0000000 --- a/base/ctor/lib/props/render-format/formats.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "vdom", - "html" -] diff --git a/base/ctor/lib/props/render-format/get.js b/base/ctor/lib/props/render-format/get.js deleted file mode 100644 index 8b42464..0000000 --- a/base/ctor/lib/props/render-format/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the render format. -* -* @private -* @returns {string} format -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._renderFormat; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/render-format/set.js b/base/ctor/lib/props/render-format/set.js deleted file mode 100644 index 9eb41a1..0000000 --- a/base/ctor/lib/props/render-format/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var FORMATS = require( './formats.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:render-format' ); - - -// MAIN // - -/** -* Sets the render format. -* -* @private -* @param {string} fmt - format -* @throws {TypeError} must be a recognized render format -*/ -function set( fmt ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( FORMATS, fmt ) === -1 ) { - throw new TypeError( format( 'invalid assignment. Unrecognized/unsupported `%s`. Must be one of the following: "%s". Value: `%s`.', 'format', FORMATS.join( '", "' ), fmt ) ); - } - if ( fmt !== this._renderFormat ) { - debug( 'Current value: %s.', this._renderFormat ); - - this._renderFormat = fmt; - debug( 'New value: %s.', this._renderFormat ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/title/get.js b/base/ctor/lib/props/title/get.js deleted file mode 100644 index 9417faa..0000000 --- a/base/ctor/lib/props/title/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the title. -* -* @private -* @returns {string} title -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._title; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/title/set.js b/base/ctor/lib/props/title/set.js deleted file mode 100644 index fcb285d..0000000 --- a/base/ctor/lib/props/title/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:title' ); - - -// MAIN // - -/** -* Sets the title. -* -* @private -* @param {string} str - title -* @throws {TypeError} must be a string -*/ -function set( str ) { - /* eslint-disable no-invalid-this */ - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'title', str ) ); - } - if ( str !== this._title ) { - debug( 'Current value: %s.', this._title ); - - this._title = str; - debug( 'New value: %s.', this._title ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/viewer/get.js b/base/ctor/lib/props/viewer/get.js deleted file mode 100644 index a8044ca..0000000 --- a/base/ctor/lib/props/viewer/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the plot viewer. -* -* @private -* @returns {string} viewer -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._viewer; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/viewer/set.js b/base/ctor/lib/props/viewer/set.js deleted file mode 100644 index fd2fb24..0000000 --- a/base/ctor/lib/props/viewer/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var VIEWERS = require( './viewers.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:viewer' ); - - -// MAIN // - -/** -* Sets the viewer. -* -* @private -* @param {string} viewer - viewer -* @throws {TypeError} must be a recognized viewer -*/ -function set( viewer ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( VIEWERS, viewer ) === -1 ) { - throw new TypeError( format( 'invalid assignment. Unrecognized/unsupported `%s`. Value: `%s`.', 'viewer', viewer ) ); - } - if ( viewer !== this._viewer ) { - debug( 'Current value: %s.', this._viewer ); - - this._viewer = viewer; - debug( 'New value: %s.', this._viewer ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/viewer/viewers.json b/base/ctor/lib/props/viewer/viewers.json deleted file mode 100644 index f515292..0000000 --- a/base/ctor/lib/props/viewer/viewers.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "none", - "browser", - "terminal", - "stdout", - "window" -] diff --git a/base/ctor/lib/props/width/get.js b/base/ctor/lib/props/width/get.js deleted file mode 100644 index cfa5f0e..0000000 --- a/base/ctor/lib/props/width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the width. -* -* @private -* @returns {number} width -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._width; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/width/set.js b/base/ctor/lib/props/width/set.js deleted file mode 100644 index 1368f5e..0000000 --- a/base/ctor/lib/props/width/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:width' ); - - -// MAIN // - -/** -* Sets the width. -* -* @private -* @param {PositiveNumber} width - width -* @throws {TypeError} must be a positive number -*/ -function set( width ) { - /* eslint-disable no-invalid-this */ - if ( !isPositiveNumber( width ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'width', width ) ); - } - if ( width !== this._width ) { - debug( 'Current value: %d.', this._width ); - - this._width = width; - debug( 'New value: %d.', this._width ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/x-axis-orient/get.js b/base/ctor/lib/props/x-axis-orient/get.js deleted file mode 100644 index a96e518..0000000 --- a/base/ctor/lib/props/x-axis-orient/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-axis orientation. -* -* @private -* @returns {string} orientation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xAxisOrient; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/x-axis-orient/orientations.json b/base/ctor/lib/props/x-axis-orient/orientations.json deleted file mode 100644 index 1e375c3..0000000 --- a/base/ctor/lib/props/x-axis-orient/orientations.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "bottom", - "top" -] diff --git a/base/ctor/lib/props/x-axis-orient/set.js b/base/ctor/lib/props/x-axis-orient/set.js deleted file mode 100644 index 23cfa4f..0000000 --- a/base/ctor/lib/props/x-axis-orient/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var ORIENTATIONS = require( './orientations.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:x-axis-orient' ); - - -// MAIN // - -/** -* Sets the x-axis orientation. -* -* @private -* @param {string} orientation - axis orientation -* @throws {TypeError} must be either `'bottom'` or `'top'` -*/ -function set( orientation ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( ORIENTATIONS, orientation ) === -1 ) { - throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'xAxisOrient', ORIENTATIONS.join( '", "' ), orientation ) ); - } - if ( orientation !== this._xAxisOrient ) { - debug( 'Current value: %s.', this._xAxisOrient ); - - this._xAxisOrient = orientation; - debug( 'New value: %s.', this._xAxisOrient ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/x-domain/get.js b/base/ctor/lib/props/x-domain/get.js deleted file mode 100644 index 44e571f..0000000 --- a/base/ctor/lib/props/x-domain/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-axis domain. -* -* @private -* @returns {Array} domain -*/ -function get() { - /* eslint-disable no-invalid-this */ - return [ this.xMin, this.xMax ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/x-label/get.js b/base/ctor/lib/props/x-label/get.js deleted file mode 100644 index eeec342..0000000 --- a/base/ctor/lib/props/x-label/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-axis label. -* -* @private -* @returns {string} label -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xLabel; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/x-label/set.js b/base/ctor/lib/props/x-label/set.js deleted file mode 100644 index 1774448..0000000 --- a/base/ctor/lib/props/x-label/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:x-label' ); - - -// MAIN // - -/** -* Sets the x-axis label. -* -* @private -* @param {string} label - axis label -* @throws {TypeError} must be a string -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( !isString( label ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'xLabel', label ) ); - } - if ( label !== this._xLabel ) { - debug( 'Current value: %s.', this._xLabel ); - - this._xLabel = label; - debug( 'New value: %s.', this._xLabel ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/x-num-ticks/get.js b/base/ctor/lib/props/x-num-ticks/get.js deleted file mode 100644 index 02dc4ef..0000000 --- a/base/ctor/lib/props/x-num-ticks/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the number of x-axis tick marks. -* -* @private -* @returns {(NonNegativeInteger|null)} number of ticks -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xNumTicks; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/x-num-ticks/set.js b/base/ctor/lib/props/x-num-ticks/set.js deleted file mode 100644 index dffc6f4..0000000 --- a/base/ctor/lib/props/x-num-ticks/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:x-num-ticks' ); - - -// MAIN // - -/** -* Sets the number of x-axis tick marks. -* -* @private -* @param {(NonNegativeInteger|null)} ticks - number of ticks -* @throws {TypeError} must be a nonnegative integer or null -*/ -function set( ticks ) { - /* eslint-disable no-invalid-this */ - if ( !isNull( ticks ) && !isNonNegativeInteger( ticks ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or null. Value: `%s`.', 'xNumTicks', ticks ) ); - } - if ( ticks !== this._xNumTicks ) { - debug( 'Current value: %d.', this._xNumTicks ); - - this._xNumTicks = ticks; - debug( 'New value: %d.', this._xNumTicks ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/x-pos/get.js b/base/ctor/lib/props/x-pos/get.js deleted file mode 100644 index f231fc5..0000000 --- a/base/ctor/lib/props/x-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:x-pos' ); - - -// MAIN // - -/** -* Returns a function to map values to x-axis coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.xScale; - return xPos; - - /** - * Maps a value to a x-axis coordinate value. - * - * @private - * @param {number} d - datum - * @returns {number} pixel value - */ - function xPos( d ) { - var px = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/x-range/get.js b/base/ctor/lib/props/x-range/get.js deleted file mode 100644 index 15069e3..0000000 --- a/base/ctor/lib/props/x-range/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-axis range. -* -* @private -* @returns {NumberArray} range -*/ -function get() { - /* eslint-disable no-invalid-this */ - return [ 0, this.graphWidth ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/x-tick-format/get.js b/base/ctor/lib/props/x-tick-format/get.js deleted file mode 100644 index 8a6fc70..0000000 --- a/base/ctor/lib/props/x-tick-format/get.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var format = require( 'd3-format' ).format; // TODO: remove -var timeFormat = require( 'd3-time-format' ).timeFormat; // TODO: remove -var isNull = require( '@stdlib/assert/is-null' ); - - -// MAIN // - -/** -* Returns the x-axis tick format. -* -* @private -* @returns {(Function|null)} format function or null -*/ -function get() { - /* eslint-disable no-invalid-this */ - if ( isNull( this._xTickFormat ) ) { - return this._xTickFormat; - } - if ( this._xScale === 'time' ) { - return timeFormat( this._xTickFormat ); - } - return format( this._xTickFormat ); -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/x-tick-format/set.js b/base/ctor/lib/props/x-tick-format/set.js deleted file mode 100644 index 1510647..0000000 --- a/base/ctor/lib/props/x-tick-format/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:x-tick-format' ); - - -// MAIN // - -/** -* Sets the x-axis tick format. -* -* @private -* @param {(string|null)} fmt - axis tick format -* @throws {TypeError} must be a string -*/ -function set( fmt ) { - /* eslint-disable no-invalid-this */ - if ( !isNull( fmt ) && !isString( fmt ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or null. Value: `%s`.', 'xTickFormat', fmt ) ); - } - if ( fmt !== this._xTickFormat ) { - debug( 'Current value: %s.', this._xTickFormat ); - - this._xTickFormat = fmt; - debug( 'New value: %s.', this._xTickFormat ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/y-axis-orient/get.js b/base/ctor/lib/props/y-axis-orient/get.js deleted file mode 100644 index 599ea8e..0000000 --- a/base/ctor/lib/props/y-axis-orient/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-axis orientation. -* -* @private -* @returns {string} orientation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yAxisOrient; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/y-axis-orient/orientations.json b/base/ctor/lib/props/y-axis-orient/orientations.json deleted file mode 100644 index d2d3df7..0000000 --- a/base/ctor/lib/props/y-axis-orient/orientations.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "left", - "right" -] diff --git a/base/ctor/lib/props/y-axis-orient/set.js b/base/ctor/lib/props/y-axis-orient/set.js deleted file mode 100644 index 7e2defe..0000000 --- a/base/ctor/lib/props/y-axis-orient/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var ORIENTATIONS = require( './orientations.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:y-axis-orient' ); - - -// MAIN // - -/** -* Sets the y-axis orientation. -* -* @private -* @param {string} orientation - axis orientation -* @throws {TypeError} must be either `'left'` or `'right'` -*/ -function set( orientation ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( ORIENTATIONS, orientation ) === -1 ) { - throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'yAxisOrient', ORIENTATIONS.join( '", "' ), orientation ) ); - } - if ( orientation !== this._yAxisOrient ) { - debug( 'Current value: %s.', this._yAxisOrient ); - - this._yAxisOrient = orientation; - debug( 'New value: %s.', this._yAxisOrient ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/y-domain/get.js b/base/ctor/lib/props/y-domain/get.js deleted file mode 100644 index cf17fe4..0000000 --- a/base/ctor/lib/props/y-domain/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-axis domain. -* -* @private -* @returns {Array} domain -*/ -function get() { - /* eslint-disable no-invalid-this */ - return [ this.yMin, this.yMax ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/y-label/get.js b/base/ctor/lib/props/y-label/get.js deleted file mode 100644 index 4b36a06..0000000 --- a/base/ctor/lib/props/y-label/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-axis label. -* -* @private -* @returns {string} label -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yLabel; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/y-label/set.js b/base/ctor/lib/props/y-label/set.js deleted file mode 100644 index e8fdab4..0000000 --- a/base/ctor/lib/props/y-label/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:y-label' ); - - -// MAIN // - -/** -* Sets the y-axis label. -* -* @private -* @param {string} label - axis label -* @throws {TypeError} must be a string -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( !isString( label ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'yLabel', label ) ); - } - if ( label !== this._yLabel ) { - debug( 'Current value: %s.', this._yLabel ); - - this._yLabel = label; - debug( 'New value: %s.', this._yLabel ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/y-num-ticks/get.js b/base/ctor/lib/props/y-num-ticks/get.js deleted file mode 100644 index 5aec4ef..0000000 --- a/base/ctor/lib/props/y-num-ticks/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the number of y-axis tick marks. -* -* @private -* @returns {(NonNegativeInteger|null)} number of ticks -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yNumTicks; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/y-num-ticks/set.js b/base/ctor/lib/props/y-num-ticks/set.js deleted file mode 100644 index b8eb615..0000000 --- a/base/ctor/lib/props/y-num-ticks/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:y-num-ticks' ); - - -// MAIN // - -/** -* Sets the number of y-axis tick marks. -* -* @private -* @param {(NonNegativeInteger|null)} ticks - number of ticks -* @throws {TypeError} must be a nonnegative integer or null -*/ -function set( ticks ) { - /* eslint-disable no-invalid-this */ - if ( !isNull( ticks ) && !isNonNegativeInteger( ticks ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or null. Value: `%s`.', 'yNumTicks', ticks ) ); - } - if ( ticks !== this._yNumTicks ) { - debug( 'Current value: %d.', this._yNumTicks ); - - this._yNumTicks = ticks; - debug( 'New value: %d.', this._yNumTicks ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/props/y-pos/get.js b/base/ctor/lib/props/y-pos/get.js deleted file mode 100644 index 1a0ff92..0000000 --- a/base/ctor/lib/props/y-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:y-pos' ); - - -// MAIN // - -/** -* Returns a function to map values to y-axis coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.yScale; - return yPos; - - /** - * Maps a value to a y-axis coordinate value. - * - * @private - * @param {number} d - datum - * @returns {number} pixel value - */ - function yPos( d ) { - var px = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/y-range/get.js b/base/ctor/lib/props/y-range/get.js deleted file mode 100644 index 8bf31ee..0000000 --- a/base/ctor/lib/props/y-range/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-axis range. -* -* @private -* @returns {NumberArray} range -*/ -function get() { - /* eslint-disable no-invalid-this */ - return [ this.graphHeight, 0 ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/y-tick-format/get.js b/base/ctor/lib/props/y-tick-format/get.js deleted file mode 100644 index 2490f0a..0000000 --- a/base/ctor/lib/props/y-tick-format/get.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var format = require( 'd3-format' ).format; // TODO: remove -var isNull = require( '@stdlib/assert/is-null' ); - - -// MAIN // - -/** -* Returns the y-axis tick format. -* -* @private -* @returns {(Function|null)} format function or null -*/ -function get() { - /* eslint-disable no-invalid-this */ - if ( isNull( this._yTickFormat ) ) { - return this._yTickFormat; - } - return format( this._yTickFormat ); -} - - -// EXPORTS // - -module.exports = get; diff --git a/base/ctor/lib/props/y-tick-format/set.js b/base/ctor/lib/props/y-tick-format/set.js deleted file mode 100644 index 85640da..0000000 --- a/base/ctor/lib/props/y-tick-format/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:set:y-tick-format' ); - - -// MAIN // - -/** -* Sets the y-axis tick format. -* -* @private -* @param {(string|null)} fmt - axis tick format -* @throws {TypeError} must be a string or null -*/ -function set( fmt ) { - /* eslint-disable no-invalid-this */ - if ( !isNull( fmt ) && !isString( fmt ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or null. Value: `%s`.', 'yTickFormat', fmt ) ); - } - if ( fmt !== this._yTickFormat ) { - debug( 'Current value: %s.', this._yTickFormat ); - - this._yTickFormat = fmt; - debug( 'New value: %s.', this._yTickFormat ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/base/ctor/lib/render/index.js b/base/ctor/lib/render/index.js deleted file mode 100644 index 66ed0ae..0000000 --- a/base/ctor/lib/render/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:render' ); - - -// MAIN // - -/** -* Renders a plot. -* -* @private -* @param {string} [format] - render format -* @returns {(VTree|string)} virtual tree or a string -*/ -function render( format ) { - /* eslint-disable no-invalid-this */ - var out; - var tmp; - var fmt; - - tmp = this.renderFormat; - if ( arguments.length ) { - // Temporarily set the render format: - this.renderFormat = format; - fmt = format; - } else { - fmt = tmp; - } - debug( 'Render format: %s.', this.renderFormat ); - - debug( 'Rendering...' ); - out = this._render( fmt ); - this.emit( 'render', out ); - - if ( arguments.length ) { - // Restore the render format: - this.renderFormat = tmp; - } - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/base/ctor/lib/render/stub.js b/base/ctor/lib/render/stub.js deleted file mode 100644 index d7046a7..0000000 --- a/base/ctor/lib/render/stub.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Placeholder `render` function. -* -* @private -* @param {string} fmt - render format -* @throws {Error} must be implemented by descendant classes -*/ -function render() { - throw new Error( 'not implemented' ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/base/ctor/lib/view/browser/index.html b/base/ctor/lib/view/browser/index.html deleted file mode 100644 index 79dc0c8..0000000 --- a/base/ctor/lib/view/browser/index.html +++ /dev/null @@ -1,708 +0,0 @@ - - - - - - - - -   - - - - - -
{{plot}}
- - diff --git a/base/ctor/lib/view/browser/index.js b/base/ctor/lib/view/browser/index.js deleted file mode 100644 index f47b382..0000000 --- a/base/ctor/lib/view/browser/index.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var path = require( 'path' ); -var toHTML = require( 'vdom-to-html' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var httpServer = require( '@stdlib/net/disposable-http-server' ); - - -// MAIN // - -/** -* Opens a plot in a browser window. -* -* @private -* @param {VTree} vtree - virtual DOM tree -*/ -function view( vtree ) { - var index; - var html; - - // Transform the virtual DOM tree to HTML: - html = toHTML( vtree ); - - // Inject the HTML: - index = path.join( __dirname, 'index.html' ); - index = readFileSync( index, { - 'encoding': 'utf8' - }); - - index = index.replace( /\{\{plot\}\}/, html ); - - // Create a disposable HTTP server: - httpServer({ - 'html': index, - 'open': true - }); -} - - -// EXPORTS // - -module.exports = view; diff --git a/base/ctor/lib/view/electron/css/colors.css b/base/ctor/lib/view/electron/css/colors.css deleted file mode 100644 index 4aef35f..0000000 --- a/base/ctor/lib/view/electron/css/colors.css +++ /dev/null @@ -1,523 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -/* D3: Category10 */ -.category10-1, -[data-color="category10-1"] { - stroke: #1f77b4; -} -.category10-2, -[data-color="category10-2"] { - stroke: #ff7f0e; -} -.category10-3, -[data-color="category10-3"] { - stroke: #2ca02c; -} -.category10-4, -[data-color="category10-4"] { - stroke: #d62728; -} -.category10-5, -[data-color="category10-5"] { - stroke: #9467bd; -} -.category10-6, -[data-color="category10-6"] { - stroke: #8c564b; -} -.category10-7, -[data-color="category10-7"] { - stroke: #e377c2; -} -.category10-8, -[data-color="category10-8"] { - stroke: #7f7f7f; -} -.category10-9, -[data-color="category10-9"] { - stroke: #bcdb22; -} -.category10-10, -[data-color="category10-10"] { - stroke: #17becf; -} - -/* D3: category20 */ -.category20-1, -[data-color="category20-1"] { - stroke: #1f77b4; -} -.category20-2, -[data-color="category20-2"] { - stroke: #aec7e8; -} -.category20-3, -[data-color="category20-3"] { - stroke: #ff7f0e; -} -.category20-4, -[data-color="category20-4"] { - stroke: #ffbb78; -} -.category20-5, -[data-color="category20-5"] { - stroke: #2ca02c; -} -.category20-6, -[data-color="category20-6"] { - stroke: #98df8a; -} -.category20-7, -[data-color="category20-7"] { - stroke: #d62728; -} -.category20-8, -[data-color="category20-8"] { - stroke: #ff9896; -} -.category20-9, -[data-color="category20-9"] { - stroke: #9467bd; -} -.category20-10, -[data-color="category20-10"] { - stroke: #c5b0d5; -} -.category20-11, -[data-color="category20-11"] { - stroke: #8c564b; -} -.category20-12, -[data-color="category20-12"] { - stroke: #c49c94; -} -.category20-13, -[data-color="category20-13"] { - stroke: #e377c2; -} -.category20-14, -[data-color="category20-14"] { - stroke: #f7b6d2; -} -.category20-15, -[data-color="category20-15"] { - stroke: #7f7f7f; -} -.category20-16, -[data-color="category20-16"] { - stroke: #c7c7c7; -} -.category20-17, -[data-color="category20-17"] { - stroke: #bcbd22; -} -.category20-18, -[data-color="category20-18"] { - stroke: #dbdb8d; -} -.category20-19, -[data-color="category20-19"] { - stroke: #17becf; -} -.category20-20, -[data-color="category20-20"] { - stroke: #9edae5; -} - -/* D3: category20b */ -.category20b-1, -[data-color="category20b-1"] { - stroke: #393b79; -} -.category20b-2, -[data-color="category20b-2"] { - stroke: #5254a3; -} -.category20b-3, -[data-color="category20b-3"] { - stroke: #6b6ecf; -} -.category20b-4, -[data-color="category20b-4"] { - stroke: #9c9ede; -} -.category20b-5, -[data-color="category20b-5"] { - stroke: #637939; -} -.category20b-6, -[data-color="category20b-6"] { - stroke: #8ca252; -} -.category20b-7, -[data-color="category20b-7"] { - stroke: #b5cf6b; -} -.category20b-8, -[data-color="category20b-8"] { - stroke: #cedb9c; -} -.category20b-9, -[data-color="category20b-9"] { - stroke: #8c6d31; -} -.category20b-10, -[data-color="category20b-10"] { - stroke: #bd9e39; -} -.category20b-11, -[data-color="category20b-11"] { - stroke: #e7ba52; -} -.category20b-12, -[data-color="category20b-12"] { - stroke: #e7cb94; -} -.category20b-13, -[data-color="category20b-13"] { - stroke: #843c39; -} -.category20b-14, -[data-color="category20b-14"] { - stroke: #ad494a; -} -.category20b-15, -[data-color="category20b-15"] { - stroke: #d6616b; -} -.category20b-16, -[data-color="category20b-16"] { - stroke: #e7969c; -} -.category20b-17, -[data-color="category20b-17"] { - stroke: #7b4173; -} -.category20b-18, -[data-color="category20b-18"] { - stroke: #a55194; -} -.category20b-19, -[data-color="category20b-19"] { - stroke: #ce6dbd; -} -.category20b-20, -[data-color="category20b-20"] { - stroke: #de9ed6; -} - -/* D3: category20c */ -.category20c-1, -[data-color="category20c-1"] { - stroke: #3182bd; -} -.category20c-2, -[data-color="category20c-2"] { - stroke: #6baed6; -} -.category20c-3, -[data-color="category20c-3"] { - stroke: #9ecae1; -} -.category20c-4, -[data-color="category20c-4"] { - stroke: #c6dbef; -} -.category20c-5, -[data-color="category20c-5"] { - stroke: #e6550d; -} -.category20c-6, -[data-color="category20c-6"] { - stroke: #fd8d3c; -} -.category20c-7, -[data-color="category20c-7"] { - stroke: #fdae6b; -} -.category20c-8, -[data-color="category20c-8"] { - stroke: #fdd0a2; -} -.category20c-9, -[data-color="category20c-9"] { - stroke: #31a354; -} -.category20c-10, -[data-color="category20c-10"] { - stroke: #74c476; -} -.category20c-11, -[data-color="category20c-11"] { - stroke: #a1d99b; -} -.category20c-12, -[data-color="category20c-12"] { - stroke: #c7e9c0; -} -.category20c-13, -[data-color="category20c-13"] { - stroke: #756bb1; -} -.category20c-14, -[data-color="category20c-14"] { - stroke: #9e9ac8; -} -.category20c-15, -[data-color="category20c-15"] { - stroke: #bcbddc; -} -.category20c-16, -[data-color="category20c-16"] { - stroke: #dadaeb; -} -.category20c-17, -[data-color="category20c-17"] { - stroke: #636363; -} -.category20c-18, -[data-color="category20c-18"] { - stroke: #969696; -} -.category20c-19, -[data-color="category20c-19"] { - stroke: #bdbdbd; -} -.category20c-20, -[data-color="category20c-20"] { - stroke: #d9d9d9; -} - -/* D3: Category10 */ -.category10-1-span { - background-color: #1f77b4; -} -.category10-2-span { - background-color: #ff7f0e; -} -.category10-3-span { - background-color: #2ca02c; -} -.category10-4-span { - background-color: #d62728; -} -.category10-5-span { - background-color: #9467bd; -} -.category10-6-span { - background-color: #8c564b; -} -.category10-7-span { - background-color: #e377c2; -} -.category10-8-span { - background-color: #7f7f7f; -} -.category10-9-span { - background-color: #bcdb22; -} -.category10-10-span { - background-color: #17becf; -} - -/* D3: category20 */ -.category20-1-span { - background-color: #1f77b4; -} -.category20-2-span { - background-color: #aec7e8; -} -.category20-3-span { - background-color: #ff7f0e; -} -.category20-4-span { - background-color: #ffbb78; -} -.category20-5-span { - background-color: #2ca02c; -} -.category20-6-span { - background-color: #98df8a; -} -.category20-7-span { - background-color: #d62728; -} -.category20-8-span { - background-color: #ff9896; -} -.category20-9-span { - background-color: #9467bd; -} -.category20-10-span { - background-color: #c5b0d5; -} -.category20-11-span { - background-color: #8c564b; -} -.category20-12-span { - background-color: #c49c94; -} -.category20-13-span { - background-color: #e377c2; -} -.category20-14-span { - background-color: #f7b6d2; -} -.category20-15-span { - background-color: #7f7f7f; -} -.category20-16-span { - background-color: #c7c7c7; -} -.category20-17-span { - background-color: #bcbd22; -} -.category20-18-span { - background-color: #dbdb8d; -} -.category20-19-span { - background-color: #17becf; -} -.category20-20-span { - background-color: #9edae5; -} - -/* D3: category20b */ -.category20b-1-span { - background-color: #393b79; -} -.category20b-2-span { - background-color: #5254a3; -} -.category20b-3-span { - background-color: #6b6ecf; -} -.category20b-4-span { - background-color: #9c9ede; -} -.category20b-5-span { - background-color: #637939; -} -.category20b-6-span { - background-color: #8ca252; -} -.category20b-7-span { - background-color: #b5cf6b; -} -.category20b-8-span { - background-color: #cedb9c; -} -.category20b-9-span { - background-color: #8c6d31; -} -.category20b-10-span { - background-color: #bd9e39; -} -.category20b-11-span { - background-color: #e7ba52; -} -.category20b-12-span { - background-color: #e7cb94; -} -.category20b-13-span { - background-color: #843c39; -} -.category20b-14-span { - background-color: #ad494a; -} -.category20b-15-span { - background-color: #d6616b; -} -.category20b-16-span { - background-color: #e7969c; -} -.category20b-17-span { - background-color: #7b4173; -} -.category20b-18-span { - background-color: #a55194; -} -.category20b-19-span { - background-color: #ce6dbd; -} -.category20b-20-span { - background-color: #de9ed6; -} - -/* D3: category20c */ -.category20c-1-span { - background-color: #3182bd; -} -.category20c-2-span { - background-color: #6baed6; -} -.category20c-3-span { - background-color: #9ecae1; -} -.category20c-4-span { - background-color: #c6dbef; -} -.category20c-5-span { - background-color: #e6550d; -} -.category20c-6-span { - background-color: #fd8d3c; -} -.category20c-7-span { - background-color: #fdae6b; -} -.category20c-8-span { - background-color: #fdd0a2; -} -.category20c-9-span { - background-color: #31a354; -} -.category20c-10-span { - background-color: #74c476; -} -.category20c-11-span { - background-color: #a1d99b; -} -.category20c-12-span { - background-color: #c7e9c0; -} -.category20c-13-span { - background-color: #756bb1; -} -.category20c-14-span { - background-color: #9e9ac8; -} -.category20c-15-span { - background-color: #bcbddc; -} -.category20c-16-span { - background-color: #dadaeb; -} -.category20c-17-span { - background-color: #636363; -} -.category20c-18-span { - background-color: #969696; -} -.category20c-19-span { - background-color: #bdbdbd; -} -.category20c-20-span { - background-color: #d9d9d9; -} diff --git a/base/ctor/lib/view/electron/css/reset.css b/base/ctor/lib/view/electron/css/reset.css deleted file mode 100644 index 753131e..0000000 --- a/base/ctor/lib/view/electron/css/reset.css +++ /dev/null @@ -1,66 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -/* http://meyerweb.com/eric/tools/css/reset/ - v2.0 | 20110126 - License: none (public domain) -*/ - -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td, -article, aside, canvas, details, embed, -figure, figcaption, footer, header, hgroup, -menu, nav, output, ruby, section, summary, -time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; -} -/* HTML5 display-role reset for older browsers */ -article, aside, details, figcaption, figure, -footer, header, hgroup, menu, nav, section { - display: block; -} -body { - line-height: 1; -} -ol, ul { - list-style: none; -} -blockquote, q { - quotes: none; -} -blockquote:before, blockquote:after, -q:before, q:after { - content: ''; - content: none; -} -table { - border-collapse: collapse; - border-spacing: 0; -} diff --git a/base/ctor/lib/view/electron/css/styles.css b/base/ctor/lib/view/electron/css/styles.css deleted file mode 100644 index ed86f1a..0000000 --- a/base/ctor/lib/view/electron/css/styles.css +++ /dev/null @@ -1,135 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -.canvas { - display: block; - margin: 0 auto; -} - -.graph .hidden { - opacity: 0; -} - -/*.annotation .marker { - cursor: pointer; - opacity: 0.2; - fill: #ff0000; - stroke: none; -} - -.annotation .vline { - stroke: #000; - stroke-opacity: 0.2; -}*/ - -.annotations .title { - display: block; - /*font-size: 2em;*/ - line-height: 2em; - padding: 0 10px; - /*background-color: #474747;*/ - /*color: #ffffff;*/ - font-size: 1.5em; - color: #474747; -} - -.legend { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 60px; -} - -.legend .entry { - cursor: pointer; - margin-bottom: 10px; -} - -.legend .symbol { - display: inline-block; - height: 4px; - width: 10px; - line-height: 0.3em; -} - -.legend .label { - margin-left: 10px; -} - -.legend .hidden { - opacity: 0.25; -} - -.noselect { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -/* http://css-tricks.com/guide-responsive-friendly-css-columns/ */ -.multicolumn-1 { - -webkit-column-count: 1; - -moz-column-count: 1; - -ms-column-count: 1; - column-count: 1; - - -webkit-column-width: 150px; - -moz-column-width: 150px; - -ms-column-width: 150px; - column-width: 150px; -} - -.multicolumn-2 { - -webkit-column-count: 2; - -moz-column-count: 2; - -ms-column-count: 2; - column-count: 2; - - -webkit-column-width: 150px; - -moz-column-width: 150px; - -ms-column-width: 150px; - column-width: 150px; -} - -.multicolumn-3 { - -webkit-column-count: 3; - -moz-column-count: 3; - -ms-column-count: 3; - column-count: 3; - - -webkit-column-width: 150px; - -moz-column-width: 150px; - -ms-column-width: 150px; - column-width: 150px; -} - -.multicolumn-4 { - -webkit-column-count: 4; - -moz-column-count: 4; - -ms-column-count: 4; - column-count: 4; - - -webkit-column-width: 150px; - -moz-column-width: 150px; - -ms-column-width: 150px; - column-width: 150px; -} diff --git a/base/ctor/lib/view/electron/index.html b/base/ctor/lib/view/electron/index.html deleted file mode 100644 index 76ba506..0000000 --- a/base/ctor/lib/view/electron/index.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - -   - - - - - -
{{plot}}
- - - diff --git a/base/ctor/lib/view/electron/index.js b/base/ctor/lib/view/electron/index.js deleted file mode 100644 index 380ca26..0000000 --- a/base/ctor/lib/view/electron/index.js +++ /dev/null @@ -1,149 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// TODO: refactor. Remove disposable server. Create a server in the electron process and have it serve assets from local directories. Should be similar to SimpleServer. - -// MODULES // - -var spawn = require( 'child_process' ).spawn; -var path = require( 'path' ); -var logger = require( 'debug' ); -var toHTML = require( 'vdom-to-html' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var ENV = require( '@stdlib/process/env' ); -var copy = require( '@stdlib/utils/copy' ); -var merge = require( '@stdlib/utils/merge' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var httpServer = require( '@stdlib/net/disposable-http-server' ); -var tryRequire = require( '@stdlib/utils/try-require' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:view:electron:main' ); -var electron = tryRequire( '@stdlib/electron' ); - - -// MAIN // - -/** -* Opens a plot in an electron window. -* -* @private -* @param {Plot} plot - plot context -* @param {VTree} vtree - virtual tree -* @throws {Error} Electron must be properly installed -*/ -function view( plot, vtree ) { - var index; - var html; - var opts; - var css; - - if ( instanceOf( electron, Error ) ) { - throw new Error( 'invalid operation. Unable to load Electron. Ensure Electron is installed and try again.' ); - } - debug( 'Transforming virtual DOM tree to HTML...' ); - html = toHTML( vtree ); - - // Define `fs` options: - opts = { - 'encoding': 'utf8' - }; - - debug( 'Injecting HTML into HTML template...' ); - index = path.join( __dirname, 'index.html' ); - index = readFileSync( index, opts ); - index = index.replace( /\{\{plot\}\}/, html ); - - debug( 'Injecting CSS into HTML template...' ); - css = path.join( __dirname, 'css', 'reset.css' ); - css = readFileSync( css, opts ); - index = index.replace( /\{\{reset\}\}/, css ); - - css = path.join( __dirname, 'css', 'colors.css' ); - css = readFileSync( css, opts ); - index = index.replace( /\{\{colors\}\}/, css ); - - css = path.join( __dirname, 'css', 'styles.css' ); - css = readFileSync( css, opts ); - index = index.replace( /\{\{styles\}\}/, css ); - - debug( 'Creating a disposable HTTP server...' ); - opts = { - 'html': index, - 'open': false - }; - httpServer( opts, onReady ); - - /** - * Callback invoked once a server is ready to receive requests. - * - * @private - * @param {(Error|null)} error - error object - * @param {Server} server - HTTP server - * @throws {Error} unexpected error - */ - function onReady( error, server ) { - var child; - var addr; - var opts; - var env; - if ( error ) { - throw error; - } - addr = server.address(); - debug( 'HTTP server initialized. Server is listening for requests on %s:%d.', addr.address, addr.port ); - - debug( 'Electron executable: %s.', electron ); - - // TODO: extract fixed env vars to config file and then won't need to pass via environment variables, but can simply require - env = { - 'SERVER_PORT': addr.port, - 'SERVER_ADDRESS': addr.address, - 'PLOT_WIDTH': plot.width, - 'PLOT_HEIGHT': plot.height, - 'PLOT_APP_PATH': __dirname, - 'PLOT_MIN_WIDTH': 100, - 'PLOT_MIN_HEIGHT': 100, - 'PLOT_TITLE': plot.title || 'stdlib' - }; - debug( 'Electron process environment variables: %s.', JSON.stringify( env ) ); - - opts = { - 'cwd': __dirname, - 'detached': true, - 'stdio': 'ignore' - }; - debug( 'Electron process options: %s.', JSON.stringify( opts ) ); - - // Merge the current process' environment variables: - opts.env = merge( {}, copy( ENV ), env ); - - debug( 'Spawning an electron process...' ); - child = spawn( electron, [ './main.js' ], opts ); - child.unref(); - } -} - - -// EXPORTS // - -module.exports = view; diff --git a/base/ctor/lib/view/electron/js/debug.js b/base/ctor/lib/view/electron/js/debug.js deleted file mode 100644 index d736a98..0000000 --- a/base/ctor/lib/view/electron/js/debug.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var ENV = require( '@stdlib/process/env' ); - - -// MAIN // - -var debug; - -// Setting the local storage variable must be done BEFORE loading `debug`: -localStorage.debug = ENV.DEBUG; - -// Load `debug`: -debug = require( 'debug/browser' ); // eslint-disable-line stdlib/require-order - - -// EXPORTS // - -module.exports = debug; diff --git a/base/ctor/lib/view/electron/js/script.js b/base/ctor/lib/view/electron/js/script.js deleted file mode 100644 index 39a44c2..0000000 --- a/base/ctor/lib/view/electron/js/script.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var path = require( 'path' ); -var readDir = require( '@stdlib/fs/read-dir' ); -var extname = require( '@stdlib/utils/extname' ); -var ENV = require( '@stdlib/process/env' ); -var logger = require( './debug.js' ); - - -// VARIABLES // - -var DIR = path.join( ENV.PLOT_APP_PATH, 'css' ); -var debug = logger( 'plot:base:view:electron:script' ); - - -// FUNCTIONS // - -/** -* Inserts stylesheets. -* -* @private -*/ -function stylesheets() { - var files; - var link; - var i; - - debug( 'Stylesheet directory: %s.', DIR ); - files = readDir.sync( DIR ); - for ( i = 0; i < files.length; i++ ) { - if ( extname( files[i] ) !== '.css' ) { - continue; - } - debug( 'Found a CSS file: %s.', files[i] ); - - debug( 'Generating link element...' ); - link = document.createElement( 'link' ); - link.setAttribute( 'rel', 'stylesheet' ); - link.setAttribute( 'href', path.join( DIR, files[i] ) ); - - debug( 'Appending link element to the document head...' ); - document.head.appendChild( link ); - } -} - - -// MAIN // - -/** -* Main script. -* -* @private -*/ -function main() { - debug( 'Injecting stylesheets into the document...' ); - stylesheets(); -} - -debug( 'Running main script...' ); -main(); diff --git a/base/ctor/lib/view/electron/main.js b/base/ctor/lib/view/electron/main.js deleted file mode 100644 index a7f1136..0000000 --- a/base/ctor/lib/view/electron/main.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var app = require( 'electron' ).app; -var BrowserWindow = require( 'electron' ).BrowserWindow; -var ENV = require( '@stdlib/process/env' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:view:electron:main-process' ); -var mainWindow = null; - - -// FUNCTIONS // - -/** -* Creates a browser window. -* -* @private -*/ -function createWindow() { - var opts; - var url; - - opts = { - 'width': parseInt( ENV.PLOT_WIDTH, 10 ) + 80, - 'height': parseInt( ENV.PLOT_HEIGHT, 10 ) + 20, - 'title': ENV.PLOT_TITLE, - - // 'minWidth': parseInt( ENV.PLOT_MIN_WIDTH, 10 ), // TODO: needed? - - // 'minHeight': parseInt( ENV.PLOT_MIN_HEIGHT, 10 ), // TODO: needed? - - // 'titleBarStyle': 'hidden-inset', // hide title bar on OS X - - 'useContentSize': true // specify web page size only considering the content - }; - debug( 'Creating a new browser window configured with the following options: %s.', JSON.stringify( opts ) ); - mainWindow = new BrowserWindow( opts ); - - mainWindow.on( 'close', onClose ); - - url = 'http://'+ENV.SERVER_ADDRESS+':'+ENV.SERVER_PORT+'/index.html'; - debug( 'Loading %s.', url ); - mainWindow.loadURL( url ); -} - -/** -* Callback invoked once a window closes. -* -* @private -*/ -function onClose() { - debug( 'Window closed. Dereferencing window object to allow for GC...' ); - mainWindow = null; -} - -/** -* Quits the application. -* -* @private -*/ -function quit() { - debug( 'Quitting application...' ); - app.quit(); -} - - -// MAIN // - -/** -* Runs the application. -* -* @private -*/ -function main() { - app.on( 'ready', createWindow ); - app.on( 'window-all-closed', quit ); -} - -debug( 'Running application...' ); -main(); diff --git a/base/ctor/lib/view/index.js b/base/ctor/lib/view/index.js deleted file mode 100644 index 36affde..0000000 --- a/base/ctor/lib/view/index.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var createView = require( './view.js' ); - - -// VARIABLES // - -var debug = logger( 'plot:base:view' ); - - -// MAIN // - -/** -* Generates a plot view. -* -* @private -* @param {string} viewer - plot viewer -*/ -function view( viewer ) { - /* eslint-disable no-invalid-this */ - var tmp = this.viewer; - if ( arguments.length ) { - // Temporarily set the viewer: - this.viewer = viewer; - } - debug( 'Viewer: %s.', this.viewer ); - debug( 'Generating view...' ); - createView( this, this.viewer, this.render() ); - if ( arguments.length ) { - // Restore the viewer: - this.viewer = tmp; - } -} - - -// EXPORTS // - -module.exports = view; diff --git a/base/ctor/lib/view/stdout/index.js b/base/ctor/lib/view/stdout/index.js deleted file mode 100644 index be39926..0000000 --- a/base/ctor/lib/view/stdout/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Writes a plot (rendered as a virtual DOM tree) to `stdout`. -* -* @private -* @param {VTree} plot - virtual tree -*/ -function view( plot ) { - console.log( JSON.stringify( plot ) ); -} - - -// EXPORTS // - -module.exports = view; diff --git a/base/ctor/lib/view/view.browser.js b/base/ctor/lib/view/view.browser.js deleted file mode 100644 index 91e2b35..0000000 --- a/base/ctor/lib/view/view.browser.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var format = require( '@stdlib/string/format' ); -var stdout = require( './stdout' ); - - -// MAIN // - -/** -* Generates a plot view. -* -* @private -* @param {Plot} plot - plot context -* @param {string} viewer - plot viewer -* @param {VTree} vtree - virtual tree -* @throws {Error} must specify a supported viewer -* @returns {void} -*/ -function view( plot, viewer, vtree ) { - if ( viewer === 'none' ) { - return; - } - if ( viewer === 'stdout' ) { - return stdout( vtree ); - } - if ( viewer === 'browser' ) { - throw new Error( format( 'invalid argument. Must provide a supported viewer. Value: `%s`.', viewer ) ); - } - if ( viewer === 'terminal' ) { - // TODO: ASCII - return; - } - throw new Error( format( 'invalid argument. Must provide a supported viewer. Value: `%s`.', viewer ) ); -} - - -// EXPORTS // - -module.exports = view; diff --git a/base/ctor/lib/view/view.js b/base/ctor/lib/view/view.js deleted file mode 100644 index 362970e..0000000 --- a/base/ctor/lib/view/view.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var stdout = require( './stdout' ); -var browser = require( './browser' ); -var electron = require( './electron' ); - - -// MAIN // - -/** -* Generates a plot view. -* -* @private -* @param {Plot} plot - plot context -* @param {string} viewer - plot viewer -* @param {VTree} vtree - virtual -* @returns {void} -*/ -function view( plot, viewer, vtree ) { - if ( viewer === 'none' ) { - return; - } - if ( viewer === 'stdout' ) { - return stdout( vtree ); - } - if ( viewer === 'browser' ) { - return browser( vtree ); - } - if ( viewer === 'terminal' ) { - // TODO: ASCII - return; - } - // viewer === 'window' - electron( plot, vtree ); -} - - -// EXPORTS // - -module.exports = view; diff --git a/base/ctor/package.json b/base/ctor/package.json deleted file mode 100644 index 00a2c39..0000000 --- a/base/ctor/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@stdlib/plot/base/ctor", - "version": "0.0.0", - "description": "Base 2-dimensional plot constructor.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "browser": { - "./lib/view/view.js": "./lib/view/view.browser.js" - }, - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "base", - "constructor", - "ctor", - "figure", - "fig", - "graph", - "chart", - "diagram", - "2-dimensional", - "2d", - "data", - "visualize", - "visualization", - "dataviz", - "explore", - "exploratory", - "analysis" - ] -} diff --git a/branches.md b/branches.md deleted file mode 100644 index 54622ae..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -C -->|bundle| D[esm]; -C -->|bundle| E[deno]; -C -->|bundle| F[umd]; - -%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot" -%% click B href "https://github.com/stdlib-js/plot/tree/main" -%% click C href "https://github.com/stdlib-js/plot/tree/production" -%% click D href "https://github.com/stdlib-js/plot/tree/esm" -%% click E href "https://github.com/stdlib-js/plot/tree/deno" -%% click F href "https://github.com/stdlib-js/plot/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/plot -[production-url]: https://github.com/stdlib-js/plot/tree/production -[deno-url]: https://github.com/stdlib-js/plot/tree/deno -[deno-readme]: https://github.com/stdlib-js/plot/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/plot/tree/umd -[umd-readme]: https://github.com/stdlib-js/plot/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/plot/tree/esm -[esm-readme]: https://github.com/stdlib-js/plot/blob/esm/README.md \ No newline at end of file diff --git a/components/svg/annotations/README.md b/components/svg/annotations/README.md deleted file mode 100644 index 5db95da..0000000 --- a/components/svg/annotations/README.md +++ /dev/null @@ -1,198 +0,0 @@ - - -# Annotations - -> [SVG][svg] plot annotations. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var Annotations = require( '@stdlib/plot/components/svg/annotations' ); -``` - -#### Annotations() - -Returns an `Annotations` instance. - -```javascript -var node = new Annotations(); -// returns -``` - -* * * - -### Methods - - - -#### Annotations.prototype.render() - -Renders an instance as a [Virtual DOM tree][virtual-dom]. - -```javascript -var node = new Annotations(); - -var vtree = node.render(); -/* e.g., returns - { - 'tagName': 'g', - 'properties': { - 'property': 'annotations', - 'className': 'annotations', - 'attributes': { - 'transform': 'translate(0,0)' - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } -*/ -``` - -* * * - -### Events - - - -#### 'render' - -Event emitted when an instance renders. The event object is the rendered [Virtual DOM tree][virtual-dom]. - -```javascript -var node = new Annotations(); - -function onRender( vtree ) { - console.log( vtree ); -} - -node.on( 'render', onRender ); -node.render(); -``` - -* * * - -### Listeners - - - -#### 'change' - -Upon receiving a `'change'` event, an instance re-renders. - -```javascript -var node = new Annotations(); - -function onRender( vtree ) { - console.log( vtree ); -} - -node.on( 'render', onRender ); -node.emit( 'change' ); -``` - -
- - - - - -
- -
- - - - - -* * * - -
- -## Examples - - - -```javascript -var toHTML = require( 'vdom-to-html' ); -var annotations = require( '@stdlib/plot/components/svg/annotations' ); - -// Create a new component: -var node = annotations(); - -// Render as a virtual DOM tree: -var vtree = node.render(); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -// returns -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/components/svg/annotations/benchmark/benchmark.js b/components/svg/annotations/benchmark/benchmark.js deleted file mode 100644 index e8b4073..0000000 --- a/components/svg/annotations/benchmark/benchmark.js +++ /dev/null @@ -1,90 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pkg = require( './../package.json' ).name; -var Annotations = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::instantiation', function benchmark( b ) { - var node; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node = new Annotations(); - if ( !( node instanceof Annotations ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( node instanceof Annotations ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,no_new', function benchmark( b ) { - var ctor; - var node; - var i; - - ctor = Annotations; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node = ctor(); - if ( !( node instanceof Annotations ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( node instanceof Annotations ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':render', function benchmark( b ) { - var vtree; - var node; - var i; - - node = new Annotations(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - vtree = node.render(); - if ( typeof vtree !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof vtree !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/components/svg/annotations/examples/index.js b/components/svg/annotations/examples/index.js deleted file mode 100644 index 743fb8e..0000000 --- a/components/svg/annotations/examples/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var annotations = require( './../lib' ); - -// Create a new component: -var node = annotations(); - -// Render as a virtual DOM tree: -var vtree = node.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); -// => diff --git a/components/svg/annotations/lib/index.js b/components/svg/annotations/lib/index.js deleted file mode 100644 index b2d44c2..0000000 --- a/components/svg/annotations/lib/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* SVG plot annotations. -* -* @module @stdlib/plot/components/svg/annotations -* -* @example -* var Annotations = require( '@stdlib/plot/components/svg/annotations' ); -* -* var node = new Annotations(); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/components/svg/annotations/lib/main.js b/components/svg/annotations/lib/main.js deleted file mode 100644 index d7f5ea9..0000000 --- a/components/svg/annotations/lib/main.js +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var inherit = require( '@stdlib/utils/inherit' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var render = require( './render.js' ); - - -// VARIABLES // - -var debug = logger( 'annotations:main' ); - - -// MAIN // - -/** -* Annotations constructor. -* -* @constructor -* @returns {Annotations} annotations instance -* -* @example -* var node = new Annotations(); -*/ -function Annotations() { - var self; - if ( !instanceOf( this, Annotations ) ) { - return new Annotations(); - } - self = this; - debug( 'Creating an instance...' ); - EventEmitter.call( this ); - this.on( 'change', onChange ); - this.on( '_render', onRender ); - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - self.render(); - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Inherit from the `EventEmitter` prototype. -*/ -inherit( Annotations, EventEmitter ); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Annotations.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var node = new Annotations(); -* -* var vtree = node.render(); -* // returns -*/ -setReadOnly( Annotations.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Annotations; diff --git a/components/svg/annotations/lib/render.js b/components/svg/annotations/lib/render.js deleted file mode 100644 index 80fd830..0000000 --- a/components/svg/annotations/lib/render.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'annotations:render' ); -var ELEMENT = 'g'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var vtree; - var props; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'annotations', - 'className': 'annotations', - 'attributes': { - 'transform': 'translate(0,0)' - } - }; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, [] ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/annotations/package.json b/components/svg/annotations/package.json deleted file mode 100644 index 96f6cac..0000000 --- a/components/svg/annotations/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/annotations", - "version": "0.0.0", - "description": "SVG plot annotations.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "annotations", - "annotate", - "component", - "virtual", - "dom", - "vdom", - "virtual-dom" - ] -} diff --git a/components/svg/annotations/test/fixtures/vtree.js b/components/svg/annotations/test/fixtures/vtree.js deleted file mode 100644 index 1d704f0..0000000 --- a/components/svg/annotations/test/fixtures/vtree.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'annotations', - 'className': 'annotations', - 'attributes': { - 'transform': 'translate(0,0)' - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/annotations/test/test.js b/components/svg/annotations/test/test.js deleted file mode 100644 index 97c0696..0000000 --- a/components/svg/annotations/test/test.js +++ /dev/null @@ -1,86 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var tape = require( 'tape' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var Annotations = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Annotations, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function is a constructor', function test( t ) { - var node = new Annotations(); - t.strictEqual( instanceOf( node, Annotations ), true, 'is an instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` operator', function test( t ) { - var ctor; - var node; - - ctor = Annotations; - node = ctor(); - - t.strictEqual( instanceOf( node, Annotations ), true, 'is an instance' ); - t.end(); -}); - -tape( 'the constructor returns an event emitter', function test( t ) { - var node = new Annotations(); - t.strictEqual( instanceOf( node, EventEmitter ), true, 'is an event emitter' ); - t.end(); -}); - -tape( 'when a returned instance receives a `change` event, it re-renders and emits a `render` event', function test( t ) { - var node = new Annotations(); - node.on( 'render', onRender ); - node.emit( 'change' ); - - function onRender( obj ) { - t.ok( true, 'emits a render event' ); - t.deepEqual( obj, VTREE, 'provides virtual tree' ); - t.end(); - } -}); - -tape( 'the `render` method returns a rendered virtual tree', function test( t ) { - var vtree; - var node; - - node = new Annotations(); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'returns a virtual tree' ); - t.end(); -}); diff --git a/components/svg/axis/examples/index.js b/components/svg/axis/examples/index.js deleted file mode 100644 index 8d063c6..0000000 --- a/components/svg/axis/examples/index.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var linear = require( 'd3-scale' ).scaleLinear; // TODO: remove -var createAxis = require( './../lib' ); - -// Create a function to map data values to pixel values: -var scale = linear(); -scale.domain( [0, 1] ).range( [0, 100] ); - -// Create a new axis: -var axis = createAxis({ - 'scale': scale, - 'orientation': 'bottom', - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = axis.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -axis.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - axis.tickSize = 12; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/components/svg/axis/lib/components/domain.js b/components/svg/axis/lib/components/domain.js deleted file mode 100644 index 7795351..0000000 --- a/components/svg/axis/lib/components/domain.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/* -* For manually constructing SVG paths, see [MDN]{@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d} -*/ - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:components:domain' ); -var ELEMENT = 'path'; - - -// MAIN // - -/** -* Renders an axis domain. -* -* @private -* @param {Object} ctx - context -* @returns {VTree} virtual tree -*/ -function render( ctx ) { - /* eslint-disable no-underscore-dangle */ - var orient; - var stroke; - var range0; - var range1; - var offset; - var range; - var props; - var d; - - orient = ctx._orientation; - debug( 'Axis orientation: %s.', orient ); - - range = ctx._scale.range(); - debug( 'Axis range: %s.', JSON.stringify( range ) ); - - range0 = range[ 0 ] + 0.5; - range1 = range[ range.length-1 ] + 0.5; - - offset = ctx.tickDir * ctx._outerTickSize; - d = ''; - if ( orient === 'left' || orient === 'right' ) { - d += 'M' + offset + ',' + range0; - d += 'H0.5'; - d += 'V' + range1; - d += 'H' + offset; - - stroke = 'none'; - } else { - d += 'M' + range0 + ',' + offset; - d += 'V0.5'; - d += 'H' + range1; - d += 'V' + offset; - - stroke = '#aaa'; - } - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'axis.domain', - 'className': 'domain', - 'attributes': { - 'fill': 'none', - 'stroke': stroke, - 'stroke-width': 1, - 'd': d - } - }; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, [] ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/axis/lib/components/index.js b/components/svg/axis/lib/components/index.js deleted file mode 100644 index 81c8273..0000000 --- a/components/svg/axis/lib/components/index.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var textAnchor = require( './../utils/text_anchor.js' ); -var domain = require( './domain.js' ); -var ticks = require( './ticks.js' ); -var label = require( './label.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:components:main' ); -var ELEMENT = 'g'; - - -// MAIN // - -/** -* Renders an axis. -* -* @private -* @param {Object} ctx - context -* @returns {VTree} virtual tree -*/ -function render( ctx ) { - var children; - var props; - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'axis', - 'className': 'axis', - 'attributes': { - 'fill': 'none', - 'font-size': 10, // TODO: option - 'font-family': 'sans-serif', // TODO: option - 'text-anchor': textAnchor( ctx._orientation ) // eslint-disable-line no-underscore-dangle - } - }; - - debug( 'Rendering tick marks...' ); - children = ticks( ctx ); - - debug( 'Rendering domain line...' ); - children.unshift( domain( ctx ) ); - - debug( 'Rendering label...' ); - children.push( label( ctx ) ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, children ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/axis/lib/components/label.js b/components/svg/axis/lib/components/label.js deleted file mode 100644 index 035be04..0000000 --- a/components/svg/axis/lib/components/label.js +++ /dev/null @@ -1,77 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var labelTransform = require( './../utils/label_transform.js' ); -var labelXPos = require( './../utils/label_x_pos.js' ); -var labelYPos = require( './../utils/label_y_pos.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:components:label' ); -var ELEMENT = 'text'; - - -// MAIN // - -/** -* Renders an axis label. -* -* @private -* @param {Object} ctx - context -* @returns {VTree} virtual tree -*/ -function render( ctx ) { - /* eslint-disable no-underscore-dangle */ - var orient; - var props; - - orient = ctx._orientation; - debug( 'Axis orientation: %s.', orient ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'axis.label', - 'className': 'label noselect', - 'attributes': { - 'fill': '#000', - 'stroke': 'none', - 'text-anchor': 'middle', - 'transform': labelTransform( orient ), - 'x': labelXPos( orient, ctx._scale.range() ), - 'y': labelYPos( orient ) - } - }; - - debug( 'Axis label: %s.', ctx._label ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, ctx._label ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/axis/lib/components/line.js b/components/svg/axis/lib/components/line.js deleted file mode 100644 index ada610c..0000000 --- a/components/svg/axis/lib/components/line.js +++ /dev/null @@ -1,73 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var xAttr = require( './../utils/x_attr.js' ); -var yAttr = require( './../utils/y_attr.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:components:line' ); -var ELEMENT = 'line'; - - -// MAIN // - -/** -* Renders a tick line. -* -* @private -* @param {Object} ctx - context -* @returns {VTree} virtual tree -*/ -function render( ctx ) { - /* eslint-disable no-underscore-dangle */ - var props; - var x; - var y; - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'attributes': { - 'stroke': '#aaa', - 'stroke-width': 1 - } - }; - - x = xAttr( ctx._orientation ); - y = yAttr( ctx._orientation ); - - props.attributes[ x+'2' ] = ctx.tickDir * ctx._innerTickSize; - props.attributes[ y+'1' ] = 0.5; - props.attributes[ y+'2' ] = 0.5; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, [] ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/axis/lib/components/text.js b/components/svg/axis/lib/components/text.js deleted file mode 100644 index f28dd7c..0000000 --- a/components/svg/axis/lib/components/text.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var dy = require( './../utils/text_dy.js' ); -var xAttr = require( './../utils/x_attr.js' ); -var yAttr = require( './../utils/y_attr.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:components:text' ); -var ELEMENT = 'text'; - - -// MAIN // - -/** -* Renders tick text. -* -* @private -* @param {Object} ctx - context -* @param {*} d - tick value -* @returns {VTree} virtual tree -*/ -function render( ctx, d ) { - /* eslint-disable no-underscore-dangle */ - var orient; - var props; - var txt; - var x; - var y; - - orient = ctx._orientation; - debug( 'Axis orientation: %s.', orient ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'attributes': { - 'fill': '#000', - 'dy': dy( orient ) - } - }; - - x = xAttr( orient ); - y = yAttr( orient ); - - props.attributes[ x ] = ctx.tickDir * ctx.tickSpacing; - props.attributes[ y ] = 0.5; - - txt = ctx.tickFormat( d ); - debug( 'Tick text: %s.', txt ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, txt ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/axis/lib/components/tick.js b/components/svg/axis/lib/components/tick.js deleted file mode 100644 index 7b1c46a..0000000 --- a/components/svg/axis/lib/components/tick.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var line = require( './line.js' ); -var text = require( './text.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:components:tick' ); -var ELEMENT = 'g'; - - -// MAIN // - -/** -* Renders an axis tick. -* -* @private -* @param {Object} ctx - context -* @param {*} d - tick value -* @param {Function} transform - tick transform -* @returns {VTree} virtual tree -*/ -function render( ctx, d, transform ) { - var children; - var props; - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'axis.tick', - 'className': 'tick', - 'attributes': { - 'opacity': 1, - 'transform': transform( d ) - } - }; - children = new Array( 2 ); - - debug( 'Rendering a tick line...' ); - children[ 0 ] = line( ctx ); - - debug( 'Rendering tick text...' ); - children[ 1 ] = text( ctx, d ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, children ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/axis/lib/components/ticks.js b/components/svg/axis/lib/components/ticks.js deleted file mode 100644 index 88580a6..0000000 --- a/components/svg/axis/lib/components/ticks.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var tickTransform = require( './../utils/tick_transform.js' ); -var tick = require( './tick.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:components:ticks' ); - - -// MAIN // - -/** -* Renders axis ticks. -* -* @private -* @param {Object} ctx - context -* @returns {Array} array of virtual DOM trees -*/ -function render( ctx ) { - /* eslint-disable no-underscore-dangle */ - var transform; - var values; - var out; - var i; - - values = ctx.ticks; - debug( 'Tick values: %s.', JSON.stringify( values ) ); - - debug( 'Generating tick transform...' ); - transform = tickTransform( ctx._orientation, ctx._scale ); - - debug( 'Rendering ticks...' ); - out = new Array( values.length ); - for ( i = 0; i < values.length; i++ ) { - debug( 'Rendering tick %d with value %s...', i, values[i] ); - out[ i ] = tick( ctx, values[i], transform ); - } - debug( 'Finished rendering ticks.' ); - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/axis/lib/defaults.json b/components/svg/axis/lib/defaults.json deleted file mode 100644 index 2086147..0000000 --- a/components/svg/axis/lib/defaults.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "scale": null, - "label": "", - "ticks": null, - "numTicks": null, - "tickFormat": null, - "tickSize": 6, - "innerTickSize": 6, - "outerTickSize": 6, - "tickPadding": 3, - "orientation": "bottom", - "autoRender": false -} diff --git a/components/svg/axis/lib/etc/orientations.json b/components/svg/axis/lib/etc/orientations.json deleted file mode 100644 index 2dbe842..0000000 --- a/components/svg/axis/lib/etc/orientations.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "left", - "right", - "top", - "bottom" -] diff --git a/components/svg/axis/lib/events/events.json b/components/svg/axis/lib/events/events.json deleted file mode 100644 index 2a5ecc0..0000000 --- a/components/svg/axis/lib/events/events.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "label": "change", - "numTicks": "change", - "orientation": "change", - "scale": "change", - "tickFormat": "change", - "tickPadding": "change", - "ticks": "change", - "tickSize": "change", - "innerTickSize": "change", - "outerTickSize": "change", - "autoRender": "change" -} diff --git a/components/svg/axis/lib/events/index.js b/components/svg/axis/lib/events/index.js deleted file mode 100644 index ef68b2b..0000000 --- a/components/svg/axis/lib/events/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EVENTS = require( './events.json' ); - - -// MAIN // - -/** -* Provided a property, returns a corresponding event name for when a property value changes. -* -* @private -* @param {string} prop - property -* @returns {string} event name -*/ -function get( prop ) { - return EVENTS[ prop ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/index.js b/components/svg/axis/lib/index.js deleted file mode 100644 index 320fba9..0000000 --- a/components/svg/axis/lib/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// TODO: remove d3-scale - -/** -* Plot axis. -* -* @module @stdlib/plot/components/svg/axis -* -* @example -* var linear = require( 'd3-scale' ).scaleLinear(); -* var Axis = require( '@stdlib/plot/components/svg/axis' ); -* -* var axis = new Axis({ -* 'scale': linear(), -* 'orient': 'bottom' -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/components/svg/axis/lib/main.js b/components/svg/axis/lib/main.js deleted file mode 100644 index 372f5b1..0000000 --- a/components/svg/axis/lib/main.js +++ /dev/null @@ -1,573 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// TODO: improve JSDoc examples - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var linear = require( 'd3-scale' ).scaleLinear; // TODO: remove -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var copy = require( '@stdlib/utils/copy' ); -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var setScale = require( './props/scale/set.js' ); -var getScale = require( './props/scale/get.js' ); -var setOrientation = require( './props/orientation/set.js' ); -var getOrientation = require( './props/orientation/get.js' ); -var setLabel = require( './props/label/set.js' ); -var getLabel = require( './props/label/get.js' ); -var setTicks = require( './props/ticks/set.js' ); -var getTicks = require( './props/ticks/get.js' ); -var setNumTicks = require( './props/num-ticks/set.js' ); -var getNumTicks = require( './props/num-ticks/get.js' ); -var setTickFormat = require( './props/tick-format/set.js' ); -var getTickFormat = require( './props/tick-format/get.js' ); -var setTickSize = require( './props/tick-size/set.js' ); -var getTickSize = require( './props/tick-size/get.js' ); -var setInnerTickSize = require( './props/inner-tick-size/set.js' ); -var getInnerTickSize = require( './props/inner-tick-size/get.js' ); -var setOuterTickSize = require( './props/outer-tick-size/set.js' ); -var getOuterTickSize = require( './props/outer-tick-size/get.js' ); -var setTickPadding = require( './props/tick-padding/set.js' ); -var getTickPadding = require( './props/tick-padding/get.js' ); -var getTickSpacing = require( './props/tick-spacing/get.js' ); -var getTickDir = require( './props/tick-dir/get.js' ); -var getTickPos = require( './props/tick-pos/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var render = require( './methods/render.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:main' ); - - -// MAIN // - -/** -* Axis constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {Function} [options.scale] - scale function -* @param {string} [options.orientation='bottom'] - axis orientation -* @param {string} [options.label] - axis label -* @param {(Array|null)} [options.ticks] - tick values -* @param {(NonNegativeInteger|null)} [options.numTicks] - number of ticks -* @param {(null|string|Function)} [options.tickFormat] - tick format -* @param {NonNegativeInteger} [options.tickSize=6] - tick size -* @param {NonNegativeInteger} [options.innerTickSize=6] - inner tick size -* @param {NonNegativeInteger} [options.outerTickSize=6] - outer tick size -* @param {NonNegativeInteger} [options.tickPadding=3] - tick padding -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Axis} axis instance -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom' -* }); -*/ -function Axis( options ) { - var self; - var opts; - var err; - if ( !( this instanceof Axis ) ) { - return new Axis( options ); - } - self = this; - opts = copy( defaults ); - err = validate( opts, options ); - if ( err ) { - throw err; - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - defineProperty( this, '_scale', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.scale || linear() - }); - defineProperty( this, '_orientation', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.orientation - }); - defineProperty( this, '_label', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.label - }); - defineProperty( this, '_ticks', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.ticks - }); - defineProperty( this, '_numTicks', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.numTicks - }); - defineProperty( this, '_tickFormat', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.tickFormat - }); - defineProperty( this, '_tickSize', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.tickSize - }); - defineProperty( this, '_innerTickSize', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.innerTickSize - }); - defineProperty( this, '_outerTickSize', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.outerTickSize - }); - defineProperty( this, '_tickPadding', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.tickPadding - }); - defineProperty( this, '_autoRender', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.autoRender - }); - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Axis.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Axis.prototype.constructor = Axis; - -/** -* Scale function. -* -* @name scale -* @memberof Axis.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var axis = new Axis({ -* 'orientation': 'top' -* }); -* -* var f = axis.scale; -* // returns -*/ -defineProperty( Axis.prototype, 'scale', { - 'configurable': false, - 'enumerable': true, - 'set': setScale, - 'get': getScale -}); - -/** -* Axis orientation. -* -* @name orientation -* @memberof Axis.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default 'bottom' -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom' -* }); -* axis.orientation = 'top'; -* -* var v = axis.orientation; -* // returns 'top' -*/ -defineProperty( Axis.prototype, 'orientation', { - 'configurable': false, - 'enumerable': true, - 'set': setOrientation, - 'get': getOrientation -}); - -/** -* Axis label. -* -* @name label -* @memberof Axis.prototype -* @type {string} -* @throws {TypeError} must be a string -* -* @example -* var axis = new Axis({ -* 'label': 'y' -* }); -* axis.label = 'Counts'; -* -* var v = axis.label; -* // returns 'Counts' -*/ -defineProperty( Axis.prototype, 'label', { - 'configurable': false, - 'enumerable': true, - 'set': setLabel, - 'get': getLabel -}); - -/** -* Axis tick values. When set to `null`, the retrieved values are the computed tick values. -* -* @name ticks -* @memberof Axis.prototype -* @type {(Array|null)} -* @throws {TypeError} must be an array or null -* @default null -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom', -* 'ticks': [1,2,3] -* }); -* axis.ticks = ['a','b','c']; -* -* var v = axis.ticks; -* // returns -*/ -defineProperty( Axis.prototype, 'ticks', { - 'configurable': false, - 'enumerable': true, - 'set': setTicks, - 'get': getTicks -}); - -/** -* Number of axis ticks. -* -* @name numTicks -* @memberof Axis.prototype -* @type {(NonNegativeInteger|null)} -* @throws {TypeError} must be a nonnegative integer or null -* @default null -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom', -* 'numTicks': 10 -* }); -* axis.numTicks = 5; -* -* var v = axis.numTicks; -* // returns 5 -*/ -defineProperty( Axis.prototype, 'numTicks', { - 'configurable': false, - 'enumerable': true, - 'set': setNumTicks, - 'get': getNumTicks -}); - -/** -* Tick format. When retrieved, the returned value is a formatting function. -* -* @name tickFormat -* @memberof Axis.prototype -* @type {(null|string|Function)} -* @throws {TypeError} must be either null, a string, or a function -* @default null -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom', -* 'tickFormat': ',f' -* }); -* axis.tickFormat = ',.0f'; -* -* var v = axis.tickFormat; -* // returns -*/ -defineProperty( Axis.prototype, 'tickFormat', { - 'configurable': false, - 'enumerable': true, - 'set': setTickFormat, - 'get': getTickFormat -}); - -/** -* Axis tick size. -* -* @name tickSize -* @memberof Axis.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 6 -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom', -* 'tickSize': 12 -* }); -* axis.tickSize = 8; -* -* var v = axis.tickSize; -* // returns 8 -*/ -defineProperty( Axis.prototype, 'tickSize', { - 'configurable': false, - 'enumerable': true, - 'set': setTickSize, - 'get': getTickSize -}); - -/** -* Axis inner tick size. -* -* @name innerTickSize -* @memberof Axis.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 6 -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom', -* 'innerTickSize': 10 -* }); -* axis.innerTickSize = 5; -* -* var v = axis.innerTickSize; -* // returns 5 -*/ -defineProperty( Axis.prototype, 'innerTickSize', { - 'configurable': false, - 'enumerable': true, - 'set': setInnerTickSize, - 'get': getInnerTickSize -}); - -/** -* Axis outer tick size. -* -* @name outerTickSize -* @memberof Axis.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 6 -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom', -* 'outerTickSize': 10 -* }); -* axis.outerTickSize = 5; -* -* var v = axis.outerTickSize; -* // returns 5 -*/ -defineProperty( Axis.prototype, 'outerTickSize', { - 'configurable': false, - 'enumerable': true, - 'set': setOuterTickSize, - 'get': getOuterTickSize -}); - -/** -* Axis tick padding. -* -* @name tickPadding -* @memberof Axis.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 3 -* -* @example -* var axis = new Axis({ -* 'orientation': 'bottom', -* 'tickPadding': 10 -* }); -* axis.tickPadding = 5; -* -* var v = axis.tickPadding; -* // returns 5 -*/ -defineProperty( Axis.prototype, 'tickPadding', { - 'configurable': false, - 'enumerable': true, - 'set': setTickPadding, - 'get': getTickPadding -}); - -/** -* Tick spacing. -* -* @name tickSpacing -* @memberof Axis.prototype -* @type {number} -* -* @example -* var axis = new Axis( {} ); -* -* var spacing = axis.tickSpacing; -* // returns -*/ -defineProperty( Axis.prototype, 'tickSpacing', { - 'configurable': false, - 'enumerable': true, - 'get': getTickSpacing -}); - -/** -* Tick direction. -* -* @name tickDir -* @memberof Axis.prototype -* @type {number} -* -* @example -* var axis = new Axis( {} ); -* -* var dir = axis.tickDir; -* // returns -*/ -defineProperty( Axis.prototype, 'tickDir', { - 'configurable': false, - 'enumerable': true, - 'get': getTickDir -}); - -/** -* Function for computing tick positions. -* -* @name tickPos -* @memberof Axis.prototype -* @type {Function} -* -* @example -* var axis = new Axis( {} ); -* -* var tickPos = axis.tickPos; -* // returns -*/ -defineProperty( Axis.prototype, 'tickPos', { - 'configurable': false, - 'enumerable': true, - 'get': getTickPos -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Axis.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var axis = new Axis({ -* 'autoRender': true -* }); -* -* var mode = axis.autoRender; -* // returns true -*/ -defineProperty( Axis.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Axis.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var axis = new Axis( {} ); -* -* var out = axis.render(); -*/ -setReadOnly( Axis.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Axis; diff --git a/components/svg/axis/lib/methods/render.js b/components/svg/axis/lib/methods/render.js deleted file mode 100644 index 7452869..0000000 --- a/components/svg/axis/lib/methods/render.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var components = require( './../components' ); - - -// VARIABLES // - -var debug = logger( 'axis:render' ); - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var vtree; - - debug( 'Rendering...' ); - vtree = components( this ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/axis/lib/props/auto-render/get.js b/components/svg/axis/lib/props/auto-render/get.js deleted file mode 100644 index 7df40de..0000000 --- a/components/svg/axis/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/props/auto-render/set.js b/components/svg/axis/lib/props/auto-render/set.js deleted file mode 100644 index 758fcf0..0000000 --- a/components/svg/axis/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/auto_render.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:auto-render' ); -var CHANGE_EVENT = events( 'autoRender' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - var err = isValid( bool ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/axis/lib/props/inner-tick-size/get.js b/components/svg/axis/lib/props/inner-tick-size/get.js deleted file mode 100644 index f343d33..0000000 --- a/components/svg/axis/lib/props/inner-tick-size/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the inner tick size. -* -* @private -* @returns {NonNegativeInteger} tick size -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._innerTickSize; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/props/inner-tick-size/set.js b/components/svg/axis/lib/props/inner-tick-size/set.js deleted file mode 100644 index fd5118a..0000000 --- a/components/svg/axis/lib/props/inner-tick-size/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/inner_tick_size.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:ticksize-inner' ); -var CHANGE_EVENT = events( 'innerTickSize' ); - - -// MAIN // - -/** -* Sets the inner tick size. -* -* @private -* @param {NonNegativeInteger} size - size -* @throws {TypeError} must be a nonnegative integer -*/ -function set( size ) { - /* eslint-disable no-invalid-this */ - var err = isValid( size ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', size ); - - this._innerTickSize = size; - debug( 'New Value: %s.', this._innerTickSize ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/axis/lib/props/label/get.js b/components/svg/axis/lib/props/label/get.js deleted file mode 100644 index a6d7816..0000000 --- a/components/svg/axis/lib/props/label/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the axis label. -* -* @private -* @returns {string} label -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._label; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/props/label/set.js b/components/svg/axis/lib/props/label/set.js deleted file mode 100644 index 96e8db1..0000000 --- a/components/svg/axis/lib/props/label/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/label.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:xlabel' ); -var CHANGE_EVENT = events( 'label' ); - - -// MAIN // - -/** -* Sets the axis label. -* -* @private -* @param {string} label - axis label -* @throws {TypeError} must be a string -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - var err = isValid( label ); - if ( err ) { - throw err; - } - debug( 'Current value: %s.', this._label ); - - this._label = label; - debug( 'New value: %s.', this._label ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/axis/lib/props/num-ticks/get.js b/components/svg/axis/lib/props/num-ticks/get.js deleted file mode 100644 index 792d7ab..0000000 --- a/components/svg/axis/lib/props/num-ticks/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the number of axis ticks. -* -* @private -* @returns {(NonNegativeInteger|null)} number of ticks -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._numTicks; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/props/num-ticks/set.js b/components/svg/axis/lib/props/num-ticks/set.js deleted file mode 100644 index c0ef5a8..0000000 --- a/components/svg/axis/lib/props/num-ticks/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/num_ticks.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:numticks' ); -var CHANGE_EVENT = events( 'numTicks' ); - - -// MAIN // - -/** -* Sets the number of axis ticks. -* -* @private -* @param {(NonNegativeInteger|null)} num - num -* @throws {TypeError} must be a nonnegative integer or null -*/ -function set( num ) { - /* eslint-disable no-invalid-this */ - var err = isValid( num ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', num ); - - this._numTicks = num; - debug( 'New Value: %s.', this._numTicks ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/axis/lib/props/orientation/get.js b/components/svg/axis/lib/props/orientation/get.js deleted file mode 100644 index 0d5b896..0000000 --- a/components/svg/axis/lib/props/orientation/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the axis orientation. -* -* @private -* @returns {string} orientation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._orientation; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/props/orientation/set.js b/components/svg/axis/lib/props/orientation/set.js deleted file mode 100644 index 93629fe..0000000 --- a/components/svg/axis/lib/props/orientation/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/orientation.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:orientation' ); -var CHANGE_EVENT = events( 'orientation' ); - - -// MAIN // - -/** -* Sets the axis orientation. -* -* @private -* @param {string} orient - axis orientation -* @throws {TypeError} must be a string -*/ -function set( orient ) { - /* eslint-disable no-invalid-this */ - var err = isValid( orient ); - if ( err ) { - throw err; - } - debug( 'Current value: %s.', this._orientation ); - - this._orientation = orient; - debug( 'New Value: %s.', this._orientation ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/axis/lib/props/outer-tick-size/get.js b/components/svg/axis/lib/props/outer-tick-size/get.js deleted file mode 100644 index 3dfecb3..0000000 --- a/components/svg/axis/lib/props/outer-tick-size/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the axis outer tick size. -* -* @private -* @returns {NonNegativeInteger} tick size -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._outerTickSize; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/props/outer-tick-size/set.js b/components/svg/axis/lib/props/outer-tick-size/set.js deleted file mode 100644 index cf55252..0000000 --- a/components/svg/axis/lib/props/outer-tick-size/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/outer_tick_size.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:ticksize-outer' ); -var CHANGE_EVENT = events( 'outerTickSize' ); - - -// MAIN // - -/** -* Sets the axis outer tick size. -* -* @private -* @param {NonNegativeInteger} size - size -* @throws {TypeError} must be a nonnegative integer -*/ -function set( size ) { - /* eslint-disable no-invalid-this */ - var err = isValid( size ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', size ); - - this._outerTickSize = size; - debug( 'New Value: %s.', this._outerTickSize ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/axis/lib/props/scale/get.js b/components/svg/axis/lib/props/scale/get.js deleted file mode 100644 index 4ef9bb2..0000000 --- a/components/svg/axis/lib/props/scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._scale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/props/scale/set.js b/components/svg/axis/lib/props/scale/set.js deleted file mode 100644 index e4f7065..0000000 --- a/components/svg/axis/lib/props/scale/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/scale.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:scale' ); -var CHANGE_EVENT = events( 'scale' ); - - -// MAIN // - -/** -* Sets the scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - var err = isValid( fcn ); - if ( err ) { - throw err; - } - debug( 'Current value: %s.', this._scale ); - - this._scale = fcn; - debug( 'New Value: %s.', this._scale ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/axis/lib/props/tick-dir/get.js b/components/svg/axis/lib/props/tick-dir/get.js deleted file mode 100644 index 6b92964..0000000 --- a/components/svg/axis/lib/props/tick-dir/get.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the tick direction. -* -* @private -* @returns {number} tick direction -*/ -function get() { - /* eslint-disable no-invalid-this */ - if ( - this._orientation === 'top' || - this._orientation === 'left' - ) { - return -1; - } - return 1; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/props/tick-format/get.js b/components/svg/axis/lib/props/tick-format/get.js deleted file mode 100644 index e7cd439..0000000 --- a/components/svg/axis/lib/props/tick-format/get.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var format = require( 'd3-format' ).format; // TODO: remove -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isNull = require( '@stdlib/assert/is-null' ); -var identity = require( '@stdlib/utils/identity-function' ); - - -// MAIN // - -/** -* Returns the axis tick format. -* -* @private -* @returns {Function} format function -*/ -function get() { - /* eslint-disable no-invalid-this */ - if ( isString( this._tickFormat ) ) { - return format( this._tickFormat ); - } - if ( isNull( this._tickFormat ) ) { - if ( this._scale.tickFormat ) { - return this._scale.tickFormat( this._numTicks, this._tickFormat ); - } - return identity; - } - return this._tickFormat; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/props/tick-format/set.js b/components/svg/axis/lib/props/tick-format/set.js deleted file mode 100644 index 0f5da33..0000000 --- a/components/svg/axis/lib/props/tick-format/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/tick_format.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:tickformat' ); -var CHANGE_EVENT = events( 'tickFormat' ); - - -// MAIN // - -/** -* Sets the axis tick format. -* -* @private -* @param {(null|string|Function)} fmt - tick format -* @throws {TypeError} must be either null, a string, or a function -*/ -function set( fmt ) { - /* eslint-disable no-invalid-this */ - var err = isValid( fmt ); - if ( err ) { - throw err; - } - debug( 'Current value: %s.', this._tickFormat ); - - this._tickFormat = fmt; - debug( 'New Value: %s.', this._tickFormat ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/axis/lib/props/tick-padding/get.js b/components/svg/axis/lib/props/tick-padding/get.js deleted file mode 100644 index e5d5072..0000000 --- a/components/svg/axis/lib/props/tick-padding/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the axis tick padding. -* -* @private -* @returns {NonNegativeInteger} padding -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._tickPadding; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/props/tick-padding/set.js b/components/svg/axis/lib/props/tick-padding/set.js deleted file mode 100644 index 841285d..0000000 --- a/components/svg/axis/lib/props/tick-padding/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/tick_padding.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:tickpadding' ); -var CHANGE_EVENT = events( 'tickPadding' ); - - -// MAIN // - -/** -* Sets the axis tick padding. -* -* @private -* @param {NonNegativeInteger} padding - padding -* @throws {TypeError} must be a nonnegative integer -*/ -function set( padding ) { - /* eslint-disable no-invalid-this */ - var err = isValid( padding ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', padding ); - - this._tickPadding = padding; - debug( 'New Value: %s.', this._tickPadding ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/axis/lib/props/tick-pos/center.js b/components/svg/axis/lib/props/tick-pos/center.js deleted file mode 100644 index 5ee1193..0000000 --- a/components/svg/axis/lib/props/tick-pos/center.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'axis:center' ); - - -// MAIN // - -/** -* Returns a function to center a tick. -* -* @private -* @returns {Function} function to center a tick -*/ -function center() { - /* eslint-disable no-invalid-this */ - var width = this._scale.bandwidth() / 2; - return center; - - /** - * Returns a centered tick position. - * - * @private - * @param {*} d - datum - * @returns {number} tick position - */ - function center( d ) { - var pos = this._scale( d ) + width; - debug( 'Value: %s => Coordinate: %d', d, pos ); - return pos; - } -} - - -// EXPORTS // - -module.exports = center; diff --git a/components/svg/axis/lib/props/tick-pos/get.js b/components/svg/axis/lib/props/tick-pos/get.js deleted file mode 100644 index e29d88b..0000000 --- a/components/svg/axis/lib/props/tick-pos/get.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var center = require( './center.js' ); - - -// MAIN // - -/** -* Returns a function for positioning ticks. -* -* @private -* @returns {Function} position function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this._scale.copy(); - if ( scale.bandwidth ) { - return center( scale ); - } - return scale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/props/tick-size/get.js b/components/svg/axis/lib/props/tick-size/get.js deleted file mode 100644 index 63c5fb3..0000000 --- a/components/svg/axis/lib/props/tick-size/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the axis tick size. -* -* @private -* @returns {NonNegativeInteger} tick size -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._tickSize; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/props/tick-size/set.js b/components/svg/axis/lib/props/tick-size/set.js deleted file mode 100644 index ffdeb33..0000000 --- a/components/svg/axis/lib/props/tick-size/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/tick_size.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:ticksize' ); -var CHANGE_EVENT = events( 'tickSize' ); - - -// MAIN // - -/** -* Sets the axis tick size. -* -* @private -* @param {NonNegativeInteger} size - size -* @throws {TypeError} must be a nonnegative integer -*/ -function set( size ) { - /* eslint-disable no-invalid-this */ - var err = isValid( size ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', size ); - - this._tickSize = size; - debug( 'New Value: %s.', this._tickSize ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/axis/lib/props/tick-spacing/get.js b/components/svg/axis/lib/props/tick-spacing/get.js deleted file mode 100644 index 9040325..0000000 --- a/components/svg/axis/lib/props/tick-spacing/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the tick spacing. -* -* @private -* @returns {number} tick spacing -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._innerTickSize + this._tickPadding; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/props/ticks/get.js b/components/svg/axis/lib/props/ticks/get.js deleted file mode 100644 index 5824099..0000000 --- a/components/svg/axis/lib/props/ticks/get.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNull = require( '@stdlib/assert/is-null' ); - - -// MAIN // - -/** -* Returns the axis tick values. -* -* @private -* @returns {Array} ticks -*/ -function get() { - /* eslint-disable no-invalid-this */ - if ( isNull( this._ticks ) ) { - if ( this._scale.ticks ) { - return this._scale.ticks( this._numTicks, this._tickFormat ); - } - return this._scale.domain(); - } - return this._ticks.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/axis/lib/props/ticks/set.js b/components/svg/axis/lib/props/ticks/set.js deleted file mode 100644 index f16e332..0000000 --- a/components/svg/axis/lib/props/ticks/set.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/ticks.js' ); - - -// VARIABLES // - -var debug = logger( 'axis:set:ticks' ); -var CHANGE_EVENT = events( 'ticks' ); - - -// MAIN // - -/** -* Sets the axis tick values. -* -* @private -* @param {(Array|null)} ticks - tick values -* @throws {TypeError} must be an array or null -*/ -function set( ticks ) { - /* eslint-disable no-invalid-this */ - var err = isValid( ticks ); - if ( err ) { - throw err; - } - debug( 'Current value: %s.', JSON.stringify( this._ticks ) ); - - if ( isNull( ticks ) ) { - this._ticks = ticks; - } else { - this._ticks = ticks.slice(); - } - debug( 'New Value: %s.', JSON.stringify( this._ticks ) ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/axis/lib/utils/label_transform.js b/components/svg/axis/lib/utils/label_transform.js deleted file mode 100644 index 3c5111b..0000000 --- a/components/svg/axis/lib/utils/label_transform.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns a label SVG transform. -* -* @private -* @param {string} orient - axis orientation -* @returns {string} SVG transform -*/ -function labelTransform( orient ) { - if ( orient === 'bottom' || orient === 'top' ) { - return 'rotate(0)'; - } - if ( orient === 'left' ) { - return 'rotate(-90)'; - } - // orient === 'right' - return 'rotate(90)'; -} - - -// EXPORTS // - -module.exports = labelTransform; diff --git a/components/svg/axis/lib/utils/label_x_pos.js b/components/svg/axis/lib/utils/label_x_pos.js deleted file mode 100644 index 5b92f87..0000000 --- a/components/svg/axis/lib/utils/label_x_pos.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the label `x` coordinate. -* -* @private -* @param {string} orient - axis orientation -* @param {NumericArray} range - scale range -* @returns {number} `x` coordinate -*/ -function labelXPos( orient, range ) { - if ( orient === 'left' || orient === 'right' ) { - return -range[0] / 2; - } - return range[1] / 2; -} - - -// EXPORTS // - -module.exports = labelXPos; diff --git a/components/svg/axis/lib/utils/label_y_pos.js b/components/svg/axis/lib/utils/label_y_pos.js deleted file mode 100644 index 6c277c0..0000000 --- a/components/svg/axis/lib/utils/label_y_pos.js +++ /dev/null @@ -1,45 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the label `y` coordinate. -* -* @private -* @param {string} orient - axis orientation -* @returns {number} `y` coordinate -*/ -function labelYPos( orient ) { - if ( orient === 'left' ) { - return -72; - } - if ( orient === 'right' ) { - return 72; - } - if ( orient === 'bottom' ) { - return 45; - } - // orient === 'top' - return -45; -} - - -// EXPORTS // - -module.exports = labelYPos; diff --git a/components/svg/axis/lib/utils/text_anchor.js b/components/svg/axis/lib/utils/text_anchor.js deleted file mode 100644 index c46a92a..0000000 --- a/components/svg/axis/lib/utils/text_anchor.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the text anchor value for text positioning. -* -* @private -* @param {string} orient - axis orientation -* @returns {string} text anchor value -*/ -function textAnchor( orient ) { - if ( orient === 'left' ) { - return 'end'; - } - if ( orient === 'right' ) { - return 'start'; - } - return 'middle'; -} - - -// EXPORTS // - -module.exports = textAnchor; diff --git a/components/svg/axis/lib/utils/text_dy.js b/components/svg/axis/lib/utils/text_dy.js deleted file mode 100644 index 8b9d22a..0000000 --- a/components/svg/axis/lib/utils/text_dy.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns vertical shift for aligning tick text. -* -* @private -* @param {string} orient - axis orientation -* @returns {string} text shift -*/ -function dy( orient ) { - if ( orient === 'top' ) { - return '0em'; - } - if ( orient === 'bottom' ) { - return '.71em'; - } - return '.32em'; -} - - -// EXPORTS // - -module.exports = dy; diff --git a/components/svg/axis/lib/utils/tick_transform.js b/components/svg/axis/lib/utils/tick_transform.js deleted file mode 100644 index 6bc43ae..0000000 --- a/components/svg/axis/lib/utils/tick_transform.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var translateX = require( './translate_x.js' ); -var translateY = require( './translate_y.js' ); - - -// MAIN // - -/** -* Returns a function to translate ticks. -* -* @private -* @param {string} orient - axis orientation -* @param {Function} scale - scale function -* @returns {Function} transform function -*/ -function tickTransform( orient, scale ) { - if ( orient === 'top' || orient === 'bottom' ) { - return translateX( scale ); - } - return translateY( scale ); -} - - -// EXPORTS // - -module.exports = tickTransform; diff --git a/components/svg/axis/lib/utils/translate_x.js b/components/svg/axis/lib/utils/translate_x.js deleted file mode 100644 index 367e71d..0000000 --- a/components/svg/axis/lib/utils/translate_x.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'axis:engine:translate-x' ); - - -// MAIN // - -/** -* Returns a function to horizontally translate a tick. -* -* @private -* @param {Function} scale - scale function -* @returns {Function} function to translate a tick -*/ -function translateX( scale ) { - return translateX; - - /** - * Horizontally translates a tick. - * - * @private - * @param {*} d - datum - * @returns {string} transform - */ - function translateX( d ) { - var t = 'translate('+scale( d )+',0)'; - debug( 'Value: %s => Transform: %s.', d, t ); - return t; - } -} - - -// EXPORTS // - -module.exports = translateX; diff --git a/components/svg/axis/lib/utils/translate_y.js b/components/svg/axis/lib/utils/translate_y.js deleted file mode 100644 index d887e7a..0000000 --- a/components/svg/axis/lib/utils/translate_y.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'axis:engine:translate-y' ); - - -// MAIN // - -/** -* Returns a function to vertically translate a tick. -* -* @private -* @param {Function} scale - scale function -* @returns {Function} function to translate a tick -*/ -function translateY( scale ) { - return translateY; - - /** - * Vertically translates a tick. - * - * @private - * @param {*} d - datum - * @returns {string} transform - */ - function translateY( d ) { - var t = 'translate(0,'+scale( d )+')'; - debug( 'Value: %s => Transform: %s.', d, t ); - return t; - } -} - - -// EXPORTS // - -module.exports = translateY; diff --git a/components/svg/axis/lib/utils/x_attr.js b/components/svg/axis/lib/utils/x_attr.js deleted file mode 100644 index a191df2..0000000 --- a/components/svg/axis/lib/utils/x_attr.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the "x" attribute for tick positioning. -* -* @private -* @param {string} orient - axis orientation -* @returns {string} attribute -*/ -function xAttr( orient ) { - if ( orient === 'left' || orient === 'right' ) { - return 'x'; - } - return 'y'; -} - - -// EXPORTS // - -module.exports = xAttr; diff --git a/components/svg/axis/lib/utils/y_attr.js b/components/svg/axis/lib/utils/y_attr.js deleted file mode 100644 index ad146b7..0000000 --- a/components/svg/axis/lib/utils/y_attr.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the "y" attribute for tick positioning. -* -* @private -* @param {string} orient - axis orientation -* @returns {string} attribute -*/ -function yAttr( orient ) { - if ( orient === 'left' || orient === 'right' ) { - return 'y'; - } - return 'x'; -} - - -// EXPORTS // - -module.exports = yAttr; diff --git a/components/svg/axis/lib/validate.js b/components/svg/axis/lib/validate.js deleted file mode 100644 index 7f7be86..0000000 --- a/components/svg/axis/lib/validate.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var objectKeys = require( '@stdlib/utils/keys' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); -var validators = require( './validators' ); - - -// VARIABLES // - -var KEYS = objectKeys( validators ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {Function} [options.scale] - scale function -* @param {string} [options.orientation] - axis orientation -* @param {string} [options.label] - axis label -* @param {(Array|null)} [options.ticks] - tick values -* @param {(NonNegativeInteger|null)} [options.numTicks] - number of ticks -* @param {(null|string|Function)} [options.tickFormat] - tick format -* @param {NonNegativeInteger} [options.tickSize] - tick size -* @param {NonNegativeInteger} [options.innerTickSize] - inner tick size -* @param {NonNegativeInteger} [options.outerTickSize] - outer tick size -* @param {NonNegativeInteger} [options.tickPadding] - tick padding -* @returns {(Error|null)} error or null -* -* @example -* var opts = {}; -* var options = { -* 'scale': function scale(){}, -* 'orientation': 'left', -* 'tickSize': 10 -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var err; - var key; - var val; - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - for ( i = 0; i < KEYS.length; i++ ) { - key = KEYS[ i ]; - if ( hasOwnProp( options, key ) ) { - val = options[ key ]; - err = validators[ key ]( val ); - if ( err ) { - return err; - } - opts[ key ] = val; - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/components/svg/axis/lib/validators/auto_render.js b/components/svg/axis/lib/validators/auto_render.js deleted file mode 100644 index 08da79f..0000000 --- a/components/svg/axis/lib/validators/auto_render.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `autoRender`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isBoolean( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/axis/lib/validators/index.js b/components/svg/axis/lib/validators/index.js deleted file mode 100644 index b849e7f..0000000 --- a/components/svg/axis/lib/validators/index.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var autoRender = require( './auto_render.js' ); -var label = require( './label.js' ); -var numTicks = require( './num_ticks.js' ); -var orientation = require( './orientation.js' ); -var scale = require( './scale.js' ); -var tickFormat = require( './tick_format.js' ); -var tickPadding = require( './tick_padding.js' ); -var ticks = require( './ticks.js' ); -var tickSize = require( './tick_size.js' ); -var innerTickSize = require( './inner_tick_size.js' ); -var outerTickSize = require( './outer_tick_size.js' ); - - -// MAIN // - -var validators = { - 'autoRender': autoRender, - 'label': label, - 'numTicks': numTicks, - 'orientation': orientation, - 'scale': scale, - 'tickFormat': tickFormat, - 'tickPadding': tickPadding, - 'ticks': ticks, - 'tickSize': tickSize, - 'innerTickSize': innerTickSize, - 'outerTickSize': outerTickSize -}; - - -// EXPORTS // - -module.exports = validators; diff --git a/components/svg/axis/lib/validators/inner_tick_size.js b/components/svg/axis/lib/validators/inner_tick_size.js deleted file mode 100644 index 8271f9c..0000000 --- a/components/svg/axis/lib/validators/inner_tick_size.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `innerTickSize`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isNonNegativeInteger( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'innerTickSize', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/axis/lib/validators/label.js b/components/svg/axis/lib/validators/label.js deleted file mode 100644 index ca11a1c..0000000 --- a/components/svg/axis/lib/validators/label.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `label`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isString( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'label', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/axis/lib/validators/num_ticks.js b/components/svg/axis/lib/validators/num_ticks.js deleted file mode 100644 index 51e366b..0000000 --- a/components/svg/axis/lib/validators/num_ticks.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNull = require( '@stdlib/assert/is-null' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `numTicks`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( - !isNull( v ) && - !isNonNegativeInteger( v ) - ) { - return new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or null. Value: `%s`.', 'numTicks', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/axis/lib/validators/orientation.js b/components/svg/axis/lib/validators/orientation.js deleted file mode 100644 index c38f5ab..0000000 --- a/components/svg/axis/lib/validators/orientation.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var ORIENTATIONS = require( './../etc/orientations.json' ); - - -// MAIN // - -/** -* Validates `orientation`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( indexOf( ORIENTATIONS, v ) === -1 ) { - return new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'orientation', ORIENTATIONS.join( '", "' ), v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/axis/lib/validators/outer_tick_size.js b/components/svg/axis/lib/validators/outer_tick_size.js deleted file mode 100644 index 6f78b85..0000000 --- a/components/svg/axis/lib/validators/outer_tick_size.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `outerTickSize`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isNonNegativeInteger( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'outerTickSize', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/axis/lib/validators/scale.js b/components/svg/axis/lib/validators/scale.js deleted file mode 100644 index d0636cd..0000000 --- a/components/svg/axis/lib/validators/scale.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `scale`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isFunction( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'scale', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/axis/lib/validators/tick_format.js b/components/svg/axis/lib/validators/tick_format.js deleted file mode 100644 index 8cf488b..0000000 --- a/components/svg/axis/lib/validators/tick_format.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNull = require( '@stdlib/assert/is-null' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `tickFormat`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( - !isNull( v ) && - !isString( v ) && - !isFunction( v ) - ) { - return new TypeError( format( 'invalid assignment. `%s` must be a string, function, or null. Value: `%s`.', 'tickFormat', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/axis/lib/validators/tick_padding.js b/components/svg/axis/lib/validators/tick_padding.js deleted file mode 100644 index ac7a624..0000000 --- a/components/svg/axis/lib/validators/tick_padding.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `tickPadding`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isNonNegativeInteger( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'tickPadding', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/axis/lib/validators/tick_size.js b/components/svg/axis/lib/validators/tick_size.js deleted file mode 100644 index 5365994..0000000 --- a/components/svg/axis/lib/validators/tick_size.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `tickSize`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isNonNegativeInteger( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'tickSize', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/axis/lib/validators/ticks.js b/components/svg/axis/lib/validators/ticks.js deleted file mode 100644 index 5bdbd37..0000000 --- a/components/svg/axis/lib/validators/ticks.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNull = require( '@stdlib/assert/is-null' ); -var isArray = require( '@stdlib/assert/is-array' ); -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `ticks`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( - !isNull( v ) && - !isArray( v ) - ) { - return new TypeError( format( 'invalid assignment. `%s` must be null or an array. Value: `%s`.', 'ticks', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/axis/package.json b/components/svg/axis/package.json deleted file mode 100644 index 549278e..0000000 --- a/components/svg/axis/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/axis", - "version": "0.0.0", - "description": "Axis.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "axis", - "axes", - "component" - ] -} diff --git a/components/svg/background/examples/index.js b/components/svg/background/examples/index.js deleted file mode 100644 index 8fe2b59..0000000 --- a/components/svg/background/examples/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var background = require( './../lib' ); - -// Create a new background: -var bkgd = background({ - 'width': 400, - 'height': 400, - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = bkgd.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -bkgd.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - bkgd.width = 500; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/components/svg/background/lib/defaults.json b/components/svg/background/lib/defaults.json deleted file mode 100644 index 292f22b..0000000 --- a/components/svg/background/lib/defaults.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "width": 400, - "height": 400, - "autoRender": false -} diff --git a/components/svg/background/lib/events/events.json b/components/svg/background/lib/events/events.json deleted file mode 100644 index de277aa..0000000 --- a/components/svg/background/lib/events/events.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "width": "change", - "height": "change", - "autoRender": "change" -} diff --git a/components/svg/background/lib/events/index.js b/components/svg/background/lib/events/index.js deleted file mode 100644 index ef68b2b..0000000 --- a/components/svg/background/lib/events/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EVENTS = require( './events.json' ); - - -// MAIN // - -/** -* Provided a property, returns a corresponding event name for when a property value changes. -* -* @private -* @param {string} prop - property -* @returns {string} event name -*/ -function get( prop ) { - return EVENTS[ prop ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/background/lib/index.js b/components/svg/background/lib/index.js deleted file mode 100644 index 538b38a..0000000 --- a/components/svg/background/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Background. -* -* @module @stdlib/plot/components/svg/background -* -* @example -* var Background = require( '@stdlib/plot/components/svg/background' ); -* -* var bkgd = new Background({ -* 'width': 400, -* 'height': 400 -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/components/svg/background/lib/main.js b/components/svg/background/lib/main.js deleted file mode 100644 index 4f9050b..0000000 --- a/components/svg/background/lib/main.js +++ /dev/null @@ -1,233 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var copy = require( '@stdlib/utils/copy' ); -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var setWidth = require( './props/width/set.js' ); -var getWidth = require( './props/width/get.js' ); -var setHeight = require( './props/height/set.js' ); -var getHeight = require( './props/height/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var render = require( './methods/render.js' ); - - -// VARIABLES // - -var debug = logger( 'background:main' ); - - -// MAIN // - -/** -* Background constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {PositiveNumber} [options.width=400] - width -* @param {PositiveNumber} [options.height=400] - height -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Background} background instance -* -* @example -* var bkgd = new Background({ -* 'width': 500, -* 'height': 500 -* }); -*/ -function Background( options ) { - var self; - var opts; - var err; - if ( !( this instanceof Background ) ) { - return new Background( options ); - } - self = this; - opts = copy( defaults ); - err = validate( opts, options ); - if ( err ) { - throw err; - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - defineProperty( this, '_width', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.width - }); - defineProperty( this, '_height', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.height - }); - defineProperty( this, '_autoRender', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.autoRender - }); - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Background.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Background.prototype.constructor = Background; - -/** -* Width. -* -* @name width -* @memberof Background.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 -* -* @example -* var bkgd = new Background({ -* 'width': 500 -* }); -* -* var width = bkgd.width; -* // returns 500 -*/ -defineProperty( Background.prototype, 'width', { - 'configurable': false, - 'enumerable': true, - 'set': setWidth, - 'get': getWidth -}); - -/** -* Height. -* -* @name height -* @memberof Background.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 -* -* @example -* var bkgd = new Background({ -* 'height': 500 -* }); -* -* var height = bkgd.height; -* // returns 500 -*/ -defineProperty( Background.prototype, 'height', { - 'configurable': false, - 'enumerable': true, - 'set': setHeight, - 'get': getHeight -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Background.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var bkgd = new Background({ -* 'autoRender': true -* }); -* -* var mode = bkgd.autoRender; -* // returns true -*/ -defineProperty( Background.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Background.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var bkgd = new Background(); -* -* var out = bkgd.render(); -*/ -setReadOnly( Background.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Background; diff --git a/components/svg/background/lib/methods/render.js b/components/svg/background/lib/methods/render.js deleted file mode 100644 index c924b42..0000000 --- a/components/svg/background/lib/methods/render.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'background:render' ); -var ELEMENT = 'rect'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var props; - var vtree; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'className': 'background', - 'attributes': { - 'x': 0, - 'y': 0, - 'width': this.width, - 'height': this.height, - 'fill': 'none', - 'stroke': 'none' - } - }; - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, [] ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/background/lib/props/auto-render/get.js b/components/svg/background/lib/props/auto-render/get.js deleted file mode 100644 index 7df40de..0000000 --- a/components/svg/background/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/background/lib/props/auto-render/set.js b/components/svg/background/lib/props/auto-render/set.js deleted file mode 100644 index b1097de..0000000 --- a/components/svg/background/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/auto_render.js' ); - - -// VARIABLES // - -var debug = logger( 'background:set:auto-render' ); -var CHANGE_EVENT = events( 'autoRender' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - var err = isValid( bool ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/background/lib/props/height/get.js b/components/svg/background/lib/props/height/get.js deleted file mode 100644 index 64bcb89..0000000 --- a/components/svg/background/lib/props/height/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the height. -* -* @private -* @returns {number} height -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._height; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/background/lib/props/height/set.js b/components/svg/background/lib/props/height/set.js deleted file mode 100644 index ef83a99..0000000 --- a/components/svg/background/lib/props/height/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/height.js' ); - - -// VARIABLES // - -var debug = logger( 'background:set:height' ); -var CHANGE_EVENT = events( 'height' ); - - -// MAIN // - -/** -* Sets the height. -* -* @private -* @param {PositiveNumber} height - height -* @throws {TypeError} must be a positive number -*/ -function set( height ) { - /* eslint-disable no-invalid-this */ - var err = isValid( height ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._height ); - - this._height = height; - debug( 'New Value: %d.', this._height ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/background/lib/props/width/get.js b/components/svg/background/lib/props/width/get.js deleted file mode 100644 index cfa5f0e..0000000 --- a/components/svg/background/lib/props/width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the width. -* -* @private -* @returns {number} width -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._width; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/background/lib/props/width/set.js b/components/svg/background/lib/props/width/set.js deleted file mode 100644 index 17b6097..0000000 --- a/components/svg/background/lib/props/width/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/width.js' ); - - -// VARIABLES // - -var debug = logger( 'background:set:width' ); -var CHANGE_EVENT = events( 'width' ); - - -// MAIN // - -/** -* Sets the width. -* -* @private -* @param {PositiveNumber} width - width -* @throws {TypeError} must be a positive number -*/ -function set( width ) { - /* eslint-disable no-invalid-this */ - var err = isValid( width ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._width ); - - this._width = width; - debug( 'New value: %d.', this._width ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/background/lib/validate.js b/components/svg/background/lib/validate.js deleted file mode 100644 index 311756c..0000000 --- a/components/svg/background/lib/validate.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var objectKeys = require( '@stdlib/utils/keys' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); -var validators = require( './validators' ); - - -// VARIABLES // - -var KEYS = objectKeys( validators ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {PositiveNumber} [options.width] - width -* @param {PositiveNumber} [options.height] - height -* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event -* @returns {(Error|null)} error or null -* -* @example -* var opts = {}; -* var options = { -* 'width': 400, -* 'height': 400 -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var err; - var key; - var val; - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - for ( i = 0; i < KEYS.length; i++ ) { - key = KEYS[ i ]; - if ( hasOwnProp( options, key ) ) { - val = options[ key ]; - err = validators[ key ]( val ); - if ( err ) { - return err; - } - opts[ key ] = val; - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/components/svg/background/lib/validators/auto_render.js b/components/svg/background/lib/validators/auto_render.js deleted file mode 100644 index 08da79f..0000000 --- a/components/svg/background/lib/validators/auto_render.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `autoRender`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isBoolean( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/background/lib/validators/height.js b/components/svg/background/lib/validators/height.js deleted file mode 100644 index 82ea73c..0000000 --- a/components/svg/background/lib/validators/height.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `height`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isPositiveNumber( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'height', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/background/lib/validators/index.js b/components/svg/background/lib/validators/index.js deleted file mode 100644 index 9ab29fd..0000000 --- a/components/svg/background/lib/validators/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var width = require( './width.js' ); -var height = require( './height.js' ); -var autoRender = require( './auto_render.js' ); - - -// MAIN // - -var validators = { - 'width': width, - 'height': height, - 'autoRender': autoRender -}; - - -// EXPORTS // - -module.exports = validators; diff --git a/components/svg/background/lib/validators/width.js b/components/svg/background/lib/validators/width.js deleted file mode 100644 index e6d8f77..0000000 --- a/components/svg/background/lib/validators/width.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `width`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isPositiveNumber( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'width', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/background/package.json b/components/svg/background/package.json deleted file mode 100644 index 91e1169..0000000 --- a/components/svg/background/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/background", - "version": "0.0.0", - "description": "SVG background.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "background", - "bkgd", - "component" - ] -} diff --git a/components/svg/canvas/examples/index.js b/components/svg/canvas/examples/index.js deleted file mode 100644 index a95a9b9..0000000 --- a/components/svg/canvas/examples/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var canvas = require( './../lib' ); - -// Create a new canvas: -var node = canvas({ - 'width': 400, - 'height': 400, - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = node.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -node.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - node.width = 500; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/components/svg/canvas/lib/defaults.json b/components/svg/canvas/lib/defaults.json deleted file mode 100644 index 93a4318..0000000 --- a/components/svg/canvas/lib/defaults.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "width": 400, - "height": 400, - "autoRender": false -} diff --git a/components/svg/canvas/lib/events/events.json b/components/svg/canvas/lib/events/events.json deleted file mode 100644 index de277aa..0000000 --- a/components/svg/canvas/lib/events/events.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "width": "change", - "height": "change", - "autoRender": "change" -} diff --git a/components/svg/canvas/lib/events/index.js b/components/svg/canvas/lib/events/index.js deleted file mode 100644 index ef68b2b..0000000 --- a/components/svg/canvas/lib/events/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EVENTS = require( './events.json' ); - - -// MAIN // - -/** -* Provided a property, returns a corresponding event name for when a property value changes. -* -* @private -* @param {string} prop - property -* @returns {string} event name -*/ -function get( prop ) { - return EVENTS[ prop ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/canvas/lib/index.js b/components/svg/canvas/lib/index.js deleted file mode 100644 index 97a74a8..0000000 --- a/components/svg/canvas/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Canvas. -* -* @module @stdlib/plot/components/svg/canvas -* -* @example -* var Canvas = require( '@stdlib/plot/components/svg/canvas' ); -* -* var canvas = new Canvas({ -* 'width': 400, -* 'height': 400 -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/components/svg/canvas/lib/main.js b/components/svg/canvas/lib/main.js deleted file mode 100644 index bfee537..0000000 --- a/components/svg/canvas/lib/main.js +++ /dev/null @@ -1,233 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var copy = require( '@stdlib/utils/copy' ); -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var setWidth = require( './props/width/set.js' ); -var getWidth = require( './props/width/get.js' ); -var setHeight = require( './props/height/set.js' ); -var getHeight = require( './props/height/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var render = require( './methods/render.js' ); - - -// VARIABLES // - -var debug = logger( 'canvas:main' ); - - -// MAIN // - -/** -* Canvas constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {PositiveNumber} [options.width=400] - width -* @param {PositiveNumber} [options.height=400] - height -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Canvas} canvas instance -* -* @example -* var canvas = new Canvas({ -* 'width': 500, -* 'height': 500 -* }); -*/ -function Canvas( options ) { - var self; - var opts; - var err; - if ( !( this instanceof Canvas ) ) { - return new Canvas( options ); - } - self = this; - opts = copy( defaults ); - err = validate( opts, options ); - if ( err ) { - throw err; - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - defineProperty( this, '_width', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.width - }); - defineProperty( this, '_height', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.height - }); - defineProperty( this, '_autoRender', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.autoRender - }); - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Canvas.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Canvas.prototype.constructor = Canvas; - -/** -* Width. -* -* @name width -* @memberof Canvas.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 -* -* @example -* var canvas = new Canvas({ -* 'width': 500 -* }); -* -* var width = canvas.width; -* // returns 500 -*/ -defineProperty( Canvas.prototype, 'width', { - 'configurable': false, - 'enumerable': true, - 'set': setWidth, - 'get': getWidth -}); - -/** -* Height. -* -* @name height -* @memberof Canvas.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 -* -* @example -* var canvas = new Canvas({ -* 'height': 500 -* }); -* -* var height = canvas.height; -* // returns 500 -*/ -defineProperty( Canvas.prototype, 'height', { - 'configurable': false, - 'enumerable': true, - 'set': setHeight, - 'get': getHeight -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Canvas.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var canvas = new Canvas({ -* 'autoRender': true -* }); -* -* var mode = canvas.autoRender; -* // returns true -*/ -defineProperty( Canvas.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Canvas.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var canvas = new Canvas({}); -* -* var out = canvas.render(); -*/ -setReadOnly( Canvas.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Canvas; diff --git a/components/svg/canvas/lib/methods/render.js b/components/svg/canvas/lib/methods/render.js deleted file mode 100644 index f7ec884..0000000 --- a/components/svg/canvas/lib/methods/render.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'canvas:render' ); -var ELEMENT = 'svg'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var props; - var vtree; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'canvas', - 'className': 'canvas', - 'attributes': { - 'width': this.width, - 'height': this.height - } - }; - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, [] ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/canvas/lib/props/auto-render/get.js b/components/svg/canvas/lib/props/auto-render/get.js deleted file mode 100644 index 7df40de..0000000 --- a/components/svg/canvas/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/canvas/lib/props/auto-render/set.js b/components/svg/canvas/lib/props/auto-render/set.js deleted file mode 100644 index 2119176..0000000 --- a/components/svg/canvas/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/auto_render.js' ); - - -// VARIABLES // - -var debug = logger( 'canvas:set:auto-render' ); -var CHANGE_EVENT = events( 'autoRender' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - var err = isValid( bool ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/canvas/lib/props/height/get.js b/components/svg/canvas/lib/props/height/get.js deleted file mode 100644 index 64bcb89..0000000 --- a/components/svg/canvas/lib/props/height/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the height. -* -* @private -* @returns {number} height -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._height; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/canvas/lib/props/height/set.js b/components/svg/canvas/lib/props/height/set.js deleted file mode 100644 index 3fa9530..0000000 --- a/components/svg/canvas/lib/props/height/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/height.js' ); - - -// VARIABLES // - -var debug = logger( 'canvas:set:height' ); -var CHANGE_EVENT = events( 'height' ); - - -// MAIN // - -/** -* Sets the height. -* -* @private -* @param {PositiveNumber} height - height -* @throws {TypeError} must be a positive number -*/ -function set( height ) { - /* eslint-disable no-invalid-this */ - var err = isValid( height ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._height ); - - this._height = height; - debug( 'New Value: %d.', this._height ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/canvas/lib/props/width/get.js b/components/svg/canvas/lib/props/width/get.js deleted file mode 100644 index cfa5f0e..0000000 --- a/components/svg/canvas/lib/props/width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the width. -* -* @private -* @returns {number} width -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._width; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/canvas/lib/props/width/set.js b/components/svg/canvas/lib/props/width/set.js deleted file mode 100644 index 5fb581d..0000000 --- a/components/svg/canvas/lib/props/width/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/width.js' ); - - -// VARIABLES // - -var debug = logger( 'canvas:set:width' ); -var CHANGE_EVENT = events( 'width' ); - - -// MAIN // - -/** -* Sets the width. -* -* @private -* @param {PositiveNumber} width - width -* @throws {TypeError} must be a positive number -*/ -function set( width ) { - /* eslint-disable no-invalid-this */ - var err = isValid( width ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._width ); - - this._width = width; - debug( 'New value: %d.', this._width ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/canvas/lib/validate.js b/components/svg/canvas/lib/validate.js deleted file mode 100644 index 311756c..0000000 --- a/components/svg/canvas/lib/validate.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var objectKeys = require( '@stdlib/utils/keys' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); -var validators = require( './validators' ); - - -// VARIABLES // - -var KEYS = objectKeys( validators ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {PositiveNumber} [options.width] - width -* @param {PositiveNumber} [options.height] - height -* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event -* @returns {(Error|null)} error or null -* -* @example -* var opts = {}; -* var options = { -* 'width': 400, -* 'height': 400 -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var err; - var key; - var val; - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - for ( i = 0; i < KEYS.length; i++ ) { - key = KEYS[ i ]; - if ( hasOwnProp( options, key ) ) { - val = options[ key ]; - err = validators[ key ]( val ); - if ( err ) { - return err; - } - opts[ key ] = val; - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/components/svg/canvas/lib/validators/auto_render.js b/components/svg/canvas/lib/validators/auto_render.js deleted file mode 100644 index 08da79f..0000000 --- a/components/svg/canvas/lib/validators/auto_render.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `autoRender`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isBoolean( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/canvas/lib/validators/height.js b/components/svg/canvas/lib/validators/height.js deleted file mode 100644 index 82ea73c..0000000 --- a/components/svg/canvas/lib/validators/height.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `height`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isPositiveNumber( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'height', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/canvas/lib/validators/index.js b/components/svg/canvas/lib/validators/index.js deleted file mode 100644 index 9ab29fd..0000000 --- a/components/svg/canvas/lib/validators/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var width = require( './width.js' ); -var height = require( './height.js' ); -var autoRender = require( './auto_render.js' ); - - -// MAIN // - -var validators = { - 'width': width, - 'height': height, - 'autoRender': autoRender -}; - - -// EXPORTS // - -module.exports = validators; diff --git a/components/svg/canvas/lib/validators/width.js b/components/svg/canvas/lib/validators/width.js deleted file mode 100644 index e6d8f77..0000000 --- a/components/svg/canvas/lib/validators/width.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `width`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isPositiveNumber( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'width', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/canvas/package.json b/components/svg/canvas/package.json deleted file mode 100644 index a40cda1..0000000 --- a/components/svg/canvas/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/canvas", - "version": "0.0.0", - "description": "SVG canvas.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "canvas", - "component" - ] -} diff --git a/components/svg/clip-path/examples/index.js b/components/svg/clip-path/examples/index.js deleted file mode 100644 index 45fbc5c..0000000 --- a/components/svg/clip-path/examples/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var clipPath = require( './../lib' ); - -// Create a new clipPath: -var cp = clipPath({ - 'width': 400, - 'height': 400, - 'id': '1234', - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = cp.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -cp.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - cp.id = '4321'; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/components/svg/clip-path/lib/components/index.js b/components/svg/clip-path/lib/components/index.js deleted file mode 100644 index 8226c92..0000000 --- a/components/svg/clip-path/lib/components/index.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var rect = require( './rect.js' ); - - -// VARIABLES // - -var debug = logger( 'clippath:components:main' ); -var ELEMENT = 'clipPath'; - - -// MAIN // - -/** -* Renders a clipping path. -* -* @private -* @param {Object} ctx - context -* @returns {VTree} virtual tree -*/ -function render( ctx ) { - var children; - var props; - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'id': ctx.id - }; - - debug( 'Rendering clipping path rectangle...' ); - children = [ - rect( ctx ) - ]; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, children ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/clip-path/lib/components/rect.js b/components/svg/clip-path/lib/components/rect.js deleted file mode 100644 index e1387d8..0000000 --- a/components/svg/clip-path/lib/components/rect.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'clippath:components:rect' ); -var ELEMENT = 'rect'; - - -// MAIN // - -/** -* Renders a clipping path rectangle. -* -* @private -* @param {Object} ctx - context -* @returns {VTree} virtual tree -*/ -function render( ctx ) { - var props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'className': 'clipPath', - 'attributes': { - 'width': ctx.width, - 'height': ctx.height - } - }; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - - return h( ELEMENT, props, [] ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/clip-path/lib/defaults.json b/components/svg/clip-path/lib/defaults.json deleted file mode 100644 index 914f1d7..0000000 --- a/components/svg/clip-path/lib/defaults.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "width": 400, - "height": 400, - "id": "", - "autoRender": false -} diff --git a/components/svg/clip-path/lib/events/events.json b/components/svg/clip-path/lib/events/events.json deleted file mode 100644 index 8f7744c..0000000 --- a/components/svg/clip-path/lib/events/events.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "width": "change", - "height": "change", - "id": "change", - "autoRender": "change" -} diff --git a/components/svg/clip-path/lib/events/index.js b/components/svg/clip-path/lib/events/index.js deleted file mode 100644 index ef68b2b..0000000 --- a/components/svg/clip-path/lib/events/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EVENTS = require( './events.json' ); - - -// MAIN // - -/** -* Provided a property, returns a corresponding event name for when a property value changes. -* -* @private -* @param {string} prop - property -* @returns {string} event name -*/ -function get( prop ) { - return EVENTS[ prop ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/clip-path/lib/index.js b/components/svg/clip-path/lib/index.js deleted file mode 100644 index 8be487e..0000000 --- a/components/svg/clip-path/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Clipping path. -* -* @module @stdlib/plot/components/svg/clip-path -* -* @example -* var ClipPath = require( '@stdlib/plot/components/svg/clip-path' ); -* -* var clipPath = new ClipPath({ -* 'width': 400, -* 'height': 400 -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/components/svg/clip-path/lib/main.js b/components/svg/clip-path/lib/main.js deleted file mode 100644 index 3ed0032..0000000 --- a/components/svg/clip-path/lib/main.js +++ /dev/null @@ -1,265 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var minstd = require( '@stdlib/random/base/minstd' ); -var copy = require( '@stdlib/utils/copy' ); -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var setWidth = require( './props/width/set.js' ); -var getWidth = require( './props/width/get.js' ); -var setHeight = require( './props/height/set.js' ); -var getHeight = require( './props/height/get.js' ); -var setID = require( './props/id/set.js' ); -var getID = require( './props/id/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var render = require( './methods/render.js' ); - - -// VARIABLES // - -var debug = logger( 'clippath:main' ); - - -// MAIN // - -/** -* Clipping path constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {PositiveNumber} [options.width=400] - width -* @param {PositiveNumber} [options.height=400] - height -* @param {string} [options.id] - clipping path id -* @param {boolean} [options.autoRender=true] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {ClipPath} clipping path instance -* -* @example -* var clipPath = new ClipPath({ -* 'width': 500, -* 'height': 500 -* }); -*/ -function ClipPath( options ) { - var self; - var opts; - var err; - if ( !( this instanceof ClipPath ) ) { - return new ClipPath( options ); - } - self = this; - opts = copy( defaults ); - err = validate( opts, options ); - if ( err ) { - throw err; - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - defineProperty( this, '_width', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.width - }); - defineProperty( this, '_height', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.height - }); - defineProperty( this, '_id', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.id || minstd().toString() // TODO: uuid - }); - defineProperty( this, '_autoRender', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.autoRender - }); - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = [ 'render' ]; - for ( i = 0; i < arguments.length; i++ ) { - args.push( arguments[ i ] ); - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -ClipPath.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -ClipPath.prototype.constructor = ClipPath; - -/** -* Width. -* -* @name width -* @memberof ClipPath.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 -* -* @example -* var clipPath = new ClipPath({ -* 'width': 500 -* }); -* -* var width = clipPath.width; -* // returns 500 -*/ -defineProperty( ClipPath.prototype, 'width', { - 'configurable': false, - 'enumerable': true, - 'set': setWidth, - 'get': getWidth -}); - -/** -* Height. -* -* @name height -* @memberof ClipPath.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 -* -* @example -* var clipPath = new ClipPath({ -* 'height': 500 -* }); -* -* var height = clipPath.height; -* // returns 500 -*/ -defineProperty( ClipPath.prototype, 'height', { - 'configurable': false, - 'enumerable': true, - 'set': setHeight, - 'get': getHeight -}); - -/** -* Clipping path id. -* -* @name id -* @memberof ClipPath.prototype -* @type {string} -* @throws {TypeError} must be a string -* -* @example -* var clipPath = new ClipPath({ -* 'id': '1234' -* }); -* -* var id = clipPath.id; -* // returns '1234' -*/ -defineProperty( ClipPath.prototype, 'id', { - 'configurable': false, - 'enumerable': true, - 'set': setID, - 'get': getID -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof ClipPath.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var clipPath = new ClipPath({ -* 'autoRender': true -* }); -* -* var mode = clipPath.autoRender; -* // returns true -*/ -defineProperty( ClipPath.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof ClipPath.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var clipPath = new ClipPath(); -* -* var out = clipPath.render(); -*/ -setReadOnly( ClipPath.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = ClipPath; diff --git a/components/svg/clip-path/lib/methods/render.js b/components/svg/clip-path/lib/methods/render.js deleted file mode 100644 index b130497..0000000 --- a/components/svg/clip-path/lib/methods/render.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var components = require( './../components' ); - - -// VARIABLES // - -var debug = logger( 'clippath:render' ); - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var vtree; - - debug( 'Rendering...' ); - vtree = components( this ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/clip-path/lib/props/auto-render/get.js b/components/svg/clip-path/lib/props/auto-render/get.js deleted file mode 100644 index 7df40de..0000000 --- a/components/svg/clip-path/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/clip-path/lib/props/auto-render/set.js b/components/svg/clip-path/lib/props/auto-render/set.js deleted file mode 100644 index b2c961c..0000000 --- a/components/svg/clip-path/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/auto_render.js' ); - - -// VARIABLES // - -var debug = logger( 'clip-path:set:auto-render' ); -var CHANGE_EVENT = events( 'autoRender' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - var err = isValid( bool ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/clip-path/lib/props/height/get.js b/components/svg/clip-path/lib/props/height/get.js deleted file mode 100644 index 64bcb89..0000000 --- a/components/svg/clip-path/lib/props/height/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the height. -* -* @private -* @returns {number} height -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._height; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/clip-path/lib/props/height/set.js b/components/svg/clip-path/lib/props/height/set.js deleted file mode 100644 index b937313..0000000 --- a/components/svg/clip-path/lib/props/height/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/height.js' ); - - -// VARIABLES // - -var debug = logger( 'clippath:set:height' ); -var CHANGE_EVENT = events( 'height' ); - - -// MAIN // - -/** -* Sets the height. -* -* @private -* @param {PositiveNumber} height - height -* @throws {TypeError} must be a positive number -*/ -function set( height ) { - /* eslint-disable no-invalid-this */ - var err = isValid( height ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._height ); - - this._height = height; - debug( 'New Value: %d.', this._height ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/clip-path/lib/props/id/get.js b/components/svg/clip-path/lib/props/id/get.js deleted file mode 100644 index 1e2aebe..0000000 --- a/components/svg/clip-path/lib/props/id/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the clipping path id. -* -* @private -* @returns {string} id -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._id; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/clip-path/lib/props/id/set.js b/components/svg/clip-path/lib/props/id/set.js deleted file mode 100644 index f85eb4e..0000000 --- a/components/svg/clip-path/lib/props/id/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/id.js' ); - - -// VARIABLES // - -var debug = logger( 'clippath:set:id' ); -var CHANGE_EVENT = events( 'id' ); - - -// MAIN // - -/** -* Sets the clipping path id. -* -* @private -* @param {string} id - id -* @throws {TypeError} must be a string -*/ -function set( id ) { - /* eslint-disable no-invalid-this */ - var err = isValid( id ); - if ( err ) { - throw err; - } - debug( 'Current value: %s.', this._id ); - - this._id = id; - debug( 'New value: %s.', this._id ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/clip-path/lib/props/width/get.js b/components/svg/clip-path/lib/props/width/get.js deleted file mode 100644 index cfa5f0e..0000000 --- a/components/svg/clip-path/lib/props/width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the width. -* -* @private -* @returns {number} width -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._width; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/clip-path/lib/props/width/set.js b/components/svg/clip-path/lib/props/width/set.js deleted file mode 100644 index b0f3a0b..0000000 --- a/components/svg/clip-path/lib/props/width/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/width.js' ); - - -// VARIABLES // - -var debug = logger( 'clippath:set:width' ); -var CHANGE_EVENT = events( 'width' ); - - -// MAIN // - -/** -* Sets the width. -* -* @private -* @param {PositiveNumber} width - width -* @throws {TypeError} must be a positive number -*/ -function set( width ) { - /* eslint-disable no-invalid-this */ - var err = isValid( width ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._width ); - - this._width = width; - debug( 'New value: %d.', this._width ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/clip-path/lib/validate.js b/components/svg/clip-path/lib/validate.js deleted file mode 100644 index 32a4a2d..0000000 --- a/components/svg/clip-path/lib/validate.js +++ /dev/null @@ -1,85 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var objectKeys = require( '@stdlib/utils/keys' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); -var validators = require( './validators' ); - - -// VARIABLES // - -var KEYS = objectKeys( validators ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {PositiveNumber} [options.width] - width -* @param {PositiveNumber} [options.height] - height -* @param {string} [options.id] - clipping path id -* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event -* @returns {(Error|null)} error or null -* -* @example -* var opts = {}; -* var options = { -* 'width': 400, -* 'height': 400 -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var err; - var key; - var val; - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - for ( i = 0; i < KEYS.length; i++ ) { - key = KEYS[ i ]; - if ( hasOwnProp( options, key ) ) { - val = options[ key ]; - err = validators[ key ]( val ); - if ( err ) { - return err; - } - opts[ key ] = val; - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/components/svg/clip-path/lib/validators/auto_render.js b/components/svg/clip-path/lib/validators/auto_render.js deleted file mode 100644 index 08da79f..0000000 --- a/components/svg/clip-path/lib/validators/auto_render.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `autoRender`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isBoolean( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/clip-path/lib/validators/height.js b/components/svg/clip-path/lib/validators/height.js deleted file mode 100644 index 82ea73c..0000000 --- a/components/svg/clip-path/lib/validators/height.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `height`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isPositiveNumber( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'height', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/clip-path/lib/validators/id.js b/components/svg/clip-path/lib/validators/id.js deleted file mode 100644 index 3e14d12..0000000 --- a/components/svg/clip-path/lib/validators/id.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `id`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isString( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'id', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/clip-path/lib/validators/index.js b/components/svg/clip-path/lib/validators/index.js deleted file mode 100644 index b7f5514..0000000 --- a/components/svg/clip-path/lib/validators/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var width = require( './width.js' ); -var height = require( './height.js' ); -var id = require( './id.js' ); -var autoRender = require( './auto_render.js' ); - - -// MAIN // - -var validators = { - 'width': width, - 'height': height, - 'id': id, - 'autoRender': autoRender -}; - - -// EXPORTS // - -module.exports = validators; diff --git a/components/svg/clip-path/lib/validators/width.js b/components/svg/clip-path/lib/validators/width.js deleted file mode 100644 index e6d8f77..0000000 --- a/components/svg/clip-path/lib/validators/width.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `width`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isPositiveNumber( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'width', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/clip-path/package.json b/components/svg/clip-path/package.json deleted file mode 100644 index 193e75a..0000000 --- a/components/svg/clip-path/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/clip-path", - "version": "0.0.0", - "description": "SVG clipping path.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "clippath", - "clip-path", - "clipping", - "clip", - "path", - "mask", - "component" - ] -} diff --git a/components/svg/defs/README.md b/components/svg/defs/README.md deleted file mode 100644 index 10e8f5c..0000000 --- a/components/svg/defs/README.md +++ /dev/null @@ -1,193 +0,0 @@ - - -# Definitions - -> [SVG][svg] plot definitions. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var Defs = require( '@stdlib/plot/components/svg/defs' ); -``` - -#### Defs() - -Returns a `Defs` instance. - -```javascript -var node = new Defs(); -// returns -``` - -* * * - -### Methods - - - -#### Defs.prototype.render() - -Renders an instance as a [virtual DOM tree][virtual-dom]. - -```javascript -var node = new Defs(); - -var vtree = node.render(); -/* e.g., returns - { - 'tagName': 'defs', - 'properties': { - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } -*/ -``` - -* * * - -### Events - - - -#### 'render' - -Event emitted when an instance renders. The event object is the rendered [Virtual DOM tree][virtual-dom]. - -```javascript -var node = new Defs(); - -function onRender( vtree ) { - console.log( vtree ); -} - -node.on( 'render', onRender ); -node.render(); -``` - -* * * - -### Listeners - - - -#### 'change' - -Upon receiving a `'change'` event, an instance re-renders. - -```javascript -var node = new Defs(); - -function onRender( vtree ) { - console.log( vtree ); -} - -node.on( 'render', onRender ); -node.emit( 'change' ); -``` - -
- - - - - -
- -
- - - - - -* * * - -
- -## Examples - - - -```javascript -var toHTML = require( 'vdom-to-html' ); -var defs = require( '@stdlib/plot/components/svg/defs' ); - -// Create a new component: -var node = defs(); - -// Render as a virtual DOM tree: -var vtree = node.render(); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -// returns -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/components/svg/defs/benchmark/benchmark.js b/components/svg/defs/benchmark/benchmark.js deleted file mode 100644 index 171d46c..0000000 --- a/components/svg/defs/benchmark/benchmark.js +++ /dev/null @@ -1,90 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pkg = require( './../package.json' ).name; -var Defs = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::instantiation', function benchmark( b ) { - var node; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node = new Defs(); - if ( !( node instanceof Defs ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( node instanceof Defs ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,no_new', function benchmark( b ) { - var ctor; - var node; - var i; - - ctor = Defs; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node = ctor(); - if ( !( node instanceof Defs ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( node instanceof Defs ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':render', function benchmark( b ) { - var vtree; - var node; - var i; - - node = new Defs(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - vtree = node.render(); - if ( typeof vtree !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof vtree !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/components/svg/defs/examples/index.js b/components/svg/defs/examples/index.js deleted file mode 100644 index af533f0..0000000 --- a/components/svg/defs/examples/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var defs = require( './../lib' ); - -// Create a new definitions component: -var node = defs(); - -// Render as a virtual DOM tree: -var vtree = node.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); -// => diff --git a/components/svg/defs/lib/index.js b/components/svg/defs/lib/index.js deleted file mode 100644 index 90a888f..0000000 --- a/components/svg/defs/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* SVG plot definitions. -* -* @module @stdlib/plot/components/svg/defs -* -* @example -* var Defs = require( '@stdlib/plot/components/svg/defs' ); -* -* var node = new Defs(); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/components/svg/defs/lib/main.js b/components/svg/defs/lib/main.js deleted file mode 100644 index 0d29175..0000000 --- a/components/svg/defs/lib/main.js +++ /dev/null @@ -1,112 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var inherit = require( '@stdlib/utils/inherit' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var render = require( './render.js' ); - - -// VARIABLES // - -var debug = logger( 'defs:main' ); - - -// MAIN // - -/** -* SVG definitions constructor. -* -* @constructor -* @returns {Defs} definitions instance -* -* @example -* var node = new Defs(); -* // returns -*/ -function Defs() { - var self; - if ( !instanceOf( this, Defs ) ) { - return new Defs(); - } - self = this; - debug( 'Creating an instance...' ); - EventEmitter.call( this ); - this.on( 'change', onChange ); - this.on( '_render', onRender ); - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - self.render(); - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Inherit from the `EventEmitter` prototype. -*/ -inherit( Defs, EventEmitter ); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Defs.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var node = new Defs(); -* -* var out = node.render(); -* // returns -*/ -setReadOnly( Defs.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Defs; diff --git a/components/svg/defs/lib/render.js b/components/svg/defs/lib/render.js deleted file mode 100644 index c64af49..0000000 --- a/components/svg/defs/lib/render.js +++ /dev/null @@ -1,64 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'defs:render' ); -var ELEMENT = 'defs'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var vtree; - var props; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg' - }; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, [] ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/defs/package.json b/components/svg/defs/package.json deleted file mode 100644 index 9159edd..0000000 --- a/components/svg/defs/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/defs", - "version": "0.0.0", - "description": "SVG plot definitions.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "defs", - "definitions", - "component", - "virtual", - "dom", - "vdom", - "virtual-dom" - ] -} diff --git a/components/svg/defs/test/fixtures/vtree.js b/components/svg/defs/test/fixtures/vtree.js deleted file mode 100644 index 220d8d6..0000000 --- a/components/svg/defs/test/fixtures/vtree.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'defs', - 'properties': { - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/defs/test/test.js b/components/svg/defs/test/test.js deleted file mode 100644 index cc1df9e..0000000 --- a/components/svg/defs/test/test.js +++ /dev/null @@ -1,86 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var tape = require( 'tape' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var Defs = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Defs, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function is a constructor', function test( t ) { - var node = new Defs(); - t.strictEqual( instanceOf( node, Defs ), true, 'is an instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` operator', function test( t ) { - var ctor; - var node; - - ctor = Defs; - node = ctor(); - - t.strictEqual( instanceOf( node, Defs ), true, 'is an instance' ); - t.end(); -}); - -tape( 'the constructor returns an event emitter', function test( t ) { - var node = new Defs(); - t.strictEqual( instanceOf( node, EventEmitter ), true, 'is an event emitter' ); - t.end(); -}); - -tape( 'when a returned instance receives a `change` event, it re-renders and emits a `render` event', function test( t ) { - var node = new Defs(); - node.on( 'render', onRender ); - node.emit( 'change' ); - - function onRender( obj ) { - t.ok( true, 'emits a render event' ); - t.deepEqual( obj, VTREE, 'provides virtual tree' ); - t.end(); - } -}); - -tape( 'the `render` method returns a rendered virtual tree', function test( t ) { - var vtree; - var node; - - node = new Defs(); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'returns a virtual tree' ); - t.end(); -}); diff --git a/components/svg/graph/examples/index.js b/components/svg/graph/examples/index.js deleted file mode 100644 index 616e8c0..0000000 --- a/components/svg/graph/examples/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var graph = require( './../lib' ); - -// Create a new graph component: -var node = graph({ - 'translateX': 90, - 'translateY': 20, - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = node.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -node.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - node.translateX = 80; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/components/svg/graph/lib/defaults.json b/components/svg/graph/lib/defaults.json deleted file mode 100644 index 983fe36..0000000 --- a/components/svg/graph/lib/defaults.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "translateX": 0, - "translateY": 0, - "autoRender": false -} diff --git a/components/svg/graph/lib/events/events.json b/components/svg/graph/lib/events/events.json deleted file mode 100644 index 54b6080..0000000 --- a/components/svg/graph/lib/events/events.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "translateX": "change", - "translateY": "change", - "autoRender": "change" -} diff --git a/components/svg/graph/lib/events/index.js b/components/svg/graph/lib/events/index.js deleted file mode 100644 index ef68b2b..0000000 --- a/components/svg/graph/lib/events/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EVENTS = require( './events.json' ); - - -// MAIN // - -/** -* Provided a property, returns a corresponding event name for when a property value changes. -* -* @private -* @param {string} prop - property -* @returns {string} event name -*/ -function get( prop ) { - return EVENTS[ prop ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/graph/lib/index.js b/components/svg/graph/lib/index.js deleted file mode 100644 index a5e342a..0000000 --- a/components/svg/graph/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Graph component. -* -* @module @stdlib/plot/components/svg/graph -* -* @example -* var Graph = require( '@stdlib/plot/components/svg/graph' ); -* -* var graph = new Graph({ -* 'translateX': 90, -* 'translateY': 20 -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/components/svg/graph/lib/main.js b/components/svg/graph/lib/main.js deleted file mode 100644 index 7897874..0000000 --- a/components/svg/graph/lib/main.js +++ /dev/null @@ -1,233 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var copy = require( '@stdlib/utils/copy' ); -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var setTranslateX = require( './props/translate-x/set.js' ); -var getTranslateX = require( './props/translate-x/get.js' ); -var setTranslateY = require( './props/translate-y/set.js' ); -var getTranslateY = require( './props/translate-y/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var render = require( './methods/render.js' ); - - -// VARIABLES // - -var debug = logger( 'graph:main' ); - - -// MAIN // - -/** -* Graph constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {NonNegativeInteger} [options.translateX=0] - horizontal translation -* @param {NonNegativeInteger} [options.translateY=0] - vertical translation -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Graph} graph instance -* -* @example -* var graph = new Graph({ -* 'translateX': 90, -* 'translateY': 20 -* }); -*/ -function Graph( options ) { - var self; - var opts; - var err; - if ( !( this instanceof Graph ) ) { - return new Graph( options ); - } - self = this; - opts = copy( defaults ); - err = validate( opts, options ); - if ( err ) { - throw err; - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - defineProperty( this, '_translateX', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.translateX - }); - defineProperty( this, '_translateY', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.translateY - }); - defineProperty( this, '_autoRender', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.autoRender - }); - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Graph.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Graph.prototype.constructor = Graph; - -/** -* Horizontal translation. -* -* @name translateX -* @memberof Graph.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 0 -* -* @example -* var graph = new Graph({ -* 'translateX': 90 -* }); -* -* var v = graph.translateX; -* // returns 90 -*/ -defineProperty( Graph.prototype, 'translateX', { - 'configurable': false, - 'enumerable': true, - 'set': setTranslateX, - 'get': getTranslateX -}); - -/** -* Vertical translation. -* -* @name translateY -* @memberof Graph.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 0 -* -* @example -* var graph = new Graph({ -* 'translateY': 20 -* }); -* -* var v = graph.translateY; -* // returns 20 -*/ -defineProperty( Graph.prototype, 'translateY', { - 'configurable': false, - 'enumerable': true, - 'set': setTranslateY, - 'get': getTranslateY -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Graph.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var graph = new Graph({ -* 'autoRender': true -* }); -* -* var mode = graph.autoRender; -* // returns true -*/ -defineProperty( Graph.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Graph.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var graph = new Graph(); -* -* var out = graph.render(); -*/ -setReadOnly( Graph.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Graph; diff --git a/components/svg/graph/lib/methods/render.js b/components/svg/graph/lib/methods/render.js deleted file mode 100644 index fcd76b3..0000000 --- a/components/svg/graph/lib/methods/render.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'graph:render' ); -var ELEMENT = 'g'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var props; - var vtree; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'graph', - 'className': 'graph', - 'attributes': { - 'transform': 'translate('+this.translateX+','+this.translateY+')' - } - }; - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, [] ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/graph/lib/props/auto-render/get.js b/components/svg/graph/lib/props/auto-render/get.js deleted file mode 100644 index 7df40de..0000000 --- a/components/svg/graph/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/graph/lib/props/auto-render/set.js b/components/svg/graph/lib/props/auto-render/set.js deleted file mode 100644 index 2119176..0000000 --- a/components/svg/graph/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/auto_render.js' ); - - -// VARIABLES // - -var debug = logger( 'canvas:set:auto-render' ); -var CHANGE_EVENT = events( 'autoRender' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - var err = isValid( bool ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/graph/lib/props/translate-x/get.js b/components/svg/graph/lib/props/translate-x/get.js deleted file mode 100644 index ef5e55c..0000000 --- a/components/svg/graph/lib/props/translate-x/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the horizontal translation. -* -* @private -* @returns {NonNegativeInteger} translation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._translateX; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/graph/lib/props/translate-x/set.js b/components/svg/graph/lib/props/translate-x/set.js deleted file mode 100644 index 49fe20f..0000000 --- a/components/svg/graph/lib/props/translate-x/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/translate_x.js' ); - - -// VARIABLES // - -var debug = logger( 'graph:set:translate-x' ); -var CHANGE_EVENT = events( 'translateX' ); - - -// MAIN // - -/** -* Sets the horizontal translation. -* -* @private -* @param {NonNegativeInteger} v - translation -* @throws {TypeError} must be a nonnegative integer -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var err = isValid( v ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._translateX ); - - this._translateX = v; - debug( 'New Value: %d.', this._translateX ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/graph/lib/props/translate-y/get.js b/components/svg/graph/lib/props/translate-y/get.js deleted file mode 100644 index 5572719..0000000 --- a/components/svg/graph/lib/props/translate-y/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the vertical translation. -* -* @private -* @returns {NonNegativeInteger} translation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._translateY; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/graph/lib/props/translate-y/set.js b/components/svg/graph/lib/props/translate-y/set.js deleted file mode 100644 index e4ce28f..0000000 --- a/components/svg/graph/lib/props/translate-y/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/translate_y.js' ); - - -// VARIABLES // - -var debug = logger( 'graph:set:translate-y' ); -var CHANGE_EVENT = events( 'translateY' ); - - -// MAIN // - -/** -* Sets the vertical translation. -* -* @private -* @param {NonNegativeInteger} v - translation -* @throws {TypeError} must be a nonnegative integer -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var err = isValid( v ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._translateY ); - - this._translateY = v; - debug( 'New Value: %d.', this._translateY ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/graph/lib/validate.js b/components/svg/graph/lib/validate.js deleted file mode 100644 index 97725e3..0000000 --- a/components/svg/graph/lib/validate.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var objectKeys = require( '@stdlib/utils/keys' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); -var validators = require( './validators' ); - - -// VARIABLES // - -var KEYS = objectKeys( validators ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {NonNegativeInteger} [options.translateX] - horizontal translation -* @param {NonNegativeInteger} [options.translateY] - vertical translation -* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event -* @returns {(Error|null)} error or null -* -* @example -* var opts = {}; -* var options = { -* 'translateX': 90, -* 'translateY': 20 -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var err; - var key; - var val; - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - for ( i = 0; i < KEYS.length; i++ ) { - key = KEYS[ i ]; - if ( hasOwnProp( options, key ) ) { - val = options[ key ]; - err = validators[ key ]( val ); - if ( err ) { - return err; - } - opts[ key ] = val; - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/components/svg/graph/lib/validators/auto_render.js b/components/svg/graph/lib/validators/auto_render.js deleted file mode 100644 index 08da79f..0000000 --- a/components/svg/graph/lib/validators/auto_render.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `autoRender`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isBoolean( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/graph/lib/validators/index.js b/components/svg/graph/lib/validators/index.js deleted file mode 100644 index 80a856d..0000000 --- a/components/svg/graph/lib/validators/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var translateX = require( './translate_x.js' ); -var translateY = require( './translate_y.js' ); -var autoRender = require( './auto_render.js' ); - - -// MAIN // - -var validators = { - 'translateX': translateX, - 'translateY': translateY, - 'autoRender': autoRender -}; - - -// EXPORTS // - -module.exports = validators; diff --git a/components/svg/graph/lib/validators/translate_x.js b/components/svg/graph/lib/validators/translate_x.js deleted file mode 100644 index 9d9c2b9..0000000 --- a/components/svg/graph/lib/validators/translate_x.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `translateX`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isNonNegativeInteger( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'translateX', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/graph/lib/validators/translate_y.js b/components/svg/graph/lib/validators/translate_y.js deleted file mode 100644 index 523ec57..0000000 --- a/components/svg/graph/lib/validators/translate_y.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `translateY`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isNonNegativeInteger( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'translateY', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/graph/package.json b/components/svg/graph/package.json deleted file mode 100644 index 935a04e..0000000 --- a/components/svg/graph/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/graph", - "version": "0.0.0", - "description": "Graph component.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "component" - ] -} diff --git a/components/svg/marks/examples/index.js b/components/svg/marks/examples/index.js deleted file mode 100644 index 38e827b..0000000 --- a/components/svg/marks/examples/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var marks = require( './../lib' ); - -// Create a new component: -var node = marks({ - 'clipPathId': '1234', - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = node.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -node.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - node.clipPathId = '4321'; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/components/svg/marks/lib/defaults.json b/components/svg/marks/lib/defaults.json deleted file mode 100644 index f77788e..0000000 --- a/components/svg/marks/lib/defaults.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "clipPathId": "", - "autoRender": false -} diff --git a/components/svg/marks/lib/events/events.json b/components/svg/marks/lib/events/events.json deleted file mode 100644 index 3496bcb..0000000 --- a/components/svg/marks/lib/events/events.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "clipPathId": "change", - "autoRender": "change" -} diff --git a/components/svg/marks/lib/events/index.js b/components/svg/marks/lib/events/index.js deleted file mode 100644 index ef68b2b..0000000 --- a/components/svg/marks/lib/events/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EVENTS = require( './events.json' ); - - -// MAIN // - -/** -* Provided a property, returns a corresponding event name for when a property value changes. -* -* @private -* @param {string} prop - property -* @returns {string} event name -*/ -function get( prop ) { - return EVENTS[ prop ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/marks/lib/index.js b/components/svg/marks/lib/index.js deleted file mode 100644 index cb30562..0000000 --- a/components/svg/marks/lib/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Marks. -* -* @module @stdlib/plot/components/svg/marks -* -* @example -* var Marks = require( '@stdlib/plot/components/svg/marks' ); -* -* var marks = new Marks({ -* 'clipPathId': '1234' -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/components/svg/marks/lib/main.js b/components/svg/marks/lib/main.js deleted file mode 100644 index 226431a..0000000 --- a/components/svg/marks/lib/main.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var copy = require( '@stdlib/utils/copy' ); -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var setClipPathId = require( './props/clip-path-id/set.js' ); -var getClipPathId = require( './props/clip-path-id/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var render = require( './methods/render.js' ); - - -// VARIABLES // - -var debug = logger( 'marks:main' ); - - -// MAIN // - -/** -* Marks constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {string} [options.clipPathId] - clipping path id -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Marks} marks instance -* -* @example -* var marks = new Marks({ -* 'clipPathId': '1234' -* }); -*/ -function Marks( options ) { - var self; - var opts; - var err; - if ( !( this instanceof Marks ) ) { - return new Marks( options ); - } - self = this; - opts = copy( defaults ); - err = validate( opts, options ); - if ( err ) { - throw err; - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - defineProperty( this, '_clipPathId', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.clipPathId - }); - defineProperty( this, '_autoRender', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.autoRender - }); - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = []; - args.push( 'render' ); - for ( i = 0; i < arguments.length; i++ ) { - args.push( arguments[ i ] ); - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Marks.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Marks.prototype.constructor = Marks; - -/** -* Clipping path id. -* -* @name clipPathId -* @memberof Marks.prototype -* @type {string} -* @throws {TypeError} must be a string -* -* @example -* var marks = new Marks({ -* 'clipPathId': '1234' -* }); -* -* var id = marks.clipPathId; -* // returns '1234' -*/ -defineProperty( Marks.prototype, 'clipPathId', { - 'configurable': false, - 'enumerable': true, - 'set': setClipPathId, - 'get': getClipPathId -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Marks.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var marks = new Marks({ -* 'autoRender': true -* }); -* -* var mode = marks.autoRender; -* // returns true -*/ -defineProperty( Marks.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Marks.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var marks = new Marks(); -* -* var out = marks.render(); -*/ -setReadOnly( Marks.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Marks; diff --git a/components/svg/marks/lib/methods/render.js b/components/svg/marks/lib/methods/render.js deleted file mode 100644 index fb5a1f5..0000000 --- a/components/svg/marks/lib/methods/render.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'marks:render' ); -var ELEMENT = 'g'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var props; - var vtree; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'marks', - 'className': 'marks', - 'attributes': { - 'clip-path': 'url(#'+this._clipPathId+')' - } - }; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, [] ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/marks/lib/props/auto-render/get.js b/components/svg/marks/lib/props/auto-render/get.js deleted file mode 100644 index 7df40de..0000000 --- a/components/svg/marks/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/marks/lib/props/auto-render/set.js b/components/svg/marks/lib/props/auto-render/set.js deleted file mode 100644 index 5fd14f6..0000000 --- a/components/svg/marks/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/auto_render.js' ); - - -// VARIABLES // - -var debug = logger( 'marks:set:auto-render' ); -var CHANGE_EVENT = events( 'autoRender' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - var err = isValid( bool ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/marks/lib/props/clip-path-id/get.js b/components/svg/marks/lib/props/clip-path-id/get.js deleted file mode 100644 index ff6c1a9..0000000 --- a/components/svg/marks/lib/props/clip-path-id/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the clipping path id. -* -* @private -* @returns {string} id -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._clipPathId; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/marks/lib/props/clip-path-id/set.js b/components/svg/marks/lib/props/clip-path-id/set.js deleted file mode 100644 index f0677e3..0000000 --- a/components/svg/marks/lib/props/clip-path-id/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/clip_path_id.js' ); - - -// VARIABLES // - -var debug = logger( 'marks:set:clip-path-id' ); -var CHANGE_EVENT = events( 'clipPathId' ); - - -// MAIN // - -/** -* Sets the clipping path id. -* -* @private -* @param {string} id - clipping path id -* @throws {TypeError} must be a string -*/ -function set( id ) { - /* eslint-disable no-invalid-this */ - var err = isValid( id ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._clipPathId ); - - this._clipPathId = id; - debug( 'New Value: %d.', this._clipPathId ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/marks/lib/validate.js b/components/svg/marks/lib/validate.js deleted file mode 100644 index 1b5e996..0000000 --- a/components/svg/marks/lib/validate.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var objectKeys = require( '@stdlib/utils/keys' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); -var validators = require( './validators' ); - - -// VARIABLES // - -var KEYS = objectKeys( validators ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {string} [options.clipPathId] - clipping path id -* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event -* @returns {(Error|null)} error or null -* -* @example -* var opts = {}; -* var options = { -* 'clipPathId': '1234' -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var err; - var key; - var val; - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - for ( i = 0; i < KEYS.length; i++ ) { - key = KEYS[ i ]; - if ( hasOwnProp( options, key ) ) { - val = options[ key ]; - err = validators[ key ]( val ); - if ( err ) { - return err; - } - opts[ key ] = val; - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/components/svg/marks/lib/validators/auto_render.js b/components/svg/marks/lib/validators/auto_render.js deleted file mode 100644 index 08da79f..0000000 --- a/components/svg/marks/lib/validators/auto_render.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `autoRender`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isBoolean( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/marks/lib/validators/clip_path_id.js b/components/svg/marks/lib/validators/clip_path_id.js deleted file mode 100644 index ec90d10..0000000 --- a/components/svg/marks/lib/validators/clip_path_id.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `clipPathId`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isString( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'clipPathId', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/marks/lib/validators/index.js b/components/svg/marks/lib/validators/index.js deleted file mode 100644 index c3bab2a..0000000 --- a/components/svg/marks/lib/validators/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var clipPathId = require( './clip_path_id.js' ); -var autoRender = require( './auto_render.js' ); - - -// MAIN // - -var validators = { - 'clipPathId': clipPathId, - 'autoRender': autoRender -}; - - -// EXPORTS // - -module.exports = validators; diff --git a/components/svg/marks/package.json b/components/svg/marks/package.json deleted file mode 100644 index 2222359..0000000 --- a/components/svg/marks/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/marks", - "version": "0.0.0", - "description": "Marks.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "marks", - "component" - ] -} diff --git a/components/svg/path/examples/index.js b/components/svg/path/examples/index.js deleted file mode 100644 index b68ee2d..0000000 --- a/components/svg/path/examples/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var path = require( './../lib' ); - -// Create a new path: -var node = path({ - 'x': [0.10, 0.50, 0.90], - 'y': [0.43, 0.37, 0.53], - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = node.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -node.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - node.y = [0.99, 0.87, 0.92]; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/components/svg/path/lib/accessors/is_defined.js b/components/svg/path/lib/accessors/is_defined.js deleted file mode 100644 index fe50ce4..0000000 --- a/components/svg/path/lib/accessors/is_defined.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isnan = require( '@stdlib/assert/is-nan' ).isPrimitive; - - -// VARIABLES // - -var debug = logger( 'path:accessor:is-defined' ); - - -// MAIN // - -/** -* Accessor function which determines whether a datum is defined. -* -* @private -* @param {number} d - datum -* @returns {boolean} boolean indicating whether a datum is defined -*/ -function isDefined( d ) { - var bool = !isnan( d ); - debug( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool ); - return bool; -} - - -// EXPORTS // - -module.exports = isDefined; diff --git a/components/svg/path/lib/defaults.json b/components/svg/path/lib/defaults.json deleted file mode 100644 index a5ca76d..0000000 --- a/components/svg/path/lib/defaults.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "autoRender": false, - "color": "#000", - "isDefined": null, - "label": "", - "opacity": 0.9, - "style": "-", - "width": 2, - "x": [], - "xScale": null, - "y": [], - "yScale": null -} diff --git a/components/svg/path/lib/index.js b/components/svg/path/lib/index.js deleted file mode 100644 index d3797cb..0000000 --- a/components/svg/path/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* SVG path component. -* -* @module @stdlib/plot/components/svg/path -* -* @example -* var Path = require( '@stdlib/plot/components/svg/path' ); -* -* var path = new Path({ -* 'x': [0.1,0.2,0.3], -* 'y': [0.4,0.5,0.6] -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/components/svg/path/lib/main.js b/components/svg/path/lib/main.js deleted file mode 100644 index d2eaa36..0000000 --- a/components/svg/path/lib/main.js +++ /dev/null @@ -1,541 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// TODO: improve JSDoc examples - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var linear = require( 'd3-scale' ).scaleLinear; // TODO: remove -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var format = require( '@stdlib/string/format' ); -var copy = require( '@stdlib/utils/copy' ); -var merge = require( '@stdlib/utils/merge' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var isDefined = require( './accessors/is_defined.js' ); -var defaults = require( './defaults.json' ); -var setX = require( './props/x/set.js' ); -var getX = require( './props/x/get.js' ); -var setY = require( './props/y/set.js' ); -var getY = require( './props/y/get.js' ); -var setXScale = require( './props/x-scale/set.js' ); -var getXScale = require( './props/x-scale/get.js' ); -var setYScale = require( './props/y-scale/set.js' ); -var getYScale = require( './props/y-scale/get.js' ); -var setIsDefined = require( './props/is-defined/set.js' ); -var getIsDefined = require( './props/is-defined/get.js' ); -var setColor = require( './props/color/set.js' ); -var getColor = require( './props/color/get.js' ); -var setLabel = require( './props/label/set.js' ); -var getLabel = require( './props/label/get.js' ); -var setOpacity = require( './props/opacity/set.js' ); -var getOpacity = require( './props/opacity/get.js' ); -var setWidth = require( './props/width/set.js' ); -var getWidth = require( './props/width/get.js' ); -var setStyle = require( './props/style/set.js' ); -var getStyle = require( './props/style/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var getLine = require( './props/line/get.js' ); -var getXPos = require( './props/x-pos/get.js' ); -var getYPos = require( './props/y-pos/get.js' ); -var render = require( './render' ); - - -// VARIABLES // - -var debug = logger( 'path:main' ); -var PRIVATE_PROPS = [ - '_autoRender', - '_color', - '_isDefined', - '_label', - '_opacity', - '_style', - '_width', - '_xData', - '_xScale', - '_yData', - '_yScale' -]; - - -// MAIN // - -/** -* Path constructor. -* -* @constructor -* @param {Options} [options] - constructor options -* @param {ArrayLike} [options.x=[]] - x-values -* @param {ArrayLike} [options.y=[]] - y-values -* @param {Function} [options.xScale] - x scale function -* @param {Function} [options.yScale] - y scale function -* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined -* @param {string} [options.color] - color -* @param {string} [options.label] - label -* @param {NonNegativeInteger} [options.width=2] - width -* @param {number} [options.opacity=0.9] - opacity -* @param {string} [options.style='-'] - style -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Path} Path instance -* -* @example -* var path = new Path({ -* 'x': [0.1,0.2,0.3], -* 'y': [0.4,0.5,0.6] -* }); -*/ -function Path( options ) { - var self; - var keys; - var opts; - var key; - var i; - if ( !( this instanceof Path ) ) { - if ( arguments.length ) { - return new Path( options ); - } - return new Path(); - } - self = this; - - opts = copy( defaults ); - opts.isDefined = isDefined; - opts.xScale = linear(); - opts.yScale = linear(); - - if ( arguments.length ) { - if ( !isObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - opts = merge( opts, options ); - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { - defineProperty( this, PRIVATE_PROPS[i], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - }); - } - // Set options... - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - this[ key ] = opts[ key ]; - } - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Path.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Path.prototype.constructor = Path; - -/** -* `x` values. -* -* @name x -* @memberof Path.prototype -* @type {ArrayLike} -* @throws {TypeError} must be array-like -* @default [] -* -* @example -* var path = new Path({ -* 'x': [0.1,0.2,0.3] -* }); -* -* var x = path.x; -* // returns [0.1,0.2,0.3] -*/ -defineProperty( Path.prototype, 'x', { - 'configurable': false, - 'enumerable': true, - 'set': setX, - 'get': getX -}); - -/** -* `y` values. -* -* @name y -* @memberof Path.prototype -* @type {ArrayLike} -* @throws {TypeError} must be array-like -* @default [] -* -* @example -* var path = new Path({ -* 'y': [0.4,0.5,0.6] -* }); -* -* var y = path.y; -* // returns [0.4,0.5,0.6] -*/ -defineProperty( Path.prototype, 'y', { - 'configurable': false, - 'enumerable': true, - 'set': setY, - 'get': getY -}); - -/** -* `x` scale function. -* -* @name xScale -* @memberof Path.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var path = new Path({ -* 'xScale': function scale(){} -* }); -* -* var f = path.xScale; -* // returns -*/ -defineProperty( Path.prototype, 'xScale', { - 'configurable': false, - 'enumerable': true, - 'set': setXScale, - 'get': getXScale -}); - -/** -* `y` scale function. -* -* @name yScale -* @memberof Path.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var path = new Path({ -* 'yScale': function scale(){} -* }); -* -* var f = path.yScale; -* // returns -*/ -defineProperty( Path.prototype, 'yScale', { - 'configurable': false, - 'enumerable': true, - 'set': setYScale, - 'get': getYScale -}); - -/** -* Accessor which defines whether a datum is defined. This accessor is used to define how missing values are encoded. The default behavior is to ignore values which are `NaN`. -* -* @name isDefined -* @memberof Path.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var path = new Path(); -* path.isDefined = function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* -* @example -* function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* var path = new Path({ -* 'isDefined': isDefined -* }); -* var fcn = path.isDefined; -* // returns -*/ -defineProperty( Path.prototype, 'isDefined', { - 'configurable': false, - 'enumerable': true, - 'set': setIsDefined, - 'get': getIsDefined -}); - -/** -* Path color. -* -* @name color -* @memberof Path.prototype -* @type {string} -* @throws {TypeError} must be a string -* -* @example -* var path = new Path({ -* 'color': 'steelblue' -* }); -* -* var color = path.color; -* // returns 'steelblue' -*/ -defineProperty( Path.prototype, 'color', { - 'configurable': false, - 'enumerable': true, - 'set': setColor, - 'get': getColor -}); - -/** -* Path label. -* -* @name label -* @memberof Path.prototype -* @type {string} -* @throws {TypeError} must be a string -* -* @example -* var path = new Path({ -* 'label': 'line-1' -* }); -* -* var label = path.label; -* // returns 'line-1' -*/ -defineProperty( Path.prototype, 'label', { - 'configurable': false, - 'enumerable': true, - 'set': setLabel, - 'get': getLabel -}); - -/** -* Path opacity. -* -* @name opacity -* @memberof Path.prototype -* @type {number} -* @throws {TypeError} must be a number -* @throws {RangeError} must be a number on the interval `[0,1]` -* @default 0.9 -* -* @example -* var path = new Path({ -* 'opacity': 0.5 -* }); -* -* var opacity = path.opacity; -* // returns 0.5 -*/ -defineProperty( Path.prototype, 'opacity', { - 'configurable': false, - 'enumerable': true, - 'set': setOpacity, - 'get': getOpacity -}); - -/** -* Path width. -* -* @name width -* @memberof Path.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 2 -* -* @example -* var path = new Path({ -* 'width': 1 -* }); -* -* var width = path.width; -* // returns 1 -*/ -defineProperty( Path.prototype, 'width', { - 'configurable': false, - 'enumerable': true, - 'set': setWidth, - 'get': getWidth -}); - -/** -* Path style. -* -* @name style -* @memberof Path.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default '-' -* -* @example -* var path = new Path({ -* 'style': '-.' -* }); -* -* var style = path.style; -* // returns '-.' -*/ -defineProperty( Path.prototype, 'style', { - 'configurable': false, - 'enumerable': true, - 'set': setStyle, - 'get': getStyle -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Path.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var path = new Path({ -* 'autoRender': true -* }); -* -* var mode = path.autoRender; -* // returns true -*/ -defineProperty( Path.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Returns a function to generate a line as an SVG path. -* -* @name line -* @memberof Path.prototype -* @type {Function} -* -* @example -* var path = new Path(); -* -* var line = path.line; -* // returns -*/ -defineProperty( Path.prototype, 'line', { - 'configurable': false, - 'enumerable': true, - 'get': getLine -}); - -/** -* Function to map values to x coordinate values. -* -* @name xPos -* @memberof Path.prototype -* @type {Function} -* -* @example -* var path = new Path(); -* var xPos = path.xPos; -* // returns -*/ -defineProperty( Path.prototype, 'xPos', { - 'configurable': false, - 'enumerable': true, - 'get': getXPos -}); - -/** -* Function to map values to y coordinate values. -* -* @name yPos -* @memberof Path.prototype -* @type {Function} -* -* @example -* var path = new Path(); -* var yPos = path.yPos; -* // returns -*/ -defineProperty( Path.prototype, 'yPos', { - 'configurable': false, - 'enumerable': true, - 'get': getYPos -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Path.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var path = new Path(); -* -* var out = path.render(); -*/ -setReadOnly( Path.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Path; diff --git a/components/svg/path/lib/props/auto-render/get.js b/components/svg/path/lib/props/auto-render/get.js deleted file mode 100644 index 7df40de..0000000 --- a/components/svg/path/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/path/lib/props/auto-render/set.js b/components/svg/path/lib/props/auto-render/set.js deleted file mode 100644 index 6174175..0000000 --- a/components/svg/path/lib/props/auto-render/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:auto-render' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/path/lib/props/color/get.js b/components/svg/path/lib/props/color/get.js deleted file mode 100644 index 95da35e..0000000 --- a/components/svg/path/lib/props/color/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the path color. -* -* @private -* @returns {string} color -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._color; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/path/lib/props/color/set.js b/components/svg/path/lib/props/color/set.js deleted file mode 100644 index 654fd19..0000000 --- a/components/svg/path/lib/props/color/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:color' ); - - -// MAIN // - -/** -* Sets the path color. -* -* @private -* @param {string} color - color -* @throws {TypeError} must be a string -*/ -function set( color ) { - /* eslint-disable no-invalid-this */ - if ( !isString( color ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'color', color ) ); - } - debug( 'Current value: %d.', this._color ); - - this._color = color; - debug( 'New Value: %d.', this._color ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/path/lib/props/is-defined/get.js b/components/svg/path/lib/props/is-defined/get.js deleted file mode 100644 index fd05f22..0000000 --- a/components/svg/path/lib/props/is-defined/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the accessor for defined values. -* -* @private -* @returns {Function} accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._isDefined; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/path/lib/props/is-defined/set.js b/components/svg/path/lib/props/is-defined/set.js deleted file mode 100644 index 3dc6b17..0000000 --- a/components/svg/path/lib/props/is-defined/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:is-defined' ); - - -// MAIN // - -/** -* Sets the accessor for defined values. -* -* @private -* @param {Function} fcn - accessor -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'isDefined', fcn ) ); - } - debug( 'Current value: %s.', this._isDefined ); - - this._isDefined = fcn; - debug( 'New Value: %s.', this._isDefined ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/path/lib/props/label/get.js b/components/svg/path/lib/props/label/get.js deleted file mode 100644 index a068a42..0000000 --- a/components/svg/path/lib/props/label/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the path label. -* -* @private -* @returns {string} label -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._label; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/path/lib/props/label/set.js b/components/svg/path/lib/props/label/set.js deleted file mode 100644 index 42bb100..0000000 --- a/components/svg/path/lib/props/label/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:label' ); - - -// MAIN // - -/** -* Sets the path label. -* -* @private -* @param {string} label - label -* @throws {TypeError} must be a string -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( !isString( label ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'label', label ) ); - } - debug( 'Current value: %d.', this._label ); - - this._label = label; - debug( 'New Value: %d.', this._label ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/path/lib/props/line/get.js b/components/svg/path/lib/props/line/get.js deleted file mode 100644 index 5e784f1..0000000 --- a/components/svg/path/lib/props/line/get.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var line = require( 'd3-shape' ).line; // TODO: remove - - -// MAIN // - -/** -* Returns a function to generate a line as an SVG path. -* -* @private -* @returns {Function} function to generate a line as an SVG path -*/ -function get() { - /* eslint-disable no-invalid-this, stdlib/empty-line-before-comment */ - var f = line() - .x( this.xPos ) - .y( this.yPos ) - .defined( this.isDefined ); - // TODO: interpolate (curve factory) - // TODO: tension - - return f; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/path/lib/props/opacity/get.js b/components/svg/path/lib/props/opacity/get.js deleted file mode 100644 index eea4f9d..0000000 --- a/components/svg/path/lib/props/opacity/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the opacity. -* -* @private -* @returns {number} opacity -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._opacity; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/path/lib/props/opacity/set.js b/components/svg/path/lib/props/opacity/set.js deleted file mode 100644 index f4867e8..0000000 --- a/components/svg/path/lib/props/opacity/set.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:opacity' ); - - -// MAIN // - -/** -* Sets the opacity. -* -* @private -* @param {number} opacity - opacity -* @throws {TypeError} must be a number -* @throws {RangeError} must be a number on the interval `[0,1]` -*/ -function set( opacity ) { - /* eslint-disable no-invalid-this */ - if ( !isNumber( opacity ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', 'opacity', opacity ) ); - } - if ( - opacity < 0.0 || - opacity > 1.0 - ) { - throw new RangeError( format( 'invalid assignment. `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'opacity', opacity ) ); - } - debug( 'Current value: %d.', this._opacity ); - - this._opacity = opacity; - debug( 'New Value: %d.', this._opacity ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/path/lib/props/style/get.js b/components/svg/path/lib/props/style/get.js deleted file mode 100644 index 5329c64..0000000 --- a/components/svg/path/lib/props/style/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the path style. -* -* @private -* @returns {string} style -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._style; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/path/lib/props/style/set.js b/components/svg/path/lib/props/style/set.js deleted file mode 100644 index 8c46af5..0000000 --- a/components/svg/path/lib/props/style/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:style' ); - - -// MAIN // - -/** -* Sets the path style. -* -* @private -* @param {string} v - style -* @throws {TypeError} must be a string -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - if ( !isString( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'style', v ) ); - } - debug( 'Current value: %d.', this._style ); - - this._style = v; - debug( 'New Value: %d.', this._style ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/path/lib/props/width/get.js b/components/svg/path/lib/props/width/get.js deleted file mode 100644 index b2b8e84..0000000 --- a/components/svg/path/lib/props/width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the width. -* -* @private -* @returns {NonNegativeInteger} width -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._width; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/path/lib/props/width/set.js b/components/svg/path/lib/props/width/set.js deleted file mode 100644 index 73d2ce0..0000000 --- a/components/svg/path/lib/props/width/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:width' ); - - -// MAIN // - -/** -* Sets the width. -* -* @private -* @param {NonNegativeInteger} v - width -* @throws {TypeError} must be a nonnegative integer -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'width', v ) ); - } - debug( 'Current value: %d.', this._width ); - - this._width = v; - debug( 'New Value: %d.', this._width ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/path/lib/props/x-pos/get.js b/components/svg/path/lib/props/x-pos/get.js deleted file mode 100644 index a0f8808..0000000 --- a/components/svg/path/lib/props/x-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'path:xpos' ); - - -// MAIN // - -/** -* Returns a function to map values to x coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.xScale; - return xPos; - - /** - * Maps a value to a x coordinate value. - * - * @private - * @param {Array} d - datum - * @returns {number} pixel value - */ - function xPos( d ) { - var px = scale( d[0] ); - debug( 'Value: %d => Pixel: %d.', d[0], px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/path/lib/props/x-scale/get.js b/components/svg/path/lib/props/x-scale/get.js deleted file mode 100644 index a3ad33f..0000000 --- a/components/svg/path/lib/props/x-scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xScale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/path/lib/props/x-scale/set.js b/components/svg/path/lib/props/x-scale/set.js deleted file mode 100644 index e9412f5..0000000 --- a/components/svg/path/lib/props/x-scale/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:xscale' ); - - -// MAIN // - -/** -* Sets the x-scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'xScale', fcn ) ); - } - debug( 'Current value: %s.', this._xScale ); - - this._xScale = fcn; - debug( 'New Value: %s.', this._xScale ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/path/lib/props/x/get.js b/components/svg/path/lib/props/x/get.js deleted file mode 100644 index fcddeb2..0000000 --- a/components/svg/path/lib/props/x/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the `x` values. -* -* @private -* @returns {ArrayLike} x values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xData; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/path/lib/props/x/set.js b/components/svg/path/lib/props/x/set.js deleted file mode 100644 index 830f7f2..0000000 --- a/components/svg/path/lib/props/x/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isArrayLike = require( '@stdlib/assert/is-array-like' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:x' ); - - -// MAIN // - -/** -* Sets the `x` values. -* -* @private -* @param {ArrayLike} x - x values -* @throws {TypeError} must be array-like -*/ -function set( x ) { - /* eslint-disable no-invalid-this */ - if ( !isArrayLike( x ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'x', x ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._xData ) ); - - this._xData = x; - debug( 'New Value: %s.', JSON.stringify( this._xData ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/path/lib/props/y-pos/get.js b/components/svg/path/lib/props/y-pos/get.js deleted file mode 100644 index ea24de7..0000000 --- a/components/svg/path/lib/props/y-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'path:ypos' ); - - -// MAIN // - -/** -* Returns a function to map values to y coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.yScale; - return yPos; - - /** - * Maps a value to a y coordinate value. - * - * @private - * @param {Array} d - datum - * @returns {number} pixel value - */ - function yPos( d ) { - var px = scale( d[1] ); - debug( 'Value: %d => Pixel: %d.', d[1], px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/path/lib/props/y-scale/get.js b/components/svg/path/lib/props/y-scale/get.js deleted file mode 100644 index 83f782c..0000000 --- a/components/svg/path/lib/props/y-scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yScale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/path/lib/props/y-scale/set.js b/components/svg/path/lib/props/y-scale/set.js deleted file mode 100644 index df1377f..0000000 --- a/components/svg/path/lib/props/y-scale/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:yscale' ); - - -// MAIN // - -/** -* Sets the y-scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'yScale', fcn ) ); - } - debug( 'Current value: %s.', this._yScale ); - - this._yScale = fcn; - debug( 'New Value: %s.', this._yScale ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/path/lib/props/y/get.js b/components/svg/path/lib/props/y/get.js deleted file mode 100644 index 459d022..0000000 --- a/components/svg/path/lib/props/y/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the `y` values. -* -* @private -* @returns {ArrayLike} y values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yData; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/path/lib/props/y/set.js b/components/svg/path/lib/props/y/set.js deleted file mode 100644 index 181b60b..0000000 --- a/components/svg/path/lib/props/y/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isArrayLike = require( '@stdlib/assert/is-array-like' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'path:set:y' ); - - -// MAIN // - -/** -* Sets the `y` values. -* -* @private -* @param {ArrayLike} y - y values -* @throws {TypeError} must be array-like -*/ -function set( y ) { - /* eslint-disable no-invalid-this */ - if ( !isArrayLike( y ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'y', y ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._yData ) ); - - this._yData = y; - debug( 'New Value: %s.', JSON.stringify( this._yData ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/path/lib/render/index.js b/components/svg/path/lib/render/index.js deleted file mode 100644 index 8fd71a9..0000000 --- a/components/svg/path/lib/render/index.js +++ /dev/null @@ -1,77 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var zip = require( './utils/zip.js' ); -var style = require( './utils/style.js' ); - - -// VARIABLES // - -var debug = logger( 'path:render' ); -var ELEMENT = 'path'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var props; - var vtree; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'line', - 'className': 'path line', - 'attributes': { - 'd': this.line( zip( this._xData, this._yData ) ), - 'fill': 'none', - 'stroke': this.color, - 'stroke-width': this.width, - 'stroke-opacity': this.opacity, - 'stroke-dasharray': style( this.style ), - 'data-label': this.label - } - }; - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, [] ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/path/lib/render/utils/style.js b/components/svg/path/lib/render/utils/style.js deleted file mode 100644 index cdfee77..0000000 --- a/components/svg/path/lib/render/utils/style.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// VARIABLES // - -var STYLES = { - // Solid path: - '-': '', - - // Dashes: - '--': '5, 1', - - // Dotted path: - ':': '0.9', - - // Dash-dotted path: - '-.': '5, 1, 1, 1' -}; - - -// MAIN // - -/** -* Checks for a known style. If present, returns the [`stroke-dasharray`][1]. Otherwise, returns the provided input value. -* -* [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray -* -* @private -* @param {string} v - style -* @returns {string} stroke dasharray value -*/ -function style( v ) { - var s = STYLES[ v ]; - if ( s ) { - return s; - } - return v; -} - - -// EXPORTS // - -module.exports = style; diff --git a/components/svg/path/lib/render/utils/zip.js b/components/svg/path/lib/render/utils/zip.js deleted file mode 100644 index 7317353..0000000 --- a/components/svg/path/lib/render/utils/zip.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Zips two arrays. -* -* @private -* @param {ArrayLike} x - x-values -* @param {ArrayLike} y - y-values -* @throws {Error} must provide equal length array-like objects -* @returns {Array} zipped array -*/ -function zip( x, y ) { - var out; - var i; - if ( x.length !== y.length ) { - throw new Error( format( 'invalid arguments. Must provide equal length array-like objects. x length: `%u`. y length: `%u`.', x.length, y.length ) ); - } - out = new Array( x.length ); - for ( i = 0; i < x.length; i++ ) { - out[ i ] = [ x[i], y[i] ]; - } - return out; -} - - -// EXPORTS // - -module.exports = zip; diff --git a/components/svg/path/package.json b/components/svg/path/package.json deleted file mode 100644 index 0933609..0000000 --- a/components/svg/path/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/path", - "version": "0.0.0", - "description": "SVG path.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "path", - "line", - "series", - "component" - ] -} diff --git a/components/svg/rects/lib/props/auto-render/get.js b/components/svg/rects/lib/props/auto-render/get.js deleted file mode 100644 index 7df40de..0000000 --- a/components/svg/rects/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rects/lib/props/auto-render/set.js b/components/svg/rects/lib/props/auto-render/set.js deleted file mode 100644 index 5ec6e51..0000000 --- a/components/svg/rects/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rects:set:auto-render' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); - } - if ( bool !== this._autoRender ) { - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/rects/lib/props/label/get.js b/components/svg/rects/lib/props/label/get.js deleted file mode 100644 index b7dbfda..0000000 --- a/components/svg/rects/lib/props/label/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get a rectangle's label. -* -* @private -* @returns {Function} label accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isString( this._label ) ) { - return label; - } - return this._label; - - /** - * Returns the label. - * - * @private - * @returns {string} label - */ - function label() { - return self._label; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rects/lib/props/label/set.js b/components/svg/rects/lib/props/label/set.js deleted file mode 100644 index ea3aa1c..0000000 --- a/components/svg/rects/lib/props/label/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rects:set:label' ); - - -// MAIN // - -/** -* Sets the label. -* -* @private -* @param {(string|Function)} label - label -* @throws {TypeError} must be a string or a function -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( !isString( label ) && !isFunction( label ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or a function. Value: `%s`.', 'label', label ) ); - } - if ( label !== this._label ) { - debug( 'Current value: %d.', this._label ); - - this._label = label; - debug( 'New Value: %d.', this._label ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/rects/lib/props/x-pos/get.js b/components/svg/rects/lib/props/x-pos/get.js deleted file mode 100644 index df38da3..0000000 --- a/components/svg/rects/lib/props/x-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'rects:x-pos' ); - - -// MAIN // - -/** -* Returns a function to map values to `x` coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.xScale; - - return xPos; - /** - * Maps a value to an `x` coordinate value. - * - * @private - * @param {*} d - datum - * @returns {number} pixel value - */ - function xPos( d ) { - var px = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rects/lib/props/x-scale/get.js b/components/svg/rects/lib/props/x-scale/get.js deleted file mode 100644 index a3ad33f..0000000 --- a/components/svg/rects/lib/props/x-scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xScale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rects/lib/props/x-scale/set.js b/components/svg/rects/lib/props/x-scale/set.js deleted file mode 100644 index 3c21e46..0000000 --- a/components/svg/rects/lib/props/x-scale/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rects:set:xscale' ); - - -// MAIN // - -/** -* Sets the x-scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'xScale', fcn ) ); - } - if ( fcn !== this._xScale ) { - debug( 'Current value: %s.', this._xScale ); - - this._xScale = fcn; - debug( 'New Value: %s.', this._xScale ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/rects/lib/props/y-pos/get.js b/components/svg/rects/lib/props/y-pos/get.js deleted file mode 100644 index 54d127c..0000000 --- a/components/svg/rects/lib/props/y-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'rects:y-pos' ); - - -// MAIN // - -/** -* Returns a function to map values to `y` coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.yScale; - return yPos; - - /** - * Maps a value to a `y` coordinate value. - * - * @private - * @param {*} d - datum - * @returns {number} pixel value - */ - function yPos( d ) { - var px = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rects/lib/props/y-scale/get.js b/components/svg/rects/lib/props/y-scale/get.js deleted file mode 100644 index 83f782c..0000000 --- a/components/svg/rects/lib/props/y-scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yScale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rects/lib/props/y-scale/set.js b/components/svg/rects/lib/props/y-scale/set.js deleted file mode 100644 index 5cb1893..0000000 --- a/components/svg/rects/lib/props/y-scale/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rects:set:yscale' ); - - -// MAIN // - -/** -* Sets the y-scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'yScale', fcn ) ); - } - if ( fcn !== this._yScale ) { - debug( 'Current value: %s.', this._yScale ); - - this._yScale = fcn; - debug( 'New Value: %s.', this._yScale ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/rects/lib/render/columns.js b/components/svg/rects/lib/render/columns.js deleted file mode 100644 index d2e51cb..0000000 --- a/components/svg/rects/lib/render/columns.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'rects:render:rects' ); -var ELEMENT = 'rect'; - - -// MAIN // - -/** -* Renders data as a rectangles. -* -* @private -* @param {Object} state - state -* @returns {Array} array of virtual trees -*/ -function render( state ) { - var lineOpacity; - var faceOpacity; - var faceColor; - var lineColor; - var label; - var props; - var xPos; - var yPos; - var data; - var out; - var pos; - var x0; - var x1; - var y; - var i; - var j; - - debug( 'Rendering rectangles...' ); - - label = state.label; - lineOpacity = state.lineOpacity; - faceOpacity = state.faceOpacity; - lineColor = state.lineColor; - faceColor = state.faceColor; - xPos = state.xPos; - yPos = state.yPos; - data = state.data; - - out = new Array( data.length/3 ); - for ( i = 0; i < data.length; i += 3 ) { - j = i / 3; - - x0 = data[ i ]; - x1 = data[ i+1 ]; - y = data[ i+2 ]; - - pos = xPos( x0 ); - - debug( 'Rendering datum %d...', j ); - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'column', - 'className': 'column', - 'attributes': { - 'x': pos, - 'width': xPos( x1 ) - pos, - 'height': yPos( y ), // FIXME - 'stroke': lineColor( x0, x1, y, j ), - 'stroke-opacity': lineOpacity( x0, x1, y, j ), - 'fill': faceColor( x0, x1, y, j ), - 'fill-opacity': faceOpacity( x0, x1, y, j ), - 'data-label': label( x0, x1, y, j ) - } - }; - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - out[ j ] = h( ELEMENT, props, [] ); - } - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/rects/lib/render/index.js b/components/svg/rects/lib/render/index.js deleted file mode 100644 index c6213fb..0000000 --- a/components/svg/rects/lib/render/index.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var columns = require( './columns.js' ); -var bars = require( './bars.js' ); - - -// VARIABLES // - -var debug = logger( 'rects:render' ); -var ELEMENT = 'g'; -var RENDER = { - 'vertical': columns, - 'horizontal': bars -}; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var children; - var props; - var vtree; - var f; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'rects', - 'className': 'rects' - }; - f = RENDER[ this.orientation ]; - children = f( this ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, children ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/rug/README.md b/components/svg/rug/README.md deleted file mode 100644 index 7f0ff35..0000000 --- a/components/svg/rug/README.md +++ /dev/null @@ -1,464 +0,0 @@ - - -# Rug - -> [SVG][svg] rug component. - - - -
- - - - - - - -A **rug plot** provides a compact 1-dimensional visualization to supplement higher dimensional plots by displaying a [marginal distribution][marginal-distribution] along one axis. Displaying a [marginal distribution][marginal-distribution] is useful in helping reveal the "shape" of data, especially when visual space is limited. - -
- - - - - -
- -## Usage - -```javascript -var Rug = require( '@stdlib/plot/components/svg/rug' ); -``` - -#### Rug( \[options] ) - -Returns a `Rug` instance. - -```javascript -var node = new Rug(); -// returns -``` - -The constructor accepts the following `options`: - -- **autoRender**: `boolean` indicating whether to re-render on a `'change'` event. Default: `true`. -- **color**: tick (tassel) color. May be either a `string` or a `function`. Default: `'#aaa'`. -- **data**: array-like `object` containing tick data. Default: `[]`. -- **isDefined**: predicate function indicating whether a datum is defined. By default, the function treats `NaN` values as undefined data values. -- **label**: tick (tassel) label. May be either a `string` or a `function`. Default: `''`. -- **opacity**: tick (tassel) opacity. Must be on the interval `[0,1]`. Default: `0.9`. -- **orientation**: rug orientation. Must be either bottom, top, right, or left. Default: `'bottom'`. -- **scale**: scale function which maps data values to coordinates. -- **size**: tick (tassel) size. Default: `6` pixels. - -To specify rug plot options at instantiation, provide an `options` object. - -```javascript -var opts = { - 'data': [ 0.1, 0.3, 0.5 ], - 'color': '#ff0000', - 'label': 'group-1', - 'opacity': 0.7, - 'orientation': 'bottom', - 'size': 5, - 'autoRender': false -}; - -var node = new Rug( opts ); -// returns -``` - -* * * - -### Properties - - - -#### Rug.prototype.autoRender - -**Writable** property which specifies whether an instance re-renders on each `'change'` event. - -```javascript -var node = new Rug({ - 'autoRender': false -}); - -var mode = node.autoRender; -// returns false -``` - - - -#### Rug.prototype.color - -**Writable** property which specifies tick (tassel) color. A color value may be either a `string` or an accessor `function`. - -```javascript -var node = new Rug({ - 'color': 'steelblue' -}); - -var color = node.color; -// returns -``` - -When retrieved, the returned value is always an accessor which accepts two parameters: - -- **d**: datum -- **i**: datum index - - - -#### Rug.prototype.data - -**Writable** property which specifies the tick (tassel) data. - -```javascript -var node = new Rug({ - 'data': [ 0.1, 0.2, 0.3 ] -}); - -var data = node.data; -// returns [ 0.1, 0.2, 0.3 ] -``` - - - -#### Rug.prototype.isDefined( d, i ) - -**Writable** property whose value is a predicate `function` which indicates whether a datum is defined and thus determines how missing values are encoded. When invoked, the function is provided two arguments: - -- **d**: datum. -- **i**: datum index. - -```javascript -function isDefined( d ) { - return ( d !== null ); -} - -var node = new Rug({ - 'isDefined': isDefined -}); - -node.isDefined = isDefined; -// returns -``` - -The default function behavior defines `NaN` data values as undefined. - - - -#### Rug.prototype.label - -**Writable** property specifying a tick (tassel) label. A label value may be either a `string` or an accessor `function`. - -```javascript -var node = new Rug({ - 'label': 'group-1' -}); - -var label = node.label; -// returns -``` - -When retrieved, the returned value is always an accessor which accepts two parameters: - -- **d**: datum. -- **i**: datum index. - - - -#### Rug.prototype.opacity - -**Writable** property specifying tick (tassel) opacity. An opacity value may be either a `number` or an accessor `function`. - -```javascript -var node = new Rug({ - 'opacity': 0.5 -}); - -var opacity = node.opacity; -// returns -``` - -When retrieved, the returned value is always an accessor which accepts two parameters: - -- **d**: datum. -- **i**: datum index. - - - -#### Rug.prototype.orientation - -**Writable** property specifying the rug plot orientation. - -```javascript -var node = new Rug({ - 'orientation': 'left' -}); - -var orient = node.orientation; -// returns 'left' -``` - -An orientation may be one of the following values: - -- **bottom**: bottom orientation (default) -- **top**: top orientation -- **left**: left orientation -- **right**: right orientation - - - -#### Rug.prototype.scale - -**Writable** property providing a function which maps data values to coordinate values. - -```javascript -function scale( d, i ) { - console.log( d, i ); - return d; -} - -var node = new Rug({ - 'scale': scale -}); - -var fcn = node.scale; -// returns -``` - - - -#### Rug.prototype.size - -**Writable** property specifying tick (tassel) size. - -```javascript -var node = new Rug({ - 'size': 5 -}); - -var size = node.size; -// returns 5 -``` - -* * * - -### Methods - - - -#### Rug.prototype.render() - -Renders an instance as a [virtual DOM tree][virtual-dom]. - -```javascript -var node = new Rug({ - 'data': [ 0.1 ] -}); - -var vtree = node.render(); -/* e.g., returns - { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } -*/ -``` - -* * * - -### Events - - - -#### 'render' - -Event emitted when an instance renders. The event object is the rendered [Virtual DOM tree][virtual-dom]. - -```javascript -var node = new Rug(); - -function onRender( vtree ) { - console.log( vtree ); -} - -// Attach an event listener: -node.on( 'render', onRender ); - -// Render an instance: -node.render(); -``` - -* * * - -### Listeners - - - -#### 'change' - -If `autoRender` is `true`, upon receiving a `'change'` event, an instance re-renders. - -```javascript -var node = new Rug({ - 'autoRender': true -}); - -function onRender( vtree ) { - console.log( vtree ); -} - -// Attach an event listener: -node.on( 'render', onRender ); - -// Manually trigger a change event: -node.emit( 'change' ); -``` - -
- - - - - -
- -
- - - - - -* * * - -
- -## Examples - - - -```javascript -var toHTML = require( 'vdom-to-html' ); -var rug = require( '@stdlib/plot/components/svg/rug' ); - -// Create a new rug component: -var opts = { - 'data': [ 0.10, 0.50, 0.90 ], - 'orientation': 'bottom' -}; -var r = rug( opts ); - -// Render as a virtual DOM tree: -var vtree = r.render(); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -// returns - -// Listen for 'render' events (e.g., when triggered due to changes in state): -r.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - r.data = [ 0.99, 0.87, 0.92 ]; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/components/svg/rug/benchmark/benchmark.js b/components/svg/rug/benchmark/benchmark.js deleted file mode 100644 index fae7353..0000000 --- a/components/svg/rug/benchmark/benchmark.js +++ /dev/null @@ -1,336 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var noop = require( '@stdlib/utils/noop' ); -var randu = require( '@stdlib/random/base/randu' ); -var isArray = require( '@stdlib/assert/is-array' ); -var pkg = require( './../package.json' ).name; -var Rug = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::instantiation', function benchmark( b ) { - var node; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node = new Rug(); - if ( !( node instanceof Rug ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( node instanceof Rug ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,no_new', function benchmark( b ) { - var ctor; - var node; - var i; - - ctor = Rug; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node = ctor(); - if ( !( node instanceof Rug ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( node instanceof Rug ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,options', function benchmark( b ) { - var node; - var opts; - var i; - - opts = { - 'autoRender': false, - 'color': '#474747', - 'data': [ 1, 2, 3 ], - 'isDefined': noop, - 'label': 'beep', - 'opacity': 1.0, - 'orientation': 'left', - 'size': 10, - 'scale': noop - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node = new Rug( opts ); - if ( !( node instanceof Rug ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( node instanceof Rug ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:autoRender', function benchmark( b ) { - var node; - var bool; - var i; - - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node.autoRender = !bool; - if ( typeof node.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( typeof node.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:color', function benchmark( b ) { - var values; - var node; - var i; - - values = [ - '#fff', - '#000' - ]; - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node.color = values[ i % values.length ]; - if ( typeof node.color !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof node.color !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:data', function benchmark( b ) { - var node; - var i; - - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node.data = [ randu(), randu(), randu() ]; - if ( typeof node.data !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArray( node.data ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:isDefined', function benchmark( b ) { - var node; - var i; - - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node.isDefined = createFcn(); - if ( typeof node.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof node.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createFcn() { - return beep; - function beep() { - // No-op... - } - } -}); - -bench( pkg+'::set,get:label', function benchmark( b ) { - var values; - var node; - var i; - - values = [ - 'beep', - 'boop' - ]; - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node.label = values[ i % values.length ]; - if ( typeof node.label !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof node.label !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:opacity', function benchmark( b ) { - var node; - var i; - - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node.opacity = randu(); - if ( typeof node.opacity !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof node.opacity !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:orientation', function benchmark( b ) { - var values; - var node; - var v; - var i; - - values = [ - 'left', - 'right', - 'top', - 'bottom' - ]; - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = values[ i % values.length ]; - node.orientation = v; - if ( node.orientation !== v ) { - b.fail( 'should return set value' ); - } - } - b.toc(); - if ( typeof node.orientation !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:scale', function benchmark( b ) { - var node; - var i; - - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - node.scale = createFcn(); - if ( typeof node.scale !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof node.scale !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createFcn() { - return beep; - function beep() { - // No-op... - } - } -}); - -bench( pkg+'::set,get:size', function benchmark( b ) { - var values; - var node; - var v; - var i; - - values = [ - 1, - 2, - 3, - 4, - 5, - 6 - ]; - node = new Rug(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = values[ i % values.length ]; - node.size = v; - if ( node.size !== v ) { - b.fail( 'should return set value' ); - } - } - b.toc(); - if ( typeof node.size !== 'number' ) { - b.fail( 'should return a number' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/components/svg/rug/benchmark/benchmark.render.js b/components/svg/rug/benchmark/benchmark.render.js deleted file mode 100644 index e8cf993..0000000 --- a/components/svg/rug/benchmark/benchmark.render.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var Float64Array = require( '@stdlib/array/float64' ); -var pkg = require( './../package.json' ).name; -var Rug = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var node; - var x; - var i; - - x = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = randu(); - } - node = new Rug({ - 'data': x - }); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var vtree; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - x[ x.length-1 ] = randu(); - vtree = node.render(); - if ( typeof vtree !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof vtree !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 4; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':render:len='+len, f ); - } -} - -main(); diff --git a/components/svg/rug/examples/index.js b/components/svg/rug/examples/index.js deleted file mode 100644 index d30bc38..0000000 --- a/components/svg/rug/examples/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var rug = require( './../lib' ); - -// Create a new rug component: -var opts = { - 'data': [ 0.10, 0.50, 0.90 ], - 'orientation': 'bottom', - 'autoRender': true -}; -var r = rug( opts ); - -// Render as a virtual DOM tree: -var vtree = r.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); -// => - -// Listen for 'render' events (e.g., when triggered due to changes in state): -r.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - r.data = [ 0.99, 0.87, 0.92 ]; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/components/svg/rug/lib/accessors/is_defined.js b/components/svg/rug/lib/accessors/is_defined.js deleted file mode 100644 index 72d4dc4..0000000 --- a/components/svg/rug/lib/accessors/is_defined.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isnan = require( '@stdlib/assert/is-nan' ).isPrimitive; - - -// VARIABLES // - -var debug = logger( 'rug:accessor:is-defined' ); - - -// MAIN // - -/** -* Predicate function which returns a boolean indicating whether a datum is defined. -* -* @private -* @param {number} d - datum -* @param {integer} i - index -* @returns {boolean} boolean indicating whether a datum is defined -*/ -function isDefined( d ) { - var bool = !isnan( d ); - debug( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool ); - return bool; -} - - -// EXPORTS // - -module.exports = isDefined; diff --git a/components/svg/rug/lib/defaults.json b/components/svg/rug/lib/defaults.json deleted file mode 100644 index be3c01d..0000000 --- a/components/svg/rug/lib/defaults.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "autoRender": false, - "color": "#aaa", - "data": [], - "isDefined": null, - "label": "", - "opacity": 0.9, - "orientation": "bottom", - "scale": null, - "size": 6 -} diff --git a/components/svg/rug/lib/index.js b/components/svg/rug/lib/index.js deleted file mode 100644 index 8133d0a..0000000 --- a/components/svg/rug/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* SVG rug component. -* -* @module @stdlib/plot/components/svg/rug -* -* @example -* var Rug = require( '@stdlib/plot/components/svg/rug' ); -* -* var node = new Rug({ -* 'data': [ 0.1, 0.2, 0.3 ] -* }); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/components/svg/rug/lib/main.js b/components/svg/rug/lib/main.js deleted file mode 100644 index a625d7d..0000000 --- a/components/svg/rug/lib/main.js +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var linear = require( 'd3-scale' ).scaleLinear; // TODO: remove -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var format = require( '@stdlib/string/format' ); -var copy = require( '@stdlib/utils/copy' ); -var merge = require( '@stdlib/utils/merge' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var inherit = require( '@stdlib/utils/inherit' ); -var isDefined = require( './accessors/is_defined.js' ); -var defaults = require( './defaults.json' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var setColor = require( './props/color/set.js' ); -var getColor = require( './props/color/get.js' ); -var setData = require( './props/data/set.js' ); -var getData = require( './props/data/get.js' ); -var setIsDefined = require( './props/is-defined/set.js' ); -var getIsDefined = require( './props/is-defined/get.js' ); -var setLabel = require( './props/label/set.js' ); -var getLabel = require( './props/label/get.js' ); -var setOpacity = require( './props/opacity/set.js' ); -var getOpacity = require( './props/opacity/get.js' ); -var setOrientation = require( './props/orientation/set.js' ); -var getOrientation = require( './props/orientation/get.js' ); -var getPos = require( './props/pos/get.js' ); -var setScale = require( './props/scale/set.js' ); -var getScale = require( './props/scale/get.js' ); -var setSize = require( './props/size/set.js' ); -var getSize = require( './props/size/get.js' ); -var render = require( './render' ); - - -// VARIABLES // - -var debug = logger( 'rug:main' ); -var PRIVATE_PROPS = [ - '_autoRender', - '_color', - '_data', - '_isDefined', - '_label', - '_opacity', - '_orientation', - '_scale', - '_size' -]; - - -// MAIN // - -/** -* Rug constructor. -* -* @constructor -* @param {Options} [options] - constructor options -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @param {(string|Function)} [options.color="#aaa"] - color -* @param {ArrayLike} [options.data=[]] - data -* @param {Function} [options.isDefined] - predicate function indicating whether a datum is defined -* @param {(string|Function)} [options.label] - label -* @param {(number|Function)} [options.opacity=0.9] - opacity -* @param {string} [options.orientation="bottom"] - orientation -* @param {Function} [options.scale] - scale function -* @param {NonNegativeInteger} [options.size=6] - tick (tassel) size -* @throws {TypeError} options argument must be an object -* @throws {TypeError} must provide valid options -* @returns {Rug} Rug instance -* -* @example -* var node = new Rug({ -* 'data': [ 0.1, 0.2, 0.3 ] -* }); -* // returns -*/ -function Rug( options ) { - var self; - var keys; - var opts; - var key; - var i; - if ( !instanceOf( this, Rug ) ) { - if ( arguments.length ) { - return new Rug( options ); - } - return new Rug(); - } - self = this; - - opts = copy( defaults ); - opts.isDefined = isDefined; - opts.scale = linear(); - - if ( arguments.length ) { - if ( !isObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - opts = merge( opts, options ); - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { - defineProperty( this, PRIVATE_PROPS[i], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - }); - } - // Set options... - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - this[ key ] = opts[ key ]; - } - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Inherit from the `EventEmitter` prototype. -*/ -inherit( Rug, EventEmitter ); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Rug.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var node = new Rug({ -* 'autoRender': true -* }); -* -* var mode = node.autoRender; -* // returns true -*/ -defineProperty( Rug.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Tick color. When retrieved, the returned value is a color accessor. -* -* @name color -* @memberof Rug.prototype -* @type {(string|Function)} -* @throws {TypeError} must be a string or function -* -* @example -* var node = new Rug({ -* 'color': 'steelblue' -* }); -* -* var color = node.color; -* // returns -*/ -defineProperty( Rug.prototype, 'color', { - 'configurable': false, - 'enumerable': true, - 'set': setColor, - 'get': getColor -}); - -/** -* Data. -* -* @name data -* @memberof Rug.prototype -* @type {ArrayLike} -* @throws {TypeError} must be array-like -* @default [] -* -* @example -* var node = new Rug({ -* 'data': [ 0.1, 0.2, 0.3 ] -* }); -* -* var data = node.data; -* // returns [ 0.1, 0.2, 0.3 ] -*/ -defineProperty( Rug.prototype, 'data', { - 'configurable': false, - 'enumerable': true, - 'set': setData, - 'get': getData -}); - -/** -* Predicate function which defines whether a datum is defined. This accessor is used to define how missing values are encoded. The default behavior is to ignore values which are `NaN`. -* -* @name isDefined -* @memberof Rug.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var node = new Rug(); -* -* function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* node.isDefined = isDefined; -* -* @example -* function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* var node = new Rug({ -* 'isDefined': isDefined -* }); -* var fcn = node.isDefined; -* // returns -*/ -defineProperty( Rug.prototype, 'isDefined', { - 'configurable': false, - 'enumerable': true, - 'set': setIsDefined, - 'get': getIsDefined -}); - -/** -* Tick label. When retrieved, the returned value is a label accessor. -* -* @name label -* @memberof Rug.prototype -* @type {(string|Function)} -* @throws {TypeError} must be a string or function -* -* @example -* var node = new Rug({ -* 'label': 'group-1' -* }); -* -* var label = node.label; -* // returns -*/ -defineProperty( Rug.prototype, 'label', { - 'configurable': false, - 'enumerable': true, - 'set': setLabel, - 'get': getLabel -}); - -/** -* Tick opacity. When retrieved, the returned value is an opacity accessor. -* -* @name opacity -* @memberof Rug.prototype -* @type {number} -* @throws {TypeError} must be a number -* @throws {RangeError} must be a number on the interval `[0,1]` -* @default 0.9 -* -* @example -* var node = new Rug({ -* 'opacity': 0.5 -* }); -* -* var opacity = node.opacity; -* // returns -*/ -defineProperty( Rug.prototype, 'opacity', { - 'configurable': false, - 'enumerable': true, - 'set': setOpacity, - 'get': getOpacity -}); - -/** -* Rug orientation. -* -* @name orientation -* @memberof Rug.prototype -* @type {string} -* @throws {TypeError} must be a supported orientation -* -* @example -* var node = new Rug({ -* 'orientation': 'left' -* }); -* -* var orient = node.orientation; -* // returns 'left' -*/ -defineProperty( Rug.prototype, 'orientation', { - 'configurable': false, - 'enumerable': true, - 'set': setOrientation, - 'get': getOrientation -}); - -/** -* Function to map values to x coordinate values. -* -* @name pos -* @memberof Rug.prototype -* @type {Function} -* -* @example -* var node = new Rug(); -* -* var pos = node.pos; -* // returns -*/ -defineProperty( Rug.prototype, 'pos', { - 'configurable': false, - 'enumerable': true, - 'get': getPos -}); - -/** -* Scale function. -* -* @name scale -* @memberof Rug.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var node = new Rug({ -* 'scale': function scale() {} -* }); -* -* var fcn = node.scale; -* // returns -*/ -defineProperty( Rug.prototype, 'scale', { - 'configurable': false, - 'enumerable': true, - 'set': setScale, - 'get': getScale -}); - -/** -* Tick (tassel) size. -* -* @name size -* @memberof Rug.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 6 -* -* @example -* var node = new Rug({ -* 'size': 5 -* }); -* -* var size = node.size; -* // returns 5 -*/ -defineProperty( Rug.prototype, 'size', { - 'configurable': false, - 'enumerable': true, - 'set': setSize, - 'get': getSize -}); - -/** -* Renders a Virtual DOM tree. -* -* @name render -* @memberof Rug.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var node = new Rug(); -* -* var out = node.render(); -* // returns -*/ -setReadOnly( Rug.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Rug; diff --git a/components/svg/rug/lib/props/auto-render/get.js b/components/svg/rug/lib/props/auto-render/get.js deleted file mode 100644 index 7df40de..0000000 --- a/components/svg/rug/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rug/lib/props/auto-render/set.js b/components/svg/rug/lib/props/auto-render/set.js deleted file mode 100644 index a092686..0000000 --- a/components/svg/rug/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:auto-render' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); - } - if ( bool !== this._autoRender ) { - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/rug/lib/props/color/get.js b/components/svg/rug/lib/props/color/get.js deleted file mode 100644 index cf0aabe..0000000 --- a/components/svg/rug/lib/props/color/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get a color. -* -* @private -* @returns {Function} color accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isString( this._color ) ) { - return color; - } - return this._color; - - /** - * Returns a color value. - * - * @private - * @returns {string} color - */ - function color() { - return self._color; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rug/lib/props/color/set.js b/components/svg/rug/lib/props/color/set.js deleted file mode 100644 index 0b10619..0000000 --- a/components/svg/rug/lib/props/color/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:color' ); - - -// MAIN // - -/** -* Sets the color. -* -* @private -* @param {(string|Function)} color - color -* @throws {TypeError} must be a string or function -*/ -function set( color ) { - /* eslint-disable no-invalid-this */ - if ( !isString( color ) && !isFunction( color ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or a function. Value: `%s`.', 'color', color ) ); - } - if ( color !== this._color ) { - debug( 'Current value: %d.', this._color ); - - this._color = color; - debug( 'New Value: %d.', this._color ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/rug/lib/props/data/get.js b/components/svg/rug/lib/props/data/get.js deleted file mode 100644 index 281803e..0000000 --- a/components/svg/rug/lib/props/data/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the data values. -* -* @private -* @returns {ArrayLike} data values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._data; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rug/lib/props/data/set.js b/components/svg/rug/lib/props/data/set.js deleted file mode 100644 index 4a1afee..0000000 --- a/components/svg/rug/lib/props/data/set.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isArrayLike = require( '@stdlib/assert/is-array-like' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:data' ); - - -// MAIN // - -/** -* Sets the data values. -* -* ## Notes -* -* - We always fire a `change` event when set, even if the provided reference is the same, to allow signaling that data values have changed (e.g., a data array has mutated). -* -* @private -* @param {ArrayLike} data - data values -* @throws {TypeError} must be array-like -*/ -function set( data ) { - /* eslint-disable no-invalid-this */ - if ( !isArrayLike( data ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'data', data ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._data ) ); - - this._data = data; - debug( 'New Value: %s.', JSON.stringify( this._data ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/rug/lib/props/is-defined/get.js b/components/svg/rug/lib/props/is-defined/get.js deleted file mode 100644 index 8d6d744..0000000 --- a/components/svg/rug/lib/props/is-defined/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the predicate function for determining whether a value is defined. -* -* @private -* @returns {Function} predicate function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._isDefined; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rug/lib/props/is-defined/set.js b/components/svg/rug/lib/props/is-defined/set.js deleted file mode 100644 index d6aebbe..0000000 --- a/components/svg/rug/lib/props/is-defined/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:is-defined' ); - - -// MAIN // - -/** -* Sets the predicate function for determining whether a value is defined. -* -* @private -* @param {Function} fcn - predicate function -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'isDefined', fcn ) ); - } - if ( fcn !== this._isDefined ) { - debug( 'Current value: %s.', this._isDefined ); - - this._isDefined = fcn; - debug( 'New Value: %s.', this._isDefined ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/rug/lib/props/label/get.js b/components/svg/rug/lib/props/label/get.js deleted file mode 100644 index 680c572..0000000 --- a/components/svg/rug/lib/props/label/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get a label. -* -* @private -* @returns {Function} label accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isString( this._label ) ) { - return label; - } - return this._label; - - /** - * Returns a label. - * - * @private - * @returns {string} label - */ - function label() { - return self._label; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rug/lib/props/label/set.js b/components/svg/rug/lib/props/label/set.js deleted file mode 100644 index 98107f6..0000000 --- a/components/svg/rug/lib/props/label/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:label' ); - - -// MAIN // - -/** -* Sets the label. -* -* @private -* @param {(string|Function)} label - label -* @throws {TypeError} must be a string or a function -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( !isString( label ) && !isFunction( label ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or a function. Value: `%s`.', 'label', label ) ); - } - if ( label !== this._label ) { - debug( 'Current value: %d.', this._label ); - - this._label = label; - debug( 'New Value: %d.', this._label ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/rug/lib/props/opacity/get.js b/components/svg/rug/lib/props/opacity/get.js deleted file mode 100644 index a6e4591..0000000 --- a/components/svg/rug/lib/props/opacity/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get an opacity. -* -* @private -* @returns {Function} opacity accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isNumber( this._opacity ) ) { - return opacity; - } - return this._opacity; - - /** - * Returns the opacity. - * - * @private - * @returns {number} opacity - */ - function opacity() { - return self._opacity; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rug/lib/props/opacity/set.js b/components/svg/rug/lib/props/opacity/set.js deleted file mode 100644 index 03fc2c4..0000000 --- a/components/svg/rug/lib/props/opacity/set.js +++ /dev/null @@ -1,66 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:opacity' ); - - -// MAIN // - -/** -* Sets the opacity. -* -* @private -* @param {(number|Function)} opacity - opacity -* @throws {TypeError} must be a number or a function -* @throws {RangeError} must be a number on the interval `[0,1]` -*/ -function set( opacity ) { - /* eslint-disable no-invalid-this */ - var isNum = isNumber( opacity ); - if ( !isNum && !isFunction( opacity ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number or a function. Value: `%s`.', 'opacity', opacity ) ); - } - if ( isNum && (opacity !== opacity || opacity < 0.0 || opacity > 1.0) ) { - throw new RangeError( format( 'invalid assignment. `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'opacity', opacity ) ); - } - if ( opacity !== this._opacity ) { - debug( 'Current value: %d.', this._opacity ); - - this._opacity = opacity; - debug( 'New Value: %d.', this._opacity ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/rug/lib/props/orientation/get.js b/components/svg/rug/lib/props/orientation/get.js deleted file mode 100644 index 2067d1d..0000000 --- a/components/svg/rug/lib/props/orientation/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the orientation. -* -* @private -* @returns {string} orientation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._orientation; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rug/lib/props/orientation/orientations.json b/components/svg/rug/lib/props/orientation/orientations.json deleted file mode 100644 index c3d57be..0000000 --- a/components/svg/rug/lib/props/orientation/orientations.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "bottom", - "left", - "right", - "top" -] diff --git a/components/svg/rug/lib/props/orientation/set.js b/components/svg/rug/lib/props/orientation/set.js deleted file mode 100644 index 4fe7468..0000000 --- a/components/svg/rug/lib/props/orientation/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var ORIENTATIONS = require( './orientations.json' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:orientation' ); - - -// MAIN // - -/** -* Sets the orientation. -* -* @private -* @param {string} orient - orientation -* @throws {TypeError} must be a supported orientation -*/ -function set( orient ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( ORIENTATIONS, orient ) === -1 ) { - throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'orientation', ORIENTATIONS.join( '", "' ), orient ) ); - } - if ( orient !== this._orientation ) { - debug( 'Current value: %d.', this._orientation ); - - this._orientation = orient; - debug( 'New Value: %d.', this._orientation ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/rug/lib/props/pos/get.js b/components/svg/rug/lib/props/pos/get.js deleted file mode 100644 index 3fd54c4..0000000 --- a/components/svg/rug/lib/props/pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'rug:pos' ); - - -// MAIN // - -/** -* Returns a function to map values to coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.scale; - return pos; - - /** - * Maps a value to a coordinate value. - * - * @private - * @param {*} d - datum - * @returns {number} pixel value - */ - function pos( d ) { - var p = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, p ); - return p; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rug/lib/props/scale/get.js b/components/svg/rug/lib/props/scale/get.js deleted file mode 100644 index 4ef9bb2..0000000 --- a/components/svg/rug/lib/props/scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._scale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rug/lib/props/scale/set.js b/components/svg/rug/lib/props/scale/set.js deleted file mode 100644 index 8beb12d..0000000 --- a/components/svg/rug/lib/props/scale/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:scale' ); - - -// MAIN // - -/** -* Sets the scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'scale', fcn ) ); - } - if ( fcn !== this._scale ) { - debug( 'Current value: %s.', this._scale ); - - this._scale = fcn; - debug( 'New Value: %s.', this._scale ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/rug/lib/props/size/get.js b/components/svg/rug/lib/props/size/get.js deleted file mode 100644 index b4c45e1..0000000 --- a/components/svg/rug/lib/props/size/get.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -/** -* Returns the tick (tassel) size. -* -* @private -* @returns {NonNegativeInteger} tick size -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._size; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/rug/lib/props/size/set.js b/components/svg/rug/lib/props/size/set.js deleted file mode 100644 index 8db6c48..0000000 --- a/components/svg/rug/lib/props/size/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'rug:set:size' ); - - -// MAIN // - -/** -* Sets the tick (tassel) size. -* -* @private -* @param {NonNegativeInteger} size - size -* @throws {TypeError} must be a nonnegative integer -*/ -function set( size ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( size ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'size', size ) ); - } - if ( size !== this._size ) { - debug( 'Current value: %d.', this._size ); - - this._size = size; - debug( 'New Value: %d.', this._size ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/rug/lib/render/index.js b/components/svg/rug/lib/render/index.js deleted file mode 100644 index 44b2517..0000000 --- a/components/svg/rug/lib/render/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var ticks = require( './ticks.js' ); - - -// VARIABLES // - -var debug = logger( 'rug:render' ); -var ELEMENT = 'g'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var children; - var props; - var vtree; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'rug', - 'className': 'rug' - }; - - children = ticks( this ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, children ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/rug/lib/render/ticks.js b/components/svg/rug/lib/render/ticks.js deleted file mode 100644 index 19bbfe0..0000000 --- a/components/svg/rug/lib/render/ticks.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var xAttr = require( './utils/x_attr.js' ); -var yAttr = require( './utils/y_attr.js' ); -var tickDir = require( './utils/tick_dir.js' ); - - -// VARIABLES // - -var debug = logger( 'rug:render:ticks' ); -var ELEMENT = 'line'; - - -// MAIN // - -/** -* Renders rug ticks (tassels). -* -* @private -* @param {Object} ctx - context -* @returns {Array} array of virtual trees -*/ -function render( ctx ) { - var props; - var data; - var out; - var pos; - var dir; - var p; - var x; - var y; - var d; - var i; - - debug( 'Rendering ticks...' ); - - data = ctx.data; - pos = ctx.pos; - x = xAttr( ctx.orientation ); - y = yAttr( ctx.orientation ); - dir = tickDir( ctx.orientation ); - - out = new Array( data.length ); - for ( i = 0; i < data.length; i++ ) { - d = data[ i ]; - if ( !ctx.isDefined( d, i ) ) { - debug( 'Datum %d is not defined. Value: %s.', i, d ); - continue; - } - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': ctx.opacity( d, i ), - 'stroke': ctx.color( d, i ), - 'stroke-width': 1, - 'data-label': ctx.label( d, i ) - } - }; - - p = pos( d ); - props.attributes[ x+'1' ] = 0; - props.attributes[ x+'2' ] = dir * ctx.size; - props.attributes[ y+'1' ] = p; - props.attributes[ y+'2' ] = p; - - debug( 'Rendering tick %d with value %s...', i, d ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - out[ i ] = h( ELEMENT, props, [] ); - } - debug( 'Finished rendering ticks.' ); - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/rug/lib/render/utils/tick_dir.js b/components/svg/rug/lib/render/utils/tick_dir.js deleted file mode 100644 index 60ef706..0000000 --- a/components/svg/rug/lib/render/utils/tick_dir.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the tick direction. -* -* @private -* @param {string} orient - orientation -* @returns {number} tick direction -*/ -function tickDir( orient ) { - if ( orient === 'bottom' || orient === 'right' ) { - return -1; - } - return 1; -} - - -// EXPORTS // - -module.exports = tickDir; diff --git a/components/svg/rug/lib/render/utils/x_attr.js b/components/svg/rug/lib/render/utils/x_attr.js deleted file mode 100644 index 8a7ec9f..0000000 --- a/components/svg/rug/lib/render/utils/x_attr.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the "x" attribute for tick positioning. -* -* @private -* @param {string} orient - rug orientation -* @returns {string} attribute -*/ -function xAttr( orient ) { - if ( orient === 'left' || orient === 'right' ) { - return 'x'; - } - return 'y'; -} - - -// EXPORTS // - -module.exports = xAttr; diff --git a/components/svg/rug/lib/render/utils/y_attr.js b/components/svg/rug/lib/render/utils/y_attr.js deleted file mode 100644 index e43b628..0000000 --- a/components/svg/rug/lib/render/utils/y_attr.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the "y" attribute for tick positioning. -* -* @private -* @param {string} orient - rug orientation -* @returns {string} attribute -*/ -function yAttr( orient ) { - if ( orient === 'left' || orient === 'right' ) { - return 'y'; - } - return 'x'; -} - - -// EXPORTS // - -module.exports = yAttr; diff --git a/components/svg/rug/package.json b/components/svg/rug/package.json deleted file mode 100644 index 18048f2..0000000 --- a/components/svg/rug/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/rug", - "version": "0.0.0", - "description": "SVG rug component.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "rug", - "density", - "component", - "vdom", - "virtual", - "dom", - "virtual-dom" - ] -} diff --git a/components/svg/rug/srv/scripts/fig_into_plot.js b/components/svg/rug/srv/scripts/fig_into_plot.js deleted file mode 100644 index c4eaa15..0000000 --- a/components/svg/rug/srv/scripts/fig_into_plot.js +++ /dev/null @@ -1,86 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var randn = require( '@stdlib/random/base/box-muller' ); -var Float64Array = require( '@stdlib/array/float64' ); -var Float32Array = require( '@stdlib/array/float32' ); -var Plot = require( './../../../../../ctor' ); - - -// MAIN // - -/** -* Generates a plot. -* -* @private -*/ -function main() { - var html; - var plot; - var opts; - var x1; - var x2; - var y1; - var y2; - var i; - - // Create some data... - x1 = new Float64Array( 1000 ); - x2 = new Float64Array( x1.length ); - y1 = new Float64Array( x1.length ); - y2 = new Float32Array( x1.length ); - for ( i = 0; i < x1.length; i++ ) { - x1[ i ] = 30.0 + (7.5*randn()); - x2[ i ] = 40.0 + (12.5*randn()); - y1[ i ] = 50.0 + (10.0*randn()); - y2[ i ] = 30.0 + (5.0*randn()); - } - - // Define the plot options: - opts = { - 'width': 600, - 'height': 480, - 'xMin': 0.0, - 'xMax': 100.0, - 'yMin': 0.0, - 'yMax': 100.0, - 'lineStyle': 'none', - 'symbols': 'closed-circle', - 'symbolsSize': 6, - 'symbolsOpacity': 0.2, - 'xRug': true, - 'yRug': true, - 'xRugOrient': 'top', - 'yRugOrient': 'right' - }; - - // Create a new plot: - plot = new Plot( [ x1, x2 ], [ y1, y2 ], opts ); - - // Render as HTML/SVG: - html = plot.render( 'html' ); - - // Write to `stdout`: - console.log( html ); -} - -main(); diff --git a/components/svg/rug/test/fixtures/vtree.color_function.js b/components/svg/rug/test/fixtures/vtree.color_function.js deleted file mode 100644 index a2448ee..0000000 --- a/components/svg/rug/test/fixtures/vtree.color_function.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#ffa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#ffb', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#ffc', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/rug/test/fixtures/vtree.color_string.js b/components/svg/rug/test/fixtures/vtree.color_string.js deleted file mode 100644 index 1517695..0000000 --- a/components/svg/rug/test/fixtures/vtree.color_string.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#fff', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#fff', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#fff', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/rug/test/fixtures/vtree.data.js b/components/svg/rug/test/fixtures/vtree.data.js deleted file mode 100644 index 6ea06b0..0000000 --- a/components/svg/rug/test/fixtures/vtree.data.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.15, - 'x2': 0.15 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.55, - 'x2': 0.55 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.95, - 'x2': 0.95 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/rug/test/fixtures/vtree.is_defined.js b/components/svg/rug/test/fixtures/vtree.is_defined.js deleted file mode 100644 index decb1a6..0000000 --- a/components/svg/rug/test/fixtures/vtree.is_defined.js +++ /dev/null @@ -1,98 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 2, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/rug/test/fixtures/vtree.js b/components/svg/rug/test/fixtures/vtree.js deleted file mode 100644 index 8cc704c..0000000 --- a/components/svg/rug/test/fixtures/vtree.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/rug/test/fixtures/vtree.label_function.js b/components/svg/rug/test/fixtures/vtree.label_function.js deleted file mode 100644 index 4d0e834..0000000 --- a/components/svg/rug/test/fixtures/vtree.label_function.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': 'beep', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': 'boop', - 'y1': 0, - 'y2': -6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': 'bop', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/rug/test/fixtures/vtree.label_string.js b/components/svg/rug/test/fixtures/vtree.label_string.js deleted file mode 100644 index 94c5b74..0000000 --- a/components/svg/rug/test/fixtures/vtree.label_string.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': 'beep', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': 'beep', - 'y1': 0, - 'y2': -6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': 'beep', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/rug/test/fixtures/vtree.opacity_function.js b/components/svg/rug/test/fixtures/vtree.opacity_function.js deleted file mode 100644 index d895e45..0000000 --- a/components/svg/rug/test/fixtures/vtree.opacity_function.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.25, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.5, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.75, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/rug/test/fixtures/vtree.opacity_number.js b/components/svg/rug/test/fixtures/vtree.opacity_number.js deleted file mode 100644 index 764d6e7..0000000 --- a/components/svg/rug/test/fixtures/vtree.opacity_number.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.1, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.1, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.1, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/rug/test/fixtures/vtree.orientation_left.js b/components/svg/rug/test/fixtures/vtree.orientation_left.js deleted file mode 100644 index cf3bf59..0000000 --- a/components/svg/rug/test/fixtures/vtree.orientation_left.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'x1': 0, - 'x2': 6, - 'y1': 0.1, - 'y2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'x1': 0, - 'x2': 6, - 'y1': 0.5, - 'y2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'x1': 0, - 'x2': 6, - 'y1': 0.9, - 'y2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/rug/test/fixtures/vtree.orientation_right.js b/components/svg/rug/test/fixtures/vtree.orientation_right.js deleted file mode 100644 index 083bff6..0000000 --- a/components/svg/rug/test/fixtures/vtree.orientation_right.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'x1': 0, - 'x2': -6, - 'y1': 0.1, - 'y2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'x1': 0, - 'x2': -6, - 'y1': 0.5, - 'y2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'x1': 0, - 'x2': -6, - 'y1': 0.9, - 'y2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/rug/test/fixtures/vtree.orientation_top.js b/components/svg/rug/test/fixtures/vtree.orientation_top.js deleted file mode 100644 index 7f7d211..0000000 --- a/components/svg/rug/test/fixtures/vtree.orientation_top.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': 6, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': 6, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': 6, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/rug/test/fixtures/vtree.scale.js b/components/svg/rug/test/fixtures/vtree.scale.js deleted file mode 100644 index 3934d43..0000000 --- a/components/svg/rug/test/fixtures/vtree.scale.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 1.0, - 'x2': 1.0 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 5.0, - 'x2': 5.0 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -6, - 'x1': 9.0, - 'x2': 9.0 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/rug/test/fixtures/vtree.size.js b/components/svg/rug/test/fixtures/vtree.size.js deleted file mode 100644 index 91d52ce..0000000 --- a/components/svg/rug/test/fixtures/vtree.size.js +++ /dev/null @@ -1,125 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -var vtree = { - 'tagName': 'g', - 'properties': { - 'property': 'rug', - 'className': 'rug', - 'namespace': void 0 - }, - 'children': [ - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -12, - 'x1': 0.1, - 'x2': 0.1 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -12, - 'x1': 0.5, - 'x2': 0.5 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - }, - { - 'tagName': 'line', - 'properties': { - 'property': 'rug.tick', - 'className': 'tick', - 'attributes': { - 'fill': 'none', - 'opacity': 0.9, - 'stroke': '#aaa', - 'stroke-width': 1, - 'data-label': '', - 'y1': 0, - 'y2': -12, - 'x1': 0.9, - 'x2': 0.9 - }, - 'namespace': void 0 - }, - 'children': [], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 0, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 - } - ], - 'namespace': 'http://www.w3.org/2000/svg', - 'count': 3, - 'hasWidgets': false, - 'hasThunks': false, - 'descendantHooks': false, - 'hooks': void 0, - 'key': void 0 -}; - - -// EXPORTS // - -module.exports = vtree; diff --git a/components/svg/rug/test/test.auto_render.js b/components/svg/rug/test/test.auto_render.js deleted file mode 100644 index 3cf3f17..0000000 --- a/components/svg/rug/test/test.auto_render.js +++ /dev/null @@ -1,172 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `autoRender` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.autoRender = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false - }); - t.strictEqual( node.autoRender, false, 'returns expected value' ); - - node.autoRender = true; - t.strictEqual( node.autoRender, true, 'returns expected value' ); - - node.autoRender = false; - t.strictEqual( node.autoRender, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'if `autoRender` is `true`, when a returned instance receives a `change` event, it re-renders and emits a `render` event', function test( t ) { - var node = ctor({ - 'autoRender': true, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - node.on( 'render', onRender ); - node.emit( 'change' ); - - function onRender( obj ) { - t.ok( true, 'emits a render event' ); - t.deepEqual( obj, VTREE, 'provides virtual tree' ); - t.end(); - } -}); - -tape( 'if `autoRender` is `false`, when a returned instance receives a `change` event, it does not re-render or emit a `render` event', function test( t ) { - var node = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'autoRender': false - }); - node.on( 'render', onRender ); - node.emit( 'change' ); - t.pass( 'is ok' ); - t.end(); - - function onRender() { - t.fail( 'should never be invoked' ); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': true - }); - node.on( 'change', onChange ); - node.autoRender = false; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': false - }); - node.on( 'change', onChange ); - node.autoRender = true; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': true - }); - node.on( 'change', onChange ); - node.autoRender = true; - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': false - }); - node.on( 'change', onChange ); - node.autoRender = false; - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); diff --git a/components/svg/rug/test/test.color.js b/components/svg/rug/test/test.color.js deleted file mode 100644 index 2dcf0f6..0000000 --- a/components/svg/rug/test/test.color.js +++ /dev/null @@ -1,294 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_COLOR_STRING = require( './fixtures/vtree.color_string.js' ); -var VTREE_COLOR_FCN = require( './fixtures/vtree.color_function.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `color` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - -3.14, - 3.14, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.color = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value (string)', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#abc' - }); - t.strictEqual( node.color(), '#abc', 'returns expected value' ); - - node.color = '#cba'; - t.strictEqual( node.color(), '#cba', 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance supports setting and getting the property value (function)', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'color': color1 - }); - t.strictEqual( node.color, color1, 'returns expected value' ); - - node.color = color2; - t.strictEqual( node.color, color2, 'returns expected value' ); - - t.end(); - - function color1() { - // no-op... - } - - function color2() { - // no-op... - } -}); - -tape( 'a color function is provided two arguments: datum and index', function test( t ) { - var expected; - var actual; - var node; - - node = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'color': color, - 'autoRender': false - }); - - expected = [ - [ 0.10, 0 ], - [ 0.50, 1 ], - [ 0.90, 2 ] - ]; - actual = []; - - node.render(); - - t.deepEqual( actual, expected, 'provides expected arguments' ); - t.end(); - - function color( d, i ) { - actual.push( [ d, i ] ); - } -}); - -tape( 'setting the `color` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'color': '#aaa' - }); - node.on( 'change', onChange ); - node.color = '#fff'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `color` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'color': '#aaa' - }); - node.on( 'change', onChange ); - node.color = color; - - function color() { - return '#fff'; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `color` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'color': color - }); - node.on( 'change', onChange ); - node.color = '#aaa'; - - function color() { - return '#fff'; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `color` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'color': color1 - }); - node.on( 'change', onChange ); - node.color = color2; - - function color1() { - return '#fff'; - } - - function color2() { - return '#aaa'; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `color` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'color': '#aaa' - }); - node.on( 'change', onChange ); - node.color = '#aaa'; - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `color` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'color': color - }); - node.on( 'change', onChange ); - node.color = color; - t.pass( 'is ok' ); - t.end(); - - function color() { - return '#fff'; - } - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'the value of the color property determines the tick (tassel) color (string)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.color = '#fff'; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_COLOR_STRING, 'expected virtual tree' ); - t.end(); -}); - -tape( 'the value of the color property determines the tick (tassel) color (function)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.color = color; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_COLOR_FCN, 'expected virtual tree' ); - t.end(); - - function color( d ) { - if ( d === 0.10 ) { - return '#ffa'; - } - if ( d === 0.50 ) { - return '#ffb'; - } - return '#ffc'; - } -}); diff --git a/components/svg/rug/test/test.data.js b/components/svg/rug/test/test.data.js deleted file mode 100644 index fb29b52..0000000 --- a/components/svg/rug/test/test.data.js +++ /dev/null @@ -1,138 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_DATA = require( './fixtures/vtree.data.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `data` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.data = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'data': [ 0.10, 0.50, 0.90 ] - }); - t.deepEqual( node.data, [ 0.10, 0.50, 0.90 ], 'returns expected value' ); - - node.data = [ 0.15, 0.55, 0.95 ]; - t.deepEqual( node.data, [ 0.15, 0.55, 0.95 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `data` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': false, - 'data': [ 0.10, 0.50, 0.90 ] - }); - node.on( 'change', onChange ); - node.data = [ 0.10, 0.50, 0.90 ]; // new reference - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `data` property to an existing value triggers a `change` event', function test( t ) { - var node; - var data; - - data = [ 0.10, 0.50, 0.90 ]; - node = ctor({ - 'autoRender': false, - 'data': data - }); - node.on( 'change', onChange ); - node.data = data; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'the value of the `data` property determines the tick (tassel) location', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.data = [ 0.15, 0.55, 0.95 ]; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_DATA, 'expected virtual tree' ); - t.end(); -}); diff --git a/components/svg/rug/test/test.is_defined.js b/components/svg/rug/test/test.is_defined.js deleted file mode 100644 index 6475cf0..0000000 --- a/components/svg/rug/test/test.is_defined.js +++ /dev/null @@ -1,193 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_IS_DEFINED = require( './fixtures/vtree.is_defined.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `isDefined` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.isDefined = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'isDefined': isDefined1 - }); - t.deepEqual( node.isDefined, isDefined1, 'returns expected value' ); - - node.isDefined = isDefined2; - t.deepEqual( node.isDefined, isDefined2, 'returns expected value' ); - - t.end(); - - function isDefined1() { - // no-op... - } - - function isDefined2() { - // no-op... - } -}); - -tape( 'an accessor function is provided two arguments: datum and index', function test( t ) { - var expected; - var actual; - var node; - - node = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'isDefined': isDefined, - 'autoRender': false - }); - - expected = [ - [ 0.10, 0 ], - [ 0.50, 1 ], - [ 0.90, 2 ] - ]; - actual = []; - - node.render(); - - t.deepEqual( actual, expected, 'provides expected arguments' ); - t.end(); - - function isDefined( d, i ) { - actual.push( [ d, i ] ); - } -}); - -tape( 'setting the `isDefined` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': false, - 'isDefined': isDefined1 - }); - node.on( 'change', onChange ); - node.isDefined = isDefined2; - - function isDefined1() { - // no-op... - } - - function isDefined2() { - // no-op... - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `isDefined` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': false, - 'isDefined': isDefined - }); - node.on( 'change', onChange ); - node.isDefined = isDefined; - t.pass( 'is ok' ); - t.end(); - - function isDefined() { - // no-op... - } - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'the value returned by the `isDefined` accessor determines whether a tick is rendered', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'isDefined': isDefined1, - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.isDefined = isDefined2; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_IS_DEFINED, 'expected virtual tree' ); - t.end(); - - function isDefined1( d ) { - return ( d === d ); - } - - function isDefined2( d ) { - return ( d !== 0.50 ); - } -}); diff --git a/components/svg/rug/test/test.js b/components/svg/rug/test/test.js deleted file mode 100644 index 2e3ace3..0000000 --- a/components/svg/rug/test/test.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var tape = require( 'tape' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var Rug = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Rug, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function is a constructor', function test( t ) { - var node = new Rug(); - t.strictEqual( instanceOf( node, Rug ), true, 'is an instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` operator', function test( t ) { - var ctor; - var node; - - ctor = Rug; - node = ctor(); - - t.strictEqual( instanceOf( node, Rug ), true, 'is an instance' ); - t.end(); -}); - -tape( 'the returned instance is an event emitter', function test( t ) { - var node = new Rug(); - t.strictEqual( instanceOf( node, EventEmitter ), true, 'is an event emitter' ); - t.end(); -}); diff --git a/components/svg/rug/test/test.label.js b/components/svg/rug/test/test.label.js deleted file mode 100644 index b8e46a1..0000000 --- a/components/svg/rug/test/test.label.js +++ /dev/null @@ -1,294 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_LABEL_STRING = require( './fixtures/vtree.label_string.js' ); -var VTREE_LABEL_FCN = require( './fixtures/vtree.label_function.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `label` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - -3.14, - 3.14, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.label = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value (string)', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'label': 'beep' - }); - t.strictEqual( node.label(), 'beep', 'returns expected value' ); - - node.label = 'boop'; - t.strictEqual( node.label(), 'boop', 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance supports setting and getting the property value (function)', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'label': label1 - }); - t.strictEqual( node.label, label1, 'returns expected value' ); - - node.label = label2; - t.strictEqual( node.label, label2, 'returns expected value' ); - - t.end(); - - function label1() { - // no-op... - } - - function label2() { - // no-op... - } -}); - -tape( 'a label function is provided two arguments: datum and index', function test( t ) { - var expected; - var actual; - var node; - - node = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'label': label, - 'autoRender': false - }); - - expected = [ - [ 0.10, 0 ], - [ 0.50, 1 ], - [ 0.90, 2 ] - ]; - actual = []; - - node.render(); - - t.deepEqual( actual, expected, 'provides expected arguments' ); - t.end(); - - function label( d, i ) { - actual.push( [ d, i ] ); - } -}); - -tape( 'setting the `label` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'label': 'beep' - }); - node.on( 'change', onChange ); - node.label = 'boop'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'label': 'beep' - }); - node.on( 'change', onChange ); - node.label = label; - - function label() { - return 'boop'; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'label': label - }); - node.on( 'change', onChange ); - node.label = 'boop'; - - function label() { - return 'beep'; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'label': label1 - }); - node.on( 'change', onChange ); - node.label = label2; - - function label1() { - return 'beep'; - } - - function label2() { - return 'boop'; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'label': 'beep' - }); - node.on( 'change', onChange ); - node.label = 'beep'; - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `label` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'label': label - }); - node.on( 'change', onChange ); - node.label = label; - t.pass( 'is ok' ); - t.end(); - - function label() { - return 'beep'; - } - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'the value of the label property determines the tick data label (string)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.label = 'beep'; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_LABEL_STRING, 'expected virtual tree' ); - t.end(); -}); - -tape( 'the value of the label property determines the tick data label (function)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.label = label; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_LABEL_FCN, 'expected virtual tree' ); - t.end(); - - function label( d ) { - if ( d === 0.10 ) { - return 'beep'; - } - if ( d === 0.50 ) { - return 'boop'; - } - return 'bop'; - } -}); diff --git a/components/svg/rug/test/test.opacity.js b/components/svg/rug/test/test.opacity.js deleted file mode 100644 index 4fc5a55..0000000 --- a/components/svg/rug/test/test.opacity.js +++ /dev/null @@ -1,314 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_OPACITY_NUM = require( './fixtures/vtree.opacity_number.js' ); -var VTREE_OPACITY_FCN = require( './fixtures/vtree.opacity_function.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `opacity` value', function test( t ) { - var values; - var i; - - values = [ - '5', - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.opacity = value; - }; - } -}); - -tape( 'an instance throws a range error if provided an `opacity` value which is not on the interval `[0,1]`', function test( t ) { - var values; - var i; - - values = [ - -3.14, - 3.14, - NaN - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.opacity = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value (number)', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'opacity': 0.9 - }); - t.strictEqual( node.opacity(), 0.9, 'returns expected value' ); - - node.opacity = 0.5; - t.strictEqual( node.opacity(), 0.5, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance supports setting and getting the property value (function)', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'opacity': opacity1 - }); - t.strictEqual( node.opacity, opacity1, 'returns expected value' ); - - node.opacity = opacity2; - t.strictEqual( node.opacity, opacity2, 'returns expected value' ); - - t.end(); - - function opacity1() { - // no-op... - } - - function opacity2() { - // no-op... - } -}); - -tape( 'an opacity function is provided two arguments: datum and index', function test( t ) { - var expected; - var actual; - var node; - - node = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'opacity': opacity, - 'autoRender': false - }); - - expected = [ - [ 0.10, 0 ], - [ 0.50, 1 ], - [ 0.90, 2 ] - ]; - actual = []; - - node.render(); - - t.deepEqual( actual, expected, 'provides expected arguments' ); - t.end(); - - function opacity( d, i ) { - actual.push( [ d, i ] ); - } -}); - -tape( 'setting the `opacity` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'opacity': 0.9 - }); - node.on( 'change', onChange ); - node.opacity = 0.1; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `opacity` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'opacity': 0.9 - }); - node.on( 'change', onChange ); - node.opacity = opacity; - - function opacity() { - return 0.1; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `opacity` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'opacity': opacity - }); - node.on( 'change', onChange ); - node.opacity = 0.9; - - function opacity() { - return 0.1; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `opacity` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'opacity': opacity1 - }); - node.on( 'change', onChange ); - node.opacity = opacity2; - - function opacity1() { - return 0.9; - } - - function opacity2() { - return 0.1; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `opacity` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'opacity': 0.9 - }); - node.on( 'change', onChange ); - node.opacity = 0.9; - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `opacity` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'opacity': opacity - }); - node.on( 'change', onChange ); - node.opacity = opacity; - t.pass( 'is ok' ); - t.end(); - - function opacity() { - return 0.9; - } - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'the value of the `opacity` property determines the tick (tassel) opacity (number)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.opacity = 0.1; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_OPACITY_NUM, 'expected virtual tree' ); - t.end(); -}); - -tape( 'the value of the `opacity` property determines the tick (tassel) opacity (function)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.opacity = opacity; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_OPACITY_FCN, 'expected virtual tree' ); - t.end(); - - function opacity( d ) { - if ( d === 0.10 ) { - return 0.25; - } - if ( d === 0.50 ) { - return 0.5; - } - return 0.75; - } -}); diff --git a/components/svg/rug/test/test.orientation.js b/components/svg/rug/test/test.orientation.js deleted file mode 100644 index be1b1e9..0000000 --- a/components/svg/rug/test/test.orientation.js +++ /dev/null @@ -1,219 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_ORIENTATION_TOP = require( './fixtures/vtree.orientation_top.js' ); -var VTREE_ORIENTATION_RIGHT = require( './fixtures/vtree.orientation_right.js' ); -var VTREE_ORIENTATION_LEFT = require( './fixtures/vtree.orientation_left.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `orientation` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'toppy', - 'lefty', - 'righty', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.orientation = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'orientation': 'bottom' - }); - t.strictEqual( node.orientation, 'bottom', 'returns expected value' ); - - node.orientation = 'left'; - t.strictEqual( node.orientation, 'left', 'returns expected value' ); - - node.orientation = 'right'; - t.strictEqual( node.orientation, 'right', 'returns expected value' ); - - node.orientation = 'top'; - t.strictEqual( node.orientation, 'top', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `orientation` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'orientation': 'bottom' - }); - node.on( 'change', onChange ); - node.orientation = 'right'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `orientation` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'orientation': 'bottom' - }); - node.on( 'change', onChange ); - node.orientation = 'bottom'; - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'the value of the `orientation` property determines the tick (tassel) orientation (top)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.orientation = 'top'; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_ORIENTATION_TOP, 'expected virtual tree' ); - t.end(); -}); - -tape( 'the value of the `orientation` property determines the tick (tassel) orientation (right)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.orientation = 'right'; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_ORIENTATION_RIGHT, 'expected virtual tree' ); - t.end(); -}); - -tape( 'the value of the `orientation` property determines the tick (tassel) orientation (left)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.orientation = 'left'; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_ORIENTATION_LEFT, 'expected virtual tree' ); - t.end(); -}); - -tape( 'the value of the `orientation` property determines the tick (tassel) orientation (bottom)', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'top', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE_ORIENTATION_TOP, 'default behavior' ); - - node.orientation = 'bottom'; - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'expected virtual tree' ); - t.end(); -}); diff --git a/components/svg/rug/test/test.render.js b/components/svg/rug/test/test.render.js deleted file mode 100644 index 8e490c2..0000000 --- a/components/svg/rug/test/test.render.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the `render` method returns a rendered virtual tree', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'returns a virtual tree' ); - t.end(); -}); diff --git a/components/svg/rug/test/test.scale.js b/components/svg/rug/test/test.scale.js deleted file mode 100644 index f68345c..0000000 --- a/components/svg/rug/test/test.scale.js +++ /dev/null @@ -1,188 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_SCALE = require( './fixtures/vtree.scale.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `scale` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.scale = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'scale': scale1 - }); - t.deepEqual( node.scale, scale1, 'returns expected value' ); - - node.scale = scale2; - t.deepEqual( node.scale, scale2, 'returns expected value' ); - - t.end(); - - function scale1() { - // no-op... - } - - function scale2() { - // no-op... - } -}); - -tape( 'a scale function is provided one argument: datum', function test( t ) { - var expected; - var actual; - var node; - - node = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'scale': scale, - 'autoRender': false - }); - - expected = [ - 0.10, - 0.50, - 0.90 - ]; - actual = []; - - node.render(); - - t.deepEqual( actual, expected, 'provides expected arguments' ); - t.end(); - - function scale( d ) { - actual.push( d ); - } -}); - -tape( 'setting the `scale` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': false, - 'scale': scale1 - }); - node.on( 'change', onChange ); - node.scale = scale2; - - function scale1() { - // no-op... - } - - function scale2() { - // no-op... - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `scale` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'autoRender': false, - 'scale': scale - }); - node.on( 'change', onChange ); - node.scale = scale; - t.pass( 'is ok' ); - t.end(); - - function scale() { - // no-op... - } - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'a scale function maps each data value to a corresponding coordinate value', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.scale = scale; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_SCALE, 'expected virtual tree' ); - t.end(); - - function scale( d ) { - return d * 10.0; - } -}); diff --git a/components/svg/rug/test/test.size.js b/components/svg/rug/test/test.size.js deleted file mode 100644 index 4fe7d91..0000000 --- a/components/svg/rug/test/test.size.js +++ /dev/null @@ -1,136 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// FIXTURES // - -var VTREE = require( './fixtures/vtree.js' ); -var VTREE_SIZE = require( './fixtures/vtree.size.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `size` value', function test( t ) { - var values; - var i; - - values = [ - '5', - NaN, - -3.14, - 3.14, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor(); - node.size = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var node; - - node = ctor({ - 'autoRender': false, - 'size': 6 - }); - t.strictEqual( node.size, 6, 'returns expected value' ); - - node.size = 12; - t.strictEqual( node.size, 12, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `size` property triggers a `change` event', function test( t ) { - var node = ctor({ - 'size': 6 - }); - node.on( 'change', onChange ); - node.size = 12; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `size` property to an existing value does not trigger a `change` event', function test( t ) { - var node = ctor({ - 'size': 6 - }); - node.on( 'change', onChange ); - node.size = 6; - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'the value of the `size` property determines the tick (tassel) size', function test( t ) { - var vtree; - var node; - - node = ctor({ - 'autoRender': false, - 'color': '#aaa', - 'data': [ 0.10, 0.50, 0.90 ], - 'label': '', - 'opacity': 0.9, - 'orientation': 'bottom', - 'size': 6 - }); - vtree = node.render(); - - t.deepEqual( vtree, VTREE, 'default behavior' ); - - node.size = 12; - vtree = node.render(); - - t.deepEqual( vtree, VTREE_SIZE, 'expected virtual tree' ); - t.end(); -}); diff --git a/components/svg/rug/test/test.validation.js b/components/svg/rug/test/test.validation.js deleted file mode 100644 index 9a05709..0000000 --- a/components/svg/rug/test/test.validation.js +++ /dev/null @@ -1,371 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the constructor throws an error if provided an `options` argument which is not an object', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor( value ); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `autoRender` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'autoRender': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `color` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - -3.14, - 3.14, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'color': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `data` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'data': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `isDefined` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'isDefined': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `label` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - -3.14, - 3.14, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'label': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `opacity` option', function test( t ) { - var values; - var i; - - values = [ - '5', - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'opacity': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws a range error if provided an `opacity` option which is not on the interval `[0,1]`', function test( t ) { - var values; - var i; - - values = [ - -3.14, - 3.14, - NaN - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'opacity': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `orientation` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'toppy', - 'lefty', - 'righty', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'orientation': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `scale` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'scale': value - }); - return node; - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid `size` option', function test( t ) { - var values; - var i; - - values = [ - '5', - NaN, - -3.14, - 3.14, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var node = ctor({ - 'size': value - }); - return node; - }; - } -}); diff --git a/components/svg/symbols/examples/index.js b/components/svg/symbols/examples/index.js deleted file mode 100644 index 0e9b2d9..0000000 --- a/components/svg/symbols/examples/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var symbols = require( './../lib' ); - -// Create a new symbols component: -var sym = symbols({ - 'x': [0.10, 0.50, 0.90], - 'y': [0.43, 0.37, 0.53], - 'symbol': 'open-circle', - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = sym.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -sym.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - sym.y = [0.99, 0.87, 0.92]; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/components/svg/symbols/lib/accessors/is_defined.js b/components/svg/symbols/lib/accessors/is_defined.js deleted file mode 100644 index 347f00b..0000000 --- a/components/svg/symbols/lib/accessors/is_defined.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isnan = require( '@stdlib/assert/is-nan' ).isPrimitive; - - -// VARIABLES // - -var debug = logger( 'symbols:accessor:is-defined' ); - - -// MAIN // - -/** -* Accessor function which determines whether a datum is defined. -* -* @private -* @param {number} d - datum -* @returns {boolean} boolean indicating whether a datum is defined -*/ -function isDefined( d ) { - var bool = !isnan( d ); - debug( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool ); - return bool; -} - - -// EXPORTS // - -module.exports = isDefined; diff --git a/components/svg/symbols/lib/defaults.json b/components/svg/symbols/lib/defaults.json deleted file mode 100644 index 76679ca..0000000 --- a/components/svg/symbols/lib/defaults.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "autoRender": false, - "color": "#000", - "isDefined": null, - "label": "", - "opacity": 0.9, - "size": 6, - "symbol": "closed-circle", - "x": [], - "xScale": null, - "y": [], - "yScale": null -} diff --git a/components/svg/symbols/lib/index.js b/components/svg/symbols/lib/index.js deleted file mode 100644 index c9deaf3..0000000 --- a/components/svg/symbols/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* SVG symbols. -* -* @module @stdlib/plot/components/svg/symbols -* -* @example -* var Symbols = require( '@stdlib/plot/components/svg/symbols' ); -* -* var symbols = new Symbols({ -* 'x': [0.1,0.2,0.3], -* 'y': [0.4,0.5,0.6] -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/components/svg/symbols/lib/main.js b/components/svg/symbols/lib/main.js deleted file mode 100644 index 0aeb8ca..0000000 --- a/components/svg/symbols/lib/main.js +++ /dev/null @@ -1,521 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// TODO: improve JSDoc examples - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var linear = require( 'd3-scale' ).scaleLinear; // TODO: remove -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var format = require( '@stdlib/string/format' ); -var copy = require( '@stdlib/utils/copy' ); -var merge = require( '@stdlib/utils/merge' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var isDefined = require( './accessors/is_defined.js' ); -var defaults = require( './defaults.json' ); -var setSymbol = require( './props/symbol/set.js' ); -var getSymbol = require( './props/symbol/get.js' ); -var setX = require( './props/x/set.js' ); -var getX = require( './props/x/get.js' ); -var setY = require( './props/y/set.js' ); -var getY = require( './props/y/get.js' ); -var setXScale = require( './props/x-scale/set.js' ); -var getXScale = require( './props/x-scale/get.js' ); -var setYScale = require( './props/y-scale/set.js' ); -var getYScale = require( './props/y-scale/get.js' ); -var setIsDefined = require( './props/is-defined/set.js' ); -var getIsDefined = require( './props/is-defined/get.js' ); -var setSize = require( './props/size/set.js' ); -var getSize = require( './props/size/get.js' ); -var setOpacity = require( './props/opacity/set.js' ); -var getOpacity = require( './props/opacity/get.js' ); -var setColor = require( './props/color/set.js' ); -var getColor = require( './props/color/get.js' ); -var setLabel = require( './props/label/set.js' ); -var getLabel = require( './props/label/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var getXPos = require( './props/x-pos/get.js' ); -var getYPos = require( './props/y-pos/get.js' ); -var render = require( './render' ); - - -// VARIABLES // - -var debug = logger( 'symbols:main' ); -var PRIVATE_PROPS = [ - '_autoRender', - '_color', - '_isDefined', - '_label', - '_opacity', - '_size', - '_symbol', - '_xData', - '_xScale', - '_yData', - '_yScale' -]; - - -// MAIN // - -/** -* Symbols constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {ArrayLike} [options.x=[]] - x-values -* @param {ArrayLike} [options.y=[]] - y-values -* @param {Function} [options.xScale] - x scale function -* @param {Function} [options.yScale] - y scale function -* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined -* @param {string} [options.symbol='closed-circle'] - symbol -* @param {(number|Function)} [options.opacity=0.9] - opacity -* @param {(string|Function)} [options.color] - color -* @param {(string|Function)} [options.label] - label -* @param {(NonNegativeInteger|Function)} [options.size=6] - symbol size -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Symbols} Symbols instance -* -* @example -* var symbols = new Symbols({ -* 'x': [0.1,0.2,0.3], -* 'y': [0.4,0.5,0.6] -* }); -*/ -function Symbols( options ) { - var self; - var keys; - var opts; - var key; - var i; - if ( !( this instanceof Symbols ) ) { - if ( arguments.length ) { - return new Symbols( options ); - } - return new Symbols(); - } - self = this; - - opts = copy( defaults ); - opts.isDefined = isDefined; - opts.xScale = linear(); - opts.yScale = linear(); - - if ( arguments.length ) { - if ( !isObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - opts = merge( opts, options ); - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { - defineProperty( this, PRIVATE_PROPS[i], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - }); - } - // Set options... - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - this[ key ] = opts[ key ]; - } - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Symbols.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Symbols.prototype.constructor = Symbols; - -/** -* Symbol. -* -* @name symbol -* @memberof Symbols.prototype -* @type {string} -* @throws {TypeError} must be a supported symbol -* @default 'closed-circle' -* -* @example -* var symbols = new Symbols({ -* 'symbol': 'open-circle' -* }); -* -* var symbol = symbols.symbol; -* // returns 'open-circle' -*/ -defineProperty( Symbols.prototype, 'symbol', { - 'configurable': false, - 'enumerable': true, - 'set': setSymbol, - 'get': getSymbol -}); - -/** -* `x` values. -* -* @name x -* @memberof Symbols.prototype -* @type {ArrayLike} -* @throws {TypeError} must be array-like -* @default [] -* -* @example -* var symbols = new Symbols({ -* 'x': [0.1,0.2,0.3] -* }); -* -* var x = symbols.x; -* // returns [0.1,0.2,0.3] -*/ -defineProperty( Symbols.prototype, 'x', { - 'configurable': false, - 'enumerable': true, - 'set': setX, - 'get': getX -}); - -/** -* `y` values. -* -* @name y -* @memberof Symbols.prototype -* @type {ArrayLike} -* @throws {TypeError} must be array-like -* @default [] -* -* @example -* var symbols = new Symbols({ -* 'y': [0.4,0.5,0.6] -* }); -* -* var y = symbols.y; -* // returns [0.4,0.5,0.6] -*/ -defineProperty( Symbols.prototype, 'y', { - 'configurable': false, - 'enumerable': true, - 'set': setY, - 'get': getY -}); - -/** -* `x` scale function. -* -* @name xScale -* @memberof Symbols.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var symbols = new Symbols({ -* 'xScale': function scale(){} -* }); -* -* var f = symbols.xScale; -* // returns -*/ -defineProperty( Symbols.prototype, 'xScale', { - 'configurable': false, - 'enumerable': true, - 'set': setXScale, - 'get': getXScale -}); - -/** -* `y` scale function. -* -* @name yScale -* @memberof Symbols.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var symbols = new Symbols({ -* 'yScale': function scale(){} -* }); -* -* var f = symbols.yScale; -* // returns -*/ -defineProperty( Symbols.prototype, 'yScale', { - 'configurable': false, - 'enumerable': true, - 'set': setYScale, - 'get': getYScale -}); - -/** -* Accessor which defines whether a datum is defined. This accessor is used to define how missing values are encoded. The default behavior is to ignore values which are `NaN`. -* -* @name isDefined -* @memberof Symbols.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* var symbols = new Symbols(); -* symbols.isDefined = function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* -* @example -* function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* var symbols = new Symbols({ -* 'isDefined': isDefined -* }); -* var fcn = symbols.isDefined; -* // returns -*/ -defineProperty( Symbols.prototype, 'isDefined', { - 'configurable': false, - 'enumerable': true, - 'set': setIsDefined, - 'get': getIsDefined -}); - -/** -* Symbol size. When retrieved, the returned value is a size accessor. -* -* @name size -* @memberof Symbols.prototype -* @type {(NonNegativeInteger|Function)} -* @throws {TypeError} must be a nonnegative integer or function -* @default 6 -* -* @example -* var symbols = new Symbols({ -* 'size': 5 -* }); -* -* var size = symbols.size; -* // returns -*/ -defineProperty( Symbols.prototype, 'size', { - 'configurable': false, - 'enumerable': true, - 'set': setSize, - 'get': getSize -}); - -/** -* Symbol opacity. When retrieved, the returned value is an opacity accessor. -* -* @name opacity -* @memberof Symbols.prototype -* @type {(number|Function)} -* @throws {TypeError} must be a number or function -* @throws {RangeError} must be a number on the interval `[0,1]` -* @default 0.9 -* -* @example -* var symbols = new Symbols({ -* 'opacity': 0.5 -* }); -* -* var opacity = symbols.opacity; -* // returns -*/ -defineProperty( Symbols.prototype, 'opacity', { - 'configurable': false, - 'enumerable': true, - 'set': setOpacity, - 'get': getOpacity -}); - -/** -* Symbols color. When retrieved, the returned value is a color accessor. -* -* @name color -* @memberof Symbols.prototype -* @type {(string|Function)} -* @throws {TypeError} must be a string or function -* -* @example -* var symbols = new Symbols({ -* 'color': 'steelblue' -* }); -* -* var color = symbols.color; -* // returns -*/ -defineProperty( Symbols.prototype, 'color', { - 'configurable': false, - 'enumerable': true, - 'set': setColor, - 'get': getColor -}); - -/** -* Symbols label. When retrieved, the returned value is a label accessor. -* -* @name label -* @memberof Symbols.prototype -* @type {(string|Function)} -* @throws {TypeError} must be a string or function -* -* @example -* var symbols = new Symbols({ -* 'label': 'group-1' -* }); -* -* var label = symbols.label; -* // returns -*/ -defineProperty( Symbols.prototype, 'label', { - 'configurable': false, - 'enumerable': true, - 'set': setLabel, - 'get': getLabel -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Symbols.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var symbols = new Symbols({ -* 'autoRender': true -* }); -* -* var mode = symbols.autoRender; -* // returns true -*/ -defineProperty( Symbols.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Function to map values to x coordinate values. -* -* @name xPos -* @memberof Symbols.prototype -* @type {Function} -* -* @example -* var symbols = new Symbols(); -* var xPos = symbols.xPos; -* // returns -*/ -defineProperty( Symbols.prototype, 'xPos', { - 'configurable': false, - 'enumerable': true, - 'get': getXPos -}); - -/** -* Function to map values to y coordinate values. -* -* @name yPos -* @memberof Symbols.prototype -* @type {Function} -* -* @example -* var symbols = new Symbols(); -* var yPos = symbols.yPos; -* // returns -*/ -defineProperty( Symbols.prototype, 'yPos', { - 'configurable': false, - 'enumerable': true, - 'get': getYPos -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Symbols.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var symbols = new Symbols(); -* -* var out = symbols.render(); -*/ -setReadOnly( Symbols.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Symbols; diff --git a/components/svg/symbols/lib/props/auto-render/get.js b/components/svg/symbols/lib/props/auto-render/get.js deleted file mode 100644 index 7df40de..0000000 --- a/components/svg/symbols/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/symbols/lib/props/auto-render/set.js b/components/svg/symbols/lib/props/auto-render/set.js deleted file mode 100644 index 8509b85..0000000 --- a/components/svg/symbols/lib/props/auto-render/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:auto-render' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/symbols/lib/props/color/get.js b/components/svg/symbols/lib/props/color/get.js deleted file mode 100644 index e087bef..0000000 --- a/components/svg/symbols/lib/props/color/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get a symbol's color. -* -* @private -* @returns {Function} color accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isString( this._color ) ) { - return color; - } - return this._color; - - /** - * Returns the color. - * - * @private - * @returns {string} color - */ - function color() { - return self._color; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/symbols/lib/props/color/set.js b/components/svg/symbols/lib/props/color/set.js deleted file mode 100644 index e72fcb1..0000000 --- a/components/svg/symbols/lib/props/color/set.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:color' ); - - -// MAIN // - -/** -* Sets the color. -* -* @private -* @param {(string|Function)} color - color -* @throws {TypeError} must be a string or function -*/ -function set( color ) { - /* eslint-disable no-invalid-this */ - if ( - !isString( color ) && - !isFunction( color ) - ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or a function. Value: `%s`.', 'color', color ) ); - } - debug( 'Current value: %d.', this._color ); - - this._color = color; - debug( 'New Value: %d.', this._color ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/symbols/lib/props/is-defined/get.js b/components/svg/symbols/lib/props/is-defined/get.js deleted file mode 100644 index fd05f22..0000000 --- a/components/svg/symbols/lib/props/is-defined/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the accessor for defined values. -* -* @private -* @returns {Function} accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._isDefined; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/symbols/lib/props/is-defined/set.js b/components/svg/symbols/lib/props/is-defined/set.js deleted file mode 100644 index 8c44937..0000000 --- a/components/svg/symbols/lib/props/is-defined/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:is-defined' ); - - -// MAIN // - -/** -* Sets the accessor for defined values. -* -* @private -* @param {Function} fcn - accessor -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'isDefined', fcn ) ); - } - debug( 'Current value: %s.', this._isDefined ); - - this._isDefined = fcn; - debug( 'New Value: %s.', this._isDefined ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/symbols/lib/props/label/get.js b/components/svg/symbols/lib/props/label/get.js deleted file mode 100644 index 8aa635d..0000000 --- a/components/svg/symbols/lib/props/label/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get a symbol's label. -* -* @private -* @returns {Function} label accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isString( this._label ) ) { - return label; - } - return this._label; - - /** - * Returns the label. - * - * @private - * @returns {string} label - */ - function label() { - return self._label; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/symbols/lib/props/label/set.js b/components/svg/symbols/lib/props/label/set.js deleted file mode 100644 index 698c3f2..0000000 --- a/components/svg/symbols/lib/props/label/set.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:label' ); - - -// MAIN // - -/** -* Sets the label. -* -* @private -* @param {(string|Function)} label - label -* @throws {TypeError} must be a string or a function -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( - !isString( label ) && - !isFunction( label ) - ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or a function. Value: `%s`.', 'label', label ) ); - } - debug( 'Current value: %d.', this._label ); - - this._label = label; - debug( 'New Value: %d.', this._label ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/symbols/lib/props/opacity/get.js b/components/svg/symbols/lib/props/opacity/get.js deleted file mode 100644 index bc8833f..0000000 --- a/components/svg/symbols/lib/props/opacity/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get a symbol's opacity. -* -* @private -* @returns {Function} opacity accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isNumber( this._opacity ) ) { - return opacity; - } - return this._opacity; - - /** - * Returns the opacity. - * - * @private - * @returns {number} opacity - */ - function opacity() { - return self._opacity; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/symbols/lib/props/opacity/set.js b/components/svg/symbols/lib/props/opacity/set.js deleted file mode 100644 index e718d22..0000000 --- a/components/svg/symbols/lib/props/opacity/set.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:opacity' ); - - -// MAIN // - -/** -* Sets the symbol opacity. -* -* @private -* @param {(number|Function)} opacity - opacity -* @throws {TypeError} must be a number or a function -* @throws {RangeError} must be a number on the interval `[0,1]` -*/ -function set( opacity ) { - /* eslint-disable no-invalid-this */ - var isNum = isNumber( opacity ); - if ( - !isNum && - !isFunction( opacity ) - ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number or a function. Value: `%s`.', 'opacity', opacity ) ); - } - if ( - isNum && - (opacity < 0.0 || opacity > 1.0) - ) { - throw new RangeError( format( 'invalid assignment. `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'opacity', opacity ) ); - } - debug( 'Current value: %d.', this._opacity ); - - this._opacity = opacity; - debug( 'New Value: %d.', this._opacity ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/symbols/lib/props/size/get.js b/components/svg/symbols/lib/props/size/get.js deleted file mode 100644 index 2958a6b..0000000 --- a/components/svg/symbols/lib/props/size/get.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; - - -// MAIN // - -/** -* Returns a function to get a symbol's size. -* -* @private -* @returns {Function} size accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - var self = this; - if ( isNumber( this._size ) ) { - return size; - } - return this._size; - - /** - * Returns the size. - * - * @private - * @returns {number} size - */ - function size() { - return self._size; // eslint-disable-line no-underscore-dangle - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/symbols/lib/props/size/set.js b/components/svg/symbols/lib/props/size/set.js deleted file mode 100644 index 1c4eef9..0000000 --- a/components/svg/symbols/lib/props/size/set.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:size' ); - - -// MAIN // - -/** -* Sets the symbol size. -* -* @private -* @param {(NonNegativeInteger|Function)} size - size -* @throws {TypeError} must be a nonnegative integer or a function -*/ -function set( size ) { - /* eslint-disable no-invalid-this */ - if ( - !isNonNegativeInteger( size ) && - !isFunction( size ) - ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or a function. Value: `%s`.', 'size', size ) ); - } - debug( 'Current value: %d.', this._size ); - - this._size = size; - debug( 'New Value: %d.', this._size ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/symbols/lib/props/symbol/get.js b/components/svg/symbols/lib/props/symbol/get.js deleted file mode 100644 index 54e9365..0000000 --- a/components/svg/symbols/lib/props/symbol/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the symbol. -* -* @private -* @returns {string} symbol -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._symbol; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/symbols/lib/props/symbol/set.js b/components/svg/symbols/lib/props/symbol/set.js deleted file mode 100644 index 6fd10f8..0000000 --- a/components/svg/symbols/lib/props/symbol/set.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var SYMBOLS = require( './symbols.json' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:symbol' ); - - -// MAIN // - -/** -* Sets the symbol. -* -* @private -* @param {string} symbol - symbol -* @throws {TypeError} must be a supported symbol -*/ -function set( symbol ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( SYMBOLS, symbol ) === -1 ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a supported symbol. Symbols: "%s". Value: `%s`.', 'symbol', SYMBOLS.join( '", "' ), symbol ) ); - } - debug( 'Current value: %d.', this._symbol ); - - this._symbol = symbol; - debug( 'New Value: %d.', this._symbol ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/symbols/lib/props/symbol/symbols.json b/components/svg/symbols/lib/props/symbol/symbols.json deleted file mode 100644 index 0f0345a..0000000 --- a/components/svg/symbols/lib/props/symbol/symbols.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "closed-circle", - "open-circle" -] diff --git a/components/svg/symbols/lib/props/x-pos/get.js b/components/svg/symbols/lib/props/x-pos/get.js deleted file mode 100644 index 75c92dc..0000000 --- a/components/svg/symbols/lib/props/x-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'symbols:xpos' ); - - -// MAIN // - -/** -* Returns a function to map values to x coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.xScale; - - return xPos; - /** - * Maps a value to a x coordinate value. - * - * @private - * @param {*} d - datum - * @returns {number} pixel value - */ - function xPos( d ) { - var px = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/symbols/lib/props/x-scale/get.js b/components/svg/symbols/lib/props/x-scale/get.js deleted file mode 100644 index a3ad33f..0000000 --- a/components/svg/symbols/lib/props/x-scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xScale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/symbols/lib/props/x-scale/set.js b/components/svg/symbols/lib/props/x-scale/set.js deleted file mode 100644 index bb7d9f4..0000000 --- a/components/svg/symbols/lib/props/x-scale/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:xscale' ); - - -// MAIN // - -/** -* Sets the x-scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'xScale', fcn ) ); - } - debug( 'Current value: %s.', this._xScale ); - - this._xScale = fcn; - debug( 'New Value: %s.', this._xScale ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/symbols/lib/props/x/get.js b/components/svg/symbols/lib/props/x/get.js deleted file mode 100644 index fcddeb2..0000000 --- a/components/svg/symbols/lib/props/x/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the `x` values. -* -* @private -* @returns {ArrayLike} x values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xData; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/symbols/lib/props/x/set.js b/components/svg/symbols/lib/props/x/set.js deleted file mode 100644 index fc654b8..0000000 --- a/components/svg/symbols/lib/props/x/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isArrayLike = require( '@stdlib/assert/is-array-like' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:x' ); - - -// MAIN // - -/** -* Sets the `x` values. -* -* @private -* @param {ArrayLike} x - x values -* @throws {TypeError} must be array-like -*/ -function set( x ) { - /* eslint-disable no-invalid-this */ - if ( !isArrayLike( x ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'x', x ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._xData ) ); - - this._xData = x; - debug( 'New Value: %s.', JSON.stringify( this._xData ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/symbols/lib/props/y-pos/get.js b/components/svg/symbols/lib/props/y-pos/get.js deleted file mode 100644 index d8bed7c..0000000 --- a/components/svg/symbols/lib/props/y-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'symbols:ypos' ); - - -// MAIN // - -/** -* Returns a function to map values to y coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.yScale; - return yPos; - - /** - * Maps a value to a y coordinate value. - * - * @private - * @param {*} d - datum - * @returns {number} pixel value - */ - function yPos( d ) { - var px = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/symbols/lib/props/y-scale/get.js b/components/svg/symbols/lib/props/y-scale/get.js deleted file mode 100644 index 83f782c..0000000 --- a/components/svg/symbols/lib/props/y-scale/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-scale function. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yScale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/symbols/lib/props/y-scale/set.js b/components/svg/symbols/lib/props/y-scale/set.js deleted file mode 100644 index 055b20f..0000000 --- a/components/svg/symbols/lib/props/y-scale/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:yscale' ); - - -// MAIN // - -/** -* Sets the y-scale function. -* -* @private -* @param {Function} fcn - scale -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'yScale', fcn ) ); - } - debug( 'Current value: %s.', this._yScale ); - - this._yScale = fcn; - debug( 'New Value: %s.', this._yScale ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/symbols/lib/props/y/get.js b/components/svg/symbols/lib/props/y/get.js deleted file mode 100644 index 459d022..0000000 --- a/components/svg/symbols/lib/props/y/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the `y` values. -* -* @private -* @returns {ArrayLike} y values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yData; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/symbols/lib/props/y/set.js b/components/svg/symbols/lib/props/y/set.js deleted file mode 100644 index 83be3a3..0000000 --- a/components/svg/symbols/lib/props/y/set.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isArrayLike = require( '@stdlib/assert/is-array-like' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'symbols:set:y' ); - - -// MAIN // - -/** -* Sets the `y` values. -* -* @private -* @param {ArrayLike} y - y values -* @throws {TypeError} must be array-like -*/ -function set( y ) { - /* eslint-disable no-invalid-this */ - if ( !isArrayLike( y ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'y', y ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._yData ) ); - - this._yData = y; - debug( 'New Value: %s.', JSON.stringify( this._yData ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/symbols/lib/render/closed_circles.js b/components/svg/symbols/lib/render/closed_circles.js deleted file mode 100644 index fcc6a30..0000000 --- a/components/svg/symbols/lib/render/closed_circles.js +++ /dev/null @@ -1,102 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'symbols:render:closed-circles' ); -var ELEMENT = 'circle'; - - -// MAIN // - -/** -* Renders data as a closed circles. -* -* @private -* @param {Object} state - state -* @returns {Array} array of virtual trees -*/ -function render( state ) { - var isDefined; - var opacity; - var label; - var color; - var props; - var size; - var xPos; - var yPos; - var out; - var xi; - var yi; - var x; - var y; - var i; - - debug( 'Rendering closed circles...' ); - - isDefined = state.isDefined; - opacity = state.opacity; - label = state.label; - color = state.color; - size = state.size; - xPos = state.xPos; - yPos = state.yPos; - x = state.x; - y = state.y; - - out = []; - for ( i = 0; i < x.length; i++ ) { - xi = x[ i ]; - yi = y[ i ]; - if ( !isDefined( xi ) || !isDefined( yi ) ) { - debug( 'Datum %d is undefined. [%s,%s].', i, xi, yi ); - continue; - } - debug( 'Rendering datum %d...', i ); - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'closed-circle', - 'className': 'closed-circle', - 'attributes': { - 'cx': xPos( xi ), - 'cy': yPos( yi ), - 'r': size( xi, yi, i ) / 2, - 'stroke': 'none', - 'opacity': opacity( xi, yi, i ), - 'fill': color( xi, yi, i ), - 'data-label': label( xi, yi, i ) - } - }; - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - out.push( h( ELEMENT, props, [] ) ); - } - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/symbols/lib/render/index.js b/components/svg/symbols/lib/render/index.js deleted file mode 100644 index 63c13dc..0000000 --- a/components/svg/symbols/lib/render/index.js +++ /dev/null @@ -1,78 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); -var closedCircles = require( './closed_circles.js' ); -var openCircles = require( './open_circles.js' ); - - -// VARIABLES // - -var debug = logger( 'symbols:render' ); -var ELEMENT = 'g'; -var RENDER = { - 'closed-circle': closedCircles, - 'open-circle': openCircles -}; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var children; - var props; - var vtree; - var f; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'symbols', - 'className': 'symbols' - }; - debug( 'Symbol: %s.', this.symbol ); - - f = RENDER[ this.symbol ]; - children = f( this ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, children ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/symbols/lib/render/open_circles.js b/components/svg/symbols/lib/render/open_circles.js deleted file mode 100644 index 57f5d55..0000000 --- a/components/svg/symbols/lib/render/open_circles.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'symbols:render:open-circles' ); -var ELEMENT = 'circle'; - - -// MAIN // - -/** -* Renders data as a open circles. -* -* @private -* @param {Object} state - state -* @returns {Array} array of virtual trees -*/ -function render( state ) { - var isDefined; - var opacity; - var label; - var color; - var props; - var size; - var xPos; - var yPos; - var out; - var xi; - var yi; - var x; - var y; - var i; - - debug( 'Rendering open circles...' ); - - isDefined = state.isDefined; - opacity = state.opacity; - label = state.label; - color = state.color; - size = state.size; - xPos = state.xPos; - yPos = state.yPos; - x = state.x; - y = state.y; - - out = new Array( x.length ); - for ( i = 0; i < x.length; i++ ) { - xi = x[ i ]; - yi = y[ i ]; - if ( !isDefined( xi ) || !isDefined( yi ) ) { - debug( 'Datum %d is undefined. [%s,%s].', i, xi, yi ); - continue; - } - debug( 'Rendering datum %d...', i ); - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'open-circle', - 'className': 'open-circle', - 'attributes': { - 'cx': xPos( xi ), - 'cy': yPos( yi ), - 'r': size( xi, yi, i ) / 2, - 'fill': 'none', - 'opacity': opacity( xi, yi, i ), - 'stroke': color( xi, yi, i ), - 'stroke-width': 1, // TODO: make property? I certainly don't see a good reason or use case why this should be a function. - 'data-label': label( xi, yi, i ) - } - }; - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - out[ i ] = h( ELEMENT, props, [] ); - } - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/symbols/package.json b/components/svg/symbols/package.json deleted file mode 100644 index 587e055..0000000 --- a/components/svg/symbols/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/symbols", - "version": "0.0.0", - "description": "SVG symbols.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "symbols", - "circles", - "scatter", - "series", - "component" - ] -} diff --git a/components/svg/title/examples/index.js b/components/svg/title/examples/index.js deleted file mode 100644 index 7f6c4b8..0000000 --- a/components/svg/title/examples/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var toHTML = require( 'vdom-to-html' ); -var title = require( './../lib' ); - -// Create a new title: -var node = title({ - 'text': 'Beep', - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = node.render(); -console.log( JSON.stringify( vtree ) ); - -// Transform the virtual DOM tree to HTML: -var html = toHTML( vtree ); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -node.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - node.text = 'Boop'; -} - -function onRender( vtree ) { - console.log( toHTML( vtree ) ); -} diff --git a/components/svg/title/lib/defaults.json b/components/svg/title/lib/defaults.json deleted file mode 100644 index c835193..0000000 --- a/components/svg/title/lib/defaults.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "text": "", - "autoRender": false -} diff --git a/components/svg/title/lib/events/events.json b/components/svg/title/lib/events/events.json deleted file mode 100644 index 31e673d..0000000 --- a/components/svg/title/lib/events/events.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "text": "change", - "autoRender": "change" -} diff --git a/components/svg/title/lib/events/index.js b/components/svg/title/lib/events/index.js deleted file mode 100644 index ef68b2b..0000000 --- a/components/svg/title/lib/events/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EVENTS = require( './events.json' ); - - -// MAIN // - -/** -* Provided a property, returns a corresponding event name for when a property value changes. -* -* @private -* @param {string} prop - property -* @returns {string} event name -*/ -function get( prop ) { - return EVENTS[ prop ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/title/lib/index.js b/components/svg/title/lib/index.js deleted file mode 100644 index 7c83f0a..0000000 --- a/components/svg/title/lib/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Title. -* -* @module @stdlib/plot/components/svg/title -* -* @example -* var Title = require( '@stdlib/plot/components/svg/title' ); -* -* var title = new Title({ -* 'text': 'Beep' -* }); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/components/svg/title/lib/main.js b/components/svg/title/lib/main.js deleted file mode 100644 index e45678b..0000000 --- a/components/svg/title/lib/main.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var copy = require( '@stdlib/utils/copy' ); -var defaults = require( './defaults.json' ); -var validate = require( './validate.js' ); -var setText = require( './props/text/set.js' ); -var getText = require( './props/text/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var render = require( './methods/render.js' ); - - -// VARIABLES // - -var debug = logger( 'title:main' ); - - -// MAIN // - -/** -* Title constructor. -* -* @constructor -* @param {Options} options - constructor options -* @param {string} [options.text] - title text -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @throws {TypeError} must provide valid options -* @returns {Title} title instance -* -* @example -* var title = new Title({ -* 'text':'Beep' -* }); -*/ -function Title( options ) { - var self; - var opts; - var err; - if ( !( this instanceof Title ) ) { - return new Title( options ); - } - self = this; - opts = copy( defaults ); - err = validate( opts, options ); - if ( err ) { - throw err; - } - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - defineProperty( this, '_text', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.text - }); - defineProperty( this, '_autoRender', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': opts.autoRender - }); - - this.on( 'change', onChange ); - this.on( '_render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - debug( 'Received a change event.' ); - if ( self._autoRender ) { // eslint-disable-line no-underscore-dangle - self.render(); - } - } - - /** - * Re-emits a render event. - * - * @private - */ - function onRender() { - var args; - var i; - debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; - for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; - } - self.emit.apply( self, args ); - } -} - -/* -* Create a prototype which inherits from the parent prototype. -*/ -Title.prototype = Object.create( EventEmitter.prototype ); - -/* -* Set the constructor. -*/ -Title.prototype.constructor = Title; - -/** -* Title text. -* -* @name text -* @memberof Title.prototype -* @type {string} -* @throws {TypeError} must be a string -* -* @example -* var title = new Title({ -* 'text': 'Beep' -* }); -* -* var text = title.text; -* // returns 'Beep' -*/ -defineProperty( Title.prototype, 'text', { - 'configurable': false, - 'enumerable': true, - 'set': setText, - 'get': getText -}); - -/** -* Rendering mode. If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Title.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var title = new Title({ -* 'autoRender': true -* }); -* -* var mode = title.autoRender; -* // returns true -*/ -defineProperty( Title.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Renders a virtual DOM tree. -* -* @name render -* @memberof Title.prototype -* @type {Function} -* @returns {VTree} virtual tree -* -* @example -* var title = new Title(); -* -* var out = title.render(); -*/ -setReadOnly( Title.prototype, 'render', render ); - - -// EXPORTS // - -module.exports = Title; diff --git a/components/svg/title/lib/methods/render.js b/components/svg/title/lib/methods/render.js deleted file mode 100644 index bd7418c..0000000 --- a/components/svg/title/lib/methods/render.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var h = require( 'virtual-dom/h.js' ); - - -// VARIABLES // - -var debug = logger( 'title:render' ); -var ELEMENT = 'text'; - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @returns {VTree} virtual DOM tree -*/ -function render() { - /* eslint-disable no-invalid-this */ - var props; - var vtree; - var text; - - debug( 'Rendering...' ); - - props = { - 'namespace': 'http://www.w3.org/2000/svg', - 'property': 'title', - 'className': 'title noselect', - 'attributes': { - 'x': 0, - 'y': 0, - 'text-anchor': 'middle' - } - }; - - text = this.text; - debug( 'Title: %s.', text ); - - debug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) ); - vtree = h( ELEMENT, props, text ); - - // Announce that a new tree has been rendered: - this.emit( '_render', vtree ); - - return vtree; -} - - -// EXPORTS // - -module.exports = render; diff --git a/components/svg/title/lib/props/auto-render/get.js b/components/svg/title/lib/props/auto-render/get.js deleted file mode 100644 index 7df40de..0000000 --- a/components/svg/title/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/title/lib/props/auto-render/set.js b/components/svg/title/lib/props/auto-render/set.js deleted file mode 100644 index 13d40d7..0000000 --- a/components/svg/title/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/auto_render.js' ); - - -// VARIABLES // - -var debug = logger( 'title:set:auto-render' ); -var CHANGE_EVENT = events( 'autoRender' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a positive number -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - var err = isValid( bool ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/title/lib/props/text/get.js b/components/svg/title/lib/props/text/get.js deleted file mode 100644 index b206c3c..0000000 --- a/components/svg/title/lib/props/text/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the title text. -* -* @private -* @returns {string} text -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._text; -} - - -// EXPORTS // - -module.exports = get; diff --git a/components/svg/title/lib/props/text/set.js b/components/svg/title/lib/props/text/set.js deleted file mode 100644 index cdc1e40..0000000 --- a/components/svg/title/lib/props/text/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var events = require( './../../events' ); -var isValid = require( './../../validators/text.js' ); - - -// VARIABLES // - -var debug = logger( 'title:set:text' ); -var CHANGE_EVENT = events( 'text' ); - - -// MAIN // - -/** -* Sets the title text. -* -* @private -* @param {string} text - text -* @throws {TypeError} must be a string -*/ -function set( text ) { - /* eslint-disable no-invalid-this */ - var err = isValid( text ); - if ( err ) { - throw err; - } - debug( 'Current value: %d.', this._text ); - - this._text = text; - debug( 'New Value: %d.', this._text ); - - this.emit( CHANGE_EVENT ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/components/svg/title/lib/validate.js b/components/svg/title/lib/validate.js deleted file mode 100644 index fbf33ae..0000000 --- a/components/svg/title/lib/validate.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var objectKeys = require( '@stdlib/utils/keys' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); -var validators = require( './validators' ); - - -// VARIABLES // - -var KEYS = objectKeys( validators ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {string} [options.text] - title text -* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event -* @returns {(Error|null)} error or null -* -* @example -* var opts = {}; -* var options = { -* 'text': 'Beep' -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var err; - var key; - var val; - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - for ( i = 0; i < KEYS.length; i++ ) { - key = KEYS[ i ]; - if ( hasOwnProp( options, key ) ) { - val = options[ key ]; - err = validators[ key ]( val ); - if ( err ) { - return err; - } - opts[ key ] = val; - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/components/svg/title/lib/validators/auto_render.js b/components/svg/title/lib/validators/auto_render.js deleted file mode 100644 index 08da79f..0000000 --- a/components/svg/title/lib/validators/auto_render.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `autoRender`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isBoolean( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/title/lib/validators/index.js b/components/svg/title/lib/validators/index.js deleted file mode 100644 index 40a493e..0000000 --- a/components/svg/title/lib/validators/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var text = require( './text.js' ); -var autoRender = require( './auto_render.js' ); - - -// MAIN // - -var validators = { - 'text': text, - 'autoRender': autoRender -}; - - -// EXPORTS // - -module.exports = validators; diff --git a/components/svg/title/lib/validators/text.js b/components/svg/title/lib/validators/text.js deleted file mode 100644 index 1a15f41..0000000 --- a/components/svg/title/lib/validators/text.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates `text`. -* -* @private -* @param {*} v - value to test -* @returns {(Error|null)} error object or null -*/ -function test( v ) { - if ( !isString( v ) ) { - return new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'text', v ) ); - } - return null; -} - - -// EXPORTS // - -module.exports = test; diff --git a/components/svg/title/package.json b/components/svg/title/package.json deleted file mode 100644 index 942b882..0000000 --- a/components/svg/title/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "@stdlib/plot/components/svg/title", - "version": "0.0.0", - "description": "SVG title.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "graph", - "chart", - "engine", - "svg", - "scalable", - "vector", - "graphics", - "title", - "component" - ] -} diff --git a/ctor/README.md b/ctor/README.md deleted file mode 100644 index 91f1cf6..0000000 --- a/ctor/README.md +++ /dev/null @@ -1,1498 +0,0 @@ - - -# Plot - -> Create a 2-dimensional plot. - -
- - - - - -
- - - -
- -## Usage - -```javascript -var Plot = require( '@stdlib/plot/ctor' ); -``` - -#### Plot( \[x, y,] \[options] ) - -Returns a `plot` instance for creating 2-dimensional plots. - -```javascript -var plot = new Plot(); -// returns -``` - -To provide plot data at instantiation, provide `x` **and** `y` data as arguments. - -```javascript -var x = [[0.10, 0.20, 0.30]]; -var y = [[0.52, 0.79, 0.64]]; - -var plot = new Plot( x, y ); -// returns -``` - -The function accepts the following `options`: - -- [**autoRender**](#prop-auto-render): `boolean` indicating whether to re-render on a `change` event. Default: `false`. -- [**autoView**](#prop-auto-view): `boolean` indicating whether to generate an updated view on a `render` event. Default: `false`. -- [**colors**](#prop-colors): data color(s). Default: `category10`. -- [**description**](#prop-description): plot description. Default: `''`. -- [**engine**](#prop-engine): plot engine. Default: `svg`. -- [**height**](#prop-height): plot height. Default: `400` (pixels). -- [**labels**](#prop-labels): data labels. -- [**isDefined**](#prop-is-defined): accessor `function` indicating whether a datum is defined. -- [**lineStyle**](#prop-line-style): data line style(s). Default: `'-'`. -- [**lineOpacity**](#prop-line-opacity): data line opacity. Default: `0.9`. -- [**lineWidth**](#prop-line-width): data line width. Default: `2` (pixels). -- [**paddingBottom**](#prop-padding-bottom): bottom padding. Default: `80` (pixels). -- [**paddingLeft**](#prop-padding-left): left padding. Default: `90` (pixels). -- [**paddingRight**](#prop-padding-right): right padding. Default: `20` (pixels). -- [**paddingTop**](#prop-padding-top): top padding. Default: `80` (pixels). -- [**renderFormat**](#prop-render-format): render format. Default: `'vdom'`. -- [**symbols**](#prop-symbols): data symbols. Default: `'none'`. -- [**symbolsOpacity**](#prop-symbols-opacity): symbols opacity. Default: `0.9`. -- [**symbolsSize**](#prop-symbols-size): symbols size. Default: `6` (pixels). -- [**title**](#prop-title): plot title. Default: `''`. -- [**viewer**](#prop-viewer): plot viewer. Default: `'none'`. -- [**width**](#prop-width): plot width. Default: `400` (pixels). -- [**x**](#prop-x): `x` values. Default: `[]`. -- [**xAxisOrient**](#prop-x-axis-orient): `x`-axis orientation. Default: `'bottom'`. -- [**xLabel**](#prop-x-label): `x`-axis label. Default: `'x'`. -- [**xMax**](#prop-x-max): maximum value of the `x`-axis domain. Default: `null`. -- [**xMin**](#prop-x-min): minimum value of the `x`-axis domain. Default: `null`. -- [**xNumTicks**](#prop-x-num-ticks): number of `x`-axis tick marks. Default: `5`. -- [**xRug**](#prop-x-rug): `boolean` indicating whether to render a rug plot along an `x`-axis. -- [**xRugOrient**](#prop-x-rug-orient): `x`-axis rug orientation. Default: `'bottom'`. -- [**xRugOpacity**](#prop-x-rug-opacity): `x`-axis rug opacity. Default: `0.1`. -- [**xRugSize**](#prop-x-rug-size): `x`-axis rug tick (tassel) size. Default: `6` (pixels). -- [**xScale**](#prop-x-scale): `x`-axis scale. Default: `'linear'`. -- [**xTickFormat**](#prop-x-tick-format): `x`-axis tick format. Default: `null`. -- [**y**](#prop-y): `y` values. Default: `[]`. -- [**yAxisOrient**](#prop-y-axis-orient): `y`-axis orientation. Default: `'left'`. -- [**yLabel**](#prop-y-label): `y`-axis label. Default: `'y'`. -- [**yMax**](#prop-y-max): maximum value of the `y`-axis domain. Default: `null`. -- [**yMin**](#prop-y-min): minimum value of the `y`-axis domain. Default: `null`. -- [**yNumTicks**](#prop-y-num-ticks): number of `y`-axis tick marks. Default: `5`. -- [**yRug**](#prop-y-rug): `boolean` indicating whether to render a rug plot along an `y`-axis. -- [**yRugOrient**](#prop-y-rug-orient): `y`-axis rug orientation. Default: `'left'`. -- [**yRugOpacity**](#prop-y-rug-opacity): `y`-axis rug opacity. Default: `0.1`. -- [**yRugSize**](#prop-y-rug-size): `y`-axis rug tick (tassel) size. Default: `6` (pixels). -- [**yScale**](#prop-y-scale): `y`-axis scale. Default: `'linear'`. -- [**yTickFormat**](#prop-y-tick-format): `y`-axis tick format. Default: `null`. - -In addition to supporting `x` and `y` data as arguments, the constructor supports providing data via the `x` and `y` options. - -```javascript -var opts = { - 'x': [[0.10, 0.20, 0.30]], - 'y': [[0.52, 0.79, 0.64]] -}; - -var plot = new Plot( opts ); -// returns -``` - -Note that `x` and `y` arguments take precedence over `x` and `y` options. - -```javascript -var opts = { - 'x': [[0.10, 0.20, 0.30]], - 'y': [[0.52, 0.79, 0.64]] -}; - -var x = [[0.40, 0.50, 0.60]]; -var y = [[0.37, 0.51, 0.44]]; - -var plot = new Plot( x, y, opts ); - -var x1 = plot.x; -// returns [[0.40, 0.50, 0.60]] - -var y1 = plot.y; -// returns [[0.37, 0.51, 0.44]] -``` - -* * * - -### Methods - - - -#### Plot.prototype.render( \[format] ) - -Renders a plot. - -```javascript -var plot = new Plot(); -var vtree = plot.render(); -// returns -``` - -By default, the method renders a plot as a [virtual DOM tree][vdom]. To render to an alternative format, provide a `format` argument. - -```javascript -var plot = new Plot(); -var vtree = plot.render( 'html' ); -// returns -``` - - - -#### Plot.prototype.view( \[viewer] ) - -Generates a plot view. - -```javascript -var plot = new Plot(); -plot.view(); -``` - -To generate a particular plot view without updating the [`viewer`](#prop-viewer) property, provide a `viewer`. - -```javascript -var plot = new Plot(); -plot.view( 'stdout' ); -``` - -* * * - -### Writable Properties - - - -#### Plot.prototype.x - -`x` values. The `x` property value must be an `array`, where each element corresponds to a plotted dataset. - -```javascript -var plot = new Plot(); - -// Set: -plot.x = [ - [ 1417563950959, 1417563952959 ], // dataset 1 - [ 1417563950959, 1417563952959 ] // dataset 2 -]; - -// Get: -var x = plot.x; -// returns [ [ 1417563950959, 1417563952959 ], [ 1417563950959, 1417563952959 ] ] -``` - - - -#### Plot.prototype.y - -`y` values. The `y` property value must be an `array`, where each element corresponds to a plotted dataset. - -```javascript -var plot = new Plot(); - -// Set: -plot.y = [ - [ 0.25, 0.23 ], // dataset 1 - [ 0.72, 0.89 ] // dataset 2 -]; - -// Get: -var y = plot.y; -// returns [ [ 0.25, 0.23 ], [ 0.72, 0.89 ] ] -``` - - - -#### Plot.prototype.labels - -Data labels. During plot creation, each plotted dataset is assigned a `label`. If the number of `labels` is less than the number of plotted datasets, `labels` are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -// Set: -plot.labels = [ - 'beep', // assigned to datasets 0,2,4,... - 'boop' // assigned to datasets 1,3,5,... -]; - -// Get: -var labels = plot.labels; -// returns ['beep','boop'] -``` - - - -#### Plot.prototype.isDefined( d, i ) - -An accessor `function` which defines whether a datum is defined. This accessor is used to define how missing values are encoded. When invoked, the function is provided two arguments: - -- **d**: datum -- **i**: datum index - -```javascript -function isDefined( d ) { - return ( d !== null ); -} - -var plot = new Plot(); - -// Set: -plot.isDefined = isDefined; - -// Get: -var fcn = plot.isDefined; -// returns -``` - -The default behavior is to ignore values which are `NaN`. - - - -#### Plot.prototype.colors - -Data colors. To set the `color` for all plotted datasets, provide a `color` name. - -```javascript -var plot = new Plot(); - -// Set: -plot.colors = '#474747'; - -// Get: -var colors = plot.colors; -// returns ['#474747'] -``` - -To specify the colors for each dataset, provide an `array` of colors. During plot creation, each plotted dataset is assigned one of the provided colors. If the number of colors is less than the number of plotted datasets, colors are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.colors = [ - '#000', // assigned to datasets 0,3,6,9,... - 'rgb(100,100,100)', // assigned to datasets 1,4,7,10,... - 'red' // assigned to datasets 2,5,8,11,... -]; - -// Get: -var colors = plot.colors; -// returns ['#000','rgb(100,100,100)','red'] -``` - -A `plot` instance also supports providing the name of a predefined color scheme. The following schemes are supported: - -- **category10** -- **category20** -- **category20b** -- **category20c** - - - -```javascript -var plot = new Plot(); - -// Set: -plot.colors = 'category20'; - -// Get: -var colors = plot.colors; -// returns -``` - - - -#### Plot.prototype.lineStyle - -Data line style(s). The following line styles are supported: - -- `'-'`: solid line. -- `'--'`: dashed line. -- `':'`: dotted line. -- `'-.'`: alternating dashes and dots. -- `'none'`: no line. - -To set the line style for all plotted datasets, - -```javascript -var plot = new Plot(); - -// Set: -plot.lineStyle = '-'; // all solid lines - -// Get: -var lineStyle = plot.lineStyle; -// returns ['-'] -``` - -To specify the line style for each dataset, provide an `array` of line styles. During plot creation, each plotted dataset is assigned a `lineStyle`. If the number of line styles is less than the number of plotted datasets, line styles are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.lineStyle = [ - ':', // assigned to datasets 0,3,6,9,... - 'none', // assigned to datasets 1,4,7,10,... - '--' // assigned to datasets 2,5,8,11,... -]; -``` - - - -#### Plot.prototype.lineOpacity - -Data line opacity, where an opacity of `0.0` makes a line completely transparent and an opacity of `1.0` makes a line completely opaque. To set the opacity for all plotted lines, - -```javascript -var plot = new Plot(); - -// Set: -plot.lineOpacity = 0.9; - -// Get: -var opacity = plot.lineOpacity; -// returns [0.9] -``` - -To specify the line opacity for each dataset, provide an `array` of opacities. During plot creation, each plotted dataset is assigned an opacity. If the number of opacities is less than the number of plotted datasets, opacities are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.lineOpacity = [ - 0.7, // assigned to datasets 0,3,6,9,... - 0.2, // assigned to datasets 1,4,7,10,... - 1.0 // assigned to datasets 2,5,8,11,... -]; -``` - - - -#### Plot.prototype.lineWidth - -Data line width(s). To set the line widths for all plotted lines, - -```javascript -var plot = new Plot(); - -// Set: -plot.lineWidth = 1; - -// Get: -var width = plot.lineWidth; -// returns [1] -``` - -To specify the line width for each dataset, provide an `array` of widths. During plot creation, each plotted dataset is assigned a line width. If the number of line widths is less than the number of plotted datasets, line widths are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.lineWidth = [ - 1, // assigned to datasets 0,2,4,... - 3 // assigned to datasets 1,3,5,... -]; -``` - - - -#### Plot.prototype.symbols - -Data symbols. The following symbols are supported: - -- `'closed-circle'`: closed circles. -- `'open-circle'`: open circles. -- `'none'`: no symbols. - -To set the symbols for all plotted datasets, - -```javascript -var plot = new Plot(); - -// Set: -plot.symbols = 'closed-circle'; - -// Get: -var sym = plot.symbols; -// returns ['closed-circle'] -``` - -To specify the symbols used for each dataset, provide an `array` of symbols. During plot creation, each plotted dataset is assigned a symbol. If the number of symbols is less than the number of plotted datasets, symbols are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.symbols = [ - 'closed-circle', // assigned to datasets 0,3,6,9,... - 'none', // assigned to datasets 1,4,7,10,... - 'open-circle' // assigned to datasets 2,5,8,11,... -]; -``` - - - -#### Plot.prototype.symbolsSize - -Symbols size. To set the size of all symbols, - -```javascript -var plot = new Plot(); - -// Set: -plot.symbolsSize = 4; - -// Get: -var size = plot.symbolsSize; -// returns [4] -``` - -To specify the symbols size for each dataset, provide an `array` of sizes. During plot creation, each plotted dataset is assigned a symbols size. If the number of sizes is less than the number of plotted datasets, sizes are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.symbolsSize = [ - 4, // assigned to datasets 0,2,4,... - 6 // assigned to datasets 1,3,5,... -]; -``` - - - -#### Plot.prototype.symbolsOpacity - -Symbols opacity, where an opacity of `0.0` makes a symbol completely transparent and an opacity of `1.0` makes a symbol completely opaque. To set the opacity for all plotted symbols, - -```javascript -var plot = new Plot(); - -// Set: -plot.symbolsOpacity = 0.9; - -// Get: -var opacity = plot.symbolsOpacity; -// returns [0.9] -``` - -To specify the opacity for each dataset, provide an `array` of opacities. During plot creation, each plotted dataset is assigned an opacity. If the number of opacities is less than the number of plotted datasets, opacities are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.symbolsOpacity = [ - 0.7, // assigned to datasets 0,3,6,9,... - 0.2, // assigned to datasets 1,4,7,10,... - 1.0 // assigned to datasets 2,5,8,11,... -]; -``` - - - -#### Plot.prototype.width - -Plot width (in pixels). - -```javascript -var plot = new Plot(); - -// Set: -plot.width = 720; - -// Get: -var width = plot.width; -// returns 720 -``` - - - -#### Plot.prototype.height - -Plot height (in pixels). - -```javascript -var plot = new Plot(); - -// Set: -plot.height = 480; - -// Get: -var height = plot.height; -// returns 480 -``` - - - -#### Plot.prototype.paddingLeft - -Plot left padding (in pixels). Left padding is typically used to create space for a left-oriented `y`-axis. - -```javascript -var plot = new Plot(); - -// Set: -plot.paddingLeft = 120; - -// Get: -var padding = plot.paddingLeft; -// returns 120 -``` - - - -#### Plot.prototype.paddingRight - -Plot right padding (in pixels). Right padding is typically used to create space for a right-oriented `y`-axis. - -```javascript -var plot = new Plot(); - -// Set: -plot.paddingRight = 90; - -// Get: -var padding = plot.paddingRight; -// returns 90 -``` - - - -#### Plot.prototype.paddingTop - -Plot top padding (in pixels). Top padding is typically used to create space for a title or top-oriented `x`-axis. - -```javascript -var plot = new Plot(); - -// Set: -plot.paddingTop = 100; - -// Get: -var padding = plot.paddingTop; -// returns 100 -``` - - - -#### Plot.prototype.paddingBottom - -Plot bottom padding (in pixels). Bottom padding is typically used to create space for a bottom-oriented `x`-axis. - -```javascript -var plot = new Plot(); - -// Set: -plot.paddingBottom = 105; - -// Get: -var padding = plot.paddingBottom; -// returns 105 -``` - - - -#### Plot.prototype.xMin - -Minimum value of the `x`-axis domain. When retrieved, if the value has been set to `null`, the returned value is computed from the `x` data. - -```javascript -var plot = new Plot(); - -// Set: -plot.xMin = -1.0; - -// Get: -var xMin = plot.xMin; -// returns -1.0 -``` - - - -#### Plot.prototype.xMax - -Maximum value of the `x`-axis domain. When retrieved, if the value has been set to `null`, the returned value is computed from the `x` data. - -```javascript -var plot = new Plot(); - -// Set: -plot.xMax = 100.0; - -// Get: -var xMax = plot.xMax; -// returns 100.0 -``` - - - -#### Plot.prototype.yMin - -Minimum value of the `y`-axis domain. When retrieved, if the value has been set to `null`, the returned value is computed from the `y` data. - -```javascript -var plot = new Plot(); - -// Set: -plot.yMin = -50.0; - -// Get: -var yMin = plot.yMin; -// returns -50.0 -``` - - - -#### Plot.prototype.yMax - -Maximum value of the `y`-axis domain. When retrieved, if the value has been set to `null`, the returned value is computed from the `y` data. - -```javascript -var plot = new Plot(); - -// Set: -plot.yMax = 31.4; - -// Get: -var yMax = plot.yMax; -// returns 31.4 -``` - - - -#### Plot.prototype.xScale - -Scale function for mapping values to a coordinate along the `x`-axis. The following `scales` are supported: - -- `'linear'`: linear scale. -- `'time'`: time scale. - -To set the scale, - -```javascript -var plot = new Plot(); - -plot.xScale = 'time'; -``` - -When retrieved, the returned value is a scale `function`. - -```javascript -var plot = new Plot(); - -var xScale = plot.xScale; -// returns -``` - - - -#### Plot.prototype.yScale - -Scale function for mapping values to a coordinate along the `y`-axis. The following `scales` are supported: - -- `'linear'`: linear scale. -- `'time'`: time scale. - -To set the scale, - -```javascript -var plot = new Plot(); - -plot.yScale = 'linear'; -``` - -When retrieved, the returned value is a scale `function`. - -```javascript -var plot = new Plot(); - -var yScale = plot.yScale; -// returns -``` - - - -#### Plot.prototype.xTickFormat - -`x`-axis tick format. To set the tick format, - -```javascript -var plot = new Plot({ - 'xScale': 'time' -}); - -plot.xTickFormat = '%H:%M'; -``` - -When retrieved, if the value has not been set to `null`, the returned value is a formatting `function`. - -```javascript -var plot = new Plot({ - 'xScale': 'time', - 'xTickFormat': '%H:%M' -}); - -var fmt = plot.xTickFormat; -// returns -``` - - - -#### Plot.prototype.yTickFormat - -`y`-axis tick format. To set the tick format, - -```javascript -var plot = new Plot({ - 'yScale': 'linear' -}); - -plot.yTickFormat = '.0%'; -``` - -When retrieved, if the value has not been set to `null`, the returned value is a formatting `function`. - -```javascript -var plot = new Plot({ - 'yScale': 'linear', - 'yTickFormat': '.0%' -}); - -var fmt = plot.yTickFormat; -// returns -``` - - - -#### Plot.prototype.xNumTicks - -Number of `x`-axis tick marks. To set the number of tick marks, - -```javascript -var plot = new Plot(); - -// Set: -plot.xNumTicks = 10; - -// Get: -var numTicks = plot.xNumTicks; -// returns 10 -``` - -If the value is set to `null`, the number of tick marks is computed internally. - -```javascript -var plot = new Plot(); - -plot.xNumTicks = null; -``` - - - -#### Plot.prototype.yNumTicks - -Number of `y`-axis tick marks. To set the number of tick marks, - -```javascript -var plot = new Plot(); - -// Set: -plot.yNumTicks = 5; - -// Get: -var numTicks = plot.yNumTicks; -// returns 5 -``` - -If the value is set to `null`, the number of tick marks is computed internally. - -```javascript -var plot = new Plot(); - -plot.yNumTicks = null; -``` - - - -#### Plot.prototype.xAxisOrient - -`x`-axis orientation. The following orientations are supported: - -- `'bottom'` -- `'top'` - -To set the orientation, - -```javascript -var plot = new Plot(); - -// Set: -plot.xAxisOrient = 'top'; - -// Get: -var orient = plot.xAxisOrient; -// returns 'top' -``` - - - -#### Plot.prototype.yAxisOrient - -`y`-axis orientation. The following orientations are supported: - -- `'left'` -- `'right'` - -To set the orientation, - -```javascript -var plot = new Plot(); - -// Set: -plot.yAxisOrient = 'right'; - -// Get: -var orient = plot.yAxisOrient; -// returns 'right' -``` - - - -#### Plot.prototype.xRug - -Boolean flag(s) indicating whether to display a rug plot along the `x`-axis. To set the for flag all plotted datasets, - -```javascript -var plot = new Plot(); - -// Set: -plot.xRug = true; - -// Get: -var flgs = plot.xRug; -// returns [true] -``` - -To specify the flag for each dataset, provide an `array` of `booleans`. During plot creation, each plotted dataset is assigned a flag. If the number of flags is less than the number of plotted datasets, flags are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.xRug = [ - true, // assigned to datasets 0,2,4,... - false // assigned to datasets 1,3,5,... -]; -``` - - - -#### Plot.prototype.yRug - -Boolean flag(s) indicating whether to display a rug plot along the `y`-axis. To set the for flag all plotted datasets, - -```javascript -var plot = new Plot(); - -// Set: -plot.yRug = true; - -// Get: -var flgs = plot.yRug; -// returns [true] -``` - -To specify the flag for each dataset, provide an `array` of `booleans`. During plot creation, each plotted dataset is assigned a flag. If the number of flags is less than the number of plotted datasets, flags are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.yRug = [ - false, // assigned to datasets 0,2,4,... - true // assigned to datasets 1,3,5,... -]; -``` - - - -#### Plot.prototype.xRugOrient - -`x`-axis rug orientation. The following orientations are supported: - -- `'bottom'` -- `'top'` - -To set the orientation for all plotted datasets, - -```javascript -var plot = new Plot(); - -// Set: -plot.xRugOrient = 'top'; - -// Get: -var orient = plot.xRugOrient; -// returns ['top'] -``` - -To specify the `x`-axis rug orientation for each dataset, provide an `array` of orientations. During plot creation, each plotted dataset is assigned an orientation. If the number of orientations is less than the number of plotted datasets, orientations are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.xRugOrient = [ - 'bottom', // assigned to datasets 0,2,4,... - 'top' // assigned to datasets 1,3,5,... -]; -``` - - - -#### Plot.prototype.yRugOrient - -`y`-axis rug orientation. The following orientations are supported: - -- `'left'` -- `'right'` - -To set the orientation for all plotted datasets, - -```javascript -var plot = new Plot(); - -// Set: -plot.yRugOrient = 'right'; - -// Get: -var orient = plot.yRugOrient; -// returns ['right'] -``` - -To specify the `y`-axis rug orientation for each dataset, provide an `array` of orientations. During plot creation, each plotted dataset is assigned an orientation. If the number of orientations is less than the number of plotted datasets, orientations are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.yRugOrient = [ - 'left', // assigned to datasets 0,2,4,... - 'right' // assigned to datasets 1,3,5,... -]; -``` - - - -#### Plot.prototype.xRugOpacity - -`x`-axis rug opacity, where an opacity of `0.0` makes a rug completely transparent and an opacity of `1.0` makes a rug completely opaque. To set the opacity for all plotted datasets, - -```javascript -var plot = new Plot(); - -// Set: -plot.xRugOpacity = 0.2; - -// Get: -var opacity = plot.xRugOpacity; -// returns [0.2] -``` - -To specify the `x`-axis rug opacity for each dataset, provide an `array` of opacities. During plot creation, each plotted dataset is assigned an opacity. If the number of opacities is less than the number of plotted datasets, opacities are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.xRugOpacity = [ - 0.1, // assigned to datasets 0,2,4,... - 1.0 // assigned to datasets 1,3,5,... -]; -``` - - - -#### Plot.prototype.yRugOpacity - -`y`-axis rug opacity, where an opacity of `0.0` makes a rug completely transparent and an opacity of `1.0` makes a rug completely opaque. To set the opacity for all plotted datasets, - -```javascript -var plot = new Plot(); - -// Set: -plot.yRugOpacity = 0.4; - -// Get: -var opacity = plot.yRugOpacity; -// returns [0.4] -``` - -To specify the `y`-axis rug opacity for each dataset, provide an `array` of opacities. During plot creation, each plotted dataset is assigned an opacity. If the number of opacities is less than the number of plotted datasets, opacities are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.yRugOpacity = [ - 0.7, // assigned to datasets 0,2,4,... - 0.1 // assigned to datasets 1,3,5,... -]; -``` - - - -#### Plot.prototype.xRugSize - -`x`-axis rug tick (tassel) size. To set the tick size for all plotted datasets, - -```javascript -var plot = new Plot(); - -// Set: -plot.xRugSize = 4; - -// Get: -var size = plot.xRugSize; -// returns [4] -``` - -To specify the `x`-axis rug size for each dataset, provide an `array` of sizes. During plot creation, each plotted dataset is assigned a tick size. If the number of sizes is less than the number of plotted datasets, sizes are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.xRugSize = [ - 4, // assigned to datasets 0,3,6,... - 6, // assigned to datasets 1,4,7,... - 4 // assigned to datasets 2,5,8,... -]; -``` - - - -#### Plot.prototype.yRugSize - -`y`-axis rug tick (tassel) size. To set the tick size for all plotted datasets, - -```javascript -var plot = new Plot(); - -// Set: -plot.yRugSize = 4; - -// Get: -var size = plot.yRugSize; -// returns [4] -``` - -To specify the `y`-axis rug size for each dataset, provide an `array` of sizes. During plot creation, each plotted dataset is assigned a tick size. If the number of sizes is less than the number of plotted datasets, sizes are reused using modulo arithmetic. - -```javascript -var plot = new Plot(); - -plot.yRugSize = [ - 6, // assigned to datasets 0,3,6,... - 4, // assigned to datasets 1,4,7,... - 4 // assigned to datasets 2,5,8,... -]; -``` - - - -#### Plot.prototype.description - -Plot description. - -```javascript -var plot = new Plot(); - -// Set: -plot.description = 'A plot of `x` vs `y`.'; - -// Get: -var desc = plot.description; -// returns 'A plot of `x` vs `y`.' -``` - - - -#### Plot.prototype.title - -Plot title. - -```javascript -var plot = new Plot(); - -// Set: -plot.title = 'Time Series'; - -// Get: -var title = plot.title; -// returns 'Time Series' -``` - - - -#### Plot.prototype.xLabel - -`x`-axis label. - -```javascript -var plot = new Plot(); - -// Set: -plot.xLabel = 'time'; - -// Get: -var label = plot.xLabel; -// returns 'time' -``` - - - -#### Plot.prototype.yLabel - -`y`-axis label. - -```javascript -var plot = new Plot(); - -// Set: -plot.yLabel = 'value'; - -// Get: -var label = plot.yLabel; -// returns 'value' -``` - - - -#### Plot.prototype.engine - -Plot rendering engine. The following engines are supported: - -- `'svg'` - -```javascript -var plot = new Plot(); - -// Set: -plot.engine = 'svg'; - -// Get: -var engine = plot.engine; -// returns 'svg' -``` - - - -#### Plot.prototype.renderFormat - -Plot render format. The following formats are supported: - -- `'vdom'` -- `'html'` - -```javascript -var plot = new Plot(); - -// Set: -plot.renderFormat = 'html'; - -// Get: -var fmt = plot.renderFormat; -// returns 'html' -``` - - - -#### Plot.prototype.autoRender - -Rendering mode. If `true`, an instance renders on each `'change'` event; otherwise, rendering must be triggered manually. - -```javascript -var plot = new Plot(); - -// Set: -plot.autoRender = false; - -// Get: -var mode = plot.autoRender; -// returns false -``` - - - -#### Plot.prototype.viewer - -Plot viewer. The following viewers are supported: - -- `'none'` -- `'stdout'` -- `'window'` -- `'browser'` - -```javascript -var plot = new Plot(); - -// Set: -plot.viewer = 'window'; - -// Get: -var viewer = plot.viewer; -// returns 'window' -``` - - - -#### Plot.prototype.autoView - -Viewer mode. If `true`, an instance generates an updated view on each `'render'` event; otherwise, generating a view must be triggered manually. - -```javascript -var plot = new Plot(); - -// Set: -plot.autoView = true; - -// Get: -var mode = plot.autoView; -// returns true -``` - -* * * - -### Computed Properties - - - -#### Plot.prototype.graphWidth - -Returns the expected graph width. - -```javascript -var plot = new Plot({ - 'width': 100, - 'paddingLeft': 20, - 'paddingRight': 10 -}); -var width = plot.graphWidth; -// returns 70 -``` - - - -#### Plot.prototype.graphHeight - -Returns the expected graph height. - -```javascript -var plot = new Plot({ - 'height': 500, - 'paddingTop': 10, - 'paddingBottom': 120 -}); -var height = plot.graphHeight; -// returns 370 -``` - - - -#### Plot.prototype.xDomain - -Returns the `x`-axis domain. - -```javascript -var plot = new Plot({ - 'xMin': -1.0, - 'xMax': 1.0 -}); -var domain = plot.xDomain; -// returns [-1.0,1.0] -``` - - - -#### Plot.prototype.yDomain - -Returns the `y`-axis domain. - -```javascript -var plot = new Plot({ - 'yMin': 0.0, - 'yMax': 100.0 -}); -var domain = plot.yDomain; -// returns [0.0,100.0] -``` - - - -#### Plot.prototype.xRange - -Returns the `x`-axis range. - -```javascript -var plot = new Plot({ - 'width': 100, - 'paddingLeft': 10, - 'paddingRight': 10 -}); -var range = plot.xRange; -// returns [0,80] -``` - - - -#### Plot.prototype.yRange - -Returns the `y`-axis range. - -```javascript -var plot = new Plot({ - 'height': 500, - 'paddingTop': 10, - 'paddingBottom': 120 -}); -var range = plot.yRange; -// returns [370,0] -``` - - - -#### Plot.prototype.xPos - -Returns a `function` to map values to `x`-axis coordinate values. - -```javascript -var plot = new Plot(); -var xPos = plot.xPos; -// returns -``` - - - -#### Plot.prototype.yPos - -Returns a `function` to map values to `y`-axis coordinate values. - -```javascript -var plot = new Plot(); -var yPos = plot.yPos; -// returns -``` - - - - - -
- -* * * - -## Examples - - - -```javascript -var randn = require( '@stdlib/random/base/box-muller' ); -var Float64Array = require( '@stdlib/array/float64' ); -var plot = require( '@stdlib/plot/ctor' ); - -var now; -var x; -var y; -var i; - -// Create some data... -now = ( new Date() ).getTime(); -x = new Float64Array( 100 ); -y = new Float64Array( x.length ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = now + (i*360000); - y[ i ] = 50.0 + (10.0*randn()); -} - -// Create a new plot: -var h = plot( [x], [y], { - 'width': 600, - 'height': 480, - 'xScale': 'time', - 'xTickFormat': '%H:%M', - 'renderFormat': 'html', - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = h.render( 'vdom' ); -console.log( JSON.stringify( vtree ) ); - -// Render as HTML: -var html = h.render(); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -h.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - h.width = 720; -} - -function onRender( html ) { - console.log( html ); -} -``` - -
- - - - - - - - - - - - - - diff --git a/ctor/docs/repl.txt b/ctor/docs/repl.txt deleted file mode 100644 index 3308943..0000000 --- a/ctor/docs/repl.txt +++ /dev/null @@ -1,452 +0,0 @@ - -{{alias}}( [x, y,] [options] ) - Returns a plot instance for creating 2-dimensional plots. - - `x` and `y` arguments take precedence over `x` and `y` options. - - Parameters - ---------- - x: Array|Array (optional) - An array of arrays containing x-coordinate values. - - y: Array|Array (optional) - An array of arrays containing y-coordinate values. - - options: Object (optional) - Options. - - options.autoRender: boolean (optional) - Boolean indicating whether to re-render on a 'change' event. Default: - false. - - options.autoView: boolean (optional) - Boolean indicating whether to generate an updated view on a 'render' - event. Default: false. - - options.colors: string|Array (optional) - Data color(s). Default: 'category10'. - - options.description: string (optional) - Plot description. - - options.engine: string (optional) - Plot engine. Default: 'svg'. - - options.height: number (optional) - Plot height (in pixels). Default: 400. - - options.labels: Array|Array (optional) - Data labels. - - options.isDefined: Function (optional) - An accessor function indicating whether a datum is defined. - - options.lineStyle: string|Array (optional) - Data line style(s). Must be one of: '-', '--', ':', '-.', or 'none'. - Default: '-'. - - options.lineOpacity: number|Array (optional) - Data line opacity. Must be on the interval [0,1]. Default: 0.9. - - options.lineWidth: integer|Array (optional) - Data line width (in pixels). Default: 2. - - options.paddingBottom: integer (optional) - Bottom padding (in pixels). Default: 80. - - options.paddingLeft: integer (optional) - Left padding (in pixels). Default: 90. - - options.paddingRight: integer (optional) - Right padding (in pixels). Default: 20. - - options.paddingTop: integer (optional) - Top padding (in pixels). Default: 80. - - options.renderFormat: string (optional) - Plot render format. Must be one of 'vdom' or 'html'. Default: 'vdom'. - - options.symbols: string|Array (optional) - Data symbols. Must be one of 'closed-circle', 'open-circle', or 'none'. - Default: 'none'. - - options.symbolsOpacity: number|Array (optional) - Symbols opacity. Must be on the interval [0,1]. Default: 0.9. - - options.symbolsSize: integer|Array (optional) - Symbols size (in pixels). Default: 6. - - options.title: string (optional) - Plot title. - - options.viewer: string (optional) - Plot viewer. Must be one of 'browser', 'terminal', 'stdout', 'window', - or 'none'. Default: 'none'. - - options.width: number (optional) - Plot width (in pixels). Default: 400. - - options.x: Array|Array (optional) - x-coordinate values. - - options.xAxisOrient: string (optional) - x-axis orientation. Must be either 'bottom' or 'top'. Default: 'bottom'. - - options.xLabel: string (optional) - x-axis label. Default: 'x'. - - options.xMax: number|null (optional) - Maximum value of the x-axis domain. If `null`, the maximum value is - calculated from the data. Default: null. - - options.xMin: number|null (optional) - Minimum value of the x-axis domain. If `null`, the minimum value is - calculated from the data. Default: null. - - options.xNumTicks: integer (optional) - Number of x-axis tick marks. Default: 5. - - options.xRug: boolean|Array (optional) - Boolean flag(s) indicating whether to render one or more rug plots along - the x-axis. - - options.xRugOrient: string|Array (optional) - x-axis rug plot orientation(s). Must be either 'bottom' or 'top'. - Default: 'bottom'. - - options.xRugOpacity: number|Array (optional) - x-axis rug plot opacity. Must be on the interval [0,1]. Default: 0.1. - - options.xRugSize: integer|Array (optional) - x-axis rug tick (tassel) size (in pixels). Default: 6. - - options.xScale: string - x-axis scale. Default: 'linear'. - - options.xTickFormat: string|null - x-axis tick format. Default: null. - - options.y: Array|Array (optional) - y-coordinate values. - - options.yAxisOrient: string (optional) - x-axis orientation. Must be either 'left' or 'right'. Default: 'left'. - - options.yLabel: string (optional) - y-axis label. Default: 'y'. - - options.yMax: number|null (optional) - Maximum value of the y-axis domain. If `null`, the maximum value is - calculated from the data. Default: null. - - options.yMin: number|null (optional) - Minimum value of the y-axis domain. If `null`, the minimum value is - calculated from the data. Default: null. - - options.yNumTicks: integer (optional) - Number of x-axis tick marks. Default: 5. - - options.yRug: boolean|Array (optional) - Boolean flag(s) indicating whether to render one or more rug plots along - the y-axis. - - options.yRugOrient: string|Array (optional) - y-axis rug plot orientation(s). Must be either 'left' or 'right'. - Default: 'left'. - - options.yRugOpacity: number|Array (optional) - y-axis rug plot opacity. Must be on the interval [0,1]. Default: 0.1. - - options.yRugSize: integer|Array (optional) - y-axis rug tick (tassel) size (in pixels). Default: 6. - - options.yScale: string - y-axis scale. Default: 'linear'. - - options.yTickFormat: string|null - y-axis tick format. Default: null. - - Returns - ------- - plot: Plot - Plot instance. - - plot.render() - Renders a plot as a virtual DOM tree. - - plot.view( [viewer] ) - Generates a plot view. - - plot.x - x-coordinate values. An assigned value must be an array where each - element corresponds to a plotted dataset. - - plot.y - y-coordinate values. An assigned value must be an array, where each - element corresponds to a plotted dataset. - - plot.labels - Data labels. During plot creation, each plotted dataset is assigned a - label. If the number of labels is less than the number of plotted - datasets, labels are reused using modulo arithmetic. - - plot.isDefined( d, i ) - An accessor function which defines whether a datum is defined. This - accessor is used to define how missing values are encoded. The default - behavior is to ignore values which are `NaN`. - - plot.colors - Data colors. To set the color all plotted datasets, provide a color - name. To specify the colors for each dataset, provide an array of - colors. During plot creation, each plotted dataset is assigned one of - the provided colors. If the number of colors is less than the number of - plotted datasets, colors are reused using modulo arithmetic. Lastly, - colors may also be specified by providing the name of a predefined color - scheme. The following schemes are supported: 'category10', 'category20', - 'category20b', and 'category20c'. - - plot.lineStyle - Data line style(s). The following line styles are supported: '-' (solid - line), '--' (dashed line), ':' (dotted line), '-.' (alternating dashes - and dots), and 'none' (no line). To specify the line style for each - dataset, provide an array of line styles. During plot creation, each - plotted dataset is assigned a line style. If the number of line styles - is less than the number of plotted datasets, line styles are reused - using modulo arithmetic. - - plot.lineOpacity - Data line opacity, where an opacity of `0.0` make a line completely - transparent and an opacity of `1.0` makes a line completely opaque. To - specify the line opacity for each dataset, provide an array of - opacities. During plot creation, each plotted dataset is assigned an - opacity. If the number of opacities is less than the number of plotted - datasets, opacities are reused using modulo arithmetic. - - plot.lineWidth - Data line width(s). To specify the line width for each dataset, provide - an array of widths. During plot creation, each plotted dataset is - assigned a line width. If the number of line widths is less than the - number of plotted datasets, line widths are reused using modulo - arithmetic. - - plot.symbols - Data symbols. The following symbols are supported: 'closed-circle' - (closed circles), 'open-circle' (open circles), and 'none' (no symbols). - To specify the symbols used for each dataset, provide an array of - symbols. During plot creation, each plotted dataset is assigned a - symbol. If the number of symbols is less than the number of plotted - datasets, symbols are reused using modulo arithmetic. - - plot.symbolSize - Symbols size. To specify the symbols size for each dataset, provide an - array of sizes. During plot creation, each plotted dataset is assigned - a symbols size. If the number of sizes is less than the number of - plotted datasets, sizes are reused using modulo arithmetic. - - plot.symbolsOpacity - Symbols opacity, where an opacity of `0.0` makes a symbol completely - transparent and an opacity of `1.0` makes a symbol completely opaque. To - specify the opacity for each dataset, provide an array of opacities. - During plot creation, each plotted dataset is assigned an opacity. If - the number of opacities is less than the number of plotted datasets, - opacities are reused using modulo arithmetic. - - plot.width - Plot width (in pixels). - - plot.height - Plot height (in pixels). - - plot.paddingLeft - Plot left padding (in pixels). Left padding is typically used to create - space for a left-oriented y-axis. - - plot.paddingRight - Plot right padding (in pixels). Right padding is typically used to - create space for a right-oriented y-axis. - - plot.paddingTop - Plot top padding (in pixels). Top padding is typically used to create - space for a title or top-oriented x-axis. - - plot.paddingBottom - Plot bottom padding (in pixels). Bottom padding is typically used to - create space for a bottom-oriented x-axis. - - plot.xMin - Minimum value of the x-axis domain. When retrieved, if the value has - been set to `null`, the returned value is computed from the `x` data. - - plot.xMax - Maximum value of the x-axis domain. When retrieved, if the value has - been set to `null`, the returned value is computed from the `x` data. - - plot.yMin - Minimum value of the y-axis domain. When retrieved, if the value has - been set to `null`, the returned value is computed from the `y` data. - - plot.yMax - Maximum value of the y-axis domain. When retrieved, if the value has - been set to `null`, the returned value is computed from the `y` data. - - plot.xScale - Scale function for mapping values to a coordinate along the x-axis. The - following `scales` are supported: 'linear' (linear scale) and 'time' - (time scale). When retrieved, the returned value is a scale function. - - plot.yScale - Scale function for mapping values to a coordinate along the y-axis. The - following `scales` are supported: 'linear' (linear scale) and 'time' - (time scale). When retrieved, the returned value is a scale function. - - plot.xTickFormat - x-axis tick format (e.g., '%H:%M'). When retrieved, if the value has not - been set to `null`, the returned value is a formatting function. - - plot.yTickFormat - y-axis tick format (e.g., '%%'). When retrieved, if the value has not - been set to `null`, the returned value is a formatting function. - - plot.xNumTicks - Number of x-axis tick marks. If the value is set to `null`, the number - of tick marks is computed internally. - - plot.yNumTicks - Number of y-axis tick marks. If the value is set to `null`, the number - of tick marks is computed internally. - - plot.xAxisOrient - x-axis orientation. The following orientations are supported: 'bottom' - and 'top'. - - plot.yAxisOrient - y-axis orientation. The following orientations are supported: 'left' and - 'right'. - - plot.xRug - Boolean flag(s) indicating whether to display a rug plot along the x- - axis. To specify the flag for each dataset, provide an array of - booleans. During plot creation, each plotted dataset is assigned a flag. - If the number of flags is less than the number of plotted datasets, - flags are reused using modulo arithmetic. - - plot.yRug - Boolean flag(s) indicating whether to display a rug plot along the y- - axis. To specify the flag for each dataset, provide an array of - booleans. During plot creation, each plotted dataset is assigned a flag. - If the number of flags is less than the number of plotted datasets, - flags are reused using modulo arithmetic. - - plot.xRugOrient - x-axis rug orientation. The following orientations are supported: - 'bottom' or 'top'. To specify the x-axis rug orientation for each - dataset, provide an array of orientations. During plot creation, each - plotted dataset is assigned an orientation. If the number of - orientations is less than the number of plotted datasets, orientations - are reused using modulo arithmetic. - - plot.yRugOrient - y-axis rug orientation. The following orientations are supported: 'left' - or 'right'. To specify the y-axis rug orientation for each dataset, - provide an array of orientations. During plot creation, each plotted - dataset is assigned an orientation. If the number of orientations is - less than the number of plotted datasets, orientations are reused using - modulo arithmetic. - - plot.xRugOpacity - x-axis rug opacity, where an opacity of `0.0` makes a rug completely - transparent and an opacity of `1.0` makes a rug completely opaque. To - specify the x-axis rug opacity for each dataset, provide an array of - opacities. During plot creation, each plotted dataset is assigned an - opacity. If the number of opacities is less than the number of plotted - datasets, opacities are reused using modulo arithmetic. - - plot.yRugOpacity - y-axis rug opacity, where an opacity of `0.0` makes a rug completely - transparent and an opacity of `1.0` makes a rug completely opaque. To - specify the y-axis rug opacity for each dataset, provide an array of - opacities. During plot creation, each plotted dataset is assigned an - opacity. If the number of opacities is less than the number of plotted - datasets, opacities are reused using modulo arithmetic. - - plot.xRugSize - x-axis rug tick (tassel) size. To specify the x-axis rug size for each - dataset, provide an array of sizes. During plot creation, each plotted - dataset is assigned a tick size. If the number of sizes is less than the - number of plotted datasets, sizes are reused using modulo arithmetic. - - plot.yRugSize - y-axis rug tick (tassel) size. To specify the y-axis rug size for each - dataset, provide an array of sizes. During plot creation, each plotted - dataset is assigned a tick size. If the number of sizes is less than the - number of plotted datasets, sizes are reused using modulo arithmetic. - - plot.description - Plot description. - - plot.title - Plot title. - - plot.xLabel - x-axis label. - - plot.yLabel - y-axis label. - - plot.engine - Plot rendering engine. The following engines are supported: 'svg'. - - plot.renderFormat - Plot render format. The following formats are supported: 'vdom' and - 'html'. - - plot.autoRender - Rendering mode. If `true`, an instance renders on each 'change' event; - otherwise, rendering must be triggered manually. - - plot.viewer - Plot viewer. The following viewers are supported: 'none', 'stdout', - 'window', and 'browser'. - - plot.autoView - Viewer mode. If `true`, an instance generates an updated view on each - 'render' event; otherwise, generating a view must be triggered manually. - - plot.graphWidth - Computed property corresponding to the expected graph width. - - plot.graphHeight - Computed property corresponding to the expected graph height. - - plot.xDomain - Computed property corresponding to the x-axis domain. - - plot.yDomain - Computed property corresponding to the y-axis domain. - - plot.xRange - Computed property corresponding to the x-axis range. - - plot.yRange - Computed property correspond to the y-axis range. - - plot.xPos - A function which maps values to x-axis coordinate values. - - plot.yPos - A function which maps values to y-axis coordinate values. - - Examples - -------- - > var plot = {{alias}}() - - - // Provide plot data at instantiation: - > var x = [[0.10, 0.20, 0.30]]; - > var y = [[0.52, 0.79, 0.64]]; - > plot = {{alias}}( x, y ) - - - See Also - -------- - diff --git a/ctor/examples/index.js b/ctor/examples/index.js deleted file mode 100644 index 577b117..0000000 --- a/ctor/examples/index.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var randn = require( '@stdlib/random/base/box-muller' ); -var now = require( '@stdlib/time/now' ); -var Float64Array = require( '@stdlib/array/float64' ); -var Plot = require( './../lib' ); - -var t; -var x; -var y; -var i; - -// Create some data... -t = now() * 1000; -x = new Float64Array( 100 ); -y = new Float64Array( x.length ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = t + (i*360000); - y[ i ] = 50.0 + (10.0*randn()); -} - -// Create a new plot: -var plot = new Plot( [x], [y], { - 'width': 600, - 'height': 480, - 'xScale': 'time', - 'xTickFormat': '%H:%M', - 'renderFormat': 'html', - 'autoRender': true -}); - -// Render as a virtual DOM tree: -var vtree = plot.render( 'vdom' ); -console.log( JSON.stringify( vtree ) ); - -// Render the plot as HTML: -var html = plot.render(); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -plot.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - plot.width = 720; -} - -function onRender( html ) { - console.log( html ); -} diff --git a/ctor/examples/linescatter b/ctor/examples/linescatter deleted file mode 100644 index 16108ce..0000000 --- a/ctor/examples/linescatter +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env node -'use strict'; - -var randn = require( '@stdlib/random/base/box-muller' ); -var Float32Array = require( '@stdlib/array/float32' ); -var Float64Array = require( '@stdlib/array/float64' ); -var Plot = require( './../lib' ); - -var y1; -var y2; -var x; -var i; - -// Create some data... -x = new Float64Array( 100 ); -y1 = new Float64Array( x.length ); -y2 = new Float32Array( x.length ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = i; - y1[ i ] = 50.0 + (10.0*randn()); - y2[ i ] = 10.0 + (5.0*randn()); -} - -// Create a new plot: -var plot = new Plot( [ x, x ], [ y1, y2 ] ); -plot.width = 600; -plot.height = 480; -plot.symbols = [ 'open-circle', 'closed-circle' ]; -plot.symbolsSize = 6; - -// View the plot in a window: -plot.view( 'window' ); diff --git a/ctor/examples/linestyles b/ctor/examples/linestyles deleted file mode 100644 index 4e45dca..0000000 --- a/ctor/examples/linestyles +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env node -'use strict'; - -var randn = require( '@stdlib/random/base/box-muller' ); -var Float64Array = require( '@stdlib/array/float64' ); -var Plot = require( './../lib' ); - -var plot; -var opts; -var y1; -var y2; -var y3; -var y4; -var x; -var i; - -// Create some data... -x = new Float64Array( 100 ); -y1 = new Float64Array( x.length ); -y2 = new Float64Array( x.length ); -y3 = new Float64Array( x.length ); -y4 = new Float64Array( x.length ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = i; - y1[ i ] = 10.0 + (5.0*randn()); - y2[ i ] = 25.0 + (7.25*randn()); - y3[ i ] = 50.0 + (10.0*randn()); - y4[ i ] = 75.0 + (2.5*randn()); -} - -// Set the plot options: -opts = { - 'width': 600, - 'height': 480, - 'colors': '#000', - 'lineOpacity': 0.5, - 'lineWidth': 1, - 'lineStyle': [ - '-', // solid - '--', // dashes - ':', // dotted - '-.' // dash-dot - ], - 'viewer': 'window' -}; - -// Create a new plot: -plot = new Plot( [ x, x, x, x ], [ y1, y2, y3, y4 ], opts ); - -// View the plot: -plot.view(); diff --git a/ctor/examples/multiline b/ctor/examples/multiline deleted file mode 100644 index d997a93..0000000 --- a/ctor/examples/multiline +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env node -'use strict'; - -var randn = require( '@stdlib/random/base/box-muller' ); -var Float64Array = require( '@stdlib/array/float64' ); -var Float32Array = require( '@stdlib/array/float32' ); -var Plot = require( './../lib' ); - -var plot; -var y1; -var y2; -var x; -var i; - -// Create some data... -x = new Float64Array( 100 ); -y1 = new Float64Array( x.length ); -y2 = new Float32Array( x.length ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = i; - y1[ i ] = 50.0 + (10.0*randn()); - y2[ i ] = 10.0 + (5.0*randn()); -} - -// Create a new plot: -plot = new Plot( [ x, x ], [ y1, y2 ] ); -plot.width = 600; -plot.height = 480; - -// View the plot in a window: -plot.view( 'window' ); diff --git a/ctor/examples/scatter b/ctor/examples/scatter deleted file mode 100644 index 38a295e..0000000 --- a/ctor/examples/scatter +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env node -'use strict'; - -var randn = require( '@stdlib/random/base/box-muller' ); -var Float64Array = require( '@stdlib/array/float64' ); -var Float32Array = require( '@stdlib/array/float32' ); -var Plot = require( './../lib' ); - -var plot; -var opts; -var x1; -var x2; -var y1; -var y2; -var i; - -// Create some data... -x1 = new Float64Array( 1000 ); -x2 = new Float64Array( x1.length ); -y1 = new Float64Array( x1.length ); -y2 = new Float32Array( x1.length ); -for ( i = 0; i < x1.length; i++ ) { - x1[ i ] = 30.0 + (7.5*randn()); - x2[ i ] = 40.0 + (12.5*randn()); - y1[ i ] = 50.0 + (10.0*randn()); - y2[ i ] = 30.0 + (5.0*randn()); -} - -// Define the plot options: -opts = { - 'width': 600, - 'height': 480, - 'xMin': 0.0, - 'xMax': 100.0, - 'yMin': 0.0, - 'yMax': 100.0, - 'lineStyle': 'none', - 'symbols': 'closed-circle', - 'symbolsSize': 6, - 'symbolsOpacity': 0.2 -}; - -// Create a new plot: -plot = new Plot( [ x1, x2 ], [ y1, y2 ], opts ); - -// View the plot in a window: -plot.view( 'window' ); diff --git a/ctor/examples/scatterrug b/ctor/examples/scatterrug deleted file mode 100644 index b801e75..0000000 --- a/ctor/examples/scatterrug +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env node -'use strict'; - -var randn = require( '@stdlib/random/base/box-muller' ); -var Float64Array = require( '@stdlib/array/float64' ); -var Float32Array = require( '@stdlib/array/float32' ); -var Plot = require( './../lib' ); - -var plot; -var opts; -var x1; -var x2; -var y1; -var y2; -var i; - -// Create some data... -x1 = new Float64Array( 1000 ); -x2 = new Float64Array( x1.length ); -y1 = new Float64Array( x1.length ); -y2 = new Float32Array( x1.length ); -for ( i = 0; i < x1.length; i++ ) { - x1[ i ] = 30.0 + (7.5*randn()); - x2[ i ] = 40.0 + (12.5*randn()); - y1[ i ] = 50.0 + (10.0*randn()); - y2[ i ] = 30.0 + (5.0*randn()); -} - -// Define the plot options: -opts = { - 'width': 600, - 'height': 480, - 'xMin': 0.0, - 'xMax': 100.0, - 'yMin': 0.0, - 'yMax': 100.0, - 'lineStyle': 'none', - 'symbols': 'closed-circle', - 'symbolsSize': 6, - 'symbolsOpacity': 0.2, - 'xRug': true, - 'yRug': true, - 'xRugOrient': 'top', - 'yRugOrient': 'right' -}; - -// Create a new plot: -plot = new Plot( [ x1, x2 ], [ y1, y2 ], opts ); - -// View the plot in a window: -plot.view( 'window' ); diff --git a/ctor/examples/timeseries b/ctor/examples/timeseries deleted file mode 100644 index 2d61f50..0000000 --- a/ctor/examples/timeseries +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env node -'use strict'; - -var randn = require( '@stdlib/random/base/box-muller' ); -var Float64Array = require( '@stdlib/array/float64' ); -var now = require( '@stdlib/time/now' ); -var Plot = require( './../lib' ); - -var t; -var x; -var y; -var i; - -// Create some data... -t = now() * 1000; -x = new Float64Array( 100 ); -y = new Float64Array( x.length ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = t + (i*360000); - y[ i ] = 50.0 + (10.0*randn()); -} - -// Create a new plot: -var plot = new Plot( [ x ], [ y ] ); -plot.width = 600; -plot.height = 480; -plot.xScale = 'time'; -plot.xTickFormat = '%H:%M'; - -// View the plot in a browser: -plot.view( 'browser' ); diff --git a/ctor/lib/accessors/is_defined.js b/ctor/lib/accessors/is_defined.js deleted file mode 100644 index 727ca23..0000000 --- a/ctor/lib/accessors/is_defined.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isnan = require( '@stdlib/assert/is-nan' ).isPrimitive; - - -// VARIABLES // - -var debug = logger( 'plot:accessor:is-defined' ); - - -// MAIN // - -/** -* Accessor function which determines whether a datum is defined. -* -* @private -* @param {number} d - datum -* @param {integer} i - index -* @returns {boolean} boolean indicating whether a datum is defined -*/ -function isDefined( d ) { - var bool = !isnan( d ); - debug( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool ); - return bool; -} - - -// EXPORTS // - -module.exports = isDefined; diff --git a/ctor/lib/defaults.js b/ctor/lib/defaults.js deleted file mode 100644 index 520790a..0000000 --- a/ctor/lib/defaults.js +++ /dev/null @@ -1,191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNodeREPL = require( '@stdlib/assert/is-node-repl' ); -var isDefined = require( './accessors/is_defined.js' ); - - -// MAIN // - -/** -* Returns default options. -* -* @private -* @returns {Object} default options -*/ -function defaults() { - var isREPL; - var o; - - isREPL = isNodeREPL(); - o = {}; - - // Boolean indicating whether to re-render on a change event: - o.autoRender = false; - - // Boolean indicating whether to generate an updated view on a render event: - o.autoView = false; - - // Data colors: - o.colors = 'category10'; - - // Plot description: - o.description = ''; - - // Plot engine: - o.engine = 'svg'; - - // Plot height: - o.height = 400; // px - - // Accessor indicating whether a datum is defined: - o.isDefined = isDefined; - - // Data labels: - o.labels = []; - - // Data line opacity: - o.lineOpacity = 0.9; // [0,1] - - // Data line style(s): - o.lineStyle = '-'; - - // Data line width(s): - o.lineWidth = 2; // px - - // FIXME: padding props depend on orientation (may require using `null` to flag) - - // Bottom padding: - o.paddingBottom = 80; // px - - // Left padding: - o.paddingLeft = 90; // px - - // Right padding: - o.paddingRight = 20; // px - - // Top padding: - o.paddingTop = 80; // px - - // Render format: - o.renderFormat = 'vdom'; - - // Data symbols: - o.symbols = 'none'; - - // Symbols opacity: - o.symbolsOpacity = 0.9; // [0,1] - - // Symbols size: - o.symbolsSize = 6; // px - - // Plot title: - o.title = ''; - - // Plot viewer: - if ( isREPL ) { - o.viewer = 'window'; - } else { - o.viewer = 'none'; - } - // Plot width: - o.width = 400; // px - - // x-values: - o.x = []; - - // x-axis orientation: - o.xAxisOrient = 'bottom'; - - // x-axis label: - o.xLabel = 'x'; - - // Maximum value of x-axis domain: - o.xMax = null; - - // Minimum value of x-axis domain: - o.xMin = null; - - // Number of x-axis tick marks: - o.xNumTicks = 5; - - // Boolean indicating whether to render a rug plot along the x-axis: - o.xRug = false; - - // x-axis rug orientation: - o.xRugOrient = 'bottom'; - - // x-axis rug opacity: - o.xRugOpacity = 0.1; // [0,1] - - // x-axis rug tick (tassel) size: - o.xRugSize = 6; // px - - // x-axis scale: - o.xScale = 'linear'; - - // x-axis tick format: - o.xTickFormat = null; - - // y-values: - o.y = []; - - // y-axis orientation: - o.yAxisOrient = 'left'; - - // y-axis label: - o.yLabel = 'y'; - - // Maximum value of y-axis domain: - o.yMax = null; - - // Minimum value of y-axis domain: - o.yMin = null; - - // Number of y-axis tick marks: - o.yNumTicks = 5; - - // Boolean indicating whether to render a rug plot along the y-axis: - o.yRug = false; - - // y-axis rug orientation: - o.yRugOrient = 'left'; - - // y-axis rug opacity: - o.yRugOpacity = 0.1; // [0,1] - - // y-axis rug tick (tassel) size: - o.yRugSize = 6; // px - - // y-axis scale: - o.yScale = 'linear'; - - // y-axis tick format: - o.yTickFormat = null; - - return o; -} - - -// EXPORTS // - -module.exports = defaults; diff --git a/ctor/lib/factory.js b/ctor/lib/factory.js deleted file mode 100644 index 4f43c95..0000000 --- a/ctor/lib/factory.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isObject = require( '@stdlib/assert/is-plain-object' ); -var format = require( '@stdlib/string/format' ); -var copy = require( '@stdlib/utils/copy' ); -var Plot = require( './main.js' ); - - -// MAIN // - -/** -* Returns a reusable function for generating plots. -* -* @param {Options} [options] - factory options -* TODO -* @throws {TypeError} must provide an object -* @returns {Function} plot function -* -* @example -* var opts = { -* 'width': 600, -* 'height': 400 -* }; -* var plot = factory( opts ); -* var h1 = plot( [[1,2,3]], [[1,0,1]] ); -* var h2 = plot( [[4,5,6]], [[0,1,0]] ); -*/ -function factory( options ) { - var opts; - if ( arguments.length ) { - if ( !isObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - opts = copy( options ); - } else { - opts = {}; - } - return plot; - - /** - * Creates a plot. - * - * @private - * @param {Array} [x] - x-values - * @param {Array} [y] - y-values - * @throws {TypeError} must provide valid options - * @returns {Plot} plot instance - */ - function plot( x, y ) { - if ( arguments.length === 2 ) { - return new Plot( x, y, opts ); - } - return new Plot( opts ); - } -} - - -// EXPORTS // - -module.exports = factory; diff --git a/ctor/lib/index.js b/ctor/lib/index.js deleted file mode 100644 index 8f4246c..0000000 --- a/ctor/lib/index.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Create a 2-dimensional plot. -* -* @module @stdlib/plot/ctor -* -* @example -* var Plot = require( '@stdlib/plot/ctor' ); -* -* var x = [ 1, 2, 3 ]; -* var y = [ 1, 0, 1 ]; -* -* var p = new Plot( [ x ], [ y ] ); -* -* @example -* var Plot = require( '@stdlib/plot/ctor' ); -* -* var opts = { -* 'width': 600, -* 'height': 400 -* }; -* var myPlot = Plot.factory( opts ); -* -* var h1 = myPlot( [[1,2,3]], [[1,0,1]] ); -* var h2 = myPlot( [[4,5,6]], [[0,1,0]] ); -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var factory = require( './factory.js' ); - - -// MAIN // - -setReadOnly( main, 'factory', factory ); - - -// EXPORTS // - -module.exports = main; diff --git a/ctor/lib/main.js b/ctor/lib/main.js deleted file mode 100644 index bec167a..0000000 --- a/ctor/lib/main.js +++ /dev/null @@ -1,1911 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var copy = require( '@stdlib/utils/copy' ); -var inherit = require( '@stdlib/utils/inherit' ); -var mergeFcn = require( '@stdlib/utils/merge' ).factory; -var minstd = require( '@stdlib/random/base/minstd' ); -var format = require( '@stdlib/string/format' ); -var view = require( './view/view.js' ); -var defaults = require( './defaults.js' ); -var setX = require( './props/x/set.js' ); -var getX = require( './props/x/get.js' ); -var setY = require( './props/y/set.js' ); -var getY = require( './props/y/get.js' ); -var setLabels = require( './props/labels/set.js' ); -var getLabels = require( './props/labels/get.js' ); -var setIsDefined = require( './props/is-defined/set.js' ); -var getIsDefined = require( './props/is-defined/get.js' ); -var setColors = require( './props/colors/set.js' ); -var getColors = require( './props/colors/get.js' ); -var setLineStyle = require( './props/line-style/set.js' ); -var getLineStyle = require( './props/line-style/get.js' ); -var setLineOpacity = require( './props/line-opacity/set.js' ); -var getLineOpacity = require( './props/line-opacity/get.js' ); -var setLineWidth = require( './props/line-width/set.js' ); -var getLineWidth = require( './props/line-width/get.js' ); -var setSymbols = require( './props/symbols/set.js' ); -var getSymbols = require( './props/symbols/get.js' ); -var setSymbolsSize = require( './props/symbols-size/set.js' ); -var getSymbolsSize = require( './props/symbols-size/get.js' ); -var setSymbolsOpacity = require( './props/symbols-opacity/set.js' ); -var getSymbolsOpacity = require( './props/symbols-opacity/get.js' ); -var setWidth = require( './props/width/set.js' ); -var getWidth = require( './props/width/get.js' ); -var setHeight = require( './props/height/set.js' ); -var getHeight = require( './props/height/get.js' ); -var setPaddingLeft = require( './props/padding-left/set.js' ); -var getPaddingLeft = require( './props/padding-left/get.js' ); -var setPaddingRight = require( './props/padding-right/set.js' ); -var getPaddingRight = require( './props/padding-right/get.js' ); -var setPaddingTop = require( './props/padding-top/set.js' ); -var getPaddingTop = require( './props/padding-top/get.js' ); -var setPaddingBottom = require( './props/padding-bottom/set.js' ); -var getPaddingBottom = require( './props/padding-bottom/get.js' ); -var setXMin = require( './props/x-min/set.js' ); -var getXMin = require( './props/x-min/get.js' ); -var setXMax = require( './props/x-max/set.js' ); -var getXMax = require( './props/x-max/get.js' ); -var setYMin = require( './props/y-min/set.js' ); -var getYMin = require( './props/y-min/get.js' ); -var setYMax = require( './props/y-max/set.js' ); -var getYMax = require( './props/y-max/get.js' ); -var setXScale = require( './props/x-scale/set.js' ); -var getXScale = require( './props/x-scale/get.js' ); -var setYScale = require( './props/y-scale/set.js' ); -var getYScale = require( './props/y-scale/get.js' ); -var setXTickFormat = require( './props/x-tick-format/set.js' ); -var getXTickFormat = require( './props/x-tick-format/get.js' ); -var setYTickFormat = require( './props/y-tick-format/set.js' ); -var getYTickFormat = require( './props/y-tick-format/get.js' ); -var setXNumTicks = require( './props/x-num-ticks/set.js' ); -var getXNumTicks = require( './props/x-num-ticks/get.js' ); -var setYNumTicks = require( './props/y-num-ticks/set.js' ); -var getYNumTicks = require( './props/y-num-ticks/get.js' ); -var setXAxisOrient = require( './props/x-axis-orient/set.js' ); -var getXAxisOrient = require( './props/x-axis-orient/get.js' ); -var setYAxisOrient = require( './props/y-axis-orient/set.js' ); -var getYAxisOrient = require( './props/y-axis-orient/get.js' ); -var setXRug = require( './props/x-rug/set.js' ); -var getXRug = require( './props/x-rug/get.js' ); -var setYRug = require( './props/y-rug/set.js' ); -var getYRug = require( './props/y-rug/get.js' ); -var setXRugOrient = require( './props/x-rug-orient/set.js' ); -var getXRugOrient = require( './props/x-rug-orient/get.js' ); -var setYRugOrient = require( './props/y-rug-orient/set.js' ); -var getYRugOrient = require( './props/y-rug-orient/get.js' ); -var setXRugOpacity = require( './props/x-rug-opacity/set.js' ); -var getXRugOpacity = require( './props/x-rug-opacity/get.js' ); -var setYRugOpacity = require( './props/y-rug-opacity/set.js' ); -var getYRugOpacity = require( './props/y-rug-opacity/get.js' ); -var setXRugSize = require( './props/x-rug-size/set.js' ); -var getXRugSize = require( './props/x-rug-size/get.js' ); -var setYRugSize = require( './props/y-rug-size/set.js' ); -var getYRugSize = require( './props/y-rug-size/get.js' ); -var setDescription = require( './props/description/set.js' ); -var getDescription = require( './props/description/get.js' ); -var setTitle = require( './props/title/set.js' ); -var getTitle = require( './props/title/get.js' ); -var setXLabel = require( './props/x-label/set.js' ); -var getXLabel = require( './props/x-label/get.js' ); -var setYLabel = require( './props/y-label/set.js' ); -var getYLabel = require( './props/y-label/get.js' ); -var setEngine = require( './props/engine/set.js' ); -var getEngine = require( './props/engine/get.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var setRenderFormat = require( './props/render-format/set.js' ); -var getRenderFormat = require( './props/render-format/get.js' ); -var setViewer = require( './props/viewer/set.js' ); -var getViewer = require( './props/viewer/get.js' ); -var setAutoView = require( './props/auto-view/set.js' ); -var getAutoView = require( './props/auto-view/get.js' ); -var getGraphWidth = require( './props/graph-width/get.js' ); -var getGraphHeight = require( './props/graph-height/get.js' ); -var getXDomain = require( './props/x-domain/get.js' ); -var getYDomain = require( './props/y-domain/get.js' ); -var getXRange = require( './props/x-range/get.js' ); -var getYRange = require( './props/y-range/get.js' ); -var getXPos = require( './props/x-pos/get.js' ); -var getYPos = require( './props/y-pos/get.js' ); -var render = require( './render' ); -var viewMethod = require( './view' ); - - -// VARIABLES // - -var debug = logger( 'plot:main' ); -var PRIVATE_PROPS = [ - '_autoRender', - '_autoView', - '_colors', - '_description', - '_engine', - '_height', - '_isDefined', - '_labels', - '_lineOpacity', - '_lineStyle', - '_lineWidth', - '_paddingBottom', - '_paddingLeft', - '_paddingRight', - '_paddingTop', - '_renderFormat', - '_symbols', - '_symbolsOpacity', - '_symbolsSize', - '_title', - '_viewer', - '_width', - '_xAxisOrient', - '_xData', - '_xLabel', - '_xMax', - '_xMin', - '_xNumTicks', - '_xRug', - '_xRugOpacity', - '_xRugOrient', - '_xRugSize', - '_xScale', - '_xTickFormat', - '_yAxisOrient', - '_yData', - '_yLabel', - '_yMax', - '_yMin', - '_yNumTicks', - '_yRug', - '_yRugOpacity', - '_yRugOrient', - '_yRugSize', - '_yScale', - '_yTickFormat' -]; - - -// FUNCTIONS // - -var merge = mergeFcn({ - 'extend': false -}); - - -// MAIN // - -/** -* Plot constructor. -* -* @constructor -* @param {Array} [x] - x-values -* @param {Array} [y] - y-values -* @param {Options} [options] - constructor options -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @param {boolean} [options.autoView=false] - indicates whether to generate an updated view on a render event -* @param {(string|StringArray)} [options.colors='category10'] - data colors -* @param {string} [options.description=''] - plot description -* @param {string} [options.engine='svg'] - plot engine -* @param {PositiveNumber} [options.height=400] - plot height -* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined -* @param {(StringArray|EmptyArray)} [options.labels] - data labels -* @param {(number|NumberArray)} [options.lineOpacity=0.9] - data line opacity -* @param {(string|StringArray)} [options.lineStyle='-'] - data line style(s) -* @param {(NonNegativeInteger|Array)} [options.lineWidth=2] - data line width(s) -* @param {NonNegativeInteger} [options.paddingBottom=80] - bottom padding -* @param {NonNegativeInteger} [options.paddingLeft=90] - left padding -* @param {NonNegativeInteger} [options.paddingRight=20] - right padding -* @param {NonNegativeInteger} [options.paddingTop=80] - top padding -* @param {string} [options.renderFormat='vdom'] - plot render format -* @param {(string|StringArray)} [options.symbols='none'] - data symbols -* @param {(number|NumberArray)} [options.symbolsOpacity=0.9] - symbols opacity -* @param {(NonNegativeInteger|Array)} [options.symbolsSize=6] - symbols size -* @param {string} [options.title=''] - plot title -* @param {string} [options.viewer='none'] - plot viewer -* @param {PositiveNumber} [options.width=400] - plot width -* @param {Array} [options.x=[]] - x-values -* @param {string} [options.xAxisOrient='bottom'] - x-axis orientation -* @param {string} [options.xLabel='x'] - x-axis label -* @param {(Date|FiniteNumber|null)} [options.xMax=null] - maximum value of x-axis domain -* @param {(Date|FiniteNumber|null)} [options.xMin=null] - minimum value of x-axis domain -* @param {(NonNegativeInteger|null)} [options.xNumTicks=5] - number of x-axis tick marks -* @param {(boolean|BooleanArray)} [options.xRug=false] - indicates whether to render a rug plot along the x-axis -* @param {(string|StringArray)} [options.xRugOrient='bottom'] - x-axis rug orientation -* @param {(number|NumberArray)} [options.xRugOpacity=0.1] - x-axis rug opacity -* @param {(NonNegativeInteger|Array)} [options.xRugSize=6] - x-axis rug tick (tassel) size -* @param {string} [options.xScale='linear'] - x-axis scale -* @param {(string|null)} [options.xTickFormat=null] - x-axis tick format -* @param {Array} [options.y=[]] - y-values -* @param {string} [options.yAxisOrient='left'] - y-axis orientation -* @param {string} [options.yLabel='y'] - y-axis label -* @param {(FiniteNumber|null)} [options.yMax=null] - maximum value of y-axis domain -* @param {(FiniteNumber|null)} [options.yMin=null] - minimum value of y-axis domain -* @param {(NonNegativeInteger|null)} [options.yNumTicks=5] - number of y-axis tick marks -* @param {(boolean|BooleanArray)} [options.yRug=false] - indicates whether to render a rug plot along the y-axis -* @param {(string|StringArray)} [options.yRugOrient='left'] - y-axis rug orientation -* @param {(number|NumberArray)} [options.yRugOpacity=0.1] - y-axis rug opacity -* @param {(NonNegativeInteger|Array)} [options.yRugSize=6] - y-axis rug tick (tassel) size -* @param {string} [options.yScale='linear'] - y-axis scale -* @param {(string|null)} [options.yTickFormat=null] - y-axis tick format -* @throws {TypeError} must provide valid options -* @returns {Plot} Plot instance -* -* @example -* var plot = new Plot(); -*/ -function Plot() { - var options; - var nargs; - var keys; - var self; - var opts; - var key; - var i; - - nargs = arguments.length; - if ( !(this instanceof Plot) ) { - if ( nargs === 0 ) { - return new Plot(); - } - if ( nargs === 1 ) { - return new Plot( arguments[0] ); - } - if ( nargs === 2 ) { - return new Plot( arguments[0], arguments[1] ); - } - return new Plot( arguments[0], arguments[1], arguments[2] ); - } - self = this; - - opts = defaults(); - if ( nargs === 0 ) { - options = {}; - } else if ( nargs === 1 ) { - options = arguments[ 0 ]; - if ( !isObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - } else if ( nargs === 2 ) { - options = { - 'x': arguments[ 0 ], - 'y': arguments[ 1 ] - }; - } else if ( nargs > 2 ) { - if ( !isObject( arguments[2] ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', arguments[2] ) ); - } - options = copy( arguments[2] ); // avoid mutation - options.x = arguments[ 0 ]; - options.y = arguments[ 1 ]; - } - opts = merge( opts, options ); - - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { - defineProperty( this, PRIVATE_PROPS[i], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - }); - } - // Set a clipping path id: - defineProperty( this, '_clipPathId', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': minstd().toString() // TODO: uuid - }); - - // Initialize an internal cache for renderers... - defineProperty( this, '$', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': {} - }); - defineProperty( this.$, 'svg', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': {} - }); - - // Set options... - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - this[ key ] = opts[ key ]; - } - - // Add event listeners: - this.on( 'change', onChange ); - this.on( 'render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a change event. - * - * @private - */ - function onChange() { - /* eslint-disable no-underscore-dangle */ - debug( 'Received a change event.' ); - if ( self._autoRender ) { - self.render(); - } - } - - /** - * Callback invoked upon receiving a render event. - * - * @private - * @param {*} plot - rendered plot - */ - function onRender( plot ) { - /* eslint-disable no-underscore-dangle */ - debug( 'Received a render event.' ); - if ( self._autoView ) { - debug( 'Viewer: %s.', self._viewer ); - debug( 'Generating view...' ); - view( self, self._viewer, plot ); - } - } -} - -/* -* Inherit from the `EventEmitter` prototype. -*/ -inherit( Plot, EventEmitter ); - -/** -* `x` values. -* -* @name x -* @memberof Plot.prototype -* @type {Array} -* @throws {TypeError} must be an array -* @default [] -* -* @example -* var plot = new Plot(); -* plot.x = [ [ 1417563950959, 1417563952959 ] ]; -* -* @example -* var plot = new Plot({ -* 'x': [ [ 1417563950959, 1417563952959 ] ] -* }); -* var x = plot.x; -* // returns [ [ 1417563950959, 1417563952959 ] ] -*/ -defineProperty( Plot.prototype, 'x', { - 'configurable': false, - 'enumerable': true, - 'set': setX, - 'get': getX -}); - -/** -* `y` values. -* -* @name y -* @memberof Plot.prototype -* @type {Array} -* @throws {TypeError} must be an array -* @default [] -* -* @example -* var plot = new Plot(); -* plot.x = [ [ 1417563950959, 1417563952959 ] ]; -* plot.y = [ [ 0.25, 0.23 ] ]; -* -* @example -* var plot = new Plot({ -* 'x': [ [ 1417563950959, 1417563952959 ] ], -* 'y': [ [ 0.25, 0.23 ] ] -* }); -* var y = plot.y; -* // returns [ [ 0.25, 0.23 ] ] -*/ -defineProperty( Plot.prototype, 'y', { - 'configurable': false, - 'enumerable': true, - 'set': setY, - 'get': getY -}); - -/** -* Data labels. -* -* @name labels -* @memberof Plot.prototype -* @type {(StringArray|EmptyArray)} -* @throws {TypeError} must be either an array of strings or an empty array -* @default [] -* -* @example -* var plot = new Plot(); -* plot.labels = [ 'beep', 'boop' ]; -* -* @example -* var plot = new Plot({ -* 'labels': [ 'beep', 'boop' ] -* }); -* var labels = plot.labels; -* // returns [ 'beep', 'boop' ] -*/ -defineProperty( Plot.prototype, 'labels', { - 'configurable': false, - 'enumerable': true, - 'set': setLabels, - 'get': getLabels -}); - -/** -* Accessor which defines whether a datum is defined. -* -* ## Notes -* -* - This accessor is used to define how missing values are encoded. -* - The default behavior is to ignore values which are `NaN`. -* -* @name isDefined -* @memberof Plot.prototype -* @type {Function} -* @param {*} d - datum -* @param {integer} i - index -* @throws {TypeError} must be a function -* -* @example -* var plot = new Plot(); -* plot.isDefined = function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* -* @example -* function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* var plot = new Plot({ -* 'isDefined': isDefined -* }); -* var fcn = plot.isDefined; -* // returns -*/ -defineProperty( Plot.prototype, 'isDefined', { - 'configurable': false, - 'enumerable': true, - 'set': setIsDefined, - 'get': getIsDefined -}); - -/** -* Data colors. When retrieved, the returned value is always an `array`. -* -* @name colors -* @memberof Plot.prototype -* @type {(string|StringArray)} -* @throws {TypeError} must be either a string or an array of strings -* @default 'category10' -* -* @example -* var plot = new Plot(); -* plot.colors = 'category20'; -* -* @example -* var plot = new Plot({ -* 'colors': 'category20' -* }); -* var colors = plot.colors; -* // returns [...] -*/ -defineProperty( Plot.prototype, 'colors', { - 'configurable': false, - 'enumerable': true, - 'set': setColors, - 'get': getColors -}); - -/** -* Data line style(s). -* -* ## Notes -* -* - When retrieved, the returned value is always an `array`. -* -* @name lineStyle -* @memberof Plot.prototype -* @type {(string|StringArray)} -* @throws {TypeError} must be a string or string array -* @throws {Error} must be a supported line style -* @default '-' -* -* @example -* var plot = new Plot(); -* plot.lineStyle = [ '-', 'none' ]; -* -* @example -* var plot = new Plot({ -* 'lineStyle': 'none' -* }); -* var lineStyle = plot.lineStyle; -* // returns [ 'none' ] -*/ -defineProperty( Plot.prototype, 'lineStyle', { - 'configurable': false, - 'enumerable': true, - 'set': setLineStyle, - 'get': getLineStyle -}); - -/** -* Data line opacity. -* -* ## Notes -* -* - When retrieved, the returned value is always an `array`. -* -* @name lineOpacity -* @memberof Plot.prototype -* @type {(number|NumberArray)} -* @throws {TypeError} must be a number or number array -* @throws {RangeError} must be a number on the interval `[0,1]` -* @default '0.9' -* -* @example -* var plot = new Plot(); -* plot.lineOpacity = [ 1.0, 0.5 ]; -* -* @example -* var plot = new Plot({ -* 'lineOpacity': 0.5 -* }); -* var opacity = plot.lineOpacity; -* // returns [ 0.5 ] -*/ -defineProperty( Plot.prototype, 'lineOpacity', { - 'configurable': false, - 'enumerable': true, - 'set': setLineOpacity, - 'get': getLineOpacity -}); - -/** -* Data line width. -* -* ## Notes -* -* - When retrieved, the returned value is always an `array`. -* -* @name lineWidth -* @memberof Plot.prototype -* @type {(NonNegativeInteger|NonNegativeIntegerArray)} -* @throws {TypeError} must be a nonnegative integer or nonnegative integer array -* @default 2 -* -* @example -* var plot = new Plot(); -* plot.lineWidth = 1; -* -* @example -* var plot = new Plot({ -* 'lineWidth': [ 1, 3 ] -* }); -* var width = plot.lineWidth; -* // returns [ 1, 3 ] -*/ -defineProperty( Plot.prototype, 'lineWidth', { - 'configurable': false, - 'enumerable': true, - 'set': setLineWidth, - 'get': getLineWidth -}); - -/** -* Data symbols. When retrieved, the returned value is always an `array`. -* -* @name symbols -* @memberof Plot.prototype -* @type {(string|StringArray)} -* @throws {TypeError} must be a string or string array -* @throws {Error} must be a supported symbol -* @default 'none' -* -* @example -* var plot = new Plot(); -* plot.symbols = [ 'open-circle', 'closed-circle' ]; -* -* @example -* var plot = new Plot({ -* 'symbols': 'closed-circle' -* }); -* var symbols = plot.symbols; -* // returns [ 'closed-circle' ] -*/ -defineProperty( Plot.prototype, 'symbols', { - 'configurable': false, - 'enumerable': true, - 'set': setSymbols, - 'get': getSymbols -}); - -/** -* Symbols size. When retrieved, the returned value is always an `array`. -* -* @name symbolsSize -* @memberof Plot.prototype -* @type {(NonNegativeInteger|NonNegativeIntegerArray)} -* @throws {TypeError} must be a nonnegative integer or nonnegative integer array -* @default 6 -* -* @example -* var plot = new Plot(); -* plot.symbolsSize = 4; -* -* @example -* var plot = new Plot({ -* 'symbolsSize': [ 4, 6 ] -* }); -* var size = plot.symbolsSize; -* // returns [ 4, 6 ] -*/ -defineProperty( Plot.prototype, 'symbolsSize', { - 'configurable': false, - 'enumerable': true, - 'set': setSymbolsSize, - 'get': getSymbolsSize -}); - -/** -* Symbols opacity. When retrieved, the returned value is always an `array`. -* -* @name symbolsOpacity -* @memberof Plot.prototype -* @type {(number|NumberArray)} -* @throws {TypeError} must be a number or number array -* @throws {RangeError} must be a number on the interval `[0,1]` -* @default 0.9 -* -* @example -* var plot = new Plot(); -* plot.symbolsOpacity = [ 0.2, 0.5 ]; -* -* @example -* var plot = new Plot({ -* 'symbolsOpacity': 0.2 -* }); -* var opacity = plot.symbolsOpacity; -* // returns [ 0.2 ] -*/ -defineProperty( Plot.prototype, 'symbolsOpacity', { - 'configurable': false, - 'enumerable': true, - 'set': setSymbolsOpacity, - 'get': getSymbolsOpacity -}); - -/** -* Plot width. -* -* @name width -* @memberof Plot.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 (px) -* -* @example -* var plot = new Plot(); -* plot.width = 100; -* -* @example -* var plot = new Plot({ -* 'width': 480 -* }); -* var width = plot.width; -* // returns 480 -*/ -defineProperty( Plot.prototype, 'width', { - 'configurable': false, - 'enumerable': true, - 'set': setWidth, - 'get': getWidth -}); - -/** -* Plot height. -* -* @name height -* @memberof Plot.prototype -* @type {PositiveNumber} -* @throws {TypeError} must be a positive number -* @default 400 (px) -* -* @example -* var plot = new Plot(); -* plot.height = 100; -* -* @example -* var plot = new Plot({ -* 'height': 360 -* }); -* var height = plot.height; -* // returns 360 -*/ -defineProperty( Plot.prototype, 'height', { - 'configurable': false, - 'enumerable': true, - 'set': setHeight, - 'get': getHeight -}); - -/** -* Plot left padding. -* -* ## Notes -* -* - Typically used to create space for a left-oriented y-axis. -* -* @name paddingLeft -* @memberof Plot.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 90 (px) -* -* @example -* var plot = new Plot(); -* plot.paddingLeft = 100; -* -* @example -* var plot = new Plot({ -* 'paddingLeft': 100 -* }); -* var padding = plot.paddingLeft; -* // returns 100 -*/ -defineProperty( Plot.prototype, 'paddingLeft', { - 'configurable': false, - 'enumerable': true, - 'set': setPaddingLeft, - 'get': getPaddingLeft -}); - -/** -* Plot right padding. -* -* ## Notes -* -* - Typically used to create space for a right-oriented y-axis. -* -* @name paddingRight -* @memberof Plot.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 20 (px) -* -* @example -* var plot = new Plot(); -* plot.paddingRight = 100; -* -* @example -* var plot = new Plot({ -* 'paddingRight': 100 -* }); -* var padding = plot.paddingRight; -* // returns 100 -*/ -defineProperty( Plot.prototype, 'paddingRight', { - 'configurable': false, - 'enumerable': true, - 'set': setPaddingRight, - 'get': getPaddingRight -}); - -/** -* Plot top padding. -* -* ## Notes -* -* - Typically used to create space for a title or top-oriented x-axis. -* -* @name paddingTop -* @memberof Plot.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 80 (px) -* -* @example -* var plot = new Plot(); -* plot.paddingTop = 100; -* -* @example -* var plot = new Plot({ -* 'paddingTop': 100 -* }); -* var padding = plot.paddingTop; -* // returns 100 -*/ -defineProperty( Plot.prototype, 'paddingTop', { - 'configurable': false, - 'enumerable': true, - 'set': setPaddingTop, - 'get': getPaddingTop -}); - -/** -* Plot bottom padding. -* -* ## Notes -* -* - Typically used to create space for a bottom-oriented y-axis. -* -* @name paddingBottom -* @memberof Plot.prototype -* @type {NonNegativeInteger} -* @throws {TypeError} must be a nonnegative integer -* @default 80 (px) -* -* @example -* var plot = new Plot(); -* plot.paddingBottom = 100; -* -* @example -* var plot = new Plot({ -* 'paddingBottom': 100 -* }); -* var padding = plot.paddingBottom; -* // returns 100 -*/ -defineProperty( Plot.prototype, 'paddingBottom', { - 'configurable': false, - 'enumerable': true, - 'set': setPaddingBottom, - 'get': getPaddingBottom -}); - -/** -* Minimum value of the x-axis domain. -* -* ## Notes -* -* - When retrieved, if the value has been set to `null`, the returned value is computed from the `x` data. -* -* @name xMin -* @memberof Plot.prototype -* @type {(FiniteNumber|null)} -* @throws {TypeError} must be a finite number or null -* @default null -* -* @example -* var plot = new Plot(); -* plot.xMin = -1.0; -* -* @example -* var plot = new Plot({ -* 'xMin': -10.0 -* }); -* var xmin = plot.xMin; -* // returns -10.0 -*/ -defineProperty( Plot.prototype, 'xMin', { - 'configurable': false, - 'enumerable': true, - 'set': setXMin, - 'get': getXMin -}); - -/** -* Maximum value of the x-axis domain. -* -* ## Notes -* -* - When retrieved, if the value has been set to `null`, the returned value is computed from the `x` data. -* -* @name xMax -* @memberof Plot.prototype -* @type {(FiniteNumber|null)} -* @throws {TypeError} must be a finite number or null -* @default null -* -* @example -* var plot = new Plot(); -* plot.xMax = 100.0; -* -* @example -* var plot = new Plot({ -* 'xMax': 10.0 -* }); -* var xmax = plot.xMax; -* // returns 10.0 -*/ -defineProperty( Plot.prototype, 'xMax', { - 'configurable': false, - 'enumerable': true, - 'set': setXMax, - 'get': getXMax -}); - -/** -* Minimum value of the y-axis domain. -* -* ## Notes -* -* - When retrieved, if the value has been set to `null`, the returned value is computed from the `y` data. -* -* @name yMin -* @memberof Plot.prototype -* @type {(FiniteNumber|null)} -* @throws {TypeError} must be a finite number or null -* @default null -* -* @example -* var plot = new Plot(); -* plot.yMin = -100.0; -* -* @example -* var plot = new Plot({ -* 'yMin': 3.14 -* }); -* var ymin = plot.yMin; -* // returns 3.14 -*/ -defineProperty( Plot.prototype, 'yMin', { - 'configurable': false, - 'enumerable': true, - 'set': setYMin, - 'get': getYMin -}); - -/** -* Maximum value of the y-axis domain. -* -* ## Notes -* -* - When retrieved, if the value has been set to `null`, the returned value is computed from the `y` data. -* -* @name yMax -* @memberof Plot.prototype -* @type {(FiniteNumber|null)} -* @throws {TypeError} must be a finite number or null -* @default null -* -* @example -* var plot = new Plot(); -* plot.yMax = 100.0; -* -* @example -* var plot = new Plot({ -* 'yMax': 31.4 -* }); -* var ymax = plot.yMax; -* // returns 31.4 -*/ -defineProperty( Plot.prototype, 'yMax', { - 'configurable': false, - 'enumerable': true, - 'set': setYMax, - 'get': getYMax -}); - -/** -* Scale function for mapping values to a coordinate along the x-axis. When retrieved, the returned value is a scale function. -* -* @name xScale -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default 'linear' -* -* @example -* var plot = new Plot(); -* plot.xScale = 'time'; -* -* @example -* var plot = new Plot({ -* 'xScale': 'time' -* }); -* var scale = plot.xScale; -* // returns -*/ -defineProperty( Plot.prototype, 'xScale', { - 'configurable': false, - 'enumerable': true, - 'set': setXScale, - 'get': getXScale -}); - -/** -* Scale function for mapping values to a coordinate along the y-axis. When retrieved, the returned value is a scale function. -* -* @name yScale -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default 'linear' -* -* @example -* var plot = new Plot(); -* plot.yScale = 'linear'; -* -* @example -* var plot = new Plot({ -* 'yScale': 'linear' -* }); -* var scale = plot.yScale; -* // returns -*/ -defineProperty( Plot.prototype, 'yScale', { - 'configurable': false, - 'enumerable': true, - 'set': setYScale, - 'get': getYScale -}); - -/** -* x-axis tick format. -* -* ## Notes -* -* - When retrieved, if the value is not `null`, the returned value is a formatting function. -* -* @name xTickFormat -* @memberof Plot.prototype -* @type {(string|null)} -* @throws {TypeError} must be a string or null -* @default null -* -* @example -* var plot = new Plot(); -* plot.xScale = 'time'; -* plot.xTickFormat = '%H:%M'; -* -* @example -* var plot = new Plot({ -* 'xScale': 'time', -* 'xTickFormat': '%H:%M' -* }); -* var fmt = plot.xTickFormat; -* // returns -*/ -defineProperty( Plot.prototype, 'xTickFormat', { - 'configurable': false, - 'enumerable': true, - 'set': setXTickFormat, - 'get': getXTickFormat -}); - -/** -* y-axis tick format. -* -* ## Notes -* -* - If the value is not `null`, when retrieved, the returned value is a formatting function. -* -* @name yTickFormat -* @memberof Plot.prototype -* @type {(string|null)} -* @throws {TypeError} must be a string or null -* @default null -* -* @example -* var plot = new Plot(); -* plot.yTickFormat = '.0%'; -* -* @example -* var plot = new Plot({ -* 'yTickFormat': '.0%' -* }); -* var fmt = plot.yTickFormat; -* // returns -*/ -defineProperty( Plot.prototype, 'yTickFormat', { - 'configurable': false, - 'enumerable': true, - 'set': setYTickFormat, - 'get': getYTickFormat -}); - -/** -* Number of x-axis tick marks. -* -* @name xNumTicks -* @memberof Plot.prototype -* @type {(NonNegativeInteger|null)} -* @throws {TypeError} must be a nonnegative integer or null -* @default 5 -* -* @example -* var plot = new Plot(); -* plot.xNumTicks = 10; -* -* @example -* var plot = new Plot({ -* 'xNumTicks': 10 -* }); -* var ticks = plot.xNumTicks; -* // returns 10 -*/ -defineProperty( Plot.prototype, 'xNumTicks', { - 'configurable': false, - 'enumerable': true, - 'set': setXNumTicks, - 'get': getXNumTicks -}); - -/** -* Number of y-axis tick marks. -* -* @name yNumTicks -* @memberof Plot.prototype -* @type {(NonNegativeInteger|null)} -* @throws {TypeError} must be a nonnegative integer or null -* @default 5 -* -* @example -* var plot = new Plot(); -* plot.yNumTicks = 10; -* -* @example -* var plot = new Plot({ -* 'yNumTicks': 10 -* }); -* var ticks = plot.yNumTicks; -* // returns 10 -*/ -defineProperty( Plot.prototype, 'yNumTicks', { - 'configurable': false, - 'enumerable': true, - 'set': setYNumTicks, - 'get': getYNumTicks -}); - -/** -* x-axis orientation. -* -* @name xAxisOrient -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be either `'top'` or `'bottom'` -* @default 'bottom' -* -* @example -* var plot = new Plot(); -* plot.xAxisOrient = 'bottom'; -* -* @example -* var plot = new Plot({ -* 'xAxisOrient': 'bottom' -* }); -* var orientation = plot.xAxisOrient; -* // returns 'bottom' -*/ -defineProperty( Plot.prototype, 'xAxisOrient', { - 'configurable': false, - 'enumerable': true, - 'set': setXAxisOrient, - 'get': getXAxisOrient -}); - -/** -* y-axis orientation. -* -* @name yAxisOrient -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be either `'left'` or `'right'` -* @default 'left' -* -* @example -* var plot = new Plot(); -* plot.yAxisOrient = 'left'; -* -* @example -* var plot = new Plot({ -* 'yAxisOrient': 'left' -* }); -* var orientation = plot.yAxisOrient; -* // returns 'left' -*/ -defineProperty( Plot.prototype, 'yAxisOrient', { - 'configurable': false, - 'enumerable': true, - 'set': setYAxisOrient, - 'get': getYAxisOrient -}); - -/** -* Boolean flag(s) indicating whether to display a rug plot along the x-axis. When retrieved, the returned value is always an `array`. -* -* @name xRug -* @memberof Plot.prototype -* @type {(boolean|BooleanArray)} -* @throws {TypeError} must be a boolean or boolean array -* @default false -* -* @example -* var plot = new Plot({ -* 'xRug': true -* }); -* -* var bool = plot.xRug; -* // returns [ true ] -*/ -defineProperty( Plot.prototype, 'xRug', { - 'configurable': false, - 'enumerable': true, - 'set': setXRug, - 'get': getXRug -}); - -/** -* Boolean flag(s) indicating whether to display a rug plot along the y-axis. When retrieved, the returned value is always an `array`. -* -* @name yRug -* @memberof Plot.prototype -* @type {(boolean|BooleanArray)} -* @throws {TypeError} must be a boolean or boolean array -* @default false -* -* @example -* var plot = new Plot({ -* 'yRug': true -* }); -* -* var bool = plot.yRug; -* // returns [ true ] -*/ -defineProperty( Plot.prototype, 'yRug', { - 'configurable': false, - 'enumerable': true, - 'set': setYRug, - 'get': getYRug -}); - -/** -* x-axis rug orientation. When retrieved, the returned value is always an `array`. -* -* @name xRugOrient -* @memberof Plot.prototype -* @type {(string|StringArray)} -* @throws {TypeError} must be a string or string array -* @throws {TypeError} must be either `'top'` or `'bottom'` -* @default 'bottom' -* -* @example -* var plot = new Plot(); -* plot.xRugOrient = [ 'bottom', 'top' ]; -* -* @example -* var plot = new Plot({ -* 'xRugOrient': 'bottom' -* }); -* var orientation = plot.xRugOrient; -* // returns [ 'bottom' ] -*/ -defineProperty( Plot.prototype, 'xRugOrient', { - 'configurable': false, - 'enumerable': true, - 'set': setXRugOrient, - 'get': getXRugOrient -}); - -/** -* y-axis rug orientation. When retrieved, the returned value is always an `array`. -* -* @name yRugOrient -* @memberof Plot.prototype -* @type {(string|StringArray)} -* @throws {TypeError} must be a string or string array -* @throws {TypeError} must be either `'left'` or `'right'` -* @default 'left' -* -* @example -* var plot = new Plot(); -* plot.yRugOrient = [ 'right', 'left' ]; -* -* @example -* var plot = new Plot({ -* 'yRugOrient': 'left' -* }); -* var orientation = plot.yRugOrient; -* // returns [ 'left' ] -*/ -defineProperty( Plot.prototype, 'yRugOrient', { - 'configurable': false, - 'enumerable': true, - 'set': setYRugOrient, - 'get': getYRugOrient -}); - -/** -* x-axis rug opacity. When retrieved, the returned value is always an `array`. -* -* @name xRugOpacity -* @memberof Plot.prototype -* @type {(number|NumberArray)} -* @throws {TypeError} must be a number or number array -* @throws {RangeError} must be a number on the interval `[0,1]` -* @default 0.1 -* -* @example -* var plot = new Plot(); -* plot.xRugOpacity = [ 0.1, 0.5 ]; -* -* @example -* var plot = new Plot({ -* 'xRugOpacity': 0.1 -* }); -* var opacity = plot.xRugOpacity; -* // returns [ 0.1 ] -*/ -defineProperty( Plot.prototype, 'xRugOpacity', { - 'configurable': false, - 'enumerable': true, - 'set': setXRugOpacity, - 'get': getXRugOpacity -}); - -/** -* y-axis rug opacity. When retrieved, the returned value is always an `array`. -* -* @name yRugOpacity -* @memberof Plot.prototype -* @type {(number|NumberArray)} -* @throws {TypeError} must be a number or number array -* @throws {RangeError} must be a number on the interval `[0,1]` -* @default 0.1 -* -* @example -* var plot = new Plot(); -* plot.yRugOpacity = [ 0.1, 0.5 ]; -* -* @example -* var plot = new Plot({ -* 'yRugOpacity': 0.1 -* }); -* var opacity = plot.yRugOpacity; -* // returns [ 0.1 ] -*/ -defineProperty( Plot.prototype, 'yRugOpacity', { - 'configurable': false, - 'enumerable': true, - 'set': setYRugOpacity, - 'get': getYRugOpacity -}); - -/** -* x-axis rug tick (tassel) size. When retrieved, the returned value is always an `array`. -* -* @name xRugSize -* @memberof Plot.prototype -* @type {(NonNegativeInteger|Array)} -* @throws {TypeError} must be a nonnegative integer or nonnegative integer array -* @default 6 -* -* @example -* var plot = new Plot(); -* plot.xRugSize = [ 4, 6 ]; -* -* @example -* var plot = new Plot({ -* 'xRugSize': 4 -* }); -* var size = plot.xRugSize; -* // returns [ 4 ] -*/ -defineProperty( Plot.prototype, 'xRugSize', { - 'configurable': false, - 'enumerable': true, - 'set': setXRugSize, - 'get': getXRugSize -}); - -/** -* y-axis rug tick (tassel) size. When retrieved, the returned value is always an `array`. -* -* @name yRugSize -* @memberof Plot.prototype -* @type {(NonNegativeInteger|Array)} -* @throws {TypeError} must be a nonnegative integer or nonnegative integer array -* @default 6 -* -* @example -* var plot = new Plot(); -* plot.yRugSize = [ 4, 6 ]; -* -* @example -* var plot = new Plot({ -* 'yRugSize': 4 -* }); -* var size = plot.yRugSize; -* // returns [ 4 ] -*/ -defineProperty( Plot.prototype, 'yRugSize', { - 'configurable': false, - 'enumerable': true, - 'set': setYRugSize, - 'get': getYRugSize -}); - -/** -* Plot description. -* -* @name description -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default '' -* -* @example -* var plot = new Plot(); -* plot.description = 'Average stock market index covering the last 100 years.'; -* -* @example -* var plot = new Plot({ -* 'description': 'A plot description.' -* }); -* var desc = plot.description; -* // returns 'A plot description.' -*/ -defineProperty( Plot.prototype, 'description', { - 'configurable': false, - 'enumerable': true, - 'set': setDescription, - 'get': getDescription -}); - -/** -* Plot title. -* -* @name title -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default '' -* -* @example -* var plot = new Plot(); -* plot.title = 'Time Series'; -* -* @example -* var plot = new Plot({ -* 'title': 'Time Series' -* }); -* var t = plot.title; -* // returns 'Time Series' -*/ -defineProperty( Plot.prototype, 'title', { - 'configurable': false, - 'enumerable': true, - 'set': setTitle, - 'get': getTitle -}); - -/** -* x-axis label. -* -* @name xLabel -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default 'x' -* -* @example -* var plot = new Plot(); -* plot.xLabel = 'time'; -* -* @example -* var plot = new Plot({ -* 'xLabel': 'time' -* }); -* var xLabel = plot.xLabel; -* // returns 'time' -*/ -defineProperty( Plot.prototype, 'xLabel', { - 'configurable': false, - 'enumerable': true, - 'set': setXLabel, - 'get': getXLabel -}); - -/** -* y-axis label. -* -* @name yLabel -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default 'y' -* -* @example -* var plot = new Plot(); -* plot.yLabel = 'value'; -* -* @example -* var plot = new Plot({ -* 'yLabel': 'value' -* }); -* var yLabel = plot.yLabel; -* // returns 'value' -*/ -defineProperty( Plot.prototype, 'yLabel', { - 'configurable': false, - 'enumerable': true, - 'set': setYLabel, - 'get': getYLabel -}); - -/** -* Plot engine. -* -* @name engine -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a recognized engine -* @default 'svg' -* -* @example -* var plot = new Plot(); -* plot.engine = 'svg'; -* -* @example -* var plot = new Plot({ -* 'engine': 'svg' -* }); -* var engine = plot.engine; -* // returns 'svg' -*/ -defineProperty( Plot.prototype, 'engine', { - 'configurable': false, - 'enumerable': true, - 'set': setEngine, - 'get': getEngine -}); - -/** -* Rendering mode. -* -* ## Notes -* -* - If `true`, an instance re-renders on each change event. -* -* @name autoRender -* @memberof Plot.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var plot = new Plot({ -* 'autoRender': true -* }); -* -* var mode = plot.autoRender; -* // returns true -*/ -defineProperty( Plot.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Plot render format. -* -* @name renderFormat -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a recognized format -* @default 'vdom' -* -* @example -* var plot = new Plot(); -* plot.renderFormat = 'vdom'; -* -* @example -* var plot = new Plot({ -* 'renderFormat': 'html' -* }); -* var fmt = plot.renderFormat; -* // returns 'html' -*/ -defineProperty( Plot.prototype, 'renderFormat', { - 'configurable': false, - 'enumerable': true, - 'set': setRenderFormat, - 'get': getRenderFormat -}); - -/** -* Plot viewer. -* -* @name viewer -* @memberof Plot.prototype -* @type {string} -* @throws {TypeError} must be a recognized viewer -* @default 'none' -* -* @example -* var plot = new Plot(); -* plot.viewer = 'none'; -* -* @example -* var plot = new Plot({ -* 'viewer': 'none' -* }); -* var viewer = plot.viewer; -* // returns 'none' -*/ -defineProperty( Plot.prototype, 'viewer', { - 'configurable': false, - 'enumerable': true, - 'set': setViewer, - 'get': getViewer -}); - -/** -* Viewer mode. If `true`, an instance generates an updated view on each render event. -* -* @name autoView -* @memberof Plot.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var plot = new Plot({ -* 'autoView': false -* }); -* -* var mode = plot.autoView; -* // returns false -*/ -defineProperty( Plot.prototype, 'autoView', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoView, - 'get': getAutoView -}); - -/** -* Expected graph width. -* -* @name graphWidth -* @memberof Plot.prototype -* @type {number} -* -* @example -* var plot = new Plot({ -* 'width': 100, -* 'paddingLeft': 10, -* 'paddingRight': 10 -* }); -* var width = plot.graphWidth; -* // returns 80 -*/ -defineProperty( Plot.prototype, 'graphWidth', { - 'configurable': false, - 'enumerable': true, - 'get': getGraphWidth -}); - -/** -* Expected graph height. -* -* @name graphHeight -* @memberof Plot.prototype -* @type {number} -* -* @example -* var plot = new Plot({ -* 'height': 100, -* 'paddingTop': 10, -* 'paddingBottom': 20 -* }); -* var height = plot.graphHeight; -* // returns 70 -*/ -defineProperty( Plot.prototype, 'graphHeight', { - 'configurable': false, - 'enumerable': true, - 'get': getGraphHeight -}); - -/** -* x-axis domain. -* -* @name xDomain -* @memberof Plot.prototype -* @type {Array} -* -* @example -* var plot = new Plot({ -* 'xMin': 0, -* 'xMax': 100 -* }); -* var domain = plot.xDomain; -* // returns [ 0, 100 ] -*/ -defineProperty( Plot.prototype, 'xDomain', { - 'configurable': false, - 'enumerable': true, - 'get': getXDomain -}); - -/** -* y-axis domain. -* -* @name yDomain -* @memberof Plot.prototype -* @type {NumberArray} -* -* @example -* var plot = new Plot({ -* 'yMin': 0, -* 'yMax': 100 -* }); -* var domain = plot.yDomain; -* // returns [ 0, 100 ] -*/ -defineProperty( Plot.prototype, 'yDomain', { - 'configurable': false, - 'enumerable': true, - 'get': getYDomain -}); - -/** -* x-axis range. -* -* @name xRange -* @memberof Plot.prototype -* @type {NumberArray} -* -* @example -* var plot = new Plot({ -* 'width': 100, -* 'paddingLeft': 10, -* 'paddingRight': 10 -* }); -* var range = plot.xRange; -* // returns [ 0, 80 ] -*/ -defineProperty( Plot.prototype, 'xRange', { - 'configurable': false, - 'enumerable': true, - 'get': getXRange -}); - -/** -* y-axis range. -* -* @name yRange -* @memberof Plot.prototype -* @type {NumberArray} -* -* @example -* var plot = new Plot({ -* 'height': 100, -* 'paddingTop': 10, -* 'paddingBottom': 20 -* }); -* var range = plot.yRange; -* // returns [ 70, 0 ] -*/ -defineProperty( Plot.prototype, 'yRange', { - 'configurable': false, - 'enumerable': true, - 'get': getYRange -}); - -/** -* Function to map values to x-axis coordinate values. -* -* @name xPos -* @memberof Plot.prototype -* @type {Function} -* -* @example -* var plot = new Plot(); -* var xPos = plot.xPos; -* // returns -*/ -defineProperty( Plot.prototype, 'xPos', { - 'configurable': false, - 'enumerable': true, - 'get': getXPos -}); - -/** -* Function to map values to y-axis coordinate values. -* -* @name yPos -* @memberof Plot.prototype -* @type {Function} -* -* @example -* var plot = new Plot(); -* var yPos = plot.yPos; -* // returns -*/ -defineProperty( Plot.prototype, 'yPos', { - 'configurable': false, - 'enumerable': true, - 'get': getYPos -}); - -/** -* Renders a plot. -* -* @name render -* @memberof Plot.prototype -* @type {Function} -* @param {string} [format] - render format -* @throws {TypeError} must provide a recognized format -* @returns {(VTree|string)} virtual tree or string -* -* @example -* var plot = new Plot(); -* plot.x = [ [ 1, 2, 3 ] ]; -* plot.y = [ [ 1, 0, 1 ] ]; -* -* var out = plot.render(); -* -* @example -* var plot = new Plot(); -* plot.x = [ [ 1, 2, 3 ] ]; -* plot.y = [ [ 1, 0, 1 ] ]; -* -* var out = plot.render( 'html' ); -*/ -setReadOnly( Plot.prototype, 'render', render ); - -/** -* Generates a plot view. -* -* @name view -* @memberof Plot.prototype -* @type {Function} -* @param {string} [viewer] -* @throws {TypeError} must provide a recognized viewer -* -* @example -* var plot = new Plot(); -* plot.x = [ [ 1, 2, 3 ] ]; -* plot.y = [ [ 1, 0, 1 ] ]; -* -* plot.view( 'stdout' ); -*/ -setReadOnly( Plot.prototype, 'view', viewMethod ); - - -// EXPORTS // - -module.exports = Plot; diff --git a/ctor/lib/props/auto-render/get.js b/ctor/lib/props/auto-render/get.js deleted file mode 100644 index 7df40de..0000000 --- a/ctor/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/auto-render/set.js b/ctor/lib/props/auto-render/set.js deleted file mode 100644 index d17bea6..0000000 --- a/ctor/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:auto-render' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); - } - if ( bool !== this._autoRender ) { - debug( 'Current value: %s.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %s.', this._autoRender ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/auto-view/get.js b/ctor/lib/props/auto-view/get.js deleted file mode 100644 index 5b414b9..0000000 --- a/ctor/lib/props/auto-view/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the viewing mode. -* -* @private -* @returns {boolean} viewing mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoView; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/auto-view/set.js b/ctor/lib/props/auto-view/set.js deleted file mode 100644 index 793b3e5..0000000 --- a/ctor/lib/props/auto-view/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:auto-view' ); - - -// MAIN // - -/** -* Sets the viewing mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to generate an updated view on a render event -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoView', bool ) ); - } - if ( bool !== this._autoView ) { - debug( 'Current value: %s.', this._autoView ); - - this._autoView = bool; - debug( 'New Value: %s.', this._autoView ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/colors/colors.js b/ctor/lib/props/colors/colors.js deleted file mode 100644 index 9c82df4..0000000 --- a/ctor/lib/props/colors/colors.js +++ /dev/null @@ -1,112 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/* -* See [D3]{@link https://github.com/d3/d3-scale/blob/master/README.md}. -*/ - -var COLORS = {}; - -COLORS.category10 = [ - '#1f77b4', // 'category10-1' - '#ff7f0e', // 'category10-2' - '#2ca02c', // 'category10-3' - '#d62728', // 'category10-4' - '#9467bd', // 'category10-5' - '#8c564b', // 'category10-6' - '#e377c2', // 'category10-7' - '#7f7f7f', // 'category10-8' - '#bcdb22', // 'category10-9' - '#17becf' // 'category10-10' -]; - -COLORS.category20 = [ - '#1f77b4', // 'category20-1' - '#aec7e8', // 'category20-2' - '#ff7f0e', // 'category20-3' - '#ffbb78', // 'category20-4' - '#2ca02c', // 'category20-5' - '#98df8a', // 'category20-6' - '#d62728', // 'category20-7' - '#ff9896', // 'category20-8' - '#9467bd', // 'category20-9' - '#c5b0d5', // 'category20-10' - '#8c564b', // 'category20-11' - '#c49c94', // 'category20-12' - '#e377c2', // 'category20-13' - '#f7b6d2', // 'category20-14' - '#7f7f7f', // 'category20-15' - '#c7c7c7', // 'category20-16' - '#bcbd22', // 'category20-17' - '#dbdb8d', // 'category20-18' - '#17becf', // 'category20-19' - '#9edae5' // 'category20-20' -]; - -COLORS.category20b = [ - '#393b79', // 'category20b-1' - '#5254a3', // 'category20b-2' - '#6b6ecf', // 'category20b-3' - '#9c9ede', // 'category20b-4' - '#637939', // 'category20b-5' - '#8ca252', // 'category20b-6' - '#b5cf6b', // 'category20b-7' - '#cedb9c', // 'category20b-8' - '#8c6d31', // 'category20b-9' - '#bd9e39', // 'category20b-10' - '#e7ba52', // 'category20b-11' - '#e7cb94', // 'category20b-12' - '#843c39', // 'category20b-13' - '#ad494a', // 'category20b-14' - '#d6616b', // 'category20b-15' - '#e7969c', // 'category20b-16' - '#7b4173', // 'category20b-17' - '#a55194', // 'category20b-18' - '#ce6dbd', // 'category20b-19' - '#de9ed6' // 'category20b-20' -]; - -COLORS.category20c = [ - '#3182bd', // 'category20c-1' - '#6baed6', // 'category20c-2' - '#9ecae1', // 'category20c-3' - '#c6dbef', // 'category20c-4' - '#e6550d', // 'category20c-5' - '#fd8d3c', // 'category20c-6' - '#fdae6b', // 'category20c-7' - '#fdd0a2', // 'category20c-8' - '#31a354', // 'category20c-9' - '#74c476', // 'category20c-10' - '#a1d99b', // 'category20c-11' - '#c7e9c0', // 'category20c-12' - '#756bb1', // 'category20c-13' - '#9e9ac8', // 'category20c-14' - '#bcbddc', // 'category20c-15' - '#dadaeb', // 'category20c-16' - '#636363', // 'category20c-17' - '#969696', // 'category20c-18' - '#bdbdbd', // 'category20c-19' - '#d9d9d9' // 'category20c-20' -]; - - -// EXPORTS // - -module.exports = COLORS; diff --git a/ctor/lib/props/colors/get.js b/ctor/lib/props/colors/get.js deleted file mode 100644 index 4518d7d..0000000 --- a/ctor/lib/props/colors/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the data colors. -* -* @private -* @returns {StringArray} colors -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._colors.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/colors/set.js b/ctor/lib/props/colors/set.js deleted file mode 100644 index cad3be7..0000000 --- a/ctor/lib/props/colors/set.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var format = require( '@stdlib/string/format' ); -var COLORS = require( './colors.js' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:colors' ); - - -// MAIN // - -/** -* Sets the data colors. -* -* @private -* @param {(string|StringArray)} v - data colors -* @throws {TypeError} must be either a string or an array of strings -* @returns {void} -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isStr = isString( v ); - if ( !isStr && !isStringArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.', 'colors', v ) ); - } - if ( isStr ) { - if ( COLORS[ v ] === void 0 ) { - v = [ v ]; - } else { - v = COLORS[ v ].slice(); - } - } else { - v = v.slice(); - } - debug( 'Current value: %s.', JSON.stringify( this._colors ) ); - - this._colors = v; - debug( 'New Value: %s.', JSON.stringify( this._colors ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/description/get.js b/ctor/lib/props/description/get.js deleted file mode 100644 index d67c978..0000000 --- a/ctor/lib/props/description/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the description. -* -* @private -* @returns {string} description -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._description; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/description/set.js b/ctor/lib/props/description/set.js deleted file mode 100644 index b8a58ad..0000000 --- a/ctor/lib/props/description/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:description' ); - - -// MAIN // - -/** -* Sets the description. -* -* @private -* @param {string} str - description -* @throws {TypeError} must be a string -*/ -function set( str ) { - /* eslint-disable no-invalid-this */ - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'description', str ) ); - } - if ( str !== this._description ) { - debug( 'Current value: %s.', this._description ); - - this._description = str; - debug( 'New value: %s.', this._description ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/engine/engines.json b/ctor/lib/props/engine/engines.json deleted file mode 100644 index 00a90eb..0000000 --- a/ctor/lib/props/engine/engines.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "svg" -] diff --git a/ctor/lib/props/engine/get.js b/ctor/lib/props/engine/get.js deleted file mode 100644 index 5ec3e30..0000000 --- a/ctor/lib/props/engine/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the plot engine. -* -* @private -* @returns {string} engine -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._engine; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/engine/set.js b/ctor/lib/props/engine/set.js deleted file mode 100644 index 2d38442..0000000 --- a/ctor/lib/props/engine/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var contains = require( '@stdlib/assert/contains' ); -var format = require( '@stdlib/string/format' ); -var ENGINES = require( './engines.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:engine' ); - - -// MAIN // - -/** -* Sets the engine. -* -* @private -* @param {string} engine - engine -* @throws {TypeError} must be a recognized engine -*/ -function set( engine ) { - /* eslint-disable no-invalid-this */ - if ( !contains( ENGINES, engine ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'engine', ENGINES.join( '", "' ), engine ) ); - } - if ( engine !== this._engine ) { - debug( 'Current value: %s.', this._engine ); - - this._engine = engine; - debug( 'New value: %s.', this._engine ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/graph-height/get.js b/ctor/lib/props/graph-height/get.js deleted file mode 100644 index a3da4e0..0000000 --- a/ctor/lib/props/graph-height/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the expected graph height. -* -* @private -* @returns {number} graph height -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._height - this._paddingTop - this._paddingBottom; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/graph-width/get.js b/ctor/lib/props/graph-width/get.js deleted file mode 100644 index 21a60f9..0000000 --- a/ctor/lib/props/graph-width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the expected graph width. -* -* @private -* @returns {number} graph width -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._width - this._paddingLeft - this._paddingRight; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/height/get.js b/ctor/lib/props/height/get.js deleted file mode 100644 index 64bcb89..0000000 --- a/ctor/lib/props/height/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the height. -* -* @private -* @returns {number} height -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._height; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/height/set.js b/ctor/lib/props/height/set.js deleted file mode 100644 index 18cd62a..0000000 --- a/ctor/lib/props/height/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:height' ); - - -// MAIN // - -/** -* Sets the height. -* -* @private -* @param {PositiveNumber} height - height -* @throws {TypeError} must be a positive number -* @returns {void} -*/ -function set( height ) { - /* eslint-disable no-invalid-this */ - if ( !isPositiveNumber( height ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'height', height ) ); - } - if ( height !== this._height ) { - debug( 'Current value: %d.', this._height ); - - this._height = height; - debug( 'New Value: %d.', this._height ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/is-defined/get.js b/ctor/lib/props/is-defined/get.js deleted file mode 100644 index fd05f22..0000000 --- a/ctor/lib/props/is-defined/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the accessor for defined values. -* -* @private -* @returns {Function} accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._isDefined; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/is-defined/set.js b/ctor/lib/props/is-defined/set.js deleted file mode 100644 index 7e8dbe2..0000000 --- a/ctor/lib/props/is-defined/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:is-defined' ); - - -// MAIN // - -/** -* Sets the accessor for defined values. -* -* @private -* @param {Function} fcn - accessor -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'isDefined', fcn ) ); - } - if ( fcn !== this._isDefined ) { - debug( 'Current value: %s.', this._isDefined ); - - this._isDefined = fcn; - debug( 'New Value: %s.', this._isDefined ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/labels/get.js b/ctor/lib/props/labels/get.js deleted file mode 100644 index 8188d4f..0000000 --- a/ctor/lib/props/labels/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the data labels. -* -* @private -* @returns {(EmptyArray|StringArray)} labels -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._labels.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/labels/set.js b/ctor/lib/props/labels/set.js deleted file mode 100644 index 599d292..0000000 --- a/ctor/lib/props/labels/set.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isEmptyArray = require( '@stdlib/assert/is-empty-array' ); -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:labels' ); - - -// MAIN // - -/** -* Sets the data labels. -* -* @private -* @param {(StringArray|EmptyArray)} labels - data labels -* @throws {TypeError} must be either an array of strings or an empty array -* @returns {void} -*/ -function set( labels ) { - /* eslint-disable no-invalid-this */ - if ( - !isEmptyArray( labels ) && - !isStringArray( labels ) - ) { - throw new TypeError( format( 'invalid assignment. `%s` must be an array of strings or an empty array. Value: `%s`.', 'labels', labels ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._labels ) ); - - this._labels = labels.slice(); - debug( 'New Value: %s.', JSON.stringify( this._labels ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/line-opacity/get.js b/ctor/lib/props/line-opacity/get.js deleted file mode 100644 index b139b94..0000000 --- a/ctor/lib/props/line-opacity/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the data line opacity. -* -* @private -* @returns {NumberArray} line opacity -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._lineOpacity.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/line-opacity/set.js b/ctor/lib/props/line-opacity/set.js deleted file mode 100644 index 2cd5e47..0000000 --- a/ctor/lib/props/line-opacity/set.js +++ /dev/null @@ -1,73 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isNumberArray = require( '@stdlib/assert/is-number-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:line-opacity' ); - - -// MAIN // - -/** -* Sets the data line opacity. -* -* @private -* @param {(number|NumberArray)} v - opacity -* @throws {TypeError} must be a number or number array -* @throws {RangeError} must be a number on the interval `[0,1]` -* @returns {void} -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isNum = isNumber( v ); - var i; - if ( !isNum && !isNumberArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number or an array of numbers. Value: `%s`.', 'lineOpacity', v ) ); - } - if ( isNum ) { - v = [ v ]; - } else { - v = v.slice(); - } - for ( i = 0; i < v.length; i++ ) { - if ( v[ i ] < 0.0 || v[ i ] > 1.0 ) { - throw new RangeError( format( 'invalid assignment. A `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'lineOpacity', v[i] ) ); - } - } - debug( 'Current value: %s.', JSON.stringify( this._lineOpacity ) ); - - this._lineOpacity = v; - debug( 'New Value: %s.', JSON.stringify( this._lineOpacity ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/line-style/get.js b/ctor/lib/props/line-style/get.js deleted file mode 100644 index 0a8694b..0000000 --- a/ctor/lib/props/line-style/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the data line style(s). -* -* @private -* @returns {StringArray} line style(s) -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._lineStyle.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/line-style/line_styles.json b/ctor/lib/props/line-style/line_styles.json deleted file mode 100644 index cf2ac73..0000000 --- a/ctor/lib/props/line-style/line_styles.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "-", - "--", - ":", - "-.", - "none" -] diff --git a/ctor/lib/props/line-style/set.js b/ctor/lib/props/line-style/set.js deleted file mode 100644 index 50600fa..0000000 --- a/ctor/lib/props/line-style/set.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var LINESTYLES = require( './line_styles.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:line-style' ); - - -// MAIN // - -/** -* Sets the data line style(s). -* -* @private -* @param {(string|StringArray)} v - line style(s) -* @throws {TypeError} must be a string or string array -* @throws {Error} must be a supported line style -* @returns {void} -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isStr = isString( v ); - var i; - if ( !isStr && !isStringArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.', 'lineStyle', v ) ); - } - if ( isStr ) { - v = [ v ]; - } else { - v = v.slice(); - } - for ( i = 0; i < v.length; i++ ) { - if ( indexOf( LINESTYLES, v[i] ) === -1 ) { - throw new Error( format( 'invalid assignment. Unsupported/unrecognized line style. Must be one of the following: "%s". Value: `%s`.', LINESTYLES.join( '", "' ), v[i] ) ); - } - } - debug( 'Current value: %s.', JSON.stringify( this._lineStyle ) ); - - this._lineStyle = v; - debug( 'New Value: %s.', JSON.stringify( this._lineStyle ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/line-width/get.js b/ctor/lib/props/line-width/get.js deleted file mode 100644 index 90ad210..0000000 --- a/ctor/lib/props/line-width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the data line width. -* -* @private -* @returns {Array} line width(s) -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._lineWidth.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/line-width/set.js b/ctor/lib/props/line-width/set.js deleted file mode 100644 index 1592dc9..0000000 --- a/ctor/lib/props/line-width/set.js +++ /dev/null @@ -1,66 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isNonNegativeIntegerArray = require( '@stdlib/assert/is-nonnegative-integer-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:line-width' ); - - -// MAIN // - -/** -* Sets the data line width(s). -* -* @private -* @param {(NonNegativeInteger|Array)} v - width -* @throws {TypeError} must be a nonnegative integer or nonnegative integer array -* @returns {void} -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isInt = isNonNegativeInteger( v ); - if ( !isInt && !isNonNegativeIntegerArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or an array of nonnegative integers. Value: `%s`.', 'lineWidth', v ) ); - } - if ( isInt ) { - v = [ v ]; - } else { - v = v.slice(); - } - debug( 'Current value: %s.', JSON.stringify( this._lineWidth ) ); - - this._lineWidth = v; - debug( 'New Value: %s.', JSON.stringify( this._lineWidth ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/padding-bottom/get.js b/ctor/lib/props/padding-bottom/get.js deleted file mode 100644 index af214a0..0000000 --- a/ctor/lib/props/padding-bottom/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the bottom padding. -* -* @private -* @returns {number} padding -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._paddingBottom; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/padding-bottom/set.js b/ctor/lib/props/padding-bottom/set.js deleted file mode 100644 index a0b2c3c..0000000 --- a/ctor/lib/props/padding-bottom/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:padding-bottom' ); - - -// MAIN // - -/** -* Sets the bottom padding. -* -* @private -* @param {NonNegativeInteger} padding - padding -* @throws {TypeError} must be a nonnegative integer -*/ -function set( padding ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( padding ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingBottom', padding ) ); - } - if ( padding !== this._paddingBottom ) { - debug( 'Current value: %d.', this._paddingBottom ); - - this._paddingBottom = padding; - debug( 'New value: %d.', this._paddingBottom ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/padding-left/get.js b/ctor/lib/props/padding-left/get.js deleted file mode 100644 index 162c41b..0000000 --- a/ctor/lib/props/padding-left/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the left padding. -* -* @private -* @returns {number} padding -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._paddingLeft; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/padding-left/set.js b/ctor/lib/props/padding-left/set.js deleted file mode 100644 index b50c85a..0000000 --- a/ctor/lib/props/padding-left/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:padding-left' ); - - -// MAIN // - -/** -* Sets the left padding. -* -* @private -* @param {NonNegativeInteger} padding - padding -* @throws {TypeError} must be a nonnegative integer -*/ -function set( padding ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( padding ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingLeft', padding ) ); - } - if ( padding !== this._paddingLeft ) { - debug( 'Current value: %d.', this._paddingLeft ); - - this._paddingLeft = padding; - debug( 'New value: %d.', this._paddingLeft ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/padding-right/get.js b/ctor/lib/props/padding-right/get.js deleted file mode 100644 index 3da30d1..0000000 --- a/ctor/lib/props/padding-right/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the right padding. -* -* @private -* @returns {number} padding -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._paddingRight; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/padding-right/set.js b/ctor/lib/props/padding-right/set.js deleted file mode 100644 index e039b98..0000000 --- a/ctor/lib/props/padding-right/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:padding-right' ); - - -// MAIN // - -/** -* Sets the right padding. -* -* @private -* @param {NonNegativeInteger} padding - padding -* @throws {TypeError} must be a nonnegative integer -*/ -function set( padding ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( padding ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingRight', padding ) ); - } - if ( padding !== this._paddingRight ) { - debug( 'Current value: %d.', this._paddingRight ); - - this._paddingRight = padding; - debug( 'New value: %d.', this._paddingRight ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/padding-top/get.js b/ctor/lib/props/padding-top/get.js deleted file mode 100644 index 4afa617..0000000 --- a/ctor/lib/props/padding-top/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the top padding. -* -* @private -* @returns {number} padding -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._paddingTop; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/padding-top/set.js b/ctor/lib/props/padding-top/set.js deleted file mode 100644 index 02b814d..0000000 --- a/ctor/lib/props/padding-top/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:padding-top' ); - - -// MAIN // - -/** -* Sets the top padding. -* -* @private -* @param {NonNegativeInteger} padding - padding -* @throws {TypeError} must be a nonnegative integer -*/ -function set( padding ) { - /* eslint-disable no-invalid-this */ - if ( !isNonNegativeInteger( padding ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingTop', padding ) ); - } - if ( padding !== this._paddingTop ) { - debug( 'Current value: %d.', this._paddingTop ); - - this._paddingTop = padding; - debug( 'New value: %d.', this._paddingTop ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/render-format/formats.json b/ctor/lib/props/render-format/formats.json deleted file mode 100644 index 7479e77..0000000 --- a/ctor/lib/props/render-format/formats.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "vdom", - "html" -] diff --git a/ctor/lib/props/render-format/get.js b/ctor/lib/props/render-format/get.js deleted file mode 100644 index 8b42464..0000000 --- a/ctor/lib/props/render-format/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the render format. -* -* @private -* @returns {string} format -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._renderFormat; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/render-format/set.js b/ctor/lib/props/render-format/set.js deleted file mode 100644 index 59a7812..0000000 --- a/ctor/lib/props/render-format/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var FORMATS = require( './formats.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:renderformat' ); - - -// MAIN // - -/** -* Sets the render format. -* -* @private -* @param {string} fmt - format -* @throws {TypeError} must be a recognized render format -*/ -function set( fmt ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( FORMATS, fmt ) === -1 ) { - throw new TypeError( format( 'invalid assignment. Unrecognized/unsupported `%s`. Must be one of the following: "%s". Value: `%s`.', 'format', FORMATS.join( '", "' ), fmt ) ); - } - if ( fmt !== this._renderFormat ) { - debug( 'Current value: %s.', this._renderFormat ); - - this._renderFormat = fmt; - debug( 'New value: %s.', this._renderFormat ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/symbols-opacity/get.js b/ctor/lib/props/symbols-opacity/get.js deleted file mode 100644 index 64c0286..0000000 --- a/ctor/lib/props/symbols-opacity/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the symbols opacity. -* -* @private -* @returns {NumberArray} symbols opacity -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._symbolsOpacity.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/symbols-opacity/set.js b/ctor/lib/props/symbols-opacity/set.js deleted file mode 100644 index 0741f26..0000000 --- a/ctor/lib/props/symbols-opacity/set.js +++ /dev/null @@ -1,73 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isNumberArray = require( '@stdlib/assert/is-number-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:symbols-opacity' ); - - -// MAIN // - -/** -* Sets the symbol opacity. -* -* @private -* @param {(number|NumberArray)} v - opacity -* @throws {TypeError} must be a number or number array -* @throws {RangeError} must be a number on the interval `[0,1]` -* @returns {void} -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isNum = isNumber( v ); - var i; - if ( !isNum && !isNumberArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number or an array of numbers. Value: `%s`.', 'symbolsOpacity', v ) ); - } - if ( isNum ) { - v = [ v ]; - } else { - v = v.slice(); - } - for ( i = 0; i < v.length; i++ ) { - if ( v[ i ] < 0.0 || v[ i ] > 1.0 ) { - throw new RangeError( format( 'invalid assignment. A `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'symbolsOpacity', v[ i ] ) ); - } - } - debug( 'Current value: %s.', JSON.stringify( this._symbolsOpacity ) ); - - this._symbolsOpacity = v; - debug( 'New Value: %s.', JSON.stringify( this._symbolsOpacity ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/symbols-size/get.js b/ctor/lib/props/symbols-size/get.js deleted file mode 100644 index dbf9c07..0000000 --- a/ctor/lib/props/symbols-size/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the symbols size. -* -* @private -* @returns {Array} symbols sizes -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._symbolsSize.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/symbols-size/set.js b/ctor/lib/props/symbols-size/set.js deleted file mode 100644 index b007fc7..0000000 --- a/ctor/lib/props/symbols-size/set.js +++ /dev/null @@ -1,66 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isNonNegativeIntegerArray = require( '@stdlib/assert/is-nonnegative-integer-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:symbols-size' ); - - -// MAIN // - -/** -* Sets the symbols size. -* -* @private -* @param {(NonNegativeInteger|Array)} v - size -* @throws {TypeError} must be a nonnegative integer or nonnegative integer array -* @returns {void} -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isInt = isNonNegativeInteger( v ); - if ( !isInt && !isNonNegativeIntegerArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or an array of nonnegative integers. Value: `%s`.', 'symbolsSize', v ) ); - } - if ( isInt ) { - v = [ v ]; - } else { - v = v.slice(); - } - debug( 'Current value: %s.', JSON.stringify( this._symbolsSize ) ); - - this._symbolsSize = v; - debug( 'New Value: %s.', JSON.stringify( this._symbolsSize ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/symbols/get.js b/ctor/lib/props/symbols/get.js deleted file mode 100644 index aeb6e7b..0000000 --- a/ctor/lib/props/symbols/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the data symbols. -* -* @private -* @returns {StringArray} symbols -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._symbols.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/symbols/set.js b/ctor/lib/props/symbols/set.js deleted file mode 100644 index c52b034..0000000 --- a/ctor/lib/props/symbols/set.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var SYMBOLS = require( './symbols.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:symbols' ); - - -// MAIN // - -/** -* Sets the data symbols. -* -* @private -* @param {(string|StringArray)} v - data symbols -* @throws {TypeError} must be a string or string array -* @throws {Error} must be a supported symbol -* @returns {void} -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isStr = isString( v ); - var i; - if ( !isStr && !isStringArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.', 'symbols', v ) ); - } - if ( isStr ) { - v = [ v ]; - } else { - v = v.slice(); - } - for ( i = 0; i < v.length; i++ ) { - if ( indexOf( SYMBOLS, v[i] ) === -1 ) { - throw new Error( format( 'invalid assignment. Unrecognized/unsupported symbol. Value: `[%s]`.', v.join(',') ) ); - } - } - debug( 'Current value: %s.', JSON.stringify( this._symbols ) ); - - this._symbols = v; - debug( 'New Value: %s.', JSON.stringify( this._symbols ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/symbols/symbols.json b/ctor/lib/props/symbols/symbols.json deleted file mode 100644 index c0a5bab..0000000 --- a/ctor/lib/props/symbols/symbols.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "closed-circle", - "open-circle", - "none" -] diff --git a/ctor/lib/props/title/get.js b/ctor/lib/props/title/get.js deleted file mode 100644 index 9417faa..0000000 --- a/ctor/lib/props/title/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the title. -* -* @private -* @returns {string} title -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._title; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/title/set.js b/ctor/lib/props/title/set.js deleted file mode 100644 index 4ea376a..0000000 --- a/ctor/lib/props/title/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:title' ); - - -// MAIN // - -/** -* Sets the title. -* -* @private -* @param {string} str - title -* @throws {TypeError} must be a string -*/ -function set( str ) { - /* eslint-disable no-invalid-this */ - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'title', str ) ); - } - if ( str !== this._title ) { - debug( 'Current value: %s.', this._title ); - - this._title = str; - debug( 'New value: %s.', this._title ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/viewer/get.js b/ctor/lib/props/viewer/get.js deleted file mode 100644 index a8044ca..0000000 --- a/ctor/lib/props/viewer/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the plot viewer. -* -* @private -* @returns {string} viewer -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._viewer; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/viewer/set.js b/ctor/lib/props/viewer/set.js deleted file mode 100644 index ac13e79..0000000 --- a/ctor/lib/props/viewer/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var VIEWERS = require( './viewers.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:viewer' ); - - -// MAIN // - -/** -* Sets the viewer. -* -* @private -* @param {string} viewer - viewer -* @throws {TypeError} must be a recognized viewer -*/ -function set( viewer ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( VIEWERS, viewer ) === -1 ) { - throw new TypeError( format( 'invalid assignment. Unrecognized/unsupported `%s`. Value: `%s`.', 'viewer', viewer ) ); - } - if ( viewer !== this._viewer ) { - debug( 'Current value: %s.', this._viewer ); - - this._viewer = viewer; - debug( 'New value: %s.', this._viewer ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/viewer/viewers.json b/ctor/lib/props/viewer/viewers.json deleted file mode 100644 index f515292..0000000 --- a/ctor/lib/props/viewer/viewers.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "none", - "browser", - "terminal", - "stdout", - "window" -] diff --git a/ctor/lib/props/width/get.js b/ctor/lib/props/width/get.js deleted file mode 100644 index cfa5f0e..0000000 --- a/ctor/lib/props/width/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the width. -* -* @private -* @returns {number} width -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._width; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/width/set.js b/ctor/lib/props/width/set.js deleted file mode 100644 index b118a3a..0000000 --- a/ctor/lib/props/width/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:width' ); - - -// MAIN // - -/** -* Sets the width. -* -* @private -* @param {PositiveNumber} width - width -* @throws {TypeError} must be a positive number -*/ -function set( width ) { - /* eslint-disable no-invalid-this */ - if ( !isPositiveNumber( width ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'width', width ) ); - } - if ( width !== this._width ) { - debug( 'Current value: %d.', this._width ); - - this._width = width; - debug( 'New value: %d.', this._width ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/x-axis-orient/get.js b/ctor/lib/props/x-axis-orient/get.js deleted file mode 100644 index a96e518..0000000 --- a/ctor/lib/props/x-axis-orient/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-axis orientation. -* -* @private -* @returns {string} orientation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xAxisOrient; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x-axis-orient/orientations.json b/ctor/lib/props/x-axis-orient/orientations.json deleted file mode 100644 index bd39084..0000000 --- a/ctor/lib/props/x-axis-orient/orientations.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "bottom", - "top" -] diff --git a/ctor/lib/props/x-axis-orient/set.js b/ctor/lib/props/x-axis-orient/set.js deleted file mode 100644 index 5071313..0000000 --- a/ctor/lib/props/x-axis-orient/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var ORIENTATIONS = require( './orientations.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:x-axis-orient' ); - - -// MAIN // - -/** -* Sets the x-axis orientation. -* -* @private -* @param {string} orientation - axis orientation -* @throws {TypeError} must be either `'bottom'` or `'top'` -*/ -function set( orientation ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( ORIENTATIONS, orientation ) === -1 ) { - throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'xAxisOrient', ORIENTATIONS.join( '", "' ), orientation ) ); - } - if ( orientation !== this._xAxisOrient ) { - debug( 'Current value: %s.', this._xAxisOrient ); - - this._xAxisOrient = orientation; - debug( 'New value: %s.', this._xAxisOrient ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/x-domain/get.js b/ctor/lib/props/x-domain/get.js deleted file mode 100644 index 44e571f..0000000 --- a/ctor/lib/props/x-domain/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-axis domain. -* -* @private -* @returns {Array} domain -*/ -function get() { - /* eslint-disable no-invalid-this */ - return [ this.xMin, this.xMax ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x-label/get.js b/ctor/lib/props/x-label/get.js deleted file mode 100644 index eeec342..0000000 --- a/ctor/lib/props/x-label/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-axis label. -* -* @private -* @returns {string} label -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xLabel; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x-label/set.js b/ctor/lib/props/x-label/set.js deleted file mode 100644 index efdb661..0000000 --- a/ctor/lib/props/x-label/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:x-label' ); - - -// MAIN // - -/** -* Sets the x-axis label. -* -* @private -* @param {string} label - axis label -* @throws {TypeError} must be a string -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( !isString( label ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'xLabel', label ) ); - } - if ( label !== this._xLabel ) { - debug( 'Current value: %s.', this._xLabel ); - - this._xLabel = label; - debug( 'New value: %s.', this._xLabel ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/x-max/get.js b/ctor/lib/props/x-max/get.js deleted file mode 100644 index dddec8d..0000000 --- a/ctor/lib/props/x-max/get.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNull = require( '@stdlib/assert/is-null' ); -var max = require( './../../utils/max.js' ); // TODO: replace with stdlib package import when added - - -// FUNCTIONS // - -/** -* Computes a maximum value. -* -* @private -* @param {Array} arr - input array -* @returns {(number|null)} maximum value or null -*/ -function getMax( arr ) { - var tmp; - var i; - if ( arr.length === 0 ) { - return null; - } - tmp = []; - for ( i = 0; i < arr.length; i++ ) { - tmp.push( max( arr[ i ] ) ); - } - return max( tmp ); -} - - -// MAIN // - -/** -* Returns the maximum value of the x-axis domain. -* -* @private -* @returns {number} maximum value -*/ -function get() { - /* eslint-disable no-invalid-this */ - var max; - if ( isNull( this._xMax ) ) { - max = getMax( this._xData ); - return ( isNull( max ) ) ? 1.0 : max; - } - return this._xMax; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x-max/set.js b/ctor/lib/props/x-max/set.js deleted file mode 100644 index fc9ae9c..0000000 --- a/ctor/lib/props/x-max/set.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'line:set:x-max' ); - - -// MAIN // - -/** -* Sets the maximum value of the x-axis domain. -* -* @private -* @param {(Date|FiniteNumber|null)} max - maximum value -* @throws {TypeError} must be a finite number primitive or null -*/ -function set( max ) { - /* eslint-disable no-invalid-this */ - - // TODO: add test to determine if evaluates to valid date? - if ( - !isNull( max ) && - !isNumber( max ) // FIXME: finite number - - // TODO: Date - ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a finite number, Date, or null. Value: `%s`.', 'xMax', max ) ); - } - if ( max !== this._xMax ) { - debug( 'Current value: %s.', this._xMax ); - - this._xMax = max; - debug( 'New value: %s.', this._xMax ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/x-min/get.js b/ctor/lib/props/x-min/get.js deleted file mode 100644 index 6c708f3..0000000 --- a/ctor/lib/props/x-min/get.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNull = require( '@stdlib/assert/is-null' ); -var min = require( './../../utils/min.js' ); // TODO: replace with mod when written - - -// FUNCTIONS // - -/** -* Computes a minimum value. -* -* @private -* @param {Array} arr - input array -* @returns {(number|null)} minimum value or null -*/ -function getMin( arr ) { - var tmp; - var i; - if ( arr.length === 0 ) { - return null; - } - tmp = new Array( arr.length ); - for ( i = 0; i < arr.length; i++ ) { - tmp[ i ] = min( arr[ i ] ); - } - return min( tmp ); -} - - -// MAIN // - -/** -* Returns the minimum value of the x-axis domain. -* -* @private -* @returns {number} minimum value -*/ -function get() { - /* eslint-disable no-invalid-this */ - var min; - if ( isNull( this._xMin ) ) { - min = getMin( this._xData ); - return ( isNull( min ) ) ? 0.0 : min; - } - return this._xMin; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x-min/set.js b/ctor/lib/props/x-min/set.js deleted file mode 100644 index 6a097f0..0000000 --- a/ctor/lib/props/x-min/set.js +++ /dev/null @@ -1,67 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:x-min' ); - - -// MAIN // - -/** -* Sets the minimum value of the x-axis domain. -* -* @private -* @param {(Date|FiniteNumber|null)} min - minimum value -* @throws {TypeError} must be a finite number or null -* @returns {void} -*/ -function set( min ) { - /* eslint-disable no-invalid-this */ - - // TODO: add test to determine if evaluates to valid date? - if ( - !isNull( min ) && - !isNumber( min ) // FIXME: finite number - - // TODO: Date - ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a finite number, Date, or null. Value: `%s`.', 'xMin', min ) ); - } - debug( 'Current value: %s.', this._xMin ); - - this._xMin = min; - debug( 'New value: %s.', this._xMin ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/x-num-ticks/get.js b/ctor/lib/props/x-num-ticks/get.js deleted file mode 100644 index 02dc4ef..0000000 --- a/ctor/lib/props/x-num-ticks/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the number of x-axis tick marks. -* -* @private -* @returns {(NonNegativeInteger|null)} number of ticks -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xNumTicks; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x-num-ticks/set.js b/ctor/lib/props/x-num-ticks/set.js deleted file mode 100644 index 2633357..0000000 --- a/ctor/lib/props/x-num-ticks/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:x-num-ticks' ); - - -// MAIN // - -/** -* Sets the number of x-axis tick marks. -* -* @private -* @param {(NonNegativeInteger|null)} ticks - number of ticks -* @throws {TypeError} must be a nonnegative integer or null -*/ -function set( ticks ) { - /* eslint-disable no-invalid-this */ - if ( !isNull( ticks ) && !isNonNegativeInteger( ticks ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or null. Value: `%s`.', 'xNumTicks', ticks ) ); - } - if ( ticks !== this._xNumTicks ) { - debug( 'Current value: %d.', this._xNumTicks ); - - this._xNumTicks = ticks; - debug( 'New value: %d.', this._xNumTicks ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/x-pos/get.js b/ctor/lib/props/x-pos/get.js deleted file mode 100644 index 2cfa1f2..0000000 --- a/ctor/lib/props/x-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'plot:x-pos' ); - - -// MAIN // - -/** -* Returns a function to map values to x-axis coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.xScale; - return xPos; - - /** - * Maps a value to a x-axis coordinate value. - * - * @private - * @param {number} d - datum - * @returns {number} pixel value - */ - function xPos( d ) { - var px = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x-range/get.js b/ctor/lib/props/x-range/get.js deleted file mode 100644 index 15069e3..0000000 --- a/ctor/lib/props/x-range/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-axis range. -* -* @private -* @returns {NumberArray} range -*/ -function get() { - /* eslint-disable no-invalid-this */ - return [ 0, this.graphWidth ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x-rug-opacity/get.js b/ctor/lib/props/x-rug-opacity/get.js deleted file mode 100644 index 542b796..0000000 --- a/ctor/lib/props/x-rug-opacity/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-axis rug opacity. -* -* @private -* @returns {NumberArray} rug opacities -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xRugOpacity.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x-rug-opacity/set.js b/ctor/lib/props/x-rug-opacity/set.js deleted file mode 100644 index f2eec76..0000000 --- a/ctor/lib/props/x-rug-opacity/set.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isNumberArray = require( '@stdlib/assert/is-number-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:x-rug-opacity' ); - - -// MAIN // - -/** -* Sets the x-axis rug opacity. -* -* @private -* @param {(number|NumberArray)} v - opacity -* @throws {TypeError} must be a number or number array -* @throws {RangeError} must be a number on the interval `[0,1]` -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isNum = isNumber( v ); - var i; - if ( !isNum && !isNumberArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number or an array of numbers. Value: `%s`.', 'xRugOpacity', v ) ); - } - if ( isNum ) { - v = [ v ]; - } else { - v = v.slice(); - } - for ( i = 0; i < v.length; i++ ) { - if ( v[ i ] < 0.0 || v[ i ] > 1.0 ) { - throw new RangeError( format( 'invalid assignment. A `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'xRugOpacity', v[i] ) ); - } - } - debug( 'Current value: %s.', JSON.stringify( this._xRugOpacity ) ); - - this._xRugOpacity = v; - debug( 'New Value: %s.', JSON.stringify( this._xRugOpacity ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/x-rug-orient/get.js b/ctor/lib/props/x-rug-orient/get.js deleted file mode 100644 index d388eb0..0000000 --- a/ctor/lib/props/x-rug-orient/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-axis rug orientation. -* -* @private -* @returns {StringArray} orientation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xRugOrient.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x-rug-orient/orientations.json b/ctor/lib/props/x-rug-orient/orientations.json deleted file mode 100644 index 1e375c3..0000000 --- a/ctor/lib/props/x-rug-orient/orientations.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "bottom", - "top" -] diff --git a/ctor/lib/props/x-rug-orient/set.js b/ctor/lib/props/x-rug-orient/set.js deleted file mode 100644 index eaeb2a2..0000000 --- a/ctor/lib/props/x-rug-orient/set.js +++ /dev/null @@ -1,74 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var ORIENTATIONS = require( './orientations.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:x-rug-orient' ); - - -// MAIN // - -/** -* Sets the x-axis rug orientation. -* -* @private -* @param {(string|StringArray)} v - rug orientation -* @throws {TypeError} must be either a string or string array -* @throws {TypeError} must be either `'bottom'` or `'top'` -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isStr = isString( v ); - var i; - if ( !isStr && !isStringArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.', 'xRugOrient', v ) ); - } - if ( isStr ) { - v = [ v ]; - } else { - v = v.slice(); - } - for ( i = 0; i < v.length; i++ ) { - if ( indexOf( ORIENTATIONS, v[i] ) === -1 ) { - throw new TypeError( format( 'invalid assignment. Unrecognized/unsupported orientation. A `%s` value must be one of the following: "%s". Value: `%s`.', 'xRugOrient', ORIENTATIONS.join( '", "' ), v[ i ] ) ); - } - } - debug( 'Current value: %s.', JSON.stringify( this._xRugOrient ) ); - - this._xRugOrient = v; - debug( 'New value: %s.', JSON.stringify( this._xRugOrient ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/x-rug-size/get.js b/ctor/lib/props/x-rug-size/get.js deleted file mode 100644 index 7e1725e..0000000 --- a/ctor/lib/props/x-rug-size/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-axis rug tick (tassel) size. -* -* @private -* @returns {Array} tick sizes -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xRugSize.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x-rug-size/set.js b/ctor/lib/props/x-rug-size/set.js deleted file mode 100644 index 0a3825a..0000000 --- a/ctor/lib/props/x-rug-size/set.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isNonNegativeIntegerArray = require( '@stdlib/assert/is-nonnegative-integer-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:x-rug-size' ); - - -// MAIN // - -/** -* Sets the x-axis rug tick (tassel) size. -* -* @private -* @param {(NonNegativeInteger|Array)} v - size -* @throws {TypeError} must be a nonnegative integer or nonnegative integer array -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isInt = isNonNegativeInteger( v ); - if ( !isInt && !isNonNegativeIntegerArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or an array of nonnegative integers. Value: `%s`.', 'xRugSize', v ) ); - } - if ( isInt ) { - v = [ v ]; - } else { - v = v.slice(); - } - debug( 'Current value: %s.', JSON.stringify( this._xRugSize ) ); - - this._xRugSize = v; - debug( 'New Value: %s.', JSON.stringify( this._xRugSize ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/x-rug/get.js b/ctor/lib/props/x-rug/get.js deleted file mode 100644 index 1cc37b7..0000000 --- a/ctor/lib/props/x-rug/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns whether a rug plot is displayed along the x-axis. -* -* @private -* @returns {BooleanArray} boolean flags -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xRug.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x-rug/set.js b/ctor/lib/props/x-rug/set.js deleted file mode 100644 index 576015d..0000000 --- a/ctor/lib/props/x-rug/set.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var isBooleanArray = require( '@stdlib/assert/is-boolean-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:x-rug' ); - - -// MAIN // - -/** -* Sets a flag indicating whether to display a rug plot along the x-axis. -* -* @private -* @param {(boolean|BooleanArray)} v - boolean flag(s) indicating whether to display a rug plot along the x-axis -* @throws {TypeError} must be a boolean or boolean array -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isBool = isBoolean( v ); - if ( !isBool && !isBooleanArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean or an array of booleans. Value: `%s`.', 'xRug', v ) ); - } - if ( isBool ) { - v = [ v ]; - } - debug( 'Current value: %s.', JSON.stringify( this._xRug ) ); - - this._xRug = v; - debug( 'New Value: %s.', JSON.stringify( this._xRug ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/x-scale/get.js b/ctor/lib/props/x-scale/get.js deleted file mode 100644 index 7da4793..0000000 --- a/ctor/lib/props/x-scale/get.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var linear = require( 'd3-scale' ).scaleLinear; // TODO: remove -var time = require( 'd3-scale' ).scaleTime; // TODO: remove - - -// MAIN // - -/** -* Returns a scale function for mapping values to a coordinate along the x-axis. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale; - if ( this._xScale === 'time' ) { - scale = time() - .domain( this.xDomain ) - .range( this.xRange ); - } else if ( this._xScale === 'linear' ) { - scale = linear() - .domain( this.xDomain ) - .range( this.xRange ); - } - // TODO: other scales - return scale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x-scale/set.js b/ctor/lib/props/x-scale/set.js deleted file mode 100644 index 9f2c000..0000000 --- a/ctor/lib/props/x-scale/set.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:x-scale' ); - - -// MAIN // - -/** -* Sets the x-axis scale. -* -* @private -* @param {string} scale - axis scale -* @throws {TypeError} must be a string -* @returns {void} -*/ -function set( scale ) { - /* eslint-disable no-invalid-this */ - if ( !isString( scale ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'xScale', scale ) ); - } - // TODO: test for valid scale - - if ( scale !== this._xScale ) { - debug( 'Current value: %s.', this._xScale ); - - this._xScale = scale; - debug( 'New value: %s.', this._xScale ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/x-tick-format/get.js b/ctor/lib/props/x-tick-format/get.js deleted file mode 100644 index 8a6fc70..0000000 --- a/ctor/lib/props/x-tick-format/get.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var format = require( 'd3-format' ).format; // TODO: remove -var timeFormat = require( 'd3-time-format' ).timeFormat; // TODO: remove -var isNull = require( '@stdlib/assert/is-null' ); - - -// MAIN // - -/** -* Returns the x-axis tick format. -* -* @private -* @returns {(Function|null)} format function or null -*/ -function get() { - /* eslint-disable no-invalid-this */ - if ( isNull( this._xTickFormat ) ) { - return this._xTickFormat; - } - if ( this._xScale === 'time' ) { - return timeFormat( this._xTickFormat ); - } - return format( this._xTickFormat ); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x-tick-format/set.js b/ctor/lib/props/x-tick-format/set.js deleted file mode 100644 index c993625..0000000 --- a/ctor/lib/props/x-tick-format/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:x-tick-format' ); - - -// MAIN // - -/** -* Sets the x-axis tick format. -* -* @private -* @param {(string|null)} fmt - axis tick format -* @throws {TypeError} must be a string -*/ -function set( fmt ) { - /* eslint-disable no-invalid-this */ - if ( !isNull( fmt ) && !isString( fmt ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or null. Value: `%s`.', 'xTickFormat', fmt ) ); - } - if ( fmt !== this._xTickFormat ) { - debug( 'Current value: %s.', this._xTickFormat ); - - this._xTickFormat = fmt; - debug( 'New value: %s.', this._xTickFormat ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/x/get.js b/ctor/lib/props/x/get.js deleted file mode 100644 index 1616853..0000000 --- a/ctor/lib/props/x/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the plot `x` values. -* -* @private -* @returns {Array} x values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._xData.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/x/set.js b/ctor/lib/props/x/set.js deleted file mode 100644 index 759f450..0000000 --- a/ctor/lib/props/x/set.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isArray = require( '@stdlib/assert/is-array' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:x' ); - - -// MAIN // - -/** -* Sets the plot `x` values. -* -* @private -* @param {Array} x - x values -* @throws {TypeError} must be an array -* @returns {void} -*/ -function set( x ) { - /* eslint-disable no-invalid-this */ - if ( !isArray( x ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be an array. Value: `%s`.', 'x', x ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._xData ) ); - - this._xData = x.slice(); - debug( 'New Value: %s.', JSON.stringify( this._xData ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/y-axis-orient/get.js b/ctor/lib/props/y-axis-orient/get.js deleted file mode 100644 index 599ea8e..0000000 --- a/ctor/lib/props/y-axis-orient/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-axis orientation. -* -* @private -* @returns {string} orientation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yAxisOrient; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y-axis-orient/orientations.json b/ctor/lib/props/y-axis-orient/orientations.json deleted file mode 100644 index d2d3df7..0000000 --- a/ctor/lib/props/y-axis-orient/orientations.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "left", - "right" -] diff --git a/ctor/lib/props/y-axis-orient/set.js b/ctor/lib/props/y-axis-orient/set.js deleted file mode 100644 index af65af2..0000000 --- a/ctor/lib/props/y-axis-orient/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var ORIENTATIONS = require( './orientations.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:y-axis-orient' ); - - -// MAIN // - -/** -* Sets the y-axis orientation. -* -* @private -* @param {string} orientation - axis orientation -* @throws {TypeError} must be either `'left'` or `'right'` -*/ -function set( orientation ) { - /* eslint-disable no-invalid-this */ - if ( indexOf( ORIENTATIONS, orientation ) === -1 ) { - throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'yAxisOrient', ORIENTATIONS.join( '", "' ), orientation ) ); - } - if ( orientation !== this._yAxisOrient ) { - debug( 'Current value: %s.', this._yAxisOrient ); - - this._yAxisOrient = orientation; - debug( 'New value: %s.', this._yAxisOrient ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/y-domain/get.js b/ctor/lib/props/y-domain/get.js deleted file mode 100644 index cf17fe4..0000000 --- a/ctor/lib/props/y-domain/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-axis domain. -* -* @private -* @returns {Array} domain -*/ -function get() { - /* eslint-disable no-invalid-this */ - return [ this.yMin, this.yMax ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y-label/get.js b/ctor/lib/props/y-label/get.js deleted file mode 100644 index 4b36a06..0000000 --- a/ctor/lib/props/y-label/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-axis label. -* -* @private -* @returns {string} label -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yLabel; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y-label/set.js b/ctor/lib/props/y-label/set.js deleted file mode 100644 index de534d8..0000000 --- a/ctor/lib/props/y-label/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:y-label' ); - - -// MAIN // - -/** -* Sets the y-axis label. -* -* @private -* @param {string} label - axis label -* @throws {TypeError} must be a string -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( !isString( label ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'yLabel', label ) ); - } - if ( label !== this._yLabel ) { - debug( 'Current value: %s.', this._yLabel ); - - this._yLabel = label; - debug( 'New value: %s.', this._yLabel ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/y-max/get.js b/ctor/lib/props/y-max/get.js deleted file mode 100644 index 562b624..0000000 --- a/ctor/lib/props/y-max/get.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNull = require( '@stdlib/assert/is-null' ); -var max = require( './../../utils/max.js' ); // TODO: replace with mod when written - - -// FUNCTIONS // - -/** -* Computes a maximum value. -* -* @private -* @param {Array} arr - input array -* @returns {(number|null)} maximum value or null -*/ -function getMax( arr ) { - var tmp; - var i; - if ( arr.length === 0 ) { - return null; - } - tmp = new Array( arr.length ); - for ( i = 0; i < arr.length; i++ ) { - tmp[ i ] = max( arr[ i ] ); - } - return max( tmp ); -} - - -// MAIN // - -/** -* Returns the maximum value of the y-axis domain. -* -* @private -* @returns {number} maximum value -*/ -function get() { - /* eslint-disable no-invalid-this */ - var max; - if ( isNull( this._yMax ) ) { - max = getMax( this._yData ); - return ( isNull( max ) ) ? 1.0 : max; - } - return this._yMax; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y-max/set.js b/ctor/lib/props/y-max/set.js deleted file mode 100644 index ecda102..0000000 --- a/ctor/lib/props/y-max/set.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:y-max' ); - - -// MAIN // - -/** -* Sets the maximum value of the y-axis domain. -* -* @private -* @param {(FiniteNumber|null)} max - maximum value -* @throws {TypeError} must be a finite number or null -* @returns {void} -*/ -function set( max ) { - /* eslint-disable no-invalid-this */ - if ( - !isNull( max ) && - !isNumber( max ) // FIXME: finite number - ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number or null. Value: `%s`.', 'yMax', max ) ); - } - if ( max !== this._yMax ) { - debug( 'Current value: %d.', this._yMax ); - - this._yMax = max; - debug( 'New value: %d.', this._yMax ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/y-min/get.js b/ctor/lib/props/y-min/get.js deleted file mode 100644 index f5fef9c..0000000 --- a/ctor/lib/props/y-min/get.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNull = require( '@stdlib/assert/is-null' ); -var min = require( './../../utils/min.js' ); // TODO: replace with mod when written - - -// FUNCTIONS // - -/** -* Computes a minimum value. -* -* @private -* @param {Array} arr - input array -* @returns {(number|null)} minimum value or null -*/ -function getMin( arr ) { - var tmp; - var i; - if ( arr.length === 0 ) { - return null; - } - tmp = new Array( arr.length ); - for ( i = 0; i < arr.length; i++ ) { - tmp[ i ] = min( arr[ i ] ); - } - return min( tmp ); -} - - -// MAIN // - -/** -* Returns the minimum value of the y-axis domain. -* -* @private -* @returns {number} minimum value -*/ -function get() { - /* eslint-disable no-invalid-this */ - var min; - if ( isNull( this._yMin ) ) { - min = getMin( this._yData ); - return ( isNull( min ) ) ? 0.0 : min; - } - return this._yMin; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y-min/set.js b/ctor/lib/props/y-min/set.js deleted file mode 100644 index 808859f..0000000 --- a/ctor/lib/props/y-min/set.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:y-min' ); - - -// MAIN // - -/** -* Sets the minimum value of the y-axis domain. -* -* @private -* @param {(FiniteNumber|null)} min - minimum value -* @throws {TypeError} must be a finite number or null -* @returns {void} -*/ -function set( min ) { - /* eslint-disable no-invalid-this */ - if ( - !isNull( min ) && - !isNumber( min ) // FIXME: finite number - ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number or null. Value: `%s`.', 'yMin', min ) ); - } - if ( min !== this._yMin ) { - debug( 'Current value: %d.', this._yMin ); - - this._yMin = min; - debug( 'New value: %d.', this._yMin ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/y-num-ticks/get.js b/ctor/lib/props/y-num-ticks/get.js deleted file mode 100644 index 5aec4ef..0000000 --- a/ctor/lib/props/y-num-ticks/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the number of y-axis tick marks. -* -* @private -* @returns {(NonNegativeInteger|null)} number of ticks -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yNumTicks; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y-num-ticks/set.js b/ctor/lib/props/y-num-ticks/set.js deleted file mode 100644 index 959e06d..0000000 --- a/ctor/lib/props/y-num-ticks/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:y-num-ticks' ); - - -// MAIN // - -/** -* Sets the number of y-axis tick marks. -* -* @private -* @param {(NonNegativeInteger|null)} ticks - number of ticks -* @throws {TypeError} must be a nonnegative integer or null -*/ -function set( ticks ) { - /* eslint-disable no-invalid-this */ - if ( !isNull( ticks ) && !isNonNegativeInteger( ticks ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or null. Value: `%s`.', 'yNumTicks', ticks ) ); - } - if ( ticks !== this._yNumTicks ) { - debug( 'Current value: %d.', this._yNumTicks ); - - this._yNumTicks = ticks; - debug( 'New value: %d.', this._yNumTicks ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/y-pos/get.js b/ctor/lib/props/y-pos/get.js deleted file mode 100644 index f14489e..0000000 --- a/ctor/lib/props/y-pos/get.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'plot:y-pos' ); - - -// MAIN // - -/** -* Returns a function to map values to y-axis coordinate values. -* -* @private -* @returns {Function} map function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale = this.yScale; - return yPos; - - /** - * Maps a value to a y-axis coordinate value. - * - * @private - * @param {number} d - datum - * @returns {number} pixel value - */ - function yPos( d ) { - var px = scale( d ); - debug( 'Value: %d => Pixel: %d.', d, px ); - return px; - } -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y-range/get.js b/ctor/lib/props/y-range/get.js deleted file mode 100644 index 8bf31ee..0000000 --- a/ctor/lib/props/y-range/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-axis range. -* -* @private -* @returns {NumberArray} range -*/ -function get() { - /* eslint-disable no-invalid-this */ - return [ this.graphHeight, 0 ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y-rug-opacity/get.js b/ctor/lib/props/y-rug-opacity/get.js deleted file mode 100644 index 15b50f0..0000000 --- a/ctor/lib/props/y-rug-opacity/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-axis rug opacity. -* -* @private -* @returns {NumberArray} rug opacities -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yRugOpacity.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y-rug-opacity/set.js b/ctor/lib/props/y-rug-opacity/set.js deleted file mode 100644 index d4ffa12..0000000 --- a/ctor/lib/props/y-rug-opacity/set.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isNumberArray = require( '@stdlib/assert/is-number-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:y-rug-opacity' ); - - -// MAIN // - -/** -* Sets the y-axis rug opacity. -* -* @private -* @param {(number|NumberArray)} v - opacity -* @throws {TypeError} must be a number or number array -* @throws {RangeError} must be a number on the interval `[0,1]` -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isNum = isNumber( v ); - var i; - if ( !isNum && !isNumberArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a number or an array of numbers. Value: `%s`.', 'yRugOpacity', v ) ); - } - if ( isNum ) { - v = [ v ]; - } else { - v = v.slice(); - } - for ( i = 0; i < v.length; i++ ) { - if ( v[ i ] < 0.0 || v[ i ] > 1.0 ) { - throw new RangeError( format( 'invalid assignment. A `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'yRugOpacity', v[ i ] ) ); - } - } - debug( 'Current value: %s.', JSON.stringify( this._yRugOpacity ) ); - - this._yRugOpacity = v; - debug( 'New Value: %s.', JSON.stringify( this._yRugOpacity ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/y-rug-orient/get.js b/ctor/lib/props/y-rug-orient/get.js deleted file mode 100644 index 17005fc..0000000 --- a/ctor/lib/props/y-rug-orient/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-axis rug orientation. -* -* @private -* @returns {StringArray} orientation -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yRugOrient.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y-rug-orient/orientations.json b/ctor/lib/props/y-rug-orient/orientations.json deleted file mode 100644 index d2d3df7..0000000 --- a/ctor/lib/props/y-rug-orient/orientations.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "left", - "right" -] diff --git a/ctor/lib/props/y-rug-orient/set.js b/ctor/lib/props/y-rug-orient/set.js deleted file mode 100644 index 59ced1c..0000000 --- a/ctor/lib/props/y-rug-orient/set.js +++ /dev/null @@ -1,74 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( '@stdlib/string/format' ); -var ORIENTATIONS = require( './orientations.json' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:y-rug-orient' ); - - -// MAIN // - -/** -* Sets the y-axis rug orientation. -* -* @private -* @param {(string|StringArray)} v - rug orientation -* @throws {TypeError} must be either a string or string array -* @throws {TypeError} must be either `'bottom'` or `'top'` -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isStr = isString( v ); - var i; - if ( !isStr && !isStringArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.', 'yRugOrient', v ) ); - } - if ( isStr ) { - v = [ v ]; - } else { - v = v.slice(); - } - for ( i = 0; i < v.length; i++ ) { - if ( indexOf( ORIENTATIONS, v[i] ) === -1 ) { - throw new TypeError( format( 'invalid assignment. Unrecognized/unsupported orientation. A `%s` value must be one of the following: "%s". Value: `%s`.', 'yRugOrient', ORIENTATIONS.join( '", "' ), v[i] ) ); - } - } - debug( 'Current value: %s.', JSON.stringify( this._yRugOrient ) ); - - this._yRugOrient = v; - debug( 'New value: %s.', JSON.stringify( this._yRugOrient ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/y-rug-size/get.js b/ctor/lib/props/y-rug-size/get.js deleted file mode 100644 index b880aaf..0000000 --- a/ctor/lib/props/y-rug-size/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-axis rug tick (tassel) size. -* -* @private -* @returns {Array} tick sizes -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yRugSize.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y-rug-size/set.js b/ctor/lib/props/y-rug-size/set.js deleted file mode 100644 index 09d335e..0000000 --- a/ctor/lib/props/y-rug-size/set.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isNonNegativeIntegerArray = require( '@stdlib/assert/is-nonnegative-integer-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:y-rug-size' ); - - -// MAIN // - -/** -* Sets the y-axis rug tick (tassel) size. -* -* @private -* @param {(NonNegativeInteger|Array)} v - size -* @throws {TypeError} must be a nonnegative integer or nonnegative integer array -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isInt = isNonNegativeInteger( v ); - if ( !isInt && !isNonNegativeIntegerArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or an array of nonnegative integers. Value: `%s`.', 'yRugSize', v ) ); - } - if ( isInt ) { - v = [ v ]; - } else { - v = v.slice(); - } - debug( 'Current value: %s.', JSON.stringify( this._yRugSize ) ); - - this._yRugSize = v; - debug( 'New Value: %s.', JSON.stringify( this._yRugSize ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/y-rug/get.js b/ctor/lib/props/y-rug/get.js deleted file mode 100644 index df03aaa..0000000 --- a/ctor/lib/props/y-rug/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns whether a rug plot is displayed along the y-axis. -* -* @private -* @returns {BooleanArray} boolean flag -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yRug.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y-rug/set.js b/ctor/lib/props/y-rug/set.js deleted file mode 100644 index 1547ae9..0000000 --- a/ctor/lib/props/y-rug/set.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var isBooleanArray = require( '@stdlib/assert/is-boolean-array' ).primitives; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:y-rug' ); - - -// MAIN // - -/** -* Sets a flag indicating whether to display a rug plot along the y-axis. -* -* @private -* @param {(boolean|BooleanArray)} v - boolean flag(s) indicating whether to display a rug plot along the y-axis -* @throws {TypeError} must be a boolean or boolean array -*/ -function set( v ) { - /* eslint-disable no-invalid-this */ - var isBool = isBoolean( v ); - if ( !isBool && !isBooleanArray( v ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean or an array of booleans. Value: `%s`.', 'yRug', v ) ); - } - if ( isBool ) { - v = [ v ]; - } - debug( 'Current value: %s.', JSON.stringify( this._yRug ) ); - - this._yRug = v; - debug( 'New Value: %s.', JSON.stringify( this._yRug ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/y-scale/get.js b/ctor/lib/props/y-scale/get.js deleted file mode 100644 index e025d85..0000000 --- a/ctor/lib/props/y-scale/get.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var linear = require( 'd3-scale' ).scaleLinear; // TODO: remove -var time = require( 'd3-scale' ).scaleTime; // TODO: remove - - -// MAIN // - -/** -* Returns a scale function for mapping values to a coordinate along the y-axis. -* -* @private -* @returns {Function} scale function -*/ -function get() { - /* eslint-disable no-invalid-this */ - var scale; - if ( this._yScale === 'time' ) { - scale = time() - .domain( this.yDomain ) - .range( this.yRange ); - } else if ( this._yScale === 'linear' ) { - scale = linear() - .domain( this.yDomain ) - .range( this.yRange ); - } - // TODO: other scales - return scale; -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y-scale/set.js b/ctor/lib/props/y-scale/set.js deleted file mode 100644 index 3b7c395..0000000 --- a/ctor/lib/props/y-scale/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:y-scale' ); - - -// MAIN // - -/** -* Sets the y-axis scale. -* -* @private -* @param {string} scale - axis scale -* @throws {TypeError} must be a string -* @returns {void} -*/ -function set( scale ) { - /* eslint-disable no-invalid-this */ - if ( !isString( scale ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'yScale', scale ) ); - } - // TODO: test for valid scale - - debug( 'Current value: %s.', this._yScale ); - - this._yScale = scale; - debug( 'New value: %s.', this._yScale ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/y-tick-format/get.js b/ctor/lib/props/y-tick-format/get.js deleted file mode 100644 index 923bf4b..0000000 --- a/ctor/lib/props/y-tick-format/get.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var format = require( 'd3-format' ).format; // TODO: remove -var timeFormat = require( 'd3-time-format' ).timeFormat; // TODO: remove -var isNull = require( '@stdlib/assert/is-null' ); - - -// MAIN // - -/** -* Returns the y-axis tick format. -* -* @private -* @returns {(Function|null)} format function or null -*/ -function get() { - /* eslint-disable no-invalid-this */ - if ( isNull( this._yTickFormat ) ) { - return this._yTickFormat; - } - if ( this._yScale === 'time' ) { - return timeFormat( this._yTickFormat ); - } - return format( this._yTickFormat ); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y-tick-format/set.js b/ctor/lib/props/y-tick-format/set.js deleted file mode 100644 index 843f201..0000000 --- a/ctor/lib/props/y-tick-format/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isNull = require( '@stdlib/assert/is-null' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:y-tick-format' ); - - -// MAIN // - -/** -* Sets the y-axis tick format. -* -* @private -* @param {(string|null)} fmt - axis tick format -* @throws {TypeError} must be a string or null -*/ -function set( fmt ) { - /* eslint-disable no-invalid-this */ - if ( !isNull( fmt ) && !isString( fmt ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or null. Value: `%s`.', 'yTickFormat', fmt ) ); - } - if ( fmt !== this._yTickFormat ) { - debug( 'Current value: %s.', this._yTickFormat ); - - this._yTickFormat = fmt; - debug( 'New value: %s.', this._yTickFormat ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/props/y/get.js b/ctor/lib/props/y/get.js deleted file mode 100644 index 1808d29..0000000 --- a/ctor/lib/props/y/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the plot `y` values. -* -* @private -* @returns {Array} y values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yData.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/ctor/lib/props/y/set.js b/ctor/lib/props/y/set.js deleted file mode 100644 index 375b0d7..0000000 --- a/ctor/lib/props/y/set.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isArray = require( '@stdlib/assert/is-array' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:y' ); - - -// MAIN // - -/** -* Sets the plot `y` values. -* -* @private -* @param {Array} y - y values -* @throws {TypeError} must be an array -* @returns {void} -*/ -function set( y ) { - /* eslint-disable no-invalid-this */ - if ( !isArray( y ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be an array. Value: `%s`.', 'y', y ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._yData ) ); - - this._yData = y.slice(); - debug( 'New Value: %s.', JSON.stringify( this._yData ) ); - - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/ctor/lib/render/index.js b/ctor/lib/render/index.js deleted file mode 100644 index 8b4c254..0000000 --- a/ctor/lib/render/index.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var vdom2html = require( 'vdom-to-html' ); -var renderSVG = require( './svg' ); -var validate = require( './validate.js' ); - - -// VARIABLES // - -var debug = logger( 'plot:render' ); - - -// MAIN // - -/** -* Renders a plot. -* -* @private -* @param {string} [format] - render format -* @returns {(VTree|string)} virtual tree or a string -*/ -function render( format ) { - /* eslint-disable no-invalid-this */ - var out; - var tmp; - var fmt; - - tmp = this.renderFormat; - if ( arguments.length ) { - // Temporarily set the render format: - this.renderFormat = format; - fmt = format; - } else { - fmt = tmp; - } - debug( 'Validating render state...' ); - validate( this ); - - debug( 'Render format: %s.', this.renderFormat ); - debug( 'Rendering...' ); - if ( this._engine === 'svg' ) { - out = renderSVG( this ); - - // Default render format is virtual DOM. - if ( fmt === 'html' ) { - out = vdom2html( out ); - } - this.emit( 'render', out ); - } - if ( arguments.length ) { - // Restore the render format: - this.renderFormat = tmp; - } - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/ctor/lib/render/svg/index.js b/ctor/lib/render/svg/index.js deleted file mode 100644 index 2d0c632..0000000 --- a/ctor/lib/render/svg/index.js +++ /dev/null @@ -1,158 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var xAxisTransform = require( './utils/x_axis_transform.js' ); -var yAxisTransform = require( './utils/y_axis_transform.js' ); -var renderMarks = require( './marks' ); -var init = require( './init.js' ); -var sync = require( './sync.js' ); - - -// VARIABLES // - -var debug = logger( 'plot:render:svg:main' ); - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @param {Object} state - state -* @returns {VTree} virtual tree -*/ -function render( state ) { - var annotations; - var clipPath; - var canvas; - var title; - var graph; - var marks; - var xAxis; - var yAxis; - var bkgd; - var defs; - var svg; - - svg = state.$.svg; - - // Lazily initialize... - if ( !svg.canvas ) { - debug( 'Initializing components...' ); - init( state ); - } - debug( 'Syncing component states...' ); - sync( state ); - - debug( 'Rendering individual components...' ); - - debug( 'Rendering annotations...' ); - annotations = svg.annotations.render(); - - debug( 'Rendering clip-path...' ); - clipPath = svg.clipPath.render(); - - debug( 'Rendering canvas...' ); - canvas = svg.canvas.render(); - - debug( 'Rendering graph...' ); - graph = svg.graph.render(); - - debug( 'Rendering title...' ); - title = svg.title.render(); - - debug( 'Rendering x-axis...' ); - xAxis = svg.xAxis.render(); - - debug( 'Rendering y-axis...' ); - yAxis = svg.yAxis.render(); - - debug( 'Rendering background...' ); - bkgd = svg.bkgd.render(); - - debug( 'Rendering definitions...' ); - defs = svg.defs.render(); - - debug( 'Rendering marks...' ); - marks = renderMarks( state ); - - debug( 'Updating rendered components...' ); - - debug( 'Updating title...' ); - title.properties.attributes.x = state.paddingLeft + ( state.graphWidth/2 ); - title.properties.attributes.y = state.paddingTop / 2; - - debug( 'Updating x-axis...' ); - xAxis.properties.className += ' x'; - xAxis.properties.attributes.transform = xAxisTransform( state.xAxisOrient, state.graphHeight ); // eslint-disable-line max-len - - debug( 'Updating y-axis...' ); - yAxis.properties.className += ' y'; - yAxis.properties.attributes.transform = yAxisTransform( state.yAxisOrient, state.graphWidth ); // eslint-disable-line max-len - - debug( 'Assembling virtual tree...' ); - - debug( 'Inserting clip-path into definitions...' ); - defs.children.push( clipPath ); - defs.count += clipPath.count; - - debug( 'Inserting background into graph...' ); - graph.children.push( bkgd ); - graph.count += bkgd.count; - - debug( 'Inserting marks into graph...' ); - graph.children.push( marks ); - graph.count += marks.count; - - debug( 'Inserting x-axis into graph...' ); - graph.children.push( xAxis ); - graph.count += xAxis.count; - - debug( 'Inserting y-axis into graph...' ); - graph.children.push( yAxis ); - graph.count += yAxis.count; - - debug( 'Inserting title into annotations...' ); - annotations.children.push( title ); - annotations.count += title.count; - - debug( 'Inserting definitions into canvas...' ); - canvas.children.push( defs ); - canvas.count += defs.count; - - debug( 'Inserting graph into canvas...' ); - canvas.children.push( graph ); - canvas.count += graph.count; - - debug( 'Inserting annotations into canvas...' ); - canvas.children.push( annotations ); - canvas.count += annotations.count; - - return canvas; -} - - -// EXPORTS // - -module.exports = render; diff --git a/ctor/lib/render/svg/init.js b/ctor/lib/render/svg/init.js deleted file mode 100644 index 3ab91c8..0000000 --- a/ctor/lib/render/svg/init.js +++ /dev/null @@ -1,205 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var Annotations = require( './../../../../components/svg/annotations' ); -var ClipPath = require( './../../../../components/svg/clip-path' ); -var Canvas = require( './../../../../components/svg/canvas' ); -var Graph = require( './../../../../components/svg/graph' ); -var Title = require( './../../../../components/svg/title' ); -var Marks = require( './../../../../components/svg/marks' ); -var Bkgd = require( './../../../../components/svg/background' ); -var Defs = require( './../../../../components/svg/defs' ); -var Axis = require( './../../../../components/svg/axis' ); -var Path = require( './../../../../components/svg/path' ); -var Symbols = require( './../../../../components/svg/symbols' ); -var Rug = require( './../../../../components/svg/rug' ); - - -// VARIABLES // - -var debug = logger( 'plot:render:svg:init' ); - - -// MAIN // - -/** -* Initializes SVG components. -* -* @private -* @param {Object} state - state -*/ -function init( state ) { - var svg = state.$.svg; - - debug( 'Initializing components...' ); - - debug( 'Initializing canvas component...' ); - defineProperty( svg, 'canvas', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Canvas({ - 'autoRender': false - }) - }); - - debug( 'Initializing definitions component...' ); - defineProperty( svg, 'defs', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Defs({ - 'autoRender': false - }) - }); - - debug( 'Initializing clipping path component...' ); - defineProperty( svg, 'clipPath', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new ClipPath({ - 'autoRender': false, - 'id': state._clipPathId // eslint-disable-line no-underscore-dangle - }) - }); - - debug( 'Initializing graph component...' ); - defineProperty( svg, 'graph', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Graph({ - 'autoRender': false - }) - }); - - debug( 'Initializing annotations component...' ); - defineProperty( svg, 'annotations', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Annotations({ - 'autoRender': false - }) - }); - - debug( 'Initializing title component...' ); - defineProperty( svg, 'title', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Title({ - 'autoRender': false - }) - }); - - debug( 'Initializing background component...' ); - defineProperty( svg, 'bkgd', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Bkgd({ - 'autoRender': false - }) - }); - - debug( 'Initializing marks component...' ); - defineProperty( svg, 'marks', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Marks({ - 'autoRender': false, - 'clipPathId': state._clipPathId // eslint-disable-line no-underscore-dangle - }) - }); - - debug( 'Initializing path component...' ); - defineProperty( svg, 'path', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Path({ - 'autoRender': false - }) - }); - - debug( 'Initializing symbols component...' ); - defineProperty( svg, 'symbols', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Symbols({ - 'autoRender': false - }) - }); - - debug( 'Initializing x-axis rug component...' ); - defineProperty( svg, 'xRug', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Rug({ - 'autoRender': false - }) - }); - - debug( 'Initializing y-axis rug component...' ); - defineProperty( svg, 'yRug', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Rug({ - 'autoRender': false - }) - }); - - debug( 'Initializing x-axis component...' ); - defineProperty( svg, 'xAxis', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Axis({ - 'autoRender': false - }) - }); - - debug( 'Initializing y-axis component...' ); - defineProperty( svg, 'yAxis', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Axis({ - 'autoRender': false - }) - }); - - debug( 'All components initialized.' ); -} - - -// EXPORTS // - -module.exports = init; diff --git a/ctor/lib/render/svg/marks/index.js b/ctor/lib/render/svg/marks/index.js deleted file mode 100644 index 0c69a27..0000000 --- a/ctor/lib/render/svg/marks/index.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var lines = require( './lines.js' ); -var symbols = require( './symbols.js' ); -var xRug = require( './x_rug.js' ); -var yRug = require( './y_rug.js' ); - - -// VARIABLES // - -var debug = logger( 'plot:render:svg:marks' ); - - -// MAIN // - -/** -* Renders individual marks. -* -* @private -* @param {Object} state - state -* @returns {VTree} virtual tree -*/ -function render( state ) { - var parent; - var marks; - var len; - var i; - - debug( 'Rendering marks group...' ); - parent = state.$.svg.marks.render(); - - len = state.x.length; - if ( len === 0 ) { - debug( 'No individual marks to render.' ); - return parent; - } - marks = []; - - debug( 'Rendering lines...' ); - marks = marks.concat( lines( state ) ); - - debug( 'Rendering symbols...' ); - marks = marks.concat( symbols( state ) ); - - debug( 'Rendering x-axis rug plots...' ); - marks = marks.concat( xRug( state ) ); - - debug( 'Rendering y-axis rug plots...' ); - marks = marks.concat( yRug( state ) ); - - debug( 'Inserting individual marks into marks group...' ); - for ( i = 0; i < marks.length; i++ ) { - parent.children.push( marks[i] ); - parent.count += marks[i].count; - } - debug( 'Finished rendering marks.' ); - return parent; -} - - -// EXPORTS // - -module.exports = render; diff --git a/ctor/lib/render/svg/marks/lines.js b/ctor/lib/render/svg/marks/lines.js deleted file mode 100644 index f9dd8a2..0000000 --- a/ctor/lib/render/svg/marks/lines.js +++ /dev/null @@ -1,99 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'plot:render:svg:marks:lines' ); - - -// MAIN // - -/** -* Renders line marks. -* -* @private -* @param {Object} state - state -* @returns {VTree} virtual tree -*/ -function render( state ) { - var nOpacities; - var lineStyle; - var opacity; - var nColors; - var nStyles; - var nWidths; - var color; - var width; - var marks; - var line; - var len; - var i; - - line = state.$.svg.path; - nOpacities = state.lineOpacity.length; - nStyles = state.lineStyle.length; - nWidths = state.lineWidth.length; - nColors = state.colors.length; - - len = state.x.length; - marks = []; - - debug( 'Rendering lines...' ); - for ( i = 0; i < len; i++ ) { - lineStyle = state.lineStyle[ i%nStyles ]; - debug( 'Line style: %s (%d).', lineStyle, i ); - - if ( lineStyle === 'none' ) { - debug( 'Line style (%d) is `none`. Skipping...', i ); - continue; - } - color = state.colors[ i%nColors ]; - debug( 'Line color: %s (%d).', color, i ); - - opacity = state.lineOpacity[ i%nOpacities ]; - debug( 'Line opacity: %s (%d).', opacity, i ); - - width = state.lineWidth[ i%nWidths ]; - debug( 'Line width: %s (%d).', width, i ); - - line.x = state.x[ i ]; - line.y = state.y[ i ]; - line.style = lineStyle; - line.label = state.labels[ i ] || ''; - line.color = color; - line.opacity = opacity; - line.width = width; - - debug( 'Rendering line %d...', i ); - marks.push( line.render() ); - } - debug( 'Finished rendering lines.' ); - return marks; -} - - -// EXPORTS // - -module.exports = render; diff --git a/ctor/lib/render/svg/marks/symbols.js b/ctor/lib/render/svg/marks/symbols.js deleted file mode 100644 index 53f3cf8..0000000 --- a/ctor/lib/render/svg/marks/symbols.js +++ /dev/null @@ -1,99 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'plot:render:svg:marks:symbols' ); - - -// MAIN // - -/** -* Renders symbols marks. -* -* @private -* @param {Object} state - state -* @returns {VTree} virtual tree -*/ -function render( state ) { - var nOpacities; - var nSymbols; - var nColors; - var opacity; - var nSizes; - var symbol; - var color; - var marks; - var size; - var sym; - var len; - var i; - - sym = state.$.svg.symbols; - nOpacities = state.symbolsOpacity.length; - nSymbols = state.symbols.length; - nColors = state.colors.length; - nSizes = state.symbolsSize.length; - - len = state.x.length; - marks = []; - - debug( 'Rendering symbols...' ); - for ( i = 0; i < len; i++ ) { - symbol = state.symbols[ i%nSymbols ]; - debug( 'Symbol: %s (%d).', symbol, i ); - - if ( symbol === 'none' ) { - debug( 'Symbol (%d) is `none`. Skipping...', i ); - continue; - } - opacity = state.symbolsOpacity[ i%nOpacities ]; - debug( 'Symbols opacity: %d (%d).', opacity, i ); - - size = state.symbolsSize[ i%nSizes ]; - debug( 'Symbols size: %d (%d).', size, i ); - - color = state.colors[ i%nColors ]; - debug( 'Symbols color: %s (%d).', color, i ); - - sym.x = state.x[ i ]; - sym.y = state.y[ i ]; - sym.symbol = symbol; - sym.label = state.labels[ i ] || ''; - sym.color = color; - sym.size = size; - sym.opacity = opacity; - - debug( 'Rendering symbols %d...', i ); - marks.push( sym.render() ); - } - debug( 'Finished rendering symbols.' ); - return marks; -} - - -// EXPORTS // - -module.exports = render; diff --git a/ctor/lib/render/svg/marks/x_rug.js b/ctor/lib/render/svg/marks/x_rug.js deleted file mode 100644 index 9a396d4..0000000 --- a/ctor/lib/render/svg/marks/x_rug.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var xRugTransform = require( './../utils/x_rug_transform.js' ); - - -// VARIABLES // - -var debug = logger( 'plot:render:svg:marks:x-rug' ); - - -// MAIN // - -/** -* Renders x-axis rug plots. -* -* @private -* @param {Object} state - state -* @returns {VTree} virtual tree -*/ -function render( state ) { - var rugTransform; - var nOpacities; - var nOrients; - var opacity; - var nColors; - var nSizes; - var orient; - var nFlgs; - var color; - var marks; - var size; - var rug; - var len; - var tmp; - var i; - - rug = state.$.svg.xRug; - - nOpacities = state.xRugOpacity.length; - nOrients = state.xRugOrient.length; - nColors = state.colors.length; - nSizes = state.xRugSize.length; - nFlgs = state.xRug.length; - - len = state.x.length; - marks = []; - - debug( 'Rendering x-axis rug plots...' ); - for ( i = 0; i < len; i++ ) { - if ( !state.xRug[ i%nFlgs ] ) { - debug( 'Rug plot (%d) disabled. Skipping...', i ); - continue; - } - color = state.colors[ i%nColors ]; - debug( 'Rug color: %s (%d).', color, i ); - - opacity = state.xRugOpacity[ i%nOpacities ]; - debug( 'Rug opacity: %d (%d).', opacity, i ); - - orient = state.xRugOrient[ i%nOrients ]; - debug( 'Rug orientation: %s (%d).', orient, i ); - - size = state.xRugSize[ i%nSizes ]; - debug( 'Rug tick size: %d (%d).', size, i ); - - rug.data = state.x[ i ]; - rug.label = state.labels[ i ] || ''; - rug.color = color; - rug.size = size; - rug.opacity = opacity; - rug.orientation = orient; - - debug( 'Rendering x-axis rug %d...', i ); - tmp = rug.render(); - - // Update the class name to indicate this is an x-axis rug and add a transform to translate the rug into position based on the graph dimensions. - tmp.properties.className += ' x'; - rugTransform = xRugTransform( orient, state.graphHeight ); - if ( !tmp.properties.attributes ) { - tmp.properties.attributes = {}; - } - tmp.properties.attributes.transform = rugTransform; - - marks.push( tmp ); - } - debug( 'Finished rendering x-axis rug plots.' ); - return marks; -} - - -// EXPORTS // - -module.exports = render; diff --git a/ctor/lib/render/svg/marks/y_rug.js b/ctor/lib/render/svg/marks/y_rug.js deleted file mode 100644 index 992dc60..0000000 --- a/ctor/lib/render/svg/marks/y_rug.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var yRugTransform = require( './../utils/y_rug_transform.js' ); - - -// VARIABLES // - -var debug = logger( 'plot:render:svg:marks:y-rug' ); - - -// MAIN // - -/** -* Renders y-axis rug plots. -* -* @private -* @param {Object} state - state -* @returns {VTree} virtual tree -*/ -function render( state ) { - var rugTransform; - var nOpacities; - var nOrients; - var opacity; - var nColors; - var nSizes; - var orient; - var nFlgs; - var color; - var marks; - var size; - var rug; - var len; - var tmp; - var i; - - rug = state.$.svg.yRug; - - nOpacities = state.yRugOpacity.length; - nOrients = state.yRugOrient.length; - nColors = state.colors.length; - nSizes = state.yRugSize.length; - nFlgs = state.yRug.length; - - len = state.y.length; - marks = []; - - debug( 'Rendering y-axis rug plots...' ); - for ( i = 0; i < len; i++ ) { - if ( !state.yRug[ i%nFlgs ] ) { - debug( 'Rug plot (%d) disabled. Skipping...', i ); - continue; - } - color = state.colors[ i%nColors ]; - debug( 'Rug color: %s (%d).', color, i ); - - opacity = state.yRugOpacity[ i%nOpacities ]; - debug( 'Rug opacity: %d (%d).', opacity, i ); - - orient = state.yRugOrient[ i%nOrients ]; - debug( 'Rug orientation: %s (%d).', orient, i ); - - size = state.yRugSize[ i%nSizes ]; - debug( 'Rug tick size: %d (%d).', size, i ); - - rug.data = state.y[ i ]; - rug.label = state.labels[ i ] || ''; - rug.color = color; - rug.size = size; - rug.opacity = opacity; - rug.orientation = orient; - - debug( 'Rendering y-axis rug %d...', i ); - tmp = rug.render(); - - // Update the class name to indicate this is a y-axis rug and add a transform to translate the rug into position based on the graph dimensions. - tmp.properties.className += ' y'; - rugTransform = yRugTransform( orient, state.graphWidth ); - if ( !tmp.properties.attributes ) { - tmp.properties.attributes = {}; - } - tmp.properties.attributes.transform = rugTransform; - - marks.push( tmp ); - } - debug( 'Finished rendering y-axis rug plots.' ); - return marks; -} - - -// EXPORTS // - -module.exports = render; diff --git a/ctor/lib/render/svg/sync.js b/ctor/lib/render/svg/sync.js deleted file mode 100644 index 1777d32..0000000 --- a/ctor/lib/render/svg/sync.js +++ /dev/null @@ -1,116 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'plot:render:svg:sync' ); - - -// MAIN // - -/** -* Syncs SVG components with the current state. -* -* @private -* @param {Object} state - state -*/ -function sync( state ) { - var svg = state.$.svg; - - debug( 'Syncing...' ); - - debug( 'Syncing canvas...' ); - svg.canvas.width = state.width; - svg.canvas.height = state.height; - - debug( 'Syncing definitions...' ); - - // ... - - debug( 'Syncing clipping path...' ); - svg.clipPath.width = state.graphWidth; - svg.clipPath.height = state.graphHeight; - - debug( 'Syncing graph...' ); - svg.graph.translateX = state.paddingLeft; - svg.graph.translateY = state.paddingTop; - - debug( 'Syncing annotations...' ); - - // ... - - debug( 'Syncing title...' ); - svg.title.text = state.title; - - debug( 'Syncing background...' ); - svg.bkgd.width = state.graphWidth; - svg.bkgd.height = state.graphHeight; - - debug( 'Syncing marks...' ); - svg.marks.clipPathId = state._clipPathId; // eslint-disable-line no-underscore-dangle - - debug( 'Syncing path...' ); - svg.path.xScale = state.xScale; - svg.path.yScale = state.yScale; - - // svg.path.isDefined = state.isDefined; // TODO - - debug( 'Syncing symbols...' ); - svg.symbols.xScale = state.xScale; - svg.symbols.yScale = state.yScale; - - // svg.symbols.isDefined = state.isDefined; // TODO - - debug( 'Syncing x-axis rug...' ); - svg.xRug.scale = state.xScale; - - // svg.xRug.isDefined = state.isDefined; // TODO - - debug( 'Syncing y-axis rug...' ); - svg.yRug.scale = state.yScale; - - // svg.yRug.isDefined = state.isDefined; // TODO - - debug( 'Syncing x-axis...' ); - svg.xAxis.scale = state.xScale; - svg.xAxis.label = state.xLabel; - svg.xAxis.tickFormat = state.xTickFormat; - svg.xAxis.numTicks = state.xNumTicks; - svg.xAxis.orientation = state.xAxisOrient; - - debug( 'Syncing y-axis...' ); - svg.yAxis.scale = state.yScale; - svg.yAxis.label = state.yLabel; - svg.yAxis.tickFormat = state.yTickFormat; - svg.yAxis.numTicks = state.yNumTicks; - svg.yAxis.orientation = state.yAxisOrient; - - debug( 'Sync complete.' ); -} - - -// EXPORTS // - -module.exports = sync; diff --git a/ctor/lib/render/svg/utils/x_axis_transform.js b/ctor/lib/render/svg/utils/x_axis_transform.js deleted file mode 100644 index dba6773..0000000 --- a/ctor/lib/render/svg/utils/x_axis_transform.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns an x-axis translation transform. -* -* @private -* @param {string} orient - axis orientation -* @param {number} height - graph height -* @returns {string} transform -*/ -function xAxisTransform( orient, height ) { - if ( orient === 'top' ) { - return 'translate(0,0)'; - } - return 'translate(0,'+height+')'; -} - - -// EXPORTS // - -module.exports = xAxisTransform; diff --git a/ctor/lib/render/svg/utils/x_rug_transform.js b/ctor/lib/render/svg/utils/x_rug_transform.js deleted file mode 100644 index 323ed86..0000000 --- a/ctor/lib/render/svg/utils/x_rug_transform.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns an x-axis rug translation transform. -* -* @private -* @param {string} orient - axis orientation -* @param {number} height - graph height -* @returns {string} transform -*/ -function xRugTransform( orient, height ) { - if ( orient === 'top' ) { - return 'translate(0,0)'; - } - return 'translate(0,'+height+')'; -} - - -// EXPORTS // - -module.exports = xRugTransform; diff --git a/ctor/lib/render/svg/utils/y_axis_transform.js b/ctor/lib/render/svg/utils/y_axis_transform.js deleted file mode 100644 index 2373863..0000000 --- a/ctor/lib/render/svg/utils/y_axis_transform.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns a y-axis translation transform. -* -* @private -* @param {string} orient - axis orientation -* @param {number} width - graph width -* @returns {string} transform -*/ -function yAxisTransform( orient, width ) { - if ( orient === 'left' ) { - return 'translate(0,0)'; - } - return 'translate('+width+',0)'; -} - - -// EXPORTS // - -module.exports = yAxisTransform; diff --git a/ctor/lib/render/svg/utils/y_rug_transform.js b/ctor/lib/render/svg/utils/y_rug_transform.js deleted file mode 100644 index 015f731..0000000 --- a/ctor/lib/render/svg/utils/y_rug_transform.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns a y-axis rug translation transform. -* -* @private -* @param {string} orient - axis orientation -* @param {number} width - graph width -* @returns {string} transform -*/ -function yRugTransform( orient, width ) { - if ( orient === 'left' ) { - return 'translate(0,0)'; - } - return 'translate('+width+',0)'; -} - - -// EXPORTS // - -module.exports = yRugTransform; diff --git a/ctor/lib/render/validate.js b/ctor/lib/render/validate.js deleted file mode 100644 index c47d814..0000000 --- a/ctor/lib/render/validate.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates that an instance is in a valid state for rendering. -* -* @private -* @param {Object} state - state -* @throws {Error} must be in a valid state to render -*/ -function validate( state ) { - /* eslint-disable no-underscore-dangle */ - var x; - var y; - var i; - - x = state._xData; - y = state._yData; - if ( x.length !== y.length ) { - throw new Error( format( 'invalid state. x and y are different lengths. x length: `%u`. y length: `%u`.', x.length, y.length ) ); - } - // TODO: will need to refactor to some degree to support `ndarray`-like `x` and `y` - for ( i = 0; i < x.length; i++ ) { - if ( x[ i ].length !== y[ i ].length ) { - throw new Error( format( 'invalid state. Each `x[i]:y[i]` pair must be the same length. x[%u].length: `%u`, y[%u].length: `%u`.', i, x[i].length, i, y[i].length ) ); - } - } -} - - -// EXPORTS // - -module.exports = validate; diff --git a/ctor/lib/utils/max.js b/ctor/lib/utils/max.js deleted file mode 100644 index 9800f1e..0000000 --- a/ctor/lib/utils/max.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Computes a maximum value. -* -* @private -* @param {NumericArray} arr - input array -* @returns {(number|null)} maximum value or null -*/ -function getMax( arr ) { - var max; - var i; - if ( arr.length === 0 ) { - return null; - } - max = arr[ 0 ]; - for ( i = 1; i < arr.length; i++ ) { - if ( arr[ i ] > max ) { - max = arr[ i ]; - } - } - return max; -} - - -// EXPORTS // - -module.exports = getMax; diff --git a/ctor/lib/utils/min.js b/ctor/lib/utils/min.js deleted file mode 100644 index a8a5878..0000000 --- a/ctor/lib/utils/min.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Computes a minimum value. -* -* @private -* @param {NumericArray} arr - input array -* @returns {(number|null)} minimum value or null -*/ -function getMin( arr ) { - var min; - var i; - if ( arr.length === 0 ) { - return null; - } - min = arr[ 0 ]; - for ( i = 1; i < arr.length; i++ ) { - if ( arr[ i ] < min ) { - min = arr[ i ]; - } - } - return min; -} - - -// EXPORTS // - -module.exports = getMin; diff --git a/ctor/lib/view/browser/index.html b/ctor/lib/view/browser/index.html deleted file mode 100644 index 79dc0c8..0000000 --- a/ctor/lib/view/browser/index.html +++ /dev/null @@ -1,708 +0,0 @@ - - - - - - - - -   - - - - - -
{{plot}}
- - diff --git a/ctor/lib/view/browser/index.js b/ctor/lib/view/browser/index.js deleted file mode 100644 index f47b382..0000000 --- a/ctor/lib/view/browser/index.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var path = require( 'path' ); -var toHTML = require( 'vdom-to-html' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var httpServer = require( '@stdlib/net/disposable-http-server' ); - - -// MAIN // - -/** -* Opens a plot in a browser window. -* -* @private -* @param {VTree} vtree - virtual DOM tree -*/ -function view( vtree ) { - var index; - var html; - - // Transform the virtual DOM tree to HTML: - html = toHTML( vtree ); - - // Inject the HTML: - index = path.join( __dirname, 'index.html' ); - index = readFileSync( index, { - 'encoding': 'utf8' - }); - - index = index.replace( /\{\{plot\}\}/, html ); - - // Create a disposable HTTP server: - httpServer({ - 'html': index, - 'open': true - }); -} - - -// EXPORTS // - -module.exports = view; diff --git a/ctor/lib/view/electron/css/colors.css b/ctor/lib/view/electron/css/colors.css deleted file mode 100644 index 4aef35f..0000000 --- a/ctor/lib/view/electron/css/colors.css +++ /dev/null @@ -1,523 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -/* D3: Category10 */ -.category10-1, -[data-color="category10-1"] { - stroke: #1f77b4; -} -.category10-2, -[data-color="category10-2"] { - stroke: #ff7f0e; -} -.category10-3, -[data-color="category10-3"] { - stroke: #2ca02c; -} -.category10-4, -[data-color="category10-4"] { - stroke: #d62728; -} -.category10-5, -[data-color="category10-5"] { - stroke: #9467bd; -} -.category10-6, -[data-color="category10-6"] { - stroke: #8c564b; -} -.category10-7, -[data-color="category10-7"] { - stroke: #e377c2; -} -.category10-8, -[data-color="category10-8"] { - stroke: #7f7f7f; -} -.category10-9, -[data-color="category10-9"] { - stroke: #bcdb22; -} -.category10-10, -[data-color="category10-10"] { - stroke: #17becf; -} - -/* D3: category20 */ -.category20-1, -[data-color="category20-1"] { - stroke: #1f77b4; -} -.category20-2, -[data-color="category20-2"] { - stroke: #aec7e8; -} -.category20-3, -[data-color="category20-3"] { - stroke: #ff7f0e; -} -.category20-4, -[data-color="category20-4"] { - stroke: #ffbb78; -} -.category20-5, -[data-color="category20-5"] { - stroke: #2ca02c; -} -.category20-6, -[data-color="category20-6"] { - stroke: #98df8a; -} -.category20-7, -[data-color="category20-7"] { - stroke: #d62728; -} -.category20-8, -[data-color="category20-8"] { - stroke: #ff9896; -} -.category20-9, -[data-color="category20-9"] { - stroke: #9467bd; -} -.category20-10, -[data-color="category20-10"] { - stroke: #c5b0d5; -} -.category20-11, -[data-color="category20-11"] { - stroke: #8c564b; -} -.category20-12, -[data-color="category20-12"] { - stroke: #c49c94; -} -.category20-13, -[data-color="category20-13"] { - stroke: #e377c2; -} -.category20-14, -[data-color="category20-14"] { - stroke: #f7b6d2; -} -.category20-15, -[data-color="category20-15"] { - stroke: #7f7f7f; -} -.category20-16, -[data-color="category20-16"] { - stroke: #c7c7c7; -} -.category20-17, -[data-color="category20-17"] { - stroke: #bcbd22; -} -.category20-18, -[data-color="category20-18"] { - stroke: #dbdb8d; -} -.category20-19, -[data-color="category20-19"] { - stroke: #17becf; -} -.category20-20, -[data-color="category20-20"] { - stroke: #9edae5; -} - -/* D3: category20b */ -.category20b-1, -[data-color="category20b-1"] { - stroke: #393b79; -} -.category20b-2, -[data-color="category20b-2"] { - stroke: #5254a3; -} -.category20b-3, -[data-color="category20b-3"] { - stroke: #6b6ecf; -} -.category20b-4, -[data-color="category20b-4"] { - stroke: #9c9ede; -} -.category20b-5, -[data-color="category20b-5"] { - stroke: #637939; -} -.category20b-6, -[data-color="category20b-6"] { - stroke: #8ca252; -} -.category20b-7, -[data-color="category20b-7"] { - stroke: #b5cf6b; -} -.category20b-8, -[data-color="category20b-8"] { - stroke: #cedb9c; -} -.category20b-9, -[data-color="category20b-9"] { - stroke: #8c6d31; -} -.category20b-10, -[data-color="category20b-10"] { - stroke: #bd9e39; -} -.category20b-11, -[data-color="category20b-11"] { - stroke: #e7ba52; -} -.category20b-12, -[data-color="category20b-12"] { - stroke: #e7cb94; -} -.category20b-13, -[data-color="category20b-13"] { - stroke: #843c39; -} -.category20b-14, -[data-color="category20b-14"] { - stroke: #ad494a; -} -.category20b-15, -[data-color="category20b-15"] { - stroke: #d6616b; -} -.category20b-16, -[data-color="category20b-16"] { - stroke: #e7969c; -} -.category20b-17, -[data-color="category20b-17"] { - stroke: #7b4173; -} -.category20b-18, -[data-color="category20b-18"] { - stroke: #a55194; -} -.category20b-19, -[data-color="category20b-19"] { - stroke: #ce6dbd; -} -.category20b-20, -[data-color="category20b-20"] { - stroke: #de9ed6; -} - -/* D3: category20c */ -.category20c-1, -[data-color="category20c-1"] { - stroke: #3182bd; -} -.category20c-2, -[data-color="category20c-2"] { - stroke: #6baed6; -} -.category20c-3, -[data-color="category20c-3"] { - stroke: #9ecae1; -} -.category20c-4, -[data-color="category20c-4"] { - stroke: #c6dbef; -} -.category20c-5, -[data-color="category20c-5"] { - stroke: #e6550d; -} -.category20c-6, -[data-color="category20c-6"] { - stroke: #fd8d3c; -} -.category20c-7, -[data-color="category20c-7"] { - stroke: #fdae6b; -} -.category20c-8, -[data-color="category20c-8"] { - stroke: #fdd0a2; -} -.category20c-9, -[data-color="category20c-9"] { - stroke: #31a354; -} -.category20c-10, -[data-color="category20c-10"] { - stroke: #74c476; -} -.category20c-11, -[data-color="category20c-11"] { - stroke: #a1d99b; -} -.category20c-12, -[data-color="category20c-12"] { - stroke: #c7e9c0; -} -.category20c-13, -[data-color="category20c-13"] { - stroke: #756bb1; -} -.category20c-14, -[data-color="category20c-14"] { - stroke: #9e9ac8; -} -.category20c-15, -[data-color="category20c-15"] { - stroke: #bcbddc; -} -.category20c-16, -[data-color="category20c-16"] { - stroke: #dadaeb; -} -.category20c-17, -[data-color="category20c-17"] { - stroke: #636363; -} -.category20c-18, -[data-color="category20c-18"] { - stroke: #969696; -} -.category20c-19, -[data-color="category20c-19"] { - stroke: #bdbdbd; -} -.category20c-20, -[data-color="category20c-20"] { - stroke: #d9d9d9; -} - -/* D3: Category10 */ -.category10-1-span { - background-color: #1f77b4; -} -.category10-2-span { - background-color: #ff7f0e; -} -.category10-3-span { - background-color: #2ca02c; -} -.category10-4-span { - background-color: #d62728; -} -.category10-5-span { - background-color: #9467bd; -} -.category10-6-span { - background-color: #8c564b; -} -.category10-7-span { - background-color: #e377c2; -} -.category10-8-span { - background-color: #7f7f7f; -} -.category10-9-span { - background-color: #bcdb22; -} -.category10-10-span { - background-color: #17becf; -} - -/* D3: category20 */ -.category20-1-span { - background-color: #1f77b4; -} -.category20-2-span { - background-color: #aec7e8; -} -.category20-3-span { - background-color: #ff7f0e; -} -.category20-4-span { - background-color: #ffbb78; -} -.category20-5-span { - background-color: #2ca02c; -} -.category20-6-span { - background-color: #98df8a; -} -.category20-7-span { - background-color: #d62728; -} -.category20-8-span { - background-color: #ff9896; -} -.category20-9-span { - background-color: #9467bd; -} -.category20-10-span { - background-color: #c5b0d5; -} -.category20-11-span { - background-color: #8c564b; -} -.category20-12-span { - background-color: #c49c94; -} -.category20-13-span { - background-color: #e377c2; -} -.category20-14-span { - background-color: #f7b6d2; -} -.category20-15-span { - background-color: #7f7f7f; -} -.category20-16-span { - background-color: #c7c7c7; -} -.category20-17-span { - background-color: #bcbd22; -} -.category20-18-span { - background-color: #dbdb8d; -} -.category20-19-span { - background-color: #17becf; -} -.category20-20-span { - background-color: #9edae5; -} - -/* D3: category20b */ -.category20b-1-span { - background-color: #393b79; -} -.category20b-2-span { - background-color: #5254a3; -} -.category20b-3-span { - background-color: #6b6ecf; -} -.category20b-4-span { - background-color: #9c9ede; -} -.category20b-5-span { - background-color: #637939; -} -.category20b-6-span { - background-color: #8ca252; -} -.category20b-7-span { - background-color: #b5cf6b; -} -.category20b-8-span { - background-color: #cedb9c; -} -.category20b-9-span { - background-color: #8c6d31; -} -.category20b-10-span { - background-color: #bd9e39; -} -.category20b-11-span { - background-color: #e7ba52; -} -.category20b-12-span { - background-color: #e7cb94; -} -.category20b-13-span { - background-color: #843c39; -} -.category20b-14-span { - background-color: #ad494a; -} -.category20b-15-span { - background-color: #d6616b; -} -.category20b-16-span { - background-color: #e7969c; -} -.category20b-17-span { - background-color: #7b4173; -} -.category20b-18-span { - background-color: #a55194; -} -.category20b-19-span { - background-color: #ce6dbd; -} -.category20b-20-span { - background-color: #de9ed6; -} - -/* D3: category20c */ -.category20c-1-span { - background-color: #3182bd; -} -.category20c-2-span { - background-color: #6baed6; -} -.category20c-3-span { - background-color: #9ecae1; -} -.category20c-4-span { - background-color: #c6dbef; -} -.category20c-5-span { - background-color: #e6550d; -} -.category20c-6-span { - background-color: #fd8d3c; -} -.category20c-7-span { - background-color: #fdae6b; -} -.category20c-8-span { - background-color: #fdd0a2; -} -.category20c-9-span { - background-color: #31a354; -} -.category20c-10-span { - background-color: #74c476; -} -.category20c-11-span { - background-color: #a1d99b; -} -.category20c-12-span { - background-color: #c7e9c0; -} -.category20c-13-span { - background-color: #756bb1; -} -.category20c-14-span { - background-color: #9e9ac8; -} -.category20c-15-span { - background-color: #bcbddc; -} -.category20c-16-span { - background-color: #dadaeb; -} -.category20c-17-span { - background-color: #636363; -} -.category20c-18-span { - background-color: #969696; -} -.category20c-19-span { - background-color: #bdbdbd; -} -.category20c-20-span { - background-color: #d9d9d9; -} diff --git a/ctor/lib/view/electron/css/reset.css b/ctor/lib/view/electron/css/reset.css deleted file mode 100644 index 753131e..0000000 --- a/ctor/lib/view/electron/css/reset.css +++ /dev/null @@ -1,66 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -/* http://meyerweb.com/eric/tools/css/reset/ - v2.0 | 20110126 - License: none (public domain) -*/ - -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td, -article, aside, canvas, details, embed, -figure, figcaption, footer, header, hgroup, -menu, nav, output, ruby, section, summary, -time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; -} -/* HTML5 display-role reset for older browsers */ -article, aside, details, figcaption, figure, -footer, header, hgroup, menu, nav, section { - display: block; -} -body { - line-height: 1; -} -ol, ul { - list-style: none; -} -blockquote, q { - quotes: none; -} -blockquote:before, blockquote:after, -q:before, q:after { - content: ''; - content: none; -} -table { - border-collapse: collapse; - border-spacing: 0; -} diff --git a/ctor/lib/view/electron/css/styles.css b/ctor/lib/view/electron/css/styles.css deleted file mode 100644 index ed86f1a..0000000 --- a/ctor/lib/view/electron/css/styles.css +++ /dev/null @@ -1,135 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -.canvas { - display: block; - margin: 0 auto; -} - -.graph .hidden { - opacity: 0; -} - -/*.annotation .marker { - cursor: pointer; - opacity: 0.2; - fill: #ff0000; - stroke: none; -} - -.annotation .vline { - stroke: #000; - stroke-opacity: 0.2; -}*/ - -.annotations .title { - display: block; - /*font-size: 2em;*/ - line-height: 2em; - padding: 0 10px; - /*background-color: #474747;*/ - /*color: #ffffff;*/ - font-size: 1.5em; - color: #474747; -} - -.legend { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 60px; -} - -.legend .entry { - cursor: pointer; - margin-bottom: 10px; -} - -.legend .symbol { - display: inline-block; - height: 4px; - width: 10px; - line-height: 0.3em; -} - -.legend .label { - margin-left: 10px; -} - -.legend .hidden { - opacity: 0.25; -} - -.noselect { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -/* http://css-tricks.com/guide-responsive-friendly-css-columns/ */ -.multicolumn-1 { - -webkit-column-count: 1; - -moz-column-count: 1; - -ms-column-count: 1; - column-count: 1; - - -webkit-column-width: 150px; - -moz-column-width: 150px; - -ms-column-width: 150px; - column-width: 150px; -} - -.multicolumn-2 { - -webkit-column-count: 2; - -moz-column-count: 2; - -ms-column-count: 2; - column-count: 2; - - -webkit-column-width: 150px; - -moz-column-width: 150px; - -ms-column-width: 150px; - column-width: 150px; -} - -.multicolumn-3 { - -webkit-column-count: 3; - -moz-column-count: 3; - -ms-column-count: 3; - column-count: 3; - - -webkit-column-width: 150px; - -moz-column-width: 150px; - -ms-column-width: 150px; - column-width: 150px; -} - -.multicolumn-4 { - -webkit-column-count: 4; - -moz-column-count: 4; - -ms-column-count: 4; - column-count: 4; - - -webkit-column-width: 150px; - -moz-column-width: 150px; - -ms-column-width: 150px; - column-width: 150px; -} diff --git a/ctor/lib/view/electron/index.html b/ctor/lib/view/electron/index.html deleted file mode 100644 index 76ba506..0000000 --- a/ctor/lib/view/electron/index.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - -   - - - - - -
{{plot}}
- - - diff --git a/ctor/lib/view/electron/index.js b/ctor/lib/view/electron/index.js deleted file mode 100644 index c5cbd74..0000000 --- a/ctor/lib/view/electron/index.js +++ /dev/null @@ -1,149 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// TODO: refactor. Remove disposable server. Create a server in the electron process and have it serve assets from local directories. Should be similar to SimpleServer. - -// MODULES // - -var spawn = require( 'child_process' ).spawn; -var path = require( 'path' ); -var logger = require( 'debug' ); -var toHTML = require( 'vdom-to-html' ); -var instanceOf = require( '@stdlib/assert/instance-of' ); -var ENV = require( '@stdlib/process/env' ); -var copy = require( '@stdlib/utils/copy' ); -var merge = require( '@stdlib/utils/merge' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var httpServer = require( '@stdlib/net/disposable-http-server' ); -var tryRequire = require( '@stdlib/utils/try-require' ); - - -// VARIABLES // - -var debug = logger( 'plot:view:electron:main' ); -var electron = tryRequire( '@stdlib/electron' ); - - -// MAIN // - -/** -* Opens a plot in an electron window. -* -* @private -* @param {Plot} plot - plot context -* @param {VTree} vtree - virtual tree -* @throws {Error} Electron must be properly installed -*/ -function view( plot, vtree ) { - var index; - var html; - var opts; - var css; - - if ( instanceOf( electron, Error ) ) { - throw new Error( 'invalid operation. Unable to load Electron. Ensure Electron is installed and try again.' ); - } - debug( 'Transforming virtual DOM tree to HTML...' ); - html = toHTML( vtree ); - - // Define `fs` options: - opts = { - 'encoding': 'utf8' - }; - - debug( 'Injecting HTML into HTML template...' ); - index = path.join( __dirname, 'index.html' ); - index = readFileSync( index, opts ); - index = index.replace( /\{\{plot\}\}/, html ); - - debug( 'Injecting CSS into HTML template...' ); - css = path.join( __dirname, 'css', 'reset.css' ); - css = readFileSync( css, opts ); - index = index.replace( /\{\{reset\}\}/, css ); - - css = path.join( __dirname, 'css', 'colors.css' ); - css = readFileSync( css, opts ); - index = index.replace( /\{\{colors\}\}/, css ); - - css = path.join( __dirname, 'css', 'styles.css' ); - css = readFileSync( css, opts ); - index = index.replace( /\{\{styles\}\}/, css ); - - debug( 'Creating a disposable HTTP server...' ); - opts = { - 'html': index, - 'open': false - }; - httpServer( opts, onReady ); - - /** - * Callback invoked once a server is ready to receive requests. - * - * @private - * @param {(Error|null)} error - error object - * @param {Server} server - HTTP server - * @throws {Error} unexpected error - */ - function onReady( error, server ) { - var child; - var addr; - var opts; - var env; - if ( error ) { - throw error; - } - addr = server.address(); - debug( 'HTTP server initialized. Server is listening for requests on %s:%d.', addr.address, addr.port ); - - debug( 'Electron executable: %s.', electron ); - - // TODO: extract fixed env vars to config file and then won't need to pass via environment variables, but can simply require - env = { - 'SERVER_PORT': addr.port, - 'SERVER_ADDRESS': addr.address, - 'PLOT_WIDTH': plot.width, - 'PLOT_HEIGHT': plot.height, - 'PLOT_APP_PATH': __dirname, - 'PLOT_MIN_WIDTH': 100, - 'PLOT_MIN_HEIGHT': 100, - 'PLOT_TITLE': plot.title || 'stdlib' - }; - debug( 'Electron process environment variables: %s.', JSON.stringify( env ) ); - - opts = { - 'cwd': __dirname, - 'detached': true, - 'stdio': 'ignore' - }; - debug( 'Electron process options: %s.', JSON.stringify( opts ) ); - - // Merge the current process' environment variables: - opts.env = merge( {}, copy( ENV ), env ); - - debug( 'Spawning an electron process...' ); - child = spawn( electron, [ './main.js' ], opts ); - child.unref(); - } -} - - -// EXPORTS // - -module.exports = view; diff --git a/ctor/lib/view/electron/js/debug.js b/ctor/lib/view/electron/js/debug.js deleted file mode 100644 index 52dbe15..0000000 --- a/ctor/lib/view/electron/js/debug.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var ENV = require( '@stdlib/process/env' ); - - -// MAIN // - -var debug; - -// Setting the local storage variable must be done BEFORE loading `debug`: -localStorage.debug = ENV.DEBUG; - -// Load `debug`: -debug = require( 'debug/browser' ); // eslint-disable-line stdlib/require-order, stdlib/require-file-extensions - - -// EXPORTS // - -module.exports = debug; diff --git a/ctor/lib/view/electron/js/script.js b/ctor/lib/view/electron/js/script.js deleted file mode 100644 index 7c01458..0000000 --- a/ctor/lib/view/electron/js/script.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var path = require( 'path' ); -var readDir = require( '@stdlib/fs/read-dir' ); -var extname = require( '@stdlib/utils/extname' ); -var ENV = require( '@stdlib/process/env' ); -var logger = require( './debug.js' ); - - -// VARIABLES // - -var DIR = path.join( ENV.PLOT_APP_PATH, 'css' ); -var debug = logger( 'plot:view:electron:script' ); - - -// FUNCTIONS // - -/** -* Inserts stylesheets. -* -* @private -*/ -function stylesheets() { - var files; - var link; - var i; - - debug( 'Stylesheet directory: %s.', DIR ); - files = readDir.sync( DIR ); - for ( i = 0; i < files.length; i++ ) { - if ( extname( files[i] ) !== '.css' ) { - continue; - } - debug( 'Found a CSS file: %s.', files[i] ); - - debug( 'Generating link element...' ); - link = document.createElement( 'link' ); - link.setAttribute( 'rel', 'stylesheet' ); - link.setAttribute( 'href', path.join( DIR, files[i] ) ); - - debug( 'Appending link element to the document head...' ); - document.head.appendChild( link ); - } -} - - -// MAIN // - -/** -* Main script. -* -* @private -*/ -function main() { - debug( 'Injecting stylesheets into the document...' ); - stylesheets(); -} - -debug( 'Running main script...' ); -main(); diff --git a/ctor/lib/view/electron/main.js b/ctor/lib/view/electron/main.js deleted file mode 100644 index 657b144..0000000 --- a/ctor/lib/view/electron/main.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var app = require( 'electron' ).app; -var BrowserWindow = require( 'electron' ).BrowserWindow; -var ENV = require( '@stdlib/process/env' ); - - -// VARIABLES // - -var debug = logger( 'plot:view:electron:main-process' ); -var mainWindow = null; - - -// FUNCTIONS // - -/** -* Creates a browser window. -* -* @private -*/ -function createWindow() { - var opts; - var url; - - opts = { - 'width': parseInt( ENV.PLOT_WIDTH, 10 ) + 80, - 'height': parseInt( ENV.PLOT_HEIGHT, 10 ) + 20, - 'title': ENV.PLOT_TITLE, - - // 'minWidth': parseInt( ENV.PLOT_MIN_WIDTH, 10 ), // TODO: needed? - - // 'minHeight': parseInt( ENV.PLOT_MIN_HEIGHT, 10 ), // TODO: needed? - - // 'titleBarStyle': 'hidden-inset', // hide title bar on OS X - - 'useContentSize': true // specify web page size only considering the content - }; - debug( 'Creating a new browser window configured with the following options: %s.', JSON.stringify( opts ) ); - mainWindow = new BrowserWindow( opts ); - - mainWindow.on( 'close', onClose ); - - url = 'http://'+ENV.SERVER_ADDRESS+':'+ENV.SERVER_PORT+'/index.html'; - debug( 'Loading %s.', url ); - mainWindow.loadURL( url ); -} - -/** -* Callback invoked once a window closes. -* -* @private -*/ -function onClose() { - debug( 'Window closed. Dereferencing window object to allow for GC...' ); - mainWindow = null; -} - -/** -* Quits the application. -* -* @private -*/ -function quit() { - debug( 'Quitting application...' ); - app.quit(); -} - - -// MAIN // - -/** -* Runs the application. -* -* @private -*/ -function main() { - app.on( 'ready', createWindow ); - app.on( 'window-all-closed', quit ); -} - -debug( 'Running application...' ); -main(); diff --git a/ctor/lib/view/index.js b/ctor/lib/view/index.js deleted file mode 100644 index 3bb8988..0000000 --- a/ctor/lib/view/index.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var _view = require( './view.js' ); // eslint-disable-line no-underscore-dangle - - -// VARIABLES // - -var debug = logger( 'plot:view' ); - - -// MAIN // - -/** -* Generates a plot view. -* -* @private -* @param {string} viewer - plot viewer -*/ -function view( viewer ) { - /* eslint-disable no-invalid-this */ - var tmp = this.viewer; - if ( arguments.length ) { - // Temporarily set the viewer: - this.viewer = viewer; - } - debug( 'Viewer: %s.', this.viewer ); - debug( 'Generating view...' ); - _view( this, this.viewer, this.render() ); - if ( arguments.length ) { - // Restore the viewer: - this.viewer = tmp; - } -} - - -// EXPORTS // - -module.exports = view; diff --git a/ctor/lib/view/stdout/index.js b/ctor/lib/view/stdout/index.js deleted file mode 100644 index be39926..0000000 --- a/ctor/lib/view/stdout/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Writes a plot (rendered as a virtual DOM tree) to `stdout`. -* -* @private -* @param {VTree} plot - virtual tree -*/ -function view( plot ) { - console.log( JSON.stringify( plot ) ); -} - - -// EXPORTS // - -module.exports = view; diff --git a/ctor/lib/view/view.browser.js b/ctor/lib/view/view.browser.js deleted file mode 100644 index 91e2b35..0000000 --- a/ctor/lib/view/view.browser.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var format = require( '@stdlib/string/format' ); -var stdout = require( './stdout' ); - - -// MAIN // - -/** -* Generates a plot view. -* -* @private -* @param {Plot} plot - plot context -* @param {string} viewer - plot viewer -* @param {VTree} vtree - virtual tree -* @throws {Error} must specify a supported viewer -* @returns {void} -*/ -function view( plot, viewer, vtree ) { - if ( viewer === 'none' ) { - return; - } - if ( viewer === 'stdout' ) { - return stdout( vtree ); - } - if ( viewer === 'browser' ) { - throw new Error( format( 'invalid argument. Must provide a supported viewer. Value: `%s`.', viewer ) ); - } - if ( viewer === 'terminal' ) { - // TODO: ASCII - return; - } - throw new Error( format( 'invalid argument. Must provide a supported viewer. Value: `%s`.', viewer ) ); -} - - -// EXPORTS // - -module.exports = view; diff --git a/ctor/lib/view/view.js b/ctor/lib/view/view.js deleted file mode 100644 index 362970e..0000000 --- a/ctor/lib/view/view.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var stdout = require( './stdout' ); -var browser = require( './browser' ); -var electron = require( './electron' ); - - -// MAIN // - -/** -* Generates a plot view. -* -* @private -* @param {Plot} plot - plot context -* @param {string} viewer - plot viewer -* @param {VTree} vtree - virtual -* @returns {void} -*/ -function view( plot, viewer, vtree ) { - if ( viewer === 'none' ) { - return; - } - if ( viewer === 'stdout' ) { - return stdout( vtree ); - } - if ( viewer === 'browser' ) { - return browser( vtree ); - } - if ( viewer === 'terminal' ) { - // TODO: ASCII - return; - } - // viewer === 'window' - electron( plot, vtree ); -} - - -// EXPORTS // - -module.exports = view; diff --git a/ctor/package.json b/ctor/package.json deleted file mode 100644 index 64850cb..0000000 --- a/ctor/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "@stdlib/plot/ctor", - "version": "0.0.0", - "description": "2-dimensional plot constructor.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "browser": { - "./lib/view/view.js": "./lib/view/view.browser.js" - }, - "directories": { - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "constructor", - "ctor", - "figure", - "fig", - "graph", - "chart", - "diagram", - "2-dimensional", - "2d", - "data", - "visualize", - "visualization", - "dataviz", - "explore", - "exploratory", - "analysis" - ] -} diff --git a/ctor/srv/scripts/fig_intro_plot.js b/ctor/srv/scripts/fig_intro_plot.js deleted file mode 100644 index 5136cf6..0000000 --- a/ctor/srv/scripts/fig_intro_plot.js +++ /dev/null @@ -1,86 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var randn = require( '@stdlib/random/base/box-muller' ); -var Float64Array = require( '@stdlib/array/float64' ); -var Float32Array = require( '@stdlib/array/float32' ); -var Plot = require( './../../../ctor' ); - - -// MAIN // - -/** -* Generates a plot. -* -* @private -*/ -function main() { - var html; - var plot; - var opts; - var x1; - var x2; - var y1; - var y2; - var i; - - // Create some data... - x1 = new Float64Array( 1000 ); - x2 = new Float64Array( x1.length ); - y1 = new Float64Array( x1.length ); - y2 = new Float32Array( x1.length ); - for ( i = 0; i < x1.length; i++ ) { - x1[ i ] = 30.0 + (7.5*randn()); - x2[ i ] = 40.0 + (12.5*randn()); - y1[ i ] = 50.0 + (10.0*randn()); - y2[ i ] = 30.0 + (5.0*randn()); - } - - // Define the plot options: - opts = { - 'width': 600, - 'height': 480, - 'xMin': 0.0, - 'xMax': 100.0, - 'yMin': 0.0, - 'yMax': 100.0, - 'lineStyle': 'none', - 'symbols': 'closed-circle', - 'symbolsSize': 6, - 'symbolsOpacity': 0.2, - 'xRug': true, - 'yRug': true, - 'xRugOrient': 'top', - 'yRugOrient': 'right' - }; - - // Create a new plot: - plot = new Plot( [ x1, x2 ], [ y1, y2 ], opts ); - - // Render as HTML/SVG: - html = plot.render( 'html' ); - - // Write to `stdout`: - console.log( html ); -} - -main(); diff --git a/ctor/test/test.js b/ctor/test/test.js deleted file mode 100644 index 2502f0e..0000000 --- a/ctor/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var plot = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof plot, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to main export is a factory method for creating reusable plot generation functions', function test( t ) { - t.equal( typeof plot.factory, 'function', 'export has factory method' ); - t.end(); -}); diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 3308943..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,452 +0,0 @@ - -{{alias}}( [x, y,] [options] ) - Returns a plot instance for creating 2-dimensional plots. - - `x` and `y` arguments take precedence over `x` and `y` options. - - Parameters - ---------- - x: Array|Array (optional) - An array of arrays containing x-coordinate values. - - y: Array|Array (optional) - An array of arrays containing y-coordinate values. - - options: Object (optional) - Options. - - options.autoRender: boolean (optional) - Boolean indicating whether to re-render on a 'change' event. Default: - false. - - options.autoView: boolean (optional) - Boolean indicating whether to generate an updated view on a 'render' - event. Default: false. - - options.colors: string|Array (optional) - Data color(s). Default: 'category10'. - - options.description: string (optional) - Plot description. - - options.engine: string (optional) - Plot engine. Default: 'svg'. - - options.height: number (optional) - Plot height (in pixels). Default: 400. - - options.labels: Array|Array (optional) - Data labels. - - options.isDefined: Function (optional) - An accessor function indicating whether a datum is defined. - - options.lineStyle: string|Array (optional) - Data line style(s). Must be one of: '-', '--', ':', '-.', or 'none'. - Default: '-'. - - options.lineOpacity: number|Array (optional) - Data line opacity. Must be on the interval [0,1]. Default: 0.9. - - options.lineWidth: integer|Array (optional) - Data line width (in pixels). Default: 2. - - options.paddingBottom: integer (optional) - Bottom padding (in pixels). Default: 80. - - options.paddingLeft: integer (optional) - Left padding (in pixels). Default: 90. - - options.paddingRight: integer (optional) - Right padding (in pixels). Default: 20. - - options.paddingTop: integer (optional) - Top padding (in pixels). Default: 80. - - options.renderFormat: string (optional) - Plot render format. Must be one of 'vdom' or 'html'. Default: 'vdom'. - - options.symbols: string|Array (optional) - Data symbols. Must be one of 'closed-circle', 'open-circle', or 'none'. - Default: 'none'. - - options.symbolsOpacity: number|Array (optional) - Symbols opacity. Must be on the interval [0,1]. Default: 0.9. - - options.symbolsSize: integer|Array (optional) - Symbols size (in pixels). Default: 6. - - options.title: string (optional) - Plot title. - - options.viewer: string (optional) - Plot viewer. Must be one of 'browser', 'terminal', 'stdout', 'window', - or 'none'. Default: 'none'. - - options.width: number (optional) - Plot width (in pixels). Default: 400. - - options.x: Array|Array (optional) - x-coordinate values. - - options.xAxisOrient: string (optional) - x-axis orientation. Must be either 'bottom' or 'top'. Default: 'bottom'. - - options.xLabel: string (optional) - x-axis label. Default: 'x'. - - options.xMax: number|null (optional) - Maximum value of the x-axis domain. If `null`, the maximum value is - calculated from the data. Default: null. - - options.xMin: number|null (optional) - Minimum value of the x-axis domain. If `null`, the minimum value is - calculated from the data. Default: null. - - options.xNumTicks: integer (optional) - Number of x-axis tick marks. Default: 5. - - options.xRug: boolean|Array (optional) - Boolean flag(s) indicating whether to render one or more rug plots along - the x-axis. - - options.xRugOrient: string|Array (optional) - x-axis rug plot orientation(s). Must be either 'bottom' or 'top'. - Default: 'bottom'. - - options.xRugOpacity: number|Array (optional) - x-axis rug plot opacity. Must be on the interval [0,1]. Default: 0.1. - - options.xRugSize: integer|Array (optional) - x-axis rug tick (tassel) size (in pixels). Default: 6. - - options.xScale: string - x-axis scale. Default: 'linear'. - - options.xTickFormat: string|null - x-axis tick format. Default: null. - - options.y: Array|Array (optional) - y-coordinate values. - - options.yAxisOrient: string (optional) - x-axis orientation. Must be either 'left' or 'right'. Default: 'left'. - - options.yLabel: string (optional) - y-axis label. Default: 'y'. - - options.yMax: number|null (optional) - Maximum value of the y-axis domain. If `null`, the maximum value is - calculated from the data. Default: null. - - options.yMin: number|null (optional) - Minimum value of the y-axis domain. If `null`, the minimum value is - calculated from the data. Default: null. - - options.yNumTicks: integer (optional) - Number of x-axis tick marks. Default: 5. - - options.yRug: boolean|Array (optional) - Boolean flag(s) indicating whether to render one or more rug plots along - the y-axis. - - options.yRugOrient: string|Array (optional) - y-axis rug plot orientation(s). Must be either 'left' or 'right'. - Default: 'left'. - - options.yRugOpacity: number|Array (optional) - y-axis rug plot opacity. Must be on the interval [0,1]. Default: 0.1. - - options.yRugSize: integer|Array (optional) - y-axis rug tick (tassel) size (in pixels). Default: 6. - - options.yScale: string - y-axis scale. Default: 'linear'. - - options.yTickFormat: string|null - y-axis tick format. Default: null. - - Returns - ------- - plot: Plot - Plot instance. - - plot.render() - Renders a plot as a virtual DOM tree. - - plot.view( [viewer] ) - Generates a plot view. - - plot.x - x-coordinate values. An assigned value must be an array where each - element corresponds to a plotted dataset. - - plot.y - y-coordinate values. An assigned value must be an array, where each - element corresponds to a plotted dataset. - - plot.labels - Data labels. During plot creation, each plotted dataset is assigned a - label. If the number of labels is less than the number of plotted - datasets, labels are reused using modulo arithmetic. - - plot.isDefined( d, i ) - An accessor function which defines whether a datum is defined. This - accessor is used to define how missing values are encoded. The default - behavior is to ignore values which are `NaN`. - - plot.colors - Data colors. To set the color all plotted datasets, provide a color - name. To specify the colors for each dataset, provide an array of - colors. During plot creation, each plotted dataset is assigned one of - the provided colors. If the number of colors is less than the number of - plotted datasets, colors are reused using modulo arithmetic. Lastly, - colors may also be specified by providing the name of a predefined color - scheme. The following schemes are supported: 'category10', 'category20', - 'category20b', and 'category20c'. - - plot.lineStyle - Data line style(s). The following line styles are supported: '-' (solid - line), '--' (dashed line), ':' (dotted line), '-.' (alternating dashes - and dots), and 'none' (no line). To specify the line style for each - dataset, provide an array of line styles. During plot creation, each - plotted dataset is assigned a line style. If the number of line styles - is less than the number of plotted datasets, line styles are reused - using modulo arithmetic. - - plot.lineOpacity - Data line opacity, where an opacity of `0.0` make a line completely - transparent and an opacity of `1.0` makes a line completely opaque. To - specify the line opacity for each dataset, provide an array of - opacities. During plot creation, each plotted dataset is assigned an - opacity. If the number of opacities is less than the number of plotted - datasets, opacities are reused using modulo arithmetic. - - plot.lineWidth - Data line width(s). To specify the line width for each dataset, provide - an array of widths. During plot creation, each plotted dataset is - assigned a line width. If the number of line widths is less than the - number of plotted datasets, line widths are reused using modulo - arithmetic. - - plot.symbols - Data symbols. The following symbols are supported: 'closed-circle' - (closed circles), 'open-circle' (open circles), and 'none' (no symbols). - To specify the symbols used for each dataset, provide an array of - symbols. During plot creation, each plotted dataset is assigned a - symbol. If the number of symbols is less than the number of plotted - datasets, symbols are reused using modulo arithmetic. - - plot.symbolSize - Symbols size. To specify the symbols size for each dataset, provide an - array of sizes. During plot creation, each plotted dataset is assigned - a symbols size. If the number of sizes is less than the number of - plotted datasets, sizes are reused using modulo arithmetic. - - plot.symbolsOpacity - Symbols opacity, where an opacity of `0.0` makes a symbol completely - transparent and an opacity of `1.0` makes a symbol completely opaque. To - specify the opacity for each dataset, provide an array of opacities. - During plot creation, each plotted dataset is assigned an opacity. If - the number of opacities is less than the number of plotted datasets, - opacities are reused using modulo arithmetic. - - plot.width - Plot width (in pixels). - - plot.height - Plot height (in pixels). - - plot.paddingLeft - Plot left padding (in pixels). Left padding is typically used to create - space for a left-oriented y-axis. - - plot.paddingRight - Plot right padding (in pixels). Right padding is typically used to - create space for a right-oriented y-axis. - - plot.paddingTop - Plot top padding (in pixels). Top padding is typically used to create - space for a title or top-oriented x-axis. - - plot.paddingBottom - Plot bottom padding (in pixels). Bottom padding is typically used to - create space for a bottom-oriented x-axis. - - plot.xMin - Minimum value of the x-axis domain. When retrieved, if the value has - been set to `null`, the returned value is computed from the `x` data. - - plot.xMax - Maximum value of the x-axis domain. When retrieved, if the value has - been set to `null`, the returned value is computed from the `x` data. - - plot.yMin - Minimum value of the y-axis domain. When retrieved, if the value has - been set to `null`, the returned value is computed from the `y` data. - - plot.yMax - Maximum value of the y-axis domain. When retrieved, if the value has - been set to `null`, the returned value is computed from the `y` data. - - plot.xScale - Scale function for mapping values to a coordinate along the x-axis. The - following `scales` are supported: 'linear' (linear scale) and 'time' - (time scale). When retrieved, the returned value is a scale function. - - plot.yScale - Scale function for mapping values to a coordinate along the y-axis. The - following `scales` are supported: 'linear' (linear scale) and 'time' - (time scale). When retrieved, the returned value is a scale function. - - plot.xTickFormat - x-axis tick format (e.g., '%H:%M'). When retrieved, if the value has not - been set to `null`, the returned value is a formatting function. - - plot.yTickFormat - y-axis tick format (e.g., '%%'). When retrieved, if the value has not - been set to `null`, the returned value is a formatting function. - - plot.xNumTicks - Number of x-axis tick marks. If the value is set to `null`, the number - of tick marks is computed internally. - - plot.yNumTicks - Number of y-axis tick marks. If the value is set to `null`, the number - of tick marks is computed internally. - - plot.xAxisOrient - x-axis orientation. The following orientations are supported: 'bottom' - and 'top'. - - plot.yAxisOrient - y-axis orientation. The following orientations are supported: 'left' and - 'right'. - - plot.xRug - Boolean flag(s) indicating whether to display a rug plot along the x- - axis. To specify the flag for each dataset, provide an array of - booleans. During plot creation, each plotted dataset is assigned a flag. - If the number of flags is less than the number of plotted datasets, - flags are reused using modulo arithmetic. - - plot.yRug - Boolean flag(s) indicating whether to display a rug plot along the y- - axis. To specify the flag for each dataset, provide an array of - booleans. During plot creation, each plotted dataset is assigned a flag. - If the number of flags is less than the number of plotted datasets, - flags are reused using modulo arithmetic. - - plot.xRugOrient - x-axis rug orientation. The following orientations are supported: - 'bottom' or 'top'. To specify the x-axis rug orientation for each - dataset, provide an array of orientations. During plot creation, each - plotted dataset is assigned an orientation. If the number of - orientations is less than the number of plotted datasets, orientations - are reused using modulo arithmetic. - - plot.yRugOrient - y-axis rug orientation. The following orientations are supported: 'left' - or 'right'. To specify the y-axis rug orientation for each dataset, - provide an array of orientations. During plot creation, each plotted - dataset is assigned an orientation. If the number of orientations is - less than the number of plotted datasets, orientations are reused using - modulo arithmetic. - - plot.xRugOpacity - x-axis rug opacity, where an opacity of `0.0` makes a rug completely - transparent and an opacity of `1.0` makes a rug completely opaque. To - specify the x-axis rug opacity for each dataset, provide an array of - opacities. During plot creation, each plotted dataset is assigned an - opacity. If the number of opacities is less than the number of plotted - datasets, opacities are reused using modulo arithmetic. - - plot.yRugOpacity - y-axis rug opacity, where an opacity of `0.0` makes a rug completely - transparent and an opacity of `1.0` makes a rug completely opaque. To - specify the y-axis rug opacity for each dataset, provide an array of - opacities. During plot creation, each plotted dataset is assigned an - opacity. If the number of opacities is less than the number of plotted - datasets, opacities are reused using modulo arithmetic. - - plot.xRugSize - x-axis rug tick (tassel) size. To specify the x-axis rug size for each - dataset, provide an array of sizes. During plot creation, each plotted - dataset is assigned a tick size. If the number of sizes is less than the - number of plotted datasets, sizes are reused using modulo arithmetic. - - plot.yRugSize - y-axis rug tick (tassel) size. To specify the y-axis rug size for each - dataset, provide an array of sizes. During plot creation, each plotted - dataset is assigned a tick size. If the number of sizes is less than the - number of plotted datasets, sizes are reused using modulo arithmetic. - - plot.description - Plot description. - - plot.title - Plot title. - - plot.xLabel - x-axis label. - - plot.yLabel - y-axis label. - - plot.engine - Plot rendering engine. The following engines are supported: 'svg'. - - plot.renderFormat - Plot render format. The following formats are supported: 'vdom' and - 'html'. - - plot.autoRender - Rendering mode. If `true`, an instance renders on each 'change' event; - otherwise, rendering must be triggered manually. - - plot.viewer - Plot viewer. The following viewers are supported: 'none', 'stdout', - 'window', and 'browser'. - - plot.autoView - Viewer mode. If `true`, an instance generates an updated view on each - 'render' event; otherwise, generating a view must be triggered manually. - - plot.graphWidth - Computed property corresponding to the expected graph width. - - plot.graphHeight - Computed property corresponding to the expected graph height. - - plot.xDomain - Computed property corresponding to the x-axis domain. - - plot.yDomain - Computed property corresponding to the y-axis domain. - - plot.xRange - Computed property corresponding to the x-axis range. - - plot.yRange - Computed property correspond to the y-axis range. - - plot.xPos - A function which maps values to x-axis coordinate values. - - plot.yPos - A function which maps values to y-axis coordinate values. - - Examples - -------- - > var plot = {{alias}}() - - - // Provide plot data at instantiation: - > var x = [[0.10, 0.20, 0.30]]; - > var y = [[0.52, 0.79, 0.64]]; - > plot = {{alias}}( x, y ) - - - See Also - -------- - diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 0ca7ba5..0000000 --- a/examples/index.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var randn = require( '@stdlib/random/base/box-muller' ); -var Float64Array = require( '@stdlib/array/float64' ); -var now = require( '@stdlib/time/now' ); -var plot = require( './../lib' ); - -var t; -var x; -var y; -var i; - -// Create some data... -t = now() * 1000; -x = new Float64Array( 100 ); -y = new Float64Array( x.length ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = t + (i*360000); - y[ i ] = 50.0 + (10.0*randn()); -} - -// Create a new plot: -var plt = plot( [x], [y], { - 'width': 600, - 'height': 480, - 'xScale': 'time', - 'xTickFormat': '%H:%M', - 'renderFormat': 'html' -}); - -// Render as a virtual DOM tree: -var vtree = plt.render( 'vdom' ); -console.log( JSON.stringify( vtree ) ); - -// Render as HTML: -var html = plt.render(); -console.log( html ); - -// Listen for 'render' events (e.g., when triggered due to changes in state): -plt.on( 'render', onRender ); - -setTimeout( update, 1000 ); - -function update() { - plt.width = 720; -} - -function onRender( html ) { - console.log( html ); -} diff --git a/hist/lib/accessors/is_defined.js b/hist/lib/accessors/is_defined.js deleted file mode 100644 index d7a1a28..0000000 --- a/hist/lib/accessors/is_defined.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isnan = require( '@stdlib/assert/is-nan' ).isPrimitive; - - -// VARIABLES // - -var debug = logger( 'hist:accessor:is-defined' ); - - -// MAIN // - -/** -* Accessor function which determines whether a datum is defined. -* -* @private -* @param {number} d - datum -* @param {integer} i - index -* @returns {boolean} boolean indicating whether a datum is defined -*/ -function isDefined( d ) { - var bool = !isnan( d ); - debug( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool ); - return bool; -} - - -// EXPORTS // - -module.exports = isDefined; diff --git a/hist/lib/defaults.js b/hist/lib/defaults.js deleted file mode 100644 index 0b56c06..0000000 --- a/hist/lib/defaults.js +++ /dev/null @@ -1,179 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isNodeREPL = require( '@stdlib/assert/is-node-repl' ); -var isDefined = require( './accessors/is_defined.js' ); - - -// MAIN // - -/** -* Returns default options. -* -* @private -* @returns {Object} default options -*/ -function defaults() { - var isREPL; - var o; - - isREPL = isNodeREPL(); - o = {}; - - // Boolean indicating whether to re-render on a change event: - o.autoRender = false; - - // Boolean indicating whether to generate an updated view on a render event: - o.autoView = false; - - // Bar face colors: - o.barColors = 'category10'; - - // Bar face opacity: - o.barOpacity = 0.9; // [0,1] - - // Binning algorithm: - o.binMethod = null; - - // Bins and/or number of bins: - o.bins = []; - - // Bin width: - o.binWidth = null; - - // Histogram description: - o.description = ''; - - // Maximum bin edge: - o.edgeMax = null; - - // Minimum bin edge: - o.edgeMin = null; - - // Bin edges: - o.edges = []; - - // Rendering engine: - o.engine = 'svg'; - - // Histogram height: - o.height = 400; // px - - // Accessor indicating whether a datum is defined: - o.isDefined = isDefined; - - // Data labels: - o.labels = []; - - // Line color: - o.lineColors = '#000000'; - - // Line opacity: - o.lineOpacity = 0.9; // [0,1] - - // Line style: - o.lineStyle = '-'; - - // Data line width(s): - o.lineWidth = 2; // px - - // Histogram normalization: - o.normalization = 'count'; - - // Histogram orientation: - o.orientation = 'vertical'; - - // FIXME: padding props depend on orientation (may require using `null` to flag) - - // Bottom padding: - o.paddingBottom = 80; // px - - // Left padding: - o.paddingLeft = 90; // px - - // Right padding: - o.paddingRight = 20; // px - - // Top padding: - o.paddingTop = 80; // px - - // Render format: - o.renderFormat = 'vdom'; - - // Histgram title: - o.title = ''; - - // Histogram viewer: - if ( isREPL ) { - o.viewer = 'window'; - } else { - o.viewer = 'none'; - } - // Histogram width: - o.width = 400; // px - - // Values to bin: - o.x = []; - - // x-axis orientation: - o.xAxisOrient = 'bottom'; - - // x-axis label: - o.xLabel = 'x'; - - // Maximum value of x-axis domain: - o.xMax = null; - - // Minimum value of x-axis domain: - o.xMin = null; - - // Number of x-axis tick marks: - o.xNumTicks = 5; - - // x-axis tick format: - o.xTickFormat = null; - - // y-axis orientation: - o.yAxisOrient = 'left'; - - // y-axis label: - o.yLabel = 'y'; - - // Maximum value of y-axis domain: - o.yMax = null; - - // Minimum value of y-axis domain: - o.yMin = null; - - // Number of y-axis tick marks: - o.yNumTicks = 5; - - // y-axis tick format: - o.yTickFormat = null; - - return o; -} - - -// EXPORTS // - -module.exports = defaults; diff --git a/hist/lib/index.js b/hist/lib/index.js deleted file mode 100644 index 3ea58a7..0000000 --- a/hist/lib/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Create a 1-dimensional histogram. -* -* @module @stdlib/plot/hist -* -* @example -* var Histogram = require( '@stdlib/plot/hist' ); -* -* var hist = new Histogram(); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/hist/lib/main.js b/hist/lib/main.js deleted file mode 100644 index 15e86f5..0000000 --- a/hist/lib/main.js +++ /dev/null @@ -1,289 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var inherit = require( '@stdlib/utils/inherit' ); -var format = require( '@stdlib/string/format' ); -var copy = require( '@stdlib/utils/copy' ); -var mergeFcn = require( '@stdlib/utils/merge' ).factory; -var defineProperty = require( '@stdlib/utils/define-property' ); -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var Plot = require( './../../base/ctor' ); -var defaults = require( './defaults.js' ); -var setIsDefined = require( './props/is-defined/set.js' ); -var getIsDefined = require( './props/is-defined/get.js' ); -var setYLabel = require( './props/y-label/set.js' ); -var getYLabel = require( './props/y-label/get.js' ); -var render = require( './render' ); - - -// VARIABLES // - -var debug = logger( 'hist:main' ); -var PRIVATE_PROPS = [ - '_barColors', - '_barOpacity', - '_binCounts', - '_binMethod', - '_binWidth', - '_edgeMax', - '_edgeMin', - '_edges', - '_lineColors', - '_nbins', - '_normalization', - '_orientation', - '_xData', - '_xMax', - '_xMin', - '_xScale', - '_yData', - '_yLabel', - '_yMax', - '_yMin', - '_yScale' -]; - - -// FUNCTIONS // - -var merge = mergeFcn({ - 'extend': false -}); - - -// MAIN // - -/** -* Histogram constructor. -* -* @constructor -* @param {Array} [x] - values to bin -* @param {Array} [bins] - edges and/or number of bins -* @param {Options} [options] - constructor options -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event -* @param {boolean} [options.autoView=false] - indicates whether to generate an updated view on a render event -* @param {(string|StringArray)} [options.barColors='category10'] - bar face color(s) -* @param {(number|NumberArray)} [options.barOpacity=0.9] - bar face opacity -* @param {(null|string|Array)} [options.binMethod=null] - binning algorithm -* @param {Array} [options.bins=[]] - edges and/or number of bins -* @param {(null|number|NumberArray)} [options.binWidth=null] - bin width -* @param {string} [options.description=''] - description -* @param {(null|number|Array)} [options.edgeMax=null] - maximum bin edge value -* @param {(null|number|Array)} [options.edgeMin=null] - minimum bin edge value -* @param {Array} [options.edges] - bin edges -* @param {string} [options.engine='svg'] - render engine -* @param {PositiveNumber} [options.height=400] - plot height -* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined -* @param {(StringArray|EmptyArray)} [options.labels] - data labels -* @param {(string|StringArray)} [options.lineColors='#000'] - line color(s) -* @param {(number|NumberArray)} [options.lineOpacity=0.9] - line opacity -* @param {(string|StringArray)} [options.lineStyle='-'] - line style(s) -* @param {(NonNegativeInteger|Array)} [options.lineWidth=2] - line width(s) -* @param {(null|number|Array)} [options.nbins] - number of bins -* @param {(string|StringArray)} [options.normalization='count'] - histogram normalization -* @param {string} [options.orientation='vertical'] - histogram orientation -* @param {NonNegativeInteger} [options.paddingBottom=80] - bottom padding -* @param {NonNegativeInteger} [options.paddingLeft=90] - left padding -* @param {NonNegativeInteger} [options.paddingRight=20] - right padding -* @param {NonNegativeInteger} [options.paddingTop=80] - top padding -* @param {string} [options.renderFormat='vdom'] - render format -* @param {string} [options.title=''] - title -* @param {string} [options.viewer='none'] - viewer -* @param {PositiveNumber} [options.width=400] - plot width -* @param {Array} [options.x=[]] - values to bin -* @param {string} [options.xAxisOrient='bottom'] - x-axis orientation -* @param {string} [options.xLabel='x'] - x-axis label -* @param {(Date|FiniteNumber|null)} [options.xMax=null] - maximum value of x-axis domain -* @param {(Date|FiniteNumber|null)} [options.xMin=null] - minimum value of x-axis domain -* @param {(NonNegativeInteger|null)} [options.xNumTicks=5] - number of x-axis tick marks -* @param {(string|null)} [options.xTickFormat=null] - x-axis tick format -* @param {string} [options.yAxisOrient='left'] - y-axis orientation -* @param {(null|string)} [options.yLabel=null] - y-axis label -* @param {(FiniteNumber|null)} [options.yMax=null] - maximum value of y-axis domain -* @param {(FiniteNumber|null)} [options.yMin=null] - minimum value of y-axis domain -* @param {(NonNegativeInteger|null)} [options.yNumTicks=5] - number of y-axis tick marks -* @param {(string|null)} [options.yTickFormat=null] - y-axis tick format -* @throws {TypeError} must provide valid options -* @returns {Histogram} Histogram instance -* -* @example -* var hist = new Histogram(); -*/ -function Histogram() { - var options; - var nargs; - var keys; - var opts; - var key; - var i; - - nargs = arguments.length; - if ( !(this instanceof Histogram) ) { - if ( nargs === 0 ) { - return new Histogram(); - } - if ( nargs === 1 ) { - return new Histogram( arguments[0] ); - } - if ( nargs === 2 ) { - return new Histogram( arguments[0], arguments[1] ); - } - return new Histogram( arguments[0], arguments[1], arguments[2] ); - } - opts = defaults(); - if ( nargs === 0 ) { - options = {}; - } else if ( nargs === 1 ) { - options = arguments[ 0 ]; - if ( !isObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - } else if ( nargs === 2 ) { - options = {}; - options.x = arguments[ 0 ]; - options.bins = arguments[ 1 ]; - } else if ( nargs > 2 ) { - if ( !isObject( arguments[ 2 ] ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', arguments[2] ) ); - } - options = copy( arguments[ 2 ] ); // avoid mutation - options.x = arguments[ 0 ]; - options.bins = arguments[ 1 ]; - } - opts = merge( opts, options ); - - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - Plot.call( this, opts ); - - for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { - defineProperty( this, PRIVATE_PROPS[i], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - }); - } - - // Set options... - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - this[ key ] = opts[ key ]; - } - - return this; -} - -/* -* Inherit from the `Plot` prototype. -*/ -inherit( Histogram, Plot ); - -/** -* Accessor which defines whether a datum is defined. -* -* ## Notes -* -* - This accessor is used to define how missing values are encoded. -* - The default behavior is to ignore values which are `NaN`. -* -* @name isDefined -* @memberof Histogram.prototype -* @type {Function} -* @param {*} d - datum -* @param {integer} i - index -* @throws {TypeError} must be a function -* -* @example -* function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* -* var hist = new Histogram(); -* hist.isDefined = isDefined; -* -* @example -* function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* -* var hist = new Histogram({ -* 'isDefined': isDefined -* }); -* var fcn = hist.isDefined; -* // returns -*/ -defineProperty( Histogram.prototype, 'isDefined', { - 'configurable': false, - 'enumerable': true, - 'set': setIsDefined, - 'get': getIsDefined -}); - -/** -* y-axis label. -* -* @name yLabel -* @memberof Histogram.prototype -* @type {(string|null)} -* @throws {TypeError} must be a string or null -* @default null -* -* @example -* var hist = new Histogram(); -* hist.yLabel = 'value'; -* -* @example -* var hist = new Histogram({ -* 'yLabel': 'value' -* }); -* var yLabel = hist.yLabel; -* // returns 'value' -*/ -defineProperty( Histogram.prototype, 'yLabel', { - 'configurable': false, - 'enumerable': true, - 'set': setYLabel, - 'get': getYLabel -}); - -/** -* Renders a histogram. -* -* @private -* @name _render -* @memberof Histogram.prototype -* @type {Function} -* @param {string} format - render format -* @returns {(VTree|string)} rendered histogram -*/ -setReadOnly( Histogram.prototype, '_render', render ); - - -// EXPORTS // - -module.exports = Histogram; diff --git a/hist/lib/props/is-defined/get.js b/hist/lib/props/is-defined/get.js deleted file mode 100644 index fd05f22..0000000 --- a/hist/lib/props/is-defined/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the accessor for defined values. -* -* @private -* @returns {Function} accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._isDefined; -} - - -// EXPORTS // - -module.exports = get; diff --git a/hist/lib/props/is-defined/set.js b/hist/lib/props/is-defined/set.js deleted file mode 100644 index 9ee18fa..0000000 --- a/hist/lib/props/is-defined/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'hist:set:is-defined' ); - - -// MAIN // - -/** -* Sets the accessor for defined values. -* -* @private -* @param {Function} fcn - accessor -* @throws {TypeError} must be a function -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'isDefined', fcn ) ); - } - if ( fcn !== this._isDefined ) { - debug( 'Current value: %s.', this._isDefined ); - - this._isDefined = fcn; - debug( 'New Value: %s.', this._isDefined ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/hist/lib/props/y-label/get.js b/hist/lib/props/y-label/get.js deleted file mode 100644 index 4b36a06..0000000 --- a/hist/lib/props/y-label/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-axis label. -* -* @private -* @returns {string} label -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._yLabel; -} - - -// EXPORTS // - -module.exports = get; diff --git a/hist/lib/props/y-label/set.js b/hist/lib/props/y-label/set.js deleted file mode 100644 index 6d66001..0000000 --- a/hist/lib/props/y-label/set.js +++ /dev/null @@ -1,73 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isNull = require( '@stdlib/assert/is-null' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'hist:set:y-label' ); -var LABELS = { - 'count': 'counts', - 'probability': 'probability', - 'countdensity': 'density', - 'pdf': 'pdf', - 'cumcount': 'counts', - 'cdf': 'cdf' -}; - - -// MAIN // - -/** -* Sets the y-axis label. -* -* @private -* @param {(string|null)} label - axis label -* @throws {TypeError} must be a string or null -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - var FLG = isNull( label ); - if ( !isString( label ) && !FLG ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string or null. Value: `%s`.', 'yLabel', label ) ); - } - if ( FLG ) { - label = LABELS[ this._normalization ]; - } - if ( label !== this._yLabel ) { - debug( 'Current value: %s.', this._yLabel ); - - this._yLabel = label; - debug( 'New value: %s.', this._yLabel ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/hist/lib/render/index.js b/hist/lib/render/index.js deleted file mode 100644 index e15299a..0000000 --- a/hist/lib/render/index.js +++ /dev/null @@ -1,64 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var vdom2html = require( 'vdom-to-html' ); -var renderSVG = require( './svg' ); - - -// VARIABLES // - -var debug = logger( 'hist:render' ); - - -// MAIN // - -/** -* Renders a histogram. -* -* @private -* @param {string} format - render format -* @returns {(VTree|string)} virtual tree or a string -*/ -function render( format ) { - /* eslint-disable no-invalid-this */ - var out; - - debug( 'Render format: %s.', format ); - - debug( 'Rendering...' ); - if ( this._engine === 'svg' ) { - out = renderSVG( this ); - - // Default render format is virtual DOM... - if ( format === 'html' ) { - out = vdom2html( out ); - } - this.emit( 'render', out ); - } - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/hist/lib/render/svg/index.js b/hist/lib/render/svg/index.js deleted file mode 100644 index 0895b03..0000000 --- a/hist/lib/render/svg/index.js +++ /dev/null @@ -1,158 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var xAxisTransform = require( './utils/x_axis_transform.js' ); -var yAxisTransform = require( './utils/y_axis_transform.js' ); -var renderMarks = require( './marks' ); -var init = require( './init.js' ); -var sync = require( './sync.js' ); - - -// VARIABLES // - -var debug = logger( 'hist:render:svg:main' ); - - -// MAIN // - -/** -* Renders a virtual DOM tree. -* -* @private -* @param {Object} state - state -* @returns {VTree} virtual tree -*/ -function render( state ) { - var annotations; - var clipPath; - var canvas; - var title; - var graph; - var marks; - var xAxis; - var yAxis; - var bkgd; - var defs; - var svg; - - svg = state.$.svg; - - // Lazily initialize... - if ( !svg.canvas ) { - debug( 'Initializing components...' ); - init( state ); - } - debug( 'Syncing component states...' ); - sync( state ); - - debug( 'Rendering individual components...' ); - - debug( 'Rendering annotations...' ); - annotations = svg.annotations.render(); - - debug( 'Rendering clip-path...' ); - clipPath = svg.clipPath.render(); - - debug( 'Rendering canvas...' ); - canvas = svg.canvas.render(); - - debug( 'Rendering graph...' ); - graph = svg.graph.render(); - - debug( 'Rendering title...' ); - title = svg.title.render(); - - debug( 'Rendering x-axis...' ); - xAxis = svg.xAxis.render(); - - debug( 'Rendering y-axis...' ); - yAxis = svg.yAxis.render(); - - debug( 'Rendering background...' ); - bkgd = svg.bkgd.render(); - - debug( 'Rendering definitions...' ); - defs = svg.defs.render(); - - debug( 'Rendering marks...' ); - marks = renderMarks( state ); - - debug( 'Updating rendered components...' ); - - debug( 'Updating title...' ); - title.properties.attributes.x = state.paddingLeft + ( state.graphWidth/2 ); - title.properties.attributes.y = state.paddingTop / 2; - - debug( 'Updating x-axis...' ); - xAxis.properties.className += ' x'; - xAxis.properties.attributes.transform = xAxisTransform( state.xAxisOrient, state.graphHeight ); // eslint-disable-line max-len - - debug( 'Updating y-axis...' ); - yAxis.properties.className += ' y'; - yAxis.properties.attributes.transform = yAxisTransform( state.yAxisOrient, state.graphWidth ); // eslint-disable-line max-len - - debug( 'Assembling virtual tree...' ); - - debug( 'Inserting clip-path into definitions...' ); - defs.children.push( clipPath ); - defs.count += clipPath.count; - - debug( 'Inserting background into graph...' ); - graph.children.push( bkgd ); - graph.count += bkgd.count; - - debug( 'Inserting marks into graph...' ); - graph.children.push( marks ); - graph.count += marks.count; - - debug( 'Inserting x-axis into graph...' ); - graph.children.push( xAxis ); - graph.count += xAxis.count; - - debug( 'Inserting y-axis into graph...' ); - graph.children.push( yAxis ); - graph.count += yAxis.count; - - debug( 'Inserting title into annotations...' ); - annotations.children.push( title ); - annotations.count += title.count; - - debug( 'Inserting definitions into canvas...' ); - canvas.children.push( defs ); - canvas.count += defs.count; - - debug( 'Inserting graph into canvas...' ); - canvas.children.push( graph ); - canvas.count += graph.count; - - debug( 'Inserting annotations into canvas...' ); - canvas.children.push( annotations ); - canvas.count += annotations.count; - - return canvas; -} - - -// EXPORTS // - -module.exports = render; diff --git a/hist/lib/render/svg/init.js b/hist/lib/render/svg/init.js deleted file mode 100644 index 1ef6f13..0000000 --- a/hist/lib/render/svg/init.js +++ /dev/null @@ -1,176 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var Annotations = require( './../../../../components/svg/annotations' ); -var ClipPath = require( './../../../../components/svg/clip-path' ); -var Canvas = require( './../../../../components/svg/canvas' ); -var Graph = require( './../../../../components/svg/graph' ); -var Title = require( './../../../../components/svg/title' ); -var Marks = require( './../../../../components/svg/marks' ); -var Bkgd = require( './../../../../components/svg/background' ); -var Defs = require( './../../../../components/svg/defs' ); -var Axis = require( './../../../../components/svg/axis' ); - -// var Columns = require( './../../../../components/svg/columns' ); - - -// VARIABLES // - -var debug = logger( 'hist:render:svg:init' ); - - -// MAIN // - -/** -* Initializes SVG components. -* -* @private -* @param {Object} state - state -*/ -function init( state ) { - var svg = state.$.svg; - - debug( 'Initializing components...' ); - - debug( 'Initializing canvas component...' ); - defineProperty( svg, 'canvas', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Canvas({ - 'autoRender': false - }) - }); - - debug( 'Initializing definitions component...' ); - defineProperty( svg, 'defs', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Defs({ - 'autoRender': false - }) - }); - - debug( 'Initializing clipping path component...' ); - defineProperty( svg, 'clipPath', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new ClipPath({ - 'autoRender': false, - 'id': state._clipPathId // eslint-disable-line no-underscore-dangle - }) - }); - - debug( 'Initializing graph component...' ); - defineProperty( svg, 'graph', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Graph({ - 'autoRender': false - }) - }); - - debug( 'Initializing annotations component...' ); - defineProperty( svg, 'annotations', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Annotations({ - 'autoRender': false - }) - }); - - debug( 'Initializing title component...' ); - defineProperty( svg, 'title', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Title({ - 'autoRender': false - }) - }); - - debug( 'Initializing background component...' ); - defineProperty( svg, 'bkgd', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Bkgd({ - 'autoRender': false - }) - }); - - debug( 'Initializing marks component...' ); - defineProperty( svg, 'marks', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Marks({ - 'autoRender': false, - 'clipPathId': state._clipPathId // eslint-disable-line no-underscore-dangle - }) - }); - - /* - debug( 'Initializing columns component...' ); - defineProperty( svg, 'columns', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Columns({ - 'autoRender': false - }) - }); - */ - - debug( 'Initializing x-axis component...' ); - defineProperty( svg, 'xAxis', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Axis({ - 'autoRender': false - }) - }); - - debug( 'Initializing y-axis component...' ); - defineProperty( svg, 'yAxis', { - 'configurable': false, - 'enumerable': false, - 'writable': false, - 'value': new Axis({ - 'autoRender': false - }) - }); - - debug( 'All components initialized.' ); -} - - -// EXPORTS // - -module.exports = init; diff --git a/hist/lib/render/svg/marks/columns.js b/hist/lib/render/svg/marks/columns.js deleted file mode 100644 index ddb5a18..0000000 --- a/hist/lib/render/svg/marks/columns.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'hist:render:svg:marks:columns' ); - - -// MAIN // - -/** -* Renders column marks. -* -* @private -* @param {Object} state - state -* @returns {VTree} virtual tree -*/ -function render( state ) { - var nOpacities; - var lineStyle; - var opacity; - var nColors; - var nStyles; - var nWidths; - var color; - var width; - var marks; - var line; - var len; - var i; - - // FIXME - - line = state.$.svg.path; - nOpacities = state.lineOpacity.length; - nStyles = state.lineStyle.length; - nWidths = state.lineWidth.length; - nColors = state.colors.length; - - len = state.x.length; - marks = []; - - debug( 'Rendering columns...' ); - for ( i = 0; i < len; i++ ) { - lineStyle = state.lineStyle[ i%nStyles ]; - debug( 'Line style: %s (%d).', lineStyle, i ); - - if ( lineStyle === 'none' ) { - debug( 'Line style (%d) is `none`. Skipping...', i ); - continue; - } - color = state.colors[ i%nColors ]; - debug( 'Line color: %s (%d).', color, i ); - - opacity = state.lineOpacity[ i%nOpacities ]; - debug( 'Line opacity: %s (%d).', opacity, i ); - - width = state.lineWidth[ i%nWidths ]; - debug( 'Line width: %s (%d).', width, i ); - - line.x = state.x[ i ]; - line.y = state.y[ i ]; - line.style = lineStyle; - line.label = state.labels[ i ] || ''; - line.color = color; - line.opacity = opacity; - line.width = width; - - debug( 'Rendering columns %d...', i ); - marks.push( line.render() ); - } - debug( 'Finished rendering columns.' ); - return marks; -} - - -// EXPORTS // - -module.exports = render; diff --git a/hist/lib/render/svg/marks/index.js b/hist/lib/render/svg/marks/index.js deleted file mode 100644 index f556c74..0000000 --- a/hist/lib/render/svg/marks/index.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var columns = require( './columns.js' ); - - -// VARIABLES // - -var debug = logger( 'hist:render:svg:marks' ); - - -// MAIN // - -/** -* Renders individual marks. -* -* @private -* @param {Object} state - state -* @returns {VTree} virtual tree -*/ -function render( state ) { - var parent; - var marks; - var len; - var i; - - debug( 'Rendering marks group...' ); - parent = state.$.svg.marks.render(); - - len = state.x.length; - if ( len === 0 ) { - debug( 'No individual marks to render.' ); - return parent; - } - marks = []; - - debug( 'Rendering columns...' ); - marks = marks.concat( columns( state ) ); - - debug( 'Inserting individual marks into marks group...' ); - for ( i = 0; i < marks.length; i++ ) { - parent.children.push( marks[i] ); - parent.count += marks[i].count; - } - debug( 'Finished rendering marks.' ); - return parent; -} - - -// EXPORTS // - -module.exports = render; diff --git a/hist/lib/render/svg/sync.js b/hist/lib/render/svg/sync.js deleted file mode 100644 index 6b426f8..0000000 --- a/hist/lib/render/svg/sync.js +++ /dev/null @@ -1,100 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'hist:render:svg:sync' ); - - -// MAIN // - -/** -* Syncs SVG components with the current state. -* -* @private -* @param {Object} state - state -*/ -function sync( state ) { - var svg = state.$.svg; - - debug( 'Syncing...' ); - - debug( 'Syncing canvas...' ); - svg.canvas.width = state.width; - svg.canvas.height = state.height; - - debug( 'Syncing definitions...' ); - - // ... - - debug( 'Syncing clipping path...' ); - svg.clipPath.width = state.graphWidth; - svg.clipPath.height = state.graphHeight; - - debug( 'Syncing graph...' ); - svg.graph.translateX = state.paddingLeft; - svg.graph.translateY = state.paddingTop; - - debug( 'Syncing annotations...' ); - - // ... - - debug( 'Syncing title...' ); - svg.title.text = state.title; - - debug( 'Syncing background...' ); - svg.bkgd.width = state.graphWidth; - svg.bkgd.height = state.graphHeight; - - debug( 'Syncing marks...' ); - svg.marks.clipPathId = state._clipPathId; // eslint-disable-line no-underscore-dangle - - debug( 'Syncing columns...' ); - svg.columns.xScale = state.xScale; - svg.columns.yScale = state.yScale; - - // svg.columns.isDefined = state.isDefined; // TODO - - debug( 'Syncing x-axis...' ); - svg.xAxis.scale = state.xScale; - svg.xAxis.label = state.xLabel; - svg.xAxis.tickFormat = state.xTickFormat; - svg.xAxis.numTicks = state.xNumTicks; - svg.xAxis.orientation = state.xAxisOrient; - - debug( 'Syncing y-axis...' ); - svg.yAxis.scale = state.yScale; - svg.yAxis.label = state.yLabel; - svg.yAxis.tickFormat = state.yTickFormat; - svg.yAxis.numTicks = state.yNumTicks; - svg.yAxis.orientation = state.yAxisOrient; - - debug( 'Sync complete.' ); -} - - -// EXPORTS // - -module.exports = sync; diff --git a/hist/lib/render/svg/utils/x_axis_transform.js b/hist/lib/render/svg/utils/x_axis_transform.js deleted file mode 100644 index dba6773..0000000 --- a/hist/lib/render/svg/utils/x_axis_transform.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns an x-axis translation transform. -* -* @private -* @param {string} orient - axis orientation -* @param {number} height - graph height -* @returns {string} transform -*/ -function xAxisTransform( orient, height ) { - if ( orient === 'top' ) { - return 'translate(0,0)'; - } - return 'translate(0,'+height+')'; -} - - -// EXPORTS // - -module.exports = xAxisTransform; diff --git a/hist/lib/render/svg/utils/y_axis_transform.js b/hist/lib/render/svg/utils/y_axis_transform.js deleted file mode 100644 index 2373863..0000000 --- a/hist/lib/render/svg/utils/y_axis_transform.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns a y-axis translation transform. -* -* @private -* @param {string} orient - axis orientation -* @param {number} width - graph width -* @returns {string} transform -*/ -function yAxisTransform( orient, width ) { - if ( orient === 'left' ) { - return 'translate(0,0)'; - } - return 'translate('+width+',0)'; -} - - -// EXPORTS // - -module.exports = yAxisTransform; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0c119d4 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-property@v0.2.4-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-read-only-property@v0.2.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-plain-object@v0.2.2-esm/index.mjs";import u from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-copy@v0.2.2-esm/index.mjs";import a from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-inherit@v0.2.2-esm/index.mjs";import s,{factory as o}from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-merge@v0.2.2-esm/index.mjs";import l from"https://cdn.jsdelivr.net/gh/stdlib-js/random-base-minstd@v0.2.1-esm/index.mjs";import c from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.2.2-esm/index.mjs";import h from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-node-repl@v0.2.2-esm/index.mjs";import{isPrimitive as f}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-nan@esm/index.mjs";import g from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-array@esm/index.mjs";import d from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-empty-array@esm/index.mjs";import{primitives as p}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string-array@esm/index.mjs";import m from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@esm/index.mjs";import{isPrimitive as y}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import v from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-index-of@esm/index.mjs";import{isPrimitive as _}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-number@esm/index.mjs";import{primitives as b}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-number-array@esm/index.mjs";import{isPrimitive as w}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-nonnegative-integer@esm/index.mjs";import{primitives as x}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-nonnegative-integer-array@esm/index.mjs";import{isPrimitive as A}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-number@v0.2.2-esm/index.mjs";import{primitives as E}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-number-array@v0.2.2-esm/index.mjs";import{isPrimitive as C}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-positive-number@v0.2.2-esm/index.mjs";import{isPrimitive as F}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-positive-number@esm/index.mjs";import{isPrimitive as D}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-nonnegative-integer@v0.2.2-esm/index.mjs";import T from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-null@esm/index.mjs";import{isPrimitive as B}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-boolean@esm/index.mjs";import{primitives as k}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-boolean-array@esm/index.mjs";import N from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-contains@esm/index.mjs";import R from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-instance-of@esm/index.mjs";import S from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import M from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-identity-function@esm/index.mjs";import O from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-array-like@esm/index.mjs";function V(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),n}function j(){}function z(){z.init.call(this)}function L(e){return void 0===e._maxListeners?z.defaultMaxListeners:e._maxListeners}function P(e,t,n,i){var r,u,a,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((u=e._events)?(u.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),u=e._events),a=u[t]):(u=e._events=new j,e._eventsCount=0),a){if("function"==typeof a?a=u[t]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),!a.warned&&(r=L(e))&&r>0&&a.length>r){a.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=e,o.type=t,o.count=a.length,s=o,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=u[t]=n,++e._eventsCount;return e}function J(e,t,n){var i=!1;function r(){e.removeListener(t,r),i||(i=!0,n.apply(e,arguments))}return r.listener=n,r}function U(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function I(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}j.prototype=Object.create(null),z.EventEmitter=z,z.usingDomains=!1,z.prototype.domain=void 0,z.prototype._events=void 0,z.prototype._maxListeners=void 0,z.defaultMaxListeners=10,z.init=function(){this.domain=null,z.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new j,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},z.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},z.prototype.getMaxListeners=function(){return L(this)},z.prototype.emit=function(e){var t,n,i,r,u,a,s,o="error"===e;if(a=this._events)o=o&&null==a.error;else if(!o)return!1;if(s=this.domain,o){if(t=arguments[1],!s){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var c="function"==typeof n;switch(i=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var i=e.length,r=I(e,i),u=0;u0;)if(n[u]===t||n[u].listener&&n[u].listener===t){a=n[u].listener,r=u;break}if(r<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new j,this;delete i[e]}else!function(e,t){for(var n=t,i=n+1,r=e.length;i0?Reflect.ownKeys(this._events):[]};var Y=V(Object.freeze({__proto__:null,EventEmitter:z,default:z})),H=V(Object.freeze({__proto__:null,default:()=>()=>{}}));function q(e,t,n){if("none"!==t){if("stdout"===t)return function(e){console.log(JSON.stringify(e))}(n);if("browser"===t)throw new Error(c("invalid argument. Must provide a supported viewer. Value: `%s`.",t));if("terminal"!==t)throw new Error(c("invalid argument. Must provide a supported viewer. Value: `%s`.",t))}}var W=H("plot:accessor:is-defined");function G(e){var t=!f(e);return W("Datum: %s. Defined: %s.",JSON.stringify(e),t),t}var $=H("plot:set:x");var X=H("plot:set:y");var Z=H("plot:set:labels");var Q=H("plot:set:is-defined");var K={category10:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcdb22","#17becf"],category20:["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],category20b:["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],category20c:["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"]},ee=H("plot:set:colors");var te=["-","--",":","-.","none"],ne=H("plot:set:line-style");var ie=H("plot:set:line-opacity");var re=H("plot:set:line-width");var ue=["closed-circle","open-circle","none"],ae=H("plot:set:symbols");var se=H("plot:set:symbols-size");var oe=H("plot:set:symbols-opacity");var le=H("plot:set:width");var ce=H("plot:set:height");var he=H("plot:set:padding-left");var fe=H("plot:set:padding-right");var ge=H("plot:set:padding-top");var de=H("plot:set:padding-bottom");var pe=H("plot:set:x-min");function me(e){var t,n;if(0===e.length)return null;for(t=e[0],n=1;nt&&(t=e[n]);return t}var _e=H("plot:set:y-min");var be=H("plot:set:y-max");var we=H("plot:set:x-scale");function xe(e,t){return et?1:e>=t?0:NaN}function Ae(e){var t;return 1===e.length&&(t=e,e=function(e,n){return xe(t(e),n)}),{left:function(t,n,i,r){for(null==i&&(i=0),null==r&&(r=t.length);i>>1;e(t[u],n)<0?i=u+1:r=u}return i},right:function(t,n,i,r){for(null==i&&(i=0),null==r&&(r=t.length);i>>1;e(t[u],n)>0?r=u:i=u+1}return i}}}var Ee=Ae(xe).right;function Ce(e){return null===e?NaN:+e}var Fe=Math.sqrt(50),De=Math.sqrt(10),Te=Math.sqrt(2);function Be(e,t,n){var i,r,u,a,s=-1;if(n=+n,(e=+e)===(t=+t)&&n>0)return[e];if((i=t0)for(e=Math.ceil(e/a),t=Math.floor(t/a),u=new Array(r=Math.ceil(t-e+1));++s=0?(u>=Fe?10:u>=De?5:u>=Te?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(u>=Fe?10:u>=De?5:u>=Te?2:1)}function Ne(e,t,n){var i=Math.abs(t-e)/Math.max(0,n),r=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)),u=i/r;return u>=Fe?r*=10:u>=De?r*=5:u>=Te&&(r*=2),t=1)return+n(e[i-1],i-1,e);var i,r=(i-1)*t,u=Math.floor(r),a=+n(e[u],u,e);return a+(+n(e[u+1],u+1,e)-a)*(r-u)}}var Se="$";function Me(){}function Oe(e,t){var n=new Me;if(e instanceof Me)e.each((function(e,t){n.set(t,e)}));else if(Array.isArray(e)){var i,r=-1,u=e.length;if(null==t)for(;++r>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?ht(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?ht(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=et.exec(e))?new dt(t[1],t[2],t[3],1):(t=tt.exec(e))?new dt(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=nt.exec(e))?ht(t[1],t[2],t[3],t[4]):(t=it.exec(e))?ht(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=rt.exec(e))?vt(t[1],t[2]/100,t[3]/100,1):(t=ut.exec(e))?vt(t[1],t[2]/100,t[3]/100,t[4]):at.hasOwnProperty(e)?ct(at[e]):"transparent"===e?new dt(NaN,NaN,NaN,0):null}function ct(e){return new dt(e>>16&255,e>>8&255,255&e,1)}function ht(e,t,n,i){return i<=0&&(e=t=n=NaN),new dt(e,t,n,i)}function ft(e){return e instanceof We||(e=lt(e)),e?new dt((e=e.rgb()).r,e.g,e.b,e.opacity):new dt}function gt(e,t,n,i){return 1===arguments.length?ft(e):new dt(e,t,n,null==i?1:i)}function dt(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}function pt(){return"#"+yt(this.r)+yt(this.g)+yt(this.b)}function mt(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function yt(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function vt(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new bt(e,t,n,i)}function _t(e){if(e instanceof bt)return new bt(e.h,e.s,e.l,e.opacity);if(e instanceof We||(e=lt(e)),!e)return new bt;if(e instanceof bt)return e;var t=(e=e.rgb()).r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),u=Math.max(t,n,i),a=NaN,s=u-r,o=(u+r)/2;return s?(a=t===u?(n-i)/s+6*(n0&&o<1?0:a,new bt(a,s,o,e.opacity)}function bt(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function wt(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}He(We,lt,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:st,formatHex:st,formatHsl:function(){return _t(this).formatHsl()},formatRgb:ot,toString:ot}),He(dt,gt,qe(We,{brighter:function(e){return e=null==e?$e:Math.pow($e,e),new dt(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?Ge:Math.pow(Ge,e),new dt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:pt,formatHex:pt,formatRgb:mt,toString:mt})),He(bt,(function(e,t,n,i){return 1===arguments.length?_t(e):new bt(e,t,n,null==i?1:i)}),qe(We,{brighter:function(e){return e=null==e?$e:Math.pow($e,e),new bt(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?Ge:Math.pow(Ge,e),new bt(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new dt(wt(e>=240?e-240:e+120,r,i),wt(e,r,i),wt(e<120?e+240:e-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var xt=Math.PI/180,At=180/Math.PI,Et=-.14861,Ct=1.78277,Ft=-.29227,Dt=-.90649,Tt=1.97294,Bt=Tt*Dt,kt=Tt*Ct,Nt=Ct*Ft-Dt*Et;function Rt(e,t,n,i){return 1===arguments.length?function(e){if(e instanceof St)return new St(e.h,e.s,e.l,e.opacity);e instanceof dt||(e=ft(e));var t=e.r/255,n=e.g/255,i=e.b/255,r=(Nt*i+Bt*t-kt*n)/(Nt+Bt-kt),u=i-r,a=(Tt*(n-r)-Ft*u)/Dt,s=Math.sqrt(a*a+u*u)/(Tt*r*(1-r)),o=s?Math.atan2(a,u)*At-120:NaN;return new St(o<0?o+360:o,s,r,e.opacity)}(e):new St(e,t,n,null==i?1:i)}function St(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function Mt(e){return function(){return e}}function Ot(e,t){return function(n){return e+n*t}}function Vt(e){return 1==(e=+e)?jt:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}(t,n,e):Mt(isNaN(t)?n:t)}}function jt(e,t){var n=t-e;return n?Ot(e,n):Mt(isNaN(e)?t:e)}He(St,Rt,qe(We,{brighter:function(e){return e=null==e?$e:Math.pow($e,e),new St(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?Ge:Math.pow(Ge,e),new St(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=isNaN(this.h)?0:(this.h+120)*xt,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),i=Math.cos(e),r=Math.sin(e);return new dt(255*(t+n*(Et*i+Ct*r)),255*(t+n*(Ft*i+Dt*r)),255*(t+n*(Tt*i)),this.opacity)}}));var zt=function e(t){var n=Vt(t);function i(e,t){var i=n((e=gt(e)).r,(t=gt(t)).r),r=n(e.g,t.g),u=n(e.b,t.b),a=jt(e.opacity,t.opacity);return function(t){return e.r=i(t),e.g=r(t),e.b=u(t),e.opacity=a(t),e+""}}return i.gamma=e,i}(1);function Lt(e,t){t||(t=[]);var n,i=e?Math.min(t.length,e.length):0,r=t.slice();return function(u){for(n=0;nu&&(r=t.slice(u,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,o.push({i:a,x:Ut(n,i)})),u=Ht.lastIndex;return u180||n<-180?n-360*Math.round(n/360):n):Mt(isNaN(e)?t:e)}));var Xt=$t(jt);function Zt(e){return function(){return e}}function Qt(e){return+e}var Kt=[0,1];function en(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Zt(t)}function tn(e,t,n,i){var r=e[0],u=e[1],a=t[0],s=t[1];return u2?nn:tn,i=r=null,c}function c(t){return(i||(i=n(u,a,o?function(e){return function(t,n){var i=e(t=+t,n=+n);return function(e){return e<=t?0:e>=n?1:i(e)}}}(e):e,s)))(+t)}return c.invert=function(e){return(r||(r=n(a,u,en,o?function(e){return function(t,n){var i=e(t=+t,n=+n);return function(e){return e<=0?t:e>=1?n:i(e)}}}(t):t)))(+e)},c.domain=function(e){return arguments.length?(u=Le.call(e,Qt),l()):u.slice()},c.range=function(e){return arguments.length?(a=Pe.call(e),l()):a.slice()},c.rangeRound=function(e){return a=Pe.call(e),s=Gt,l()},c.clamp=function(e){return arguments.length?(o=!!e,l()):o},c.interpolate=function(e){return arguments.length?(s=e,l()):s},l()}function an(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function sn(e){return(e=an(Math.abs(e)))?e[1]:NaN}var on,ln=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function cn(e){if(!(t=ln.exec(e)))throw new Error("invalid format: "+e);var t;return new hn({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function hn(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function fn(e,t){var n=an(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}cn.prototype=hn.prototype,hn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var gn={"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return fn(100*e,t)},r:fn,s:function(e,t){var n=an(e,t);if(!n)return e+"";var i=n[0],r=n[1],u=r-(on=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,a=i.length;return u===a?i:u>a?i+new Array(u-a+1).join("0"):u>0?i.slice(0,u)+"."+i.slice(u):"0."+new Array(1-u).join("0")+an(e,Math.max(0,t+u-1))[0]},X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}};function dn(e){return e}var pn,mn,yn,vn=Array.prototype.map,_n=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function bn(e){var t,n,i=void 0===e.grouping||void 0===e.thousands?dn:(t=vn.call(e.grouping,Number),n=e.thousands+"",function(e,i){for(var r=e.length,u=[],a=0,s=t[0],o=0;r>0&&s>0&&(o+s+1>i&&(s=Math.max(1,i-o)),u.push(e.substring(r-=s,r+s)),!((o+=s+1)>i));)s=t[a=(a+1)%t.length];return u.reverse().join(n)}),r=void 0===e.currency?"":e.currency[0]+"",u=void 0===e.currency?"":e.currency[1]+"",a=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?dn:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(vn.call(e.numerals,String)),o=void 0===e.percent?"%":e.percent+"",l=void 0===e.minus?"-":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function h(e){var t=(e=cn(e)).fill,n=e.align,h=e.sign,f=e.symbol,g=e.zero,d=e.width,p=e.comma,m=e.precision,y=e.trim,v=e.type;"n"===v?(p=!0,v="g"):gn[v]||(void 0===m&&(m=12),y=!0,v="g"),(g||"0"===t&&"="===n)&&(g=!0,t="0",n="=");var _="$"===f?r:"#"===f&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",b="$"===f?u:/[%p]/.test(v)?o:"",w=gn[v],x=/[defgprs%]/.test(v);function A(e){var r,u,o,f=_,A=b;if("c"===v)A=w(e)+A,e="";else{var E=(e=+e)<0||1/e<0;if(e=isNaN(e)?c:w(Math.abs(e),m),y&&(e=function(e){e:for(var t,n=e.length,i=1,r=-1;i0&&(r=0)}return r>0?e.slice(0,r)+e.slice(t+1):e}(e)),E&&0==+e&&"+"!==h&&(E=!1),f=(E?"("===h?h:l:"-"===h||"("===h?"":h)+f,A=("s"===v?_n[8+on/3]:"")+A+(E&&"("===h?")":""),x)for(r=-1,u=e.length;++r(o=e.charCodeAt(r))||o>57){A=(46===o?a+e.slice(r+1):e.slice(r))+A,e=e.slice(0,r);break}}p&&!g&&(e=i(e,1/0));var C=f.length+e.length+A.length,F=C>1)+f+e+A+F.slice(C);break;default:e=F+f+e+A}return s(e)}return m=void 0===m?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),A.toString=function(){return e+""},A}return{format:h,formatPrefix:function(e,t){var n=h(((e=cn(e)).type="f",e)),i=3*Math.max(-8,Math.min(8,Math.floor(sn(t)/3))),r=Math.pow(10,-i),u=_n[8+i/3];return function(e){return n(r*e)+u}}}}function wn(e){return pn=bn(e),mn=pn.format,yn=pn.formatPrefix,pn}function xn(e){return Math.max(0,-sn(Math.abs(e)))}function An(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(sn(t)/3)))-sn(Math.abs(e)))}function En(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,sn(t)-sn(e))+1}wn({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});var Cn=Object.freeze({__proto__:null,FormatSpecifier:hn,get format(){return mn},formatDefaultLocale:wn,formatLocale:bn,get formatPrefix(){return yn},formatSpecifier:cn,precisionFixed:xn,precisionPrefix:An,precisionRound:En});function Fn(e){var t=e.domain;return e.ticks=function(e){var n=t();return Be(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){return function(e,t,n){var i,r=e[0],u=e[e.length-1],a=Ne(r,u,null==t?10:t);switch((n=cn(null==n?",f":n)).type){case"s":var s=Math.max(Math.abs(r),Math.abs(u));return null!=n.precision||isNaN(i=An(a,s))||(n.precision=i),yn(n,s);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(i=En(a,Math.max(Math.abs(r),Math.abs(u))))||(n.precision=i-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(i=xn(a))||(n.precision=i-2*("%"===n.type))}return mn(n)}(t(),e,n)},e.nice=function(n){null==n&&(n=10);var i,r=t(),u=0,a=r.length-1,s=r[u],o=r[a];return o0?i=ke(s=Math.floor(s/i)*i,o=Math.ceil(o/i)*i,n):i<0&&(i=ke(s=Math.ceil(s*i)/i,o=Math.floor(o*i)/i,n)),i>0?(r[u]=Math.floor(s/i)*i,r[a]=Math.ceil(o/i)*i,t(r)):i<0&&(r[u]=Math.ceil(s*i)/i,r[a]=Math.floor(o*i)/i,t(r)),e},e}function Dn(e,t){var n,i=0,r=(e=e.slice()).length-1,u=e[i],a=e[r];return a0))return s;do{s.push(a=new Date(+n)),t(n,u),e(n)}while(a=t)for(;e(t),!n(t);)t.setTime(t-1)}),(function(e,i){if(e>=e)if(i<0)for(;++i<=0;)for(;t(e,-1),!n(e););else for(;--i>=0;)for(;t(e,1),!n(e););}))},n&&(r.count=function(t,i){return Vn.setTime(+t),jn.setTime(+i),e(Vn),e(jn),Math.floor(n(Vn,jn))},r.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?r.filter(i?function(t){return i(t)%e==0}:function(t){return r.count(0,t)%e==0}):r:null}),r}var Ln=zn((function(){}),(function(e,t){e.setTime(+e+t)}),(function(e,t){return t-e}));Ln.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?zn((function(t){t.setTime(Math.floor(t/e)*e)}),(function(t,n){t.setTime(+t+n*e)}),(function(t,n){return(n-t)/e})):Ln:null};var Pn=Ln;Ln.range;var Jn=1e3,Un=6e4,In=36e5,Yn=864e5,Hn=6048e5,qn=zn((function(e){e.setTime(e-e.getMilliseconds())}),(function(e,t){e.setTime(+e+t*Jn)}),(function(e,t){return(t-e)/Jn}),(function(e){return e.getUTCSeconds()})),Wn=qn;qn.range;var Gn=zn((function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*Jn)}),(function(e,t){e.setTime(+e+t*Un)}),(function(e,t){return(t-e)/Un}),(function(e){return e.getMinutes()})),$n=Gn;Gn.range;var Xn=zn((function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*Jn-e.getMinutes()*Un)}),(function(e,t){e.setTime(+e+t*In)}),(function(e,t){return(t-e)/In}),(function(e){return e.getHours()})),Zn=Xn;Xn.range;var Qn=zn((function(e){e.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Un)/Yn}),(function(e){return e.getDate()-1})),Kn=Qn;function ei(e){return zn((function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+7*t)}),(function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Un)/Hn}))}Qn.range;var ti=ei(0),ni=ei(1),ii=ei(2),ri=ei(3),ui=ei(4),ai=ei(5),si=ei(6);ti.range,ni.range,ii.range,ri.range,ui.range,ai.range,si.range;var oi=zn((function(e){e.setDate(1),e.setHours(0,0,0,0)}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())}),(function(e){return e.getMonth()})),li=oi;oi.range;var ci=zn((function(e){e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e,t){return t.getFullYear()-e.getFullYear()}),(function(e){return e.getFullYear()}));ci.every=function(e){return isFinite(e=Math.floor(e))&&e>0?zn((function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n*e)})):null};var hi=ci;ci.range;var fi=zn((function(e){e.setUTCSeconds(0,0)}),(function(e,t){e.setTime(+e+t*Un)}),(function(e,t){return(t-e)/Un}),(function(e){return e.getUTCMinutes()})),gi=fi;fi.range;var di=zn((function(e){e.setUTCMinutes(0,0,0)}),(function(e,t){e.setTime(+e+t*In)}),(function(e,t){return(t-e)/In}),(function(e){return e.getUTCHours()})),pi=di;di.range;var mi=zn((function(e){e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+t)}),(function(e,t){return(t-e)/Yn}),(function(e){return e.getUTCDate()-1})),yi=mi;function vi(e){return zn((function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+7*t)}),(function(e,t){return(t-e)/Hn}))}mi.range;var _i=vi(0),bi=vi(1),wi=vi(2),xi=vi(3),Ai=vi(4),Ei=vi(5),Ci=vi(6);_i.range,bi.range,wi.range,xi.range,Ai.range,Ei.range,Ci.range;var Fi=zn((function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCMonth(e.getUTCMonth()+t)}),(function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())}),(function(e){return e.getUTCMonth()})),Di=Fi;Fi.range;var Ti=zn((function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)}),(function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),(function(e){return e.getUTCFullYear()}));Ti.every=function(e){return isFinite(e=Math.floor(e))&&e>0?zn((function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null};var Bi=Ti;function ki(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Ni(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Ri(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function Si(e){var t=e.dateTime,n=e.date,i=e.time,r=e.periods,u=e.days,a=e.shortDays,s=e.months,o=e.shortMonths,l=Hi(r),c=qi(r),h=Hi(u),f=qi(u),g=Hi(a),d=qi(a),p=Hi(s),m=qi(s),y=Hi(o),v=qi(o),_={a:function(e){return a[e.getDay()]},A:function(e){return u[e.getDay()]},b:function(e){return o[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:gr,e:gr,f:vr,g:Br,G:Nr,H:dr,I:pr,j:mr,L:yr,m:_r,M:br,p:function(e){return r[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:eu,s:tu,S:wr,u:xr,U:Ar,V:Cr,w:Fr,W:Dr,x:null,X:null,y:Tr,Y:kr,Z:Rr,"%":Kr},b={a:function(e){return a[e.getUTCDay()]},A:function(e){return u[e.getUTCDay()]},b:function(e){return o[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:Sr,e:Sr,f:zr,g:$r,G:Zr,H:Mr,I:Or,j:Vr,L:jr,m:Lr,M:Pr,p:function(e){return r[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:eu,s:tu,S:Jr,u:Ur,U:Ir,V:Hr,w:qr,W:Wr,x:null,X:null,y:Gr,Y:Xr,Z:Qr,"%":Kr},w={a:function(e,t,n){var i=g.exec(t.slice(n));return i?(e.w=d[i[0].toLowerCase()],n+i[0].length):-1},A:function(e,t,n){var i=h.exec(t.slice(n));return i?(e.w=f[i[0].toLowerCase()],n+i[0].length):-1},b:function(e,t,n){var i=y.exec(t.slice(n));return i?(e.m=v[i[0].toLowerCase()],n+i[0].length):-1},B:function(e,t,n){var i=p.exec(t.slice(n));return i?(e.m=m[i[0].toLowerCase()],n+i[0].length):-1},c:function(e,n,i){return E(e,t,n,i)},d:ir,e:ir,f:lr,g:Ki,G:Qi,H:ur,I:ur,j:rr,L:or,m:nr,M:ar,p:function(e,t,n){var i=l.exec(t.slice(n));return i?(e.p=c[i[0].toLowerCase()],n+i[0].length):-1},q:tr,Q:hr,s:fr,S:sr,u:Gi,U:$i,V:Xi,w:Wi,W:Zi,x:function(e,t,i){return E(e,n,t,i)},X:function(e,t,n){return E(e,i,t,n)},y:Ki,Y:Qi,Z:er,"%":cr};function x(e,t){return function(n){var i,r,u,a=[],s=-1,o=0,l=e.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;"w"in u||(u.w=1),"Z"in u?(r=(i=Ni(Ri(u.y,0,1))).getUTCDay(),i=r>4||0===r?bi.ceil(i):bi(i),i=yi.offset(i,7*(u.V-1)),u.y=i.getUTCFullYear(),u.m=i.getUTCMonth(),u.d=i.getUTCDate()+(u.w+6)%7):(r=(i=ki(Ri(u.y,0,1))).getDay(),i=r>4||0===r?ni.ceil(i):ni(i),i=Kn.offset(i,7*(u.V-1)),u.y=i.getFullYear(),u.m=i.getMonth(),u.d=i.getDate()+(u.w+6)%7)}else("W"in u||"U"in u)&&("w"in u||(u.w="u"in u?u.u%7:"W"in u?1:0),r="Z"in u?Ni(Ri(u.y,0,1)).getUTCDay():ki(Ri(u.y,0,1)).getDay(),u.m=0,u.d="W"in u?(u.w+6)%7+7*u.W-(r+5)%7:u.w+7*u.U-(r+6)%7);return"Z"in u?(u.H+=u.Z/100|0,u.M+=u.Z%100,Ni(u)):ki(u)}}function E(e,t,n,i){for(var r,u,a=0,s=t.length,o=n.length;a=o)return-1;if(37===(r=t.charCodeAt(a++))){if(r=t.charAt(a++),!(u=w[r in Li?t.charAt(a++):r])||(i=u(e,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return _.x=x(n,_),_.X=x(i,_),_.c=x(t,_),b.x=x(n,b),b.X=x(i,b),b.c=x(t,b),{format:function(e){var t=x(e+="",_);return t.toString=function(){return e},t},parse:function(e){var t=A(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=x(e+="",b);return t.toString=function(){return e},t},utcParse:function(e){var t=A(e+="",!0);return t.toString=function(){return e},t}}}Ti.range;var Mi,Oi,Vi,ji,zi,Li={"-":"",_:" ",0:"0"},Pi=/^\s*\d+/,Ji=/^%/,Ui=/[\\^$*+?|[\]().{}]/g;function Ii(e,t,n){var i=e<0?"-":"",r=(i?-e:e)+"",u=r.length;return i+(u68?1900:2e3),n+i[0].length):-1}function er(e,t,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return i?(e.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function tr(e,t,n){var i=Pi.exec(t.slice(n,n+1));return i?(e.q=3*i[0]-3,n+i[0].length):-1}function nr(e,t,n){var i=Pi.exec(t.slice(n,n+2));return i?(e.m=i[0]-1,n+i[0].length):-1}function ir(e,t,n){var i=Pi.exec(t.slice(n,n+2));return i?(e.d=+i[0],n+i[0].length):-1}function rr(e,t,n){var i=Pi.exec(t.slice(n,n+3));return i?(e.m=0,e.d=+i[0],n+i[0].length):-1}function ur(e,t,n){var i=Pi.exec(t.slice(n,n+2));return i?(e.H=+i[0],n+i[0].length):-1}function ar(e,t,n){var i=Pi.exec(t.slice(n,n+2));return i?(e.M=+i[0],n+i[0].length):-1}function sr(e,t,n){var i=Pi.exec(t.slice(n,n+2));return i?(e.S=+i[0],n+i[0].length):-1}function or(e,t,n){var i=Pi.exec(t.slice(n,n+3));return i?(e.L=+i[0],n+i[0].length):-1}function lr(e,t,n){var i=Pi.exec(t.slice(n,n+6));return i?(e.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function cr(e,t,n){var i=Ji.exec(t.slice(n,n+1));return i?n+i[0].length:-1}function hr(e,t,n){var i=Pi.exec(t.slice(n));return i?(e.Q=+i[0],n+i[0].length):-1}function fr(e,t,n){var i=Pi.exec(t.slice(n));return i?(e.s=+i[0],n+i[0].length):-1}function gr(e,t){return Ii(e.getDate(),t,2)}function dr(e,t){return Ii(e.getHours(),t,2)}function pr(e,t){return Ii(e.getHours()%12||12,t,2)}function mr(e,t){return Ii(1+Kn.count(hi(e),e),t,3)}function yr(e,t){return Ii(e.getMilliseconds(),t,3)}function vr(e,t){return yr(e,t)+"000"}function _r(e,t){return Ii(e.getMonth()+1,t,2)}function br(e,t){return Ii(e.getMinutes(),t,2)}function wr(e,t){return Ii(e.getSeconds(),t,2)}function xr(e){var t=e.getDay();return 0===t?7:t}function Ar(e,t){return Ii(ti.count(hi(e)-1,e),t,2)}function Er(e){var t=e.getDay();return t>=4||0===t?ui(e):ui.ceil(e)}function Cr(e,t){return e=Er(e),Ii(ui.count(hi(e),e)+(4===hi(e).getDay()),t,2)}function Fr(e){return e.getDay()}function Dr(e,t){return Ii(ni.count(hi(e)-1,e),t,2)}function Tr(e,t){return Ii(e.getFullYear()%100,t,2)}function Br(e,t){return Ii((e=Er(e)).getFullYear()%100,t,2)}function kr(e,t){return Ii(e.getFullYear()%1e4,t,4)}function Nr(e,t){var n=e.getDay();return Ii((e=n>=4||0===n?ui(e):ui.ceil(e)).getFullYear()%1e4,t,4)}function Rr(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Ii(t/60|0,"0",2)+Ii(t%60,"0",2)}function Sr(e,t){return Ii(e.getUTCDate(),t,2)}function Mr(e,t){return Ii(e.getUTCHours(),t,2)}function Or(e,t){return Ii(e.getUTCHours()%12||12,t,2)}function Vr(e,t){return Ii(1+yi.count(Bi(e),e),t,3)}function jr(e,t){return Ii(e.getUTCMilliseconds(),t,3)}function zr(e,t){return jr(e,t)+"000"}function Lr(e,t){return Ii(e.getUTCMonth()+1,t,2)}function Pr(e,t){return Ii(e.getUTCMinutes(),t,2)}function Jr(e,t){return Ii(e.getUTCSeconds(),t,2)}function Ur(e){var t=e.getUTCDay();return 0===t?7:t}function Ir(e,t){return Ii(_i.count(Bi(e)-1,e),t,2)}function Yr(e){var t=e.getUTCDay();return t>=4||0===t?Ai(e):Ai.ceil(e)}function Hr(e,t){return e=Yr(e),Ii(Ai.count(Bi(e),e)+(4===Bi(e).getUTCDay()),t,2)}function qr(e){return e.getUTCDay()}function Wr(e,t){return Ii(bi.count(Bi(e)-1,e),t,2)}function Gr(e,t){return Ii(e.getUTCFullYear()%100,t,2)}function $r(e,t){return Ii((e=Yr(e)).getUTCFullYear()%100,t,2)}function Xr(e,t){return Ii(e.getUTCFullYear()%1e4,t,4)}function Zr(e,t){var n=e.getUTCDay();return Ii((e=n>=4||0===n?Ai(e):Ai.ceil(e)).getUTCFullYear()%1e4,t,4)}function Qr(){return"+0000"}function Kr(){return"%"}function eu(e){return+e}function tu(e){return Math.floor(+e/1e3)}function nu(e){return Mi=Si(e),Oi=Mi.format,Vi=Mi.parse,ji=Mi.utcFormat,zi=Mi.utcParse,Mi}nu({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var iu="%Y-%m-%dT%H:%M:%S.%LZ";var ru=Date.prototype.toISOString?function(e){return e.toISOString()}:ji(iu),uu=ru;var au=+new Date("2000-01-01T00:00:00.000Z")?function(e){var t=new Date(e);return isNaN(t)?null:t}:zi(iu),su=au,ou=Object.freeze({__proto__:null,isoFormat:uu,isoParse:su,get timeFormat(){return Oi},timeFormatDefaultLocale:nu,timeFormatLocale:Si,get timeParse(){return Vi},get utcFormat(){return ji},get utcParse(){return zi}}),lu=1e3,cu=60*lu,hu=60*cu,fu=24*hu,gu=7*fu,du=30*fu,pu=365*fu;function mu(e){return new Date(e)}function yu(e){return e instanceof Date?+e:+new Date(+e)}function vu(e,t,n,i,r,u,a,s,o){var l=un(en,Ut),c=l.invert,h=l.domain,f=o(".%L"),g=o(":%S"),d=o("%I:%M"),p=o("%I %p"),m=o("%a %d"),y=o("%b %d"),v=o("%B"),_=o("%Y"),b=[[a,1,lu],[a,5,5*lu],[a,15,15*lu],[a,30,30*lu],[u,1,cu],[u,5,5*cu],[u,15,15*cu],[u,30,30*cu],[r,1,hu],[r,3,3*hu],[r,6,6*hu],[r,12,12*hu],[i,1,fu],[i,2,2*fu],[n,1,gu],[t,1,du],[t,3,3*du],[e,1,pu]];function w(s){return(a(s)1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return Du.h=360*e-100,Du.s=1.5-1.5*t,Du.l=.8-.9*t,Du+""},interpolateViridis:Bu,interpolateWarm:Cu,scaleBand:Ie,scaleIdentity:function e(){var t=[0,1];function n(e){return+e}return n.invert=n,n.domain=n.range=function(e){return arguments.length?(t=Le.call(e,Qt),n):t.slice()},n.copy=function(){return e().domain(t)},Fn(n)},scaleImplicit:Je,scaleLinear:function e(){var t=un(en,Ut);return t.copy=function(){return rn(t,e())},Fn(t)},scaleLog:function e(){var t=un(Tn,Bn).domain([1,10]),n=t.domain,i=10,r=Rn(10),u=Nn(10);function a(){return r=Rn(i),u=Nn(i),n()[0]<0&&(r=Sn(r),u=Sn(u)),t}return t.base=function(e){return arguments.length?(i=+e,a()):i},t.domain=function(e){return arguments.length?(n(e),a()):n()},t.ticks=function(e){var t,a=n(),s=a[0],o=a[a.length-1];(t=o0){for(;fo)break;p.push(h)}}else for(;f=1;--c)if(!((h=l*c)o)break;p.push(h)}}else p=Be(f,g,Math.min(g-f,d)).map(u);return t?p.reverse():p},t.tickFormat=function(e,n){if(null==n&&(n=10===i?".0e":","),"function"!=typeof n&&(n=mn(n)),e===1/0)return n;null==e&&(e=10);var a=Math.max(1,i*e/t.ticks().length);return function(e){var t=e/u(Math.round(r(e)));return t*i0?i[r-1]:t[0],r=i?[r[i-1],n]:[r[a-1],r[a]]},a.copy=function(){return e().domain([t,n]).range(u)},Fn(a)},scaleSequential:function e(t){var n=0,i=1,r=!1;function u(e){var u=(e-n)/(i-n);return t(r?Math.max(0,Math.min(1,u)):u)}return u.domain=function(e){return arguments.length?(n=+e[0],i=+e[1],u):[n,i]},u.clamp=function(e){return arguments.length?(r=!!e,u):r},u.interpolator=function(e){return arguments.length?(t=e,u):t},u.copy=function(){return e(t).domain([n,i]).clamp(r)},Fn(u)},scaleSqrt:function(){return On().exponent(.5)},scaleThreshold:function e(){var t=[.5],n=[0,1],i=1;function r(e){if(e<=e)return n[Ee(t,e,0,i)]}return r.domain=function(e){return arguments.length?(t=Pe.call(e),i=Math.min(t.length,n.length-1),r):t.slice()},r.range=function(e){return arguments.length?(n=Pe.call(e),i=Math.min(t.length,n.length-1),r):n.slice()},r.invertExtent=function(e){var i=n.indexOf(e);return[t[i-1],t[i]]},r.copy=function(){return e().domain(t).range(n)},r},scaleTime:function(){return vu(hi,li,ti,Kn,Zn,$n,Wn,Pn,Oi).domain([new Date(2e3,0,1),new Date(2e3,0,2)])},scaleUtc:function(){return vu(Bi,Di,_i,yi,pi,gi,Wn,Pn,ji).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)])},schemeCategory10:bu,schemeCategory20:Au,schemeCategory20b:wu,schemeCategory20c:xu}),Mu=V(Su),Ou=Mu.scaleLinear,Vu=Mu.scaleTime;var ju=H("plot:set:y-scale");var zu=Mu.scaleLinear,Lu=Mu.scaleTime;var Pu=H("plot:set:x-tick-format");var Ju=V(Cn),Uu=V(ou),Iu=Ju.format,Yu=Uu.timeFormat;var Hu=H("plot:set:y-tick-format");var qu=Ju.format,Wu=Uu.timeFormat;var Gu=H("plot:set:x-num-ticks");var $u=H("plot:set:y-num-ticks");var Xu=["bottom","top"],Zu=H("plot:set:x-axis-orient");var Qu=["left","right"],Ku=H("plot:set:y-axis-orient");var ea=H("plot:set:x-rug");var ta=H("plot:set:y-rug");var na=["bottom","top"],ia=H("plot:set:x-rug-orient");var ra=["left","right"],ua=H("plot:set:y-rug-orient");var aa=H("plot:set:x-rug-opacity");var sa=H("plot:set:y-rug-opacity");var oa=H("plot:set:x-rug-size");var la=H("plot:set:y-rug-size");var ca=H("plot:set:description");var ha=H("plot:set:title");var fa=H("plot:set:x-label");var ga=H("plot:set:y-label");var da=["svg"],pa=H("plot:set:engine");var ma=H("plot:set:auto-render");var ya=["vdom","html"],va=H("plot:set:renderformat");var _a=["none","browser","terminal","stdout","window"],ba=H("plot:set:viewer");var wa=H("plot:set:auto-view");var xa=H("plot:x-pos");var Aa=H("plot:y-pos");var Ea=/["'&<>]/,Ca=function(e){var t,n=""+e,i=Ea.exec(n);if(!i)return n;var r="",u=0,a=0;for(u=i.index;u-1?t.substr(i+1):t;e.removeAttributeNS(this.namespace,r)}},za.prototype.type="AttributeHook";var La,Pa,Ja={tr:{regexp:/\u0130|\u0049|\u0049\u0307/g,map:{"İ":"i",I:"ı","İ":"i"}},az:{regexp:/[\u0130]/g,map:{"İ":"i",I:"ı","İ":"i"}},lt:{regexp:/[\u0049\u004A\u012E\u00CC\u00CD\u0128]/g,map:{I:"i̇",J:"j̇","Į":"į̇","Ì":"i̇̀","Í":"i̇́","Ĩ":"i̇̃"}}},Ua=function(e,t){var n=Ja[t];return e=null==e?"":String(e),n&&(e=e.replace(n.regexp,(function(e){return n.map[e]}))),e.toLowerCase()},Ia=/[^\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]+/g,Ya=/([\u0061-\u007A\u00B5\u00DF-\u00F6\u00F8-\u00FF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0561-\u0587\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1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u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7FA\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A])([\u0041-\u005A\u00C0-\u00D6\u00D8-\u00DE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA\uFF21-\uFF3A\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])/g,Ha=/([\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])([^\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])/g,qa=function(e,t,n){if(null==e)return"";return n=n||" ",e=String(e).replace(Ya,"$1 $2").replace(Ha,"$1 $2").replace(Ia,(function(e,t,i){return 0===t||t===i.length-e.length?"":n})),Ua(e,t)},Wa={BOOLEAN:1,OVERLOADED_BOOLEAN:2},Ga={attributeTypes:Wa,properties:{accept:!0,acceptCharset:!0,accessKey:!0,action:!0,allowFullScreen:Wa.BOOLEAN,allowTransparency:!0,alt:!0,async:Wa.BOOLEAN,autocomplete:!0,autofocus:Wa.BOOLEAN,autoplay:Wa.BOOLEAN,cellPadding:!0,cellSpacing:!0,charset:!0,checked:Wa.BOOLEAN,classID:!0,className:!0,cols:!0,colSpan:!0,content:!0,contentEditable:!0,contextMenu:!0,controls:Wa.BOOLEAN,coords:!0,crossOrigin:!0,data:!0,dateTime:!0,defer:Wa.BOOLEAN,dir:!0,disabled:Wa.BOOLEAN,download:Wa.OVERLOADED_BOOLEAN,draggable:!0,enctype:!0,form:!0,formAction:!0,formEncType:!0,formMethod:!0,formNoValidate:Wa.BOOLEAN,formTarget:!0,frameBorder:!0,headers:!0,height:!0,hidden:Wa.BOOLEAN,href:!0,hreflang:!0,htmlFor:!0,httpEquiv:!0,icon:!0,id:!0,label:!0,lang:!0,list:!0,loop:Wa.BOOLEAN,manifest:!0,marginHeight:!0,marginWidth:!0,max:!0,maxLength:!0,media:!0,mediaGroup:!0,method:!0,min:!0,multiple:Wa.BOOLEAN,muted:Wa.BOOLEAN,name:!0,noValidate:Wa.BOOLEAN,open:!0,pattern:!0,placeholder:!0,poster:!0,preload:!0,radiogroup:!0,readOnly:Wa.BOOLEAN,rel:!0,required:Wa.BOOLEAN,role:!0,rows:!0,rowSpan:!0,sandbox:!0,scope:!0,scrolling:!0,seamless:Wa.BOOLEAN,selected:Wa.BOOLEAN,shape:!0,size:!0,sizes:!0,span:!0,spellcheck:!0,src:!0,srcdoc:!0,srcset:!0,start:!0,step:!0,style:!0,tabIndex:!0,target:!0,title:!0,type:!0,useMap:!0,value:!0,width:!0,wmode:!0,autocapitalize:!0,autocorrect:!0,itemProp:!0,itemScope:Wa.BOOLEAN,itemType:!0,property:!0},attributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"}},$a=Ca,Xa=Ga.attributeTypes,Za=Ga.properties,Qa=Ga.attributeNames,Ka=(La=function(e){return $a(e)+'="'},Pa={},function(e){return Pa.hasOwnProperty(e)?Pa[e]:Pa[e]=La.call(this,e)});var es=Ca,ts=Fa,ns=ka,is=Ra,rs=Sa,us=Ma,as=Oa,ss=ja,os=function(e,t){return qa(e,t,"-")},ls=function(e,t,n){if(Za.hasOwnProperty(e)){if(function(e,t){var n=Za[e];return null==t||n===Xa.BOOLEAN&&!t||n===Xa.OVERLOADED_BOOLEAN&&!1===t}(e,t))return"";e=(Qa[e]||e).toLowerCase();var i=Za[e];return i===Xa.BOOLEAN||i===Xa.OVERLOADED_BOOLEAN&&!0===t?$a(e):Ka(e)+$a(t)+'"'}if(n)return null==t?"":Ka(e)+$a(t)+'"';return null},cs={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},hs=fs;function fs(e,t){return e?(rs(e)&&(e=e.render()),us(e)&&e.render&&(e=e.render()),ns(e)?function(e){var t=e.properties,n="<"+e.tagName.toLowerCase();for(var i in t){var r=t[i];if(null!=r)if("attributes"!=i)if("dataset"!=i){if("style"==i){var u="";for(var a in r=ts({},r))u+=os(a)+": "+r[a]+"; ";r=u.trim()}if(r instanceof as||r instanceof ss)n+=" "+ls(i,r.value,!0);else{var s=ls(i,r);s&&(n+=" "+s)}}else for(var o in r=ts({},r))n+=" "+ls("data-"+os(o),r[o],!0);else for(var l in r=ts({},r))n+=" "+ls(l,r[l],!0)}return n+">"}(e)+function(e){var t=e.properties.innerHTML;if(null!=t)return t;var n="";if(e.children&&e.children.length)for(var i=0,r=e.children.length;i"}(e):is(e)?!t||"script"!==t.tagName.toLowerCase()&&"style"!==t.tagName.toLowerCase()?es(String(e.text)):String(e.text):""):""}var gs=H("plot:render:svg:marks:lines");var ds=H("plot:render:svg:marks:symbols");function ps(e,t){return"top"===e?"translate(0,0)":"translate(0,"+t+")"}var ms=H("plot:render:svg:marks:x-rug");function ys(e,t){return"left"===e?"translate(0,0)":"translate("+t+",0)"}var vs=H("plot:render:svg:marks:y-rug");var _s=H("plot:render:svg:marks");function bs(e){var t,n,i;if(_s("Rendering marks group..."),t=e.$.svg.marks.render(),0===e.x.length)return _s("No individual marks to render."),t;for(n=[],_s("Rendering lines..."),n=n.concat(function(e){var t,n,i,r,u,a,s,o,l,c,h,f;for(c=e.$.svg.path,t=e.lineOpacity.length,u=e.lineStyle.length,a=e.lineWidth.length,r=e.colors.length,h=e.x.length,l=[],gs("Rendering lines..."),f=0;f>>0:u>>>0;(s=r.exec(t))&&!((o=s.index+s[0].length)>f&&(c.push(t.slice(f,s.index)),!i&&s.length>1&&s[0].replace(a,(function(){for(var t=1;t1&&s.index=u));)r.lastIndex===s.index&&r.lastIndex++;return f===t.length?!l&&r.test("")||c.push(""):c.push(t.slice(f)),c.length>u?c.slice(0,u):c},t}(),zs=/([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/,Ls=/^\.|#/,Ps=function(e,t){if(!e)return"DIV";var n,i,r,u,a=!t.hasOwnProperty("id"),s=js(e,zs),o=null;Ls.test(s[1])&&(o="DIV");for(u=0;u Transform: %s.",t,n),n}}(t):function(e){return function(t){var n="translate(0,"+e(t)+")";return Ch("Value: %s => Transform: %s.",t,n),n}}(t)}function Dh(e){return"left"===e||"right"===e?"x":"y"}function Th(e){return"left"===e||"right"===e?"y":"x"}var Bh=co,kh=H("axis:components:line"),Nh="line";function Rh(e){return"top"===e?"0em":"bottom"===e?".71em":".32em"}var Sh=co,Mh=H("axis:components:text"),Oh="text";var Vh=co,jh=H("axis:components:tick"),zh="g";function Lh(e,t,n){var i,r;return r={namespace:"http://www.w3.org/2000/svg",property:"axis.tick",className:"tick",attributes:{opacity:1,transform:n(t)}},i=new Array(2),jh("Rendering a tick line..."),i[0]=function(e){var t,n,i;return t={namespace:"http://www.w3.org/2000/svg",attributes:{stroke:"#aaa","stroke-width":1}},n=Dh(e._orientation),i=Th(e._orientation),t.attributes[n+"2"]=e.tickDir*e._innerTickSize,t.attributes[i+"1"]=.5,t.attributes[i+"2"]=.5,kh("Generating a virtual DOM tree (%s) with properties: %s.",Nh,JSON.stringify(t)),Bh(Nh,t,[])}(e),jh("Rendering tick text..."),i[1]=function(e,t){var n,i,r,u,a;return n=e._orientation,Mh("Axis orientation: %s.",n),i={namespace:"http://www.w3.org/2000/svg",attributes:{fill:"#000",dy:Rh(n)}},u=Dh(n),a=Th(n),i.attributes[u]=e.tickDir*e.tickSpacing,i.attributes[a]=.5,r=e.tickFormat(t),Mh("Tick text: %s.",r),Mh("Generating a virtual DOM tree (%s) with properties: %s.",Oh,JSON.stringify(i)),Sh(Oh,i,r)}(e,t),jh("Generating a virtual DOM tree (%s) with properties: %s.",zh,JSON.stringify(r)),Vh(zh,r,i)}var Ph=H("axis:components:ticks");function Jh(e){return"bottom"===e||"top"===e?"rotate(0)":"left"===e?"rotate(-90)":"rotate(90)"}function Uh(e,t){return"left"===e||"right"===e?-t[0]/2:t[1]/2}function Ih(e){return"left"===e?-72:"right"===e?72:"bottom"===e?45:-45}var Yh=co,Hh=H("axis:components:label"),qh="text";var Wh=co,Gh=H("axis:components:main"),$h="g";function Xh(e){var t,n,i;return n={namespace:"http://www.w3.org/2000/svg",property:"axis",className:"axis",attributes:{fill:"none","font-size":10,"font-family":"sans-serif","text-anchor":(i=e._orientation,"left"===i?"end":"right"===i?"start":"middle")}},Gh("Rendering tick marks..."),t=function(e){var t,n,i,r;for(n=e.ticks,Ph("Tick values: %s.",JSON.stringify(n)),Ph("Generating tick transform..."),t=Fh(e._orientation,e._scale),Ph("Rendering ticks..."),i=new Array(n.length),r=0;r Coordinate: %d",t,n),n}}():e}}),n(nf.prototype,"autoRender",{configurable:!1,enumerable:!0,set:function(e){var t=Oc(e);if(t)throw t;_h("Current value: %d.",this._autoRender),this._autoRender=e,_h("New Value: %d.",this._autoRender),this.emit(bh)},get:function(){return this._autoRender}}),i(nf.prototype,"render",(function(){var e;return Zh("Rendering..."),e=Xh(this),this.emit("_render",e),e}));var rf=H("path:accessor:is-defined");function uf(e){var t=!f(e);return rf("Datum: %s. Defined: %s.",JSON.stringify(e),t),t}var af={autoRender:!1,color:"#000",isDefined:null,label:"",opacity:.9,style:"-",width:2,x:[],xScale:null,y:[],yScale:null},sf=H("path:set:x");var of=H("path:set:y");var lf=H("path:set:xscale");var cf=H("path:set:yscale");var hf=H("path:set:is-defined");var ff=H("path:set:color");var gf=H("path:set:label");var df=H("path:set:opacity");var pf=H("path:set:width");var mf=H("path:set:style");var yf=H("path:set:auto-render");var vf=Math.PI,_f=2*vf,bf=1e-6,wf=_f-bf;function xf(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Af(){return new xf}function Ef(e){return function(){return e}}xf.prototype=Af.prototype={constructor:xf,moveTo:function(e,t){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,t){this._+="L"+(this._x1=+e)+","+(this._y1=+t)},quadraticCurveTo:function(e,t,n,i){this._+="Q"+ +e+","+ +t+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(e,t,n,i,r,u){this._+="C"+ +e+","+ +t+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+u)},arcTo:function(e,t,n,i,r){e=+e,t=+t,n=+n,i=+i,r=+r;var u=this._x1,a=this._y1,s=n-e,o=i-t,l=u-e,c=a-t,h=l*l+c*c;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=e)+","+(this._y1=t);else if(h>bf)if(Math.abs(c*s-o*l)>bf&&r){var f=n-u,g=i-a,d=s*s+o*o,p=f*f+g*g,m=Math.sqrt(d),y=Math.sqrt(h),v=r*Math.tan((vf-Math.acos((d+h-p)/(2*m*y)))/2),_=v/y,b=v/m;Math.abs(_-1)>bf&&(this._+="L"+(e+_*l)+","+(t+_*c)),this._+="A"+r+","+r+",0,0,"+ +(c*f>l*g)+","+(this._x1=e+b*s)+","+(this._y1=t+b*o)}else this._+="L"+(this._x1=e)+","+(this._y1=t);else;},arc:function(e,t,n,i,r,u){e=+e,t=+t,u=!!u;var a=(n=+n)*Math.cos(i),s=n*Math.sin(i),o=e+a,l=t+s,c=1^u,h=u?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+o+","+l:(Math.abs(this._x1-o)>bf||Math.abs(this._y1-l)>bf)&&(this._+="L"+o+","+l),n&&(h<0&&(h=h%_f+_f),h>wf?this._+="A"+n+","+n+",0,1,"+c+","+(e-a)+","+(t-s)+"A"+n+","+n+",0,1,"+c+","+(this._x1=o)+","+(this._y1=l):h>bf&&(this._+="A"+n+","+n+",0,"+ +(h>=vf)+","+c+","+(this._x1=e+n*Math.cos(r))+","+(this._y1=t+n*Math.sin(r))))},rect:function(e,t,n,i){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};var Cf=Math.abs,Ff=Math.atan2,Df=Math.cos,Tf=Math.max,Bf=Math.min,kf=Math.sin,Nf=Math.sqrt,Rf=1e-12,Sf=Math.PI,Mf=Sf/2,Of=2*Sf;function Vf(e){return e>=1?Mf:e<=-1?-Mf:Math.asin(e)}function jf(e){return e.innerRadius}function zf(e){return e.outerRadius}function Lf(e){return e.startAngle}function Pf(e){return e.endAngle}function Jf(e){return e&&e.padAngle}function Uf(e,t,n,i,r,u,a){var s=e-n,o=t-i,l=(a?u:-u)/Nf(s*s+o*o),c=l*o,h=-l*s,f=e+c,g=t+h,d=n+c,p=i+h,m=(f+d)/2,y=(g+p)/2,v=d-f,_=p-g,b=v*v+_*_,w=r-u,x=f*p-d*g,A=(_<0?-1:1)*Nf(Tf(0,w*w*b-x*x)),E=(x*_-v*A)/b,C=(-x*v-_*A)/b,F=(x*_+v*A)/b,D=(-x*v+_*A)/b,T=E-m,B=C-y,k=F-m,N=D-y;return T*T+B*B>k*k+N*N&&(E=F,C=D),{cx:E,cy:C,x01:-c,y01:-h,x11:E*(r/w-1),y11:C*(r/w-1)}}function If(e){this._context=e}function Yf(e){return new If(e)}function Hf(e){return e[0]}function qf(e){return e[1]}function Wf(){var e=Hf,t=qf,n=Ef(!0),i=null,r=Yf,u=null;function a(a){var s,o,l,c=a.length,h=!1;for(null==i&&(u=r(l=Af())),s=0;s<=c;++s)!(s=c;--h)s.point(m[h],y[h]);s.lineEnd(),s.areaEnd()}p&&(m[l]=+e(f,l,o),y[l]=+n(f,l,o),s.point(t?+t(f,l,o):m[l],i?+i(f,l,o):y[l]))}if(g)return s=null,g+""||null}function l(){return Wf().defined(r).curve(a).context(u)}return o.x=function(n){return arguments.length?(e="function"==typeof n?n:Ef(+n),t=null,o):e},o.x0=function(t){return arguments.length?(e="function"==typeof t?t:Ef(+t),o):e},o.x1=function(e){return arguments.length?(t=null==e?null:"function"==typeof e?e:Ef(+e),o):t},o.y=function(e){return arguments.length?(n="function"==typeof e?e:Ef(+e),i=null,o):n},o.y0=function(e){return arguments.length?(n="function"==typeof e?e:Ef(+e),o):n},o.y1=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:Ef(+e),o):i},o.lineX0=o.lineY0=function(){return l().x(e).y(n)},o.lineY1=function(){return l().x(e).y(i)},o.lineX1=function(){return l().x(t).y(n)},o.defined=function(e){return arguments.length?(r="function"==typeof e?e:Ef(!!e),o):r},o.curve=function(e){return arguments.length?(a=e,null!=u&&(s=a(u)),o):a},o.context=function(e){return arguments.length?(null==e?u=s=null:s=a(u=e),o):u},o}function $f(e,t){return te?1:t>=e?0:NaN}function Xf(e){return e}If.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};var Zf=Kf(Yf);function Qf(e){this._curve=e}function Kf(e){function t(t){return new Qf(e(t))}return t._curve=e,t}function eg(e){var t=e.curve;return e.angle=e.x,delete e.x,e.radius=e.y,delete e.y,e.curve=function(e){return arguments.length?t(Kf(e)):t()._curve},e}function tg(){return eg(Wf().curve(Zf))}function ng(){var e=Gf().curve(Zf),t=e.curve,n=e.lineX0,i=e.lineX1,r=e.lineY0,u=e.lineY1;return e.angle=e.x,delete e.x,e.startAngle=e.x0,delete e.x0,e.endAngle=e.x1,delete e.x1,e.radius=e.y,delete e.y,e.innerRadius=e.y0,delete e.y0,e.outerRadius=e.y1,delete e.y1,e.lineStartAngle=function(){return eg(n())},delete e.lineX0,e.lineEndAngle=function(){return eg(i())},delete e.lineX1,e.lineInnerRadius=function(){return eg(r())},delete e.lineY0,e.lineOuterRadius=function(){return eg(u())},delete e.lineY1,e.curve=function(e){return arguments.length?t(Kf(e)):t()._curve},e}function ig(e,t){return[(t=+t)*Math.cos(e-=Math.PI/2),t*Math.sin(e)]}Qf.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(e,t){this._curve.point(t*Math.sin(e),t*-Math.cos(e))}};var rg=Array.prototype.slice;function ug(e){return e.source}function ag(e){return e.target}function sg(e){var t=ug,n=ag,i=Hf,r=qf,u=null;function a(){var a,s=rg.call(arguments),o=t.apply(this,s),l=n.apply(this,s);if(u||(u=a=Af()),e(u,+i.apply(this,(s[0]=o,s)),+r.apply(this,s),+i.apply(this,(s[0]=l,s)),+r.apply(this,s)),a)return u=null,a+""||null}return a.source=function(e){return arguments.length?(t=e,a):t},a.target=function(e){return arguments.length?(n=e,a):n},a.x=function(e){return arguments.length?(i="function"==typeof e?e:Ef(+e),a):i},a.y=function(e){return arguments.length?(r="function"==typeof e?e:Ef(+e),a):r},a.context=function(e){return arguments.length?(u=null==e?null:e,a):u},a}function og(e,t,n,i,r){e.moveTo(t,n),e.bezierCurveTo(t=(t+i)/2,n,t,r,i,r)}function lg(e,t,n,i,r){e.moveTo(t,n),e.bezierCurveTo(t,n=(n+r)/2,i,n,i,r)}function cg(e,t,n,i,r){var u=ig(t,n),a=ig(t,n=(n+r)/2),s=ig(i,n),o=ig(i,r);e.moveTo(u[0],u[1]),e.bezierCurveTo(a[0],a[1],s[0],s[1],o[0],o[1])}var hg={draw:function(e,t){var n=Math.sqrt(t/Sf);e.moveTo(n,0),e.arc(0,0,n,0,Of)}},fg={draw:function(e,t){var n=Math.sqrt(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},gg=Math.sqrt(1/3),dg=2*gg,pg={draw:function(e,t){var n=Math.sqrt(t/dg),i=n*gg;e.moveTo(0,-n),e.lineTo(i,0),e.lineTo(0,n),e.lineTo(-i,0),e.closePath()}},mg=Math.sin(Sf/10)/Math.sin(7*Sf/10),yg=Math.sin(Of/10)*mg,vg=-Math.cos(Of/10)*mg,_g={draw:function(e,t){var n=Math.sqrt(.8908130915292852*t),i=yg*n,r=vg*n;e.moveTo(0,-n),e.lineTo(i,r);for(var u=1;u<5;++u){var a=Of*u/5,s=Math.cos(a),o=Math.sin(a);e.lineTo(o*n,-s*n),e.lineTo(s*i-o*r,o*i+s*r)}e.closePath()}},bg={draw:function(e,t){var n=Math.sqrt(t),i=-n/2;e.rect(i,i,n,n)}},wg=Math.sqrt(3),xg={draw:function(e,t){var n=-Math.sqrt(t/(3*wg));e.moveTo(0,2*n),e.lineTo(-wg*n,-n),e.lineTo(wg*n,-n),e.closePath()}},Ag=-.5,Eg=Math.sqrt(3)/2,Cg=1/Math.sqrt(12),Fg=3*(Cg/2+1),Dg={draw:function(e,t){var n=Math.sqrt(t/Fg),i=n/2,r=n*Cg,u=i,a=n*Cg+n,s=-u,o=a;e.moveTo(i,r),e.lineTo(u,a),e.lineTo(s,o),e.lineTo(Ag*i-Eg*r,Eg*i+Ag*r),e.lineTo(Ag*u-Eg*a,Eg*u+Ag*a),e.lineTo(Ag*s-Eg*o,Eg*s+Ag*o),e.lineTo(Ag*i+Eg*r,Ag*r-Eg*i),e.lineTo(Ag*u+Eg*a,Ag*a-Eg*u),e.lineTo(Ag*s+Eg*o,Ag*o-Eg*s),e.closePath()}},Tg=[hg,fg,pg,bg,_g,xg,Dg];function Bg(){}function kg(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Ng(e){this._context=e}function Rg(e){this._context=e}function Sg(e){this._context=e}function Mg(e,t){this._basis=new Ng(e),this._beta=t}Ng.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:kg(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:kg(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},Rg.prototype={areaStart:Bg,areaEnd:Bg,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:kg(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},Sg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,i=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,i):this._context.moveTo(n,i);break;case 3:this._point=4;default:kg(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},Mg.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var i,r=e[0],u=t[0],a=e[n]-r,s=t[n]-u,o=-1;++o<=n;)i=o/n,this._basis.point(this._beta*e[o]+(1-this._beta)*(r+i*a),this._beta*t[o]+(1-this._beta)*(u+i*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var Og=function e(t){function n(e){return 1===t?new Ng(e):new Mg(e,t)}return n.beta=function(t){return e(+t)},n}(.85);function Vg(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function jg(e,t){this._context=e,this._k=(1-t)/6}jg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Vg(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Vg(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var zg=function e(t){function n(e){return new jg(e,t)}return n.tension=function(t){return e(+t)},n}(0);function Lg(e,t){this._context=e,this._k=(1-t)/6}Lg.prototype={areaStart:Bg,areaEnd:Bg,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Vg(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Pg=function e(t){function n(e){return new Lg(e,t)}return n.tension=function(t){return e(+t)},n}(0);function Jg(e,t){this._context=e,this._k=(1-t)/6}Jg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Vg(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Ug=function e(t){function n(e){return new Jg(e,t)}return n.tension=function(t){return e(+t)},n}(0);function Ig(e,t,n){var i=e._x1,r=e._y1,u=e._x2,a=e._y2;if(e._l01_a>Rf){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,o=3*e._l01_a*(e._l01_a+e._l12_a);i=(i*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/o,r=(r*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/o}if(e._l23_a>Rf){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,c=3*e._l23_a*(e._l23_a+e._l12_a);u=(u*l+e._x1*e._l23_2a-t*e._l12_2a)/c,a=(a*l+e._y1*e._l23_2a-n*e._l12_2a)/c}e._context.bezierCurveTo(i,r,u,a,e._x2,e._y2)}function Yg(e,t){this._context=e,this._alpha=t}Yg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Ig(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Hg=function e(t){function n(e){return t?new Yg(e,t):new jg(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function qg(e,t){this._context=e,this._alpha=t}qg.prototype={areaStart:Bg,areaEnd:Bg,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Ig(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Wg=function e(t){function n(e){return t?new qg(e,t):new Lg(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Gg(e,t){this._context=e,this._alpha=t}Gg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Ig(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var $g=function e(t){function n(e){return t?new Gg(e,t):new Jg(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Xg(e){this._context=e}function Zg(e){return e<0?-1:1}function Qg(e,t,n){var i=e._x1-e._x0,r=t-e._x1,u=(e._y1-e._y0)/(i||r<0&&-0),a=(n-e._y1)/(r||i<0&&-0),s=(u*r+a*i)/(i+r);return(Zg(u)+Zg(a))*Math.min(Math.abs(u),Math.abs(a),.5*Math.abs(s))||0}function Kg(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function ed(e,t,n){var i=e._x0,r=e._y0,u=e._x1,a=e._y1,s=(u-i)/3;e._context.bezierCurveTo(i+s,r+s*t,u-s,a-s*n,u,a)}function td(e){this._context=e}function nd(e){this._context=new id(e)}function id(e){this._context=e}function rd(e){this._context=e}function ud(e){var t,n,i=e.length-1,r=new Array(i),u=new Array(i),a=new Array(i);for(r[0]=0,u[0]=2,a[0]=e[0]+2*e[1],t=1;t=0;--t)r[t]=(a[t]-r[t+1])/u[t];for(u[i-1]=(e[i]+r[i-1])/2,t=0;t1)for(var n,i,r,u=1,a=e[t[0]],s=a.length;u=0;)n[t]=t;return n}function ld(e,t){return e[t]}function cd(e){var t=e.map(hd);return od(e).sort((function(e,n){return t[e]-t[n]}))}function hd(e){for(var t,n=-1,i=0,r=e.length,u=-1/0;++nu&&(u=t,i=n);return i}function fd(e){var t=e.map(gd);return od(e).sort((function(e,n){return t[e]-t[n]}))}function gd(e){for(var t,n=0,i=-1,r=e.length;++i=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};var dd=Object.freeze({__proto__:null,arc:function(){var e=jf,t=zf,n=Ef(0),i=null,r=Lf,u=Pf,a=Jf,s=null;function o(){var o,l,c=+e.apply(this,arguments),h=+t.apply(this,arguments),f=r.apply(this,arguments)-Mf,g=u.apply(this,arguments)-Mf,d=Cf(g-f),p=g>f;if(s||(s=o=Af()),hRf)if(d>Of-Rf)s.moveTo(h*Df(f),h*kf(f)),s.arc(0,0,h,f,g,!p),c>Rf&&(s.moveTo(c*Df(g),c*kf(g)),s.arc(0,0,c,g,f,p));else{var m,y,v=f,_=g,b=f,w=g,x=d,A=d,E=a.apply(this,arguments)/2,C=E>Rf&&(i?+i.apply(this,arguments):Nf(c*c+h*h)),F=Bf(Cf(h-c)/2,+n.apply(this,arguments)),D=F,T=F;if(C>Rf){var B=Vf(C/c*kf(E)),k=Vf(C/h*kf(E));(x-=2*B)>Rf?(b+=B*=p?1:-1,w-=B):(x=0,b=w=(f+g)/2),(A-=2*k)>Rf?(v+=k*=p?1:-1,_-=k):(A=0,v=_=(f+g)/2)}var N=h*Df(v),R=h*kf(v),S=c*Df(w),M=c*kf(w);if(F>Rf){var O,V=h*Df(_),j=h*kf(_),z=c*Df(b),L=c*kf(b);if(d1?0:e<-1?Sf:Math.acos(e)}((P*U+J*I)/(Nf(P*P+J*J)*Nf(U*U+I*I)))/2),H=Nf(O[0]*O[0]+O[1]*O[1]);D=Bf(F,(c-H)/(Y-1)),T=Bf(F,(h-H)/(Y+1))}}A>Rf?T>Rf?(m=Uf(z,L,N,R,h,T,p),y=Uf(V,j,S,M,h,T,p),s.moveTo(m.cx+m.x01,m.cy+m.y01),TRf&&x>Rf?D>Rf?(m=Uf(S,M,V,j,c,-D,p),y=Uf(N,R,z,L,c,-D,p),s.lineTo(m.cx+m.x01,m.cy+m.y01),D0&&(g+=h);for(null!=t?d.sort((function(e,n){return t(p[e],p[n])})):null!=n&&d.sort((function(e,t){return n(a[e],a[t])})),s=0,l=g?(y-f*_)/g:0;s0?h*l:0)+_,p[o]={data:a[o],index:s,value:h,startAngle:m,endAngle:c,padAngle:v};return p}return a.value=function(t){return arguments.length?(e="function"==typeof t?t:Ef(+t),a):e},a.sortValues=function(e){return arguments.length?(t=e,n=null,a):t},a.sort=function(e){return arguments.length?(n=e,t=null,a):n},a.startAngle=function(e){return arguments.length?(i="function"==typeof e?e:Ef(+e),a):i},a.endAngle=function(e){return arguments.length?(r="function"==typeof e?e:Ef(+e),a):r},a.padAngle=function(e){return arguments.length?(u="function"==typeof e?e:Ef(+e),a):u},a},pointRadial:ig,radialArea:ng,radialLine:tg,stack:function(){var e=Ef([]),t=od,n=sd,i=ld;function r(r){var u,a,s=e.apply(this,arguments),o=r.length,l=s.length,c=new Array(l);for(u=0;u0)for(var n,i,r,u,a,s,o=0,l=e[t[0]].length;o0?(i[0]=u,i[1]=u+=r):r<0?(i[1]=a,i[0]=a+=r):(i[0]=0,i[1]=r)},stackOffsetExpand:function(e,t){if((i=e.length)>0){for(var n,i,r,u=0,a=e[0].length;u0){for(var n,i=0,r=e[t[0]],u=r.length;i0&&(i=(n=e[t[0]]).length)>0){for(var n,i,r,u=0,a=1;a1)throw new RangeError(c("invalid assignment. `%s` must be a number on the interval: [0, 1]. Value: `%f`.","opacity",e));df("Current value: %d.",this._opacity),this._opacity=e,df("New Value: %d.",this._opacity),this.emit("change")},get:function(){return this._opacity}}),n(Bd.prototype,"width",{configurable:!1,enumerable:!0,set:function(e){if(!D(e))throw new TypeError(c("invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.","width",e));pf("Current value: %d.",this._width),this._width=e,pf("New Value: %d.",this._width),this.emit("change")},get:function(){return this._width}}),n(Bd.prototype,"style",{configurable:!1,enumerable:!0,set:function(e){if(!y(e))throw new TypeError(c("invalid assignment. `%s` must be a string. Value: `%s`.","style",e));mf("Current value: %d.",this._style),this._style=e,mf("New Value: %d.",this._style),this.emit("change")},get:function(){return this._style}}),n(Bd.prototype,"autoRender",{configurable:!1,enumerable:!0,set:function(e){if(!B(e))throw new TypeError(c("invalid assignment. `%s` must be a boolean. Value: `%s`.","autoRender",e));yf("Current value: %d.",this._autoRender),this._autoRender=e,yf("New Value: %d.",this._autoRender),this.emit("change")},get:function(){return this._autoRender}}),n(Bd.prototype,"line",{configurable:!1,enumerable:!0,get:function(){return pd().x(this.xPos).y(this.yPos).defined(this.isDefined)}}),n(Bd.prototype,"xPos",{configurable:!1,enumerable:!0,get:function(){var e=this.xScale;return function(t){var n=e(t[0]);return md("Value: %d => Pixel: %d.",t[0],n),n}}}),n(Bd.prototype,"yPos",{configurable:!1,enumerable:!0,get:function(){var e=this.yScale;return function(t){var n=e(t[1]);return yd("Value: %d => Pixel: %d.",t[1],n),n}}}),i(Bd.prototype,"render",(function(){var e,t;return xd("Rendering..."),e={namespace:"http://www.w3.org/2000/svg",property:"line",className:"path line",attributes:{d:this.line(vd(this._xData,this._yData)),fill:"none",stroke:this.color,"stroke-width":this.width,"stroke-opacity":this.opacity,"stroke-dasharray":bd(this.style),"data-label":this.label}},xd("Generating a virtual DOM tree (%s) with properties: %s.",Ad,JSON.stringify(e)),t=wd(Ad,e,[]),this.emit("_render",t),t}));var kd=H("symbols:accessor:is-defined");function Nd(e){var t=!f(e);return kd("Datum: %s. Defined: %s.",JSON.stringify(e),t),t}var Rd={autoRender:!1,color:"#000",isDefined:null,label:"",opacity:.9,size:6,symbol:"closed-circle",x:[],xScale:null,y:[],yScale:null},Sd=["closed-circle","open-circle"],Md=H("symbols:set:symbol");var Od=H("symbols:set:x");var Vd=H("symbols:set:y");var jd=H("symbols:set:xscale");var zd=H("symbols:set:yscale");var Ld=H("symbols:set:is-defined");var Pd=H("symbols:set:size");var Jd=H("symbols:set:opacity");var Ud=H("symbols:set:color");var Id=H("symbols:set:label");var Yd=H("symbols:set:auto-render");var Hd=H("symbols:xpos");var qd=H("symbols:ypos");var Wd=co,Gd=H("symbols:render:closed-circles"),$d="circle";var Xd=co,Zd=H("symbols:render:open-circles"),Qd="circle";var Kd=co,ep=H("symbols:render"),tp={"closed-circle":function(e){var t,n,i,r,u,a,s,o,l,c,h,f,g,d;for(Gd("Rendering closed circles..."),t=e.isDefined,n=e.opacity,i=e.label,r=e.color,a=e.size,s=e.xPos,o=e.yPos,f=e.x,g=e.y,l=[],d=0;d1))throw new RangeError(c("invalid assignment. `%s` must be a number on the interval: [0, 1]. Value: `%f`.","opacity",e));Jd("Current value: %d.",this._opacity),this._opacity=e,Jd("New Value: %d.",this._opacity),this.emit("change")},get:function(){var e=this;return A(this._opacity)?function(){return e._opacity}:this._opacity}}),n(sp.prototype,"color",{configurable:!1,enumerable:!0,set:function(e){if(!y(e)&&!m(e))throw new TypeError(c("invalid assignment. `%s` must be a string or a function. Value: `%s`.","color",e));Ud("Current value: %d.",this._color),this._color=e,Ud("New Value: %d.",this._color),this.emit("change")},get:function(){var e=this;return y(this._color)?function(){return e._color}:this._color}}),n(sp.prototype,"label",{configurable:!1,enumerable:!0,set:function(e){if(!y(e)&&!m(e))throw new TypeError(c("invalid assignment. `%s` must be a string or a function. Value: `%s`.","label",e));Id("Current value: %d.",this._label),this._label=e,Id("New Value: %d.",this._label),this.emit("change")},get:function(){var e=this;return y(this._label)?function(){return e._label}:this._label}}),n(sp.prototype,"autoRender",{configurable:!1,enumerable:!0,set:function(e){if(!B(e))throw new TypeError(c("invalid assignment. `%s` must be a boolean. Value: `%s`.","autoRender",e));Yd("Current value: %d.",this._autoRender),this._autoRender=e,Yd("New Value: %d.",this._autoRender),this.emit("change")},get:function(){return this._autoRender}}),n(sp.prototype,"xPos",{configurable:!1,enumerable:!0,get:function(){var e=this.xScale;return function(t){var n=e(t);return Hd("Value: %d => Pixel: %d.",t,n),n}}}),n(sp.prototype,"yPos",{configurable:!1,enumerable:!0,get:function(){var e=this.yScale;return function(t){var n=e(t);return qd("Value: %d => Pixel: %d.",t,n),n}}}),i(sp.prototype,"render",(function(){var e,t,n;return ep("Rendering..."),t={namespace:"http://www.w3.org/2000/svg",property:"symbols",className:"symbols"},ep("Symbol: %s.",this.symbol),e=(0,tp[this.symbol])(this),ep("Generating a virtual DOM tree (%s) with properties: %s.","g",JSON.stringify(t)),n=Kd("g",t,e),this.emit("_render",n),n}));var op=H("rug:accessor:is-defined");function lp(e){var t=!f(e);return op("Datum: %s. Defined: %s.",JSON.stringify(e),t),t}var cp={autoRender:!1,color:"#aaa",data:[],isDefined:null,label:"",opacity:.9,orientation:"bottom",scale:null,size:6},hp=H("rug:set:auto-render");var fp=H("rug:set:color");var gp=H("rug:set:data");var dp=H("rug:set:is-defined");var pp=H("rug:set:label");var mp=H("rug:set:opacity");var yp=["bottom","left","right","top"],vp=H("rug:set:orientation");var _p=H("rug:pos");var bp=H("rug:set:scale");var wp=H("rug:set:size");var xp=co,Ap=H("rug:render:ticks"),Ep="line";var Cp=co,Fp=H("rug:render");var Dp=Y.EventEmitter,Tp=H,Bp=Mu.scaleLinear,kp=Tp("rug:main"),Np=["_autoRender","_color","_data","_isDefined","_label","_opacity","_orientation","_scale","_size"];function Rp(e){var i,a,o,l,h;if(!R(this,Rp))return arguments.length?new Rp(e):new Rp;if(i=this,(o=u(cp)).isDefined=lp,o.scale=Bp(),arguments.length){if(!r(e))throw new TypeError(c("invalid argument. Options argument must be an object. Value: `%s`.",e));o=s(o,e)}for(kp("Creating an instance with the following configuration: %s.",JSON.stringify(o)),Dp.call(this),h=0;h1))throw new RangeError(c("invalid assignment. `%s` must be a number on the interval: [0, 1]. Value: `%f`.","opacity",e));e!==this._opacity&&(mp("Current value: %d.",this._opacity),this._opacity=e,mp("New Value: %d.",this._opacity),this.emit("change"))},get:function(){var e=this;return A(this._opacity)?function(){return e._opacity}:this._opacity}}),n(Rp.prototype,"orientation",{configurable:!1,enumerable:!0,set:function(e){if(-1===v(yp,e))throw new TypeError(c('invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.',"orientation",yp.join('", "'),e));e!==this._orientation&&(vp("Current value: %d.",this._orientation),this._orientation=e,vp("New Value: %d.",this._orientation),this.emit("change"))},get:function(){return this._orientation}}),n(Rp.prototype,"pos",{configurable:!1,enumerable:!0,get:function(){var e=this.scale;return function(t){var n=e(t);return _p("Value: %d => Pixel: %d.",t,n),n}}}),n(Rp.prototype,"scale",{configurable:!1,enumerable:!0,set:function(e){if(!m(e))throw new TypeError(c("invalid assignment. `%s` must be a function. Value: `%s`.","scale",e));e!==this._scale&&(bp("Current value: %s.",this._scale),this._scale=e,bp("New Value: %s.",this._scale),this.emit("change"))},get:function(){return this._scale}}),n(Rp.prototype,"size",{configurable:!1,enumerable:!0,set:function(e){if(!D(e))throw new TypeError(c("invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.","size",e));e!==this._size&&(wp("Current value: %d.",this._size),this._size=e,wp("New Value: %d.",this._size),this.emit("change"))},get:function(){return this._size}}),i(Rp.prototype,"render",(function(){var e,t,n;return Fp("Rendering..."),t={namespace:"http://www.w3.org/2000/svg",property:"rug",className:"rug"},e=function(e){var t,n,i,r,u,a,s,o,l,c,h;for(Ap("Rendering ticks..."),n=e.data,r=e.pos,s="left"===(h=e.orientation)||"right"===h?"x":"y",o=function(e){return"left"===e||"right"===e?"y":"x"}(e.orientation),u=function(e){return"bottom"===e||"right"===e?-1:1}(e.orientation),i=new Array(n.length),c=0;c2){if(!r(arguments[2]))throw new TypeError(c("invalid argument. Options argument must be an object. Value: `%s`.",arguments[2]));(e=u(arguments[2])).x=arguments[0],e.y=arguments[1]}for(o=Ip(o,e),Jp("Creating an instance with the following configuration: %s.",JSON.stringify(o)),Pp.call(this),g=0;g1)throw new RangeError(c("invalid assignment. A `%s` must be a number on the interval: [0, 1]. Value: `%f`.","lineOpacity",e[t]));ie("Current value: %s.",JSON.stringify(this._lineOpacity)),this._lineOpacity=e,ie("New Value: %s.",JSON.stringify(this._lineOpacity)),this.emit("change")},get:function(){return this._lineOpacity.slice()}}),n(Yp.prototype,"lineWidth",{configurable:!1,enumerable:!0,set:function(e){var t=w(e);if(!t&&!x(e))throw new TypeError(c("invalid assignment. `%s` must be a nonnegative integer or an array of nonnegative integers. Value: `%s`.","lineWidth",e));e=t?[e]:e.slice(),re("Current value: %s.",JSON.stringify(this._lineWidth)),this._lineWidth=e,re("New Value: %s.",JSON.stringify(this._lineWidth)),this.emit("change")},get:function(){return this._lineWidth.slice()}}),n(Yp.prototype,"symbols",{configurable:!1,enumerable:!0,set:function(e){var t,n=y(e);if(!n&&!p(e))throw new TypeError(c("invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.","symbols",e));for(e=n?[e]:e.slice(),t=0;t1)throw new RangeError(c("invalid assignment. A `%s` must be a number on the interval: [0, 1]. Value: `%f`.","symbolsOpacity",e[t]));oe("Current value: %s.",JSON.stringify(this._symbolsOpacity)),this._symbolsOpacity=e,oe("New Value: %s.",JSON.stringify(this._symbolsOpacity)),this.emit("change")},get:function(){return this._symbolsOpacity.slice()}}),n(Yp.prototype,"width",{configurable:!1,enumerable:!0,set:function(e){if(!C(e))throw new TypeError(c("invalid assignment. `%s` must be a positive number. Value: `%s`.","width",e));e!==this._width&&(le("Current value: %d.",this._width),this._width=e,le("New value: %d.",this._width),this.emit("change"))},get:function(){return this._width}}),n(Yp.prototype,"height",{configurable:!1,enumerable:!0,set:function(e){if(!F(e))throw new TypeError(c("invalid assignment. `%s` must be a positive number. Value: `%s`.","height",e));e!==this._height&&(ce("Current value: %d.",this._height),this._height=e,ce("New Value: %d.",this._height),this.emit("change"))},get:function(){return this._height}}),n(Yp.prototype,"paddingLeft",{configurable:!1,enumerable:!0,set:function(e){if(!D(e))throw new TypeError(c("invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.","paddingLeft",e));e!==this._paddingLeft&&(he("Current value: %d.",this._paddingLeft),this._paddingLeft=e,he("New value: %d.",this._paddingLeft),this.emit("change"))},get:function(){return this._paddingLeft}}),n(Yp.prototype,"paddingRight",{configurable:!1,enumerable:!0,set:function(e){if(!w(e))throw new TypeError(c("invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.","paddingRight",e));e!==this._paddingRight&&(fe("Current value: %d.",this._paddingRight),this._paddingRight=e,fe("New value: %d.",this._paddingRight),this.emit("change"))},get:function(){return this._paddingRight}}),n(Yp.prototype,"paddingTop",{configurable:!1,enumerable:!0,set:function(e){if(!w(e))throw new TypeError(c("invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.","paddingTop",e));e!==this._paddingTop&&(ge("Current value: %d.",this._paddingTop),this._paddingTop=e,ge("New value: %d.",this._paddingTop),this.emit("change"))},get:function(){return this._paddingTop}}),n(Yp.prototype,"paddingBottom",{configurable:!1,enumerable:!0,set:function(e){if(!w(e))throw new TypeError(c("invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.","paddingBottom",e));e!==this._paddingBottom&&(de("Current value: %d.",this._paddingBottom),this._paddingBottom=e,de("New value: %d.",this._paddingBottom),this.emit("change"))},get:function(){return this._paddingBottom}}),n(Yp.prototype,"xMin",{configurable:!1,enumerable:!0,set:function(e){if(!T(e)&&!_(e))throw new TypeError(c("invalid assignment. `%s` must be a finite number, Date, or null. Value: `%s`.","xMin",e));pe("Current value: %s.",this._xMin),this._xMin=e,pe("New value: %s.",this._xMin),this.emit("change")},get:function(){var e;return T(this._xMin)?(e=function(e){var t,n;if(0===e.length)return null;for(t=new Array(e.length),n=0;n1)throw new RangeError(c("invalid assignment. A `%s` must be a number on the interval: [0, 1]. Value: `%f`.","xRugOpacity",e[t]));aa("Current value: %s.",JSON.stringify(this._xRugOpacity)),this._xRugOpacity=e,aa("New Value: %s.",JSON.stringify(this._xRugOpacity)),this.emit("change")},get:function(){return this._xRugOpacity.slice()}}),n(Yp.prototype,"yRugOpacity",{configurable:!1,enumerable:!0,set:function(e){var t,n=A(e);if(!n&&!b(e))throw new TypeError(c("invalid assignment. `%s` must be a number or an array of numbers. Value: `%s`.","yRugOpacity",e));for(e=n?[e]:e.slice(),t=0;t1)throw new RangeError(c("invalid assignment. A `%s` must be a number on the interval: [0, 1]. Value: `%f`.","yRugOpacity",e[t]));sa("Current value: %s.",JSON.stringify(this._yRugOpacity)),this._yRugOpacity=e,sa("New Value: %s.",JSON.stringify(this._yRugOpacity)),this.emit("change")},get:function(){return this._yRugOpacity.slice()}}),n(Yp.prototype,"xRugSize",{configurable:!1,enumerable:!0,set:function(e){var t=D(e);if(!t&&!x(e))throw new TypeError(c("invalid assignment. `%s` must be a nonnegative integer or an array of nonnegative integers. Value: `%s`.","xRugSize",e));e=t?[e]:e.slice(),oa("Current value: %s.",JSON.stringify(this._xRugSize)),this._xRugSize=e,oa("New Value: %s.",JSON.stringify(this._xRugSize)),this.emit("change")},get:function(){return this._xRugSize.slice()}}),n(Yp.prototype,"yRugSize",{configurable:!1,enumerable:!0,set:function(e){var t=D(e);if(!t&&!x(e))throw new TypeError(c("invalid assignment. `%s` must be a nonnegative integer or an array of nonnegative integers. Value: `%s`.","yRugSize",e));e=t?[e]:e.slice(),la("Current value: %s.",JSON.stringify(this._yRugSize)),this._yRugSize=e,la("New Value: %s.",JSON.stringify(this._yRugSize)),this.emit("change")},get:function(){return this._yRugSize.slice()}}),n(Yp.prototype,"description",{configurable:!1,enumerable:!0,set:function(e){if(!y(e))throw new TypeError(c("invalid assignment. `%s` must be a string. Value: `%s`.","description",e));e!==this._description&&(ca("Current value: %s.",this._description),this._description=e,ca("New value: %s.",this._description),this.emit("change"))},get:function(){return this._description}}),n(Yp.prototype,"title",{configurable:!1,enumerable:!0,set:function(e){if(!y(e))throw new TypeError(c("invalid assignment. `%s` must be a string. Value: `%s`.","title",e));e!==this._title&&(ha("Current value: %s.",this._title),this._title=e,ha("New value: %s.",this._title),this.emit("change"))},get:function(){return this._title}}),n(Yp.prototype,"xLabel",{configurable:!1,enumerable:!0,set:function(e){if(!y(e))throw new TypeError(c("invalid assignment. `%s` must be a string. Value: `%s`.","xLabel",e));e!==this._xLabel&&(fa("Current value: %s.",this._xLabel),this._xLabel=e,fa("New value: %s.",this._xLabel),this.emit("change"))},get:function(){return this._xLabel}}),n(Yp.prototype,"yLabel",{configurable:!1,enumerable:!0,set:function(e){if(!y(e))throw new TypeError(c("invalid assignment. `%s` must be a string. Value: `%s`.","yLabel",e));e!==this._yLabel&&(ga("Current value: %s.",this._yLabel),this._yLabel=e,ga("New value: %s.",this._yLabel),this.emit("change"))},get:function(){return this._yLabel}}),n(Yp.prototype,"engine",{configurable:!1,enumerable:!0,set:function(e){if(!N(da,e))throw new TypeError(c('invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.',"engine",da.join('", "'),e));e!==this._engine&&(pa("Current value: %s.",this._engine),this._engine=e,pa("New value: %s.",this._engine),this.emit("change"))},get:function(){return this._engine}}),n(Yp.prototype,"autoRender",{configurable:!1,enumerable:!0,set:function(e){if(!B(e))throw new TypeError(c("invalid assignment. `%s` must be a boolean. Value: `%s`.","autoRender",e));e!==this._autoRender&&(ma("Current value: %s.",this._autoRender),this._autoRender=e,ma("New Value: %s.",this._autoRender),this.emit("change"))},get:function(){return this._autoRender}}),n(Yp.prototype,"renderFormat",{configurable:!1,enumerable:!0,set:function(e){if(-1===v(ya,e))throw new TypeError(c('invalid assignment. Unrecognized/unsupported `%s`. Must be one of the following: "%s". Value: `%s`.',"format",ya.join('", "'),e));e!==this._renderFormat&&(va("Current value: %s.",this._renderFormat),this._renderFormat=e,va("New value: %s.",this._renderFormat),this.emit("change"))},get:function(){return this._renderFormat}}),n(Yp.prototype,"viewer",{configurable:!1,enumerable:!0,set:function(e){if(-1===v(_a,e))throw new TypeError(c("invalid assignment. Unrecognized/unsupported `%s`. Value: `%s`.","viewer",e));e!==this._viewer&&(ba("Current value: %s.",this._viewer),this._viewer=e,ba("New value: %s.",this._viewer),this.emit("change"))},get:function(){return this._viewer}}),n(Yp.prototype,"autoView",{configurable:!1,enumerable:!0,set:function(e){if(!B(e))throw new TypeError(c("invalid assignment. `%s` must be a boolean. Value: `%s`.","autoView",e));e!==this._autoView&&(wa("Current value: %s.",this._autoView),this._autoView=e,wa("New Value: %s.",this._autoView),this.emit("change"))},get:function(){return this._autoView}}),n(Yp.prototype,"graphWidth",{configurable:!1,enumerable:!0,get:function(){return this._width-this._paddingLeft-this._paddingRight}}),n(Yp.prototype,"graphHeight",{configurable:!1,enumerable:!0,get:function(){return this._height-this._paddingTop-this._paddingBottom}}),n(Yp.prototype,"xDomain",{configurable:!1,enumerable:!0,get:function(){return[this.xMin,this.xMax]}}),n(Yp.prototype,"yDomain",{configurable:!1,enumerable:!0,get:function(){return[this.yMin,this.yMax]}}),n(Yp.prototype,"xRange",{configurable:!1,enumerable:!0,get:function(){return[0,this.graphWidth]}}),n(Yp.prototype,"yRange",{configurable:!1,enumerable:!0,get:function(){return[this.graphHeight,0]}}),n(Yp.prototype,"xPos",{configurable:!1,enumerable:!0,get:function(){var e=this.xScale;return function(t){var n=e(t);return xa("Value: %d => Pixel: %d.",t,n),n}}}),n(Yp.prototype,"yPos",{configurable:!1,enumerable:!0,get:function(){var e=this.yScale;return function(t){var n=e(t);return Aa("Value: %d => Pixel: %d.",t,n),n}}}),i(Yp.prototype,"render",(function(e){var t,n,i;return n=this.renderFormat,arguments.length?(this.renderFormat=e,i=e):i=n,zp("Validating render state..."),function(e){var t,n,i;if(t=e._xData,n=e._yData,t.length!==n.length)throw new Error(c("invalid state. x and y are different lengths. x length: `%u`. y length: `%u`.",t.length,n.length));for(i=0;i 1.0 ) {\n\t\t\tthrow new RangeError( format( 'invalid assignment. A `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'lineOpacity', v[i] ) );\n\t\t}\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._lineOpacity ) );\n\n\tthis._lineOpacity = v;\n\tdebug( 'New Value: %s.', JSON.stringify( this._lineOpacity ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { primitives as isNonNegativeIntegerArray } from '@stdlib/assert/is-nonnegative-integer-array';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:line-width' );\n\n\n// MAIN //\n\n/**\n* Sets the data line width(s).\n*\n* @private\n* @param {(NonNegativeInteger|Array)} v - width\n* @throws {TypeError} must be a nonnegative integer or nonnegative integer array\n* @returns {void}\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar isInt = isNonNegativeInteger( v );\n\tif ( !isInt && !isNonNegativeIntegerArray( v ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or an array of nonnegative integers. Value: `%s`.', 'lineWidth', v ) );\n\t}\n\tif ( isInt ) {\n\t\tv = [ v ];\n\t} else {\n\t\tv = v.slice();\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._lineWidth ) );\n\n\tthis._lineWidth = v;\n\tdebug( 'New Value: %s.', JSON.stringify( this._lineWidth ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport indexOf from '@stdlib/utils/index-of';\nimport format from '@stdlib/string/format';\nimport SYMBOLS from './symbols.json';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:symbols' );\n\n\n// MAIN //\n\n/**\n* Sets the data symbols.\n*\n* @private\n* @param {(string|StringArray)} v - data symbols\n* @throws {TypeError} must be a string or string array\n* @throws {Error} must be a supported symbol\n* @returns {void}\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar isStr = isString( v );\n\tvar i;\n\tif ( !isStr && !isStringArray( v ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.', 'symbols', v ) );\n\t}\n\tif ( isStr ) {\n\t\tv = [ v ];\n\t} else {\n\t\tv = v.slice();\n\t}\n\tfor ( i = 0; i < v.length; i++ ) {\n\t\tif ( indexOf( SYMBOLS, v[i] ) === -1 ) {\n\t\t\tthrow new Error( format( 'invalid assignment. Unrecognized/unsupported symbol. Value: `[%s]`.', v.join(',') ) );\n\t\t}\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._symbols ) );\n\n\tthis._symbols = v;\n\tdebug( 'New Value: %s.', JSON.stringify( this._symbols ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { primitives as isNonNegativeIntegerArray } from '@stdlib/assert/is-nonnegative-integer-array';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:symbols-size' );\n\n\n// MAIN //\n\n/**\n* Sets the symbols size.\n*\n* @private\n* @param {(NonNegativeInteger|Array)} v - size\n* @throws {TypeError} must be a nonnegative integer or nonnegative integer array\n* @returns {void}\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar isInt = isNonNegativeInteger( v );\n\tif ( !isInt && !isNonNegativeIntegerArray( v ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or an array of nonnegative integers. Value: `%s`.', 'symbolsSize', v ) );\n\t}\n\tif ( isInt ) {\n\t\tv = [ v ];\n\t} else {\n\t\tv = v.slice();\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._symbolsSize ) );\n\n\tthis._symbolsSize = v;\n\tdebug( 'New Value: %s.', JSON.stringify( this._symbolsSize ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport { primitives as isNumberArray } from '@stdlib/assert/is-number-array';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:symbols-opacity' );\n\n\n// MAIN //\n\n/**\n* Sets the symbol opacity.\n*\n* @private\n* @param {(number|NumberArray)} v - opacity\n* @throws {TypeError} must be a number or number array\n* @throws {RangeError} must be a number on the interval `[0,1]`\n* @returns {void}\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar isNum = isNumber( v );\n\tvar i;\n\tif ( !isNum && !isNumberArray( v ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a number or an array of numbers. Value: `%s`.', 'symbolsOpacity', v ) );\n\t}\n\tif ( isNum ) {\n\t\tv = [ v ];\n\t} else {\n\t\tv = v.slice();\n\t}\n\tfor ( i = 0; i < v.length; i++ ) {\n\t\tif ( v[ i ] < 0.0 || v[ i ] > 1.0 ) {\n\t\t\tthrow new RangeError( format( 'invalid assignment. A `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'symbolsOpacity', v[ i ] ) );\n\t\t}\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._symbolsOpacity ) );\n\n\tthis._symbolsOpacity = v;\n\tdebug( 'New Value: %s.', JSON.stringify( this._symbolsOpacity ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isPositiveNumber } from '@stdlib/assert/is-positive-number';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:width' );\n\n\n// MAIN //\n\n/**\n* Sets the width.\n*\n* @private\n* @param {PositiveNumber} width - width\n* @throws {TypeError} must be a positive number\n*/\nfunction set( width ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isPositiveNumber( width ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'width', width ) );\n\t}\n\tif ( width !== this._width ) {\n\t\tdebug( 'Current value: %d.', this._width );\n\n\t\tthis._width = width;\n\t\tdebug( 'New value: %d.', this._width );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isPositiveNumber } from '@stdlib/assert/is-positive-number';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:height' );\n\n\n// MAIN //\n\n/**\n* Sets the height.\n*\n* @private\n* @param {PositiveNumber} height - height\n* @throws {TypeError} must be a positive number\n* @returns {void}\n*/\nfunction set( height ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isPositiveNumber( height ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'height', height ) );\n\t}\n\tif ( height !== this._height ) {\n\t\tdebug( 'Current value: %d.', this._height );\n\n\t\tthis._height = height;\n\t\tdebug( 'New Value: %d.', this._height );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:padding-left' );\n\n\n// MAIN //\n\n/**\n* Sets the left padding.\n*\n* @private\n* @param {NonNegativeInteger} padding - padding\n* @throws {TypeError} must be a nonnegative integer\n*/\nfunction set( padding ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isNonNegativeInteger( padding ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingLeft', padding ) );\n\t}\n\tif ( padding !== this._paddingLeft ) {\n\t\tdebug( 'Current value: %d.', this._paddingLeft );\n\n\t\tthis._paddingLeft = padding;\n\t\tdebug( 'New value: %d.', this._paddingLeft );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:padding-right' );\n\n\n// MAIN //\n\n/**\n* Sets the right padding.\n*\n* @private\n* @param {NonNegativeInteger} padding - padding\n* @throws {TypeError} must be a nonnegative integer\n*/\nfunction set( padding ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isNonNegativeInteger( padding ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingRight', padding ) );\n\t}\n\tif ( padding !== this._paddingRight ) {\n\t\tdebug( 'Current value: %d.', this._paddingRight );\n\n\t\tthis._paddingRight = padding;\n\t\tdebug( 'New value: %d.', this._paddingRight );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:padding-top' );\n\n\n// MAIN //\n\n/**\n* Sets the top padding.\n*\n* @private\n* @param {NonNegativeInteger} padding - padding\n* @throws {TypeError} must be a nonnegative integer\n*/\nfunction set( padding ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isNonNegativeInteger( padding ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingTop', padding ) );\n\t}\n\tif ( padding !== this._paddingTop ) {\n\t\tdebug( 'Current value: %d.', this._paddingTop );\n\n\t\tthis._paddingTop = padding;\n\t\tdebug( 'New value: %d.', this._paddingTop );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:padding-bottom' );\n\n\n// MAIN //\n\n/**\n* Sets the bottom padding.\n*\n* @private\n* @param {NonNegativeInteger} padding - padding\n* @throws {TypeError} must be a nonnegative integer\n*/\nfunction set( padding ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isNonNegativeInteger( padding ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'paddingBottom', padding ) );\n\t}\n\tif ( padding !== this._paddingBottom ) {\n\t\tdebug( 'Current value: %d.', this._paddingBottom );\n\n\t\tthis._paddingBottom = padding;\n\t\tdebug( 'New value: %d.', this._paddingBottom );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isNull from '@stdlib/assert/is-null';\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:x-min' );\n\n\n// MAIN //\n\n/**\n* Sets the minimum value of the x-axis domain.\n*\n* @private\n* @param {(Date|FiniteNumber|null)} min - minimum value\n* @throws {TypeError} must be a finite number or null\n* @returns {void}\n*/\nfunction set( min ) {\n\t/* eslint-disable no-invalid-this */\n\n\t// TODO: add test to determine if evaluates to valid date?\n\tif (\n\t\t!isNull( min ) &&\n\t\t!isNumber( min ) // FIXME: finite number\n\n\t\t// TODO: Date\n\t) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a finite number, Date, or null. Value: `%s`.', 'xMin', min ) );\n\t}\n\tdebug( 'Current value: %s.', this._xMin );\n\n\tthis._xMin = min;\n\tdebug( 'New value: %s.', this._xMin );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Computes a minimum value.\n*\n* @private\n* @param {NumericArray} arr - input array\n* @returns {(number|null)} minimum value or null\n*/\nfunction getMin( arr ) {\n\tvar min;\n\tvar i;\n\tif ( arr.length === 0 ) {\n\t\treturn null;\n\t}\n\tmin = arr[ 0 ];\n\tfor ( i = 1; i < arr.length; i++ ) {\n\t\tif ( arr[ i ] < min ) {\n\t\t\tmin = arr[ i ];\n\t\t}\n\t}\n\treturn min;\n}\n\n\n// EXPORTS //\n\nexport default getMin;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isNull from '@stdlib/assert/is-null';\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'line:set:x-max' );\n\n\n// MAIN //\n\n/**\n* Sets the maximum value of the x-axis domain.\n*\n* @private\n* @param {(Date|FiniteNumber|null)} max - maximum value\n* @throws {TypeError} must be a finite number primitive or null\n*/\nfunction set( max ) {\n\t/* eslint-disable no-invalid-this */\n\n\t// TODO: add test to determine if evaluates to valid date?\n\tif (\n\t\t!isNull( max ) &&\n\t\t!isNumber( max ) // FIXME: finite number\n\n\t\t// TODO: Date\n\t) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a finite number, Date, or null. Value: `%s`.', 'xMax', max ) );\n\t}\n\tif ( max !== this._xMax ) {\n\t\tdebug( 'Current value: %s.', this._xMax );\n\n\t\tthis._xMax = max;\n\t\tdebug( 'New value: %s.', this._xMax );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Computes a maximum value.\n*\n* @private\n* @param {NumericArray} arr - input array\n* @returns {(number|null)} maximum value or null\n*/\nfunction getMax( arr ) {\n\tvar max;\n\tvar i;\n\tif ( arr.length === 0 ) {\n\t\treturn null;\n\t}\n\tmax = arr[ 0 ];\n\tfor ( i = 1; i < arr.length; i++ ) {\n\t\tif ( arr[ i ] > max ) {\n\t\t\tmax = arr[ i ];\n\t\t}\n\t}\n\treturn max;\n}\n\n\n// EXPORTS //\n\nexport default getMax;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isNull from '@stdlib/assert/is-null';\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:y-min' );\n\n\n// MAIN //\n\n/**\n* Sets the minimum value of the y-axis domain.\n*\n* @private\n* @param {(FiniteNumber|null)} min - minimum value\n* @throws {TypeError} must be a finite number or null\n* @returns {void}\n*/\nfunction set( min ) {\n\t/* eslint-disable no-invalid-this */\n\tif (\n\t\t!isNull( min ) &&\n\t\t!isNumber( min ) // FIXME: finite number\n\t) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a number or null. Value: `%s`.', 'yMin', min ) );\n\t}\n\tif ( min !== this._yMin ) {\n\t\tdebug( 'Current value: %d.', this._yMin );\n\n\t\tthis._yMin = min;\n\t\tdebug( 'New value: %d.', this._yMin );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isNull from '@stdlib/assert/is-null';\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:y-max' );\n\n\n// MAIN //\n\n/**\n* Sets the maximum value of the y-axis domain.\n*\n* @private\n* @param {(FiniteNumber|null)} max - maximum value\n* @throws {TypeError} must be a finite number or null\n* @returns {void}\n*/\nfunction set( max ) {\n\t/* eslint-disable no-invalid-this */\n\tif (\n\t\t!isNull( max ) &&\n\t\t!isNumber( max ) // FIXME: finite number\n\t) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a number or null. Value: `%s`.', 'yMax', max ) );\n\t}\n\tif ( max !== this._yMax ) {\n\t\tdebug( 'Current value: %d.', this._yMax );\n\n\t\tthis._yMax = max;\n\t\tdebug( 'New value: %d.', this._yMax );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:x-scale' );\n\n\n// MAIN //\n\n/**\n* Sets the x-axis scale.\n*\n* @private\n* @param {string} scale - axis scale\n* @throws {TypeError} must be a string\n* @returns {void}\n*/\nfunction set( scale ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isString( scale ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'xScale', scale ) );\n\t}\n\t// TODO: test for valid scale\n\n\tif ( scale !== this._xScale ) {\n\t\tdebug( 'Current value: %s.', this._xScale );\n\n\t\tthis._xScale = scale;\n\t\tdebug( 'New value: %s.', this._xScale );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","export default function(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","import ascending from \"./ascending\";\n\nexport default function(compare) {\n if (compare.length === 1) compare = ascendingComparator(compare);\n return {\n left: function(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n },\n right: function(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (compare(a[mid], x) > 0) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n };\n}\n\nfunction ascendingComparator(f) {\n return function(d, x) {\n return ascending(f(d), x);\n };\n}\n","import ascending from \"./ascending\";\nimport bisector from \"./bisector\";\n\nvar ascendingBisect = bisector(ascending);\nexport var bisectRight = ascendingBisect.right;\nexport var bisectLeft = ascendingBisect.left;\nexport default bisectRight;\n","export default function(x) {\n return x === null ? NaN : +x;\n}\n","var e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nexport default function(start, stop, count) {\n var reverse,\n i = -1,\n n,\n ticks,\n step;\n\n stop = +stop, start = +start, count = +count;\n if (start === stop && count > 0) return [start];\n if (reverse = stop < start) n = start, start = stop, stop = n;\n if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];\n\n if (step > 0) {\n start = Math.ceil(start / step);\n stop = Math.floor(stop / step);\n ticks = new Array(n = Math.ceil(stop - start + 1));\n while (++i < n) ticks[i] = (start + i) * step;\n } else {\n start = Math.floor(start * step);\n stop = Math.ceil(stop * step);\n ticks = new Array(n = Math.ceil(start - stop + 1));\n while (++i < n) ticks[i] = (start - i) / step;\n }\n\n if (reverse) ticks.reverse();\n\n return ticks;\n}\n\nexport function tickIncrement(start, stop, count) {\n var step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log(step) / Math.LN10),\n error = step / Math.pow(10, power);\n return power >= 0\n ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)\n : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);\n}\n\nexport function tickStep(start, stop, count) {\n var step0 = Math.abs(stop - start) / Math.max(0, count),\n step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),\n error = step0 / step1;\n if (error >= e10) step1 *= 10;\n else if (error >= e5) step1 *= 5;\n else if (error >= e2) step1 *= 2;\n return stop < start ? -step1 : step1;\n}\n","import number from \"./number\";\n\nexport default function(values, p, valueof) {\n if (valueof == null) valueof = number;\n if (!(n = values.length)) return;\n if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);\n if (p >= 1) return +valueof(values[n - 1], n - 1, values);\n var n,\n i = (n - 1) * p,\n i0 = Math.floor(i),\n value0 = +valueof(values[i0], i0, values),\n value1 = +valueof(values[i0 + 1], i0 + 1, values);\n return value0 + (value1 - value0) * (i - i0);\n}\n","export var prefix = \"$\";\n\nfunction Map() {}\n\nMap.prototype = map.prototype = {\n constructor: Map,\n has: function(key) {\n return (prefix + key) in this;\n },\n get: function(key) {\n return this[prefix + key];\n },\n set: function(key, value) {\n this[prefix + key] = value;\n return this;\n },\n remove: function(key) {\n var property = prefix + key;\n return property in this && delete this[property];\n },\n clear: function() {\n for (var property in this) if (property[0] === prefix) delete this[property];\n },\n keys: function() {\n var keys = [];\n for (var property in this) if (property[0] === prefix) keys.push(property.slice(1));\n return keys;\n },\n values: function() {\n var values = [];\n for (var property in this) if (property[0] === prefix) values.push(this[property]);\n return values;\n },\n entries: function() {\n var entries = [];\n for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]});\n return entries;\n },\n size: function() {\n var size = 0;\n for (var property in this) if (property[0] === prefix) ++size;\n return size;\n },\n empty: function() {\n for (var property in this) if (property[0] === prefix) return false;\n return true;\n },\n each: function(f) {\n for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this);\n }\n};\n\nfunction map(object, f) {\n var map = new Map;\n\n // Copy constructor.\n if (object instanceof Map) object.each(function(value, key) { map.set(key, value); });\n\n // Index array by numeric index or specified key function.\n else if (Array.isArray(object)) {\n var i = -1,\n n = object.length,\n o;\n\n if (f == null) while (++i < n) map.set(i, object[i]);\n else while (++i < n) map.set(f(o = object[i], i, object), o);\n }\n\n // Convert object to map.\n else if (object) for (var key in object) map.set(key, object[key]);\n\n return map;\n}\n\nexport default map;\n","import {default as map, prefix} from \"./map\";\n\nfunction Set() {}\n\nvar proto = map.prototype;\n\nSet.prototype = set.prototype = {\n constructor: Set,\n has: proto.has,\n add: function(value) {\n value += \"\";\n this[prefix + value] = value;\n return this;\n },\n remove: proto.remove,\n clear: proto.clear,\n values: proto.keys,\n size: proto.size,\n empty: proto.empty,\n each: proto.each\n};\n\nfunction set(object, f) {\n var set = new Set;\n\n // Copy constructor.\n if (object instanceof Set) object.each(function(value) { set.add(value); });\n\n // Otherwise, assume it’s an array.\n else if (object) {\n var i = -1, n = object.length;\n if (f == null) while (++i < n) set.add(object[i]);\n else while (++i < n) set.add(f(object[i], i, object));\n }\n\n return set;\n}\n\nexport default set;\n","var array = Array.prototype;\n\nexport var map = array.map;\nexport var slice = array.slice;\n","import {map} from \"d3-collection\";\nimport {slice} from \"./array\";\n\nexport var implicit = {name: \"implicit\"};\n\nexport default function ordinal(range) {\n var index = map(),\n domain = [],\n unknown = implicit;\n\n range = range == null ? [] : slice.call(range);\n\n function scale(d) {\n var key = d + \"\", i = index.get(key);\n if (!i) {\n if (unknown !== implicit) return unknown;\n index.set(key, i = domain.push(d));\n }\n return range[(i - 1) % range.length];\n }\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [], index = map();\n var i = -1, n = _.length, d, key;\n while (++i < n) if (!index.has(key = (d = _[i]) + \"\")) index.set(key, domain.push(d));\n return scale;\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = slice.call(_), scale) : range.slice();\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n scale.copy = function() {\n return ordinal()\n .domain(domain)\n .range(range)\n .unknown(unknown);\n };\n\n return scale;\n}\n","import {range as sequence} from \"d3-array\";\nimport ordinal from \"./ordinal\";\n\nexport default function band() {\n var scale = ordinal().unknown(undefined),\n domain = scale.domain,\n ordinalRange = scale.range,\n range = [0, 1],\n step,\n bandwidth,\n round = false,\n paddingInner = 0,\n paddingOuter = 0,\n align = 0.5;\n\n delete scale.unknown;\n\n function rescale() {\n var n = domain().length,\n reverse = range[1] < range[0],\n start = range[reverse - 0],\n stop = range[1 - reverse];\n step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);\n if (round) step = Math.floor(step);\n start += (stop - start - step * (n - paddingInner)) * align;\n bandwidth = step * (1 - paddingInner);\n if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);\n var values = sequence(n).map(function(i) { return start + step * i; });\n return ordinalRange(reverse ? values.reverse() : values);\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = [+_[0], +_[1]], rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = [+_[0], +_[1]], round = true, rescale();\n };\n\n scale.bandwidth = function() {\n return bandwidth;\n };\n\n scale.step = function() {\n return step;\n };\n\n scale.round = function(_) {\n return arguments.length ? (round = !!_, rescale()) : round;\n };\n\n scale.padding = function(_) {\n return arguments.length ? (paddingInner = paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;\n };\n\n scale.paddingInner = function(_) {\n return arguments.length ? (paddingInner = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;\n };\n\n scale.paddingOuter = function(_) {\n return arguments.length ? (paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingOuter;\n };\n\n scale.align = function(_) {\n return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;\n };\n\n scale.copy = function() {\n return band()\n .domain(domain())\n .range(range)\n .round(round)\n .paddingInner(paddingInner)\n .paddingOuter(paddingOuter)\n .align(align);\n };\n\n return rescale();\n}\n\nfunction pointish(scale) {\n var copy = scale.copy;\n\n scale.padding = scale.paddingOuter;\n delete scale.paddingInner;\n delete scale.paddingOuter;\n\n scale.copy = function() {\n return pointish(copy());\n };\n\n return scale;\n}\n\nexport function point() {\n return pointish(band().paddingInner(1));\n}\n","export default function(start, stop, step) {\n start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;\n\n var i = -1,\n n = Math.max(0, Math.ceil((stop - start) / step)) | 0,\n range = new Array(n);\n\n while (++i < n) {\n range[i] = start + i * step;\n }\n\n return range;\n}\n","export default function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n}\n\nexport function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n","import define, {extend} from \"./define.js\";\n\nexport function Color() {}\n\nexport var darker = 0.7;\nexport var brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\",\n reN = \"\\\\s*([+-]?\\\\d*\\\\.?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",\n reP = \"\\\\s*([+-]?\\\\d*\\\\.?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",\n reHex = /^#([0-9a-f]{3,8})$/,\n reRgbInteger = new RegExp(\"^rgb\\\\(\" + [reI, reI, reI] + \"\\\\)$\"),\n reRgbPercent = new RegExp(\"^rgb\\\\(\" + [reP, reP, reP] + \"\\\\)$\"),\n reRgbaInteger = new RegExp(\"^rgba\\\\(\" + [reI, reI, reI, reN] + \"\\\\)$\"),\n reRgbaPercent = new RegExp(\"^rgba\\\\(\" + [reP, reP, reP, reN] + \"\\\\)$\"),\n reHslPercent = new RegExp(\"^hsl\\\\(\" + [reN, reP, reP] + \"\\\\)$\"),\n reHslaPercent = new RegExp(\"^hsla\\\\(\" + [reN, reP, reP, reN] + \"\\\\)$\");\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n copy: function(channels) {\n return Object.assign(new this.constructor, this, channels);\n },\n displayable: function() {\n return this.rgb().displayable();\n },\n hex: color_formatHex, // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n});\n\nfunction color_formatHex() {\n return this.rgb().formatHex();\n}\n\nfunction color_formatHsl() {\n return hslConvert(this).formatHsl();\n}\n\nfunction color_formatRgb() {\n return this.rgb().formatRgb();\n}\n\nexport default function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000\n : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00\n : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000\n : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000\n : null) // invalid hex\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nexport function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nexport function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nexport function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter: function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker: function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb: function() {\n return this;\n },\n displayable: function() {\n return (-0.5 <= this.r && this.r < 255.5)\n && (-0.5 <= this.g && this.g < 255.5)\n && (-0.5 <= this.b && this.b < 255.5)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex, // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n}));\n\nfunction rgb_formatHex() {\n return \"#\" + hex(this.r) + hex(this.g) + hex(this.b);\n}\n\nfunction rgb_formatRgb() {\n var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));\n return (a === 1 ? \"rgb(\" : \"rgba(\")\n + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + \", \"\n + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + \", \"\n + Math.max(0, Math.min(255, Math.round(this.b) || 0))\n + (a === 1 ? \")\" : \", \" + a + \")\");\n}\n\nfunction hex(value) {\n value = Math.max(0, Math.min(255, Math.round(value) || 0));\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n}\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nexport function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nexport function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter: function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker: function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb: function() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n displayable: function() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl: function() {\n var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));\n return (a === 1 ? \"hsl(\" : \"hsla(\")\n + (this.h || 0) + \", \"\n + (this.s || 0) * 100 + \"%, \"\n + (this.l || 0) * 100 + \"%\"\n + (a === 1 ? \")\" : \", \" + a + \")\");\n }\n}));\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n","export var deg2rad = Math.PI / 180;\nexport var rad2deg = 180 / Math.PI;\n","import define, {extend} from \"./define.js\";\nimport {Color, rgbConvert, Rgb, darker, brighter} from \"./color.js\";\nimport {deg2rad, rad2deg} from \"./math.js\";\n\nvar A = -0.14861,\n B = +1.78277,\n C = -0.29227,\n D = -0.90649,\n E = +1.97294,\n ED = E * D,\n EB = E * B,\n BC_DA = B * C - D * A;\n\nfunction cubehelixConvert(o) {\n if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),\n bl = b - l,\n k = (E * (g - l) - C * bl) / D,\n s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1\n h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;\n return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);\n}\n\nexport default function cubehelix(h, s, l, opacity) {\n return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);\n}\n\nexport function Cubehelix(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Cubehelix, cubehelix, extend(Color, {\n brighter: function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n darker: function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n rgb: function() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,\n l = +this.l,\n a = isNaN(this.s) ? 0 : this.s * l * (1 - l),\n cosh = Math.cos(h),\n sinh = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh + B * sinh)),\n 255 * (l + a * (C * cosh + D * sinh)),\n 255 * (l + a * (E * cosh)),\n this.opacity\n );\n }\n}));\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","import constant from \"./constant.js\";\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nexport function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);\n}\n\nexport function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);\n };\n}\n\nexport default function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant(isNaN(a) ? b : a);\n}\n","import {rgb as colorRgb} from \"d3-color\";\nimport basis from \"./basis.js\";\nimport basisClosed from \"./basisClosed.js\";\nimport nogamma, {gamma} from \"./color.js\";\n\nexport default (function rgbGamma(y) {\n var color = gamma(y);\n\n function rgb(start, end) {\n var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r),\n g = color(start.g, end.g),\n b = color(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb.gamma = rgbGamma;\n\n return rgb;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color;\n for (i = 0; i < n; ++i) {\n color = colorRgb(colors[i]);\n r[i] = color.r || 0;\n g[i] = color.g || 0;\n b[i] = color.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color.opacity = 1;\n return function(t) {\n color.r = r(t);\n color.g = g(t);\n color.b = b(t);\n return color + \"\";\n };\n };\n}\n\nexport var rgbBasis = rgbSpline(basis);\nexport var rgbBasisClosed = rgbSpline(basisClosed);\n","export default function(a, b) {\n if (!b) b = [];\n var n = a ? Math.min(b.length, a.length) : 0,\n c = b.slice(),\n i;\n return function(t) {\n for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;\n return c;\n };\n}\n\nexport function isNumberArray(x) {\n return ArrayBuffer.isView(x) && !(x instanceof DataView);\n}\n","import value from \"./value.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n return (isNumberArray(b) ? numberArray : genericArray)(a, b);\n}\n\nexport function genericArray(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(na),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n}\n","export default function(a, b) {\n var d = new Date;\n return a = +a, b = +b, function(t) {\n return d.setTime(a * (1 - t) + b * t), d;\n };\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n}\n","import value from \"./value.js\";\n\nexport default function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = value(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n}\n","import number from \"./number.js\";\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,\n reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nexport default function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: number(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n}\n","import {color} from \"d3-color\";\nimport rgb from \"./rgb.js\";\nimport {genericArray} from \"./array.js\";\nimport date from \"./date.js\";\nimport number from \"./number.js\";\nimport object from \"./object.js\";\nimport string from \"./string.js\";\nimport constant from \"./constant.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant(b)\n : (t === \"number\" ? number\n : t === \"string\" ? ((c = color(b)) ? (b = c, rgb) : string)\n : b instanceof color ? rgb\n : b instanceof Date ? date\n : isNumberArray(b) ? numberArray\n : Array.isArray(b) ? genericArray\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : number)(a, b);\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return Math.round(a * (1 - t) + b * t);\n };\n}\n","import {cubehelix as colorCubehelix} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction cubehelix(hue) {\n return (function cubehelixGamma(y) {\n y = +y;\n\n function cubehelix(start, end) {\n var h = hue((start = colorCubehelix(start)).h, (end = colorCubehelix(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(Math.pow(t, y));\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n cubehelix.gamma = cubehelixGamma;\n\n return cubehelix;\n })(1);\n}\n\nexport default cubehelix(hue);\nexport var cubehelixLong = cubehelix(color);\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","export default function(x) {\n return +x;\n}\n","import {bisect} from \"d3-array\";\nimport {interpolate as interpolateValue, interpolateRound} from \"d3-interpolate\";\nimport {map, slice} from \"./array\";\nimport constant from \"./constant\";\nimport number from \"./number\";\n\nvar unit = [0, 1];\n\nexport function deinterpolateLinear(a, b) {\n return (b -= (a = +a))\n ? function(x) { return (x - a) / b; }\n : constant(b);\n}\n\nfunction deinterpolateClamp(deinterpolate) {\n return function(a, b) {\n var d = deinterpolate(a = +a, b = +b);\n return function(x) { return x <= a ? 0 : x >= b ? 1 : d(x); };\n };\n}\n\nfunction reinterpolateClamp(reinterpolate) {\n return function(a, b) {\n var r = reinterpolate(a = +a, b = +b);\n return function(t) { return t <= 0 ? a : t >= 1 ? b : r(t); };\n };\n}\n\nfunction bimap(domain, range, deinterpolate, reinterpolate) {\n var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];\n if (d1 < d0) d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0);\n else d0 = deinterpolate(d0, d1), r0 = reinterpolate(r0, r1);\n return function(x) { return r0(d0(x)); };\n}\n\nfunction polymap(domain, range, deinterpolate, reinterpolate) {\n var j = Math.min(domain.length, range.length) - 1,\n d = new Array(j),\n r = new Array(j),\n i = -1;\n\n // Reverse descending domains.\n if (domain[j] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n\n while (++i < j) {\n d[i] = deinterpolate(domain[i], domain[i + 1]);\n r[i] = reinterpolate(range[i], range[i + 1]);\n }\n\n return function(x) {\n var i = bisect(domain, x, 1, j) - 1;\n return r[i](d[i](x));\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .range(source.range())\n .interpolate(source.interpolate())\n .clamp(source.clamp());\n}\n\n// deinterpolate(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].\n// reinterpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding domain value x in [a,b].\nexport default function continuous(deinterpolate, reinterpolate) {\n var domain = unit,\n range = unit,\n interpolate = interpolateValue,\n clamp = false,\n piecewise,\n output,\n input;\n\n function rescale() {\n piecewise = Math.min(domain.length, range.length) > 2 ? polymap : bimap;\n output = input = null;\n return scale;\n }\n\n function scale(x) {\n return (output || (output = piecewise(domain, range, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate)))(+x);\n }\n\n scale.invert = function(y) {\n return (input || (input = piecewise(range, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y);\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain = map.call(_, number), rescale()) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = slice.call(_), rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = slice.call(_), interpolate = interpolateRound, rescale();\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, rescale()) : clamp;\n };\n\n scale.interpolate = function(_) {\n return arguments.length ? (interpolate = _, rescale()) : interpolate;\n };\n\n return rescale();\n}\n","export default function(x) {\n return Math.abs(x = Math.round(x)) >= 1e21\n ? x.toLocaleString(\"en\").replace(/,/g, \"\")\n : x.toString(10);\n}\n\n// Computes the decimal coefficient and exponent of the specified number x with\n// significant digits p, where x is positive and p is in [1, 21] or undefined.\n// For example, formatDecimalParts(1.23) returns [\"123\", 0].\nexport function formatDecimalParts(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x) {\n return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;\n}\n","// [[fill]align][sign][symbol][0][width][,][.precision][~][type]\nvar re = /^(?:(.)?([<>=^]))?([+\\-( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?(~)?([a-z%])?$/i;\n\nexport default function formatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n var match;\n return new FormatSpecifier({\n fill: match[1],\n align: match[2],\n sign: match[3],\n symbol: match[4],\n zero: match[5],\n width: match[6],\n comma: match[7],\n precision: match[8] && match[8].slice(1),\n trim: match[9],\n type: match[10]\n });\n}\n\nformatSpecifier.prototype = FormatSpecifier.prototype; // instanceof\n\nexport function FormatSpecifier(specifier) {\n this.fill = specifier.fill === undefined ? \" \" : specifier.fill + \"\";\n this.align = specifier.align === undefined ? \">\" : specifier.align + \"\";\n this.sign = specifier.sign === undefined ? \"-\" : specifier.sign + \"\";\n this.symbol = specifier.symbol === undefined ? \"\" : specifier.symbol + \"\";\n this.zero = !!specifier.zero;\n this.width = specifier.width === undefined ? undefined : +specifier.width;\n this.comma = !!specifier.comma;\n this.precision = specifier.precision === undefined ? undefined : +specifier.precision;\n this.trim = !!specifier.trim;\n this.type = specifier.type === undefined ? \"\" : specifier.type + \"\";\n}\n\nFormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width === undefined ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision === undefined ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + (this.trim ? \"~\" : \"\")\n + this.type;\n};\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport var prefixExponent;\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n}\n","import formatDecimal from \"./formatDecimal.js\";\nimport formatPrefixAuto from \"./formatPrefixAuto.js\";\nimport formatRounded from \"./formatRounded.js\";\n\nexport default {\n \"%\": function(x, p) { return (x * 100).toFixed(p); },\n \"b\": function(x) { return Math.round(x).toString(2); },\n \"c\": function(x) { return x + \"\"; },\n \"d\": formatDecimal,\n \"e\": function(x, p) { return x.toExponential(p); },\n \"f\": function(x, p) { return x.toFixed(p); },\n \"g\": function(x, p) { return x.toPrecision(p); },\n \"o\": function(x) { return Math.round(x).toString(8); },\n \"p\": function(x, p) { return formatRounded(x * 100, p); },\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": function(x) { return Math.round(x).toString(16).toUpperCase(); },\n \"x\": function(x) { return Math.round(x).toString(16); }\n};\n","export default function(x) {\n return x;\n}\n","import exponent from \"./exponent.js\";\nimport formatGroup from \"./formatGroup.js\";\nimport formatNumerals from \"./formatNumerals.js\";\nimport formatSpecifier from \"./formatSpecifier.js\";\nimport formatTrim from \"./formatTrim.js\";\nimport formatTypes from \"./formatTypes.js\";\nimport {prefixExponent} from \"./formatPrefixAuto.js\";\nimport identity from \"./identity.js\";\n\nvar map = Array.prototype.map,\n prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\nexport default function(locale) {\n var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + \"\"),\n currencyPrefix = locale.currency === undefined ? \"\" : locale.currency[0] + \"\",\n currencySuffix = locale.currency === undefined ? \"\" : locale.currency[1] + \"\",\n decimal = locale.decimal === undefined ? \".\" : locale.decimal + \"\",\n numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),\n percent = locale.percent === undefined ? \"%\" : locale.percent + \"\",\n minus = locale.minus === undefined ? \"-\" : locale.minus + \"\",\n nan = locale.nan === undefined ? \"NaN\" : locale.nan + \"\";\n\n function newFormat(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n trim = specifier.trim,\n type = specifier.type;\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // The \"\" type, and any invalid type, is an alias for \".12~g\".\n else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = \"g\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currencyPrefix : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currencySuffix : /[%p]/.test(type) ? percent : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision === undefined ? 6\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n function format(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix,\n i, n, c;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Determine the sign. -0 is not less than 0, but 1 / -0 is!\n var valueNegative = value < 0 || 1 / value < 0;\n\n // Perform the initial formatting.\n value = isNaN(value) ? nan : formatType(Math.abs(value), precision);\n\n // Trim insignificant zeros.\n if (trim) value = formatTrim(value);\n\n // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.\n if (valueNegative && +value === 0 && sign !== \"+\") valueNegative = false;\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : minus) : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + valueSuffix + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n i = -1, n = value.length;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": value = valuePrefix + value + valueSuffix + padding; break;\n case \"=\": value = valuePrefix + padding + value + valueSuffix; break;\n case \"^\": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;\n default: value = padding + valuePrefix + value + valueSuffix; break;\n }\n\n return numerals(value);\n }\n\n format.toString = function() {\n return specifier + \"\";\n };\n\n return format;\n }\n\n function formatPrefix(specifier, value) {\n var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: newFormat,\n formatPrefix: formatPrefix\n };\n}\n","import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var format;\nexport var formatPrefix;\n\ndefaultLocale({\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"],\n minus: \"-\"\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n format = locale.format;\n formatPrefix = locale.formatPrefix;\n return locale;\n}\n","export default function(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n}\n","export default function(numerals) {\n return function(value) {\n return value.replace(/[0-9]/g, function(i) {\n return numerals[+i];\n });\n };\n}\n","// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.\nexport default function(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, max) {\n step = Math.abs(step), max = Math.abs(max) - step;\n return Math.max(0, exponent(max) - exponent(step)) + 1;\n}\n","import {ticks, tickIncrement} from \"d3-array\";\nimport {interpolateNumber as reinterpolate} from \"d3-interpolate\";\nimport {default as continuous, copy, deinterpolateLinear as deinterpolate} from \"./continuous\";\nimport tickFormat from \"./tickFormat\";\n\nexport function linearish(scale) {\n var domain = scale.domain;\n\n scale.ticks = function(count) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], count == null ? 10 : count);\n };\n\n scale.tickFormat = function(count, specifier) {\n return tickFormat(domain(), count, specifier);\n };\n\n scale.nice = function(count) {\n if (count == null) count = 10;\n\n var d = domain(),\n i0 = 0,\n i1 = d.length - 1,\n start = d[i0],\n stop = d[i1],\n step;\n\n if (stop < start) {\n step = start, start = stop, stop = step;\n step = i0, i0 = i1, i1 = step;\n }\n\n step = tickIncrement(start, stop, count);\n\n if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n step = tickIncrement(start, stop, count);\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n step = tickIncrement(start, stop, count);\n }\n\n if (step > 0) {\n d[i0] = Math.floor(start / step) * step;\n d[i1] = Math.ceil(stop / step) * step;\n domain(d);\n } else if (step < 0) {\n d[i0] = Math.ceil(start * step) / step;\n d[i1] = Math.floor(stop * step) / step;\n domain(d);\n }\n\n return scale;\n };\n\n return scale;\n}\n\nexport default function linear() {\n var scale = continuous(deinterpolate, reinterpolate);\n\n scale.copy = function() {\n return copy(scale, linear());\n };\n\n return linearish(scale);\n}\n","import {tickStep} from \"d3-array\";\nimport {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from \"d3-format\";\n\nexport default function(domain, count, specifier) {\n var start = domain[0],\n stop = domain[domain.length - 1],\n step = tickStep(start, stop, count == null ? 10 : count),\n precision;\n specifier = formatSpecifier(specifier == null ? \",f\" : specifier);\n switch (specifier.type) {\n case \"s\": {\n var value = Math.max(Math.abs(start), Math.abs(stop));\n if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;\n return formatPrefix(specifier, value);\n }\n case \"\":\n case \"e\":\n case \"g\":\n case \"p\":\n case \"r\": {\n if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === \"e\");\n break;\n }\n case \"f\":\n case \"%\": {\n if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === \"%\") * 2;\n break;\n }\n }\n return format(specifier);\n}\n","export default function(domain, interval) {\n domain = domain.slice();\n\n var i0 = 0,\n i1 = domain.length - 1,\n x0 = domain[i0],\n x1 = domain[i1],\n t;\n\n if (x1 < x0) {\n t = i0, i0 = i1, i1 = t;\n t = x0, x0 = x1, x1 = t;\n }\n\n domain[i0] = interval.floor(x0);\n domain[i1] = interval.ceil(x1);\n return domain;\n}\n","import {ticks} from \"d3-array\";\nimport {format} from \"d3-format\";\nimport constant from \"./constant\";\nimport nice from \"./nice\";\nimport {default as continuous, copy} from \"./continuous\";\n\nfunction deinterpolate(a, b) {\n return (b = Math.log(b / a))\n ? function(x) { return Math.log(x / a) / b; }\n : constant(b);\n}\n\nfunction reinterpolate(a, b) {\n return a < 0\n ? function(t) { return -Math.pow(-b, t) * Math.pow(-a, 1 - t); }\n : function(t) { return Math.pow(b, t) * Math.pow(a, 1 - t); };\n}\n\nfunction pow10(x) {\n return isFinite(x) ? +(\"1e\" + x) : x < 0 ? 0 : x;\n}\n\nfunction powp(base) {\n return base === 10 ? pow10\n : base === Math.E ? Math.exp\n : function(x) { return Math.pow(base, x); };\n}\n\nfunction logp(base) {\n return base === Math.E ? Math.log\n : base === 10 && Math.log10\n || base === 2 && Math.log2\n || (base = Math.log(base), function(x) { return Math.log(x) / base; });\n}\n\nfunction reflect(f) {\n return function(x) {\n return -f(-x);\n };\n}\n\nexport default function log() {\n var scale = continuous(deinterpolate, reinterpolate).domain([1, 10]),\n domain = scale.domain,\n base = 10,\n logs = logp(10),\n pows = powp(10);\n\n function rescale() {\n logs = logp(base), pows = powp(base);\n if (domain()[0] < 0) logs = reflect(logs), pows = reflect(pows);\n return scale;\n }\n\n scale.base = function(_) {\n return arguments.length ? (base = +_, rescale()) : base;\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain(_), rescale()) : domain();\n };\n\n scale.ticks = function(count) {\n var d = domain(),\n u = d[0],\n v = d[d.length - 1],\n r;\n\n if (r = v < u) i = u, u = v, v = i;\n\n var i = logs(u),\n j = logs(v),\n p,\n k,\n t,\n n = count == null ? 10 : +count,\n z = [];\n\n if (!(base % 1) && j - i < n) {\n i = Math.round(i) - 1, j = Math.round(j) + 1;\n if (u > 0) for (; i < j; ++i) {\n for (k = 1, p = pows(i); k < base; ++k) {\n t = p * k;\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n } else for (; i < j; ++i) {\n for (k = base - 1, p = pows(i); k >= 1; --k) {\n t = p * k;\n if (t < u) continue;\n if (t > v) break;\n z.push(t);\n }\n }\n } else {\n z = ticks(i, j, Math.min(j - i, n)).map(pows);\n }\n\n return r ? z.reverse() : z;\n };\n\n scale.tickFormat = function(count, specifier) {\n if (specifier == null) specifier = base === 10 ? \".0e\" : \",\";\n if (typeof specifier !== \"function\") specifier = format(specifier);\n if (count === Infinity) return specifier;\n if (count == null) count = 10;\n var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?\n return function(d) {\n var i = d / pows(Math.round(logs(d)));\n if (i * base < base - 0.5) i *= base;\n return i <= k ? specifier(d) : \"\";\n };\n };\n\n scale.nice = function() {\n return domain(nice(domain(), {\n floor: function(x) { return pows(Math.floor(logs(x))); },\n ceil: function(x) { return pows(Math.ceil(logs(x))); }\n }));\n };\n\n scale.copy = function() {\n return copy(scale, log().base(base));\n };\n\n return scale;\n}\n","import constant from \"./constant\";\nimport {linearish} from \"./linear\";\nimport {default as continuous, copy} from \"./continuous\";\n\nfunction raise(x, exponent) {\n return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);\n}\n\nexport default function pow() {\n var exponent = 1,\n scale = continuous(deinterpolate, reinterpolate),\n domain = scale.domain;\n\n function deinterpolate(a, b) {\n return (b = raise(b, exponent) - (a = raise(a, exponent)))\n ? function(x) { return (raise(x, exponent) - a) / b; }\n : constant(b);\n }\n\n function reinterpolate(a, b) {\n b = raise(b, exponent) - (a = raise(a, exponent));\n return function(t) { return raise(a + b * t, 1 / exponent); };\n }\n\n scale.exponent = function(_) {\n return arguments.length ? (exponent = +_, domain(domain())) : exponent;\n };\n\n scale.copy = function() {\n return copy(scale, pow().exponent(exponent));\n };\n\n return linearish(scale);\n}\n\nexport function sqrt() {\n return pow().exponent(0.5);\n}\n","var t0 = new Date,\n t1 = new Date;\n\nexport default function newInterval(floori, offseti, count, field) {\n\n function interval(date) {\n return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;\n }\n\n interval.floor = function(date) {\n return floori(date = new Date(+date)), date;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;\n };\n\n interval.round = function(date) {\n var d0 = interval(date),\n d1 = interval.ceil(date);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [], previous;\n start = interval.ceil(start);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n do range.push(previous = new Date(+start)), offseti(start, step), floori(start);\n while (previous < start && start < stop);\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n if (date >= date) {\n if (step < 0) while (++step <= 0) {\n while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty\n } else while (--step >= 0) {\n while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty\n }\n }\n });\n };\n\n if (count) {\n interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n interval.every = function(step) {\n step = Math.floor(step);\n return !isFinite(step) || !(step > 0) ? null\n : !(step > 1) ? interval\n : interval.filter(field\n ? function(d) { return field(d) % step === 0; }\n : function(d) { return interval.count(0, d) % step === 0; });\n };\n }\n\n return interval;\n}\n","import interval from \"./interval.js\";\n\nvar millisecond = interval(function() {\n // noop\n}, function(date, step) {\n date.setTime(+date + step);\n}, function(start, end) {\n return end - start;\n});\n\n// An optimized implementation for this simple case.\nmillisecond.every = function(k) {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return interval(function(date) {\n date.setTime(Math.floor(date / k) * k);\n }, function(date, step) {\n date.setTime(+date + step * k);\n }, function(start, end) {\n return (end - start) / k;\n });\n};\n\nexport default millisecond;\nexport var milliseconds = millisecond.range;\n","export var durationSecond = 1e3;\nexport var durationMinute = 6e4;\nexport var durationHour = 36e5;\nexport var durationDay = 864e5;\nexport var durationWeek = 6048e5;\n","import interval from \"./interval.js\";\nimport {durationSecond} from \"./duration.js\";\n\nvar second = interval(function(date) {\n date.setTime(date - date.getMilliseconds());\n}, function(date, step) {\n date.setTime(+date + step * durationSecond);\n}, function(start, end) {\n return (end - start) / durationSecond;\n}, function(date) {\n return date.getUTCSeconds();\n});\n\nexport default second;\nexport var seconds = second.range;\n","import interval from \"./interval.js\";\nimport {durationMinute, durationSecond} from \"./duration.js\";\n\nvar minute = interval(function(date) {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);\n}, function(date, step) {\n date.setTime(+date + step * durationMinute);\n}, function(start, end) {\n return (end - start) / durationMinute;\n}, function(date) {\n return date.getMinutes();\n});\n\nexport default minute;\nexport var minutes = minute.range;\n","import interval from \"./interval.js\";\nimport {durationHour, durationMinute, durationSecond} from \"./duration.js\";\n\nvar hour = interval(function(date) {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);\n}, function(date, step) {\n date.setTime(+date + step * durationHour);\n}, function(start, end) {\n return (end - start) / durationHour;\n}, function(date) {\n return date.getHours();\n});\n\nexport default hour;\nexport var hours = hour.range;\n","import interval from \"./interval.js\";\nimport {durationDay, durationMinute} from \"./duration.js\";\n\nvar day = interval(function(date) {\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setDate(date.getDate() + step);\n}, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay;\n}, function(date) {\n return date.getDate() - 1;\n});\n\nexport default day;\nexport var days = day.range;\n","import interval from \"./interval.js\";\nimport {durationMinute, durationWeek} from \"./duration.js\";\n\nfunction weekday(i) {\n return interval(function(date) {\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;\n });\n}\n\nexport var sunday = weekday(0);\nexport var monday = weekday(1);\nexport var tuesday = weekday(2);\nexport var wednesday = weekday(3);\nexport var thursday = weekday(4);\nexport var friday = weekday(5);\nexport var saturday = weekday(6);\n\nexport var sundays = sunday.range;\nexport var mondays = monday.range;\nexport var tuesdays = tuesday.range;\nexport var wednesdays = wednesday.range;\nexport var thursdays = thursday.range;\nexport var fridays = friday.range;\nexport var saturdays = saturday.range;\n","import interval from \"./interval.js\";\n\nvar month = interval(function(date) {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setMonth(date.getMonth() + step);\n}, function(start, end) {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n}, function(date) {\n return date.getMonth();\n});\n\nexport default month;\nexport var months = month.range;\n","import interval from \"./interval.js\";\n\nvar year = interval(function(date) {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n}, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n}, function(date) {\n return date.getFullYear();\n});\n\n// An optimized implementation for this simple case.\nyear.every = function(k) {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : interval(function(date) {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step * k);\n });\n};\n\nexport default year;\nexport var years = year.range;\n","import interval from \"./interval.js\";\nimport {durationMinute} from \"./duration.js\";\n\nvar utcMinute = interval(function(date) {\n date.setUTCSeconds(0, 0);\n}, function(date, step) {\n date.setTime(+date + step * durationMinute);\n}, function(start, end) {\n return (end - start) / durationMinute;\n}, function(date) {\n return date.getUTCMinutes();\n});\n\nexport default utcMinute;\nexport var utcMinutes = utcMinute.range;\n","import interval from \"./interval.js\";\nimport {durationHour} from \"./duration.js\";\n\nvar utcHour = interval(function(date) {\n date.setUTCMinutes(0, 0, 0);\n}, function(date, step) {\n date.setTime(+date + step * durationHour);\n}, function(start, end) {\n return (end - start) / durationHour;\n}, function(date) {\n return date.getUTCHours();\n});\n\nexport default utcHour;\nexport var utcHours = utcHour.range;\n","import interval from \"./interval.js\";\nimport {durationDay} from \"./duration.js\";\n\nvar utcDay = interval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n}, function(start, end) {\n return (end - start) / durationDay;\n}, function(date) {\n return date.getUTCDate() - 1;\n});\n\nexport default utcDay;\nexport var utcDays = utcDay.range;\n","import interval from \"./interval.js\";\nimport {durationWeek} from \"./duration.js\";\n\nfunction utcWeekday(i) {\n return interval(function(date) {\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / durationWeek;\n });\n}\n\nexport var utcSunday = utcWeekday(0);\nexport var utcMonday = utcWeekday(1);\nexport var utcTuesday = utcWeekday(2);\nexport var utcWednesday = utcWeekday(3);\nexport var utcThursday = utcWeekday(4);\nexport var utcFriday = utcWeekday(5);\nexport var utcSaturday = utcWeekday(6);\n\nexport var utcSundays = utcSunday.range;\nexport var utcMondays = utcMonday.range;\nexport var utcTuesdays = utcTuesday.range;\nexport var utcWednesdays = utcWednesday.range;\nexport var utcThursdays = utcThursday.range;\nexport var utcFridays = utcFriday.range;\nexport var utcSaturdays = utcSaturday.range;\n","import interval from \"./interval.js\";\n\nvar utcMonth = interval(function(date) {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCMonth(date.getUTCMonth() + step);\n}, function(start, end) {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n}, function(date) {\n return date.getUTCMonth();\n});\n\nexport default utcMonth;\nexport var utcMonths = utcMonth.range;\n","import interval from \"./interval.js\";\n\nvar utcYear = interval(function(date) {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n}, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n}, function(date) {\n return date.getUTCFullYear();\n});\n\n// An optimized implementation for this simple case.\nutcYear.every = function(k) {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : interval(function(date) {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n });\n};\n\nexport default utcYear;\nexport var utcYears = utcYear.range;\n","import {\n timeDay,\n timeSunday,\n timeMonday,\n timeThursday,\n timeYear,\n utcDay,\n utcSunday,\n utcMonday,\n utcThursday,\n utcYear\n} from \"d3-time\";\n\nfunction localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n}\n\nfunction utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n}\n\nfunction newDate(y, m, d) {\n return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0};\n}\n\nexport default function formatLocale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodRe = formatRe(locale_periods),\n periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"f\": formatMicroseconds,\n \"g\": formatYearISO,\n \"G\": formatFullYearISO,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"q\": formatQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatSeconds,\n \"u\": formatWeekdayNumberMonday,\n \"U\": formatWeekNumberSunday,\n \"V\": formatWeekNumberISO,\n \"w\": formatWeekdayNumberSunday,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"f\": formatUTCMicroseconds,\n \"g\": formatUTCYearISO,\n \"G\": formatUTCFullYearISO,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"q\": formatUTCQuarter,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatUTCSeconds,\n \"u\": formatUTCWeekdayNumberMonday,\n \"U\": formatUTCWeekNumberSunday,\n \"V\": formatUTCWeekNumberISO,\n \"w\": formatUTCWeekdayNumberSunday,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"f\": parseMicroseconds,\n \"g\": parseYear,\n \"G\": parseFullYear,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"q\": parseQuarter,\n \"Q\": parseUnixTimestamp,\n \"s\": parseUnixTimestampSeconds,\n \"S\": parseSeconds,\n \"u\": parseWeekdayNumberMonday,\n \"U\": parseWeekNumberSunday,\n \"V\": parseWeekNumberISO,\n \"w\": parseWeekdayNumberSunday,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n if (!(date instanceof Date)) date = new Date(+date);\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n else pad = c === \"e\" ? \" \" : \"0\";\n if (format = formats[c]) c = format(date, pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, Z) {\n return function(string) {\n var d = newDate(1900, undefined, 1),\n i = parseSpecifier(d, specifier, string += \"\", 0),\n week, day;\n if (i != string.length) return null;\n\n // If a UNIX timestamp is specified, return it.\n if (\"Q\" in d) return new Date(d.Q);\n if (\"s\" in d) return new Date(d.s * 1000 + (\"L\" in d ? d.L : 0));\n\n // If this is utcParse, never use the local timezone.\n if (Z && !(\"Z\" in d)) d.Z = 0;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If the month was not specified, inherit from the quarter.\n if (d.m === undefined) d.m = \"q\" in d ? d.q : 0;\n\n // Convert day-of-week and week-of-year to day-of-year.\n if (\"V\" in d) {\n if (d.V < 1 || d.V > 53) return null;\n if (!(\"w\" in d)) d.w = 1;\n if (\"Z\" in d) {\n week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();\n week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);\n week = utcDay.offset(week, (d.V - 1) * 7);\n d.y = week.getUTCFullYear();\n d.m = week.getUTCMonth();\n d.d = week.getUTCDate() + (d.w + 6) % 7;\n } else {\n week = localDate(newDate(d.y, 0, 1)), day = week.getDay();\n week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);\n week = timeDay.offset(week, (d.V - 1) * 7);\n d.y = week.getFullYear();\n d.m = week.getMonth();\n d.d = week.getDate() + (d.w + 6) % 7;\n }\n } else if (\"W\" in d || \"U\" in d) {\n if (!(\"w\" in d)) d.w = \"u\" in d ? d.u % 7 : \"W\" in d ? 1 : 0;\n day = \"Z\" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();\n d.m = 0;\n d.d = \"W\" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;\n }\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n return localDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parsePeriod(d, string, i) {\n var n = periodRe.exec(string.slice(i));\n return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatQuarter(d) {\n return 1 + ~~(d.getMonth() / 3);\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n function formatUTCQuarter(d) {\n return 1 + ~~(d.getUTCMonth() / 3);\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.toString = function() { return specifier; };\n return f;\n },\n parse: function(specifier) {\n var p = newParse(specifier += \"\", false);\n p.toString = function() { return specifier; };\n return p;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.toString = function() { return specifier; };\n return f;\n },\n utcParse: function(specifier) {\n var p = newParse(specifier += \"\", true);\n p.toString = function() { return specifier; };\n return p;\n }\n };\n}\n\nvar pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"},\n numberRe = /^\\s*\\d+/, // note: ignores next directive\n percentRe = /^%/,\n requoteRe = /[\\\\^$*+?|[\\]().{}]/g;\n\nfunction pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n}\n\nfunction requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n}\n\nfunction formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n}\n\nfunction formatLookup(names) {\n var map = {}, i = -1, n = names.length;\n while (++i < n) map[names[i].toLowerCase()] = i;\n return map;\n}\n\nfunction parseWeekdayNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekdayNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.u = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberISO(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.V = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n}\n\nfunction parseZone(d, string, i) {\n var n = /^(Z)|([+-]\\d\\d)(?::?(\\d\\d))?/.exec(string.slice(i, i + 6));\n return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || \"00\")), i + n[0].length) : -1;\n}\n\nfunction parseQuarter(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;\n}\n\nfunction parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n}\n\nfunction parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMicroseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 6));\n return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;\n}\n\nfunction parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n}\n\nfunction parseUnixTimestamp(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.Q = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseUnixTimestampSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.s = +n[0], i + n[0].length) : -1;\n}\n\nfunction formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n}\n\nfunction formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n}\n\nfunction formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n}\n\nfunction formatDayOfYear(d, p) {\n return pad(1 + timeDay.count(timeYear(d), d), p, 3);\n}\n\nfunction formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n}\n\nfunction formatMicroseconds(d, p) {\n return formatMilliseconds(d, p) + \"000\";\n}\n\nfunction formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n}\n\nfunction formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n}\n\nfunction formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n}\n\nfunction formatWeekdayNumberMonday(d) {\n var day = d.getDay();\n return day === 0 ? 7 : day;\n}\n\nfunction formatWeekNumberSunday(d, p) {\n return pad(timeSunday.count(timeYear(d) - 1, d), p, 2);\n}\n\nfunction dISO(d) {\n var day = d.getDay();\n return (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n}\n\nfunction formatWeekNumberISO(d, p) {\n d = dISO(d);\n return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);\n}\n\nfunction formatWeekdayNumberSunday(d) {\n return d.getDay();\n}\n\nfunction formatWeekNumberMonday(d, p) {\n return pad(timeMonday.count(timeYear(d) - 1, d), p, 2);\n}\n\nfunction formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatYearISO(d, p) {\n d = dISO(d);\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatFullYearISO(d, p) {\n var day = d.getDay();\n d = (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n}\n\nfunction formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n}\n\nfunction formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n}\n\nfunction formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n}\n\nfunction formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n}\n\nfunction formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n}\n\nfunction formatUTCMicroseconds(d, p) {\n return formatUTCMilliseconds(d, p) + \"000\";\n}\n\nfunction formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n}\n\nfunction formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n}\n\nfunction formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n}\n\nfunction formatUTCWeekdayNumberMonday(d) {\n var dow = d.getUTCDay();\n return dow === 0 ? 7 : dow;\n}\n\nfunction formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);\n}\n\nfunction UTCdISO(d) {\n var day = d.getUTCDay();\n return (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n}\n\nfunction formatUTCWeekNumberISO(d, p) {\n d = UTCdISO(d);\n return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);\n}\n\nfunction formatUTCWeekdayNumberSunday(d) {\n return d.getUTCDay();\n}\n\nfunction formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);\n}\n\nfunction formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCYearISO(d, p) {\n d = UTCdISO(d);\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCFullYearISO(d, p) {\n var day = d.getUTCDay();\n d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCZone() {\n return \"+0000\";\n}\n\nfunction formatLiteralPercent() {\n return \"%\";\n}\n\nfunction formatUnixTimestamp(d) {\n return +d;\n}\n\nfunction formatUnixTimestampSeconds(d) {\n return Math.floor(+d / 1000);\n}\n","import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var timeFormat;\nexport var timeParse;\nexport var utcFormat;\nexport var utcParse;\n\ndefaultLocale({\n dateTime: \"%x, %X\",\n date: \"%-m/%-d/%Y\",\n time: \"%-I:%M:%S %p\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n timeFormat = locale.format;\n timeParse = locale.parse;\n utcFormat = locale.utcFormat;\n utcParse = locale.utcParse;\n return locale;\n}\n","import {utcFormat} from \"./defaultLocale.js\";\n\nexport var isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n\nfunction formatIsoNative(date) {\n return date.toISOString();\n}\n\nvar formatIso = Date.prototype.toISOString\n ? formatIsoNative\n : utcFormat(isoSpecifier);\n\nexport default formatIso;\n","import {isoSpecifier} from \"./isoFormat.js\";\nimport {utcParse} from \"./defaultLocale.js\";\n\nfunction parseIsoNative(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n}\n\nvar parseIso = +new Date(\"2000-01-01T00:00:00.000Z\")\n ? parseIsoNative\n : utcParse(isoSpecifier);\n\nexport default parseIso;\n","import {bisector, tickStep} from \"d3-array\";\nimport {interpolateNumber as reinterpolate} from \"d3-interpolate\";\nimport {timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeMillisecond} from \"d3-time\";\nimport {timeFormat} from \"d3-time-format\";\nimport {map} from \"./array\";\nimport {default as continuous, copy, deinterpolateLinear as deinterpolate} from \"./continuous\";\nimport nice from \"./nice\";\n\nvar durationSecond = 1000,\n durationMinute = durationSecond * 60,\n durationHour = durationMinute * 60,\n durationDay = durationHour * 24,\n durationWeek = durationDay * 7,\n durationMonth = durationDay * 30,\n durationYear = durationDay * 365;\n\nfunction date(t) {\n return new Date(t);\n}\n\nfunction number(t) {\n return t instanceof Date ? +t : +new Date(+t);\n}\n\nexport function calendar(year, month, week, day, hour, minute, second, millisecond, format) {\n var scale = continuous(deinterpolate, reinterpolate),\n invert = scale.invert,\n domain = scale.domain;\n\n var formatMillisecond = format(\".%L\"),\n formatSecond = format(\":%S\"),\n formatMinute = format(\"%I:%M\"),\n formatHour = format(\"%I %p\"),\n formatDay = format(\"%a %d\"),\n formatWeek = format(\"%b %d\"),\n formatMonth = format(\"%B\"),\n formatYear = format(\"%Y\");\n\n var tickIntervals = [\n [second, 1, durationSecond],\n [second, 5, 5 * durationSecond],\n [second, 15, 15 * durationSecond],\n [second, 30, 30 * durationSecond],\n [minute, 1, durationMinute],\n [minute, 5, 5 * durationMinute],\n [minute, 15, 15 * durationMinute],\n [minute, 30, 30 * durationMinute],\n [ hour, 1, durationHour ],\n [ hour, 3, 3 * durationHour ],\n [ hour, 6, 6 * durationHour ],\n [ hour, 12, 12 * durationHour ],\n [ day, 1, durationDay ],\n [ day, 2, 2 * durationDay ],\n [ week, 1, durationWeek ],\n [ month, 1, durationMonth ],\n [ month, 3, 3 * durationMonth ],\n [ year, 1, durationYear ]\n ];\n\n function tickFormat(date) {\n return (second(date) < date ? formatMillisecond\n : minute(date) < date ? formatSecond\n : hour(date) < date ? formatMinute\n : day(date) < date ? formatHour\n : month(date) < date ? (week(date) < date ? formatDay : formatWeek)\n : year(date) < date ? formatMonth\n : formatYear)(date);\n }\n\n function tickInterval(interval, start, stop, step) {\n if (interval == null) interval = 10;\n\n // If a desired tick count is specified, pick a reasonable tick interval\n // based on the extent of the domain and a rough estimate of tick size.\n // Otherwise, assume interval is already a time interval and use it.\n if (typeof interval === \"number\") {\n var target = Math.abs(stop - start) / interval,\n i = bisector(function(i) { return i[2]; }).right(tickIntervals, target);\n if (i === tickIntervals.length) {\n step = tickStep(start / durationYear, stop / durationYear, interval);\n interval = year;\n } else if (i) {\n i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];\n step = i[1];\n interval = i[0];\n } else {\n step = Math.max(tickStep(start, stop, interval), 1);\n interval = millisecond;\n }\n }\n\n return step == null ? interval : interval.every(step);\n }\n\n scale.invert = function(y) {\n return new Date(invert(y));\n };\n\n scale.domain = function(_) {\n return arguments.length ? domain(map.call(_, number)) : domain().map(date);\n };\n\n scale.ticks = function(interval, step) {\n var d = domain(),\n t0 = d[0],\n t1 = d[d.length - 1],\n r = t1 < t0,\n t;\n if (r) t = t0, t0 = t1, t1 = t;\n t = tickInterval(interval, t0, t1, step);\n t = t ? t.range(t0, t1 + 1) : []; // inclusive stop\n return r ? t.reverse() : t;\n };\n\n scale.tickFormat = function(count, specifier) {\n return specifier == null ? tickFormat : format(specifier);\n };\n\n scale.nice = function(interval, step) {\n var d = domain();\n return (interval = tickInterval(interval, d[0], d[d.length - 1], step))\n ? domain(nice(d, interval))\n : scale;\n };\n\n scale.copy = function() {\n return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format));\n };\n\n return scale;\n}\n\nexport default function() {\n return calendar(timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeMillisecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]);\n}\n","export default function(s) {\n return s.match(/.{6}/g).map(function(x) {\n return \"#\" + x;\n });\n}\n","import colors from \"./colors\";\n\nexport default colors(\"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf\");\n","import colors from \"./colors\";\n\nexport default colors(\"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6\");\n","import colors from \"./colors\";\n\nexport default colors(\"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9\");\n","import colors from \"./colors\";\n\nexport default colors(\"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5\");\n","import {cubehelix} from \"d3-color\";\nimport {interpolateCubehelixLong} from \"d3-interpolate\";\n\nexport default interpolateCubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240, 0.5, 1.0));\n","import {cubehelix} from \"d3-color\";\nimport {interpolateCubehelixLong} from \"d3-interpolate\";\n\nexport var warm = interpolateCubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8));\n\nexport var cool = interpolateCubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8));\n\nvar rainbow = cubehelix();\n\nexport default function(t) {\n if (t < 0 || t > 1) t -= Math.floor(t);\n var ts = Math.abs(t - 0.5);\n rainbow.h = 360 * t - 100;\n rainbow.s = 1.5 - 1.5 * ts;\n rainbow.l = 0.8 - 0.9 * ts;\n return rainbow + \"\";\n}\n","import colors from \"./colors\";\n\nfunction ramp(range) {\n var n = range.length;\n return function(t) {\n return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];\n };\n}\n\nexport default ramp(colors(\"44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725\"));\n\nexport var magma = ramp(colors(\"00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf\"));\n\nexport var inferno = ramp(colors(\"00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4\"));\n\nexport var plasma = ramp(colors(\"0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921\"));\n","import {map} from \"./array\";\nimport {linearish} from \"./linear\";\nimport number from \"./number\";\n\nexport default function identity() {\n var domain = [0, 1];\n\n function scale(x) {\n return +x;\n }\n\n scale.invert = scale;\n\n scale.domain = scale.range = function(_) {\n return arguments.length ? (domain = map.call(_, number), scale) : domain.slice();\n };\n\n scale.copy = function() {\n return identity().domain(domain);\n };\n\n return linearish(scale);\n}\n","import {ascending, bisect, quantile as threshold} from \"d3-array\";\nimport {slice} from \"./array\";\n\nexport default function quantile() {\n var domain = [],\n range = [],\n thresholds = [];\n\n function rescale() {\n var i = 0, n = Math.max(1, range.length);\n thresholds = new Array(n - 1);\n while (++i < n) thresholds[i - 1] = threshold(domain, i / n);\n return scale;\n }\n\n function scale(x) {\n if (!isNaN(x = +x)) return range[bisect(thresholds, x)];\n }\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return i < 0 ? [NaN, NaN] : [\n i > 0 ? thresholds[i - 1] : domain[0],\n i < thresholds.length ? thresholds[i] : domain[domain.length - 1]\n ];\n };\n\n scale.domain = function(_) {\n if (!arguments.length) return domain.slice();\n domain = [];\n for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d);\n domain.sort(ascending);\n return rescale();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = slice.call(_), rescale()) : range.slice();\n };\n\n scale.quantiles = function() {\n return thresholds.slice();\n };\n\n scale.copy = function() {\n return quantile()\n .domain(domain)\n .range(range);\n };\n\n return scale;\n}\n","import {bisect} from \"d3-array\";\nimport {slice} from \"./array\";\nimport {linearish} from \"./linear\";\n\nexport default function quantize() {\n var x0 = 0,\n x1 = 1,\n n = 1,\n domain = [0.5],\n range = [0, 1];\n\n function scale(x) {\n if (x <= x) return range[bisect(domain, x, 0, n)];\n }\n\n function rescale() {\n var i = -1;\n domain = new Array(n);\n while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);\n return scale;\n }\n\n scale.domain = function(_) {\n return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [x0, x1];\n };\n\n scale.range = function(_) {\n return arguments.length ? (n = (range = slice.call(_)).length - 1, rescale()) : range.slice();\n };\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return i < 0 ? [NaN, NaN]\n : i < 1 ? [x0, domain[0]]\n : i >= n ? [domain[n - 1], x1]\n : [domain[i - 1], domain[i]];\n };\n\n scale.copy = function() {\n return quantize()\n .domain([x0, x1])\n .range(range);\n };\n\n return linearish(scale);\n}\n","import {linearish} from \"./linear\";\n\nexport default function sequential(interpolator) {\n var x0 = 0,\n x1 = 1,\n clamp = false;\n\n function scale(x) {\n var t = (x - x0) / (x1 - x0);\n return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t);\n }\n\n scale.domain = function(_) {\n return arguments.length ? (x0 = +_[0], x1 = +_[1], scale) : [x0, x1];\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, scale) : clamp;\n };\n\n scale.interpolator = function(_) {\n return arguments.length ? (interpolator = _, scale) : interpolator;\n };\n\n scale.copy = function() {\n return sequential(interpolator).domain([x0, x1]).clamp(clamp);\n };\n\n return linearish(scale);\n}\n","import {bisect} from \"d3-array\";\nimport {slice} from \"./array\";\n\nexport default function threshold() {\n var domain = [0.5],\n range = [0, 1],\n n = 1;\n\n function scale(x) {\n if (x <= x) return range[bisect(domain, x, 0, n)];\n }\n\n scale.domain = function(_) {\n return arguments.length ? (domain = slice.call(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = slice.call(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();\n };\n\n scale.invertExtent = function(y) {\n var i = range.indexOf(y);\n return [domain[i - 1], domain[i]];\n };\n\n scale.copy = function() {\n return threshold()\n .domain(domain)\n .range(range);\n };\n\n return scale;\n}\n","import {calendar} from \"./time\";\nimport {utcFormat} from \"d3-time-format\";\nimport {utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcMillisecond} from \"d3-time\";\n\nexport default function() {\n return calendar(utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcMillisecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]);\n}\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar linear = require( 'd3-scale' ).scaleLinear; // TODO: remove\nvar time = require( 'd3-scale' ).scaleTime; // TODO: remove\n\n\n// MAIN //\n\n/**\n* Returns a scale function for mapping values to a coordinate along the x-axis.\n*\n* @private\n* @returns {Function} scale function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar scale;\n\tif ( this._xScale === 'time' ) {\n\t\tscale = time()\n\t\t\t.domain( this.xDomain )\n\t\t\t.range( this.xRange );\n\t} else if ( this._xScale === 'linear' ) {\n\t\tscale = linear()\n\t\t\t.domain( this.xDomain )\n\t\t\t.range( this.xRange );\n\t}\n\t// TODO: other scales\n\treturn scale;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:y-scale' );\n\n\n// MAIN //\n\n/**\n* Sets the y-axis scale.\n*\n* @private\n* @param {string} scale - axis scale\n* @throws {TypeError} must be a string\n* @returns {void}\n*/\nfunction set( scale ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isString( scale ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'yScale', scale ) );\n\t}\n\t// TODO: test for valid scale\n\n\tdebug( 'Current value: %s.', this._yScale );\n\n\tthis._yScale = scale;\n\tdebug( 'New value: %s.', this._yScale );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar linear = require( 'd3-scale' ).scaleLinear; // TODO: remove\nvar time = require( 'd3-scale' ).scaleTime; // TODO: remove\n\n\n// MAIN //\n\n/**\n* Returns a scale function for mapping values to a coordinate along the y-axis.\n*\n* @private\n* @returns {Function} scale function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar scale;\n\tif ( this._yScale === 'time' ) {\n\t\tscale = time()\n\t\t\t.domain( this.yDomain )\n\t\t\t.range( this.yRange );\n\t} else if ( this._yScale === 'linear' ) {\n\t\tscale = linear()\n\t\t\t.domain( this.yDomain )\n\t\t\t.range( this.yRange );\n\t}\n\t// TODO: other scales\n\treturn scale;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isNull from '@stdlib/assert/is-null';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:x-tick-format' );\n\n\n// MAIN //\n\n/**\n* Sets the x-axis tick format.\n*\n* @private\n* @param {(string|null)} fmt - axis tick format\n* @throws {TypeError} must be a string\n*/\nfunction set( fmt ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isNull( fmt ) && !isString( fmt ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string or null. Value: `%s`.', 'xTickFormat', fmt ) );\n\t}\n\tif ( fmt !== this._xTickFormat ) {\n\t\tdebug( 'Current value: %s.', this._xTickFormat );\n\n\t\tthis._xTickFormat = fmt;\n\t\tdebug( 'New value: %s.', this._xTickFormat );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar format = require( 'd3-format' ).format; // TODO: remove\nvar timeFormat = require( 'd3-time-format' ).timeFormat; // TODO: remove\nimport isNull from '@stdlib/assert/is-null';\n\n\n// MAIN //\n\n/**\n* Returns the x-axis tick format.\n*\n* @private\n* @returns {(Function|null)} format function or null\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tif ( isNull( this._xTickFormat ) ) {\n\t\treturn this._xTickFormat;\n\t}\n\tif ( this._xScale === 'time' ) {\n\t\treturn timeFormat( this._xTickFormat );\n\t}\n\treturn format( this._xTickFormat );\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isNull from '@stdlib/assert/is-null';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:y-tick-format' );\n\n\n// MAIN //\n\n/**\n* Sets the y-axis tick format.\n*\n* @private\n* @param {(string|null)} fmt - axis tick format\n* @throws {TypeError} must be a string or null\n*/\nfunction set( fmt ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isNull( fmt ) && !isString( fmt ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string or null. Value: `%s`.', 'yTickFormat', fmt ) );\n\t}\n\tif ( fmt !== this._yTickFormat ) {\n\t\tdebug( 'Current value: %s.', this._yTickFormat );\n\n\t\tthis._yTickFormat = fmt;\n\t\tdebug( 'New value: %s.', this._yTickFormat );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar format = require( 'd3-format' ).format; // TODO: remove\nvar timeFormat = require( 'd3-time-format' ).timeFormat; // TODO: remove\nimport isNull from '@stdlib/assert/is-null';\n\n\n// MAIN //\n\n/**\n* Returns the y-axis tick format.\n*\n* @private\n* @returns {(Function|null)} format function or null\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tif ( isNull( this._yTickFormat ) ) {\n\t\treturn this._yTickFormat;\n\t}\n\tif ( this._yScale === 'time' ) {\n\t\treturn timeFormat( this._yTickFormat );\n\t}\n\treturn format( this._yTickFormat );\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isNull from '@stdlib/assert/is-null';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:x-num-ticks' );\n\n\n// MAIN //\n\n/**\n* Sets the number of x-axis tick marks.\n*\n* @private\n* @param {(NonNegativeInteger|null)} ticks - number of ticks\n* @throws {TypeError} must be a nonnegative integer or null\n*/\nfunction set( ticks ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isNull( ticks ) && !isNonNegativeInteger( ticks ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or null. Value: `%s`.', 'xNumTicks', ticks ) );\n\t}\n\tif ( ticks !== this._xNumTicks ) {\n\t\tdebug( 'Current value: %d.', this._xNumTicks );\n\n\t\tthis._xNumTicks = ticks;\n\t\tdebug( 'New value: %d.', this._xNumTicks );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isNull from '@stdlib/assert/is-null';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:y-num-ticks' );\n\n\n// MAIN //\n\n/**\n* Sets the number of y-axis tick marks.\n*\n* @private\n* @param {(NonNegativeInteger|null)} ticks - number of ticks\n* @throws {TypeError} must be a nonnegative integer or null\n*/\nfunction set( ticks ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isNull( ticks ) && !isNonNegativeInteger( ticks ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or null. Value: `%s`.', 'yNumTicks', ticks ) );\n\t}\n\tif ( ticks !== this._yNumTicks ) {\n\t\tdebug( 'Current value: %d.', this._yNumTicks );\n\n\t\tthis._yNumTicks = ticks;\n\t\tdebug( 'New value: %d.', this._yNumTicks );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport indexOf from '@stdlib/utils/index-of';\nimport format from '@stdlib/string/format';\nimport ORIENTATIONS from './orientations.json';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:x-axis-orient' );\n\n\n// MAIN //\n\n/**\n* Sets the x-axis orientation.\n*\n* @private\n* @param {string} orientation - axis orientation\n* @throws {TypeError} must be either `'bottom'` or `'top'`\n*/\nfunction set( orientation ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( indexOf( ORIENTATIONS, orientation ) === -1 ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be one of the following: \"%s\". Value: `%s`.', 'xAxisOrient', ORIENTATIONS.join( '\", \"' ), orientation ) );\n\t}\n\tif ( orientation !== this._xAxisOrient ) {\n\t\tdebug( 'Current value: %s.', this._xAxisOrient );\n\n\t\tthis._xAxisOrient = orientation;\n\t\tdebug( 'New value: %s.', this._xAxisOrient );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport indexOf from '@stdlib/utils/index-of';\nimport format from '@stdlib/string/format';\nimport ORIENTATIONS from './orientations.json';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:y-axis-orient' );\n\n\n// MAIN //\n\n/**\n* Sets the y-axis orientation.\n*\n* @private\n* @param {string} orientation - axis orientation\n* @throws {TypeError} must be either `'left'` or `'right'`\n*/\nfunction set( orientation ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( indexOf( ORIENTATIONS, orientation ) === -1 ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be one of the following: \"%s\". Value: `%s`.', 'yAxisOrient', ORIENTATIONS.join( '\", \"' ), orientation ) );\n\t}\n\tif ( orientation !== this._yAxisOrient ) {\n\t\tdebug( 'Current value: %s.', this._yAxisOrient );\n\n\t\tthis._yAxisOrient = orientation;\n\t\tdebug( 'New value: %s.', this._yAxisOrient );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport { primitives as isBooleanArray } from '@stdlib/assert/is-boolean-array';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:x-rug' );\n\n\n// MAIN //\n\n/**\n* Sets a flag indicating whether to display a rug plot along the x-axis.\n*\n* @private\n* @param {(boolean|BooleanArray)} v - boolean flag(s) indicating whether to display a rug plot along the x-axis\n* @throws {TypeError} must be a boolean or boolean array\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar isBool = isBoolean( v );\n\tif ( !isBool && !isBooleanArray( v ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a boolean or an array of booleans. Value: `%s`.', 'xRug', v ) );\n\t}\n\tif ( isBool ) {\n\t\tv = [ v ];\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._xRug ) );\n\n\tthis._xRug = v;\n\tdebug( 'New Value: %s.', JSON.stringify( this._xRug ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport { primitives as isBooleanArray } from '@stdlib/assert/is-boolean-array';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:y-rug' );\n\n\n// MAIN //\n\n/**\n* Sets a flag indicating whether to display a rug plot along the y-axis.\n*\n* @private\n* @param {(boolean|BooleanArray)} v - boolean flag(s) indicating whether to display a rug plot along the y-axis\n* @throws {TypeError} must be a boolean or boolean array\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar isBool = isBoolean( v );\n\tif ( !isBool && !isBooleanArray( v ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a boolean or an array of booleans. Value: `%s`.', 'yRug', v ) );\n\t}\n\tif ( isBool ) {\n\t\tv = [ v ];\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._yRug ) );\n\n\tthis._yRug = v;\n\tdebug( 'New Value: %s.', JSON.stringify( this._yRug ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport indexOf from '@stdlib/utils/index-of';\nimport format from '@stdlib/string/format';\nimport ORIENTATIONS from './orientations.json';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:x-rug-orient' );\n\n\n// MAIN //\n\n/**\n* Sets the x-axis rug orientation.\n*\n* @private\n* @param {(string|StringArray)} v - rug orientation\n* @throws {TypeError} must be either a string or string array\n* @throws {TypeError} must be either `'bottom'` or `'top'`\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar isStr = isString( v );\n\tvar i;\n\tif ( !isStr && !isStringArray( v ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.', 'xRugOrient', v ) );\n\t}\n\tif ( isStr ) {\n\t\tv = [ v ];\n\t} else {\n\t\tv = v.slice();\n\t}\n\tfor ( i = 0; i < v.length; i++ ) {\n\t\tif ( indexOf( ORIENTATIONS, v[i] ) === -1 ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. Unrecognized/unsupported orientation. A `%s` value must be one of the following: \"%s\". Value: `%s`.', 'xRugOrient', ORIENTATIONS.join( '\", \"' ), v[ i ] ) );\n\t\t}\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._xRugOrient ) );\n\n\tthis._xRugOrient = v;\n\tdebug( 'New value: %s.', JSON.stringify( this._xRugOrient ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport indexOf from '@stdlib/utils/index-of';\nimport format from '@stdlib/string/format';\nimport ORIENTATIONS from './orientations.json';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:y-rug-orient' );\n\n\n// MAIN //\n\n/**\n* Sets the y-axis rug orientation.\n*\n* @private\n* @param {(string|StringArray)} v - rug orientation\n* @throws {TypeError} must be either a string or string array\n* @throws {TypeError} must be either `'bottom'` or `'top'`\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar isStr = isString( v );\n\tvar i;\n\tif ( !isStr && !isStringArray( v ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string or an array of strings. Value: `%s`.', 'yRugOrient', v ) );\n\t}\n\tif ( isStr ) {\n\t\tv = [ v ];\n\t} else {\n\t\tv = v.slice();\n\t}\n\tfor ( i = 0; i < v.length; i++ ) {\n\t\tif ( indexOf( ORIENTATIONS, v[i] ) === -1 ) {\n\t\t\tthrow new TypeError( format( 'invalid assignment. Unrecognized/unsupported orientation. A `%s` value must be one of the following: \"%s\". Value: `%s`.', 'yRugOrient', ORIENTATIONS.join( '\", \"' ), v[i] ) );\n\t\t}\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._yRugOrient ) );\n\n\tthis._yRugOrient = v;\n\tdebug( 'New value: %s.', JSON.stringify( this._yRugOrient ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport { primitives as isNumberArray } from '@stdlib/assert/is-number-array';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:x-rug-opacity' );\n\n\n// MAIN //\n\n/**\n* Sets the x-axis rug opacity.\n*\n* @private\n* @param {(number|NumberArray)} v - opacity\n* @throws {TypeError} must be a number or number array\n* @throws {RangeError} must be a number on the interval `[0,1]`\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar isNum = isNumber( v );\n\tvar i;\n\tif ( !isNum && !isNumberArray( v ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a number or an array of numbers. Value: `%s`.', 'xRugOpacity', v ) );\n\t}\n\tif ( isNum ) {\n\t\tv = [ v ];\n\t} else {\n\t\tv = v.slice();\n\t}\n\tfor ( i = 0; i < v.length; i++ ) {\n\t\tif ( v[ i ] < 0.0 || v[ i ] > 1.0 ) {\n\t\t\tthrow new RangeError( format( 'invalid assignment. A `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'xRugOpacity', v[i] ) );\n\t\t}\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._xRugOpacity ) );\n\n\tthis._xRugOpacity = v;\n\tdebug( 'New Value: %s.', JSON.stringify( this._xRugOpacity ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport { primitives as isNumberArray } from '@stdlib/assert/is-number-array';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:y-rug-opacity' );\n\n\n// MAIN //\n\n/**\n* Sets the y-axis rug opacity.\n*\n* @private\n* @param {(number|NumberArray)} v - opacity\n* @throws {TypeError} must be a number or number array\n* @throws {RangeError} must be a number on the interval `[0,1]`\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar isNum = isNumber( v );\n\tvar i;\n\tif ( !isNum && !isNumberArray( v ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a number or an array of numbers. Value: `%s`.', 'yRugOpacity', v ) );\n\t}\n\tif ( isNum ) {\n\t\tv = [ v ];\n\t} else {\n\t\tv = v.slice();\n\t}\n\tfor ( i = 0; i < v.length; i++ ) {\n\t\tif ( v[ i ] < 0.0 || v[ i ] > 1.0 ) {\n\t\t\tthrow new RangeError( format( 'invalid assignment. A `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'yRugOpacity', v[ i ] ) );\n\t\t}\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._yRugOpacity ) );\n\n\tthis._yRugOpacity = v;\n\tdebug( 'New Value: %s.', JSON.stringify( this._yRugOpacity ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { primitives as isNonNegativeIntegerArray } from '@stdlib/assert/is-nonnegative-integer-array';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:x-rug-size' );\n\n\n// MAIN //\n\n/**\n* Sets the x-axis rug tick (tassel) size.\n*\n* @private\n* @param {(NonNegativeInteger|Array)} v - size\n* @throws {TypeError} must be a nonnegative integer or nonnegative integer array\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar isInt = isNonNegativeInteger( v );\n\tif ( !isInt && !isNonNegativeIntegerArray( v ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or an array of nonnegative integers. Value: `%s`.', 'xRugSize', v ) );\n\t}\n\tif ( isInt ) {\n\t\tv = [ v ];\n\t} else {\n\t\tv = v.slice();\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._xRugSize ) );\n\n\tthis._xRugSize = v;\n\tdebug( 'New Value: %s.', JSON.stringify( this._xRugSize ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { primitives as isNonNegativeIntegerArray } from '@stdlib/assert/is-nonnegative-integer-array';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:y-rug-size' );\n\n\n// MAIN //\n\n/**\n* Sets the y-axis rug tick (tassel) size.\n*\n* @private\n* @param {(NonNegativeInteger|Array)} v - size\n* @throws {TypeError} must be a nonnegative integer or nonnegative integer array\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar isInt = isNonNegativeInteger( v );\n\tif ( !isInt && !isNonNegativeIntegerArray( v ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or an array of nonnegative integers. Value: `%s`.', 'yRugSize', v ) );\n\t}\n\tif ( isInt ) {\n\t\tv = [ v ];\n\t} else {\n\t\tv = v.slice();\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._yRugSize ) );\n\n\tthis._yRugSize = v;\n\tdebug( 'New Value: %s.', JSON.stringify( this._yRugSize ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:description' );\n\n\n// MAIN //\n\n/**\n* Sets the description.\n*\n* @private\n* @param {string} str - description\n* @throws {TypeError} must be a string\n*/\nfunction set( str ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'description', str ) );\n\t}\n\tif ( str !== this._description ) {\n\t\tdebug( 'Current value: %s.', this._description );\n\n\t\tthis._description = str;\n\t\tdebug( 'New value: %s.', this._description );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:title' );\n\n\n// MAIN //\n\n/**\n* Sets the title.\n*\n* @private\n* @param {string} str - title\n* @throws {TypeError} must be a string\n*/\nfunction set( str ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'title', str ) );\n\t}\n\tif ( str !== this._title ) {\n\t\tdebug( 'Current value: %s.', this._title );\n\n\t\tthis._title = str;\n\t\tdebug( 'New value: %s.', this._title );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:x-label' );\n\n\n// MAIN //\n\n/**\n* Sets the x-axis label.\n*\n* @private\n* @param {string} label - axis label\n* @throws {TypeError} must be a string\n*/\nfunction set( label ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isString( label ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'xLabel', label ) );\n\t}\n\tif ( label !== this._xLabel ) {\n\t\tdebug( 'Current value: %s.', this._xLabel );\n\n\t\tthis._xLabel = label;\n\t\tdebug( 'New value: %s.', this._xLabel );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:y-label' );\n\n\n// MAIN //\n\n/**\n* Sets the y-axis label.\n*\n* @private\n* @param {string} label - axis label\n* @throws {TypeError} must be a string\n*/\nfunction set( label ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isString( label ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'yLabel', label ) );\n\t}\n\tif ( label !== this._yLabel ) {\n\t\tdebug( 'Current value: %s.', this._yLabel );\n\n\t\tthis._yLabel = label;\n\t\tdebug( 'New value: %s.', this._yLabel );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport contains from '@stdlib/assert/contains';\nimport format from '@stdlib/string/format';\nimport ENGINES from './engines.json';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:engine' );\n\n\n// MAIN //\n\n/**\n* Sets the engine.\n*\n* @private\n* @param {string} engine - engine\n* @throws {TypeError} must be a recognized engine\n*/\nfunction set( engine ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !contains( ENGINES, engine ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be one of the following: \"%s\". Value: `%s`.', 'engine', ENGINES.join( '\", \"' ), engine ) );\n\t}\n\tif ( engine !== this._engine ) {\n\t\tdebug( 'Current value: %s.', this._engine );\n\n\t\tthis._engine = engine;\n\t\tdebug( 'New value: %s.', this._engine );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:auto-render' );\n\n\n// MAIN //\n\n/**\n* Sets the rendering mode.\n*\n* @private\n* @param {boolean} bool - boolean indicating whether to re-render on a change event\n* @throws {TypeError} must be a boolean\n*/\nfunction set( bool ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isBoolean( bool ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) );\n\t}\n\tif ( bool !== this._autoRender ) {\n\t\tdebug( 'Current value: %s.', this._autoRender );\n\n\t\tthis._autoRender = bool;\n\t\tdebug( 'New Value: %s.', this._autoRender );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport indexOf from '@stdlib/utils/index-of';\nimport format from '@stdlib/string/format';\nimport FORMATS from './formats.json';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:renderformat' );\n\n\n// MAIN //\n\n/**\n* Sets the render format.\n*\n* @private\n* @param {string} fmt - format\n* @throws {TypeError} must be a recognized render format\n*/\nfunction set( fmt ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( indexOf( FORMATS, fmt ) === -1 ) {\n\t\tthrow new TypeError( format( 'invalid assignment. Unrecognized/unsupported `%s`. Must be one of the following: \"%s\". Value: `%s`.', 'format', FORMATS.join( '\", \"' ), fmt ) );\n\t}\n\tif ( fmt !== this._renderFormat ) {\n\t\tdebug( 'Current value: %s.', this._renderFormat );\n\n\t\tthis._renderFormat = fmt;\n\t\tdebug( 'New value: %s.', this._renderFormat );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport indexOf from '@stdlib/utils/index-of';\nimport format from '@stdlib/string/format';\nimport VIEWERS from './viewers.json';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:viewer' );\n\n\n// MAIN //\n\n/**\n* Sets the viewer.\n*\n* @private\n* @param {string} viewer - viewer\n* @throws {TypeError} must be a recognized viewer\n*/\nfunction set( viewer ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( indexOf( VIEWERS, viewer ) === -1 ) {\n\t\tthrow new TypeError( format( 'invalid assignment. Unrecognized/unsupported `%s`. Value: `%s`.', 'viewer', viewer ) );\n\t}\n\tif ( viewer !== this._viewer ) {\n\t\tdebug( 'Current value: %s.', this._viewer );\n\n\t\tthis._viewer = viewer;\n\t\tdebug( 'New value: %s.', this._viewer );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:set:auto-view' );\n\n\n// MAIN //\n\n/**\n* Sets the viewing mode.\n*\n* @private\n* @param {boolean} bool - boolean indicating whether to generate an updated view on a render event\n* @throws {TypeError} must be a boolean\n*/\nfunction set( bool ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isBoolean( bool ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoView', bool ) );\n\t}\n\tif ( bool !== this._autoView ) {\n\t\tdebug( 'Current value: %s.', this._autoView );\n\n\t\tthis._autoView = bool;\n\t\tdebug( 'New Value: %s.', this._autoView );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:x-pos' );\n\n\n// MAIN //\n\n/**\n* Returns a function to map values to x-axis coordinate values.\n*\n* @private\n* @returns {Function} map function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar scale = this.xScale;\n\treturn xPos;\n\n\t/**\n\t* Maps a value to a x-axis coordinate value.\n\t*\n\t* @private\n\t* @param {number} d - datum\n\t* @returns {number} pixel value\n\t*/\n\tfunction xPos( d ) {\n\t\tvar px = scale( d );\n\t\tdebug( 'Value: %d => Pixel: %d.', d, px );\n\t\treturn px;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:y-pos' );\n\n\n// MAIN //\n\n/**\n* Returns a function to map values to y-axis coordinate values.\n*\n* @private\n* @returns {Function} map function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar scale = this.yScale;\n\treturn yPos;\n\n\t/**\n\t* Maps a value to a y-axis coordinate value.\n\t*\n\t* @private\n\t* @param {number} d - datum\n\t* @returns {number} pixel value\n\t*/\n\tfunction yPos( d ) {\n\t\tvar px = scale( d );\n\t\tdebug( 'Value: %d => Pixel: %d.', d, px );\n\t\treturn px;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/*!\n * escape-html\n * Copyright(c) 2012-2013 TJ Holowaychuk\n * Copyright(c) 2015 Andreas Lubbe\n * Copyright(c) 2015 Tiancheng \"Timothy\" Gu\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module variables.\n * @private\n */\n\nvar matchHtmlRegExp = /[\"'&<>]/;\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = escapeHtml;\n\n/**\n * Escape special characters in the given string of html.\n *\n * @param {string} string The string to escape for inserting into HTML\n * @return {string}\n * @public\n */\n\nfunction escapeHtml(string) {\n var str = '' + string;\n var match = matchHtmlRegExp.exec(str);\n\n if (!match) {\n return str;\n }\n\n var escape;\n var html = '';\n var index = 0;\n var lastIndex = 0;\n\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34: // \"\n escape = '"';\n break;\n case 38: // &\n escape = '&';\n break;\n case 39: // '\n escape = ''';\n break;\n case 60: // <\n escape = '<';\n break;\n case 62: // >\n escape = '>';\n break;\n default:\n continue;\n }\n\n if (lastIndex !== index) {\n html += str.substring(lastIndex, index);\n }\n\n lastIndex = index + 1;\n html += escape;\n }\n\n return lastIndex !== index\n ? html + str.substring(lastIndex, index)\n : html;\n}\n","module.exports = extend\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n target[key] = source[key]\n }\n }\n }\n\n return target\n}\n","module.exports = \"2\"\n","var version = require(\"./version\")\n\nmodule.exports = isVirtualNode\n\nfunction isVirtualNode(x) {\n return x && x.type === \"VirtualNode\" && x.version === version\n}\n","var version = require(\"./version\")\n\nmodule.exports = isVirtualText\n\nfunction isVirtualText(x) {\n return x && x.type === \"VirtualText\" && x.version === version\n}\n","module.exports = isThunk\r\n\r\nfunction isThunk(t) {\r\n return t && t.type === \"Thunk\"\r\n}\r\n","module.exports = isWidget\n\nfunction isWidget(w) {\n return w && w.type === \"Widget\"\n}\n","'use strict';\n\nmodule.exports = SoftSetHook;\n\nfunction SoftSetHook(value) {\n if (!(this instanceof SoftSetHook)) {\n return new SoftSetHook(value);\n }\n\n this.value = value;\n}\n\nSoftSetHook.prototype.hook = function (node, propertyName) {\n if (node[propertyName] !== this.value) {\n node[propertyName] = this.value;\n }\n};\n","'use strict';\n\nmodule.exports = AttributeHook;\n\nfunction AttributeHook(namespace, value) {\n if (!(this instanceof AttributeHook)) {\n return new AttributeHook(namespace, value);\n }\n\n this.namespace = namespace;\n this.value = value;\n}\n\nAttributeHook.prototype.hook = function (node, prop, prev) {\n if (prev && prev.type === 'AttributeHook' &&\n prev.value === this.value &&\n prev.namespace === this.namespace) {\n return;\n }\n\n node.setAttributeNS(this.namespace, prop, this.value);\n};\n\nAttributeHook.prototype.unhook = function (node, prop, next) {\n if (next && next.type === 'AttributeHook' &&\n next.namespace === this.namespace) {\n return;\n }\n\n var colonPosition = prop.indexOf(':');\n var localName = colonPosition > -1 ? prop.substr(colonPosition + 1) : prop;\n node.removeAttributeNS(this.namespace, localName);\n};\n\nAttributeHook.prototype.type = 'AttributeHook';\n","/**\n * Special language-specific overrides.\n *\n * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt\n *\n * @type {Object}\n */\nvar LANGUAGES = {\n tr: {\n regexp: /\\u0130|\\u0049|\\u0049\\u0307/g,\n map: {\n '\\u0130': '\\u0069',\n '\\u0049': '\\u0131',\n '\\u0049\\u0307': '\\u0069'\n }\n },\n az: {\n regexp: /[\\u0130]/g,\n map: {\n '\\u0130': '\\u0069',\n '\\u0049': '\\u0131',\n '\\u0049\\u0307': '\\u0069'\n }\n },\n lt: {\n regexp: /[\\u0049\\u004A\\u012E\\u00CC\\u00CD\\u0128]/g,\n map: {\n '\\u0049': '\\u0069\\u0307',\n '\\u004A': '\\u006A\\u0307',\n '\\u012E': '\\u012F\\u0307',\n '\\u00CC': '\\u0069\\u0307\\u0300',\n '\\u00CD': '\\u0069\\u0307\\u0301',\n '\\u0128': '\\u0069\\u0307\\u0303'\n }\n }\n}\n\n/**\n * Lowercase a string.\n *\n * @param {String} str\n * @return {String}\n */\nmodule.exports = function (str, locale) {\n var lang = LANGUAGES[locale]\n\n str = str == null ? '' : String(str)\n\n if (lang) {\n str = str.replace(lang.regexp, function (m) { return lang.map[m] })\n }\n\n return str.toLowerCase()\n}\n","var escape = require('escape-html');\nvar propConfig = require('./property-config');\nvar types = propConfig.attributeTypes;\nvar properties = propConfig.properties;\nvar attributeNames = propConfig.attributeNames;\n\nvar prefixAttribute = memoizeString(function (name) {\n return escape(name) + '=\"';\n});\n\nmodule.exports = createAttribute;\n\n/**\n * Create attribute string.\n *\n * @param {String} name The name of the property or attribute\n * @param {*} value The value\n * @param {Boolean} [isAttribute] Denotes whether `name` is an attribute.\n * @return {?String} Attribute string || null if not a valid property or custom attribute.\n */\n\nfunction createAttribute(name, value, isAttribute) {\n if (properties.hasOwnProperty(name)) {\n if (shouldSkip(name, value)) return '';\n name = (attributeNames[name] || name).toLowerCase();\n var attrType = properties[name];\n // for BOOLEAN `value` only has to be truthy\n // for OVERLOADED_BOOLEAN `value` has to be === true\n if ((attrType === types.BOOLEAN) ||\n (attrType === types.OVERLOADED_BOOLEAN && value === true)) {\n return escape(name);\n }\n return prefixAttribute(name) + escape(value) + '\"';\n } else if (isAttribute) {\n if (value == null) return '';\n return prefixAttribute(name) + escape(value) + '\"';\n }\n // return null if `name` is neither a valid property nor an attribute\n return null;\n}\n\n/**\n * Should skip false boolean attributes.\n */\n\nfunction shouldSkip(name, value) {\n var attrType = properties[name];\n return value == null ||\n (attrType === types.BOOLEAN && !value) ||\n (attrType === types.OVERLOADED_BOOLEAN && value === false);\n}\n\n/**\n * Memoizes the return value of a function that accepts one string argument.\n *\n * @param {function} callback\n * @return {function}\n */\n\nfunction memoizeString(callback) {\n var cache = {};\n return function(string) {\n if (cache.hasOwnProperty(string)) {\n return cache[string];\n } else {\n return cache[string] = callback.call(this, string);\n }\n };\n}","var lowerCase = require('lower-case')\n\nvar NON_WORD_REGEXP = require('./vendor/non-word-regexp')\nvar CAMEL_CASE_REGEXP = require('./vendor/camel-case-regexp')\nvar TRAILING_DIGIT_REGEXP = require('./vendor/trailing-digit-regexp')\n\n/**\n * Sentence case a string.\n *\n * @param {String} str\n * @param {String} locale\n * @param {String} replacement\n * @return {String}\n */\nmodule.exports = function (str, locale, replacement) {\n if (str == null) {\n return ''\n }\n\n replacement = replacement || ' '\n\n function replace (match, index, string) {\n if (index === 0 || index === (string.length - match.length)) {\n return ''\n }\n\n return replacement\n }\n\n str = String(str)\n // Support camel case (\"camelCase\" -> \"camel Case\").\n .replace(CAMEL_CASE_REGEXP, '$1 $2')\n // Support digit groups (\"test2012\" -> \"test 2012\").\n .replace(TRAILING_DIGIT_REGEXP, '$1 $2')\n // Remove all non-word characters and replace with a single space.\n .replace(NON_WORD_REGEXP, replace)\n\n // Lower case the entire string.\n return lowerCase(str, locale)\n}\n","module.exports = /[^\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0\\u08A2-\\u08AC\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA697\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA793\\uA7A0-\\uA7AA\\uA7F8-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u0030-\\u0039\\u00B2\\u00B3\\u00B9\\u00BC-\\u00BE\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u09F4-\\u09F9\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0B72-\\u0B77\\u0BE6-\\u0BF2\\u0C66-\\u0C6F\\u0C78-\\u0C7E\\u0CE6-\\u0CEF\\u0D66-\\u0D75\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F33\\u1040-\\u1049\\u1090-\\u1099\\u1369-\\u137C\\u16EE-\\u16F0\\u17E0-\\u17E9\\u17F0-\\u17F9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19DA\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u2182\\u2185-\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA620-\\uA629\\uA6E6-\\uA6EF\\uA830-\\uA835\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19]+/g\n","module.exports = /([\\u0061-\\u007A\\u00B5\\u00DF-\\u00F6\\u00F8-\\u00FF\\u0101\\u0103\\u0105\\u0107\\u0109\\u010B\\u010D\\u010F\\u0111\\u0113\\u0115\\u0117\\u0119\\u011B\\u011D\\u011F\\u0121\\u0123\\u0125\\u0127\\u0129\\u012B\\u012D\\u012F\\u0131\\u0133\\u0135\\u0137\\u0138\\u013A\\u013C\\u013E\\u0140\\u0142\\u0144\\u0146\\u0148\\u0149\\u014B\\u014D\\u014F\\u0151\\u0153\\u0155\\u0157\\u0159\\u015B\\u015D\\u015F\\u0161\\u0163\\u0165\\u0167\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173\\u0175\\u0177\\u017A\\u017C\\u017E-\\u0180\\u0183\\u0185\\u0188\\u018C\\u018D\\u0192\\u0195\\u0199-\\u019B\\u019E\\u01A1\\u01A3\\u01A5\\u01A8\\u01AA\\u01AB\\u01AD\\u01B0\\u01B4\\u01B6\\u01B9\\u01BA\\u01BD-\\u01BF\\u01C6\\u01C9\\u01CC\\u01CE\\u01D0\\u01D2\\u01D4\\u01D6\\u01D8\\u01DA\\u01DC\\u01DD\\u01DF\\u01E1\\u01E3\\u01E5\\u01E7\\u01E9\\u01EB\\u01ED\\u01EF\\u01F0\\u01F3\\u01F5\\u01F9\\u01FB\\u01FD\\u01FF\\u0201\\u0203\\u0205\\u0207\\u0209\\u020B\\u020D\\u020F\\u0211\\u0213\\u0215\\u0217\\u0219\\u021B\\u021D\\u021F\\u0221\\u0223\\u0225\\u0227\\u0229\\u022B\\u022D\\u022F\\u0231\\u0233-\\u0239\\u023C\\u023F\\u0240\\u0242\\u0247\\u0249\\u024B\\u024D\\u024F-\\u0293\\u0295-\\u02AF\\u0371\\u0373\\u0377\\u037B-\\u037D\\u0390\\u03AC-\\u03CE\\u03D0\\u03D1\\u03D5-\\u03D7\\u03D9\\u03DB\\u03DD\\u03DF\\u03E1\\u03E3\\u03E5\\u03E7\\u03E9\\u03EB\\u03ED\\u03EF-\\u03F3\\u03F5\\u03F8\\u03FB\\u03FC\\u0430-\\u045F\\u0461\\u0463\\u0465\\u0467\\u0469\\u046B\\u046D\\u046F\\u0471\\u0473\\u0475\\u0477\\u0479\\u047B\\u047D\\u047F\\u0481\\u048B\\u048D\\u048F\\u0491\\u0493\\u0495\\u0497\\u0499\\u049B\\u049D\\u049F\\u04A1\\u04A3\\u04A5\\u04A7\\u04A9\\u04AB\\u04AD\\u04AF\\u04B1\\u04B3\\u04B5\\u04B7\\u04B9\\u04BB\\u04BD\\u04BF\\u04C2\\u04C4\\u04C6\\u04C8\\u04CA\\u04CC\\u04CE\\u04CF\\u04D1\\u04D3\\u04D5\\u04D7\\u04D9\\u04DB\\u04DD\\u04DF\\u04E1\\u04E3\\u04E5\\u04E7\\u04E9\\u04EB\\u04ED\\u04EF\\u04F1\\u04F3\\u04F5\\u04F7\\u04F9\\u04FB\\u04FD\\u04FF\\u0501\\u0503\\u0505\\u0507\\u0509\\u050B\\u050D\\u050F\\u0511\\u0513\\u0515\\u0517\\u0519\\u051B\\u051D\\u051F\\u0521\\u0523\\u0525\\u0527\\u0561-\\u0587\\u1D00-\\u1D2B\\u1D6B-\\u1D77\\u1D79-\\u1D9A\\u1E01\\u1E03\\u1E05\\u1E07\\u1E09\\u1E0B\\u1E0D\\u1E0F\\u1E11\\u1E13\\u1E15\\u1E17\\u1E19\\u1E1B\\u1E1D\\u1E1F\\u1E21\\u1E23\\u1E25\\u1E27\\u1E29\\u1E2B\\u1E2D\\u1E2F\\u1E31\\u1E33\\u1E35\\u1E37\\u1E39\\u1E3B\\u1E3D\\u1E3F\\u1E41\\u1E43\\u1E45\\u1E47\\u1E49\\u1E4B\\u1E4D\\u1E4F\\u1E51\\u1E53\\u1E55\\u1E57\\u1E59\\u1E5B\\u1E5D\\u1E5F\\u1E61\\u1E63\\u1E65\\u1E67\\u1E69\\u1E6B\\u1E6D\\u1E6F\\u1E71\\u1E73\\u1E75\\u1E77\\u1E79\\u1E7B\\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\\u2CB3\\u2CB5\\u2CB7\\u2CB9\\u2CBB\\u2CBD\\u2CBF\\u2CC1\\u2CC3\\u2CC5\\u2CC7\\u2CC9\\u2CCB\\u2CCD\\u2CCF\\u2CD1\\u2CD3\\u2CD5\\u2CD7\\u2CD9\\u2CDB\\u2CDD\\u2CDF\\u2CE1\\u2CE3\\u2CE4\\u2CEC\\u2CEE\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\uA641\\uA643\\uA645\\uA647\\uA649\\uA64B\\uA64D\\uA64F\\uA651\\uA653\\uA655\\uA657\\uA659\\uA65B\\uA65D\\uA65F\\uA661\\uA663\\uA665\\uA667\\uA669\\uA66B\\uA66D\\uA681\\uA683\\uA685\\uA687\\uA689\\uA68B\\uA68D\\uA68F\\uA691\\uA693\\uA695\\uA697\\uA723\\uA725\\uA727\\uA729\\uA72B\\uA72D\\uA72F-\\uA731\\uA733\\uA735\\uA737\\uA739\\uA73B\\uA73D\\uA73F\\uA741\\uA743\\uA745\\uA747\\uA749\\uA74B\\uA74D\\uA74F\\uA751\\uA753\\uA755\\uA757\\uA759\\uA75B\\uA75D\\uA75F\\uA761\\uA763\\uA765\\uA767\\uA769\\uA76B\\uA76D\\uA76F\\uA771-\\uA778\\uA77A\\uA77C\\uA77F\\uA781\\uA783\\uA785\\uA787\\uA78C\\uA78E\\uA791\\uA793\\uA7A1\\uA7A3\\uA7A5\\uA7A7\\uA7A9\\uA7FA\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFF41-\\uFF5A])([\\u0041-\\u005A\\u00C0-\\u00D6\\u00D8-\\u00DE\\u0100\\u0102\\u0104\\u0106\\u0108\\u010A\\u010C\\u010E\\u0110\\u0112\\u0114\\u0116\\u0118\\u011A\\u011C\\u011E\\u0120\\u0122\\u0124\\u0126\\u0128\\u012A\\u012C\\u012E\\u0130\\u0132\\u0134\\u0136\\u0139\\u013B\\u013D\\u013F\\u0141\\u0143\\u0145\\u0147\\u014A\\u014C\\u014E\\u0150\\u0152\\u0154\\u0156\\u0158\\u015A\\u015C\\u015E\\u0160\\u0162\\u0164\\u0166\\u0168\\u016A\\u016C\\u016E\\u0170\\u0172\\u0174\\u0176\\u0178\\u0179\\u017B\\u017D\\u0181\\u0182\\u0184\\u0186\\u0187\\u0189-\\u018B\\u018E-\\u0191\\u0193\\u0194\\u0196-\\u0198\\u019C\\u019D\\u019F\\u01A0\\u01A2\\u01A4\\u01A6\\u01A7\\u01A9\\u01AC\\u01AE\\u01AF\\u01B1-\\u01B3\\u01B5\\u01B7\\u01B8\\u01BC\\u01C4\\u01C7\\u01CA\\u01CD\\u01CF\\u01D1\\u01D3\\u01D5\\u01D7\\u01D9\\u01DB\\u01DE\\u01E0\\u01E2\\u01E4\\u01E6\\u01E8\\u01EA\\u01EC\\u01EE\\u01F1\\u01F4\\u01F6-\\u01F8\\u01FA\\u01FC\\u01FE\\u0200\\u0202\\u0204\\u0206\\u0208\\u020A\\u020C\\u020E\\u0210\\u0212\\u0214\\u0216\\u0218\\u021A\\u021C\\u021E\\u0220\\u0222\\u0224\\u0226\\u0228\\u022A\\u022C\\u022E\\u0230\\u0232\\u023A\\u023B\\u023D\\u023E\\u0241\\u0243-\\u0246\\u0248\\u024A\\u024C\\u024E\\u0370\\u0372\\u0376\\u0386\\u0388-\\u038A\\u038C\\u038E\\u038F\\u0391-\\u03A1\\u03A3-\\u03AB\\u03CF\\u03D2-\\u03D4\\u03D8\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2\\u03E4\\u03E6\\u03E8\\u03EA\\u03EC\\u03EE\\u03F4\\u03F7\\u03F9\\u03FA\\u03FD-\\u042F\\u0460\\u0462\\u0464\\u0466\\u0468\\u046A\\u046C\\u046E\\u0470\\u0472\\u0474\\u0476\\u0478\\u047A\\u047C\\u047E\\u0480\\u048A\\u048C\\u048E\\u0490\\u0492\\u0494\\u0496\\u0498\\u049A\\u049C\\u049E\\u04A0\\u04A2\\u04A4\\u04A6\\u04A8\\u04AA\\u04AC\\u04AE\\u04B0\\u04B2\\u04B4\\u04B6\\u04B8\\u04BA\\u04BC\\u04BE\\u04C0\\u04C1\\u04C3\\u04C5\\u04C7\\u04C9\\u04CB\\u04CD\\u04D0\\u04D2\\u04D4\\u04D6\\u04D8\\u04DA\\u04DC\\u04DE\\u04E0\\u04E2\\u04E4\\u04E6\\u04E8\\u04EA\\u04EC\\u04EE\\u04F0\\u04F2\\u04F4\\u04F6\\u04F8\\u04FA\\u04FC\\u04FE\\u0500\\u0502\\u0504\\u0506\\u0508\\u050A\\u050C\\u050E\\u0510\\u0512\\u0514\\u0516\\u0518\\u051A\\u051C\\u051E\\u0520\\u0522\\u0524\\u0526\\u0531-\\u0556\\u10A0-\\u10C5\\u10C7\\u10CD\\u1E00\\u1E02\\u1E04\\u1E06\\u1E08\\u1E0A\\u1E0C\\u1E0E\\u1E10\\u1E12\\u1E14\\u1E16\\u1E18\\u1E1A\\u1E1C\\u1E1E\\u1E20\\u1E22\\u1E24\\u1E26\\u1E28\\u1E2A\\u1E2C\\u1E2E\\u1E30\\u1E32\\u1E34\\u1E36\\u1E38\\u1E3A\\u1E3C\\u1E3E\\u1E40\\u1E42\\u1E44\\u1E46\\u1E48\\u1E4A\\u1E4C\\u1E4E\\u1E50\\u1E52\\u1E54\\u1E56\\u1E58\\u1E5A\\u1E5C\\u1E5E\\u1E60\\u1E62\\u1E64\\u1E66\\u1E68\\u1E6A\\u1E6C\\u1E6E\\u1E70\\u1E72\\u1E74\\u1E76\\u1E78\\u1E7A\\u1E7C\\u1E7E\\u1E80\\u1E82\\u1E84\\u1E86\\u1E88\\u1E8A\\u1E8C\\u1E8E\\u1E90\\u1E92\\u1E94\\u1E9E\\u1EA0\\u1EA2\\u1EA4\\u1EA6\\u1EA8\\u1EAA\\u1EAC\\u1EAE\\u1EB0\\u1EB2\\u1EB4\\u1EB6\\u1EB8\\u1EBA\\u1EBC\\u1EBE\\u1EC0\\u1EC2\\u1EC4\\u1EC6\\u1EC8\\u1ECA\\u1ECC\\u1ECE\\u1ED0\\u1ED2\\u1ED4\\u1ED6\\u1ED8\\u1EDA\\u1EDC\\u1EDE\\u1EE0\\u1EE2\\u1EE4\\u1EE6\\u1EE8\\u1EEA\\u1EEC\\u1EEE\\u1EF0\\u1EF2\\u1EF4\\u1EF6\\u1EF8\\u1EFA\\u1EFC\\u1EFE\\u1F08-\\u1F0F\\u1F18-\\u1F1D\\u1F28-\\u1F2F\\u1F38-\\u1F3F\\u1F48-\\u1F4D\\u1F59\\u1F5B\\u1F5D\\u1F5F\\u1F68-\\u1F6F\\u1FB8-\\u1FBB\\u1FC8-\\u1FCB\\u1FD8-\\u1FDB\\u1FE8-\\u1FEC\\u1FF8-\\u1FFB\\u2102\\u2107\\u210B-\\u210D\\u2110-\\u2112\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u2130-\\u2133\\u213E\\u213F\\u2145\\u2183\\u2C00-\\u2C2E\\u2C60\\u2C62-\\u2C64\\u2C67\\u2C69\\u2C6B\\u2C6D-\\u2C70\\u2C72\\u2C75\\u2C7E-\\u2C80\\u2C82\\u2C84\\u2C86\\u2C88\\u2C8A\\u2C8C\\u2C8E\\u2C90\\u2C92\\u2C94\\u2C96\\u2C98\\u2C9A\\u2C9C\\u2C9E\\u2CA0\\u2CA2\\u2CA4\\u2CA6\\u2CA8\\u2CAA\\u2CAC\\u2CAE\\u2CB0\\u2CB2\\u2CB4\\u2CB6\\u2CB8\\u2CBA\\u2CBC\\u2CBE\\u2CC0\\u2CC2\\u2CC4\\u2CC6\\u2CC8\\u2CCA\\u2CCC\\u2CCE\\u2CD0\\u2CD2\\u2CD4\\u2CD6\\u2CD8\\u2CDA\\u2CDC\\u2CDE\\u2CE0\\u2CE2\\u2CEB\\u2CED\\u2CF2\\uA640\\uA642\\uA644\\uA646\\uA648\\uA64A\\uA64C\\uA64E\\uA650\\uA652\\uA654\\uA656\\uA658\\uA65A\\uA65C\\uA65E\\uA660\\uA662\\uA664\\uA666\\uA668\\uA66A\\uA66C\\uA680\\uA682\\uA684\\uA686\\uA688\\uA68A\\uA68C\\uA68E\\uA690\\uA692\\uA694\\uA696\\uA722\\uA724\\uA726\\uA728\\uA72A\\uA72C\\uA72E\\uA732\\uA734\\uA736\\uA738\\uA73A\\uA73C\\uA73E\\uA740\\uA742\\uA744\\uA746\\uA748\\uA74A\\uA74C\\uA74E\\uA750\\uA752\\uA754\\uA756\\uA758\\uA75A\\uA75C\\uA75E\\uA760\\uA762\\uA764\\uA766\\uA768\\uA76A\\uA76C\\uA76E\\uA779\\uA77B\\uA77D\\uA77E\\uA780\\uA782\\uA784\\uA786\\uA78B\\uA78D\\uA790\\uA792\\uA7A0\\uA7A2\\uA7A4\\uA7A6\\uA7A8\\uA7AA\\uFF21-\\uFF3A\\u0030-\\u0039\\u00B2\\u00B3\\u00B9\\u00BC-\\u00BE\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u09F4-\\u09F9\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0B72-\\u0B77\\u0BE6-\\u0BF2\\u0C66-\\u0C6F\\u0C78-\\u0C7E\\u0CE6-\\u0CEF\\u0D66-\\u0D75\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F33\\u1040-\\u1049\\u1090-\\u1099\\u1369-\\u137C\\u16EE-\\u16F0\\u17E0-\\u17E9\\u17F0-\\u17F9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19DA\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u2182\\u2185-\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA620-\\uA629\\uA6E6-\\uA6EF\\uA830-\\uA835\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19])/g\n","module.exports = /([\\u0030-\\u0039\\u00B2\\u00B3\\u00B9\\u00BC-\\u00BE\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u09F4-\\u09F9\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0B72-\\u0B77\\u0BE6-\\u0BF2\\u0C66-\\u0C6F\\u0C78-\\u0C7E\\u0CE6-\\u0CEF\\u0D66-\\u0D75\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F33\\u1040-\\u1049\\u1090-\\u1099\\u1369-\\u137C\\u16EE-\\u16F0\\u17E0-\\u17E9\\u17F0-\\u17F9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19DA\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u2182\\u2185-\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA620-\\uA629\\uA6E6-\\uA6EF\\uA830-\\uA835\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19])([^\\u0030-\\u0039\\u00B2\\u00B3\\u00B9\\u00BC-\\u00BE\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u09F4-\\u09F9\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0B72-\\u0B77\\u0BE6-\\u0BF2\\u0C66-\\u0C6F\\u0C78-\\u0C7E\\u0CE6-\\u0CEF\\u0D66-\\u0D75\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F33\\u1040-\\u1049\\u1090-\\u1099\\u1369-\\u137C\\u16EE-\\u16F0\\u17E0-\\u17E9\\u17F0-\\u17F9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19DA\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u2182\\u2185-\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA620-\\uA629\\uA6E6-\\uA6EF\\uA830-\\uA835\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19])/g\n","var sentenceCase = require('sentence-case')\n\n/**\n * Param case a string.\n *\n * @param {String} string\n * @param {String} [locale]\n * @return {String}\n */\nmodule.exports = function (string, locale) {\n return sentenceCase(string, locale, '-')\n}\n","/**\n * Attribute types.\n */\n\nvar types = {\n BOOLEAN: 1,\n OVERLOADED_BOOLEAN: 2\n};\n\n/**\n * Properties.\n *\n * Taken from https://github.com/facebook/react/blob/847357e42e5267b04dd6e297219eaa125ab2f9f4/src/browser/ui/dom/HTMLDOMPropertyConfig.js\n *\n */\n\nvar properties = {\n /**\n * Standard Properties\n */\n accept: true,\n acceptCharset: true,\n accessKey: true,\n action: true,\n allowFullScreen: types.BOOLEAN,\n allowTransparency: true,\n alt: true,\n async: types.BOOLEAN,\n autocomplete: true,\n autofocus: types.BOOLEAN,\n autoplay: types.BOOLEAN,\n cellPadding: true,\n cellSpacing: true,\n charset: true,\n checked: types.BOOLEAN,\n classID: true,\n className: true,\n cols: true,\n colSpan: true,\n content: true,\n contentEditable: true,\n contextMenu: true,\n controls: types.BOOLEAN,\n coords: true,\n crossOrigin: true,\n data: true, // For `` acts as `src`.\n dateTime: true,\n defer: types.BOOLEAN,\n dir: true,\n disabled: types.BOOLEAN,\n download: types.OVERLOADED_BOOLEAN,\n draggable: true,\n enctype: true,\n form: true,\n formAction: true,\n formEncType: true,\n formMethod: true,\n formNoValidate: types.BOOLEAN,\n formTarget: true,\n frameBorder: true,\n headers: true,\n height: true,\n hidden: types.BOOLEAN,\n href: true,\n hreflang: true,\n htmlFor: true,\n httpEquiv: true,\n icon: true,\n id: true,\n label: true,\n lang: true,\n list: true,\n loop: types.BOOLEAN,\n manifest: true,\n marginHeight: true,\n marginWidth: true,\n max: true,\n maxLength: true,\n media: true,\n mediaGroup: true,\n method: true,\n min: true,\n multiple: types.BOOLEAN,\n muted: types.BOOLEAN,\n name: true,\n noValidate: types.BOOLEAN,\n open: true,\n pattern: true,\n placeholder: true,\n poster: true,\n preload: true,\n radiogroup: true,\n readOnly: types.BOOLEAN,\n rel: true,\n required: types.BOOLEAN,\n role: true,\n rows: true,\n rowSpan: true,\n sandbox: true,\n scope: true,\n scrolling: true,\n seamless: types.BOOLEAN,\n selected: types.BOOLEAN,\n shape: true,\n size: true,\n sizes: true,\n span: true,\n spellcheck: true,\n src: true,\n srcdoc: true,\n srcset: true,\n start: true,\n step: true,\n style: true,\n tabIndex: true,\n target: true,\n title: true,\n type: true,\n useMap: true,\n value: true,\n width: true,\n wmode: true,\n\n /**\n * Non-standard Properties\n */\n // autoCapitalize and autoCorrect are supported in Mobile Safari for\n // keyboard hints.\n autocapitalize: true,\n autocorrect: true,\n // itemProp, itemScope, itemType are for Microdata support. See\n // http://schema.org/docs/gs.html\n itemProp: true,\n itemScope: types.BOOLEAN,\n itemType: true,\n // property is supported for OpenGraph in meta tags.\n property: true\n};\n\n/**\n * Properties to attributes mapping.\n *\n * The ones not here are simply converted to lower case.\n */\n\nvar attributeNames = {\n acceptCharset: 'accept-charset',\n className: 'class',\n htmlFor: 'for',\n httpEquiv: 'http-equiv'\n};\n\n/**\n * Exports.\n */\n\nmodule.exports = {\n attributeTypes: types,\n properties: properties,\n attributeNames: attributeNames\n};","\n/**\n * Void elements.\n *\n * https://github.com/facebook/react/blob/v0.12.0/src/browser/ui/ReactDOMComponent.js#L99\n */\n\nmodule.exports = {\n 'area': true,\n 'base': true,\n 'br': true,\n 'col': true,\n 'embed': true,\n 'hr': true,\n 'img': true,\n 'input': true,\n 'keygen': true,\n 'link': true,\n 'meta': true,\n 'param': true,\n 'source': true,\n 'track': true,\n 'wbr': true\n};","var escape = require('escape-html');\nvar extend = require('xtend');\nvar isVNode = require('virtual-dom/vnode/is-vnode');\nvar isVText = require('virtual-dom/vnode/is-vtext');\nvar isThunk = require('virtual-dom/vnode/is-thunk');\nvar isWidget = require('virtual-dom/vnode/is-widget');\nvar softHook = require('virtual-dom/virtual-hyperscript/hooks/soft-set-hook');\nvar attrHook = require('virtual-dom/virtual-hyperscript/hooks/attribute-hook');\nvar paramCase = require('param-case');\nvar createAttribute = require('./create-attribute');\nvar voidElements = require('./void-elements');\n\nmodule.exports = toHTML;\n\nfunction toHTML(node, parent) {\n if (!node) return '';\n\n if (isThunk(node)) {\n node = node.render();\n }\n\n if (isWidget(node) && node.render) {\n node = node.render();\n }\n\n if (isVNode(node)) {\n return openTag(node) + tagContent(node) + closeTag(node);\n } else if (isVText(node)) {\n if (parent && (parent.tagName.toLowerCase() === 'script'\n || parent.tagName.toLowerCase() === 'style'))\n return String(node.text);\n return escape(String(node.text));\n }\n\n return '';\n}\n\nfunction openTag(node) {\n var props = node.properties;\n var ret = '<' + node.tagName.toLowerCase();\n\n for (var name in props) {\n var value = props[name];\n if (value == null) continue;\n\n if (name == 'attributes') {\n value = extend({}, value);\n for (var attrProp in value) {\n ret += ' ' + createAttribute(attrProp, value[attrProp], true);\n }\n continue;\n }\n\n if (name == 'dataset') {\n value = extend({}, value);\n for (var dataProp in value) {\n ret += ' ' + createAttribute('data-' + paramCase(dataProp), value[dataProp], true);\n }\n continue;\n }\n\n if (name == 'style') {\n var css = '';\n value = extend({}, value);\n for (var styleProp in value) {\n css += paramCase(styleProp) + ': ' + value[styleProp] + '; ';\n }\n value = css.trim();\n }\n\n if (value instanceof softHook || value instanceof attrHook) {\n ret += ' ' + createAttribute(name, value.value, true);\n continue;\n }\n\n var attr = createAttribute(name, value);\n if (attr) ret += ' ' + attr;\n }\n\n return ret + '>';\n}\n\nfunction tagContent(node) {\n var innerHTML = node.properties.innerHTML;\n if (innerHTML != null) return innerHTML;\n else {\n var ret = '';\n if (node.children && node.children.length) {\n for (var i = 0, l = node.children.length; i';\n}\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:render:svg:marks:lines' );\n\n\n// MAIN //\n\n/**\n* Renders line marks.\n*\n* @private\n* @param {Object} state - state\n* @returns {VTree} virtual tree\n*/\nfunction render( state ) {\n\tvar nOpacities;\n\tvar lineStyle;\n\tvar opacity;\n\tvar nColors;\n\tvar nStyles;\n\tvar nWidths;\n\tvar color;\n\tvar width;\n\tvar marks;\n\tvar line;\n\tvar len;\n\tvar i;\n\n\tline = state.$.svg.path;\n\tnOpacities = state.lineOpacity.length;\n\tnStyles = state.lineStyle.length;\n\tnWidths = state.lineWidth.length;\n\tnColors = state.colors.length;\n\n\tlen = state.x.length;\n\tmarks = [];\n\n\tdebug( 'Rendering lines...' );\n\tfor ( i = 0; i < len; i++ ) {\n\t\tlineStyle = state.lineStyle[ i%nStyles ];\n\t\tdebug( 'Line style: %s (%d).', lineStyle, i );\n\n\t\tif ( lineStyle === 'none' ) {\n\t\t\tdebug( 'Line style (%d) is `none`. Skipping...', i );\n\t\t\tcontinue;\n\t\t}\n\t\tcolor = state.colors[ i%nColors ];\n\t\tdebug( 'Line color: %s (%d).', color, i );\n\n\t\topacity = state.lineOpacity[ i%nOpacities ];\n\t\tdebug( 'Line opacity: %s (%d).', opacity, i );\n\n\t\twidth = state.lineWidth[ i%nWidths ];\n\t\tdebug( 'Line width: %s (%d).', width, i );\n\n\t\tline.x = state.x[ i ];\n\t\tline.y = state.y[ i ];\n\t\tline.style = lineStyle;\n\t\tline.label = state.labels[ i ] || '';\n\t\tline.color = color;\n\t\tline.opacity = opacity;\n\t\tline.width = width;\n\n\t\tdebug( 'Rendering line %d...', i );\n\t\tmarks.push( line.render() );\n\t}\n\tdebug( 'Finished rendering lines.' );\n\treturn marks;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:render:svg:marks:symbols' );\n\n\n// MAIN //\n\n/**\n* Renders symbols marks.\n*\n* @private\n* @param {Object} state - state\n* @returns {VTree} virtual tree\n*/\nfunction render( state ) {\n\tvar nOpacities;\n\tvar nSymbols;\n\tvar nColors;\n\tvar opacity;\n\tvar nSizes;\n\tvar symbol;\n\tvar color;\n\tvar marks;\n\tvar size;\n\tvar sym;\n\tvar len;\n\tvar i;\n\n\tsym = state.$.svg.symbols;\n\tnOpacities = state.symbolsOpacity.length;\n\tnSymbols = state.symbols.length;\n\tnColors = state.colors.length;\n\tnSizes = state.symbolsSize.length;\n\n\tlen = state.x.length;\n\tmarks = [];\n\n\tdebug( 'Rendering symbols...' );\n\tfor ( i = 0; i < len; i++ ) {\n\t\tsymbol = state.symbols[ i%nSymbols ];\n\t\tdebug( 'Symbol: %s (%d).', symbol, i );\n\n\t\tif ( symbol === 'none' ) {\n\t\t\tdebug( 'Symbol (%d) is `none`. Skipping...', i );\n\t\t\tcontinue;\n\t\t}\n\t\topacity = state.symbolsOpacity[ i%nOpacities ];\n\t\tdebug( 'Symbols opacity: %d (%d).', opacity, i );\n\n\t\tsize = state.symbolsSize[ i%nSizes ];\n\t\tdebug( 'Symbols size: %d (%d).', size, i );\n\n\t\tcolor = state.colors[ i%nColors ];\n\t\tdebug( 'Symbols color: %s (%d).', color, i );\n\n\t\tsym.x = state.x[ i ];\n\t\tsym.y = state.y[ i ];\n\t\tsym.symbol = symbol;\n\t\tsym.label = state.labels[ i ] || '';\n\t\tsym.color = color;\n\t\tsym.size = size;\n\t\tsym.opacity = opacity;\n\n\t\tdebug( 'Rendering symbols %d...', i );\n\t\tmarks.push( sym.render() );\n\t}\n\tdebug( 'Finished rendering symbols.' );\n\treturn marks;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns an x-axis rug translation transform.\n*\n* @private\n* @param {string} orient - axis orientation\n* @param {number} height - graph height\n* @returns {string} transform\n*/\nfunction xRugTransform( orient, height ) {\n\tif ( orient === 'top' ) {\n\t\treturn 'translate(0,0)';\n\t}\n\treturn 'translate(0,'+height+')';\n}\n\n\n// EXPORTS //\n\nexport default xRugTransform;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport xRugTransform from './../utils/x_rug_transform.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:render:svg:marks:x-rug' );\n\n\n// MAIN //\n\n/**\n* Renders x-axis rug plots.\n*\n* @private\n* @param {Object} state - state\n* @returns {VTree} virtual tree\n*/\nfunction render( state ) {\n\tvar rugTransform;\n\tvar nOpacities;\n\tvar nOrients;\n\tvar opacity;\n\tvar nColors;\n\tvar nSizes;\n\tvar orient;\n\tvar nFlgs;\n\tvar color;\n\tvar marks;\n\tvar size;\n\tvar rug;\n\tvar len;\n\tvar tmp;\n\tvar i;\n\n\trug = state.$.svg.xRug;\n\n\tnOpacities = state.xRugOpacity.length;\n\tnOrients = state.xRugOrient.length;\n\tnColors = state.colors.length;\n\tnSizes = state.xRugSize.length;\n\tnFlgs = state.xRug.length;\n\n\tlen = state.x.length;\n\tmarks = [];\n\n\tdebug( 'Rendering x-axis rug plots...' );\n\tfor ( i = 0; i < len; i++ ) {\n\t\tif ( !state.xRug[ i%nFlgs ] ) {\n\t\t\tdebug( 'Rug plot (%d) disabled. Skipping...', i );\n\t\t\tcontinue;\n\t\t}\n\t\tcolor = state.colors[ i%nColors ];\n\t\tdebug( 'Rug color: %s (%d).', color, i );\n\n\t\topacity = state.xRugOpacity[ i%nOpacities ];\n\t\tdebug( 'Rug opacity: %d (%d).', opacity, i );\n\n\t\torient = state.xRugOrient[ i%nOrients ];\n\t\tdebug( 'Rug orientation: %s (%d).', orient, i );\n\n\t\tsize = state.xRugSize[ i%nSizes ];\n\t\tdebug( 'Rug tick size: %d (%d).', size, i );\n\n\t\trug.data = state.x[ i ];\n\t\trug.label = state.labels[ i ] || '';\n\t\trug.color = color;\n\t\trug.size = size;\n\t\trug.opacity = opacity;\n\t\trug.orientation = orient;\n\n\t\tdebug( 'Rendering x-axis rug %d...', i );\n\t\ttmp = rug.render();\n\n\t\t// Update the class name to indicate this is an x-axis rug and add a transform to translate the rug into position based on the graph dimensions.\n\t\ttmp.properties.className += ' x';\n\t\trugTransform = xRugTransform( orient, state.graphHeight );\n\t\tif ( !tmp.properties.attributes ) {\n\t\t\ttmp.properties.attributes = {};\n\t\t}\n\t\ttmp.properties.attributes.transform = rugTransform;\n\n\t\tmarks.push( tmp );\n\t}\n\tdebug( 'Finished rendering x-axis rug plots.' );\n\treturn marks;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns a y-axis rug translation transform.\n*\n* @private\n* @param {string} orient - axis orientation\n* @param {number} width - graph width\n* @returns {string} transform\n*/\nfunction yRugTransform( orient, width ) {\n\tif ( orient === 'left' ) {\n\t\treturn 'translate(0,0)';\n\t}\n\treturn 'translate('+width+',0)';\n}\n\n\n// EXPORTS //\n\nexport default yRugTransform;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport yRugTransform from './../utils/y_rug_transform.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:render:svg:marks:y-rug' );\n\n\n// MAIN //\n\n/**\n* Renders y-axis rug plots.\n*\n* @private\n* @param {Object} state - state\n* @returns {VTree} virtual tree\n*/\nfunction render( state ) {\n\tvar rugTransform;\n\tvar nOpacities;\n\tvar nOrients;\n\tvar opacity;\n\tvar nColors;\n\tvar nSizes;\n\tvar orient;\n\tvar nFlgs;\n\tvar color;\n\tvar marks;\n\tvar size;\n\tvar rug;\n\tvar len;\n\tvar tmp;\n\tvar i;\n\n\trug = state.$.svg.yRug;\n\n\tnOpacities = state.yRugOpacity.length;\n\tnOrients = state.yRugOrient.length;\n\tnColors = state.colors.length;\n\tnSizes = state.yRugSize.length;\n\tnFlgs = state.yRug.length;\n\n\tlen = state.y.length;\n\tmarks = [];\n\n\tdebug( 'Rendering y-axis rug plots...' );\n\tfor ( i = 0; i < len; i++ ) {\n\t\tif ( !state.yRug[ i%nFlgs ] ) {\n\t\t\tdebug( 'Rug plot (%d) disabled. Skipping...', i );\n\t\t\tcontinue;\n\t\t}\n\t\tcolor = state.colors[ i%nColors ];\n\t\tdebug( 'Rug color: %s (%d).', color, i );\n\n\t\topacity = state.yRugOpacity[ i%nOpacities ];\n\t\tdebug( 'Rug opacity: %d (%d).', opacity, i );\n\n\t\torient = state.yRugOrient[ i%nOrients ];\n\t\tdebug( 'Rug orientation: %s (%d).', orient, i );\n\n\t\tsize = state.yRugSize[ i%nSizes ];\n\t\tdebug( 'Rug tick size: %d (%d).', size, i );\n\n\t\trug.data = state.y[ i ];\n\t\trug.label = state.labels[ i ] || '';\n\t\trug.color = color;\n\t\trug.size = size;\n\t\trug.opacity = opacity;\n\t\trug.orientation = orient;\n\n\t\tdebug( 'Rendering y-axis rug %d...', i );\n\t\ttmp = rug.render();\n\n\t\t// Update the class name to indicate this is a y-axis rug and add a transform to translate the rug into position based on the graph dimensions.\n\t\ttmp.properties.className += ' y';\n\t\trugTransform = yRugTransform( orient, state.graphWidth );\n\t\tif ( !tmp.properties.attributes ) {\n\t\t\ttmp.properties.attributes = {};\n\t\t}\n\t\ttmp.properties.attributes.transform = rugTransform;\n\n\t\tmarks.push( tmp );\n\t}\n\tdebug( 'Finished rendering y-axis rug plots.' );\n\treturn marks;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport lines from './lines.js';\nimport symbols from './symbols.js';\nimport xRug from './x_rug.js';\nimport yRug from './y_rug.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:render:svg:marks' );\n\n\n// MAIN //\n\n/**\n* Renders individual marks.\n*\n* @private\n* @param {Object} state - state\n* @returns {VTree} virtual tree\n*/\nfunction render( state ) {\n\tvar parent;\n\tvar marks;\n\tvar len;\n\tvar i;\n\n\tdebug( 'Rendering marks group...' );\n\tparent = state.$.svg.marks.render();\n\n\tlen = state.x.length;\n\tif ( len === 0 ) {\n\t\tdebug( 'No individual marks to render.' );\n\t\treturn parent;\n\t}\n\tmarks = [];\n\n\tdebug( 'Rendering lines...' );\n\tmarks = marks.concat( lines( state ) );\n\n\tdebug( 'Rendering symbols...' );\n\tmarks = marks.concat( symbols( state ) );\n\n\tdebug( 'Rendering x-axis rug plots...' );\n\tmarks = marks.concat( xRug( state ) );\n\n\tdebug( 'Rendering y-axis rug plots...' );\n\tmarks = marks.concat( yRug( state ) );\n\n\tdebug( 'Inserting individual marks into marks group...' );\n\tfor ( i = 0; i < marks.length; i++ ) {\n\t\tparent.children.push( marks[i] );\n\t\tparent.count += marks[i].count;\n\t}\n\tdebug( 'Finished rendering marks.' );\n\treturn parent;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","var nativeIsArray = Array.isArray\nvar toString = Object.prototype.toString\n\nmodule.exports = nativeIsArray || isArray\n\nfunction isArray(obj) {\n return toString.call(obj) === \"[object Array]\"\n}\n","module.exports = isHook\n\nfunction isHook(hook) {\n return hook &&\n (typeof hook.hook === \"function\" && !hook.hasOwnProperty(\"hook\") ||\n typeof hook.unhook === \"function\" && !hook.hasOwnProperty(\"unhook\"))\n}\n","var version = require(\"./version\")\nvar isVNode = require(\"./is-vnode\")\nvar isWidget = require(\"./is-widget\")\nvar isThunk = require(\"./is-thunk\")\nvar isVHook = require(\"./is-vhook\")\n\nmodule.exports = VirtualNode\n\nvar noProperties = {}\nvar noChildren = []\n\nfunction VirtualNode(tagName, properties, children, key, namespace) {\n this.tagName = tagName\n this.properties = properties || noProperties\n this.children = children || noChildren\n this.key = key != null ? String(key) : undefined\n this.namespace = (typeof namespace === \"string\") ? namespace : null\n\n var count = (children && children.length) || 0\n var descendants = 0\n var hasWidgets = false\n var hasThunks = false\n var descendantHooks = false\n var hooks\n\n for (var propName in properties) {\n if (properties.hasOwnProperty(propName)) {\n var property = properties[propName]\n if (isVHook(property) && property.unhook) {\n if (!hooks) {\n hooks = {}\n }\n\n hooks[propName] = property\n }\n }\n }\n\n for (var i = 0; i < count; i++) {\n var child = children[i]\n if (isVNode(child)) {\n descendants += child.count || 0\n\n if (!hasWidgets && child.hasWidgets) {\n hasWidgets = true\n }\n\n if (!hasThunks && child.hasThunks) {\n hasThunks = true\n }\n\n if (!descendantHooks && (child.hooks || child.descendantHooks)) {\n descendantHooks = true\n }\n } else if (!hasWidgets && isWidget(child)) {\n if (typeof child.destroy === \"function\") {\n hasWidgets = true\n }\n } else if (!hasThunks && isThunk(child)) {\n hasThunks = true;\n }\n }\n\n this.count = count + descendants\n this.hasWidgets = hasWidgets\n this.hasThunks = hasThunks\n this.hooks = hooks\n this.descendantHooks = descendantHooks\n}\n\nVirtualNode.prototype.version = version\nVirtualNode.prototype.type = \"VirtualNode\"\n","var version = require(\"./version\")\n\nmodule.exports = VirtualText\n\nfunction VirtualText(text) {\n this.text = String(text)\n}\n\nVirtualText.prototype.version = version\nVirtualText.prototype.type = \"VirtualText\"\n","/*!\n * Cross-Browser Split 1.1.1\n * Copyright 2007-2012 Steven Levithan \n * Available under the MIT License\n * ECMAScript compliant, uniform cross-browser split method\n */\n\n/**\n * Splits a string into an array of strings using a regex or string separator. Matches of the\n * separator are not included in the result array. However, if `separator` is a regex that contains\n * capturing groups, backreferences are spliced into the result each time `separator` is matched.\n * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably\n * cross-browser.\n * @param {String} str String to split.\n * @param {RegExp|String} separator Regex or string to use for separating the string.\n * @param {Number} [limit] Maximum number of items to include in the result array.\n * @returns {Array} Array of substrings.\n * @example\n *\n * // Basic use\n * split('a b c d', ' ');\n * // -> ['a', 'b', 'c', 'd']\n *\n * // With limit\n * split('a b c d', ' ', 2);\n * // -> ['a', 'b']\n *\n * // Backreferences in result array\n * split('..word1 word2..', /([a-z]+)(\\d+)/i);\n * // -> ['..', 'word', '1', ' ', 'word', '2', '..']\n */\nmodule.exports = (function split(undef) {\n\n var nativeSplit = String.prototype.split,\n compliantExecNpcg = /()??/.exec(\"\")[1] === undef,\n // NPCG: nonparticipating capturing group\n self;\n\n self = function(str, separator, limit) {\n // If `separator` is not a regex, use `nativeSplit`\n if (Object.prototype.toString.call(separator) !== \"[object RegExp]\") {\n return nativeSplit.call(str, separator, limit);\n }\n var output = [],\n flags = (separator.ignoreCase ? \"i\" : \"\") + (separator.multiline ? \"m\" : \"\") + (separator.extended ? \"x\" : \"\") + // Proposed for ES6\n (separator.sticky ? \"y\" : \"\"),\n // Firefox 3+\n lastLastIndex = 0,\n // Make `global` and avoid `lastIndex` issues by working with a copy\n separator = new RegExp(separator.source, flags + \"g\"),\n separator2, match, lastIndex, lastLength;\n str += \"\"; // Type-convert\n if (!compliantExecNpcg) {\n // Doesn't need flags gy, but they don't hurt\n separator2 = new RegExp(\"^\" + separator.source + \"$(?!\\\\s)\", flags);\n }\n /* Values for `limit`, per the spec:\n * If undefined: 4294967295 // Math.pow(2, 32) - 1\n * If 0, Infinity, or NaN: 0\n * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;\n * If negative number: 4294967296 - Math.floor(Math.abs(limit))\n * If other: Type-convert, then use the above rules\n */\n limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1\n limit >>> 0; // ToUint32(limit)\n while (match = separator.exec(str)) {\n // `separator.lastIndex` is not reliable cross-browser\n lastIndex = match.index + match[0].length;\n if (lastIndex > lastLastIndex) {\n output.push(str.slice(lastLastIndex, match.index));\n // Fix browsers whose `exec` methods don't consistently return `undefined` for\n // nonparticipating capturing groups\n if (!compliantExecNpcg && match.length > 1) {\n match[0].replace(separator2, function() {\n for (var i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undef) {\n match[i] = undef;\n }\n }\n });\n }\n if (match.length > 1 && match.index < str.length) {\n Array.prototype.push.apply(output, match.slice(1));\n }\n lastLength = match[0].length;\n lastLastIndex = lastIndex;\n if (output.length >= limit) {\n break;\n }\n }\n if (separator.lastIndex === match.index) {\n separator.lastIndex++; // Avoid an infinite loop\n }\n }\n if (lastLastIndex === str.length) {\n if (lastLength || !separator.test(\"\")) {\n output.push(\"\");\n }\n } else {\n output.push(str.slice(lastLastIndex));\n }\n return output.length > limit ? output.slice(0, limit) : output;\n };\n\n return self;\n})();\n","'use strict';\n\nvar split = require('browser-split');\n\nvar classIdSplit = /([\\.#]?[a-zA-Z0-9\\u007F-\\uFFFF_:-]+)/;\nvar notClassId = /^\\.|#/;\n\nmodule.exports = parseTag;\n\nfunction parseTag(tag, props) {\n if (!tag) {\n return 'DIV';\n }\n\n var noId = !(props.hasOwnProperty('id'));\n\n var tagParts = split(tag, classIdSplit);\n var tagName = null;\n\n if (notClassId.test(tagParts[1])) {\n tagName = 'DIV';\n }\n\n var classes, part, type, i;\n\n for (i = 0; i < tagParts.length; i++) {\n part = tagParts[i];\n\n if (!part) {\n continue;\n }\n\n type = part.charAt(0);\n\n if (!tagName) {\n tagName = part;\n } else if (type === '.') {\n classes = classes || [];\n classes.push(part.substring(1, part.length));\n } else if (type === '#' && noId) {\n props.id = part.substring(1, part.length);\n }\n }\n\n if (classes) {\n if (props.className) {\n classes.push(props.className);\n }\n\n props.className = classes.join(' ');\n }\n\n return props.namespace ? tagName : tagName.toUpperCase();\n}\n","'use strict';\n\n/*global window, global*/\n\nvar root = typeof window !== 'undefined' ?\n window : typeof global !== 'undefined' ?\n global : {};\n\nmodule.exports = Individual;\n\nfunction Individual(key, value) {\n if (key in root) {\n return root[key];\n }\n\n root[key] = value;\n\n return value;\n}\n","'use strict';\n\nvar Individual = require('./index.js');\n\nmodule.exports = OneVersion;\n\nfunction OneVersion(moduleName, version, defaultValue) {\n var key = '__INDIVIDUAL_ONE_VERSION_' + moduleName;\n var enforceKey = key + '_ENFORCE_SINGLETON';\n\n var versionValue = Individual(enforceKey, version);\n\n if (versionValue !== version) {\n throw new Error('Can only have one copy of ' +\n moduleName + '.\\n' +\n 'You already have version ' + versionValue +\n ' installed.\\n' +\n 'This means you cannot install version ' + version);\n }\n\n return Individual(key, defaultValue);\n}\n","'use strict';\n\nvar OneVersionConstraint = require('individual/one-version');\n\nvar MY_VERSION = '7';\nOneVersionConstraint('ev-store', MY_VERSION);\n\nvar hashKey = '__EV_STORE_KEY@' + MY_VERSION;\n\nmodule.exports = EvStore;\n\nfunction EvStore(elem) {\n var hash = elem[hashKey];\n\n if (!hash) {\n hash = elem[hashKey] = {};\n }\n\n return hash;\n}\n","'use strict';\n\nvar EvStore = require('ev-store');\n\nmodule.exports = EvHook;\n\nfunction EvHook(value) {\n if (!(this instanceof EvHook)) {\n return new EvHook(value);\n }\n\n this.value = value;\n}\n\nEvHook.prototype.hook = function (node, propertyName) {\n var es = EvStore(node);\n var propName = propertyName.substr(3);\n\n es[propName] = this.value;\n};\n\nEvHook.prototype.unhook = function(node, propertyName) {\n var es = EvStore(node);\n var propName = propertyName.substr(3);\n\n es[propName] = undefined;\n};\n","'use strict';\n\nvar isArray = require('x-is-array');\n\nvar VNode = require('../vnode/vnode.js');\nvar VText = require('../vnode/vtext.js');\nvar isVNode = require('../vnode/is-vnode');\nvar isVText = require('../vnode/is-vtext');\nvar isWidget = require('../vnode/is-widget');\nvar isHook = require('../vnode/is-vhook');\nvar isVThunk = require('../vnode/is-thunk');\n\nvar parseTag = require('./parse-tag.js');\nvar softSetHook = require('./hooks/soft-set-hook.js');\nvar evHook = require('./hooks/ev-hook.js');\n\nmodule.exports = h;\n\nfunction h(tagName, properties, children) {\n var childNodes = [];\n var tag, props, key, namespace;\n\n if (!children && isChildren(properties)) {\n children = properties;\n props = {};\n }\n\n props = props || properties || {};\n tag = parseTag(tagName, props);\n\n // support keys\n if (props.hasOwnProperty('key')) {\n key = props.key;\n props.key = undefined;\n }\n\n // support namespace\n if (props.hasOwnProperty('namespace')) {\n namespace = props.namespace;\n props.namespace = undefined;\n }\n\n // fix cursor bug\n if (tag === 'INPUT' &&\n !namespace &&\n props.hasOwnProperty('value') &&\n props.value !== undefined &&\n !isHook(props.value)\n ) {\n props.value = softSetHook(props.value);\n }\n\n transformProperties(props);\n\n if (children !== undefined && children !== null) {\n addChild(children, childNodes, tag, props);\n }\n\n\n return new VNode(tag, props, childNodes, key, namespace);\n}\n\nfunction addChild(c, childNodes, tag, props) {\n if (typeof c === 'string') {\n childNodes.push(new VText(c));\n } else if (typeof c === 'number') {\n childNodes.push(new VText(String(c)));\n } else if (isChild(c)) {\n childNodes.push(c);\n } else if (isArray(c)) {\n for (var i = 0; i < c.length; i++) {\n addChild(c[i], childNodes, tag, props);\n }\n } else if (c === null || c === undefined) {\n return;\n } else {\n throw UnexpectedVirtualElement({\n foreignObject: c,\n parentVnode: {\n tagName: tag,\n properties: props\n }\n });\n }\n}\n\nfunction transformProperties(props) {\n for (var propName in props) {\n if (props.hasOwnProperty(propName)) {\n var value = props[propName];\n\n if (isHook(value)) {\n continue;\n }\n\n if (propName.substr(0, 3) === 'ev-') {\n // add ev-foo support\n props[propName] = evHook(value);\n }\n }\n }\n}\n\nfunction isChild(x) {\n return isVNode(x) || isVText(x) || isWidget(x) || isVThunk(x);\n}\n\nfunction isChildren(x) {\n return typeof x === 'string' || isArray(x) || isChild(x);\n}\n\nfunction UnexpectedVirtualElement(data) {\n var err = new Error();\n\n err.type = 'virtual-hyperscript.unexpected.virtual-element';\n err.message = 'Unexpected virtual child passed to h().\\n' +\n 'Expected a VNode / Vthunk / VWidget / string but:\\n' +\n 'got:\\n' +\n errorString(data.foreignObject) +\n '.\\n' +\n 'The parent vnode is:\\n' +\n errorString(data.parentVnode)\n '\\n' +\n 'Suggested fix: change your `h(..., [ ... ])` callsite.';\n err.foreignObject = data.foreignObject;\n err.parentVnode = data.parentVnode;\n\n return err;\n}\n\nfunction errorString(obj) {\n try {\n return JSON.stringify(obj, null, ' ');\n } catch (e) {\n return String(obj);\n }\n}\n","var h = require(\"./virtual-hyperscript/index.js\")\n\nmodule.exports = h\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'annotations:render' );\nvar ELEMENT = 'g';\n\n\n// MAIN //\n\n/**\n* Renders a virtual DOM tree.\n*\n* @private\n* @returns {VTree} virtual tree\n*/\nfunction render() {\n\t/* eslint-disable no-invalid-this */\n\tvar vtree;\n\tvar props;\n\n\tdebug( 'Rendering...' );\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'property': 'annotations',\n\t\t'className': 'annotations',\n\t\t'attributes': {\n\t\t\t'transform': 'translate(0,0)'\n\t\t}\n\t};\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\tvtree = h( ELEMENT, props, [] );\n\n\t// Announce that a new tree has been rendered:\n\tthis.emit( '_render', vtree );\n\n\treturn vtree;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar EventEmitter = require( 'events' ).EventEmitter;\nvar logger = require( 'debug' );\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport inherit from '@stdlib/utils/inherit';\nimport instanceOf from '@stdlib/assert/instance-of';\nimport render from './render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'annotations:main' );\n\n\n// MAIN //\n\n/**\n* Annotations constructor.\n*\n* @constructor\n* @returns {Annotations} annotations instance\n*\n* @example\n* var node = new Annotations();\n*/\nfunction Annotations() {\n\tvar self;\n\tif ( !instanceOf( this, Annotations ) ) {\n\t\treturn new Annotations();\n\t}\n\tself = this;\n\tdebug( 'Creating an instance...' );\n\tEventEmitter.call( this );\n\tthis.on( 'change', onChange );\n\tthis.on( '_render', onRender );\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a change event.\n\t*\n\t* @private\n\t*/\n\tfunction onChange() {\n\t\tdebug( 'Received a change event.' );\n\t\tself.render();\n\t}\n\n\t/**\n\t* Re-emits a render event.\n\t*\n\t* @private\n\t*/\n\tfunction onRender() {\n\t\tvar args;\n\t\tvar i;\n\t\tdebug( 'Received a render event. Re-emitting...' );\n\t\targs = new Array( arguments.length+1 );\n\t\targs[ 0 ] = 'render';\n\t\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\t\targs[ i+1 ] = arguments[ i ];\n\t\t}\n\t\tself.emit.apply( self, args );\n\t}\n}\n\n/*\n* Inherit from the `EventEmitter` prototype.\n*/\ninherit( Annotations, EventEmitter );\n\n/**\n* Renders a virtual DOM tree.\n*\n* @name render\n* @memberof Annotations.prototype\n* @type {Function}\n* @returns {VTree} virtual tree\n*\n* @example\n* var node = new Annotations();\n*\n* var vtree = node.render();\n* // returns \n*/\nsetReadOnly( Annotations.prototype, 'render', render );\n\n\n// EXPORTS //\n\nexport default Annotations;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isPositiveNumber } from '@stdlib/assert/is-positive-number';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `width`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isPositiveNumber( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'width', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isPositiveNumber } from '@stdlib/assert/is-positive-number';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `height`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isPositiveNumber( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'height', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `id`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isString( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'id', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `autoRender`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isBoolean( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport width from './width.js';\nimport height from './height.js';\nimport id from './id.js';\nimport autoRender from './auto_render.js';\n\n\n// MAIN //\n\nvar validators = {\n\t'width': width,\n\t'height': height,\n\t'id': id,\n\t'autoRender': autoRender\n};\n\n\n// EXPORTS //\n\nexport default validators;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport objectKeys from '@stdlib/utils/keys';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport format from '@stdlib/string/format';\nimport validators from './validators';\n\n\n// VARIABLES //\n\nvar KEYS = objectKeys( validators );\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - function options\n* @param {PositiveNumber} [options.width] - width\n* @param {PositiveNumber} [options.height] - height\n* @param {string} [options.id] - clipping path id\n* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event\n* @returns {(Error|null)} error or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'width': 400,\n* 'height': 400\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tvar err;\n\tvar key;\n\tvar val;\n\tvar i;\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tfor ( i = 0; i < KEYS.length; i++ ) {\n\t\tkey = KEYS[ i ];\n\t\tif ( hasOwnProp( options, key ) ) {\n\t\t\tval = options[ key ];\n\t\t\terr = validators[ key ]( val );\n\t\t\tif ( err ) {\n\t\t\t\treturn err;\n\t\t\t}\n\t\t\topts[ key ] = val;\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport EVENTS from './events.json';\n\n\n// MAIN //\n\n/**\n* Provided a property, returns a corresponding event name for when a property value changes.\n*\n* @private\n* @param {string} prop - property\n* @returns {string} event name\n*/\nfunction get( prop ) {\n\treturn EVENTS[ prop ];\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/width.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'clippath:set:width' );\nvar CHANGE_EVENT = events( 'width' );\n\n\n// MAIN //\n\n/**\n* Sets the width.\n*\n* @private\n* @param {PositiveNumber} width - width\n* @throws {TypeError} must be a positive number\n*/\nfunction set( width ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( width );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._width );\n\n\tthis._width = width;\n\tdebug( 'New value: %d.', this._width );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/height.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'clippath:set:height' );\nvar CHANGE_EVENT = events( 'height' );\n\n\n// MAIN //\n\n/**\n* Sets the height.\n*\n* @private\n* @param {PositiveNumber} height - height\n* @throws {TypeError} must be a positive number\n*/\nfunction set( height ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( height );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._height );\n\n\tthis._height = height;\n\tdebug( 'New Value: %d.', this._height );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/id.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'clippath:set:id' );\nvar CHANGE_EVENT = events( 'id' );\n\n\n// MAIN //\n\n/**\n* Sets the clipping path id.\n*\n* @private\n* @param {string} id - id\n* @throws {TypeError} must be a string\n*/\nfunction set( id ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( id );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %s.', this._id );\n\n\tthis._id = id;\n\tdebug( 'New value: %s.', this._id );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/auto_render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'clip-path:set:auto-render' );\nvar CHANGE_EVENT = events( 'autoRender' );\n\n\n// MAIN //\n\n/**\n* Sets the rendering mode.\n*\n* @private\n* @param {boolean} bool - boolean indicating whether to re-render on a change event\n* @throws {TypeError} must be a positive number\n*/\nfunction set( bool ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( bool );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._autoRender );\n\n\tthis._autoRender = bool;\n\tdebug( 'New Value: %d.', this._autoRender );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'clippath:components:rect' );\nvar ELEMENT = 'rect';\n\n\n// MAIN //\n\n/**\n* Renders a clipping path rectangle.\n*\n* @private\n* @param {Object} ctx - context\n* @returns {VTree} virtual tree\n*/\nfunction render( ctx ) {\n\tvar props = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'className': 'clipPath',\n\t\t'attributes': {\n\t\t\t'width': ctx.width,\n\t\t\t'height': ctx.height\n\t\t}\n\t};\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\n\treturn h( ELEMENT, props, [] );\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\nimport rect from './rect.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'clippath:components:main' );\nvar ELEMENT = 'clipPath';\n\n\n// MAIN //\n\n/**\n* Renders a clipping path.\n*\n* @private\n* @param {Object} ctx - context\n* @returns {VTree} virtual tree\n*/\nfunction render( ctx ) {\n\tvar children;\n\tvar props;\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'id': ctx.id\n\t};\n\n\tdebug( 'Rendering clipping path rectangle...' );\n\tchildren = [\n\t\trect( ctx )\n\t];\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\n\treturn h( ELEMENT, props, children );\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport components from './../components';\n\n\n// VARIABLES //\n\nvar debug = logger( 'clippath:render' );\n\n\n// MAIN //\n\n/**\n* Renders a virtual DOM tree.\n*\n* @private\n* @returns {VTree} virtual tree\n*/\nfunction render() {\n\t/* eslint-disable no-invalid-this */\n\tvar vtree;\n\n\tdebug( 'Rendering...' );\n\tvtree = components( this );\n\n\t// Announce that a new tree has been rendered:\n\tthis.emit( '_render', vtree );\n\n\treturn vtree;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar EventEmitter = require( 'events' ).EventEmitter;\nvar logger = require( 'debug' );\nimport defineProperty from '@stdlib/utils/define-property';\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\nimport minstd from '@stdlib/random/base/minstd';\nimport copy from '@stdlib/utils/copy';\nimport defaults from './defaults.json';\nimport validate from './validate.js';\nimport setWidth from './props/width/set.js';\nimport getWidth from './props/width/get.js';\nimport setHeight from './props/height/set.js';\nimport getHeight from './props/height/get.js';\nimport setID from './props/id/set.js';\nimport getID from './props/id/get.js';\nimport setAutoRender from './props/auto-render/set.js';\nimport getAutoRender from './props/auto-render/get.js';\nimport render from './methods/render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'clippath:main' );\n\n\n// MAIN //\n\n/**\n* Clipping path constructor.\n*\n* @constructor\n* @param {Options} options - constructor options\n* @param {PositiveNumber} [options.width=400] - width\n* @param {PositiveNumber} [options.height=400] - height\n* @param {string} [options.id] - clipping path id\n* @param {boolean} [options.autoRender=true] - indicates whether to re-render on a change event\n* @throws {TypeError} must provide valid options\n* @returns {ClipPath} clipping path instance\n*\n* @example\n* var clipPath = new ClipPath({\n* 'width': 500,\n* 'height': 500\n* });\n*/\nfunction ClipPath( options ) {\n\tvar self;\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof ClipPath ) ) {\n\t\treturn new ClipPath( options );\n\t}\n\tself = this;\n\topts = copy( defaults );\n\terr = validate( opts, options );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) );\n\tEventEmitter.call( this );\n\n\tdefineProperty( this, '_width', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.width\n\t});\n\tdefineProperty( this, '_height', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.height\n\t});\n\tdefineProperty( this, '_id', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.id || minstd().toString() // TODO: uuid\n\t});\n\tdefineProperty( this, '_autoRender', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.autoRender\n\t});\n\n\tthis.on( 'change', onChange );\n\tthis.on( '_render', onRender );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a change event.\n\t*\n\t* @private\n\t*/\n\tfunction onChange() {\n\t\tdebug( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}\n\n\t/**\n\t* Re-emits a render event.\n\t*\n\t* @private\n\t*/\n\tfunction onRender() {\n\t\tvar args;\n\t\tvar i;\n\t\tdebug( 'Received a render event. Re-emitting...' );\n\t\targs = [ 'render' ];\n\t\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\t\targs.push( arguments[ i ] );\n\t\t}\n\t\tself.emit.apply( self, args );\n\t}\n}\n\n/*\n* Create a prototype which inherits from the parent prototype.\n*/\nClipPath.prototype = Object.create( EventEmitter.prototype );\n\n/*\n* Set the constructor.\n*/\nClipPath.prototype.constructor = ClipPath;\n\n/**\n* Width.\n*\n* @name width\n* @memberof ClipPath.prototype\n* @type {PositiveNumber}\n* @throws {TypeError} must be a positive number\n* @default 400\n*\n* @example\n* var clipPath = new ClipPath({\n* 'width': 500\n* });\n*\n* var width = clipPath.width;\n* // returns 500\n*/\ndefineProperty( ClipPath.prototype, 'width', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setWidth,\n\t'get': getWidth\n});\n\n/**\n* Height.\n*\n* @name height\n* @memberof ClipPath.prototype\n* @type {PositiveNumber}\n* @throws {TypeError} must be a positive number\n* @default 400\n*\n* @example\n* var clipPath = new ClipPath({\n* 'height': 500\n* });\n*\n* var height = clipPath.height;\n* // returns 500\n*/\ndefineProperty( ClipPath.prototype, 'height', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setHeight,\n\t'get': getHeight\n});\n\n/**\n* Clipping path id.\n*\n* @name id\n* @memberof ClipPath.prototype\n* @type {string}\n* @throws {TypeError} must be a string\n*\n* @example\n* var clipPath = new ClipPath({\n* 'id': '1234'\n* });\n*\n* var id = clipPath.id;\n* // returns '1234'\n*/\ndefineProperty( ClipPath.prototype, 'id', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setID,\n\t'get': getID\n});\n\n/**\n* Rendering mode. If `true`, an instance re-renders on each change event.\n*\n* @name autoRender\n* @memberof ClipPath.prototype\n* @type {boolean}\n* @throws {TypeError} must be a boolean\n* @default false\n*\n* @example\n* var clipPath = new ClipPath({\n* 'autoRender': true\n* });\n*\n* var mode = clipPath.autoRender;\n* // returns true\n*/\ndefineProperty( ClipPath.prototype, 'autoRender', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setAutoRender,\n\t'get': getAutoRender\n});\n\n/**\n* Renders a virtual DOM tree.\n*\n* @name render\n* @memberof ClipPath.prototype\n* @type {Function}\n* @returns {VTree} virtual tree\n*\n* @example\n* var clipPath = new ClipPath();\n*\n* var out = clipPath.render();\n*/\nsetReadOnly( ClipPath.prototype, 'render', render );\n\n\n// EXPORTS //\n\nexport default ClipPath;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the width.\n*\n* @private\n* @returns {number} width\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._width;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the height.\n*\n* @private\n* @returns {number} height\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._height;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the clipping path id.\n*\n* @private\n* @returns {string} id\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._id;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the rendering mode.\n*\n* @private\n* @returns {boolean} rendering mode\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._autoRender;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isPositiveNumber } from '@stdlib/assert/is-positive-number';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `width`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isPositiveNumber( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'width', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isPositiveNumber } from '@stdlib/assert/is-positive-number';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `height`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isPositiveNumber( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'height', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `autoRender`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isBoolean( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport width from './width.js';\nimport height from './height.js';\nimport autoRender from './auto_render.js';\n\n\n// MAIN //\n\nvar validators = {\n\t'width': width,\n\t'height': height,\n\t'autoRender': autoRender\n};\n\n\n// EXPORTS //\n\nexport default validators;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport objectKeys from '@stdlib/utils/keys';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport format from '@stdlib/string/format';\nimport validators from './validators';\n\n\n// VARIABLES //\n\nvar KEYS = objectKeys( validators );\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - function options\n* @param {PositiveNumber} [options.width] - width\n* @param {PositiveNumber} [options.height] - height\n* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event\n* @returns {(Error|null)} error or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'width': 400,\n* 'height': 400\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tvar err;\n\tvar key;\n\tvar val;\n\tvar i;\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tfor ( i = 0; i < KEYS.length; i++ ) {\n\t\tkey = KEYS[ i ];\n\t\tif ( hasOwnProp( options, key ) ) {\n\t\t\tval = options[ key ];\n\t\t\terr = validators[ key ]( val );\n\t\t\tif ( err ) {\n\t\t\t\treturn err;\n\t\t\t}\n\t\t\topts[ key ] = val;\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport EVENTS from './events.json';\n\n\n// MAIN //\n\n/**\n* Provided a property, returns a corresponding event name for when a property value changes.\n*\n* @private\n* @param {string} prop - property\n* @returns {string} event name\n*/\nfunction get( prop ) {\n\treturn EVENTS[ prop ];\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/width.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'canvas:set:width' );\nvar CHANGE_EVENT = events( 'width' );\n\n\n// MAIN //\n\n/**\n* Sets the width.\n*\n* @private\n* @param {PositiveNumber} width - width\n* @throws {TypeError} must be a positive number\n*/\nfunction set( width ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( width );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._width );\n\n\tthis._width = width;\n\tdebug( 'New value: %d.', this._width );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/height.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'canvas:set:height' );\nvar CHANGE_EVENT = events( 'height' );\n\n\n// MAIN //\n\n/**\n* Sets the height.\n*\n* @private\n* @param {PositiveNumber} height - height\n* @throws {TypeError} must be a positive number\n*/\nfunction set( height ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( height );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._height );\n\n\tthis._height = height;\n\tdebug( 'New Value: %d.', this._height );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/auto_render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'canvas:set:auto-render' );\nvar CHANGE_EVENT = events( 'autoRender' );\n\n\n// MAIN //\n\n/**\n* Sets the rendering mode.\n*\n* @private\n* @param {boolean} bool - boolean indicating whether to re-render on a change event\n* @throws {TypeError} must be a positive number\n*/\nfunction set( bool ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( bool );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._autoRender );\n\n\tthis._autoRender = bool;\n\tdebug( 'New Value: %d.', this._autoRender );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'canvas:render' );\nvar ELEMENT = 'svg';\n\n\n// MAIN //\n\n/**\n* Renders a virtual DOM tree.\n*\n* @private\n* @returns {VTree} virtual DOM tree\n*/\nfunction render() {\n\t/* eslint-disable no-invalid-this */\n\tvar props;\n\tvar vtree;\n\n\tdebug( 'Rendering...' );\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'property': 'canvas',\n\t\t'className': 'canvas',\n\t\t'attributes': {\n\t\t\t'width': this.width,\n\t\t\t'height': this.height\n\t\t}\n\t};\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\tvtree = h( ELEMENT, props, [] );\n\n\t// Announce that a new tree has been rendered:\n\tthis.emit( '_render', vtree );\n\n\treturn vtree;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar EventEmitter = require( 'events' ).EventEmitter;\nvar logger = require( 'debug' );\nimport defineProperty from '@stdlib/utils/define-property';\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\nimport copy from '@stdlib/utils/copy';\nimport defaults from './defaults.json';\nimport validate from './validate.js';\nimport setWidth from './props/width/set.js';\nimport getWidth from './props/width/get.js';\nimport setHeight from './props/height/set.js';\nimport getHeight from './props/height/get.js';\nimport setAutoRender from './props/auto-render/set.js';\nimport getAutoRender from './props/auto-render/get.js';\nimport render from './methods/render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'canvas:main' );\n\n\n// MAIN //\n\n/**\n* Canvas constructor.\n*\n* @constructor\n* @param {Options} options - constructor options\n* @param {PositiveNumber} [options.width=400] - width\n* @param {PositiveNumber} [options.height=400] - height\n* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event\n* @throws {TypeError} must provide valid options\n* @returns {Canvas} canvas instance\n*\n* @example\n* var canvas = new Canvas({\n* 'width': 500,\n* 'height': 500\n* });\n*/\nfunction Canvas( options ) {\n\tvar self;\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof Canvas ) ) {\n\t\treturn new Canvas( options );\n\t}\n\tself = this;\n\topts = copy( defaults );\n\terr = validate( opts, options );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) );\n\tEventEmitter.call( this );\n\n\tdefineProperty( this, '_width', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.width\n\t});\n\tdefineProperty( this, '_height', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.height\n\t});\n\tdefineProperty( this, '_autoRender', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.autoRender\n\t});\n\n\tthis.on( 'change', onChange );\n\tthis.on( '_render', onRender );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a change event.\n\t*\n\t* @private\n\t*/\n\tfunction onChange() {\n\t\tdebug( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}\n\n\t/**\n\t* Re-emits a render event.\n\t*\n\t* @private\n\t*/\n\tfunction onRender() {\n\t\tvar args;\n\t\tvar i;\n\t\tdebug( 'Received a render event. Re-emitting...' );\n\t\targs = new Array( arguments.length+1 );\n\t\targs[ 0 ] = 'render';\n\t\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\t\targs[ i+1 ] = arguments[ i ];\n\t\t}\n\t\tself.emit.apply( self, args );\n\t}\n}\n\n/*\n* Create a prototype which inherits from the parent prototype.\n*/\nCanvas.prototype = Object.create( EventEmitter.prototype );\n\n/*\n* Set the constructor.\n*/\nCanvas.prototype.constructor = Canvas;\n\n/**\n* Width.\n*\n* @name width\n* @memberof Canvas.prototype\n* @type {PositiveNumber}\n* @throws {TypeError} must be a positive number\n* @default 400\n*\n* @example\n* var canvas = new Canvas({\n* 'width': 500\n* });\n*\n* var width = canvas.width;\n* // returns 500\n*/\ndefineProperty( Canvas.prototype, 'width', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setWidth,\n\t'get': getWidth\n});\n\n/**\n* Height.\n*\n* @name height\n* @memberof Canvas.prototype\n* @type {PositiveNumber}\n* @throws {TypeError} must be a positive number\n* @default 400\n*\n* @example\n* var canvas = new Canvas({\n* 'height': 500\n* });\n*\n* var height = canvas.height;\n* // returns 500\n*/\ndefineProperty( Canvas.prototype, 'height', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setHeight,\n\t'get': getHeight\n});\n\n/**\n* Rendering mode. If `true`, an instance re-renders on each change event.\n*\n* @name autoRender\n* @memberof Canvas.prototype\n* @type {boolean}\n* @throws {TypeError} must be a boolean\n* @default false\n*\n* @example\n* var canvas = new Canvas({\n* 'autoRender': true\n* });\n*\n* var mode = canvas.autoRender;\n* // returns true\n*/\ndefineProperty( Canvas.prototype, 'autoRender', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setAutoRender,\n\t'get': getAutoRender\n});\n\n/**\n* Renders a virtual DOM tree.\n*\n* @name render\n* @memberof Canvas.prototype\n* @type {Function}\n* @returns {VTree} virtual tree\n*\n* @example\n* var canvas = new Canvas({});\n*\n* var out = canvas.render();\n*/\nsetReadOnly( Canvas.prototype, 'render', render );\n\n\n// EXPORTS //\n\nexport default Canvas;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the width.\n*\n* @private\n* @returns {number} width\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._width;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the height.\n*\n* @private\n* @returns {number} height\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._height;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the rendering mode.\n*\n* @private\n* @returns {boolean} rendering mode\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._autoRender;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `translateX`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isNonNegativeInteger( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'translateX', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `translateY`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isNonNegativeInteger( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'translateY', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `autoRender`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isBoolean( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport translateX from './translate_x.js';\nimport translateY from './translate_y.js';\nimport autoRender from './auto_render.js';\n\n\n// MAIN //\n\nvar validators = {\n\t'translateX': translateX,\n\t'translateY': translateY,\n\t'autoRender': autoRender\n};\n\n\n// EXPORTS //\n\nexport default validators;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport objectKeys from '@stdlib/utils/keys';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport format from '@stdlib/string/format';\nimport validators from './validators';\n\n\n// VARIABLES //\n\nvar KEYS = objectKeys( validators );\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - function options\n* @param {NonNegativeInteger} [options.translateX] - horizontal translation\n* @param {NonNegativeInteger} [options.translateY] - vertical translation\n* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event\n* @returns {(Error|null)} error or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'translateX': 90,\n* 'translateY': 20\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tvar err;\n\tvar key;\n\tvar val;\n\tvar i;\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tfor ( i = 0; i < KEYS.length; i++ ) {\n\t\tkey = KEYS[ i ];\n\t\tif ( hasOwnProp( options, key ) ) {\n\t\t\tval = options[ key ];\n\t\t\terr = validators[ key ]( val );\n\t\t\tif ( err ) {\n\t\t\t\treturn err;\n\t\t\t}\n\t\t\topts[ key ] = val;\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport EVENTS from './events.json';\n\n\n// MAIN //\n\n/**\n* Provided a property, returns a corresponding event name for when a property value changes.\n*\n* @private\n* @param {string} prop - property\n* @returns {string} event name\n*/\nfunction get( prop ) {\n\treturn EVENTS[ prop ];\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/translate_x.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'graph:set:translate-x' );\nvar CHANGE_EVENT = events( 'translateX' );\n\n\n// MAIN //\n\n/**\n* Sets the horizontal translation.\n*\n* @private\n* @param {NonNegativeInteger} v - translation\n* @throws {TypeError} must be a nonnegative integer\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( v );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._translateX );\n\n\tthis._translateX = v;\n\tdebug( 'New Value: %d.', this._translateX );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/translate_y.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'graph:set:translate-y' );\nvar CHANGE_EVENT = events( 'translateY' );\n\n\n// MAIN //\n\n/**\n* Sets the vertical translation.\n*\n* @private\n* @param {NonNegativeInteger} v - translation\n* @throws {TypeError} must be a nonnegative integer\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( v );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._translateY );\n\n\tthis._translateY = v;\n\tdebug( 'New Value: %d.', this._translateY );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/auto_render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'canvas:set:auto-render' );\nvar CHANGE_EVENT = events( 'autoRender' );\n\n\n// MAIN //\n\n/**\n* Sets the rendering mode.\n*\n* @private\n* @param {boolean} bool - boolean indicating whether to re-render on a change event\n* @throws {TypeError} must be a positive number\n*/\nfunction set( bool ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( bool );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._autoRender );\n\n\tthis._autoRender = bool;\n\tdebug( 'New Value: %d.', this._autoRender );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'graph:render' );\nvar ELEMENT = 'g';\n\n\n// MAIN //\n\n/**\n* Renders a virtual DOM tree.\n*\n* @private\n* @returns {VTree} virtual DOM tree\n*/\nfunction render() {\n\t/* eslint-disable no-invalid-this */\n\tvar props;\n\tvar vtree;\n\n\tdebug( 'Rendering...' );\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'property': 'graph',\n\t\t'className': 'graph',\n\t\t'attributes': {\n\t\t\t'transform': 'translate('+this.translateX+','+this.translateY+')'\n\t\t}\n\t};\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\tvtree = h( ELEMENT, props, [] );\n\n\t// Announce that a new tree has been rendered:\n\tthis.emit( '_render', vtree );\n\n\treturn vtree;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar EventEmitter = require( 'events' ).EventEmitter;\nvar logger = require( 'debug' );\nimport defineProperty from '@stdlib/utils/define-property';\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\nimport copy from '@stdlib/utils/copy';\nimport defaults from './defaults.json';\nimport validate from './validate.js';\nimport setTranslateX from './props/translate-x/set.js';\nimport getTranslateX from './props/translate-x/get.js';\nimport setTranslateY from './props/translate-y/set.js';\nimport getTranslateY from './props/translate-y/get.js';\nimport setAutoRender from './props/auto-render/set.js';\nimport getAutoRender from './props/auto-render/get.js';\nimport render from './methods/render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'graph:main' );\n\n\n// MAIN //\n\n/**\n* Graph constructor.\n*\n* @constructor\n* @param {Options} options - constructor options\n* @param {NonNegativeInteger} [options.translateX=0] - horizontal translation\n* @param {NonNegativeInteger} [options.translateY=0] - vertical translation\n* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event\n* @throws {TypeError} must provide valid options\n* @returns {Graph} graph instance\n*\n* @example\n* var graph = new Graph({\n* 'translateX': 90,\n* 'translateY': 20\n* });\n*/\nfunction Graph( options ) {\n\tvar self;\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof Graph ) ) {\n\t\treturn new Graph( options );\n\t}\n\tself = this;\n\topts = copy( defaults );\n\terr = validate( opts, options );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) );\n\tEventEmitter.call( this );\n\n\tdefineProperty( this, '_translateX', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.translateX\n\t});\n\tdefineProperty( this, '_translateY', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.translateY\n\t});\n\tdefineProperty( this, '_autoRender', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.autoRender\n\t});\n\n\tthis.on( 'change', onChange );\n\tthis.on( '_render', onRender );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a change event.\n\t*\n\t* @private\n\t*/\n\tfunction onChange() {\n\t\tdebug( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}\n\n\t/**\n\t* Re-emits a render event.\n\t*\n\t* @private\n\t*/\n\tfunction onRender() {\n\t\tvar args;\n\t\tvar i;\n\t\tdebug( 'Received a render event. Re-emitting...' );\n\t\targs = new Array( arguments.length+1 );\n\t\targs[ 0 ] = 'render';\n\t\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\t\targs[ i+1 ] = arguments[ i ];\n\t\t}\n\t\tself.emit.apply( self, args );\n\t}\n}\n\n/*\n* Create a prototype which inherits from the parent prototype.\n*/\nGraph.prototype = Object.create( EventEmitter.prototype );\n\n/*\n* Set the constructor.\n*/\nGraph.prototype.constructor = Graph;\n\n/**\n* Horizontal translation.\n*\n* @name translateX\n* @memberof Graph.prototype\n* @type {NonNegativeInteger}\n* @throws {TypeError} must be a nonnegative integer\n* @default 0\n*\n* @example\n* var graph = new Graph({\n* 'translateX': 90\n* });\n*\n* var v = graph.translateX;\n* // returns 90\n*/\ndefineProperty( Graph.prototype, 'translateX', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setTranslateX,\n\t'get': getTranslateX\n});\n\n/**\n* Vertical translation.\n*\n* @name translateY\n* @memberof Graph.prototype\n* @type {NonNegativeInteger}\n* @throws {TypeError} must be a nonnegative integer\n* @default 0\n*\n* @example\n* var graph = new Graph({\n* 'translateY': 20\n* });\n*\n* var v = graph.translateY;\n* // returns 20\n*/\ndefineProperty( Graph.prototype, 'translateY', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setTranslateY,\n\t'get': getTranslateY\n});\n\n/**\n* Rendering mode. If `true`, an instance re-renders on each change event.\n*\n* @name autoRender\n* @memberof Graph.prototype\n* @type {boolean}\n* @throws {TypeError} must be a boolean\n* @default false\n*\n* @example\n* var graph = new Graph({\n* 'autoRender': true\n* });\n*\n* var mode = graph.autoRender;\n* // returns true\n*/\ndefineProperty( Graph.prototype, 'autoRender', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setAutoRender,\n\t'get': getAutoRender\n});\n\n/**\n* Renders a virtual DOM tree.\n*\n* @name render\n* @memberof Graph.prototype\n* @type {Function}\n* @returns {VTree} virtual tree\n*\n* @example\n* var graph = new Graph();\n*\n* var out = graph.render();\n*/\nsetReadOnly( Graph.prototype, 'render', render );\n\n\n// EXPORTS //\n\nexport default Graph;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the horizontal translation.\n*\n* @private\n* @returns {NonNegativeInteger} translation\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._translateX;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the vertical translation.\n*\n* @private\n* @returns {NonNegativeInteger} translation\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._translateY;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the rendering mode.\n*\n* @private\n* @returns {boolean} rendering mode\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._autoRender;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `text`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isString( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'text', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `autoRender`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isBoolean( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport text from './text.js';\nimport autoRender from './auto_render.js';\n\n\n// MAIN //\n\nvar validators = {\n\t'text': text,\n\t'autoRender': autoRender\n};\n\n\n// EXPORTS //\n\nexport default validators;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport objectKeys from '@stdlib/utils/keys';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport format from '@stdlib/string/format';\nimport validators from './validators';\n\n\n// VARIABLES //\n\nvar KEYS = objectKeys( validators );\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - function options\n* @param {string} [options.text] - title text\n* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event\n* @returns {(Error|null)} error or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'text': 'Beep'\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tvar err;\n\tvar key;\n\tvar val;\n\tvar i;\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tfor ( i = 0; i < KEYS.length; i++ ) {\n\t\tkey = KEYS[ i ];\n\t\tif ( hasOwnProp( options, key ) ) {\n\t\t\tval = options[ key ];\n\t\t\terr = validators[ key ]( val );\n\t\t\tif ( err ) {\n\t\t\t\treturn err;\n\t\t\t}\n\t\t\topts[ key ] = val;\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport EVENTS from './events.json';\n\n\n// MAIN //\n\n/**\n* Provided a property, returns a corresponding event name for when a property value changes.\n*\n* @private\n* @param {string} prop - property\n* @returns {string} event name\n*/\nfunction get( prop ) {\n\treturn EVENTS[ prop ];\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/text.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'title:set:text' );\nvar CHANGE_EVENT = events( 'text' );\n\n\n// MAIN //\n\n/**\n* Sets the title text.\n*\n* @private\n* @param {string} text - text\n* @throws {TypeError} must be a string\n*/\nfunction set( text ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( text );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._text );\n\n\tthis._text = text;\n\tdebug( 'New Value: %d.', this._text );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/auto_render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'title:set:auto-render' );\nvar CHANGE_EVENT = events( 'autoRender' );\n\n\n// MAIN //\n\n/**\n* Sets the rendering mode.\n*\n* @private\n* @param {boolean} bool - boolean indicating whether to re-render on a change event\n* @throws {TypeError} must be a positive number\n*/\nfunction set( bool ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( bool );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._autoRender );\n\n\tthis._autoRender = bool;\n\tdebug( 'New Value: %d.', this._autoRender );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'title:render' );\nvar ELEMENT = 'text';\n\n\n// MAIN //\n\n/**\n* Renders a virtual DOM tree.\n*\n* @private\n* @returns {VTree} virtual DOM tree\n*/\nfunction render() {\n\t/* eslint-disable no-invalid-this */\n\tvar props;\n\tvar vtree;\n\tvar text;\n\n\tdebug( 'Rendering...' );\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'property': 'title',\n\t\t'className': 'title noselect',\n\t\t'attributes': {\n\t\t\t'x': 0,\n\t\t\t'y': 0,\n\t\t\t'text-anchor': 'middle'\n\t\t}\n\t};\n\n\ttext = this.text;\n\tdebug( 'Title: %s.', text );\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\tvtree = h( ELEMENT, props, text );\n\n\t// Announce that a new tree has been rendered:\n\tthis.emit( '_render', vtree );\n\n\treturn vtree;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar EventEmitter = require( 'events' ).EventEmitter;\nvar logger = require( 'debug' );\nimport defineProperty from '@stdlib/utils/define-property';\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\nimport copy from '@stdlib/utils/copy';\nimport defaults from './defaults.json';\nimport validate from './validate.js';\nimport setText from './props/text/set.js';\nimport getText from './props/text/get.js';\nimport setAutoRender from './props/auto-render/set.js';\nimport getAutoRender from './props/auto-render/get.js';\nimport render from './methods/render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'title:main' );\n\n\n// MAIN //\n\n/**\n* Title constructor.\n*\n* @constructor\n* @param {Options} options - constructor options\n* @param {string} [options.text] - title text\n* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event\n* @throws {TypeError} must provide valid options\n* @returns {Title} title instance\n*\n* @example\n* var title = new Title({\n* 'text':'Beep'\n* });\n*/\nfunction Title( options ) {\n\tvar self;\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof Title ) ) {\n\t\treturn new Title( options );\n\t}\n\tself = this;\n\topts = copy( defaults );\n\terr = validate( opts, options );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) );\n\tEventEmitter.call( this );\n\n\tdefineProperty( this, '_text', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.text\n\t});\n\tdefineProperty( this, '_autoRender', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.autoRender\n\t});\n\n\tthis.on( 'change', onChange );\n\tthis.on( '_render', onRender );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a change event.\n\t*\n\t* @private\n\t*/\n\tfunction onChange() {\n\t\tdebug( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}\n\n\t/**\n\t* Re-emits a render event.\n\t*\n\t* @private\n\t*/\n\tfunction onRender() {\n\t\tvar args;\n\t\tvar i;\n\t\tdebug( 'Received a render event. Re-emitting...' );\n\t\targs = new Array( arguments.length+1 );\n\t\targs[ 0 ] = 'render';\n\t\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\t\targs[ i+1 ] = arguments[ i ];\n\t\t}\n\t\tself.emit.apply( self, args );\n\t}\n}\n\n/*\n* Create a prototype which inherits from the parent prototype.\n*/\nTitle.prototype = Object.create( EventEmitter.prototype );\n\n/*\n* Set the constructor.\n*/\nTitle.prototype.constructor = Title;\n\n/**\n* Title text.\n*\n* @name text\n* @memberof Title.prototype\n* @type {string}\n* @throws {TypeError} must be a string\n*\n* @example\n* var title = new Title({\n* 'text': 'Beep'\n* });\n*\n* var text = title.text;\n* // returns 'Beep'\n*/\ndefineProperty( Title.prototype, 'text', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setText,\n\t'get': getText\n});\n\n/**\n* Rendering mode. If `true`, an instance re-renders on each change event.\n*\n* @name autoRender\n* @memberof Title.prototype\n* @type {boolean}\n* @throws {TypeError} must be a boolean\n* @default false\n*\n* @example\n* var title = new Title({\n* 'autoRender': true\n* });\n*\n* var mode = title.autoRender;\n* // returns true\n*/\ndefineProperty( Title.prototype, 'autoRender', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setAutoRender,\n\t'get': getAutoRender\n});\n\n/**\n* Renders a virtual DOM tree.\n*\n* @name render\n* @memberof Title.prototype\n* @type {Function}\n* @returns {VTree} virtual tree\n*\n* @example\n* var title = new Title();\n*\n* var out = title.render();\n*/\nsetReadOnly( Title.prototype, 'render', render );\n\n\n// EXPORTS //\n\nexport default Title;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the title text.\n*\n* @private\n* @returns {string} text\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._text;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the rendering mode.\n*\n* @private\n* @returns {boolean} rendering mode\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._autoRender;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `clipPathId`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isString( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'clipPathId', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `autoRender`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isBoolean( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport clipPathId from './clip_path_id.js';\nimport autoRender from './auto_render.js';\n\n\n// MAIN //\n\nvar validators = {\n\t'clipPathId': clipPathId,\n\t'autoRender': autoRender\n};\n\n\n// EXPORTS //\n\nexport default validators;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport objectKeys from '@stdlib/utils/keys';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport format from '@stdlib/string/format';\nimport validators from './validators';\n\n\n// VARIABLES //\n\nvar KEYS = objectKeys( validators );\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - function options\n* @param {string} [options.clipPathId] - clipping path id\n* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event\n* @returns {(Error|null)} error or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'clipPathId': '1234'\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tvar err;\n\tvar key;\n\tvar val;\n\tvar i;\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tfor ( i = 0; i < KEYS.length; i++ ) {\n\t\tkey = KEYS[ i ];\n\t\tif ( hasOwnProp( options, key ) ) {\n\t\t\tval = options[ key ];\n\t\t\terr = validators[ key ]( val );\n\t\t\tif ( err ) {\n\t\t\t\treturn err;\n\t\t\t}\n\t\t\topts[ key ] = val;\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport EVENTS from './events.json';\n\n\n// MAIN //\n\n/**\n* Provided a property, returns a corresponding event name for when a property value changes.\n*\n* @private\n* @param {string} prop - property\n* @returns {string} event name\n*/\nfunction get( prop ) {\n\treturn EVENTS[ prop ];\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/clip_path_id.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'marks:set:clip-path-id' );\nvar CHANGE_EVENT = events( 'clipPathId' );\n\n\n// MAIN //\n\n/**\n* Sets the clipping path id.\n*\n* @private\n* @param {string} id - clipping path id\n* @throws {TypeError} must be a string\n*/\nfunction set( id ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( id );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._clipPathId );\n\n\tthis._clipPathId = id;\n\tdebug( 'New Value: %d.', this._clipPathId );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/auto_render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'marks:set:auto-render' );\nvar CHANGE_EVENT = events( 'autoRender' );\n\n\n// MAIN //\n\n/**\n* Sets the rendering mode.\n*\n* @private\n* @param {boolean} bool - boolean indicating whether to re-render on a change event\n* @throws {TypeError} must be a positive number\n*/\nfunction set( bool ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( bool );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._autoRender );\n\n\tthis._autoRender = bool;\n\tdebug( 'New Value: %d.', this._autoRender );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'marks:render' );\nvar ELEMENT = 'g';\n\n\n// MAIN //\n\n/**\n* Renders a virtual DOM tree.\n*\n* @private\n* @returns {VTree} virtual DOM tree\n*/\nfunction render() {\n\t/* eslint-disable no-invalid-this */\n\tvar props;\n\tvar vtree;\n\n\tdebug( 'Rendering...' );\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'property': 'marks',\n\t\t'className': 'marks',\n\t\t'attributes': {\n\t\t\t'clip-path': 'url(#'+this._clipPathId+')'\n\t\t}\n\t};\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\tvtree = h( ELEMENT, props, [] );\n\n\t// Announce that a new tree has been rendered:\n\tthis.emit( '_render', vtree );\n\n\treturn vtree;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar EventEmitter = require( 'events' ).EventEmitter;\nvar logger = require( 'debug' );\nimport defineProperty from '@stdlib/utils/define-property';\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\nimport copy from '@stdlib/utils/copy';\nimport defaults from './defaults.json';\nimport validate from './validate.js';\nimport setClipPathId from './props/clip-path-id/set.js';\nimport getClipPathId from './props/clip-path-id/get.js';\nimport setAutoRender from './props/auto-render/set.js';\nimport getAutoRender from './props/auto-render/get.js';\nimport render from './methods/render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'marks:main' );\n\n\n// MAIN //\n\n/**\n* Marks constructor.\n*\n* @constructor\n* @param {Options} options - constructor options\n* @param {string} [options.clipPathId] - clipping path id\n* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event\n* @throws {TypeError} must provide valid options\n* @returns {Marks} marks instance\n*\n* @example\n* var marks = new Marks({\n* 'clipPathId': '1234'\n* });\n*/\nfunction Marks( options ) {\n\tvar self;\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof Marks ) ) {\n\t\treturn new Marks( options );\n\t}\n\tself = this;\n\topts = copy( defaults );\n\terr = validate( opts, options );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) );\n\tEventEmitter.call( this );\n\n\tdefineProperty( this, '_clipPathId', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.clipPathId\n\t});\n\tdefineProperty( this, '_autoRender', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.autoRender\n\t});\n\n\tthis.on( 'change', onChange );\n\tthis.on( '_render', onRender );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a change event.\n\t*\n\t* @private\n\t*/\n\tfunction onChange() {\n\t\tdebug( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}\n\n\t/**\n\t* Re-emits a render event.\n\t*\n\t* @private\n\t*/\n\tfunction onRender() {\n\t\tvar args;\n\t\tvar i;\n\t\tdebug( 'Received a render event. Re-emitting...' );\n\t\targs = [];\n\t\targs.push( 'render' );\n\t\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\t\targs.push( arguments[ i ] );\n\t\t}\n\t\tself.emit.apply( self, args );\n\t}\n}\n\n/*\n* Create a prototype which inherits from the parent prototype.\n*/\nMarks.prototype = Object.create( EventEmitter.prototype );\n\n/*\n* Set the constructor.\n*/\nMarks.prototype.constructor = Marks;\n\n/**\n* Clipping path id.\n*\n* @name clipPathId\n* @memberof Marks.prototype\n* @type {string}\n* @throws {TypeError} must be a string\n*\n* @example\n* var marks = new Marks({\n* 'clipPathId': '1234'\n* });\n*\n* var id = marks.clipPathId;\n* // returns '1234'\n*/\ndefineProperty( Marks.prototype, 'clipPathId', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setClipPathId,\n\t'get': getClipPathId\n});\n\n/**\n* Rendering mode. If `true`, an instance re-renders on each change event.\n*\n* @name autoRender\n* @memberof Marks.prototype\n* @type {boolean}\n* @throws {TypeError} must be a boolean\n* @default false\n*\n* @example\n* var marks = new Marks({\n* 'autoRender': true\n* });\n*\n* var mode = marks.autoRender;\n* // returns true\n*/\ndefineProperty( Marks.prototype, 'autoRender', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setAutoRender,\n\t'get': getAutoRender\n});\n\n/**\n* Renders a virtual DOM tree.\n*\n* @name render\n* @memberof Marks.prototype\n* @type {Function}\n* @returns {VTree} virtual tree\n*\n* @example\n* var marks = new Marks();\n*\n* var out = marks.render();\n*/\nsetReadOnly( Marks.prototype, 'render', render );\n\n\n// EXPORTS //\n\nexport default Marks;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the clipping path id.\n*\n* @private\n* @returns {string} id\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._clipPathId;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the rendering mode.\n*\n* @private\n* @returns {boolean} rendering mode\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._autoRender;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isPositiveNumber } from '@stdlib/assert/is-positive-number';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `width`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isPositiveNumber( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'width', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isPositiveNumber } from '@stdlib/assert/is-positive-number';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `height`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isPositiveNumber( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a positive number. Value: `%s`.', 'height', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `autoRender`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isBoolean( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport width from './width.js';\nimport height from './height.js';\nimport autoRender from './auto_render.js';\n\n\n// MAIN //\n\nvar validators = {\n\t'width': width,\n\t'height': height,\n\t'autoRender': autoRender\n};\n\n\n// EXPORTS //\n\nexport default validators;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport objectKeys from '@stdlib/utils/keys';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport format from '@stdlib/string/format';\nimport validators from './validators';\n\n\n// VARIABLES //\n\nvar KEYS = objectKeys( validators );\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - function options\n* @param {PositiveNumber} [options.width] - width\n* @param {PositiveNumber} [options.height] - height\n* @param {boolean} [options.autoRender] - indicates whether to re-render on a change event\n* @returns {(Error|null)} error or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'width': 400,\n* 'height': 400\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tvar err;\n\tvar key;\n\tvar val;\n\tvar i;\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tfor ( i = 0; i < KEYS.length; i++ ) {\n\t\tkey = KEYS[ i ];\n\t\tif ( hasOwnProp( options, key ) ) {\n\t\t\tval = options[ key ];\n\t\t\terr = validators[ key ]( val );\n\t\t\tif ( err ) {\n\t\t\t\treturn err;\n\t\t\t}\n\t\t\topts[ key ] = val;\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport EVENTS from './events.json';\n\n\n// MAIN //\n\n/**\n* Provided a property, returns a corresponding event name for when a property value changes.\n*\n* @private\n* @param {string} prop - property\n* @returns {string} event name\n*/\nfunction get( prop ) {\n\treturn EVENTS[ prop ];\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/width.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'background:set:width' );\nvar CHANGE_EVENT = events( 'width' );\n\n\n// MAIN //\n\n/**\n* Sets the width.\n*\n* @private\n* @param {PositiveNumber} width - width\n* @throws {TypeError} must be a positive number\n*/\nfunction set( width ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( width );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._width );\n\n\tthis._width = width;\n\tdebug( 'New value: %d.', this._width );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/height.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'background:set:height' );\nvar CHANGE_EVENT = events( 'height' );\n\n\n// MAIN //\n\n/**\n* Sets the height.\n*\n* @private\n* @param {PositiveNumber} height - height\n* @throws {TypeError} must be a positive number\n*/\nfunction set( height ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( height );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._height );\n\n\tthis._height = height;\n\tdebug( 'New Value: %d.', this._height );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/auto_render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'background:set:auto-render' );\nvar CHANGE_EVENT = events( 'autoRender' );\n\n\n// MAIN //\n\n/**\n* Sets the rendering mode.\n*\n* @private\n* @param {boolean} bool - boolean indicating whether to re-render on a change event\n* @throws {TypeError} must be a positive number\n*/\nfunction set( bool ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( bool );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._autoRender );\n\n\tthis._autoRender = bool;\n\tdebug( 'New Value: %d.', this._autoRender );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'background:render' );\nvar ELEMENT = 'rect';\n\n\n// MAIN //\n\n/**\n* Renders a virtual DOM tree.\n*\n* @private\n* @returns {VTree} virtual DOM tree\n*/\nfunction render() {\n\t/* eslint-disable no-invalid-this */\n\tvar props;\n\tvar vtree;\n\n\tdebug( 'Rendering...' );\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'className': 'background',\n\t\t'attributes': {\n\t\t\t'x': 0,\n\t\t\t'y': 0,\n\t\t\t'width': this.width,\n\t\t\t'height': this.height,\n\t\t\t'fill': 'none',\n\t\t\t'stroke': 'none'\n\t\t}\n\t};\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\tvtree = h( ELEMENT, props, [] );\n\n\t// Announce that a new tree has been rendered:\n\tthis.emit( '_render', vtree );\n\n\treturn vtree;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar EventEmitter = require( 'events' ).EventEmitter;\nvar logger = require( 'debug' );\nimport defineProperty from '@stdlib/utils/define-property';\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\nimport copy from '@stdlib/utils/copy';\nimport defaults from './defaults.json';\nimport validate from './validate.js';\nimport setWidth from './props/width/set.js';\nimport getWidth from './props/width/get.js';\nimport setHeight from './props/height/set.js';\nimport getHeight from './props/height/get.js';\nimport setAutoRender from './props/auto-render/set.js';\nimport getAutoRender from './props/auto-render/get.js';\nimport render from './methods/render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'background:main' );\n\n\n// MAIN //\n\n/**\n* Background constructor.\n*\n* @constructor\n* @param {Options} options - constructor options\n* @param {PositiveNumber} [options.width=400] - width\n* @param {PositiveNumber} [options.height=400] - height\n* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event\n* @throws {TypeError} must provide valid options\n* @returns {Background} background instance\n*\n* @example\n* var bkgd = new Background({\n* 'width': 500,\n* 'height': 500\n* });\n*/\nfunction Background( options ) {\n\tvar self;\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof Background ) ) {\n\t\treturn new Background( options );\n\t}\n\tself = this;\n\topts = copy( defaults );\n\terr = validate( opts, options );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) );\n\tEventEmitter.call( this );\n\n\tdefineProperty( this, '_width', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.width\n\t});\n\tdefineProperty( this, '_height', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.height\n\t});\n\tdefineProperty( this, '_autoRender', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.autoRender\n\t});\n\n\tthis.on( 'change', onChange );\n\tthis.on( '_render', onRender );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a change event.\n\t*\n\t* @private\n\t*/\n\tfunction onChange() {\n\t\tdebug( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}\n\n\t/**\n\t* Re-emits a render event.\n\t*\n\t* @private\n\t*/\n\tfunction onRender() {\n\t\tvar args;\n\t\tvar i;\n\t\tdebug( 'Received a render event. Re-emitting...' );\n\t\targs = new Array( arguments.length+1 );\n\t\targs[ 0 ] = 'render';\n\t\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\t\targs[ i+1 ] = arguments[ i ];\n\t\t}\n\t\tself.emit.apply( self, args );\n\t}\n}\n\n/*\n* Create a prototype which inherits from the parent prototype.\n*/\nBackground.prototype = Object.create( EventEmitter.prototype );\n\n/*\n* Set the constructor.\n*/\nBackground.prototype.constructor = Background;\n\n/**\n* Width.\n*\n* @name width\n* @memberof Background.prototype\n* @type {PositiveNumber}\n* @throws {TypeError} must be a positive number\n* @default 400\n*\n* @example\n* var bkgd = new Background({\n* 'width': 500\n* });\n*\n* var width = bkgd.width;\n* // returns 500\n*/\ndefineProperty( Background.prototype, 'width', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setWidth,\n\t'get': getWidth\n});\n\n/**\n* Height.\n*\n* @name height\n* @memberof Background.prototype\n* @type {PositiveNumber}\n* @throws {TypeError} must be a positive number\n* @default 400\n*\n* @example\n* var bkgd = new Background({\n* 'height': 500\n* });\n*\n* var height = bkgd.height;\n* // returns 500\n*/\ndefineProperty( Background.prototype, 'height', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setHeight,\n\t'get': getHeight\n});\n\n/**\n* Rendering mode. If `true`, an instance re-renders on each change event.\n*\n* @name autoRender\n* @memberof Background.prototype\n* @type {boolean}\n* @throws {TypeError} must be a boolean\n* @default false\n*\n* @example\n* var bkgd = new Background({\n* 'autoRender': true\n* });\n*\n* var mode = bkgd.autoRender;\n* // returns true\n*/\ndefineProperty( Background.prototype, 'autoRender', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setAutoRender,\n\t'get': getAutoRender\n});\n\n/**\n* Renders a virtual DOM tree.\n*\n* @name render\n* @memberof Background.prototype\n* @type {Function}\n* @returns {VTree} virtual tree\n*\n* @example\n* var bkgd = new Background();\n*\n* var out = bkgd.render();\n*/\nsetReadOnly( Background.prototype, 'render', render );\n\n\n// EXPORTS //\n\nexport default Background;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the width.\n*\n* @private\n* @returns {number} width\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._width;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the height.\n*\n* @private\n* @returns {number} height\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._height;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the rendering mode.\n*\n* @private\n* @returns {boolean} rendering mode\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._autoRender;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'defs:render' );\nvar ELEMENT = 'defs';\n\n\n// MAIN //\n\n/**\n* Renders a virtual DOM tree.\n*\n* @private\n* @returns {VTree} virtual tree\n*/\nfunction render() {\n\t/* eslint-disable no-invalid-this */\n\tvar vtree;\n\tvar props;\n\n\tdebug( 'Rendering...' );\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg'\n\t};\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\tvtree = h( ELEMENT, props, [] );\n\n\t// Announce that a new tree has been rendered:\n\tthis.emit( '_render', vtree );\n\n\treturn vtree;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar EventEmitter = require( 'events' ).EventEmitter;\nvar logger = require( 'debug' );\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport inherit from '@stdlib/utils/inherit';\nimport instanceOf from '@stdlib/assert/instance-of';\nimport render from './render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'defs:main' );\n\n\n// MAIN //\n\n/**\n* SVG definitions constructor.\n*\n* @constructor\n* @returns {Defs} definitions instance\n*\n* @example\n* var node = new Defs();\n* // returns \n*/\nfunction Defs() {\n\tvar self;\n\tif ( !instanceOf( this, Defs ) ) {\n\t\treturn new Defs();\n\t}\n\tself = this;\n\tdebug( 'Creating an instance...' );\n\tEventEmitter.call( this );\n\tthis.on( 'change', onChange );\n\tthis.on( '_render', onRender );\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a change event.\n\t*\n\t* @private\n\t*/\n\tfunction onChange() {\n\t\tdebug( 'Received a change event.' );\n\t\tself.render();\n\t}\n\n\t/**\n\t* Re-emits a render event.\n\t*\n\t* @private\n\t*/\n\tfunction onRender() {\n\t\tvar args;\n\t\tvar i;\n\t\tdebug( 'Received a render event. Re-emitting...' );\n\t\targs = new Array( arguments.length+1 );\n\t\targs[ 0 ] = 'render';\n\t\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\t\targs[ i+1 ] = arguments[ i ];\n\t\t}\n\t\tself.emit.apply( self, args );\n\t}\n}\n\n/*\n* Inherit from the `EventEmitter` prototype.\n*/\ninherit( Defs, EventEmitter );\n\n/**\n* Renders a virtual DOM tree.\n*\n* @name render\n* @memberof Defs.prototype\n* @type {Function}\n* @returns {VTree} virtual tree\n*\n* @example\n* var node = new Defs();\n*\n* var out = node.render();\n* // returns \n*/\nsetReadOnly( Defs.prototype, 'render', render );\n\n\n// EXPORTS //\n\nexport default Defs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `autoRender`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isBoolean( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `label`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isString( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'label', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isNull from '@stdlib/assert/is-null';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `numTicks`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif (\n\t\t!isNull( v ) &&\n\t\t!isNonNegativeInteger( v )\n\t) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or null. Value: `%s`.', 'numTicks', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport indexOf from '@stdlib/utils/index-of';\nimport format from '@stdlib/string/format';\nimport ORIENTATIONS from './../etc/orientations.json';\n\n\n// MAIN //\n\n/**\n* Validates `orientation`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( indexOf( ORIENTATIONS, v ) === -1 ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be one of the following: \"%s\". Value: `%s`.', 'orientation', ORIENTATIONS.join( '\", \"' ), v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `scale`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isFunction( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'scale', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isNull from '@stdlib/assert/is-null';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `tickFormat`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif (\n\t\t!isNull( v ) &&\n\t\t!isString( v ) &&\n\t\t!isFunction( v )\n\t) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a string, function, or null. Value: `%s`.', 'tickFormat', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `tickPadding`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isNonNegativeInteger( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'tickPadding', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isNull from '@stdlib/assert/is-null';\nimport isArray from '@stdlib/assert/is-array';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `ticks`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif (\n\t\t!isNull( v ) &&\n\t\t!isArray( v )\n\t) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be null or an array. Value: `%s`.', 'ticks', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `tickSize`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isNonNegativeInteger( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'tickSize', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `innerTickSize`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isNonNegativeInteger( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'innerTickSize', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates `outerTickSize`.\n*\n* @private\n* @param {*} v - value to test\n* @returns {(Error|null)} error object or null\n*/\nfunction test( v ) {\n\tif ( !isNonNegativeInteger( v ) ) {\n\t\treturn new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'outerTickSize', v ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport autoRender from './auto_render.js';\nimport label from './label.js';\nimport numTicks from './num_ticks.js';\nimport orientation from './orientation.js';\nimport scale from './scale.js';\nimport tickFormat from './tick_format.js';\nimport tickPadding from './tick_padding.js';\nimport ticks from './ticks.js';\nimport tickSize from './tick_size.js';\nimport innerTickSize from './inner_tick_size.js';\nimport outerTickSize from './outer_tick_size.js';\n\n\n// MAIN //\n\nvar validators = {\n\t'autoRender': autoRender,\n\t'label': label,\n\t'numTicks': numTicks,\n\t'orientation': orientation,\n\t'scale': scale,\n\t'tickFormat': tickFormat,\n\t'tickPadding': tickPadding,\n\t'ticks': ticks,\n\t'tickSize': tickSize,\n\t'innerTickSize': innerTickSize,\n\t'outerTickSize': outerTickSize\n};\n\n\n// EXPORTS //\n\nexport default validators;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport objectKeys from '@stdlib/utils/keys';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport format from '@stdlib/string/format';\nimport validators from './validators';\n\n\n// VARIABLES //\n\nvar KEYS = objectKeys( validators );\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - function options\n* @param {Function} [options.scale] - scale function\n* @param {string} [options.orientation] - axis orientation\n* @param {string} [options.label] - axis label\n* @param {(Array|null)} [options.ticks] - tick values\n* @param {(NonNegativeInteger|null)} [options.numTicks] - number of ticks\n* @param {(null|string|Function)} [options.tickFormat] - tick format\n* @param {NonNegativeInteger} [options.tickSize] - tick size\n* @param {NonNegativeInteger} [options.innerTickSize] - inner tick size\n* @param {NonNegativeInteger} [options.outerTickSize] - outer tick size\n* @param {NonNegativeInteger} [options.tickPadding] - tick padding\n* @returns {(Error|null)} error or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'scale': function scale(){},\n* 'orientation': 'left',\n* 'tickSize': 10\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tvar err;\n\tvar key;\n\tvar val;\n\tvar i;\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tfor ( i = 0; i < KEYS.length; i++ ) {\n\t\tkey = KEYS[ i ];\n\t\tif ( hasOwnProp( options, key ) ) {\n\t\t\tval = options[ key ];\n\t\t\terr = validators[ key ]( val );\n\t\t\tif ( err ) {\n\t\t\t\treturn err;\n\t\t\t}\n\t\t\topts[ key ] = val;\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport EVENTS from './events.json';\n\n\n// MAIN //\n\n/**\n* Provided a property, returns a corresponding event name for when a property value changes.\n*\n* @private\n* @param {string} prop - property\n* @returns {string} event name\n*/\nfunction get( prop ) {\n\treturn EVENTS[ prop ];\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/scale.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:set:scale' );\nvar CHANGE_EVENT = events( 'scale' );\n\n\n// MAIN //\n\n/**\n* Sets the scale function.\n*\n* @private\n* @param {Function} fcn - scale\n* @throws {TypeError} must be a function\n*/\nfunction set( fcn ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( fcn );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %s.', this._scale );\n\n\tthis._scale = fcn;\n\tdebug( 'New Value: %s.', this._scale );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/orientation.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:set:orientation' );\nvar CHANGE_EVENT = events( 'orientation' );\n\n\n// MAIN //\n\n/**\n* Sets the axis orientation.\n*\n* @private\n* @param {string} orient - axis orientation\n* @throws {TypeError} must be a string\n*/\nfunction set( orient ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( orient );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %s.', this._orientation );\n\n\tthis._orientation = orient;\n\tdebug( 'New Value: %s.', this._orientation );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/label.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:set:xlabel' );\nvar CHANGE_EVENT = events( 'label' );\n\n\n// MAIN //\n\n/**\n* Sets the axis label.\n*\n* @private\n* @param {string} label - axis label\n* @throws {TypeError} must be a string\n*/\nfunction set( label ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( label );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %s.', this._label );\n\n\tthis._label = label;\n\tdebug( 'New value: %s.', this._label );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isNull from '@stdlib/assert/is-null';\nimport events from './../../events';\nimport isValid from './../../validators/ticks.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:set:ticks' );\nvar CHANGE_EVENT = events( 'ticks' );\n\n\n// MAIN //\n\n/**\n* Sets the axis tick values.\n*\n* @private\n* @param {(Array|null)} ticks - tick values\n* @throws {TypeError} must be an array or null\n*/\nfunction set( ticks ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( ticks );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._ticks ) );\n\n\tif ( isNull( ticks ) ) {\n\t\tthis._ticks = ticks;\n\t} else {\n\t\tthis._ticks = ticks.slice();\n\t}\n\tdebug( 'New Value: %s.', JSON.stringify( this._ticks ) );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/num_ticks.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:set:numticks' );\nvar CHANGE_EVENT = events( 'numTicks' );\n\n\n// MAIN //\n\n/**\n* Sets the number of axis ticks.\n*\n* @private\n* @param {(NonNegativeInteger|null)} num - num\n* @throws {TypeError} must be a nonnegative integer or null\n*/\nfunction set( num ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( num );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', num );\n\n\tthis._numTicks = num;\n\tdebug( 'New Value: %s.', this._numTicks );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/tick_format.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:set:tickformat' );\nvar CHANGE_EVENT = events( 'tickFormat' );\n\n\n// MAIN //\n\n/**\n* Sets the axis tick format.\n*\n* @private\n* @param {(null|string|Function)} fmt - tick format\n* @throws {TypeError} must be either null, a string, or a function\n*/\nfunction set( fmt ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( fmt );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %s.', this._tickFormat );\n\n\tthis._tickFormat = fmt;\n\tdebug( 'New Value: %s.', this._tickFormat );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar format = require( 'd3-format' ).format; // TODO: remove\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isNull from '@stdlib/assert/is-null';\nimport identity from '@stdlib/utils/identity-function';\n\n\n// MAIN //\n\n/**\n* Returns the axis tick format.\n*\n* @private\n* @returns {Function} format function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tif ( isString( this._tickFormat ) ) {\n\t\treturn format( this._tickFormat );\n\t}\n\tif ( isNull( this._tickFormat ) ) {\n\t\tif ( this._scale.tickFormat ) {\n\t\t\treturn this._scale.tickFormat( this._numTicks, this._tickFormat );\n\t\t}\n\t\treturn identity;\n\t}\n\treturn this._tickFormat;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/tick_size.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:set:ticksize' );\nvar CHANGE_EVENT = events( 'tickSize' );\n\n\n// MAIN //\n\n/**\n* Sets the axis tick size.\n*\n* @private\n* @param {NonNegativeInteger} size - size\n* @throws {TypeError} must be a nonnegative integer\n*/\nfunction set( size ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( size );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', size );\n\n\tthis._tickSize = size;\n\tdebug( 'New Value: %s.', this._tickSize );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/inner_tick_size.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:set:ticksize-inner' );\nvar CHANGE_EVENT = events( 'innerTickSize' );\n\n\n// MAIN //\n\n/**\n* Sets the inner tick size.\n*\n* @private\n* @param {NonNegativeInteger} size - size\n* @throws {TypeError} must be a nonnegative integer\n*/\nfunction set( size ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( size );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', size );\n\n\tthis._innerTickSize = size;\n\tdebug( 'New Value: %s.', this._innerTickSize );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/outer_tick_size.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:set:ticksize-outer' );\nvar CHANGE_EVENT = events( 'outerTickSize' );\n\n\n// MAIN //\n\n/**\n* Sets the axis outer tick size.\n*\n* @private\n* @param {NonNegativeInteger} size - size\n* @throws {TypeError} must be a nonnegative integer\n*/\nfunction set( size ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( size );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', size );\n\n\tthis._outerTickSize = size;\n\tdebug( 'New Value: %s.', this._outerTickSize );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/tick_padding.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:set:tickpadding' );\nvar CHANGE_EVENT = events( 'tickPadding' );\n\n\n// MAIN //\n\n/**\n* Sets the axis tick padding.\n*\n* @private\n* @param {NonNegativeInteger} padding - padding\n* @throws {TypeError} must be a nonnegative integer\n*/\nfunction set( padding ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( padding );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', padding );\n\n\tthis._tickPadding = padding;\n\tdebug( 'New Value: %s.', this._tickPadding );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:center' );\n\n\n// MAIN //\n\n/**\n* Returns a function to center a tick.\n*\n* @private\n* @returns {Function} function to center a tick\n*/\nfunction center() {\n\t/* eslint-disable no-invalid-this */\n\tvar width = this._scale.bandwidth() / 2;\n\treturn center;\n\n\t/**\n\t* Returns a centered tick position.\n\t*\n\t* @private\n\t* @param {*} d - datum\n\t* @returns {number} tick position\n\t*/\n\tfunction center( d ) {\n\t\tvar pos = this._scale( d ) + width;\n\t\tdebug( 'Value: %s => Coordinate: %d', d, pos );\n\t\treturn pos;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default center;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport events from './../../events';\nimport isValid from './../../validators/auto_render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:set:auto-render' );\nvar CHANGE_EVENT = events( 'autoRender' );\n\n\n// MAIN //\n\n/**\n* Sets the rendering mode.\n*\n* @private\n* @param {boolean} bool - boolean indicating whether to re-render on a change event\n* @throws {TypeError} must be a positive number\n*/\nfunction set( bool ) {\n\t/* eslint-disable no-invalid-this */\n\tvar err = isValid( bool );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Current value: %d.', this._autoRender );\n\n\tthis._autoRender = bool;\n\tdebug( 'New Value: %d.', this._autoRender );\n\n\tthis.emit( CHANGE_EVENT );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/*\n* For manually constructing SVG paths, see [MDN]{@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d}\n*/\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:components:domain' );\nvar ELEMENT = 'path';\n\n\n// MAIN //\n\n/**\n* Renders an axis domain.\n*\n* @private\n* @param {Object} ctx - context\n* @returns {VTree} virtual tree\n*/\nfunction render( ctx ) {\n\t/* eslint-disable no-underscore-dangle */\n\tvar orient;\n\tvar stroke;\n\tvar range0;\n\tvar range1;\n\tvar offset;\n\tvar range;\n\tvar props;\n\tvar d;\n\n\torient = ctx._orientation;\n\tdebug( 'Axis orientation: %s.', orient );\n\n\trange = ctx._scale.range();\n\tdebug( 'Axis range: %s.', JSON.stringify( range ) );\n\n\trange0 = range[ 0 ] + 0.5;\n\trange1 = range[ range.length-1 ] + 0.5;\n\n\toffset = ctx.tickDir * ctx._outerTickSize;\n\td = '';\n\tif ( orient === 'left' || orient === 'right' ) {\n\t\td += 'M' + offset + ',' + range0;\n\t\td += 'H0.5';\n\t\td += 'V' + range1;\n\t\td += 'H' + offset;\n\n\t\tstroke = 'none';\n\t} else {\n\t\td += 'M' + range0 + ',' + offset;\n\t\td += 'V0.5';\n\t\td += 'H' + range1;\n\t\td += 'V' + offset;\n\n\t\tstroke = '#aaa';\n\t}\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'property': 'axis.domain',\n\t\t'className': 'domain',\n\t\t'attributes': {\n\t\t\t'fill': 'none',\n\t\t\t'stroke': stroke,\n\t\t\t'stroke-width': 1,\n\t\t\t'd': d\n\t\t}\n\t};\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\n\treturn h( ELEMENT, props, [] );\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:engine:translate-x' );\n\n\n// MAIN //\n\n/**\n* Returns a function to horizontally translate a tick.\n*\n* @private\n* @param {Function} scale - scale function\n* @returns {Function} function to translate a tick\n*/\nfunction translateX( scale ) {\n\treturn translateX;\n\n\t/**\n\t* Horizontally translates a tick.\n\t*\n\t* @private\n\t* @param {*} d - datum\n\t* @returns {string} transform\n\t*/\n\tfunction translateX( d ) {\n\t\tvar t = 'translate('+scale( d )+',0)';\n\t\tdebug( 'Value: %s => Transform: %s.', d, t );\n\t\treturn t;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default translateX;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:engine:translate-y' );\n\n\n// MAIN //\n\n/**\n* Returns a function to vertically translate a tick.\n*\n* @private\n* @param {Function} scale - scale function\n* @returns {Function} function to translate a tick\n*/\nfunction translateY( scale ) {\n\treturn translateY;\n\n\t/**\n\t* Vertically translates a tick.\n\t*\n\t* @private\n\t* @param {*} d - datum\n\t* @returns {string} transform\n\t*/\n\tfunction translateY( d ) {\n\t\tvar t = 'translate(0,'+scale( d )+')';\n\t\tdebug( 'Value: %s => Transform: %s.', d, t );\n\t\treturn t;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default translateY;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport translateX from './translate_x.js';\nimport translateY from './translate_y.js';\n\n\n// MAIN //\n\n/**\n* Returns a function to translate ticks.\n*\n* @private\n* @param {string} orient - axis orientation\n* @param {Function} scale - scale function\n* @returns {Function} transform function\n*/\nfunction tickTransform( orient, scale ) {\n\tif ( orient === 'top' || orient === 'bottom' ) {\n\t\treturn translateX( scale );\n\t}\n\treturn translateY( scale );\n}\n\n\n// EXPORTS //\n\nexport default tickTransform;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the \"x\" attribute for tick positioning.\n*\n* @private\n* @param {string} orient - axis orientation\n* @returns {string} attribute\n*/\nfunction xAttr( orient ) {\n\tif ( orient === 'left' || orient === 'right' ) {\n\t\treturn 'x';\n\t}\n\treturn 'y';\n}\n\n\n// EXPORTS //\n\nexport default xAttr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the \"y\" attribute for tick positioning.\n*\n* @private\n* @param {string} orient - axis orientation\n* @returns {string} attribute\n*/\nfunction yAttr( orient ) {\n\tif ( orient === 'left' || orient === 'right' ) {\n\t\treturn 'y';\n\t}\n\treturn 'x';\n}\n\n\n// EXPORTS //\n\nexport default yAttr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\nimport xAttr from './../utils/x_attr.js';\nimport yAttr from './../utils/y_attr.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:components:line' );\nvar ELEMENT = 'line';\n\n\n// MAIN //\n\n/**\n* Renders a tick line.\n*\n* @private\n* @param {Object} ctx - context\n* @returns {VTree} virtual tree\n*/\nfunction render( ctx ) {\n\t/* eslint-disable no-underscore-dangle */\n\tvar props;\n\tvar x;\n\tvar y;\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'attributes': {\n\t\t\t'stroke': '#aaa',\n\t\t\t'stroke-width': 1\n\t\t}\n\t};\n\n\tx = xAttr( ctx._orientation );\n\ty = yAttr( ctx._orientation );\n\n\tprops.attributes[ x+'2' ] = ctx.tickDir * ctx._innerTickSize;\n\tprops.attributes[ y+'1' ] = 0.5;\n\tprops.attributes[ y+'2' ] = 0.5;\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\n\treturn h( ELEMENT, props, [] );\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns vertical shift for aligning tick text.\n*\n* @private\n* @param {string} orient - axis orientation\n* @returns {string} text shift\n*/\nfunction dy( orient ) {\n\tif ( orient === 'top' ) {\n\t\treturn '0em';\n\t}\n\tif ( orient === 'bottom' ) {\n\t\treturn '.71em';\n\t}\n\treturn '.32em';\n}\n\n\n// EXPORTS //\n\nexport default dy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\nimport dy from './../utils/text_dy.js';\nimport xAttr from './../utils/x_attr.js';\nimport yAttr from './../utils/y_attr.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:components:text' );\nvar ELEMENT = 'text';\n\n\n// MAIN //\n\n/**\n* Renders tick text.\n*\n* @private\n* @param {Object} ctx - context\n* @param {*} d - tick value\n* @returns {VTree} virtual tree\n*/\nfunction render( ctx, d ) {\n\t/* eslint-disable no-underscore-dangle */\n\tvar orient;\n\tvar props;\n\tvar txt;\n\tvar x;\n\tvar y;\n\n\torient = ctx._orientation;\n\tdebug( 'Axis orientation: %s.', orient );\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'attributes': {\n\t\t\t'fill': '#000',\n\t\t\t'dy': dy( orient )\n\t\t}\n\t};\n\n\tx = xAttr( orient );\n\ty = yAttr( orient );\n\n\tprops.attributes[ x ] = ctx.tickDir * ctx.tickSpacing;\n\tprops.attributes[ y ] = 0.5;\n\n\ttxt = ctx.tickFormat( d );\n\tdebug( 'Tick text: %s.', txt );\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\n\treturn h( ELEMENT, props, txt );\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\nimport line from './line.js';\nimport text from './text.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:components:tick' );\nvar ELEMENT = 'g';\n\n\n// MAIN //\n\n/**\n* Renders an axis tick.\n*\n* @private\n* @param {Object} ctx - context\n* @param {*} d - tick value\n* @param {Function} transform - tick transform\n* @returns {VTree} virtual tree\n*/\nfunction render( ctx, d, transform ) {\n\tvar children;\n\tvar props;\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'property': 'axis.tick',\n\t\t'className': 'tick',\n\t\t'attributes': {\n\t\t\t'opacity': 1,\n\t\t\t'transform': transform( d )\n\t\t}\n\t};\n\tchildren = new Array( 2 );\n\n\tdebug( 'Rendering a tick line...' );\n\tchildren[ 0 ] = line( ctx );\n\n\tdebug( 'Rendering tick text...' );\n\tchildren[ 1 ] = text( ctx, d );\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\n\treturn h( ELEMENT, props, children );\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport tickTransform from './../utils/tick_transform.js';\nimport tick from './tick.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:components:ticks' );\n\n\n// MAIN //\n\n/**\n* Renders axis ticks.\n*\n* @private\n* @param {Object} ctx - context\n* @returns {Array} array of virtual DOM trees\n*/\nfunction render( ctx ) {\n\t/* eslint-disable no-underscore-dangle */\n\tvar transform;\n\tvar values;\n\tvar out;\n\tvar i;\n\n\tvalues = ctx.ticks;\n\tdebug( 'Tick values: %s.', JSON.stringify( values ) );\n\n\tdebug( 'Generating tick transform...' );\n\ttransform = tickTransform( ctx._orientation, ctx._scale );\n\n\tdebug( 'Rendering ticks...' );\n\tout = new Array( values.length );\n\tfor ( i = 0; i < values.length; i++ ) {\n\t\tdebug( 'Rendering tick %d with value %s...', i, values[i] );\n\t\tout[ i ] = tick( ctx, values[i], transform );\n\t}\n\tdebug( 'Finished rendering ticks.' );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns a label SVG transform.\n*\n* @private\n* @param {string} orient - axis orientation\n* @returns {string} SVG transform\n*/\nfunction labelTransform( orient ) {\n\tif ( orient === 'bottom' || orient === 'top' ) {\n\t\treturn 'rotate(0)';\n\t}\n\tif ( orient === 'left' ) {\n\t\treturn 'rotate(-90)';\n\t}\n\t// orient === 'right'\n\treturn 'rotate(90)';\n}\n\n\n// EXPORTS //\n\nexport default labelTransform;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the label `x` coordinate.\n*\n* @private\n* @param {string} orient - axis orientation\n* @param {NumericArray} range - scale range\n* @returns {number} `x` coordinate\n*/\nfunction labelXPos( orient, range ) {\n\tif ( orient === 'left' || orient === 'right' ) {\n\t\treturn -range[0] / 2;\n\t}\n\treturn range[1] / 2;\n}\n\n\n// EXPORTS //\n\nexport default labelXPos;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the label `y` coordinate.\n*\n* @private\n* @param {string} orient - axis orientation\n* @returns {number} `y` coordinate\n*/\nfunction labelYPos( orient ) {\n\tif ( orient === 'left' ) {\n\t\treturn -72;\n\t}\n\tif ( orient === 'right' ) {\n\t\treturn 72;\n\t}\n\tif ( orient === 'bottom' ) {\n\t\treturn 45;\n\t}\n\t// orient === 'top'\n\treturn -45;\n}\n\n\n// EXPORTS //\n\nexport default labelYPos;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\nimport labelTransform from './../utils/label_transform.js';\nimport labelXPos from './../utils/label_x_pos.js';\nimport labelYPos from './../utils/label_y_pos.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:components:label' );\nvar ELEMENT = 'text';\n\n\n// MAIN //\n\n/**\n* Renders an axis label.\n*\n* @private\n* @param {Object} ctx - context\n* @returns {VTree} virtual tree\n*/\nfunction render( ctx ) {\n\t/* eslint-disable no-underscore-dangle */\n\tvar orient;\n\tvar props;\n\n\torient = ctx._orientation;\n\tdebug( 'Axis orientation: %s.', orient );\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'property': 'axis.label',\n\t\t'className': 'label noselect',\n\t\t'attributes': {\n\t\t\t'fill': '#000',\n\t\t\t'stroke': 'none',\n\t\t\t'text-anchor': 'middle',\n\t\t\t'transform': labelTransform( orient ),\n\t\t\t'x': labelXPos( orient, ctx._scale.range() ),\n\t\t\t'y': labelYPos( orient )\n\t\t}\n\t};\n\n\tdebug( 'Axis label: %s.', ctx._label );\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\n\treturn h( ELEMENT, props, ctx._label );\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\nimport textAnchor from './../utils/text_anchor.js';\nimport domain from './domain.js';\nimport ticks from './ticks.js';\nimport label from './label.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:components:main' );\nvar ELEMENT = 'g';\n\n\n// MAIN //\n\n/**\n* Renders an axis.\n*\n* @private\n* @param {Object} ctx - context\n* @returns {VTree} virtual tree\n*/\nfunction render( ctx ) {\n\tvar children;\n\tvar props;\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'property': 'axis',\n\t\t'className': 'axis',\n\t\t'attributes': {\n\t\t\t'fill': 'none',\n\t\t\t'font-size': 10, // TODO: option\n\t\t\t'font-family': 'sans-serif', // TODO: option\n\t\t\t'text-anchor': textAnchor( ctx._orientation ) // eslint-disable-line no-underscore-dangle\n\t\t}\n\t};\n\n\tdebug( 'Rendering tick marks...' );\n\tchildren = ticks( ctx );\n\n\tdebug( 'Rendering domain line...' );\n\tchildren.unshift( domain( ctx ) );\n\n\tdebug( 'Rendering label...' );\n\tchildren.push( label( ctx ) );\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\n\treturn h( ELEMENT, props, children );\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the text anchor value for text positioning.\n*\n* @private\n* @param {string} orient - axis orientation\n* @returns {string} text anchor value\n*/\nfunction textAnchor( orient ) {\n\tif ( orient === 'left' ) {\n\t\treturn 'end';\n\t}\n\tif ( orient === 'right' ) {\n\t\treturn 'start';\n\t}\n\treturn 'middle';\n}\n\n\n// EXPORTS //\n\nexport default textAnchor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport components from './../components';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:render' );\n\n\n// MAIN //\n\n/**\n* Renders a virtual DOM tree.\n*\n* @private\n* @returns {VTree} virtual tree\n*/\nfunction render() {\n\t/* eslint-disable no-invalid-this */\n\tvar vtree;\n\n\tdebug( 'Rendering...' );\n\tvtree = components( this );\n\n\t// Announce that a new tree has been rendered:\n\tthis.emit( '_render', vtree );\n\n\treturn vtree;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// TODO: improve JSDoc examples\n\n// MODULES //\n\nvar EventEmitter = require( 'events' ).EventEmitter;\nvar logger = require( 'debug' );\nvar linear = require( 'd3-scale' ).scaleLinear; // TODO: remove\nimport defineProperty from '@stdlib/utils/define-property';\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\nimport copy from '@stdlib/utils/copy';\nimport defaults from './defaults.json';\nimport validate from './validate.js';\nimport setScale from './props/scale/set.js';\nimport getScale from './props/scale/get.js';\nimport setOrientation from './props/orientation/set.js';\nimport getOrientation from './props/orientation/get.js';\nimport setLabel from './props/label/set.js';\nimport getLabel from './props/label/get.js';\nimport setTicks from './props/ticks/set.js';\nimport getTicks from './props/ticks/get.js';\nimport setNumTicks from './props/num-ticks/set.js';\nimport getNumTicks from './props/num-ticks/get.js';\nimport setTickFormat from './props/tick-format/set.js';\nimport getTickFormat from './props/tick-format/get.js';\nimport setTickSize from './props/tick-size/set.js';\nimport getTickSize from './props/tick-size/get.js';\nimport setInnerTickSize from './props/inner-tick-size/set.js';\nimport getInnerTickSize from './props/inner-tick-size/get.js';\nimport setOuterTickSize from './props/outer-tick-size/set.js';\nimport getOuterTickSize from './props/outer-tick-size/get.js';\nimport setTickPadding from './props/tick-padding/set.js';\nimport getTickPadding from './props/tick-padding/get.js';\nimport getTickSpacing from './props/tick-spacing/get.js';\nimport getTickDir from './props/tick-dir/get.js';\nimport getTickPos from './props/tick-pos/get.js';\nimport setAutoRender from './props/auto-render/set.js';\nimport getAutoRender from './props/auto-render/get.js';\nimport render from './methods/render.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'axis:main' );\n\n\n// MAIN //\n\n/**\n* Axis constructor.\n*\n* @constructor\n* @param {Options} options - constructor options\n* @param {Function} [options.scale] - scale function\n* @param {string} [options.orientation='bottom'] - axis orientation\n* @param {string} [options.label] - axis label\n* @param {(Array|null)} [options.ticks] - tick values\n* @param {(NonNegativeInteger|null)} [options.numTicks] - number of ticks\n* @param {(null|string|Function)} [options.tickFormat] - tick format\n* @param {NonNegativeInteger} [options.tickSize=6] - tick size\n* @param {NonNegativeInteger} [options.innerTickSize=6] - inner tick size\n* @param {NonNegativeInteger} [options.outerTickSize=6] - outer tick size\n* @param {NonNegativeInteger} [options.tickPadding=3] - tick padding\n* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event\n* @throws {TypeError} must provide valid options\n* @returns {Axis} axis instance\n*\n* @example\n* var axis = new Axis({\n* 'orientation': 'bottom'\n* });\n*/\nfunction Axis( options ) {\n\tvar self;\n\tvar opts;\n\tvar err;\n\tif ( !( this instanceof Axis ) ) {\n\t\treturn new Axis( options );\n\t}\n\tself = this;\n\topts = copy( defaults );\n\terr = validate( opts, options );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tdebug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) );\n\tEventEmitter.call( this );\n\n\tdefineProperty( this, '_scale', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.scale || linear()\n\t});\n\tdefineProperty( this, '_orientation', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.orientation\n\t});\n\tdefineProperty( this, '_label', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.label\n\t});\n\tdefineProperty( this, '_ticks', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.ticks\n\t});\n\tdefineProperty( this, '_numTicks', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.numTicks\n\t});\n\tdefineProperty( this, '_tickFormat', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.tickFormat\n\t});\n\tdefineProperty( this, '_tickSize', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.tickSize\n\t});\n\tdefineProperty( this, '_innerTickSize', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.innerTickSize\n\t});\n\tdefineProperty( this, '_outerTickSize', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.outerTickSize\n\t});\n\tdefineProperty( this, '_tickPadding', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.tickPadding\n\t});\n\tdefineProperty( this, '_autoRender', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': opts.autoRender\n\t});\n\n\tthis.on( 'change', onChange );\n\tthis.on( '_render', onRender );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a change event.\n\t*\n\t* @private\n\t*/\n\tfunction onChange() {\n\t\tdebug( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}\n\n\t/**\n\t* Re-emits a render event.\n\t*\n\t* @private\n\t*/\n\tfunction onRender() {\n\t\tvar args;\n\t\tvar i;\n\t\tdebug( 'Received a render event. Re-emitting...' );\n\t\targs = new Array( arguments.length+1 );\n\t\targs[ 0 ] = 'render';\n\t\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\t\targs[ i+1 ] = arguments[ i ];\n\t\t}\n\t\tself.emit.apply( self, args );\n\t}\n}\n\n/*\n* Create a prototype which inherits from the parent prototype.\n*/\nAxis.prototype = Object.create( EventEmitter.prototype );\n\n/*\n* Set the constructor.\n*/\nAxis.prototype.constructor = Axis;\n\n/**\n* Scale function.\n*\n* @name scale\n* @memberof Axis.prototype\n* @type {Function}\n* @throws {TypeError} must be a function\n*\n* @example\n* var axis = new Axis({\n* 'orientation': 'top'\n* });\n*\n* var f = axis.scale;\n* // returns \n*/\ndefineProperty( Axis.prototype, 'scale', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setScale,\n\t'get': getScale\n});\n\n/**\n* Axis orientation.\n*\n* @name orientation\n* @memberof Axis.prototype\n* @type {string}\n* @throws {TypeError} must be a string\n* @default 'bottom'\n*\n* @example\n* var axis = new Axis({\n* 'orientation': 'bottom'\n* });\n* axis.orientation = 'top';\n*\n* var v = axis.orientation;\n* // returns 'top'\n*/\ndefineProperty( Axis.prototype, 'orientation', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setOrientation,\n\t'get': getOrientation\n});\n\n/**\n* Axis label.\n*\n* @name label\n* @memberof Axis.prototype\n* @type {string}\n* @throws {TypeError} must be a string\n*\n* @example\n* var axis = new Axis({\n* 'label': 'y'\n* });\n* axis.label = 'Counts';\n*\n* var v = axis.label;\n* // returns 'Counts'\n*/\ndefineProperty( Axis.prototype, 'label', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setLabel,\n\t'get': getLabel\n});\n\n/**\n* Axis tick values. When set to `null`, the retrieved values are the computed tick values.\n*\n* @name ticks\n* @memberof Axis.prototype\n* @type {(Array|null)}\n* @throws {TypeError} must be an array or null\n* @default null\n*\n* @example\n* var axis = new Axis({\n* 'orientation': 'bottom',\n* 'ticks': [1,2,3]\n* });\n* axis.ticks = ['a','b','c'];\n*\n* var v = axis.ticks;\n* // returns \n*/\ndefineProperty( Axis.prototype, 'ticks', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setTicks,\n\t'get': getTicks\n});\n\n/**\n* Number of axis ticks.\n*\n* @name numTicks\n* @memberof Axis.prototype\n* @type {(NonNegativeInteger|null)}\n* @throws {TypeError} must be a nonnegative integer or null\n* @default null\n*\n* @example\n* var axis = new Axis({\n* 'orientation': 'bottom',\n* 'numTicks': 10\n* });\n* axis.numTicks = 5;\n*\n* var v = axis.numTicks;\n* // returns 5\n*/\ndefineProperty( Axis.prototype, 'numTicks', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setNumTicks,\n\t'get': getNumTicks\n});\n\n/**\n* Tick format. When retrieved, the returned value is a formatting function.\n*\n* @name tickFormat\n* @memberof Axis.prototype\n* @type {(null|string|Function)}\n* @throws {TypeError} must be either null, a string, or a function\n* @default null\n*\n* @example\n* var axis = new Axis({\n* 'orientation': 'bottom',\n* 'tickFormat': ',f'\n* });\n* axis.tickFormat = ',.0f';\n*\n* var v = axis.tickFormat;\n* // returns \n*/\ndefineProperty( Axis.prototype, 'tickFormat', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setTickFormat,\n\t'get': getTickFormat\n});\n\n/**\n* Axis tick size.\n*\n* @name tickSize\n* @memberof Axis.prototype\n* @type {NonNegativeInteger}\n* @throws {TypeError} must be a nonnegative integer\n* @default 6\n*\n* @example\n* var axis = new Axis({\n* 'orientation': 'bottom',\n* 'tickSize': 12\n* });\n* axis.tickSize = 8;\n*\n* var v = axis.tickSize;\n* // returns 8\n*/\ndefineProperty( Axis.prototype, 'tickSize', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setTickSize,\n\t'get': getTickSize\n});\n\n/**\n* Axis inner tick size.\n*\n* @name innerTickSize\n* @memberof Axis.prototype\n* @type {NonNegativeInteger}\n* @throws {TypeError} must be a nonnegative integer\n* @default 6\n*\n* @example\n* var axis = new Axis({\n* 'orientation': 'bottom',\n* 'innerTickSize': 10\n* });\n* axis.innerTickSize = 5;\n*\n* var v = axis.innerTickSize;\n* // returns 5\n*/\ndefineProperty( Axis.prototype, 'innerTickSize', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setInnerTickSize,\n\t'get': getInnerTickSize\n});\n\n/**\n* Axis outer tick size.\n*\n* @name outerTickSize\n* @memberof Axis.prototype\n* @type {NonNegativeInteger}\n* @throws {TypeError} must be a nonnegative integer\n* @default 6\n*\n* @example\n* var axis = new Axis({\n* 'orientation': 'bottom',\n* 'outerTickSize': 10\n* });\n* axis.outerTickSize = 5;\n*\n* var v = axis.outerTickSize;\n* // returns 5\n*/\ndefineProperty( Axis.prototype, 'outerTickSize', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setOuterTickSize,\n\t'get': getOuterTickSize\n});\n\n/**\n* Axis tick padding.\n*\n* @name tickPadding\n* @memberof Axis.prototype\n* @type {NonNegativeInteger}\n* @throws {TypeError} must be a nonnegative integer\n* @default 3\n*\n* @example\n* var axis = new Axis({\n* 'orientation': 'bottom',\n* 'tickPadding': 10\n* });\n* axis.tickPadding = 5;\n*\n* var v = axis.tickPadding;\n* // returns 5\n*/\ndefineProperty( Axis.prototype, 'tickPadding', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setTickPadding,\n\t'get': getTickPadding\n});\n\n/**\n* Tick spacing.\n*\n* @name tickSpacing\n* @memberof Axis.prototype\n* @type {number}\n*\n* @example\n* var axis = new Axis( {} );\n*\n* var spacing = axis.tickSpacing;\n* // returns \n*/\ndefineProperty( Axis.prototype, 'tickSpacing', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getTickSpacing\n});\n\n/**\n* Tick direction.\n*\n* @name tickDir\n* @memberof Axis.prototype\n* @type {number}\n*\n* @example\n* var axis = new Axis( {} );\n*\n* var dir = axis.tickDir;\n* // returns \n*/\ndefineProperty( Axis.prototype, 'tickDir', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getTickDir\n});\n\n/**\n* Function for computing tick positions.\n*\n* @name tickPos\n* @memberof Axis.prototype\n* @type {Function}\n*\n* @example\n* var axis = new Axis( {} );\n*\n* var tickPos = axis.tickPos;\n* // returns \n*/\ndefineProperty( Axis.prototype, 'tickPos', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getTickPos\n});\n\n/**\n* Rendering mode. If `true`, an instance re-renders on each change event.\n*\n* @name autoRender\n* @memberof Axis.prototype\n* @type {boolean}\n* @throws {TypeError} must be a boolean\n* @default false\n*\n* @example\n* var axis = new Axis({\n* 'autoRender': true\n* });\n*\n* var mode = axis.autoRender;\n* // returns true\n*/\ndefineProperty( Axis.prototype, 'autoRender', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setAutoRender,\n\t'get': getAutoRender\n});\n\n/**\n* Renders a virtual DOM tree.\n*\n* @name render\n* @memberof Axis.prototype\n* @type {Function}\n* @returns {VTree} virtual tree\n*\n* @example\n* var axis = new Axis( {} );\n*\n* var out = axis.render();\n*/\nsetReadOnly( Axis.prototype, 'render', render );\n\n\n// EXPORTS //\n\nexport default Axis;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the scale function.\n*\n* @private\n* @returns {Function} scale function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._scale;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the axis orientation.\n*\n* @private\n* @returns {string} orientation\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._orientation;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the axis label.\n*\n* @private\n* @returns {string} label\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._label;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isNull from '@stdlib/assert/is-null';\n\n\n// MAIN //\n\n/**\n* Returns the axis tick values.\n*\n* @private\n* @returns {Array} ticks\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tif ( isNull( this._ticks ) ) {\n\t\tif ( this._scale.ticks ) {\n\t\t\treturn this._scale.ticks( this._numTicks, this._tickFormat );\n\t\t}\n\t\treturn this._scale.domain();\n\t}\n\treturn this._ticks.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the number of axis ticks.\n*\n* @private\n* @returns {(NonNegativeInteger|null)} number of ticks\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._numTicks;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the axis tick size.\n*\n* @private\n* @returns {NonNegativeInteger} tick size\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._tickSize;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the inner tick size.\n*\n* @private\n* @returns {NonNegativeInteger} tick size\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._innerTickSize;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the axis outer tick size.\n*\n* @private\n* @returns {NonNegativeInteger} tick size\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._outerTickSize;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the axis tick padding.\n*\n* @private\n* @returns {NonNegativeInteger} padding\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._tickPadding;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the tick spacing.\n*\n* @private\n* @returns {number} tick spacing\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._innerTickSize + this._tickPadding;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the tick direction.\n*\n* @private\n* @returns {number} tick direction\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tif (\n\t\tthis._orientation === 'top' ||\n\t\tthis._orientation === 'left'\n\t) {\n\t\treturn -1;\n\t}\n\treturn 1;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport center from './center.js';\n\n\n// MAIN //\n\n/**\n* Returns a function for positioning ticks.\n*\n* @private\n* @returns {Function} position function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar scale = this._scale.copy();\n\tif ( scale.bandwidth ) {\n\t\treturn center( scale );\n\t}\n\treturn scale;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the rendering mode.\n*\n* @private\n* @returns {boolean} rendering mode\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._autoRender;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isnan } from '@stdlib/assert/is-nan';\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:accessor:is-defined' );\n\n\n// MAIN //\n\n/**\n* Accessor function which determines whether a datum is defined.\n*\n* @private\n* @param {number} d - datum\n* @returns {boolean} boolean indicating whether a datum is defined\n*/\nfunction isDefined( d ) {\n\tvar bool = !isnan( d );\n\tdebug( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool );\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default isDefined;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isArrayLike from '@stdlib/assert/is-array-like';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:set:x' );\n\n\n// MAIN //\n\n/**\n* Sets the `x` values.\n*\n* @private\n* @param {ArrayLike} x - x values\n* @throws {TypeError} must be array-like\n*/\nfunction set( x ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isArrayLike( x ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'x', x ) );\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._xData ) );\n\n\tthis._xData = x;\n\tdebug( 'New Value: %s.', JSON.stringify( this._xData ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isArrayLike from '@stdlib/assert/is-array-like';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:set:y' );\n\n\n// MAIN //\n\n/**\n* Sets the `y` values.\n*\n* @private\n* @param {ArrayLike} y - y values\n* @throws {TypeError} must be array-like\n*/\nfunction set( y ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isArrayLike( y ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'y', y ) );\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._yData ) );\n\n\tthis._yData = y;\n\tdebug( 'New Value: %s.', JSON.stringify( this._yData ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:set:xscale' );\n\n\n// MAIN //\n\n/**\n* Sets the x-scale function.\n*\n* @private\n* @param {Function} fcn - scale\n* @throws {TypeError} must be a function\n*/\nfunction set( fcn ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'xScale', fcn ) );\n\t}\n\tdebug( 'Current value: %s.', this._xScale );\n\n\tthis._xScale = fcn;\n\tdebug( 'New Value: %s.', this._xScale );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:set:yscale' );\n\n\n// MAIN //\n\n/**\n* Sets the y-scale function.\n*\n* @private\n* @param {Function} fcn - scale\n* @throws {TypeError} must be a function\n*/\nfunction set( fcn ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'yScale', fcn ) );\n\t}\n\tdebug( 'Current value: %s.', this._yScale );\n\n\tthis._yScale = fcn;\n\tdebug( 'New Value: %s.', this._yScale );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:set:is-defined' );\n\n\n// MAIN //\n\n/**\n* Sets the accessor for defined values.\n*\n* @private\n* @param {Function} fcn - accessor\n* @throws {TypeError} must be a function\n*/\nfunction set( fcn ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'isDefined', fcn ) );\n\t}\n\tdebug( 'Current value: %s.', this._isDefined );\n\n\tthis._isDefined = fcn;\n\tdebug( 'New Value: %s.', this._isDefined );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:set:color' );\n\n\n// MAIN //\n\n/**\n* Sets the path color.\n*\n* @private\n* @param {string} color - color\n* @throws {TypeError} must be a string\n*/\nfunction set( color ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isString( color ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'color', color ) );\n\t}\n\tdebug( 'Current value: %d.', this._color );\n\n\tthis._color = color;\n\tdebug( 'New Value: %d.', this._color );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:set:label' );\n\n\n// MAIN //\n\n/**\n* Sets the path label.\n*\n* @private\n* @param {string} label - label\n* @throws {TypeError} must be a string\n*/\nfunction set( label ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isString( label ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'label', label ) );\n\t}\n\tdebug( 'Current value: %d.', this._label );\n\n\tthis._label = label;\n\tdebug( 'New Value: %d.', this._label );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:set:opacity' );\n\n\n// MAIN //\n\n/**\n* Sets the opacity.\n*\n* @private\n* @param {number} opacity - opacity\n* @throws {TypeError} must be a number\n* @throws {RangeError} must be a number on the interval `[0,1]`\n*/\nfunction set( opacity ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isNumber( opacity ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a number. Value: `%s`.', 'opacity', opacity ) );\n\t}\n\tif (\n\t\topacity < 0.0 ||\n\t\topacity > 1.0\n\t) {\n\t\tthrow new RangeError( format( 'invalid assignment. `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'opacity', opacity ) );\n\t}\n\tdebug( 'Current value: %d.', this._opacity );\n\n\tthis._opacity = opacity;\n\tdebug( 'New Value: %d.', this._opacity );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:set:width' );\n\n\n// MAIN //\n\n/**\n* Sets the width.\n*\n* @private\n* @param {NonNegativeInteger} v - width\n* @throws {TypeError} must be a nonnegative integer\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isNonNegativeInteger( v ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'width', v ) );\n\t}\n\tdebug( 'Current value: %d.', this._width );\n\n\tthis._width = v;\n\tdebug( 'New Value: %d.', this._width );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:set:style' );\n\n\n// MAIN //\n\n/**\n* Sets the path style.\n*\n* @private\n* @param {string} v - style\n* @throws {TypeError} must be a string\n*/\nfunction set( v ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isString( v ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'style', v ) );\n\t}\n\tdebug( 'Current value: %d.', this._style );\n\n\tthis._style = v;\n\tdebug( 'New Value: %d.', this._style );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:set:auto-render' );\n\n\n// MAIN //\n\n/**\n* Sets the rendering mode.\n*\n* @private\n* @param {boolean} bool - boolean indicating whether to re-render on a change event\n* @throws {TypeError} must be a positive number\n*/\nfunction set( bool ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isBoolean( bool ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) );\n\t}\n\tdebug( 'Current value: %d.', this._autoRender );\n\n\tthis._autoRender = bool;\n\tdebug( 'New Value: %d.', this._autoRender );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","var pi = Math.PI,\n tau = 2 * pi,\n epsilon = 1e-6,\n tauEpsilon = tau - epsilon;\n\nfunction Path() {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n}\n\nfunction path() {\n return new Path;\n}\n\nPath.prototype = path.prototype = {\n constructor: Path,\n moveTo: function(x, y) {\n this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y);\n },\n closePath: function() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._ += \"Z\";\n }\n },\n lineTo: function(x, y) {\n this._ += \"L\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n quadraticCurveTo: function(x1, y1, x, y) {\n this._ += \"Q\" + (+x1) + \",\" + (+y1) + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) {\n this._ += \"C\" + (+x1) + \",\" + (+y1) + \",\" + (+x2) + \",\" + (+y2) + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n arcTo: function(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n var x0 = this._x1,\n y0 = this._y1,\n x21 = x2 - x1,\n y21 = y2 - y1,\n x01 = x0 - x1,\n y01 = y0 - y1,\n l01_2 = x01 * x01 + y01 * y01;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(\"negative radius: \" + r);\n\n // Is this path empty? Move to (x1,y1).\n if (this._x1 === null) {\n this._ += \"M\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n }\n\n // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n else if (!(l01_2 > epsilon));\n\n // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n // Equivalently, is (x1,y1) coincident with (x2,y2)?\n // Or, is the radius zero? Line to (x1,y1).\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n this._ += \"L\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n }\n\n // Otherwise, draw an arc!\n else {\n var x20 = x2 - x0,\n y20 = y2 - y0,\n l21_2 = x21 * x21 + y21 * y21,\n l20_2 = x20 * x20 + y20 * y20,\n l21 = Math.sqrt(l21_2),\n l01 = Math.sqrt(l01_2),\n l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n t01 = l / l01,\n t21 = l / l21;\n\n // If the start tangent is not coincident with (x0,y0), line to.\n if (Math.abs(t01 - 1) > epsilon) {\n this._ += \"L\" + (x1 + t01 * x01) + \",\" + (y1 + t01 * y01);\n }\n\n this._ += \"A\" + r + \",\" + r + \",0,0,\" + (+(y01 * x20 > x01 * y20)) + \",\" + (this._x1 = x1 + t21 * x21) + \",\" + (this._y1 = y1 + t21 * y21);\n }\n },\n arc: function(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r, ccw = !!ccw;\n var dx = r * Math.cos(a0),\n dy = r * Math.sin(a0),\n x0 = x + dx,\n y0 = y + dy,\n cw = 1 ^ ccw,\n da = ccw ? a0 - a1 : a1 - a0;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(\"negative radius: \" + r);\n\n // Is this path empty? Move to (x0,y0).\n if (this._x1 === null) {\n this._ += \"M\" + x0 + \",\" + y0;\n }\n\n // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n this._ += \"L\" + x0 + \",\" + y0;\n }\n\n // Is this arc empty? We’re done.\n if (!r) return;\n\n // Does the angle go the wrong way? Flip the direction.\n if (da < 0) da = da % tau + tau;\n\n // Is this a complete circle? Draw two arcs to complete the circle.\n if (da > tauEpsilon) {\n this._ += \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (x - dx) + \",\" + (y - dy) + \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (this._x1 = x0) + \",\" + (this._y1 = y0);\n }\n\n // Is this arc non-empty? Draw an arc!\n else if (da > epsilon) {\n this._ += \"A\" + r + \",\" + r + \",0,\" + (+(da >= pi)) + \",\" + cw + \",\" + (this._x1 = x + r * Math.cos(a1)) + \",\" + (this._y1 = y + r * Math.sin(a1));\n }\n },\n rect: function(x, y, w, h) {\n this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y) + \"h\" + (+w) + \"v\" + (+h) + \"h\" + (-w) + \"Z\";\n },\n toString: function() {\n return this._;\n }\n};\n\nexport default path;\n","export default function(x) {\n return function constant() {\n return x;\n };\n}\n","export var abs = Math.abs;\nexport var atan2 = Math.atan2;\nexport var cos = Math.cos;\nexport var max = Math.max;\nexport var min = Math.min;\nexport var sin = Math.sin;\nexport var sqrt = Math.sqrt;\n\nexport var epsilon = 1e-12;\nexport var pi = Math.PI;\nexport var halfPi = pi / 2;\nexport var tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","import {path} from \"d3-path\";\nimport constant from \"./constant.js\";\nimport {abs, acos, asin, atan2, cos, epsilon, halfPi, max, min, pi, sin, sqrt, tau} from \"./math.js\";\n\nfunction arcInnerRadius(d) {\n return d.innerRadius;\n}\n\nfunction arcOuterRadius(d) {\n return d.outerRadius;\n}\n\nfunction arcStartAngle(d) {\n return d.startAngle;\n}\n\nfunction arcEndAngle(d) {\n return d.endAngle;\n}\n\nfunction arcPadAngle(d) {\n return d && d.padAngle; // Note: optional!\n}\n\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n var x10 = x1 - x0, y10 = y1 - y0,\n x32 = x3 - x2, y32 = y3 - y2,\n t = y32 * x10 - x32 * y10;\n if (t * t < epsilon) return;\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;\n return [x0 + t * x10, y0 + t * y10];\n}\n\n// Compute perpendicular offset line of length rc.\n// http://mathworld.wolfram.com/Circle-LineIntersection.html\nfunction cornerTangents(x0, y0, x1, y1, r1, rc, cw) {\n var x01 = x0 - x1,\n y01 = y0 - y1,\n lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),\n ox = lo * y01,\n oy = -lo * x01,\n x11 = x0 + ox,\n y11 = y0 + oy,\n x10 = x1 + ox,\n y10 = y1 + oy,\n x00 = (x11 + x10) / 2,\n y00 = (y11 + y10) / 2,\n dx = x10 - x11,\n dy = y10 - y11,\n d2 = dx * dx + dy * dy,\n r = r1 - rc,\n D = x11 * y10 - x10 * y11,\n d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),\n cx0 = (D * dy - dx * d) / d2,\n cy0 = (-D * dx - dy * d) / d2,\n cx1 = (D * dy + dx * d) / d2,\n cy1 = (-D * dx + dy * d) / d2,\n dx0 = cx0 - x00,\n dy0 = cy0 - y00,\n dx1 = cx1 - x00,\n dy1 = cy1 - y00;\n\n // Pick the closer of the two intersection points.\n // TODO Is there a faster way to determine which intersection to use?\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (r1 / r - 1),\n y11: cy0 * (r1 / r - 1)\n };\n}\n\nexport default function() {\n var innerRadius = arcInnerRadius,\n outerRadius = arcOuterRadius,\n cornerRadius = constant(0),\n padRadius = null,\n startAngle = arcStartAngle,\n endAngle = arcEndAngle,\n padAngle = arcPadAngle,\n context = null;\n\n function arc() {\n var buffer,\n r,\n r0 = +innerRadius.apply(this, arguments),\n r1 = +outerRadius.apply(this, arguments),\n a0 = startAngle.apply(this, arguments) - halfPi,\n a1 = endAngle.apply(this, arguments) - halfPi,\n da = abs(a1 - a0),\n cw = a1 > a0;\n\n if (!context) context = buffer = path();\n\n // Ensure that the outer radius is always larger than the inner radius.\n if (r1 < r0) r = r1, r1 = r0, r0 = r;\n\n // Is it a point?\n if (!(r1 > epsilon)) context.moveTo(0, 0);\n\n // Or is it a circle or annulus?\n else if (da > tau - epsilon) {\n context.moveTo(r1 * cos(a0), r1 * sin(a0));\n context.arc(0, 0, r1, a0, a1, !cw);\n if (r0 > epsilon) {\n context.moveTo(r0 * cos(a1), r0 * sin(a1));\n context.arc(0, 0, r0, a1, a0, cw);\n }\n }\n\n // Or is it a circular or annular sector?\n else {\n var a01 = a0,\n a11 = a1,\n a00 = a0,\n a10 = a1,\n da0 = da,\n da1 = da,\n ap = padAngle.apply(this, arguments) / 2,\n rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),\n rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),\n rc0 = rc,\n rc1 = rc,\n t0,\n t1;\n\n // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.\n if (rp > epsilon) {\n var p0 = asin(rp / r0 * sin(ap)),\n p1 = asin(rp / r1 * sin(ap));\n if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;\n else da0 = 0, a00 = a10 = (a0 + a1) / 2;\n if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;\n else da1 = 0, a01 = a11 = (a0 + a1) / 2;\n }\n\n var x01 = r1 * cos(a01),\n y01 = r1 * sin(a01),\n x10 = r0 * cos(a10),\n y10 = r0 * sin(a10);\n\n // Apply rounded corners?\n if (rc > epsilon) {\n var x11 = r1 * cos(a11),\n y11 = r1 * sin(a11),\n x00 = r0 * cos(a00),\n y00 = r0 * sin(a00),\n oc;\n\n // Restrict the corner radius according to the sector angle.\n if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {\n var ax = x01 - oc[0],\n ay = y01 - oc[1],\n bx = x11 - oc[0],\n by = y11 - oc[1],\n kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),\n lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n rc0 = min(rc, (r0 - lc) / (kc - 1));\n rc1 = min(rc, (r1 - lc) / (kc + 1));\n }\n }\n\n // Is the sector collapsed to a line?\n if (!(da1 > epsilon)) context.moveTo(x01, y01);\n\n // Does the sector’s outer ring have rounded corners?\n else if (rc1 > epsilon) {\n t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);\n t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);\n\n context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);\n context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the outer ring just a circular arc?\n else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);\n\n // Is there no inner ring, and it’s a circular sector?\n // Or perhaps it’s an annular sector collapsed due to padding?\n if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);\n\n // Does the sector’s inner ring (or point) have rounded corners?\n else if (rc0 > epsilon) {\n t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);\n t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);\n\n context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);\n context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the inner ring just a circular arc?\n else context.arc(0, 0, r0, a10, a00, cw);\n }\n\n context.closePath();\n\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n arc.centroid = function() {\n var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,\n a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;\n return [cos(a) * r, sin(a) * r];\n };\n\n arc.innerRadius = function(_) {\n return arguments.length ? (innerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : innerRadius;\n };\n\n arc.outerRadius = function(_) {\n return arguments.length ? (outerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : outerRadius;\n };\n\n arc.cornerRadius = function(_) {\n return arguments.length ? (cornerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : cornerRadius;\n };\n\n arc.padRadius = function(_) {\n return arguments.length ? (padRadius = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), arc) : padRadius;\n };\n\n arc.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : startAngle;\n };\n\n arc.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : endAngle;\n };\n\n arc.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : padAngle;\n };\n\n arc.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), arc) : context;\n };\n\n return arc;\n}\n","function Linear(context) {\n this._context = context;\n}\n\nLinear.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // proceed\n default: this._context.lineTo(x, y); break;\n }\n }\n};\n\nexport default function(context) {\n return new Linear(context);\n}\n","export function x(p) {\n return p[0];\n}\n\nexport function y(p) {\n return p[1];\n}\n","import {path} from \"d3-path\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function() {\n var x = pointX,\n y = pointY,\n defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null;\n\n function line(data) {\n var i,\n n = data.length,\n d,\n defined0 = false,\n buffer;\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) output.lineStart();\n else output.lineEnd();\n }\n if (defined0) output.point(+x(d, i, data), +y(d, i, data));\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n line.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), line) : x;\n };\n\n line.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), line) : y;\n };\n\n line.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), line) : defined;\n };\n\n line.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;\n };\n\n line.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;\n };\n\n return line;\n}\n","import {path} from \"d3-path\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport line from \"./line.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function() {\n var x0 = pointX,\n x1 = null,\n y0 = constant(0),\n y1 = pointY,\n defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null;\n\n function area(data) {\n var i,\n j,\n k,\n n = data.length,\n d,\n defined0 = false,\n buffer,\n x0z = new Array(n),\n y0z = new Array(n);\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) {\n j = i;\n output.areaStart();\n output.lineStart();\n } else {\n output.lineEnd();\n output.lineStart();\n for (k = i - 1; k >= j; --k) {\n output.point(x0z[k], y0z[k]);\n }\n output.lineEnd();\n output.areaEnd();\n }\n }\n if (defined0) {\n x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);\n output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);\n }\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n function arealine() {\n return line().defined(defined).curve(curve).context(context);\n }\n\n area.x = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), x1 = null, area) : x0;\n };\n\n area.x0 = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), area) : x0;\n };\n\n area.x1 = function(_) {\n return arguments.length ? (x1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : x1;\n };\n\n area.y = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), y1 = null, area) : y0;\n };\n\n area.y0 = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), area) : y0;\n };\n\n area.y1 = function(_) {\n return arguments.length ? (y1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : y1;\n };\n\n area.lineX0 =\n area.lineY0 = function() {\n return arealine().x(x0).y(y0);\n };\n\n area.lineY1 = function() {\n return arealine().x(x0).y(y1);\n };\n\n area.lineX1 = function() {\n return arealine().x(x1).y(y0);\n };\n\n area.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), area) : defined;\n };\n\n area.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;\n };\n\n area.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;\n };\n\n return area;\n}\n","export default function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n}\n","export default function(d) {\n return d;\n}\n","import curveLinear from \"./linear.js\";\n\nexport var curveRadialLinear = curveRadial(curveLinear);\n\nfunction Radial(curve) {\n this._curve = curve;\n}\n\nRadial.prototype = {\n areaStart: function() {\n this._curve.areaStart();\n },\n areaEnd: function() {\n this._curve.areaEnd();\n },\n lineStart: function() {\n this._curve.lineStart();\n },\n lineEnd: function() {\n this._curve.lineEnd();\n },\n point: function(a, r) {\n this._curve.point(r * Math.sin(a), r * -Math.cos(a));\n }\n};\n\nexport default function curveRadial(curve) {\n\n function radial(context) {\n return new Radial(curve(context));\n }\n\n radial._curve = curve;\n\n return radial;\n}\n","import curveRadial, {curveRadialLinear} from \"./curve/radial.js\";\nimport line from \"./line.js\";\n\nexport function lineRadial(l) {\n var c = l.curve;\n\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n\n l.curve = function(_) {\n return arguments.length ? c(curveRadial(_)) : c()._curve;\n };\n\n return l;\n}\n\nexport default function() {\n return lineRadial(line().curve(curveRadialLinear));\n}\n","import curveRadial, {curveRadialLinear} from \"./curve/radial.js\";\nimport area from \"./area.js\";\nimport {lineRadial} from \"./lineRadial.js\";\n\nexport default function() {\n var a = area().curve(curveRadialLinear),\n c = a.curve,\n x0 = a.lineX0,\n x1 = a.lineX1,\n y0 = a.lineY0,\n y1 = a.lineY1;\n\n a.angle = a.x, delete a.x;\n a.startAngle = a.x0, delete a.x0;\n a.endAngle = a.x1, delete a.x1;\n a.radius = a.y, delete a.y;\n a.innerRadius = a.y0, delete a.y0;\n a.outerRadius = a.y1, delete a.y1;\n a.lineStartAngle = function() { return lineRadial(x0()); }, delete a.lineX0;\n a.lineEndAngle = function() { return lineRadial(x1()); }, delete a.lineX1;\n a.lineInnerRadius = function() { return lineRadial(y0()); }, delete a.lineY0;\n a.lineOuterRadius = function() { return lineRadial(y1()); }, delete a.lineY1;\n\n a.curve = function(_) {\n return arguments.length ? c(curveRadial(_)) : c()._curve;\n };\n\n return a;\n}\n","export default function(x, y) {\n return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)];\n}\n","export var slice = Array.prototype.slice;\n","import {path} from \"d3-path\";\nimport {slice} from \"../array.js\";\nimport constant from \"../constant.js\";\nimport {x as pointX, y as pointY} from \"../point.js\";\nimport pointRadial from \"../pointRadial.js\";\n\nfunction linkSource(d) {\n return d.source;\n}\n\nfunction linkTarget(d) {\n return d.target;\n}\n\nfunction link(curve) {\n var source = linkSource,\n target = linkTarget,\n x = pointX,\n y = pointY,\n context = null;\n\n function link() {\n var buffer, argv = slice.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);\n if (!context) context = buffer = path();\n curve(context, +x.apply(this, (argv[0] = s, argv)), +y.apply(this, argv), +x.apply(this, (argv[0] = t, argv)), +y.apply(this, argv));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n link.source = function(_) {\n return arguments.length ? (source = _, link) : source;\n };\n\n link.target = function(_) {\n return arguments.length ? (target = _, link) : target;\n };\n\n link.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), link) : x;\n };\n\n link.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), link) : y;\n };\n\n link.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), link) : context;\n };\n\n return link;\n}\n\nfunction curveHorizontal(context, x0, y0, x1, y1) {\n context.moveTo(x0, y0);\n context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);\n}\n\nfunction curveVertical(context, x0, y0, x1, y1) {\n context.moveTo(x0, y0);\n context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1);\n}\n\nfunction curveRadial(context, x0, y0, x1, y1) {\n var p0 = pointRadial(x0, y0),\n p1 = pointRadial(x0, y0 = (y0 + y1) / 2),\n p2 = pointRadial(x1, y0),\n p3 = pointRadial(x1, y1);\n context.moveTo(p0[0], p0[1]);\n context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);\n}\n\nexport function linkHorizontal() {\n return link(curveHorizontal);\n}\n\nexport function linkVertical() {\n return link(curveVertical);\n}\n\nexport function linkRadial() {\n var l = link(curveRadial);\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n return l;\n}\n","import {pi, tau} from \"../math.js\";\n\nexport default {\n draw: function(context, size) {\n var r = Math.sqrt(size / pi);\n context.moveTo(r, 0);\n context.arc(0, 0, r, 0, tau);\n }\n};\n","export default {\n draw: function(context, size) {\n var r = Math.sqrt(size / 5) / 2;\n context.moveTo(-3 * r, -r);\n context.lineTo(-r, -r);\n context.lineTo(-r, -3 * r);\n context.lineTo(r, -3 * r);\n context.lineTo(r, -r);\n context.lineTo(3 * r, -r);\n context.lineTo(3 * r, r);\n context.lineTo(r, r);\n context.lineTo(r, 3 * r);\n context.lineTo(-r, 3 * r);\n context.lineTo(-r, r);\n context.lineTo(-3 * r, r);\n context.closePath();\n }\n};\n","var tan30 = Math.sqrt(1 / 3),\n tan30_2 = tan30 * 2;\n\nexport default {\n draw: function(context, size) {\n var y = Math.sqrt(size / tan30_2),\n x = y * tan30;\n context.moveTo(0, -y);\n context.lineTo(x, 0);\n context.lineTo(0, y);\n context.lineTo(-x, 0);\n context.closePath();\n }\n};\n","import {pi, tau} from \"../math.js\";\n\nvar ka = 0.89081309152928522810,\n kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10),\n kx = Math.sin(tau / 10) * kr,\n ky = -Math.cos(tau / 10) * kr;\n\nexport default {\n draw: function(context, size) {\n var r = Math.sqrt(size * ka),\n x = kx * r,\n y = ky * r;\n context.moveTo(0, -r);\n context.lineTo(x, y);\n for (var i = 1; i < 5; ++i) {\n var a = tau * i / 5,\n c = Math.cos(a),\n s = Math.sin(a);\n context.lineTo(s * r, -c * r);\n context.lineTo(c * x - s * y, s * x + c * y);\n }\n context.closePath();\n }\n};\n","export default {\n draw: function(context, size) {\n var w = Math.sqrt(size),\n x = -w / 2;\n context.rect(x, x, w, w);\n }\n};\n","var sqrt3 = Math.sqrt(3);\n\nexport default {\n draw: function(context, size) {\n var y = -Math.sqrt(size / (sqrt3 * 3));\n context.moveTo(0, y * 2);\n context.lineTo(-sqrt3 * y, -y);\n context.lineTo(sqrt3 * y, -y);\n context.closePath();\n }\n};\n","var c = -0.5,\n s = Math.sqrt(3) / 2,\n k = 1 / Math.sqrt(12),\n a = (k / 2 + 1) * 3;\n\nexport default {\n draw: function(context, size) {\n var r = Math.sqrt(size / a),\n x0 = r / 2,\n y0 = r * k,\n x1 = x0,\n y1 = r * k + r,\n x2 = -x1,\n y2 = y1;\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n context.lineTo(c * x0 - s * y0, s * x0 + c * y0);\n context.lineTo(c * x1 - s * y1, s * x1 + c * y1);\n context.lineTo(c * x2 - s * y2, s * x2 + c * y2);\n context.lineTo(c * x0 + s * y0, c * y0 - s * x0);\n context.lineTo(c * x1 + s * y1, c * y1 - s * x1);\n context.lineTo(c * x2 + s * y2, c * y2 - s * x2);\n context.closePath();\n }\n};\n","import {path} from \"d3-path\";\nimport circle from \"./symbol/circle.js\";\nimport cross from \"./symbol/cross.js\";\nimport diamond from \"./symbol/diamond.js\";\nimport star from \"./symbol/star.js\";\nimport square from \"./symbol/square.js\";\nimport triangle from \"./symbol/triangle.js\";\nimport wye from \"./symbol/wye.js\";\nimport constant from \"./constant.js\";\n\nexport var symbols = [\n circle,\n cross,\n diamond,\n square,\n star,\n triangle,\n wye\n];\n\nexport default function() {\n var type = constant(circle),\n size = constant(64),\n context = null;\n\n function symbol() {\n var buffer;\n if (!context) context = buffer = path();\n type.apply(this, arguments).draw(context, +size.apply(this, arguments));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n symbol.type = function(_) {\n return arguments.length ? (type = typeof _ === \"function\" ? _ : constant(_), symbol) : type;\n };\n\n symbol.size = function(_) {\n return arguments.length ? (size = typeof _ === \"function\" ? _ : constant(+_), symbol) : size;\n };\n\n symbol.context = function(_) {\n return arguments.length ? (context = _ == null ? null : _, symbol) : context;\n };\n\n return symbol;\n}\n","export default function() {}\n","export function point(that, x, y) {\n that._context.bezierCurveTo(\n (2 * that._x0 + that._x1) / 3,\n (2 * that._y0 + that._y1) / 3,\n (that._x0 + 2 * that._x1) / 3,\n (that._y0 + 2 * that._y1) / 3,\n (that._x0 + 4 * that._x1 + x) / 6,\n (that._y0 + 4 * that._y1 + y) / 6\n );\n}\n\nexport function Basis(context) {\n this._context = context;\n}\n\nBasis.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 3: point(this, this._x1, this._y1); // proceed\n case 2: this._context.lineTo(this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new Basis(context);\n}\n","import noop from \"../noop.js\";\nimport {point} from \"./basis.js\";\n\nfunction BasisClosed(context) {\n this._context = context;\n}\n\nBasisClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x2, this._y2);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);\n this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x2, this._y2);\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x2 = x, this._y2 = y; break;\n case 1: this._point = 2; this._x3 = x, this._y3 = y; break;\n case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisClosed(context);\n}\n","import {point} from \"./basis.js\";\n\nfunction BasisOpen(context) {\n this._context = context;\n}\n\nBasisOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;\n case 3: this._point = 4; // proceed\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisOpen(context);\n}\n","import {Basis} from \"./basis.js\";\n\nfunction Bundle(context, beta) {\n this._basis = new Basis(context);\n this._beta = beta;\n}\n\nBundle.prototype = {\n lineStart: function() {\n this._x = [];\n this._y = [];\n this._basis.lineStart();\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n j = x.length - 1;\n\n if (j > 0) {\n var x0 = x[0],\n y0 = y[0],\n dx = x[j] - x0,\n dy = y[j] - y0,\n i = -1,\n t;\n\n while (++i <= j) {\n t = i / j;\n this._basis.point(\n this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),\n this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)\n );\n }\n }\n\n this._x = this._y = null;\n this._basis.lineEnd();\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\nexport default (function custom(beta) {\n\n function bundle(context) {\n return beta === 1 ? new Basis(context) : new Bundle(context, beta);\n }\n\n bundle.beta = function(beta) {\n return custom(+beta);\n };\n\n return bundle;\n})(0.85);\n","export function point(that, x, y) {\n that._context.bezierCurveTo(\n that._x1 + that._k * (that._x2 - that._x0),\n that._y1 + that._k * (that._y2 - that._y0),\n that._x2 + that._k * (that._x1 - x),\n that._y2 + that._k * (that._y1 - y),\n that._x2,\n that._y2\n );\n}\n\nexport function Cardinal(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: point(this, this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n case 2: this._point = 3; // proceed\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new Cardinal(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import noop from \"../noop.js\";\nimport {point} from \"./cardinal.js\";\n\nexport function CardinalClosed(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalClosed(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import {point} from \"./cardinal.js\";\n\nexport function CardinalOpen(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // proceed\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalOpen(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import {epsilon} from \"../math.js\";\nimport {Cardinal} from \"./cardinal.js\";\n\nexport function point(that, x, y) {\n var x1 = that._x1,\n y1 = that._y1,\n x2 = that._x2,\n y2 = that._y2;\n\n if (that._l01_a > epsilon) {\n var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,\n n = 3 * that._l01_a * (that._l01_a + that._l12_a);\n x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;\n y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;\n }\n\n if (that._l23_a > epsilon) {\n var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,\n m = 3 * that._l23_a * (that._l23_a + that._l12_a);\n x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;\n y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;\n }\n\n that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);\n}\n\nfunction CatmullRom(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRom.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: this.point(this._x2, this._y2); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; // proceed\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n","import {CardinalClosed} from \"./cardinalClosed.js\";\nimport noop from \"../noop.js\";\nimport {point} from \"./catmullRom.js\";\n\nfunction CatmullRomClosed(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n","import {CardinalOpen} from \"./cardinalOpen.js\";\nimport {point} from \"./catmullRom.js\";\n\nfunction CatmullRomOpen(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // proceed\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n","import noop from \"../noop.js\";\n\nfunction LinearClosed(context) {\n this._context = context;\n}\n\nLinearClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x, y) {\n x = +x, y = +y;\n if (this._point) this._context.lineTo(x, y);\n else this._point = 1, this._context.moveTo(x, y);\n }\n};\n\nexport default function(context) {\n return new LinearClosed(context);\n}\n","function sign(x) {\n return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(that, x2, y2) {\n var h0 = that._x1 - that._x0,\n h1 = x2 - that._x1,\n s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),\n s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),\n p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(that, t) {\n var h = that._x1 - that._x0;\n return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic Bézier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point(that, t0, t1) {\n var x0 = that._x0,\n y0 = that._y0,\n x1 = that._x1,\n y1 = that._y1,\n dx = (x1 - x0) / 3;\n that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);\n}\n\nfunction MonotoneX(context) {\n this._context = context;\n}\n\nMonotoneX.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 =\n this._t0 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x1, this._y1); break;\n case 3: point(this, this._t0, slope2(this, this._t0)); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n var t1 = NaN;\n\n x = +x, y = +y;\n if (x === this._x1 && y === this._y1) return; // Ignore coincident points.\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;\n default: point(this, this._t0, t1 = slope3(this, x, y)); break;\n }\n\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n this._t0 = t1;\n }\n}\n\nfunction MonotoneY(context) {\n this._context = new ReflectContext(context);\n}\n\n(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {\n MonotoneX.prototype.point.call(this, y, x);\n};\n\nfunction ReflectContext(context) {\n this._context = context;\n}\n\nReflectContext.prototype = {\n moveTo: function(x, y) { this._context.moveTo(y, x); },\n closePath: function() { this._context.closePath(); },\n lineTo: function(x, y) { this._context.lineTo(y, x); },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }\n};\n\nexport function monotoneX(context) {\n return new MonotoneX(context);\n}\n\nexport function monotoneY(context) {\n return new MonotoneY(context);\n}\n","function Natural(context) {\n this._context = context;\n}\n\nNatural.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = [];\n this._y = [];\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n n = x.length;\n\n if (n) {\n this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);\n if (n === 2) {\n this._context.lineTo(x[1], y[1]);\n } else {\n var px = controlPoints(x),\n py = controlPoints(y);\n for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {\n this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);\n }\n }\n }\n\n if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();\n this._line = 1 - this._line;\n this._x = this._y = null;\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\n// See https://www.particleincell.com/2012/bezier-splines/ for derivation.\nfunction controlPoints(x) {\n var i,\n n = x.length - 1,\n m,\n a = new Array(n),\n b = new Array(n),\n r = new Array(n);\n a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];\n for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];\n a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];\n for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];\n a[n - 1] = r[n - 1] / b[n - 1];\n for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];\n b[n - 1] = (x[n] + a[n - 1]) / 2;\n for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];\n return [a, b];\n}\n\nexport default function(context) {\n return new Natural(context);\n}\n","function Step(context, t) {\n this._context = context;\n this._t = t;\n}\n\nStep.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = this._y = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // proceed\n default: {\n if (this._t <= 0) {\n this._context.lineTo(this._x, y);\n this._context.lineTo(x, y);\n } else {\n var x1 = this._x * (1 - this._t) + x * this._t;\n this._context.lineTo(x1, this._y);\n this._context.lineTo(x1, y);\n }\n break;\n }\n }\n this._x = x, this._y = y;\n }\n};\n\nexport default function(context) {\n return new Step(context, 0.5);\n}\n\nexport function stepBefore(context) {\n return new Step(context, 0);\n}\n\nexport function stepAfter(context) {\n return new Step(context, 1);\n}\n","export default function(series, order) {\n if (!((n = series.length) > 1)) return;\n for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) {\n s0 = s1, s1 = series[order[i]];\n for (j = 0; j < m; ++j) {\n s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1];\n }\n }\n}\n","export default function(series) {\n var n = series.length, o = new Array(n);\n while (--n >= 0) o[n] = n;\n return o;\n}\n","import {slice} from \"./array.js\";\nimport constant from \"./constant.js\";\nimport offsetNone from \"./offset/none.js\";\nimport orderNone from \"./order/none.js\";\n\nfunction stackValue(d, key) {\n return d[key];\n}\n\nexport default function() {\n var keys = constant([]),\n order = orderNone,\n offset = offsetNone,\n value = stackValue;\n\n function stack(data) {\n var kz = keys.apply(this, arguments),\n i,\n m = data.length,\n n = kz.length,\n sz = new Array(n),\n oz;\n\n for (i = 0; i < n; ++i) {\n for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) {\n si[j] = sij = [0, +value(data[j], ki, j, data)];\n sij.data = data[j];\n }\n si.key = ki;\n }\n\n for (i = 0, oz = order(sz); i < n; ++i) {\n sz[oz[i]].index = i;\n }\n\n offset(sz, oz);\n return sz;\n }\n\n stack.keys = function(_) {\n return arguments.length ? (keys = typeof _ === \"function\" ? _ : constant(slice.call(_)), stack) : keys;\n };\n\n stack.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), stack) : value;\n };\n\n stack.order = function(_) {\n return arguments.length ? (order = _ == null ? orderNone : typeof _ === \"function\" ? _ : constant(slice.call(_)), stack) : order;\n };\n\n stack.offset = function(_) {\n return arguments.length ? (offset = _ == null ? offsetNone : _, stack) : offset;\n };\n\n return stack;\n}\n","import none from \"./none.js\";\n\nexport default function(series) {\n var peaks = series.map(peak);\n return none(series).sort(function(a, b) { return peaks[a] - peaks[b]; });\n}\n\nfunction peak(series) {\n var i = -1, j = 0, n = series.length, vi, vj = -Infinity;\n while (++i < n) if ((vi = +series[i][1]) > vj) vj = vi, j = i;\n return j;\n}\n","import none from \"./none.js\";\n\nexport default function(series) {\n var sums = series.map(sum);\n return none(series).sort(function(a, b) { return sums[a] - sums[b]; });\n}\n\nexport function sum(series) {\n var s = 0, i = -1, n = series.length, v;\n while (++i < n) if (v = +series[i][1]) s += v;\n return s;\n}\n","import constant from \"./constant.js\";\nimport descending from \"./descending.js\";\nimport identity from \"./identity.js\";\nimport {tau} from \"./math.js\";\n\nexport default function() {\n var value = identity,\n sortValues = descending,\n sort = null,\n startAngle = constant(0),\n endAngle = constant(tau),\n padAngle = constant(0);\n\n function pie(data) {\n var i,\n n = data.length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : padAngle;\n };\n\n return pie;\n}\n","export default function(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) {\n for (yp = yn = 0, i = 0; i < n; ++i) {\n if ((dy = (d = series[order[i]][j])[1] - d[0]) > 0) {\n d[0] = yp, d[1] = yp += dy;\n } else if (dy < 0) {\n d[1] = yn, d[0] = yn += dy;\n } else {\n d[0] = 0, d[1] = dy;\n }\n }\n }\n}\n","import none from \"./none.js\";\n\nexport default function(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) {\n for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0;\n if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y;\n }\n none(series, order);\n}\n","import none from \"./none.js\";\n\nexport default function(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) {\n for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0;\n s0[j][1] += s0[j][0] = -y / 2;\n }\n none(series, order);\n}\n","import none from \"./none.js\";\n\nexport default function(series, order) {\n if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return;\n for (var y = 0, j = 1, s0, m, n; j < m; ++j) {\n for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) {\n var si = series[order[i]],\n sij0 = si[j][1] || 0,\n sij1 = si[j - 1][1] || 0,\n s3 = (sij0 - sij1) / 2;\n for (var k = 0; k < i; ++k) {\n var sk = series[order[k]],\n skj0 = sk[j][1] || 0,\n skj1 = sk[j - 1][1] || 0;\n s3 += skj0 - skj1;\n }\n s1 += sij0, s2 += s3 * sij0;\n }\n s0[j - 1][1] += s0[j - 1][0] = y;\n if (s1) y -= s2 / s1;\n }\n s0[j - 1][1] += s0[j - 1][0] = y;\n none(series, order);\n}\n","import ascending from \"./ascending.js\";\n\nexport default function(series) {\n return ascending(series).reverse();\n}\n","import appearance from \"./appearance.js\";\nimport {sum} from \"./ascending.js\";\n\nexport default function(series) {\n var n = series.length,\n i,\n j,\n sums = series.map(sum),\n order = appearance(series),\n top = 0,\n bottom = 0,\n tops = [],\n bottoms = [];\n\n for (i = 0; i < n; ++i) {\n j = order[i];\n if (top < bottom) {\n top += sums[j];\n tops.push(j);\n } else {\n bottom += sums[j];\n bottoms.push(j);\n }\n }\n\n return bottoms.reverse().concat(tops);\n}\n","import none from \"./none.js\";\n\nexport default function(series) {\n return none(series).reverse();\n}\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar line = require( 'd3-shape' ).line; // TODO: remove\n\n\n// MAIN //\n\n/**\n* Returns a function to generate a line as an SVG path.\n*\n* @private\n* @returns {Function} function to generate a line as an SVG path\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this, stdlib/empty-line-before-comment */\n\tvar f = line()\n\t\t.x( this.xPos )\n\t\t.y( this.yPos )\n\t\t.defined( this.isDefined );\n\t\t// TODO: interpolate (curve factory)\n\t\t// TODO: tension\n\n\treturn f;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:xpos' );\n\n\n// MAIN //\n\n/**\n* Returns a function to map values to x coordinate values.\n*\n* @private\n* @returns {Function} map function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar scale = this.xScale;\n\treturn xPos;\n\n\t/**\n\t* Maps a value to a x coordinate value.\n\t*\n\t* @private\n\t* @param {Array} d - datum\n\t* @returns {number} pixel value\n\t*/\n\tfunction xPos( d ) {\n\t\tvar px = scale( d[0] );\n\t\tdebug( 'Value: %d => Pixel: %d.', d[0], px );\n\t\treturn px;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:ypos' );\n\n\n// MAIN //\n\n/**\n* Returns a function to map values to y coordinate values.\n*\n* @private\n* @returns {Function} map function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar scale = this.yScale;\n\treturn yPos;\n\n\t/**\n\t* Maps a value to a y coordinate value.\n\t*\n\t* @private\n\t* @param {Array} d - datum\n\t* @returns {number} pixel value\n\t*/\n\tfunction yPos( d ) {\n\t\tvar px = scale( d[1] );\n\t\tdebug( 'Value: %d => Pixel: %d.', d[1], px );\n\t\treturn px;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Zips two arrays.\n*\n* @private\n* @param {ArrayLike} x - x-values\n* @param {ArrayLike} y - y-values\n* @throws {Error} must provide equal length array-like objects\n* @returns {Array} zipped array\n*/\nfunction zip( x, y ) {\n\tvar out;\n\tvar i;\n\tif ( x.length !== y.length ) {\n\t\tthrow new Error( format( 'invalid arguments. Must provide equal length array-like objects. x length: `%u`. y length: `%u`.', x.length, y.length ) );\n\t}\n\tout = new Array( x.length );\n\tfor ( i = 0; i < x.length; i++ ) {\n\t\tout[ i ] = [ x[i], y[i] ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default zip;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar STYLES = {\n\t// Solid path:\n\t'-': '',\n\n\t// Dashes:\n\t'--': '5, 1',\n\n\t// Dotted path:\n\t':': '0.9',\n\n\t// Dash-dotted path:\n\t'-.': '5, 1, 1, 1'\n};\n\n\n// MAIN //\n\n/**\n* Checks for a known style. If present, returns the [`stroke-dasharray`][1]. Otherwise, returns the provided input value.\n*\n* [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray\n*\n* @private\n* @param {string} v - style\n* @returns {string} stroke dasharray value\n*/\nfunction style( v ) {\n\tvar s = STYLES[ v ];\n\tif ( s ) {\n\t\treturn s;\n\t}\n\treturn v;\n}\n\n\n// EXPORTS //\n\nexport default style;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\nimport zip from './utils/zip.js';\nimport style from './utils/style.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:render' );\nvar ELEMENT = 'path';\n\n\n// MAIN //\n\n/**\n* Renders a virtual DOM tree.\n*\n* @private\n* @returns {VTree} virtual DOM tree\n*/\nfunction render() {\n\t/* eslint-disable no-invalid-this */\n\tvar props;\n\tvar vtree;\n\n\tdebug( 'Rendering...' );\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'property': 'line',\n\t\t'className': 'path line',\n\t\t'attributes': {\n\t\t\t'd': this.line( zip( this._xData, this._yData ) ),\n\t\t\t'fill': 'none',\n\t\t\t'stroke': this.color,\n\t\t\t'stroke-width': this.width,\n\t\t\t'stroke-opacity': this.opacity,\n\t\t\t'stroke-dasharray': style( this.style ),\n\t\t\t'data-label': this.label\n\t\t}\n\t};\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\tvtree = h( ELEMENT, props, [] );\n\n\t// Announce that a new tree has been rendered:\n\tthis.emit( '_render', vtree );\n\n\treturn vtree;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// TODO: improve JSDoc examples\n\n// MODULES //\n\nvar EventEmitter = require( 'events' ).EventEmitter;\nvar logger = require( 'debug' );\nvar linear = require( 'd3-scale' ).scaleLinear; // TODO: remove\nimport defineProperty from '@stdlib/utils/define-property';\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\nimport objectKeys from '@stdlib/utils/keys';\nimport format from '@stdlib/string/format';\nimport copy from '@stdlib/utils/copy';\nimport merge from '@stdlib/utils/merge';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport isDefined from './accessors/is_defined.js';\nimport defaults from './defaults.json';\nimport setX from './props/x/set.js';\nimport getX from './props/x/get.js';\nimport setY from './props/y/set.js';\nimport getY from './props/y/get.js';\nimport setXScale from './props/x-scale/set.js';\nimport getXScale from './props/x-scale/get.js';\nimport setYScale from './props/y-scale/set.js';\nimport getYScale from './props/y-scale/get.js';\nimport setIsDefined from './props/is-defined/set.js';\nimport getIsDefined from './props/is-defined/get.js';\nimport setColor from './props/color/set.js';\nimport getColor from './props/color/get.js';\nimport setLabel from './props/label/set.js';\nimport getLabel from './props/label/get.js';\nimport setOpacity from './props/opacity/set.js';\nimport getOpacity from './props/opacity/get.js';\nimport setWidth from './props/width/set.js';\nimport getWidth from './props/width/get.js';\nimport setStyle from './props/style/set.js';\nimport getStyle from './props/style/get.js';\nimport setAutoRender from './props/auto-render/set.js';\nimport getAutoRender from './props/auto-render/get.js';\nimport getLine from './props/line/get.js';\nimport getXPos from './props/x-pos/get.js';\nimport getYPos from './props/y-pos/get.js';\nimport render from './render';\n\n\n// VARIABLES //\n\nvar debug = logger( 'path:main' );\nvar PRIVATE_PROPS = [\n\t'_autoRender',\n\t'_color',\n\t'_isDefined',\n\t'_label',\n\t'_opacity',\n\t'_style',\n\t'_width',\n\t'_xData',\n\t'_xScale',\n\t'_yData',\n\t'_yScale'\n];\n\n\n// MAIN //\n\n/**\n* Path constructor.\n*\n* @constructor\n* @param {Options} [options] - constructor options\n* @param {ArrayLike} [options.x=[]] - x-values\n* @param {ArrayLike} [options.y=[]] - y-values\n* @param {Function} [options.xScale] - x scale function\n* @param {Function} [options.yScale] - y scale function\n* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined\n* @param {string} [options.color] - color\n* @param {string} [options.label] - label\n* @param {NonNegativeInteger} [options.width=2] - width\n* @param {number} [options.opacity=0.9] - opacity\n* @param {string} [options.style='-'] - style\n* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event\n* @throws {TypeError} must provide valid options\n* @returns {Path} Path instance\n*\n* @example\n* var path = new Path({\n* 'x': [0.1,0.2,0.3],\n* 'y': [0.4,0.5,0.6]\n* });\n*/\nfunction Path( options ) {\n\tvar self;\n\tvar keys;\n\tvar opts;\n\tvar key;\n\tvar i;\n\tif ( !( this instanceof Path ) ) {\n\t\tif ( arguments.length ) {\n\t\t\treturn new Path( options );\n\t\t}\n\t\treturn new Path();\n\t}\n\tself = this;\n\n\topts = copy( defaults );\n\topts.isDefined = isDefined;\n\topts.xScale = linear();\n\topts.yScale = linear();\n\n\tif ( arguments.length ) {\n\t\tif ( !isObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t\topts = merge( opts, options );\n\t}\n\tdebug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) );\n\tEventEmitter.call( this );\n\n\tfor ( i = 0; i < PRIVATE_PROPS.length; i++ ) {\n\t\tdefineProperty( this, PRIVATE_PROPS[i], {\n\t\t\t'configurable': false,\n\t\t\t'enumerable': false,\n\t\t\t'writable': true,\n\t\t\t'value': null\n\t\t});\n\t}\n\t// Set options...\n\tkeys = objectKeys( opts );\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tkey = keys[ i ];\n\t\tthis[ key ] = opts[ key ];\n\t}\n\n\tthis.on( 'change', onChange );\n\tthis.on( '_render', onRender );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a change event.\n\t*\n\t* @private\n\t*/\n\tfunction onChange() {\n\t\tdebug( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}\n\n\t/**\n\t* Re-emits a render event.\n\t*\n\t* @private\n\t*/\n\tfunction onRender() {\n\t\tvar args;\n\t\tvar i;\n\t\tdebug( 'Received a render event. Re-emitting...' );\n\t\targs = new Array( arguments.length+1 );\n\t\targs[ 0 ] = 'render';\n\t\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\t\targs[ i+1 ] = arguments[ i ];\n\t\t}\n\t\tself.emit.apply( self, args );\n\t}\n}\n\n/*\n* Create a prototype which inherits from the parent prototype.\n*/\nPath.prototype = Object.create( EventEmitter.prototype );\n\n/*\n* Set the constructor.\n*/\nPath.prototype.constructor = Path;\n\n/**\n* `x` values.\n*\n* @name x\n* @memberof Path.prototype\n* @type {ArrayLike}\n* @throws {TypeError} must be array-like\n* @default []\n*\n* @example\n* var path = new Path({\n* 'x': [0.1,0.2,0.3]\n* });\n*\n* var x = path.x;\n* // returns [0.1,0.2,0.3]\n*/\ndefineProperty( Path.prototype, 'x', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setX,\n\t'get': getX\n});\n\n/**\n* `y` values.\n*\n* @name y\n* @memberof Path.prototype\n* @type {ArrayLike}\n* @throws {TypeError} must be array-like\n* @default []\n*\n* @example\n* var path = new Path({\n* 'y': [0.4,0.5,0.6]\n* });\n*\n* var y = path.y;\n* // returns [0.4,0.5,0.6]\n*/\ndefineProperty( Path.prototype, 'y', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setY,\n\t'get': getY\n});\n\n/**\n* `x` scale function.\n*\n* @name xScale\n* @memberof Path.prototype\n* @type {Function}\n* @throws {TypeError} must be a function\n*\n* @example\n* var path = new Path({\n* 'xScale': function scale(){}\n* });\n*\n* var f = path.xScale;\n* // returns \n*/\ndefineProperty( Path.prototype, 'xScale', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setXScale,\n\t'get': getXScale\n});\n\n/**\n* `y` scale function.\n*\n* @name yScale\n* @memberof Path.prototype\n* @type {Function}\n* @throws {TypeError} must be a function\n*\n* @example\n* var path = new Path({\n* 'yScale': function scale(){}\n* });\n*\n* var f = path.yScale;\n* // returns \n*/\ndefineProperty( Path.prototype, 'yScale', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setYScale,\n\t'get': getYScale\n});\n\n/**\n* Accessor which defines whether a datum is defined. This accessor is used to define how missing values are encoded. The default behavior is to ignore values which are `NaN`.\n*\n* @name isDefined\n* @memberof Path.prototype\n* @type {Function}\n* @throws {TypeError} must be a function\n*\n* @example\n* var path = new Path();\n* path.isDefined = function isDefined( d ) {\n* // Check for `NaN`:\n* return ( d === d );\n* }\n*\n* @example\n* function isDefined( d ) {\n* // Check for `NaN`:\n* return ( d === d );\n* }\n* var path = new Path({\n* 'isDefined': isDefined\n* });\n* var fcn = path.isDefined;\n* // returns \n*/\ndefineProperty( Path.prototype, 'isDefined', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setIsDefined,\n\t'get': getIsDefined\n});\n\n/**\n* Path color.\n*\n* @name color\n* @memberof Path.prototype\n* @type {string}\n* @throws {TypeError} must be a string\n*\n* @example\n* var path = new Path({\n* 'color': 'steelblue'\n* });\n*\n* var color = path.color;\n* // returns 'steelblue'\n*/\ndefineProperty( Path.prototype, 'color', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setColor,\n\t'get': getColor\n});\n\n/**\n* Path label.\n*\n* @name label\n* @memberof Path.prototype\n* @type {string}\n* @throws {TypeError} must be a string\n*\n* @example\n* var path = new Path({\n* 'label': 'line-1'\n* });\n*\n* var label = path.label;\n* // returns 'line-1'\n*/\ndefineProperty( Path.prototype, 'label', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setLabel,\n\t'get': getLabel\n});\n\n/**\n* Path opacity.\n*\n* @name opacity\n* @memberof Path.prototype\n* @type {number}\n* @throws {TypeError} must be a number\n* @throws {RangeError} must be a number on the interval `[0,1]`\n* @default 0.9\n*\n* @example\n* var path = new Path({\n* 'opacity': 0.5\n* });\n*\n* var opacity = path.opacity;\n* // returns 0.5\n*/\ndefineProperty( Path.prototype, 'opacity', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setOpacity,\n\t'get': getOpacity\n});\n\n/**\n* Path width.\n*\n* @name width\n* @memberof Path.prototype\n* @type {NonNegativeInteger}\n* @throws {TypeError} must be a nonnegative integer\n* @default 2\n*\n* @example\n* var path = new Path({\n* 'width': 1\n* });\n*\n* var width = path.width;\n* // returns 1\n*/\ndefineProperty( Path.prototype, 'width', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setWidth,\n\t'get': getWidth\n});\n\n/**\n* Path style.\n*\n* @name style\n* @memberof Path.prototype\n* @type {string}\n* @throws {TypeError} must be a string\n* @default '-'\n*\n* @example\n* var path = new Path({\n* 'style': '-.'\n* });\n*\n* var style = path.style;\n* // returns '-.'\n*/\ndefineProperty( Path.prototype, 'style', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setStyle,\n\t'get': getStyle\n});\n\n/**\n* Rendering mode. If `true`, an instance re-renders on each change event.\n*\n* @name autoRender\n* @memberof Path.prototype\n* @type {boolean}\n* @throws {TypeError} must be a boolean\n* @default false\n*\n* @example\n* var path = new Path({\n* 'autoRender': true\n* });\n*\n* var mode = path.autoRender;\n* // returns true\n*/\ndefineProperty( Path.prototype, 'autoRender', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setAutoRender,\n\t'get': getAutoRender\n});\n\n/**\n* Returns a function to generate a line as an SVG path.\n*\n* @name line\n* @memberof Path.prototype\n* @type {Function}\n*\n* @example\n* var path = new Path();\n*\n* var line = path.line;\n* // returns \n*/\ndefineProperty( Path.prototype, 'line', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getLine\n});\n\n/**\n* Function to map values to x coordinate values.\n*\n* @name xPos\n* @memberof Path.prototype\n* @type {Function}\n*\n* @example\n* var path = new Path();\n* var xPos = path.xPos;\n* // returns \n*/\ndefineProperty( Path.prototype, 'xPos', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getXPos\n});\n\n/**\n* Function to map values to y coordinate values.\n*\n* @name yPos\n* @memberof Path.prototype\n* @type {Function}\n*\n* @example\n* var path = new Path();\n* var yPos = path.yPos;\n* // returns \n*/\ndefineProperty( Path.prototype, 'yPos', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getYPos\n});\n\n/**\n* Renders a virtual DOM tree.\n*\n* @name render\n* @memberof Path.prototype\n* @type {Function}\n* @returns {VTree} virtual tree\n*\n* @example\n* var path = new Path();\n*\n* var out = path.render();\n*/\nsetReadOnly( Path.prototype, 'render', render );\n\n\n// EXPORTS //\n\nexport default Path;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the `x` values.\n*\n* @private\n* @returns {ArrayLike} x values\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._xData;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the `y` values.\n*\n* @private\n* @returns {ArrayLike} y values\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._yData;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the x-scale function.\n*\n* @private\n* @returns {Function} scale function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._xScale;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the y-scale function.\n*\n* @private\n* @returns {Function} scale function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._yScale;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the accessor for defined values.\n*\n* @private\n* @returns {Function} accessor\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._isDefined;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the path color.\n*\n* @private\n* @returns {string} color\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._color;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the path label.\n*\n* @private\n* @returns {string} label\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._label;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the opacity.\n*\n* @private\n* @returns {number} opacity\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._opacity;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the width.\n*\n* @private\n* @returns {NonNegativeInteger} width\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._width;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the path style.\n*\n* @private\n* @returns {string} style\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._style;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the rendering mode.\n*\n* @private\n* @returns {boolean} rendering mode\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._autoRender;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isnan } from '@stdlib/assert/is-nan';\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:accessor:is-defined' );\n\n\n// MAIN //\n\n/**\n* Accessor function which determines whether a datum is defined.\n*\n* @private\n* @param {number} d - datum\n* @returns {boolean} boolean indicating whether a datum is defined\n*/\nfunction isDefined( d ) {\n\tvar bool = !isnan( d );\n\tdebug( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool );\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default isDefined;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport indexOf from '@stdlib/utils/index-of';\nimport format from '@stdlib/string/format';\nimport SYMBOLS from './symbols.json';\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:set:symbol' );\n\n\n// MAIN //\n\n/**\n* Sets the symbol.\n*\n* @private\n* @param {string} symbol - symbol\n* @throws {TypeError} must be a supported symbol\n*/\nfunction set( symbol ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( indexOf( SYMBOLS, symbol ) === -1 ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a supported symbol. Symbols: \"%s\". Value: `%s`.', 'symbol', SYMBOLS.join( '\", \"' ), symbol ) );\n\t}\n\tdebug( 'Current value: %d.', this._symbol );\n\n\tthis._symbol = symbol;\n\tdebug( 'New Value: %d.', this._symbol );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isArrayLike from '@stdlib/assert/is-array-like';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:set:x' );\n\n\n// MAIN //\n\n/**\n* Sets the `x` values.\n*\n* @private\n* @param {ArrayLike} x - x values\n* @throws {TypeError} must be array-like\n*/\nfunction set( x ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isArrayLike( x ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'x', x ) );\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._xData ) );\n\n\tthis._xData = x;\n\tdebug( 'New Value: %s.', JSON.stringify( this._xData ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isArrayLike from '@stdlib/assert/is-array-like';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:set:y' );\n\n\n// MAIN //\n\n/**\n* Sets the `y` values.\n*\n* @private\n* @param {ArrayLike} y - y values\n* @throws {TypeError} must be array-like\n*/\nfunction set( y ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isArrayLike( y ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'y', y ) );\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._yData ) );\n\n\tthis._yData = y;\n\tdebug( 'New Value: %s.', JSON.stringify( this._yData ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:set:xscale' );\n\n\n// MAIN //\n\n/**\n* Sets the x-scale function.\n*\n* @private\n* @param {Function} fcn - scale\n* @throws {TypeError} must be a function\n*/\nfunction set( fcn ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'xScale', fcn ) );\n\t}\n\tdebug( 'Current value: %s.', this._xScale );\n\n\tthis._xScale = fcn;\n\tdebug( 'New Value: %s.', this._xScale );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:set:yscale' );\n\n\n// MAIN //\n\n/**\n* Sets the y-scale function.\n*\n* @private\n* @param {Function} fcn - scale\n* @throws {TypeError} must be a function\n*/\nfunction set( fcn ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'yScale', fcn ) );\n\t}\n\tdebug( 'Current value: %s.', this._yScale );\n\n\tthis._yScale = fcn;\n\tdebug( 'New Value: %s.', this._yScale );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:set:is-defined' );\n\n\n// MAIN //\n\n/**\n* Sets the accessor for defined values.\n*\n* @private\n* @param {Function} fcn - accessor\n* @throws {TypeError} must be a function\n*/\nfunction set( fcn ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'isDefined', fcn ) );\n\t}\n\tdebug( 'Current value: %s.', this._isDefined );\n\n\tthis._isDefined = fcn;\n\tdebug( 'New Value: %s.', this._isDefined );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:set:size' );\n\n\n// MAIN //\n\n/**\n* Sets the symbol size.\n*\n* @private\n* @param {(NonNegativeInteger|Function)} size - size\n* @throws {TypeError} must be a nonnegative integer or a function\n*/\nfunction set( size ) {\n\t/* eslint-disable no-invalid-this */\n\tif (\n\t\t!isNonNegativeInteger( size ) &&\n\t\t!isFunction( size )\n\t) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer or a function. Value: `%s`.', 'size', size ) );\n\t}\n\tdebug( 'Current value: %d.', this._size );\n\n\tthis._size = size;\n\tdebug( 'New Value: %d.', this._size );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:set:opacity' );\n\n\n// MAIN //\n\n/**\n* Sets the symbol opacity.\n*\n* @private\n* @param {(number|Function)} opacity - opacity\n* @throws {TypeError} must be a number or a function\n* @throws {RangeError} must be a number on the interval `[0,1]`\n*/\nfunction set( opacity ) {\n\t/* eslint-disable no-invalid-this */\n\tvar isNum = isNumber( opacity );\n\tif (\n\t\t!isNum &&\n\t\t!isFunction( opacity )\n\t) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a number or a function. Value: `%s`.', 'opacity', opacity ) );\n\t}\n\tif (\n\t\tisNum &&\n\t\t(opacity < 0.0 || opacity > 1.0)\n\t) {\n\t\tthrow new RangeError( format( 'invalid assignment. `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'opacity', opacity ) );\n\t}\n\tdebug( 'Current value: %d.', this._opacity );\n\n\tthis._opacity = opacity;\n\tdebug( 'New Value: %d.', this._opacity );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:set:color' );\n\n\n// MAIN //\n\n/**\n* Sets the color.\n*\n* @private\n* @param {(string|Function)} color - color\n* @throws {TypeError} must be a string or function\n*/\nfunction set( color ) {\n\t/* eslint-disable no-invalid-this */\n\tif (\n\t\t!isString( color ) &&\n\t\t!isFunction( color )\n\t) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string or a function. Value: `%s`.', 'color', color ) );\n\t}\n\tdebug( 'Current value: %d.', this._color );\n\n\tthis._color = color;\n\tdebug( 'New Value: %d.', this._color );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:set:label' );\n\n\n// MAIN //\n\n/**\n* Sets the label.\n*\n* @private\n* @param {(string|Function)} label - label\n* @throws {TypeError} must be a string or a function\n*/\nfunction set( label ) {\n\t/* eslint-disable no-invalid-this */\n\tif (\n\t\t!isString( label ) &&\n\t\t!isFunction( label )\n\t) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string or a function. Value: `%s`.', 'label', label ) );\n\t}\n\tdebug( 'Current value: %d.', this._label );\n\n\tthis._label = label;\n\tdebug( 'New Value: %d.', this._label );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:set:auto-render' );\n\n\n// MAIN //\n\n/**\n* Sets the rendering mode.\n*\n* @private\n* @param {boolean} bool - boolean indicating whether to re-render on a change event\n* @throws {TypeError} must be a boolean\n*/\nfunction set( bool ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isBoolean( bool ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) );\n\t}\n\tdebug( 'Current value: %d.', this._autoRender );\n\n\tthis._autoRender = bool;\n\tdebug( 'New Value: %d.', this._autoRender );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:xpos' );\n\n\n// MAIN //\n\n/**\n* Returns a function to map values to x coordinate values.\n*\n* @private\n* @returns {Function} map function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar scale = this.xScale;\n\n\treturn xPos;\n\t/**\n\t* Maps a value to a x coordinate value.\n\t*\n\t* @private\n\t* @param {*} d - datum\n\t* @returns {number} pixel value\n\t*/\n\tfunction xPos( d ) {\n\t\tvar px = scale( d );\n\t\tdebug( 'Value: %d => Pixel: %d.', d, px );\n\t\treturn px;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:ypos' );\n\n\n// MAIN //\n\n/**\n* Returns a function to map values to y coordinate values.\n*\n* @private\n* @returns {Function} map function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar scale = this.yScale;\n\treturn yPos;\n\n\t/**\n\t* Maps a value to a y coordinate value.\n\t*\n\t* @private\n\t* @param {*} d - datum\n\t* @returns {number} pixel value\n\t*/\n\tfunction yPos( d ) {\n\t\tvar px = scale( d );\n\t\tdebug( 'Value: %d => Pixel: %d.', d, px );\n\t\treturn px;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:render:closed-circles' );\nvar ELEMENT = 'circle';\n\n\n// MAIN //\n\n/**\n* Renders data as a closed circles.\n*\n* @private\n* @param {Object} state - state\n* @returns {Array} array of virtual trees\n*/\nfunction render( state ) {\n\tvar isDefined;\n\tvar opacity;\n\tvar label;\n\tvar color;\n\tvar props;\n\tvar size;\n\tvar xPos;\n\tvar yPos;\n\tvar out;\n\tvar xi;\n\tvar yi;\n\tvar x;\n\tvar y;\n\tvar i;\n\n\tdebug( 'Rendering closed circles...' );\n\n\tisDefined = state.isDefined;\n\topacity = state.opacity;\n\tlabel = state.label;\n\tcolor = state.color;\n\tsize = state.size;\n\txPos = state.xPos;\n\tyPos = state.yPos;\n\tx = state.x;\n\ty = state.y;\n\n\tout = [];\n\tfor ( i = 0; i < x.length; i++ ) {\n\t\txi = x[ i ];\n\t\tyi = y[ i ];\n\t\tif ( !isDefined( xi ) || !isDefined( yi ) ) {\n\t\t\tdebug( 'Datum %d is undefined. [%s,%s].', i, xi, yi );\n\t\t\tcontinue;\n\t\t}\n\t\tdebug( 'Rendering datum %d...', i );\n\t\tprops = {\n\t\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t\t'property': 'closed-circle',\n\t\t\t'className': 'closed-circle',\n\t\t\t'attributes': {\n\t\t\t\t'cx': xPos( xi ),\n\t\t\t\t'cy': yPos( yi ),\n\t\t\t\t'r': size( xi, yi, i ) / 2,\n\t\t\t\t'stroke': 'none',\n\t\t\t\t'opacity': opacity( xi, yi, i ),\n\t\t\t\t'fill': color( xi, yi, i ),\n\t\t\t\t'data-label': label( xi, yi, i )\n\t\t\t}\n\t\t};\n\t\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\t\tout.push( h( ELEMENT, props, [] ) );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:render:open-circles' );\nvar ELEMENT = 'circle';\n\n\n// MAIN //\n\n/**\n* Renders data as a open circles.\n*\n* @private\n* @param {Object} state - state\n* @returns {Array} array of virtual trees\n*/\nfunction render( state ) {\n\tvar isDefined;\n\tvar opacity;\n\tvar label;\n\tvar color;\n\tvar props;\n\tvar size;\n\tvar xPos;\n\tvar yPos;\n\tvar out;\n\tvar xi;\n\tvar yi;\n\tvar x;\n\tvar y;\n\tvar i;\n\n\tdebug( 'Rendering open circles...' );\n\n\tisDefined = state.isDefined;\n\topacity = state.opacity;\n\tlabel = state.label;\n\tcolor = state.color;\n\tsize = state.size;\n\txPos = state.xPos;\n\tyPos = state.yPos;\n\tx = state.x;\n\ty = state.y;\n\n\tout = new Array( x.length );\n\tfor ( i = 0; i < x.length; i++ ) {\n\t\txi = x[ i ];\n\t\tyi = y[ i ];\n\t\tif ( !isDefined( xi ) || !isDefined( yi ) ) {\n\t\t\tdebug( 'Datum %d is undefined. [%s,%s].', i, xi, yi );\n\t\t\tcontinue;\n\t\t}\n\t\tdebug( 'Rendering datum %d...', i );\n\t\tprops = {\n\t\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t\t'property': 'open-circle',\n\t\t\t'className': 'open-circle',\n\t\t\t'attributes': {\n\t\t\t\t'cx': xPos( xi ),\n\t\t\t\t'cy': yPos( yi ),\n\t\t\t\t'r': size( xi, yi, i ) / 2,\n\t\t\t\t'fill': 'none',\n\t\t\t\t'opacity': opacity( xi, yi, i ),\n\t\t\t\t'stroke': color( xi, yi, i ),\n\t\t\t\t'stroke-width': 1, // TODO: make property? I certainly don't see a good reason or use case why this should be a function.\n\t\t\t\t'data-label': label( xi, yi, i )\n\t\t\t}\n\t\t};\n\t\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\t\tout[ i ] = h( ELEMENT, props, [] );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\nimport closedCircles from './closed_circles.js';\nimport openCircles from './open_circles.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:render' );\nvar ELEMENT = 'g';\nvar RENDER = {\n\t'closed-circle': closedCircles,\n\t'open-circle': openCircles\n};\n\n\n// MAIN //\n\n/**\n* Renders a virtual DOM tree.\n*\n* @private\n* @returns {VTree} virtual DOM tree\n*/\nfunction render() {\n\t/* eslint-disable no-invalid-this */\n\tvar children;\n\tvar props;\n\tvar vtree;\n\tvar f;\n\n\tdebug( 'Rendering...' );\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'property': 'symbols',\n\t\t'className': 'symbols'\n\t};\n\tdebug( 'Symbol: %s.', this.symbol );\n\n\tf = RENDER[ this.symbol ];\n\tchildren = f( this );\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\tvtree = h( ELEMENT, props, children );\n\n\t// Announce that a new tree has been rendered:\n\tthis.emit( '_render', vtree );\n\n\treturn vtree;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// TODO: improve JSDoc examples\n\n// MODULES //\n\nvar EventEmitter = require( 'events' ).EventEmitter;\nvar logger = require( 'debug' );\nvar linear = require( 'd3-scale' ).scaleLinear; // TODO: remove\nimport defineProperty from '@stdlib/utils/define-property';\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\nimport objectKeys from '@stdlib/utils/keys';\nimport format from '@stdlib/string/format';\nimport copy from '@stdlib/utils/copy';\nimport merge from '@stdlib/utils/merge';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport isDefined from './accessors/is_defined.js';\nimport defaults from './defaults.json';\nimport setSymbol from './props/symbol/set.js';\nimport getSymbol from './props/symbol/get.js';\nimport setX from './props/x/set.js';\nimport getX from './props/x/get.js';\nimport setY from './props/y/set.js';\nimport getY from './props/y/get.js';\nimport setXScale from './props/x-scale/set.js';\nimport getXScale from './props/x-scale/get.js';\nimport setYScale from './props/y-scale/set.js';\nimport getYScale from './props/y-scale/get.js';\nimport setIsDefined from './props/is-defined/set.js';\nimport getIsDefined from './props/is-defined/get.js';\nimport setSize from './props/size/set.js';\nimport getSize from './props/size/get.js';\nimport setOpacity from './props/opacity/set.js';\nimport getOpacity from './props/opacity/get.js';\nimport setColor from './props/color/set.js';\nimport getColor from './props/color/get.js';\nimport setLabel from './props/label/set.js';\nimport getLabel from './props/label/get.js';\nimport setAutoRender from './props/auto-render/set.js';\nimport getAutoRender from './props/auto-render/get.js';\nimport getXPos from './props/x-pos/get.js';\nimport getYPos from './props/y-pos/get.js';\nimport render from './render';\n\n\n// VARIABLES //\n\nvar debug = logger( 'symbols:main' );\nvar PRIVATE_PROPS = [\n\t'_autoRender',\n\t'_color',\n\t'_isDefined',\n\t'_label',\n\t'_opacity',\n\t'_size',\n\t'_symbol',\n\t'_xData',\n\t'_xScale',\n\t'_yData',\n\t'_yScale'\n];\n\n\n// MAIN //\n\n/**\n* Symbols constructor.\n*\n* @constructor\n* @param {Options} options - constructor options\n* @param {ArrayLike} [options.x=[]] - x-values\n* @param {ArrayLike} [options.y=[]] - y-values\n* @param {Function} [options.xScale] - x scale function\n* @param {Function} [options.yScale] - y scale function\n* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined\n* @param {string} [options.symbol='closed-circle'] - symbol\n* @param {(number|Function)} [options.opacity=0.9] - opacity\n* @param {(string|Function)} [options.color] - color\n* @param {(string|Function)} [options.label] - label\n* @param {(NonNegativeInteger|Function)} [options.size=6] - symbol size\n* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event\n* @throws {TypeError} must provide valid options\n* @returns {Symbols} Symbols instance\n*\n* @example\n* var symbols = new Symbols({\n* 'x': [0.1,0.2,0.3],\n* 'y': [0.4,0.5,0.6]\n* });\n*/\nfunction Symbols( options ) {\n\tvar self;\n\tvar keys;\n\tvar opts;\n\tvar key;\n\tvar i;\n\tif ( !( this instanceof Symbols ) ) {\n\t\tif ( arguments.length ) {\n\t\t\treturn new Symbols( options );\n\t\t}\n\t\treturn new Symbols();\n\t}\n\tself = this;\n\n\topts = copy( defaults );\n\topts.isDefined = isDefined;\n\topts.xScale = linear();\n\topts.yScale = linear();\n\n\tif ( arguments.length ) {\n\t\tif ( !isObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t\topts = merge( opts, options );\n\t}\n\tdebug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) );\n\tEventEmitter.call( this );\n\n\tfor ( i = 0; i < PRIVATE_PROPS.length; i++ ) {\n\t\tdefineProperty( this, PRIVATE_PROPS[i], {\n\t\t\t'configurable': false,\n\t\t\t'enumerable': false,\n\t\t\t'writable': true,\n\t\t\t'value': null\n\t\t});\n\t}\n\t// Set options...\n\tkeys = objectKeys( opts );\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tkey = keys[ i ];\n\t\tthis[ key ] = opts[ key ];\n\t}\n\n\tthis.on( 'change', onChange );\n\tthis.on( '_render', onRender );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a change event.\n\t*\n\t* @private\n\t*/\n\tfunction onChange() {\n\t\tdebug( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}\n\n\t/**\n\t* Re-emits a render event.\n\t*\n\t* @private\n\t*/\n\tfunction onRender() {\n\t\tvar args;\n\t\tvar i;\n\t\tdebug( 'Received a render event. Re-emitting...' );\n\t\targs = new Array( arguments.length+1 );\n\t\targs[ 0 ] = 'render';\n\t\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\t\targs[ i+1 ] = arguments[ i ];\n\t\t}\n\t\tself.emit.apply( self, args );\n\t}\n}\n\n/*\n* Create a prototype which inherits from the parent prototype.\n*/\nSymbols.prototype = Object.create( EventEmitter.prototype );\n\n/*\n* Set the constructor.\n*/\nSymbols.prototype.constructor = Symbols;\n\n/**\n* Symbol.\n*\n* @name symbol\n* @memberof Symbols.prototype\n* @type {string}\n* @throws {TypeError} must be a supported symbol\n* @default 'closed-circle'\n*\n* @example\n* var symbols = new Symbols({\n* 'symbol': 'open-circle'\n* });\n*\n* var symbol = symbols.symbol;\n* // returns 'open-circle'\n*/\ndefineProperty( Symbols.prototype, 'symbol', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setSymbol,\n\t'get': getSymbol\n});\n\n/**\n* `x` values.\n*\n* @name x\n* @memberof Symbols.prototype\n* @type {ArrayLike}\n* @throws {TypeError} must be array-like\n* @default []\n*\n* @example\n* var symbols = new Symbols({\n* 'x': [0.1,0.2,0.3]\n* });\n*\n* var x = symbols.x;\n* // returns [0.1,0.2,0.3]\n*/\ndefineProperty( Symbols.prototype, 'x', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setX,\n\t'get': getX\n});\n\n/**\n* `y` values.\n*\n* @name y\n* @memberof Symbols.prototype\n* @type {ArrayLike}\n* @throws {TypeError} must be array-like\n* @default []\n*\n* @example\n* var symbols = new Symbols({\n* 'y': [0.4,0.5,0.6]\n* });\n*\n* var y = symbols.y;\n* // returns [0.4,0.5,0.6]\n*/\ndefineProperty( Symbols.prototype, 'y', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setY,\n\t'get': getY\n});\n\n/**\n* `x` scale function.\n*\n* @name xScale\n* @memberof Symbols.prototype\n* @type {Function}\n* @throws {TypeError} must be a function\n*\n* @example\n* var symbols = new Symbols({\n* 'xScale': function scale(){}\n* });\n*\n* var f = symbols.xScale;\n* // returns \n*/\ndefineProperty( Symbols.prototype, 'xScale', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setXScale,\n\t'get': getXScale\n});\n\n/**\n* `y` scale function.\n*\n* @name yScale\n* @memberof Symbols.prototype\n* @type {Function}\n* @throws {TypeError} must be a function\n*\n* @example\n* var symbols = new Symbols({\n* 'yScale': function scale(){}\n* });\n*\n* var f = symbols.yScale;\n* // returns \n*/\ndefineProperty( Symbols.prototype, 'yScale', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setYScale,\n\t'get': getYScale\n});\n\n/**\n* Accessor which defines whether a datum is defined. This accessor is used to define how missing values are encoded. The default behavior is to ignore values which are `NaN`.\n*\n* @name isDefined\n* @memberof Symbols.prototype\n* @type {Function}\n* @throws {TypeError} must be a function\n*\n* @example\n* var symbols = new Symbols();\n* symbols.isDefined = function isDefined( d ) {\n* // Check for `NaN`:\n* return ( d === d );\n* }\n*\n* @example\n* function isDefined( d ) {\n* // Check for `NaN`:\n* return ( d === d );\n* }\n* var symbols = new Symbols({\n* 'isDefined': isDefined\n* });\n* var fcn = symbols.isDefined;\n* // returns \n*/\ndefineProperty( Symbols.prototype, 'isDefined', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setIsDefined,\n\t'get': getIsDefined\n});\n\n/**\n* Symbol size. When retrieved, the returned value is a size accessor.\n*\n* @name size\n* @memberof Symbols.prototype\n* @type {(NonNegativeInteger|Function)}\n* @throws {TypeError} must be a nonnegative integer or function\n* @default 6\n*\n* @example\n* var symbols = new Symbols({\n* 'size': 5\n* });\n*\n* var size = symbols.size;\n* // returns \n*/\ndefineProperty( Symbols.prototype, 'size', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setSize,\n\t'get': getSize\n});\n\n/**\n* Symbol opacity. When retrieved, the returned value is an opacity accessor.\n*\n* @name opacity\n* @memberof Symbols.prototype\n* @type {(number|Function)}\n* @throws {TypeError} must be a number or function\n* @throws {RangeError} must be a number on the interval `[0,1]`\n* @default 0.9\n*\n* @example\n* var symbols = new Symbols({\n* 'opacity': 0.5\n* });\n*\n* var opacity = symbols.opacity;\n* // returns \n*/\ndefineProperty( Symbols.prototype, 'opacity', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setOpacity,\n\t'get': getOpacity\n});\n\n/**\n* Symbols color. When retrieved, the returned value is a color accessor.\n*\n* @name color\n* @memberof Symbols.prototype\n* @type {(string|Function)}\n* @throws {TypeError} must be a string or function\n*\n* @example\n* var symbols = new Symbols({\n* 'color': 'steelblue'\n* });\n*\n* var color = symbols.color;\n* // returns \n*/\ndefineProperty( Symbols.prototype, 'color', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setColor,\n\t'get': getColor\n});\n\n/**\n* Symbols label. When retrieved, the returned value is a label accessor.\n*\n* @name label\n* @memberof Symbols.prototype\n* @type {(string|Function)}\n* @throws {TypeError} must be a string or function\n*\n* @example\n* var symbols = new Symbols({\n* 'label': 'group-1'\n* });\n*\n* var label = symbols.label;\n* // returns \n*/\ndefineProperty( Symbols.prototype, 'label', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setLabel,\n\t'get': getLabel\n});\n\n/**\n* Rendering mode. If `true`, an instance re-renders on each change event.\n*\n* @name autoRender\n* @memberof Symbols.prototype\n* @type {boolean}\n* @throws {TypeError} must be a boolean\n* @default false\n*\n* @example\n* var symbols = new Symbols({\n* 'autoRender': true\n* });\n*\n* var mode = symbols.autoRender;\n* // returns true\n*/\ndefineProperty( Symbols.prototype, 'autoRender', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setAutoRender,\n\t'get': getAutoRender\n});\n\n/**\n* Function to map values to x coordinate values.\n*\n* @name xPos\n* @memberof Symbols.prototype\n* @type {Function}\n*\n* @example\n* var symbols = new Symbols();\n* var xPos = symbols.xPos;\n* // returns \n*/\ndefineProperty( Symbols.prototype, 'xPos', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getXPos\n});\n\n/**\n* Function to map values to y coordinate values.\n*\n* @name yPos\n* @memberof Symbols.prototype\n* @type {Function}\n*\n* @example\n* var symbols = new Symbols();\n* var yPos = symbols.yPos;\n* // returns \n*/\ndefineProperty( Symbols.prototype, 'yPos', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getYPos\n});\n\n/**\n* Renders a virtual DOM tree.\n*\n* @name render\n* @memberof Symbols.prototype\n* @type {Function}\n* @returns {VTree} virtual tree\n*\n* @example\n* var symbols = new Symbols();\n*\n* var out = symbols.render();\n*/\nsetReadOnly( Symbols.prototype, 'render', render );\n\n\n// EXPORTS //\n\nexport default Symbols;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the symbol.\n*\n* @private\n* @returns {string} symbol\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._symbol;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the `x` values.\n*\n* @private\n* @returns {ArrayLike} x values\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._xData;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the `y` values.\n*\n* @private\n* @returns {ArrayLike} y values\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._yData;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the x-scale function.\n*\n* @private\n* @returns {Function} scale function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._xScale;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the y-scale function.\n*\n* @private\n* @returns {Function} scale function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._yScale;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the accessor for defined values.\n*\n* @private\n* @returns {Function} accessor\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._isDefined;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\n\n\n// MAIN //\n\n/**\n* Returns a function to get a symbol's size.\n*\n* @private\n* @returns {Function} size accessor\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar self = this;\n\tif ( isNumber( this._size ) ) {\n\t\treturn size;\n\t}\n\treturn this._size;\n\n\t/**\n\t* Returns the size.\n\t*\n\t* @private\n\t* @returns {number} size\n\t*/\n\tfunction size() {\n\t\treturn self._size; // eslint-disable-line no-underscore-dangle\n\t}\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\n\n\n// MAIN //\n\n/**\n* Returns a function to get a symbol's opacity.\n*\n* @private\n* @returns {Function} opacity accessor\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar self = this;\n\tif ( isNumber( this._opacity ) ) {\n\t\treturn opacity;\n\t}\n\treturn this._opacity;\n\n\t/**\n\t* Returns the opacity.\n\t*\n\t* @private\n\t* @returns {number} opacity\n\t*/\n\tfunction opacity() {\n\t\treturn self._opacity; // eslint-disable-line no-underscore-dangle\n\t}\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\n\n\n// MAIN //\n\n/**\n* Returns a function to get a symbol's color.\n*\n* @private\n* @returns {Function} color accessor\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar self = this;\n\tif ( isString( this._color ) ) {\n\t\treturn color;\n\t}\n\treturn this._color;\n\n\t/**\n\t* Returns the color.\n\t*\n\t* @private\n\t* @returns {string} color\n\t*/\n\tfunction color() {\n\t\treturn self._color; // eslint-disable-line no-underscore-dangle\n\t}\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\n\n\n// MAIN //\n\n/**\n* Returns a function to get a symbol's label.\n*\n* @private\n* @returns {Function} label accessor\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar self = this;\n\tif ( isString( this._label ) ) {\n\t\treturn label;\n\t}\n\treturn this._label;\n\n\t/**\n\t* Returns the label.\n\t*\n\t* @private\n\t* @returns {string} label\n\t*/\n\tfunction label() {\n\t\treturn self._label; // eslint-disable-line no-underscore-dangle\n\t}\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the rendering mode.\n*\n* @private\n* @returns {boolean} rendering mode\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._autoRender;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isnan } from '@stdlib/assert/is-nan';\n\n\n// VARIABLES //\n\nvar debug = logger( 'rug:accessor:is-defined' );\n\n\n// MAIN //\n\n/**\n* Predicate function which returns a boolean indicating whether a datum is defined.\n*\n* @private\n* @param {number} d - datum\n* @param {integer} i - index\n* @returns {boolean} boolean indicating whether a datum is defined\n*/\nfunction isDefined( d ) {\n\tvar bool = !isnan( d );\n\tdebug( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool );\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default isDefined;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'rug:set:auto-render' );\n\n\n// MAIN //\n\n/**\n* Sets the rendering mode.\n*\n* @private\n* @param {boolean} bool - boolean indicating whether to re-render on a change event\n* @throws {TypeError} must be a boolean\n*/\nfunction set( bool ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isBoolean( bool ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) );\n\t}\n\tif ( bool !== this._autoRender ) {\n\t\tdebug( 'Current value: %d.', this._autoRender );\n\n\t\tthis._autoRender = bool;\n\t\tdebug( 'New Value: %d.', this._autoRender );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'rug:set:color' );\n\n\n// MAIN //\n\n/**\n* Sets the color.\n*\n* @private\n* @param {(string|Function)} color - color\n* @throws {TypeError} must be a string or function\n*/\nfunction set( color ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isString( color ) && !isFunction( color ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string or a function. Value: `%s`.', 'color', color ) );\n\t}\n\tif ( color !== this._color ) {\n\t\tdebug( 'Current value: %d.', this._color );\n\n\t\tthis._color = color;\n\t\tdebug( 'New Value: %d.', this._color );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isArrayLike from '@stdlib/assert/is-array-like';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'rug:set:data' );\n\n\n// MAIN //\n\n/**\n* Sets the data values.\n*\n* ## Notes\n*\n* - We always fire a `change` event when set, even if the provided reference is the same, to allow signaling that data values have changed (e.g., a data array has mutated).\n*\n* @private\n* @param {ArrayLike} data - data values\n* @throws {TypeError} must be array-like\n*/\nfunction set( data ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isArrayLike( data ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be array-like. Value: `%s`.', 'data', data ) );\n\t}\n\tdebug( 'Current value: %s.', JSON.stringify( this._data ) );\n\n\tthis._data = data;\n\tdebug( 'New Value: %s.', JSON.stringify( this._data ) );\n\n\tthis.emit( 'change' );\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'rug:set:is-defined' );\n\n\n// MAIN //\n\n/**\n* Sets the predicate function for determining whether a value is defined.\n*\n* @private\n* @param {Function} fcn - predicate function\n* @throws {TypeError} must be a function\n*/\nfunction set( fcn ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'isDefined', fcn ) );\n\t}\n\tif ( fcn !== this._isDefined ) {\n\t\tdebug( 'Current value: %s.', this._isDefined );\n\n\t\tthis._isDefined = fcn;\n\t\tdebug( 'New Value: %s.', this._isDefined );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'rug:set:label' );\n\n\n// MAIN //\n\n/**\n* Sets the label.\n*\n* @private\n* @param {(string|Function)} label - label\n* @throws {TypeError} must be a string or a function\n*/\nfunction set( label ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isString( label ) && !isFunction( label ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a string or a function. Value: `%s`.', 'label', label ) );\n\t}\n\tif ( label !== this._label ) {\n\t\tdebug( 'Current value: %d.', this._label );\n\n\t\tthis._label = label;\n\t\tdebug( 'New Value: %d.', this._label );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'rug:set:opacity' );\n\n\n// MAIN //\n\n/**\n* Sets the opacity.\n*\n* @private\n* @param {(number|Function)} opacity - opacity\n* @throws {TypeError} must be a number or a function\n* @throws {RangeError} must be a number on the interval `[0,1]`\n*/\nfunction set( opacity ) {\n\t/* eslint-disable no-invalid-this */\n\tvar isNum = isNumber( opacity );\n\tif ( !isNum && !isFunction( opacity ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a number or a function. Value: `%s`.', 'opacity', opacity ) );\n\t}\n\tif ( isNum && (opacity !== opacity || opacity < 0.0 || opacity > 1.0) ) {\n\t\tthrow new RangeError( format( 'invalid assignment. `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'opacity', opacity ) );\n\t}\n\tif ( opacity !== this._opacity ) {\n\t\tdebug( 'Current value: %d.', this._opacity );\n\n\t\tthis._opacity = opacity;\n\t\tdebug( 'New Value: %d.', this._opacity );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport indexOf from '@stdlib/utils/index-of';\nimport format from '@stdlib/string/format';\nimport ORIENTATIONS from './orientations.json';\n\n\n// VARIABLES //\n\nvar debug = logger( 'rug:set:orientation' );\n\n\n// MAIN //\n\n/**\n* Sets the orientation.\n*\n* @private\n* @param {string} orient - orientation\n* @throws {TypeError} must be a supported orientation\n*/\nfunction set( orient ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( indexOf( ORIENTATIONS, orient ) === -1 ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be one of the following: \"%s\". Value: `%s`.', 'orientation', ORIENTATIONS.join( '\", \"' ), orient ) );\n\t}\n\tif ( orient !== this._orientation ) {\n\t\tdebug( 'Current value: %d.', this._orientation );\n\n\t\tthis._orientation = orient;\n\t\tdebug( 'New Value: %d.', this._orientation );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'rug:pos' );\n\n\n// MAIN //\n\n/**\n* Returns a function to map values to coordinate values.\n*\n* @private\n* @returns {Function} map function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar scale = this.scale;\n\treturn pos;\n\n\t/**\n\t* Maps a value to a coordinate value.\n\t*\n\t* @private\n\t* @param {*} d - datum\n\t* @returns {number} pixel value\n\t*/\n\tfunction pos( d ) {\n\t\tvar p = scale( d );\n\t\tdebug( 'Value: %d => Pixel: %d.', d, p );\n\t\treturn p;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport isFunction from '@stdlib/assert/is-function';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'rug:set:scale' );\n\n\n// MAIN //\n\n/**\n* Sets the scale function.\n*\n* @private\n* @param {Function} fcn - scale\n* @throws {TypeError} must be a function\n*/\nfunction set( fcn ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'scale', fcn ) );\n\t}\n\tif ( fcn !== this._scale ) {\n\t\tdebug( 'Current value: %s.', this._scale );\n\n\t\tthis._scale = fcn;\n\t\tdebug( 'New Value: %s.', this._scale );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar debug = logger( 'rug:set:size' );\n\n\n// MAIN //\n\n/**\n* Sets the tick (tassel) size.\n*\n* @private\n* @param {NonNegativeInteger} size - size\n* @throws {TypeError} must be a nonnegative integer\n*/\nfunction set( size ) {\n\t/* eslint-disable no-invalid-this */\n\tif ( !isNonNegativeInteger( size ) ) {\n\t\tthrow new TypeError( format( 'invalid assignment. `%s` must be a nonnegative integer. Value: `%s`.', 'size', size ) );\n\t}\n\tif ( size !== this._size ) {\n\t\tdebug( 'Current value: %d.', this._size );\n\n\t\tthis._size = size;\n\t\tdebug( 'New Value: %d.', this._size );\n\n\t\tthis.emit( 'change' );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default set;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\nimport xAttr from './utils/x_attr.js';\nimport yAttr from './utils/y_attr.js';\nimport tickDir from './utils/tick_dir.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'rug:render:ticks' );\nvar ELEMENT = 'line';\n\n\n// MAIN //\n\n/**\n* Renders rug ticks (tassels).\n*\n* @private\n* @param {Object} ctx - context\n* @returns {Array} array of virtual trees\n*/\nfunction render( ctx ) {\n\tvar props;\n\tvar data;\n\tvar out;\n\tvar pos;\n\tvar dir;\n\tvar p;\n\tvar x;\n\tvar y;\n\tvar d;\n\tvar i;\n\n\tdebug( 'Rendering ticks...' );\n\n\tdata = ctx.data;\n\tpos = ctx.pos;\n\tx = xAttr( ctx.orientation );\n\ty = yAttr( ctx.orientation );\n\tdir = tickDir( ctx.orientation );\n\n\tout = new Array( data.length );\n\tfor ( i = 0; i < data.length; i++ ) {\n\t\td = data[ i ];\n\t\tif ( !ctx.isDefined( d, i ) ) {\n\t\t\tdebug( 'Datum %d is not defined. Value: %s.', i, d );\n\t\t\tcontinue;\n\t\t}\n\t\tprops = {\n\t\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t\t'property': 'rug.tick',\n\t\t\t'className': 'tick',\n\t\t\t'attributes': {\n\t\t\t\t'fill': 'none',\n\t\t\t\t'opacity': ctx.opacity( d, i ),\n\t\t\t\t'stroke': ctx.color( d, i ),\n\t\t\t\t'stroke-width': 1,\n\t\t\t\t'data-label': ctx.label( d, i )\n\t\t\t}\n\t\t};\n\n\t\tp = pos( d );\n\t\tprops.attributes[ x+'1' ] = 0;\n\t\tprops.attributes[ x+'2' ] = dir * ctx.size;\n\t\tprops.attributes[ y+'1' ] = p;\n\t\tprops.attributes[ y+'2' ] = p;\n\n\t\tdebug( 'Rendering tick %d with value %s...', i, d );\n\n\t\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\t\tout[ i ] = h( ELEMENT, props, [] );\n\t}\n\tdebug( 'Finished rendering ticks.' );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar h = require( 'virtual-dom/h.js' );\nimport ticks from './ticks.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'rug:render' );\nvar ELEMENT = 'g';\n\n\n// MAIN //\n\n/**\n* Renders a virtual DOM tree.\n*\n* @private\n* @returns {VTree} virtual tree\n*/\nfunction render() {\n\t/* eslint-disable no-invalid-this */\n\tvar children;\n\tvar props;\n\tvar vtree;\n\n\tdebug( 'Rendering...' );\n\n\tprops = {\n\t\t'namespace': 'http://www.w3.org/2000/svg',\n\t\t'property': 'rug',\n\t\t'className': 'rug'\n\t};\n\n\tchildren = ticks( this );\n\n\tdebug( 'Generating a virtual DOM tree (%s) with properties: %s.', ELEMENT, JSON.stringify( props ) );\n\tvtree = h( ELEMENT, props, children );\n\n\t// Announce that a new tree has been rendered:\n\tthis.emit( '_render', vtree );\n\n\treturn vtree;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar EventEmitter = require( 'events' ).EventEmitter;\nvar logger = require( 'debug' );\nvar linear = require( 'd3-scale' ).scaleLinear; // TODO: remove\nimport defineProperty from '@stdlib/utils/define-property';\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\nimport objectKeys from '@stdlib/utils/keys';\nimport format from '@stdlib/string/format';\nimport copy from '@stdlib/utils/copy';\nimport merge from '@stdlib/utils/merge';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport instanceOf from '@stdlib/assert/instance-of';\nimport inherit from '@stdlib/utils/inherit';\nimport isDefined from './accessors/is_defined.js';\nimport defaults from './defaults.json';\nimport setAutoRender from './props/auto-render/set.js';\nimport getAutoRender from './props/auto-render/get.js';\nimport setColor from './props/color/set.js';\nimport getColor from './props/color/get.js';\nimport setData from './props/data/set.js';\nimport getData from './props/data/get.js';\nimport setIsDefined from './props/is-defined/set.js';\nimport getIsDefined from './props/is-defined/get.js';\nimport setLabel from './props/label/set.js';\nimport getLabel from './props/label/get.js';\nimport setOpacity from './props/opacity/set.js';\nimport getOpacity from './props/opacity/get.js';\nimport setOrientation from './props/orientation/set.js';\nimport getOrientation from './props/orientation/get.js';\nimport getPos from './props/pos/get.js';\nimport setScale from './props/scale/set.js';\nimport getScale from './props/scale/get.js';\nimport setSize from './props/size/set.js';\nimport getSize from './props/size/get.js';\nimport render from './render';\n\n\n// VARIABLES //\n\nvar debug = logger( 'rug:main' );\nvar PRIVATE_PROPS = [\n\t'_autoRender',\n\t'_color',\n\t'_data',\n\t'_isDefined',\n\t'_label',\n\t'_opacity',\n\t'_orientation',\n\t'_scale',\n\t'_size'\n];\n\n\n// MAIN //\n\n/**\n* Rug constructor.\n*\n* @constructor\n* @param {Options} [options] - constructor options\n* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event\n* @param {(string|Function)} [options.color=\"#aaa\"] - color\n* @param {ArrayLike} [options.data=[]] - data\n* @param {Function} [options.isDefined] - predicate function indicating whether a datum is defined\n* @param {(string|Function)} [options.label] - label\n* @param {(number|Function)} [options.opacity=0.9] - opacity\n* @param {string} [options.orientation=\"bottom\"] - orientation\n* @param {Function} [options.scale] - scale function\n* @param {NonNegativeInteger} [options.size=6] - tick (tassel) size\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {Rug} Rug instance\n*\n* @example\n* var node = new Rug({\n* 'data': [ 0.1, 0.2, 0.3 ]\n* });\n* // returns \n*/\nfunction Rug( options ) {\n\tvar self;\n\tvar keys;\n\tvar opts;\n\tvar key;\n\tvar i;\n\tif ( !instanceOf( this, Rug ) ) {\n\t\tif ( arguments.length ) {\n\t\t\treturn new Rug( options );\n\t\t}\n\t\treturn new Rug();\n\t}\n\tself = this;\n\n\topts = copy( defaults );\n\topts.isDefined = isDefined;\n\topts.scale = linear();\n\n\tif ( arguments.length ) {\n\t\tif ( !isObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t\topts = merge( opts, options );\n\t}\n\tdebug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) );\n\tEventEmitter.call( this );\n\n\tfor ( i = 0; i < PRIVATE_PROPS.length; i++ ) {\n\t\tdefineProperty( this, PRIVATE_PROPS[i], {\n\t\t\t'configurable': false,\n\t\t\t'enumerable': false,\n\t\t\t'writable': true,\n\t\t\t'value': null\n\t\t});\n\t}\n\t// Set options...\n\tkeys = objectKeys( opts );\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tkey = keys[ i ];\n\t\tthis[ key ] = opts[ key ];\n\t}\n\n\tthis.on( 'change', onChange );\n\tthis.on( '_render', onRender );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a change event.\n\t*\n\t* @private\n\t*/\n\tfunction onChange() {\n\t\tdebug( 'Received a change event.' );\n\t\tif ( self._autoRender ) { // eslint-disable-line no-underscore-dangle\n\t\t\tself.render();\n\t\t}\n\t}\n\n\t/**\n\t* Re-emits a render event.\n\t*\n\t* @private\n\t*/\n\tfunction onRender() {\n\t\tvar args;\n\t\tvar i;\n\t\tdebug( 'Received a render event. Re-emitting...' );\n\t\targs = new Array( arguments.length+1 );\n\t\targs[ 0 ] = 'render';\n\t\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\t\targs[ i+1 ] = arguments[ i ];\n\t\t}\n\t\tself.emit.apply( self, args );\n\t}\n}\n\n/*\n* Inherit from the `EventEmitter` prototype.\n*/\ninherit( Rug, EventEmitter );\n\n/**\n* Rendering mode. If `true`, an instance re-renders on each change event.\n*\n* @name autoRender\n* @memberof Rug.prototype\n* @type {boolean}\n* @throws {TypeError} must be a boolean\n* @default false\n*\n* @example\n* var node = new Rug({\n* 'autoRender': true\n* });\n*\n* var mode = node.autoRender;\n* // returns true\n*/\ndefineProperty( Rug.prototype, 'autoRender', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setAutoRender,\n\t'get': getAutoRender\n});\n\n/**\n* Tick color. When retrieved, the returned value is a color accessor.\n*\n* @name color\n* @memberof Rug.prototype\n* @type {(string|Function)}\n* @throws {TypeError} must be a string or function\n*\n* @example\n* var node = new Rug({\n* 'color': 'steelblue'\n* });\n*\n* var color = node.color;\n* // returns \n*/\ndefineProperty( Rug.prototype, 'color', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setColor,\n\t'get': getColor\n});\n\n/**\n* Data.\n*\n* @name data\n* @memberof Rug.prototype\n* @type {ArrayLike}\n* @throws {TypeError} must be array-like\n* @default []\n*\n* @example\n* var node = new Rug({\n* 'data': [ 0.1, 0.2, 0.3 ]\n* });\n*\n* var data = node.data;\n* // returns [ 0.1, 0.2, 0.3 ]\n*/\ndefineProperty( Rug.prototype, 'data', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setData,\n\t'get': getData\n});\n\n/**\n* Predicate function which defines whether a datum is defined. This accessor is used to define how missing values are encoded. The default behavior is to ignore values which are `NaN`.\n*\n* @name isDefined\n* @memberof Rug.prototype\n* @type {Function}\n* @throws {TypeError} must be a function\n*\n* @example\n* var node = new Rug();\n*\n* function isDefined( d ) {\n* // Check for `NaN`:\n* return ( d === d );\n* }\n* node.isDefined = isDefined;\n*\n* @example\n* function isDefined( d ) {\n* // Check for `NaN`:\n* return ( d === d );\n* }\n* var node = new Rug({\n* 'isDefined': isDefined\n* });\n* var fcn = node.isDefined;\n* // returns \n*/\ndefineProperty( Rug.prototype, 'isDefined', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setIsDefined,\n\t'get': getIsDefined\n});\n\n/**\n* Tick label. When retrieved, the returned value is a label accessor.\n*\n* @name label\n* @memberof Rug.prototype\n* @type {(string|Function)}\n* @throws {TypeError} must be a string or function\n*\n* @example\n* var node = new Rug({\n* 'label': 'group-1'\n* });\n*\n* var label = node.label;\n* // returns \n*/\ndefineProperty( Rug.prototype, 'label', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setLabel,\n\t'get': getLabel\n});\n\n/**\n* Tick opacity. When retrieved, the returned value is an opacity accessor.\n*\n* @name opacity\n* @memberof Rug.prototype\n* @type {number}\n* @throws {TypeError} must be a number\n* @throws {RangeError} must be a number on the interval `[0,1]`\n* @default 0.9\n*\n* @example\n* var node = new Rug({\n* 'opacity': 0.5\n* });\n*\n* var opacity = node.opacity;\n* // returns \n*/\ndefineProperty( Rug.prototype, 'opacity', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setOpacity,\n\t'get': getOpacity\n});\n\n/**\n* Rug orientation.\n*\n* @name orientation\n* @memberof Rug.prototype\n* @type {string}\n* @throws {TypeError} must be a supported orientation\n*\n* @example\n* var node = new Rug({\n* 'orientation': 'left'\n* });\n*\n* var orient = node.orientation;\n* // returns 'left'\n*/\ndefineProperty( Rug.prototype, 'orientation', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setOrientation,\n\t'get': getOrientation\n});\n\n/**\n* Function to map values to x coordinate values.\n*\n* @name pos\n* @memberof Rug.prototype\n* @type {Function}\n*\n* @example\n* var node = new Rug();\n*\n* var pos = node.pos;\n* // returns \n*/\ndefineProperty( Rug.prototype, 'pos', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getPos\n});\n\n/**\n* Scale function.\n*\n* @name scale\n* @memberof Rug.prototype\n* @type {Function}\n* @throws {TypeError} must be a function\n*\n* @example\n* var node = new Rug({\n* 'scale': function scale() {}\n* });\n*\n* var fcn = node.scale;\n* // returns \n*/\ndefineProperty( Rug.prototype, 'scale', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setScale,\n\t'get': getScale\n});\n\n/**\n* Tick (tassel) size.\n*\n* @name size\n* @memberof Rug.prototype\n* @type {NonNegativeInteger}\n* @throws {TypeError} must be a nonnegative integer\n* @default 6\n*\n* @example\n* var node = new Rug({\n* 'size': 5\n* });\n*\n* var size = node.size;\n* // returns 5\n*/\ndefineProperty( Rug.prototype, 'size', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setSize,\n\t'get': getSize\n});\n\n/**\n* Renders a Virtual DOM tree.\n*\n* @name render\n* @memberof Rug.prototype\n* @type {Function}\n* @returns {VTree} virtual tree\n*\n* @example\n* var node = new Rug();\n*\n* var out = node.render();\n* // returns \n*/\nsetReadOnly( Rug.prototype, 'render', render );\n\n\n// EXPORTS //\n\nexport default Rug;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the rendering mode.\n*\n* @private\n* @returns {boolean} rendering mode\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._autoRender;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\n\n\n// MAIN //\n\n/**\n* Returns a function to get a color.\n*\n* @private\n* @returns {Function} color accessor\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar self = this;\n\tif ( isString( this._color ) ) {\n\t\treturn color;\n\t}\n\treturn this._color;\n\n\t/**\n\t* Returns a color value.\n\t*\n\t* @private\n\t* @returns {string} color\n\t*/\n\tfunction color() {\n\t\treturn self._color; // eslint-disable-line no-underscore-dangle\n\t}\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the data values.\n*\n* @private\n* @returns {ArrayLike} data values\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._data;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the predicate function for determining whether a value is defined.\n*\n* @private\n* @returns {Function} predicate function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._isDefined;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\n\n\n// MAIN //\n\n/**\n* Returns a function to get a label.\n*\n* @private\n* @returns {Function} label accessor\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar self = this;\n\tif ( isString( this._label ) ) {\n\t\treturn label;\n\t}\n\treturn this._label;\n\n\t/**\n\t* Returns a label.\n\t*\n\t* @private\n\t* @returns {string} label\n\t*/\n\tfunction label() {\n\t\treturn self._label; // eslint-disable-line no-underscore-dangle\n\t}\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\n\n\n// MAIN //\n\n/**\n* Returns a function to get an opacity.\n*\n* @private\n* @returns {Function} opacity accessor\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar self = this;\n\tif ( isNumber( this._opacity ) ) {\n\t\treturn opacity;\n\t}\n\treturn this._opacity;\n\n\t/**\n\t* Returns the opacity.\n\t*\n\t* @private\n\t* @returns {number} opacity\n\t*/\n\tfunction opacity() {\n\t\treturn self._opacity; // eslint-disable-line no-underscore-dangle\n\t}\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the orientation.\n*\n* @private\n* @returns {string} orientation\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._orientation;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the scale function.\n*\n* @private\n* @returns {Function} scale function\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._scale;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns the tick (tassel) size.\n*\n* @private\n* @returns {NonNegativeInteger} tick size\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._size;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the \"x\" attribute for tick positioning.\n*\n* @private\n* @param {string} orient - rug orientation\n* @returns {string} attribute\n*/\nfunction xAttr( orient ) {\n\tif ( orient === 'left' || orient === 'right' ) {\n\t\treturn 'x';\n\t}\n\treturn 'y';\n}\n\n\n// EXPORTS //\n\nexport default xAttr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the \"y\" attribute for tick positioning.\n*\n* @private\n* @param {string} orient - rug orientation\n* @returns {string} attribute\n*/\nfunction yAttr( orient ) {\n\tif ( orient === 'left' || orient === 'right' ) {\n\t\treturn 'y';\n\t}\n\treturn 'x';\n}\n\n\n// EXPORTS //\n\nexport default yAttr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the tick direction.\n*\n* @private\n* @param {string} orient - orientation\n* @returns {number} tick direction\n*/\nfunction tickDir( orient ) {\n\tif ( orient === 'bottom' || orient === 'right' ) {\n\t\treturn -1;\n\t}\n\treturn 1;\n}\n\n\n// EXPORTS //\n\nexport default tickDir;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport defineProperty from '@stdlib/utils/define-property';\nimport Annotations from './../../../../components/svg/annotations';\nimport ClipPath from './../../../../components/svg/clip-path';\nimport Canvas from './../../../../components/svg/canvas';\nimport Graph from './../../../../components/svg/graph';\nimport Title from './../../../../components/svg/title';\nimport Marks from './../../../../components/svg/marks';\nimport Bkgd from './../../../../components/svg/background';\nimport Defs from './../../../../components/svg/defs';\nimport Axis from './../../../../components/svg/axis';\nimport Path from './../../../../components/svg/path';\nimport Symbols from './../../../../components/svg/symbols';\nimport Rug from './../../../../components/svg/rug';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:render:svg:init' );\n\n\n// MAIN //\n\n/**\n* Initializes SVG components.\n*\n* @private\n* @param {Object} state - state\n*/\nfunction init( state ) {\n\tvar svg = state.$.svg;\n\n\tdebug( 'Initializing components...' );\n\n\tdebug( 'Initializing canvas component...' );\n\tdefineProperty( svg, 'canvas', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': new Canvas({\n\t\t\t'autoRender': false\n\t\t})\n\t});\n\n\tdebug( 'Initializing definitions component...' );\n\tdefineProperty( svg, 'defs', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': new Defs({\n\t\t\t'autoRender': false\n\t\t})\n\t});\n\n\tdebug( 'Initializing clipping path component...' );\n\tdefineProperty( svg, 'clipPath', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': new ClipPath({\n\t\t\t'autoRender': false,\n\t\t\t'id': state._clipPathId // eslint-disable-line no-underscore-dangle\n\t\t})\n\t});\n\n\tdebug( 'Initializing graph component...' );\n\tdefineProperty( svg, 'graph', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': new Graph({\n\t\t\t'autoRender': false\n\t\t})\n\t});\n\n\tdebug( 'Initializing annotations component...' );\n\tdefineProperty( svg, 'annotations', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': new Annotations({\n\t\t\t'autoRender': false\n\t\t})\n\t});\n\n\tdebug( 'Initializing title component...' );\n\tdefineProperty( svg, 'title', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': new Title({\n\t\t\t'autoRender': false\n\t\t})\n\t});\n\n\tdebug( 'Initializing background component...' );\n\tdefineProperty( svg, 'bkgd', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': new Bkgd({\n\t\t\t'autoRender': false\n\t\t})\n\t});\n\n\tdebug( 'Initializing marks component...' );\n\tdefineProperty( svg, 'marks', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': new Marks({\n\t\t\t'autoRender': false,\n\t\t\t'clipPathId': state._clipPathId // eslint-disable-line no-underscore-dangle\n\t\t})\n\t});\n\n\tdebug( 'Initializing path component...' );\n\tdefineProperty( svg, 'path', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': new Path({\n\t\t\t'autoRender': false\n\t\t})\n\t});\n\n\tdebug( 'Initializing symbols component...' );\n\tdefineProperty( svg, 'symbols', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': new Symbols({\n\t\t\t'autoRender': false\n\t\t})\n\t});\n\n\tdebug( 'Initializing x-axis rug component...' );\n\tdefineProperty( svg, 'xRug', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': new Rug({\n\t\t\t'autoRender': false\n\t\t})\n\t});\n\n\tdebug( 'Initializing y-axis rug component...' );\n\tdefineProperty( svg, 'yRug', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': new Rug({\n\t\t\t'autoRender': false\n\t\t})\n\t});\n\n\tdebug( 'Initializing x-axis component...' );\n\tdefineProperty( svg, 'xAxis', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': new Axis({\n\t\t\t'autoRender': false\n\t\t})\n\t});\n\n\tdebug( 'Initializing y-axis component...' );\n\tdefineProperty( svg, 'yAxis', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': new Axis({\n\t\t\t'autoRender': false\n\t\t})\n\t});\n\n\tdebug( 'All components initialized.' );\n}\n\n\n// EXPORTS //\n\nexport default init;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:render:svg:sync' );\n\n\n// MAIN //\n\n/**\n* Syncs SVG components with the current state.\n*\n* @private\n* @param {Object} state - state\n*/\nfunction sync( state ) {\n\tvar svg = state.$.svg;\n\n\tdebug( 'Syncing...' );\n\n\tdebug( 'Syncing canvas...' );\n\tsvg.canvas.width = state.width;\n\tsvg.canvas.height = state.height;\n\n\tdebug( 'Syncing definitions...' );\n\n\t// ...\n\n\tdebug( 'Syncing clipping path...' );\n\tsvg.clipPath.width = state.graphWidth;\n\tsvg.clipPath.height = state.graphHeight;\n\n\tdebug( 'Syncing graph...' );\n\tsvg.graph.translateX = state.paddingLeft;\n\tsvg.graph.translateY = state.paddingTop;\n\n\tdebug( 'Syncing annotations...' );\n\n\t// ...\n\n\tdebug( 'Syncing title...' );\n\tsvg.title.text = state.title;\n\n\tdebug( 'Syncing background...' );\n\tsvg.bkgd.width = state.graphWidth;\n\tsvg.bkgd.height = state.graphHeight;\n\n\tdebug( 'Syncing marks...' );\n\tsvg.marks.clipPathId = state._clipPathId; // eslint-disable-line no-underscore-dangle\n\n\tdebug( 'Syncing path...' );\n\tsvg.path.xScale = state.xScale;\n\tsvg.path.yScale = state.yScale;\n\n\t// svg.path.isDefined = state.isDefined; // TODO\n\n\tdebug( 'Syncing symbols...' );\n\tsvg.symbols.xScale = state.xScale;\n\tsvg.symbols.yScale = state.yScale;\n\n\t// svg.symbols.isDefined = state.isDefined; // TODO\n\n\tdebug( 'Syncing x-axis rug...' );\n\tsvg.xRug.scale = state.xScale;\n\n\t// svg.xRug.isDefined = state.isDefined; // TODO\n\n\tdebug( 'Syncing y-axis rug...' );\n\tsvg.yRug.scale = state.yScale;\n\n\t// svg.yRug.isDefined = state.isDefined; // TODO\n\n\tdebug( 'Syncing x-axis...' );\n\tsvg.xAxis.scale = state.xScale;\n\tsvg.xAxis.label = state.xLabel;\n\tsvg.xAxis.tickFormat = state.xTickFormat;\n\tsvg.xAxis.numTicks = state.xNumTicks;\n\tsvg.xAxis.orientation = state.xAxisOrient;\n\n\tdebug( 'Syncing y-axis...' );\n\tsvg.yAxis.scale = state.yScale;\n\tsvg.yAxis.label = state.yLabel;\n\tsvg.yAxis.tickFormat = state.yTickFormat;\n\tsvg.yAxis.numTicks = state.yNumTicks;\n\tsvg.yAxis.orientation = state.yAxisOrient;\n\n\tdebug( 'Sync complete.' );\n}\n\n\n// EXPORTS //\n\nexport default sync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport xAxisTransform from './utils/x_axis_transform.js';\nimport yAxisTransform from './utils/y_axis_transform.js';\nimport renderMarks from './marks';\nimport init from './init.js';\nimport sync from './sync.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:render:svg:main' );\n\n\n// MAIN //\n\n/**\n* Renders a virtual DOM tree.\n*\n* @private\n* @param {Object} state - state\n* @returns {VTree} virtual tree\n*/\nfunction render( state ) {\n\tvar annotations;\n\tvar clipPath;\n\tvar canvas;\n\tvar title;\n\tvar graph;\n\tvar marks;\n\tvar xAxis;\n\tvar yAxis;\n\tvar bkgd;\n\tvar defs;\n\tvar svg;\n\n\tsvg = state.$.svg;\n\n\t// Lazily initialize...\n\tif ( !svg.canvas ) {\n\t\tdebug( 'Initializing components...' );\n\t\tinit( state );\n\t}\n\tdebug( 'Syncing component states...' );\n\tsync( state );\n\n\tdebug( 'Rendering individual components...' );\n\n\tdebug( 'Rendering annotations...' );\n\tannotations = svg.annotations.render();\n\n\tdebug( 'Rendering clip-path...' );\n\tclipPath = svg.clipPath.render();\n\n\tdebug( 'Rendering canvas...' );\n\tcanvas = svg.canvas.render();\n\n\tdebug( 'Rendering graph...' );\n\tgraph = svg.graph.render();\n\n\tdebug( 'Rendering title...' );\n\ttitle = svg.title.render();\n\n\tdebug( 'Rendering x-axis...' );\n\txAxis = svg.xAxis.render();\n\n\tdebug( 'Rendering y-axis...' );\n\tyAxis = svg.yAxis.render();\n\n\tdebug( 'Rendering background...' );\n\tbkgd = svg.bkgd.render();\n\n\tdebug( 'Rendering definitions...' );\n\tdefs = svg.defs.render();\n\n\tdebug( 'Rendering marks...' );\n\tmarks = renderMarks( state );\n\n\tdebug( 'Updating rendered components...' );\n\n\tdebug( 'Updating title...' );\n\ttitle.properties.attributes.x = state.paddingLeft + ( state.graphWidth/2 );\n\ttitle.properties.attributes.y = state.paddingTop / 2;\n\n\tdebug( 'Updating x-axis...' );\n\txAxis.properties.className += ' x';\n\txAxis.properties.attributes.transform = xAxisTransform( state.xAxisOrient, state.graphHeight ); // eslint-disable-line max-len\n\n\tdebug( 'Updating y-axis...' );\n\tyAxis.properties.className += ' y';\n\tyAxis.properties.attributes.transform = yAxisTransform( state.yAxisOrient, state.graphWidth ); // eslint-disable-line max-len\n\n\tdebug( 'Assembling virtual tree...' );\n\n\tdebug( 'Inserting clip-path into definitions...' );\n\tdefs.children.push( clipPath );\n\tdefs.count += clipPath.count;\n\n\tdebug( 'Inserting background into graph...' );\n\tgraph.children.push( bkgd );\n\tgraph.count += bkgd.count;\n\n\tdebug( 'Inserting marks into graph...' );\n\tgraph.children.push( marks );\n\tgraph.count += marks.count;\n\n\tdebug( 'Inserting x-axis into graph...' );\n\tgraph.children.push( xAxis );\n\tgraph.count += xAxis.count;\n\n\tdebug( 'Inserting y-axis into graph...' );\n\tgraph.children.push( yAxis );\n\tgraph.count += yAxis.count;\n\n\tdebug( 'Inserting title into annotations...' );\n\tannotations.children.push( title );\n\tannotations.count += title.count;\n\n\tdebug( 'Inserting definitions into canvas...' );\n\tcanvas.children.push( defs );\n\tcanvas.count += defs.count;\n\n\tdebug( 'Inserting graph into canvas...' );\n\tcanvas.children.push( graph );\n\tcanvas.count += graph.count;\n\n\tdebug( 'Inserting annotations into canvas...' );\n\tcanvas.children.push( annotations );\n\tcanvas.count += annotations.count;\n\n\treturn canvas;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns an x-axis translation transform.\n*\n* @private\n* @param {string} orient - axis orientation\n* @param {number} height - graph height\n* @returns {string} transform\n*/\nfunction xAxisTransform( orient, height ) {\n\tif ( orient === 'top' ) {\n\t\treturn 'translate(0,0)';\n\t}\n\treturn 'translate(0,'+height+')';\n}\n\n\n// EXPORTS //\n\nexport default xAxisTransform;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns a y-axis translation transform.\n*\n* @private\n* @param {string} orient - axis orientation\n* @param {number} width - graph width\n* @returns {string} transform\n*/\nfunction yAxisTransform( orient, width ) {\n\tif ( orient === 'left' ) {\n\t\treturn 'translate(0,0)';\n\t}\n\treturn 'translate('+width+',0)';\n}\n\n\n// EXPORTS //\n\nexport default yAxisTransform;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nvar vdom2html = require( 'vdom-to-html' );\nimport renderSVG from './svg';\nimport validate from './validate.js';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:render' );\n\n\n// MAIN //\n\n/**\n* Renders a plot.\n*\n* @private\n* @param {string} [format] - render format\n* @returns {(VTree|string)} virtual tree or a string\n*/\nfunction render( format ) {\n\t/* eslint-disable no-invalid-this */\n\tvar out;\n\tvar tmp;\n\tvar fmt;\n\n\ttmp = this.renderFormat;\n\tif ( arguments.length ) {\n\t\t// Temporarily set the render format:\n\t\tthis.renderFormat = format;\n\t\tfmt = format;\n\t} else {\n\t\tfmt = tmp;\n\t}\n\tdebug( 'Validating render state...' );\n\tvalidate( this );\n\n\tdebug( 'Render format: %s.', this.renderFormat );\n\tdebug( 'Rendering...' );\n\tif ( this._engine === 'svg' ) {\n\t\tout = renderSVG( this );\n\n\t\t// Default render format is virtual DOM.\n\t\tif ( fmt === 'html' ) {\n\t\t\tout = vdom2html( out );\n\t\t}\n\t\tthis.emit( 'render', out );\n\t}\n\tif ( arguments.length ) {\n\t\t// Restore the render format:\n\t\tthis.renderFormat = tmp;\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default render;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar logger = require( 'debug' );\nimport _view from './view.js'; // eslint-disable-line no-underscore-dangle\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:view' );\n\n\n// MAIN //\n\n/**\n* Generates a plot view.\n*\n* @private\n* @param {string} viewer - plot viewer\n*/\nfunction view( viewer ) {\n\t/* eslint-disable no-invalid-this */\n\tvar tmp = this.viewer;\n\tif ( arguments.length ) {\n\t\t// Temporarily set the viewer:\n\t\tthis.viewer = viewer;\n\t}\n\tdebug( 'Viewer: %s.', this.viewer );\n\tdebug( 'Generating view...' );\n\t_view( this, this.viewer, this.render() );\n\tif ( arguments.length ) {\n\t\t// Restore the viewer:\n\t\tthis.viewer = tmp;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default view;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\nvar EventEmitter = require( 'events' ).EventEmitter;\nvar logger = require( 'debug' );\nimport objectKeys from '@stdlib/utils/keys';\nimport defineProperty from '@stdlib/utils/define-property';\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport copy from '@stdlib/utils/copy';\nimport inherit from '@stdlib/utils/inherit';\nimport { factory as mergeFcn } from '@stdlib/utils/merge';\nimport minstd from '@stdlib/random/base/minstd';\nimport format from '@stdlib/string/format';\nimport view from './view/view.js';\nimport defaults from './defaults.js';\nimport setX from './props/x/set.js';\nimport getX from './props/x/get.js';\nimport setY from './props/y/set.js';\nimport getY from './props/y/get.js';\nimport setLabels from './props/labels/set.js';\nimport getLabels from './props/labels/get.js';\nimport setIsDefined from './props/is-defined/set.js';\nimport getIsDefined from './props/is-defined/get.js';\nimport setColors from './props/colors/set.js';\nimport getColors from './props/colors/get.js';\nimport setLineStyle from './props/line-style/set.js';\nimport getLineStyle from './props/line-style/get.js';\nimport setLineOpacity from './props/line-opacity/set.js';\nimport getLineOpacity from './props/line-opacity/get.js';\nimport setLineWidth from './props/line-width/set.js';\nimport getLineWidth from './props/line-width/get.js';\nimport setSymbols from './props/symbols/set.js';\nimport getSymbols from './props/symbols/get.js';\nimport setSymbolsSize from './props/symbols-size/set.js';\nimport getSymbolsSize from './props/symbols-size/get.js';\nimport setSymbolsOpacity from './props/symbols-opacity/set.js';\nimport getSymbolsOpacity from './props/symbols-opacity/get.js';\nimport setWidth from './props/width/set.js';\nimport getWidth from './props/width/get.js';\nimport setHeight from './props/height/set.js';\nimport getHeight from './props/height/get.js';\nimport setPaddingLeft from './props/padding-left/set.js';\nimport getPaddingLeft from './props/padding-left/get.js';\nimport setPaddingRight from './props/padding-right/set.js';\nimport getPaddingRight from './props/padding-right/get.js';\nimport setPaddingTop from './props/padding-top/set.js';\nimport getPaddingTop from './props/padding-top/get.js';\nimport setPaddingBottom from './props/padding-bottom/set.js';\nimport getPaddingBottom from './props/padding-bottom/get.js';\nimport setXMin from './props/x-min/set.js';\nimport getXMin from './props/x-min/get.js';\nimport setXMax from './props/x-max/set.js';\nimport getXMax from './props/x-max/get.js';\nimport setYMin from './props/y-min/set.js';\nimport getYMin from './props/y-min/get.js';\nimport setYMax from './props/y-max/set.js';\nimport getYMax from './props/y-max/get.js';\nimport setXScale from './props/x-scale/set.js';\nimport getXScale from './props/x-scale/get.js';\nimport setYScale from './props/y-scale/set.js';\nimport getYScale from './props/y-scale/get.js';\nimport setXTickFormat from './props/x-tick-format/set.js';\nimport getXTickFormat from './props/x-tick-format/get.js';\nimport setYTickFormat from './props/y-tick-format/set.js';\nimport getYTickFormat from './props/y-tick-format/get.js';\nimport setXNumTicks from './props/x-num-ticks/set.js';\nimport getXNumTicks from './props/x-num-ticks/get.js';\nimport setYNumTicks from './props/y-num-ticks/set.js';\nimport getYNumTicks from './props/y-num-ticks/get.js';\nimport setXAxisOrient from './props/x-axis-orient/set.js';\nimport getXAxisOrient from './props/x-axis-orient/get.js';\nimport setYAxisOrient from './props/y-axis-orient/set.js';\nimport getYAxisOrient from './props/y-axis-orient/get.js';\nimport setXRug from './props/x-rug/set.js';\nimport getXRug from './props/x-rug/get.js';\nimport setYRug from './props/y-rug/set.js';\nimport getYRug from './props/y-rug/get.js';\nimport setXRugOrient from './props/x-rug-orient/set.js';\nimport getXRugOrient from './props/x-rug-orient/get.js';\nimport setYRugOrient from './props/y-rug-orient/set.js';\nimport getYRugOrient from './props/y-rug-orient/get.js';\nimport setXRugOpacity from './props/x-rug-opacity/set.js';\nimport getXRugOpacity from './props/x-rug-opacity/get.js';\nimport setYRugOpacity from './props/y-rug-opacity/set.js';\nimport getYRugOpacity from './props/y-rug-opacity/get.js';\nimport setXRugSize from './props/x-rug-size/set.js';\nimport getXRugSize from './props/x-rug-size/get.js';\nimport setYRugSize from './props/y-rug-size/set.js';\nimport getYRugSize from './props/y-rug-size/get.js';\nimport setDescription from './props/description/set.js';\nimport getDescription from './props/description/get.js';\nimport setTitle from './props/title/set.js';\nimport getTitle from './props/title/get.js';\nimport setXLabel from './props/x-label/set.js';\nimport getXLabel from './props/x-label/get.js';\nimport setYLabel from './props/y-label/set.js';\nimport getYLabel from './props/y-label/get.js';\nimport setEngine from './props/engine/set.js';\nimport getEngine from './props/engine/get.js';\nimport setAutoRender from './props/auto-render/set.js';\nimport getAutoRender from './props/auto-render/get.js';\nimport setRenderFormat from './props/render-format/set.js';\nimport getRenderFormat from './props/render-format/get.js';\nimport setViewer from './props/viewer/set.js';\nimport getViewer from './props/viewer/get.js';\nimport setAutoView from './props/auto-view/set.js';\nimport getAutoView from './props/auto-view/get.js';\nimport getGraphWidth from './props/graph-width/get.js';\nimport getGraphHeight from './props/graph-height/get.js';\nimport getXDomain from './props/x-domain/get.js';\nimport getYDomain from './props/y-domain/get.js';\nimport getXRange from './props/x-range/get.js';\nimport getYRange from './props/y-range/get.js';\nimport getXPos from './props/x-pos/get.js';\nimport getYPos from './props/y-pos/get.js';\nimport render from './render';\nimport viewMethod from './view';\n\n\n// VARIABLES //\n\nvar debug = logger( 'plot:main' );\nvar PRIVATE_PROPS = [\n\t'_autoRender',\n\t'_autoView',\n\t'_colors',\n\t'_description',\n\t'_engine',\n\t'_height',\n\t'_isDefined',\n\t'_labels',\n\t'_lineOpacity',\n\t'_lineStyle',\n\t'_lineWidth',\n\t'_paddingBottom',\n\t'_paddingLeft',\n\t'_paddingRight',\n\t'_paddingTop',\n\t'_renderFormat',\n\t'_symbols',\n\t'_symbolsOpacity',\n\t'_symbolsSize',\n\t'_title',\n\t'_viewer',\n\t'_width',\n\t'_xAxisOrient',\n\t'_xData',\n\t'_xLabel',\n\t'_xMax',\n\t'_xMin',\n\t'_xNumTicks',\n\t'_xRug',\n\t'_xRugOpacity',\n\t'_xRugOrient',\n\t'_xRugSize',\n\t'_xScale',\n\t'_xTickFormat',\n\t'_yAxisOrient',\n\t'_yData',\n\t'_yLabel',\n\t'_yMax',\n\t'_yMin',\n\t'_yNumTicks',\n\t'_yRug',\n\t'_yRugOpacity',\n\t'_yRugOrient',\n\t'_yRugSize',\n\t'_yScale',\n\t'_yTickFormat'\n];\n\n\n// FUNCTIONS //\n\nvar merge = mergeFcn({\n\t'extend': false\n});\n\n\n// MAIN //\n\n/**\n* Plot constructor.\n*\n* @constructor\n* @param {Array} [x] - x-values\n* @param {Array} [y] - y-values\n* @param {Options} [options] - constructor options\n* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a change event\n* @param {boolean} [options.autoView=false] - indicates whether to generate an updated view on a render event\n* @param {(string|StringArray)} [options.colors='category10'] - data colors\n* @param {string} [options.description=''] - plot description\n* @param {string} [options.engine='svg'] - plot engine\n* @param {PositiveNumber} [options.height=400] - plot height\n* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined\n* @param {(StringArray|EmptyArray)} [options.labels] - data labels\n* @param {(number|NumberArray)} [options.lineOpacity=0.9] - data line opacity\n* @param {(string|StringArray)} [options.lineStyle='-'] - data line style(s)\n* @param {(NonNegativeInteger|Array)} [options.lineWidth=2] - data line width(s)\n* @param {NonNegativeInteger} [options.paddingBottom=80] - bottom padding\n* @param {NonNegativeInteger} [options.paddingLeft=90] - left padding\n* @param {NonNegativeInteger} [options.paddingRight=20] - right padding\n* @param {NonNegativeInteger} [options.paddingTop=80] - top padding\n* @param {string} [options.renderFormat='vdom'] - plot render format\n* @param {(string|StringArray)} [options.symbols='none'] - data symbols\n* @param {(number|NumberArray)} [options.symbolsOpacity=0.9] - symbols opacity\n* @param {(NonNegativeInteger|Array)} [options.symbolsSize=6] - symbols size\n* @param {string} [options.title=''] - plot title\n* @param {string} [options.viewer='none'] - plot viewer\n* @param {PositiveNumber} [options.width=400] - plot width\n* @param {Array} [options.x=[]] - x-values\n* @param {string} [options.xAxisOrient='bottom'] - x-axis orientation\n* @param {string} [options.xLabel='x'] - x-axis label\n* @param {(Date|FiniteNumber|null)} [options.xMax=null] - maximum value of x-axis domain\n* @param {(Date|FiniteNumber|null)} [options.xMin=null] - minimum value of x-axis domain\n* @param {(NonNegativeInteger|null)} [options.xNumTicks=5] - number of x-axis tick marks\n* @param {(boolean|BooleanArray)} [options.xRug=false] - indicates whether to render a rug plot along the x-axis\n* @param {(string|StringArray)} [options.xRugOrient='bottom'] - x-axis rug orientation\n* @param {(number|NumberArray)} [options.xRugOpacity=0.1] - x-axis rug opacity\n* @param {(NonNegativeInteger|Array)} [options.xRugSize=6] - x-axis rug tick (tassel) size\n* @param {string} [options.xScale='linear'] - x-axis scale\n* @param {(string|null)} [options.xTickFormat=null] - x-axis tick format\n* @param {Array} [options.y=[]] - y-values\n* @param {string} [options.yAxisOrient='left'] - y-axis orientation\n* @param {string} [options.yLabel='y'] - y-axis label\n* @param {(FiniteNumber|null)} [options.yMax=null] - maximum value of y-axis domain\n* @param {(FiniteNumber|null)} [options.yMin=null] - minimum value of y-axis domain\n* @param {(NonNegativeInteger|null)} [options.yNumTicks=5] - number of y-axis tick marks\n* @param {(boolean|BooleanArray)} [options.yRug=false] - indicates whether to render a rug plot along the y-axis\n* @param {(string|StringArray)} [options.yRugOrient='left'] - y-axis rug orientation\n* @param {(number|NumberArray)} [options.yRugOpacity=0.1] - y-axis rug opacity\n* @param {(NonNegativeInteger|Array)} [options.yRugSize=6] - y-axis rug tick (tassel) size\n* @param {string} [options.yScale='linear'] - y-axis scale\n* @param {(string|null)} [options.yTickFormat=null] - y-axis tick format\n* @throws {TypeError} must provide valid options\n* @returns {Plot} Plot instance\n*\n* @example\n* var plot = new Plot();\n*/\nfunction Plot() {\n\tvar options;\n\tvar nargs;\n\tvar keys;\n\tvar self;\n\tvar opts;\n\tvar key;\n\tvar i;\n\n\tnargs = arguments.length;\n\tif ( !(this instanceof Plot) ) {\n\t\tif ( nargs === 0 ) {\n\t\t\treturn new Plot();\n\t\t}\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new Plot( arguments[0] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new Plot( arguments[0], arguments[1] );\n\t\t}\n\t\treturn new Plot( arguments[0], arguments[1], arguments[2] );\n\t}\n\tself = this;\n\n\topts = defaults();\n\tif ( nargs === 0 ) {\n\t\toptions = {};\n\t} else if ( nargs === 1 ) {\n\t\toptions = arguments[ 0 ];\n\t\tif ( !isObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t} else if ( nargs === 2 ) {\n\t\toptions = {\n\t\t\t'x': arguments[ 0 ],\n\t\t\t'y': arguments[ 1 ]\n\t\t};\n\t} else if ( nargs > 2 ) {\n\t\tif ( !isObject( arguments[2] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', arguments[2] ) );\n\t\t}\n\t\toptions = copy( arguments[2] ); // avoid mutation\n\t\toptions.x = arguments[ 0 ];\n\t\toptions.y = arguments[ 1 ];\n\t}\n\topts = merge( opts, options );\n\n\tdebug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) );\n\tEventEmitter.call( this );\n\n\tfor ( i = 0; i < PRIVATE_PROPS.length; i++ ) {\n\t\tdefineProperty( this, PRIVATE_PROPS[i], {\n\t\t\t'configurable': false,\n\t\t\t'enumerable': false,\n\t\t\t'writable': true,\n\t\t\t'value': null\n\t\t});\n\t}\n\t// Set a clipping path id:\n\tdefineProperty( this, '_clipPathId', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': minstd().toString() // TODO: uuid\n\t});\n\n\t// Initialize an internal cache for renderers...\n\tdefineProperty( this, '$', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': {}\n\t});\n\tdefineProperty( this.$, 'svg', {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': {}\n\t});\n\n\t// Set options...\n\tkeys = objectKeys( opts );\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tkey = keys[ i ];\n\t\tthis[ key ] = opts[ key ];\n\t}\n\n\t// Add event listeners:\n\tthis.on( 'change', onChange );\n\tthis.on( 'render', onRender );\n\n\treturn this;\n\n\t/**\n\t* Callback invoked upon receiving a change event.\n\t*\n\t* @private\n\t*/\n\tfunction onChange() {\n\t\t/* eslint-disable no-underscore-dangle */\n\t\tdebug( 'Received a change event.' );\n\t\tif ( self._autoRender ) {\n\t\t\tself.render();\n\t\t}\n\t}\n\n\t/**\n\t* Callback invoked upon receiving a render event.\n\t*\n\t* @private\n\t* @param {*} plot - rendered plot\n\t*/\n\tfunction onRender( plot ) {\n\t\t/* eslint-disable no-underscore-dangle */\n\t\tdebug( 'Received a render event.' );\n\t\tif ( self._autoView ) {\n\t\t\tdebug( 'Viewer: %s.', self._viewer );\n\t\t\tdebug( 'Generating view...' );\n\t\t\tview( self, self._viewer, plot );\n\t\t}\n\t}\n}\n\n/*\n* Inherit from the `EventEmitter` prototype.\n*/\ninherit( Plot, EventEmitter );\n\n/**\n* `x` values.\n*\n* @name x\n* @memberof Plot.prototype\n* @type {Array}\n* @throws {TypeError} must be an array\n* @default []\n*\n* @example\n* var plot = new Plot();\n* plot.x = [ [ 1417563950959, 1417563952959 ] ];\n*\n* @example\n* var plot = new Plot({\n* 'x': [ [ 1417563950959, 1417563952959 ] ]\n* });\n* var x = plot.x;\n* // returns [ [ 1417563950959, 1417563952959 ] ]\n*/\ndefineProperty( Plot.prototype, 'x', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setX,\n\t'get': getX\n});\n\n/**\n* `y` values.\n*\n* @name y\n* @memberof Plot.prototype\n* @type {Array}\n* @throws {TypeError} must be an array\n* @default []\n*\n* @example\n* var plot = new Plot();\n* plot.x = [ [ 1417563950959, 1417563952959 ] ];\n* plot.y = [ [ 0.25, 0.23 ] ];\n*\n* @example\n* var plot = new Plot({\n* 'x': [ [ 1417563950959, 1417563952959 ] ],\n* 'y': [ [ 0.25, 0.23 ] ]\n* });\n* var y = plot.y;\n* // returns [ [ 0.25, 0.23 ] ]\n*/\ndefineProperty( Plot.prototype, 'y', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setY,\n\t'get': getY\n});\n\n/**\n* Data labels.\n*\n* @name labels\n* @memberof Plot.prototype\n* @type {(StringArray|EmptyArray)}\n* @throws {TypeError} must be either an array of strings or an empty array\n* @default []\n*\n* @example\n* var plot = new Plot();\n* plot.labels = [ 'beep', 'boop' ];\n*\n* @example\n* var plot = new Plot({\n* 'labels': [ 'beep', 'boop' ]\n* });\n* var labels = plot.labels;\n* // returns [ 'beep', 'boop' ]\n*/\ndefineProperty( Plot.prototype, 'labels', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setLabels,\n\t'get': getLabels\n});\n\n/**\n* Accessor which defines whether a datum is defined.\n*\n* ## Notes\n*\n* - This accessor is used to define how missing values are encoded.\n* - The default behavior is to ignore values which are `NaN`.\n*\n* @name isDefined\n* @memberof Plot.prototype\n* @type {Function}\n* @param {*} d - datum\n* @param {integer} i - index\n* @throws {TypeError} must be a function\n*\n* @example\n* var plot = new Plot();\n* plot.isDefined = function isDefined( d ) {\n* // Check for `NaN`:\n* return ( d === d );\n* }\n*\n* @example\n* function isDefined( d ) {\n* // Check for `NaN`:\n* return ( d === d );\n* }\n* var plot = new Plot({\n* 'isDefined': isDefined\n* });\n* var fcn = plot.isDefined;\n* // returns \n*/\ndefineProperty( Plot.prototype, 'isDefined', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setIsDefined,\n\t'get': getIsDefined\n});\n\n/**\n* Data colors. When retrieved, the returned value is always an `array`.\n*\n* @name colors\n* @memberof Plot.prototype\n* @type {(string|StringArray)}\n* @throws {TypeError} must be either a string or an array of strings\n* @default 'category10'\n*\n* @example\n* var plot = new Plot();\n* plot.colors = 'category20';\n*\n* @example\n* var plot = new Plot({\n* 'colors': 'category20'\n* });\n* var colors = plot.colors;\n* // returns [...]\n*/\ndefineProperty( Plot.prototype, 'colors', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setColors,\n\t'get': getColors\n});\n\n/**\n* Data line style(s).\n*\n* ## Notes\n*\n* - When retrieved, the returned value is always an `array`.\n*\n* @name lineStyle\n* @memberof Plot.prototype\n* @type {(string|StringArray)}\n* @throws {TypeError} must be a string or string array\n* @throws {Error} must be a supported line style\n* @default '-'\n*\n* @example\n* var plot = new Plot();\n* plot.lineStyle = [ '-', 'none' ];\n*\n* @example\n* var plot = new Plot({\n* 'lineStyle': 'none'\n* });\n* var lineStyle = plot.lineStyle;\n* // returns [ 'none' ]\n*/\ndefineProperty( Plot.prototype, 'lineStyle', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setLineStyle,\n\t'get': getLineStyle\n});\n\n/**\n* Data line opacity.\n*\n* ## Notes\n*\n* - When retrieved, the returned value is always an `array`.\n*\n* @name lineOpacity\n* @memberof Plot.prototype\n* @type {(number|NumberArray)}\n* @throws {TypeError} must be a number or number array\n* @throws {RangeError} must be a number on the interval `[0,1]`\n* @default '0.9'\n*\n* @example\n* var plot = new Plot();\n* plot.lineOpacity = [ 1.0, 0.5 ];\n*\n* @example\n* var plot = new Plot({\n* 'lineOpacity': 0.5\n* });\n* var opacity = plot.lineOpacity;\n* // returns [ 0.5 ]\n*/\ndefineProperty( Plot.prototype, 'lineOpacity', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setLineOpacity,\n\t'get': getLineOpacity\n});\n\n/**\n* Data line width.\n*\n* ## Notes\n*\n* - When retrieved, the returned value is always an `array`.\n*\n* @name lineWidth\n* @memberof Plot.prototype\n* @type {(NonNegativeInteger|NonNegativeIntegerArray)}\n* @throws {TypeError} must be a nonnegative integer or nonnegative integer array\n* @default 2\n*\n* @example\n* var plot = new Plot();\n* plot.lineWidth = 1;\n*\n* @example\n* var plot = new Plot({\n* 'lineWidth': [ 1, 3 ]\n* });\n* var width = plot.lineWidth;\n* // returns [ 1, 3 ]\n*/\ndefineProperty( Plot.prototype, 'lineWidth', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setLineWidth,\n\t'get': getLineWidth\n});\n\n/**\n* Data symbols. When retrieved, the returned value is always an `array`.\n*\n* @name symbols\n* @memberof Plot.prototype\n* @type {(string|StringArray)}\n* @throws {TypeError} must be a string or string array\n* @throws {Error} must be a supported symbol\n* @default 'none'\n*\n* @example\n* var plot = new Plot();\n* plot.symbols = [ 'open-circle', 'closed-circle' ];\n*\n* @example\n* var plot = new Plot({\n* 'symbols': 'closed-circle'\n* });\n* var symbols = plot.symbols;\n* // returns [ 'closed-circle' ]\n*/\ndefineProperty( Plot.prototype, 'symbols', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setSymbols,\n\t'get': getSymbols\n});\n\n/**\n* Symbols size. When retrieved, the returned value is always an `array`.\n*\n* @name symbolsSize\n* @memberof Plot.prototype\n* @type {(NonNegativeInteger|NonNegativeIntegerArray)}\n* @throws {TypeError} must be a nonnegative integer or nonnegative integer array\n* @default 6\n*\n* @example\n* var plot = new Plot();\n* plot.symbolsSize = 4;\n*\n* @example\n* var plot = new Plot({\n* 'symbolsSize': [ 4, 6 ]\n* });\n* var size = plot.symbolsSize;\n* // returns [ 4, 6 ]\n*/\ndefineProperty( Plot.prototype, 'symbolsSize', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setSymbolsSize,\n\t'get': getSymbolsSize\n});\n\n/**\n* Symbols opacity. When retrieved, the returned value is always an `array`.\n*\n* @name symbolsOpacity\n* @memberof Plot.prototype\n* @type {(number|NumberArray)}\n* @throws {TypeError} must be a number or number array\n* @throws {RangeError} must be a number on the interval `[0,1]`\n* @default 0.9\n*\n* @example\n* var plot = new Plot();\n* plot.symbolsOpacity = [ 0.2, 0.5 ];\n*\n* @example\n* var plot = new Plot({\n* 'symbolsOpacity': 0.2\n* });\n* var opacity = plot.symbolsOpacity;\n* // returns [ 0.2 ]\n*/\ndefineProperty( Plot.prototype, 'symbolsOpacity', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setSymbolsOpacity,\n\t'get': getSymbolsOpacity\n});\n\n/**\n* Plot width.\n*\n* @name width\n* @memberof Plot.prototype\n* @type {PositiveNumber}\n* @throws {TypeError} must be a positive number\n* @default 400 (px)\n*\n* @example\n* var plot = new Plot();\n* plot.width = 100;\n*\n* @example\n* var plot = new Plot({\n* 'width': 480\n* });\n* var width = plot.width;\n* // returns 480\n*/\ndefineProperty( Plot.prototype, 'width', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setWidth,\n\t'get': getWidth\n});\n\n/**\n* Plot height.\n*\n* @name height\n* @memberof Plot.prototype\n* @type {PositiveNumber}\n* @throws {TypeError} must be a positive number\n* @default 400 (px)\n*\n* @example\n* var plot = new Plot();\n* plot.height = 100;\n*\n* @example\n* var plot = new Plot({\n* 'height': 360\n* });\n* var height = plot.height;\n* // returns 360\n*/\ndefineProperty( Plot.prototype, 'height', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setHeight,\n\t'get': getHeight\n});\n\n/**\n* Plot left padding.\n*\n* ## Notes\n*\n* - Typically used to create space for a left-oriented y-axis.\n*\n* @name paddingLeft\n* @memberof Plot.prototype\n* @type {NonNegativeInteger}\n* @throws {TypeError} must be a nonnegative integer\n* @default 90 (px)\n*\n* @example\n* var plot = new Plot();\n* plot.paddingLeft = 100;\n*\n* @example\n* var plot = new Plot({\n* 'paddingLeft': 100\n* });\n* var padding = plot.paddingLeft;\n* // returns 100\n*/\ndefineProperty( Plot.prototype, 'paddingLeft', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setPaddingLeft,\n\t'get': getPaddingLeft\n});\n\n/**\n* Plot right padding.\n*\n* ## Notes\n*\n* - Typically used to create space for a right-oriented y-axis.\n*\n* @name paddingRight\n* @memberof Plot.prototype\n* @type {NonNegativeInteger}\n* @throws {TypeError} must be a nonnegative integer\n* @default 20 (px)\n*\n* @example\n* var plot = new Plot();\n* plot.paddingRight = 100;\n*\n* @example\n* var plot = new Plot({\n* 'paddingRight': 100\n* });\n* var padding = plot.paddingRight;\n* // returns 100\n*/\ndefineProperty( Plot.prototype, 'paddingRight', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setPaddingRight,\n\t'get': getPaddingRight\n});\n\n/**\n* Plot top padding.\n*\n* ## Notes\n*\n* - Typically used to create space for a title or top-oriented x-axis.\n*\n* @name paddingTop\n* @memberof Plot.prototype\n* @type {NonNegativeInteger}\n* @throws {TypeError} must be a nonnegative integer\n* @default 80 (px)\n*\n* @example\n* var plot = new Plot();\n* plot.paddingTop = 100;\n*\n* @example\n* var plot = new Plot({\n* 'paddingTop': 100\n* });\n* var padding = plot.paddingTop;\n* // returns 100\n*/\ndefineProperty( Plot.prototype, 'paddingTop', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setPaddingTop,\n\t'get': getPaddingTop\n});\n\n/**\n* Plot bottom padding.\n*\n* ## Notes\n*\n* - Typically used to create space for a bottom-oriented y-axis.\n*\n* @name paddingBottom\n* @memberof Plot.prototype\n* @type {NonNegativeInteger}\n* @throws {TypeError} must be a nonnegative integer\n* @default 80 (px)\n*\n* @example\n* var plot = new Plot();\n* plot.paddingBottom = 100;\n*\n* @example\n* var plot = new Plot({\n* 'paddingBottom': 100\n* });\n* var padding = plot.paddingBottom;\n* // returns 100\n*/\ndefineProperty( Plot.prototype, 'paddingBottom', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setPaddingBottom,\n\t'get': getPaddingBottom\n});\n\n/**\n* Minimum value of the x-axis domain.\n*\n* ## Notes\n*\n* - When retrieved, if the value has been set to `null`, the returned value is computed from the `x` data.\n*\n* @name xMin\n* @memberof Plot.prototype\n* @type {(FiniteNumber|null)}\n* @throws {TypeError} must be a finite number or null\n* @default null\n*\n* @example\n* var plot = new Plot();\n* plot.xMin = -1.0;\n*\n* @example\n* var plot = new Plot({\n* 'xMin': -10.0\n* });\n* var xmin = plot.xMin;\n* // returns -10.0\n*/\ndefineProperty( Plot.prototype, 'xMin', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setXMin,\n\t'get': getXMin\n});\n\n/**\n* Maximum value of the x-axis domain.\n*\n* ## Notes\n*\n* - When retrieved, if the value has been set to `null`, the returned value is computed from the `x` data.\n*\n* @name xMax\n* @memberof Plot.prototype\n* @type {(FiniteNumber|null)}\n* @throws {TypeError} must be a finite number or null\n* @default null\n*\n* @example\n* var plot = new Plot();\n* plot.xMax = 100.0;\n*\n* @example\n* var plot = new Plot({\n* 'xMax': 10.0\n* });\n* var xmax = plot.xMax;\n* // returns 10.0\n*/\ndefineProperty( Plot.prototype, 'xMax', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setXMax,\n\t'get': getXMax\n});\n\n/**\n* Minimum value of the y-axis domain.\n*\n* ## Notes\n*\n* - When retrieved, if the value has been set to `null`, the returned value is computed from the `y` data.\n*\n* @name yMin\n* @memberof Plot.prototype\n* @type {(FiniteNumber|null)}\n* @throws {TypeError} must be a finite number or null\n* @default null\n*\n* @example\n* var plot = new Plot();\n* plot.yMin = -100.0;\n*\n* @example\n* var plot = new Plot({\n* 'yMin': 3.14\n* });\n* var ymin = plot.yMin;\n* // returns 3.14\n*/\ndefineProperty( Plot.prototype, 'yMin', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setYMin,\n\t'get': getYMin\n});\n\n/**\n* Maximum value of the y-axis domain.\n*\n* ## Notes\n*\n* - When retrieved, if the value has been set to `null`, the returned value is computed from the `y` data.\n*\n* @name yMax\n* @memberof Plot.prototype\n* @type {(FiniteNumber|null)}\n* @throws {TypeError} must be a finite number or null\n* @default null\n*\n* @example\n* var plot = new Plot();\n* plot.yMax = 100.0;\n*\n* @example\n* var plot = new Plot({\n* 'yMax': 31.4\n* });\n* var ymax = plot.yMax;\n* // returns 31.4\n*/\ndefineProperty( Plot.prototype, 'yMax', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setYMax,\n\t'get': getYMax\n});\n\n/**\n* Scale function for mapping values to a coordinate along the x-axis. When retrieved, the returned value is a scale function.\n*\n* @name xScale\n* @memberof Plot.prototype\n* @type {string}\n* @throws {TypeError} must be a string\n* @default 'linear'\n*\n* @example\n* var plot = new Plot();\n* plot.xScale = 'time';\n*\n* @example\n* var plot = new Plot({\n* 'xScale': 'time'\n* });\n* var scale = plot.xScale;\n* // returns \n*/\ndefineProperty( Plot.prototype, 'xScale', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setXScale,\n\t'get': getXScale\n});\n\n/**\n* Scale function for mapping values to a coordinate along the y-axis. When retrieved, the returned value is a scale function.\n*\n* @name yScale\n* @memberof Plot.prototype\n* @type {string}\n* @throws {TypeError} must be a string\n* @default 'linear'\n*\n* @example\n* var plot = new Plot();\n* plot.yScale = 'linear';\n*\n* @example\n* var plot = new Plot({\n* 'yScale': 'linear'\n* });\n* var scale = plot.yScale;\n* // returns \n*/\ndefineProperty( Plot.prototype, 'yScale', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setYScale,\n\t'get': getYScale\n});\n\n/**\n* x-axis tick format.\n*\n* ## Notes\n*\n* - When retrieved, if the value is not `null`, the returned value is a formatting function.\n*\n* @name xTickFormat\n* @memberof Plot.prototype\n* @type {(string|null)}\n* @throws {TypeError} must be a string or null\n* @default null\n*\n* @example\n* var plot = new Plot();\n* plot.xScale = 'time';\n* plot.xTickFormat = '%H:%M';\n*\n* @example\n* var plot = new Plot({\n* 'xScale': 'time',\n* 'xTickFormat': '%H:%M'\n* });\n* var fmt = plot.xTickFormat;\n* // returns \n*/\ndefineProperty( Plot.prototype, 'xTickFormat', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setXTickFormat,\n\t'get': getXTickFormat\n});\n\n/**\n* y-axis tick format.\n*\n* ## Notes\n*\n* - If the value is not `null`, when retrieved, the returned value is a formatting function.\n*\n* @name yTickFormat\n* @memberof Plot.prototype\n* @type {(string|null)}\n* @throws {TypeError} must be a string or null\n* @default null\n*\n* @example\n* var plot = new Plot();\n* plot.yTickFormat = '.0%';\n*\n* @example\n* var plot = new Plot({\n* 'yTickFormat': '.0%'\n* });\n* var fmt = plot.yTickFormat;\n* // returns \n*/\ndefineProperty( Plot.prototype, 'yTickFormat', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setYTickFormat,\n\t'get': getYTickFormat\n});\n\n/**\n* Number of x-axis tick marks.\n*\n* @name xNumTicks\n* @memberof Plot.prototype\n* @type {(NonNegativeInteger|null)}\n* @throws {TypeError} must be a nonnegative integer or null\n* @default 5\n*\n* @example\n* var plot = new Plot();\n* plot.xNumTicks = 10;\n*\n* @example\n* var plot = new Plot({\n* 'xNumTicks': 10\n* });\n* var ticks = plot.xNumTicks;\n* // returns 10\n*/\ndefineProperty( Plot.prototype, 'xNumTicks', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setXNumTicks,\n\t'get': getXNumTicks\n});\n\n/**\n* Number of y-axis tick marks.\n*\n* @name yNumTicks\n* @memberof Plot.prototype\n* @type {(NonNegativeInteger|null)}\n* @throws {TypeError} must be a nonnegative integer or null\n* @default 5\n*\n* @example\n* var plot = new Plot();\n* plot.yNumTicks = 10;\n*\n* @example\n* var plot = new Plot({\n* 'yNumTicks': 10\n* });\n* var ticks = plot.yNumTicks;\n* // returns 10\n*/\ndefineProperty( Plot.prototype, 'yNumTicks', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setYNumTicks,\n\t'get': getYNumTicks\n});\n\n/**\n* x-axis orientation.\n*\n* @name xAxisOrient\n* @memberof Plot.prototype\n* @type {string}\n* @throws {TypeError} must be either `'top'` or `'bottom'`\n* @default 'bottom'\n*\n* @example\n* var plot = new Plot();\n* plot.xAxisOrient = 'bottom';\n*\n* @example\n* var plot = new Plot({\n* 'xAxisOrient': 'bottom'\n* });\n* var orientation = plot.xAxisOrient;\n* // returns 'bottom'\n*/\ndefineProperty( Plot.prototype, 'xAxisOrient', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setXAxisOrient,\n\t'get': getXAxisOrient\n});\n\n/**\n* y-axis orientation.\n*\n* @name yAxisOrient\n* @memberof Plot.prototype\n* @type {string}\n* @throws {TypeError} must be either `'left'` or `'right'`\n* @default 'left'\n*\n* @example\n* var plot = new Plot();\n* plot.yAxisOrient = 'left';\n*\n* @example\n* var plot = new Plot({\n* 'yAxisOrient': 'left'\n* });\n* var orientation = plot.yAxisOrient;\n* // returns 'left'\n*/\ndefineProperty( Plot.prototype, 'yAxisOrient', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setYAxisOrient,\n\t'get': getYAxisOrient\n});\n\n/**\n* Boolean flag(s) indicating whether to display a rug plot along the x-axis. When retrieved, the returned value is always an `array`.\n*\n* @name xRug\n* @memberof Plot.prototype\n* @type {(boolean|BooleanArray)}\n* @throws {TypeError} must be a boolean or boolean array\n* @default false\n*\n* @example\n* var plot = new Plot({\n* 'xRug': true\n* });\n*\n* var bool = plot.xRug;\n* // returns [ true ]\n*/\ndefineProperty( Plot.prototype, 'xRug', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setXRug,\n\t'get': getXRug\n});\n\n/**\n* Boolean flag(s) indicating whether to display a rug plot along the y-axis. When retrieved, the returned value is always an `array`.\n*\n* @name yRug\n* @memberof Plot.prototype\n* @type {(boolean|BooleanArray)}\n* @throws {TypeError} must be a boolean or boolean array\n* @default false\n*\n* @example\n* var plot = new Plot({\n* 'yRug': true\n* });\n*\n* var bool = plot.yRug;\n* // returns [ true ]\n*/\ndefineProperty( Plot.prototype, 'yRug', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setYRug,\n\t'get': getYRug\n});\n\n/**\n* x-axis rug orientation. When retrieved, the returned value is always an `array`.\n*\n* @name xRugOrient\n* @memberof Plot.prototype\n* @type {(string|StringArray)}\n* @throws {TypeError} must be a string or string array\n* @throws {TypeError} must be either `'top'` or `'bottom'`\n* @default 'bottom'\n*\n* @example\n* var plot = new Plot();\n* plot.xRugOrient = [ 'bottom', 'top' ];\n*\n* @example\n* var plot = new Plot({\n* 'xRugOrient': 'bottom'\n* });\n* var orientation = plot.xRugOrient;\n* // returns [ 'bottom' ]\n*/\ndefineProperty( Plot.prototype, 'xRugOrient', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setXRugOrient,\n\t'get': getXRugOrient\n});\n\n/**\n* y-axis rug orientation. When retrieved, the returned value is always an `array`.\n*\n* @name yRugOrient\n* @memberof Plot.prototype\n* @type {(string|StringArray)}\n* @throws {TypeError} must be a string or string array\n* @throws {TypeError} must be either `'left'` or `'right'`\n* @default 'left'\n*\n* @example\n* var plot = new Plot();\n* plot.yRugOrient = [ 'right', 'left' ];\n*\n* @example\n* var plot = new Plot({\n* 'yRugOrient': 'left'\n* });\n* var orientation = plot.yRugOrient;\n* // returns [ 'left' ]\n*/\ndefineProperty( Plot.prototype, 'yRugOrient', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setYRugOrient,\n\t'get': getYRugOrient\n});\n\n/**\n* x-axis rug opacity. When retrieved, the returned value is always an `array`.\n*\n* @name xRugOpacity\n* @memberof Plot.prototype\n* @type {(number|NumberArray)}\n* @throws {TypeError} must be a number or number array\n* @throws {RangeError} must be a number on the interval `[0,1]`\n* @default 0.1\n*\n* @example\n* var plot = new Plot();\n* plot.xRugOpacity = [ 0.1, 0.5 ];\n*\n* @example\n* var plot = new Plot({\n* 'xRugOpacity': 0.1\n* });\n* var opacity = plot.xRugOpacity;\n* // returns [ 0.1 ]\n*/\ndefineProperty( Plot.prototype, 'xRugOpacity', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setXRugOpacity,\n\t'get': getXRugOpacity\n});\n\n/**\n* y-axis rug opacity. When retrieved, the returned value is always an `array`.\n*\n* @name yRugOpacity\n* @memberof Plot.prototype\n* @type {(number|NumberArray)}\n* @throws {TypeError} must be a number or number array\n* @throws {RangeError} must be a number on the interval `[0,1]`\n* @default 0.1\n*\n* @example\n* var plot = new Plot();\n* plot.yRugOpacity = [ 0.1, 0.5 ];\n*\n* @example\n* var plot = new Plot({\n* 'yRugOpacity': 0.1\n* });\n* var opacity = plot.yRugOpacity;\n* // returns [ 0.1 ]\n*/\ndefineProperty( Plot.prototype, 'yRugOpacity', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setYRugOpacity,\n\t'get': getYRugOpacity\n});\n\n/**\n* x-axis rug tick (tassel) size. When retrieved, the returned value is always an `array`.\n*\n* @name xRugSize\n* @memberof Plot.prototype\n* @type {(NonNegativeInteger|Array)}\n* @throws {TypeError} must be a nonnegative integer or nonnegative integer array\n* @default 6\n*\n* @example\n* var plot = new Plot();\n* plot.xRugSize = [ 4, 6 ];\n*\n* @example\n* var plot = new Plot({\n* 'xRugSize': 4\n* });\n* var size = plot.xRugSize;\n* // returns [ 4 ]\n*/\ndefineProperty( Plot.prototype, 'xRugSize', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setXRugSize,\n\t'get': getXRugSize\n});\n\n/**\n* y-axis rug tick (tassel) size. When retrieved, the returned value is always an `array`.\n*\n* @name yRugSize\n* @memberof Plot.prototype\n* @type {(NonNegativeInteger|Array)}\n* @throws {TypeError} must be a nonnegative integer or nonnegative integer array\n* @default 6\n*\n* @example\n* var plot = new Plot();\n* plot.yRugSize = [ 4, 6 ];\n*\n* @example\n* var plot = new Plot({\n* 'yRugSize': 4\n* });\n* var size = plot.yRugSize;\n* // returns [ 4 ]\n*/\ndefineProperty( Plot.prototype, 'yRugSize', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setYRugSize,\n\t'get': getYRugSize\n});\n\n/**\n* Plot description.\n*\n* @name description\n* @memberof Plot.prototype\n* @type {string}\n* @throws {TypeError} must be a string\n* @default ''\n*\n* @example\n* var plot = new Plot();\n* plot.description = 'Average stock market index covering the last 100 years.';\n*\n* @example\n* var plot = new Plot({\n* 'description': 'A plot description.'\n* });\n* var desc = plot.description;\n* // returns 'A plot description.'\n*/\ndefineProperty( Plot.prototype, 'description', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setDescription,\n\t'get': getDescription\n});\n\n/**\n* Plot title.\n*\n* @name title\n* @memberof Plot.prototype\n* @type {string}\n* @throws {TypeError} must be a string\n* @default ''\n*\n* @example\n* var plot = new Plot();\n* plot.title = 'Time Series';\n*\n* @example\n* var plot = new Plot({\n* 'title': 'Time Series'\n* });\n* var t = plot.title;\n* // returns 'Time Series'\n*/\ndefineProperty( Plot.prototype, 'title', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setTitle,\n\t'get': getTitle\n});\n\n/**\n* x-axis label.\n*\n* @name xLabel\n* @memberof Plot.prototype\n* @type {string}\n* @throws {TypeError} must be a string\n* @default 'x'\n*\n* @example\n* var plot = new Plot();\n* plot.xLabel = 'time';\n*\n* @example\n* var plot = new Plot({\n* 'xLabel': 'time'\n* });\n* var xLabel = plot.xLabel;\n* // returns 'time'\n*/\ndefineProperty( Plot.prototype, 'xLabel', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setXLabel,\n\t'get': getXLabel\n});\n\n/**\n* y-axis label.\n*\n* @name yLabel\n* @memberof Plot.prototype\n* @type {string}\n* @throws {TypeError} must be a string\n* @default 'y'\n*\n* @example\n* var plot = new Plot();\n* plot.yLabel = 'value';\n*\n* @example\n* var plot = new Plot({\n* 'yLabel': 'value'\n* });\n* var yLabel = plot.yLabel;\n* // returns 'value'\n*/\ndefineProperty( Plot.prototype, 'yLabel', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setYLabel,\n\t'get': getYLabel\n});\n\n/**\n* Plot engine.\n*\n* @name engine\n* @memberof Plot.prototype\n* @type {string}\n* @throws {TypeError} must be a recognized engine\n* @default 'svg'\n*\n* @example\n* var plot = new Plot();\n* plot.engine = 'svg';\n*\n* @example\n* var plot = new Plot({\n* 'engine': 'svg'\n* });\n* var engine = plot.engine;\n* // returns 'svg'\n*/\ndefineProperty( Plot.prototype, 'engine', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setEngine,\n\t'get': getEngine\n});\n\n/**\n* Rendering mode.\n*\n* ## Notes\n*\n* - If `true`, an instance re-renders on each change event.\n*\n* @name autoRender\n* @memberof Plot.prototype\n* @type {boolean}\n* @throws {TypeError} must be a boolean\n* @default false\n*\n* @example\n* var plot = new Plot({\n* 'autoRender': true\n* });\n*\n* var mode = plot.autoRender;\n* // returns true\n*/\ndefineProperty( Plot.prototype, 'autoRender', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setAutoRender,\n\t'get': getAutoRender\n});\n\n/**\n* Plot render format.\n*\n* @name renderFormat\n* @memberof Plot.prototype\n* @type {string}\n* @throws {TypeError} must be a recognized format\n* @default 'vdom'\n*\n* @example\n* var plot = new Plot();\n* plot.renderFormat = 'vdom';\n*\n* @example\n* var plot = new Plot({\n* 'renderFormat': 'html'\n* });\n* var fmt = plot.renderFormat;\n* // returns 'html'\n*/\ndefineProperty( Plot.prototype, 'renderFormat', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setRenderFormat,\n\t'get': getRenderFormat\n});\n\n/**\n* Plot viewer.\n*\n* @name viewer\n* @memberof Plot.prototype\n* @type {string}\n* @throws {TypeError} must be a recognized viewer\n* @default 'none'\n*\n* @example\n* var plot = new Plot();\n* plot.viewer = 'none';\n*\n* @example\n* var plot = new Plot({\n* 'viewer': 'none'\n* });\n* var viewer = plot.viewer;\n* // returns 'none'\n*/\ndefineProperty( Plot.prototype, 'viewer', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setViewer,\n\t'get': getViewer\n});\n\n/**\n* Viewer mode. If `true`, an instance generates an updated view on each render event.\n*\n* @name autoView\n* @memberof Plot.prototype\n* @type {boolean}\n* @throws {TypeError} must be a boolean\n* @default false\n*\n* @example\n* var plot = new Plot({\n* 'autoView': false\n* });\n*\n* var mode = plot.autoView;\n* // returns false\n*/\ndefineProperty( Plot.prototype, 'autoView', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'set': setAutoView,\n\t'get': getAutoView\n});\n\n/**\n* Expected graph width.\n*\n* @name graphWidth\n* @memberof Plot.prototype\n* @type {number}\n*\n* @example\n* var plot = new Plot({\n* 'width': 100,\n* 'paddingLeft': 10,\n* 'paddingRight': 10\n* });\n* var width = plot.graphWidth;\n* // returns 80\n*/\ndefineProperty( Plot.prototype, 'graphWidth', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getGraphWidth\n});\n\n/**\n* Expected graph height.\n*\n* @name graphHeight\n* @memberof Plot.prototype\n* @type {number}\n*\n* @example\n* var plot = new Plot({\n* 'height': 100,\n* 'paddingTop': 10,\n* 'paddingBottom': 20\n* });\n* var height = plot.graphHeight;\n* // returns 70\n*/\ndefineProperty( Plot.prototype, 'graphHeight', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getGraphHeight\n});\n\n/**\n* x-axis domain.\n*\n* @name xDomain\n* @memberof Plot.prototype\n* @type {Array}\n*\n* @example\n* var plot = new Plot({\n* 'xMin': 0,\n* 'xMax': 100\n* });\n* var domain = plot.xDomain;\n* // returns [ 0, 100 ]\n*/\ndefineProperty( Plot.prototype, 'xDomain', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getXDomain\n});\n\n/**\n* y-axis domain.\n*\n* @name yDomain\n* @memberof Plot.prototype\n* @type {NumberArray}\n*\n* @example\n* var plot = new Plot({\n* 'yMin': 0,\n* 'yMax': 100\n* });\n* var domain = plot.yDomain;\n* // returns [ 0, 100 ]\n*/\ndefineProperty( Plot.prototype, 'yDomain', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getYDomain\n});\n\n/**\n* x-axis range.\n*\n* @name xRange\n* @memberof Plot.prototype\n* @type {NumberArray}\n*\n* @example\n* var plot = new Plot({\n* 'width': 100,\n* 'paddingLeft': 10,\n* 'paddingRight': 10\n* });\n* var range = plot.xRange;\n* // returns [ 0, 80 ]\n*/\ndefineProperty( Plot.prototype, 'xRange', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getXRange\n});\n\n/**\n* y-axis range.\n*\n* @name yRange\n* @memberof Plot.prototype\n* @type {NumberArray}\n*\n* @example\n* var plot = new Plot({\n* 'height': 100,\n* 'paddingTop': 10,\n* 'paddingBottom': 20\n* });\n* var range = plot.yRange;\n* // returns [ 70, 0 ]\n*/\ndefineProperty( Plot.prototype, 'yRange', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getYRange\n});\n\n/**\n* Function to map values to x-axis coordinate values.\n*\n* @name xPos\n* @memberof Plot.prototype\n* @type {Function}\n*\n* @example\n* var plot = new Plot();\n* var xPos = plot.xPos;\n* // returns \n*/\ndefineProperty( Plot.prototype, 'xPos', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getXPos\n});\n\n/**\n* Function to map values to y-axis coordinate values.\n*\n* @name yPos\n* @memberof Plot.prototype\n* @type {Function}\n*\n* @example\n* var plot = new Plot();\n* var yPos = plot.yPos;\n* // returns \n*/\ndefineProperty( Plot.prototype, 'yPos', {\n\t'configurable': false,\n\t'enumerable': true,\n\t'get': getYPos\n});\n\n/**\n* Renders a plot.\n*\n* @name render\n* @memberof Plot.prototype\n* @type {Function}\n* @param {string} [format] - render format\n* @throws {TypeError} must provide a recognized format\n* @returns {(VTree|string)} virtual tree or string\n*\n* @example\n* var plot = new Plot();\n* plot.x = [ [ 1, 2, 3 ] ];\n* plot.y = [ [ 1, 0, 1 ] ];\n*\n* var out = plot.render();\n*\n* @example\n* var plot = new Plot();\n* plot.x = [ [ 1, 2, 3 ] ];\n* plot.y = [ [ 1, 0, 1 ] ];\n*\n* var out = plot.render( 'html' );\n*/\nsetReadOnly( Plot.prototype, 'render', render );\n\n/**\n* Generates a plot view.\n*\n* @name view\n* @memberof Plot.prototype\n* @type {Function}\n* @param {string} [viewer]\n* @throws {TypeError} must provide a recognized viewer\n*\n* @example\n* var plot = new Plot();\n* plot.x = [ [ 1, 2, 3 ] ];\n* plot.y = [ [ 1, 0, 1 ] ];\n*\n* plot.view( 'stdout' );\n*/\nsetReadOnly( Plot.prototype, 'view', viewMethod );\n\n\n// EXPORTS //\n\nexport default Plot;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isNodeREPL from '@stdlib/assert/is-node-repl';\nimport isDefined from './accessors/is_defined.js';\n\n\n// MAIN //\n\n/**\n* Returns default options.\n*\n* @private\n* @returns {Object} default options\n*/\nfunction defaults() {\n\tvar isREPL;\n\tvar o;\n\n\tisREPL = isNodeREPL();\n\to = {};\n\n\t// Boolean indicating whether to re-render on a change event:\n\to.autoRender = false;\n\n\t// Boolean indicating whether to generate an updated view on a render event:\n\to.autoView = false;\n\n\t// Data colors:\n\to.colors = 'category10';\n\n\t// Plot description:\n\to.description = '';\n\n\t// Plot engine:\n\to.engine = 'svg';\n\n\t// Plot height:\n\to.height = 400; // px\n\n\t// Accessor indicating whether a datum is defined:\n\to.isDefined = isDefined;\n\n\t// Data labels:\n\to.labels = [];\n\n\t// Data line opacity:\n\to.lineOpacity = 0.9; // [0,1]\n\n\t// Data line style(s):\n\to.lineStyle = '-';\n\n\t// Data line width(s):\n\to.lineWidth = 2; // px\n\n\t// FIXME: padding props depend on orientation (may require using `null` to flag)\n\n\t// Bottom padding:\n\to.paddingBottom = 80; // px\n\n\t// Left padding:\n\to.paddingLeft = 90; // px\n\n\t// Right padding:\n\to.paddingRight = 20; // px\n\n\t// Top padding:\n\to.paddingTop = 80; // px\n\n\t// Render format:\n\to.renderFormat = 'vdom';\n\n\t// Data symbols:\n\to.symbols = 'none';\n\n\t// Symbols opacity:\n\to.symbolsOpacity = 0.9; // [0,1]\n\n\t// Symbols size:\n\to.symbolsSize = 6; // px\n\n\t// Plot title:\n\to.title = '';\n\n\t// Plot viewer:\n\tif ( isREPL ) {\n\t\to.viewer = 'window';\n\t} else {\n\t\to.viewer = 'none';\n\t}\n\t// Plot width:\n\to.width = 400; // px\n\n\t// x-values:\n\to.x = [];\n\n\t// x-axis orientation:\n\to.xAxisOrient = 'bottom';\n\n\t// x-axis label:\n\to.xLabel = 'x';\n\n\t// Maximum value of x-axis domain:\n\to.xMax = null;\n\n\t// Minimum value of x-axis domain:\n\to.xMin = null;\n\n\t// Number of x-axis tick marks:\n\to.xNumTicks = 5;\n\n\t// Boolean indicating whether to render a rug plot along the x-axis:\n\to.xRug = false;\n\n\t// x-axis rug orientation:\n\to.xRugOrient = 'bottom';\n\n\t// x-axis rug opacity:\n\to.xRugOpacity = 0.1; // [0,1]\n\n\t// x-axis rug tick (tassel) size:\n\to.xRugSize = 6; // px\n\n\t// x-axis scale:\n\to.xScale = 'linear';\n\n\t// x-axis tick format:\n\to.xTickFormat = null;\n\n\t// y-values:\n\to.y = [];\n\n\t// y-axis orientation:\n\to.yAxisOrient = 'left';\n\n\t// y-axis label:\n\to.yLabel = 'y';\n\n\t// Maximum value of y-axis domain:\n\to.yMax = null;\n\n\t// Minimum value of y-axis domain:\n\to.yMin = null;\n\n\t// Number of y-axis tick marks:\n\to.yNumTicks = 5;\n\n\t// Boolean indicating whether to render a rug plot along the y-axis:\n\to.yRug = false;\n\n\t// y-axis rug orientation:\n\to.yRugOrient = 'left';\n\n\t// y-axis rug opacity:\n\to.yRugOpacity = 0.1; // [0,1]\n\n\t// y-axis rug tick (tassel) size:\n\to.yRugSize = 6; // px\n\n\t// y-axis scale:\n\to.yScale = 'linear';\n\n\t// y-axis tick format:\n\to.yTickFormat = null;\n\n\treturn o;\n}\n\n\n// EXPORTS //\n\nexport default defaults;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the plot `x` values.\n*\n* @private\n* @returns {Array} x values\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._xData.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the plot `y` values.\n*\n* @private\n* @returns {Array} y values\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._yData.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the data labels.\n*\n* @private\n* @returns {(EmptyArray|StringArray)} labels\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._labels.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the accessor for defined values.\n*\n* @private\n* @returns {Function} accessor\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._isDefined;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the data colors.\n*\n* @private\n* @returns {StringArray} colors\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._colors.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the data line style(s).\n*\n* @private\n* @returns {StringArray} line style(s)\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._lineStyle.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the data line opacity.\n*\n* @private\n* @returns {NumberArray} line opacity\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._lineOpacity.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the data line width.\n*\n* @private\n* @returns {Array} line width(s)\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._lineWidth.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the data symbols.\n*\n* @private\n* @returns {StringArray} symbols\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._symbols.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the symbols size.\n*\n* @private\n* @returns {Array} symbols sizes\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._symbolsSize.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the symbols opacity.\n*\n* @private\n* @returns {NumberArray} symbols opacity\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._symbolsOpacity.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the width.\n*\n* @private\n* @returns {number} width\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._width;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the height.\n*\n* @private\n* @returns {number} height\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._height;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the left padding.\n*\n* @private\n* @returns {number} padding\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._paddingLeft;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the right padding.\n*\n* @private\n* @returns {number} padding\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._paddingRight;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the top padding.\n*\n* @private\n* @returns {number} padding\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._paddingTop;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the bottom padding.\n*\n* @private\n* @returns {number} padding\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._paddingBottom;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isNull from '@stdlib/assert/is-null';\nimport min from './../../utils/min.js'; // TODO: replace with mod when written\n\n\n// FUNCTIONS //\n\n/**\n* Computes a minimum value.\n*\n* @private\n* @param {Array} arr - input array\n* @returns {(number|null)} minimum value or null\n*/\nfunction getMin( arr ) {\n\tvar tmp;\n\tvar i;\n\tif ( arr.length === 0 ) {\n\t\treturn null;\n\t}\n\ttmp = new Array( arr.length );\n\tfor ( i = 0; i < arr.length; i++ ) {\n\t\ttmp[ i ] = min( arr[ i ] );\n\t}\n\treturn min( tmp );\n}\n\n\n// MAIN //\n\n/**\n* Returns the minimum value of the x-axis domain.\n*\n* @private\n* @returns {number} minimum value\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar min;\n\tif ( isNull( this._xMin ) ) {\n\t\tmin = getMin( this._xData );\n\t\treturn ( isNull( min ) ) ? 0.0 : min;\n\t}\n\treturn this._xMin;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isNull from '@stdlib/assert/is-null';\nimport max from './../../utils/max.js'; // TODO: replace with stdlib package import when added\n\n\n// FUNCTIONS //\n\n/**\n* Computes a maximum value.\n*\n* @private\n* @param {Array} arr - input array\n* @returns {(number|null)} maximum value or null\n*/\nfunction getMax( arr ) {\n\tvar tmp;\n\tvar i;\n\tif ( arr.length === 0 ) {\n\t\treturn null;\n\t}\n\ttmp = [];\n\tfor ( i = 0; i < arr.length; i++ ) {\n\t\ttmp.push( max( arr[ i ] ) );\n\t}\n\treturn max( tmp );\n}\n\n\n// MAIN //\n\n/**\n* Returns the maximum value of the x-axis domain.\n*\n* @private\n* @returns {number} maximum value\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar max;\n\tif ( isNull( this._xMax ) ) {\n\t\tmax = getMax( this._xData );\n\t\treturn ( isNull( max ) ) ? 1.0 : max;\n\t}\n\treturn this._xMax;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isNull from '@stdlib/assert/is-null';\nimport min from './../../utils/min.js'; // TODO: replace with mod when written\n\n\n// FUNCTIONS //\n\n/**\n* Computes a minimum value.\n*\n* @private\n* @param {Array} arr - input array\n* @returns {(number|null)} minimum value or null\n*/\nfunction getMin( arr ) {\n\tvar tmp;\n\tvar i;\n\tif ( arr.length === 0 ) {\n\t\treturn null;\n\t}\n\ttmp = new Array( arr.length );\n\tfor ( i = 0; i < arr.length; i++ ) {\n\t\ttmp[ i ] = min( arr[ i ] );\n\t}\n\treturn min( tmp );\n}\n\n\n// MAIN //\n\n/**\n* Returns the minimum value of the y-axis domain.\n*\n* @private\n* @returns {number} minimum value\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar min;\n\tif ( isNull( this._yMin ) ) {\n\t\tmin = getMin( this._yData );\n\t\treturn ( isNull( min ) ) ? 0.0 : min;\n\t}\n\treturn this._yMin;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isNull from '@stdlib/assert/is-null';\nimport max from './../../utils/max.js'; // TODO: replace with mod when written\n\n\n// FUNCTIONS //\n\n/**\n* Computes a maximum value.\n*\n* @private\n* @param {Array} arr - input array\n* @returns {(number|null)} maximum value or null\n*/\nfunction getMax( arr ) {\n\tvar tmp;\n\tvar i;\n\tif ( arr.length === 0 ) {\n\t\treturn null;\n\t}\n\ttmp = new Array( arr.length );\n\tfor ( i = 0; i < arr.length; i++ ) {\n\t\ttmp[ i ] = max( arr[ i ] );\n\t}\n\treturn max( tmp );\n}\n\n\n// MAIN //\n\n/**\n* Returns the maximum value of the y-axis domain.\n*\n* @private\n* @returns {number} maximum value\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar max;\n\tif ( isNull( this._yMax ) ) {\n\t\tmax = getMax( this._yData );\n\t\treturn ( isNull( max ) ) ? 1.0 : max;\n\t}\n\treturn this._yMax;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the number of x-axis tick marks.\n*\n* @private\n* @returns {(NonNegativeInteger|null)} number of ticks\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._xNumTicks;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the number of y-axis tick marks.\n*\n* @private\n* @returns {(NonNegativeInteger|null)} number of ticks\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._yNumTicks;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the x-axis orientation.\n*\n* @private\n* @returns {string} orientation\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._xAxisOrient;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the y-axis orientation.\n*\n* @private\n* @returns {string} orientation\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._yAxisOrient;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns whether a rug plot is displayed along the x-axis.\n*\n* @private\n* @returns {BooleanArray} boolean flags\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._xRug.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns whether a rug plot is displayed along the y-axis.\n*\n* @private\n* @returns {BooleanArray} boolean flag\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._yRug.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the x-axis rug orientation.\n*\n* @private\n* @returns {StringArray} orientation\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._xRugOrient.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the y-axis rug orientation.\n*\n* @private\n* @returns {StringArray} orientation\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._yRugOrient.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the x-axis rug opacity.\n*\n* @private\n* @returns {NumberArray} rug opacities\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._xRugOpacity.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the y-axis rug opacity.\n*\n* @private\n* @returns {NumberArray} rug opacities\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._yRugOpacity.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the x-axis rug tick (tassel) size.\n*\n* @private\n* @returns {Array} tick sizes\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._xRugSize.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the y-axis rug tick (tassel) size.\n*\n* @private\n* @returns {Array} tick sizes\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._yRugSize.slice();\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the description.\n*\n* @private\n* @returns {string} description\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._description;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the title.\n*\n* @private\n* @returns {string} title\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._title;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the x-axis label.\n*\n* @private\n* @returns {string} label\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._xLabel;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the y-axis label.\n*\n* @private\n* @returns {string} label\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._yLabel;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the plot engine.\n*\n* @private\n* @returns {string} engine\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._engine;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the rendering mode.\n*\n* @private\n* @returns {boolean} rendering mode\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._autoRender;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the render format.\n*\n* @private\n* @returns {string} format\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._renderFormat;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the plot viewer.\n*\n* @private\n* @returns {string} viewer\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._viewer;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the viewing mode.\n*\n* @private\n* @returns {boolean} viewing mode\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._autoView;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the expected graph width.\n*\n* @private\n* @returns {number} graph width\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._width - this._paddingLeft - this._paddingRight;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the expected graph height.\n*\n* @private\n* @returns {number} graph height\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn this._height - this._paddingTop - this._paddingBottom;\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the x-axis domain.\n*\n* @private\n* @returns {Array} domain\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn [ this.xMin, this.xMax ];\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the y-axis domain.\n*\n* @private\n* @returns {Array} domain\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn [ this.yMin, this.yMax ];\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the x-axis range.\n*\n* @private\n* @returns {NumberArray} range\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn [ 0, this.graphWidth ];\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Returns the y-axis range.\n*\n* @private\n* @returns {NumberArray} range\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\treturn [ this.graphHeight, 0 ];\n}\n\n\n// EXPORTS //\n\nexport default get;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates that an instance is in a valid state for rendering.\n*\n* @private\n* @param {Object} state - state\n* @throws {Error} must be in a valid state to render\n*/\nfunction validate( state ) {\n\t/* eslint-disable no-underscore-dangle */\n\tvar x;\n\tvar y;\n\tvar i;\n\n\tx = state._xData;\n\ty = state._yData;\n\tif ( x.length !== y.length ) {\n\t\tthrow new Error( format( 'invalid state. x and y are different lengths. x length: `%u`. y length: `%u`.', x.length, y.length ) );\n\t}\n\t// TODO: will need to refactor to some degree to support `ndarray`-like `x` and `y`\n\tfor ( i = 0; i < x.length; i++ ) {\n\t\tif ( x[ i ].length !== y[ i ].length ) {\n\t\t\tthrow new Error( format( 'invalid state. Each `x[i]:y[i]` pair must be the same length. x[%u].length: `%u`, y[%u].length: `%u`.', i, x[i].length, i, y[i].length ) );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Create a 2-dimensional plot.\n*\n* @module @stdlib/plot/ctor\n*\n* @example\n* import Plot from '@stdlib/plot/ctor';\n*\n* var x = [ 1, 2, 3 ];\n* var y = [ 1, 0, 1 ];\n*\n* var p = new Plot( [ x ], [ y ] );\n*\n* @example\n* import Plot from '@stdlib/plot/ctor';\n*\n* var opts = {\n* 'width': 600,\n* 'height': 400\n* };\n* var myPlot = Plot.factory( opts );\n*\n* var h1 = myPlot( [[1,2,3]], [[1,0,1]] );\n* var h2 = myPlot( [[4,5,6]], [[0,1,0]] );\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isObject from '@stdlib/assert/is-plain-object';\nimport format from '@stdlib/string/format';\nimport copy from '@stdlib/utils/copy';\nimport Plot from './main.js';\n\n\n// MAIN //\n\n/**\n* Returns a reusable function for generating plots.\n*\n* @param {Options} [options] - factory options\n* TODO\n* @throws {TypeError} must provide an object\n* @returns {Function} plot function\n*\n* @example\n* var opts = {\n* 'width': 600,\n* 'height': 400\n* };\n* var plot = factory( opts );\n* var h1 = plot( [[1,2,3]], [[1,0,1]] );\n* var h2 = plot( [[4,5,6]], [[0,1,0]] );\n*/\nfunction factory( options ) {\n\tvar opts;\n\tif ( arguments.length ) {\n\t\tif ( !isObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t\topts = copy( options );\n\t} else {\n\t\topts = {};\n\t}\n\treturn plot;\n\n\t/**\n\t* Creates a plot.\n\t*\n\t* @private\n\t* @param {Array} [x] - x-values\n\t* @param {Array} [y] - y-values\n\t* @throws {TypeError} must provide valid options\n\t* @returns {Plot} plot instance\n\t*/\n\tfunction plot( x, y ) {\n\t\tif ( arguments.length === 2 ) {\n\t\t\treturn new Plot( x, y, opts );\n\t\t}\n\t\treturn new Plot( opts );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default factory;\n"],"names":["view","plot","viewer","vtree","console","log","JSON","stringify","stdout","Error","format","debug","require$$0","isDefined","d","bool","isnan","COLORS","getMin","arr","min","i","length","getMax","max","ascending$1","a","b","NaN","bisector","compare","f","x","ascending","left","lo","hi","mid","right","bisectRight","number$2","e10","Math","sqrt","e5","e2","ticks$2","start","stop","count","reverse","n","ticks","step","tickIncrement","isFinite","ceil","floor","Array","power","LN10","error","pow","tickStep","step0","abs","step1","threshold$1","values","p","valueof","number","i0","value0","prefix","Map","map","object","each","value","key","set","isArray","o","Set","prototype","constructor","has","this","get","remove","property","clear","keys","push","slice","entries","size","empty","proto","add","array","implicit","name","ordinal","range","index","domain","unknown","scale","call","_","arguments","copy","band","bandwidth","undefined","ordinalRange","round","paddingInner","paddingOuter","align","rescale","sequence","rangeRound","padding","pointish","define","factory","extend","parent","definition","Object","create","Color","darker","brighter","reI","reN","reP","reHex","reRgbInteger","RegExp","reRgbPercent","reRgbaInteger","reRgbaPercent","reHslPercent","reHslaPercent","named","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","color_formatHex","rgb","formatHex","color_formatRgb","formatRgb","color","m","l","trim","toLowerCase","exec","parseInt","rgbn","Rgb","rgba","hsla","hasOwnProperty","r","g","rgbConvert","opacity","rgb_formatHex","hex","rgb_formatRgb","isNaN","toString","h","s","Hsl","hslConvert","hsl2rgb","m1","m2","channels","assign","displayable","formatHsl","k","deg2rad","PI","rad2deg","A","B","C","D","E","ED","EB","BC_DA","cubehelix","Cubehelix","bl","atan2","cubehelixConvert","constant$2","linear","t","gamma","y","nogamma","exponential","constant","cosh","cos","sinh","sin","rgbGamma","end","colorRgb","numberArray","c","genericArray","nb","na","date$1","Date","setTime","reinterpolate$1","reA","reB","source","string","am","bm","bs","bi","lastIndex","q","one","zero","join","interpolateValue","date","ArrayBuffer","isView","DataView","isNumberArray","valueOf","interpolateRound","hue","cubehelixGamma","colorCubehelix","cubehelixLong","constant$1","number$1","unit","deinterpolateLinear","bimap","deinterpolate","reinterpolate","d0","d1","r0","r1","polymap","j","bisect","target","interpolate","clamp","continuous","piecewise","output","input","deinterpolateClamp","invert","reinterpolateClamp","formatDecimalParts","toExponential","indexOf","coefficient","exponent","prefixExponent","re","formatSpecifier","specifier","match","FormatSpecifier","fill","sign","symbol","width","comma","precision","type","formatRounded","formatTypes","toFixed","toLocaleString","replace","e","toPrecision","X","toUpperCase","identity$2","locale","formatPrefix","prefixes","formatLocale$1","grouping","thousands","group","identity","Number","substring","currencyPrefix","currency","currencySuffix","decimal","numerals","formatNumerals","String","percent","minus","nan","newFormat","test","suffix","formatType","maybeSuffix","valuePrefix","valueSuffix","valueNegative","out","i1","formatTrim","charCodeAt","Infinity","defaultLocale","formatLocale","precisionFixed","precisionPrefix","precisionRound","linearish","tickFormat","nice","interval","x0","x1","pow10","powp","base","exp","logp","log10","log2","reflect","raise","t0","t1","newInterval","floori","offseti","field","offset","previous","filter","every","millisecond","utcMillisecond","durationSecond","durationMinute","durationHour","durationDay","durationWeek","second","getMilliseconds","getUTCSeconds","utcSecond","minute","getSeconds","getMinutes","timeMinute","hour","getHours","timeHour","day","setHours","setDate","getDate","getTimezoneOffset","timeDay","weekday","getDay","sunday","monday","tuesday","wednesday","thursday","friday","saturday","month","setMonth","getMonth","getFullYear","timeMonth","year","setFullYear","timeYear","utcMinute","setUTCSeconds","getUTCMinutes","utcMinute$1","utcHour","setUTCMinutes","getUTCHours","utcHour$1","utcDay","setUTCHours","setUTCDate","getUTCDate","utcDay$1","utcWeekday","getUTCDay","utcSunday","utcMonday","utcTuesday","utcWednesday","utcThursday","utcFriday","utcSaturday","utcMonth","setUTCMonth","getUTCMonth","getUTCFullYear","utcMonth$1","utcYear","setUTCFullYear","utcYear$1","localDate","H","M","S","L","utcDate","UTC","newDate","locale_dateTime","dateTime","locale_date","locale_time","time","locale_periods","periods","locale_weekdays","days","locale_shortWeekdays","shortDays","locale_months","months","locale_shortMonths","shortMonths","periodRe","formatRe","periodLookup","formatLookup","weekdayRe","weekdayLookup","shortWeekdayRe","shortWeekdayLookup","monthRe","monthLookup","shortMonthRe","shortMonthLookup","formats","formatDayOfMonth","formatMicroseconds","formatYearISO","G","formatFullYearISO","formatHour24","I","formatHour12","formatDayOfYear","formatMilliseconds","formatMonthNumber","formatMinutes","Q","formatUnixTimestamp","formatUnixTimestampSeconds","formatSeconds","u","formatWeekdayNumberMonday","U","formatWeekNumberSunday","V","formatWeekNumberISO","w","formatWeekdayNumberSunday","W","formatWeekNumberMonday","formatYear","Y","formatFullYear","Z","formatZone","formatLiteralPercent","utcFormats","formatUTCDayOfMonth","formatUTCMicroseconds","formatUTCYearISO","formatUTCFullYearISO","formatUTCHour24","formatUTCHour12","formatUTCDayOfYear","formatUTCMilliseconds","formatUTCMonthNumber","formatUTCMinutes","formatUTCSeconds","formatUTCWeekdayNumberMonday","formatUTCWeekNumberSunday","formatUTCWeekNumberISO","formatUTCWeekdayNumberSunday","formatUTCWeekNumberMonday","formatUTCYear","formatUTCFullYear","formatUTCZone","parses","parseSpecifier","parseDayOfMonth","parseMicroseconds","parseYear","parseFullYear","parseHour24","parseDayOfYear","parseMilliseconds","parseMonthNumber","parseMinutes","parseQuarter","parseUnixTimestamp","parseUnixTimestampSeconds","parseSeconds","parseWeekdayNumberMonday","parseWeekNumberSunday","parseWeekNumberISO","parseWeekdayNumberSunday","parseWeekNumberMonday","parseZone","parseLiteralPercent","pad","pads","charAt","newParse","week","timeMonday","parse","utcFormat","utcParse","timeFormat","timeParse","numberRe","percentRe","requoteRe","requote","names","timeSunday","dISO","timeThursday","z","getUTCMilliseconds","dow","UTCdISO","isoSpecifier","formatIso","toISOString","formatIso$1","parseIso","parseIso$1","durationMonth","durationYear","calendar","formatMillisecond","formatSecond","formatMinute","formatHour","formatDay","formatWeek","formatMonth","tickIntervals","tickInterval","colors","category10","category20b","category20c","category20","interpolateCubehelixLong","warm","cool","rainbow","ramp","viridis","magma","inferno","plasma","ts","logs","pows","v","quantile","thresholds","threshold","invertExtent","sort","quantiles","quantize","sequential","interpolator","timeWeek","timeSecond","timeMillisecond","utcWeek","scaleLinear","scaleTime","require$$1","matchHtmlRegExp","escapeHtml_1","escape","str","html","immutable","version","isVnode","isVtext","isThunk_1","isWidget_1","softSetHook","SoftSetHook","hook","node","propertyName","attributeHook","AttributeHook","namespace","prop","prev","setAttributeNS","unhook","next","colonPosition","localName","substr","removeAttributeNS","callback","cache","LANGUAGES","tr","regexp","az","lt","J","lowerCase","lang","NON_WORD_REGEXP","CAMEL_CASE_REGEXP","TRAILING_DIGIT_REGEXP","sentenceCase","replacement","types","BOOLEAN","OVERLOADED_BOOLEAN","propertyConfig","attributeTypes","properties","accept","acceptCharset","accessKey","action","allowFullScreen","allowTransparency","alt","async","autocomplete","autofocus","autoplay","cellPadding","cellSpacing","charset","checked","classID","className","cols","colSpan","content","contentEditable","contextMenu","controls","coords","crossOrigin","data","defer","dir","disabled","download","draggable","enctype","form","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","headers","height","hidden","href","hreflang","htmlFor","httpEquiv","icon","id","label","list","loop","manifest","marginHeight","marginWidth","maxLength","media","mediaGroup","method","multiple","muted","noValidate","open","pattern","placeholder","poster","preload","radiogroup","readOnly","rel","required","role","rows","rowSpan","sandbox","scope","scrolling","seamless","selected","shape","sizes","span","spellcheck","src","srcdoc","srcset","style","tabIndex","title","useMap","wmode","autocapitalize","autocorrect","itemProp","itemScope","itemType","attributeNames","prefixAttribute","isVNode","require$$2","isVText","require$$3","isThunk","require$$4","isWidget","require$$5","softHook","require$$6","attrHook","require$$7","paramCase","createAttribute","isAttribute","attrType","shouldSkip","voidElements","area","br","col","embed","hr","img","keygen","link","meta","param","track","wbr","vdomToHtml","toHTML","render","props","ret","tagName","css","styleProp","attr","dataProp","attrProp","openTag","innerHTML","children","tagContent","tag","closeTag","text","xRugTransform","orient","yRugTransform","state","marks","$","svg","concat","nOpacities","lineStyle","nColors","nStyles","nWidths","line","len","path","lineOpacity","lineWidth","labels","lines","nSymbols","nSizes","sym","symbols","symbolsOpacity","symbolsSize","rugTransform","nOrients","nFlgs","rug","tmp","xRug","xRugOpacity","xRugOrient","xRugSize","orientation","graphHeight","attributes","transform","yRug","yRugOpacity","yRugOrient","yRugSize","graphWidth","nativeIsArray","xIsArray","obj","isVhook","isVHook","vnode","VirtualNode","noProperties","noChildren","hooks","descendants","hasWidgets","hasThunks","descendantHooks","propName","child","destroy","vtext","VirtualText","split","undef","self","nativeSplit","compliantExecNpcg","separator","limit","separator2","lastLength","flags","ignoreCase","multiline","extended","sticky","lastLastIndex","apply","classIdSplit","notClassId","parseTag_1","classes","part","noId","tagParts","root","window","global","module","exports","Individual","oneVersion","moduleName","defaultValue","versionValue","hashKey","EvStore","elem","hash","evHook","EvHook","VNode","VText","isHook","isVThunk","parseTag","require$$8","require$$9","require$$10","virtualHyperscript","childNodes","isChild","isChildren","transformProperties","addChild","err","message","errorString","foreignObject","parentVnode","UnexpectedVirtualElement","h_1","EventEmitter","Annotations","instanceOf","on","args","emit","inherit","setReadOnly","isPositiveNumber","TypeError","isString","isBoolean","validators","autoRender","KEYS","objectKeys","EVENTS","CHANGE_EVENT","events","ELEMENT","ctx","ClipPath","options","opts","val","isObject","hasOwnProp","validate","defaults","defineProperty","configurable","enumerable","writable","minstd","_autoRender","isValid","_width","_height","_id","rect","Canvas","isNonNegativeInteger","translateX","translateY","Graph","_translateX","_translateY","Title","_text","clipPathId","Marks","_clipPathId","Background","stroke","Defs","isNull","ORIENTATIONS","isFunction","numTicks","tickPadding","tickSize","innerTickSize","outerTickSize","tickTransform","xAttr","yAttr","dy","_orientation","tickDir","_innerTickSize","txt","tickSpacing","labelTransform","labelXPos","labelYPos","_scale","tick","unshift","range0","range1","_outerTickSize","_label","logger","Axis","fcn","_ticks","_numTicks","_tickFormat","num","fmt","_tickSize","_tickPadding","pos","center","components","pi","tau","epsilon","tauEpsilon","Path","_x0","_y0","_x1","_y1","moveTo","closePath","lineTo","quadraticCurveTo","y1","bezierCurveTo","x2","y2","arcTo","y0","x21","y21","x01","y01","l01_2","x20","y20","l21_2","l20_2","l21","l01","acos","t01","t21","arc","a0","a1","ccw","dx","cw","da","halfPi","asin","arcInnerRadius","innerRadius","arcOuterRadius","outerRadius","arcStartAngle","startAngle","arcEndAngle","endAngle","arcPadAngle","padAngle","cornerTangents","rc","ox","oy","x11","y11","x10","y10","x00","y00","d2","cx0","cy0","cx1","cy1","dx0","dy0","dx1","dy1","cx","cy","Linear","context","_context","curveLinear","line$1","pointX","pointY","defined","curve","buffer","defined0","lineStart","lineEnd","point","x0z","y0z","areaStart","areaEnd","arealine","lineX0","lineY0","lineY1","lineX1","descending$1","_line","_point","curveRadialLinear","curveRadial","Radial","_curve","radial","lineRadial","angle","radius","lineRadial$1","areaRadial","lineStartAngle","lineEndAngle","lineInnerRadius","lineOuterRadius","pointRadial","linkSource","linkTarget","argv","curveHorizontal","curveVertical","p0","p1","p2","p3","circle","draw","cross","tan30","tan30_2","diamond","kr","kx","ky","star","square","sqrt3","triangle","wye","noop","that","Basis","BasisClosed","BasisOpen","Bundle","beta","_basis","_beta","_x2","_x3","_x4","_y2","_y3","_y4","_x","_y","bundle","custom","_k","Cardinal","tension","cardinal","CardinalClosed","_x5","_y5","cardinalClosed","CardinalOpen","cardinalOpen","_l01_a","_l01_2a","_l12_a","_l12_2a","_l23_a","_l23_2a","CatmullRom","alpha","_alpha","x23","y23","catmullRom","CatmullRomClosed","catmullRomClosed","CatmullRomOpen","catmullRomOpen","LinearClosed","slope3","h0","h1","s0","s1","slope2","MonotoneX","MonotoneY","ReflectContext","Natural","controlPoints","Step","_t","none$1","series","order","none","stackValue","appearance","peaks","peak","vi","vj","sums","sum","_t0","px","py","cornerRadius","padRadius","a01","a11","a00","a10","da0","da1","ap","rp","rc0","rc1","oc","x3","y3","x32","y32","intersect","ax","ay","bx","by","kc","lc","centroid","sortValues","descending","pie","arcs","pa","orderNone","offsetNone","stack","oz","kz","sz","sij","ki","si","yp","yn","s2","sij0","s3","sk","top","bottom","tops","bottoms","zip","STYLES","PRIVATE_PROPS","xScale","yScale","merge","isArrayLike","_xData","_yData","_xScale","_yScale","_isDefined","_color","isNumber","RangeError","_opacity","_style","xPos","yPos","RENDER","xi","yi","Symbols","SYMBOLS","_symbol","_size","isNum","Rug","_data","annotations","clipPath","canvas","graph","xAxis","yAxis","bkgd","defs","Bkgd","init","paddingLeft","paddingTop","xLabel","xTickFormat","xNumTicks","xAxisOrient","yLabel","yTickFormat","yNumTicks","yAxisOrient","sync","renderMarks","xAxisTransform","yAxisTransform","vdom2html","mergeFcn","Plot","nargs","isREPL","isNodeREPL","autoView","description","engine","paddingBottom","paddingRight","renderFormat","xMax","xMin","yMax","yMin","_autoView","_viewer","isEmptyArray","isStringArray","_labels","isStr","_colors","LINESTYLES","_lineStyle","_lineOpacity","isInt","isNonNegativeIntegerArray","_lineWidth","_symbols","_symbolsSize","_symbolsOpacity","_paddingLeft","_paddingRight","_paddingTop","_paddingBottom","_xMin","_xMax","_yMin","_yMax","xDomain","xRange","yDomain","yRange","_xTickFormat","_yTickFormat","_xNumTicks","_yNumTicks","_xAxisOrient","_yAxisOrient","isBool","isBooleanArray","_xRug","_yRug","_xRugOrient","_yRugOrient","_xRugOpacity","_yRugOpacity","_xRugSize","_yRugSize","_description","_title","_xLabel","_yLabel","contains","ENGINES","_engine","FORMATS","_renderFormat","VIEWERS","renderSVG","_view","main"],"mappings":";;0mSAsCA,SAASA,EAAMC,EAAMC,EAAQC,GAC5B,GAAgB,SAAXD,EAAL,CAGA,GAAgB,WAAXA,EACJ,OCjBF,SAAeD,GACdG,QAAQC,IAAKC,KAAKC,UAAWN,GAC9B,CDeSO,CAAQL,GAEhB,GAAgB,YAAXD,EACJ,MAAM,IAAIO,MAAOC,EAAQ,kEAAmER,IAE7F,GAAgB,aAAXA,EAIL,MAAM,IAAIO,MAAOC,EAAQ,kEAAmER,GAX3F,CAYF,CE/BA,IAMIS,EANSC,EAMO,4BAapB,SAASC,EAAWC,GACnB,IAAIC,GAAQC,EAAOF,GAEnB,OADAH,EAAO,0BAA2BL,KAAKC,UAAWO,GAAKC,GAChDA,CACR,CCvBA,IAOIJ,EAPSC,EAOO,cCPpB,IAOID,EAPSC,EAOO,cCPpB,IAQID,EARSC,EAQO,mBCRpB,IAOID,EAPSC,EAOO,uBCLpB,IAAIK,EAAS,CAEbA,WAAoB,CACnB,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAGDA,WAAoB,CACnB,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAGDA,YAAqB,CACpB,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAGDA,YAAqB,CACpB,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,YC1EGN,GATSC,EASO,qDCChBD,GAVSC,EAUO,uBCVpB,IAQID,GARSC,EAQO,yBCRpB,IAQID,GARSC,EAQO,qECEhBD,GAVSC,EAUO,oBCVpB,IAQID,GARSC,EAQO,yBCRpB,IAQID,GARSC,EAQO,4BCRpB,IAOID,GAPSC,EAOO,kBCPpB,IAOID,GAPSC,EAOO,mBCPpB,IAOID,GAPSC,EAOO,yBCPpB,IAOID,GAPSC,EAOO,0BCPpB,IAOID,GAPSC,EAOO,wBCPpB,IAOID,GAPSC,EAOO,2BCPpB,IAQID,GARSC,EAQO,kBCHpB,SAASM,GAAQC,GAChB,IAAIC,EACAC,EACJ,GAAoB,IAAfF,EAAIG,OACR,OAAO,KAGR,IADAF,EAAMD,EAAK,GACLE,EAAI,EAAGA,EAAIF,EAAIG,OAAQD,IACvBF,EAAKE,GAAMD,IACfA,EAAMD,EAAKE,IAGb,OAAOD,CACR,CClBA,IAQIT,GARSC,EAQO,kBCHpB,SAASW,GAAQJ,GAChB,IAAIK,EACAH,EACJ,GAAoB,IAAfF,EAAIG,OACR,OAAO,KAGR,IADAE,EAAML,EAAK,GACLE,EAAI,EAAGA,EAAIF,EAAIG,OAAQD,IACvBF,EAAKE,GAAMG,IACfA,EAAML,EAAKE,IAGb,OAAOG,CACR,CClBA,IAQIb,GARSC,EAQO,kBCRpB,IAQID,G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B,SAASl2B,KAAMm2C,GACpBM,EAAKt5C,OAASg5C,EAASh5C,MAEvBtC,GAAO,sCACPw7C,EAAMngB,SAASl2B,KAAMw2C,GACrBH,EAAMl5C,OAASq5C,EAAKr5C,MAEpBtC,GAAO,iCACPw7C,EAAMngB,SAASl2B,KAAM22B,GACrB0f,EAAMl5C,OAASw5B,EAAMx5B,MAErBtC,GAAO,kCACPw7C,EAAMngB,SAASl2B,KAAMs2C,GACrBD,EAAMl5C,OAASm5C,EAAMn5C,MAErBtC,GAAO,kCACPw7C,EAAMngB,SAASl2B,KAAMu2C,GACrBF,EAAMl5C,OAASo5C,EAAMp5C,MAErBtC,GAAO,uCACPq7C,EAAYhgB,SAASl2B,KAAM6yB,GAC3BqjB,EAAY/4C,OAAS01B,EAAM11B,MAE3BtC,GAAO,wCACPu7C,EAAOlgB,SAASl2B,KAAMy2C,GACtBL,EAAOj5C,OAASs5C,EAAKt5C,MAErBtC,GAAO,kCACPu7C,EAAOlgB,SAASl2B,KAAMq2C,GACtBD,EAAOj5C,OAASk5C,EAAMl5C,MAEtBtC,GAAO,wCACPu7C,EAAOlgB,SAASl2B,KAAMk2C,GACtBE,EAAOj5C,OAAS+4C,EAAY/4C,MAErBi5C,CACR,CGlIA,IACIsB,GAAYttB,GAOZvvB,GARSC,EAQO,eCRpB,IAMID,GANSC,EAMO,aCRpB,IAAIojC,GAAepjC,EAAoBojC,aAuHnCrjC,GAtHSuvB,EAsHO,aAChBmqB,GAAgB,CACnB,cACA,YACA,UACA,eACA,UACA,UACA,aACA,UACA,eACA,aACA,aACA,iBACA,eACA,gBACA,cACA,gBACA,WACA,kBACA,eACA,SACA,UACA,SACA,eACA,SACA,UACA,QACA,QACA,aACA,QACA,eACA,cACA,YACA,UACA,eACA,eACA,SACA,UACA,QACA,QACA,aACA,QACA,eACA,cACA,YACA,UACA,gBAMGG,GAAQiD,EAAS,CACpBx1C,QAAU,IAiEX,SAASy1C,KACR,IAAIpY,EACAqY,EACA93C,EACAy6B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tF,OAASA,GAEfS,GAAO,cAAe6E,KAAKtF,QAC3BS,GAAO,sBACPohD,EAAOv8C,EAAMA,KAAKtF,OAAQsF,KAAK61B,UAC1Br0B,UAAU1F,SAEdkE,KAAKtF,OAASi+B,EAEhB,IoDEAoG,EAAAyd,GAAA,WCRA,SAAkB1c,GACjB,IAAIC,EACJ,GAAKv+B,UAAU1F,OAAS,CACvB,IAAMmkC,EAAUH,GACf,MAAM,IAAIb,UAAW/jC,EAAQ,qEAAsE4kC,IAEpGC,EAAOt+B,EAAMq+B,EACf,MACEC,EAAO,CAAA,EAER,OAWA,SAAevjC,EAAGmU,GACjB,GAA0B,IAArBnP,UAAU1F,OACd,OAAO,IAAIo8C,GAAM17C,EAAGmU,EAAGovB,GAExB,OAAO,IAAImY,GAAMnY,EACjB,CACF","x_google_ignoreList":[28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,170,171,172,173,174,175,176,177,178,179,180,181,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391]} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 9a0feba..0000000 --- a/lib/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Plot. -* -* @module @stdlib/plot -* -* @example -* var plot = require( '@stdlib/plot' ); -* -* var x = [ 1, 2, 3 ]; -* var y = [ 1, 0, 1 ]; -* -* var plt = plot( [ x ], [ y ] ); -*/ - -// MODULES // - -var plot = require( './../ctor' ); - - -// EXPORTS // - -module.exports = plot; diff --git a/package.json b/package.json index e8a1a26..7f8099b 100644 --- a/package.json +++ b/package.json @@ -3,29 +3,8 @@ "version": "0.3.3", "description": "Plotting.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -34,49 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert": "github:stdlib-js/assert#main", - "@stdlib/fs": "github:stdlib-js/fs#main", - "@stdlib/net": "github:stdlib-js/net#main", - "@stdlib/process": "github:stdlib-js/process#main", - "@stdlib/random": "github:stdlib-js/random#main", - "@stdlib/string": "github:stdlib-js/string#main", - "@stdlib/utils": "github:stdlib-js/utils#main", - "d3-format": "^1.0.0", - "d3-scale": "^1.0.0", - "d3-shape": "^1.0.0", - "d3-time-format": "^2.0.0", - "debug": "^2.6.9", - "vdom-to-html": "^2.3.0" - }, - "devDependencies": { - "@stdlib/array": "github:stdlib-js/array#main", - "@stdlib/bench": "github:stdlib-js/bench#main", - "@stdlib/constants": "github:stdlib-js/constants#main", - "@stdlib/math": "github:stdlib-js/math#main", - "@stdlib/ndarray": "github:stdlib-js/ndarray#main", - "@stdlib/streams": "github:stdlib-js/streams#main", - "@stdlib/time": "github:stdlib-js/time#main", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "proxyquire": "^2.0.0", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "figure", diff --git a/sparklines/README.md b/sparklines/README.md deleted file mode 100644 index 9aa8cdf..0000000 --- a/sparklines/README.md +++ /dev/null @@ -1,98 +0,0 @@ - - -# Sparklines - -> Sparklines. - -
- -## Usage - -```javascript -var ns = require( '@stdlib/plot/sparklines' ); -``` - -#### ns - -Namespace for sparkline functionality. - -```javascript -var o = ns; -// returns {...} -``` - - - -
- -- [`base`][@stdlib/plot/sparklines/base]: base sparkline functionality. -- [`unicode( [data,] [options] )`][@stdlib/plot/sparklines/unicode]: create a Unicode sparkline. - -
- - - -
- - - -
- -## Examples - - - - - -```javascript -var objectKeys = require( '@stdlib/utils/keys' ); -var ns = require( '@stdlib/plot/sparklines' ); - -console.log( objectKeys( ns ) ); -``` - -
- - - - - - - - - - - - - - diff --git a/sparklines/base/README.md b/sparklines/base/README.md deleted file mode 100644 index d431d3e..0000000 --- a/sparklines/base/README.md +++ /dev/null @@ -1,95 +0,0 @@ - - -# Base - -> Base sparkline functionality. - -
- -## Usage - -```javascript -var ns = require( '@stdlib/plot/sparklines/base' ); -``` - -#### ns - -Namespace containing "base" (i.e., lower-level) sparkline functionality. - -```javascript -var o = ns; -// returns {...} -``` - - - -
- -- [`Sparkline( [data,] [options] )`][@stdlib/plot/sparklines/base/ctor]: base class for sparklines. - -
- - - -
- - - -
- -## Examples - - - - - -```javascript -var objectKeys = require( '@stdlib/utils/keys' ); -var ns = require( '@stdlib/plot/sparklines/base' ); - -console.log( objectKeys( ns ) ); -``` - -
- - - - - - - - - - - - - - diff --git a/sparklines/base/ctor/README.md b/sparklines/base/ctor/README.md deleted file mode 100644 index 5a5b64b..0000000 --- a/sparklines/base/ctor/README.md +++ /dev/null @@ -1,408 +0,0 @@ - - -# Sparkline - -> Base class for sparklines. - -
- -## Usage - -```javascript -var Sparkline = require( '@stdlib/plot/sparklines/base/ctor' ); -``` - -#### Sparkline( \[data,] \[options] ) - -Returns a `sparkline` instance. - -```javascript -var sparkline = new Sparkline(); -// returns -``` - -The constructor accepts the following `options`: - -- **autoRender**: `boolean` indicating whether to re-render on a `change` event. -- **bufferSize**: data buffer size. If provided, data is kept in a first-in first-out (FIFO) buffer which cannot exceed the buffer size. Default: `+infinity`. -- **data**: sparkline data. -- **description**: sparkline description. -- **isDefined**: accessor `function` indicating whether a datum is defined. -- **label**: data label. - -* * * - -### Writable Properties - - - -#### Sparkline.prototype.autoRender - -Rendering mode. If `true`, an instance renders on each `'change'` event; otherwise, rendering must be triggered manually. - -```javascript -var sparkline = new Sparkline(); - -// Set: -sparkline.autoRender = false; - -// Get: -var mode = sparkline.autoRender; -// returns false -``` - - - -#### Sparkline.prototype.bufferSize - -Data buffer size. If set, this specifies the maximum number of data elements which can be rendered. Once the data buffer is full, each new datum results in the oldest datum being removed. - -```javascript -var sparkline = new Sparkline(); - -// Set: -sparkline.bufferSize = 3; - -// Get: -var size = sparkline.bufferSize; -// returns 3 - -sparkline.data = [ 1, 2, 3 ]; - -var data = sparkline.data; -// returns [ 1, 2, 3 ] - -sparkline.push( 4 ); - -data = sparkline.data; -// returns [ 2, 3, 4 ] -``` - -Setting a data buffer size is useful when rendering data streams. - - - -#### Sparkline.prototype.data - -Sparkline data. When set, the value must be either `array`-like or an [ndarray][@stdlib/ndarray/ctor] and cannot exceed the `bufferSize`. - -```javascript -var Float32Array = require( '@stdlib/array/float32' ); - -var sparkline = new Sparkline(); - -// Set: -sparkline.data = new Float32Array( [ 3.14, 5.0, -3.14, -1.0 ] ); - -// Get: -var data = sparkline.data; -// returns [ ~3.14, 5.0, ~-3.14, -1.0 ] -``` - -Note that data is **copied** to an internal data buffer. - - - -#### Sparkline.prototype.description - -Sparkline description. - -```javascript -var sparkline = new Sparkline(); - -// Set: -sparkline.description = 'Daily stock prices for the past 30 days.'; - -// Get: -var desc = sparkline.description; -// returns 'Daily stock prices for the past 30 days.' -``` - - - -#### Sparkline.prototype.isDefined( d, i ) - -An accessor `function` which defines whether a datum is defined. This accessor is used to define how missing values are encoded. When invoked, the function is provided two arguments: - -- **d**: datum. -- **i**: datum index. - -```javascript -function isDefined( d ) { - return ( d !== null ); -} - -var sparkline = new Sparkline(); - -// Set: -sparkline.isDefined = isDefined; - -// Get: -var fcn = sparkline.isDefined; -// returns -``` - -The default behavior is to ignore values which are `NaN`. - - - -#### Sparkline.prototype.label - -Data label. - -```javascript -var sparkline = new Sparkline(); - -// Set: -sparkline.label = 'beep'; - -// Get: -var label = sparkline.label; -// returns 'beep' -``` - -* * * - -### Methods - - - -#### Sparkline.prototype.push( datum ) - -Appends data to a sparkline. - -```javascript -var sparkline = new Sparkline(); - -// Set: -sparkline.data = [ 1, 2, 3 ]; - -// Get: -var data = sparkline.data; -// returns [ 1, 2, 3 ] - -sparkline.push( 4 ); - -data = sparkline.data; -// returns [ 1, 2, 3, 4 ] -``` - - - -#### Sparkline.prototype.\_render() - -Private method for rendering a sparkline. This method **should be** implemented by `Sparkline` descendants. - - - -```javascript -function render() { - return '▁█▅▃▆▆▅'; -} - -var sparkline = new Sparkline(); - -sparkline._render = render; -``` - - - -#### Sparkline.prototype.render() - -Public method for rendering a sparkline which internally invokes the private `_render()` method. - - - -```javascript -function render() { - return '▁█▅▃▆▆▅'; -} - -var sparkline = new Sparkline(); - -sparkline._render = render; - -var str = sparkline.render(); -// returns '▁█▅▃▆▆▅' -``` - - - -#### Sparkline.prototype.toString() - -Serializes a sparkline as a `string` by calling the public `render()` method. - - - - - -```javascript -function render() { - return '▁█▅▃▆▆▅'; -} - -var sparkline = new Sparkline(); - -sparkline._render = render; - -var str = sparkline.toString(); -// returns '▁█▅▃▆▆▅' -``` - -* * * - -### Events - -#### 'change' - -Emitted whenever a property value changes. - -```javascript -var sparkline = new Sparkline(); - -sparkline.on( 'change', onChange ); - -function onChange() { - console.log( 'A property was updated.' ); -} -``` - -#### 'render' - -Emitted whenever a sparkline is rendered. - -```javascript -var sparkline = new Sparkline(); - -sparkline.on( 'render', onRender ); - -function onRender( str ) { - console.log( 'Rendered sparkline: %s', str ); -} -``` - -
- - - -
- -* * * - -## Examples - - - - - -```javascript -var inherit = require( '@stdlib/utils/inherit' ); -var Sparkline = require( '@stdlib/plot/sparklines/base/ctor' ); - -// Define a chart constructor: -function Chart( opts ) { - if ( opts === void 0 ) { - opts = {}; - } - // Call the parent constructor: - Sparkline.call( this, opts ); - - return this; -} - -// Inherit from the Sparkline constructor: -inherit( Chart, Sparkline ); - -// Implement a custom render method: -Chart.prototype._render = function render() { - var str; - var i; - - str = ''; - for ( i = 0; i < this._data.length; i++ ) { - if ( this._data[ i ] > 0 ) { - str += '↑'; - } else { - str += '↓'; - } - } - return str; -}; - -// Create a new chart instance: -var chart = new Chart(); - -// Set chart data: -chart.data = [ 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0 ]; - -// Render the chart: -console.log( chart.render() ); -// => '↑↓↓↑↓↑↑↑↓↑↑↓↓' -``` - -
- - - - - - - - - - - - - - diff --git a/sparklines/base/ctor/benchmark/benchmark.js b/sparklines/base/ctor/benchmark/benchmark.js deleted file mode 100644 index 45261a2..0000000 --- a/sparklines/base/ctor/benchmark/benchmark.js +++ /dev/null @@ -1,301 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var noop = require( '@stdlib/utils/noop' ); -var randu = require( '@stdlib/random/base/randu' ); -var isArray = require( '@stdlib/assert/is-array' ); -var pkg = require( './../package.json' ).name; -var Sparkline = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::instantiation', function benchmark( b ) { - var v; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new Sparkline(); - if ( !( v instanceof Sparkline ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof Sparkline ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,no_new', function benchmark( b ) { - var ctor; - var v; - var i; - - ctor = Sparkline; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = ctor(); - if ( !( v instanceof Sparkline ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof Sparkline ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,options', function benchmark( b ) { - var opts; - var v; - var i; - - opts = { - 'autoRender': false, - 'bufferSize': 10, - 'data': [ 1, 2, 3 ], - 'description': 'foo', - 'label': 'beep', - 'isDefined': noop - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new Sparkline( opts ); - if ( !( v instanceof Sparkline ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof Sparkline ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,data', function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new Sparkline( [ 1, 2, 3 ] ); - if ( !( v instanceof Sparkline ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof Sparkline ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,data,options', function benchmark( b ) { - var opts; - var v; - var i; - - opts = { - 'autoRender': false, - 'bufferSize': 10, - 'description': 'foo', - 'label': 'beep', - 'isDefined': noop - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new Sparkline( [ 1, 2, 3 ], opts ); - if ( !( v instanceof Sparkline ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof Sparkline ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:autoRender', function benchmark( b ) { - var bool; - var v; - var i; - - v = new Sparkline(); - v._render = noop; // eslint-disable-line no-underscore-dangle - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.autoRender = !bool; - if ( typeof v.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( typeof v.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:bufferSize', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 10, - 20, - 30 - ]; - v = new Sparkline(); - v._render = noop; // eslint-disable-line no-underscore-dangle - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.bufferSize = values[ i % values.length ]; - if ( typeof v.bufferSize !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( typeof v.bufferSize !== 'number' ) { - b.fail( 'should return a number' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:data', function benchmark( b ) { - var v; - var i; - - v = new Sparkline(); - v._render = noop; // eslint-disable-line no-underscore-dangle - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.data = [ randu(), randu(), randu() ]; - if ( typeof v.data !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArray( v.data ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:description', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'beep', - 'boop' - ]; - v = new Sparkline(); - v._render = noop; // eslint-disable-line no-underscore-dangle - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.description = values[ i % values.length ]; - if ( typeof v.description !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.description !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:isDefined', function benchmark( b ) { - var v; - var i; - - v = new Sparkline(); - v._render = noop; // eslint-disable-line no-underscore-dangle - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.isDefined = createFcn(); - if ( typeof v.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof v.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createFcn() { - return beep; - function beep() { - // No-op... - } - } -}); - -bench( pkg+'::set,get:label', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'beep', - 'boop' - ]; - v = new Sparkline(); - v._render = noop; // eslint-disable-line no-underscore-dangle - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.label = values[ i % values.length ]; - if ( typeof v.label !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.label !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/sparklines/base/ctor/docs/repl.txt b/sparklines/base/ctor/docs/repl.txt deleted file mode 100644 index a9266c1..0000000 --- a/sparklines/base/ctor/docs/repl.txt +++ /dev/null @@ -1,85 +0,0 @@ - -{{alias}}( [data,] [options] ) - Returns a Sparkline instance. - - This constructor is a base Sparkline constructor from which constructors - tailored to generating particular types of Sparkline graphics should be - derived. - - At a minimum, descendants should implement a private `_render()` method - which will be automatically invoked by the public `render()` method. - - The `data` argument takes precedence over the `data` option. - - Parameters - ---------- - data: ArrayLike|ndarray (optional) - Sparkline data. - - options: Object (optional) - Options. - - options.autoRender: boolean (optional) - Boolean indicating whether to re-render on a 'change' event. Default: - false. - - options.bufferSize: integer|null (optional) - Data buffer size. If provided, data is kept in a first-in first-out - (FIFO) buffer which cannot exceed the buffer size. Default: +infinity. - - options.data: ArrayLike|ndarray (optional) - Sparkline data. - - options.description: string (optional) - Sparkline description. - - options.isDefined: Function (optional) - An accessor function indicating whether a datum is defined. - - options.label: string (optional) - Data label. - - Returns - ------- - sparkline: Sparkline - Sparkline instance. - - sparkline.autoRender - Rendering mode. If `true`, an instance renders on each 'change' event; - otherwise, rendering must be triggered manually. - - sparkline.bufferSize - Data buffer size. - - sparkline.description - Sparkline description. - - sparkline.data - Sparkline data. - - sparkline.label - Data label. - - sparkline.isDefined( d, i ) - An accessor function which defines whether a datum is defined. This - accessor is used to define how missing values are encoded. The default - behavior is to ignore values which are `NaN`. - - sparkline.render() - Renders a sparkline. This method calls `_render()` which must be - implemented by instances and child classes. The default behavior is - throw an error. - - Examples - -------- - > var sparkline = new {{alias}}() - - - // Provide sparkline data at instantiation: - > var data = [ 1, 2, 3 ]; - > sparkline = new {{alias}}( data ) - - - See Also - -------- - diff --git a/sparklines/base/ctor/examples/index.js b/sparklines/base/ctor/examples/index.js deleted file mode 100644 index 15e2b61..0000000 --- a/sparklines/base/ctor/examples/index.js +++ /dev/null @@ -1,64 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -/* eslint-disable no-restricted-syntax, no-underscore-dangle */ - -'use strict'; - -var inherit = require( '@stdlib/utils/inherit' ); -var Sparkline = require( './../lib' ); - -// Define a chart constructor: -function Chart( opts ) { - if ( opts === void 0 ) { - opts = {}; - } - // Call the parent constructor: - Sparkline.call( this, opts ); - - return this; -} - -// Inherit from the Sparkline constructor: -inherit( Chart, Sparkline ); - -// Implement a custom render method: -Chart.prototype._render = function render() { - var str; - var i; - - str = ''; - for ( i = 0; i < this._data.length; i++ ) { - if ( this._data[ i ] > 0 ) { - str += '↑'; - } else { - str += '↓'; - } - } - return str; -}; - -// Create a new chart instance: -var chart = new Chart(); - -// Set chart data: -chart.data = [ 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0 ]; - -// Render the chart: -console.log( chart.render() ); -// => '↑↓↓↑↓↑↑↑↓↑↑↓↓' diff --git a/sparklines/base/ctor/lib/accessors/is_defined.js b/sparklines/base/ctor/lib/accessors/is_defined.js deleted file mode 100644 index 2fb3f5a..0000000 --- a/sparklines/base/ctor/lib/accessors/is_defined.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isnan = require( '@stdlib/assert/is-nan' ).isPrimitive; - - -// VARIABLES // - -var debug = logger( 'sparkline:accessor:is-defined' ); - - -// MAIN // - -/** -* Accessor function which determines whether a datum is defined. -* -* @private -* @param {number} d - datum -* @param {integer} i - index -* @returns {boolean} boolean indicating whether a datum is defined -*/ -function isDefined( d ) { - var bool = !isnan( d ); - debug( 'Datum: %s. Defined: %s.', JSON.stringify( d ), bool ); - return bool; -} - - -// EXPORTS // - -module.exports = isDefined; diff --git a/sparklines/base/ctor/lib/defaults.js b/sparklines/base/ctor/lib/defaults.js deleted file mode 100644 index 5d80744..0000000 --- a/sparklines/base/ctor/lib/defaults.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var isDefined = require( './accessors/is_defined.js' ); - - -// MAIN // - -/** -* Returns default options. -* -* @private -* @returns {Object} default options -*/ -function defaults() { - var out = {}; - - // Boolean indicating whether to re-render on a `change` event: - out.autoRender = false; - - // Data buffer size: - out.bufferSize = FLOAT64_MAX; - - // Sparkline data: - out.data = []; - - // Sparkline description: - out.description = ''; - - // Accessor indicating whether a datum is defined: - out.isDefined = isDefined; - - // Data label: - out.label = ''; - - return out; -} - - -// EXPORTS // - -module.exports = defaults; diff --git a/sparklines/base/ctor/lib/index.js b/sparklines/base/ctor/lib/index.js deleted file mode 100644 index e8ec386..0000000 --- a/sparklines/base/ctor/lib/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Base class for sparklines. -* -* @module @stdlib/plot/sparklines/base/ctor -* -* @example -* var Sparkline = require( '@stdlib/plot/sparklines/base/ctor' ); -* -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* -* var chart = Sparkline( data ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/sparklines/base/ctor/lib/main.js b/sparklines/base/ctor/lib/main.js deleted file mode 100644 index 0a44018..0000000 --- a/sparklines/base/ctor/lib/main.js +++ /dev/null @@ -1,433 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var EventEmitter = require( 'events' ).EventEmitter; -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var inherit = require( '@stdlib/utils/inherit' ); -var isObject = require( '@stdlib/assert/is-plain-object' ); -var isCollection = require( '@stdlib/assert/is-collection' ); -var mergeFcn = require( '@stdlib/utils/merge' ).factory; -var format = require( '@stdlib/string/format' ); -var defaults = require( './defaults.js' ); -var setAutoRender = require( './props/auto-render/set.js' ); -var getAutoRender = require( './props/auto-render/get.js' ); -var setBufferSize = require( './props/buffer-size/set.js' ); -var getBufferSize = require( './props/buffer-size/get.js' ); -var setData = require( './props/data/set.js' ); -var getData = require( './props/data/get.js' ); -var setDescription = require( './props/description/set.js' ); -var getDescription = require( './props/description/get.js' ); -var setIsDefined = require( './props/is-defined/set.js' ); -var getIsDefined = require( './props/is-defined/get.js' ); -var setLabel = require( './props/label/set.js' ); -var getLabel = require( './props/label/get.js' ); -var push = require( './push.js' ); -var render = require( './render' ); -var stub = require( './render/stub.js' ); -var toString = require( './tostring.js' ); // eslint-disable-line stdlib/no-redeclare - - -// VARIABLES // - -var debug = logger( 'sparkline:main' ); - -var merge = mergeFcn({ - 'extend': false -}); - -// List of private properties (note: keep in alphabetical order): -var PRIVATE_PROPS = [ - '_autoRender', - '_bufferSize', - '_data', - '_description', - '_isDefined', - '_labels' -]; - - -// MAIN // - -/** -* Sparkline constructor. -* -* @constructor -* @param {(Collection|ndarrayLike)} [data] - sparkline data -* @param {Options} [options] - sparkline options -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a `change` event -* @param {(PositiveInteger|null)} [options.bufferSize] - data buffer size -* @param {(Collection|ndarrayLike)} [options.data] - data -* @param {string} [options.description=''] - sparkline description -* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined -* @param {string} [options.label] - data label -* @throws {TypeError} must provide valid options -* @returns {Sparkline} sparkline instance -* -* @example -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* -* var chart = Sparkline( data ); -* -* @example -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* var opts = { -* 'data': data -* }; -* var chart = Sparkline( opts ); -*/ -function Sparkline() { - var options; - var nargs; - var opts; - var keys; - var self; - var key; - var i; - - nargs = arguments.length; - if ( !(this instanceof Sparkline) ) { - if ( nargs === 0 ) { - return new Sparkline(); - } - if ( nargs === 1 ) { - return new Sparkline( arguments[ 0 ] ); - } - return new Sparkline( arguments[ 0 ], arguments[ 1 ] ); - } - self = this; - - opts = defaults(); - if ( nargs === 0 ) { - options = {}; - } else if ( nargs === 1 ) { - if ( isCollection( arguments[ 0 ] ) ) { - options = { - 'data': arguments[ 0 ] - }; - } else { - options = arguments[ 0 ]; - if ( !isObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - } - } else { - if ( !isObject( arguments[ 1 ] ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', arguments[ 1 ] ) ); - } - options = arguments[ 1 ]; - options.data = arguments[ 0 ]; - } - opts = merge( opts, options ); - - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( opts ) ); - EventEmitter.call( this ); - - for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { - defineProperty( this, PRIVATE_PROPS[i], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - }); - } - - // Set options... - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - this[ key ] = opts[ key ]; - } - - // Add event listeners: - this.on( 'change', onChange ); - this.on( 'render', onRender ); - - return this; - - /** - * Callback invoked upon receiving a `change` event. - * - * @private - */ - function onChange() { - /* eslint-disable no-underscore-dangle */ - debug( 'Received a change event.' ); - if ( self._autoRender ) { - self.render(); - } - } - - /** - * Callback invoked upon receiving a `render` event. - * - * @private - * @param {*} chart - rendered chart - */ - function onRender() { - debug( 'Received a render event.' ); - } -} - -/* -* Inherit from the `EventEmitter` prototype. -*/ -inherit( Sparkline, EventEmitter ); - -/** -* Rendering mode. -* -* ## Notes -* -* - If `true`, an instance re-renders on each `change` event. -* -* @name autoRender -* @memberof Sparkline.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var chart = new Sparkline({ -* 'autoRender': true -* }); -* -* var mode = chart.autoRender; -* // returns true -*/ -defineProperty( Sparkline.prototype, 'autoRender', { - 'configurable': false, - 'enumerable': true, - 'set': setAutoRender, - 'get': getAutoRender -}); - -/** -* Size of data buffer. -* -* @name bufferSize -* @memberof Sparkline.prototype -* @type {(PositiveInteger|null)} -* @throws {TypeError} must be a positive integer or null -* @throws {RangeError} must be greater than or equal to the number of data elements -* -* @example -* var chart = new Sparkline(); -* chart.bufferSize = 20; -* -* @example -* var chart = new Sparkline({ -* 'bufferSize': 25 -* }); -* var size = chart.bufferSize; -* // returns 25 -*/ -defineProperty( Sparkline.prototype, 'bufferSize', { - 'configurable': false, - 'enumerable': true, - 'set': setBufferSize, - 'get': getBufferSize -}); - -/** -* Sparkline data. -* -* @name data -* @memberof Sparkline.prototype -* @type {(ArrayLikeObject|ndarrayLike)} -* @throws {TypeError} must be an array-like object or an ndarray -* @throws {RangeError} length must not exceed maximum data buffer size -* -* @example -* var chart = new Sparkline(); -* chart.data = [ 1.0, 0.0, 3.14, 2.0, 5.0 ]; -* -* @example -* var data = [ 1.0, 0.0, 3.14, 2.0, 5.0 ]; -* var chart = new Sparkline({ -* 'data': data -* }); -* var d = chart.data; -* // returns [ 1.0, 0.0, 3.14, 2.0, 5.0 ] -*/ -defineProperty( Sparkline.prototype, 'data', { - 'configurable': false, - 'enumerable': true, - 'set': setData, - 'get': getData -}); - -/** -* Sparkline description. -* -* @name description -* @memberof Sparkline.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default '' -* -* @example -* var chart = new Sparkline(); -* chart.description = 'Average daily stock market index for the past year.'; -* -* @example -* var chart = new Sparkline({ -* 'description': 'A description.' -* }); -* var desc = chart.description; -* // returns 'A description.' -*/ -defineProperty( Sparkline.prototype, 'description', { - 'configurable': false, - 'enumerable': true, - 'set': setDescription, - 'get': getDescription -}); - -/** -* Accessor which defines whether a datum is defined. -* -* ## Notes -* -* - This accessor is used to define how missing values are encoded. The default behavior is to ignore values which are `NaN`. -* -* @name isDefined -* @memberof Sparkline.prototype -* @type {Function} -* @param {*} d - datum -* @param {integer} i - index -* @throws {TypeError} must be a function -* -* @example -* var chart = new Sparkline(); -* chart.isDefined = function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* -* @example -* function isDefined( d ) { -* // Check for `NaN`: -* return ( d === d ); -* } -* var chart = new Sparkline({ -* 'isDefined': isDefined -* }); -* var fcn = chart.isDefined; -* // returns -*/ -defineProperty( Sparkline.prototype, 'isDefined', { - 'configurable': false, - 'enumerable': true, - 'set': setIsDefined, - 'get': getIsDefined -}); - -/** -* Data label. -* -* @name label -* @memberof Sparkline.prototype -* @type {string} -* @throws {TypeError} must be a string -* @default '' -* -* @example -* var chart = new Sparkline(); -* chart.label = 'beep'; -* -* @example -* var chart = new Sparkline({ -* 'label': 'beep' -* }); -* var label = chart.label; -* // returns 'beep' -*/ -defineProperty( Sparkline.prototype, 'label', { - 'configurable': false, - 'enumerable': true, - 'set': setLabel, - 'get': getLabel -}); - -/** -* Appends data. -* -* @name push -* @memberof Sparkline.prototype -* @type {Function} -* @param {*} datum - data to append -* @returns {Sparkline} chart instance -* -* @example -* var data = [ 1.0, 0.0, 3.14, 2.0, 5.0 ]; -* -* var chart = new Sparkline({ -* 'data': data -* }); -* -* chart.push( 6.0 ).push( -3.14 ).push( -1.0 ); -*/ -Sparkline.prototype.push = push; - -/** -* Renders a sparkline. -* -* @name render -* @memberof Sparkline.prototype -* @type {Function} -* @returns {string} rendered sparkline -*/ -Sparkline.prototype.render = render; - -/** -* Renders a sparkline. -* -* ## Notes -* -* - This method **should** be implemented by descendants. -* -* @private -* @name _render -* @memberof Sparkline.prototype -* @type {Function} -* @returns {string} rendered sparkline -*/ -Sparkline.prototype._render = stub; - -/** -* Serializes a sparkline as a string. -* -* @name toString -* @memberof Sparkline.prototype -* @type {Function} -* @returns {string} serialized sparkline -*/ -Sparkline.prototype.toString = toString; - -// TODO: stub `toJSON` method, which, similar to `render`, should be implemented by descendants, as will be chart type specific - - -// EXPORTS // - -module.exports = Sparkline; diff --git a/sparklines/base/ctor/lib/props/auto-render/get.js b/sparklines/base/ctor/lib/props/auto-render/get.js deleted file mode 100644 index 7df40de..0000000 --- a/sparklines/base/ctor/lib/props/auto-render/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the rendering mode. -* -* @private -* @returns {boolean} rendering mode -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._autoRender; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/base/ctor/lib/props/auto-render/set.js b/sparklines/base/ctor/lib/props/auto-render/set.js deleted file mode 100644 index e899788..0000000 --- a/sparklines/base/ctor/lib/props/auto-render/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:set:auto-render' ); - - -// MAIN // - -/** -* Sets the rendering mode. -* -* @private -* @param {boolean} bool - boolean indicating whether to re-render on a change event -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'autoRender', bool ) ); - } - if ( bool !== this._autoRender ) { - debug( 'Current value: %d.', this._autoRender ); - - this._autoRender = bool; - debug( 'New Value: %d.', this._autoRender ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/base/ctor/lib/props/buffer-size/get.js b/sparklines/base/ctor/lib/props/buffer-size/get.js deleted file mode 100644 index 7687400..0000000 --- a/sparklines/base/ctor/lib/props/buffer-size/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the data buffer size. -* -* @private -* @returns {number} data buffer size -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._bufferSize; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/base/ctor/lib/props/buffer-size/set.js b/sparklines/base/ctor/lib/props/buffer-size/set.js deleted file mode 100644 index ba0a629..0000000 --- a/sparklines/base/ctor/lib/props/buffer-size/set.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive; -var isNull = require( '@stdlib/assert/is-null' ); -var format = require( '@stdlib/string/format' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:set:buffer-size' ); - - -// MAIN // - -/** -* Sets the data buffer size. -* -* @param {(PositiveInteger|null)} size - data buffer size -* @throws {TypeError} must be a positive integer or null -* @throws {RangeError} must be greater than or equal to the number of data elements -*/ -function set( size ) { - /* eslint-disable no-invalid-this */ - var FLG = isNull( size ); - if ( !isPositiveInteger( size ) && !FLG ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a positive integer or null. Value: `%s`.', 'bufferSize', size ) ); - } - if ( FLG ) { - size = FLOAT64_MAX; - } - if ( this._data && size < this._data.length ) { - throw new RangeError( format( 'invalid assignment. `%s` size is less than the number of data elements. Number of elements: `%u`. Value: `%u`.', 'bufferSize', this._data.length, size ) ); - } - if ( size !== this._bufferSize ) { - debug( 'Current value: %s.', this._bufferSize ); - - this._bufferSize = size; - debug( 'New value: %s.', this._bufferSize ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/base/ctor/lib/props/data/get.js b/sparklines/base/ctor/lib/props/data/get.js deleted file mode 100644 index c42a909..0000000 --- a/sparklines/base/ctor/lib/props/data/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns sparkline data. -* -* @private -* @returns {Array} sparkline data -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._data.slice(); -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/base/ctor/lib/props/data/set.js b/sparklines/base/ctor/lib/props/data/set.js deleted file mode 100644 index cfcc099..0000000 --- a/sparklines/base/ctor/lib/props/data/set.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isCollection = require( '@stdlib/assert/is-collection' ); -var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:set:data' ); - - -// MAIN // - -/** -* Sets the sparkline data. -* -* @private -* @param {(Collection|ndarrayLike)} data - sparkline data -* @throws {TypeError} must be an array-like object or an ndarray -* @throws {RangeError} length must not exceed maximum data buffer size -*/ -function set( data ) { - /* eslint-disable no-invalid-this */ - var FLG; - var i; - - FLG = isndarrayLike( data ) && typeof data.iget === 'function'; - if ( !isCollection( data ) && !FLG ) { - throw new TypeError( format( 'invalid assignment. `%s` must be an array-like object or an ndarray. Value: `%s`.', 'data', data ) ); - } - if ( data.length > this._bufferSize ) { - throw new RangeError( format( 'invalid assignment. `%s` length exceeds maximum data buffer size. Buffer size: `%u`. Length: `%u`.', 'data', this._bufferSize, data.length ) ); - } - debug( 'Current value: %s.', JSON.stringify( this._data ) ); - - this._data = []; - if ( FLG ) { - for ( i = 0; i < data.length; i++ ) { - this._data.push( data.iget( i ) ); - } - } else { - for ( i = 0; i < data.length; i++ ) { - this._data.push( data[ i ] ); - } - } - debug( 'New value: %s.', JSON.stringify( this._data ) ); - this.emit( 'change' ); -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/base/ctor/lib/props/description/get.js b/sparklines/base/ctor/lib/props/description/get.js deleted file mode 100644 index d67c978..0000000 --- a/sparklines/base/ctor/lib/props/description/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the description. -* -* @private -* @returns {string} description -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._description; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/base/ctor/lib/props/description/set.js b/sparklines/base/ctor/lib/props/description/set.js deleted file mode 100644 index 445c0ba..0000000 --- a/sparklines/base/ctor/lib/props/description/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'plot:set:description' ); - - -// MAIN // - -/** -* Sets the description. -* -* @private -* @param {string} str - description -* @throws {TypeError} must be a string -* @returns {void} -*/ -function set( str ) { - /* eslint-disable no-invalid-this */ - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'description', str ) ); - } - if ( str !== this._description ) { - debug( 'Current value: %s.', this._description ); - - this._description = str; - debug( 'New value: %s.', this._description ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/base/ctor/lib/props/is-defined/get.js b/sparklines/base/ctor/lib/props/is-defined/get.js deleted file mode 100644 index fd05f22..0000000 --- a/sparklines/base/ctor/lib/props/is-defined/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the accessor for defined values. -* -* @private -* @returns {Function} accessor -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._isDefined; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/base/ctor/lib/props/is-defined/set.js b/sparklines/base/ctor/lib/props/is-defined/set.js deleted file mode 100644 index 275ed62..0000000 --- a/sparklines/base/ctor/lib/props/is-defined/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:set:is-defined' ); - - -// MAIN // - -/** -* Sets the accessor for defined values. -* -* @private -* @param {Function} fcn - accessor -* @throws {TypeError} must be a function -* @returns {void} -*/ -function set( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'isDefined', fcn ) ); - } - if ( fcn !== this._isDefined ) { - debug( 'Current value: %s.', this._isDefined ); - - this._isDefined = fcn; - debug( 'New Value: %s.', this._isDefined ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/base/ctor/lib/props/label/get.js b/sparklines/base/ctor/lib/props/label/get.js deleted file mode 100644 index 0288e4e..0000000 --- a/sparklines/base/ctor/lib/props/label/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the data label. -* -* @private -* @returns {string} label -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._label; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/base/ctor/lib/props/label/set.js b/sparklines/base/ctor/lib/props/label/set.js deleted file mode 100644 index cb2b7d5..0000000 --- a/sparklines/base/ctor/lib/props/label/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:set:label' ); - - -// MAIN // - -/** -* Sets the data label. -* -* @private -* @param {string} label - data label -* @throws {TypeError} must be a string -* @returns {void} -*/ -function set( label ) { - /* eslint-disable no-invalid-this */ - if ( !isString( label ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a string. Value: `%s`.', 'label', label ) ); - } - if ( label !== this._label ) { - debug( 'Current value: %s.', this._label ); - - this._label = label; - debug( 'New Value: %s.', this._label ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/base/ctor/lib/push.js b/sparklines/base/ctor/lib/push.js deleted file mode 100644 index 4ded91d..0000000 --- a/sparklines/base/ctor/lib/push.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:push' ); - - -// MAIN // - -/** -* Appends data. -* -* @private -* @param {*} datum - data to append -* @returns {Sparkline} class instance -*/ -function push( datum ) { - /* eslint-disable no-invalid-this */ - debug( 'Current value: %s.', JSON.stringify( this._data ) ); - if ( this._data.length >= this._bufferSize ) { - this._data.shift(); - } - this._data.push( datum ); - - debug( 'New value: %s.', JSON.stringify( this._data ) ); - this.emit( 'change' ); - - return this; -} - - -// EXPORTS // - -module.exports = push; diff --git a/sparklines/base/ctor/lib/render/index.js b/sparklines/base/ctor/lib/render/index.js deleted file mode 100644 index 4ddc779..0000000 --- a/sparklines/base/ctor/lib/render/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:render' ); - - -// MAIN // - -/** -* Renders a sparkline. -* -* @private -* @returns {*} rendered sparkline -*/ -function render() { - /* eslint-disable no-invalid-this */ - var out; - - debug( 'Rendering...' ); - out = this._render(); - - this.emit( 'render', out ); - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/sparklines/base/ctor/lib/render/stub.js b/sparklines/base/ctor/lib/render/stub.js deleted file mode 100644 index 98180cb..0000000 --- a/sparklines/base/ctor/lib/render/stub.js +++ /dev/null @@ -1,34 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Placeholder `render` function. -* -* @private -* @throws {Error} must be implemented by descendant classes -*/ -function render() { - throw new Error( 'not implemented' ); -} - - -// EXPORTS // - -module.exports = render; diff --git a/sparklines/base/ctor/lib/tostring.js b/sparklines/base/ctor/lib/tostring.js deleted file mode 100644 index 6b456b3..0000000 --- a/sparklines/base/ctor/lib/tostring.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Serializes a sparkline as a string. -* -* @private -* @returns {string} serialized sparkline -*/ -function toString() { // eslint-disable-line stdlib/no-redeclare - /* eslint-disable no-invalid-this */ - return this.render(); -} - - -// EXPORTS // - -module.exports = toString; diff --git a/sparklines/base/ctor/package.json b/sparklines/base/ctor/package.json deleted file mode 100644 index f5e5944..0000000 --- a/sparklines/base/ctor/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@stdlib/plot/sparklines/base/ctor", - "version": "0.0.0", - "description": "Base class for sparklines.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "chart", - "graph", - "graphic", - "data", - "sparklines", - "sparkline", - "visualize", - "viz", - "vis" - ] -} diff --git a/sparklines/base/ctor/test/test.auto_render.js b/sparklines/base/ctor/test/test.auto_render.js deleted file mode 100644 index 620b2bf..0000000 --- a/sparklines/base/ctor/test/test.auto_render.js +++ /dev/null @@ -1,195 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `autoRender` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var sparkline = ctor(); - sparkline.autoRender = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'autoRender': false - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - t.strictEqual( sparkline.autoRender, false, 'returns expected value' ); - - sparkline.autoRender = true; - t.strictEqual( sparkline.autoRender, true, 'returns expected value' ); - - sparkline.autoRender = false; - t.strictEqual( sparkline.autoRender, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'if `autoRender` is `true`, when a returned instance receives a `change` event, it re-renders and emits a `render` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'autoRender': true, - 'data': [ 0.10, 0.50, 0.90 ] - }); - sparkline._render = render; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'render', onRender ); - sparkline.emit( 'change' ); - - function render() { - return '...'; - } - - function onRender( str ) { - t.ok( true, 'emits a render event' ); - t.strictEqual( str, '...', 'provides expected value' ); - t.end(); - } -}); - -tape( 'if `autoRender` is `false`, when a returned instance receives a `change` event, it does not re-render or emit a `render` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'autoRender': false - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'render', onRender ); - sparkline.emit( 'change' ); - - t.pass( 'is ok' ); - t.end(); - - function onRender() { - t.fail( 'should never be invoked' ); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'autoRender': true - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'change', onChange ); - sparkline.autoRender = false; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'autoRender': false - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'change', onChange ); - sparkline.autoRender = true; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'autoRender': true - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'change', onChange ); - sparkline.autoRender = true; - - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'autoRender': false - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'change', onChange ); - sparkline.autoRender = false; - - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); diff --git a/sparklines/base/ctor/test/test.buffer_size.js b/sparklines/base/ctor/test/test.buffer_size.js deleted file mode 100644 index a65048d..0000000 --- a/sparklines/base/ctor/test/test.buffer_size.js +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `bufferSize` value', function test( t ) { - var values; - var i; - - values = [ - '5', - -5, - 0, - 3.14, - NaN, - void 0, - true, - false, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var sparkline = ctor(); - sparkline.bufferSize = value; - }; - } -}); - -tape( 'an instance throws an error if provided a `bufferSize` which is less than the number of data elements', function test( t ) { - var values; - var i; - - values = [ - 1, - 2, - 3, - 4, - 5 - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var sparkline = ctor({ - 'data': [ 1, 2, 3, 4, 5, 6 ] - }); - sparkline.bufferSize = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'bufferSize': 10 - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - t.strictEqual( sparkline.bufferSize, 10, 'returns expected value' ); - - sparkline.bufferSize = 20; - t.strictEqual( sparkline.bufferSize, 20, 'returns expected value' ); - - sparkline.bufferSize = 30; - t.strictEqual( sparkline.bufferSize, 30, 'returns expected value' ); - - sparkline.bufferSize = null; - t.strictEqual( sparkline.bufferSize, FLOAT64_MAX, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `bufferSize` property to a new value triggers a `change` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'bufferSize': 10 - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'change', onChange ); - sparkline.bufferSize = 30; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `bufferSize` property to its current value does not trigger a `change` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'bufferSize': 10 - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'change', onChange ); - sparkline.bufferSize = 10; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/base/ctor/test/test.data.js b/sparklines/base/ctor/test/test.data.js deleted file mode 100644 index fa8ad91..0000000 --- a/sparklines/base/ctor/test/test.data.js +++ /dev/null @@ -1,131 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var ndarray = require( '@stdlib/ndarray/ctor' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `data` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var sparkline = ctor(); - sparkline.data = value; - }; - } -}); - -tape( 'an instance throws an error if provided a `data` value which more data elements than the data buffer size', function test( t ) { - var values; - var i; - - values = [ - [ 1, 2 ], - [ 1, 2, 3 ], - [ 1, 2, 3, 4 ] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var sparkline = ctor({ - 'bufferSize': 1 - }); - sparkline.data = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var sparkline; - var arr; - - arr = [ 1, 2, 3 ]; - sparkline = ctor({ - 'data': arr - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - t.notEqual( sparkline.data, arr, 'returns a new reference' ); - t.deepEqual( sparkline.data, arr, 'returns expected value' ); - - arr = [ 4, 5, 6 ]; - sparkline.data = arr; - t.notEqual( sparkline.data, arr, 'returns a new reference' ); - t.deepEqual( sparkline.data, arr, 'returns expected value' ); - - arr = ndarray( 'generic', [ 7, 8, 9 ], [ 3 ], [ 1 ], 0, 'row-major' ); - sparkline.data = arr; - t.notEqual( sparkline.data, arr, 'returns a new reference' ); - t.deepEqual( sparkline.data, [ 7, 8, 9 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `data` property triggers a `change` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'data': [ 1, 2, 3 ] - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'change', onChange ); - sparkline.data = [ 4, 5, 6 ]; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); diff --git a/sparklines/base/ctor/test/test.description.js b/sparklines/base/ctor/test/test.description.js deleted file mode 100644 index a88705b..0000000 --- a/sparklines/base/ctor/test/test.description.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `description` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var sparkline = ctor(); - sparkline.description = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'description': 'beep' - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - t.strictEqual( sparkline.description, 'beep', 'returns expected value' ); - - sparkline.description = 'boop'; - t.strictEqual( sparkline.description, 'boop', 'returns expected value' ); - - sparkline.description = 'foo'; - t.strictEqual( sparkline.description, 'foo', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `description` property to a new value triggers a `change` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'description': 'beep' - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'change', onChange ); - sparkline.description = 'boop'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `description` property to its current value does not trigger a `change` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'description': 'beep' - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'change', onChange ); - sparkline.description = 'beep'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/base/ctor/test/test.is_defined.js b/sparklines/base/ctor/test/test.is_defined.js deleted file mode 100644 index 91bb53a..0000000 --- a/sparklines/base/ctor/test/test.is_defined.js +++ /dev/null @@ -1,136 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `isDefined` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var sparkline = ctor(); - sparkline.isDefined = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'isDefined': noop - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - t.strictEqual( sparkline.isDefined, noop, 'returns expected value' ); - - sparkline.isDefined = isDefined; - t.strictEqual( sparkline.isDefined, isDefined, 'returns expected value' ); - - t.end(); - - function isDefined( d ) { - return d === d; - } -}); - -tape( 'the default behavior is to treat `NaN` values as undefined', function test( t ) { - var sparkline = ctor(); - t.strictEqual( sparkline.isDefined( NaN ), false, 'returns expected value' ); - t.strictEqual( sparkline.isDefined( 5 ), true, 'returns expected value' ); - t.strictEqual( sparkline.isDefined( null ), true, 'returns expected value' ); - t.strictEqual( sparkline.isDefined( '' ), true, 'returns expected value' ); - t.strictEqual( sparkline.isDefined( [] ), true, 'returns expected value' ); - t.strictEqual( sparkline.isDefined( {} ), true, 'returns expected value' ); - t.strictEqual( sparkline.isDefined( 'foo' ), true, 'returns expected value' ); - t.strictEqual( sparkline.isDefined( true ), true, 'returns expected value' ); - t.strictEqual( sparkline.isDefined( false ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'setting the `isDefined` property to a new value triggers a `change` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'isDefined': noop - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'change', onChange ); - sparkline.isDefined = isDefined; - - function isDefined( d ) { - return d === d; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `isDefined` property to its current value does not trigger a `change` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'isDefined': noop - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'change', onChange ); - sparkline.isDefined = noop; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/base/ctor/test/test.js b/sparklines/base/ctor/test/test.js deleted file mode 100644 index 9c3c6fb..0000000 --- a/sparklines/base/ctor/test/test.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Sparkline = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Sparkline, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the export is a class constructor', function test( t ) { - var sparkline = new Sparkline(); - t.strictEqual( sparkline instanceof Sparkline, true, 'returns class instance' ); - t.end(); -}); diff --git a/sparklines/base/ctor/test/test.label.js b/sparklines/base/ctor/test/test.label.js deleted file mode 100644 index b0ec6e0..0000000 --- a/sparklines/base/ctor/test/test.label.js +++ /dev/null @@ -1,115 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `label` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - {}, - [], - [ 'beep' ], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var sparkline = ctor(); - sparkline.label = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'label': 'beep' - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - t.strictEqual( sparkline.label, 'beep', 'returns expected value' ); - - sparkline.label = 'boop'; - t.strictEqual( sparkline.label, 'boop', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `label` property to a new value triggers a `change` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'label': 'a' - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'change', onChange ); - sparkline.label = 'b'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property to its current value does not trigger a `change` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'label': 'a' - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'change', onChange ); - sparkline.label = 'a'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/base/ctor/test/test.main.js b/sparklines/base/ctor/test/test.main.js deleted file mode 100644 index 4644c5a..0000000 --- a/sparklines/base/ctor/test/test.main.js +++ /dev/null @@ -1,335 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var Sparkline = require( './../lib/main.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Sparkline, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the export is a class constructor', function test( t ) { - var sparkline = new Sparkline(); - t.strictEqual( sparkline instanceof Sparkline, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (no data, no options)', function test( t ) { - var sparkline; - var ctor; - - ctor = Sparkline; - sparkline = ctor(); - - t.strictEqual( sparkline instanceof Sparkline, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (data)', function test( t ) { - var sparkline; - var ctor; - - ctor = Sparkline; - sparkline = ctor( [ 1, 2, 3 ] ); - - t.strictEqual( sparkline instanceof Sparkline, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (options)', function test( t ) { - var sparkline; - var ctor; - - ctor = Sparkline; - sparkline = ctor({ - 'bufferSize': 10, - 'description': 'beep', - 'isDefined': noop, - 'data': [ 1, 2, 3 ], - 'autoRender': true, - 'label': 'foo' - }); - - t.strictEqual( sparkline instanceof Sparkline, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (data and options)', function test( t ) { - var sparkline; - var ctor; - - ctor = Sparkline; - sparkline = ctor( [ 1, 2, 3 ], { - 'description': 'beep', - 'bufferSize': 10, - 'isDefined': noop, - 'autoRender': true, - 'label': 'foo' - }); - - t.strictEqual( sparkline instanceof Sparkline, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor will throw an error if provided an invalid options argument (no data argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var sparkline = new Sparkline( value ); // eslint-disable-line no-unused-vars - }; - } -}); - -tape( 'the constructor will throw an error if provided an invalid options argument (data argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var sparkline = new Sparkline( [ 1, 2, 3 ], value ); // eslint-disable-line no-unused-vars - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid option (no data argument)', function test( t ) { - t.throws( foo, TypeError, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var sparkline = new Sparkline({ - 'description': [] - }); - } -}); - -tape( 'the constructor throws an error if provided an invalid option (data argument)', function test( t ) { - t.throws( foo, TypeError, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var sparkline = new Sparkline( [ 1, 2, 3 ], { - 'description': [] - }); - } -}); - -tape( 'the constructor throws an error if provided a `bufferSize` option which is less than the number of data elements (options)', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var sparkline = new Sparkline({ - 'data': [ 1, 2, 3, 4, 5 ], - 'bufferSize': 3 - }); - } -}); - -tape( 'the constructor throws an error if provided a `bufferSize` option which is less than the number of data elements (data argument)', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var sparkline = new Sparkline( [ 1, 2, 3, 4, 5 ], { - 'bufferSize': 3 - }); - } -}); - -tape( 'an instance has a writable `autoRender` property', function test( t ) { - var sparkline; - var expected; - var opts; - - sparkline = new Sparkline(); - t.strictEqual( sparkline.autoRender, false, 'default value is false' ); - - opts = { - 'autoRender': true - }; - sparkline = new Sparkline( opts ); - - expected = true; - t.strictEqual( sparkline.autoRender, expected, 'returns expected value' ); - - sparkline.autoRender = false; - - expected = false; - t.strictEqual( sparkline.autoRender, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `bufferSize` property', function test( t ) { - var sparkline; - var opts; - - sparkline = new Sparkline(); - t.strictEqual( sparkline.bufferSize, FLOAT64_MAX, 'default value is the maximum double-precision floating-point number' ); - - opts = { - 'bufferSize': 20 - }; - sparkline = new Sparkline( opts ); - t.strictEqual( sparkline.bufferSize, opts.bufferSize, 'returns expected value' ); - - sparkline.bufferSize = 5; - t.strictEqual( sparkline.bufferSize, 5, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `data` property', function test( t ) { - var sparkline; - var expected; - var opts; - - sparkline = new Sparkline(); - t.deepEqual( sparkline.data, [], 'default value is an empty array' ); - - opts = { - 'data': [ 1, 2, 3 ] - }; - sparkline = new Sparkline( opts ); - - expected = [ 1, 2, 3 ]; - t.deepEqual( sparkline.data, expected, 'returns expected value' ); - - sparkline.data = [ 4, 5, 6 ]; - - expected = [ 4, 5, 6 ]; - t.deepEqual( sparkline.data, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `isDefined` property', function test( t ) { - var sparkline; - var expected; - var opts; - - sparkline = new Sparkline(); - t.strictEqual( typeof sparkline.isDefined, 'function', 'default value is a function' ); - - opts = { - 'isDefined': noop - }; - sparkline = new Sparkline( opts ); - - expected = noop; - t.deepEqual( sparkline.isDefined, expected, 'returns expected value' ); - - sparkline.isDefined = noop; - - expected = noop; - t.deepEqual( sparkline.isDefined, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `label` property', function test( t ) { - var sparkline; - var expected; - var opts; - - sparkline = new Sparkline(); - t.strictEqual( sparkline.label, '', 'default value is an empty string' ); - - opts = { - 'label': 'foo' - }; - sparkline = new Sparkline( opts ); - - expected = 'foo'; - t.strictEqual( sparkline.label, expected, 'returns expected value' ); - - sparkline.label = 'bar'; - - expected = 'bar'; - t.strictEqual( sparkline.label, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a `push` method for appending data', function test( t ) { - var sparkline = new Sparkline(); - t.strictEqual( typeof sparkline.push, 'function', 'has push method' ); - t.end(); -}); - -tape( 'an instance has a `render` method for rendering a sparkline', function test( t ) { - var sparkline = new Sparkline(); - t.strictEqual( typeof sparkline.render, 'function', 'has render method' ); - t.end(); -}); - -tape( 'an instance has a `toString` method for serializing a sparkline to a string', function test( t ) { - var sparkline = new Sparkline(); - t.strictEqual( typeof sparkline.toString, 'function', 'has toString method' ); - t.end(); -}); diff --git a/sparklines/base/ctor/test/test.push.js b/sparklines/base/ctor/test/test.push.js deleted file mode 100644 index 341573b..0000000 --- a/sparklines/base/ctor/test/test.push.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function appends a datum to the sparkline data', function test( t ) { - var sparkline; - var expected; - var data; - var v; - - data = [ 1, 2, 3 ]; - sparkline = ctor({ - 'data': data - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.push( 4 ); - v = sparkline.data; - - expected = [ 1, 2, 3, 4 ]; - t.deepEqual( v, expected, 'appends to sparkline data' ); - - t.end(); -}); - -tape( 'if appending data to the internal data buffer will result in the sparkline data exceeding the data buffer size, the function will remove the first data element', function test( t ) { - var sparkline; - var expected; - var data; - var v; - - data = [ 1, 2, 3 ]; - sparkline = ctor({ - 'data': data, - 'bufferSize': 3 - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.push( 4 ); - v = sparkline.data; - - expected = [ 2, 3, 4 ]; - t.deepEqual( v, expected, 'removes first data element' ); - - t.end(); -}); - -tape( 'appending `data` triggers a `change` event', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'data': [ 1, 2, 3 ] - }); - sparkline._render = noop; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'change', onChange ); - sparkline.push( 4 ); - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); diff --git a/sparklines/base/ctor/test/test.render.js b/sparklines/base/ctor/test/test.render.js deleted file mode 100644 index 7d3b6ea..0000000 --- a/sparklines/base/ctor/test/test.render.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the `render` method throws an error if instances or child classes do not implement a `_render` method', function test( t ) { - var sparkline = ctor(); - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - sparkline.render(); - } -}); - -tape( 'the `render` method emits a `render` event upon rendering', function test( t ) { - var sparkline; - - sparkline = ctor({ - 'data': [ 1, 2, 3 ] - }); - sparkline._render = render; // eslint-disable-line no-underscore-dangle - - sparkline.on( 'render', onRender ); - sparkline.render(); - - function render() { - return '...'; - } - - function onRender( str ) { - t.ok( true, 'triggers event' ); - t.strictEqual( str, '...', 'provides expected value' ); - t.end(); - } -}); diff --git a/sparklines/base/ctor/test/test.tostring.js b/sparklines/base/ctor/test/test.tostring.js deleted file mode 100644 index a7b5bf8..0000000 --- a/sparklines/base/ctor/test/test.tostring.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the `toString` method serializes a sparkline as a string by rendering a sparkline', function test( t ) { - var sparkline; - var str; - - sparkline = ctor(); - sparkline._render = render; // eslint-disable-line no-underscore-dangle - - str = sparkline.toString(); - t.strictEqual( str, '▁█▅▃▆▆▅', 'returns expected value' ); - - t.end(); - - function render() { - return '▁█▅▃▆▆▅'; - } -}); diff --git a/sparklines/base/examples/index.js b/sparklines/base/examples/index.js deleted file mode 100644 index c7e940d..0000000 --- a/sparklines/base/examples/index.js +++ /dev/null @@ -1,24 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var objectKeys = require( '@stdlib/utils/keys' ); -var ns = require( './../lib' ); - -console.log( objectKeys( ns ) ); diff --git a/sparklines/base/lib/index.js b/sparklines/base/lib/index.js deleted file mode 100644 index af35d67..0000000 --- a/sparklines/base/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/* -* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name. -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); - - -// MAIN // - -/** -* Top-level namespace. -* -* @namespace ns -*/ -var ns = {}; - -/** -* @name Sparkline -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/plot/sparklines/base/ctor} -*/ -setReadOnly( ns, 'Sparkline', require( './../../../sparklines/base/ctor' ) ); - - -// EXPORTS // - -module.exports = ns; diff --git a/sparklines/base/package.json b/sparklines/base/package.json deleted file mode 100644 index 5dfbe71..0000000 --- a/sparklines/base/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@stdlib/plot/sparklines/base", - "version": "0.0.0", - "description": "Base (i.e., lower-level) sparkline functionality.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "standard", - "library", - "std", - "lib", - "sparklines", - "sparkline", - "base", - "plot", - "data", - "vis", - "viz", - "visualization" - ] -} diff --git a/sparklines/base/test/test.js b/sparklines/base/test/test.js deleted file mode 100644 index 14dda1f..0000000 --- a/sparklines/base/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var ns = require( './../lib' ); - - -// TESTS // - -tape( 'main export is an object', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof ns, 'object', 'main export is an object' ); - t.end(); -}); - -tape( 'the exported object contains key-value pairs', function test( t ) { - var keys = objectKeys( ns ); - t.equal( keys.length > 0, true, 'has keys' ); - t.end(); -}); diff --git a/sparklines/examples/index.js b/sparklines/examples/index.js deleted file mode 100644 index c7e940d..0000000 --- a/sparklines/examples/index.js +++ /dev/null @@ -1,24 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var objectKeys = require( '@stdlib/utils/keys' ); -var ns = require( './../lib' ); - -console.log( objectKeys( ns ) ); diff --git a/sparklines/lib/index.js b/sparklines/lib/index.js deleted file mode 100644 index e896110..0000000 --- a/sparklines/lib/index.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/* -* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name. -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); - - -// MAIN // - -/** -* Top-level namespace. -* -* @namespace ns -*/ -var ns = {}; - -/** -* @name base -* @memberof ns -* @readonly -* @type {Namespace} -* @see {@link module:@stdlib/plot/sparklines/base} -*/ -setReadOnly( ns, 'base', require( './../../sparklines/base' ) ); - -/** -* @name unicode -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/plot/sparklines/unicode} -*/ -setReadOnly( ns, 'unicode', require( './../../sparklines/unicode' ) ); - - -// EXPORTS // - -module.exports = ns; diff --git a/sparklines/package.json b/sparklines/package.json deleted file mode 100644 index 9161987..0000000 --- a/sparklines/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@stdlib/plot/sparklines", - "version": "0.0.0", - "description": "Sparklines.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "standard", - "library", - "std", - "lib", - "sparklines", - "sparkline", - "plot", - "data", - "vis", - "viz", - "visualization", - "unicode" - ] -} diff --git a/sparklines/test/test.js b/sparklines/test/test.js deleted file mode 100644 index 14dda1f..0000000 --- a/sparklines/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var ns = require( './../lib' ); - - -// TESTS // - -tape( 'main export is an object', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof ns, 'object', 'main export is an object' ); - t.end(); -}); - -tape( 'the exported object contains key-value pairs', function test( t ) { - var keys = objectKeys( ns ); - t.equal( keys.length > 0, true, 'has keys' ); - t.end(); -}); diff --git a/sparklines/unicode/README.md b/sparklines/unicode/README.md deleted file mode 100644 index 22202e2..0000000 --- a/sparklines/unicode/README.md +++ /dev/null @@ -1,546 +0,0 @@ - - -# Unicode Sparkline - -> Create a Unicode sparkline. - -
- -## Usage - -```javascript -var UnicodeSparkline = require( '@stdlib/plot/sparklines/unicode' ); -``` - -#### UnicodeSparkline( \[data,] \[options] ) - -Returns a chart instance. - -```javascript -var chart = new UnicodeSparkline(); -``` - -The constructor accepts the following `options`: - -- **autoRender**: `boolean` indicating whether to re-render on a `change` event. -- **bufferSize**: data buffer size. If provided, data is kept in a first-in first-out (FIFO) buffer which cannot exceed the buffer size. Default: `+infinity`. -- **data**: chart data. -- **description**: chart description. -- **infinities**: `boolean` flag indicating whether to encode infinite values. Default: `false`. -- **isDefined**: accessor `function` indicating whether a datum is defined. -- **label**: data label. -- **type**: chart type. Default: `'column'`. -- **yMax**: maximum value of the y-axis domain. If set to `null`, the maximum value is computed from the data. -- **yMin**: minimum value of the y-axis domain. If set to `null`, the minimum value is computed from the data. - -* * * - -### Writable Properties - - - -#### UnicodeSparkline.prototype.autoRender - -Rendering mode. If `true`, an instance renders on each `'change'` event; otherwise, rendering must be triggered manually. - -```javascript -var chart = new UnicodeSparkline(); - -// Set: -chart.autoRender = false; - -// Get: -var mode = chart.autoRender; -// returns false -``` - - - -#### UnicodeSparkline.prototype.bufferSize - -Data buffer size. If set, this specifies the maximum number of data elements which can be rendered. Once the data buffer is full, each new datum results in the oldest datum being removed. - -```javascript -var chart = new UnicodeSparkline(); - -// Set: -chart.bufferSize = 3; - -// Get: -var size = chart.bufferSize; -// returns 3 - -chart.data = [ 1, 2, 3 ]; - -var data = chart.data; -// returns [ 1, 2, 3 ] - -chart.push( 4 ); - -data = chart.data; -// returns [ 2, 3, 4 ] -``` - -Setting a data buffer size is useful when rendering data streams. - - - -#### UnicodeSparkline.prototype.data - -Chart data. When set, the value must be either `array`-like or an [ndarray][@stdlib/ndarray/ctor] and cannot exceed the `bufferSize`. - -```javascript -var Float64Array = require( '@stdlib/array/float64' ); - -var chart = new UnicodeSparkline(); - -// Set: -chart.data = new Float64Array( [ 3.14, 5.0, -3.14, -1.0 ] ); - -// Get: -var data = chart.data; -// returns [ 3.14, 5.0, -3.14, -1.0 ] -``` - -Note that data is **copied** to an internal data buffer. - - - -#### UnicodeSparkline.prototype.description - -Chart description. - -```javascript -var chart = new UnicodeSparkline(); - -// Set: -chart.description = 'Daily stock prices for the past 30 days.'; - -// Get: -var desc = chart.description; -// returns 'Daily stock prices for the past 30 days.' -``` - - - -#### UnicodeSparkline.prototype.infinities - -`Boolean` flag indicating whether to render infinite values. For certain chart types, when set to `false`, infinite values are considered missing values. Otherwise, for those same chart types, both positive and negative infinity are encoded as `∞`. - -```javascript -var chart = new UnicodeSparkline(); - -chart.infinities = true; - -chart.data = [ - 1.0, - 5.0, - NaN, - Infinity, - 4.0, - -Infinity, - 3.0 -]; - -var str = chart.render(); -// returns '▁█ ∞▆∞▅' -``` - - - -#### UnicodeSparkline.prototype.isDefined( d, i ) - -An accessor `function` which defines whether a datum is defined. This accessor is used to define how missing values are encoded. When invoked, the function is provided two arguments: - -- **d**: datum. -- **i**: datum index. - -```javascript -function isDefined( d ) { - return ( d !== null ); -} - -var chart = new UnicodeSparkline(); - -// Set: -chart.isDefined = isDefined; - -// Get: -var fcn = chart.isDefined; -// returns -``` - -The default behavior is **dependent** on the chart type. - - - -#### UnicodeSparkline.prototype.label - -Data label. - -```javascript -var chart = new UnicodeSparkline(); - -// Set: -chart.label = 'beep'; - -// Get: -var label = chart.label; -// returns 'beep' -``` - - - -#### UnicodeSparkline.prototype.type - -Chart type. - -```javascript -var chart = new UnicodeSparkline(); - -// Set: -chart.type = 'line'; - -// Get: -var type = chart.type; -// returns 'line' -``` - -The following chart types are supported: - -- [`'column'`][@stdlib/plot/sparklines/unicode/column]: column chart (e.g., `▃▆▂▄▁▅▅`). -- [`'line'`][@stdlib/plot/sparklines/unicode/line]: line chart (e.g., `⡈⠑⠢⠔⠒⠒⠒`). -- [`'tristate'`][@stdlib/plot/sparklines/unicode/tristate]: tristate chart (e.g., `▄▀──▀▄▄▀`). -- [`'up-down'`][@stdlib/plot/sparklines/unicode/up-down]: up/down chart (e.g., `↓↑↑↑↑↓↓↑`). -- [`'win-loss'`][@stdlib/plot/sparklines/unicode/win-loss]: win/loss chart (e.g., `┌╵└┴╵╷╷╵`). - - - -#### UnicodeSparkline.prototype.yMin - -Minimum value of the y-axis domain. If this value is set to a value other than `null`, the y-axis lower bound is fixed; otherwise, the minimum value is computed from the chart data. - -```javascript -var chart = new UnicodeSparkline( [ -1.0, 5.0, -3.0, 2.0, -4.0, 4.0, 3.0 ] ); - -chart.yMin = 0.0; - -var str = chart.render(); -// returns '▁█▁▄▁▇▅' -``` - - - -#### UnicodeSparkline.prototype.yMax - -Maximum value of the y-axis domain. If this value is set to a value other than `null`, the y-axis upper bound is fixed; otherwise, the maximum value is computed based on the chart data. - -```javascript -var chart = new UnicodeSparkline( [ -1.0, 5.0, -3.0, 2.0, -4.0, 4.0, 3.0 ] ); - -chart.yMax = 10.0; - -var str = chart.render(); -// returns '▃▆▂▄▁▅▅' -``` - -* * * - -### Methods - - - -#### UnicodeSparkline.prototype.push( datum ) - -Appends data to a chart. - -```javascript -var chart = new UnicodeSparkline( [ 1, 2, 3 ] ); - -var data = chart.data; -// returns [ 1, 2, 3 ] - -chart.push( 4 ); - -data = chart.data; -// returns [ 1, 2, 3, 4 ] -``` - - - -#### UnicodeSparkline.prototype.render() - -Renders a Unicode sparkline. - -```javascript -var chart = new UnicodeSparkline( [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ] ); - -var str = chart.render(); -// returns '▁█▅▃▆▆▅' - -// Render a line chart from the same data: -chart.type = 'line'; - -str = chart.render(); -// returns '⡈⠑⠢⠔⠒⠒⠒' -``` - - - -#### UnicodeSparkline.prototype.toString() - -Serializes a Unicode sparkline as a `string` by calling the `render()` method. - -```javascript -var chart = new UnicodeSparkline( [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ] ); - -var str = chart.toString(); -// returns '▁█▅▃▆▆▅' -``` - -* * * - -### Events - -#### 'change' - -Emitted whenever a property value changes. - -```javascript -var chart = new UnicodeSparkline(); - -chart.on( 'change', onChange ); - -function onChange() { - console.log( 'A property was updated.' ); -} -``` - -#### 'render' - -Emitted whenever a sparkline is rendered. - -```javascript -var chart = new UnicodeSparkline(); - -chart.on( 'render', onRender ); - -function onRender( str ) { - console.log( 'Rendered sparkline: %s', str ); -} -``` - -
- - - -
- -
- - - -
- -* * * - -## Examples - - - - - -```javascript -var stdout = require( '@stdlib/streams/node/stdout' ); -var randu = require( '@stdlib/random/base/randu' ); -var Float64Array = require( '@stdlib/array/float64' ); -var sparkline = require( '@stdlib/plot/sparklines/unicode' ); - -var chart; -var data; -var id; -var i; - -// Generate some random data... -data = new Float64Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = randu() * 100.0; -} - -// Create a sparkline chart: -chart = sparkline( data ); - -// Hide the terminal cursor: -stdout.write( '\u001b[?25l' ); - -// Render the chart in the terminal: -stdout.write( chart.render() ); - -// Configure the chart to support streaming data: -chart.bufferSize = data.length; -chart.yMin = 0.0; -chart.yMax = 100.0; - -// Update the terminal chart with new data every second: -id = setInterval( update, 1000 ); - -// After some time, stop updating and close: -setTimeout( stop, 20000 ); - -function update() { - // Update the chart with new data: - chart.push( randu()*100.0 ); - - // Clear the terminal line and render the chart: - stdout.write( '\r\u001b[2K' + chart.render() ); -} - -function stop() { // eslint-disable-line stdlib/no-redeclare - clearInterval( id ); - - // Restore the terminal cursor: - stdout.write( '\u001b[?25h' ); - - stdout.write( '\n' ); -} -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: sparkline [options] ... - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Separator used to split stdin data. Default: /\\r?\\n/. - --type type Chart type. Default: column. - --ymin min Minimum value of y-axis domain. - --ymax max Maximum value of y-axis domain. - --infinities Encode infinite values. -``` - -
- - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is properly **escaped**. - - ```bash - # Not escaped... - $ echo -n $'1\n2\n3\n' | sparkline --split /\r?\n/ - - # Escaped... - $ echo -n $'1\n2\n3\n' | sparkline --split /\\r?\\n/ - ``` - -
- - - -
- -### Examples - -```bash -$ sparkline 1 2 3 4 5 6 -▁▂▄▅▇█ -``` - -```bash -$ echo -n $'1\n2\n3\n4\n5\n6\n' | sparkline --ymax 3 -▁▅████ -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/sparklines/unicode/benchmark/benchmark.js b/sparklines/unicode/benchmark/benchmark.js deleted file mode 100644 index 7a1f95e..0000000 --- a/sparklines/unicode/benchmark/benchmark.js +++ /dev/null @@ -1,396 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var noop = require( '@stdlib/utils/noop' ); -var randu = require( '@stdlib/random/base/randu' ); -var isArray = require( '@stdlib/assert/is-array' ); -var pkg = require( './../package.json' ).name; -var UnicodeSparkline = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::instantiation', function benchmark( b ) { - var v; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new UnicodeSparkline(); - if ( !( v instanceof UnicodeSparkline ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof UnicodeSparkline ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,no_new', function benchmark( b ) { - var ctor; - var v; - var i; - - ctor = UnicodeSparkline; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = ctor(); - if ( !( v instanceof UnicodeSparkline ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof UnicodeSparkline ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,options', function benchmark( b ) { - var opts; - var v; - var i; - - opts = { - 'autoRender': false, - 'bufferSize': 10, - 'data': [ 1, 2, 3 ], - 'description': 'foo', - 'label': 'beep', - 'infinities': true, - 'isDefined': noop, - 'type': 'line', - 'yMax': 0, - 'yMin': 4 - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new UnicodeSparkline( opts ); - if ( !( v instanceof UnicodeSparkline ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof UnicodeSparkline ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,data', function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new UnicodeSparkline( [ 1, 2, 3 ] ); - if ( !( v instanceof UnicodeSparkline ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof UnicodeSparkline ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,data,options', function benchmark( b ) { - var opts; - var v; - var i; - - opts = { - 'autoRender': false, - 'bufferSize': 10, - 'description': 'foo', - 'label': 'beep', - 'infinities': true, - 'isDefined': noop, - 'type': 'line', - 'yMax': 0, - 'yMin': 4 - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new UnicodeSparkline( [ 1, 2, 3 ], opts ); - if ( !( v instanceof UnicodeSparkline ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof UnicodeSparkline ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:autoRender', function benchmark( b ) { - var bool; - var v; - var i; - - v = new UnicodeSparkline(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.autoRender = !bool; - if ( typeof v.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( typeof v.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:bufferSize', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 10, - 20, - 30 - ]; - v = new UnicodeSparkline(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.bufferSize = values[ i % values.length ]; - if ( typeof v.bufferSize !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( typeof v.bufferSize !== 'number' ) { - b.fail( 'should return a number' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:data', function benchmark( b ) { - var v; - var i; - - v = new UnicodeSparkline(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.data = [ randu(), randu(), randu() ]; - if ( typeof v.data !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArray( v.data ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:description', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'beep', - 'boop' - ]; - v = new UnicodeSparkline(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.description = values[ i % values.length ]; - if ( typeof v.description !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.description !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:infinities', function benchmark( b ) { - var bool; - var v; - var i; - - v = new UnicodeSparkline(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.infinities = !bool; - if ( typeof v.infinities !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( typeof v.infinities !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:isDefined', function benchmark( b ) { - var v; - var i; - - v = new UnicodeSparkline(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.isDefined = createFcn(); - if ( typeof v.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof v.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createFcn() { - return beep; - function beep() { - // No-op... - } - } -}); - -bench( pkg+'::set,get:label', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'beep', - 'boop' - ]; - v = new UnicodeSparkline(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.label = values[ i % values.length ]; - if ( typeof v.label !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.label !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:type', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'column', - 'line', - 'tristate', - 'up-down', - 'win-loss' - ]; - v = new UnicodeSparkline(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.type = values[ i % values.length ]; - if ( typeof v.type !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.type !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:yMax', function benchmark( b ) { - var v; - var i; - - v = new UnicodeSparkline(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.yMax = i; - if ( v.yMax !== i ) { - b.fail( 'unexpected value' ); - } - } - b.toc(); - if ( v.yMax !== i-1 ) { - b.fail( 'unexpected value' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:yMin', function benchmark( b ) { - var v; - var i; - - v = new UnicodeSparkline(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.yMin = i; - if ( v.yMin !== i ) { - b.fail( 'unexpected value' ); - } - } - b.toc(); - if ( v.yMin !== i-1 ) { - b.fail( 'unexpected value' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/sparklines/unicode/benchmark/benchmark.render.js b/sparklines/unicode/benchmark/benchmark.render.js deleted file mode 100644 index b2a732c..0000000 --- a/sparklines/unicode/benchmark/benchmark.render.js +++ /dev/null @@ -1,230 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var Float64Array = require( '@stdlib/array/float64' ); -var pkg = require( './../package.json' ).name; -var UnicodeSparkline = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @param {UnicodeSparkline} chart - chart instance -* @returns {Function} benchmark function -*/ -function createBenchmark( len, chart ) { - var datum; - var x; - var i; - - x = new Float64Array( len ); - if ( chart.type === 'column' || chart.type === 'line' ) { - datum = randu; - } else if ( chart.type === 'tristate' ) { - datum = tristate; - } else if ( chart.type === 'win-loss' ) { - datum = winloss; - } else { - datum = updown; - } - for ( i = 0; i < x.length; i++ ) { - x[ i ] = datum(); - } - chart.data = x; - return benchmark; - - /** - * Returns a tristate chart datum. - * - * @private - * @returns {number} datum - */ - function tristate() { - var r = randu(); - if ( r > 0.66 ) { - return 1; - } - if ( r > 0.33 ) { - return 0; - } - return -1; - } - - /** - * Returns a win-loss chart datum. - * - * @private - * @returns {number} datum - */ - function winloss() { - var r = randu(); - if ( r > 0.66 ) { - return 2; - } - if ( r > 0.33 ) { - return 1; - } - if ( r > 0.15 ) { - return -1; - } - return -2; - } - - /** - * Returns an up-down chart datum. - * - * @private - * @returns {number} datum - */ - function updown() { - var r = randu(); - if ( r > 0.5 ) { - return 1; - } - return -1; - } - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var str; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = chart.push( datum() ).render(); - if ( typeof str !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof str !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var chart; - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 4; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - chart = new UnicodeSparkline({ - 'bufferSize': len - }); - f = createBenchmark( len, chart ); - bench( pkg+':render:type=default,len='+len, f ); - - chart = new UnicodeSparkline({ - 'bufferSize': len, - 'yMin': 0.0, - 'yMax': 1.0 - }); - f = createBenchmark( len, chart ); - bench( pkg+'::ymin,ymax:render:type=default,len='+len, f ); - - chart = new UnicodeSparkline({ - 'bufferSize': len, - 'type': 'column' - }); - f = createBenchmark( len, chart ); - bench( pkg+':render:type=column,len='+len, f ); - - chart = new UnicodeSparkline({ - 'bufferSize': len, - 'type': 'column', - 'yMin': 0.0, - 'yMax': 1.0 - }); - f = createBenchmark( len, chart ); - bench( pkg+'::ymin,ymax:render:type=column,len='+len, f ); - - chart = new UnicodeSparkline({ - 'bufferSize': len, - 'type': 'line' - }); - f = createBenchmark( len, chart ); - bench( pkg+':render:type=line,len='+len, f ); - - chart = new UnicodeSparkline({ - 'bufferSize': len, - 'type': 'line', - 'yMin': 0.0, - 'yMax': 1.0 - }); - f = createBenchmark( len, chart ); - bench( pkg+'::ymin,ymax:render:type=line,len='+len, f ); - - chart = new UnicodeSparkline({ - 'bufferSize': len, - 'type': 'tristate' - }); - f = createBenchmark( len, chart ); - bench( pkg+':render:type=tristate,len='+len, f ); - - chart = new UnicodeSparkline({ - 'bufferSize': len, - 'type': 'up-down' - }); - f = createBenchmark( len, chart ); - bench( pkg+':render:type=up-down,len='+len, f ); - - chart = new UnicodeSparkline({ - 'bufferSize': len, - 'type': 'win-loss' - }); - f = createBenchmark( len, chart ); - bench( pkg+':render:type=win-loss,len='+len, f ); - } -} - -main(); diff --git a/sparklines/unicode/bin/cli b/sparklines/unicode/bin/cli deleted file mode 100755 index ce6e4c2..0000000 --- a/sparklines/unicode/bin/cli +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var sparkline = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var opts; - var cli; - var i; - - opts = {}; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Get any provided command-line flags: - if ( flags.type ) { - opts.type = flags.type; - } - if ( flags.ymin ) { - opts.yMin = parseFloat( flags.ymin ); - } - if ( flags.ymax ) { - opts.yMax = parseFloat( flags.ymax ); - } - if ( flags.infinities ) { - opts.infinities = flags.infinities; - } - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - opts.split = reFromString( flags.split ); - } else { - opts.split = RE_EOL; - } - return stdin( onRead ); - } - for ( i = 0; i < args.length; i++ ) { - args[ i ] = parseFloat( args[ i ] ); - } - console.log( sparkline( args, opts ).render() ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( opts.split ); - for ( i = 0; i < lines.length; i++ ) { - lines[ i ] = parseFloat( lines[ i ] ); - } - console.log( sparkline( lines, opts ).render() ); // eslint-disable-line no-console - } -} - -main(); diff --git a/sparklines/unicode/column/README.md b/sparklines/unicode/column/README.md deleted file mode 100644 index 37caef1..0000000 --- a/sparklines/unicode/column/README.md +++ /dev/null @@ -1,513 +0,0 @@ - - -# Column Chart - -> Create a Unicode sparkline column chart. - -
- -## Usage - -```javascript -var ColumnChart = require( '@stdlib/plot/sparklines/unicode/column' ); -``` - -#### ColumnChart( \[data,] \[options] ) - -Returns a chart instance. - -```javascript -var chart = new ColumnChart(); -``` - -The constructor accepts the following `options`: - -- **autoRender**: `boolean` indicating whether to re-render on a `change` event. -- **bufferSize**: data buffer size. If provided, data is kept in a first-in first-out (FIFO) buffer which cannot exceed the buffer size. Default: `+infinity`. -- **data**: chart data. -- **description**: chart description. -- **infinities**: `boolean` flag indicating whether to encode infinite values. Default: `false`. -- **isDefined**: accessor `function` indicating whether a datum is defined. -- **label**: data label. -- **yMax**: maximum value of the y-axis domain. If set to `null`, the maximum value is computed from the data. -- **yMin**: minimum value of the y-axis domain. If set to `null`, the minimum value is computed from the data. - -* * * - -### Writable Properties - - - -#### ColumnChart.prototype.autoRender - -Rendering mode. If `true`, an instance renders on each `'change'` event; otherwise, rendering must be triggered manually. - -```javascript -var chart = new ColumnChart(); - -// Set: -chart.autoRender = false; - -// Get: -var mode = chart.autoRender; -// returns false -``` - - - -#### ColumnChart.prototype.bufferSize - -Data buffer size. If set, this specifies the maximum number of data elements which can be rendered. Once the data buffer is full, each new datum results in the oldest datum being removed. - -```javascript -var chart = new ColumnChart(); - -// Set: -chart.bufferSize = 3; - -// Get: -var size = chart.bufferSize; -// returns 3 - -chart.data = [ 1, 2, 3 ]; - -var data = chart.data; -// returns [ 1, 2, 3 ] - -chart.push( 4 ); - -data = chart.data; -// returns [ 2, 3, 4 ] -``` - -Setting a data buffer size is useful when rendering data streams. - - - -#### ColumnChart.prototype.data - -Chart data. When set, the value must be either `array`-like or an [ndarray][@stdlib/ndarray/ctor] and cannot exceed the `bufferSize`. - -```javascript -var Float64Array = require( '@stdlib/array/float64' ); - -var chart = new ColumnChart(); - -// Set: -chart.data = new Float64Array( [ 3.14, 5.0, -3.14, -1.0 ] ); - -// Get: -var data = chart.data; -// returns [ 3.14, 5.0, -3.14, -1.0 ] -``` - -Note that data is **copied** to an internal data buffer. - - - -#### ColumnChart.prototype.description - -Chart description. - -```javascript -var chart = new ColumnChart(); - -// Set: -chart.description = 'Daily stock prices for the past 30 days.'; - -// Get: -var desc = chart.description; -// returns 'Daily stock prices for the past 30 days.' -``` - - - -#### ColumnChart.prototype.infinities - -`Boolean` flag indicating whether to render infinite values. When set to `false`, infinite values are considered missing values. When set to `true`, both positive and negative infinity are encoded as `∞`. - -```javascript -var chart = new ColumnChart(); - -chart.infinities = true; - -chart.data = [ - 1.0, - 5.0, - NaN, - Infinity, - 4.0, - -Infinity, - 3.0 -]; - -var str = chart.render(); -// returns '▁█ ∞▆∞▅' -``` - - - -#### ColumnChart.prototype.isDefined( d, i ) - -An accessor `function` which defines whether a datum is defined. This accessor is used to define how missing values are encoded. When invoked, the function is provided two arguments: - -- **d**: datum. -- **i**: datum index. - -```javascript -function isDefined( d ) { - return ( d !== null ); -} - -var chart = new ColumnChart(); - -// Set: -chart.isDefined = isDefined; - -// Get: -var fcn = chart.isDefined; -// returns -``` - -The default behavior is to ignore values which are `NaN`. - - - -#### ColumnChart.prototype.label - -Data label. - -```javascript -var chart = new ColumnChart(); - -// Set: -chart.label = 'beep'; - -// Get: -var label = chart.label; -// returns 'beep' -``` - - - -#### ColumnChart.prototype.yMin - -Minimum value of the y-axis domain. If this value is set to a value other than `null`, the y-axis lower bound is fixed; otherwise, the minimum value is computed from the chart data. - -```javascript -var chart = new ColumnChart( [ -1.0, 5.0, -3.0, 2.0, -4.0, 4.0, 3.0 ] ); - -chart.yMin = 0.0; - -var str = chart.render(); -// returns '▁█▁▄▁▇▅' -``` - - - -#### ColumnChart.prototype.yMax - -Maximum value of the y-axis domain. If this value is set to a value other than `null`, the y-axis upper bound is fixed; otherwise, the maximum value is computed based on the chart data. - -```javascript -var chart = new ColumnChart( [ -1.0, 5.0, -3.0, 2.0, -4.0, 4.0, 3.0 ] ); - -chart.yMax = 10.0; - -var str = chart.render(); -// returns '▃▆▂▄▁▅▅' -``` - -* * * - -### Methods - - - -#### ColumnChart.prototype.push( datum ) - -Appends data to a chart. - -```javascript -var chart = new ColumnChart( [ 1, 2, 3 ] ); - -var data = chart.data; -// returns [ 1, 2, 3 ] - -chart.push( 4 ); - -data = chart.data; -// returns [ 1, 2, 3, 4 ] -``` - - - -#### ColumnChart.prototype.render() - -Renders a column chart sparkline. - -```javascript -var chart = new ColumnChart( [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ] ); - -var str = chart.render(); -// returns '▁█▅▃▆▆▅' -``` - - - -#### ColumnChart.prototype.toString() - -Serializes a column chart sparkline as a `string` by calling the `render()` method. - -```javascript -var chart = new ColumnChart( [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ] ); - -var str = chart.toString(); -// returns '▁█▅▃▆▆▅' -``` - -* * * - -### Events - -#### 'change' - -Emitted whenever a property value changes. - -```javascript -var chart = new ColumnChart(); - -chart.on( 'change', onChange ); - -function onChange() { - console.log( 'A property was updated.' ); -} -``` - -#### 'render' - -Emitted whenever a sparkline is rendered. - -```javascript -var chart = new ColumnChart(); - -chart.on( 'render', onRender ); - -function onRender( str ) { - console.log( 'Rendered sparkline: %s', str ); -} -``` - -
- - - -
- -
- - - -
- -* * * - -## Examples - - - - - -```javascript -var stdout = require( '@stdlib/streams/node/stdout' ); -var randu = require( '@stdlib/random/base/randu' ); -var Float64Array = require( '@stdlib/array/float64' ); -var columnChart = require( '@stdlib/plot/sparklines/unicode/column' ); - -var chart; -var data; -var id; -var i; - -// Generate some random data... -data = new Float64Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = randu() * 100.0; -} - -// Create a new column chart: -chart = columnChart( data ); - -// Hide the terminal cursor: -stdout.write( '\u001b[?25l' ); - -// Render the chart in the terminal: -stdout.write( chart.render() ); - -// Configure the chart to support streaming data: -chart.bufferSize = data.length; -chart.yMin = 0.0; -chart.yMax = 100.0; - -// Update the terminal chart with new data every second: -id = setInterval( update, 1000 ); - -// After some time, stop updating and close: -setTimeout( stop, 20000 ); - -function update() { - // Update the chart with new data: - chart.push( randu()*100.0 ); - - // Clear the terminal line and render the chart: - stdout.write( '\r\u001b[2K' + chart.render() ); -} - -function stop() { - clearInterval( id ); - - // Restore the terminal cursor: - stdout.write( '\u001b[?25h' ); - - stdout.write( '\n' ); -} -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: sparkline-column [options] ... - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Separator used to split stdin data. Default: /\\r?\\n/. - --ymin min Minimum value of y-axis domain. - --ymax max Maximum value of y-axis domain. - --infinities Encode infinite values. -``` - -
- - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is properly **escaped**. - - ```bash - # Not escaped... - $ echo -n $'1\n2\n3\n' | sparkline-column --split /\r?\n/ - - # Escaped... - $ echo -n $'1\n2\n3\n' | sparkline-column --split /\\r?\\n/ - ``` - -
- - - -
- -### Examples - -```bash -$ sparkline-column 1 2 3 4 5 6 -▁▂▄▅▇█ -``` - -```bash -$ echo -n $'1\n2\n3\n4\n5\n6\n' | sparkline-column --ymax 3 -▁▅████ -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/sparklines/unicode/column/benchmark/benchmark.js b/sparklines/unicode/column/benchmark/benchmark.js deleted file mode 100644 index 1c357dc..0000000 --- a/sparklines/unicode/column/benchmark/benchmark.js +++ /dev/null @@ -1,365 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var noop = require( '@stdlib/utils/noop' ); -var randu = require( '@stdlib/random/base/randu' ); -var isArray = require( '@stdlib/assert/is-array' ); -var pkg = require( './../package.json' ).name; -var ColumnChart = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::instantiation', function benchmark( b ) { - var v; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new ColumnChart(); - if ( !( v instanceof ColumnChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof ColumnChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,no_new', function benchmark( b ) { - var ctor; - var v; - var i; - - ctor = ColumnChart; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = ctor(); - if ( !( v instanceof ColumnChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof ColumnChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,options', function benchmark( b ) { - var opts; - var v; - var i; - - opts = { - 'autoRender': false, - 'bufferSize': 10, - 'data': [ 1, 2, 3 ], - 'description': 'foo', - 'label': 'beep', - 'infinities': true, - 'isDefined': noop, - 'yMax': 0, - 'yMin': 4 - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new ColumnChart( opts ); - if ( !( v instanceof ColumnChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof ColumnChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,data', function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new ColumnChart( [ 1, 2, 3 ] ); - if ( !( v instanceof ColumnChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof ColumnChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,data,options', function benchmark( b ) { - var opts; - var v; - var i; - - opts = { - 'autoRender': false, - 'bufferSize': 10, - 'description': 'foo', - 'label': 'beep', - 'infinities': true, - 'isDefined': noop, - 'yMax': 0, - 'yMin': 4 - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new ColumnChart( [ 1, 2, 3 ], opts ); - if ( !( v instanceof ColumnChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof ColumnChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:autoRender', function benchmark( b ) { - var bool; - var v; - var i; - - v = new ColumnChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.autoRender = !bool; - if ( typeof v.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( typeof v.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:bufferSize', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 10, - 20, - 30 - ]; - v = new ColumnChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.bufferSize = values[ i % values.length ]; - if ( typeof v.bufferSize !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( typeof v.bufferSize !== 'number' ) { - b.fail( 'should return a number' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:data', function benchmark( b ) { - var v; - var i; - - v = new ColumnChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.data = [ randu(), randu(), randu() ]; - if ( typeof v.data !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArray( v.data ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:description', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'beep', - 'boop' - ]; - v = new ColumnChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.description = values[ i % values.length ]; - if ( typeof v.description !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.description !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:infinities', function benchmark( b ) { - var bool; - var v; - var i; - - v = new ColumnChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.infinities = !bool; - if ( typeof v.infinities !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( typeof v.infinities !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:isDefined', function benchmark( b ) { - var v; - var i; - - v = new ColumnChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.isDefined = createFcn(); - if ( typeof v.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof v.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createFcn() { - return beep; - function beep() { - // No-op... - } - } -}); - -bench( pkg+'::set,get:label', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'beep', - 'boop' - ]; - v = new ColumnChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.label = values[ i % values.length ]; - if ( typeof v.label !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.label !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:yMax', function benchmark( b ) { - var v; - var i; - - v = new ColumnChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.yMax = i; - if ( v.yMax !== i ) { - b.fail( 'unexpected value' ); - } - } - b.toc(); - if ( v.yMax !== i-1 ) { - b.fail( 'unexpected value' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:yMin', function benchmark( b ) { - var v; - var i; - - v = new ColumnChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.yMin = i; - if ( v.yMin !== i ) { - b.fail( 'unexpected value' ); - } - } - b.toc(); - if ( v.yMin !== i-1 ) { - b.fail( 'unexpected value' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/sparklines/unicode/column/benchmark/benchmark.render.js b/sparklines/unicode/column/benchmark/benchmark.render.js deleted file mode 100644 index b5fdef4..0000000 --- a/sparklines/unicode/column/benchmark/benchmark.render.js +++ /dev/null @@ -1,116 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var Float64Array = require( '@stdlib/array/float64' ); -var pkg = require( './../package.json' ).name; -var ColumnChart = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @param {ColumnChart} chart - chart instance -* @returns {Function} benchmark function -*/ -function createBenchmark( len, chart ) { - var x; - var i; - - x = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = randu(); - } - chart.data = x; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var str; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = chart.push( randu() ).render(); - if ( typeof str !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof str !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var chart; - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 4; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - chart = new ColumnChart({ - 'bufferSize': len - }); - f = createBenchmark( len, chart ); - bench( pkg+':render:len='+len, f ); - - chart = new ColumnChart({ - 'bufferSize': len, - 'yMin': 0.0, - 'yMax': 1.0 - }); - f = createBenchmark( len, chart ); - bench( pkg+'::ymin,ymax:render:len='+len, f ); - } -} - -main(); diff --git a/sparklines/unicode/column/bin/cli b/sparklines/unicode/column/bin/cli deleted file mode 100755 index 8eae57e..0000000 --- a/sparklines/unicode/column/bin/cli +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var sparkline = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var opts; - var cli; - var i; - - opts = {}; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - if ( flags.ymin ) { - opts.yMin = parseFloat( flags.ymin ); - } - if ( flags.ymax ) { - opts.yMax = parseFloat( flags.ymax ); - } - if ( flags.infinities ) { - opts.infinities = flags.infinities; - } - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - opts.split = reFromString( flags.split ); - } else { - opts.split = RE_EOL; - } - return stdin( onRead ); - } - for ( i = 0; i < args.length; i++ ) { - args[ i ] = parseFloat( args[ i ] ); - } - console.log( sparkline( args, opts ).render() ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( opts.split ); - for ( i = 0; i < lines.length; i++ ) { - lines[ i ] = parseFloat( lines[ i ] ); - } - console.log( sparkline( lines, opts ).render() ); // eslint-disable-line no-console - } -} - -main(); diff --git a/sparklines/unicode/column/docs/repl.txt b/sparklines/unicode/column/docs/repl.txt deleted file mode 100644 index 90a5268..0000000 --- a/sparklines/unicode/column/docs/repl.txt +++ /dev/null @@ -1,95 +0,0 @@ - -{{alias}}( [data,] [options] ) - Returns a sparkline column chart instance. - - The `data` argument takes precedence over the `data` option. - - Parameters - ---------- - data: ArrayLike|ndarray (optional) - Chart data. - - options: Object (optional) - Options. - - options.autoRender: boolean (optional) - Boolean indicating whether to re-render on a 'change' event. Default: - false. - - options.bufferSize: integer|null (optional) - Data buffer size. If provided, data is kept in a first-in first-out - (FIFO) buffer which cannot exceed the buffer size. Default: +infinity. - - options.data: ArrayLike|ndarray (optional) - Chart data. - - options.description: string (optional) - Chart description. - - options.infinities: boolean (optional) - Boolean indicating whether to encode infinite values. Default: false. - - options.isDefined: Function (optional) - An accessor function indicating whether a datum is defined. - - options.label: string (optional) - Data label. - - options.yMax: number|null (optional) - Maximum value of the y-axis domain. If `null`, the value is computed - from the data. Default: null. - - options.yMin: number|null (optional) - Minimum value of the y-axis domain. If `null`, the value is computed - from the data. Default: null. - - Returns - ------- - chart: ColumnChart - Column chart instance. - - chart.autoRender - Rendering mode. If `true`, an instance renders on each 'change' event; - otherwise, rendering must be triggered manually. - - chart.bufferSize - Data buffer size. - - chart.description - Chart description. - - chart.data - Chart data. - - chart.label - Data label. - - chart.infinities - Indicates whether to encode infinite values. - - chart.isDefined( d, i ) - An accessor function which defines whether a datum is defined. This - accessor is used to define how missing values are encoded. The default - behavior is to ignore values which are `NaN`. - - chart.render() - Renders a column chart sparkline. - - chart.yMax - Maximum value of the y-axis domain. If set to `null`, when accessed, the - returned value is computed from the data. - - chart.yMin - Minimum value of the y-axis domain. If set to `null`, when accessed, the - returned value is computed from the data. - - Examples - -------- - > var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; - > var chart = new {{alias}}( data ); - > chart.render() - '▁█▅▃▆▆▅' - - See Also - -------- - diff --git a/sparklines/unicode/column/docs/usage.txt b/sparklines/unicode/column/docs/usage.txt deleted file mode 100644 index 54690d0..0000000 --- a/sparklines/unicode/column/docs/usage.txt +++ /dev/null @@ -1,11 +0,0 @@ - -Usage: sparkline-column [options] ... - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Separator used to split stdin data. Default: /\\r?\\n/. - --ymin min Minimum value of y-axis domain. - --ymax max Maximum value of y-axis domain. - --infinities Encode infinite values. diff --git a/sparklines/unicode/column/etc/cli_opts.json b/sparklines/unicode/column/etc/cli_opts.json deleted file mode 100644 index d11e5f6..0000000 --- a/sparklines/unicode/column/etc/cli_opts.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "string": [ - "split", - "ymin", - "ymax" - ], - "boolean": [ - "help", - "version", - "infinities" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/sparklines/unicode/column/examples/index.js b/sparklines/unicode/column/examples/index.js deleted file mode 100644 index 44d0257..0000000 --- a/sparklines/unicode/column/examples/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var randu = require( '@stdlib/random/base/randu' ); -var Float64Array = require( '@stdlib/array/float64' ); -var columnChart = require( './../lib' ); - -var chart; -var data; -var opts; -var str; -var i; - -// Generate some random data... -data = new Float64Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = randu() * 100.0; -} - -// Set chart options: -opts = { - 'infinities': true -}; - -// Create a new column chart: -chart = columnChart( data, opts ); - -// Render the chart as a string: -str = chart.render(); - -console.log( str ); -// => '...' diff --git a/sparklines/unicode/column/examples/update.js b/sparklines/unicode/column/examples/update.js deleted file mode 100644 index a87cea5..0000000 --- a/sparklines/unicode/column/examples/update.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var randu = require( '@stdlib/random/base/randu' ); -var Float64Array = require( '@stdlib/array/float64' ); -var stdout = require( '@stdlib/streams/node/stdout' ); -var columnChart = require( './../lib' ); - -var chart; -var data; -var id; -var i; - -// Generate some random data... -data = new Float64Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = randu() * 100.0; -} - -// Create a new column chart: -chart = columnChart( data ); - -// Hide the terminal cursor: -stdout.write( '\u001b[?25l' ); - -// Render the chart in the terminal: -stdout.write( chart.render() ); - -// Configure the chart to support streaming data: -chart.bufferSize = data.length; -chart.yMin = 0.0; -chart.yMax = 100.0; - -// Update the terminal chart with new data every second: -id = setInterval( update, 1000 ); - -// After some time, stop updating and close: -setTimeout( stop, 20000 ); - -function update() { - // Update the chart with new data: - chart.push( randu() * 100.0 ); - - // Clear the terminal line and render the chart: - stdout.write( '\r\u001b[2K' + chart.render() ); -} - -function stop() { // eslint-disable-line stdlib/no-redeclare - clearInterval( id ); - - // Restore the terminal cursor: - stdout.write( '\u001b[?25h' ); - - stdout.write( '\n' ); -} diff --git a/sparklines/unicode/column/lib/defaults.js b/sparklines/unicode/column/lib/defaults.js deleted file mode 100644 index 7a94618..0000000 --- a/sparklines/unicode/column/lib/defaults.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -/** -* Returns default options. -* -* @private -* @returns {Object} default options -*/ -function defaults() { - var out = {}; - - // Boolean indicating whether to encode infinite values: - out.infinities = false; - - // Maximum value of the y-axis domain: - out.yMax = null; - - // Minimum value of the y-axis domain: - out.yMin = null; - - return out; -} - - -// EXPORTS // - -module.exports = defaults; diff --git a/sparklines/unicode/column/lib/index.js b/sparklines/unicode/column/lib/index.js deleted file mode 100644 index 4f2f53e..0000000 --- a/sparklines/unicode/column/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Create a Unicode sparkline column chart. -* -* @module @stdlib/plot/sparklines/unicode/column -* -* @example -* var columnChart = require( '@stdlib/plot/sparklines/unicode/column' ); -* -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* -* var chart = columnChart( data ); -* -* var str = chart.render(); -* // returns '▁█▅▃▆▆▅' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/sparklines/unicode/column/lib/main.js b/sparklines/unicode/column/lib/main.js deleted file mode 100644 index b0299a2..0000000 --- a/sparklines/unicode/column/lib/main.js +++ /dev/null @@ -1,266 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var isCollection = require( '@stdlib/assert/is-collection' ); -var mergeFcn = require( '@stdlib/utils/merge' ).factory; -var pick = require( '@stdlib/utils/pick' ); -var inherit = require( '@stdlib/utils/inherit' ); -var Sparkline = require( './../../../../sparklines/base/ctor' ); -var defaults = require( './defaults.js' ); -var setInfinities = require( './props/infinities/set.js' ); -var getInfinities = require( './props/infinities/get.js' ); -var setYMax = require( './props/y-max/set.js' ); -var getYMax = require( './props/y-max/get.js' ); -var setYMin = require( './props/y-min/set.js' ); -var getYMin = require( './props/y-min/get.js' ); -var render = require( './render.js' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:column-chart:unicode:main' ); - -var merge = mergeFcn({ - 'extend': false -}); - -// List of private properties (note: keep in alphabetical order): -var PRIVATE_PROPS = [ - '_infinities', - '_yMax', - '_yMin' -]; - -// List of options properties (note: keep in alphabetical order): -var OPTIONS_PROPS = [ - 'infinities', - 'yMax', - 'yMin' -]; - - -// MAIN // - -/** -* Unicode sparkline column chart constructor. -* -* @constructor -* @param {(Collection|ndarrayLike)} [data] - chart data -* @param {Options} [options] - chart options -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a `change` event -* @param {(PositiveInteger|null)} [options.bufferSize] - data buffer size -* @param {(Collection|ndarrayLike)} [options.data] - data -* @param {string} [options.description=''] - chart description -* @param {boolean} [options.infinities=false] - boolean indicating whether to encode infinite values -* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined -* @param {string} [options.label] - data label -* @param {(FiniteNumber|null)} [options.yMax] - maximum value of the y-axis domain -* @param {(FiniteNumber|null)} [options.yMin] - minimum value of the y-axis domain -* @throws {TypeError} must provide valid options -* @returns {ColumnChart} chart instance -* -* @example -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* -* var chart = new ColumnChart( data ); -* -* var str = chart.render(); -* // returns '▁█▅▃▆▆▅' -* -* @example -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* var opts = { -* 'data': data -* }; -* var chart = new ColumnChart( opts ); -* -* var str = chart.render(); -* // returns '▁█▅▃▆▆▅' -*/ -function ColumnChart() { - var options; - var nargs; - var opts; - var keys; - var key; - var i; - - nargs = arguments.length; - if ( !(this instanceof ColumnChart) ) { - if ( nargs === 0 ) { - return new ColumnChart(); - } - if ( nargs === 1 ) { - return new ColumnChart( arguments[ 0 ] ); - } - return new ColumnChart( arguments[ 0 ], arguments[ 1 ] ); - } - // Invoke parent constructor... - if ( nargs === 0 ) { - Sparkline.call( this ); - } else if ( nargs === 1 ) { - Sparkline.call( this, arguments[ 0 ] ); - } else { - Sparkline.call( this, arguments[ 0 ], arguments[ 1 ] ); - } - // Extract chart-specific options... - opts = defaults(); - if ( nargs === 1 && !isCollection( arguments[ 0 ] ) ) { - options = arguments[ 0 ]; - } else if ( nargs === 2 ) { - options = arguments[ 1 ]; - } else { - options = {}; - } - opts = merge( opts, pick( options, OPTIONS_PROPS ) ); - - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( options ) ); - - // Initialize private chart-specific properties... - for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { - defineProperty( this, PRIVATE_PROPS[i], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - }); - } - - // Set chart-specific properties... - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - this[ key ] = opts[ key ]; - } - return this; -} - -/* -* Inherit from the `Sparkline` prototype. -*/ -inherit( ColumnChart, Sparkline ); - -/** -* Boolean indicating whether to encode infinite values. -* -* @name infinities -* @memberof ColumnChart.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var chart = new ColumnChart(); -* chart.infinities = true; -* -* @example -* var chart = new ColumnChart({ -* 'infinities': true -* }); -* var bool = chart.infinities; -* // returns true -*/ -defineProperty( ColumnChart.prototype, 'infinities', { - 'configurable': false, - 'enumerable': true, - 'set': setInfinities, - 'get': getInfinities -}); - -/** -* Maximum value of the y-axis domain. -* -* @name yMax -* @memberof ColumnChart.prototype -* @type {(FiniteNumber|null)} -* @throws {TypeError} must be a finite number or null -* -* @example -* var chart = new ColumnChart(); -* chart.yMax = 100.0; -* -* @example -* var chart = new ColumnChart({ -* 'yMax': 314.0 -* }); -* var ymax = chart.yMax; -* // returns 314.0 -*/ -defineProperty( ColumnChart.prototype, 'yMax', { - 'configurable': false, - 'enumerable': true, - 'set': setYMax, - 'get': getYMax -}); - -/** -* Minimum value of the y-axis domain. -* -* @name yMin -* @memberof ColumnChart.prototype -* @type {(FiniteNumber|null)} -* @throws {TypeError} must be a finite number or null -* -* @example -* var chart = new ColumnChart(); -* chart.yMin = -100.0; -* -* @example -* var chart = new ColumnChart({ -* 'yMin': 3.14 -* }); -* var ymin = chart.yMin; -* // returns 3.14 -*/ -defineProperty( ColumnChart.prototype, 'yMin', { - 'configurable': false, - 'enumerable': true, - 'set': setYMin, - 'get': getYMin -}); - -/** -* Renders a sparkline column chart. -* -* @private -* @name _render -* @memberof ColumnChart.prototype -* @type {Function} -* @returns {string} rendered sparkline column chart -* -* @example -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* -* var chart = new ColumnChart( data ); -* -* var str = chart.render(); -* // returns '▁█▅▃▆▆▅' -*/ -ColumnChart.prototype._render = render; // eslint-disable-line no-underscore-dangle - - -// EXPORTS // - -module.exports = ColumnChart; diff --git a/sparklines/unicode/column/lib/props/infinities/get.js b/sparklines/unicode/column/lib/props/infinities/get.js deleted file mode 100644 index 15be814..0000000 --- a/sparklines/unicode/column/lib/props/infinities/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns a flag indicating whether to encode infinite values. -* -* @private -* @returns {boolean} boolean indicating whether to encode infinite values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._infinities; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/unicode/column/lib/props/infinities/set.js b/sparklines/unicode/column/lib/props/infinities/set.js deleted file mode 100644 index 8da396a..0000000 --- a/sparklines/unicode/column/lib/props/infinities/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:column-chart:unicode:set:infinities' ); - - -// MAIN // - -/** -* Sets a flag indicating whether to encode infinite values. -* -* @private -* @param {boolean} bool - boolean flag -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'infinities', bool ) ); - } - if ( bool !== this._infinities ) { - debug( 'Current value: %s.', this._infinities ); - - this._infinities = bool; - debug( 'New value: %s.', this._infinities ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/unicode/column/lib/props/y-max/get.js b/sparklines/unicode/column/lib/props/y-max/get.js deleted file mode 100644 index 8f722bf..0000000 --- a/sparklines/unicode/column/lib/props/y-max/get.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); - - -// MAIN // - -/** -* Returns the maximum value of the y-axis domain. -* -* @private -* @returns {(FiniteNumber|null)} maximum value of the y-axis domain -*/ -function get() { - /* eslint-disable no-invalid-this */ - var max; - var len; - var d; - var i; - - if ( this._yMax === null ) { - len = this._data.length; - max = NINF; - for ( i = 0; i < len; i++ ) { - d = this._data[ i ]; - if ( this._isDefined( d ) && d !== PINF && d > max ) { - max = d; - } - } - return max; - } - return this._yMax; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/unicode/column/lib/props/y-max/set.js b/sparklines/unicode/column/lib/props/y-max/set.js deleted file mode 100644 index 9adb388..0000000 --- a/sparklines/unicode/column/lib/props/y-max/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFiniteNumber = require( '@stdlib/assert/is-finite' ).isPrimitive; -var isNull = require( '@stdlib/assert/is-null' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:column-chart:unicode:set:y-max' ); - - -// MAIN // - -/** -* Sets the maximum value of the y-axis domain. -* -* @private -* @param {(FiniteNumber|null)} max - maximum value -* @throws {TypeError} must be a finite number or null -*/ -function set( max ) { - /* eslint-disable no-invalid-this */ - if ( !isFiniteNumber( max ) && !isNull( max ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a finite number or null. Value: `%s`.', 'yMax', max ) ); - } - if ( max !== this._yMax ) { - debug( 'Current value: %s.', this._yMax ); - - this._yMax = max; - debug( 'New value: %s.', this._yMax ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/unicode/column/lib/props/y-min/get.js b/sparklines/unicode/column/lib/props/y-min/get.js deleted file mode 100644 index b084808..0000000 --- a/sparklines/unicode/column/lib/props/y-min/get.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); - - -// MAIN // - -/** -* Returns the minimum value of the y-axis domain. -* -* @private -* @returns {number} minimum value of the y-axis domain -*/ -function get() { - /* eslint-disable no-invalid-this */ - var min; - var len; - var d; - var i; - - if ( this._yMin === null ) { - len = this._data.length; - min = PINF; - for ( i = 0; i < len; i++ ) { - d = this._data[ i ]; - if ( this._isDefined( d ) && d !== NINF && d < min ) { - min = d; - } - } - return min; - } - return this._yMin; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/unicode/column/lib/props/y-min/set.js b/sparklines/unicode/column/lib/props/y-min/set.js deleted file mode 100644 index 35c7404..0000000 --- a/sparklines/unicode/column/lib/props/y-min/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFiniteNumber = require( '@stdlib/assert/is-finite' ).isPrimitive; -var isNull = require( '@stdlib/assert/is-null' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:column-chart:unicode:set:y-min' ); - - -// MAIN // - -/** -* Sets the minimum value of the y-axis domain. -* -* @private -* @param {(FiniteNumber|null)} min - minimum value -* @throws {TypeError} must be a finite number or null -*/ -function set( min ) { - /* eslint-disable no-invalid-this */ - if ( !isFiniteNumber( min ) && !isNull( min ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a finite number or null. Value: `%s`.', 'yMin', min ) ); - } - if ( min !== this._yMin ) { - debug( 'Current value: %s.', this._yMin ); - - this._yMin = min; - debug( 'New value: %s.', this._yMin ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/unicode/column/lib/render.js b/sparklines/unicode/column/lib/render.js deleted file mode 100644 index 4fe4a7a..0000000 --- a/sparklines/unicode/column/lib/render.js +++ /dev/null @@ -1,129 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var abs = require( '@stdlib/math/base/special/abs' ); -var round = require( '@stdlib/math/base/special/round' ); -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); - - -// VARIABLES // - -// See [Block Elements]{@link https://en.wikipedia.org/wiki/Block_Elements}. -var UNICODE_BLOCK_ELEMENTS = [ - '▁', // U+2581, lower 1/8 - '▂', // U+2582, lower 2/8 - '▃', // U+2583, lower 3/8 - '▄', // U+2584, lower 4/8 - '▅', // U+2585, lower 5/8 - '▆', // U+2586, lower 6/8 - '▇', // U+2587, lower 7/8 - '█' // U+2588, full block -]; -var UNICODE_INF = '∞'; // U+221E -var MISSING_VALUE = ' '; - - -// MAIN // - -/** -* Renders a chart. -* -* @private -* @returns {string} rendered chart -*/ -function render() { - /* eslint-disable no-invalid-this */ - var blocks; - var range; - var str; - var min; - var max; - var len; - var idx; - var d; - var v; - var n; - var i; - - len = this._data.length; - if ( len === 0 ) { - return ''; - } - min = this.yMin; - max = this.yMax; - range = abs( max-min ); - - // Check if data is constant... - if ( range === 0.0 ) { - // If `max` is `0`, encode each finite datum as the smallest block glyph... - if ( max === 0.0 ) { - blocks = [ UNICODE_BLOCK_ELEMENTS[ 0 ] ]; - } - // Otherwise, encode each finite datum as a mid-sized block glyph... - else { - blocks = [ UNICODE_BLOCK_ELEMENTS[ 3 ] ]; - } - } else { - blocks = UNICODE_BLOCK_ELEMENTS; - } - // Generate the sparkline chart, assigning a glyph to each datum... - n = blocks.length - 1; - str = ''; - - // TODO: color encoding: one color for both pos and neg or two colors for separate colors - - // TODO: negative values diff color (red) - - for ( i = 0; i < len; i++ ) { - d = this._data[ i ]; - if ( this._infinities && ( d === PINF || d === NINF ) ) { - str += UNICODE_INF; - continue; - } - if ( !this._isDefined( d, i ) || d === PINF || d === NINF ) { - str += MISSING_VALUE; - continue; - } - // Normalize the datum (aka feature scaling): - if ( range ) { - v = ( d-min ) / range; - } else { - v = 0.0; - } - // Determine the glyph index: - idx = round( v*n ); - if ( idx < 0 ) { - idx = 0; - } else if ( idx > n ) { - idx = n; - } - // Add the glyph to the chart: - str += blocks[ idx ]; - } - return str; -} - - -// EXPORTS // - -module.exports = render; diff --git a/sparklines/unicode/column/package.json b/sparklines/unicode/column/package.json deleted file mode 100644 index 334f24a..0000000 --- a/sparklines/unicode/column/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@stdlib/plot/sparklines/unicode/column", - "version": "0.0.0", - "description": "Create a Unicode sparkline column chart.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "bin": { - "sparkline-column": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "column", - "bar", - "histogram", - "hist", - "chart", - "graph", - "graphic", - "data", - "sparklines", - "sparkline", - "visualize", - "viz", - "vis", - "unicode" - ] -} diff --git a/sparklines/unicode/column/test/fixtures/stdin_error.js.txt b/sparklines/unicode/column/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4aca..0000000 --- a/sparklines/unicode/column/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/sparklines/unicode/column/test/test.auto_render.js b/sparklines/unicode/column/test/test.auto_render.js deleted file mode 100644 index 039c91f..0000000 --- a/sparklines/unicode/column/test/test.auto_render.js +++ /dev/null @@ -1,183 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `autoRender` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.autoRender = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - t.strictEqual( chart.autoRender, false, 'returns expected value' ); - - chart.autoRender = true; - t.strictEqual( chart.autoRender, true, 'returns expected value' ); - - chart.autoRender = false; - t.strictEqual( chart.autoRender, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'if `autoRender` is `true`, when a returned instance receives a `change` event, it re-renders and emits a `render` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true, - 'data': [ 0.10, 0.50, 0.90 ] - }); - - chart.on( 'render', onRender ); - chart.emit( 'change' ); - - function onRender( str ) { - t.ok( true, 'emits a render event' ); - t.strictEqual( typeof str, 'string', 'provides expected value' ); - t.end(); - } -}); - -tape( 'if `autoRender` is `false`, when a returned instance receives a `change` event, it does not re-render or emit a `render` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'autoRender': false - }); - - chart.on( 'render', onRender ); - chart.emit( 'change' ); - - t.pass( 'is ok' ); - t.end(); - - function onRender() { - t.fail( 'should never be invoked' ); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true - }); - - chart.on( 'change', onChange ); - chart.autoRender = false; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - - chart.on( 'change', onChange ); - chart.autoRender = true; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true - }); - - chart.on( 'change', onChange ); - chart.autoRender = true; - - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - - chart.on( 'change', onChange ); - chart.autoRender = false; - - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); diff --git a/sparklines/unicode/column/test/test.buffer_size.js b/sparklines/unicode/column/test/test.buffer_size.js deleted file mode 100644 index 4bbd121..0000000 --- a/sparklines/unicode/column/test/test.buffer_size.js +++ /dev/null @@ -1,146 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `bufferSize` value', function test( t ) { - var values; - var i; - - values = [ - '5', - -5, - 0, - 3.14, - NaN, - void 0, - true, - false, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.bufferSize = value; - }; - } -}); - -tape( 'an instance throws an error if provided a `bufferSize` which is less than the number of data elements', function test( t ) { - var values; - var i; - - values = [ - 1, - 2, - 3, - 4, - 5 - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor({ - 'data': [ 1, 2, 3, 4, 5, 6 ] - }); - chart.bufferSize = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - t.strictEqual( chart.bufferSize, 10, 'returns expected value' ); - - chart.bufferSize = 20; - t.strictEqual( chart.bufferSize, 20, 'returns expected value' ); - - chart.bufferSize = 30; - t.strictEqual( chart.bufferSize, 30, 'returns expected value' ); - - chart.bufferSize = null; - t.strictEqual( chart.bufferSize, FLOAT64_MAX, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `bufferSize` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - - chart.on( 'change', onChange ); - chart.bufferSize = 30; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `bufferSize` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - - chart.on( 'change', onChange ); - chart.bufferSize = 10; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/column/test/test.cli.js b/sparklines/unicode/column/test/test.cli.js deleted file mode 100644 index 7fc3cdd..0000000 --- a/sparklines/unicode/column/test/test.cli.js +++ /dev/null @@ -1,363 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( '@stdlib/string/replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface renders a column chart', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'6\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▂▄▅▇█\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the minimum value of the y-axis domain', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'6\'; process.argv[ 8 ] = \'--ymin=3\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▁▁▃▆█\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the maximum value of the y-axis domain', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'6\'; process.argv[ 8 ] = \'--ymax=3\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▅████\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports encoding infinities', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'9e500\'; process.argv[ 8 ] = \'--infinities\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▃▅▆█∞\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports encoding infinities (disable)', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'9e500\'; process.argv[ 8 ] = \'--no-infinities\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▃▅▆█ \n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "1\n2\n3\n4\n5\n6"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▂▄▅▇█\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports providing a custom separator when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf "1\t2\t3\t4\t5\t6"', - '|', - EXEC_PATH, - '-e', - '"process.stdin.isTTY = false; process.argv[ 2 ] = \'--split=/\\t/\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▂▄▅▇█\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports providing a custom separator when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf "1\t2\t3\t4\t5\t6"', - '|', - EXEC_PATH, - '-e', - '"process.stdin.isTTY = false; process.argv[ 2 ] = \'--split=\\t\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▂▄▅▇█\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/sparklines/unicode/column/test/test.data.js b/sparklines/unicode/column/test/test.data.js deleted file mode 100644 index a28b01c..0000000 --- a/sparklines/unicode/column/test/test.data.js +++ /dev/null @@ -1,128 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ndarray = require( '@stdlib/ndarray/ctor' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `data` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.data = value; - }; - } -}); - -tape( 'an instance throws an error if provided a `data` value which more data elements than the data buffer size', function test( t ) { - var values; - var i; - - values = [ - [ 1, 2 ], - [ 1, 2, 3 ], - [ 1, 2, 3, 4 ] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor({ - 'bufferSize': 1 - }); - chart.data = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - var arr; - - arr = [ 1, 2, 3 ]; - chart = ctor({ - 'data': arr - }); - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, arr, 'returns expected value' ); - - arr = [ 4, 5, 6 ]; - chart.data = arr; - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, arr, 'returns expected value' ); - - arr = ndarray( 'generic', [ 7, 8, 9 ], [ 3 ], [ 1 ], 0, 'row-major' ); - chart.data = arr; - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, [ 7, 8, 9 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `data` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ] - }); - - chart.on( 'change', onChange ); - chart.data = [ 4, 5, 6 ]; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); diff --git a/sparklines/unicode/column/test/test.description.js b/sparklines/unicode/column/test/test.description.js deleted file mode 100644 index b2222e1..0000000 --- a/sparklines/unicode/column/test/test.description.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `description` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.description = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - t.strictEqual( chart.description, 'beep', 'returns expected value' ); - - chart.description = 'boop'; - t.strictEqual( chart.description, 'boop', 'returns expected value' ); - - chart.description = 'foo'; - t.strictEqual( chart.description, 'foo', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `description` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - - chart.on( 'change', onChange ); - chart.description = 'boop'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `description` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - - chart.on( 'change', onChange ); - chart.description = 'beep'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/column/test/test.infinities.js b/sparklines/unicode/column/test/test.infinities.js deleted file mode 100644 index db3e916..0000000 --- a/sparklines/unicode/column/test/test.infinities.js +++ /dev/null @@ -1,128 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `infinities` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.infinities = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'infinities': false - }); - t.strictEqual( chart.infinities, false, 'returns expected value' ); - - chart.infinities = true; - t.strictEqual( chart.infinities, true, 'returns expected value' ); - - chart.infinities = false; - t.strictEqual( chart.infinities, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `infinities` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'infinities': true - }); - - chart.on( 'change', onChange ); - chart.infinities = false; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `infinities` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'infinities': false - }); - - chart.on( 'change', onChange ); - chart.infinities = true; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `infinities` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'infinities': true - }); - - chart.on( 'change', onChange ); - chart.infinities = true; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/column/test/test.is_defined.js b/sparklines/unicode/column/test/test.is_defined.js deleted file mode 100644 index deaa3d7..0000000 --- a/sparklines/unicode/column/test/test.is_defined.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `isDefined` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.isDefined = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - t.strictEqual( chart.isDefined, noop, 'returns expected value' ); - - chart.isDefined = isDefined; - t.strictEqual( chart.isDefined, isDefined, 'returns expected value' ); - - t.end(); - - function isDefined( d ) { - return d === d; - } -}); - -tape( 'the default behavior is to treat `NaN` values as undefined', function test( t ) { - var chart = ctor(); - t.strictEqual( chart.isDefined( NaN ), false, 'returns expected value' ); - t.strictEqual( chart.isDefined( 5 ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( null ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( '' ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( [] ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( {} ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( 'foo' ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( true ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( false ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'setting the `isDefined` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - - chart.on( 'change', onChange ); - chart.isDefined = isDefined; - - function isDefined( d ) { - return d === d; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `isDefined` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - - chart.on( 'change', onChange ); - chart.isDefined = noop; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/column/test/test.js b/sparklines/unicode/column/test/test.js deleted file mode 100644 index 5e5bc79..0000000 --- a/sparklines/unicode/column/test/test.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Chart = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Chart, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the export is a class constructor', function test( t ) { - var chart = new Chart(); - t.strictEqual( chart instanceof Chart, true, 'returns class instance' ); - t.end(); -}); diff --git a/sparklines/unicode/column/test/test.label.js b/sparklines/unicode/column/test/test.label.js deleted file mode 100644 index d008ba5..0000000 --- a/sparklines/unicode/column/test/test.label.js +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `label` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - {}, - [], - [ 'beep' ], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.label = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'beep' - }); - t.strictEqual( chart.label, 'beep', 'returns expected value' ); - - chart.label = 'boop'; - t.strictEqual( chart.label, 'boop', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `label` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'a' - }); - - chart.on( 'change', onChange ); - chart.label = 'b'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'a' - }); - - chart.on( 'change', onChange ); - chart.label = 'a'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/column/test/test.main.js b/sparklines/unicode/column/test/test.main.js deleted file mode 100644 index 8472cb6..0000000 --- a/sparklines/unicode/column/test/test.main.js +++ /dev/null @@ -1,559 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); -var ColumnChart = require( './../lib/main.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ColumnChart, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the export is a class constructor', function test( t ) { - var chart = new ColumnChart(); - t.strictEqual( chart instanceof ColumnChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (no data, no options)', function test( t ) { - var chart; - var ctor; - - ctor = ColumnChart; - chart = ctor(); - - t.strictEqual( chart instanceof ColumnChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (data)', function test( t ) { - var chart; - var ctor; - - ctor = ColumnChart; - chart = ctor( [ 1, 2, 3 ] ); - - t.strictEqual( chart instanceof ColumnChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (options)', function test( t ) { - var chart; - var ctor; - - ctor = ColumnChart; - chart = ctor({ - 'bufferSize': 10, - 'description': 'beep', - 'infinities': true, - 'isDefined': noop, - 'data': [ 1, 2, 3 ], - 'autoRender': true, - 'label': 'foo', - 'yMin': null, - 'yMax': null - }); - - t.strictEqual( chart instanceof ColumnChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (data and options)', function test( t ) { - var chart; - var ctor; - - ctor = ColumnChart; - chart = ctor( [ 1, 2, 3 ], { - 'bufferSize': 10, - 'description': 'beep', - 'infinities': true, - 'isDefined': noop, - 'autoRender': true, - 'label': 'foo', - 'yMin': null, - 'yMax': null - }); - - t.strictEqual( chart instanceof ColumnChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor will throw an error if provided an invalid options argument (no data argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = new ColumnChart( value ); // eslint-disable-line no-unused-vars - }; - } -}); - -tape( 'the constructor will throw an error if provided an invalid options argument (data argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = new ColumnChart( [ 1, 2, 3 ], value ); // eslint-disable-line no-unused-vars - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid option (no data argument)', function test( t ) { - t.throws( foo, TypeError, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new ColumnChart({ - 'description': [] - }); - } -}); - -tape( 'the constructor throws an error if provided an invalid option (data argument)', function test( t ) { - t.throws( foo, TypeError, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new ColumnChart( [ 1, 2, 3 ], { - 'description': [] - }); - } -}); - -tape( 'the constructor throws an error if provided a `bufferSize` option which is less than the number of data elements (options)', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new ColumnChart({ - 'data': [ 1, 2, 3, 4, 5 ], - 'bufferSize': 3 - }); - } -}); - -tape( 'the constructor throws an error if provided a `bufferSize` option which is less than the number of data elements (data argument)', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new ColumnChart( [ 1, 2, 3, 4, 5 ], { - 'bufferSize': 3 - }); - } -}); - -tape( 'an instance has a writable `autoRender` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new ColumnChart(); - t.strictEqual( chart.autoRender, false, 'default value is false' ); - - opts = { - 'autoRender': true - }; - chart = new ColumnChart( opts ); - - expected = true; - t.strictEqual( chart.autoRender, expected, 'returns expected value' ); - - chart.autoRender = false; - - expected = false; - t.strictEqual( chart.autoRender, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `bufferSize` property', function test( t ) { - var chart; - var opts; - - chart = new ColumnChart(); - t.strictEqual( chart.bufferSize, FLOAT64_MAX, 'default value is the maximum double-precision floating-point number' ); - - opts = { - 'bufferSize': 20 - }; - chart = new ColumnChart( opts ); - t.strictEqual( chart.bufferSize, opts.bufferSize, 'returns expected value' ); - - chart.bufferSize = 5; - t.strictEqual( chart.bufferSize, 5, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `data` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new ColumnChart(); - t.deepEqual( chart.data, [], 'default value is an empty array' ); - - opts = { - 'data': [ 1, 2, 3 ] - }; - chart = new ColumnChart( opts ); - - expected = [ 1, 2, 3 ]; - t.deepEqual( chart.data, expected, 'returns expected value' ); - - chart.data = [ 4, 5, 6 ]; - - expected = [ 4, 5, 6 ]; - t.deepEqual( chart.data, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `infinities` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new ColumnChart(); - t.strictEqual( chart.infinities, false, 'default value is false' ); - - opts = { - 'infinities': true - }; - chart = new ColumnChart( opts ); - - expected = true; - t.strictEqual( chart.infinities, expected, 'returns expected value' ); - - chart.infinities = false; - - expected = false; - t.strictEqual( chart.infinities, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `isDefined` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new ColumnChart(); - t.strictEqual( typeof chart.isDefined, 'function', 'default value is a function' ); - - opts = { - 'isDefined': noop - }; - chart = new ColumnChart( opts ); - - expected = noop; - t.deepEqual( chart.isDefined, expected, 'returns expected value' ); - - chart.isDefined = noop; - - expected = noop; - t.deepEqual( chart.isDefined, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `label` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new ColumnChart(); - t.strictEqual( chart.label, '', 'default value is an empty string' ); - - opts = { - 'label': 'foo' - }; - chart = new ColumnChart( opts ); - - expected = 'foo'; - t.strictEqual( chart.label, expected, 'returns expected value' ); - - chart.label = 'bar'; - - expected = 'bar'; - t.strictEqual( chart.label, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `yMax` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new ColumnChart(); - t.strictEqual( chart.yMax, NINF, 'default value is -infinity' ); - - opts = { - 'data': [ 1, 2, 3 ], - 'yMax': 10 - }; - chart = new ColumnChart( opts ); - - expected = 10; - t.strictEqual( chart.yMax, expected, 'returns expected value' ); - - chart.yMax = null; - - expected = 3; - t.strictEqual( chart.yMax, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `yMin` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new ColumnChart(); - t.strictEqual( chart.yMin, PINF, 'default value is +infinity' ); - - opts = { - 'data': [ 1, 2, 3 ], - 'yMin': 10 - }; - chart = new ColumnChart( opts ); - - expected = 10; - t.strictEqual( chart.yMin, expected, 'returns expected value' ); - - chart.yMin = null; - - expected = 1; - t.strictEqual( chart.yMin, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a `push` method for appending data', function test( t ) { - var chart = new ColumnChart(); - t.strictEqual( typeof chart.push, 'function', 'has push method' ); - t.end(); -}); - -tape( 'an instance has a `render` method for rendering a chart', function test( t ) { - var chart; - var str; - - chart = new ColumnChart(); - chart.data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; - - str = chart.render(); - t.strictEqual( str, '▁█▅▃▆▆▅', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'if a chart has not been provided data, the render method returns an empty string', function test( t ) { - var chart; - var str; - - chart = new ColumnChart(); - - str = chart.render(); - t.strictEqual( str, '', 'returns empty string' ); - - t.end(); -}); - -tape( 'by default, a chart renders `NaN` and infinite values as missing values', function test( t ) { - var chart; - var str; - - chart = new ColumnChart(); - chart.data = [ - 1.0, - 5.0, - NaN, - PINF, - NINF, - 4.0, - 3.0 - ]; - - str = chart.render(); - t.strictEqual( str, '▁█ ▆▅', 'returns rendered chart with missing values' ); - - t.end(); -}); - -tape( 'if the `infinities` option/property is set to `true`, the chart encodes infinite values as `∞`', function test( t ) { - var chart; - var str; - - chart = new ColumnChart({ - 'infinities': true - }); - chart.data = [ - 1.0, - 5.0, - NaN, - PINF, - NINF, - 4.0, - 3.0 - ]; - - str = chart.render(); - t.strictEqual( str, '▁█ ∞∞▆▅', 'returns rendered chart with infinities encoded as ∞' ); - - t.end(); -}); - -tape( 'if provided `yMin` and/or `yMax` values, the chart fixes the y-axis domain', function test( t ) { - var chart; - var str; - - chart = new ColumnChart(); - chart.data = [ - -1.0, - 5.0, - -3.0, - 2.0, - -4.0, - 4.0, - 3.0 - ]; - chart.yMin = 0.0; - chart.yMax = 10.0; - - str = chart.render(); - t.strictEqual( str, '▁▅▁▂▁▄▃', 'returns rendered chart with fixed y-axis domain' ); - - chart.data = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; - chart.yMin = null; - chart.yMax = 3.0; - - str = chart.render(); - t.strictEqual( str, '▁▅████', 'returns rendered chart with fixed y-axis domain' ); - - t.end(); -}); - -tape( 'if all datum are `0` and the y-axis domain is `0`, the chart renders each finite datum as the smallest glyph', function test( t ) { - var chart; - var str; - - chart = new ColumnChart(); - chart.data = [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]; - - str = chart.render(); - t.strictEqual( str, '▁▁▁▁▁▁▁', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'if all datum are constant and non-zero and the y-axis domain is `0`, the chart renders each finite datum as the same mid-sized glyph', function test( t ) { - var chart; - var str; - - chart = new ColumnChart(); - chart.data = [ - 5.0, - 5.0, - 5.0, - 5.0, - 5.0, - 5.0, - 5.0 - ]; - - str = chart.render(); - t.strictEqual( str, '▄▄▄▄▄▄▄', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'an instance has a `toString` method for serializing a chart to string', function test( t ) { - var chart; - var str; - - chart = new ColumnChart(); - chart.data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; - - str = chart.toString(); - t.strictEqual( str, '▁█▅▃▆▆▅', 'returns rendered chart' ); - - t.end(); -}); diff --git a/sparklines/unicode/column/test/test.push.js b/sparklines/unicode/column/test/test.push.js deleted file mode 100644 index cdd005b..0000000 --- a/sparklines/unicode/column/test/test.push.js +++ /dev/null @@ -1,90 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function appends a datum to the chart data', function test( t ) { - var expected; - var chart; - var data; - var v; - - data = [ 1, 2, 3 ]; - chart = ctor({ - 'data': data - }); - - chart.push( 4 ); - v = chart.data; - - expected = [ 1, 2, 3, 4 ]; - t.deepEqual( v, expected, 'appends to chart data' ); - - t.end(); -}); - -tape( 'if appending data to the internal data buffer will result in the chart data exceeding the data buffer size, the function will remove the first data element', function test( t ) { - var expected; - var chart; - var data; - var v; - - data = [ 1, 2, 3 ]; - chart = ctor({ - 'data': data, - 'bufferSize': 3 - }); - - chart.push( 4 ); - v = chart.data; - - expected = [ 2, 3, 4 ]; - t.deepEqual( v, expected, 'removes first data element' ); - - t.end(); -}); - -tape( 'appending `data` triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ] - }); - - chart.on( 'change', onChange ); - chart.push( 4 ); - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); diff --git a/sparklines/unicode/column/test/test.y_max.js b/sparklines/unicode/column/test/test.y_max.js deleted file mode 100644 index ca96a99..0000000 --- a/sparklines/unicode/column/test/test.y_max.js +++ /dev/null @@ -1,116 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `yMax` value', function test( t ) { - var values; - var i; - - values = [ - '5', - NaN, - void 0, - true, - false, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.yMax = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ], - 'yMax': 10.0 - }); - t.strictEqual( chart.yMax, 10.0, 'returns expected value' ); - - chart.yMax = 20.0; - t.strictEqual( chart.yMax, 20.0, 'returns expected value' ); - - chart.yMax = 30.0; - t.strictEqual( chart.yMax, 30.0, 'returns expected value' ); - - chart.yMax = null; - t.strictEqual( chart.yMax, 3, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `yMax` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'yMax': 10.0 - }); - - chart.on( 'change', onChange ); - chart.yMax = 30.0; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `yMax` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'yMax': 10.0 - }); - - chart.on( 'change', onChange ); - chart.yMax = 10.0; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/column/test/test.y_min.js b/sparklines/unicode/column/test/test.y_min.js deleted file mode 100644 index 470d9a7..0000000 --- a/sparklines/unicode/column/test/test.y_min.js +++ /dev/null @@ -1,116 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `yMin` value', function test( t ) { - var values; - var i; - - values = [ - '5', - NaN, - void 0, - true, - false, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.yMin = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ], - 'yMin': 10.0 - }); - t.strictEqual( chart.yMin, 10.0, 'returns expected value' ); - - chart.yMin = 20.0; - t.strictEqual( chart.yMin, 20.0, 'returns expected value' ); - - chart.yMin = 30.0; - t.strictEqual( chart.yMin, 30.0, 'returns expected value' ); - - chart.yMin = null; - t.strictEqual( chart.yMin, 1, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `yMin` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'yMin': 10.0 - }); - - chart.on( 'change', onChange ); - chart.yMin = 30.0; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `yMin` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'yMin': 10.0 - }); - - chart.on( 'change', onChange ); - chart.yMin = 10.0; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/docs/repl.txt b/sparklines/unicode/docs/repl.txt deleted file mode 100644 index 927c242..0000000 --- a/sparklines/unicode/docs/repl.txt +++ /dev/null @@ -1,112 +0,0 @@ - -{{alias}}( [data,] [options] ) - Returns a Unicode sparkline instance. - - The following chart types are supported: - - - column: column chart (e.g., ▃▆▂▄▁▅▅). - - line: line chart (e.g., ⡈⠑⠢⠔⠒⠒⠒). - - tristate: tristate chart (e.g., ▄▀──▀▄▄▀). - - up-down: up/down chart (e.g., ↓↑↑↑↑↓↓↑). - - win-loss: win/loss chart (e.g., ┌╵└┴╵╷╷╵). - - The `data` argument takes precedence over the `data` option. - - Parameters - ---------- - data: ArrayLike|ndarray (optional) - Chart data. - - options: Object (optional) - Options. - - options.autoRender: boolean (optional) - Boolean indicating whether to re-render on a 'change' event. Default: - false. - - options.bufferSize: integer|null (optional) - Data buffer size. If provided, data is kept in a first-in first-out - (FIFO) buffer which cannot exceed the buffer size. Default: +infinity. - - options.data: ArrayLike|ndarray (optional) - Chart data. - - options.description: string (optional) - Chart description. - - options.infinities: boolean (optional) - Boolean indicating whether to encode infinite values. Default: false. - - options.isDefined: Function (optional) - An accessor function indicating whether a datum is defined. - - options.label: string (optional) - Data label. - - options.type: string (optional) - Chart type. Default: 'column'. - - options.yMax: number|null (optional) - Maximum value of the y-axis domain. If `null`, the value is computed - from the data. Default: null. - - options.yMin: number|null (optional) - Minimum value of the y-axis domain. If `null`, the value is computed - from the data. Default: null. - - Returns - ------- - chart: ColumnChart - Column chart instance. - - chart.autoRender - Rendering mode. If `true`, an instance renders on each 'change' event; - otherwise, rendering must be triggered manually. - - chart.bufferSize - Data buffer size. - - chart.description - Chart description. - - chart.data - Chart data. - - chart.label - Data label. - - chart.infinities - Indicates whether to encode infinite values. - - chart.isDefined( d, i ) - An accessor function which defines whether a datum is defined. This - accessor is used to define how missing values are encoded. The default - behavior is to ignore values which are `NaN`. - - chart.render() - Renders a column chart sparkline. - - chart.type - Chart type. - - chart.yMax - Maximum value of the y-axis domain. If set to `null`, when accessed, the - returned value is computed from the data. - - chart.yMin - Minimum value of the y-axis domain. If set to `null`, when accessed, the - returned value is computed from the data. - - Examples - -------- - > var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; - > var chart = new {{alias}}( data ); - > chart.render() - '▁█▅▃▆▆▅' - > chart.type = 'line'; - > chart.render() - '⡈⠑⠢⠔⠒⠒⠒' - - See Also - -------- - diff --git a/sparklines/unicode/docs/usage.txt b/sparklines/unicode/docs/usage.txt deleted file mode 100644 index 777f8ec..0000000 --- a/sparklines/unicode/docs/usage.txt +++ /dev/null @@ -1,12 +0,0 @@ - -Usage: sparkline [options] ... - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Separator used to split stdin data. Default: /\\r?\\n/. - --type type Chart type. Default: column. - --ymin min Minimum value of y-axis domain. - --ymax max Maximum value of y-axis domain. - --infinities Encode infinite values. diff --git a/sparklines/unicode/etc/cli_opts.json b/sparklines/unicode/etc/cli_opts.json deleted file mode 100644 index 6d2ee5e..0000000 --- a/sparklines/unicode/etc/cli_opts.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "string": [ - "split", - "type", - "ymin", - "ymax" - ], - "boolean": [ - "help", - "version", - "infinities" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/sparklines/unicode/examples/index.js b/sparklines/unicode/examples/index.js deleted file mode 100644 index 4b7b761..0000000 --- a/sparklines/unicode/examples/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var randu = require( '@stdlib/random/base/randu' ); -var Float64Array = require( '@stdlib/array/float64' ); -var sparkline = require( './../lib' ); - -var chart; -var data; -var str; -var i; - -// Generate some random data... -data = new Float64Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = randu() * 100.0; -} - -// Create a sparkline chart: -chart = sparkline( data ); - -// Render the chart as a column chart: -chart.type = 'column'; -str = chart.render(); -console.log( str ); -// => '...' - -// Render the chart as a line chart: -chart.type = 'line'; -str = chart.render(); -console.log( str ); -// => '...' diff --git a/sparklines/unicode/examples/update.js b/sparklines/unicode/examples/update.js deleted file mode 100644 index ce4bd15..0000000 --- a/sparklines/unicode/examples/update.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var randu = require( '@stdlib/random/base/randu' ); -var Float64Array = require( '@stdlib/array/float64' ); -var stdout = require( '@stdlib/streams/node/stdout' ); -var sparkline = require( './../lib' ); - -var chart; -var data; -var id; -var i; - -// Generate some random data... -data = new Float64Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = randu() * 100.0; -} - -// Create a sparkline chart: -chart = sparkline( data ); - -// Hide the terminal cursor: -stdout.write( '\u001b[?25l' ); - -// Render the chart in the terminal: -stdout.write( chart.render() ); - -// Configure the chart to support streaming data: -chart.bufferSize = data.length; -chart.yMin = 0.0; -chart.yMax = 100.0; - -// Update the terminal chart with new data every second: -id = setInterval( update, 1000 ); - -// After some time, stop updating and close: -setTimeout( stop, 20000 ); - -function update() { - // Update the chart with new data: - chart.push( randu()*100.0 ); - - // Clear the terminal line and render the chart: - stdout.write( '\r\u001b[2K' + chart.render() ); -} - -function stop() { // eslint-disable-line stdlib/no-redeclare - clearInterval( id ); - - // Restore the terminal cursor: - stdout.write( '\u001b[?25h' ); - - stdout.write( '\n' ); -} diff --git a/sparklines/unicode/lib/defaults.js b/sparklines/unicode/lib/defaults.js deleted file mode 100644 index 80c00ca..0000000 --- a/sparklines/unicode/lib/defaults.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -/** -* Returns default options. -* -* @private -* @returns {Object} default options -*/ -function defaults() { - var out = {}; - - // Boolean indicating whether to encode infinite values: - out.infinities = false; - - // Chart type: - out.type = 'column'; - - // Maximum value of the y-axis domain: - out.yMax = null; - - // Minimum value of the y-axis domain: - out.yMin = null; - - return out; -} - - -// EXPORTS // - -module.exports = defaults; diff --git a/sparklines/unicode/lib/index.js b/sparklines/unicode/lib/index.js deleted file mode 100644 index c054c4b..0000000 --- a/sparklines/unicode/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Create a Unicode sparkline. -* -* @module @stdlib/plot/sparklines/unicode -* -* @example -* var sparkline = require( '@stdlib/plot/sparklines/unicode' ); -* -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* -* var chart = sparkline( data ); -* -* var str = chart.render(); -* // returns '▁█▅▃▆▆▅' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/sparklines/unicode/lib/main.js b/sparklines/unicode/lib/main.js deleted file mode 100644 index 8bc1116..0000000 --- a/sparklines/unicode/lib/main.js +++ /dev/null @@ -1,297 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var isCollection = require( '@stdlib/assert/is-collection' ); -var mergeFcn = require( '@stdlib/utils/merge' ).factory; -var pick = require( '@stdlib/utils/pick' ); -var inherit = require( '@stdlib/utils/inherit' ); -var Sparkline = require( './../../../sparklines/base/ctor' ); -var defaults = require( './defaults.js' ); -var setInfinities = require( './props/infinities/set.js' ); -var getInfinities = require( './props/infinities/get.js' ); -var setType = require( './props/type/set.js' ); -var getType = require( './props/type/get.js' ); -var setYMax = require( './props/y-max/set.js' ); -var getYMax = require( './props/y-max/get.js' ); -var setYMin = require( './props/y-min/set.js' ); -var getYMin = require( './props/y-min/get.js' ); -var render = require( './render.js' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:unicode:main' ); - -var merge = mergeFcn({ - 'extend': false -}); - -// List of private properties (note: keep in alphabetical order): -var PRIVATE_PROPS = [ - '_infinities', - '_type', - '_yMax', - '_yMin' -]; - -// List of options properties (note: keep in alphabetical order): -var OPTIONS_PROPS = [ - 'infinities', - 'type', - 'yMax', - 'yMin' -]; - - -// MAIN // - -/** -* Unicode sparkline constructor. -* -* @constructor -* @param {(Collection|ndarrayLike)} [data] - chart data -* @param {Options} [options] - chart options -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a `change` event -* @param {(PositiveInteger|null)} [options.bufferSize] - data buffer size -* @param {(Collection|ndarrayLike)} [options.data] - data -* @param {string} [options.description=''] - chart description -* @param {boolean} [options.infinities=false] - boolean indicating whether to encode infinite values -* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined -* @param {string} [options.label] - data label -* @param {string} [options.type='column'] - chart type -* @param {(FiniteNumber|null)} [options.yMax] - maximum value of the y-axis domain -* @param {(FiniteNumber|null)} [options.yMin] - minimum value of the y-axis domain -* @throws {TypeError} must provide valid options -* @returns {UnicodeSparkline} chart instance -* -* @example -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* -* var chart = new UnicodeSparkline( data ); -* -* var str = chart.render(); -* // returns '▁█▅▃▆▆▅' -* -* @example -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* var opts = { -* 'data': data -* }; -* var chart = new UnicodeSparkline( opts ); -* -* var str = chart.render(); -* // returns '▁█▅▃▆▆▅' -*/ -function UnicodeSparkline() { - var options; - var nargs; - var opts; - var keys; - var key; - var i; - - nargs = arguments.length; - if ( !(this instanceof UnicodeSparkline) ) { - if ( nargs === 0 ) { - return new UnicodeSparkline(); - } - if ( nargs === 1 ) { - return new UnicodeSparkline( arguments[ 0 ] ); - } - return new UnicodeSparkline( arguments[ 0 ], arguments[ 1 ] ); - } - // Invoke parent constructor... - if ( nargs === 0 ) { - Sparkline.call( this ); - } else if ( nargs === 1 ) { - Sparkline.call( this, arguments[ 0 ] ); - } else { - Sparkline.call( this, arguments[ 0 ], arguments[ 1 ] ); - } - // Extract chart-specific options... - opts = defaults(); - if ( nargs === 1 && !isCollection( arguments[ 0 ] ) ) { - options = arguments[ 0 ]; - } else if ( nargs === 2 ) { - options = arguments[ 1 ]; - } else { - options = {}; - } - opts = merge( opts, pick( options, OPTIONS_PROPS ) ); - - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( options ) ); - - // Initialize private chart-specific properties... - for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { - defineProperty( this, PRIVATE_PROPS[i], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - }); - } - - // Set chart-specific properties... - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - this[ key ] = opts[ key ]; - } - return this; -} - -/* -* Inherit from the `Sparkline` prototype. -*/ -inherit( UnicodeSparkline, Sparkline ); - -/** -* Boolean indicating whether to encode infinite values. -* -* @name infinities -* @memberof UnicodeSparkline.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var chart = new UnicodeSparkline(); -* chart.infinities = true; -* -* @example -* var chart = new UnicodeSparkline({ -* 'infinities': true -* }); -* var bool = chart.infinities; -* // returns true -*/ -defineProperty( UnicodeSparkline.prototype, 'infinities', { - 'configurable': false, - 'enumerable': true, - 'set': setInfinities, - 'get': getInfinities -}); - -/** -* Sparkline chart type. -* -* @name types -* @memberof UnicodeSparkline.prototype -* @type {string} -* @throws {TypeError} must be a supported chart type -* @default 'column' -* -* @example -* var chart = new UnicodeSparkline(); -* chart.type = 'win-loss'; -* -* @example -* var chart = new UnicodeSparkline({ -* 'type': 'win-loss' -* }); -* var type = chart.type; -* // returns 'win-loss' -*/ -defineProperty( UnicodeSparkline.prototype, 'type', { - 'configurable': false, - 'enumerable': true, - 'set': setType, - 'get': getType -}); - -/** -* Maximum value of the y-axis domain. -* -* @name yMax -* @memberof UnicodeSparkline.prototype -* @type {(FiniteNumber|null)} -* @throws {TypeError} must be a finite number or null -* -* @example -* var chart = new UnicodeSparkline(); -* chart.yMax = 100.0; -* -* @example -* var chart = new UnicodeSparkline({ -* 'yMax': 314.0 -* }); -* var ymax = chart.yMax; -* // returns 314.0 -*/ -defineProperty( UnicodeSparkline.prototype, 'yMax', { - 'configurable': false, - 'enumerable': true, - 'set': setYMax, - 'get': getYMax -}); - -/** -* Minimum value of the y-axis domain. -* -* @name yMin -* @memberof UnicodeSparkline.prototype -* @type {(FiniteNumber|null)} -* @throws {TypeError} must be a finite number or null -* -* @example -* var chart = new UnicodeSparkline(); -* chart.yMin = -100.0; -* -* @example -* var chart = new UnicodeSparkline({ -* 'yMin': 3.14 -* }); -* var ymin = chart.yMin; -* // returns 3.14 -*/ -defineProperty( UnicodeSparkline.prototype, 'yMin', { - 'configurable': false, - 'enumerable': true, - 'set': setYMin, - 'get': getYMin -}); - -/** -* Renders a sparkline chart. -* -* @name render -* @memberof UnicodeSparkline.prototype -* @type {Function} -* @returns {string} rendered sparkline chart -* -* @example -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* -* var chart = new UnicodeSparkline( data ); -* -* var str = chart.render(); -* // returns '▁█▅▃▆▆▅' -*/ -UnicodeSparkline.prototype.render = render; - - -// EXPORTS // - -module.exports = UnicodeSparkline; diff --git a/sparklines/unicode/lib/props/infinities/get.js b/sparklines/unicode/lib/props/infinities/get.js deleted file mode 100644 index 15be814..0000000 --- a/sparklines/unicode/lib/props/infinities/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns a flag indicating whether to encode infinite values. -* -* @private -* @returns {boolean} boolean indicating whether to encode infinite values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._infinities; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/unicode/lib/props/infinities/set.js b/sparklines/unicode/lib/props/infinities/set.js deleted file mode 100644 index 99b2370..0000000 --- a/sparklines/unicode/lib/props/infinities/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:unicode:set:infinities' ); - - -// MAIN // - -/** -* Sets a flag indicating whether to encode infinite values. -* -* @private -* @param {boolean} bool - boolean flag -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'infinities', bool ) ); - } - if ( bool !== this._infinities ) { - debug( 'Current value: %s.', this._infinities ); - - this._infinities = bool; - debug( 'New value: %s.', this._infinities ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/unicode/lib/props/type/chart_types.json b/sparklines/unicode/lib/props/type/chart_types.json deleted file mode 100644 index c135503..0000000 --- a/sparklines/unicode/lib/props/type/chart_types.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "column", - "line", - "tristate", - "up-down", - "win-loss" -] diff --git a/sparklines/unicode/lib/props/type/get.js b/sparklines/unicode/lib/props/type/get.js deleted file mode 100644 index 25585cb..0000000 --- a/sparklines/unicode/lib/props/type/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the sparkline chart type. -* -* @private -* @returns {string} sparkline chart type -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._type; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/unicode/lib/props/type/set.js b/sparklines/unicode/lib/props/type/set.js deleted file mode 100644 index 054bd0a..0000000 --- a/sparklines/unicode/lib/props/type/set.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var format = require( '@stdlib/string/format' ); -var CHART_TYPES = require( './chart_types.json' ); - - -// VARIABLES // - -var isChartType = contains( CHART_TYPES ); -var debug = logger( 'sparkline:unicode:set:type' ); - - -// MAIN // - -/** -* Sets the sparkline chart type. -* -* @private -* @param {string} type - chart type -* @throws {TypeError} must be a supported chart type -*/ -function set( type ) { - /* eslint-disable no-invalid-this */ - if ( !isChartType( type ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be one of the following: "%s". Value: `%s`.', 'type', CHART_TYPES.join( '", "' ), type ) ); - } - if ( type !== this._type ) { - debug( 'Current value: %s.', this._type ); - - this._type = type; - debug( 'New value: %s.', this._type ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/unicode/lib/props/y-max/get.js b/sparklines/unicode/lib/props/y-max/get.js deleted file mode 100644 index 8f722bf..0000000 --- a/sparklines/unicode/lib/props/y-max/get.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); - - -// MAIN // - -/** -* Returns the maximum value of the y-axis domain. -* -* @private -* @returns {(FiniteNumber|null)} maximum value of the y-axis domain -*/ -function get() { - /* eslint-disable no-invalid-this */ - var max; - var len; - var d; - var i; - - if ( this._yMax === null ) { - len = this._data.length; - max = NINF; - for ( i = 0; i < len; i++ ) { - d = this._data[ i ]; - if ( this._isDefined( d ) && d !== PINF && d > max ) { - max = d; - } - } - return max; - } - return this._yMax; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/unicode/lib/props/y-max/set.js b/sparklines/unicode/lib/props/y-max/set.js deleted file mode 100644 index 499f600..0000000 --- a/sparklines/unicode/lib/props/y-max/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFiniteNumber = require( '@stdlib/assert/is-finite' ).isPrimitive; -var isNull = require( '@stdlib/assert/is-null' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:unicode:set:y-max' ); - - -// MAIN // - -/** -* Sets the maximum value of the y-axis domain. -* -* @private -* @param {(FiniteNumber|null)} max - maximum value -* @throws {TypeError} must be a finite number or null -*/ -function set( max ) { - /* eslint-disable no-invalid-this */ - if ( !isFiniteNumber( max ) && !isNull( max ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a finite number or null. Value: `%s`.', 'yMax', max ) ); - } - if ( max !== this._yMax ) { - debug( 'Current value: %s.', this._yMax ); - - this._yMax = max; - debug( 'New value: %s.', this._yMax ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/unicode/lib/props/y-min/get.js b/sparklines/unicode/lib/props/y-min/get.js deleted file mode 100644 index b084808..0000000 --- a/sparklines/unicode/lib/props/y-min/get.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); - - -// MAIN // - -/** -* Returns the minimum value of the y-axis domain. -* -* @private -* @returns {number} minimum value of the y-axis domain -*/ -function get() { - /* eslint-disable no-invalid-this */ - var min; - var len; - var d; - var i; - - if ( this._yMin === null ) { - len = this._data.length; - min = PINF; - for ( i = 0; i < len; i++ ) { - d = this._data[ i ]; - if ( this._isDefined( d ) && d !== NINF && d < min ) { - min = d; - } - } - return min; - } - return this._yMin; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/unicode/lib/props/y-min/set.js b/sparklines/unicode/lib/props/y-min/set.js deleted file mode 100644 index 22058cc..0000000 --- a/sparklines/unicode/lib/props/y-min/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFiniteNumber = require( '@stdlib/assert/is-finite' ).isPrimitive; -var isNull = require( '@stdlib/assert/is-null' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:unicode:set:y-min' ); - - -// MAIN // - -/** -* Sets the minimum value of the y-axis domain. -* -* @private -* @param {(FiniteNumber|null)} min - minimum value -* @throws {TypeError} must be a finite number or null -*/ -function set( min ) { - /* eslint-disable no-invalid-this */ - if ( !isFiniteNumber( min ) && !isNull( min ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a finite number or null. Value: `%s`.', 'yMin', min ) ); - } - if ( min !== this._yMin ) { - debug( 'Current value: %s.', this._yMin ); - - this._yMin = min; - debug( 'New value: %s.', this._yMin ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/unicode/lib/render.js b/sparklines/unicode/lib/render.js deleted file mode 100644 index 3284de7..0000000 --- a/sparklines/unicode/lib/render.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var ColumnChart = require( './../../../sparklines/unicode/column' ); -var LineChart = require( './../../../sparklines/unicode/line' ); -var TristateChart = require( './../../../sparklines/unicode/tristate' ); -var UpDownChart = require( './../../../sparklines/unicode/up-down' ); -var WinLossChart = require( './../../../sparklines/unicode/win-loss' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:unicode:render' ); - - -// MAIN // - -/** -* Renders a chart. -* -* @private -* @returns {string} rendered chart -*/ -function render() { - /* eslint-disable no-invalid-this */ - var out; - - debug( 'Rendering...' ); - - switch ( this._type ) { // eslint-disable-line default-case - case 'column': - out = ColumnChart.prototype._render.call( this ); // eslint-disable-line no-underscore-dangle - break; - case 'line': - out = LineChart.prototype._render.call( this ); // eslint-disable-line no-underscore-dangle - break; - case 'tristate': - out = TristateChart.prototype._render.call( this ); // eslint-disable-line no-underscore-dangle - break; - case 'up-down': - out = UpDownChart.prototype._render.call( this ); // eslint-disable-line no-underscore-dangle - break; - case 'win-loss': - out = WinLossChart.prototype._render.call( this ); // eslint-disable-line no-underscore-dangle - break; - } - - this.emit( 'render', out ); - return out; -} - - -// EXPORTS // - -module.exports = render; diff --git a/sparklines/unicode/line/README.md b/sparklines/unicode/line/README.md deleted file mode 100644 index c1461f9..0000000 --- a/sparklines/unicode/line/README.md +++ /dev/null @@ -1,513 +0,0 @@ - - -# Line Chart - -> Create a Unicode sparkline line chart. - -
- -## Usage - -```javascript -var LineChart = require( '@stdlib/plot/sparklines/unicode/line' ); -``` - -#### LineChart( \[data,] \[options] ) - -Returns a chart instance. - -```javascript -var chart = new LineChart(); -``` - -The constructor accepts the following `options`: - -- **autoRender**: `boolean` indicating whether to re-render on a `change` event. -- **bufferSize**: data buffer size. If provided, data is kept in a first-in first-out (FIFO) buffer which cannot exceed the buffer size. Default: `+infinity`. -- **data**: chart data. -- **description**: chart description. -- **infinities**: `boolean` flag indicating whether to encode infinite values. Default: `false`. -- **isDefined**: accessor `function` indicating whether a datum is defined. -- **label**: data label. -- **yMax**: maximum value of the y-axis domain. If set to `null`, the maximum value is computed from the data. -- **yMin**: minimum value of the y-axis domain. If set to `null`, the minimum value is computed from the data. - -* * * - -### Writable Properties - - - -#### LineChart.prototype.autoRender - -Rendering mode. If `true`, an instance renders on each `'change'` event; otherwise, rendering must be triggered manually. - -```javascript -var chart = new LineChart(); - -// Set: -chart.autoRender = false; - -// Get: -var mode = chart.autoRender; -// returns false -``` - - - -#### LineChart.prototype.bufferSize - -Data buffer size. If set, this specifies the maximum number of data elements which can be rendered. Once the data buffer is full, each new datum results in the oldest datum being removed. - -```javascript -var chart = new LineChart(); - -// Set: -chart.bufferSize = 3; - -// Get: -var size = chart.bufferSize; -// returns 3 - -chart.data = [ 1, 2, 3 ]; - -var data = chart.data; -// returns [ 1, 2, 3 ] - -chart.push( 4 ); - -data = chart.data; -// returns [ 2, 3, 4 ] -``` - -Setting a data buffer size is useful when rendering data streams. - - - -#### LineChart.prototype.data - -Chart data. When set, the value must be either `array`-like or an [ndarray][@stdlib/ndarray/ctor] and cannot exceed the `bufferSize`. - -```javascript -var Float64Array = require( '@stdlib/array/float64' ); - -var chart = new LineChart(); - -// Set: -chart.data = new Float64Array( [ 3.14, 5.0, -3.14, -1.0 ] ); - -// Get: -var data = chart.data; -// returns [ 3.14, 5.0, -3.14, -1.0 ] -``` - -Note that data is **copied** to an internal data buffer. - - - -#### LineChart.prototype.description - -Chart description. - -```javascript -var chart = new LineChart(); - -// Set: -chart.description = 'Daily stock prices for the past 30 days.'; - -// Get: -var desc = chart.description; -// returns 'Daily stock prices for the past 30 days.' -``` - - - -#### LineChart.prototype.infinities - -`Boolean` flag indicating whether to render infinite values. When set to `false`, infinite values are considered missing values. When set to `true`, both positive and negative infinity are encoded as `∞`. - -```javascript -var chart = new LineChart(); - -chart.infinities = true; - -chart.data = [ - 1.0, - 5.0, - NaN, - Infinity, - 4.0, - -Infinity, - 3.0 -]; - -var str = chart.render(); -// returns '⡈⠉ ∞⢂∞⠒' -``` - - - -#### LineChart.prototype.isDefined( d, i ) - -An accessor `function` which defines whether a datum is defined. This accessor is used to define how missing values are encoded. When invoked, the function is provided two arguments: - -- **d**: datum. -- **i**: datum index. - -```javascript -function isDefined( d ) { - return ( d !== null ); -} - -var chart = new LineChart(); - -// Set: -chart.isDefined = isDefined; - -// Get: -var fcn = chart.isDefined; -// returns -``` - -The default behavior is to ignore values which are `NaN`. - - - -#### LineChart.prototype.label - -Data label. - -```javascript -var chart = new LineChart(); - -// Set: -chart.label = 'beep'; - -// Get: -var label = chart.label; -// returns 'beep' -``` - - - -#### LineChart.prototype.yMin - -Minimum value of the y-axis domain. If this value is set to a value other than `null`, the y-axis lower bound is fixed; otherwise, the minimum value is computed from the chart data. - -```javascript -var chart = new LineChart( [ -1.0, 5.0, -3.0, 2.0, -4.0, 4.0, 3.0 ] ); - -chart.yMin = 0.0; - -var str = chart.render(); -// returns '⡈⢁⡠⢄⡐⠒⠒' -``` - - - -#### LineChart.prototype.yMax - -Maximum value of the y-axis domain. If this value is set to a value other than `null`, the y-axis upper bound is fixed; otherwise, the maximum value is computed based on the chart data. - -```javascript -var chart = new LineChart( [ -1.0, 5.0, -3.0, 2.0, -4.0, 4.0, 3.0 ] ); - -chart.yMax = 10.0; - -var str = chart.render(); -// returns '⠔⢂⡠⢄⡐⠒⠒' -``` - -* * * - -### Methods - - - -#### LineChart.prototype.push( datum ) - -Appends data to a chart. - -```javascript -var chart = new LineChart( [ 1, 2, 3 ] ); - -var data = chart.data; -// returns [ 1, 2, 3 ] - -chart.push( 4 ); - -data = chart.data; -// returns [ 1, 2, 3, 4 ] -``` - - - -#### LineChart.prototype.render() - -Renders a line chart sparkline. - -```javascript -var chart = new LineChart( [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ] ); - -var str = chart.render(); -// returns '⡈⠑⠢⠔⠒⠒⠒' -``` - - - -#### LineChart.prototype.toString() - -Serializes a line chart sparkline as a `string` by calling the `render()` method. - -```javascript -var chart = new LineChart( [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ] ); - -var str = chart.toString(); -// returns '⡈⠑⠢⠔⠒⠒⠒' -``` - -* * * - -### Events - -#### 'change' - -Emitted whenever a property value changes. - -```javascript -var chart = new LineChart(); - -chart.on( 'change', onChange ); - -function onChange() { - console.log( 'A property was updated.' ); -} -``` - -#### 'render' - -Emitted whenever a sparkline is rendered. - -```javascript -var chart = new LineChart(); - -chart.on( 'render', onRender ); - -function onRender( str ) { - console.log( 'Rendered sparkline: %s', str ); -} -``` - -
- - - -
- -
- - - -
- -* * * - -## Examples - - - - - -```javascript -var randu = require( '@stdlib/random/base/randu' ); -var Float64Array = require( '@stdlib/array/float64' ); -var stdout = require( '@stdlib/streams/node/stdout' ); -var lineChart = require( '@stdlib/plot/sparklines/unicode/line' ); - -var chart; -var data; -var id; -var i; - -// Generate some random data... -data = new Float64Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = randu() * 100.0; -} - -// Create a new line chart: -chart = lineChart( data ); - -// Hide the terminal cursor: -stdout.write( '\u001b[?25l' ); - -// Render the chart in the terminal: -stdout.write( chart.render() ); - -// Configure the chart to support streaming data: -chart.bufferSize = data.length; -chart.yMin = 0.0; -chart.yMax = 100.0; - -// Update the terminal chart with new data every second: -id = setInterval( update, 1000 ); - -// After some time, stop updating and close: -setTimeout( stop, 20000 ); - -function update() { - // Update the chart with new data: - chart.push( randu()*100.0 ); - - // Clear the terminal line and render the chart: - stdout.write( '\r\u001b[2K' + chart.render() ); -} - -function stop() { - clearInterval( id ); - - // Restore the terminal cursor: - stdout.write( '\u001b[?25h' ); - - stdout.write( '\n' ); -} -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: sparkline-line [options] ... - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Separator used to split stdin data. Default: /\\r?\\n/. - --ymin min Minimum value of y-axis domain. - --ymax max Maximum value of y-axis domain. - --infinities Encode infinite values. -``` - -
- - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is properly **escaped**. - - ```bash - # Not escaped... - $ echo -n $'1\n2\n3\n' | sparkline-line --split /\r?\n/ - - # Escaped... - $ echo -n $'1\n2\n3\n' | sparkline-line --split /\\r?\\n/ - ``` - -
- - - -
- -### Examples - -```bash -$ sparkline-line 1 2 3 4 5 6 -⡠⠤⠔⠒⠊⠉ -``` - -```bash -$ echo -n $'1\n2\n3\n4\n5\n6\n' | sparkline-line --ymax 3 -⡐⠊⠉⠉⠉⠉ -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/sparklines/unicode/line/benchmark/benchmark.js b/sparklines/unicode/line/benchmark/benchmark.js deleted file mode 100644 index 3257d1b..0000000 --- a/sparklines/unicode/line/benchmark/benchmark.js +++ /dev/null @@ -1,365 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var noop = require( '@stdlib/utils/noop' ); -var randu = require( '@stdlib/random/base/randu' ); -var isArray = require( '@stdlib/assert/is-array' ); -var pkg = require( './../package.json' ).name; -var LineChart = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::instantiation', function benchmark( b ) { - var v; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new LineChart(); - if ( !( v instanceof LineChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof LineChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,no_new', function benchmark( b ) { - var ctor; - var v; - var i; - - ctor = LineChart; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = ctor(); - if ( !( v instanceof LineChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof LineChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,options', function benchmark( b ) { - var opts; - var v; - var i; - - opts = { - 'autoRender': false, - 'bufferSize': 10, - 'data': [ 1, 2, 3 ], - 'description': 'foo', - 'label': 'beep', - 'infinities': true, - 'isDefined': noop, - 'yMax': 0, - 'yMin': 4 - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new LineChart( opts ); - if ( !( v instanceof LineChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof LineChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,data', function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new LineChart( [ 1, 2, 3 ] ); - if ( !( v instanceof LineChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof LineChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,data,options', function benchmark( b ) { - var opts; - var v; - var i; - - opts = { - 'autoRender': false, - 'bufferSize': 10, - 'description': 'foo', - 'label': 'beep', - 'infinities': true, - 'isDefined': noop, - 'yMax': 0, - 'yMin': 4 - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new LineChart( [ 1, 2, 3 ], opts ); - if ( !( v instanceof LineChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof LineChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:autoRender', function benchmark( b ) { - var bool; - var v; - var i; - - v = new LineChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.autoRender = !bool; - if ( typeof v.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( typeof v.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:bufferSize', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 10, - 20, - 30 - ]; - v = new LineChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.bufferSize = values[ i % values.length ]; - if ( typeof v.bufferSize !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( typeof v.bufferSize !== 'number' ) { - b.fail( 'should return a number' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:data', function benchmark( b ) { - var v; - var i; - - v = new LineChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.data = [ randu(), randu(), randu() ]; - if ( typeof v.data !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArray( v.data ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:description', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'beep', - 'boop' - ]; - v = new LineChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.description = values[ i % values.length ]; - if ( typeof v.description !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.description !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:infinities', function benchmark( b ) { - var bool; - var v; - var i; - - v = new LineChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.infinities = !bool; - if ( typeof v.infinities !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( typeof v.infinities !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:isDefined', function benchmark( b ) { - var v; - var i; - - v = new LineChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.isDefined = createFcn(); - if ( typeof v.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof v.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createFcn() { - return beep; - function beep() { - // No-op... - } - } -}); - -bench( pkg+'::set,get:label', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'beep', - 'boop' - ]; - v = new LineChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.label = values[ i % values.length ]; - if ( typeof v.label !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.label !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:yMax', function benchmark( b ) { - var v; - var i; - - v = new LineChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.yMax = i; - if ( v.yMax !== i ) { - b.fail( 'unexpected value' ); - } - } - b.toc(); - if ( v.yMax !== i-1 ) { - b.fail( 'unexpected value' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:yMin', function benchmark( b ) { - var v; - var i; - - v = new LineChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.yMin = i; - if ( v.yMin !== i ) { - b.fail( 'unexpected value' ); - } - } - b.toc(); - if ( v.yMin !== i-1 ) { - b.fail( 'unexpected value' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/sparklines/unicode/line/benchmark/benchmark.render.js b/sparklines/unicode/line/benchmark/benchmark.render.js deleted file mode 100644 index 46dc56b..0000000 --- a/sparklines/unicode/line/benchmark/benchmark.render.js +++ /dev/null @@ -1,116 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var Float64Array = require( '@stdlib/array/float64' ); -var pkg = require( './../package.json' ).name; -var LineChart = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @param {LineChart} chart - chart instance -* @returns {Function} benchmark function -*/ -function createBenchmark( len, chart ) { - var x; - var i; - - x = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = randu(); - } - chart.data = x; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var str; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = chart.push( randu() ).render(); - if ( typeof str !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof str !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var chart; - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 4; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - chart = new LineChart({ - 'bufferSize': len - }); - f = createBenchmark( len, chart ); - bench( pkg+':render:len='+len, f ); - - chart = new LineChart({ - 'bufferSize': len, - 'yMin': 0.0, - 'yMax': 1.0 - }); - f = createBenchmark( len, chart ); - bench( pkg+'::ymin,ymax:render:len='+len, f ); - } -} - -main(); diff --git a/sparklines/unicode/line/bin/cli b/sparklines/unicode/line/bin/cli deleted file mode 100755 index e3f1cc2..0000000 --- a/sparklines/unicode/line/bin/cli +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var sparkline = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var opts; - var cli; - var i; - - opts = {}; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Get any provided command-line flags: - if ( flags.ymin ) { - opts.yMin = parseFloat( flags.ymin ); - } - if ( flags.ymax ) { - opts.yMax = parseFloat( flags.ymax ); - } - if ( flags.infinities ) { - opts.infinities = flags.infinities; - } - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - opts.split = reFromString( flags.split ); - } else { - opts.split = RE_EOL; - } - return stdin( onRead ); - } - for ( i = 0; i < args.length; i++ ) { - args[ i ] = parseFloat( args[ i ] ); - } - console.log( sparkline( args, opts ).render() ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( opts.split ); - for ( i = 0; i < lines.length; i++ ) { - lines[ i ] = parseFloat( lines[ i ] ); - } - console.log( sparkline( lines, opts ).render() ); // eslint-disable-line no-console - } -} - -main(); diff --git a/sparklines/unicode/line/docs/repl.txt b/sparklines/unicode/line/docs/repl.txt deleted file mode 100644 index 53665cd..0000000 --- a/sparklines/unicode/line/docs/repl.txt +++ /dev/null @@ -1,95 +0,0 @@ - -{{alias}}( [data,] [options] ) - Returns a sparkline line chart instance. - - The `data` argument takes precedence over the `data` option. - - Parameters - ---------- - data: ArrayLike|ndarray (optional) - Chart data. - - options: Object (optional) - Options. - - options.autoRender: boolean (optional) - Boolean indicating whether to re-render on a 'change' event. Default: - false. - - options.bufferSize: integer|null (optional) - Data buffer size. If provided, data is kept in a first-in first-out - (FIFO) buffer which cannot exceed the buffer size. Default: +infinity. - - options.data: ArrayLike|ndarray (optional) - Chart data. - - options.description: string (optional) - Chart description. - - options.infinities: boolean (optional) - Boolean indicating whether to encode infinite values. Default: false. - - options.isDefined: Function (optional) - An accessor function indicating whether a datum is defined. - - options.label: string (optional) - Data label. - - options.yMax: number|null (optional) - Maximum value of the y-axis domain. If `null`, the value is computed - from the data. Default: null. - - options.yMin: number|null (optional) - Minimum value of the y-axis domain. If `null`, the value is computed - from the data. Default: null. - - Returns - ------- - chart: LineChart - Line chart instance. - - chart.autoRender - Rendering mode. If `true`, an instance renders on each 'change' event; - otherwise, rendering must be triggered manually. - - chart.bufferSize - Data buffer size. - - chart.description - Chart description. - - chart.data - Chart data. - - chart.label - Data label. - - chart.infinities - Indicates whether to encode infinite values. - - chart.isDefined( d, i ) - An accessor function which defines whether a datum is defined. This - accessor is used to define how missing values are encoded. The default - behavior is to ignore values which are `NaN`. - - chart.render() - Renders a line chart sparkline. - - chart.yMax - Maximum value of the y-axis domain. If set to `null`, when accessed, the - returned value is computed from the data. - - chart.yMin - Minimum value of the y-axis domain. If set to `null`, when accessed, the - returned value is computed from the data. - - Examples - -------- - > var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; - > var chart = new {{alias}}( data ); - > chart.render() - '⡈⠑⠢⠔⠒⠒⠒' - - See Also - -------- - diff --git a/sparklines/unicode/line/docs/usage.txt b/sparklines/unicode/line/docs/usage.txt deleted file mode 100644 index 5c3ea9f..0000000 --- a/sparklines/unicode/line/docs/usage.txt +++ /dev/null @@ -1,11 +0,0 @@ - -Usage: sparkline-line [options] ... - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Separator used to split stdin data. Default: /\\r?\\n/. - --ymin min Minimum value of y-axis domain. - --ymax max Maximum value of y-axis domain. - --infinities Encode infinite values. diff --git a/sparklines/unicode/line/etc/cli_opts.json b/sparklines/unicode/line/etc/cli_opts.json deleted file mode 100644 index d11e5f6..0000000 --- a/sparklines/unicode/line/etc/cli_opts.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "string": [ - "split", - "ymin", - "ymax" - ], - "boolean": [ - "help", - "version", - "infinities" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/sparklines/unicode/line/examples/index.js b/sparklines/unicode/line/examples/index.js deleted file mode 100644 index 968d2cc..0000000 --- a/sparklines/unicode/line/examples/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var randu = require( '@stdlib/random/base/randu' ); -var Float64Array = require( '@stdlib/array/float64' ); -var lineChart = require( './../lib' ); - -var chart; -var data; -var opts; -var str; -var i; - -// Generate some random data... -data = new Float64Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = randu() * 100.0; -} - -// Set chart options: -opts = { - 'infinities': true -}; - -// Create a new line chart: -chart = lineChart( data, opts ); - -// Render the chart as a string: -str = chart.render(); - -console.log( str ); -// => '...' diff --git a/sparklines/unicode/line/examples/update.js b/sparklines/unicode/line/examples/update.js deleted file mode 100644 index 38b26f7..0000000 --- a/sparklines/unicode/line/examples/update.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var randu = require( '@stdlib/random/base/randu' ); -var Float64Array = require( '@stdlib/array/float64' ); -var stdout = require( '@stdlib/streams/node/stdout' ); -var lineChart = require( './../lib' ); - -var chart; -var data; -var id; -var i; - -// Generate some random data... -data = new Float64Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = randu() * 100.0; -} - -// Create a new line chart: -chart = lineChart( data ); - -// Hide the terminal cursor: -stdout.write( '\u001b[?25l' ); - -// Render the chart in the terminal: -stdout.write( chart.render() ); - -// Configure the chart to support streaming data: -chart.bufferSize = data.length; -chart.yMin = 0.0; -chart.yMax = 100.0; - -// Update the terminal chart with new data every second: -id = setInterval( update, 1000 ); - -// After some time, stop updating and close: -setTimeout( stop, 20000 ); - -function update() { - // Update the chart with new data: - chart.push( randu() * 100.0 ); - - // Clear the terminal line and render the chart: - stdout.write( '\r\u001b[2K' + chart.render() ); -} - -function stop() { // eslint-disable-line stdlib/no-redeclare - clearInterval( id ); - - // Restore the terminal cursor: - stdout.write( '\u001b[?25h' ); - - stdout.write( '\n' ); -} diff --git a/sparklines/unicode/line/lib/defaults.js b/sparklines/unicode/line/lib/defaults.js deleted file mode 100644 index 7a94618..0000000 --- a/sparklines/unicode/line/lib/defaults.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MAIN // - -/** -* Returns default options. -* -* @private -* @returns {Object} default options -*/ -function defaults() { - var out = {}; - - // Boolean indicating whether to encode infinite values: - out.infinities = false; - - // Maximum value of the y-axis domain: - out.yMax = null; - - // Minimum value of the y-axis domain: - out.yMin = null; - - return out; -} - - -// EXPORTS // - -module.exports = defaults; diff --git a/sparklines/unicode/line/lib/index.js b/sparklines/unicode/line/lib/index.js deleted file mode 100644 index b4f0c65..0000000 --- a/sparklines/unicode/line/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Create a Unicode sparkline line chart. -* -* @module @stdlib/plot/sparklines/unicode/line -* -* @example -* var lineChart = require( '@stdlib/plot/sparklines/unicode/line' ); -* -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* -* var chart = lineChart( data ); -* -* var str = chart.render(); -* // returns '⡈⠑⠢⠔⠒⠒⠒' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/sparklines/unicode/line/lib/main.js b/sparklines/unicode/line/lib/main.js deleted file mode 100644 index 1a56c90..0000000 --- a/sparklines/unicode/line/lib/main.js +++ /dev/null @@ -1,266 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var defineProperty = require( '@stdlib/utils/define-property' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var isCollection = require( '@stdlib/assert/is-collection' ); -var mergeFcn = require( '@stdlib/utils/merge' ).factory; -var pick = require( '@stdlib/utils/pick' ); -var inherit = require( '@stdlib/utils/inherit' ); -var Sparkline = require( './../../../../sparklines/base/ctor' ); -var defaults = require( './defaults.js' ); -var setInfinities = require( './props/infinities/set.js' ); -var getInfinities = require( './props/infinities/get.js' ); -var setYMax = require( './props/y-max/set.js' ); -var getYMax = require( './props/y-max/get.js' ); -var setYMin = require( './props/y-min/set.js' ); -var getYMin = require( './props/y-min/get.js' ); -var render = require( './render.js' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:line-chart:unicode:main' ); - -var merge = mergeFcn({ - 'extend': false -}); - -// List of private properties (note: keep in alphabetical order): -var PRIVATE_PROPS = [ - '_infinities', - '_yMax', - '_yMin' -]; - -// List of options properties (note: keep in alphabetical order): -var OPTIONS_PROPS = [ - 'infinities', - 'yMax', - 'yMin' -]; - - -// MAIN // - -/** -* Unicode sparkline line chart constructor. -* -* @constructor -* @param {(Collection|ndarrayLike)} [data] - chart data -* @param {Options} [options] - chart options -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a `change` event -* @param {(PositiveInteger|null)} [options.bufferSize] - data buffer size -* @param {(Collection|ndarrayLike)} [options.data] - data -* @param {string} [options.description=''] - chart description -* @param {boolean} [options.infinities=false] - boolean indicating whether to encode infinite values -* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined -* @param {string} [options.label] - data label -* @param {(FiniteNumber|null)} [options.yMax] - maximum value of the y-axis domain -* @param {(FiniteNumber|null)} [options.yMin] - minimum value of the y-axis domain -* @throws {TypeError} must provide valid options -* @returns {LineChart} chart instance -* -* @example -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* -* var chart = new LineChart( data ); -* -* var str = chart.render(); -* // returns '⡈⠑⠢⠔⠒⠒⠒' -* -* @example -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* var opts = { -* 'data': data -* }; -* var chart = new LineChart( opts ); -* -* var str = chart.render(); -* // returns '⡈⠑⠢⠔⠒⠒⠒' -*/ -function LineChart() { - var options; - var nargs; - var opts; - var keys; - var key; - var i; - - nargs = arguments.length; - if ( !(this instanceof LineChart) ) { - if ( nargs === 0 ) { - return new LineChart(); - } - if ( nargs === 1 ) { - return new LineChart( arguments[ 0 ] ); - } - return new LineChart( arguments[ 0 ], arguments[ 1 ] ); - } - // Invoke parent constructor... - if ( nargs === 0 ) { - Sparkline.call( this ); - } else if ( nargs === 1 ) { - Sparkline.call( this, arguments[ 0 ] ); - } else { - Sparkline.call( this, arguments[ 0 ], arguments[ 1 ] ); - } - // Extract chart-specific options... - opts = defaults(); - if ( nargs === 1 && !isCollection( arguments[ 0 ] ) ) { - options = arguments[ 0 ]; - } else if ( nargs === 2 ) { - options = arguments[ 1 ]; - } else { - options = {}; - } - opts = merge( opts, pick( options, OPTIONS_PROPS ) ); - - debug( 'Creating an instance with the following configuration: %s.', JSON.stringify( options ) ); - - // Initialize private chart-specific properties... - for ( i = 0; i < PRIVATE_PROPS.length; i++ ) { - defineProperty( this, PRIVATE_PROPS[i], { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': null - }); - } - - // Set chart-specific properties... - keys = objectKeys( opts ); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - this[ key ] = opts[ key ]; - } - return this; -} - -/* -* Inherit from the `Sparkline` prototype. -*/ -inherit( LineChart, Sparkline ); - -/** -* Boolean indicating whether to encode infinite values. -* -* @name infinities -* @memberof LineChart.prototype -* @type {boolean} -* @throws {TypeError} must be a boolean -* @default false -* -* @example -* var chart = new LineChart(); -* chart.infinities = true; -* -* @example -* var chart = new LineChart({ -* 'infinities': true -* }); -* var bool = chart.infinities; -* // returns true -*/ -defineProperty( LineChart.prototype, 'infinities', { - 'configurable': false, - 'enumerable': true, - 'set': setInfinities, - 'get': getInfinities -}); - -/** -* Maximum value of the y-axis domain. -* -* @name yMax -* @memberof LineChart.prototype -* @type {(FiniteNumber|null)} -* @throws {TypeError} must be a finite number or null -* -* @example -* var chart = new LineChart(); -* chart.yMax = 100.0; -* -* @example -* var chart = new LineChart({ -* 'yMax': 314.0 -* }); -* var ymax = chart.yMax; -* // returns 314.0 -*/ -defineProperty( LineChart.prototype, 'yMax', { - 'configurable': false, - 'enumerable': true, - 'set': setYMax, - 'get': getYMax -}); - -/** -* Minimum value of the y-axis domain. -* -* @name yMin -* @memberof LineChart.prototype -* @type {(FiniteNumber|null)} -* @throws {TypeError} must be a finite number or null -* -* @example -* var chart = new LineChart(); -* chart.yMin = -100.0; -* -* @example -* var chart = new LineChart({ -* 'yMin': 3.14 -* }); -* var ymin = chart.yMin; -* // returns 3.14 -*/ -defineProperty( LineChart.prototype, 'yMin', { - 'configurable': false, - 'enumerable': true, - 'set': setYMin, - 'get': getYMin -}); - -/** -* Renders a sparkline line chart. -* -* @private -* @name _render -* @memberof LineChart.prototype -* @type {Function} -* @returns {string} rendered sparkline line chart -* -* @example -* var data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; -* -* var chart = new LineChart( data ); -* -* var str = chart.render(); -* // returns '⡈⠑⠢⠔⠒⠒⠒' -*/ -LineChart.prototype._render = render; // eslint-disable-line no-underscore-dangle - - -// EXPORTS // - -module.exports = LineChart; diff --git a/sparklines/unicode/line/lib/props/infinities/get.js b/sparklines/unicode/line/lib/props/infinities/get.js deleted file mode 100644 index 15be814..0000000 --- a/sparklines/unicode/line/lib/props/infinities/get.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns a flag indicating whether to encode infinite values. -* -* @private -* @returns {boolean} boolean indicating whether to encode infinite values -*/ -function get() { - /* eslint-disable no-invalid-this */ - return this._infinities; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/unicode/line/lib/props/infinities/set.js b/sparklines/unicode/line/lib/props/infinities/set.js deleted file mode 100644 index b439b98..0000000 --- a/sparklines/unicode/line/lib/props/infinities/set.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:line-chart:unicode:set:infinities' ); - - -// MAIN // - -/** -* Sets a flag indicating whether to encode infinite values. -* -* @private -* @param {boolean} bool - boolean flag -* @throws {TypeError} must be a boolean -*/ -function set( bool ) { - /* eslint-disable no-invalid-this */ - if ( !isBoolean( bool ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a boolean. Value: `%s`.', 'infinities', bool ) ); - } - if ( bool !== this._infinities ) { - debug( 'Current value: %s.', this._infinities ); - - this._infinities = bool; - debug( 'New value: %s.', this._infinities ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/unicode/line/lib/props/y-max/get.js b/sparklines/unicode/line/lib/props/y-max/get.js deleted file mode 100644 index 8f722bf..0000000 --- a/sparklines/unicode/line/lib/props/y-max/get.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); - - -// MAIN // - -/** -* Returns the maximum value of the y-axis domain. -* -* @private -* @returns {(FiniteNumber|null)} maximum value of the y-axis domain -*/ -function get() { - /* eslint-disable no-invalid-this */ - var max; - var len; - var d; - var i; - - if ( this._yMax === null ) { - len = this._data.length; - max = NINF; - for ( i = 0; i < len; i++ ) { - d = this._data[ i ]; - if ( this._isDefined( d ) && d !== PINF && d > max ) { - max = d; - } - } - return max; - } - return this._yMax; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/unicode/line/lib/props/y-max/set.js b/sparklines/unicode/line/lib/props/y-max/set.js deleted file mode 100644 index 439c194..0000000 --- a/sparklines/unicode/line/lib/props/y-max/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFiniteNumber = require( '@stdlib/assert/is-finite' ).isPrimitive; -var isNull = require( '@stdlib/assert/is-null' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:line-chart:unicode:set:y-max' ); - - -// MAIN // - -/** -* Sets the maximum value of the y-axis domain. -* -* @private -* @param {(FiniteNumber|null)} max - maximum value -* @throws {TypeError} must be a finite number or null -*/ -function set( max ) { - /* eslint-disable no-invalid-this */ - if ( !isFiniteNumber( max ) && !isNull( max ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a finite number or null. Value: `%s`.', 'yMax', max ) ); - } - if ( max !== this._yMax ) { - debug( 'Current value: %s.', this._yMax ); - - this._yMax = max; - debug( 'New value: %s.', this._yMax ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/unicode/line/lib/props/y-min/get.js b/sparklines/unicode/line/lib/props/y-min/get.js deleted file mode 100644 index b084808..0000000 --- a/sparklines/unicode/line/lib/props/y-min/get.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); - - -// MAIN // - -/** -* Returns the minimum value of the y-axis domain. -* -* @private -* @returns {number} minimum value of the y-axis domain -*/ -function get() { - /* eslint-disable no-invalid-this */ - var min; - var len; - var d; - var i; - - if ( this._yMin === null ) { - len = this._data.length; - min = PINF; - for ( i = 0; i < len; i++ ) { - d = this._data[ i ]; - if ( this._isDefined( d ) && d !== NINF && d < min ) { - min = d; - } - } - return min; - } - return this._yMin; -} - - -// EXPORTS // - -module.exports = get; diff --git a/sparklines/unicode/line/lib/props/y-min/set.js b/sparklines/unicode/line/lib/props/y-min/set.js deleted file mode 100644 index eb86c24..0000000 --- a/sparklines/unicode/line/lib/props/y-min/set.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var logger = require( 'debug' ); -var isFiniteNumber = require( '@stdlib/assert/is-finite' ).isPrimitive; -var isNull = require( '@stdlib/assert/is-null' ); -var format = require( '@stdlib/string/format' ); - - -// VARIABLES // - -var debug = logger( 'sparkline:line-chart:unicode:set:y-min' ); - - -// MAIN // - -/** -* Sets the minimum value of the y-axis domain. -* -* @private -* @param {(FiniteNumber|null)} min - minimum value -* @throws {TypeError} must be a finite number or null -*/ -function set( min ) { - /* eslint-disable no-invalid-this */ - if ( !isFiniteNumber( min ) && !isNull( min ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a finite number or null. Value: `%s`.', 'yMin', min ) ); - } - if ( min !== this._yMin ) { - debug( 'Current value: %s.', this._yMin ); - - this._yMin = min; - debug( 'New value: %s.', this._yMin ); - - this.emit( 'change' ); - } -} - - -// EXPORTS // - -module.exports = set; diff --git a/sparklines/unicode/line/lib/render.js b/sparklines/unicode/line/lib/render.js deleted file mode 100644 index dd3a617..0000000 --- a/sparklines/unicode/line/lib/render.js +++ /dev/null @@ -1,153 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var abs = require( '@stdlib/math/base/special/abs' ); -var round = require( '@stdlib/math/base/special/round' ); -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); - - -// VARIABLES // - -// See [Braille Patterns]{@link https://en.wikipedia.org/wiki/Braille_Patterns}. -var UNICODE_BRAILLE_ELEMENTS = [ - [ '⣀', '⡠', '⡐', '⡈' ], // U+28C0, U+2860, U+2850, U+2848 - [ '⢄', '⠤', '⠔', '⠌' ], // U+2884, U+2824, U+2814, U+2802 - [ '⢂', '⠢', '⠒', '⠊' ], // U+2882, U+2822, U+2812, U+280A - [ '⢁', '⠡', '⠑', '⠉' ] // U+2881, U+2821, U+2811, U+2809 -]; -var UNICODE_INF = '∞'; // U+221E -var MISSING_VALUE = ' '; - - -// MAIN // - -/** -* Renders a chart. -* -* @private -* @returns {string} rendered chart -*/ -function render() { - /* eslint-disable no-invalid-this */ - var glyphs; - var range; - var str; - var min; - var max; - var len; - var idx; - var FLG; - var d; - var v; - var n; - var i; - var j; - - len = this._data.length; - if ( len === 0 ) { - return ''; - } - min = this.yMin; - max = this.yMax; - range = abs( max-min ); - - // Check if data is constant... - if ( range === 0.0 ) { - // If `max` is `0`, encode each finite datum as the lowest Braille glyph... - if ( max === 0.0 ) { - glyphs = [ [ UNICODE_BRAILLE_ELEMENTS[0][0] ] ]; - } - // Otherwise, encode each finite datum as a mid-sized Braille glyph... - else { - glyphs = [ [ UNICODE_BRAILLE_ELEMENTS[2][2] ] ]; - } - } else { - glyphs = UNICODE_BRAILLE_ELEMENTS; - } - // Assign each datum to a bin... - idx = new Array( len ); - FLG = new Array( len ); - n = glyphs.length - 1; - for ( i = 0; i < len; i++ ) { - d = this._data[ i ]; - if ( !this._isDefined( d, i ) || d === PINF || d === NINF ) { - FLG[ i ] = true; - continue; - } - // Normalize the datum (aka feature scaling): - if ( range ) { - v = ( d-min ) / range; - } else { - v = 0.0; - } - // Determine the bin index: - j = round( v*n ); - if ( j < 0 ) { - j = 0; - } else if ( j > n ) { - j = n; - } - idx[ i ] = j; - } - - // TODO: color encoding: one color for both pos and neg or two colors for separate colors - // TODO: negative values diff color (red) - - // For each datum, we peek ahead to determine if the next value is greater than or less than the current value. The magnitude of the difference determines the glyph slope. - str = ''; - for ( i = 0; i < len; i++ ) { - d = this._data[ i ]; - if ( this._infinities && ( d === PINF || d === NINF ) ) { - str += UNICODE_INF; - continue; - } - if ( FLG[ i ] ) { - str += MISSING_VALUE; - continue; - } - if ( i === len-1 ) { - // The final glyph is flat, as the next value is unknown... - j = idx[ i ]; - str += glyphs[ j ][ j ]; - break; - } - j = i + 1; - n = this._data[ j ]; - if ( n === PINF ) { - j = 3; // highest bin - } else if ( n === NINF ) { - j = 0; // lowest bin - } else if ( FLG[ j ] ) { - j = idx[ i ]; // same bin, as no slope can be inferred from a missing value - } else { - j = idx[ j ]; // slope toward the next value's bin - } - str += glyphs[ idx[i] ][ j ]; - } - return str; -} - - -// EXPORTS // - -module.exports = render; diff --git a/sparklines/unicode/line/package.json b/sparklines/unicode/line/package.json deleted file mode 100644 index 962b609..0000000 --- a/sparklines/unicode/line/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/plot/sparklines/unicode/line", - "version": "0.0.0", - "description": "Create a Unicode sparkline line chart.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "bin": { - "sparkline-line": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "line", - "chart", - "graph", - "graphic", - "data", - "sparklines", - "sparkline", - "visualize", - "viz", - "vis", - "unicode", - "trend" - ] -} diff --git a/sparklines/unicode/line/test/fixtures/stdin_error.js.txt b/sparklines/unicode/line/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4aca..0000000 --- a/sparklines/unicode/line/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/sparklines/unicode/line/test/test.auto_render.js b/sparklines/unicode/line/test/test.auto_render.js deleted file mode 100644 index 039c91f..0000000 --- a/sparklines/unicode/line/test/test.auto_render.js +++ /dev/null @@ -1,183 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `autoRender` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.autoRender = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - t.strictEqual( chart.autoRender, false, 'returns expected value' ); - - chart.autoRender = true; - t.strictEqual( chart.autoRender, true, 'returns expected value' ); - - chart.autoRender = false; - t.strictEqual( chart.autoRender, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'if `autoRender` is `true`, when a returned instance receives a `change` event, it re-renders and emits a `render` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true, - 'data': [ 0.10, 0.50, 0.90 ] - }); - - chart.on( 'render', onRender ); - chart.emit( 'change' ); - - function onRender( str ) { - t.ok( true, 'emits a render event' ); - t.strictEqual( typeof str, 'string', 'provides expected value' ); - t.end(); - } -}); - -tape( 'if `autoRender` is `false`, when a returned instance receives a `change` event, it does not re-render or emit a `render` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'autoRender': false - }); - - chart.on( 'render', onRender ); - chart.emit( 'change' ); - - t.pass( 'is ok' ); - t.end(); - - function onRender() { - t.fail( 'should never be invoked' ); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true - }); - - chart.on( 'change', onChange ); - chart.autoRender = false; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - - chart.on( 'change', onChange ); - chart.autoRender = true; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true - }); - - chart.on( 'change', onChange ); - chart.autoRender = true; - - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - - chart.on( 'change', onChange ); - chart.autoRender = false; - - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); diff --git a/sparklines/unicode/line/test/test.buffer_size.js b/sparklines/unicode/line/test/test.buffer_size.js deleted file mode 100644 index 4bbd121..0000000 --- a/sparklines/unicode/line/test/test.buffer_size.js +++ /dev/null @@ -1,146 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `bufferSize` value', function test( t ) { - var values; - var i; - - values = [ - '5', - -5, - 0, - 3.14, - NaN, - void 0, - true, - false, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.bufferSize = value; - }; - } -}); - -tape( 'an instance throws an error if provided a `bufferSize` which is less than the number of data elements', function test( t ) { - var values; - var i; - - values = [ - 1, - 2, - 3, - 4, - 5 - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor({ - 'data': [ 1, 2, 3, 4, 5, 6 ] - }); - chart.bufferSize = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - t.strictEqual( chart.bufferSize, 10, 'returns expected value' ); - - chart.bufferSize = 20; - t.strictEqual( chart.bufferSize, 20, 'returns expected value' ); - - chart.bufferSize = 30; - t.strictEqual( chart.bufferSize, 30, 'returns expected value' ); - - chart.bufferSize = null; - t.strictEqual( chart.bufferSize, FLOAT64_MAX, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `bufferSize` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - - chart.on( 'change', onChange ); - chart.bufferSize = 30; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `bufferSize` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - - chart.on( 'change', onChange ); - chart.bufferSize = 10; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/line/test/test.cli.js b/sparklines/unicode/line/test/test.cli.js deleted file mode 100644 index 14a2d36..0000000 --- a/sparklines/unicode/line/test/test.cli.js +++ /dev/null @@ -1,363 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( '@stdlib/string/replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface renders a line chart', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'6\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '⡠⠤⠔⠒⠊⠉\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the minimum value of the y-axis domain', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'6\'; process.argv[ 8 ] = \'--ymin=3\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '⣀⣀⡠⠔⠊⠉\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the maximum value of the y-axis domain', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'6\'; process.argv[ 8 ] = \'--ymax=3\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '⡐⠊⠉⠉⠉⠉\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports encoding infinities', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'9e500\'; process.argv[ 8 ] = \'--infinities\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '⡠⠔⠒⠊⠉∞\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports encoding infinities (disable)', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'9e500\'; process.argv[ 8 ] = \'--no-infinities\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '⡠⠔⠒⠊⠉ \n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "1\n2\n3\n4\n5\n6"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '⡠⠤⠔⠒⠊⠉\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports providing a custom separator when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf "1\t2\t3\t4\t5\t6"', - '|', - EXEC_PATH, - '-e', - '"process.stdin.isTTY = false; process.argv[ 2 ] = \'--split=/\\t/\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '⡠⠤⠔⠒⠊⠉\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports providing a custom separator when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf "1\t2\t3\t4\t5\t6"', - '|', - EXEC_PATH, - '-e', - '"process.stdin.isTTY = false; process.argv[ 2 ] = \'--split=\\t\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '⡠⠤⠔⠒⠊⠉\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/sparklines/unicode/line/test/test.data.js b/sparklines/unicode/line/test/test.data.js deleted file mode 100644 index a28b01c..0000000 --- a/sparklines/unicode/line/test/test.data.js +++ /dev/null @@ -1,128 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ndarray = require( '@stdlib/ndarray/ctor' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `data` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.data = value; - }; - } -}); - -tape( 'an instance throws an error if provided a `data` value which more data elements than the data buffer size', function test( t ) { - var values; - var i; - - values = [ - [ 1, 2 ], - [ 1, 2, 3 ], - [ 1, 2, 3, 4 ] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor({ - 'bufferSize': 1 - }); - chart.data = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - var arr; - - arr = [ 1, 2, 3 ]; - chart = ctor({ - 'data': arr - }); - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, arr, 'returns expected value' ); - - arr = [ 4, 5, 6 ]; - chart.data = arr; - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, arr, 'returns expected value' ); - - arr = ndarray( 'generic', [ 7, 8, 9 ], [ 3 ], [ 1 ], 0, 'row-major' ); - chart.data = arr; - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, [ 7, 8, 9 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `data` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ] - }); - - chart.on( 'change', onChange ); - chart.data = [ 4, 5, 6 ]; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); diff --git a/sparklines/unicode/line/test/test.description.js b/sparklines/unicode/line/test/test.description.js deleted file mode 100644 index b2222e1..0000000 --- a/sparklines/unicode/line/test/test.description.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `description` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.description = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - t.strictEqual( chart.description, 'beep', 'returns expected value' ); - - chart.description = 'boop'; - t.strictEqual( chart.description, 'boop', 'returns expected value' ); - - chart.description = 'foo'; - t.strictEqual( chart.description, 'foo', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `description` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - - chart.on( 'change', onChange ); - chart.description = 'boop'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `description` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - - chart.on( 'change', onChange ); - chart.description = 'beep'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/line/test/test.infinities.js b/sparklines/unicode/line/test/test.infinities.js deleted file mode 100644 index db3e916..0000000 --- a/sparklines/unicode/line/test/test.infinities.js +++ /dev/null @@ -1,128 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `infinities` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.infinities = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'infinities': false - }); - t.strictEqual( chart.infinities, false, 'returns expected value' ); - - chart.infinities = true; - t.strictEqual( chart.infinities, true, 'returns expected value' ); - - chart.infinities = false; - t.strictEqual( chart.infinities, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `infinities` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'infinities': true - }); - - chart.on( 'change', onChange ); - chart.infinities = false; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `infinities` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'infinities': false - }); - - chart.on( 'change', onChange ); - chart.infinities = true; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `infinities` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'infinities': true - }); - - chart.on( 'change', onChange ); - chart.infinities = true; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/line/test/test.is_defined.js b/sparklines/unicode/line/test/test.is_defined.js deleted file mode 100644 index deaa3d7..0000000 --- a/sparklines/unicode/line/test/test.is_defined.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `isDefined` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.isDefined = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - t.strictEqual( chart.isDefined, noop, 'returns expected value' ); - - chart.isDefined = isDefined; - t.strictEqual( chart.isDefined, isDefined, 'returns expected value' ); - - t.end(); - - function isDefined( d ) { - return d === d; - } -}); - -tape( 'the default behavior is to treat `NaN` values as undefined', function test( t ) { - var chart = ctor(); - t.strictEqual( chart.isDefined( NaN ), false, 'returns expected value' ); - t.strictEqual( chart.isDefined( 5 ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( null ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( '' ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( [] ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( {} ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( 'foo' ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( true ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( false ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'setting the `isDefined` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - - chart.on( 'change', onChange ); - chart.isDefined = isDefined; - - function isDefined( d ) { - return d === d; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `isDefined` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - - chart.on( 'change', onChange ); - chart.isDefined = noop; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/line/test/test.js b/sparklines/unicode/line/test/test.js deleted file mode 100644 index 5e5bc79..0000000 --- a/sparklines/unicode/line/test/test.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Chart = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Chart, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the export is a class constructor', function test( t ) { - var chart = new Chart(); - t.strictEqual( chart instanceof Chart, true, 'returns class instance' ); - t.end(); -}); diff --git a/sparklines/unicode/line/test/test.label.js b/sparklines/unicode/line/test/test.label.js deleted file mode 100644 index d008ba5..0000000 --- a/sparklines/unicode/line/test/test.label.js +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `label` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - {}, - [], - [ 'beep' ], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.label = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'beep' - }); - t.strictEqual( chart.label, 'beep', 'returns expected value' ); - - chart.label = 'boop'; - t.strictEqual( chart.label, 'boop', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `label` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'a' - }); - - chart.on( 'change', onChange ); - chart.label = 'b'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'a' - }); - - chart.on( 'change', onChange ); - chart.label = 'a'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/line/test/test.main.js b/sparklines/unicode/line/test/test.main.js deleted file mode 100644 index 4c62b34..0000000 --- a/sparklines/unicode/line/test/test.main.js +++ /dev/null @@ -1,572 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); -var LineChart = require( './../lib/main.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof LineChart, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the export is a class constructor', function test( t ) { - var chart = new LineChart(); - t.strictEqual( chart instanceof LineChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (no data, no options)', function test( t ) { - var chart; - var ctor; - - ctor = LineChart; - chart = ctor(); - - t.strictEqual( chart instanceof LineChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (data)', function test( t ) { - var chart; - var ctor; - - ctor = LineChart; - chart = ctor( [ 1, 2, 3 ] ); - - t.strictEqual( chart instanceof LineChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (options)', function test( t ) { - var chart; - var ctor; - - ctor = LineChart; - chart = ctor({ - 'bufferSize': 10, - 'description': 'beep', - 'infinities': true, - 'isDefined': noop, - 'data': [ 1, 2, 3 ], - 'autoRender': true, - 'label': 'foo', - 'yMin': null, - 'yMax': null - }); - - t.strictEqual( chart instanceof LineChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (data and options)', function test( t ) { - var chart; - var ctor; - - ctor = LineChart; - chart = ctor( [ 1, 2, 3 ], { - 'bufferSize': 10, - 'description': 'beep', - 'infinities': true, - 'isDefined': noop, - 'autoRender': true, - 'label': 'foo', - 'yMin': null, - 'yMax': null - }); - - t.strictEqual( chart instanceof LineChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor will throw an error if provided an invalid options argument (no data argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = new LineChart( value ); // eslint-disable-line no-unused-vars - }; - } -}); - -tape( 'the constructor will throw an error if provided an invalid options argument (data argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = new LineChart( [ 1, 2, 3 ], value ); // eslint-disable-line no-unused-vars - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid option (no data argument)', function test( t ) { - t.throws( foo, TypeError, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new LineChart({ - 'description': [] - }); - } -}); - -tape( 'the constructor throws an error if provided an invalid option (data argument)', function test( t ) { - t.throws( foo, TypeError, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new LineChart( [ 1, 2, 3 ], { - 'description': [] - }); - } -}); - -tape( 'the constructor throws an error if provided a `bufferSize` option which is less than the number of data elements (options)', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new LineChart({ - 'data': [ 1, 2, 3, 4, 5 ], - 'bufferSize': 3 - }); - } -}); - -tape( 'the constructor throws an error if provided a `bufferSize` option which is less than the number of data elements (data argument)', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new LineChart( [ 1, 2, 3, 4, 5 ], { - 'bufferSize': 3 - }); - } -}); - -tape( 'an instance has a writable `autoRender` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new LineChart(); - t.strictEqual( chart.autoRender, false, 'default value is false' ); - - opts = { - 'autoRender': true - }; - chart = new LineChart( opts ); - - expected = true; - t.strictEqual( chart.autoRender, expected, 'returns expected value' ); - - chart.autoRender = false; - - expected = false; - t.strictEqual( chart.autoRender, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `bufferSize` property', function test( t ) { - var chart; - var opts; - - chart = new LineChart(); - t.strictEqual( chart.bufferSize, FLOAT64_MAX, 'default value is the maximum double-precision floating-point number' ); - - opts = { - 'bufferSize': 20 - }; - chart = new LineChart( opts ); - t.strictEqual( chart.bufferSize, opts.bufferSize, 'returns expected value' ); - - chart.bufferSize = 5; - t.strictEqual( chart.bufferSize, 5, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `data` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new LineChart(); - t.deepEqual( chart.data, [], 'default value is an empty array' ); - - opts = { - 'data': [ 1, 2, 3 ] - }; - chart = new LineChart( opts ); - - expected = [ 1, 2, 3 ]; - t.deepEqual( chart.data, expected, 'returns expected value' ); - - chart.data = [ 4, 5, 6 ]; - - expected = [ 4, 5, 6 ]; - t.deepEqual( chart.data, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `infinities` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new LineChart(); - t.strictEqual( chart.infinities, false, 'default value is false' ); - - opts = { - 'infinities': true - }; - chart = new LineChart( opts ); - - expected = true; - t.strictEqual( chart.infinities, expected, 'returns expected value' ); - - chart.infinities = false; - - expected = false; - t.strictEqual( chart.infinities, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `isDefined` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new LineChart(); - t.strictEqual( typeof chart.isDefined, 'function', 'default value is a function' ); - - opts = { - 'isDefined': noop - }; - chart = new LineChart( opts ); - - expected = noop; - t.deepEqual( chart.isDefined, expected, 'returns expected value' ); - - chart.isDefined = noop; - - expected = noop; - t.deepEqual( chart.isDefined, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `label` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new LineChart(); - t.strictEqual( chart.label, '', 'default value is an empty string' ); - - opts = { - 'label': 'foo' - }; - chart = new LineChart( opts ); - - expected = 'foo'; - t.strictEqual( chart.label, expected, 'returns expected value' ); - - chart.label = 'bar'; - - expected = 'bar'; - t.strictEqual( chart.label, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `yMax` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new LineChart(); - t.strictEqual( chart.yMax, NINF, 'default value is -infinity' ); - - opts = { - 'data': [ 1, 2, 3 ], - 'yMax': 10 - }; - chart = new LineChart( opts ); - - expected = 10; - t.strictEqual( chart.yMax, expected, 'returns expected value' ); - - chart.yMax = null; - - expected = 3; - t.strictEqual( chart.yMax, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `yMin` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new LineChart(); - t.strictEqual( chart.yMin, PINF, 'default value is +infinity' ); - - opts = { - 'data': [ 1, 2, 3 ], - 'yMin': 10 - }; - chart = new LineChart( opts ); - - expected = 10; - t.strictEqual( chart.yMin, expected, 'returns expected value' ); - - chart.yMin = null; - - expected = 1; - t.strictEqual( chart.yMin, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a `push` method for appending data', function test( t ) { - var chart = new LineChart(); - t.strictEqual( typeof chart.push, 'function', 'has push method' ); - t.end(); -}); - -tape( 'an instance has a `render` method for rendering a chart', function test( t ) { - var chart; - var str; - - chart = new LineChart(); - chart.data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; - - str = chart.render(); - t.strictEqual( str, '⡈⠑⠢⠔⠒⠒⠒', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'if a chart has not been provided data, the render method returns an empty string', function test( t ) { - var chart; - var str; - - chart = new LineChart(); - - str = chart.render(); - t.strictEqual( str, '', 'returns empty string' ); - - t.end(); -}); - -tape( 'by default, a chart renders `NaN` and infinite values as missing values', function test( t ) { - var chart; - var str; - - chart = new LineChart(); - chart.data = [ - 1.0, - 5.0, - NaN, - PINF, - NINF, - 4.0, - 3.0 - ]; - - str = chart.render(); - t.strictEqual( str, '⡈⠉ ⠒⠒', 'returns rendered chart with missing values' ); - - t.end(); -}); - -tape( 'if the `infinities` option/property is set to `true`, the chart encodes infinite values as `∞`', function test( t ) { - var chart; - var str; - - chart = new LineChart({ - 'infinities': true - }); - chart.data = [ - 1.0, - 5.0, - NaN, - PINF, - NINF, - 4.0, - 3.0 - ]; - - str = chart.render(); - t.strictEqual( str, '⡈⠉ ∞∞⠒⠒', 'returns rendered chart with infinities encoded as ∞' ); - - t.end(); -}); - -tape( 'if provided `yMin` and/or `yMax` values, the chart fixes the y-axis domain', function test( t ) { - var chart; - var str; - - chart = new LineChart(); - chart.data = [ - -1.0, - 5.0, - -3.0, - 2.0, - -4.0, - 4.0, - 3.0 - ]; - chart.yMin = 0.0; - chart.yMax = 10.0; - - str = chart.render(); - t.strictEqual( str, '⡐⢂⡠⢄⡠⠤⠤', 'returns rendered chart with fixed y-axis domain' ); - - chart.data = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; - chart.yMin = null; - chart.yMax = 3.0; - - str = chart.render(); - t.strictEqual( str, '⡐⠊⠉⠉⠉⠉', 'returns rendered chart with fixed y-axis domain' ); - - t.end(); -}); - -tape( 'if all datum are `0` and the y-axis domain is `0`, the chart renders each finite datum as the smallest glyph', function test( t ) { - var chart; - var str; - - chart = new LineChart(); - chart.data = [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]; - - str = chart.render(); - t.strictEqual( str, '⣀⣀⣀⣀⣀⣀⣀', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'if all datum are constant and non-zero and the y-axis domain is `0`, the chart renders each finite datum as the same mid-sized glyph', function test( t ) { - var chart; - var str; - - chart = new LineChart(); - chart.data = [ - 5.0, - 5.0, - 5.0, - 5.0, - 5.0, - 5.0, - 5.0 - ]; - - str = chart.render(); - t.strictEqual( str, '⠒⠒⠒⠒⠒⠒⠒', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'glyphs preceding infinite values slope in the direction of those values', function test( t ) { - var chart; - var str; - - chart = new LineChart(); - chart.data = [ 1.0, 5.0, NINF, 2.0, PINF, 4.0, 3.0 ]; - - str = chart.render(); - t.strictEqual( str, '⡈⢁ ⠌ ⠒⠒', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'an instance has a `toString` method for serializing a chart to string', function test( t ) { - var chart; - var str; - - chart = new LineChart(); - chart.data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; - - str = chart.toString(); - t.strictEqual( str, '⡈⠑⠢⠔⠒⠒⠒', 'returns rendered chart' ); - - t.end(); -}); diff --git a/sparklines/unicode/line/test/test.push.js b/sparklines/unicode/line/test/test.push.js deleted file mode 100644 index cdd005b..0000000 --- a/sparklines/unicode/line/test/test.push.js +++ /dev/null @@ -1,90 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function appends a datum to the chart data', function test( t ) { - var expected; - var chart; - var data; - var v; - - data = [ 1, 2, 3 ]; - chart = ctor({ - 'data': data - }); - - chart.push( 4 ); - v = chart.data; - - expected = [ 1, 2, 3, 4 ]; - t.deepEqual( v, expected, 'appends to chart data' ); - - t.end(); -}); - -tape( 'if appending data to the internal data buffer will result in the chart data exceeding the data buffer size, the function will remove the first data element', function test( t ) { - var expected; - var chart; - var data; - var v; - - data = [ 1, 2, 3 ]; - chart = ctor({ - 'data': data, - 'bufferSize': 3 - }); - - chart.push( 4 ); - v = chart.data; - - expected = [ 2, 3, 4 ]; - t.deepEqual( v, expected, 'removes first data element' ); - - t.end(); -}); - -tape( 'appending `data` triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ] - }); - - chart.on( 'change', onChange ); - chart.push( 4 ); - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); diff --git a/sparklines/unicode/line/test/test.y_max.js b/sparklines/unicode/line/test/test.y_max.js deleted file mode 100644 index ca96a99..0000000 --- a/sparklines/unicode/line/test/test.y_max.js +++ /dev/null @@ -1,116 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `yMax` value', function test( t ) { - var values; - var i; - - values = [ - '5', - NaN, - void 0, - true, - false, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.yMax = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ], - 'yMax': 10.0 - }); - t.strictEqual( chart.yMax, 10.0, 'returns expected value' ); - - chart.yMax = 20.0; - t.strictEqual( chart.yMax, 20.0, 'returns expected value' ); - - chart.yMax = 30.0; - t.strictEqual( chart.yMax, 30.0, 'returns expected value' ); - - chart.yMax = null; - t.strictEqual( chart.yMax, 3, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `yMax` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'yMax': 10.0 - }); - - chart.on( 'change', onChange ); - chart.yMax = 30.0; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `yMax` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'yMax': 10.0 - }); - - chart.on( 'change', onChange ); - chart.yMax = 10.0; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/line/test/test.y_min.js b/sparklines/unicode/line/test/test.y_min.js deleted file mode 100644 index 470d9a7..0000000 --- a/sparklines/unicode/line/test/test.y_min.js +++ /dev/null @@ -1,116 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `yMin` value', function test( t ) { - var values; - var i; - - values = [ - '5', - NaN, - void 0, - true, - false, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.yMin = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ], - 'yMin': 10.0 - }); - t.strictEqual( chart.yMin, 10.0, 'returns expected value' ); - - chart.yMin = 20.0; - t.strictEqual( chart.yMin, 20.0, 'returns expected value' ); - - chart.yMin = 30.0; - t.strictEqual( chart.yMin, 30.0, 'returns expected value' ); - - chart.yMin = null; - t.strictEqual( chart.yMin, 1, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `yMin` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'yMin': 10.0 - }); - - chart.on( 'change', onChange ); - chart.yMin = 30.0; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `yMin` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'yMin': 10.0 - }); - - chart.on( 'change', onChange ); - chart.yMin = 10.0; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/package.json b/sparklines/unicode/package.json deleted file mode 100644 index 6d6ff29..0000000 --- a/sparklines/unicode/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "@stdlib/plot/sparklines/unicode", - "version": "0.0.0", - "description": "Create a Unicode sparkline.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "bin": { - "sparkline": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "column", - "bar", - "histogram", - "hist", - "win", - "loss", - "tristate", - "up", - "down", - "line", - "chart", - "graph", - "graphic", - "data", - "sparklines", - "sparkline", - "visualize", - "viz", - "vis", - "unicode" - ] -} diff --git a/sparklines/unicode/test/fixtures/stdin_error.js.txt b/sparklines/unicode/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4aca..0000000 --- a/sparklines/unicode/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/sparklines/unicode/test/test.auto_render.js b/sparklines/unicode/test/test.auto_render.js deleted file mode 100644 index 039c91f..0000000 --- a/sparklines/unicode/test/test.auto_render.js +++ /dev/null @@ -1,183 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `autoRender` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.autoRender = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - t.strictEqual( chart.autoRender, false, 'returns expected value' ); - - chart.autoRender = true; - t.strictEqual( chart.autoRender, true, 'returns expected value' ); - - chart.autoRender = false; - t.strictEqual( chart.autoRender, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'if `autoRender` is `true`, when a returned instance receives a `change` event, it re-renders and emits a `render` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true, - 'data': [ 0.10, 0.50, 0.90 ] - }); - - chart.on( 'render', onRender ); - chart.emit( 'change' ); - - function onRender( str ) { - t.ok( true, 'emits a render event' ); - t.strictEqual( typeof str, 'string', 'provides expected value' ); - t.end(); - } -}); - -tape( 'if `autoRender` is `false`, when a returned instance receives a `change` event, it does not re-render or emit a `render` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'autoRender': false - }); - - chart.on( 'render', onRender ); - chart.emit( 'change' ); - - t.pass( 'is ok' ); - t.end(); - - function onRender() { - t.fail( 'should never be invoked' ); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true - }); - - chart.on( 'change', onChange ); - chart.autoRender = false; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - - chart.on( 'change', onChange ); - chart.autoRender = true; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true - }); - - chart.on( 'change', onChange ); - chart.autoRender = true; - - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - - chart.on( 'change', onChange ); - chart.autoRender = false; - - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); diff --git a/sparklines/unicode/test/test.buffer_size.js b/sparklines/unicode/test/test.buffer_size.js deleted file mode 100644 index 4bbd121..0000000 --- a/sparklines/unicode/test/test.buffer_size.js +++ /dev/null @@ -1,146 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `bufferSize` value', function test( t ) { - var values; - var i; - - values = [ - '5', - -5, - 0, - 3.14, - NaN, - void 0, - true, - false, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.bufferSize = value; - }; - } -}); - -tape( 'an instance throws an error if provided a `bufferSize` which is less than the number of data elements', function test( t ) { - var values; - var i; - - values = [ - 1, - 2, - 3, - 4, - 5 - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor({ - 'data': [ 1, 2, 3, 4, 5, 6 ] - }); - chart.bufferSize = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - t.strictEqual( chart.bufferSize, 10, 'returns expected value' ); - - chart.bufferSize = 20; - t.strictEqual( chart.bufferSize, 20, 'returns expected value' ); - - chart.bufferSize = 30; - t.strictEqual( chart.bufferSize, 30, 'returns expected value' ); - - chart.bufferSize = null; - t.strictEqual( chart.bufferSize, FLOAT64_MAX, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `bufferSize` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - - chart.on( 'change', onChange ); - chart.bufferSize = 30; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `bufferSize` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - - chart.on( 'change', onChange ); - chart.bufferSize = 10; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/test/test.cli.js b/sparklines/unicode/test/test.cli.js deleted file mode 100644 index afde671..0000000 --- a/sparklines/unicode/test/test.cli.js +++ /dev/null @@ -1,387 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( '@stdlib/string/replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface renders a Unicode sparkline', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'6\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▂▄▅▇█\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a chart type', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'6\'; process.argv[ 8 ] = \'--type=line\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '⡠⠤⠔⠒⠊⠉\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the minimum value of the y-axis domain', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'6\'; process.argv[ 8 ] = \'--ymin=3\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▁▁▃▆█\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the maximum value of the y-axis domain', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'6\'; process.argv[ 8 ] = \'--ymax=3\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▅████\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports encoding infinities', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'9e500\'; process.argv[ 8 ] = \'--infinities\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▃▅▆█∞\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports encoding infinities (disable)', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'1\'; process.argv[ 3 ] = \'2\'; process.argv[ 4 ] = \'3\'; process.argv[ 5 ] = \'4\'; process.argv[ 6 ] = \'5\'; process.argv[ 7 ] = \'9e500\'; process.argv[ 8 ] = \'--no-infinities\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▃▅▆█ \n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "1\n2\n3\n4\n5\n6"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▂▄▅▇█\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports providing a custom separator when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf "1\t2\t3\t4\t5\t6"', - '|', - EXEC_PATH, - '-e', - '"process.stdin.isTTY = false; process.argv[ 2 ] = \'--split=/\\t/\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▂▄▅▇█\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports providing a custom separator when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf "1\t2\t3\t4\t5\t6"', - '|', - EXEC_PATH, - '-e', - '"process.stdin.isTTY = false; process.argv[ 2 ] = \'--split=\\t\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▁▂▄▅▇█\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/sparklines/unicode/test/test.data.js b/sparklines/unicode/test/test.data.js deleted file mode 100644 index a28b01c..0000000 --- a/sparklines/unicode/test/test.data.js +++ /dev/null @@ -1,128 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ndarray = require( '@stdlib/ndarray/ctor' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `data` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.data = value; - }; - } -}); - -tape( 'an instance throws an error if provided a `data` value which more data elements than the data buffer size', function test( t ) { - var values; - var i; - - values = [ - [ 1, 2 ], - [ 1, 2, 3 ], - [ 1, 2, 3, 4 ] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor({ - 'bufferSize': 1 - }); - chart.data = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - var arr; - - arr = [ 1, 2, 3 ]; - chart = ctor({ - 'data': arr - }); - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, arr, 'returns expected value' ); - - arr = [ 4, 5, 6 ]; - chart.data = arr; - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, arr, 'returns expected value' ); - - arr = ndarray( 'generic', [ 7, 8, 9 ], [ 3 ], [ 1 ], 0, 'row-major' ); - chart.data = arr; - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, [ 7, 8, 9 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `data` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ] - }); - - chart.on( 'change', onChange ); - chart.data = [ 4, 5, 6 ]; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); diff --git a/sparklines/unicode/test/test.description.js b/sparklines/unicode/test/test.description.js deleted file mode 100644 index b2222e1..0000000 --- a/sparklines/unicode/test/test.description.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `description` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.description = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - t.strictEqual( chart.description, 'beep', 'returns expected value' ); - - chart.description = 'boop'; - t.strictEqual( chart.description, 'boop', 'returns expected value' ); - - chart.description = 'foo'; - t.strictEqual( chart.description, 'foo', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `description` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - - chart.on( 'change', onChange ); - chart.description = 'boop'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `description` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - - chart.on( 'change', onChange ); - chart.description = 'beep'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/test/test.infinities.js b/sparklines/unicode/test/test.infinities.js deleted file mode 100644 index db3e916..0000000 --- a/sparklines/unicode/test/test.infinities.js +++ /dev/null @@ -1,128 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `infinities` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.infinities = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'infinities': false - }); - t.strictEqual( chart.infinities, false, 'returns expected value' ); - - chart.infinities = true; - t.strictEqual( chart.infinities, true, 'returns expected value' ); - - chart.infinities = false; - t.strictEqual( chart.infinities, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `infinities` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'infinities': true - }); - - chart.on( 'change', onChange ); - chart.infinities = false; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `infinities` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'infinities': false - }); - - chart.on( 'change', onChange ); - chart.infinities = true; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `infinities` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'infinities': true - }); - - chart.on( 'change', onChange ); - chart.infinities = true; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/test/test.is_defined.js b/sparklines/unicode/test/test.is_defined.js deleted file mode 100644 index deaa3d7..0000000 --- a/sparklines/unicode/test/test.is_defined.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `isDefined` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.isDefined = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - t.strictEqual( chart.isDefined, noop, 'returns expected value' ); - - chart.isDefined = isDefined; - t.strictEqual( chart.isDefined, isDefined, 'returns expected value' ); - - t.end(); - - function isDefined( d ) { - return d === d; - } -}); - -tape( 'the default behavior is to treat `NaN` values as undefined', function test( t ) { - var chart = ctor(); - t.strictEqual( chart.isDefined( NaN ), false, 'returns expected value' ); - t.strictEqual( chart.isDefined( 5 ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( null ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( '' ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( [] ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( {} ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( 'foo' ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( true ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( false ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'setting the `isDefined` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - - chart.on( 'change', onChange ); - chart.isDefined = isDefined; - - function isDefined( d ) { - return d === d; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `isDefined` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - - chart.on( 'change', onChange ); - chart.isDefined = noop; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/test/test.js b/sparklines/unicode/test/test.js deleted file mode 100644 index 5e5bc79..0000000 --- a/sparklines/unicode/test/test.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Chart = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Chart, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the export is a class constructor', function test( t ) { - var chart = new Chart(); - t.strictEqual( chart instanceof Chart, true, 'returns class instance' ); - t.end(); -}); diff --git a/sparklines/unicode/test/test.label.js b/sparklines/unicode/test/test.label.js deleted file mode 100644 index d008ba5..0000000 --- a/sparklines/unicode/test/test.label.js +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `label` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - {}, - [], - [ 'beep' ], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.label = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'beep' - }); - t.strictEqual( chart.label, 'beep', 'returns expected value' ); - - chart.label = 'boop'; - t.strictEqual( chart.label, 'boop', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `label` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'a' - }); - - chart.on( 'change', onChange ); - chart.label = 'b'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'a' - }); - - chart.on( 'change', onChange ); - chart.label = 'a'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/test/test.main.js b/sparklines/unicode/test/test.main.js deleted file mode 100644 index 4aa7014..0000000 --- a/sparklines/unicode/test/test.main.js +++ /dev/null @@ -1,600 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); -var UnicodeSparkline = require( './../lib/main.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof UnicodeSparkline, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the export is a class constructor', function test( t ) { - var chart = new UnicodeSparkline(); - t.strictEqual( chart instanceof UnicodeSparkline, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (no data, no options)', function test( t ) { - var chart; - var ctor; - - ctor = UnicodeSparkline; - chart = ctor(); - - t.strictEqual( chart instanceof UnicodeSparkline, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (data)', function test( t ) { - var chart; - var ctor; - - ctor = UnicodeSparkline; - chart = ctor( [ 1, 2, 3 ] ); - - t.strictEqual( chart instanceof UnicodeSparkline, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (options)', function test( t ) { - var chart; - var ctor; - - ctor = UnicodeSparkline; - chart = ctor({ - 'bufferSize': 10, - 'description': 'beep', - 'infinities': true, - 'isDefined': noop, - 'data': [ 1, 2, 3 ], - 'autoRender': true, - 'label': 'foo', - 'type': 'line', - 'yMin': null, - 'yMax': null - }); - - t.strictEqual( chart instanceof UnicodeSparkline, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (data and options)', function test( t ) { - var chart; - var ctor; - - ctor = UnicodeSparkline; - chart = ctor( [ 1, 2, 3 ], { - 'bufferSize': 10, - 'description': 'beep', - 'infinities': true, - 'isDefined': noop, - 'autoRender': true, - 'label': 'foo', - 'type': 'line', - 'yMin': null, - 'yMax': null - }); - - t.strictEqual( chart instanceof UnicodeSparkline, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor will throw an error if provided an invalid options argument (no data argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = new UnicodeSparkline( value ); // eslint-disable-line no-unused-vars - }; - } -}); - -tape( 'the constructor will throw an error if provided an invalid options argument (data argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = new UnicodeSparkline( [ 1, 2, 3 ], value ); // eslint-disable-line no-unused-vars - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid option (no data argument)', function test( t ) { - t.throws( foo, TypeError, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new UnicodeSparkline({ - 'description': [] - }); - } -}); - -tape( 'the constructor throws an error if provided an invalid option (data argument)', function test( t ) { - t.throws( foo, TypeError, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new UnicodeSparkline( [ 1, 2, 3 ], { - 'description': [] - }); - } -}); - -tape( 'the constructor throws an error if provided a `bufferSize` option which is less than the number of data elements (options)', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new UnicodeSparkline({ - 'data': [ 1, 2, 3, 4, 5 ], - 'bufferSize': 3 - }); - } -}); - -tape( 'the constructor throws an error if provided a `bufferSize` option which is less than the number of data elements (data argument)', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new UnicodeSparkline( [ 1, 2, 3, 4, 5 ], { - 'bufferSize': 3 - }); - } -}); - -tape( 'an instance has a writable `autoRender` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new UnicodeSparkline(); - t.strictEqual( chart.autoRender, false, 'default value is false' ); - - opts = { - 'autoRender': true - }; - chart = new UnicodeSparkline( opts ); - - expected = true; - t.strictEqual( chart.autoRender, expected, 'returns expected value' ); - - chart.autoRender = false; - - expected = false; - t.strictEqual( chart.autoRender, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `bufferSize` property', function test( t ) { - var chart; - var opts; - - chart = new UnicodeSparkline(); - t.strictEqual( chart.bufferSize, FLOAT64_MAX, 'default value is the maximum double-precision floating-point number' ); - - opts = { - 'bufferSize': 20 - }; - chart = new UnicodeSparkline( opts ); - t.strictEqual( chart.bufferSize, opts.bufferSize, 'returns expected value' ); - - chart.bufferSize = 5; - t.strictEqual( chart.bufferSize, 5, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `data` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new UnicodeSparkline(); - t.deepEqual( chart.data, [], 'default value is an empty array' ); - - opts = { - 'data': [ 1, 2, 3 ] - }; - chart = new UnicodeSparkline( opts ); - - expected = [ 1, 2, 3 ]; - t.deepEqual( chart.data, expected, 'returns expected value' ); - - chart.data = [ 4, 5, 6 ]; - - expected = [ 4, 5, 6 ]; - t.deepEqual( chart.data, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `infinities` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new UnicodeSparkline(); - t.strictEqual( chart.infinities, false, 'default value is false' ); - - opts = { - 'infinities': true - }; - chart = new UnicodeSparkline( opts ); - - expected = true; - t.strictEqual( chart.infinities, expected, 'returns expected value' ); - - chart.infinities = false; - - expected = false; - t.strictEqual( chart.infinities, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `isDefined` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new UnicodeSparkline(); - t.strictEqual( typeof chart.isDefined, 'function', 'default value is a function' ); - - opts = { - 'isDefined': noop - }; - chart = new UnicodeSparkline( opts ); - - expected = noop; - t.deepEqual( chart.isDefined, expected, 'returns expected value' ); - - chart.isDefined = noop; - - expected = noop; - t.deepEqual( chart.isDefined, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `label` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new UnicodeSparkline(); - t.strictEqual( chart.label, '', 'default value is an empty string' ); - - opts = { - 'label': 'foo' - }; - chart = new UnicodeSparkline( opts ); - - expected = 'foo'; - t.strictEqual( chart.label, expected, 'returns expected value' ); - - chart.label = 'bar'; - - expected = 'bar'; - t.strictEqual( chart.label, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `type` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new UnicodeSparkline(); - t.strictEqual( chart.type, 'column', 'default value is a column chart' ); - - opts = { - 'type': 'line' - }; - chart = new UnicodeSparkline( opts ); - - expected = 'line'; - t.strictEqual( chart.type, expected, 'returns expected value' ); - - chart.type = 'win-loss'; - - expected = 'win-loss'; - t.strictEqual( chart.type, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `yMax` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new UnicodeSparkline(); - t.strictEqual( chart.yMax, NINF, 'default value is -infinity' ); - - opts = { - 'data': [ 1, 2, 3 ], - 'yMax': 10 - }; - chart = new UnicodeSparkline( opts ); - - expected = 10; - t.strictEqual( chart.yMax, expected, 'returns expected value' ); - - chart.yMax = null; - - expected = 3; - t.strictEqual( chart.yMax, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `yMin` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new UnicodeSparkline(); - t.strictEqual( chart.yMin, PINF, 'default value is +infinity' ); - - opts = { - 'data': [ 1, 2, 3 ], - 'yMin': 10 - }; - chart = new UnicodeSparkline( opts ); - - expected = 10; - t.strictEqual( chart.yMin, expected, 'returns expected value' ); - - chart.yMin = null; - - expected = 1; - t.strictEqual( chart.yMin, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a `push` method for appending data', function test( t ) { - var chart = new UnicodeSparkline(); - t.strictEqual( typeof chart.push, 'function', 'has push method' ); - t.end(); -}); - -tape( 'an instance has a `render` method for rendering a chart', function test( t ) { - var chart; - var str; - - chart = new UnicodeSparkline(); - chart.data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; - - str = chart.render(); - t.strictEqual( str, '▁█▅▃▆▆▅', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'an instance supports rendering a column chart', function test( t ) { - var chart; - var str; - - chart = new UnicodeSparkline({ - 'type': 'column' - }); - chart.data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; - - str = chart.render(); - t.strictEqual( str, '▁█▅▃▆▆▅', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'an instance supports rendering a line chart', function test( t ) { - var chart; - var str; - - chart = new UnicodeSparkline({ - 'type': 'line' - }); - chart.data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; - - str = chart.render(); - t.strictEqual( str, '⡈⠑⠢⠔⠒⠒⠒', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'an instance supports rendering a tristate chart', function test( t ) { - var chart; - var str; - - chart = new UnicodeSparkline({ - 'type': 'tristate' - }); - chart.data = [ -1, 1, 0, 0, 1, -1, -1, 1 ]; - - str = chart.render(); - t.strictEqual( str, '▄▀──▀▄▄▀', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'an instance supports rendering an up/down chart', function test( t ) { - var chart; - var str; - - chart = new UnicodeSparkline({ - 'type': 'up-down' - }); - chart.data = [ -1, 1, 1, 1, 1, -1, -1, 1 ]; - - str = chart.render(); - t.strictEqual( str, '↓↑↑↑↑↓↓↑', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'an instance supports rendering a win/loss chart', function test( t ) { - var chart; - var str; - - chart = new UnicodeSparkline({ - 'type': 'win-loss' - }); - chart.data = [ -2, 1, 2, 2, 1, -1, -1, 1, -2, -2, 2, 2, -2 ]; - - str = chart.render(); - t.strictEqual( str, '┌╵└┴╵╷╷╵┌┬┴┴┬', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'if a chart has not been provided data, the render method returns an empty string', function test( t ) { - var chart; - var str; - - chart = new UnicodeSparkline(); - - str = chart.render(); - t.strictEqual( str, '', 'returns empty string' ); - - t.end(); -}); - -tape( 'for certain chart types, if the `infinities` option/property is set to `true`, the chart encodes infinite values as `∞`', function test( t ) { - var chart; - var str; - - chart = new UnicodeSparkline({ - 'type': 'column', - 'infinities': true - }); - chart.data = [ - 1.0, - 5.0, - NaN, - PINF, - NINF, - 4.0, - 3.0 - ]; - - str = chart.render(); - t.strictEqual( str, '▁█ ∞∞▆▅', 'returns rendered chart with infinities encoded as ∞' ); - - t.end(); -}); - -tape( 'for certain chart types, if provided `yMin` and/or `yMax` values, the chart fixes the y-axis domain', function test( t ) { - var chart; - var str; - - chart = new UnicodeSparkline({ - 'type': 'column' - }); - chart.data = [ - -1.0, - 5.0, - -3.0, - 2.0, - -4.0, - 4.0, - 3.0 - ]; - chart.yMin = 0.0; - chart.yMax = 10.0; - - str = chart.render(); - t.strictEqual( str, '▁▅▁▂▁▄▃', 'returns rendered chart with fixed y-axis domain' ); - - chart.data = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; - chart.yMin = null; - chart.yMax = 3.0; - - str = chart.render(); - t.strictEqual( str, '▁▅████', 'returns rendered chart with fixed y-axis domain' ); - - t.end(); -}); - -tape( 'an instance has a `toString` method for serializing a chart to string', function test( t ) { - var chart; - var str; - - chart = new UnicodeSparkline(); - chart.data = [ 1.0, 5.0, 3.0, 2.0, 4.0, 4.0, 3.0 ]; - - str = chart.toString(); - t.strictEqual( str, '▁█▅▃▆▆▅', 'returns rendered chart' ); - - t.end(); -}); diff --git a/sparklines/unicode/test/test.push.js b/sparklines/unicode/test/test.push.js deleted file mode 100644 index cdd005b..0000000 --- a/sparklines/unicode/test/test.push.js +++ /dev/null @@ -1,90 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function appends a datum to the chart data', function test( t ) { - var expected; - var chart; - var data; - var v; - - data = [ 1, 2, 3 ]; - chart = ctor({ - 'data': data - }); - - chart.push( 4 ); - v = chart.data; - - expected = [ 1, 2, 3, 4 ]; - t.deepEqual( v, expected, 'appends to chart data' ); - - t.end(); -}); - -tape( 'if appending data to the internal data buffer will result in the chart data exceeding the data buffer size, the function will remove the first data element', function test( t ) { - var expected; - var chart; - var data; - var v; - - data = [ 1, 2, 3 ]; - chart = ctor({ - 'data': data, - 'bufferSize': 3 - }); - - chart.push( 4 ); - v = chart.data; - - expected = [ 2, 3, 4 ]; - t.deepEqual( v, expected, 'removes first data element' ); - - t.end(); -}); - -tape( 'appending `data` triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ] - }); - - chart.on( 'change', onChange ); - chart.push( 4 ); - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); diff --git a/sparklines/unicode/test/test.type.js b/sparklines/unicode/test/test.type.js deleted file mode 100644 index f3f62bf..0000000 --- a/sparklines/unicode/test/test.type.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `type` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 'COLUMN', - 'WIN/LOSS', - 'win/loss', - 'up/down', - 'Line', - 5, - NaN, - null, - void 0, - true, - false, - {}, - [], - [ 'beep' ], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.type = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'type': 'win-loss' - }); - t.strictEqual( chart.type, 'win-loss', 'returns expected value' ); - - chart.type = 'line'; - t.strictEqual( chart.type, 'line', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `type` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'type': 'column' - }); - - chart.on( 'change', onChange ); - chart.type = 'line'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `type` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'type': 'line' - }); - - chart.on( 'change', onChange ); - chart.type = 'line'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/test/test.y_max.js b/sparklines/unicode/test/test.y_max.js deleted file mode 100644 index ca96a99..0000000 --- a/sparklines/unicode/test/test.y_max.js +++ /dev/null @@ -1,116 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `yMax` value', function test( t ) { - var values; - var i; - - values = [ - '5', - NaN, - void 0, - true, - false, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.yMax = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ], - 'yMax': 10.0 - }); - t.strictEqual( chart.yMax, 10.0, 'returns expected value' ); - - chart.yMax = 20.0; - t.strictEqual( chart.yMax, 20.0, 'returns expected value' ); - - chart.yMax = 30.0; - t.strictEqual( chart.yMax, 30.0, 'returns expected value' ); - - chart.yMax = null; - t.strictEqual( chart.yMax, 3, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `yMax` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'yMax': 10.0 - }); - - chart.on( 'change', onChange ); - chart.yMax = 30.0; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `yMax` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'yMax': 10.0 - }); - - chart.on( 'change', onChange ); - chart.yMax = 10.0; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/test/test.y_min.js b/sparklines/unicode/test/test.y_min.js deleted file mode 100644 index 470d9a7..0000000 --- a/sparklines/unicode/test/test.y_min.js +++ /dev/null @@ -1,116 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `yMin` value', function test( t ) { - var values; - var i; - - values = [ - '5', - NaN, - void 0, - true, - false, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.yMin = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ], - 'yMin': 10.0 - }); - t.strictEqual( chart.yMin, 10.0, 'returns expected value' ); - - chart.yMin = 20.0; - t.strictEqual( chart.yMin, 20.0, 'returns expected value' ); - - chart.yMin = 30.0; - t.strictEqual( chart.yMin, 30.0, 'returns expected value' ); - - chart.yMin = null; - t.strictEqual( chart.yMin, 1, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `yMin` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'yMin': 10.0 - }); - - chart.on( 'change', onChange ); - chart.yMin = 30.0; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `yMin` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'yMin': 10.0 - }); - - chart.on( 'change', onChange ); - chart.yMin = 10.0; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/tristate/README.md b/sparklines/unicode/tristate/README.md deleted file mode 100644 index e7a0185..0000000 --- a/sparklines/unicode/tristate/README.md +++ /dev/null @@ -1,463 +0,0 @@ - - -# Tristate Chart - -> Create a Unicode sparkline tristate chart. - -
- -## Usage - -```javascript -var TristateChart = require( '@stdlib/plot/sparklines/unicode/tristate' ); -``` - -#### TristateChart( \[data,] \[options] ) - -Returns a chart instance. - -```javascript -var chart = new TristateChart(); -``` - -The constructor accepts the following `options`: - -- **autoRender**: `boolean` indicating whether to re-render on a `change` event. -- **bufferSize**: data buffer size. If provided, data is kept in a first-in first-out (FIFO) buffer which cannot exceed the buffer size. Default: `+infinity`. -- **data**: chart data. -- **description**: chart description. -- **isDefined**: accessor `function` indicating whether a datum is defined. -- **label**: data label. - -* * * - -### Writable Properties - - - -#### TristateChart.prototype.autoRender - -Rendering mode. If `true`, an instance renders on each `'change'` event; otherwise, rendering must be triggered manually. - -```javascript -var chart = new TristateChart(); - -// Set: -chart.autoRender = false; - -// Get: -var mode = chart.autoRender; -// returns false -``` - - - -#### TristateChart.prototype.bufferSize - -Data buffer size. If set, this specifies the maximum number of data elements which can be rendered. Once the data buffer is full, each new datum results in the oldest datum being removed. - -```javascript -var chart = new TristateChart(); - -// Set: -chart.bufferSize = 3; - -// Get: -var size = chart.bufferSize; -// returns 3 - -chart.data = [ 1, 2, 3 ]; - -var data = chart.data; -// returns [ 1, 2, 3 ] - -chart.push( 4 ); - -data = chart.data; -// returns [ 2, 3, 4 ] -``` - -Setting a data buffer size is useful when rendering data streams. - - - -#### TristateChart.prototype.data - -Chart data. When set, the value must be either `array`-like or an [ndarray][@stdlib/ndarray/ctor] and cannot exceed the `bufferSize`. - -```javascript -var Int8Array = require( '@stdlib/array/int8' ); - -var chart = new TristateChart(); - -// Set: -chart.data = new Int8Array( [ 1, 0, -1, 1, 1, 0 ] ); - -// Get: -var data = chart.data; -// returns [ 1, 0, -1, 1, 1, 0 ] -``` - -Note that data is **copied** to an internal data buffer. - - - -#### TristateChart.prototype.description - -Chart description. - -```javascript -var chart = new TristateChart(); - -// Set: -chart.description = 'Gains and losses for the past 30 days.'; - -// Get: -var desc = chart.description; -// returns 'Gains and losses for the past 30 days.' -``` - - - -#### TristateChart.prototype.isDefined( d, i ) - -An accessor `function` which defines whether a datum is defined. This accessor is used to define how missing values are encoded. When invoked, the function is provided two arguments: - -- **d**: datum. -- **i**: datum index. - -```javascript -function isDefined( d ) { - return ( d !== null ); -} - -var chart = new TristateChart(); - -// Set: -chart.isDefined = isDefined; - -// Get: -var fcn = chart.isDefined; -// returns -``` - -The default behavior is to ignore values which are `NaN`. - - - -#### TristateChart.prototype.label - -Data label. - -```javascript -var chart = new TristateChart(); - -// Set: -chart.label = 'beep'; - -// Get: -var label = chart.label; -// returns 'beep' -``` - -* * * - -### Methods - - - -#### TristateChart.prototype.push( datum ) - -Appends data to a chart. - -```javascript -var chart = new TristateChart( [ 1, 2, 3 ] ); - -var data = chart.data; -// returns [ 1, 2, 3 ] - -chart.push( 4 ); - -data = chart.data; -// returns [ 1, 2, 3, 4 ] -``` - - - -#### TristateChart.prototype.render() - -Renders a tristate chart sparkline. - -```javascript -var chart = new TristateChart( [ -1, 1, 0, 0, 1, -1, -1, 1 ] ); - -var str = chart.render(); -// returns '▄▀──▀▄▄▀' -``` - -In a tristate chart, negative values are encoded as lower blocks, positive values are encoded as upper blocks, and values equal to zero are encoded as middle lines. - - - -#### TristateChart.prototype.toString() - -Serializes a tristate chart sparkline as a `string` by calling the `render()` method. - -```javascript -var chart = new TristateChart( [ -1, 1, 0, 0, 1, -1, -1, 1 ] ); - -var str = chart.toString(); -// returns '▄▀──▀▄▄▀' -``` - -* * * - -### Events - -#### 'change' - -Emitted whenever a property value changes. - -```javascript -var chart = new TristateChart(); - -chart.on( 'change', onChange ); - -function onChange() { - console.log( 'A property was updated.' ); -} -``` - -#### 'render' - -Emitted whenever a sparkline is rendered. - -```javascript -var chart = new TristateChart(); - -chart.on( 'render', onRender ); - -function onRender( str ) { - console.log( 'Rendered sparkline: %s', str ); -} -``` - -
- - - -
- -
- - - -
- -* * * - -## Examples - - - - - -```javascript -var randu = require( '@stdlib/random/base/randu' ); -var Int8Array = require( '@stdlib/array/int8' ); -var stdout = require( '@stdlib/streams/node/stdout' ); -var tristateChart = require( '@stdlib/plot/sparklines/unicode/tristate' ); - -var chart; -var data; -var id; -var i; - -function datum() { - var d = randu(); - if ( d > 0.67 ) { - return 1; - } - if ( d < 0.33 ) { - return -1; - } - return 0; -} - -// Generate some random data... -data = new Int8Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = datum(); -} - -// Create a new tristate chart: -chart = tristateChart( data ); - -// Hide the terminal cursor: -stdout.write( '\u001b[?25l' ); - -// Render the chart in the terminal: -stdout.write( chart.render() ); - -// Configure the chart to support streaming data: -chart.bufferSize = data.length; - -// Update the terminal chart with new data every second: -id = setInterval( update, 1000 ); - -// After some time, stop updating and close: -setTimeout( stop, 20000 ); - -function update() { - // Update the chart with new data: - chart.push( datum() ); - - // Clear the terminal line and render the chart: - stdout.write( '\r\u001b[2K' + chart.render() ); -} - -function stop() { - clearInterval( id ); - - // Restore the terminal cursor: - stdout.write( '\u001b[?25h' ); - - stdout.write( '\n' ); -} -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: sparkline-tristate [options] ... - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Separator used to split stdin data. Default: /\\r?\\n/. -``` - -
- - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is properly **escaped**. - - ```bash - # Not escaped... - $ echo -n $'1\n2\n3\n' | sparkline-tristate --split /\r?\n/ - - # Escaped... - $ echo -n $'1\n2\n3\n' | sparkline-tristate --split /\\r?\\n/ - ``` - -
- - - -
- -### Examples - -```bash -$ sparkline-tristate -- -1 1 0 0 1 -1 -1 1 -▄▀──▀▄▄▀ -``` - -```bash -$ echo -n $'-1\n1\n0\n0\n1\n-1\n-1\n1\n' | sparkline-tristate -▄▀──▀▄▄▀ -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/sparklines/unicode/tristate/benchmark/benchmark.js b/sparklines/unicode/tristate/benchmark/benchmark.js deleted file mode 100644 index ad80d7d..0000000 --- a/sparklines/unicode/tristate/benchmark/benchmark.js +++ /dev/null @@ -1,295 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var noop = require( '@stdlib/utils/noop' ); -var randu = require( '@stdlib/random/base/randu' ); -var isArray = require( '@stdlib/assert/is-array' ); -var pkg = require( './../package.json' ).name; -var TristateChart = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::instantiation', function benchmark( b ) { - var v; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new TristateChart(); - if ( !( v instanceof TristateChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof TristateChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,no_new', function benchmark( b ) { - var ctor; - var v; - var i; - - ctor = TristateChart; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = ctor(); - if ( !( v instanceof TristateChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof TristateChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,options', function benchmark( b ) { - var opts; - var v; - var i; - - opts = { - 'autoRender': false, - 'bufferSize': 10, - 'data': [ 1, 2, 3 ], - 'description': 'foo', - 'label': 'beep', - 'isDefined': noop - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new TristateChart( opts ); - if ( !( v instanceof TristateChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof TristateChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,data', function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new TristateChart( [ 1, 2, 3 ] ); - if ( !( v instanceof TristateChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof TristateChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,data,options', function benchmark( b ) { - var opts; - var v; - var i; - - opts = { - 'autoRender': false, - 'bufferSize': 10, - 'description': 'foo', - 'label': 'beep', - 'isDefined': noop - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new TristateChart( [ 1, 2, 3 ], opts ); - if ( !( v instanceof TristateChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof TristateChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:autoRender', function benchmark( b ) { - var bool; - var v; - var i; - - v = new TristateChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.autoRender = !bool; - if ( typeof v.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( typeof v.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:bufferSize', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 10, - 20, - 30 - ]; - v = new TristateChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.bufferSize = values[ i % values.length ]; - if ( typeof v.bufferSize !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( typeof v.bufferSize !== 'number' ) { - b.fail( 'should return a number' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:data', function benchmark( b ) { - var v; - var i; - - v = new TristateChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.data = [ randu(), randu(), randu() ]; - if ( typeof v.data !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArray( v.data ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:description', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'beep', - 'boop' - ]; - v = new TristateChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.description = values[ i % values.length ]; - if ( typeof v.description !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.description !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:isDefined', function benchmark( b ) { - var v; - var i; - - v = new TristateChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.isDefined = createFcn(); - if ( typeof v.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof v.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createFcn() { - return beep; - function beep() { - // No-op... - } - } -}); - -bench( pkg+'::set,get:label', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'beep', - 'boop' - ]; - v = new TristateChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.label = values[ i % values.length ]; - if ( typeof v.label !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.label !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/sparklines/unicode/tristate/benchmark/benchmark.render.js b/sparklines/unicode/tristate/benchmark/benchmark.render.js deleted file mode 100644 index a0d309d..0000000 --- a/sparklines/unicode/tristate/benchmark/benchmark.render.js +++ /dev/null @@ -1,116 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var Int8Array = require( '@stdlib/array/int8' ); -var pkg = require( './../package.json' ).name; -var TristateChart = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @param {TristateChart} chart - chart instance -* @returns {Function} benchmark function -*/ -function createBenchmark( len, chart ) { - var x; - var r; - var i; - - x = new Int8Array( len ); - for ( i = 0; i < x.length; i++ ) { - r = randu(); - if ( r > 0.51 ) { - x[ i ] = 1; - } else if ( r > 0.49 ) { - x[ i ] = 0; - } else { - x[ i ] = -1; - } - } - chart.data = x; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var str; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = chart.push( randu() ).render(); - if ( typeof str !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof str !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var chart; - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 4; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - chart = new TristateChart({ - 'bufferSize': len - }); - f = createBenchmark( len, chart ); - bench( pkg+':render:len='+len, f ); - } -} - -main(); diff --git a/sparklines/unicode/tristate/bin/cli b/sparklines/unicode/tristate/bin/cli deleted file mode 100755 index 3ea2f05..0000000 --- a/sparklines/unicode/tristate/bin/cli +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var sparkline = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var opts; - var cli; - var i; - - opts = {}; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - opts.split = reFromString( flags.split ); - } else { - opts.split = RE_EOL; - } - return stdin( onRead ); - } - for ( i = 0; i < args.length; i++ ) { - args[ i ] = parseFloat( args[ i ] ); - } - console.log( sparkline( args, opts ).render() ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( opts.split ); - for ( i = 0; i < lines.length; i++ ) { - lines[ i ] = parseFloat( lines[ i ] ); - } - console.log( sparkline( lines, opts ).render() ); // eslint-disable-line no-console - } -} - -main(); diff --git a/sparklines/unicode/tristate/docs/repl.txt b/sparklines/unicode/tristate/docs/repl.txt deleted file mode 100644 index 0d6ef0e..0000000 --- a/sparklines/unicode/tristate/docs/repl.txt +++ /dev/null @@ -1,77 +0,0 @@ - -{{alias}}( [data,] [options] ) - Returns a sparkline tristate chart instance. - - In a tristate chart, negative values are encoded as lower blocks, positive - values are encoded as upper blocks, and values equal to zero are encoded as - middle lines. - - The `data` argument takes precedence over the `data` option. - - Parameters - ---------- - data: ArrayLike|ndarray (optional) - Chart data. - - options: Object (optional) - Options. - - options.autoRender: boolean (optional) - Boolean indicating whether to re-render on a 'change' event. Default: - false. - - options.bufferSize: integer|null (optional) - Data buffer size. If provided, data is kept in a first-in first-out - (FIFO) buffer which cannot exceed the buffer size. Default: +infinity. - - options.data: ArrayLike|ndarray (optional) - Chart data. - - options.description: string (optional) - Chart description. - - options.isDefined: Function (optional) - An accessor function indicating whether a datum is defined. - - options.label: string (optional) - Data label. - - Returns - ------- - chart: TristateChart - Tristate chart instance. - - chart.autoRender - Rendering mode. If `true`, an instance renders on each 'change' event; - otherwise, rendering must be triggered manually. - - chart.bufferSize - Data buffer size. - - chart.description - Chart description. - - chart.data - Chart data. - - chart.label - Data label. - - chart.isDefined( d, i ) - An accessor function which defines whether a datum is defined. This - accessor is used to define how missing values are encoded. The default - behavior is to ignore values which are `NaN`. - - chart.render() - Renders a tristate chart sparkline. - - Examples - -------- - > var data = [ -1, 1, 0, 0, 1, -1, -1, 1 ]; - > var chart = new {{alias}}( data ); - > chart.render() - '▄▀──▀▄▄▀' - - See Also - -------- - diff --git a/sparklines/unicode/tristate/docs/usage.txt b/sparklines/unicode/tristate/docs/usage.txt deleted file mode 100644 index a7cebd4..0000000 --- a/sparklines/unicode/tristate/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: sparkline-tristate [options] ... - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Separator used to split stdin data. Default: /\\r?\\n/. diff --git a/sparklines/unicode/tristate/etc/cli_opts.json b/sparklines/unicode/tristate/etc/cli_opts.json deleted file mode 100644 index 7c40f9a..0000000 --- a/sparklines/unicode/tristate/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/sparklines/unicode/tristate/examples/index.js b/sparklines/unicode/tristate/examples/index.js deleted file mode 100644 index 130c6e1..0000000 --- a/sparklines/unicode/tristate/examples/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var randu = require( '@stdlib/random/base/randu' ); -var Int8Array = require( '@stdlib/array/int8' ); -var tristateChart = require( './../lib' ); - -var chart; -var data; -var str; -var d; -var i; - -// Generate some random data... -data = new Int8Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - d = randu(); - if ( d > 0.67 ) { - d = 1; - } else if ( d < 0.33 ) { - d = -1; - } else { - d = 0; - } - data[ i ] = d; -} - -// Create a new tristate chart: -chart = tristateChart( data ); - -// Render the chart as a string: -str = chart.render(); - -console.log( str ); -// => '...' diff --git a/sparklines/unicode/tristate/examples/update.js b/sparklines/unicode/tristate/examples/update.js deleted file mode 100644 index bce364f..0000000 --- a/sparklines/unicode/tristate/examples/update.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var randu = require( '@stdlib/random/base/randu' ); -var Int8Array = require( '@stdlib/array/int8' ); -var stdout = require( '@stdlib/streams/node/stdout' ); -var tristateChart = require( './../lib' ); - -var chart; -var data; -var id; -var i; - -function datum() { - var d = randu(); - if ( d > 0.67 ) { - return 1; - } - if ( d < 0.33 ) { - return -1; - } - return 0; -} - -// Generate some random data... -data = new Int8Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = datum(); -} - -// Create a new tristate chart: -chart = tristateChart( data ); - -// Hide the terminal cursor: -stdout.write( '\u001b[?25l' ); - -// Render the chart in the terminal: -stdout.write( chart.render() ); - -// Configure the chart to support streaming data: -chart.bufferSize = data.length; - -// Update the terminal chart with new data every second: -id = setInterval( update, 1000 ); - -// After some time, stop updating and close: -setTimeout( stop, 20000 ); - -function update() { - // Update the chart with new data: - chart.push( datum() ); - - // Clear the terminal line and render the chart: - stdout.write( '\r\u001b[2K' + chart.render() ); -} - -function stop() { // eslint-disable-line stdlib/no-redeclare - clearInterval( id ); - - // Restore the terminal cursor: - stdout.write( '\u001b[?25h' ); - - stdout.write( '\n' ); -} diff --git a/sparklines/unicode/tristate/lib/index.js b/sparklines/unicode/tristate/lib/index.js deleted file mode 100644 index 2f50c92..0000000 --- a/sparklines/unicode/tristate/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Create a Unicode sparkline tristate chart. -* -* @module @stdlib/plot/sparklines/unicode/tristate -* -* @example -* var tristateChart = require( '@stdlib/plot/sparklines/unicode/tristate' ); -* -* var data = [ -1, 1, 0, 0, 1, -1, -1, 1 ]; -* -* var chart = tristateChart( data ); -* -* var str = chart.render(); -* // returns '▄▀──▀▄▄▀' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/sparklines/unicode/tristate/lib/main.js b/sparklines/unicode/tristate/lib/main.js deleted file mode 100644 index 94d4af8..0000000 --- a/sparklines/unicode/tristate/lib/main.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var inherit = require( '@stdlib/utils/inherit' ); -var Sparkline = require( './../../../../sparklines/base/ctor' ); - - -// MAIN // - -/** -* Unicode sparkline tristate chart constructor. -* -* @constructor -* @param {(ArrayLike|ndarrayLike)} [data] - chart data -* @param {Options} [options] - chart options -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a `change` event -* @param {(PositiveInteger|null)} [options.bufferSize] - data buffer size -* @param {(ArrayLikeObject|ndarrayLike)} [options.data] - data -* @param {string} [options.description=''] - chart description -* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined -* @param {string} [options.label] - data label -* @throws {TypeError} must provide valid options -* @returns {TristateChart} chart instance -* -* @example -* var data = [ -1, 1, 0, 0, 1, -1, -1, 1 ]; -* -* var chart = new TristateChart( data ); -* -* var str = chart.render(); -* // returns '▄▀──▀▄▄▀' -* -* @example -* var data = [ -1, 1, 0, 0, 1, -1, -1, 1 ]; -* var opts = { -* 'data': data -* }; -* var chart = new TristateChart( opts ); -* -* var str = chart.render(); -* // returns '▄▀──▀▄▄▀' -*/ -function TristateChart() { - var nargs; - - nargs = arguments.length; - if ( !(this instanceof TristateChart) ) { - if ( nargs === 0 ) { - return new TristateChart(); - } - if ( nargs === 1 ) { - return new TristateChart( arguments[ 0 ] ); - } - return new TristateChart( arguments[ 0 ], arguments[ 1 ] ); - } - // Invoke parent constructor... - if ( nargs === 0 ) { - Sparkline.call( this ); - } else if ( nargs === 1 ) { - Sparkline.call( this, arguments[ 0 ] ); - } else { - Sparkline.call( this, arguments[ 0 ], arguments[ 1 ] ); - } - return this; -} - -/* -* Inherit from the `Sparkline` prototype. -*/ -inherit( TristateChart, Sparkline ); - -/** -* Renders a sparkline tristate chart. -* -* @private -* @name _render -* @memberof TristateChart.prototype -* @type {Function} -* @returns {string} rendered sparkline tristate chart -* -* @example -* var data = [ -1, 1, 0, 0, 1, -1, -1, 1 ]; -* -* var chart = new TristateChart( data ); -* -* var str = chart.render(); -* // returns '▄▀──▀▄▄▀' -*/ -TristateChart.prototype._render = require( './render.js' ); // eslint-disable-line no-underscore-dangle - - -// EXPORTS // - -module.exports = TristateChart; diff --git a/sparklines/unicode/tristate/lib/render.js b/sparklines/unicode/tristate/lib/render.js deleted file mode 100644 index bfc3bef..0000000 --- a/sparklines/unicode/tristate/lib/render.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// VARIABLES // - -// See [Block Elements]{@link https://en.wikipedia.org/wiki/Block_Elements}. -var UPPER_BLOCK = '▀'; // U+2580 -var LOWER_BLOCK = '▄'; // U+2584 - -var MIDDLE = '─'; // U+2500 -var MISSING_VALUE = ' '; - - -// MAIN // - -/** -* Renders a chart. -* -* @private -* @returns {string} rendered chart -*/ -function render() { - /* eslint-disable no-invalid-this */ - var str; - var len; - var d; - var i; - - len = this._data.length; - if ( len === 0 ) { - return ''; - } - // Generate the sparkline chart, assigning a glyph to each datum... - str = ''; - - // TODO: color encoding: one color for both pos and neg or two colors for separate colors - - // TODO: "loss" values diff color (red) - - for ( i = 0; i < len; i++ ) { - d = this._data[ i ]; - if ( !this._isDefined( d, i ) ) { - str += MISSING_VALUE; - } else if ( d < 0.0 ) { - str += LOWER_BLOCK; - } else if ( d === 0.0 ) { - str += MIDDLE; - } else { - str += UPPER_BLOCK; - } - } - return str; -} - - -// EXPORTS // - -module.exports = render; diff --git a/sparklines/unicode/tristate/package.json b/sparklines/unicode/tristate/package.json deleted file mode 100644 index 44db6c1..0000000 --- a/sparklines/unicode/tristate/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@stdlib/plot/sparklines/unicode/tristate", - "version": "0.0.0", - "description": "Create a Unicode sparkline tristate chart.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "bin": { - "sparkline-tristate": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "tristate", - "win", - "loss", - "draw", - "chart", - "graph", - "graphic", - "data", - "sparklines", - "sparkline", - "visualize", - "viz", - "vis", - "unicode" - ] -} diff --git a/sparklines/unicode/tristate/test/fixtures/stdin_error.js.txt b/sparklines/unicode/tristate/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4aca..0000000 --- a/sparklines/unicode/tristate/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/sparklines/unicode/tristate/test/test.auto_render.js b/sparklines/unicode/tristate/test/test.auto_render.js deleted file mode 100644 index 039c91f..0000000 --- a/sparklines/unicode/tristate/test/test.auto_render.js +++ /dev/null @@ -1,183 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `autoRender` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.autoRender = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - t.strictEqual( chart.autoRender, false, 'returns expected value' ); - - chart.autoRender = true; - t.strictEqual( chart.autoRender, true, 'returns expected value' ); - - chart.autoRender = false; - t.strictEqual( chart.autoRender, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'if `autoRender` is `true`, when a returned instance receives a `change` event, it re-renders and emits a `render` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true, - 'data': [ 0.10, 0.50, 0.90 ] - }); - - chart.on( 'render', onRender ); - chart.emit( 'change' ); - - function onRender( str ) { - t.ok( true, 'emits a render event' ); - t.strictEqual( typeof str, 'string', 'provides expected value' ); - t.end(); - } -}); - -tape( 'if `autoRender` is `false`, when a returned instance receives a `change` event, it does not re-render or emit a `render` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'autoRender': false - }); - - chart.on( 'render', onRender ); - chart.emit( 'change' ); - - t.pass( 'is ok' ); - t.end(); - - function onRender() { - t.fail( 'should never be invoked' ); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true - }); - - chart.on( 'change', onChange ); - chart.autoRender = false; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - - chart.on( 'change', onChange ); - chart.autoRender = true; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true - }); - - chart.on( 'change', onChange ); - chart.autoRender = true; - - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - - chart.on( 'change', onChange ); - chart.autoRender = false; - - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); diff --git a/sparklines/unicode/tristate/test/test.buffer_size.js b/sparklines/unicode/tristate/test/test.buffer_size.js deleted file mode 100644 index 4bbd121..0000000 --- a/sparklines/unicode/tristate/test/test.buffer_size.js +++ /dev/null @@ -1,146 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `bufferSize` value', function test( t ) { - var values; - var i; - - values = [ - '5', - -5, - 0, - 3.14, - NaN, - void 0, - true, - false, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.bufferSize = value; - }; - } -}); - -tape( 'an instance throws an error if provided a `bufferSize` which is less than the number of data elements', function test( t ) { - var values; - var i; - - values = [ - 1, - 2, - 3, - 4, - 5 - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor({ - 'data': [ 1, 2, 3, 4, 5, 6 ] - }); - chart.bufferSize = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - t.strictEqual( chart.bufferSize, 10, 'returns expected value' ); - - chart.bufferSize = 20; - t.strictEqual( chart.bufferSize, 20, 'returns expected value' ); - - chart.bufferSize = 30; - t.strictEqual( chart.bufferSize, 30, 'returns expected value' ); - - chart.bufferSize = null; - t.strictEqual( chart.bufferSize, FLOAT64_MAX, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `bufferSize` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - - chart.on( 'change', onChange ); - chart.bufferSize = 30; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `bufferSize` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - - chart.on( 'change', onChange ); - chart.bufferSize = 10; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/tristate/test/test.cli.js b/sparklines/unicode/tristate/test/test.cli.js deleted file mode 100644 index aafc40b..0000000 --- a/sparklines/unicode/tristate/test/test.cli.js +++ /dev/null @@ -1,267 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( '@stdlib/string/replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface renders a tristate chart', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--\'; process.argv[ 3 ] = \'-1\'; process.argv[ 4 ] = \'1\'; process.argv[ 5 ] = \'0\'; process.argv[ 6 ] = \'0\'; process.argv[ 7 ] = \'1\'; process.argv[ 8 ] = \'-1\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▄▀──▀▄\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf -- "-1\n1\n0\n0\n1\n-1"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▄▀──▀▄\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports providing a custom separator when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf -- "-1\t1\t0\t0\t1\t-1"', - '|', - EXEC_PATH, - '-e', - '"process.stdin.isTTY = false; process.argv[ 2 ] = \'--split=/\\t/\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▄▀──▀▄\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports providing a custom separator when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf -- "-1\t1\t0\t0\t1\t-1"', - '|', - EXEC_PATH, - '-e', - '"process.stdin.isTTY = false; process.argv[ 2 ] = \'--split=\\t\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '▄▀──▀▄\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/sparklines/unicode/tristate/test/test.data.js b/sparklines/unicode/tristate/test/test.data.js deleted file mode 100644 index a28b01c..0000000 --- a/sparklines/unicode/tristate/test/test.data.js +++ /dev/null @@ -1,128 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ndarray = require( '@stdlib/ndarray/ctor' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `data` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.data = value; - }; - } -}); - -tape( 'an instance throws an error if provided a `data` value which more data elements than the data buffer size', function test( t ) { - var values; - var i; - - values = [ - [ 1, 2 ], - [ 1, 2, 3 ], - [ 1, 2, 3, 4 ] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor({ - 'bufferSize': 1 - }); - chart.data = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - var arr; - - arr = [ 1, 2, 3 ]; - chart = ctor({ - 'data': arr - }); - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, arr, 'returns expected value' ); - - arr = [ 4, 5, 6 ]; - chart.data = arr; - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, arr, 'returns expected value' ); - - arr = ndarray( 'generic', [ 7, 8, 9 ], [ 3 ], [ 1 ], 0, 'row-major' ); - chart.data = arr; - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, [ 7, 8, 9 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `data` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ] - }); - - chart.on( 'change', onChange ); - chart.data = [ 4, 5, 6 ]; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); diff --git a/sparklines/unicode/tristate/test/test.description.js b/sparklines/unicode/tristate/test/test.description.js deleted file mode 100644 index b2222e1..0000000 --- a/sparklines/unicode/tristate/test/test.description.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `description` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.description = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - t.strictEqual( chart.description, 'beep', 'returns expected value' ); - - chart.description = 'boop'; - t.strictEqual( chart.description, 'boop', 'returns expected value' ); - - chart.description = 'foo'; - t.strictEqual( chart.description, 'foo', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `description` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - - chart.on( 'change', onChange ); - chart.description = 'boop'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `description` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - - chart.on( 'change', onChange ); - chart.description = 'beep'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/tristate/test/test.is_defined.js b/sparklines/unicode/tristate/test/test.is_defined.js deleted file mode 100644 index deaa3d7..0000000 --- a/sparklines/unicode/tristate/test/test.is_defined.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `isDefined` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.isDefined = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - t.strictEqual( chart.isDefined, noop, 'returns expected value' ); - - chart.isDefined = isDefined; - t.strictEqual( chart.isDefined, isDefined, 'returns expected value' ); - - t.end(); - - function isDefined( d ) { - return d === d; - } -}); - -tape( 'the default behavior is to treat `NaN` values as undefined', function test( t ) { - var chart = ctor(); - t.strictEqual( chart.isDefined( NaN ), false, 'returns expected value' ); - t.strictEqual( chart.isDefined( 5 ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( null ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( '' ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( [] ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( {} ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( 'foo' ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( true ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( false ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'setting the `isDefined` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - - chart.on( 'change', onChange ); - chart.isDefined = isDefined; - - function isDefined( d ) { - return d === d; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `isDefined` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - - chart.on( 'change', onChange ); - chart.isDefined = noop; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/tristate/test/test.js b/sparklines/unicode/tristate/test/test.js deleted file mode 100644 index 5e5bc79..0000000 --- a/sparklines/unicode/tristate/test/test.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Chart = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Chart, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the export is a class constructor', function test( t ) { - var chart = new Chart(); - t.strictEqual( chart instanceof Chart, true, 'returns class instance' ); - t.end(); -}); diff --git a/sparklines/unicode/tristate/test/test.label.js b/sparklines/unicode/tristate/test/test.label.js deleted file mode 100644 index d008ba5..0000000 --- a/sparklines/unicode/tristate/test/test.label.js +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `label` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - {}, - [], - [ 'beep' ], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.label = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'beep' - }); - t.strictEqual( chart.label, 'beep', 'returns expected value' ); - - chart.label = 'boop'; - t.strictEqual( chart.label, 'boop', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `label` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'a' - }); - - chart.on( 'change', onChange ); - chart.label = 'b'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'a' - }); - - chart.on( 'change', onChange ); - chart.label = 'a'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/tristate/test/test.main.js b/sparklines/unicode/tristate/test/test.main.js deleted file mode 100644 index 242d859..0000000 --- a/sparklines/unicode/tristate/test/test.main.js +++ /dev/null @@ -1,374 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var TristateChart = require( './../lib/main.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof TristateChart, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the export is a class constructor', function test( t ) { - var chart = new TristateChart(); - t.strictEqual( chart instanceof TristateChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (no data, no options)', function test( t ) { - var chart; - var ctor; - - ctor = TristateChart; - chart = ctor(); - - t.strictEqual( chart instanceof TristateChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (data)', function test( t ) { - var chart; - var ctor; - - ctor = TristateChart; - chart = ctor( [ 1, 2, 3 ] ); - - t.strictEqual( chart instanceof TristateChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (options)', function test( t ) { - var chart; - var ctor; - - ctor = TristateChart; - chart = ctor({ - 'bufferSize': 10, - 'description': 'beep', - 'isDefined': noop, - 'data': [ 1, 2, 3 ], - 'autoRender': true, - 'label': 'foo' - }); - - t.strictEqual( chart instanceof TristateChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (data and options)', function test( t ) { - var chart; - var ctor; - - ctor = TristateChart; - chart = ctor( [ 1, 2, 3 ], { - 'bufferSize': 10, - 'description': 'beep', - 'isDefined': noop, - 'autoRender': true, - 'label': 'foo' - }); - - t.strictEqual( chart instanceof TristateChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor will throw an error if provided an invalid options argument (no data argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = new TristateChart( value ); // eslint-disable-line no-unused-vars - }; - } -}); - -tape( 'the constructor will throw an error if provided an invalid options argument (data argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = new TristateChart( [ 1, 2, 3 ], value ); // eslint-disable-line no-unused-vars - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid option (no data argument)', function test( t ) { - t.throws( foo, TypeError, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new TristateChart({ - 'description': [] - }); - } -}); - -tape( 'the constructor throws an error if provided an invalid option (data argument)', function test( t ) { - t.throws( foo, TypeError, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new TristateChart( [ 1, 2, 3 ], { - 'description': [] - }); - } -}); - -tape( 'the constructor throws an error if provided a `bufferSize` option which is less than the number of data elements (options)', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new TristateChart({ - 'data': [ 1, 2, 3, 4, 5 ], - 'bufferSize': 3 - }); - } -}); - -tape( 'the constructor throws an error if provided a `bufferSize` option which is less than the number of data elements (data argument)', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new TristateChart( [ 1, 2, 3, 4, 5 ], { - 'bufferSize': 3 - }); - } -}); - -tape( 'an instance has a writable `autoRender` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new TristateChart(); - t.strictEqual( chart.autoRender, false, 'default value is false' ); - - opts = { - 'autoRender': true - }; - chart = new TristateChart( opts ); - - expected = true; - t.strictEqual( chart.autoRender, expected, 'returns expected value' ); - - chart.autoRender = false; - - expected = false; - t.strictEqual( chart.autoRender, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `bufferSize` property', function test( t ) { - var chart; - var opts; - - chart = new TristateChart(); - t.strictEqual( chart.bufferSize, FLOAT64_MAX, 'default value is the maximum double-precision floating-point number' ); - - opts = { - 'bufferSize': 20 - }; - chart = new TristateChart( opts ); - t.strictEqual( chart.bufferSize, opts.bufferSize, 'returns expected value' ); - - chart.bufferSize = 5; - t.strictEqual( chart.bufferSize, 5, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `data` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new TristateChart(); - t.deepEqual( chart.data, [], 'default value is an empty array' ); - - opts = { - 'data': [ 1, 2, 3 ] - }; - chart = new TristateChart( opts ); - - expected = [ 1, 2, 3 ]; - t.deepEqual( chart.data, expected, 'returns expected value' ); - - chart.data = [ 4, 5, 6 ]; - - expected = [ 4, 5, 6 ]; - t.deepEqual( chart.data, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `isDefined` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new TristateChart(); - t.strictEqual( typeof chart.isDefined, 'function', 'default value is a function' ); - - opts = { - 'isDefined': noop - }; - chart = new TristateChart( opts ); - - expected = noop; - t.deepEqual( chart.isDefined, expected, 'returns expected value' ); - - chart.isDefined = noop; - - expected = noop; - t.deepEqual( chart.isDefined, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `label` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new TristateChart(); - t.strictEqual( chart.label, '', 'default value is an empty string' ); - - opts = { - 'label': 'foo' - }; - chart = new TristateChart( opts ); - - expected = 'foo'; - t.strictEqual( chart.label, expected, 'returns expected value' ); - - chart.label = 'bar'; - - expected = 'bar'; - t.strictEqual( chart.label, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a `push` method for appending data', function test( t ) { - var chart = new TristateChart(); - t.strictEqual( typeof chart.push, 'function', 'has push method' ); - t.end(); -}); - -tape( 'an instance has a `render` method for rendering a chart', function test( t ) { - var chart; - var str; - - chart = new TristateChart(); - chart.data = [ -1, 1, 0, 0, 1, -1, -1, 1 ]; - - str = chart.render(); - t.strictEqual( str, '▄▀──▀▄▄▀', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'if a chart has not been provided data, the render method returns an empty string', function test( t ) { - var chart; - var str; - - chart = new TristateChart(); - - str = chart.render(); - t.strictEqual( str, '', 'returns empty string' ); - - t.end(); -}); - -tape( 'by default, a chart renders `NaN` values as missing values', function test( t ) { - var chart; - var str; - - chart = new TristateChart(); - chart.data = [ -1, 1, NaN, 0, 1, NaN, -1, 1 ]; - - str = chart.render(); - t.strictEqual( str, '▄▀ ─▀ ▄▀', 'returns rendered chart with missing values' ); - - t.end(); -}); - -tape( 'an instance has a `toString` method for serializing a chart to string', function test( t ) { - var chart; - var str; - - chart = new TristateChart(); - chart.data = [ -1, 1, 0, 0, 1, -1, -1, 1 ]; - - str = chart.toString(); - t.strictEqual( str, '▄▀──▀▄▄▀', 'returns rendered chart' ); - - t.end(); -}); diff --git a/sparklines/unicode/tristate/test/test.push.js b/sparklines/unicode/tristate/test/test.push.js deleted file mode 100644 index cdd005b..0000000 --- a/sparklines/unicode/tristate/test/test.push.js +++ /dev/null @@ -1,90 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function appends a datum to the chart data', function test( t ) { - var expected; - var chart; - var data; - var v; - - data = [ 1, 2, 3 ]; - chart = ctor({ - 'data': data - }); - - chart.push( 4 ); - v = chart.data; - - expected = [ 1, 2, 3, 4 ]; - t.deepEqual( v, expected, 'appends to chart data' ); - - t.end(); -}); - -tape( 'if appending data to the internal data buffer will result in the chart data exceeding the data buffer size, the function will remove the first data element', function test( t ) { - var expected; - var chart; - var data; - var v; - - data = [ 1, 2, 3 ]; - chart = ctor({ - 'data': data, - 'bufferSize': 3 - }); - - chart.push( 4 ); - v = chart.data; - - expected = [ 2, 3, 4 ]; - t.deepEqual( v, expected, 'removes first data element' ); - - t.end(); -}); - -tape( 'appending `data` triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ] - }); - - chart.on( 'change', onChange ); - chart.push( 4 ); - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); diff --git a/sparklines/unicode/up-down/README.md b/sparklines/unicode/up-down/README.md deleted file mode 100644 index 8be6068..0000000 --- a/sparklines/unicode/up-down/README.md +++ /dev/null @@ -1,470 +0,0 @@ - - -# Up/Down Chart - -> Create a Unicode sparkline up/down chart. - -
- -## Usage - -```javascript -var UpDownChart = require( '@stdlib/plot/sparklines/unicode/up-down' ); -``` - -#### UpDownChart( \[data,] \[options] ) - -Returns a chart instance. - -```javascript -var chart = new UpDownChart(); -``` - -The constructor accepts the following `options`: - -- **autoRender**: `boolean` indicating whether to re-render on a `change` event. -- **bufferSize**: data buffer size. If provided, data is kept in a first-in first-out (FIFO) buffer which cannot exceed the buffer size. Default: `+infinity`. -- **data**: chart data. -- **description**: chart description. -- **isDefined**: accessor `function` indicating whether a datum is defined. -- **label**: data label. - -* * * - -### Writable Properties - - - -#### UpDownChart.prototype.autoRender - -Rendering mode. If `true`, an instance renders on each `'change'` event; otherwise, rendering must be triggered manually. - -```javascript -var chart = new UpDownChart(); - -// Set: -chart.autoRender = false; - -// Get: -var mode = chart.autoRender; -// returns false -``` - - - -#### UpDownChart.prototype.bufferSize - -Data buffer size. If set, this specifies the maximum number of data elements which can be rendered. Once the data buffer is full, each new datum results in the oldest datum being removed. - -```javascript -var chart = new UpDownChart(); - -// Set: -chart.bufferSize = 3; - -// Get: -var size = chart.bufferSize; -// returns 3 - -chart.data = [ 1, 2, 3 ]; - -var data = chart.data; -// returns [ 1, 2, 3 ] - -chart.push( 4 ); - -data = chart.data; -// returns [ 2, 3, 4 ] -``` - -Setting a data buffer size is useful when rendering data streams. - - - -#### UpDownChart.prototype.data - -Chart data. When set, the value must be either `array`-like or an [ndarray][@stdlib/ndarray/ctor] and cannot exceed the `bufferSize`. - -```javascript -var Int8Array = require( '@stdlib/array/int8' ); - -var chart = new UpDownChart(); - -// Set: -chart.data = new Int8Array( [ -1, 1, 1, 1, 1, -1, -1, 1 ] ); - -// Get: -var data = chart.data; -// returns [ -1, 1, 1, 1, 1, -1, -1, 1 ] -``` - -Note that data is **copied** to an internal data buffer. - - - -#### UpDownChart.prototype.description - -Chart description. - -```javascript -var chart = new UpDownChart(); - -// Set: -chart.description = 'Wins and losses for the past 30 days.'; - -// Get: -var desc = chart.description; -// returns 'Wins and losses for the past 30 days.' -``` - - - -#### UpDownChart.prototype.isDefined( d, i ) - -An accessor `function` which defines whether a datum is defined. This accessor is used to define how missing values are encoded. When invoked, the function is provided two arguments: - -- **d**: datum. -- **i**: datum index. - -```javascript -function isDefined( d ) { - // Only consider "wins" as defined: - return ( d === 1 ); -} - -var chart = new UpDownChart(); - -// Set: -chart.isDefined = isDefined; - -// Get: -var fcn = chart.isDefined; -// returns -``` - -The default behavior is to ignore any values which are not `1` or `-1`. - - - -#### UpDownChart.prototype.label - -Data label. - -```javascript -var chart = new UpDownChart(); - -// Set: -chart.label = 'beep'; - -// Get: -var label = chart.label; -// returns 'beep' -``` - -* * * - -### Methods - - - -#### UpDownChart.prototype.push( datum ) - -Appends data to a chart. - -```javascript -var chart = new UpDownChart( [ 1, 2, 3 ] ); - -var data = chart.data; -// returns [ 1, 2, 3 ] - -chart.push( 4 ); - -data = chart.data; -// returns [ 1, 2, 3, 4 ] -``` - - - -#### UpDownChart.prototype.render() - -Renders an up/down chart sparkline. - -```javascript -var chart = new UpDownChart( [ -1, 1, 1, 1, 1, -1, -1, 1 ] ); - -var str = chart.render(); -// returns '↓↑↑↑↑↓↓↑' -``` - -Glyphs: - -| Value | Glyph | -| :---: | :---: | -| 1 | ↑ | -| -1 | ↓ | - -If provided any other value other than `1` or `-1`, the value is encoded as a missing value. - - - -#### UpDownChart.prototype.toString() - -Serializes an up/down chart sparkline as a `string` by calling the `render()` method. - -```javascript -var chart = new UpDownChart( [ -1, 1, 1, 1, 1, -1, -1, 1 ] ); - -var str = chart.toString(); -// returns '↓↑↑↑↑↓↓↑' -``` - -* * * - -### Events - -#### 'change' - -Emitted whenever a property value changes. - -```javascript -var chart = new UpDownChart(); - -chart.on( 'change', onChange ); - -function onChange() { - console.log( 'A property was updated.' ); -} -``` - -#### 'render' - -Emitted whenever a sparkline is rendered. - -```javascript -var chart = new UpDownChart(); - -chart.on( 'render', onRender ); - -function onRender( str ) { - console.log( 'Rendered sparkline: %s', str ); -} -``` - -
- - - -
- -
- - - -
- -* * * - -## Examples - - - - - -```javascript -var randu = require( '@stdlib/random/base/randu' ); -var Int8Array = require( '@stdlib/array/int8' ); -var stdout = require( '@stdlib/streams/node/stdout' ); -var updownChart = require( '@stdlib/plot/sparklines/unicode/up-down' ); - -var chart; -var data; -var id; -var i; - -function datum() { - var d = randu(); - if ( d > 0.75 ) { - d = 1; - } else { - d = -1; - } - return d; -} - -// Generate some random data... -data = new Int8Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = datum(); -} - -// Create a new up/down chart: -chart = updownChart( data ); - -// Hide the terminal cursor: -stdout.write( '\u001b[?25l' ); - -// Render the chart in the terminal: -stdout.write( chart.render() ); - -// Configure the chart to support streaming data: -chart.bufferSize = data.length; - -// Update the terminal chart with new data every second: -id = setInterval( update, 1000 ); - -// After some time, stop updating and close: -setTimeout( stop, 20000 ); - -function update() { - // Update the chart with new data: - chart.push( datum() ); - - // Clear the terminal line and render the chart: - stdout.write( '\r\u001b[2K' + chart.render() ); -} - -function stop() { - clearInterval( id ); - - // Restore the terminal cursor: - stdout.write( '\u001b[?25h' ); - - stdout.write( '\n' ); -} -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: sparkline-updown [options] ... - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Separator used to split stdin data. Default: /\\r?\\n/. -``` - -
- - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is properly **escaped**. - - ```bash - # Not escaped... - $ echo -n $'1\n2\n3\n' | sparkline-updown --split /\r?\n/ - - # Escaped... - $ echo -n $'1\n2\n3\n' | sparkline-updown --split /\\r?\\n/ - ``` - -
- - - -
- -### Examples - -```bash -$ sparkline-updown -- -1 1 1 1 1 -1 -1 1 -↓↑↑↑↑↓↓↑ -``` - -```bash -$ echo -n $'-1\n1\n1\n1\n1\n-1\n-1\n1\n' | sparkline-updown -↓↑↑↑↑↓↓↑ -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/sparklines/unicode/up-down/benchmark/benchmark.js b/sparklines/unicode/up-down/benchmark/benchmark.js deleted file mode 100644 index e377dff..0000000 --- a/sparklines/unicode/up-down/benchmark/benchmark.js +++ /dev/null @@ -1,295 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var noop = require( '@stdlib/utils/noop' ); -var randu = require( '@stdlib/random/base/randu' ); -var isArray = require( '@stdlib/assert/is-array' ); -var pkg = require( './../package.json' ).name; -var UpDownChart = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::instantiation', function benchmark( b ) { - var v; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new UpDownChart(); - if ( !( v instanceof UpDownChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof UpDownChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,no_new', function benchmark( b ) { - var ctor; - var v; - var i; - - ctor = UpDownChart; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = ctor(); - if ( !( v instanceof UpDownChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof UpDownChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,options', function benchmark( b ) { - var opts; - var v; - var i; - - opts = { - 'autoRender': false, - 'bufferSize': 10, - 'data': [ 1, 2, 3 ], - 'description': 'foo', - 'label': 'beep', - 'isDefined': noop - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new UpDownChart( opts ); - if ( !( v instanceof UpDownChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof UpDownChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,data', function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new UpDownChart( [ 1, 2, 3 ] ); - if ( !( v instanceof UpDownChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof UpDownChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,data,options', function benchmark( b ) { - var opts; - var v; - var i; - - opts = { - 'autoRender': false, - 'bufferSize': 10, - 'description': 'foo', - 'label': 'beep', - 'isDefined': noop - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new UpDownChart( [ 1, 2, 3 ], opts ); - if ( !( v instanceof UpDownChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof UpDownChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:autoRender', function benchmark( b ) { - var bool; - var v; - var i; - - v = new UpDownChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.autoRender = !bool; - if ( typeof v.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( typeof v.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:bufferSize', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 10, - 20, - 30 - ]; - v = new UpDownChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.bufferSize = values[ i % values.length ]; - if ( typeof v.bufferSize !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( typeof v.bufferSize !== 'number' ) { - b.fail( 'should return a number' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:data', function benchmark( b ) { - var v; - var i; - - v = new UpDownChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.data = [ randu(), randu(), randu() ]; - if ( typeof v.data !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArray( v.data ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:description', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'beep', - 'boop' - ]; - v = new UpDownChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.description = values[ i % values.length ]; - if ( typeof v.description !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.description !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:isDefined', function benchmark( b ) { - var v; - var i; - - v = new UpDownChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.isDefined = createFcn(); - if ( typeof v.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof v.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createFcn() { - return beep; - function beep() { - // No-op... - } - } -}); - -bench( pkg+'::set,get:label', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'beep', - 'boop' - ]; - v = new UpDownChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.label = values[ i % values.length ]; - if ( typeof v.label !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.label !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/sparklines/unicode/up-down/benchmark/benchmark.render.js b/sparklines/unicode/up-down/benchmark/benchmark.render.js deleted file mode 100644 index ab7579f..0000000 --- a/sparklines/unicode/up-down/benchmark/benchmark.render.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var Int8Array = require( '@stdlib/array/int8' ); -var pkg = require( './../package.json' ).name; -var UpDownChart = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @param {UpDownChart} chart - chart instance -* @returns {Function} benchmark function -*/ -function createBenchmark( len, chart ) { - var x; - var r; - var i; - - x = new Int8Array( len ); - for ( i = 0; i < x.length; i++ ) { - r = randu(); - if ( r > 0.5 ) { - x[ i ] = 1; - } else { - x[ i ] = -1; - } - } - chart.data = x; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var str; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = chart.push( randu() ).render(); - if ( typeof str !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof str !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var chart; - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 4; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - chart = new UpDownChart({ - 'bufferSize': len - }); - f = createBenchmark( len, chart ); - bench( pkg+':render:len='+len, f ); - } -} - -main(); diff --git a/sparklines/unicode/up-down/bin/cli b/sparklines/unicode/up-down/bin/cli deleted file mode 100755 index 3ea2f05..0000000 --- a/sparklines/unicode/up-down/bin/cli +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var sparkline = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var opts; - var cli; - var i; - - opts = {}; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - opts.split = reFromString( flags.split ); - } else { - opts.split = RE_EOL; - } - return stdin( onRead ); - } - for ( i = 0; i < args.length; i++ ) { - args[ i ] = parseFloat( args[ i ] ); - } - console.log( sparkline( args, opts ).render() ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( opts.split ); - for ( i = 0; i < lines.length; i++ ) { - lines[ i ] = parseFloat( lines[ i ] ); - } - console.log( sparkline( lines, opts ).render() ); // eslint-disable-line no-console - } -} - -main(); diff --git a/sparklines/unicode/up-down/docs/repl.txt b/sparklines/unicode/up-down/docs/repl.txt deleted file mode 100644 index 5a10962..0000000 --- a/sparklines/unicode/up-down/docs/repl.txt +++ /dev/null @@ -1,83 +0,0 @@ - -{{alias}}( [data,] [options] ) - Returns a sparkline up/down chart instance. - - Glyphs: - - | Value | Glyph | - |:-----:|:-----:| - | 1 | ↑ | - | -1 | ↓ | - - If provided any other value other than 1 or -1, the value is encoded as a - missing value. - - The `data` argument takes precedence over the `data` option. - - Parameters - ---------- - data: ArrayLike|ndarray (optional) - Chart data. - - options: Object (optional) - Options. - - options.autoRender: boolean (optional) - Boolean indicating whether to re-render on a 'change' event. Default: - false. - - options.bufferSize: integer|null (optional) - Data buffer size. If provided, data is kept in a first-in first-out - (FIFO) buffer which cannot exceed the buffer size. Default: +infinity. - - options.data: ArrayLike|ndarray (optional) - Chart data. - - options.description: string (optional) - Chart description. - - options.isDefined: Function (optional) - An accessor function indicating whether a datum is defined. - - options.label: string (optional) - Data label. - - Returns - ------- - chart: UpDownChart - Chart instance. - - chart.autoRender - Rendering mode. If `true`, an instance renders on each 'change' event; - otherwise, rendering must be triggered manually. - - chart.bufferSize - Data buffer size. - - chart.description - Chart description. - - chart.data - Chart data. - - chart.label - Data label. - - chart.isDefined( d, i ) - An accessor function which defines whether a datum is defined. This - accessor is used to define how missing values are encoded. The default - behavior is to ignore any values which are not 1 or -1. - - chart.render() - Renders an up/down chart sparkline. - - Examples - -------- - > var data = [ -1, 1, 1, 1, 1, -1, -1, 1 ]; - > var chart = new {{alias}}( data ); - > chart.render() - '↓↑↑↑↑↓↓↑' - - See Also - -------- - diff --git a/sparklines/unicode/up-down/docs/usage.txt b/sparklines/unicode/up-down/docs/usage.txt deleted file mode 100644 index 9309952..0000000 --- a/sparklines/unicode/up-down/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: sparkline-updown [options] ... - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Separator used to split stdin data. Default: /\\r?\\n/. diff --git a/sparklines/unicode/up-down/etc/cli_opts.json b/sparklines/unicode/up-down/etc/cli_opts.json deleted file mode 100644 index 7c40f9a..0000000 --- a/sparklines/unicode/up-down/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/sparklines/unicode/up-down/examples/index.js b/sparklines/unicode/up-down/examples/index.js deleted file mode 100644 index 85e70a7..0000000 --- a/sparklines/unicode/up-down/examples/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var randu = require( '@stdlib/random/base/randu' ); -var Int8Array = require( '@stdlib/array/int8' ); -var updown = require( './../lib' ); - -var chart; -var data; -var str; -var d; -var i; - -// Generate some random data... -data = new Int8Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - d = randu(); - if ( d > 0.75 ) { - d = 1; - } else { - d = -1; - } - data[ i ] = d; -} - -// Create a new up/down chart: -chart = updown( data ); - -// Render the chart as a string: -str = chart.render(); - -console.log( str ); -// => '...' diff --git a/sparklines/unicode/up-down/examples/update.js b/sparklines/unicode/up-down/examples/update.js deleted file mode 100644 index f72b42c..0000000 --- a/sparklines/unicode/up-down/examples/update.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var randu = require( '@stdlib/random/base/randu' ); -var Int8Array = require( '@stdlib/array/int8' ); -var stdout = require( '@stdlib/streams/node/stdout' ); -var updown = require( './../lib' ); - -var chart; -var data; -var id; -var i; - -function datum() { - var d = randu(); - if ( d > 0.75 ) { - d = 1; - } else { - d = -1; - } - return d; -} - -// Generate some random data... -data = new Int8Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = datum(); -} - -// Create a new up/down chart: -chart = updown( data ); - -// Hide the terminal cursor: -stdout.write( '\u001b[?25l' ); - -// Render the chart in the terminal: -stdout.write( chart.render() ); - -// Configure the chart to support streaming data: -chart.bufferSize = data.length; - -// Update the terminal chart with new data every second: -id = setInterval( update, 1000 ); - -// After some time, stop updating and close: -setTimeout( stop, 20000 ); - -function update() { - // Update the chart with new data: - chart.push( datum() ); - - // Clear the terminal line and render the chart: - stdout.write( '\r\u001b[2K' + chart.render() ); -} - -function stop() { // eslint-disable-line stdlib/no-redeclare - clearInterval( id ); - - // Restore the terminal cursor: - stdout.write( '\u001b[?25h' ); - - stdout.write( '\n' ); -} diff --git a/sparklines/unicode/up-down/lib/index.js b/sparklines/unicode/up-down/lib/index.js deleted file mode 100644 index e673157..0000000 --- a/sparklines/unicode/up-down/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Create a Unicode sparkline up/down chart. -* -* @module @stdlib/plot/sparklines/unicode/up-down -* -* @example -* var updownChart = require( '@stdlib/plot/sparklines/unicode/up-down' ); -* -* var data = [ -1, 1, 1, 1, 1, -1, -1, 1 ]; -* -* var chart = updownChart( data ); -* -* var str = chart.render(); -* // returns '↓↑↑↑↑↓↓↑' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/sparklines/unicode/up-down/lib/main.js b/sparklines/unicode/up-down/lib/main.js deleted file mode 100644 index c8c8d33..0000000 --- a/sparklines/unicode/up-down/lib/main.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var inherit = require( '@stdlib/utils/inherit' ); -var Sparkline = require( './../../../../sparklines/base/ctor' ); - - -// MAIN // - -/** -* Unicode sparkline up/down chart constructor. -* -* @constructor -* @param {(ArrayLike|ndarrayLike)} [data] - chart data -* @param {Options} [options] - chart options -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a `change` event -* @param {(PositiveInteger|null)} [options.bufferSize] - data buffer size -* @param {(ArrayLikeObject|ndarrayLike)} [options.data] - data -* @param {string} [options.description=''] - chart description -* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined -* @param {string} [options.label] - data label -* @throws {TypeError} must provide valid options -* @returns {UpDownChart} chart instance -* -* @example -* var data = [ -1, 1, 1, 1, 1, -1, -1, 1 ]; -* -* var chart = new UpDownChart( data ); -* -* var str = chart.render(); -* // returns '↓↑↑↑↑↓↓↑' -* -* @example -* var data = [ -1, 1, 1, 1, 1, -1, -1, 1 ]; -* var opts = { -* 'data': data -* }; -* var chart = new UpDownChart( opts ); -* -* var str = chart.render(); -* // returns '↓↑↑↑↑↓↓↑' -*/ -function UpDownChart() { - var nargs; - - nargs = arguments.length; - if ( !(this instanceof UpDownChart) ) { - if ( nargs === 0 ) { - return new UpDownChart(); - } - if ( nargs === 1 ) { - return new UpDownChart( arguments[ 0 ] ); - } - return new UpDownChart( arguments[ 0 ], arguments[ 1 ] ); - } - // Invoke parent constructor... - if ( nargs === 0 ) { - Sparkline.call( this ); - } else if ( nargs === 1 ) { - Sparkline.call( this, arguments[ 0 ] ); - } else { - Sparkline.call( this, arguments[ 0 ], arguments[ 1 ] ); - } - return this; -} - -/* -* Inherit from the `Sparkline` prototype. -*/ -inherit( UpDownChart, Sparkline ); - -/** -* Renders a sparkline up/down chart. -* -* @private -* @name _render -* @memberof UpDownChart.prototype -* @type {Function} -* @returns {string} rendered sparkline up/down chart -* -* @example -* var data = [ -1, 1, 1, 1, 1, -1, -1, 1 ]; -* -* var chart = new UpDownChart( data ); -* -* var str = chart.render(); -* // returns '↓↑↑↑↑↓↓↑' -*/ -UpDownChart.prototype._render = require( './render.js' ); // eslint-disable-line no-underscore-dangle - - -// EXPORTS // - -module.exports = UpDownChart; diff --git a/sparklines/unicode/up-down/lib/render.js b/sparklines/unicode/up-down/lib/render.js deleted file mode 100644 index 5856dd6..0000000 --- a/sparklines/unicode/up-down/lib/render.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// VARIABLES // - -var UP = '↑'; // U+2191 -var DOWN = '↓'; // U+2193 -var MISSING_VALUE = ' '; - - -// MAIN // - -/** -* Renders a chart. -* -* @private -* @returns {string} rendered chart -*/ -function render() { - /* eslint-disable no-invalid-this */ - var str; - var len; - var d; - var i; - - len = this._data.length; - if ( len === 0 ) { - return ''; - } - // Generate the sparkline chart, assigning a glyph to each datum... - str = ''; - - // TODO: "down" values diff color (red) (?) - - // TODO: specify bkgd color for streaks of a given length (?) - - for ( i = 0; i < len; i++ ) { - d = this._data[ i ]; - if ( !this._isDefined( d, i ) ) { - str += MISSING_VALUE; - } else if ( d === 1 ) { - str += UP; - } else if ( d === -1 ) { - str += DOWN; - } else { - str += MISSING_VALUE; - } - } - return str; -} - - -// EXPORTS // - -module.exports = render; diff --git a/sparklines/unicode/up-down/package.json b/sparklines/unicode/up-down/package.json deleted file mode 100644 index 7a423e8..0000000 --- a/sparklines/unicode/up-down/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "@stdlib/plot/sparklines/unicode/up-down", - "version": "0.0.0", - "description": "Create a Unicode sparkline up/down chart.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "bin": { - "sparkline-updown": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "win", - "up", - "loss", - "down", - "draw", - "chart", - "graph", - "graphic", - "data", - "sparklines", - "sparkline", - "visualize", - "viz", - "vis", - "unicode" - ] -} diff --git a/sparklines/unicode/up-down/test/fixtures/stdin_error.js.txt b/sparklines/unicode/up-down/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4aca..0000000 --- a/sparklines/unicode/up-down/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/sparklines/unicode/up-down/test/test.auto_render.js b/sparklines/unicode/up-down/test/test.auto_render.js deleted file mode 100644 index 039c91f..0000000 --- a/sparklines/unicode/up-down/test/test.auto_render.js +++ /dev/null @@ -1,183 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `autoRender` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.autoRender = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - t.strictEqual( chart.autoRender, false, 'returns expected value' ); - - chart.autoRender = true; - t.strictEqual( chart.autoRender, true, 'returns expected value' ); - - chart.autoRender = false; - t.strictEqual( chart.autoRender, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'if `autoRender` is `true`, when a returned instance receives a `change` event, it re-renders and emits a `render` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true, - 'data': [ 0.10, 0.50, 0.90 ] - }); - - chart.on( 'render', onRender ); - chart.emit( 'change' ); - - function onRender( str ) { - t.ok( true, 'emits a render event' ); - t.strictEqual( typeof str, 'string', 'provides expected value' ); - t.end(); - } -}); - -tape( 'if `autoRender` is `false`, when a returned instance receives a `change` event, it does not re-render or emit a `render` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'autoRender': false - }); - - chart.on( 'render', onRender ); - chart.emit( 'change' ); - - t.pass( 'is ok' ); - t.end(); - - function onRender() { - t.fail( 'should never be invoked' ); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true - }); - - chart.on( 'change', onChange ); - chart.autoRender = false; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - - chart.on( 'change', onChange ); - chart.autoRender = true; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true - }); - - chart.on( 'change', onChange ); - chart.autoRender = true; - - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - - chart.on( 'change', onChange ); - chart.autoRender = false; - - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); diff --git a/sparklines/unicode/up-down/test/test.buffer_size.js b/sparklines/unicode/up-down/test/test.buffer_size.js deleted file mode 100644 index 4bbd121..0000000 --- a/sparklines/unicode/up-down/test/test.buffer_size.js +++ /dev/null @@ -1,146 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `bufferSize` value', function test( t ) { - var values; - var i; - - values = [ - '5', - -5, - 0, - 3.14, - NaN, - void 0, - true, - false, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.bufferSize = value; - }; - } -}); - -tape( 'an instance throws an error if provided a `bufferSize` which is less than the number of data elements', function test( t ) { - var values; - var i; - - values = [ - 1, - 2, - 3, - 4, - 5 - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor({ - 'data': [ 1, 2, 3, 4, 5, 6 ] - }); - chart.bufferSize = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - t.strictEqual( chart.bufferSize, 10, 'returns expected value' ); - - chart.bufferSize = 20; - t.strictEqual( chart.bufferSize, 20, 'returns expected value' ); - - chart.bufferSize = 30; - t.strictEqual( chart.bufferSize, 30, 'returns expected value' ); - - chart.bufferSize = null; - t.strictEqual( chart.bufferSize, FLOAT64_MAX, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `bufferSize` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - - chart.on( 'change', onChange ); - chart.bufferSize = 30; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `bufferSize` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - - chart.on( 'change', onChange ); - chart.bufferSize = 10; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/up-down/test/test.cli.js b/sparklines/unicode/up-down/test/test.cli.js deleted file mode 100644 index c9469e1..0000000 --- a/sparklines/unicode/up-down/test/test.cli.js +++ /dev/null @@ -1,267 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( '@stdlib/string/replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface renders an up/down chart', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--\'; process.argv[ 3 ] = \'-1\'; process.argv[ 4 ] = \'1\'; process.argv[ 5 ] = \'1\'; process.argv[ 6 ] = \'1\'; process.argv[ 7 ] = \'1\'; process.argv[ 8 ] = \'-1\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '↓↑↑↑↑↓\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf -- "-1\n1\n1\n1\n1\n-1"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '↓↑↑↑↑↓\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports providing a custom separator when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf -- "-1\t1\t1\t1\t1\t-1"', - '|', - EXEC_PATH, - '-e', - '"process.stdin.isTTY = false; process.argv[ 2 ] = \'--split=/\\t/\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '↓↑↑↑↑↓\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports providing a custom separator when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf -- "-1\t1\t1\t1\t1\t-1"', - '|', - EXEC_PATH, - '-e', - '"process.stdin.isTTY = false; process.argv[ 2 ] = \'--split=\\t\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '↓↑↑↑↑↓\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/sparklines/unicode/up-down/test/test.data.js b/sparklines/unicode/up-down/test/test.data.js deleted file mode 100644 index a28b01c..0000000 --- a/sparklines/unicode/up-down/test/test.data.js +++ /dev/null @@ -1,128 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ndarray = require( '@stdlib/ndarray/ctor' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `data` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.data = value; - }; - } -}); - -tape( 'an instance throws an error if provided a `data` value which more data elements than the data buffer size', function test( t ) { - var values; - var i; - - values = [ - [ 1, 2 ], - [ 1, 2, 3 ], - [ 1, 2, 3, 4 ] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor({ - 'bufferSize': 1 - }); - chart.data = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - var arr; - - arr = [ 1, 2, 3 ]; - chart = ctor({ - 'data': arr - }); - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, arr, 'returns expected value' ); - - arr = [ 4, 5, 6 ]; - chart.data = arr; - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, arr, 'returns expected value' ); - - arr = ndarray( 'generic', [ 7, 8, 9 ], [ 3 ], [ 1 ], 0, 'row-major' ); - chart.data = arr; - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, [ 7, 8, 9 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `data` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ] - }); - - chart.on( 'change', onChange ); - chart.data = [ 4, 5, 6 ]; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); diff --git a/sparklines/unicode/up-down/test/test.description.js b/sparklines/unicode/up-down/test/test.description.js deleted file mode 100644 index b2222e1..0000000 --- a/sparklines/unicode/up-down/test/test.description.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `description` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.description = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - t.strictEqual( chart.description, 'beep', 'returns expected value' ); - - chart.description = 'boop'; - t.strictEqual( chart.description, 'boop', 'returns expected value' ); - - chart.description = 'foo'; - t.strictEqual( chart.description, 'foo', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `description` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - - chart.on( 'change', onChange ); - chart.description = 'boop'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `description` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - - chart.on( 'change', onChange ); - chart.description = 'beep'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/up-down/test/test.is_defined.js b/sparklines/unicode/up-down/test/test.is_defined.js deleted file mode 100644 index deaa3d7..0000000 --- a/sparklines/unicode/up-down/test/test.is_defined.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `isDefined` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.isDefined = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - t.strictEqual( chart.isDefined, noop, 'returns expected value' ); - - chart.isDefined = isDefined; - t.strictEqual( chart.isDefined, isDefined, 'returns expected value' ); - - t.end(); - - function isDefined( d ) { - return d === d; - } -}); - -tape( 'the default behavior is to treat `NaN` values as undefined', function test( t ) { - var chart = ctor(); - t.strictEqual( chart.isDefined( NaN ), false, 'returns expected value' ); - t.strictEqual( chart.isDefined( 5 ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( null ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( '' ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( [] ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( {} ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( 'foo' ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( true ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( false ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'setting the `isDefined` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - - chart.on( 'change', onChange ); - chart.isDefined = isDefined; - - function isDefined( d ) { - return d === d; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `isDefined` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - - chart.on( 'change', onChange ); - chart.isDefined = noop; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/up-down/test/test.js b/sparklines/unicode/up-down/test/test.js deleted file mode 100644 index 5e5bc79..0000000 --- a/sparklines/unicode/up-down/test/test.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Chart = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Chart, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the export is a class constructor', function test( t ) { - var chart = new Chart(); - t.strictEqual( chart instanceof Chart, true, 'returns class instance' ); - t.end(); -}); diff --git a/sparklines/unicode/up-down/test/test.label.js b/sparklines/unicode/up-down/test/test.label.js deleted file mode 100644 index d008ba5..0000000 --- a/sparklines/unicode/up-down/test/test.label.js +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `label` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - {}, - [], - [ 'beep' ], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.label = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'beep' - }); - t.strictEqual( chart.label, 'beep', 'returns expected value' ); - - chart.label = 'boop'; - t.strictEqual( chart.label, 'boop', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `label` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'a' - }); - - chart.on( 'change', onChange ); - chart.label = 'b'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'a' - }); - - chart.on( 'change', onChange ); - chart.label = 'a'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/up-down/test/test.main.js b/sparklines/unicode/up-down/test/test.main.js deleted file mode 100644 index 9aecd82..0000000 --- a/sparklines/unicode/up-down/test/test.main.js +++ /dev/null @@ -1,392 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var UpDownChart = require( './../lib/main.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof UpDownChart, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the export is a class constructor', function test( t ) { - var chart = new UpDownChart(); - t.strictEqual( chart instanceof UpDownChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (no data, no options)', function test( t ) { - var chart; - var ctor; - - ctor = UpDownChart; - chart = ctor(); - - t.strictEqual( chart instanceof UpDownChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (data)', function test( t ) { - var chart; - var ctor; - - ctor = UpDownChart; - chart = ctor( [ 1, 2, 3 ] ); - - t.strictEqual( chart instanceof UpDownChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (options)', function test( t ) { - var chart; - var ctor; - - ctor = UpDownChart; - chart = ctor({ - 'bufferSize': 10, - 'description': 'beep', - 'isDefined': noop, - 'data': [ 1, 2, 3 ], - 'autoRender': true, - 'label': 'foo' - }); - - t.strictEqual( chart instanceof UpDownChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (data and options)', function test( t ) { - var chart; - var ctor; - - ctor = UpDownChart; - chart = ctor( [ 1, 2, 3 ], { - 'bufferSize': 10, - 'description': 'beep', - 'isDefined': noop, - 'autoRender': true, - 'label': 'foo' - }); - - t.strictEqual( chart instanceof UpDownChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor will throw an error if provided an invalid options argument (no data argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = new UpDownChart( value ); // eslint-disable-line no-unused-vars - }; - } -}); - -tape( 'the constructor will throw an error if provided an invalid options argument (data argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = new UpDownChart( [ 1, 2, 3 ], value ); // eslint-disable-line no-unused-vars - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid option (no data argument)', function test( t ) { - t.throws( foo, TypeError, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new UpDownChart({ - 'description': [] - }); - } -}); - -tape( 'the constructor throws an error if provided an invalid option (data argument)', function test( t ) { - t.throws( foo, TypeError, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new UpDownChart( [ 1, 2, 3 ], { - 'description': [] - }); - } -}); - -tape( 'the constructor throws an error if provided a `bufferSize` option which is less than the number of data elements (options)', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new UpDownChart({ - 'data': [ 1, 2, 3, 4, 5 ], - 'bufferSize': 3 - }); - } -}); - -tape( 'the constructor throws an error if provided a `bufferSize` option which is less than the number of data elements (data argument)', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new UpDownChart( [ 1, 2, 3, 4, 5 ], { - 'bufferSize': 3 - }); - } -}); - -tape( 'an instance has a writable `autoRender` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new UpDownChart(); - t.strictEqual( chart.autoRender, false, 'default value is false' ); - - opts = { - 'autoRender': true - }; - chart = new UpDownChart( opts ); - - expected = true; - t.strictEqual( chart.autoRender, expected, 'returns expected value' ); - - chart.autoRender = false; - - expected = false; - t.strictEqual( chart.autoRender, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `bufferSize` property', function test( t ) { - var chart; - var opts; - - chart = new UpDownChart(); - t.strictEqual( chart.bufferSize, FLOAT64_MAX, 'default value is the maximum double-precision floating-point number' ); - - opts = { - 'bufferSize': 20 - }; - chart = new UpDownChart( opts ); - t.strictEqual( chart.bufferSize, opts.bufferSize, 'returns expected value' ); - - chart.bufferSize = 5; - t.strictEqual( chart.bufferSize, 5, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `data` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new UpDownChart(); - t.deepEqual( chart.data, [], 'default value is an empty array' ); - - opts = { - 'data': [ 1, 2, 3 ] - }; - chart = new UpDownChart( opts ); - - expected = [ 1, 2, 3 ]; - t.deepEqual( chart.data, expected, 'returns expected value' ); - - chart.data = [ 4, 5, 6 ]; - - expected = [ 4, 5, 6 ]; - t.deepEqual( chart.data, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `isDefined` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new UpDownChart(); - t.strictEqual( typeof chart.isDefined, 'function', 'default value is a function' ); - - opts = { - 'isDefined': noop - }; - chart = new UpDownChart( opts ); - - expected = noop; - t.deepEqual( chart.isDefined, expected, 'returns expected value' ); - - chart.isDefined = noop; - - expected = noop; - t.deepEqual( chart.isDefined, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `label` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new UpDownChart(); - t.strictEqual( chart.label, '', 'default value is an empty string' ); - - opts = { - 'label': 'foo' - }; - chart = new UpDownChart( opts ); - - expected = 'foo'; - t.strictEqual( chart.label, expected, 'returns expected value' ); - - chart.label = 'bar'; - - expected = 'bar'; - t.strictEqual( chart.label, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a `push` method for appending data', function test( t ) { - var chart = new UpDownChart(); - t.strictEqual( typeof chart.push, 'function', 'has push method' ); - t.end(); -}); - -tape( 'an instance has a `render` method for rendering a chart', function test( t ) { - var chart; - var str; - - chart = new UpDownChart(); - chart.data = [ -1, 1, 1, 1, 1, -1, -1, 1 ]; - - str = chart.render(); - t.strictEqual( str, '↓↑↑↑↑↓↓↑', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'if a chart has not been provided data, the render method returns an empty string', function test( t ) { - var chart; - var str; - - chart = new UpDownChart(); - - str = chart.render(); - t.strictEqual( str, '', 'returns empty string' ); - - t.end(); -}); - -tape( 'by default, a chart renders values which are not `-1` or `1` as missing values', function test( t ) { - var chart; - var str; - - chart = new UpDownChart(); - chart.data = [ -1, 1, NaN, 1, 1, 5, -1, 1 ]; - - str = chart.render(); - t.strictEqual( str, '↓↑ ↑↑ ↓↑', 'returns rendered chart with missing values' ); - - t.end(); -}); - -tape( 'a chart supports filtering `1` or `-1` as missing values', function test( t ) { - var chart; - var str; - - chart = new UpDownChart(); - chart.isDefined = isDefined; - chart.data = [ -1, 1, -1, 1, 1, -1, -1, 1 ]; - - str = chart.render(); - t.strictEqual( str, ' ↑ ↑↑ ↑', 'returns rendered chart with missing values' ); - - t.end(); - - function isDefined( d ) { - return d === 1; - } -}); - -tape( 'an instance has a `toString` method for serializing a chart to string', function test( t ) { - var chart; - var str; - - chart = new UpDownChart(); - chart.data = [ -1, 1, 1, 1, 1, -1, -1, 1 ]; - - str = chart.toString(); - t.strictEqual( str, '↓↑↑↑↑↓↓↑', 'returns rendered chart' ); - - t.end(); -}); diff --git a/sparklines/unicode/up-down/test/test.push.js b/sparklines/unicode/up-down/test/test.push.js deleted file mode 100644 index cdd005b..0000000 --- a/sparklines/unicode/up-down/test/test.push.js +++ /dev/null @@ -1,90 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function appends a datum to the chart data', function test( t ) { - var expected; - var chart; - var data; - var v; - - data = [ 1, 2, 3 ]; - chart = ctor({ - 'data': data - }); - - chart.push( 4 ); - v = chart.data; - - expected = [ 1, 2, 3, 4 ]; - t.deepEqual( v, expected, 'appends to chart data' ); - - t.end(); -}); - -tape( 'if appending data to the internal data buffer will result in the chart data exceeding the data buffer size, the function will remove the first data element', function test( t ) { - var expected; - var chart; - var data; - var v; - - data = [ 1, 2, 3 ]; - chart = ctor({ - 'data': data, - 'bufferSize': 3 - }); - - chart.push( 4 ); - v = chart.data; - - expected = [ 2, 3, 4 ]; - t.deepEqual( v, expected, 'removes first data element' ); - - t.end(); -}); - -tape( 'appending `data` triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ] - }); - - chart.on( 'change', onChange ); - chart.push( 4 ); - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); diff --git a/sparklines/unicode/win-loss/README.md b/sparklines/unicode/win-loss/README.md deleted file mode 100644 index 6784157..0000000 --- a/sparklines/unicode/win-loss/README.md +++ /dev/null @@ -1,497 +0,0 @@ - - -# Win/Loss Chart - -> Create a Unicode sparkline win/loss chart. - -
- -## Usage - -```javascript -var WinLossChart = require( '@stdlib/plot/sparklines/unicode/win-loss' ); -``` - -#### WinLossChart( \[data,] \[options] ) - -Returns a chart instance. - -```javascript -var chart = new WinLossChart(); -``` - -The constructor accepts the following `options`: - -- **autoRender**: `boolean` indicating whether to re-render on a `change` event. -- **bufferSize**: data buffer size. If provided, data is kept in a first-in first-out (FIFO) buffer which cannot exceed the buffer size. Default: `+infinity`. -- **data**: chart data. -- **description**: chart description. -- **isDefined**: accessor `function` indicating whether a datum is defined. -- **label**: data label. - -* * * - -### Writable Properties - - - -#### WinLossChart.prototype.autoRender - -Rendering mode. If `true`, an instance renders on each `'change'` event; otherwise, rendering must be triggered manually. - -```javascript -var chart = new WinLossChart(); - -// Set: -chart.autoRender = false; - -// Get: -var mode = chart.autoRender; -// returns false -``` - - - -#### WinLossChart.prototype.bufferSize - -Data buffer size. If set, this specifies the maximum number of data elements which can be rendered. Once the data buffer is full, each new datum results in the oldest datum being removed. - -```javascript -var chart = new WinLossChart(); - -// Set: -chart.bufferSize = 3; - -// Get: -var size = chart.bufferSize; -// returns 3 - -chart.data = [ 1, 2, 3 ]; - -var data = chart.data; -// returns [ 1, 2, 3 ] - -chart.push( 4 ); - -data = chart.data; -// returns [ 2, 3, 4 ] -``` - -Setting a data buffer size is useful when rendering data streams. - - - -#### WinLossChart.prototype.data - -Chart data. When set, the value must be either `array`-like or an [ndarray][@stdlib/ndarray/ctor] and cannot exceed the `bufferSize`. - -```javascript -var Int8Array = require( '@stdlib/array/int8' ); - -var chart = new WinLossChart(); - -// Set: -chart.data = new Int8Array( [ -2, 1, 2, 2, 1, -1, -1, 1 ] ); - -// Get: -var data = chart.data; -// returns [ -2, 1, 2, 2, 1, -1, -1, 1 ] -``` - -Note that data is **copied** to an internal data buffer. - - - -#### WinLossChart.prototype.description - -Chart description. - -```javascript -var chart = new WinLossChart(); - -// Set: -chart.description = 'Wins and losses for the past 30 days.'; - -// Get: -var desc = chart.description; -// returns 'Wins and losses for the past 30 days.' -``` - - - -#### WinLossChart.prototype.isDefined( d, i ) - -An accessor `function` which defines whether a datum is defined. This accessor is used to define how missing values are encoded. When invoked, the function is provided two arguments: - -- **d**: datum. -- **i**: datum index. - -```javascript -function isDefined( d ) { - // Ignore home losses: - return ( d !== -2 ); -} - -var chart = new WinLossChart(); - -// Set: -chart.isDefined = isDefined; - -// Get: -var fcn = chart.isDefined; -// returns -``` - -The default behavior is to ignore any values which are not `1`, `-1`, `2`, or `-2`. - - - -#### WinLossChart.prototype.label - -Data label. - -```javascript -var chart = new WinLossChart(); - -// Set: -chart.label = 'beep'; - -// Get: -var label = chart.label; -// returns 'beep' -``` - -* * * - -### Methods - - - -#### WinLossChart.prototype.push( datum ) - -Appends data to a chart. - -```javascript -var chart = new WinLossChart( [ 1, 2, 3 ] ); - -var data = chart.data; -// returns [ 1, 2, 3 ] - -chart.push( 4 ); - -data = chart.data; -// returns [ 1, 2, 3, 4 ] -``` - - - -#### WinLossChart.prototype.render() - -Renders a win/loss chart sparkline. - -```javascript -var chart = new WinLossChart( [ -2, 1, 2, 2, 1, -1, -1, 1, -2, -2 ] ); - -var str = chart.render(); -// returns '┌╵└┴╵╷╷╵┌┬' -``` - -Glyphs: - -| Value | Glyph | -| :---: | :---: | -| 1 | ╵ | -| -1 | ╷ | -| 2 | └ | -| -2 | ┌ | - -If a `2` or `-2` is preceded by a `2` or `-2`, - -| Value | Glyph | -| :---: | :---: | -| 2 | ┴ | -| -2 | ┬ | - -Based on the win/loss analogy, - -- `1`: win away -- `-1`: loss away -- `2`: win at home -- `-2`: loss at home - -If provided any value other than `1`, `-1`, `2`, or `-2`, the value is encoded as a missing value. - - - -#### WinLossChart.prototype.toString() - -Serializes a win/loss chart sparkline as a `string` by calling the `render()` method. - -```javascript -var chart = new WinLossChart( [ -2, 1, 2, 2, 1, -1, -1, 1, -2, -2 ] ); - -var str = chart.toString(); -// returns '┌╵└┴╵╷╷╵┌┬' -``` - -* * * - -### Events - -#### 'change' - -Emitted whenever a property value changes. - -```javascript -var chart = new WinLossChart(); - -chart.on( 'change', onChange ); - -function onChange() { - console.log( 'A property was updated.' ); -} -``` - -#### 'render' - -Emitted whenever a sparkline is rendered. - -```javascript -var chart = new WinLossChart(); - -chart.on( 'render', onRender ); - -function onRender( str ) { - console.log( 'Rendered sparkline: %s', str ); -} -``` - -
- - - -
- -
- - - -
- -* * * - -## Examples - - - - - -```javascript -var randu = require( '@stdlib/random/base/randu' ); -var Int8Array = require( '@stdlib/array/int8' ); -var stdout = require( '@stdlib/streams/node/stdout' ); -var winlossChart = require( '@stdlib/plot/sparklines/unicode/win-loss' ); - -var chart; -var data; -var id; -var i; - -// Based on GS Warriors winning percentages for 2015-2016... -function datum() { - var d = randu(); - if ( d > 0.5 ) { // home - d = randu(); - if ( d < 0.057 ) { // loss - d = -2; - } else { // win - d = 2; - } - } else { // away - d = randu(); - if ( d < 0.229 ) { // loss - d = -1; - } else { // win - d = 1; - } - } - return d; -} - -// Generate some random data... -data = new Int8Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = datum(); -} - -// Create a new win/loss chart: -chart = winlossChart( data ); - -// Hide the terminal cursor: -stdout.write( '\u001b[?25l' ); - -// Render the chart in the terminal: -stdout.write( chart.render() ); - -// Configure the chart to support streaming data: -chart.bufferSize = data.length; - -// Update the terminal chart with new data every second: -id = setInterval( update, 1000 ); - -// After some time, stop updating and close: -setTimeout( stop, 20000 ); - -function update() { - // Update the chart with new data: - chart.push( datum() ); - - // Clear the terminal line and render the chart: - stdout.write( '\r\u001b[2K' + chart.render() ); -} - -function stop() { - clearInterval( id ); - - // Restore the terminal cursor: - stdout.write( '\u001b[?25h' ); - - stdout.write( '\n' ); -} -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: sparkline-winloss [options] ... - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Separator used to split stdin data. Default: /\\r?\\n/. -``` - -
- - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is properly **escaped**. - - ```bash - # Not escaped... - $ echo -n $'1\n2\n3\n' | sparkline-winloss --split /\r?\n/ - - # Escaped... - $ echo -n $'1\n2\n3\n' | sparkline-winloss --split /\\r?\\n/ - ``` - -
- - - -
- -### Examples - -```bash -$ sparkline-winloss -- -2 1 2 2 1 -1 -1 1 -2 -2 -┌╵└┴╵╷╷╵┌┬ -``` - -```bash -$ echo -n $'-2\n1\n2\n2\n1\n-1\n-1\n1\n-2\n-2\n' | sparkline-winloss -┌╵└┴╵╷╷╵┌┬ -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/sparklines/unicode/win-loss/benchmark/benchmark.js b/sparklines/unicode/win-loss/benchmark/benchmark.js deleted file mode 100644 index 5b46a43..0000000 --- a/sparklines/unicode/win-loss/benchmark/benchmark.js +++ /dev/null @@ -1,295 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var noop = require( '@stdlib/utils/noop' ); -var randu = require( '@stdlib/random/base/randu' ); -var isArray = require( '@stdlib/assert/is-array' ); -var pkg = require( './../package.json' ).name; -var WinLossChart = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::instantiation', function benchmark( b ) { - var v; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new WinLossChart(); - if ( !( v instanceof WinLossChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof WinLossChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,no_new', function benchmark( b ) { - var ctor; - var v; - var i; - - ctor = WinLossChart; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = ctor(); - if ( !( v instanceof WinLossChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof WinLossChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,options', function benchmark( b ) { - var opts; - var v; - var i; - - opts = { - 'autoRender': false, - 'bufferSize': 10, - 'data': [ 1, 2, 3 ], - 'description': 'foo', - 'label': 'beep', - 'isDefined': noop - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new WinLossChart( opts ); - if ( !( v instanceof WinLossChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof WinLossChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,data', function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new WinLossChart( [ 1, 2, 3 ] ); - if ( !( v instanceof WinLossChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof WinLossChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::instantiation,data,options', function benchmark( b ) { - var opts; - var v; - var i; - - opts = { - 'autoRender': false, - 'bufferSize': 10, - 'description': 'foo', - 'label': 'beep', - 'isDefined': noop - }; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = new WinLossChart( [ 1, 2, 3 ], opts ); - if ( !( v instanceof WinLossChart ) ) { - b.fail( 'should return an instance' ); - } - } - b.toc(); - if ( !( v instanceof WinLossChart ) ) { - b.fail( 'should return an instance' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:autoRender', function benchmark( b ) { - var bool; - var v; - var i; - - v = new WinLossChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.autoRender = !bool; - if ( typeof v.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( typeof v.autoRender !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:bufferSize', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 10, - 20, - 30 - ]; - v = new WinLossChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.bufferSize = values[ i % values.length ]; - if ( typeof v.bufferSize !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( typeof v.bufferSize !== 'number' ) { - b.fail( 'should return a number' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:data', function benchmark( b ) { - var v; - var i; - - v = new WinLossChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.data = [ randu(), randu(), randu() ]; - if ( typeof v.data !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArray( v.data ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:description', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'beep', - 'boop' - ]; - v = new WinLossChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.description = values[ i % values.length ]; - if ( typeof v.description !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.description !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::set,get:isDefined', function benchmark( b ) { - var v; - var i; - - v = new WinLossChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.isDefined = createFcn(); - if ( typeof v.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - } - b.toc(); - if ( typeof v.isDefined !== 'function' ) { - b.fail( 'should return a function' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function createFcn() { - return beep; - function beep() { - // No-op... - } - } -}); - -bench( pkg+'::set,get:label', function benchmark( b ) { - var values; - var v; - var i; - - values = [ - 'beep', - 'boop' - ]; - v = new WinLossChart(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v.label = values[ i % values.length ]; - if ( typeof v.label !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof v.label !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/sparklines/unicode/win-loss/benchmark/benchmark.render.js b/sparklines/unicode/win-loss/benchmark/benchmark.render.js deleted file mode 100644 index 04e1e40..0000000 --- a/sparklines/unicode/win-loss/benchmark/benchmark.render.js +++ /dev/null @@ -1,118 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var Int8Array = require( '@stdlib/array/int8' ); -var pkg = require( './../package.json' ).name; -var WinLossChart = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @param {WinLossChart} chart - chart instance -* @returns {Function} benchmark function -*/ -function createBenchmark( len, chart ) { - var x; - var r; - var i; - - x = new Int8Array( len ); - for ( i = 0; i < x.length; i++ ) { - r = randu(); - if ( r > 0.75 ) { - x[ i ] = 2; - } else if ( r > 0.5 ) { - x[ i ] = 1; - } else if ( r > 0.25 ) { - x[ i ] = -1; - } else { - x[ i ] = -2; - } - } - chart.data = x; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var str; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = chart.push( randu() ).render(); - if ( typeof str !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof str !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var chart; - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 4; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - chart = new WinLossChart({ - 'bufferSize': len - }); - f = createBenchmark( len, chart ); - bench( pkg+':render:len='+len, f ); - } -} - -main(); diff --git a/sparklines/unicode/win-loss/bin/cli b/sparklines/unicode/win-loss/bin/cli deleted file mode 100755 index 3ea2f05..0000000 --- a/sparklines/unicode/win-loss/bin/cli +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var sparkline = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var opts; - var cli; - var i; - - opts = {}; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - opts.split = reFromString( flags.split ); - } else { - opts.split = RE_EOL; - } - return stdin( onRead ); - } - for ( i = 0; i < args.length; i++ ) { - args[ i ] = parseFloat( args[ i ] ); - } - console.log( sparkline( args, opts ).render() ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( opts.split ); - for ( i = 0; i < lines.length; i++ ) { - lines[ i ] = parseFloat( lines[ i ] ); - } - console.log( sparkline( lines, opts ).render() ); // eslint-disable-line no-console - } -} - -main(); diff --git a/sparklines/unicode/win-loss/docs/repl.txt b/sparklines/unicode/win-loss/docs/repl.txt deleted file mode 100644 index 999fbce..0000000 --- a/sparklines/unicode/win-loss/docs/repl.txt +++ /dev/null @@ -1,99 +0,0 @@ - -{{alias}}( [data,] [options] ) - Returns a sparkline win/loss chart instance. - - Glyphs: - - | Value | Glyph | - |:-----:|:-----:| - | 1 | ╵ | - | -1 | ╷ | - | 2 | └ | - | -2 | ┌ | - - If a `2` or `-2` is preceded by a `2` or `-2`, - - | Value | Glyph | - |:-----:|:-----:| - | 2 | ┴ | - | -2 | ┬ | - - Based on the win/loss analogy, - - - 1: win away - - 2: win at home - - -1: loss away - - -2: loss at home - - If provided any value other than 1, -1, 2, or -2, the value is encoded as a - missing value. - - The `data` argument takes precedence over the `data` option. - - Parameters - ---------- - data: ArrayLike|ndarray (optional) - Chart data. - - options: Object (optional) - Options. - - options.autoRender: boolean (optional) - Boolean indicating whether to re-render on a 'change' event. Default: - false. - - options.bufferSize: integer|null (optional) - Data buffer size. If provided, data is kept in a first-in first-out - (FIFO) buffer which cannot exceed the buffer size. Default: +infinity. - - options.data: ArrayLike|ndarray (optional) - Chart data. - - options.description: string (optional) - Chart description. - - options.isDefined: Function (optional) - An accessor function indicating whether a datum is defined. - - options.label: string (optional) - Data label. - - Returns - ------- - chart: WinLossChart - Chart instance. - - chart.autoRender - Rendering mode. If `true`, an instance renders on each 'change' event; - otherwise, rendering must be triggered manually. - - chart.bufferSize - Data buffer size. - - chart.description - Chart description. - - chart.data - Chart data. - - chart.label - Data label. - - chart.isDefined( d, i ) - An accessor function which defines whether a datum is defined. This - accessor is used to define how missing values are encoded. The default - behavior is to ignore any values which are not 1, -1, 2, or -2. - - chart.render() - Renders a win/loss chart sparkline. - - Examples - -------- - > var data = [ -2, 1, 2, 2, 1, -1, -1, 1 ]; - > var chart = new {{alias}}( data ); - > chart.render() - '┌╵└┴╵╷╷╵' - - See Also - -------- - diff --git a/sparklines/unicode/win-loss/docs/usage.txt b/sparklines/unicode/win-loss/docs/usage.txt deleted file mode 100644 index dcc6aa5..0000000 --- a/sparklines/unicode/win-loss/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: sparkline-winloss [options] ... - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Separator used to split stdin data. Default: /\\r?\\n/. diff --git a/sparklines/unicode/win-loss/etc/cli_opts.json b/sparklines/unicode/win-loss/etc/cli_opts.json deleted file mode 100644 index 7c40f9a..0000000 --- a/sparklines/unicode/win-loss/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/sparklines/unicode/win-loss/examples/index.js b/sparklines/unicode/win-loss/examples/index.js deleted file mode 100644 index 9e86f2f..0000000 --- a/sparklines/unicode/win-loss/examples/index.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var randu = require( '@stdlib/random/base/randu' ); -var Int8Array = require( '@stdlib/array/int8' ); -var winloss = require( './../lib' ); - -var chart; -var data; -var str; -var d; -var i; - -// Generate some random data (based on GS Warriors 2015-2016)... -data = new Int8Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - d = randu(); - if ( d > 0.5 ) { // home - d = randu(); - if ( d < 0.057 ) { // loss - d = -2; - } else { // win - d = 2; - } - } else { // away - d = randu(); - if ( d < 0.229 ) { // loss - d = -1; - } else { // win - d = 1; - } - } - data[ i ] = d; -} - -// Create a new win/loss chart: -chart = winloss( data ); - -// Render the chart as a string: -str = chart.render(); - -console.log( str ); -// => '...' diff --git a/sparklines/unicode/win-loss/examples/update.js b/sparklines/unicode/win-loss/examples/update.js deleted file mode 100644 index 940a99d..0000000 --- a/sparklines/unicode/win-loss/examples/update.js +++ /dev/null @@ -1,91 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -var randu = require( '@stdlib/random/base/randu' ); -var Int8Array = require( '@stdlib/array/int8' ); -var stdout = require( '@stdlib/streams/node/stdout' ); -var winloss = require( './../lib' ); - -var chart; -var data; -var id; -var i; - -// Based on GS Warriors winning percentages for 2015-2016... -function datum() { - var d = randu(); - if ( d > 0.5 ) { // home - d = randu(); - if ( d < 0.057 ) { // loss - d = -2; - } else { // win - d = 2; - } - } else { // away - d = randu(); - if ( d < 0.229 ) { // loss - d = -1; - } else { // win - d = 1; - } - } - return d; -} - -// Generate some random data... -data = new Int8Array( 50 ); -for ( i = 0; i < data.length; i++ ) { - data[ i ] = datum(); -} - -// Create a new win/loss chart: -chart = winloss( data ); - -// Hide the terminal cursor: -stdout.write( '\u001b[?25l' ); - -// Render the chart in the terminal: -stdout.write( chart.render() ); - -// Configure the chart to support streaming data: -chart.bufferSize = data.length; - -// Update the terminal chart with new data every second: -id = setInterval( update, 1000 ); - -// After some time, stop updating and close: -setTimeout( stop, 20000 ); - -function update() { - // Update the chart with new data: - chart.push( datum() ); - - // Clear the terminal line and render the chart: - stdout.write( '\r\u001b[2K' + chart.render() ); -} - -function stop() { // eslint-disable-line stdlib/no-redeclare - clearInterval( id ); - - // Restore the terminal cursor: - stdout.write( '\u001b[?25h' ); - - stdout.write( '\n' ); -} diff --git a/sparklines/unicode/win-loss/lib/index.js b/sparklines/unicode/win-loss/lib/index.js deleted file mode 100644 index 60a401f..0000000 --- a/sparklines/unicode/win-loss/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Create a Unicode sparkline win/loss chart. -* -* @module @stdlib/plot/sparklines/unicode/win-loss -* -* @example -* var winlossChart = require( '@stdlib/plot/sparklines/unicode/win-loss' ); -* -* var data = [ -2, 1, 2, 2, 1, -1, -1, 1 ]; -* -* var chart = winlossChart( data ); -* -* var str = chart.render(); -* // returns '┌╵└┴╵╷╷╵' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/sparklines/unicode/win-loss/lib/main.js b/sparklines/unicode/win-loss/lib/main.js deleted file mode 100644 index 0ef46b5..0000000 --- a/sparklines/unicode/win-loss/lib/main.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var inherit = require( '@stdlib/utils/inherit' ); -var Sparkline = require( './../../../../sparklines/base/ctor' ); - - -// MAIN // - -/** -* Unicode sparkline win/loss chart constructor. -* -* @constructor -* @param {(ArrayLike|ndarrayLike)} [data] - chart data -* @param {Options} [options] - chart options -* @param {boolean} [options.autoRender=false] - indicates whether to re-render on a `change` event -* @param {(PositiveInteger|null)} [options.bufferSize] - data buffer size -* @param {(ArrayLikeObject|ndarrayLike)} [options.data] - data -* @param {string} [options.description=''] - chart description -* @param {Function} [options.isDefined] - accessor indicating whether a datum is defined -* @param {string} [options.label] - data label -* @throws {TypeError} must provide valid options -* @returns {WinLossChart} chart instance -* -* @example -* var data = [ -2, 1, 2, 2, 1, -1, -1, 1 ]; -* -* var chart = new WinLossChart( data ); -* -* var str = chart.render(); -* // returns '┌╵└┴╵╷╷╵' -* -* @example -* var data = [ -2, 1, 2, 2, 1, -1, -1, 1 ]; -* var opts = { -* 'data': data -* }; -* var chart = new WinLossChart( opts ); -* -* var str = chart.render(); -* // returns '┌╵└┴╵╷╷╵' -*/ -function WinLossChart() { - var nargs; - - nargs = arguments.length; - if ( !(this instanceof WinLossChart) ) { - if ( nargs === 0 ) { - return new WinLossChart(); - } - if ( nargs === 1 ) { - return new WinLossChart( arguments[ 0 ] ); - } - return new WinLossChart( arguments[ 0 ], arguments[ 1 ] ); - } - // Invoke parent constructor... - if ( nargs === 0 ) { - Sparkline.call( this ); - } else if ( nargs === 1 ) { - Sparkline.call( this, arguments[ 0 ] ); - } else { - Sparkline.call( this, arguments[ 0 ], arguments[ 1 ] ); - } - return this; -} - -/* -* Inherit from the `Sparkline` prototype. -*/ -inherit( WinLossChart, Sparkline ); - -/** -* Renders a sparkline win/loss chart. -* -* @private -* @name _render -* @memberof WinLossChart.prototype -* @type {Function} -* @returns {string} rendered sparkline win/loss chart -* -* @example -* var data = [ -2, 1, 2, 2, 1, -1, -1, 1 ]; -* -* var chart = new WinLossChart( data ); -* -* var str = chart.render(); -* // returns '┌╵└┴╵╷╷╵' -*/ -WinLossChart.prototype._render = require( './render.js' ); // eslint-disable-line no-underscore-dangle - - -// EXPORTS // - -module.exports = WinLossChart; diff --git a/sparklines/unicode/win-loss/lib/render.js b/sparklines/unicode/win-loss/lib/render.js deleted file mode 100644 index 7ce57d1..0000000 --- a/sparklines/unicode/win-loss/lib/render.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// VARIABLES // - -// See [box-drawing characters]{@link https://en.wikipedia.org/wiki/Box-drawing_character}. -var HOME_WIN = [ - '└', // U+2514 - '┴' // U+2534 -]; -var HOME_LOSS = [ - '┌', // U+250C - '┬' // U+252C -]; -var AWAY_WIN = '╵'; // U+2575 -var AWAY_LOSS = '╷'; // U+2577 - -var MISSING_VALUE = ' '; - - -// MAIN // - -/** -* Renders a chart. -* -* @private -* @returns {string} rendered chart -*/ -function render() { - /* eslint-disable no-invalid-this */ - var str; - var len; - var py; - var d; - var i; - - len = this._data.length; - if ( len === 0 ) { - return ''; - } - // Generate the sparkline chart, assigning a glyph to each datum... - str = ''; - - // TODO: "loss" values diff color (red) (?) - - // TODO: specify bkgd color for streaks of a given length (?) - - for ( i = 0; i < len; i++ ) { - d = this._data[ i ]; - if ( !this._isDefined( d, i ) ) { - str += MISSING_VALUE; - } else if ( d === 2 ) { - if ( py === 2 || py === -2 ) { - str += HOME_WIN[ 1 ]; - } else { - str += HOME_WIN[ 0 ]; - } - } else if ( d === 1 ) { - str += AWAY_WIN; - } else if ( d === -1 ) { - str += AWAY_LOSS; - } else if ( d === -2 ) { - if ( py === 2 || py === -2 ) { - str += HOME_LOSS[ 1 ]; - } else { - str += HOME_LOSS[ 0 ]; - } - } else { - str += MISSING_VALUE; - } - py = d; // save the current data value to allow look-back - } - return str; -} - - -// EXPORTS // - -module.exports = render; diff --git a/sparklines/unicode/win-loss/package.json b/sparklines/unicode/win-loss/package.json deleted file mode 100644 index e7219c9..0000000 --- a/sparklines/unicode/win-loss/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/plot/sparklines/unicode/win-loss", - "version": "0.0.0", - "description": "Create a Unicode sparkline win/loss chart.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "bin": { - "sparkline-winloss": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "win", - "loss", - "draw", - "chart", - "graph", - "graphic", - "data", - "sparklines", - "sparkline", - "visualize", - "viz", - "vis", - "unicode" - ] -} diff --git a/sparklines/unicode/win-loss/test/fixtures/stdin_error.js.txt b/sparklines/unicode/win-loss/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4aca..0000000 --- a/sparklines/unicode/win-loss/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/sparklines/unicode/win-loss/test/test.auto_render.js b/sparklines/unicode/win-loss/test/test.auto_render.js deleted file mode 100644 index 039c91f..0000000 --- a/sparklines/unicode/win-loss/test/test.auto_render.js +++ /dev/null @@ -1,183 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `autoRender` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.autoRender = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - t.strictEqual( chart.autoRender, false, 'returns expected value' ); - - chart.autoRender = true; - t.strictEqual( chart.autoRender, true, 'returns expected value' ); - - chart.autoRender = false; - t.strictEqual( chart.autoRender, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'if `autoRender` is `true`, when a returned instance receives a `change` event, it re-renders and emits a `render` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true, - 'data': [ 0.10, 0.50, 0.90 ] - }); - - chart.on( 'render', onRender ); - chart.emit( 'change' ); - - function onRender( str ) { - t.ok( true, 'emits a render event' ); - t.strictEqual( typeof str, 'string', 'provides expected value' ); - t.end(); - } -}); - -tape( 'if `autoRender` is `false`, when a returned instance receives a `change` event, it does not re-render or emit a `render` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 0.10, 0.50, 0.90 ], - 'autoRender': false - }); - - chart.on( 'render', onRender ); - chart.emit( 'change' ); - - t.pass( 'is ok' ); - t.end(); - - function onRender() { - t.fail( 'should never be invoked' ); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true - }); - - chart.on( 'change', onChange ); - chart.autoRender = false; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - - chart.on( 'change', onChange ); - chart.autoRender = true; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': true - }); - - chart.on( 'change', onChange ); - chart.autoRender = true; - - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); - -tape( 'setting the `autoRender` property to an existing value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'autoRender': false - }); - - chart.on( 'change', onChange ); - chart.autoRender = false; - - t.pass( 'is ok' ); - t.end(); - - function onChange() { - t.fail( 'should never be called' ); - } -}); diff --git a/sparklines/unicode/win-loss/test/test.buffer_size.js b/sparklines/unicode/win-loss/test/test.buffer_size.js deleted file mode 100644 index 4bbd121..0000000 --- a/sparklines/unicode/win-loss/test/test.buffer_size.js +++ /dev/null @@ -1,146 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `bufferSize` value', function test( t ) { - var values; - var i; - - values = [ - '5', - -5, - 0, - 3.14, - NaN, - void 0, - true, - false, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.bufferSize = value; - }; - } -}); - -tape( 'an instance throws an error if provided a `bufferSize` which is less than the number of data elements', function test( t ) { - var values; - var i; - - values = [ - 1, - 2, - 3, - 4, - 5 - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor({ - 'data': [ 1, 2, 3, 4, 5, 6 ] - }); - chart.bufferSize = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - t.strictEqual( chart.bufferSize, 10, 'returns expected value' ); - - chart.bufferSize = 20; - t.strictEqual( chart.bufferSize, 20, 'returns expected value' ); - - chart.bufferSize = 30; - t.strictEqual( chart.bufferSize, 30, 'returns expected value' ); - - chart.bufferSize = null; - t.strictEqual( chart.bufferSize, FLOAT64_MAX, 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `bufferSize` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - - chart.on( 'change', onChange ); - chart.bufferSize = 30; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `bufferSize` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'bufferSize': 10 - }); - - chart.on( 'change', onChange ); - chart.bufferSize = 10; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/win-loss/test/test.cli.js b/sparklines/unicode/win-loss/test/test.cli.js deleted file mode 100644 index 987ddde..0000000 --- a/sparklines/unicode/win-loss/test/test.cli.js +++ /dev/null @@ -1,267 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( '@stdlib/string/replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface renders a win/loss chart', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--\'; process.argv[ 3 ] = \'-2\'; process.argv[ 4 ] = \'1\'; process.argv[ 5 ] = \'2\'; process.argv[ 6 ] = \'2\'; process.argv[ 7 ] = \'1\'; process.argv[ 8 ] = \'-1\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '┌╵└┴╵╷\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf -- "-2\n1\n2\n2\n1\n-1"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '┌╵└┴╵╷\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports providing a custom separator when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf -- "-2\t1\t2\t2\t1\t-1"', - '|', - EXEC_PATH, - '-e', - '"process.stdin.isTTY = false; process.argv[ 2 ] = \'--split=/\\t/\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '┌╵└┴╵╷\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports providing a custom separator when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf -- "-2\t1\t2\t2\t1\t-1"', - '|', - EXEC_PATH, - '-e', - '"process.stdin.isTTY = false; process.argv[ 2 ] = \'--split=\\t\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '┌╵└┴╵╷\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/sparklines/unicode/win-loss/test/test.data.js b/sparklines/unicode/win-loss/test/test.data.js deleted file mode 100644 index a28b01c..0000000 --- a/sparklines/unicode/win-loss/test/test.data.js +++ /dev/null @@ -1,128 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ndarray = require( '@stdlib/ndarray/ctor' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `data` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.data = value; - }; - } -}); - -tape( 'an instance throws an error if provided a `data` value which more data elements than the data buffer size', function test( t ) { - var values; - var i; - - values = [ - [ 1, 2 ], - [ 1, 2, 3 ], - [ 1, 2, 3, 4 ] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), RangeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor({ - 'bufferSize': 1 - }); - chart.data = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - var arr; - - arr = [ 1, 2, 3 ]; - chart = ctor({ - 'data': arr - }); - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, arr, 'returns expected value' ); - - arr = [ 4, 5, 6 ]; - chart.data = arr; - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, arr, 'returns expected value' ); - - arr = ndarray( 'generic', [ 7, 8, 9 ], [ 3 ], [ 1 ], 0, 'row-major' ); - chart.data = arr; - t.notEqual( chart.data, arr, 'returns a new reference' ); - t.deepEqual( chart.data, [ 7, 8, 9 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `data` property triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ] - }); - - chart.on( 'change', onChange ); - chart.data = [ 4, 5, 6 ]; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); diff --git a/sparklines/unicode/win-loss/test/test.description.js b/sparklines/unicode/win-loss/test/test.description.js deleted file mode 100644 index b2222e1..0000000 --- a/sparklines/unicode/win-loss/test/test.description.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `description` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.description = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - t.strictEqual( chart.description, 'beep', 'returns expected value' ); - - chart.description = 'boop'; - t.strictEqual( chart.description, 'boop', 'returns expected value' ); - - chart.description = 'foo'; - t.strictEqual( chart.description, 'foo', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `description` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - - chart.on( 'change', onChange ); - chart.description = 'boop'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `description` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'description': 'beep' - }); - - chart.on( 'change', onChange ); - chart.description = 'beep'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/win-loss/test/test.is_defined.js b/sparklines/unicode/win-loss/test/test.is_defined.js deleted file mode 100644 index deaa3d7..0000000 --- a/sparklines/unicode/win-loss/test/test.is_defined.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `isDefined` value', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [] - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.isDefined = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - t.strictEqual( chart.isDefined, noop, 'returns expected value' ); - - chart.isDefined = isDefined; - t.strictEqual( chart.isDefined, isDefined, 'returns expected value' ); - - t.end(); - - function isDefined( d ) { - return d === d; - } -}); - -tape( 'the default behavior is to treat `NaN` values as undefined', function test( t ) { - var chart = ctor(); - t.strictEqual( chart.isDefined( NaN ), false, 'returns expected value' ); - t.strictEqual( chart.isDefined( 5 ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( null ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( '' ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( [] ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( {} ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( 'foo' ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( true ), true, 'returns expected value' ); - t.strictEqual( chart.isDefined( false ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'setting the `isDefined` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - - chart.on( 'change', onChange ); - chart.isDefined = isDefined; - - function isDefined( d ) { - return d === d; - } - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `isDefined` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'isDefined': noop - }); - - chart.on( 'change', onChange ); - chart.isDefined = noop; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/win-loss/test/test.js b/sparklines/unicode/win-loss/test/test.js deleted file mode 100644 index 5e5bc79..0000000 --- a/sparklines/unicode/win-loss/test/test.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Chart = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof Chart, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the export is a class constructor', function test( t ) { - var chart = new Chart(); - t.strictEqual( chart instanceof Chart, true, 'returns class instance' ); - t.end(); -}); diff --git a/sparklines/unicode/win-loss/test/test.label.js b/sparklines/unicode/win-loss/test/test.label.js deleted file mode 100644 index d008ba5..0000000 --- a/sparklines/unicode/win-loss/test/test.label.js +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an instance throws an error if provided an invalid `label` value', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - {}, - [], - [ 'beep' ], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = ctor(); - chart.label = value; - }; - } -}); - -tape( 'an instance supports setting and getting the property value', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'beep' - }); - t.strictEqual( chart.label, 'beep', 'returns expected value' ); - - chart.label = 'boop'; - t.strictEqual( chart.label, 'boop', 'returns expected value' ); - - t.end(); -}); - -tape( 'setting the `label` property to a new value triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'a' - }); - - chart.on( 'change', onChange ); - chart.label = 'b'; - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); - -tape( 'setting the `label` property to its current value does not trigger a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'label': 'a' - }); - - chart.on( 'change', onChange ); - chart.label = 'a'; - - t.ok( true, 'does not trigger event' ); - t.end(); - - function onChange() { - t.ok( false, 'should not trigger event' ); - } -}); diff --git a/sparklines/unicode/win-loss/test/test.main.js b/sparklines/unicode/win-loss/test/test.main.js deleted file mode 100644 index eafaa73..0000000 --- a/sparklines/unicode/win-loss/test/test.main.js +++ /dev/null @@ -1,392 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils/noop' ); -var FLOAT64_MAX = require( '@stdlib/constants/float64/max' ); -var WinLossChart = require( './../lib/main.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof WinLossChart, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the export is a class constructor', function test( t ) { - var chart = new WinLossChart(); - t.strictEqual( chart instanceof WinLossChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (no data, no options)', function test( t ) { - var chart; - var ctor; - - ctor = WinLossChart; - chart = ctor(); - - t.strictEqual( chart instanceof WinLossChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (data)', function test( t ) { - var chart; - var ctor; - - ctor = WinLossChart; - chart = ctor( [ 1, 2, 3 ] ); - - t.strictEqual( chart instanceof WinLossChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (options)', function test( t ) { - var chart; - var ctor; - - ctor = WinLossChart; - chart = ctor({ - 'bufferSize': 10, - 'description': 'beep', - 'isDefined': noop, - 'data': [ 1, 2, 3 ], - 'autoRender': true, - 'label': 'foo' - }); - - t.strictEqual( chart instanceof WinLossChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (data and options)', function test( t ) { - var chart; - var ctor; - - ctor = WinLossChart; - chart = ctor( [ 1, 2, 3 ], { - 'bufferSize': 10, - 'description': 'beep', - 'isDefined': noop, - 'autoRender': true, - 'label': 'foo' - }); - - t.strictEqual( chart instanceof WinLossChart, true, 'returns class instance' ); - t.end(); -}); - -tape( 'the constructor will throw an error if provided an invalid options argument (no data argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = new WinLossChart( value ); // eslint-disable-line no-unused-vars - }; - } -}); - -tape( 'the constructor will throw an error if provided an invalid options argument (data argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - false, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var chart = new WinLossChart( [ 1, 2, 3 ], value ); // eslint-disable-line no-unused-vars - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid option (no data argument)', function test( t ) { - t.throws( foo, TypeError, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new WinLossChart({ - 'description': [] - }); - } -}); - -tape( 'the constructor throws an error if provided an invalid option (data argument)', function test( t ) { - t.throws( foo, TypeError, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new WinLossChart( [ 1, 2, 3 ], { - 'description': [] - }); - } -}); - -tape( 'the constructor throws an error if provided a `bufferSize` option which is less than the number of data elements (options)', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new WinLossChart({ - 'data': [ 1, 2, 3, 4, 5 ], - 'bufferSize': 3 - }); - } -}); - -tape( 'the constructor throws an error if provided a `bufferSize` option which is less than the number of data elements (data argument)', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - // eslint-disable-next-line no-unused-vars - var chart = new WinLossChart( [ 1, 2, 3, 4, 5 ], { - 'bufferSize': 3 - }); - } -}); - -tape( 'an instance has a writable `autoRender` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new WinLossChart(); - t.strictEqual( chart.autoRender, false, 'default value is false' ); - - opts = { - 'autoRender': true - }; - chart = new WinLossChart( opts ); - - expected = true; - t.strictEqual( chart.autoRender, expected, 'returns expected value' ); - - chart.autoRender = false; - - expected = false; - t.strictEqual( chart.autoRender, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `bufferSize` property', function test( t ) { - var chart; - var opts; - - chart = new WinLossChart(); - t.strictEqual( chart.bufferSize, FLOAT64_MAX, 'default value is the maximum double-precision floating-point number' ); - - opts = { - 'bufferSize': 20 - }; - chart = new WinLossChart( opts ); - t.strictEqual( chart.bufferSize, opts.bufferSize, 'returns expected value' ); - - chart.bufferSize = 5; - t.strictEqual( chart.bufferSize, 5, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `data` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new WinLossChart(); - t.deepEqual( chart.data, [], 'default value is an empty array' ); - - opts = { - 'data': [ 1, 2, 3 ] - }; - chart = new WinLossChart( opts ); - - expected = [ 1, 2, 3 ]; - t.deepEqual( chart.data, expected, 'returns expected value' ); - - chart.data = [ 4, 5, 6 ]; - - expected = [ 4, 5, 6 ]; - t.deepEqual( chart.data, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `isDefined` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new WinLossChart(); - t.strictEqual( typeof chart.isDefined, 'function', 'default value is a function' ); - - opts = { - 'isDefined': noop - }; - chart = new WinLossChart( opts ); - - expected = noop; - t.deepEqual( chart.isDefined, expected, 'returns expected value' ); - - chart.isDefined = noop; - - expected = noop; - t.deepEqual( chart.isDefined, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a writable `label` property', function test( t ) { - var expected; - var chart; - var opts; - - chart = new WinLossChart(); - t.strictEqual( chart.label, '', 'default value is an empty string' ); - - opts = { - 'label': 'foo' - }; - chart = new WinLossChart( opts ); - - expected = 'foo'; - t.strictEqual( chart.label, expected, 'returns expected value' ); - - chart.label = 'bar'; - - expected = 'bar'; - t.strictEqual( chart.label, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an instance has a `push` method for appending data', function test( t ) { - var chart = new WinLossChart(); - t.strictEqual( typeof chart.push, 'function', 'has push method' ); - t.end(); -}); - -tape( 'an instance has a `render` method for rendering a chart', function test( t ) { - var chart; - var str; - - chart = new WinLossChart(); - chart.data = [ -2, 1, 2, 2, 1, -1, -1, 1, -2, -2, 2, 2, -2 ]; - - str = chart.render(); - t.strictEqual( str, '┌╵└┴╵╷╷╵┌┬┴┴┬', 'returns rendered chart' ); - - t.end(); -}); - -tape( 'if a chart has not been provided data, the render method returns an empty string', function test( t ) { - var chart; - var str; - - chart = new WinLossChart(); - - str = chart.render(); - t.strictEqual( str, '', 'returns empty string' ); - - t.end(); -}); - -tape( 'by default, a chart renders values which are not `-1, 1, -2, 2` as missing values', function test( t ) { - var chart; - var str; - - chart = new WinLossChart(); - chart.data = [ -2, 1, NaN, 2, 1, 5, -1, 1 ]; - - str = chart.render(); - t.strictEqual( str, '┌╵ └╵ ╷╵', 'returns rendered chart with missing values' ); - - t.end(); -}); - -tape( 'a chart supports treating `-1`, `1`, `-2` or `2` as missing values', function test( t ) { - var chart; - var str; - - chart = new WinLossChart(); - chart.isDefined = isDefined; - chart.data = [ -2, 1, -2, 2, 1, -2, -1, 1 ]; - - str = chart.render(); - t.strictEqual( str, ' ╵ ┴╵ ╷╵', 'returns rendered chart with missing values' ); - - t.end(); - - function isDefined( d ) { - return d !== -2; - } -}); - -tape( 'an instance has a `toString` method for serializing a chart to string', function test( t ) { - var chart; - var str; - - chart = new WinLossChart(); - chart.data = [ -2, 1, 2, 2, 1, -1, -1, 1, -2, -2 ]; - - str = chart.toString(); - t.strictEqual( str, '┌╵└┴╵╷╷╵┌┬', 'returns rendered chart' ); - - t.end(); -}); diff --git a/sparklines/unicode/win-loss/test/test.push.js b/sparklines/unicode/win-loss/test/test.push.js deleted file mode 100644 index cdd005b..0000000 --- a/sparklines/unicode/win-loss/test/test.push.js +++ /dev/null @@ -1,90 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ctor = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ctor, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function appends a datum to the chart data', function test( t ) { - var expected; - var chart; - var data; - var v; - - data = [ 1, 2, 3 ]; - chart = ctor({ - 'data': data - }); - - chart.push( 4 ); - v = chart.data; - - expected = [ 1, 2, 3, 4 ]; - t.deepEqual( v, expected, 'appends to chart data' ); - - t.end(); -}); - -tape( 'if appending data to the internal data buffer will result in the chart data exceeding the data buffer size, the function will remove the first data element', function test( t ) { - var expected; - var chart; - var data; - var v; - - data = [ 1, 2, 3 ]; - chart = ctor({ - 'data': data, - 'bufferSize': 3 - }); - - chart.push( 4 ); - v = chart.data; - - expected = [ 2, 3, 4 ]; - t.deepEqual( v, expected, 'removes first data element' ); - - t.end(); -}); - -tape( 'appending `data` triggers a `change` event', function test( t ) { - var chart; - - chart = ctor({ - 'data': [ 1, 2, 3 ] - }); - - chart.on( 'change', onChange ); - chart.push( 4 ); - - function onChange() { - t.ok( true, 'triggers event' ); - t.end(); - } -}); diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4a156c1 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 54ed363..0000000 --- a/test/test.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Plot = require( './../ctor' ); -var plot = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof plot, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the main export is a plot constructor', function test( t ) { - t.strictEqual( plot, Plot, 'is alias' ); - t.end(); -}); diff --git a/unicode/stemleaf/examples/index.js b/unicode/stemleaf/examples/index.js deleted file mode 100644 index d067f8d..0000000 --- a/unicode/stemleaf/examples/index.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -/* eslint-disable array-element-newline */ - -'use strict'; - -var StemLeaf = require( './../lib' ); - -var chart; -var x; -var y; - -// Data from [RosettaCode]{@link https://www.rosettacode.org/wiki/Stem-and-leaf_plot#Python} -x = [ - 12, 127, 28, 42, 39, 113, 42, 18, 44, 118, 44, 37, 113, 124, 37, - 48, 127, 36, 29, 31, 125, 139, 131, 115, 105, 132, 104, 123, 35, - 113, 122, 42, 117, 119, 58, 109, 23, 105, 63, 27, 44, 105, 99, - 41, 128, 121, 116, 125, 32, 61, 37, 127, 29, 113, 121, 58, 114 -]; -y = [ - 126, 53, 114, 96, 25, 109, 7, 31, 141, 46, 13, 27, 43, 117, 116, - 27, 7, 68, 40, 31, 115, 124, 42, 128, 52, 71, 118, 117, 38, 27, - 106, 33, 117, 116, 111, 40, 119, 47, 105, 57, 122, 109, 124, 115, - 43, 120, 43, 27, 27, 18, 28, 48, 125, 107, 114, 34, 133, 45, 120, - 30, 127, 31, 116, 146 -]; - -// Only x values: -chart = new StemLeaf({ - 'x': x -}); -console.log( chart.render() ); - -// Only y values: -chart = new StemLeaf({ - 'y': y -}); -console.log( chart.render() ); - -// Compare x and y values: -chart = new StemLeaf({ - 'x': x, - 'y': y -}); -console.log( chart.render() ); diff --git a/unicode/stemleaf/lib/format_data.js b/unicode/stemleaf/lib/format_data.js deleted file mode 100644 index 7e1c991..0000000 --- a/unicode/stemleaf/lib/format_data.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var round = require( '@stdlib/math/base/special/round' ); -var isInfinite = require( '@stdlib/math/base/assert/is-infinite' ); - - -// MAIN // - -/** -* Formats data to a standard representation. This is required for non-deterministic accessors. -* -* @private -* @param {(Array|TypedArray)} data - data to standardize -* @param {Function} getValue - accessor function -* @returns {ObjectArray} standardized data -* -* @example -* var data = [{'y':5.0},{'y':3.0},{'y':2.0}]; -* function yValue( d ) { -* return d.y; -* } -* var arr = formatData( data, yValue ); -* // returns [ 5.0, 3.0, 2.0 ] -*/ -function formatData( data, getValue ) { - var out; - var d; - var i; - - // TODO: add support for `ndarray`-like interfaces - - out = []; - for ( i = 0; i < data.length; i++ ) { - d = getValue( data[ i ], i ); - if ( isnan( d ) || isInfinite( d ) ) { - continue; - } - out.push( round( d ) ); - } - - return out; -} - - -// EXPORTS // - -module.exports = formatData; diff --git a/unicode/stemleaf/lib/get_x.js b/unicode/stemleaf/lib/get_x.js deleted file mode 100644 index 159490a..0000000 --- a/unicode/stemleaf/lib/get_x.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var copy = require( '@stdlib/utils/copy' ); - - -// MAIN // - -/** -* Returns first chart data. -* -* @private -* @returns {(Array|TypedArray)} first stem-and-leaf data -*/ -function getX() { - /* eslint-disable no-invalid-this */ - return copy( this._x ); -} - - -// EXPORTS // - -module.exports = getX; diff --git a/unicode/stemleaf/lib/get_xvalue.js b/unicode/stemleaf/lib/get_xvalue.js deleted file mode 100644 index 7ab27a4..0000000 --- a/unicode/stemleaf/lib/get_xvalue.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the x-value accessor. -* -* @private -* @returns {Function} x-value accessor -*/ -function getXValue() { - /* eslint-disable no-invalid-this */ - return this._xValue; -} - - -// EXPORTS // - -module.exports = getXValue; diff --git a/unicode/stemleaf/lib/get_y.js b/unicode/stemleaf/lib/get_y.js deleted file mode 100644 index 6de6964..0000000 --- a/unicode/stemleaf/lib/get_y.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var copy = require( '@stdlib/utils/copy' ); - - -// MAIN // - -/** -* Returns second chart data. -* -* @private -* @returns {(Array|TypedArray)} second stem-and-leaf data -*/ -function getY() { - /* eslint-disable no-invalid-this */ - return copy( this._y ); -} - - -// EXPORTS // - -module.exports = getY; diff --git a/unicode/stemleaf/lib/get_yvalue.js b/unicode/stemleaf/lib/get_yvalue.js deleted file mode 100644 index 6e9450c..0000000 --- a/unicode/stemleaf/lib/get_yvalue.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Returns the y-value accessor. -* -* @private -* @returns {Function} y-value accessor -*/ -function getYValue() { - /* eslint-disable no-invalid-this */ - return this._yValue; -} - - -// EXPORTS // - -module.exports = getYValue; diff --git a/unicode/stemleaf/lib/index.js b/unicode/stemleaf/lib/index.js deleted file mode 100644 index 6615ea9..0000000 --- a/unicode/stemleaf/lib/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* Stem-and-Leaf Plot. -* -* @module @stdlib/plot/unicode/stemleaf -* -* @example -* var StemLeaf = require( '@stdlib/plot/unicode/stemleaf' ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/unicode/stemleaf/lib/main.js b/unicode/stemleaf/lib/main.js deleted file mode 100644 index b749ef6..0000000 --- a/unicode/stemleaf/lib/main.js +++ /dev/null @@ -1,253 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var defineProperty = require( '@stdlib/utils/define-property' ); -var xValue = require( './x_value.js' ); -var yValue = require( './y_value.js' ); -var formatData = require( './format_data.js' ); -var validate = require( './validate.js' ); -var setXValue = require( './set_xvalue.js' ); -var getXValue = require( './get_xvalue.js' ); -var setYValue = require( './set_yvalue.js' ); -var getYValue = require( './get_yvalue.js' ); -var setX = require( './set_x.js' ); -var getX = require( './get_x.js' ); -var setY = require( './set_y.js' ); -var getY = require( './get_y.js' ); -var render = require( './render.js' ); - - -// MAIN // - -/** -* Creates a stem-and-leaf plot. -* -* @constructor -* @param {Options} [options] - steam-and-leaf options -* @param {(Array|TypedArray)} [options.x] - first input data -* @param {(Array|TypedArray)} [options.y] - second input data -* @param {Function} [options.xValue] - x-value accessor -* @param {Function} [options.yValue] - y-value accessor -* @param {PositiveInteger} [options.leafDigits=1] - number of digits to display as leafs -* @returns {StemLeaf} chart instance -*/ -function StemLeaf( options ) { - var opts; - var err; - if ( !(this instanceof StemLeaf) ) { - if ( arguments.length ) { - return new StemLeaf( options ); - } - return new StemLeaf(); - } - if ( arguments.length ) { - opts = options; - err = validate( opts ); - if ( err ) { - throw err; - } - } else { - opts = {}; - } - - defineProperty( this, '_x', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': [] - }); - defineProperty( this, '_xValue', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': xValue - }); - defineProperty( this, '_y', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': [] - }); - defineProperty( this, '_yValue', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': yValue - }); - defineProperty( this, '_leafDigits', { - 'configurable': false, - 'enumerable': false, - 'writable': true, - 'value': 1 - }); - - if ( opts.xValue !== void 0 ) { - this._xValue = opts.xValue; - } - if ( opts.yValue !== void 0 ) { - this._yValue = opts.yValue; - } - if ( opts.x !== void 0 ) { - this._x = formatData( opts.x, this._yValue ); - } - if ( opts.y !== void 0 ) { - this._y = formatData( opts.y, this._yValue ); - } - if ( opts.leafDigits !== void 0 ) { - this._leafDigits = opts.leafDigits; - } - return this; -} - -/** -* `x`-value accessor. -* -* @name xValue -* @memberof StemLeaf.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* function xValue( d ) { -* return d.y; -* } -* var chart = new StemLeaf(); -* chart.xValue = xValue; -* -* @example -* function xValue( d ) { -* return d.y; -* } -* var chart = new StemLeaf({ -* 'xValue': xValue -* }); -* var fcn = chart.xValue; -* var bool = ( fcn === xValue ); -* // returns true -*/ -defineProperty( StemLeaf.prototype, 'xValue', { - 'configurable': false, - 'enumerable': true, - 'set': setXValue, - 'get': getXValue -}); - -/** -* `y`-value accessor. -* -* @name yValue -* @memberof StemLeaf.prototype -* @type {Function} -* @throws {TypeError} must be a function -* -* @example -* function yValue( d ) { -* return d.y; -* } -* var chart = new StemLeaf(); -* chart.yValue = yValue; -* -* @example -* function yValue( d ) { -* return d.y; -* } -* var chart = new StemLeaf({ -* 'yValue': yValue -* }); -* var fcn = chart.yValue; -* var bool = ( fcn === yValue ); -* // returns true -*/ -defineProperty( StemLeaf.prototype, 'yValue', { - 'configurable': false, - 'enumerable': true, - 'set': setYValue, - 'get': getYValue -}); - -/** -* First stem-and-leaf data. -* -* @name x -* @memberof StemLeaf.prototype -* @type {(Array|TypedArray)} -* @throws {TypeError} must be an array or typed array -* -* @example -* var chart = new StemLeaf(); -* chart.x = [ 1.0, 0.0, 8.0, 2.0, 5.0 ]; -* -* @example -* var x = [ 1.0, 0.0, 9.0, 2.0, 5.0 ]; -* var chart = new StemLeaf({ -* 'x': x -* }); -* var d = chart.x; -* // returns [...] -*/ -defineProperty( StemLeaf.prototype, 'x', { - 'configurable': false, - 'enumerable': true, - 'set': setX, - 'get': getX -}); - -/** -* Second stem-and-leaf data. -* -* @name y -* @memberof StemLeaf.prototype -* @type {(Array|TypedArray)} -* @throws {TypeError} must be an array or typed array -* -* @example -* var chart = new StemLeaf(); -* chart.y = [ 1.0, 0.0, 8.0, 2.0, 5.0 ]; -* -* @example -* var y = [ 1.0, 0.0, 9.0, 2.0, 5.0 ]; -* var chart = new StemLeaf({ -* 'y': y -* }); -* var d = chart.y; -* // returns [...] -*/ -defineProperty( StemLeaf.prototype, 'y', { - 'configurable': false, - 'enumerable': true, - 'set': setY, - 'get': getY -}); - -/** -* Renders a stem-and-leaf plot. -* -* @memberof StemLeaf.prototype -* @function render -* @returns {string} rendered stem-and-leaf display -*/ -StemLeaf.prototype.render = render; - - -// EXPORTS // - -module.exports = StemLeaf; diff --git a/unicode/stemleaf/lib/render.js b/unicode/stemleaf/lib/render.js deleted file mode 100644 index 7bf0588..0000000 --- a/unicode/stemleaf/lib/render.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var floor = require( '@stdlib/math/base/special/floor' ); -var exp10 = require( '@stdlib/math/base/special/exp10' ); - - -// FUNCTIONS // - -/** -* Comparator function to sort numeric array in ascending order. -* -* @private -* @param {number} a - first number -* @param {number} b - second number -* @returns {number} a - b -* -* @example -* var arr = [ 3, 1, 2, 5, 4 ]; -* var sorted = arr.sort( ascending ); -* // returns [ 1, 2, 3, 4, 5 ] -*/ -function ascending( a, b ) { - return a - b; -} - -/** -* Comparator function to sort object data array in ascending order. -* -* @private -* @param {Object} a - first data object -* @param {Object} b - second data object -* @returns {number} a.val - b.val -* -* @example -* var arr = [ -* { 'val': 2, 'class': 'x' }, -* { 'val': 3, 'class': 'y' }, -* { 'val': 7, 'class': 'y' }, -* { 'val': 2, 'class': 'x' }, -* ]; -* var sorted = arr.sort( ascending2 ); -* // returns [...] -*/ -function ascending2( a, b ) { - return a.val - b.val; -} - -/** -* Generates a sequence of whitespace characters. -* -* @private -* @param {integer} n - number of characters -* @returns {string} sequence of whitespace characters -* -* @example -* var str = spaces( 3 ); -* // returns ' ' -*/ -function spaces( n ) { - return new Array( n ).join( ' ' ); -} - -/** -* Create string representation of stem-and-leaf plot for a single data vector. -* -* @private -* @param {(Array|TypedArray)} x - input data -* @param {PositiveInteger} interval - 10**leafDigits -* @returns {string} chart representation -*/ -function constructSingleDisplay( x, interval ) { - var stemWidth; - var leafWidth; - var lastStem; - var chrs; - var len; - var str; - var stm; - var lf; - var i; - var v; - var n; - - x.sort( ascending ); - - len = x.length; - stm = new Array( len ); - lf = new Array( len ); - stemWidth = 0; - leafWidth = 0; - - for ( i = 0; i < len; i++ ) { - stm[ i ] = floor( x[ i ] / interval ); - chrs = stm[ i ].toString().length; - if ( chrs > stemWidth ) { - stemWidth = chrs; - } - lf[ i ] = x[ i ] % interval; - chrs = lf[ i ].toString().length; - if ( chrs > leafWidth ) { - leafWidth = chrs; - } - } - - str = ''; - for ( i = 0; i < len; i++ ) { - while ( lastStem < stm[ i ] ) { - lastStem += 1; - str += '\n'; - n = lastStem.toString().length - 1; - str += ' ' + lastStem + spaces( stemWidth - n ); - str += ' | '; - } - if ( stm[ i ] !== lastStem ) { - str += '\n'; - v = stm[ i ].toString(); - n = v.length - 1; - str += ' ' + v + spaces( stemWidth - n ); - str += ' | '; - } - v = lf[ i ].toString(); - n = v.length; - str += v + spaces( leafWidth - n ) + ' '; - lastStem = stm[ i ]; - } - return str; -} - -/** -* Create string representation of stem-and-leaf plot for two data vectors. -* -* @private -* @param {(Array|TypedArray)} x - first input data -* @param {(Array|TypedArray)} y - second input data -* @param {PositiveInteger} interval - 10**leafDigits -* @returns {string} chart representation -*/ -function constructDoubleDisplay( x, y, interval ) { - var xLeafWidth; - var yLeafWidth; - var stemWidth; - var lastStem; - var nSpaces; - var lines; - var line; - var lmax; - var chrs; - var data; - var arr; - var lfs; - var len; - var stm; - var i; - var v; - var n; - - data = []; - for ( i = 0; i < x.length; i++ ) { - v = { - 'val': x[ i ], - 'class': 'x' - }; - data.push( v ); - } - for ( i = 0; i < y.length; i++ ) { - v = { - 'val': y[ i ], - 'class': 'y' - }; - data.push( v ); - } - len = data.length; - - data.sort( ascending2 ); - - stemWidth = 0; - xLeafWidth = 0; - yLeafWidth = 0; - - stm = new Array( len ); - lfs = new Array( len ); - for ( i = 0; i < len; i++ ) { - stm[ i ] = floor( data[ i ].val / interval ); - chrs = stm[ i ].toString().length; - if ( chrs > stemWidth ) { - stemWidth = chrs; - } - if ( data[i].class === 'x' ) { - lfs[ i ] = data[ i ].val % interval; - chrs = lfs[ i ].toString().length; - if ( chrs > xLeafWidth ) { - xLeafWidth = chrs; - } - } else if ( data[i].class === 'y' ) { - lfs[ i ] = data[ i ].val % interval; - chrs = lfs[ i ].toString().length; - if ( chrs > yLeafWidth ) { - yLeafWidth = chrs; - } - } - } - - lines = []; - line = ''; - for ( i = 0; i < len; i++ ) { - while ( lastStem < stm[ i ] ) { - lines.push( line ); - lastStem += 1; - n = lastStem.toString().length - 1; - line = '& | ' + spaces( stemWidth - n ) + lastStem + ' | '; - } - if ( stm[ i ] !== lastStem ) { - if ( line ) { - lines.push( line ); - } - v = stm[ i ].toString(); - n = v.length - 1; - line = '& | '; - line += spaces( stemWidth - n ) + v; - line += ' | '; - } - v = lfs[ i ].toString(); - n = v.length; - if ( data[i].class === 'x' ) { - line = v + spaces( xLeafWidth - n ) + ' ' + line; - } else if ( data[i].class === 'y' ) { - line = line + v + spaces( xLeafWidth - n ) + ' '; - } - lastStem = stm[ i ]; - } - - // Align lines... - lmax = 0; - for ( i = 0; i < lines.length; i++ ) { - v = lines[ i ].indexOf( '|' ); - if ( v > lmax ) { - lmax = v; - } - } - for ( i = 0; i < lines.length; i++ ) { - arr = lines[ i ].split( '&', 2 ); - nSpaces = lmax - arr[ 0 ].length; - arr[ 0 ] = spaces( nSpaces ) + arr[ 0 ]; - lines[ i ] = arr[ 0 ] + arr[ 1 ]; - } - - return lines.join( '\n' ); -} - - -// MAIN // - -/** -* Renders a chart. -* -* @private -* @returns {string} rendered chart -*/ -function render() { - /* eslint-disable no-invalid-this */ - var interval; - var digits; - var ret; - var x; - var y; - - x = this._x; - y = this._y; - - digits = this._leafDigits; - interval = exp10( digits ); - - if ( x.length && y.length ) { - ret = constructDoubleDisplay( x, y, interval ); - } else if ( x.length && !y.length ) { - ret = constructSingleDisplay( x, interval ); - } else if ( y.length && !x.length ) { - ret = constructSingleDisplay( y, interval ); - } - - ret += '\n\n'; - ret += 'Legend: '; - ret += '\n X | Y => ' + interval + ' * X + Y\n'; - return ret; -} - - -// EXPORTS // - -module.exports = render; diff --git a/unicode/stemleaf/lib/set_x.js b/unicode/stemleaf/lib/set_x.js deleted file mode 100644 index b144fb4..0000000 --- a/unicode/stemleaf/lib/set_x.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isTypedArray = require( '@stdlib/assert/is-typed-array' ); -var isArray = require( '@stdlib/assert/is-array' ); -var format = require( '@stdlib/string/format' ); -var formatData = require( './format_data.js' ); - - -// MAIN // - -/** -* Sets the first chart data. -* -* @private -* @param {(Array|TypedArray)} x - data -* @throws {TypeError} must be an array or typed array -*/ -function setX( x ) { - /* eslint-disable no-invalid-this */ - if ( - !isArray( x ) && - !isTypedArray( x ) - ) { - throw new TypeError( format( 'invalid assignment. Must be an array or typed array. Value: `%s`.', x ) ); - } - this._x = formatData( x, this._xValue ); -} - - -// EXPORTS // - -module.exports = setX; diff --git a/unicode/stemleaf/lib/set_xvalue.js b/unicode/stemleaf/lib/set_xvalue.js deleted file mode 100644 index f140e99..0000000 --- a/unicode/stemleaf/lib/set_xvalue.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Sets the x-value accessor. -* -* @private -* @param {Function} fcn - accessor function -* @throws {TypeError} must be a function -*/ -function setXValue( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'xValue', fcn ) ); - } - this._xValue = fcn; -} - - -// EXPORTS // - -module.exports = setXValue; diff --git a/unicode/stemleaf/lib/set_y.js b/unicode/stemleaf/lib/set_y.js deleted file mode 100644 index 56d84a0..0000000 --- a/unicode/stemleaf/lib/set_y.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isTypedArray = require( '@stdlib/assert/is-typed-array' ); -var isArray = require( '@stdlib/assert/is-array' ); -var format = require( '@stdlib/string/format' ); -var formatData = require( './format_data.js' ); - - -// MAIN // - -/** -* Sets the second chart data. -* -* @private -* @param {(Array|TypedArray)} y - data -* @throws {TypeError} must be an array or typed array -*/ -function setY( y ) { - /* eslint-disable no-invalid-this */ - if ( - !isArray( y ) && - !isTypedArray( y ) - ) { - throw new TypeError( format( 'invalid assignment. Must be an array or typed array. Value: `%s`.', y ) ); - } - this._y = formatData( y, this._yValue ); -} - - -// EXPORTS // - -module.exports = setY; diff --git a/unicode/stemleaf/lib/set_yvalue.js b/unicode/stemleaf/lib/set_yvalue.js deleted file mode 100644 index 3dba3a7..0000000 --- a/unicode/stemleaf/lib/set_yvalue.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert/is-function' ); -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Sets the y-value accessor. -* -* @private -* @param {Function} fcn - accessor function -* @throws {TypeError} must be a function -*/ -function setYValue( fcn ) { - /* eslint-disable no-invalid-this */ - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid assignment. `%s` must be a function. Value: `%s`.', 'yValue', fcn ) ); - } - this._yValue = fcn; -} - - -// EXPORTS // - -module.exports = setYValue; diff --git a/unicode/stemleaf/lib/validate.js b/unicode/stemleaf/lib/validate.js deleted file mode 100644 index a6f74b6..0000000 --- a/unicode/stemleaf/lib/validate.js +++ /dev/null @@ -1,91 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -// MODULES // - -var isObject = require( '@stdlib/assert/is-plain-object' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var isArray = require( '@stdlib/assert/is-array' ); -var isTypedArray = require( '@stdlib/assert/is-typed-array' ); -var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive; -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var format = require( '@stdlib/string/format' ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Options} opts - function options -* @param {(Array|TypedArray)} [opts.x] - chart data -* @param {(Array|TypedArray)} [opts.y] - chart data -* @param {Function} [opts.xValue] - x-value accessor -* @param {Function} [opts.yValue] - y-value accessor -* @param {PositiveInteger} leafDigits - number of digits to display as leafs -* @returns {(Error|null)} error or null -* -* @example -* var opts = { -* 'x': [ 23, 11, 137, 58 ], -* 'y': [ 21, 11, 39, 80 ] -* }; -* var err = validate( opts ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts ) { - if ( !isObject( opts ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) ); - } - if ( hasOwnProp( opts, 'x' ) ) { - if ( !isArray( opts.x ) && !isTypedArray( opts.x ) ) { - return new TypeError( format( 'invalid option. `%s` option must be an array or typed array. Option: `%s`.', 'x', opts.x ) ); - } - } - if ( hasOwnProp( opts, 'xValue' ) ) { - if ( !isFunction( opts.xValue ) ) { - return new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'xValue', opts.xValue ) ); - } - } - if ( hasOwnProp( opts, 'y' ) ) { - if ( !isArray( opts.y ) && !isTypedArray( opts.y ) ) { - return new TypeError( format( 'invalid option. `%s` option must be an array or typed array. Option: `%s`.', 'y', opts.y ) ); - } - } - if ( hasOwnProp( opts, 'yValue' ) ) { - if ( !isFunction( opts.yValue ) ) { - return new TypeError( format( 'invalid option. `%s` option must be a function. Option: `%s`.', 'yValue', opts.yValue ) ); - } - } - if ( hasOwnProp( opts, 'leafDigits' ) ) { - if ( !isPositiveInteger( opts.leafDigits ) ) { - return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'leafDigits', opts.leafDigits ) ); - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/unicode/stemleaf/lib/x_value.js b/unicode/stemleaf/lib/x_value.js deleted file mode 100644 index f0f2e93..0000000 --- a/unicode/stemleaf/lib/x_value.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* `x`-value accessor function. -* -* @private -* @param {number} x - input value -* @returns {number} input value -* -* @example -* var v = xValue( 5.0 ); -* // returns 5.0 -*/ -function xValue( x ) { - return x; -} - - -// EXPORTS // - -module.exports = xValue; diff --git a/unicode/stemleaf/lib/y_value.js b/unicode/stemleaf/lib/y_value.js deleted file mode 100644 index 3e407ad..0000000 --- a/unicode/stemleaf/lib/y_value.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* 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. -*/ - -'use strict'; - -/** -* `y`-value accessor function. -* -* @private -* @param {number} y - input value -* @returns {number} input value -* -* @example -* var v = yValue( 5.0 ); -* // returns 5.0 -*/ -function yValue( y ) { - return y; -} - - -// EXPORTS // - -module.exports = yValue; diff --git a/unicode/stemleaf/package.json b/unicode/stemleaf/package.json deleted file mode 100644 index 00977d2..0000000 --- a/unicode/stemleaf/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "@stdlib/plot/unicode/stemleaf", - "version": "0.0.0", - "description": "Create a Unicode stem-and-leaf chart.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "example": "./examples", - "lib": "./lib" - }, - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "plot", - "stem", - "leaf", - "chart", - "graph", - "data", - "visualize", - "viz", - "vis", - "unicode" - ] -}