2 Star 2 Fork 0

joylei / riot-echarts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

riot-echarts

a no-brainer riot tag to display charts easily with Baidu ECharts, like Google Chart does.

riot-echarts demo

Features

  • 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)

usage

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.

riot echart tag supported attributes

simple attribute

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 attribute

option={}

You can provide ECharts option directly by this attribute. see docs of ECharts for usages.

Plans

  • add more chart types

  • make DataTable headers more meaningful for chart types and other informations

  • make it extensible for custom chart types

License

MIT

The MIT License (MIT) Copyright (c) 2016 Liu Lei Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

a no-brainer riot tag to display charts easily with Baidu ECharts, like Google Chart does 展开 收起
TypeScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
TypeScript
1
https://gitee.com/wowin/riot-echarts.git
git@gitee.com:wowin/riot-echarts.git
wowin
riot-echarts
riot-echarts
master

搜索帮助