javascript - vue-echarts-v3使用的過程中折線圖區(qū)域呈漸變色。
問題描述
這是我的圖表數據
我希望紅色部分是漸變色。我已經使用了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. css - 如何控制鼠標事件?當處于down時會觸發(fā)其他效果,而up的時候則會取消所有效果?2. 求助一個Android控件名稱3. vim - docker中新的ubuntu12.04鏡像,運行vi提示,找不到命名.4. IOS app應用軟件的id號怎么查詢?比如百度貼吧的app-id=4779278135. css - 關于offsetLeft和offsetTop6. javascript - video標簽無法識別的視頻格式怎么辦?7. python - flask的errorhandler(BaseError)重寫方法后怎么獲得更多信息8. html5 - mui dialog 如何配置type屬性9. javascript - 微信內置瀏覽器的ua是多少?10. html5 - 小程序的swiper那個點可以給他居右?
