|  | <!DOCTYPE html> | 
|  | <!-- | 
|  | 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> | 
|  | <script src="lib/jquery.min.js"></script> | 
|  | <script src="lib/facePrint.js"></script> | 
|  | <script src="ut/lib/canteen.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> | 
|  |  | 
|  |  | 
|  | <div class="chart" id="main"></div> | 
|  |  | 
|  | <textarea id="info" style="height: 600px; width: 1000px"></textarea> | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  | <script> | 
|  |  | 
|  | var echarts; | 
|  | var chart; | 
|  | var myChart; | 
|  | var groupCategories = []; | 
|  | var groupColors = []; | 
|  |  | 
|  | require([ | 
|  | 'echarts' | 
|  | ], function (ec) { | 
|  | echarts = ec; | 
|  |  | 
|  | var y1Max = 100; | 
|  | var y2Max = 100; | 
|  | var myxAxisData = ['05-11','05-12','05-13','05-14','05-15','05-16','05-17']; | 
|  | var myData1 = [28,25,27,26,33,33,33]; | 
|  | var myData2 = [82,71,79,84,99,89,89]; | 
|  |  | 
|  | option = { | 
|  | title: { | 
|  | text: '最近一周趋势', | 
|  | textStyle: { | 
|  | fontWeight: 'bold', | 
|  | fontSize: 12 | 
|  | }, | 
|  | padding: [15, 0, 0, 0] | 
|  | }, | 
|  | legend: { | 
|  | data: ['数量', '比例'], | 
|  | right: 0, | 
|  | padding: [15, 0, 0, 0] | 
|  | }, | 
|  | xAxis: { | 
|  | data: myxAxisData, | 
|  | axisLabel: { | 
|  | textStyle: { | 
|  | color: '#000' | 
|  | } | 
|  | }, | 
|  | axisTick: { | 
|  | show: true | 
|  | }, | 
|  | axisLine: { | 
|  | show: true | 
|  | }, | 
|  | z: 10 | 
|  | }, | 
|  | yAxis: [{ | 
|  | type: 'value', | 
|  | name: '数量', | 
|  | min: 0, | 
|  | max: y1Max, | 
|  | position: 'left', | 
|  | splitLine: { | 
|  | show: false | 
|  | } | 
|  | }, { | 
|  | type: 'value', | 
|  | name: '比例', | 
|  | min: 0, | 
|  | max: y2Max, | 
|  | position: 'right', | 
|  | axisLabel: { | 
|  | formatter: '{value}%' | 
|  | }, | 
|  | offset: -6, | 
|  | splitLine: { | 
|  | show: false | 
|  | } | 
|  | }], | 
|  | series: [{ | 
|  | name: '数量', | 
|  | type: 'bar', | 
|  | barWidth: 18, | 
|  | yAxisIndex: 0, | 
|  | label: { | 
|  | normal: { | 
|  | color: '#73cafd', | 
|  | show: true, | 
|  | position: 'top' | 
|  | } | 
|  | }, | 
|  | itemStyle: { | 
|  | normal: { | 
|  | color: '#73cafd' | 
|  | } | 
|  | }, | 
|  | data: myData1 | 
|  | }, { | 
|  | name: '比例', | 
|  | type: 'line', | 
|  | yAxisIndex: 1, | 
|  | label: { | 
|  | normal: { | 
|  | textStyle: { | 
|  | color: '#999', | 
|  | }, | 
|  | show: true, | 
|  | position: 'top', | 
|  | formatter: '{c}%' | 
|  | } | 
|  | }, | 
|  | lineStyle: { | 
|  | normal: { | 
|  | color: '#999', | 
|  | width: 3, | 
|  | shadowColor: 'rgba(0,0,0,0.4)', | 
|  | shadowBlur: 10, | 
|  | shadowOffsetY: 10 | 
|  | } | 
|  | }, | 
|  | data: myData2 | 
|  | }] | 
|  | } | 
|  |  | 
|  | // var canvas = document.createElement('canvas'); | 
|  | // canvas.width = 600; | 
|  | // canvas.height = 400; | 
|  | // chart = myChart = echarts.init(canvas); | 
|  | chart = myChart = echarts.init(document.getElementById('main')); | 
|  | chart.setOption(option); | 
|  |  | 
|  | // var ctx = canvas.getContext('2d'); | 
|  | // console.log(JSON.stringify(ctx.stack())); | 
|  | }); | 
|  |  | 
|  | </script> | 
|  | </body> | 
|  | </html> |