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 2021/03/17 10:14:42 UTC

[GitHub] [echarts] Ovilia opened a new pull request #14497: WIP(legend): make default legend more intuitive

Ovilia opened a new pull request #14497:
URL: https://github.com/apache/echarts/pull/14497


   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [ ] bug fixing
   - [x] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   <!-- USE ONCE SENTENCE TO DESCRIBE WHAT THIS PR DOES. -->
   
   Update default legend style so that the icons looks more intuitively like that of the series.
   
   ### Fixed issues
   
   <!--
   - #xxxx: ...
   -->
   
   
   ## Details
   
   ### Before: What was the problem?
   
   <!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
   
   Legend for line series only have the color of the series, lacking `itemStyle.borderWidth`, `itemStyle.borderColor`, `lineStyle.color`, `lineStyle.borderColor` and etc.
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   ### After: How is it fixed in this PR?
   
   Legend for line series looks more like that of the series.
   `emptyCircle` has been changed to `circle`.
   
   <img width="1349" alt="屏幕快照 2020-04-16 11 54 58" src="https://user-images.githubusercontent.com/779050/79412906-25618400-7fd9-11ea-899b-b2febcdad606.png">
   
   See `test/legend-style.html` for more info.
   
   
   
   ## Usage
   
   ### Are there any API changes?
   
   - [x] The API has been changed.
   
   <!-- LIST THE API CHANGES HERE -->
   
   // TODO: add changes here
   
   ### Related test cases or examples to use the new APIs
   
   `test/legend-style.html`
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merge.
   
   ### Other information
   
   There was a PR #12444 before v5.0 and there was too much to be merged so I made this new PR based on v5.0 code base.
   


----------------------------------------------------------------
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] [echarts] Ovilia commented on a change in pull request #14497: WIP(legend): make default legend more intuitive

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



##########
File path: src/component/legend/LegendModel.ts
##########
@@ -59,7 +63,77 @@ export interface LegendSelectorButtonOption {
     title?: string
 }
 
-interface DataItem {
+export interface LegendItemStyleOption {
+    color?: ZRColor | 'inherit'
+    opacity?: number | 'inherit'
+    decal?: DecalObject | 'none' | 'inherit'
+    shadowBlur?: number | 'inherit'
+    shadowColor?: ColorString | 'inherit'
+    shadowOffsetX?: number | 'inherit'
+    shadowOffsetY?: number | 'inherit'
+    borderColor?: ZRColor | 'inherit'
+    borderWidth?: number | 'inherit' | 'auto'
+    borderType?: ZRLineType | 'inherit'
+    borderCap?: CanvasLineCap | 'inherit'
+    borderJoin?: CanvasLineJoin | 'inherit'
+    borderDashOffset?: number | 'inherit'
+    borderMiterLimit?: number | 'inherit'
+}
+
+export interface LegendLineStyleOption {
+    width?: number | 'inherit' | 'auto'
+    color?: ZRColor | 'inherit'
+    opacity?: number | 'inherit'
+    type?: ZRLineType | 'inherit'
+    cap?: CanvasLineCap | 'inherit'
+    join?: CanvasLineJoin | 'inherit'
+    dashOffset?: number | 'inherit'
+    miterLimit?: number | 'inherit'
+    shadowBlur?: number | 'inherit'
+    shadowColor?: ColorString | 'inherit'
+    shadowOffsetX?: number | 'inherit'
+    shadowOffsetY?: number | 'inherit'
+    inactiveColor?: ColorString,
+    inactiveWidth?: number
+}

Review comment:
       @plainheart Thanks for the suggestion. This really helps to reduce the mistake of missing some attributes.




-- 
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] [echarts] pissang merged pull request #14497: feat(legend): make default legend more intuitive

Posted by GitBox <gi...@apache.org>.
pissang merged pull request #14497:
URL: https://github.com/apache/echarts/pull/14497


   


-- 
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] [echarts] plainheart commented on a change in pull request #14497: WIP(legend): make default legend more intuitive

Posted by GitBox <gi...@apache.org>.
plainheart commented on a change in pull request #14497:
URL: https://github.com/apache/echarts/pull/14497#discussion_r601991419



##########
File path: src/component/legend/LegendModel.ts
##########
@@ -59,7 +63,77 @@ export interface LegendSelectorButtonOption {
     title?: string
 }
 
-interface DataItem {
+export interface LegendItemStyleOption {
+    color?: ZRColor | 'inherit'
+    opacity?: number | 'inherit'
+    decal?: DecalObject | 'none' | 'inherit'
+    shadowBlur?: number | 'inherit'
+    shadowColor?: ColorString | 'inherit'
+    shadowOffsetX?: number | 'inherit'
+    shadowOffsetY?: number | 'inherit'
+    borderColor?: ZRColor | 'inherit'
+    borderWidth?: number | 'inherit' | 'auto'
+    borderType?: ZRLineType | 'inherit'
+    borderCap?: CanvasLineCap | 'inherit'
+    borderJoin?: CanvasLineJoin | 'inherit'
+    borderDashOffset?: number | 'inherit'
+    borderMiterLimit?: number | 'inherit'
+}
+
+export interface LegendLineStyleOption {
+    width?: number | 'inherit' | 'auto'
+    color?: ZRColor | 'inherit'
+    opacity?: number | 'inherit'
+    type?: ZRLineType | 'inherit'
+    cap?: CanvasLineCap | 'inherit'
+    join?: CanvasLineJoin | 'inherit'
+    dashOffset?: number | 'inherit'
+    miterLimit?: number | 'inherit'
+    shadowBlur?: number | 'inherit'
+    shadowColor?: ColorString | 'inherit'
+    shadowOffsetX?: number | 'inherit'
+    shadowOffsetY?: number | 'inherit'
+    inactiveColor?: ColorString,
+    inactiveWidth?: number
+}

Review comment:
       Most of these options are extended from `ItemStyleOption` and `LineStyleOption`, so, to keep the type definition uniform for the same options in each component and the document, I'm thinking whether it would be better if we reduce some duplicate definition work and use a type utility to extend(reuse) current existing interface and only define or extend(expand) the needed extra types for options.
   
   Just personally, `LegendItemStyleOption` and `LegendLineStyleOption` could probably be simplified like this,
   
   ```ts
   // T: the type to be extended
   // ET: extended type for keys of T
   // ST: special type for T to be extended 
   type ExtendPropertyType<T, ET, ST extends { [key in keyof T]: any }> = {
       [key in keyof T]: key extends keyof ST ? T[key] | ET | ST[key] : T[key] | ET
   };
   
   export interface LegendItemStyleOption extends ExtendPropertyType<ItemStyleOption, 'inherit', {
       borderWidth: 'auto'
   }> {}
   
   export interface LegendLineStyleOption extends ExtendPropertyType<LineStyleOption, 'inherit', {
       width: 'auto'
   }> {
       inactiveColor?: ColorString
       inactiveWidth?: number
   }
   ```
   
   It should be working well like before.
   




-- 
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] [echarts] echarts-bot[bot] commented on pull request #14497: WIP(legend): make default legend more intuitive

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


   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/echarts/wiki/How-to-make-a-pull-request).
   
   The pull request is marked to be `PR: author is committer` because you are a committer of this project.
   
   Document changes are required in this PR. Please also make a PR to [apache/echarts-doc](https://github.com/apache/echarts-doc) for document changes. When the doc PR is merged, the maintainers will remove the `PR: awaiting doc` label.


----------------------------------------------------------------
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] [echarts] plainheart commented on a change in pull request #14497: WIP(legend): make default legend more intuitive

Posted by GitBox <gi...@apache.org>.
plainheart commented on a change in pull request #14497:
URL: https://github.com/apache/echarts/pull/14497#discussion_r601991419



##########
File path: src/component/legend/LegendModel.ts
##########
@@ -59,7 +63,77 @@ export interface LegendSelectorButtonOption {
     title?: string
 }
 
-interface DataItem {
+export interface LegendItemStyleOption {
+    color?: ZRColor | 'inherit'
+    opacity?: number | 'inherit'
+    decal?: DecalObject | 'none' | 'inherit'
+    shadowBlur?: number | 'inherit'
+    shadowColor?: ColorString | 'inherit'
+    shadowOffsetX?: number | 'inherit'
+    shadowOffsetY?: number | 'inherit'
+    borderColor?: ZRColor | 'inherit'
+    borderWidth?: number | 'inherit' | 'auto'
+    borderType?: ZRLineType | 'inherit'
+    borderCap?: CanvasLineCap | 'inherit'
+    borderJoin?: CanvasLineJoin | 'inherit'
+    borderDashOffset?: number | 'inherit'
+    borderMiterLimit?: number | 'inherit'
+}
+
+export interface LegendLineStyleOption {
+    width?: number | 'inherit' | 'auto'
+    color?: ZRColor | 'inherit'
+    opacity?: number | 'inherit'
+    type?: ZRLineType | 'inherit'
+    cap?: CanvasLineCap | 'inherit'
+    join?: CanvasLineJoin | 'inherit'
+    dashOffset?: number | 'inherit'
+    miterLimit?: number | 'inherit'
+    shadowBlur?: number | 'inherit'
+    shadowColor?: ColorString | 'inherit'
+    shadowOffsetX?: number | 'inherit'
+    shadowOffsetY?: number | 'inherit'
+    inactiveColor?: ColorString,
+    inactiveWidth?: number
+}

Review comment:
       Most of these options are extended from `ItemStyleOption` and `LineStyleOption`, so, to keep the type definition uniform for the same options in each component and the document, I'm thinking whether it would be better if we reduce some duplicate definition work and use a type utility to extend(reuse) current existing interface and only define or extend(expand) the needed extra types for options.
   
   Just personally, `LegendItemStyleOption` and `LegendLineStyleOption` could probably be simplified like this,
   
   ```ts
   // T: the type to be extended
   // ET: extended type for keys of T
   // ST: special type for T to be extended 
   type ExtendPropertyType<T, ET, ST extends { [key in keyof T]: any }> = {
       [key in keyof T]: key extends keyof ST ? T[key] | ET | ST[key] : T[key] | ET
   };
   
   export interface LegendItemStyleOption extends ExtendPropertyType<ItemStyleOption, 'inherit', {
       borderWidth?: 'auto'
   }> {}
   
   export interface LegendLineStyleOption extends ExtendPropertyType<LineStyleOption, 'inherit', {
       width?: 'auto'
   }> {
       inactiveColor?: ColorString
       inactiveWidth?: number
   }
   ```
   
   It should be working well like before.
   




-- 
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] [echarts] echarts-bot[bot] commented on pull request #14497: feat(legend): make default legend more intuitive

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


   Congratulations! Your PR has been merged. Thanks for your contribution! 👍


-- 
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