# eCharts + AngularJS
AngularJS directives to use [eCharts](http://ecomfe.github.io/echarts/index-en.html)
## Prerequisites
You will need the following things properly installed on your computer.
* [Node.js](http://nodejs.org/) (with NPM) and [Bower](http://bower.io/)
## Building
- Preparing
`bower install` & `npm install`
- default
`gulp`
> develop with realtime monitor, automatic open browser to view example
- build
`gulp build`
> Build file to dist
- publish
`gulp publish`
> Build & bump npm versions
## Usage
Install bower dependency and save for production
```
$ bower install angular-echarts --save
```
Inject echarts and angular-echarts file into page
```
<script src="path/to/bower_components/echarts/build/dist/echarts-all.js"></script>
<script src="path/to/bower_components/angular-echarts/dist/angular-echarts.min.js"></script>
```
Add dependency and declare a demo controller
```
var app = angular.module('demo', ['angular-echarts']);
app.controller('LineChartController', function ($scope) {
var pageload = {
name: 'page.load',
datapoints: [
{ x: 2001, y: 1012 },
{ x: 2002, y: 1023 },
{ x: 2003, y: 1045 },
{ x: 2004, y: 1062 },
{ x: 2005, y: 1032 },
{ x: 2006, y: 1040 },
{ x: 2007, y: 1023 },
{ x: 2008, y: 1090 },
{ x: 2009, y: 1012 },
{ x: 2010, y: 1012 },
]
};
var firstPaint = {
name: 'page.firstPaint',
datapoints: [
{ x: 2001, y: 22 },
{ x: 2002, y: 13 },
{ x: 2003, y: 35 },
{ x: 2004, y: 52 },
{ x: 2005, y: 32 },
{ x: 2006, y: 40 },
{ x: 2007, y: 63 },
{ x: 2008, y: 80 },
{ x: 2009, y: 20 },
{ x: 2010, y: 25 },
]
};
$scope.config = {
title: 'Line Chart',
subtitle: 'Line Chart Subtitle',
debug: true,
showXAxis: true,
showYAxis: true,
showLegend: true,
stack: false,
};
$scope.data = [ pageload ];
$scope.multiple = [pageload, firstPaint ];
});
```
Use this markup for a quick demo
```
<div class="col-md-3" ng-controller="LineChartController">
<line-chart config="config" data="data"></line-chart>
<line-chart config="config" data="multiple"></line-chart>
</div>
```
## Contribute
* `git clone git@github.com:wangshijun/angular-echarts.git`
* change into the new directory
* `npm install`
* `bower install`
### __Running / Development__
* open ```docs/index.html``` in browser
> Or you can use `gulp server` and visit `http://localhost:8080` in Chrome browser, to avoid `XMLHttpRequest Cross origin requests` error.
Angularjs-echarts 点击事件
需积分: 50 81 浏览量
2016-03-20
11:10:20
上传
评论 2
收藏 20KB 7Z 举报
WW.SS
- 粉丝: 1
- 资源: 4
最新资源
- 已过基于Hadoop+Spark招聘推荐可视化系统 大数据项目 毕业设计(源码下载)
- python爬虫开发题答案及题目-100(1).zip
- Python 小游戏 (贪吃蛇、五子棋、扫雷、俄罗斯方块)-3 (2).zip
- c语言实现的数独小游戏.zip
- 高德地图中国行政区划省、市、县经纬度
- March 2024 Expiration Of The OAM Out Of The Box Certificates
- 二叉搜索树迭代器(java代码).docx
- 解决keil MDK 5.38版本 在Debug配置使用STlink调试时软件闪退的问题
- py小项目:用户登录和注册系统开发欢迎图片
- TCCEE-x64-v6.2.3(9.51)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈