The problem of introducing echart to call its graphic method to report an error in a vue project

index.js introduces echart
clipboard.png
echart


clipboard.png

the console mistakenly reported that graphic is not defined. May I ask what went wrong

?
Mar.15,2021

1. First register the prototype chain in main, that is, Vue.prototype.$echarts = echarts
2. Use color: new this.$echarts.graphic.LinearGradient to call


you can try to rewrite color: new echarts.graphic.LinearGradient in this way


have you solved


after the main.js reference, you should also call import echarts from "echarts" on the page, which can set the shadow gradient on the page.


normal: {
color: function (params) {
return {
colorStops: [{
offset: 0, / / the starting position of the color
color:'- sharp29facb' / / 0% color
}, {
offset: 0.6, / / Color ending
color:'- sharp17a7fd' / / 100% Color
}]
}

Menu