123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <!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>
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <link rel="stylesheet" href="lib/reset.css">
- </head>
- <body>
- <style>
- h1 {
- line-height: 60px;
- background: #140;
- text-align: center;
- font-weight: bold;
- color: #eee;
- font-size: 14px;
- }
- .chart {
- height: 200px;
- }
- </style>
- <h1>default {boundaryGap:true, alignWithLabel: false}, in category axis, axis tick and label should be consistent</h1>
- <div class="chart" id="a"></div>
- <script>
- require([
- 'echarts'
- // 'echarts/chart/line',
- // 'echarts/chart/bar',
- // 'echarts/chart/candlestick',
- // 'echarts/component/grid',
- // 'echarts/component/graphic',
- // 'echarts/component/legend',
- // 'echarts/component/tooltip',
- // 'echarts/component/toolbox',
- // 'echarts/component/dataZoom'
- ], function (echarts) {
- var axisData = [
- "2013/1/24", "2013/1/25", "2013/1/28", "2013/1/29", "2013/1/30",
- "2013/1/31", "2013/2/1", "2013/2/4", "2013/2/5", "2013/2/6",
- "2013/2/7", "2013/2/8", "2013/2/18", "2013/2/19", "2013/2/20",
- "2013/2/21", "2013/2/22", "2013/2/25", "2013/2/26", "2013/2/27",
- "2013/2/28", "2013/3/1", "2013/3/4", "2013/3/5", "2013/3/6",
- "2013/3/7", "2013/3/8", "2013/3/11", "2013/3/12", "2013/3/13",
- "2013/3/14", "2013/3/15", "2013/3/18", "2013/3/19", "2013/3/20",
- "2013/3/21", "2013/3/22", "2013/3/25", "2013/3/26", "2013/3/27",
- "2013/3/28", "2013/3/29", "2013/4/1", "2013/4/2", "2013/4/3",
- "2013/4/8", "2013/4/9", "2013/4/10", "2013/4/11", "2013/4/12",
- "2013/4/15", "2013/4/16", "2013/4/17", "2013/4/18", "2013/4/19",
- "2013/4/22", "2013/4/23", "2013/4/24", "2013/4/25", "2013/4/26",
- "2013/5/2", "2013/5/3", "2013/5/6", "2013/5/7", "2013/5/8",
- "2013/5/9", "2013/5/10", "2013/5/13", "2013/5/14", "2013/5/15",
- "2013/5/16", "2013/5/17", "2013/5/20", "2013/5/21", "2013/5/22",
- "2013/5/23", "2013/5/24", "2013/5/27", "2013/5/28", "2013/5/29",
- "2013/5/30", "2013/5/31", "2013/6/3", "2013/6/4", "2013/6/5",
- "2013/6/6", "2013/6/7", "2013/6/13"
- ];
- var option = {
- tooltip : {
- trigger: 'axis',
- },
- legend: {
- y : -30,
- data:['上证指数','成交金额(万)','虚拟数据']
- },
- dataZoom : {
- show : true,
- realtime: true,
- start : 50,
- end : 70
- },
- grid: {
- x: 80,
- y: 20,
- x2: 20,
- y2: 60
- },
- xAxis : [
- {
- type : 'category',
- // axisTick: {
- // alignWithLabel: true
- // },
- boundaryGap : true,
- data : axisData
- }
- ],
- yAxis : [
- {
- type : 'value',
- splitArea : {show : true}
- }
- ],
- series : [
- {
- name:'成交金额(万)',
- type:'line',
- data:[
- 13560434, 8026738.5, 11691637, 12491697, 12485603,
- 11620504, 12555496, 15253370, 12709611, 10458354,
- 10933507, 9896523, 10365702, 10633095, 9722230,
- 12662783, 8757982, 7764234, 10591719, 8826293,
- 11591827, 11153111, 14304651, 11672120, 12536480,
- 12608589, 8843860, 7391994.5, 10063709, 7768895.5,
- 6921859, 10157810, 8148617.5, 7551207, 11397426,
- 10478607, 8595132, 8541862, 9181132, 8570842,
- 10759351, 7335819, 6699753.5, 7759666.5, 6880135.5,
- 7366616.5, 7313504, 7109021.5, 6213270, 5619688,
- 5816217.5, 6695584.5, 5998655.5, 6188812.5, 9538301,
- 8224500, 8221751.5, 7897721, 8448324, 6525151,
- 5987761, 7831570, 8162560.5, 7904092, 8139084.5,
- 9116529, 8128014, 7919148, 7566047, 6665826.5,
- 10225527, 11124881, 12884353, 11302521, 11529046,
- 11105205, 9202153, 9992016, 12035250, 11431155,
- 10354677, 10070399, 9164861, 9237718, 7114268,
- 7526158.5, 8105835, 7971452.5
- ]
- }
- ]
- };
- chart = myChart = echarts.init(document.getElementById('a'));
- chart.setOption(option);
- });
- </script>
- </body>
- </html>
|