|  |  | 
|  | <!-- | 
|  | 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="lib/testHelper.js"></script> | 
|  | <meta name="viewport" content="width=device-width, initial-scale=1" /> | 
|  | </head> | 
|  | <body> | 
|  | <style> | 
|  | h1 { | 
|  | line-height: 60px; | 
|  | height: 60px; | 
|  | background: #146402; | 
|  | text-align: center; | 
|  | font-weight: bold; | 
|  | color: #eee; | 
|  | font-size: 14px; | 
|  | } | 
|  | .chart { | 
|  | height: 600px; | 
|  | } | 
|  | </style> | 
|  |  | 
|  | <div id="main" class="chart"></div> | 
|  | <p id="aria-1"></p> | 
|  |  | 
|  | <div id="main2" class="chart"></div> | 
|  | <p id="aria-2"></p> | 
|  | <script> | 
|  |  | 
|  | require(['echarts'], | 
|  | function (echarts) { | 
|  |  | 
|  | var chart = echarts.init(document.getElementById('main')); | 
|  |  | 
|  | chart.setOption({ | 
|  | aria: { | 
|  | enabled: true | 
|  | }, | 
|  | title : { | 
|  | text: '某站点用户访问来源', | 
|  | subtext: '纯属虚构', | 
|  | x:'center' | 
|  | }, | 
|  | tooltip : { | 
|  | trigger: 'item', | 
|  | formatter: "{a} <br/>{b} : {c} ({d}%)" | 
|  | }, | 
|  | legend: { | 
|  | orient: 'vertical', | 
|  | left: 'left', | 
|  | data: ['直接访问','邮件营销','联盟广告','视频广告(value is null)','搜索引擎'] | 
|  | }, | 
|  | series : [ | 
|  | { | 
|  | name: '访问来源', | 
|  | type: 'pie', | 
|  | radius : '55%', | 
|  | center: ['50%', '60%'], | 
|  | selectedMode: 'single', | 
|  | data:[ | 
|  | {value:335, name:'直接访问'}, | 
|  | {value:310, name:'邮件营销'}, | 
|  | {value:234, name:'联盟广告'}, | 
|  | {value:null, name:'视频广告(value is null)'}, | 
|  | {value:1548, name:'搜索引擎'} | 
|  | ], | 
|  | emphasis: { | 
|  | itemStyle: { | 
|  | shadowBlur: 10, | 
|  | shadowOffsetX: 0, | 
|  | shadowColor: 'rgba(0, 0, 0, 0.5)' | 
|  | } | 
|  | } | 
|  | } | 
|  | ] | 
|  | }); | 
|  |  | 
|  | document.getElementById('aria-1').innerText = chart.getDom().getAttribute('aria-label'); | 
|  |  | 
|  | var chart2 = echarts.init(document.getElementById('main2')); | 
|  |  | 
|  | chart2.setOption( | 
|  | { | 
|  | "dataset": { | 
|  | "dimensions": ["c_0", "c_1"], | 
|  | "source": [{"c_0": "Amount used", "c_1": 1699.0}, {"c_0": "Amount left", "c_1": 2301.0}] | 
|  | }, | 
|  | "series": [{ | 
|  | "type": "pie", "silent": true, | 
|  | "encode": {"itemName": "c_0", "value": "c_1"}, | 
|  | "radius": ["30%", "60%"] | 
|  | }], | 
|  | "aria": {"show": true} | 
|  | } | 
|  | ); | 
|  | document.getElementById('aria-2').innerText = chart2.getDom().getAttribute('aria-label'); | 
|  | } | 
|  | ); | 
|  | </script> | 
|  | </body> | 
|  | </html> |