Chartist-js: Line chart point and label placement

Created on 17 Jun 2016  路  3Comments  路  Source: gionkunz/chartist-js

First of all, thanks for creating such an awesome library! It's been a joy to switch to it from Highcharts. 馃槃

I have a quick question about the difference in placements between line charts and bar charts. In a line chart, the dot is placed on the axis grid lines, and the label is left aligned under it:

screen shot 2016-06-16 at 3 37 33 pm

In a bar chart, the bar is placed between the grid lines, and the label is centered under it.

screen shot 2016-06-16 at 3 38 01 pm

What I really need is a line graph, but with the points placed between the grid lines and the labels centered under them. Is there a way to accomplish this with Chartist? Thanks in advance!

Most helpful comment

Hi there. Thanks for the kind words :-) Unfortunately I didn't had much time to spend on chartist recently, but this will change very soon.

Using the draw event you could easily offset the points and lines by half a step length. Check this bin: http://jsbin.com/joloqac/edit?js,output

Cheers
Gion

All 3 comments

Hi there. Thanks for the kind words :-) Unfortunately I didn't had much time to spend on chartist recently, but this will change very soon.

Using the draw event you could easily offset the points and lines by half a step length. Check this bin: http://jsbin.com/joloqac/edit?js,output

Cheers
Gion

That did the trick! Thanks for the help Gion.

Hey,
I having the same issue, your solution solved it @gionkunz Thank you!
And again awesome charting library.
Quick question, how would I move the chart area, the area highlighted beneath the line chart with the line?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eddr picture eddr  路  3Comments

bluepineventures picture bluepineventures  路  4Comments

joshiashish23 picture joshiashish23  路  3Comments

FabienPapet picture FabienPapet  路  4Comments

alberk8 picture alberk8  路  4Comments