console
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>ECharts</title>
</head>
<body>
<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
<div id="main" style="width: 100%;height:600px;"></div>
<script type="text/javascript">
var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
var option;
var defaultV1 = 1600
var defaultV2 = 600
option = {
title: {
text: 'Stacked Area Chart'
},
// grid: {
// left: '3%',
// right: '4%',
// bottom: '3%',
// containLabel: true
// },
xAxis: [
{
show:false,
type: 'category',
boundaryGap: false,
axisLabel: {
show: false, // 隐藏 x 轴刻度标签
},
axisLine: {
show: false, // 如果还需要隐藏 x 轴线,可以设置此属性
},
axisTick: {
show: false, // 如果还需要隐藏 x 轴刻度线,可以设置此属性
},
}
],
yAxis: [
{
show:false,
type: 'value'
}
],
series: [
{
z:2,
name: 'Email',
type: 'line',
stack: 'Total',
data: [
[1, defaultV1],
[2, defaultV1],
[3, defaultV1],
[4, defaultV2],
[5, defaultV2],
[6, defaultV2],
[7, defaultV2],
[8, defaultV1],
[9, defaultV1],
[10, defaultV1]
],
tooltip: {
show: false
},
// smooth: true, // 平滑
showSymbol: false, //隐藏点
lineStyle: {
width: 0
},
areaStyle: {
opacity: 1.6,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgb(228, 202, 160)'
},
{
offset: 1,
color: 'rgb(197, 173, 76)'
}
])
}
},
{
z:1,
name: 'Email',
type: 'line',
stack: 'Total1',
tooltip: {
show: false
},
showSymbol: false, //隐藏点
areaStyle: {
opacity: 0.9,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgb(47, 109, 200)'
},
{
offset: 1,
color: 'rgb(86, 169, 251)'
}
])
},
data: [
[1, 600],
[9, 600],
]
},
]
};
option && myChart.setOption(option);
</script>
</body>
</html>