先看效果:
配置:
option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['default','Step End', 'Step Middle', 'Step Start','Smooth']
},
series: [
{
name: 'default',
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line'
},
{
name: 'Step End',
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line',
step: 'end',
},
{
name: 'Step Middle',
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line',
step: 'middle',
},
{
name: 'Step Start',
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line',
step: 'start',
},
{
name: 'Smooth',
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line',
smooth: true
}
]
};
完整代码:
<!--
THIS EXAMPLE WAS DOWNLOADED FROM https://echarts.apache.org/examples/zh/editor.html?c=line-simple
-->
<!DOCTYPE html>
<html style="height: 100%">
<head>
<meta charset="utf-8">
</head>
<body style="height: 100%; margin: 0">
<div id="container" style="height: 100%"></div>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5.2.2/dist/echarts.min.js"></script>
<!-- Uncomment this line if you want to dataTool extension
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5.2.2/dist/extension/dataTool.min.js"></script>
-->
<!-- Uncomment this line if you want to use gl extension
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script>
-->
<!-- Uncomment this line if you want to echarts-stat extension
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script>
-->
<!-- Uncomment this line if you want to use map
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5.2.2/map/js/china.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5.2.2/map/js/world.js"></script>
-->
<!-- Uncomment these two lines if you want to use bmap extension
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=<Your Key Here>"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@{{version}}/dist/extension/bmap.min.js"></script>
-->
<script type="text/javascript">
var dom = document.getElementById("container");
var myChart = echarts.init(dom);
var app = {};
var option;
option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['default','Step End', 'Step Middle', 'Step Start','Smooth']
},
series: [
{
name: 'default',
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line'
},
{
name: 'Step End',
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line',
step: 'end',
},
{
name: 'Step Middle',
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line',
step: 'middle',
},
{
name: 'Step Start',
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line',
step: 'start',
},
{
name: 'Smooth',
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line',
smooth: true
}
]
};
if (option && typeof option === 'object') {
myChart.setOption(option);
}
</script>
</body>
</html>
本文分享自 传输过程数值模拟学习笔记 微信公众号,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文参与 腾讯云自媒体同步曝光计划 ,欢迎热爱写作的你一起参与!