请问,用wix网页 想嵌入html 把echarts图表弄进去 咋嵌入?

img


下面是我在wix嵌入里输入的代码 求指教 显示不出来表格

myChart = echarts.init(document.getElementBYId('main'))
option = {
title: {
text: '',
subtext: ''
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
toolbox: {
show: true,
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
// prettier-ignore
data: ['-30', '-25', '-23', '-20', '-18', '-15', '-13', '-10', '-5', '0', '3', '5', '8', '10', '15', '20', '25', '30', '35', '40']
},
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value} '
},
axisPointer: {
snap: true
}
},
visualMap: {
show: false,
dimension: 0,
pieces: [
{
lte: 8,
color: 'green'
},
{
gt: 8,
lte: 9,
color: 'red'
},
{
gt: 9,
lte: 10,
color: 'green'
},
{
gt: 10,
lte: 13,
color: 'red'
},
{
gt: 13,
color: 'green'
}
]
},
series: [
{
name: '2019',
type: 'line',
smooth: true,
// prettier-ignore
data: [, 4.3, 4.5, 4.5, 4.3, 4.1, 4.3, 4.1, 4.3, 4, 4.8, 4.3, 4.5, 4.1, 4.5, 4, 4.8, 4.5, 4.3, 4.8],
markArea: {
itemStyle: {
color: 'rgba(255, 173, 177, 0.4)'
},
data: [
[
{
name: '钟南山院士首次声明疫情“人传人”',
xAxis: '-5'
},
{
xAxis: '0'
}
],
[
{
name: '工作革命',
xAxis: '3'
},
{
xAxis: '10'
}
]
]
}
},
{
name: '2020',
type: 'line',
smooth: true,
data: [, 4.8, 5.3, 5.2, 5.3, 4.8, 5.3, 5.2, 5.4, 4, 3, 2.5, 2.3, 2.1, 2.1, 2.3, 2.8, 2.9, 3.6, 3.9],
markArea: {
itemStyle: {
color: 'rgba(255, 173, 177, 0.4)'
},
}

根据我的经验 应该是 没有输出 位置导致的!
html 中要有 渲染的容器 myChart = echarts.init(document.getElementBYId('main')) main 指的是容器 ID

img

比如


```html
<div id="main" style="height:400px; width:100%;"></div> 

 必须要加高度
 // 使用刚指定的配置项和数据显示图表。
  myChart.setOption(option);