blob: 8d6d81d3e9c54e71177c49489143f1d75e7f59a0 [file] [log] [blame]
<html>
<head>
<meta charset="utf-8">
<script src="http://requirejs.org/docs/release/2.2.0/minified/require.js"></script>
<script src="lib/config.js"></script>
<meta name="viewport" content="user-scalable=no,width=device-width,height=device-height">
</head>
<body>
<style>
html, body, #main {
width: 100%;
height: 100%;
}
</style>
<div id="main"></div>
<script>
require([
'echarts'
// 'echarts/chart/line',
// 'echarts/component/legend',
// 'echarts/component/gridSimple',
// 'echarts/component/tooltip',
// 'zrender/vml/vml'
], function (echarts) {
var chart = echarts.init(document.getElementById('main'));
var xAxisData = [];
var data1 = [];
var data2 = [];
var data3 = [];
var data4 = [];
var data5 = [];
var data6 = [];
xAxisData.push('类目' + -1);
data1.push('-');
data2.push('-');
data3.push('-');
data4.push('-');
data5.push('-');
data6.push('-');
for (var i = 0; i < 5; i++) {
xAxisData.push('类目' + i);
data1.push((-Math.random() - 0.2).toFixed(3));
data2.push((Math.random() + 0.3).toFixed(3));
data3.push((Math.random() + 0.2).toFixed(3));
data4.push((-Math.random() - 0.2).toFixed(3));
data5.push((-Math.random() - 0.2).toFixed(3));
data6.push((Math.random() + 0.2).toFixed(3));
}
xAxisData.push('类目' + i);
data1.push('-');
data2.push('-');
data3.push('-');
data4.push('-');
data5.push('-');
data6.push('-');
for (; i < 10; i++) {
xAxisData.push('类目' + i);
data1.push((-Math.random() - 0.2).toFixed(3));
data2.push((Math.random() + 0.3).toFixed(3));
data3.push((Math.random() + 0.2).toFixed(3));
data4.push((-Math.random() - 0.2).toFixed(3));
data5.push((-Math.random() - 0.2).toFixed(3));
data6.push((Math.random() + 0.2).toFixed(3));
}
xAxisData.push('类目' + i);
data1.push('-');
data2.push('-');
data3.push('-');
data4.push('-');
data5.push('-');
data6.push('-');
var itemStyle = {
normal: {
// borderColor: 'white',
// borderWidth: 3,
// shadowBlur: 10,
// shadowOffsetX: 0,
// shadowOffsetY: 5,
// shadowColor: 'rgba(0, 0, 0, 0.4)',
lineStyle: {
width: 2
// shadowBlur: 10,
// shadowOffsetX: 0,
// shadowOffsetY: 5,
// shadowColor: 'rgba(0, 0, 0, 0.4)'
},
areaStyle: {
}
}
};
chart.setOption({
legend: {
},
toolbox: {
feature: {
magicType: {
type: ['line', 'bar', 'stack', 'tiled']
}
}
},
tooltip: {
trigger: 'axis',
position: function (point) {
return [point[0], '10%'];
},
axisPointer: {
type: 'line'
}
},
xAxis: {
// data: ['类目1', '类目2', '类目3', '类目4', '类目5',]
data: xAxisData,
boundaryGap: false,
// inverse: true,
splitArea: {
show: true
}
},
yAxis: {
splitLine: {
// show: false
}
},
dataZoom: [{
type: 'inside'
}, {
type: 'slider'
}],
series: [{
name: 'line',
type: 'line',
stack: 'all',
symbolSize: 10,
data: data1,
itemStyle: itemStyle,
smooth: true,
connectNulls: true
}, {
name: 'line2',
type: 'line',
stack: 'all',
symbolSize: 10,
data: data2,
itemStyle: itemStyle,
connectNulls: true,
smooth: true
}, {
name: '+connectNulls:true',
type: 'line',
stack: 'all',
symbolSize: 10,
data: data3,
itemStyle: itemStyle,
label: {
normal: {
show: true
}
},
connectNulls: true,
smooth: true
}, {
name: '-connectNulls:false',
type: 'line',
stack: 'all',
symbolSize: 10,
data: data4,
itemStyle: itemStyle,
label: {
normal: {
show: true
}
},
connectNulls: false,
smooth: true
}, {
name: '-connectNulls:true',
type: 'line',
stack: 'all',
symbolSize: 10,
data: data5,
itemStyle: itemStyle,
label: {
normal: {
show: true
}
},
connectNulls: true,
smooth: true
}, {
name: '+connectNulls:false',
type: 'line',
stack: 'all',
symbolSize: 10,
data: data6,
itemStyle: itemStyle,
label: {
normal: {
show: true
}
},
connectNulls: false,
smooth: true
}]
});
})
</script>
</body>
</html>