123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
- <meta http-equiv="Content-Type" content="text/html; charset=utf8">
- <style type="text/css">
- html,body{height:100%;margin:0px;padding:0px;font-family:"微软雅黑";font-size:14px;}
- #allmap{height:100%;width:100%; margin:0 auto;}
- .optionpanel{margin: 10px auto;}
- #r-result{ margin:0 auto; width:500px; position: absolute; top:0px;}
- .anchorBL {display:none;}
- img
- {
- opacity:0.85;
- }
-
- </style>
- <title>个性底图设置模板Demo页</title>
- <script src="echarts.min.js"></script>
- <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
- </head>
- <body>
- <div id="main" style="width: 600px;height:400px;"></div>
- </body>
- </html>
- <script type="text/javascript">
-
- // 基于准备好的dom,初始化echarts实例
- var myChart = echarts.init(document.getElementById('main'));
- // 指定图表的配置项和数据
- $.get('data-1469156830975-S1PyA-yO.json', function (data) {
- myChart.setOption(option = {
- title: {
- text: 'Beijing AQI'
- },
- tooltip: {
- trigger: 'axis'
- },
- xAxis: {
- data: data.map(function (item) {
- return item[0];
- })
- },
- yAxis: {
- splitLine: {
- show: false
- }
- },
- toolbox: {
- left: 'center',
- feature: {
- dataZoom: {
- yAxisIndex: 'none'
- },
- restore: {},
- saveAsImage: {}
- }
- },
- dataZoom: [{
- startValue: '2014-06-01'
- }, {
- type: 'inside'
- }],
- visualMap: {
- top: 10,
- right: 10,
- pieces: [{
- gt: 0,
- lte: 50,
- color: '#096'
- }, {
- gt: 50,
- lte: 100,
- color: '#ffde33'
- }, {
- gt: 100,
- lte: 150,
- color: '#ff9933'
- }, {
- gt: 150,
- lte: 200,
- color: '#cc0033'
- }, {
- gt: 200,
- lte: 300,
- color: '#660099'
- }, {
- gt: 300,
- color: '#7e0023'
- }],
- outOfRange: {
- color: '#999'
- }
- },
- series: {
- name: 'Beijing AQI',
- type: 'line',
- data: data.map(function (item) {
- return item[1];
- }),
- markLine: {
- silent: true,
- data: [{
- yAxis: 50
- }, {
- yAxis: 100
- }, {
- yAxis: 150
- }, {
- yAxis: 200
- }, {
- yAxis: 300
- }]
- }
- }
- });
- });
-
- </script>
|