一个比较正确的使用方法:https://github.com/xieziyu/ngx-echarts
1、
npm install echarts --save
npm install ngx-echarts --save
如果网速差,可以使用淘宝镜像
2、项目中.angular-cli.json 中添加echarts
{
"scripts": [
// ...
// add this:
"../node_modules/echarts/dist/echarts.min.js" // or echarts.js for debug purpose
],
}
3、在module 中调用
import { AngularEchartsModule } from 'ngx-echarts';
@NgModule({
imports: [
...,
AngularEchartsModule
],
...
})
export class AppModule { }
4、html中
<div echarts [options]="chartOption" class="demo-chart"></div>
5、chartOption就是option
6、事件方法
chartClick
: It emits the sameparams
of'click'
eventchartDblClick
: It emits the sameparams
of'dblclick'
eventchartMouseDown
: It emits the sameparams
of'mousedown'
eventchartMouseUp
: It emits the sameparams
of'mouseup'
eventchartMouseOver
: It emits the sameparams
of'mouseover'
eventchartMouseOut
: It emits the sameparams
of'mouseout'
eventchartGlobalOut
: It emits the sameparams
of'globalout'
eventchartContextMenu
: It emits the sameparams
of'contextmenu'
event (since v1.2.1)chartDataZoom
: It emits the sameparams
of'dataZoom'
event (thanks to averhaegen)
版权声明:本文为博主原创文章,未经博主允许不得转载。