You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

163 lines
4.4 KiB

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>ECharts</title>
<!-- 引入刚刚下载的 ECharts 文件 -->
<script src="js/echarts.js"></script>
</head>
<body>
<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
<div id="main" style="width: 800px;height:300px;"></div>
<script type="text/javascript">
var postData =
{
"legend": {
"data": [
"仓库货值",
"在途货值",
"门店货值",
"帐户余额",
"应收帐款",
"借款金额"
]
},
"xAxis": {
"type": "category",
"boundaryGap": false,
"data": [
"23-01-01",
"23-01-02",
"23-01-03",
"23-01-04",
"23-01-05",
"23-01-06",
"23-01-07"
]
},
"series": [
{
"name": "仓库货值",
"type": "line",
"stack": "Total",
"data": [
120,
132,
101,
134,
90,
230,
210
]
},
{
"name": "在途货值",
"type": "line",
"stack": "Total",
"data": [
120,
132,
101,
134,
90,
230,
210
]
},
{
"name": "门店货值",
"type": "line",
"stack": "Total",
"data": [
120,
132,
101,
134,
90,
230,
210
]
},
{
"name": "帐户余额",
"type": "line",
"stack": "Total",
"data": [
120,
132,
101,
134,
90,
230,
210
]
},
{
"name": "应收帐款",
"type": "line",
"stack": "Total",
"data": [
120,
132,
101,
134,
90,
230,
210
]
},
{
"name": "借款金额",
"type": "line",
"stack": "Total",
"data": [
120,
132,
101,
134,
90,
230,
210
]
}
]
}
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
var option = {
title: {
text: ''
},
tooltip: {
trigger: 'axis'
},
legend: {
data: postData.legend.data
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: postData.xAxis.data
},
yAxis: {
type: 'value'
},
series: postData.series
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
</body>
</html>