Closed JajaRodriguez closed 5 years ago
Perhaps https://github.com/chartjs/chartjs-plugin-annotation will do what you're looking for?
Something like
var x = chart.chart.scales['x-axis-0'].getPixelForValue('2005');
var y = chart.chart.scales['y-axis-0'].getPixelForValue(3);
Is there any way to assign text position via chartjs coordinate system, in stead of "width., height."?
For instance, according to xCoord & yCoord arrays, is it possible to set the position of ctx.fillText x,y coordinates:
In stead of ctx.fillText("s(A)", width .28, height .70); can be like this : ctx.fillText("s(A)", 2005, 3); (2015,9) is belong to chartjs coordinate system.
My Aim: s(A) can be seen on chartjs area at the point of (2005,3) s(A) can be seen on chartjs area at the point of (2015,9)
Here is My Code:
Here is CodePen: Click
Here is My Aim: