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

Plot date on both axis #4022

Closed
karthiksd9 opened this issue Mar 15, 2017 · 8 comments
Closed

Plot date on both axis #4022

karthiksd9 opened this issue Mar 15, 2017 · 8 comments

Comments

@karthiksd9
Copy link

karthiksd9 commented Mar 15, 2017

I am trying to plot the milestone chart, i.e. the chart that plots date on doth x and y axis.
I am using the type: "time" for both axis to do it :

		var config = {
			type: 'line',
			data: data1,
			options: {
				responsive: true,
				title:{
					display:true,
					text:'Milestone Chart'
				},

				scales: {
				xAxes: [{
						type: "time",
						display: true,
						scaleLabel: {
							display: true,
							labelString: 'Time-X'
						}
					}],
				
				yAxes: [{
				        type: "time",
				        position: 'left',
						display: true,
						scaleLabel: {
							display: true,
							labelString: 'Time-Y'
						},
						
						time: {
						    unit: 'month',
						    unitStepSize: 4
						},
					}]
				},

				legend: {
				    display: true,
				    position: 'bottom'
				}
			}
		};

The problem is, Y axis date is displaying inverted. i.e. it doesn't start with lowest date.
It starts with end date and moves up to the start date.
Can someone please help me how to fix it.

here is the fiddle:
https://jsfiddle.net/ovw0rudn/2/

@etimberg
Copy link
Member

To change the order, the ticks[] array needs to be reversed. Some of the other axes support this property already. I'm happy to merge a PR adding support for the reverse property to the time scale.

@karthiksd9
Copy link
Author

@etimberg Thanks. Adding reverse property to the time scale would be really helpful.

@karthiksd9
Copy link
Author

@etimberg How to reverse time scale in ticks?

@etimberg
Copy link
Member

@karthiksd9
Copy link
Author

@etimberg Thanks for the reply.
One quick question, Why the Y axis is plotting in reverse order? It should start from lowest date and end with max date right by default right? Just like x axis.

@etimberg
Copy link
Member

@karthiksd9 I agree that it's supposed to draw like that, but I think it actually does drawing from the top and the ticks array isn't correctly reversed. Either that, or the getPixelForValue function is wrong for time axes that are vertical.

@karthiksd9
Copy link
Author

Hi @etimberg ,
Any update on this Issue?

@nagix
Copy link
Contributor

nagix commented May 23, 2019

The reverse option support was added to time scale by #5927, and it is included in version 2.8.0.

@nagix nagix closed this as completed May 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants