We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
echart.js是一款超级强大的图表制作插件,可以满足我们展示业务数据,如柱形图,饼状图,折线图,仪表图等,因为这次项目内大量地方用到数据展示,所以引入了echart.js插件用于制作图表,先总结下开发的时候遇到的小问题
首先引入echarts.js,使用npm install --save echarts
定制组件,因为复用的地方比较多,所以抽出来成了组件,共封装了四个组件,折线图,柱状图,饼状图,仪表图,封装这四个组件的方法类似
按需引入,因为echarts的组件较多导致文件较大,所以这里需要使用什么就引入什么,bar柱状图,gauge仪表盘,line折线图,pie饼状图 const echarts = require('echarts/lib/echarts'); // 引入echarts主模块 require('echarts/lib/chart/bar'); // 引入柱状图 require('echarts/lib/component/tooltip'); // 引入提示框 require('echarts/lib/component/title'); // 引入标题组件 require('echarts/theme/macarons'); // echarts 主题
const echarts = require('echarts/lib/echarts'); // 引入echarts主模块 require('echarts/lib/chart/bar'); // 引入柱状图 require('echarts/lib/component/tooltip'); // 引入提示框 require('echarts/lib/component/title'); // 引入标题组件 require('echarts/theme/macarons'); // echarts 主题
柱状图通过xAxis,与yAxis的type属性的值来决定哪个是类目轴哪个是数值轴,category类目轴,value表示数值轴 xAxis: { // type参数决定那个是类目轴哪个是数值轴 type: this.isShowX ? 'category' : 'value', }, yAxis: { type: this.isShowX ? 'value' : 'category', },
xAxis: { // type参数决定那个是类目轴哪个是数值轴 type: this.isShowX ? 'category' : 'value', },
yAxis: { type: this.isShowX ? 'value' : 'category', },
怎样让echart.js制作出来的图表随着浏览器的窗口大小的变化而变化
window.addEventListener('resize', this.chart.resize)
window.removeEventListener('resize', this.chart.resize);
怎么去动态设置图表的值,让图表随着后端请求来的值进行实时更新
柱状图,折线图不显示坐标轴,通过设置xAxis,yAxis下的axisLine,不显示背景色通过设置xAxis,yAxis下的splitLine与splitArea
legend属性用于设置切换索引
开发效果图
echart.js的使用不难,难的时配置参数的查找;
封装有该组件的项目地址
参考链接 http://echarts.baidu.com/option.html#series
The text was updated successfully, but these errors were encountered:
No branches or pull requests
echart.js是一款超级强大的图表制作插件,可以满足我们展示业务数据,如柱形图,饼状图,折线图,仪表图等,因为这次项目内大量地方用到数据展示,所以引入了echart.js插件用于制作图表,先总结下开发的时候遇到的小问题
首先引入echarts.js,使用npm install --save echarts
定制组件,因为复用的地方比较多,所以抽出来成了组件,共封装了四个组件,折线图,柱状图,饼状图,仪表图,封装这四个组件的方法类似
按需引入,因为echarts的组件较多导致文件较大,所以这里需要使用什么就引入什么,bar柱状图,gauge仪表盘,line折线图,pie饼状图
const echarts = require('echarts/lib/echarts'); // 引入echarts主模块 require('echarts/lib/chart/bar'); // 引入柱状图 require('echarts/lib/component/tooltip'); // 引入提示框 require('echarts/lib/component/title'); // 引入标题组件 require('echarts/theme/macarons'); // echarts 主题
柱状图通过xAxis,与yAxis的type属性的值来决定哪个是类目轴哪个是数值轴,category类目轴,value表示数值轴
xAxis: { // type参数决定那个是类目轴哪个是数值轴 type: this.isShowX ? 'category' : 'value', },
yAxis: { type: this.isShowX ? 'value' : 'category', },
怎样让echart.js制作出来的图表随着浏览器的窗口大小的变化而变化
window.addEventListener('resize', this.chart.resize)
window.removeEventListener('resize', this.chart.resize);
,注意要在this.chart.dispose();之前注销怎么去动态设置图表的值,让图表随着后端请求来的值进行实时更新
柱状图,折线图不显示坐标轴,通过设置xAxis,yAxis下的axisLine,不显示背景色通过设置xAxis,yAxis下的splitLine与splitArea
legend属性用于设置切换索引
开发效果图

echart.js的使用不难,难的时配置参数的查找;
封装有该组件的项目地址
参考链接
http://echarts.baidu.com/option.html#series
The text was updated successfully, but these errors were encountered: