https://github.com/geekplux/markvis-pie
Pie chart generator for markvis in browser and node.js.
https://github.com/geekplux/markvis-pie
d3 d3-node markvis visualization
Last synced: 7 months ago
JSON representation
Pie chart generator for markvis in browser and node.js.
- Host: GitHub
- URL: https://github.com/geekplux/markvis-pie
- Owner: geekplux
- License: mit
- Created: 2017-07-07T17:58:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-09-16T03:26:06.000Z (over 2 years ago)
- Last Synced: 2025-06-05T18:05:36.530Z (8 months ago)
- Topics: d3, d3-node, markvis, visualization
- Language: JavaScript
- Homepage:
- Size: 1.11 MB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## PieChart
> Pie chart generator for [markvis](https://github.com/geekplux/markvis) in browser and node.js.
[](https://npmjs.com/package/markvis-pie) [](https://npmjs.com/package/markvis-pie) [](https://travis-ci.org/geekplux/markvis-pie) [](https://coveralls.io/github/geekplux/markvis-pie) [](https://geekplux.github.io/donate)
## Install
```bash
npm install markvis-pie --save
or use yarn
yarn add markvis-pie --save
```
## Usage
```js
const markvisPie = require('markvis-pie');
const pie = markvisPie({ data, d3, d3node })
```
Check out the [example](./example) for usage.
#### Output the visualization result to a image
```
npm run example
```
#### Output Preview (png):

## API
### markvisPie({ data, d3, d3node[, selector, container, style] })
### options
#### data
- Type: `Array`
Data from file or web processed by d3 library.
##### d3
- Type: `Object`
[d3](https://github.com/d3/d3) library which used in **browser** environment.
##### d3node
- Type: `Object`
[d3-node](https://github.com/d3-node/d3-node) constructor which used in **node** environment.
##### selector
- Type: `String`
- Default: `'#chart'`
DOM selector in container.
##### container
- Type: `String`
- Default: `
Pie Chart
`
DOM contained the visualization result.
##### style
- Type: `String`
- Default:
```html
.arc text {
font: 10px sans-serif;
text-anchor: middle;
}
.arc path {
stroke: #fff;
}
```
Pie chart style.
##### width
- Type: `Number`
- Default: `960`
SVG width for pie chart.
##### radius
- Type: `Number`
- Default: `width / 2 * 0.9`
Radius for pie chart.
##### export
- Type: `boolean`
- Default: `false`
Whether to export to a PNG image.
## Contributing
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D
### LICENSE
**markvis-pie** © [geekplux](https://github.com/geekplux), Released under the [MIT](./LICENSE) License.
Authored and maintained by geekplux with help from contributors ([list](https://github.com/geekplux/markvis/contributors)).
> [geekplux.com](http://geekplux.com) · GitHub [@geekplux](https://github.com/geekplux) · Twitter [@geekplux](https://twitter.com/geekplux)