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

parseTime for Bar Charts - be or not to be? #634

Open
Demitrius opened this issue Jan 12, 2016 · 2 comments
Open

parseTime for Bar Charts - be or not to be? #634

Demitrius opened this issue Jan 12, 2016 · 2 comments

Comments

@Demitrius
Copy link

Hello,

As I understand, where is no parseTime, dateFormat implementations for Bar charts,
What can I do in this case?

Looks not good if two charts will have different metrix

Use string as xkey not solution coz in some case I need display hours on x, but full date for hint.

Please help!

screenshot from 2016-01-12 14 43 15

@esseti
Copy link

esseti commented Mar 6, 2020

same problem here, any idea?

pierresh pushed a commit to pierresh/morris.js that referenced this issue Mar 7, 2020
@pierresh
Copy link

pierresh commented Mar 7, 2020

Hello,

That is a bit complicated to bring the option parseTime to bar charts. Instead, it is much easier to define a new line type for Line charts. I just made a commit on my fork of Morris.js.

With this code:

Morris.Line({
	element: 'chart_line',
	data: [
		{ year: '1958', nb: 9, e: 10 },
		{ year: '1962', nb: 4, e: 20 },
		{ year: '1970', nb: 2, e: 40 },
		{ year: '1994', nb: 1, e: 90 },
		{ year: '2002', nb: 1, e: 90 }
	],
	xkey: 'year',
	ykeys: ['nb', 'e'],
	labels: ['Editions Wins', 'e'],
	parseTime: true,
	pointSize: 0,
	dataLabels: false,
	lineType: 'vertical',
	lineWidth: 10
});

You should get something like this:
image

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

3 participants