Chartjs-plugin-datalabels: Question about anchor and align

Created on 13 Oct 2017  路  5Comments  路  Source: chartjs/chartjs-plugin-datalabels

First off, thank you for this great plugin. The docs and samples are awesome.

Question:
I'm creating a scatter plot with labels. I have the labels working, however, I can't seem to get them positioned how I'd like. What I want is the text to be centered to the right of the plot point.

enhancement resolved

Most helpful comment

We could also support align as a number representing the angle (in degree) in which the label should be shifted away from the anchor point, with the following presets:

  • align: 'right' -> align: 0
  • align: 'bottom' -> align: 90
  • align: 'left' -> align: 180
  • align: 'top' -> align: 270

All 5 comments

@alex-martinez It's not possible (yet) to align horizontally for data bound to an horizontal scale, but it's on my todo list to support align: left|right|bottom|top in addition to start|center|end.

Can you post a screenshot of what you are thinking of exactly?

screen shot 2017-10-13 at 10 07 39 am

I created a small plugin to achieve the effect. There's still more I need to solve such as text ellipses and preventing text overlap.

We could also support align as a number representing the angle (in degree) in which the label should be shifted away from the anchor point, with the following presets:

  • align: 'right' -> align: 0
  • align: 'bottom' -> align: 90
  • align: 'left' -> align: 180
  • align: 'top' -> align: 270

Implemented in ee7723c7dd but not released yet! (docs)

Released in v0.2.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

boriskogan81 picture boriskogan81  路  4Comments

wjohnsto picture wjohnsto  路  12Comments

ericsvendsen picture ericsvendsen  路  15Comments

Lenophie picture Lenophie  路  14Comments

EmilMoe picture EmilMoe  路  4Comments