[BUG] Incorrect position of image when using with pointBackgroundColor
See original GitHub issueExpected Behavior
The picture should start rendering from the left top position of the point and should fill up the point.
Current Behavior
The picture starts rendering from the centre of the point.
Possible Solution
I am not sure about where the problem is, but the following change worked for me.
Add the following line after https://github.com/chartjs/Chart.js/blob/master/src/helpers/helpers.canvas.js#L75
ctx.translate(-1 * radius, -1 * radius);
Steps to Reproduce (for bugs)
Here is a sample codepen that demonstrates the problem: https://codepen.io/anon/pen/aRgjwz
Context
I want to place the user avatars on the graph data points as can see in the expected behavior.
Environment
- Chart.js version: 2.7.3
- Browser name and version: Chrome [Version 70.0.3538.77 (Official Build) (64-bit)]
- Link to my project: https://codepen.io/anon/pen/aRgjwz
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
javascript - why tooltip appears wrong in my chart JS? - Stack Overflow
I have a chart that I have developed using Chart JS and it works good. ... So for example in the image below,...
Read more >Images with different align parameters display in incorrect ...
Bug CONFSERVER-18762 - Images with align tags are automatically indented as if they were ... The images display in incorrect order/position.
Read more >Smarty - Kaburi
Simple HTML5 Charts using the canvas tag. https://github.com/chartjs/Chart.js; License: MIT. HINT! Use Smarty Colorpicker to get RGBA colors for your graphs!
Read more >IE CSS bugs when using floats and background-color
If a div is given a background colour and contains floated items (floated using CSS's float or HTML 's align on images), things...
Read more >[Solved]-How can I color dots in a xy scatterplot according to column ...
There is an Excel add-in called Funfun that allows you to use javascript, ... the scatter chart with each dot having his designated...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You may want to use chartjs-plugin-datalabels for text labels. You can also take the same approach as above like this.
@nagix Thank you for the quick response.
I’ve tried pattern with offset and with
repeat
, now the picture seems to be aligned to the center, but it is not visible completely. Please check https://codepen.io/anon/pen/PxzYLj