This is an automated email from the ASF dual-hosted git repository. ovilia pushed a commit to branch fix-pie-label in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 4bcace439918b2d3763325a3749f327eb7d851e9 Author: Ovilia <zwl.s...@gmail.com> AuthorDate: Tue Nov 9 18:14:35 2021 +0800 test(pie): add test case --- src/chart/pie/labelLayout.ts | 1 - test/pie-label.html | 165 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+), 1 deletion(-) diff --git a/src/chart/pie/labelLayout.ts b/src/chart/pie/labelLayout.ts index f0a1d59..1143823 100644 --- a/src/chart/pie/labelLayout.ts +++ b/src/chart/pie/labelLayout.ts @@ -218,7 +218,6 @@ function avoidOverlap( layout.rect.y -= (block.contentHeight - layout.rect.height) / 2; layout.rect.width = block.width; layout.rect.height = block.height; - console.log(block,layout.rect.width, layout.rect.height); } const dist = linePoints[1][0] - linePoints[2][0]; diff --git a/test/pie-label.html b/test/pie-label.html index 9041d2d..e5bf5e5 100644 --- a/test/pie-label.html +++ b/test/pie-label.html @@ -37,6 +37,9 @@ under the License. background: #146402; color: #fff; } + #main9, #main10 { + border: 1px solid red; + } </style> @@ -49,6 +52,8 @@ under the License. <div id="main6"></div> <div id="main7"></div> <div id="main8"></div> + <div id="main9"></div> + <div id="main10"></div> <script> @@ -770,5 +775,165 @@ under the License. }); </script> + + <script> + + require([ + 'echarts' + ], function (echarts) { + var data = [ + { + name: 'Apples', + value: 138 + }, + { + name: '{a|Neque porro quisquam est qui dolorem}', + value: 48 + }, + { + name: 'Oranges', + value: 40 + }, + { + name: 'Pears', + value: 32 + }, + { + name: 'quia dolorsit amet consectetur adipisci', + value: 27 + } + ]; + var option = { + series: [ + { + type: 'pie', + radius: '80%', + center: ['50%', '50%'], + data: data, + label: { + position: 'outer', + alignTo: 'edge', + margin: 20, + fontSize: 30, + padding: [5, 20], + backgroundColor: 'rgba(0, 0, 255, 0.2)', + rich: { + a: { + fontSize: 46, + borderColor: 'rgba(0, 0, 255, 0.8)', + borderWidth: 1, + borderRadius: 10 + } + }, + overflow: 'break' + }, + left: 0, + right: 0, + top: 0, + bottom: 0, + animationDuration: 0 + } + ] + }; + + var chart = testHelper.create(echarts, 'main9', { + title: 'Labels (rich text) should not be outside of the canvas', + option: option, + info: { + label: { + position: 'outer', + alignTo: 'edge', + margin: 20, + fontSize: 30, + padding: [5, 20], + backgroundColor: 'rgba(0, 0, 255, 0.2)', + rich: { + a: { + fontSize: 46, + borderColor: 'rgba(0, 0, 255, 0.8)', + borderWidth: 1, + borderRadius: 10 + } + }, + overflow: 'break' + } + } + }); + }); + + </script> + + <script> + + require([ + 'echarts' + ], function (echarts) { + var data = [ + { + name: 'Apples', + value: 138 + }, + { + name: 'Neque porro quisquam\nest qui\ndolorem', + value: 48 + }, + { + name: 'Oranges', + value: 40 + }, + { + name: 'Pears', + value: 32 + }, + { + name: 'quia dolorsit amet consectetur adipisci', + value: 27 + } + ]; + var option = { + series: [ + { + type: 'pie', + radius: '80%', + center: ['50%', '50%'], + data: data, + label: { + position: 'outer', + alignTo: 'edge', + margin: 20, + fontSize: 30, + padding: [5, 20], + backgroundColor: 'rgba(0, 0, 255, 0.2)', + overflow: 'break' + }, + left: 0, + right: 0, + top: 0, + bottom: 0, + animationDuration: 0 + } + ] + }; + + var chart = testHelper.create(echarts, 'main10', { + title: 'Labels (plain text) should not be outside of the canvas', + option: option, + info: { + label: { + position: 'outer', + alignTo: 'edge', + margin: 20, + fontSize: 30, + padding: [5, 20], + backgroundColor: 'rgba(0, 0, 255, 0.2)', + overflow: 'break' + } + } + }); + }); + + </script> + + </body> </html> --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org