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

feat(axis): custom axis tick/label positions. close #13627 #13636

Closed
wants to merge 1 commit into from

Conversation

dvdkon
Copy link

@dvdkon dvdkon commented Nov 17, 2020

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.

Fixed issues

#13627 (my own issue)

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?

  • The API has been changed.

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

@echarts-bot
Copy link

echarts-bot bot commented Nov 17, 2020

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/incubator-echarts-doc for document changes. When the doc PR is merged, the maintainers will remove the PR: awaiting doc label.

@echarts-bot echarts-bot bot added PR: awaiting doc Document changes is required for this PR. PR: awaiting review labels Nov 17, 2020
dvdkon added a commit to dvdkon/incubator-echarts-doc that referenced this pull request Nov 17, 2020
@pissang
Copy link
Contributor

pissang commented Nov 18, 2020

Thanks for the idea and implementation! We are planning features similar. Perhaps we can discuss it together

@dvdkon
Copy link
Author

dvdkon commented Nov 18, 2020

Thanks! That would be nice, I made this PR because it was quick and I wanted the feature sooner, but as long as ECharts has this functionality in some way, I'm happy.

@pissang pissang added this to the 5.2.0 milestone Nov 18, 2020
@pissang pissang modified the milestones: 5.2.0, 5.x May 5, 2021
@poczepeter
Copy link

Any updates on this?

@NotSqrt
Copy link

NotSqrt commented Apr 1, 2022

@pissang This feature would be really useful to avoid funky tick positions for a weekly bar graph with axis type: 'time' like this one:
image

Can it be merged and released please ?
Thanks a lot !

Copy link

@jordigoyanes jordigoyanes left a comment

Choose a reason for hiding this comment

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

LGTM

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.

This is indeed a fantastic feature and I deeply apologise for not having reviewed it over the past few years. There are only a few areas that require improvement. Given the significant amount of time that has lapsed, I have created a new PR based on this one. Please rest assured that your commit information has been retained in the records, and we greatly value your contribution. We warmly invite you to continue the conversation in the new PR.

@Ovilia Ovilia removed this from the 5.5.1 milestone May 10, 2024
@Ovilia Ovilia closed this May 10, 2024
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. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants