简介
roughViz.js是可重用的JavaScript库,用于基于D3v5,roughjs和handy在浏览器中创建粗略/手绘样式的图表。
github 地址:
https://github.com/jwilber/roughViz
github star:1.4K+
最新版本:1.0.3,MIT 协议
主要特性
柱状图水平柱状图甜甜圈图线图饼图散射图特效截图
柱状图
圆图
圈图
快速上手
安装
通过CDN:
<script src="https://unpkg.com/rough-viz@1.0.2"></script>通过npm:
npm install rough-vizReact Rough
npm install react-roughvizhtml:
<!--you can name each id whatever you want --><p id="viz0"></p><p id="viz1"></p>js:
// create donut chart from csv file, using default options new roughViz.Bar({ element: #vis0, // container selection data: https://raw.githubusercontent.com/jwilber/random_data/master/flavors.csv, labels: flavor, values: price});// create Donut chart using defined data & customize plot optionsnew roughViz.Donut( { element: #vis1, data: { labels: [North, South, East, West], values: [10, 5, 8, 3] }, title: "Regions", width: window.innerWidth / 4, roughness: 8, colors: [red, orange, blue, skyblue], stroke: black, strokeWidth: 3, fillStyle: cross-hatch, fillWeight: 3.5, });PS
如果需要更详细用法,自行去官网了解。