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 2022/04/20 16:28:30 UTC

[GitHub] [echarts] MaXal opened a new pull request, #16921: fix(custom): provide generic for itemStyle. close #16775

MaXal opened a new pull request, #16921:
URL: https://github.com/apache/echarts/pull/16921

   <!-- Please fill in the following information to help us review your PR more efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [ x ] bug fixing
   - [ ] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   Fixes the TS error in case color is provided as a callback.
   
   
   
   ### Fixed issues
   
   #16775
   
   
   ## Details
   
   ### Before: What was the problem?
   ```
   series: [
       {
         type: 'custom',
         name: 'trend',
         itemStyle: {
           color: function f(_item){ //TS error
             return "red"
           }
         },
   ```
   
   
   
   ### After: How is it fixed in this PR?
   
   Now the generic parameter can be passed to CustomChart to properly define a callback for `color` property.
   
   
   
   ## Misc
   
   <!-- ADD RELATED ISSUE ID WHEN APPLICABLE -->
   
   - [ ] The API has been changed (apache/echarts-doc#xxx).
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   N.A.
   
   
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merging.
   
   ### 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.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

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 commented on a diff in pull request #16921: fix(custom): provide generic for itemStyle. close #16775

Posted by GitBox <gi...@apache.org>.
pissang commented on code in PR #16921:
URL: https://github.com/apache/echarts/pull/16921#discussion_r854719053


##########
src/chart/custom/CustomSeries.ts:
##########
@@ -338,7 +338,7 @@ export interface CustomSeriesOption extends
     /**
      * @deprecated
      */
-    itemStyle?: ItemStyleOption;
+    itemStyle?: ItemStyleOption<TCbParams>;

Review Comment:
   Could we use `CallbackDataParams` here as other series did?



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

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

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] MaXal commented on a diff in pull request #16921: fix(custom): provide generic for itemStyle. close #16775

Posted by GitBox <gi...@apache.org>.
MaXal commented on code in PR #16921:
URL: https://github.com/apache/echarts/pull/16921#discussion_r856261018


##########
src/chart/custom/CustomSeries.ts:
##########
@@ -338,7 +338,7 @@ export interface CustomSeriesOption extends
     /**
      * @deprecated
      */
-    itemStyle?: ItemStyleOption;
+    itemStyle?: ItemStyleOption<TCbParams>;

Review Comment:
   Thank you for the suggestion! Fixed.



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

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

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 diff in pull request #16921: fix(custom): provide generic for itemStyle. close #16775

Posted by GitBox <gi...@apache.org>.
Ovilia commented on code in PR #16921:
URL: https://github.com/apache/echarts/pull/16921#discussion_r890809114


##########
src/chart/custom/CustomSeries.ts:
##########
@@ -319,7 +319,7 @@ export type CustomSeriesRenderItem = (
     api: CustomSeriesRenderItemAPI
 ) => CustomSeriesRenderItemReturn;
 
-export interface CustomSeriesOption extends
+export interface CustomSeriesOption<CallbackDataParams = never> extends

Review Comment:
   Was this necessary? It seems to work without this line change and `= never` doesn't look a good way to define.



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

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

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 #16921: fix(custom): provide generic for itemStyle. close #16775

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

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


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

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

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] MaXal commented on a diff in pull request #16921: fix(custom): provide generic for itemStyle. close #16775

Posted by "MaXal (via GitHub)" <gi...@apache.org>.
MaXal commented on code in PR #16921:
URL: https://github.com/apache/echarts/pull/16921#discussion_r1168986067


##########
src/chart/custom/CustomSeries.ts:
##########
@@ -319,7 +319,7 @@ export type CustomSeriesRenderItem = (
     api: CustomSeriesRenderItemAPI
 ) => CustomSeriesRenderItemReturn;
 
-export interface CustomSeriesOption extends
+export interface CustomSeriesOption<CallbackDataParams = never> extends

Review Comment:
   I'm sorry for not getting back to you sooner. I had to provide `never` to minimize the needed change. If the "never" is omitted, it would require providing a generic argument to `CustomSeriesOption`, resulting in API changes.



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

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

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