a no-brainer riot tag to display charts easily with Baidu ECharts, like Google Chart does.
take advantage of ECharts
easy to present data with a DataTable structure. You'll feel familiar with this if you have used Google Charts,
friendly to SQL queries(no row-column transforms)
import ECharts or use CDN
https://cdn.bootcss.com/echarts/3.3.2/echarts.min.js
install riot-echarts
npm install riot-echarts --save
import riot-echarts
import 'riot-echarts'
<app>
<p>chart</p>
<echart simple="{ option }"></echart>
<script>
this.option = {type:'pie',
data: [
['name', 'value'],
['a', 10],
['b', 20],
['c', 25],
['d', 15],
['e', 55]
]
}
</script>
<style>
echart {
display:block;
width: 100%;
height: 500px;
}
</style>
</app>
Note: the container of charts must be visible and have determined height and width before chart rendering.
For more information, see example.
simple={type:string, data, color:Array<string>}
type: pie | bar | line
data:
can be an array, first line of which are columns
can be can DataTable object
can be an thenable object, which eventually be resolved to an array or DataTable
can be an function that returns array,DataTable or thenable
can be an function that accept an callback and eventually be resolved to an array or DataTable
color: color sheets, if not provided will use built-in ones
option={}
You can provide ECharts option directly by this attribute. see docs of ECharts for usages.
add more chart types
make DataTable headers more meaningful for chart types and other informations
make it extensible for custom chart types
MIT
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型