官方給的案例中,顏色都能正常顯示:
https://echarts.apache.org/examples/zh/editor.html?c=area-basic
可我做了一些嘗試都不能顯示顏色!
// const option = { // xAxis: { // type: "category", // data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] // }, // yAxis: {}, // series: [{ // type: "line", // smooth:true, // areaStyle: {} // areaStyle:{ // color:"red" // }, // // areaStyle:{ // // color: { // // type: 'linear', // // x: 0, // // y: 0, // // x2: 0, // // y2: 1, // // colorStops: [{ // // offset: 0, color: 'red' // 0% 處的顏色 // // }, { // // offset: 1, color: 'white' // 100% 處的顏色 // // }], // // global: false // 缺省爲 false // // } // // } ,
// data: [820, 932, 901, 934, 1290, 1330, 1320], // }] // }
會不會是版本問題?
package.json 查看版本爲 "echarts": "^3.8.5",