You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2020/05/29 14:45:07 UTC

[GitHub] [incubator-echarts] Ling310 opened a new pull request #12721: 修复issue #12708

Ling310 opened a new pull request #12721:
URL: https://github.com/apache/incubator-echarts/pull/12721


   <!-- Please fill in the following information to help us review your PR more efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:  
   - bug fixing
   
   ### What does this PR do?
   
   <!-- USE ONCE SENTENCE TO DESCRIBE WHAT THIS PR DOES. -->
   calculate the rich label
   
   
   ### Fixed issues
   
   - #12708 
   
   
   ## Details
   
   ### Before: What was the problem?
   
   <!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   - doesn't caluculate the rich informations
   
   
   ### After: How is it fixed in this PR?
   
   <!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   - caluculate the rich informations
   
   ## Usage
   
   ### Are there any API changes?
   
   -  The API hasn't been changed.
   
   <!-- LIST THE API CHANGES HERE -->
   
   
   
   ### Related test cases or examples to use the new APIs
   
   NA.
   
   
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merge.
   
   ### Other information
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [incubator-echarts] Ovilia commented on a change in pull request #12721: Fix #12708

Posted by GitBox <gi...@apache.org>.
Ovilia commented on a change in pull request #12721:
URL: https://github.com/apache/incubator-echarts/pull/12721#discussion_r433724164



##########
File path: src/chart/pie/labelLayout.js
##########
@@ -270,6 +272,22 @@ export default function (seriesModel, r, viewWidth, viewHeight, viewLeft, viewTo
             text, font, textAlign, 'top'
         );
 
+        // calculate after rich convert
+        var rich = labelModel.get('rich');
+        if (rich) {
+            var cloneRich = zrUtil.clone(rich);
+            Object.keys(cloneRich).forEach(key => {
+                const convertFont = getFont(cloneRich[key]);
+                cloneRich[key].font = convertFont;
+            });
+            var textParseRich = textContain.parseRichText(text, {
+                rich: cloneRich,
+                font: font
+            });
+            textRect.width = textParseRich.width;
+            textRect.height = textParseRich.height;

Review comment:
       Probably should use `outerWidth` and `outerHeight` instead.

##########
File path: src/chart/pie/labelLayout.js
##########
@@ -270,6 +272,22 @@ export default function (seriesModel, r, viewWidth, viewHeight, viewLeft, viewTo
             text, font, textAlign, 'top'
         );
 
+        // calculate after rich convert
+        var rich = labelModel.get('rich');
+        if (rich) {
+            var cloneRich = zrUtil.clone(rich);
+            Object.keys(cloneRich).forEach(key => {
+                const convertFont = getFont(cloneRich[key]);
+                cloneRich[key].font = convertFont;
+            });

Review comment:
       Use `rich: zrUtil.extend({}, rich)` instead.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [incubator-echarts] susiwen8 commented on a change in pull request #12721: Fix #12708

Posted by GitBox <gi...@apache.org>.
susiwen8 commented on a change in pull request #12721:
URL: https://github.com/apache/incubator-echarts/pull/12721#discussion_r432545455



##########
File path: src/chart/pie/labelLayout.js
##########
@@ -270,6 +272,22 @@ export default function (seriesModel, r, viewWidth, viewHeight, viewLeft, viewTo
             text, font, textAlign, 'top'
         );
 
+        // calculate after rich convert
+        var rich = labelModel.get('rich');
+        if (rich) {
+            var cloneRich = zrUtil.clone(rich);
+            Object.keys(cloneRich).forEach(key => {
+                const convertFont = getFont(cloneRich[key]);

Review comment:
       use `var`

##########
File path: src/chart/pie/labelLayout.js
##########
@@ -21,6 +21,8 @@
 
 import * as textContain from 'zrender/src/contain/text';
 import {parsePercent} from '../../util/number';
+import * as zrUtil from 'zrender/src/core/util';
+import { getFont } from '../../util/graphic';

Review comment:
       Please follow code style, no space before or after bracket

##########
File path: src/chart/pie/labelLayout.js
##########
@@ -270,6 +272,22 @@ export default function (seriesModel, r, viewWidth, viewHeight, viewLeft, viewTo
             text, font, textAlign, 'top'
         );
 
+        // calculate after rich convert
+        var rich = labelModel.get('rich');
+        if (rich) {
+            var cloneRich = zrUtil.clone(rich);
+            Object.keys(cloneRich).forEach(key => {

Review comment:
       Please use ES3
   https://echarts.apache.org/zh/coding-standard.html#compatibility




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [incubator-echarts] echarts-bot[bot] commented on pull request #12721: 修复issue #12708

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on pull request #12721:
URL: https://github.com/apache/incubator-echarts/pull/12721#issuecomment-636013188


   Thanks for your contribution!
   The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/incubator-echarts/wiki/How-to-make-a-pull-request).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org