blob: 8a50580a5a3247f8665e2f04ce3c2ed988f9a59b [file] [log] [blame]
<!DOCTYPE>
<html>
<head>
<meta charset="utf-8">
<script src="lib/esl.js"></script>
<script src="lib/config.js"></script>
<script src="lib/jquery.min.js"></script>
<script src="lib/facePrint.js"></script>
<script src="ut/lib/canteen.js"></script>
<script src="lib/testHelper.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="lib/reset.css">
</head>
<body>
<style>
h1 {
line-height: 60px;
height: 60px;
background: #146402;
text-align: center;
font-weight: bold;
color: #eee;
font-size: 14px;
}
.chart {
height: 500px;
}
</style>
<div class="chart" id="main"></div>
<textarea id="info" style="height: 600px; width: 1000px"></textarea>
<script>
var echarts;
var chart;
var myChart;
var groupCategories = [];
var groupColors = [];
require([
'echarts'
// 'echarts/chart/line',
// 'echarts/chart/bar',
// 'echarts/chart/pie',
// 'echarts/chart/scatter',
// 'echarts/chart/map',
// 'echarts/chart/parallel',
// 'echarts/chart/radar',
// 'echarts/component/grid',
// 'echarts/component/polar',
// 'echarts/component/geo',
// 'echarts/component/singleAxis',
// 'echarts/component/legend',
// 'echarts/component/tooltip',
// 'echarts/component/toolbox',
// 'echarts/component/visualMap',
// 'echarts/component/dataZoom'
], function (ec) {
echarts = ec;
var y1Max = 100;
var y2Max = 100;
var myxAxisData = ['05-11','05-12','05-13','05-14','05-15','05-16','05-17'];
var myData1 = [28,25,27,26,33,33,33];
var myData2 = [82,71,79,84,99,89,89];
option = {
title: {
text: '最近一周趋势',
textStyle: {
fontWeight: 'bold',
fontSize: 12
},
padding: [15, 0, 0, 0]
},
legend: {
data: ['数量', '比例'],
right: 0,
padding: [15, 0, 0, 0]
},
xAxis: {
data: myxAxisData,
axisLabel: {
textStyle: {
color: '#000'
}
},
axisTick: {
show: true
},
axisLine: {
show: true
},
z: 10
},
yAxis: [{
type: 'value',
name: '数量',
min: 0,
max: y1Max,
position: 'left',
splitLine: {
show: false
}
}, {
type: 'value',
name: '比例',
min: 0,
max: y2Max,
position: 'right',
axisLabel: {
formatter: '{value}%'
},
offset: -6,
splitLine: {
show: false
}
}],
series: [{
name: '数量',
type: 'bar',
barWidth: 18,
yAxisIndex: 0,
label: {
normal: {
color: '#73cafd',
show: true,
position: 'top'
}
},
itemStyle: {
normal: {
color: '#73cafd'
}
},
data: myData1
}, {
name: '比例',
type: 'line',
yAxisIndex: 1,
label: {
normal: {
textStyle: {
color: '#999',
},
show: true,
position: 'top',
formatter: '{c}%'
}
},
lineStyle: {
normal: {
color: '#999',
width: 3,
shadowColor: 'rgba(0,0,0,0.4)',
shadowBlur: 10,
shadowOffsetY: 10
}
},
data: myData2
}]
}
// var canvas = document.createElement('canvas');
// canvas.width = 600;
// canvas.height = 400;
// chart = myChart = echarts.init(canvas);
chart = myChart = echarts.init(document.getElementById('main'));
chart.setOption(option);
// var ctx = canvas.getContext('2d');
// console.log(JSON.stringify(ctx.stack()));
});
</script>
</body>
</html>