/
githubmirror
/
echarts
Обзор
Документация
Войти
/
githubmirror
/
echarts
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/pie-visual.html
250 строк
9 KB
pissang
test: use require to replace original jquery loading
10 май 2021, 09:02
10 май 2021, 09:02
f07de0b
Код
Авторство
О чём код?
<!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> <div id="main3"></div> <div id="main4"></div> <script> require(['echarts'], function (echarts) { var option; option = { series: [ { type: 'pie', data: [ {value: 335, name: 'Tom'}, {value: 310, name: 'Jack'}, {value: 274, name: 'Bobby'}, {value: 235, name: 'Emily'}, {value: 400, name: 'Jessy'} ], roseType: 'radius' } ] }; var chart = testHelper.create(echarts, 'main0', { title: [ 'Should use color from palette by default' ], option: option }); }); </script> <script> require(['echarts'], function (echarts) { var option; option = { series: [ { type: 'pie', data: [ {value: 335, name: 'Tom'}, {value: 310, name: 'Jack'}, {value: 274, name: 'Bobby'}, {value: 235, name: 'Emily'}, {value: 400, name: 'Jessy'} ], itemStyle: { color: '#37A2DA', borderColor: '#fff', borderWidth: 2 } } ] }; var chart = testHelper.create(echarts, 'main1', { title: [ 'Test of itemStyle.color', 'Should all be color #37A2DA' ], option: option }); }); </script> <script> require(['echarts'], function (echarts) { var option; option = { series: [ { type: 'pie', data: [ { value: 335, name: 'This color should be purple. Others will pick from color palette', itemStyle: { color: 'purple' } }, { value: 310, name: 'This should has shadow', itemStyle: { shadowBlur: 10 } }, {value: 274, name: 'Bobby'}, {value: 235, name: 'Emily'}, {value: 400, name: 'Jessy'} ] } ] }; var chart = testHelper.create(echarts, 'main2', { title: [ 'data.itemStyle.color should work property ' ], option: option }); }); </script> <script> require(['echarts'], function (echarts) { var option; option = { series: [ { type: 'pie', itemStyle: { color: function (params) { return echarts.color.modifyAlpha('red', params.dataIndex / 10 + 0.5); } }, label: { formatter: function (params) { return params.name + '(opacity: ' + (params.dataIndex / 10 + 0.5) + ')'; } }, data: [ { value: 335, name: 'This color should be purple', itemStyle: { color: 'purple' } }, {value: 310, name: 'Jack'}, {value: 274, name: 'Bobby'}, {value: 235, name: 'Emily'}, {value: 400, name: 'Jessy'} ] } ] }; var chart = testHelper.create(echarts, 'main3', { title: [ 'Callback of color' ], option: option }); }); </script> <script> require(['echarts'], function (echarts) { var option; option = { backgroundColor: '#2c343c', visualMap: { show: false, min: 80, max: 600, inRange: { colorLightness: [0, 1] } }, series: [ { type: 'pie', radius: '50%', center: ['25%', '50%'], data: [ {value: 335, name: 'Tom'}, {value: 310, name: 'Jack'}, {value: 274, name: 'Bobby'}, {value: 235, name: 'Emily'}, {value: 400, name: 'Jessy'} ].sort(function (a, b) { return a.value - b.value; }), roseType: 'radius' }, { type: 'pie', radius: '50%', center: ['75%', '50%'], data: [ { value: 335, name: 'This should be pink', itemStyle: { color: 'pink' } }, {value: 310, name: 'Jack'}, {value: 274, name: 'Bobby'}, {value: 235, name: 'Emily'}, {value: 400, name: 'Jessy'} ].sort(function (a, b) { return a.value - b.value; }), roseType: 'radius' } ] }; var chart = testHelper.create(echarts, 'main4', { title: [ 'visualMap will apply lightness modification on series color', 'data.itemStyle.color should have higher priority.' ], option: option }); }); </script> </body> </html>