ECharts图表图例4

jave

用eclipse软件

代码:

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<!-- 引入ECharts脚本 -->

<script src="js/echarts.js"></script>

<title>绘制堆积面积图</title>

</head>

<body>

<div id="main" style="width: 600px; height: 400px"></div>

<script type="text/javascript">

var myChart = echarts. init(document. getElementById("main"));

var option= {

title:{

text:"堆积面积图",

textStyle:{

color:'green',

},

left:20,

top:3

},

tooltip:{

trigger:'axis'

},

legend:{

data:['手机','冰箱','空调','电视','其他'],

left:160,

top:3

},

toolbox:{

show:true,

orient:'vertical',

feature:{

mark:{show:true}

dataView:{show:true,resdOnly:false},

magicType:{show:true,type:['line','bar','stack','tiled']},

restore:{show:true},

saveAsImage:{show:true}

},

top:52,

left:550

},

calculable:true,

xAxis:[

{

type:'category',

boundaryGap:false,

data:['周一','周二','周三','周四','周五','周六','周日']

}

],

yAxis:[

{

type:'value'

}

],

series:[

{

name:'手机',

type:'line',

stack:'总量',

color:'rgb(0,0,0)',

itemStyle:{

normal:

{

}

},

data:[434,345,456,222,333,444,432]

},

{

name:'冰箱',

type:'line',

stack:'总量',

color:'blue',

itemStyle:{

normal:{

}

},

data:[420,282,391,344,390,530,410]

},

{

name:'空调',

type:'line',

stack:'总量',

color:'green',

itemStyle:{

normal:{

}

},

data:[350,332,331,334,390,320,340]

},

{

name:'电视',

type:'line',

stack:'总量',

color:'green',

itemStyle:{

normal:{

}

},

data:[420,222,333,442,230,430,430]

},

{

name:'其他',

type:'line',

stack:'总量',

color:'#FA8072';,

itemStyle:{

normal:{

}

},

data:[330,442,432,555,456,666,877]

}

]

};

myChart.setOption(option);

</script>

</body>

</html>

代码结果:

相关推荐
BestAns7 小时前
一文带你吃透 Java 反射机制
java·后端
wasp5207 小时前
AgentScope Java 核心架构深度解析
java·开发语言·人工智能·架构·agentscope
智算菩萨7 小时前
高效多模态大语言模型:从统一框架到训练与推理效率的系统化理论梳理
大数据·人工智能·多模态
2501_916766548 小时前
【Springboot】数据层开发-数据源自动管理
java·spring boot·后端
hzp6668 小时前
新兴存储全景与未来架构走向
大数据·大模型·llm·aigc·数据存储
自在极意功。8 小时前
MyBatis 动态 SQL 详解:从基础到进阶实战
java·数据库·mybatis·动态sql
软件管理系统8 小时前
基于Spring Boot的便民维修管理系统
java·spring boot·后端
INFINI Labs8 小时前
Easy-Es 2.1.0-easysearch 版本发布
大数据·elasticsearch·搜索引擎·easysearch·easy-es
百***78759 小时前
Step-Audio-2 轻量化接入全流程详解
android·java·gpt·php·llama