├── docs
├── .nojekyll
├── _sidebar.md
├── bars
│ └── README.md
├── chart
│ └── README.md
├── index.html
└── README.md
├── .babelrc
├── CONTRIBUTING.md
├── test
├── mocha.opts
├── chart.test.js
├── scatter.test.js
├── istanbul.reporter.js
├── index.test.txt
├── helper.test.js
└── bars.test.txt
├── .mocharc
├── .travis.yml
├── out
├── fonts
│ ├── OpenSans-Bold-webfont.eot
│ ├── OpenSans-Bold-webfont.woff
│ ├── OpenSans-Italic-webfont.eot
│ ├── OpenSans-Italic-webfont.woff
│ ├── OpenSans-Light-webfont.eot
│ ├── OpenSans-Light-webfont.woff
│ ├── OpenSans-Regular-webfont.eot
│ ├── OpenSans-Regular-webfont.woff
│ ├── OpenSans-BoldItalic-webfont.eot
│ ├── OpenSans-BoldItalic-webfont.woff
│ ├── OpenSans-LightItalic-webfont.eot
│ └── OpenSans-LightItalic-webfont.woff
├── scripts
│ ├── linenumber.js
│ └── prettify
│ │ ├── lang-css.js
│ │ ├── Apache-License-2.0.txt
│ │ └── prettify.js
├── index.html
└── styles
│ ├── prettify-jsdoc.css
│ ├── prettify-tomorrow.css
│ └── jsdoc-default.css
├── ROADMAP.md
├── CHANGELOG.md
├── .editorconfig
├── .nycrc
├── jsdocs.config.json
├── .eslintrc.json
├── rollup.config.js
├── README.md
├── .gitignore
├── Makefile
├── index.js
├── index.dev.js
├── LICENSE.md
├── bk_docs
├── development_setup.md
├── svg_treemap.md
└── API.md
├── package.json
├── CODE_OF_CONDUCT.md
└── lib
├── helper.js
└── chart.js
/docs/.nojekyll:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/_sidebar.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/bars/README.md:
--------------------------------------------------------------------------------
1 | # dboxjs/bars
2 |
3 |
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["env"]
3 | }
4 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to DboxJS
2 |
--------------------------------------------------------------------------------
/test/mocha.opts:
--------------------------------------------------------------------------------
1 | --recursive --compilers js:babel-register
2 |
--------------------------------------------------------------------------------
/.mocharc:
--------------------------------------------------------------------------------
1 | test
2 | --require babel-polyfill
3 | --compilers js:babel-register
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "4.0"
4 | - "5.0"
5 | - "6.0"
6 |
--------------------------------------------------------------------------------
/out/fonts/OpenSans-Bold-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dboxjs/core/HEAD/out/fonts/OpenSans-Bold-webfont.eot
--------------------------------------------------------------------------------
/out/fonts/OpenSans-Bold-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dboxjs/core/HEAD/out/fonts/OpenSans-Bold-webfont.woff
--------------------------------------------------------------------------------
/out/fonts/OpenSans-Italic-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dboxjs/core/HEAD/out/fonts/OpenSans-Italic-webfont.eot
--------------------------------------------------------------------------------
/out/fonts/OpenSans-Italic-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dboxjs/core/HEAD/out/fonts/OpenSans-Italic-webfont.woff
--------------------------------------------------------------------------------
/out/fonts/OpenSans-Light-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dboxjs/core/HEAD/out/fonts/OpenSans-Light-webfont.eot
--------------------------------------------------------------------------------
/out/fonts/OpenSans-Light-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dboxjs/core/HEAD/out/fonts/OpenSans-Light-webfont.woff
--------------------------------------------------------------------------------
/out/fonts/OpenSans-Regular-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dboxjs/core/HEAD/out/fonts/OpenSans-Regular-webfont.eot
--------------------------------------------------------------------------------
/out/fonts/OpenSans-Regular-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dboxjs/core/HEAD/out/fonts/OpenSans-Regular-webfont.woff
--------------------------------------------------------------------------------
/out/fonts/OpenSans-BoldItalic-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dboxjs/core/HEAD/out/fonts/OpenSans-BoldItalic-webfont.eot
--------------------------------------------------------------------------------
/out/fonts/OpenSans-BoldItalic-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dboxjs/core/HEAD/out/fonts/OpenSans-BoldItalic-webfont.woff
--------------------------------------------------------------------------------
/out/fonts/OpenSans-LightItalic-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dboxjs/core/HEAD/out/fonts/OpenSans-LightItalic-webfont.eot
--------------------------------------------------------------------------------
/out/fonts/OpenSans-LightItalic-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dboxjs/core/HEAD/out/fonts/OpenSans-LightItalic-webfont.woff
--------------------------------------------------------------------------------
/test/chart.test.js:
--------------------------------------------------------------------------------
1 | import * as dbox from '../';
2 | import * as assert from 'assert';
3 |
4 | describe('Chart', () => {
5 | it('Chart should be defined on dbox', () => {
6 | assert.ok(dbox.chart);
7 | });
8 | });
9 |
--------------------------------------------------------------------------------
/ROADMAP.md:
--------------------------------------------------------------------------------
1 | #ROADMAP
2 |
3 | ##Legend
4 | * Remove series on click
5 |
6 | ##Aestetics
7 | * title
8 | ** text
9 | ** color
10 | ** fontSize
11 |
12 | * subtitle
13 | ** text
14 | ** color
15 | ** fontSize
16 |
17 | * axes
18 | ** text
19 | ** color
20 | ** fontSize
21 |
--------------------------------------------------------------------------------
/test/scatter.test.js:
--------------------------------------------------------------------------------
1 | import * as dbox from '../';
2 | import * as assert from 'assert';
3 |
4 | describe('Scatter chart', () => {
5 | it('Scatter should be defined on dbox', () => {
6 | console.log(dbox.scatter);
7 | assert.ok(dbox.scatter);
8 | });
9 | });
10 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # 0.0.9
2 |
3 | ## @upgrades
4 | * Implemented Delegation Design instead of Object Oriented Design
5 | * helper.js - delegated general chart/layer data/functions with OLOO (Object linked to another object)
6 | * use of *.hasOwnProperty()* to verify properties
7 |
8 | ## @deprecated
9 | * Chart.prototype.generateScale()
10 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig is awesome: http://EditorConfig.org
2 |
3 | # top-most EditorConfig file
4 | root = true
5 |
6 | # Unix-style newlines with a newline ending every file
7 | [*]
8 | end_of_line = lf
9 | insert_final_newline = true
10 | indent_size = 2
11 | indent_style = space
12 | charset = utf-8
13 |
14 | [Makefile]
15 | indent_style = tab
16 |
--------------------------------------------------------------------------------
/.nycrc:
--------------------------------------------------------------------------------
1 | {
2 | "check-coverage": true,
3 | "per-file": true,
4 | "lines": 99,
5 | "statements": 99,
6 | "functions": 99,
7 | "branches": 99,
8 | "include": [
9 | "src/**/*.js"
10 | ],
11 | "exclude": [
12 | "src/**/*.spec.js"
13 | ],
14 | "reporter": [
15 | "lcov",
16 | "text-summary"
17 | ],
18 | "require": [
19 | "babel-register"
20 | ],
21 | "sourceMap": false,
22 | "instrument": false
23 | }
24 |
--------------------------------------------------------------------------------
/docs/chart/README.md:
--------------------------------------------------------------------------------
1 | # Chart
2 |
3 | ## What is it?
4 |
5 | ## The config object
6 |
7 | ```javascript
8 | {
9 | size: {
10 | width: number,
11 | height: number,
12 | margin:''
13 | }
14 | }
15 | ```
16 |
17 |
18 |
19 | ## Usage
20 |
21 | ## Examples
22 |
23 | ## Methods
24 |
25 | .size({height: number, width: number: margin: {top: number, right: number, bottom: number, left: number}})
26 |
27 |
--------------------------------------------------------------------------------
/jsdocs.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": [],
3 | "recurseDepth": 10,
4 | "source": {
5 | "includePattern": ["./lib/.+\\.js(doc|x)?$", "../*/.+\\.js(doc|x)?$"],
6 | "excludePattern": "(^|\\/|\\\\)_"
7 | },
8 | "sourceType": "module",
9 | "tags": {
10 | "allowUnknownTags": true,
11 | "dictionaries": ["jsdoc","closure"]
12 | },
13 | "templates": {
14 | "cleverLinks": false,
15 | "monospaceLinks": false
16 | }
17 | }
--------------------------------------------------------------------------------
/test/istanbul.reporter.js:
--------------------------------------------------------------------------------
1 | const instanbul = require('istanbul');
2 | const MochaSpecReporter = require('mocha/lib/reporters/spec');
3 |
4 | module.exports = function(runner) {
5 | const collector = new instanbul.Collector();
6 | const reporter = new instanbul.Reporter();
7 | reporter.addAll(['lcov', 'json']);
8 | new MochaSpecReporter(runner);
9 |
10 | runner.on('end', function() {
11 | collector.add(global.__coverage__);
12 |
13 | reporter.write(collector, true, function() {
14 | process.stdout.write('report generated');
15 | });
16 | });
17 | };
18 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "commonjs": true,
5 | "es6": true,
6 | "node": true
7 | },
8 | "globals": {
9 | "ENV": true
10 | },
11 | "extends": "eslint:recommended",
12 | "parserOptions": {
13 | "sourceType": "module"
14 | },
15 | "rules": {
16 | "indent": ["error", 2],
17 | "linebreak-style": ["error", "unix"],
18 | "quotes": ["error", "single"],
19 | "semi": ["error", "always"],
20 | "one-line": [
21 | true,
22 | "check-open-brace",
23 | "check-catch",
24 | "check-else",
25 | "check-whitespace"
26 | ],
27 | "no-console": ["warn", "always"]
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | import resolve from 'rollup-plugin-node-resolve';
2 | import babel from 'rollup-plugin-babel';
3 | import babelrc from 'babelrc-rollup';
4 |
5 | let pkg = require('./package.json');
6 | let external = Object.keys(pkg.dependencies);
7 |
8 | export default {
9 | input: 'index.js',
10 | plugins: [resolve(), 'external-helpers', babel(babelrc())],
11 | external: external,
12 | output: {
13 | file: pkg.main,
14 | format: 'umd',
15 | name: 'dbox',
16 | sourcemap: true,
17 | globals: {
18 | lodash: '_',
19 | d3: 'd3',
20 | cartodb: 'cartodb',
21 | textures: 'textures',
22 | topojson: 'topojson',
23 | leaflet: 'L',
24 | },
25 | },
26 | };
27 |
--------------------------------------------------------------------------------
/out/scripts/linenumber.js:
--------------------------------------------------------------------------------
1 | /*global document */
2 | (function() {
3 | var source = document.getElementsByClassName('prettyprint source linenums');
4 | var i = 0;
5 | var lineNumber = 0;
6 | var lineId;
7 | var lines;
8 | var totalLines;
9 | var anchorHash;
10 |
11 | if (source && source[0]) {
12 | anchorHash = document.location.hash.substring(1);
13 | lines = source[0].getElementsByTagName('li');
14 | totalLines = lines.length;
15 |
16 | for (; i < totalLines; i++) {
17 | lineNumber++;
18 | lineId = 'line' + lineNumber;
19 | lines[i].id = lineId;
20 | if (lineId === anchorHash) {
21 | lines[i].className += ' selected';
22 | }
23 | }
24 | }
25 | })();
26 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | @dboxjs/core - A library to create easy reusable charts
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/out/scripts/prettify/lang-css.js:
--------------------------------------------------------------------------------
1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com",
2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Dbox.js
2 |
3 | A library to create easy reusable charts
4 |
5 | ## Dependencies
6 |
7 | Dbox uses `d3`, `d3-queue`, `d3-tip`, `lodash`, `topojson`
8 |
9 | ## Instalation
10 |
11 | Using npm
12 |
13 | ```
14 | npm install @dboxjs/core
15 | ```
16 |
17 | ## Usage
18 |
19 | Dbox uses one chart that allows to draw different layers
20 |
21 | ```javascript
22 | var config = {
23 | size: {
24 | width: width,
25 | height: 500,
26 | margin: { top: 20, right: 20, bottom: 30, left: 40 }
27 | },
28 | xAxis: {
29 | scale: "time"
30 | }
31 | };
32 |
33 | dbox
34 | .chart(config)
35 | .bindTo("#timeline-chart")
36 | .data({ csv: "assets/data/linea.csv" })
37 | .layer(dbox.timeline)
38 | .x("year")
39 | .series(["tot"])
40 | .color("species")
41 | .end()
42 | .draw();
43 | ```
44 |
45 | Check examples on [dboxjs.org](http://dboxjs.org)
46 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | lerna-debug.log*
8 |
9 | # Diagnostic reports (https://nodejs.org/api/report.html)
10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11 |
12 | # Coverage directory used by tools like istanbul
13 | coverage
14 | *.lcov
15 |
16 | # nyc test coverage
17 | .nyc_output
18 |
19 | # Dependency directories
20 | node_modules/
21 |
22 | # Optional eslint cache
23 | .eslintcache
24 |
25 | # Optional REPL history
26 | .node_repl_history
27 |
28 | # Output of 'npm pack'
29 | *.tgz
30 |
31 | # Yarn Integrity file
32 | .yarn-integrity
33 | yarn.lock
34 |
35 | # dotenv environment variables file
36 | .env
37 | .env.test
38 |
39 | # parcel-bundler cache (https://parceljs.org/)
40 | .cache
41 |
42 | # rollup.js default build output
43 | # dist/
44 | rollup.config.dev.js
45 |
46 | # Temporary folders
47 | tmp/
48 | temp/
49 | .DS_Store
50 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | install:
4 | for file in ../*/ ; \
5 | do \
6 | echo "$$file"; \
7 | cd $$file; \
8 | npm install; \
9 | cd ../core; \
10 | done
11 |
12 | pull:
13 | for file in ../*/ ; \
14 | do \
15 | echo "$$file"; \
16 | cd $$file; \
17 | git pull origin dev; \
18 | cd ../core; \
19 | done
20 |
21 | pull_master:
22 | for file in ../*/ ; \
23 | do \
24 | echo "$$file"; \
25 | cd $$file; \
26 | git pull origin master; \
27 | cd ../core; \
28 | done
29 |
30 | checkout_dev:
31 | for file in ../*/ ; \
32 | do \
33 | echo "$$file"; \
34 | cd $$file; \
35 | git checkout dev; \
36 | cd ../core; \
37 | done
38 |
39 | status:
40 | for file in ../*/ ; \
41 | do \
42 | echo "$$file"; \
43 | cd $$file; \
44 | git status; \
45 | cd ../core; \
46 | done
47 |
48 | fetch:
49 | for file in ../*/ ; \
50 | do \
51 | echo "$$file"; \
52 | cd $$file; \
53 | git fetch --all --prune; \
54 | cd ../core; \
55 | done
56 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Dboxjs
3 | *
4 | * You can import other modules here, including external packages. When
5 | * bundling using rollup you can mark those modules as external and have them
6 | * excluded or, if they have a jsnext:main entry in their package.json (like
7 | * this package does), let rollup bundle them into your dist file.
8 | */
9 |
10 | /* Core */
11 | export { default as chart } from './lib/chart';
12 |
13 | /* Chart modules */
14 | export { default as bars } from '@dboxjs/bars';
15 |
16 | export { default as distro } from '@dboxjs/distro';
17 |
18 | export { default as heatmap } from '@dboxjs/heatmap';
19 |
20 | export { default as leaflet } from '@dboxjs/leaflet';
21 |
22 | export { default as map } from '@dboxjs/map';
23 |
24 | export { default as radar } from '@dboxjs/radar';
25 |
26 | export { default as scatter } from '@dboxjs/scatter';
27 |
28 | export { default as spineplot } from '@dboxjs/spineplot';
29 |
30 | export { default as timeline } from '@dboxjs/timeline';
31 |
32 | export { default as treemap } from '@dboxjs/treemap';
33 |
--------------------------------------------------------------------------------
/index.dev.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Dboxjs
3 | *
4 | * You can import other modules here, including external packages. When
5 | * bundling using rollup you can mark those modules as external and have them
6 | * excluded or, if they have a jsnext:main entry in their package.json (like
7 | * this package does), let rollup bundle them into your dist file.
8 | */
9 |
10 | /* Core */
11 |
12 | export { default as chart } from './lib/chart';
13 |
14 | /* Chart modules */
15 | export { default as bars } from '../bars/bars.js';
16 |
17 | export { default as distro } from '../distro/distro.js';
18 |
19 | export { default as heatmap } from '../heatmap/heatmap.js';
20 |
21 | export { default as leaflet } from '../leaflet/leaflet.js';
22 |
23 | export { default as map } from '../map/map.js';
24 |
25 | export { default as radar } from '../radar/radar.js';
26 |
27 | export { default as scatter } from '../scatter/scatter.js';
28 |
29 | export { default as spineplot } from '../spineplot/spineplot.js';
30 |
31 | export { default as timeline } from '../timeline/timeline.js';
32 |
33 | export { default as treemap } from '../treemap/treemap.js';
34 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 DboxJs
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/bk_docs/development_setup.md:
--------------------------------------------------------------------------------
1 | # Development Setup
2 |
3 | Setting up a development environment
4 |
5 | ## Getting started
6 |
7 | 1. Create a directory *dboxjs*
8 |
9 | 2. Clone the following repositories:
10 | * core
11 | * bars
12 | * heatmap
13 | * radar
14 | * scatter
15 | * timeline
16 | * treemap
17 |
18 | ```
19 | git clone git@github.com:dboxjs/core.git
20 | git clone git@github.com:dboxjs/bars.git
21 | git clone git@github.com:dboxjs/heatmap.git
22 | git clone git@github.com:dboxjs/radar.git
23 | git clone git@github.com:dboxjs/scatter.git
24 | git clone git@github.com:dboxjs/timeline.git
25 | git clone git@github.com:dboxjs/treemap.git
26 | ```
27 |
28 |
29 | 3. In all the repositories execute
30 | ```
31 | npm install
32 | ```
33 | 4. In @dboxjs/core
34 | * Duplicate rollup.conf.js save as rollup.config.dev.js
35 | * Modify entry as `entry: 'index.dev.js'`
36 | * Modify targets > dest to the desired destination
37 | ```javascript
38 | targets: [
39 | {
40 | dest: "your/desired/folder",
41 | format: 'umd',
42 | moduleName: 'dbox',
43 | sourceMap: true
44 | }
45 | ```
46 |
47 | 6. Run rollup
48 | ```
49 | npm run dev
50 | ```
51 |
--------------------------------------------------------------------------------
/out/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | JSDoc: Home
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
Home
21 |
22 |
23 |
24 |
25 |
26 |
27 |
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 |
55 |
56 |
57 |
58 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/bk_docs/svg_treemap.md:
--------------------------------------------------------------------------------
1 | # SVG Treemap
2 |
3 | Draws a treemap chart using SVG Rects.
4 |
5 | ## Treemap.nestBy()
6 |
7 | **(Required)** Expects an array of column names that will be used to generate hierarchical data.
8 |
9 | __nestBy('columnName')__: Uses only one level nesting
10 |
11 | __nestBy(['columnName1', 'columnName2', ...])__: Nests data using many levels of hierarchy
12 |
13 | ```javascript
14 | {
15 | "name": "grandparent",
16 | "children": [
17 | {
18 | "name": "parent",
19 | "children": [
20 | {
21 | "name": "child",
22 | "value": 464
23 | }
24 | ]
25 | }
26 | ]
27 | }
28 | ```
29 |
30 | ## Treemap.size()
31 |
32 | **(Required)** Expects a column name that will be used to determine each rect size. It **must ** be a _Number_
33 |
34 | ```javascript
35 | data = {"name": "foo", "value": 32};
36 | layer.size('value')
37 | ```
38 |
39 | ## Treemap.colorScale()
40 |
41 | **(Optional)** Expects an array of colors what will be used to match each children fill color
42 |
43 | **Default:** d3.colorScale20c
44 |
45 | ```
46 | layer.colorScale(['red','#45f530','blue'])
47 | ```
48 |
49 | ## Treemap.padding()
50 |
51 | **(Optional)** Expects a _Number_ set as inner padding
52 |
53 | **Default:** 4
54 |
55 | ```javascript
56 | layer.padding(5)
57 | ```
58 |
59 | ## Treemap.labels()
60 |
61 | **(Optional)** Expects ```true``` or ```false``` to show or hide labels on each rect.
62 |
63 | **Default:** ```true```
64 |
65 | ```javascript
66 | layer.labels(false)
67 | ```
68 |
69 | ## Treemap.tip()
70 |
71 | **(Optional)** Expects a function that will be used as HTML option for d3-tip
72 |
73 | **Default:** ```function(d) { return d.data.name + "\n" + vm._config._format(d.value); };```
74 |
75 | ```javascript
76 | layer.tip(function(d) { return d.data.name; });
77 | ```
78 |
--------------------------------------------------------------------------------
/test/index.test.txt:
--------------------------------------------------------------------------------
1 | import * as dbox from '../';
2 | import * as assert from 'assert';
3 |
4 | describe('chart core', () => {
5 | it('Creates a default chart config template', () => {
6 | var chart = dbox.chart();
7 | assert.deepEqual(chart._config, {size: {width: 800, height: 600, margin: {left: 0, right: 0, top: 0, bottom: 0}}});
8 | });
9 |
10 | it('Should set size options using chained method', () => {
11 | var size = {
12 | width: 400,
13 | height: 400,
14 | margin: {
15 | top: 0,
16 | right: 10,
17 | bottom: 5,
18 | left: 10
19 | }
20 | };
21 | var chart = dbox.chart()
22 | .size(size);
23 |
24 | assert.deepEqual(chart._config.size, size);
25 | assert.deepEqual(chart._width, size.width);
26 | assert.deepEqual(chart._height, size.height);
27 | assert.deepEqual(chart._margin, size.margin);
28 | });
29 |
30 | it('Should bind chart to element', () => {
31 | var chart = dbox.chart()
32 | .bindTo('body')
33 | assert.strictEqual(chart._config.bindTo, 'body');
34 | });
35 |
36 | it('Should return generated scales', () => {
37 | var data = [{name: 'female', value: 52, date: new Date('2017-05-12')},{name: 'male', value: 25, date: new Date('2017-05-11')},{name: 'NA', value: 8, date: new Date('2017-05-10')}];
38 | var options = {
39 | column: 'name',
40 | type: 'ordinal',
41 | range: [0, 600]
42 | };
43 | var xScale = dbox.chart().generateScale(data, options);
44 |
45 | options = {
46 | column: 'value',
47 | type: 'linear',
48 | range: [0, 400]
49 | };
50 | var yScale = dbox.chart().generateScale(data, options);
51 | console.log(xScale.range(), xScale.domain());
52 | console.log(yScale.range(), yScale.domain());
53 | assert.strictEqual(xScale('male'), 213);
54 | assert.strictEqual(yScale(25), 155);
55 | });
56 | });
57 |
--------------------------------------------------------------------------------
/test/helper.test.js:
--------------------------------------------------------------------------------
1 | import * as dbox from '../';
2 | import * as assert from 'assert';
3 |
4 | describe('Helper.utils', function() {
5 | describe('format()', function() {
6 | it('Should format 5450000 to 5.5 millones', function() {
7 | var chart = dbox.chart();
8 | var result = chart.helper.utils.format(null, true)(5450000);
9 | assert.equal(result, '5.5 millones');
10 | });
11 | it('Should format 430958 to 431.0 mil', function() {
12 | var chart = dbox.chart();
13 | var result = chart.helper.utils.format(null, true)(430958);
14 | assert.equal(result, '431.0 mil');
15 | });
16 | it('Should format 6234 to 6,234', function() {
17 | var chart = dbox.chart();
18 | var result = chart.helper.utils.format(null, true)(6234);
19 | assert.equal(result, '6,234');
20 | });
21 | it('Should format 345.23 to 345.2', function() {
22 | var chart = dbox.chart();
23 | var result = chart.helper.utils.format(null, true)(345.23);
24 | assert.equal(result, '345.2');
25 | });
26 | it('Should format 5.2093 to 5.2', function() {
27 | var chart = dbox.chart();
28 | var result = chart.helper.utils.format(null, true)(5.2093);
29 | assert.equal(result, '5.2');
30 | });
31 | it('Should format 12.0 to 12', function() {
32 | var chart = dbox.chart();
33 | var result = chart.helper.utils.format(null, true)(12.0);
34 | assert.equal(result, '12');
35 | });
36 | it('Should format 1.4904 to 1.5', function() {
37 | var chart = dbox.chart();
38 | var result = chart.helper.utils.format(null, true)(1.4904);
39 | assert.equal(result, '1.5');
40 | });
41 | it('Should format 0.4935 to 0.5 ', function() {
42 | var chart = dbox.chart();
43 | var result = chart.helper.utils.format(null, true)(0.4935);
44 | assert.equal(result, '0.5');
45 | });
46 | it('Should format 0.00435 to 0.004 ', function() {
47 | var chart = dbox.chart();
48 | var result = chart.helper.utils.format(null, true)(0.00435);
49 | assert.equal(result, '0.004');
50 | });
51 | });
52 | });
53 |
--------------------------------------------------------------------------------
/test/bars.test.txt:
--------------------------------------------------------------------------------
1 | import * as dbox from '../';
2 | import * as assert from 'assert';
3 |
4 | describe('Bar chart', () => {
5 | it('Should create a base chart', () => {
6 | var config = {
7 | size: {
8 | width: 600,
9 | height: 400,
10 | margin: {
11 | top: 5,
12 | right: 5,
13 | bottom: 20,
14 | left: 20
15 | }
16 | },
17 | xAxis: {
18 | enabled:true,
19 | scale: 'linear'
20 | },
21 | yAxis: {
22 | enabled: true,
23 | scale: 'linear'
24 | }
25 | };
26 |
27 | var chart = dbox.chart(config)
28 | .bindTo('body')
29 | .data({'raw': [{name: 'female', value: 35},{name: 'male', value: 24},{name: 'NA', value: 4}]})
30 | assert.equal(chart._config.bindTo, 'body');
31 | });
32 |
33 | it('Bars should be defined in dbox', () => {
34 | assert.ok(dbox.bars);
35 | });
36 |
37 | it('Should create a bar chart', () => {
38 | var config = {
39 | size: {
40 | width: 600,
41 | height: 400,
42 | margin: {
43 | top: 5,
44 | right: 5,
45 | bottom: 20,
46 | left: 20
47 | }
48 | },
49 | xAxis: {
50 | enabled:true,
51 | scale: 'ordinal'
52 | },
53 | yAxis: {
54 | enabled: true,
55 | scale: 'linear'
56 | },
57 | events: {
58 | load: onLoad
59 | }
60 | };
61 | var data = [{name: 'female', value: 35},{name: 'male', value: 24},{name: 'NA', value: 4}];
62 |
63 | var chart = dbox.chart(config)
64 | .bindTo(this)
65 | .data({'raw': data})
66 | .layer(dbox.bars)
67 | .x('name')
68 | .y('value')
69 | .end()
70 | .draw();
71 | function onLoad(chart){
72 | setTimeout(function(){
73 | console.log(chart.getLayer(0));
74 | assert.ok(chart.getLayer(0)._scales.x);
75 | assert.ok(chart.getLayer(0)._scales.y);
76 | }, 2000);
77 | }
78 | })
79 | });
80 |
--------------------------------------------------------------------------------
/out/styles/prettify-jsdoc.css:
--------------------------------------------------------------------------------
1 | /* JSDoc prettify.js theme */
2 |
3 | /* plain text */
4 | .pln {
5 | color: #000000;
6 | font-weight: normal;
7 | font-style: normal;
8 | }
9 |
10 | /* string content */
11 | .str {
12 | color: #006400;
13 | font-weight: normal;
14 | font-style: normal;
15 | }
16 |
17 | /* a keyword */
18 | .kwd {
19 | color: #000000;
20 | font-weight: bold;
21 | font-style: normal;
22 | }
23 |
24 | /* a comment */
25 | .com {
26 | font-weight: normal;
27 | font-style: italic;
28 | }
29 |
30 | /* a type name */
31 | .typ {
32 | color: #000000;
33 | font-weight: normal;
34 | font-style: normal;
35 | }
36 |
37 | /* a literal value */
38 | .lit {
39 | color: #006400;
40 | font-weight: normal;
41 | font-style: normal;
42 | }
43 |
44 | /* punctuation */
45 | .pun {
46 | color: #000000;
47 | font-weight: bold;
48 | font-style: normal;
49 | }
50 |
51 | /* lisp open bracket */
52 | .opn {
53 | color: #000000;
54 | font-weight: bold;
55 | font-style: normal;
56 | }
57 |
58 | /* lisp close bracket */
59 | .clo {
60 | color: #000000;
61 | font-weight: bold;
62 | font-style: normal;
63 | }
64 |
65 | /* a markup tag name */
66 | .tag {
67 | color: #006400;
68 | font-weight: normal;
69 | font-style: normal;
70 | }
71 |
72 | /* a markup attribute name */
73 | .atn {
74 | color: #006400;
75 | font-weight: normal;
76 | font-style: normal;
77 | }
78 |
79 | /* a markup attribute value */
80 | .atv {
81 | color: #006400;
82 | font-weight: normal;
83 | font-style: normal;
84 | }
85 |
86 | /* a declaration */
87 | .dec {
88 | color: #000000;
89 | font-weight: bold;
90 | font-style: normal;
91 | }
92 |
93 | /* a variable name */
94 | .var {
95 | color: #000000;
96 | font-weight: normal;
97 | font-style: normal;
98 | }
99 |
100 | /* a function name */
101 | .fun {
102 | color: #000000;
103 | font-weight: bold;
104 | font-style: normal;
105 | }
106 |
107 | /* Specify class=linenums on a pre to get line numbering */
108 | ol.linenums {
109 | margin-top: 0;
110 | margin-bottom: 0;
111 | }
112 |
--------------------------------------------------------------------------------
/bk_docs/API.md:
--------------------------------------------------------------------------------
1 | # DboxJS API Reference
2 |
3 | DboxJS is a collection of modules that are designed to work together. The source and documentation for each module is available in its repository.
4 |
5 | ## Chart
6 |
7 | Main module.
8 |
9 | Methods for generating layers.
10 |
11 | * chart.config - define the layout
12 | * chart.size - define the size
13 | * chart.grid
14 | * chart.bindTo
15 | * chart.data - load the data
16 | * chart.layer
17 | * chart.getLayer
18 | * chart.draw
19 |
20 | ## Bars
21 |
22 | ## Heatmap
23 |
24 | Heatmap layer module.
25 |
26 | Methods for generating heatmap layers.
27 |
28 | * heatmap.x -
29 | * heatmap.y -
30 | * heatmap.color -
31 | * heatmap.tip -
32 | * heatmap.buckets -
33 | * heatmap.end -
34 | * heatmap.chart -
35 | * heatmap.data -
36 | * heatmap.scales -
37 | * heatmap.axes -
38 | * heatmap.domains -
39 | * heatmap.draw -
40 |
41 | ## Radar
42 |
43 | ## Scatter
44 |
45 | Scatter layer module.
46 |
47 | Methods for generating scatter layers.
48 |
49 | * scatter.x -
50 | * scatter.y -
51 | * scatter.radius -
52 | * scatter.radiusRange -
53 | * scatter.properties -
54 | * scatter.color -
55 | * scatter.opacity -
56 | * scatter.tip -
57 | * scatter.end -
58 | * scatter.chart -
59 | * scatter.data -
60 | * scatter.scales -
61 | * scatter.axes -
62 | * scatter.domains -
63 | * scatter.draw -
64 | * scatter.select -
65 | * scatter.selectAll -
66 |
67 | ## Timeline
68 |
69 | Timeline layer module.
70 |
71 | Methods for generating timeline layers.
72 |
73 | * timeline.x -
74 | * timeline.y -
75 | * timeline.series -
76 | * timeline.colors -
77 | * timeline.timeParse -
78 | * timeline.area -
79 | * timeline.color -
80 | * timeline.end -
81 | * timeline.chart -
82 | * timeline.data -
83 | * timeline.scales -
84 | * timeline.axes -
85 | * timeline.domains -
86 | * timeline.draw -
87 |
88 | ## Treemap
89 |
90 | Treemap layer module.
91 |
92 | Methods for generating treemap layers.
93 |
94 | * treemap.end -
95 | * treemap.size -
96 | * treemap.colorScale -
97 | * treemap.padding -
98 | * treemap.nestBy -
99 | * treemap.format -
100 | * treemap.labels -
101 | * treemap.tip -
102 | * treemap.chart -
103 | * treemap.scales -
104 | * treemap.axes -
105 | * treemap.domains -
106 | * treemap.isValidStructure -
107 | * treemap.formatNestedData -
108 | * treemap.data -
109 | * treemap.draw -
110 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@dboxjs/core",
3 | "version": "0.1.9",
4 | "description": "A library to create easy reusable charts",
5 | "main": "dist/dbox.js",
6 | "module": "dist/dbox.mjs",
7 | "jsnext:main": "dist/dbox.mjs",
8 | "scripts": {
9 | "eslint": "eslint -c .eslintrc lib test",
10 | "build": "rollup -c rollup.config.js; uglifyjs ./dist/dbox.js -c -m -o ./dist/dbox.min.js",
11 | "dev": "rollup -c rollup.config.dev.js -w",
12 | "pretest": "npm run build",
13 | "docs": "jsdoc -c jsdocs.config.json"
14 | },
15 | "repository": {
16 | "type": "git",
17 | "url": "git+https://github.com/dboxjs/core.git"
18 | },
19 | "keywords": [
20 | "d3",
21 | "charts",
22 | "dataviz",
23 | "dbox",
24 | "dboxjs"
25 | ],
26 | "author": "",
27 | "license": "MIT",
28 | "bugs": {
29 | "url": "https://github.com/dboxjs/dbox/issues"
30 | },
31 | "files": [
32 | "lib",
33 | "dist",
34 | "docs"
35 | ],
36 | "homepage": "https://github.com/dboxjs/dbox#readme",
37 | "prettier": {
38 | "singleQuote": true
39 | },
40 | "dependencies": {
41 | "d3": "^4.13.0",
42 | "d3-queue": "^3.0.7",
43 | "d3-tip": "^0.9.1",
44 | "leaflet": "^1.3.1",
45 | "lodash": "^4.17.15",
46 | "textures": "^1.0.4",
47 | "topojson": "^2.2.0"
48 | },
49 | "devDependencies": {
50 | "@dboxjs/bars": "0",
51 | "@dboxjs/distro": "0",
52 | "@dboxjs/heatmap": "0",
53 | "@dboxjs/leaflet": "^0.1.2",
54 | "@dboxjs/map": "0",
55 | "@dboxjs/radar": "0",
56 | "@dboxjs/scatter": "0",
57 | "@dboxjs/spineplot": "0",
58 | "@dboxjs/timeline": "0",
59 | "@dboxjs/treemap": "0",
60 | "babel": "^6.23.0",
61 | "babel-eslint": "^7.1.1",
62 | "babel-plugin-external-helpers": "^6.22.0",
63 | "babel-preset-env": "^1.6.0",
64 | "babel-register": "^6.18.0",
65 | "babelrc-rollup": "^3.0.0",
66 | "eslint": "^4.18.2",
67 | "istanbul": "^0.4.5",
68 | "jsdoc": "^3.6.3",
69 | "mocha": "^5.1.1",
70 | "mocha-phantomjs": "^4.1.0",
71 | "redux": "^4.0.1",
72 | "rollup": "^0.57.1",
73 | "rollup-plugin-babel": "^3.0.7",
74 | "rollup-plugin-commonjs": "^9.1.0",
75 | "rollup-plugin-istanbul": "^2.0.1",
76 | "rollup-plugin-legacy": "^1.0.0",
77 | "rollup-plugin-node-resolve": "^2.1.1",
78 | "rollup-watch": "^2.5.0",
79 | "uglify-js": "^2.8.10"
80 | },
81 | "directories": {
82 | "doc": "docs",
83 | "test": "test"
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/out/styles/prettify-tomorrow.css:
--------------------------------------------------------------------------------
1 | /* Tomorrow Theme */
2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */
3 | /* Pretty printing styles. Used with prettify.js. */
4 | /* SPAN elements with the classes below are added by prettyprint. */
5 | /* plain text */
6 | .pln {
7 | color: #4d4d4c; }
8 |
9 | @media screen {
10 | /* string content */
11 | .str {
12 | color: #718c00; }
13 |
14 | /* a keyword */
15 | .kwd {
16 | color: #8959a8; }
17 |
18 | /* a comment */
19 | .com {
20 | color: #8e908c; }
21 |
22 | /* a type name */
23 | .typ {
24 | color: #4271ae; }
25 |
26 | /* a literal value */
27 | .lit {
28 | color: #f5871f; }
29 |
30 | /* punctuation */
31 | .pun {
32 | color: #4d4d4c; }
33 |
34 | /* lisp open bracket */
35 | .opn {
36 | color: #4d4d4c; }
37 |
38 | /* lisp close bracket */
39 | .clo {
40 | color: #4d4d4c; }
41 |
42 | /* a markup tag name */
43 | .tag {
44 | color: #c82829; }
45 |
46 | /* a markup attribute name */
47 | .atn {
48 | color: #f5871f; }
49 |
50 | /* a markup attribute value */
51 | .atv {
52 | color: #3e999f; }
53 |
54 | /* a declaration */
55 | .dec {
56 | color: #f5871f; }
57 |
58 | /* a variable name */
59 | .var {
60 | color: #c82829; }
61 |
62 | /* a function name */
63 | .fun {
64 | color: #4271ae; } }
65 | /* Use higher contrast and text-weight for printable form. */
66 | @media print, projection {
67 | .str {
68 | color: #060; }
69 |
70 | .kwd {
71 | color: #006;
72 | font-weight: bold; }
73 |
74 | .com {
75 | color: #600;
76 | font-style: italic; }
77 |
78 | .typ {
79 | color: #404;
80 | font-weight: bold; }
81 |
82 | .lit {
83 | color: #044; }
84 |
85 | .pun, .opn, .clo {
86 | color: #440; }
87 |
88 | .tag {
89 | color: #006;
90 | font-weight: bold; }
91 |
92 | .atn {
93 | color: #404; }
94 |
95 | .atv {
96 | color: #060; } }
97 | /* Style */
98 | /*
99 | pre.prettyprint {
100 | background: white;
101 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
102 | font-size: 12px;
103 | line-height: 1.5;
104 | border: 1px solid #ccc;
105 | padding: 10px; }
106 | */
107 |
108 | /* Specify class=linenums on a pre to get line numbering */
109 | ol.linenums {
110 | margin-top: 0;
111 | margin-bottom: 0; }
112 |
113 | /* IE indents via margin-left */
114 | li.L0,
115 | li.L1,
116 | li.L2,
117 | li.L3,
118 | li.L4,
119 | li.L5,
120 | li.L6,
121 | li.L7,
122 | li.L8,
123 | li.L9 {
124 | /* */ }
125 |
126 | /* Alternate shading for lines */
127 | li.L1,
128 | li.L3,
129 | li.L5,
130 | li.L7,
131 | li.L9 {
132 | /* */ }
133 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6 |
7 | ## Our Standards
8 |
9 | Examples of behavior that contributes to creating a positive environment include:
10 |
11 | * Using welcoming and inclusive language
12 | * Being respectful of differing viewpoints and experiences
13 | * Gracefully accepting constructive criticism
14 | * Focusing on what is best for the community
15 | * Showing empathy towards other community members
16 |
17 | Examples of unacceptable behavior by participants include:
18 |
19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances
20 | * Trolling, insulting/derogatory comments, and personal or political attacks
21 | * Public or private harassment
22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission
23 | * Other conduct which could reasonably be considered inappropriate in a professional setting
24 |
25 | ## Our Responsibilities
26 |
27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28 |
29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30 |
31 | ## Scope
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34 |
35 | ## Enforcement
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at info@dboxjs.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38 |
39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40 |
41 | ## Attribution
42 |
43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44 |
45 | [homepage]: http://contributor-covenant.org
46 | [version]: http://contributor-covenant.org/version/1/4/
47 |
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | # Dbox.js - @dboxjs/core
2 |
3 | ---
4 |
5 | A library to create easy reusable charts
6 |
7 | ## Installation
8 |
9 | Using npm
10 |
11 | ```
12 | npm install @dboxjs/core
13 | ```
14 |
15 | ## Usage
16 |
17 | Dbox uses one chart that allows to draw different layers
18 |
19 | ```javascript
20 | var config = {
21 | size: {
22 | width: width,
23 | height: 500,
24 | margin: { top: 20, right: 20, bottom: 30, left: 40 }
25 | },
26 | xAxis: {
27 | scale: "time"
28 | }
29 | };
30 |
31 | dbox
32 | .chart(config)
33 | .bindTo("#timeline-chart")
34 | .data({ csv: "assets/data/linea.csv" })
35 | .layer(dbox.timeline)
36 | .x("year")
37 | .series(["tot"])
38 | .color("species")
39 | .end()
40 | .draw();
41 | ```
42 |
43 | Check examples on [dboxjs.org](http://dboxjs.org)
44 |
45 | ## Dependencies
46 |
47 | Dbox uses `d3`, `d3-queue`, `d3-tip`, `lodash`, `topojson`
48 |
49 | ---
50 |
51 | # Layers
52 |
53 | ---
54 |
55 | dbox.js has several layers currently implemented. Each layer is developed independently. However all instances should at least have the following listed methods.
56 |
57 | | Public Methods | Description | @dboxjs/bar |
58 | | -------------------- | -------------------------------------------------------------- | :---------: |
59 | | .data(_object_) | Passes the data to the layer | X |
60 | | .map(_function_) | Used to create a new array of data | - |
61 | | .filter(_function_) | Used to filter rows in the data | - |
62 | | .sortBy(_function_) | Used to sort the rows in the data | - |
63 | | .color(_string_) | Specify which column as the input for color selection | X |
64 | | .colorScale(_array_) | Specify the range of hexadecimal colors for each serie of data | X |
65 | | .tip(_function_) | Specify the html to render on mouse hover | - |
66 | | .format(_function_) | Pending | - |
67 |
68 |
69 |
70 | ---
71 |
72 | # @dboxjs/bar
73 |
74 | ---
75 |
76 | ## Usage
77 |
78 | ```javascript
79 | var data = [
80 | {
81 | State: "CA",
82 | "Under 5 Years": 2704659,
83 | "5 to 13 Years": 4499890,
84 | "14 to 17 Years": 2159981,
85 | "18 to 24 Years": 3853788,
86 | "25 to 44 Years": 10604510,
87 | "45 to 64 Years": 8819342,
88 | "65 Years and Over": 4114496
89 | },
90 | {
91 | State: "TX",
92 | "Under 5 Years": 2027307,
93 | "5 to 13 Years": 3277946,
94 | "14 to 17 Years": 1420518,
95 | "18 to 24 Years": 2454721,
96 | "25 to 44 Years": 7017731,
97 | "45 to 64 Years": 5656528,
98 | "65 Years and Over": 2472223
99 | },
100 | {
101 | State: "NY",
102 | "Under 5 Years": 1208495,
103 | "5 to 13 Years": 2141490,
104 | "14 to 17 Years": 1058031,
105 | "18 to 24 Years": 1999120,
106 | "25 to 44 Years": 5355235,
107 | "45 to 64 Years": 5120254,
108 | "65 Years and Over": 2607672
109 | }
110 | ];
111 |
112 | var config = {
113 | size: {
114 | width: 600,
115 | height: 400,
116 | margin: { top: 5, right: 5, bottom: 40, left: 100 }
117 | },
118 | xAxis: {
119 | enabled: true,
120 | scale: "band"
121 | },
122 | yAxis: {
123 | enabled: true,
124 | scale: "linear"
125 | }
126 | };
127 |
128 | var chart = dbox
129 | .chart(config)
130 | .bindTo("#chart")
131 | .data({ raw: data })
132 | .layer(dbox.bars)
133 | .x("State")
134 | .y("Under 5 Years")
135 | .end()
136 | .draw();
137 | ```
138 |
139 | ### Normal Bar chart
140 |
141 | - Set the x and y attributes according to the dataset
142 |
143 | ```javascript
144 | var chart = dbox
145 | .chart(config)
146 | .bindTo("#chart")
147 | .data({ raw: data })
148 | .layer(dbox.bars)
149 | .x("State")
150 | .y("Under 5 Years")
151 | .end()
152 | .draw();
153 | ```
154 |
155 | ### GroupBy Bar Chart
156 |
157 | - Set the x attribute according to the dataset. This attribute will serve as the parent category
158 | - Set the groupBy with an array of attributes. This attributes will serve as the "children" categories
159 |
160 | ```javascript
161 | var chart = dbox
162 | .chart(config)
163 | .bindTo("#chart")
164 | .data({ raw: data })
165 | .layer(dbox.bars)
166 | .x("State")
167 | .groupBy([
168 | "Under 5 Years",
169 | "5 to 13 Years",
170 | "14 to 17 Years",
171 | "18 to 24 Years",
172 | "25 to 44 Years",
173 | "45 to 64 Years",
174 | "65 Years and Over"
175 | ])
176 | .end()
177 | .draw();
178 | ```
179 |
180 | ### StackBy Bar Chart
181 |
182 | - Set the x attribute according to the dataset. This attribute will serve as the parent category
183 | - Set the stackBy with an array of attributes. This attributes will serve as the "children" categories
184 |
185 | ```javascript
186 | var chart = dbox
187 | .chart(config)
188 | .bindTo("#chart")
189 | .data({ raw: data })
190 | .layer(dbox.bars)
191 | .x("State")
192 | .stackBy([
193 | "Under 5 Years",
194 | "5 to 13 Years",
195 | "14 to 17 Years",
196 | "18 to 24 Years",
197 | "25 to 44 Years",
198 | "45 to 64 Years",
199 | "65 Years and Over"
200 | ])
201 | .end()
202 | .draw();
203 | ```
204 |
205 | ## Methods
206 |
207 | ### .x(string)
208 |
209 | ---
210 |
211 | | Parameter | Description |
212 | | ---------- | ----------------------------------------------- |
213 | | columnName | Attribute from the dataset to use in the x Axis |
214 |
215 | ### .y(string)
216 |
217 | ---
218 |
219 | | Parameter | Description |
220 | | ---------- | ----------------------------------------------- |
221 | | columnName | Attribute from the dataset to use in the y Axis |
222 |
223 | ### .groupBy(array)
224 |
225 | ---
226 |
227 | | Parameter | Description |
228 | | --------- | ---------------------------------------- |
229 | | columns | Array of columns to groupBy in the xAxis |
230 |
231 | ---
232 |
233 | # Contribute
234 |
235 | ---
236 |
237 | Setting up a development environment
238 |
239 | ## Getting started
240 |
241 | 1. Create a directory _dboxjs_
242 |
243 | 2. Clone the following repositories:
244 |
245 | - core
246 | - bars
247 | - heatmap
248 | - radar
249 | - scatter
250 | - timeline
251 | - treemap
252 |
253 | ```
254 | git clone git@github.com:dboxjs/core.git
255 | git clone git@github.com:dboxjs/bars.git
256 | git clone git@github.com:dboxjs/heatmap.git
257 | git clone git@github.com:dboxjs/radar.git
258 | git clone git@github.com:dboxjs/scatter.git
259 | git clone git@github.com:dboxjs/timeline.git
260 | git clone git@github.com:dboxjs/treemap.git
261 | ```
262 |
263 | 3. In all the repositories execute
264 |
265 | ```
266 | npm install
267 | ```
268 |
269 | 4. In @dboxjs/core
270 | - Duplicate rollup.conf.js save as rollup.config.dev.js
271 | - Modify entry as `entry: 'index.dev.js'`
272 | - Modify output > file to the desired destination
273 | ```javascript
274 | output: [
275 | {
276 | file: "your/desired/folder",
277 | format : 'umd',
278 | name : 'dbox',
279 | sourcemap : true
280 | }
281 | ```
282 |
283 | ```
284 |
285 | 6. Run rollup
286 | ```
287 |
288 | npm run dev
289 |
290 | ```
291 |
292 | ```
293 |
--------------------------------------------------------------------------------
/out/styles/jsdoc-default.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Open Sans';
3 | font-weight: normal;
4 | font-style: normal;
5 | src: url('../fonts/OpenSans-Regular-webfont.eot');
6 | src:
7 | local('Open Sans'),
8 | local('OpenSans'),
9 | url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'),
10 | url('../fonts/OpenSans-Regular-webfont.woff') format('woff'),
11 | url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg');
12 | }
13 |
14 | @font-face {
15 | font-family: 'Open Sans Light';
16 | font-weight: normal;
17 | font-style: normal;
18 | src: url('../fonts/OpenSans-Light-webfont.eot');
19 | src:
20 | local('Open Sans Light'),
21 | local('OpenSans Light'),
22 | url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'),
23 | url('../fonts/OpenSans-Light-webfont.woff') format('woff'),
24 | url('../fonts/OpenSans-Light-webfont.svg#open_sanslight') format('svg');
25 | }
26 |
27 | html
28 | {
29 | overflow: auto;
30 | background-color: #fff;
31 | font-size: 14px;
32 | }
33 |
34 | body
35 | {
36 | font-family: 'Open Sans', sans-serif;
37 | line-height: 1.5;
38 | color: #4d4e53;
39 | background-color: white;
40 | }
41 |
42 | a, a:visited, a:active {
43 | color: #0095dd;
44 | text-decoration: none;
45 | }
46 |
47 | a:hover {
48 | text-decoration: underline;
49 | }
50 |
51 | header
52 | {
53 | display: block;
54 | padding: 0px 4px;
55 | }
56 |
57 | tt, code, kbd, samp {
58 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
59 | }
60 |
61 | .class-description {
62 | font-size: 130%;
63 | line-height: 140%;
64 | margin-bottom: 1em;
65 | margin-top: 1em;
66 | }
67 |
68 | .class-description:empty {
69 | margin: 0;
70 | }
71 |
72 | #main {
73 | float: left;
74 | width: 70%;
75 | }
76 |
77 | article dl {
78 | margin-bottom: 40px;
79 | }
80 |
81 | article img {
82 | max-width: 100%;
83 | }
84 |
85 | section
86 | {
87 | display: block;
88 | background-color: #fff;
89 | padding: 12px 24px;
90 | border-bottom: 1px solid #ccc;
91 | margin-right: 30px;
92 | }
93 |
94 | .variation {
95 | display: none;
96 | }
97 |
98 | .signature-attributes {
99 | font-size: 60%;
100 | color: #aaa;
101 | font-style: italic;
102 | font-weight: lighter;
103 | }
104 |
105 | nav
106 | {
107 | display: block;
108 | float: right;
109 | margin-top: 28px;
110 | width: 30%;
111 | box-sizing: border-box;
112 | border-left: 1px solid #ccc;
113 | padding-left: 16px;
114 | }
115 |
116 | nav ul {
117 | font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif;
118 | font-size: 100%;
119 | line-height: 17px;
120 | padding: 0;
121 | margin: 0;
122 | list-style-type: none;
123 | }
124 |
125 | nav ul a, nav ul a:visited, nav ul a:active {
126 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
127 | line-height: 18px;
128 | color: #4D4E53;
129 | }
130 |
131 | nav h3 {
132 | margin-top: 12px;
133 | }
134 |
135 | nav li {
136 | margin-top: 6px;
137 | }
138 |
139 | footer {
140 | display: block;
141 | padding: 6px;
142 | margin-top: 12px;
143 | font-style: italic;
144 | font-size: 90%;
145 | }
146 |
147 | h1, h2, h3, h4 {
148 | font-weight: 200;
149 | margin: 0;
150 | }
151 |
152 | h1
153 | {
154 | font-family: 'Open Sans Light', sans-serif;
155 | font-size: 48px;
156 | letter-spacing: -2px;
157 | margin: 12px 24px 20px;
158 | }
159 |
160 | h2, h3.subsection-title
161 | {
162 | font-size: 30px;
163 | font-weight: 700;
164 | letter-spacing: -1px;
165 | margin-bottom: 12px;
166 | }
167 |
168 | h3
169 | {
170 | font-size: 24px;
171 | letter-spacing: -0.5px;
172 | margin-bottom: 12px;
173 | }
174 |
175 | h4
176 | {
177 | font-size: 18px;
178 | letter-spacing: -0.33px;
179 | margin-bottom: 12px;
180 | color: #4d4e53;
181 | }
182 |
183 | h5, .container-overview .subsection-title
184 | {
185 | font-size: 120%;
186 | font-weight: bold;
187 | letter-spacing: -0.01em;
188 | margin: 8px 0 3px 0;
189 | }
190 |
191 | h6
192 | {
193 | font-size: 100%;
194 | letter-spacing: -0.01em;
195 | margin: 6px 0 3px 0;
196 | font-style: italic;
197 | }
198 |
199 | table
200 | {
201 | border-spacing: 0;
202 | border: 0;
203 | border-collapse: collapse;
204 | }
205 |
206 | td, th
207 | {
208 | border: 1px solid #ddd;
209 | margin: 0px;
210 | text-align: left;
211 | vertical-align: top;
212 | padding: 4px 6px;
213 | display: table-cell;
214 | }
215 |
216 | thead tr
217 | {
218 | background-color: #ddd;
219 | font-weight: bold;
220 | }
221 |
222 | th { border-right: 1px solid #aaa; }
223 | tr > th:last-child { border-right: 1px solid #ddd; }
224 |
225 | .ancestors, .attribs { color: #999; }
226 | .ancestors a, .attribs a
227 | {
228 | color: #999 !important;
229 | text-decoration: none;
230 | }
231 |
232 | .clear
233 | {
234 | clear: both;
235 | }
236 |
237 | .important
238 | {
239 | font-weight: bold;
240 | color: #950B02;
241 | }
242 |
243 | .yes-def {
244 | text-indent: -1000px;
245 | }
246 |
247 | .type-signature {
248 | color: #aaa;
249 | }
250 |
251 | .name, .signature {
252 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
253 | }
254 |
255 | .details { margin-top: 14px; border-left: 2px solid #DDD; }
256 | .details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; }
257 | .details dd { margin-left: 70px; }
258 | .details ul { margin: 0; }
259 | .details ul { list-style-type: none; }
260 | .details li { margin-left: 30px; padding-top: 6px; }
261 | .details pre.prettyprint { margin: 0 }
262 | .details .object-value { padding-top: 0; }
263 |
264 | .description {
265 | margin-bottom: 1em;
266 | margin-top: 1em;
267 | }
268 |
269 | .code-caption
270 | {
271 | font-style: italic;
272 | font-size: 107%;
273 | margin: 0;
274 | }
275 |
276 | .prettyprint
277 | {
278 | border: 1px solid #ddd;
279 | width: 80%;
280 | overflow: auto;
281 | }
282 |
283 | .prettyprint.source {
284 | width: inherit;
285 | }
286 |
287 | .prettyprint code
288 | {
289 | font-size: 100%;
290 | line-height: 18px;
291 | display: block;
292 | padding: 4px 12px;
293 | margin: 0;
294 | background-color: #fff;
295 | color: #4D4E53;
296 | }
297 |
298 | .prettyprint code span.line
299 | {
300 | display: inline-block;
301 | }
302 |
303 | .prettyprint.linenums
304 | {
305 | padding-left: 70px;
306 | -webkit-user-select: none;
307 | -moz-user-select: none;
308 | -ms-user-select: none;
309 | user-select: none;
310 | }
311 |
312 | .prettyprint.linenums ol
313 | {
314 | padding-left: 0;
315 | }
316 |
317 | .prettyprint.linenums li
318 | {
319 | border-left: 3px #ddd solid;
320 | }
321 |
322 | .prettyprint.linenums li.selected,
323 | .prettyprint.linenums li.selected *
324 | {
325 | background-color: lightyellow;
326 | }
327 |
328 | .prettyprint.linenums li *
329 | {
330 | -webkit-user-select: text;
331 | -moz-user-select: text;
332 | -ms-user-select: text;
333 | user-select: text;
334 | }
335 |
336 | .params .name, .props .name, .name code {
337 | color: #4D4E53;
338 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
339 | font-size: 100%;
340 | }
341 |
342 | .params td.description > p:first-child,
343 | .props td.description > p:first-child
344 | {
345 | margin-top: 0;
346 | padding-top: 0;
347 | }
348 |
349 | .params td.description > p:last-child,
350 | .props td.description > p:last-child
351 | {
352 | margin-bottom: 0;
353 | padding-bottom: 0;
354 | }
355 |
356 | .disabled {
357 | color: #454545;
358 | }
359 |
--------------------------------------------------------------------------------
/out/scripts/prettify/Apache-License-2.0.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/out/scripts/prettify/prettify.js:
--------------------------------------------------------------------------------
1 | var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
2 | (function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
3 | [],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
9 | l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
10 | q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
11 | q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
12 | "");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
13 | a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
14 | for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
18 | "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
19 | H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
20 | J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
21 | I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]+/],["dec",/^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^