6

Opera Version: 32.0.1948.69 (the output works fine on other major browsers).

Does anyone know how could I possibly fix the blurriness from Chart.js?

The width of the chart isn't relevant here, no matter which dimesions I take it always has a level of blurriness (especially when hovering over the column) which I would like to eliminate.

Image:

enter image description here

Fiddle example: https://jsfiddle.net/eugensunic/1sg79n7x/1/

Fiddle code:

var array= [100, 59, 80, 333, 56, 55, 40]
var data = {
    labels: ["January", "February", "March", "April", "May", "June", "July"],
    datasets: [
        {
            label: "My First dataset",
            fillColor: "rgba(220,220,220,0.5)",
            strokeColor: "rgba(220,220,220,0.8)",
            highlightFill: "rgba(220,220,220,0.75)",
            highlightStroke: "rgba(220,220,220,1)",
            data: array
        }
     ]
};
 var options = {
        animation: true
    };
    var ctx = document.getElementById("myChart").getContext("2d");
    myNewChart = new Chart(ctx).Bar(data, options);

EDIT: Picture comparison between Chrome and Opera. enter image description here

14
  • 2
    I don't see a blurry chart in Firefox, Chrome, or IE11. Also, you can't link to the chart.js file from the website; use a CDN such as cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js - here's an updated jsFiddle: jsfiddle.net/1sg79n7x/2
    – Tieson T.
    Commented Oct 12, 2015 at 1:26
  • Sorry for the late response. I'm using opera (stable version). It works very well in the browsers that you've specified above. Opera fails. I've added the chart.min.js and removed the old one, still the problem is there.
    – EugenSunic
    Commented Oct 12, 2015 at 17:05
  • Which version of Opera?
    – Tieson T.
    Commented Oct 12, 2015 at 17:55
  • 2
    @eugensunic - I checked the fiddle on Opera (the version you mentioned) and compared it to Chrome (both on Desktop). Couldn't see any noticeable difference(yep, I didn't forget my glasses :-)). If it's not too much trouble could you add an image from Chrome for comparison when you get the chance. Also not exactly seeing the blurriness in the current image. Commented Oct 13, 2015 at 10:25
  • 2
    @eugensunic Does this seem any better: jsfiddle.net/1sg79n7x/4 ?
    – Tieson T.
    Commented Oct 13, 2015 at 19:48

2 Answers 2

3

You need to add a few lines of CSS properties to optimize image rendering for Opera as explained here: https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering and seen below.

canvas#myChart {
    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) */
}
-1

You could try rendering it as a png like so:

myLineChart.toBase64Image();

Of coarse this would make it static so It might not be the best answer.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.