Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(axis): add customValues option to customize axis tick/label positions #19919

Merged
merged 3 commits into from
Jun 17, 2024

Conversation

Ovilia
Copy link
Contributor

@Ovilia Ovilia commented May 10, 2024

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Add option customValues to axisTick and axisLabel, which allow the user to specify tick/label positions.

This PR is based on #13636 . Since it's a long time since the opening of this PR, I made a few adjustment based on the original commit, with full regards to the contribution to @dvdkon 's contribution.

Fixed issues

#13627

Details

Before: What was the problem?

See issue #13627

After: How is it fixed in this PR?

The new option allows for completely custom tick/label positions, for example:

xAxis: {
	type: 'value',
	axisLabel: {
		customValues: [0, 4, 7, 8, 9]
	},
	axisTick: {
		alignWithLabel: true,
		customValues: [0, 0.5, 1, 1.5, 2, 8, 9]
	},
}

example

Usage

Are there any API changes?

In axis:

  • axisTick.customValues: (string | number | Date)[]
  • axisLabel.customValues: (string | number | Date)[]

Array of axis values on which a tick/label will be present (automatic tick generation is disabled)

Related test cases or examples to use the new APIs

test/axis-customTicks.html

Copy link

echarts-bot bot commented May 10, 2024

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.

The pull request is marked to be PR: author is committer because you are a committer of this project.

To reviewers: If this PR is going to be described in the changelog in the future release, please make sure this PR has one of the following labels: PR: doc ready, PR: awaiting doc, PR: doc unchanged

This message is shown because the PR description doesn't contain the document related template.

@Ovilia Ovilia added this to the 5.5.1 milestone May 10, 2024
Copy link
Contributor

The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-19919@0c90824

@gooroodev

This comment was marked as resolved.

@pissang pissang merged commit a282471 into master Jun 17, 2024
2 checks passed
Copy link

echarts-bot bot commented Jun 17, 2024

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

@pissang pissang deleted the dvdkon-fix-13627 branch June 17, 2024 12:43
@plainheart plainheart changed the title feat(axis): custom axis tick/label positions feat(axis): add customValues option to allow customizing axis tick/label positions Jun 18, 2024
@plainheart plainheart changed the title feat(axis): add customValues option to allow customizing axis tick/label positions feat(axis): add customValues option to customize axis tick/label positions Jun 18, 2024
plainheart added a commit to apache/echarts-doc that referenced this pull request Jun 21, 2024
@apache apache deleted a comment from admsev Jun 21, 2024
@shreya0230
Copy link

shreya0230 commented Jul 18, 2024

@Ovilia
Thank you for the customValues parameter. It’s very helpful. However, the DataZoom Y-axis slider isn't working as expected.

Please check the screenshot below. I have set customValues starting from 800 to 1400, and in the DataZoom slider, I have set startValue = 930 and endValue = 1330. You can see that the labels rendered are not correct; we are also seeing labels 900 and 1350 on the Y-axis.

PS: In axisLabel Formatter, I am no longer able to see index value (if customValues parameter is present in y-axis). index comes out to be undefined.

image

@plainheart
Copy link
Member

@shreya0230 Please open an issue for your question and mention this PR.

@naguindy
Copy link

naguindy commented Jan 9, 2025

Hi, Superset and generally speaking opensource newbie here, How can i use this customValues option in Superset? I am currently exprementing in docker container and customer requirements needs customized xaxis ticks. i installed echart5.6.0 usin npm but it is not showing the new features on superset frontend UI, thanks a lot for your help

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

Successfully merging this pull request may close these issues.

8 participants