使用Echarts过程中问题小结
来源:互联网 发布:oracle调用java http 编辑:程序博客网 时间:2024/05/21 19:32
Echarts简单易上手,官网简洁明了,但使用过程中遇到几个特殊需求,解决时耗时较长,特此记录。
1. echarts点击作用域问题
ECharts 支持常规的鼠标事件类型,包括
‘click’、’dblclick’、’mousedown’、’mousemove’、’mouseup’、’mouseover’、’mouseout’ 事件。
Click示例:
// 处理点击事件并且跳转到相应的百度搜索页面
myChart.on('click', function (params) { window.open('https://www.baidu.com/s?wd=' + encodeURIComponent(params.name));});
params,这是一个包含点击图形的数据信息的对象
具体参阅官网
点击柱状图非数据区域:
(参考官网柱状图第三个示例:)
series: [ { // For shadow type: 'bar', itemStyle: { normal: {color: 'rgba(0,0,0,0.05)'} }, barGap:'-100%', barCategoryGap:'40%', data: dataShadow, animation: false }, { type: 'bar', itemStyle: { normal: { color: new echarts.graphic.LinearGradient( 0, 0, 0, 1, [ {offset: 0, color: '#83bff6'}, {offset: 0.5, color: '#188df0'}, {offset: 1, color: '#188df0'} ] ) }, emphasis: { color: new echarts.graphic.LinearGradient( 0, 0, 0, 1, [ {offset: 0, color: '#2378f7'}, {offset: 0.7, color: '#2378f7'}, {offset: 1, color: '#83bff6'} ] ) } }, data: data }
解决思路:添加透明层,覆盖想要点击区域,可响应点击事件。
2、滚动图例
官网案例:
legend: { type: 'scroll', orient: 'vertical', right: 10, top: 20, bottom: 20, data: data.legendData},
只要添加 type: ‘scroll’,即可
注意事项:V3.7.0之后才有此功能,因为版本不对,浪费了许多时间调试
3、showLoading
在echarts上显示和隐藏loading效果
myChart.showLoading({ text: '数据获取中', effect: 'whirling' });myChart.hideLoading();
阅读全文
0 0
- 使用Echarts过程中问题小结
- 使用Echarts过程中遇到的问题
- ECharts的简单使用过程
- react中使用echarts
- vuejs中使用echarts
- React中使用ECharts
- angular中使用ECharts
- webpack中使用echarts
- 测试过程中遇到字符集问题小结
- horizontalscrollview的使用过程问题小结
- 记录在使用react-native-echarts中遇到的问题
- 使用oracle存储过程中出错小结
- echarts中toolbox乱码问题
- Android项目中使用echarts
- vue项目中使用echarts
- 在 webpack 中使用 ECharts
- Extjs中使用Echarts(自适应)
- Vue.js中,使用echarts
- java的优先队列注意事项
- ORA-12560: TNS: 协议适配器错误
- 江苏淳客网络在第五届“创响江苏 赢在南京”创业大赛中获得一等奖!
- 生产者和消费者问题c++(操作系统)
- 收集一些工作中常用的经典SQL语句
- 使用Echarts过程中问题小结
- Java题目详解
- IOS开发中利用AudioToolbox播放系统声音
- playframework在intelij idea中的debug调试方法
- 如何通过adb 获取应用的版本号
- 22、Selenium + Python 实现 UI 自动化测试-操作日期时间控件
- 解决arcgis desktop 添加 arcgis server 提示无法连接问题
- WebAPI HelpPage出现Failed to generate the sample for media type 'application/x-www-form-urlencoded'. 错
- github上实用、常用的插件和库