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

Uneven X-Axis values for a line chart #2975

Closed
nikhilpandey4 opened this issue Nov 10, 2017 · 5 comments
Closed

Uneven X-Axis values for a line chart #2975

nikhilpandey4 opened this issue Nov 10, 2017 · 5 comments

Comments

@nikhilpandey4
Copy link

Hi,
I have a time series line chart with data points like this
(1, 2), (3, 4), (8, 18), (9, 20).
Here difference in x-Axis values convey a meaningful information and hence this information is crucial to display. I looked around net, stack overflow and issues in this chart forum but couldn't find any answer of how to display labels on X-axis which are non- uniform in their placement. Can anyone please help.

@liuxuan30
Copy link
Member

liuxuan30 commented Nov 10, 2017

I don't quite follow what you said with your example. maybe an image

@nikhilpandey4
Copy link
Author

Hi,
I am trying to draw a line chart where my x-Axis values are
[1,3,8,9]
And corresponding y values are
[2,4,18,20]
Now x values are not evenly spaced , i.e., difference between 1&3, 3&8,8&9 are not same. While drawing the line chart it’s picking intermittent values using some algorithm so as to have equidistanced x values and not showing the exact x-axis values, which I would like to show. Here the difference between 2 xvalues conveys a crucial information ( say the growth in a particular period or when suddenly the nature of the thing changes) and that’s why I am very keen to display actual x-axis values which are not evenly spaced.

@liuxuan30
Copy link
Member

liuxuan30 commented Nov 10, 2017

you mean you want x value labels to be [1,3,8,9] exactly? You can override computeAxisValues() to return the value(set axis.entries) you want to display.

remember the idea is using your y data to define the y axis range, and it will calculate a proper interval so the axis labels look nice. If you force return some values, it may look bad (interval not the same), but it should draw at the right place.

@nikhilpandey4
Copy link
Author

Hi Sorry
But can you please post an example of this as its being asked by quite a lot number of people and it will serve as a great documentation.
Thanks in Advance.

@liuxuan30
Copy link
Member

that's why I suggest everyone takes a look at the function, it's all there. everyone has slight difference. but the easiest one is make axis.entries = [1,3,8,9]

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

No branches or pull requests

2 participants