javascript - vue-echarts-v3使用的过程中折线图区域呈渐变色。
问题描述
这是我的图表数据
我希望红色部分是渐变色。我已经使用了visvisualMap的方法,并不能达到我想要的效果。当我使用new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0, color: ’rgb(255, 158, 68)’}, { offset: 1, color: ’rgb(255, 70, 131)’}])。。。我找到的其中一种方法,。。但是不知道怎么获取echarts对象,
由于不想在项目中引入过多的资源,所以引入zRender暂时不在考虑范围之内。。。 求助希望解决vue-echarts-v3插件使用是,获取new echarts.graphic.LinearGradient()的办法
<IEcharts :option='bar' class='step_echarts'></IEcharts
import IEcharts from ’vue-echarts-v3’import ’echarts/lib/chart/line’
export defalut{data(){
return{ bar: { tooltip: {}, xAxis: {data: [’1泡’, ’2泡’, ’3泡’, ’4泡’, ’5泡’],axisTick:{ alignWithLabel:true} }, yAxis: {show:false }, series: [{name: ’Clouds’,type: ’line’,data: [5, 7, 13, 20, 30],areaStyle: {normal:{}} }]} }}
}}
问题解答
回答1:我随便写了三个颜色。
series: [{name: ’Clouds’,type: ’line’,data: [5, 7, 13, 20, 30],areaStyle: {normal:{}},itemStyle: {normal: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1,[ {offset: 0, color: ’red’}, {offset: 0.5, color: ’pink’}, {offset: 1, color: ’#ddd’}] )} }}]

楼上说的对,你要想要渐变,你就要给他设置图例,告诉它从哪渐变到哪,要不然用的是默认的颜色
相关文章:
1. javascript - vue组件通过eventBus通信时,报错a.$on is not a function2. python3.x - python3.5.2安装时make报错求助3. html - vue项目中用到了elementUI问题4. javascript - 在使用 vue.js element ui的时候 怎么样保留table翻页后check的值?5. mysql_replication - mysql读写分离时如果单台写库也无法满足性能怎么解决6. ionic 项目 ionic build android -release 打包时报错7. linux - ubuntu 命令行中文 显示菱形,期望通过引入字体解决而不是zhcon这种方式8. angular.js - 如何控制ngrepeat输出的个数9. mac里的docker如何命令行开启呢?10. python - 如何用pandas处理分钟数据变成小时线?

网公网安备