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. python - Django內使用filter過濾時間,只認年份不認月份是怎么回事?2. centos7 編譯安裝 Python 3.5.1 失敗3. 人工智能 - python 機器學習 醫療數據 怎么學4. c++ - 請問MySQL_Connection::isReadOnly 怎么解決?5. python - 能通過CAN控制一部普通的家用轎車嗎?6. mysql優化 - 關于mysql分區7. css3 - 微信前端頁面遇到的transition過渡動畫的bug8. mysql - 分庫分表、分區、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處9. python - beautifulsoup獲取網頁內容的問題10. Python爬蟲如何爬取span和span中間的內容并分別存入字典里?
