blob: 09cb9259b6c8587bc285c5a80fa4960f65318b1a [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="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>
<h1>right y: min/max set, should not effect onZero of left y. (pick the first axis that can on zero)</h1>
<div class="chart" id="a"></div>
<h1>onZeroAxisIndex specified (onZero on the right y axis)</h1>
<div class="chart" id="b"></div>
<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;
chart = myChart = echarts.init(document.getElementById('a'));
option = {
legend: {
data: ['left', 'right']
},
xAxis : [
{
type : 'category',
data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
}
],
yAxis : [
{
type : 'value'
},
{
type: 'value',
axisLabel: {
formatter: '{value} %'
},
min: 1,
max: 80
}
],
series : [
{
name: 'left',
type: 'bar',
// barWidth: '60%',
data:[1000, -520, -2000, -3340, 3900, -330, -5220]
},
{
name: 'right',
type: 'line',
yAxisIndex: 1,
data: [10, 0, 30, 50]
}
]
};
chart.setOption(option);
});
</script>
<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;
chart = myChart = echarts.init(document.getElementById('b'));
option = {
legend: {
data: ['left', 'right']
},
xAxis : [
{
type : 'category',
axisLine: {
onZero: true,
onZeroAxisIndex: 1
},
data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
}
],
yAxis : [
{
type : 'value'
},
{
type: 'value',
axisLabel: {
formatter: '{value} %'
}
}
],
series : [
{
name: 'left',
type: 'line',
data:[1000, -520, -2000, -3340, 3900, -330, -5220]
},
{
name: 'right',
type: 'line',
yAxisIndex: 1,
data: [-10, 0, 30, 50]
}
]
};
chart.setOption(option);
});
</script>
</body>
</html>