| <!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"> | 
 |         <meta name="viewport" content="width=device-width, initial-scale=1" /> | 
 |         <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> | 
 |         <!-- <script src="ut/lib/canteen.js"></script> --> | 
 |         <link rel="stylesheet" href="lib/reset.css" /> | 
 |     </head> | 
 |     <body> | 
 |         <style> | 
 |         </style> | 
 |  | 
 |  | 
 |  | 
 |         <div id="main0"></div> | 
 |         <div id="main1"></div> | 
 |         <div id="main2"></div> | 
 |  | 
 |  | 
 |  | 
 |  | 
 |         <script> | 
 |         require([ | 
 |             'echarts' | 
 |         ], function (echarts) { | 
 |             var option; | 
 |             var data = []; | 
 |             for (var i = 0; i < 1e3; i++) { | 
 |                 data.push({ | 
 |                     name: 'test' + i, | 
 |                     value: Math.random() * 1000, | 
 |                 }); | 
 |             } | 
 |             option = { | 
 |                 series: { | 
 |                     type: 'pie', | 
 |                     data: data, | 
 |                     percentPrecision: 5, | 
 |                     label: { | 
 |                         formatter: '{b} {d}%' | 
 |                     } | 
 |                 } | 
 |             }; | 
 |  | 
 |             var chart = testHelper.create(echarts, 'main0', { | 
 |                 title: [ | 
 |                     'Test Pie performance' | 
 |                 ] | 
 |             }); | 
 |  | 
 |             var startTs = performance.now(); | 
 |             chart.setOption(option); | 
 |  | 
 |             chart.on('finished', function () { | 
 |                 var endTs = performance.now(); | 
 |                 var time = endTs - startTs; | 
 |                 console.log('Finished in ' + time + 'ms'); | 
 |                 startTs = endTs; | 
 |             }); | 
 |         }); | 
 |         </script> | 
 |  | 
 |         <script> | 
 |             require(['echarts'], function (echarts) { | 
 |                 var option = { | 
 |                     tooltip: { | 
 |                         trigger: 'item', | 
 |                         formatter(params) { | 
 |                             return params.name + ': ' + params.percent + '%'; | 
 |                         } | 
 |                     }, | 
 |                     legend: { | 
 |                         data: ['一级', '二级', '三级', '四级', '五级', '六级'] | 
 |                     }, | 
 |                     series: { | 
 |                         type: 'pie', | 
 |                         data: [ | 
 |                             { | 
 |                                 name: '一级', | 
 |                                 value: 77 | 
 |                             }, | 
 |                             { | 
 |                                 name: '二级', | 
 |                                 value: 1 | 
 |                             }, | 
 |                             { | 
 |                                 name: '三级', | 
 |                                 value: 0 | 
 |                             }, | 
 |                             { | 
 |                                 name: '四级', | 
 |                                 value: 0 | 
 |                             }, | 
 |                             { | 
 |                                 name: '五级', | 
 |                                 value: 0 | 
 |                             }, | 
 |                             { | 
 |                                 name: '六级', | 
 |                                 value: 0 | 
 |                             } | 
 |                         ], | 
 |                         label: { | 
 |                             show: true, | 
 |                             formatter(val) { | 
 |                                 return val.name + ':' + val.percent + '%'; | 
 |                             } | 
 |                         }, | 
 |                         labelLine: { | 
 |                             show: true | 
 |                         } | 
 |                     } | 
 |                 }; | 
 |  | 
 |                 var chart = testHelper.create(echarts, 'main1', { | 
 |                     option, | 
 |                     title: [ | 
 |                         'The percent should be correct after toggling the legend', | 
 |                         'Test modified from https://github.com/apache/echarts/issues/17732' | 
 |                     ] | 
 |                 }); | 
 |             }); | 
 |             </script> | 
 |  | 
 |             <script> | 
 |                 require(['echarts'], function (echarts) { | 
 |                     var option = { | 
 |                         tooltip: { | 
 |                             trigger: 'item', | 
 |                             formatter(params) { | 
 |                                 return params.name + ': ' + params.percent + '%'; | 
 |                             } | 
 |                         }, | 
 |                         legend: { | 
 |                             data: ['一级', '二级', '三级', '四级', '五级', '六级'] | 
 |                         }, | 
 |                         series: { | 
 |                             type: 'pie', | 
 |                             data: [ | 
 |                                 { | 
 |                                     name: '一级', | 
 |                                     value: 0 | 
 |                                 }, | 
 |                                 { | 
 |                                     name: '二级', | 
 |                                     value: 0 | 
 |                                 }, | 
 |                                 { | 
 |                                     name: '三级', | 
 |                                     value: 0 | 
 |                                 }, | 
 |                                 { | 
 |                                     name: '四级', | 
 |                                     value: 0 | 
 |                                 }, | 
 |                                 { | 
 |                                     name: '五级', | 
 |                                     value: 0 | 
 |                                 }, | 
 |                                 { | 
 |                                     name: '六级', | 
 |                                     value: 0 | 
 |                                 } | 
 |                             ], | 
 |                             label: { | 
 |                                 show: true, | 
 |                                 formatter(val) { | 
 |                                     return val.name + ':' + val.percent + '%'; | 
 |                                 } | 
 |                             }, | 
 |                             labelLine: { | 
 |                                 show: true | 
 |                             } | 
 |                         } | 
 |                     }; | 
 |  | 
 |                     var chart = testHelper.create(echarts, 'main2', { | 
 |                         option, | 
 |                         title: [ | 
 |                             'The percent should be not **`undefined`** when all values are 0', | 
 |                         ] | 
 |                     }); | 
 |                 }); | 
 |             </script> | 
 |  | 
 |     </body> | 
 | </html> | 
 |  |