| |
| <!-- |
| 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/esl.js"></script> |
| <script src="lib/config.js"></script> |
| </head> |
| <body> |
| <style> |
| html, body, #main { |
| width: 100%; |
| height: 100%; |
| /* background-image: url(old_mathematics.png); */ |
| /* background-repeat: repeat; */ |
| } |
| </style> |
| <div id="main"></div> |
| <script> |
| var chart; |
| require([ |
| 'echarts' |
| ], function (echarts) { |
| |
| chart = echarts.init(document.getElementById('main'), null, { |
| // renderer: 'svg' |
| }); |
| |
| var canvasColor = ['#FF6161', '#FF8C75', '#FFB499']; |
| var svgColor = ['#53C299', '#83E0A8', '#B7F6C0']; |
| var evenColor = '#eee'; |
| |
| var data = [{ |
| name: '展示平台', |
| children: [{ |
| name: '手机端', |
| children: [{ |
| name: '安卓', |
| children: [{ |
| name: 'SVG ↑↑↑', |
| value: 1, |
| itemStyle: { |
| color: svgColor[0] |
| } |
| }] |
| }, { |
| name: 'iOS', |
| children: [{ |
| name: 'SVG ↑', |
| value: 1, |
| itemStyle: { |
| color: svgColor[2] |
| } |
| }] |
| }] |
| }, { |
| name: '电脑端', |
| children: [{ |
| name: 'Mac', |
| children: [{ |
| name: 'Chrome', |
| children: [{ |
| name: 'SVG ↑', |
| value: 1, |
| itemStyle: { |
| color: svgColor[2] |
| } |
| }] |
| }, { |
| name: 'Safari', |
| children: [{ |
| name: '-', |
| value: 1, |
| itemStyle: { |
| color: evenColor |
| } |
| }] |
| }, { |
| name: 'Firefox', |
| children: [{ |
| name: '-', |
| value: 1, |
| itemStyle: { |
| color: evenColor |
| } |
| }] |
| }] |
| }, { |
| name: 'Windows', |
| children: [{ |
| name: 'IE', |
| children: [{ |
| name: 'Canvas ↑↑', |
| value: 1, |
| itemStyle: { |
| color: canvasColor[1] |
| } |
| }] |
| }, { |
| name: 'Chrome', |
| children: [{ |
| name: '-', |
| value: 1, |
| itemStyle: { |
| color: evenColor |
| } |
| }] |
| }, { |
| name: 'Firefox', |
| children: [{ |
| name: 'SVG ↑', |
| value: 1, |
| itemStyle: { |
| color: svgColor[2] |
| } |
| }] |
| }] |
| }] |
| }] |
| }, { |
| name: '图表类型', |
| children: [{ |
| name: '折线图', |
| children: [{ |
| name: 'SVG ↑↑', |
| value: 1, |
| itemStyle: { |
| color: svgColor[1] |
| } |
| }] |
| }, { |
| name: '柱状图', |
| children: [{ |
| name: 'Canvas ↑↑', |
| value: 1, |
| itemStyle: { |
| color: canvasColor[1] |
| } |
| }] |
| }, { |
| name: '饼图', |
| children: [{ |
| name: '-', |
| value: 1, |
| itemStyle: { |
| color: evenColor |
| } |
| }] |
| }] |
| }, { |
| name: '数据量', |
| children: [{ |
| name: '< 1000', |
| children: [{ |
| name: '-', |
| value: 1, |
| itemStyle: { |
| color: evenColor |
| } |
| }] |
| }, { |
| name: '>= 1000', |
| children: [{ |
| name: 'Canvas ↑', |
| value: 1, |
| itemStyle: { |
| color: canvasColor[2] |
| } |
| }] |
| }] |
| }, { |
| name: '图表个数', |
| children: [{ |
| name: '< 10', |
| children: [{ |
| name: '-', |
| value: 1, |
| itemStyle: { |
| color: evenColor |
| } |
| }] |
| }, { |
| name: '>= 10', |
| children: [{ |
| name: 'SVG ↑↑↑', |
| value: 1, |
| itemStyle: { |
| color: svgColor[0] |
| } |
| }] |
| }] |
| }, { |
| name: '特殊\n渲染\n需求', |
| children: [{ |
| name: '仅 Canvas\n支持', |
| value: 1, |
| itemStyle: { |
| color: canvasColor[0] |
| } |
| }] |
| }]; |
| |
| chart.setOption({ |
| series: { |
| radius: ['10%', '120%'], |
| center: ['50%', '38%'], |
| startAngle: 0, |
| type: 'sunburst', |
| sort: null, |
| highlightPolicy: 'ancestor', |
| data: data, |
| label: { |
| rotate: 0, |
| textBorderColor: '#444', |
| textBorderWidth: 2, |
| fontSize: 14 |
| }, |
| levels: [{}, { |
| itemStyle: { |
| color: '#999' |
| } |
| }, { |
| itemStyle: { |
| color: '#bbb' |
| } |
| }, { |
| itemStyle: { |
| color: '#ccc' |
| } |
| }], |
| itemStyle: { |
| color: '#ddd', |
| borderWidth: 2 |
| } |
| } |
| }); |
| }); |
| |
| </script> |
| </body> |
| </html> |