Skip to content

fix(custom): provide generic for itemStyle. close #16775#16921

Closed
MaXal wants to merge 2 commits into
apache:masterfrom
MaXal:fix-16775
Closed

fix(custom): provide generic for itemStyle. close #16775#16921
MaXal wants to merge 2 commits into
apache:masterfrom
MaXal:fix-16775

Conversation

@MaXal
Copy link
Copy Markdown

@MaXal MaXal commented Apr 20, 2022

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

  • 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

@echarts-bot
Copy link
Copy Markdown

echarts-bot Bot commented Apr 20, 2022

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Comment thread src/chart/custom/CustomSeries.ts Outdated
Rename TCbParams to CallbackDataParams
) => CustomSeriesRenderItemReturn;

export interface CustomSeriesOption extends
export interface CustomSeriesOption<CallbackDataParams = never> extends
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions
Copy link
Copy Markdown
Contributor

This PR has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this PR. We are sorry for this but 2 years is a long time and the code base has been changed a lot. Thanks for your contribution anyway.

@github-actions github-actions Bot added the stale Inactive for a long time. Will be closed in 7 days. label Apr 16, 2025
@github-actions
Copy link
Copy Markdown
Contributor

This PR has been automatically closed because it has not had recent activity. Sorry for that and we are looking forward to your next contribution.

@github-actions github-actions Bot closed this Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: first-time contributor PR: revision needed size/XS stale Inactive for a long time. Will be closed in 7 days.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants