├── .eslintrc.yml
├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── bower.json
├── dist
├── angular-word-cloud.js
└── angular-word-cloud.min.js
├── docs
├── css
│ ├── github-light.css
│ ├── normalize.css
│ └── stylesheet.css
├── index.html
└── js
│ └── controllers
│ └── app.js
├── gulpfile.js
├── karma.conf.js
├── package.json
├── run.js
├── src
└── angular-word-cloud.js
└── test
└── angular-d3-word-cloud.spec.js
/.eslintrc.yml:
--------------------------------------------------------------------------------
1 | ---
2 | env:
3 | commonjs: true
4 | es6: true
5 | browser: true
6 | extends:
7 | - eslint:recommended
8 | - angular
9 | globals:
10 | before: true
11 | beforeEach: true
12 | d3: true
13 | describe: true
14 | expect: true
15 | inject: true
16 | it: true
17 | process: true
18 | spyOn: true
19 | document: true
20 | __dirname: true
21 | __testBase: true
22 | "$": true
23 | rules:
24 | indent:
25 | - error
26 | - 3
27 | angular/controller-as-vm: 'off'
28 | angular/log: 'off'
29 | angular/angularelement: 'off'
30 | angular/document-service: 'off'
31 | no-undef: error
32 | no-console: 'off'
33 | quotes:
34 | - error
35 | - single
36 | semi:
37 | - error
38 | - always
39 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | /bower_components
3 | /coverage
4 | npm-debug.log
5 | /docs/js/plugins
6 | /docs/css/plugins
7 | /docs/css/fonts
8 | /docs/dist
9 | package-lock.json
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - 8.4.0
4 | before_script:
5 | - npm install
6 | script:
7 | - npm run release
8 |
9 | deploy:
10 | provider: pages
11 | skip_cleanup: true
12 | github_token: $GITHUB_TOKEN
13 | on:
14 | branch: master
15 | local_dir: docs
16 | email: $GITHUB_MAIL
17 |
18 | branches:
19 | only:
20 | - master
21 | notification:
22 | email:
23 | - ${GITHUB_MAIL}
24 | on_success: always
25 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 weihanchen
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.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # angular-d3-word-cloud #
2 |
3 | [](https://travis-ci.org/weihanchen/angular-d3-word-cloud)
4 | [](https://coveralls.io/github/weihanchen/angular-d3-word-cloud?branch=master)
5 |
6 | ## Run examples with server ##
7 | ```
8 | $ npm install
9 | $ npm run test
10 | $ npm run dev //default server port is 8000
11 | $ npm run release //build release files
12 | ```
13 |
14 | ## Dependencies ##
15 | * [angular.js](https://angularjs.org/)
16 | * [d3.js](https://d3js.org/)
17 | * [d3.layout.cloud.js](https://www.jasondavies.com/wordcloud/)
18 |
19 | ## Demo ##
20 | Watch the wordcloud component in action on the [demo page](https://weihanchen.github.io/angular-d3-word-cloud/).
21 |
22 | ## How to use ##
23 |
24 | ### Install ###
25 |
26 | ##### bower #####
27 |
28 | $ bower install angular-d3-word-cloud
29 |
30 | [angular.js](https://angularjs.org/), [d3.js](https://d3js.org/), [d3.layout.cloud.js](https://www.jasondavies.com/wordcloud/) would be install as dependencies auto. If it won't for some error, install it manually.
31 |
32 | $ bower install angular
33 | $ bower install d3
34 | $ bower install d3-cloud
35 |
36 |
37 | ##### npm #####
38 | ```
39 | $ npm install angular-d3-word-cloud
40 | ```
41 |
42 | ## Inject scripts ##
43 | Add dependencies to the
section of your index html:
44 |
45 | ```html
46 |
47 |
48 |
49 |
50 |
51 | ```
52 |
53 | ## Options ##
54 | Note: if words element not contains color property, default will use [d3 schemeCategory20](https://github.com/d3/d3-scale#category-scales)
55 | * `words=[array]` -> [{text: '',size: 0, color: '#6d989e', tooltipText: ''}]
56 | * `height=[number]`
57 | * `width=[number]`
58 | * `padding=[number]` -> [optional] padding for each word, defaults to `5`
59 | * `rotate=[number, function]` -> [optional] rotation for each word, default to `~~(Math.random() * 2) * 60`
60 | * `random=[function]` -> [optional] default to `Math.random`, If specified, sets the internal random number generator, used for selecting the initial position of each word, and the clockwise/counterclockwise direction of the spiral for each word. This should return a number in the range [0, 1).
61 | * `use-tooltip=[boolean]` default tooltip template
62 | * `use-transition=[boolean]` transition with font size
63 | * `on-click=[function]` -> word clicked callback
64 |
65 | ## Directive Usage ##
66 | ```html
67 |