Skip to content

Conversation

@jasonpaige
Copy link

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

This PR adds the ability to 'inverse' any of the axis on a radar chart

Fixed issues

#18206

Details

Before: What was the problem?

Previously a radar chart could look like so:

image

However, you may which the cost to actually reflect negatively, the more expensive it is.

After: How does it behave after the fixing?

image

Now this single axis is inverted, where the cheaper the cost, the better it appears on the radar chart.

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

Related test cases or examples to use the new APIs

A test case has been added here: test/radar-inverse.html

The API to inverse an indicator axis works by simply adding inverse: true like this:

...
indicator: [
    { name: 'Speed'},
    { name: 'Reaction'},
    { name: 'Power'},
    { name: 'Cost £m', inverse: true, min: 4, max: 0},
    { name: 'Stamina'},
],
...

@echarts-bot
Copy link

echarts-bot bot commented Mar 13, 2023

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.

Document changes are required in this PR. Please also make a PR to apache/echarts-doc for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the PR: awaiting doc label.

indicatorAxis.name = indicatorModel.get('name');
// Inject model and axis
indicatorAxis.model = indicatorModel;
indicatorAxis.inverse = indicatorModel.get('inverse');
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably not necessary to be set to indicatorAxis.inverse. You should call indicatorModel.get('inverse') whenever you need the value.

Copy link
Author

Choose a reason for hiding this comment

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

Unfortunately, without this line the test graph does not render as expected. I think the Axes needs to know it is inversed as well as the data model which is why this line is there? I assumed this is how it is achieved on the other charts which support the inverse property as the base Axis class has the inverse property set.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the information. Yes, others may depend on this information.

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.

I've run visual tests about radar cases and all passed.

indicatorAxis.name = indicatorModel.get('name');
// Inject model and axis
indicatorAxis.model = indicatorModel;
indicatorAxis.inverse = indicatorModel.get('inverse');
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the information. Yes, others may depend on this information.

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.

@jasonpaige Please check the failed test case in the CI. It's werid that the failed case is not about radar. Please let me know if you fail to figure it out.

@x-merlin-x
Copy link

Andy progress on this?

@gkentr
Copy link

gkentr commented Nov 16, 2023

Also happen to have a need for this currently, looks like the CI logs are not available anymore though.

@github-actions
Copy link
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 Nov 15, 2025
@github-actions
Copy link
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.

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

Labels

PR: awaiting doc Document changes is required for this PR. PR: first-time contributor size/S 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.

4 participants