[Chartjs]-Disable legend charts.js when width < XXX px

2👍

You can try with something like this :

if ($(window).width() < 500) {
  $(".doughnut-legend").hide();
} else {
  $(".doughnut-legend").show();
}
$(window).resize(function(e) {
  if ($(this).width() < 500) {
    $(".doughnut-legend").hide();
  } else {
    $(".doughnut-legend").show();
  }
});

http://jsfiddle.net/Tintin37/k568zvcr/

EDIT

You can generate the legend as Html, and play with the div generated.It’s not perfect, I ll try to find a better way to hide the legend

http://jsfiddle.net/Tintin37/5eLtdzck/

EDIT2

Like that it looks good :

http://jsfiddle.net/Tintin37/b9w2r01m/

Leave a comment