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>

代码结果:

相关推荐
数字新视界38 分钟前
U位资产管理系统助力数字化资产监管与提升效率
大数据·人工智能·数据中心·微模块机房·模块化机房
砚底藏山河41 分钟前
容错重试与指数退避:网络抖动手抖不再丢数据(魔码量化实战 #04)
java·数据库·python·金融
2501_930472441 小时前
云安全自查清单:用腾讯云助手 30 分钟完成一次权限与密钥体检
java·腾讯云
蓝速科技1 小时前
会议室门牌触控预约选型与落地实战指南丨蓝速科技
大数据·运维·数据库·人工智能·科技
蓝速科技1 小时前
企业展厅数字人导览效果提升与选型实战指南丨蓝速科技
大数据·运维·数据库·人工智能·科技·microsoft
大大大大晴天2 小时前
大数据数据治理体系建设:从平台能力到组织闭环的完整蓝图
大数据
letisgo52 小时前
JAVA 高级进阶05篇《Spring容器机制:Bean生命周期与三级缓存全解》
java·spring·面试·ioc·源码分析
岁月如歌77862 小时前
分布式锁完全指南:从数据库到 Redisson 的演进
java·后端·架构
AI深栈2 小时前
第 8 章 · Tool Calling 与 Tool Search
java·人工智能
写后端的胖头鱼2 小时前
【高频面试题】spring事物失效场景(带原理 + 代码示例)
java·后端·spring·事务·事物失效