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. 在mybatis使用mysql的ON DUPLICATE KEY UPDATE語法實現存在即更新應該使用哪個標簽?2. 哭遼 求大佬解答 控制器的join方法怎么轉模型方法3. mysql儲存json錯誤4. mysql - 怎么生成這個sql表?5. mysql - 數據庫表中,兩個表互為外鍵參考如何解決6. Navicat for mysql 中以json格式儲存的數據存在大量反斜杠,如何去除?7. sql語句 - 如何在mysql中批量添加用戶?8. mysql - 表名稱前綴到底有啥用?9. 編輯成功不顯示彈窗10. 怎么php怎么通過數組顯示sql查詢結果呢,查詢結果有多條,如圖。
