Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(type): add overflow property to AxisLabelBaseOption interface. close #17363 #17808

Merged
merged 1 commit into from
Oct 27, 2022

Conversation

breizh24
Copy link
Contributor

@breizh24 breizh24 commented Oct 21, 2022

Co-authored-by: Giulio Mazzanti gmazzanti@protonmail.com

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

This PR sets the correct interface that AxisLabelBaseOption extends, changing it from TextCommonOption to LabelOption.

This PR adds the overflow property to the AxisLabelBaseOption interface.

Fixed issues

Details

Before: What was the problem?

The overflow property on xAxis.axisLabel works fine as you can see from this demo: Chart demo

The actual issue is with the type of xAxis.axisLabel (AxisLabelBaseOption) that is extending TextCommonOption insted of LabelOption which is already extending TextCommonOption which is missing the overflow property, resulting in a type error if We try to use that property in a typescript file.

If We look at the documentation We can see that the overflow property is available with all the others properties inside LabelOption https://echarts.apache.org/zh/option.html#xAxis.axisLabel.overflow

image

After: How does it behave after the fixing?

After setting the correct type We can use the overflow property on xAxis.axisLabel without getting a type error.

The issue was fixed by changing the interface that AxisLabelBaseOption was extending from TextCommonOption to LabelOption, as wrote before LabelOption is already extending TextCommonOption.
I have also removed from AxisLabelBaseOption the property that were already available in LabelOption.

The issue was fixed by adding the overflow property to AxisLabelBaseOption, copying the type of overflow from TextStyleProps.

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

ZRender Changes

  • 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

echarts-bot bot commented Oct 21, 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.

Copy link
Contributor

@Ovilia Ovilia left a comment

Choose a reason for hiding this comment

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

It seems a lot of attributes of LabelOption should not be included in AxisBaseOptionCommon. So it's probably not a good idea to extend it. Add overflow?: TextStyleProps['overflow'] to AxisBaseOptionCommon may be enough.

 apache#17363

Co-authored-by: Giulio Mazzanti <gmazzanti@protonmail.com>
@breizh24
Copy link
Contributor Author

breizh24 commented Oct 25, 2022

It seems a lot of attributes of LabelOption should not be included in AxisBaseOptionCommon. So it's probably not a good idea to extend it. Add overflow?: TextStyleProps['overflow'] to AxisBaseOptionCommon may be enough.

Agreed, I've done the requested changes

@breizh24 breizh24 changed the title fix(type): extend correct interface on AxisLabelBaseOption. close #17363 fix(type): add overflow property to AxisLabelBaseOption interface. close #17363 Oct 25, 2022
@breizh24 breizh24 requested a review from Ovilia October 25, 2022 12:00
@Ovilia Ovilia merged commit 817b84d into apache:master Oct 27, 2022
@echarts-bot
Copy link

echarts-bot bot commented Oct 27, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants