1 | <picture>
|
2 | <source srcset="https://naver.github.io/billboard.js/img/logo/billboard.js-white.svg" media="(prefers-color-scheme: dark)">
|
3 | <img src="https://naver.github.io/billboard.js/img/logo/billboard.js.svg" width="350" alt="billboard.js"><br>
|
4 | </picture>
|
5 |
|
6 | [![Latest Version][badge-latest]][link-version] [![Next version][badge-next]][link-version] [![bb][badge-@billboard.js/react]][link-@billboard.js/react]<br>
|
7 | [![semantic-release][badge-semantic-release]][link-semantic-release] ![React][badge-react]
|
8 |
|
9 | ![CI Status][badge-ci-status] [![Coverage Status][badge-coverage]][link-coverage] [![Known Vulnerabilities][badge-snyk]][link-snyk]
|
10 | [![download][badge-download]][link-download] [![jsDelivr][badge-jsDelivr]][link-jsDelivr] [![gzip size][badge-gzip-size]][link-gzip-size]
|
11 |
|
12 | billboard.js is a re-usable, easy interface JavaScript chart library, based on [D3.js](https://d3js.org/).
|
13 | > The name "billboard" comes from the famous `billboard chart` which everybody knows.<br>
|
14 | > - [Why we decided to start billboard.js?](https://github.com/naver/billboard.js/wiki/Why-we-decided-to-start-billboard.js%3F)
|
15 |
|
16 | ## Documents
|
17 | - [API Documentation](https://naver.github.io/billboard.js/release/latest/doc/)
|
18 | - [Examples](https://naver.github.io/billboard.js/demo/)
|
19 | - [Roadmap](https://github.com/naver/billboard.js/wiki/Roadmap)
|
20 | - [Contribution Guide](CONTRIBUTING.md)
|
21 | - [Development Guide](DEVELOPMENT.md)
|
22 | - [Comparison table with other libraries](https://github.com/naver/billboard.js/wiki/Comparison-table)
|
23 | - [Migration guide from C3.js](https://github.com/naver/billboard.js/wiki/How-to-migrate-from-C3.js%3F)
|
24 | - [Third Party Applications](https://github.com/naver/billboard.js/wiki/Third-party-applications)
|
25 | - [Who's using billboard.js](https://github.com/naver/billboard.js/wiki/Who's-using-billboard.js)
|
26 | - [Benchmark](https://naver.github.io/billboard.js/demo/benchmark/)
|
27 | - Technicals:
|
28 | - [How to bundle for legacy browsers?](https://github.com/naver/billboard.js/wiki/How-to-bundle-for-legacy-browsers%3F)
|
29 | - [How to generate chart image in Node.js environment?](https://github.com/naver/billboard.js/wiki/How-to-generate-chart-image-in-Node.js-environment%3F)
|
30 | - find out more at [Wiki](https://github.com/naver/billboard.js/wiki) page.
|
31 | - v2 updates:
|
32 | - [v2 CHANGELOG](https://github.com/naver/billboard.js/wiki/CHANGELOG-v2)
|
33 | - [Migration Guide to v2](https://github.com/naver/billboard.js/wiki/Migration-Guide-to-v2)
|
34 | - v3 updates:
|
35 | - [billboard.js 3.0 release: D3.js v6 support & new candlestick type!](https://netil.medium.com/billboard-js-3-0-release-d3-js-v6-support-new-candlestick-type-9bd74af6a753)
|
36 |
|
37 | ## Questions?
|
38 | If you have any questions, checkout the previous posts or create a new one at:
|
39 | - [Stack Overflow: billboard.js tagged posts](https://stackoverflow.com/questions/tagged/billboard.js)
|
40 | - [Issue with 'question' label](https://github.com/naver/billboard.js/issues?utf8=%E2%9C%93&q=label%3Aquestion)
|
41 |
|
42 | ## Supported chart types
|
43 | <img src="https://naver.github.io/billboard.js/img/chart-types.png?v=15" width=800>
|
44 |
|
45 | ## Download and Installation
|
46 |
|
47 | Download dist files from the repo directly or install it via npm.
|
48 |
|
49 | <details>
|
50 | <summary>Dist file list from the repo. (click to expand)</summary>
|
51 |
|
52 | ### For development (Uncompressed)
|
53 |
|
54 | You can download the uncompressed files for development
|
55 |
|
56 | #### Latest
|
57 | - https://naver.github.io/billboard.js/release/latest/dist/billboard.js
|
58 | - https://naver.github.io/billboard.js/release/latest/dist/billboard.css
|
59 |
|
60 | #### Specific version
|
61 | - https://naver.github.io/billboard.js/release/[VERSION]/dist/billboard.js
|
62 | - https://naver.github.io/billboard.js/release/[VERSION]/dist/billboard.css
|
63 |
|
64 | ### For production (Compressed)
|
65 |
|
66 | You can download the compressed files for production
|
67 |
|
68 | #### Latest
|
69 | - https://naver.github.io/billboard.js/release/latest/dist/billboard.min.js
|
70 | - https://naver.github.io/billboard.js/release/latest/dist/billboard.min.css
|
71 |
|
72 | #### Specific version
|
73 | - https://naver.github.io/billboard.js/release/[VERSION]/dist/billboard.min.js
|
74 | - https://naver.github.io/billboard.js/release/[VERSION]/dist/billboard.min.css
|
75 |
|
76 | ### Packaged version (with D3.js inclusion)
|
77 |
|
78 | > ⚠️ Packaged version is not an official distribution.
|
79 | > It's to provide an easy way to load 'billboard.js' with dependencies.
|
80 |
|
81 | - **Latest**
|
82 | - https://naver.github.io/billboard.js/release/latest/dist/billboard.pkgd.js
|
83 | - https://naver.github.io/billboard.js/release/latest/dist/billboard.pkgd.min.js
|
84 | - **Specific version**
|
85 | - https://naver.github.io/billboard.js/release/[VERSION]/dist/billboard.pkgd.js
|
86 | - https://naver.github.io/billboard.js/release/[VERSION]/dist/billboard.pkgd.min.js
|
87 |
|
88 | </details>
|
89 |
|
90 | ### Themes
|
91 | > [!NOTE]
|
92 | > If you want apply themes, simply load one of the theme css file provided instead of the default css file.
|
93 | > - [Screenshot Preview](https://github.com/naver/billboard.js/wiki/Themes)
|
94 |
|
95 |
|
96 | <details>
|
97 | <summary>Dist theme file list from the repo. (click to expand)</summary>
|
98 |
|
99 | #### datalab
|
100 | - https://naver.github.io/billboard.js/release/latest/dist/theme/datalab.css
|
101 | - https://naver.github.io/billboard.js/release/latest/dist/theme/datalab.min.css
|
102 |
|
103 | #### dark
|
104 | - https://naver.github.io/billboard.js/release/latest/dist/theme/dark.css
|
105 | - https://naver.github.io/billboard.js/release/latest/dist/theme/dark.min.css
|
106 |
|
107 | #### insight
|
108 | - https://naver.github.io/billboard.js/release/latest/dist/theme/insight.css
|
109 | - https://naver.github.io/billboard.js/release/latest/dist/theme/insight.min.css
|
110 |
|
111 | #### graph
|
112 | - https://naver.github.io/billboard.js/release/latest/dist/theme/graph.css
|
113 | - https://naver.github.io/billboard.js/release/latest/dist/theme/graph.min.css
|
114 |
|
115 | #### modern
|
116 | - https://naver.github.io/billboard.js/release/latest/dist/theme/modern.css
|
117 | - https://naver.github.io/billboard.js/release/latest/dist/theme/modern.min.css
|
118 |
|
119 | </details>
|
120 |
|
121 | ### Nightly version
|
122 |
|
123 | Nightly version is the latest build from the master branch.
|
124 | With nightly, you can try upcoming changes prior the official release.
|
125 |
|
126 | - https://github.com/naver/billboard.js/tree/nightly/dist
|
127 |
|
128 | > [!NOTE]
|
129 | > The version info will be given as the build datetime: `x.x.x-nightly-yyyymmddhhmmss`
|
130 |
|
131 | There're two ways to install from `nightly` branch directly.
|
132 | ```js
|
133 | // Specify on 'package.json' file
|
134 | "dependencies": {
|
135 | ...
|
136 | "billboard.js": "naver/billboard.js#nightly"
|
137 | },
|
138 | ```
|
139 |
|
140 | ```sh
|
141 | # Run install command from shell
|
142 | $ npm install git+https://github.com/naver/billboard.js.git#nightly --save
|
143 | ```
|
144 |
|
145 | ### Next(Release Canditate) version
|
146 |
|
147 | Next version is the 'release candidate' build, prior the latest official release.
|
148 |
|
149 | ```sh
|
150 | # Run install command from shell
|
151 | $ npm install billboard.js@next --save
|
152 | ```
|
153 |
|
154 | ### Installation with npm
|
155 |
|
156 | ```bash
|
157 | $ npm install billboard.js
|
158 | ```
|
159 |
|
160 | ### Packages
|
161 |
|
162 | Name | For | Description
|
163 | :---: | :---:| :---:
|
164 | [![bb][badge-@billboard.js/react]][link-@billboard.js/react] | ![React][badge-react] | React component for billboard.js
|
165 |
|
166 | ### Using CDN
|
167 |
|
168 | If you want to use 'billboard.js' without installation, load files directly from one of the CDN providers.
|
169 |
|
170 | - cdnjs: https://cdnjs.com/libraries/billboard.js
|
171 | - jsDelivr: https://cdn.jsdelivr.net/npm/billboard.js/dist/
|
172 | - unpkg: https://unpkg.com/billboard.js/dist/
|
173 |
|
174 | ## Supported Browsers
|
175 |
|
176 | > [!IMPORTANT]
|
177 | > - Basically will work on all SVG and ES6+ supported browsers.
|
178 | > - <sup>*</sup>Notes for legacy browsers:
|
179 | > - Recommended to use `packaged` build or construct your own build following [`How to bundle for legacy browsers?`](https://github.com/naver/billboard.js/wiki/How-to-bundle-for-legacy-browsers%3F) instruction.
|
180 | > - D3.js dropped the support of legacy browsers since [v6](https://observablehq.com/@d3/d3v6-migration-guide).
|
181 | > - The support isn't fully guaranteed.
|
182 |
|
183 |
|
184 | ## Dependency by version
|
185 |
|
186 | [D3.js](https://d3js.org/) (required)| billboard.js
|
187 | :---: | :---:
|
188 | 4.x ~ 5.x | 1.x ~ 2.x
|
189 | 6.x+ | 3.x+
|
190 |
|
191 | # Getting Started
|
192 |
|
193 | Load billboard.js after D3.js.
|
194 |
|
195 | ```html
|
196 | <!-- 1) Load D3.js and billboard.js separately -->
|
197 | <!-- Load D3: -->
|
198 | <script src="https://d3js.org/d3.v6.min.js"></script>
|
199 |
|
200 | <!-- Load billboard.js with base(or theme) style -->
|
201 | <link rel="stylesheet" href="$YOUR_PATH/billboard.css">
|
202 | <script src="$YOUR_PATH/billboard.js"></script>
|
203 |
|
204 | <!-- 2) or Load billboard.js packaged with D3.js -->
|
205 | <link rel="stylesheet" href="$YOUR_PATH/billboard.css">
|
206 | <script src="$YOUR_PATH/billboard.pkgd.js"></script>
|
207 | ```
|
208 |
|
209 | or use importing ESM.
|
210 | > [!TIP]
|
211 | > 📌 Also check: [How to load as ESM directly from the browser?](https://github.com/naver/billboard.js/wiki/How-to-load-as-ESM-directly-from-the-browser%3F)
|
212 |
|
213 | ```js
|
214 | // 1) import billboard.js
|
215 | // as named import with desired shapes and interaction modules
|
216 | // https://github.com/naver/billboard.js/wiki/CHANGELOG-v2#modularization-by-its-functionality
|
217 | import {bb, area, bar, zoom} from "billboard.js";
|
218 |
|
219 | // or as importing default
|
220 | import bb, {area, bar, zoom} from "billboard.js";
|
221 |
|
222 | // 2) import css if your dev-env supports. If don't, include them via <link>
|
223 | import "billboard.js/dist/billboard.css";
|
224 |
|
225 | // or theme style. Find more themes from 'theme' folder
|
226 | import "billboard.js/dist/theme/insight.css"
|
227 | ```
|
228 |
|
229 | > [!NOTE]
|
230 | > - For migration from C3.js, checkout the [migration guide](https://github.com/naver/billboard.js/wiki/How-to-migrate-from-C3.js%3F).
|
231 | > - If has an issue bundling for legacy browsers, checkout "[How to bundle for legacy browsers?](https://github.com/naver/billboard.js/wiki/How-to-bundle-for-legacy-browsers%3F)".
|
232 |
|
233 | ## Basic usage example
|
234 |
|
235 | #### 1) Create chart holder element
|
236 | ```html
|
237 | <div id="chart"></div>
|
238 | ```
|
239 |
|
240 | #### 2) Generate a chart with options
|
241 | ```js
|
242 | // generate the chart
|
243 | var chart = bb.generate({
|
244 | bindto: "#chart",
|
245 | data: {
|
246 | // for ESM import usage, import 'line' module and execute it as
|
247 | // type: line(),
|
248 | type: "line",
|
249 | columns: [
|
250 | ["data1", 30, 200, 100, 400, 150, 250]
|
251 | ]
|
252 | },
|
253 | zoom: {
|
254 | // for ESM import usage, import 'zoom' module and execute it as
|
255 | // enabled: zoom()
|
256 | enabled: true
|
257 | }
|
258 | });
|
259 |
|
260 | // call some API
|
261 | chart.load( ... );
|
262 | ```
|
263 |
|
264 | ## License
|
265 | billboard.js is released under the [MIT license](https://github.com/naver/billboard.js/blob/master/LICENSE).
|
266 |
|
267 | ```
|
268 | Copyright (c) 2017 ~ present NAVER Corp.
|
269 |
|
270 | Permission is hereby granted, free of charge, to any person obtaining a copy
|
271 | of this software and associated documentation files (the "Software"), to deal
|
272 | in the Software without restriction, including without limitation the rights
|
273 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
274 | copies of the Software, and to permit persons to whom the Software is
|
275 | furnished to do so, subject to the following conditions:
|
276 |
|
277 | The above copyright notice and this permission notice shall be included in
|
278 | all copies or substantial portions of the Software.
|
279 |
|
280 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
281 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
282 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
283 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
284 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
285 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
286 | THE SOFTWARE.
|
287 | ```
|
288 |
|
289 |
|
290 | [badge-download]: https://img.shields.io/npm/dm/billboard.js.svg?style=flat
|
291 | [badge-jsDelivr]: https://data.jsdelivr.com/v1/package/npm/billboard.js/badge?style=rounded
|
292 | [badge-ci-status]: https://github.com/naver/billboard.js/workflows/CI/badge.svg
|
293 | [badge-coverage]: https://coveralls.io/repos/github/naver/billboard.js/badge.svg?branch=master&v1
|
294 | [badge-snyk]: https://snyk.io/test/github/naver/billboard.js/badge.svg?targetFile=package.json
|
295 | [badge-gzip-size]: https://img.badgesize.io/https://unpkg.com/billboard.js/dist/billboard.min.js?compression=gzip
|
296 | [badge-latest]: https://img.shields.io/npm/v/billboard.js/latest.svg
|
297 | [badge-next]: https://img.shields.io/npm/v/billboard.js/next.svg
|
298 | [badge-semantic-release]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
|
299 | [badge-react]: https://img.shields.io/badge/React-20232A?style=flat&logo=react&logoColor=fff&labelColor=grey&color=62d9fb
|
300 | [badge-@billboard.js/react]: https://img.shields.io/npm/v/@billboard.js/react?style=flat&labelColor=grey&label=%40billboard.js%2Freact
|
301 |
|
302 |
|
303 | [link-download]: https://npm-stat.com/charts.html?package=billboard.js&from=2017-06-08
|
304 | [link-jsDelivr]: https://www.jsdelivr.com/package/npm/billboard.js
|
305 | [link-version]: https://www.npmjs.com/package/billboard.js
|
306 | [link-coverage]: https://coveralls.io/github/naver/billboard.js?branch=master
|
307 | [link-snyk]: https://snyk.io/test/github/naver/billboard.js?targetFile=package.json
|
308 | [link-gzip-size]: https://unpkg.com/billboard.js/dist/billboard.min.js
|
309 | [link-semantic-release]: https://github.com/semantic-release/semantic-release
|
310 | [link-@billboard.js/react]: https://www.npmjs.com/package/@billboard.js/react
|
311 |
|
312 | [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnaver%2Fbillboard.js.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fnaver%2Fbillboard.js?ref=badge_large)
|