The text isn't clean/sharp!
Hello,
I believe there is some issue with the text in my charts.
Ideally, a chart should look this way
But, in my case, the text seems to be blurry and too smooth. It doesn't look sharp/clean at all.

Following are the options I am using:
options: {
animation: {
duration: 5000,
easing: "easeOutBounce"
},
tooltips: {
mode: "label"
},
bar: {
stacked: true
},
scales: {
xAxes: [{
gridLines: {
display: false
},
ticks: {
beginAtZero: true
}
}],
yAxes: [{
gridLines: {
display: false
},
ticks: {
beginAtZero: true,
max: {!! ($individualStatsMax+1) !!},
}
}]
},
legend: {
labels: {
boxWidth: 10,
fontSize: 14
}
}
}
Now, I understand the first image isn't ChartJs, so the font family can be different, but why is the text not sharp at all? Is this happening because of the theme I am using? If yes, what really can it be? Is there a way to fix this from ChartJs only?? If no, what else can be causing this?
Thanks,
@prateekkathal This is due to the canvas rendering so its based on the browser / device and there is probably not much we can do at the moment. From http://stackoverflow.com/questions/4550926/subpixel-anti-aliased-text-on-html5s-canvas-element the fonts can be improved if the canvas context has no alpha channel
@etimberg any news on this?
My chart too is looking blurry compared to other charts, ie. https://jsfiddle.net/askhflajsf/xzk6sh1q/ compared to https://coin.dance/volume/paxful/USD.
cc @prateekkathal
Like @etimberg said, I believe this is a property of HTML5 canvas tag and so the ChartJs team isn't really able to do much about it.
Still, I would recommend you to have a look at this article - https://stackoverflow.com/questions/15661339/how-do-i-fix-blurry-text-in-my-html5-canvas
@etimberg If there is any scope of improvement in this, I think you should add some documentation on this regard on the main site.
CC: @frankie-loves-jesus
I faced this today on Chrome latest version, literally wasted 3 hours to chase it. Finally it turned out that issue only occurs only when browser zoom is reduced less than 100%, resetting window zoom to 100% resolved the issue.
Hope this info helps the developers to reproduce and fix the bug!!!
Had the same issue and tested different zooms. I have the blurry effects also with zoom > 100%. Only at 100% the chart is fine.
https://github.com/apache/incubator-echarts/ which is also Canvas based, doesn't have this issue. I think there is something to be done here (yes I don't know what).
We can't expect the user to not use the zoom. Can you, at least, reopen it?
Make sure that you don't adding some css to the canvas element. In my case I found that I am adding border property to the canvas element what was causing the problem of blur on text and bars.
dont use something like that :
`canvas { border: 1px solid #000 }`
or with id or class like that :
`#myChart { border: 1px solid #000 }`
`.myChart { border: 1px solid #000 }`
Any hint on this? Changing the zoom to > 100% solves the problem, but the user must be able to handle the browser's zoom.
@reda-alaoui can you share an example where echarts correctly handles the browser zoom != 100%?
I tried a few of their examples and it's doesn't behave better (actually worse for zoom > 100%)

@nahue086 We already adjust the scale of the canvas when the zoom is < 100% and I'm not sure what we can do better to make the text to appear sharp, neither if it's possible.
If anyone have a working (and clean) solution, feel free to open a PR.
I've actually run into this. It's not just the text, but it's everything about the chart is not sharp. The issue is that we need to make all drawing straddle the pixels: https://stackoverflow.com/a/8696641/64421
@benmccann agreed, it's not only the text but I don't understand how your comment (and solution) is related to this issue which is about the browser zoom? If I'm not wrong, we already straddle the pixels when drawing lines (e.g. when drawing scale lines using alignPixel).
I noticed that when you don't straddle the pixels then adjusting the zoom in Chrome will often make things better. I don't have an explanation for why. I missed that this issue is about zooming making things worse
I wasn't aware of alignPixel. I think most places we don't use it. I wonder if we could use context.translate(0.5, 0.5) to make it substantially easier to straddle pixels rather than trying to manually add 0.5 to every location we do a drawing
I notice the blurry charts in Firefox only, in Chromium they are crisp.
Edit:
I just ran into this CSS fix:
#chartJS {
image-rendering: optimizeSpeed; /* Older versions of FF */
image-rendering: -moz-crisp-edges; /* FF 6.0+ */
image-rendering: -webkit-optimize-contrast; /* Webkit (non standard naming) */
image-rendering: -o-crisp-edges; /* OS X & Windows Opera (12.02+) */
image-rendering: crisp-edges; /* Possible future browsers. */
-ms-interpolation-mode: nearest-neighbor; /* IE (non standard naming) */
}
Source: https://stackoverflow.com/a/33161568
Edit2:
It is not a fix per se, but the charts look better when you do this on a MacBook Pro with Retina screen (touch bar)
I had this and manually disabling, then reenabling the z-index on chartjs-size-monitor seemed to make it render properly. No idea why that works.
My charts were also blurry. I noticed that if I disabled box-sizing: border-box (which was being applied by Bootstrap to all elements) then the charts were clear. So I added canvas: { box-sizing: initial; } to my CSS which solved the problem.
My charts were also blurry. I noticed that if I disabled
box-sizing: border-box(which was being applied by Bootstrap to all elements) then the charts were clear. So I addedcanvas: { box-sizing: initial; }to my CSS which solved the problem.
See my answer here : https://stackoverflow.com/questions/33385398/how-to-fix-blurry-chart-issue-in-chart-js/53414863#53414863
any new updates?
I am using chartjs v4 but still this issue persist, Is there any new update?