| <!-- | |
| Licensed to the Apache Software Foundation (ASF) under one | |
| or more contributor license agreements. See the NOTICE file | |
| distributed with this work for additional information | |
| regarding copyright ownership. The ASF licenses this file | |
| to you under the Apache License, Version 2.0 (the | |
| "License"); you may not use this file except in compliance | |
| with the License. You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, | |
| software distributed under the License is distributed on an | |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| KIND, either express or implied. See the License for the | |
| specific language governing permissions and limitations | |
| under the License. | |
| --> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <script src="lib/simpleRequire.js"></script> | |
| <script src="lib/config.js"></script> | |
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | |
| </head> | |
| <body> | |
| <style> | |
| html, body, #main { | |
| width: 100%; | |
| height: 100%; | |
| margin: 0; | |
| } | |
| #main { | |
| width: 100%; | |
| background: #fff; | |
| } | |
| </style> | |
| <div id="main"></div> | |
| <script> | |
| require(['echarts'], function (echarts) { | |
| var chart = echarts.init(document.getElementById('main'), null, { | |
| }); | |
| var labelOption = { | |
| normal: { | |
| show: true, | |
| position: 'insideBottom', | |
| rotate: 90, | |
| textStyle: { | |
| align: 'left', | |
| verticalAlign: 'middle' | |
| } | |
| } | |
| }; | |
| option = { | |
| color: ['#003366', '#006699', '#4cabce', '#e5323e'], | |
| tooltip: { | |
| trigger: 'axis', | |
| axisPointer: { // 坐标轴指示器,坐标轴触发有效 | |
| type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' | |
| } | |
| }, | |
| legend: { | |
| data:['A', 'B', 'C', 'D'] | |
| }, | |
| toolbox: { | |
| show: true, | |
| orient: 'vertical', | |
| left: 'right', | |
| top: 'center', | |
| feature: { | |
| mark: {show: true}, | |
| dataView: {show: true, readOnly: false}, | |
| magicType: {show: true, type: ['line', 'bar', 'stack', 'tiled']}, | |
| restore: {show: true}, | |
| saveAsImage: {show: true} | |
| } | |
| }, | |
| calculable: true, | |
| xAxis: [ | |
| { | |
| type: 'category', | |
| axisTick: {show: false}, | |
| data: ['2012', '2013', '2014', '2015', '2016'] | |
| } | |
| ], | |
| yAxis: [ | |
| { | |
| type: 'value' | |
| } | |
| ], | |
| series: [ | |
| { | |
| name: 'A', | |
| type: 'bar', | |
| barGap: 0, | |
| label: labelOption, | |
| data: [320, 332, 301, 334, 390] | |
| }, | |
| { | |
| name: 'B', | |
| type: 'bar', | |
| label: labelOption, | |
| data: [220, 182, 191, 234, 290] | |
| }, | |
| { | |
| name: 'C', | |
| type: 'bar', | |
| label: labelOption, | |
| data: [150, 232, 201, 154, 190] | |
| }, | |
| { | |
| name: 'D', | |
| type: 'bar', | |
| label: labelOption, | |
| data: [98, 77, 101, 99, 30] | |
| } | |
| ] | |
| } | |
| chart.setOption(option); | |
| }); | |
| </script> | |
| </body> | |
| </html> |