Skip to content

Mobile charts somehow duplicate and bloat the hardware #654

@kevinmu17

Description

@kevinmu17

Hi there,

I have a strange problem with chart.js, here is my scenario:

I have multiple action buttons on a website, they all drive the same chart, so on click they open the chart with its data, and if you press another button it will first destroy the chart and than reload it again with different data. this works absoluty perfect on a normal computer but when i am on a device, like smartphone (samsung note 2 android 4.4.2) it will open the chart perfectly the FIRST time, but when i click on a other button to load other data, it totally screws it up. it's even crashing my chrome browser on mobile.

How is this possible? i do the check if there is already set a chart, when it's set I destroy it first and than remake it.

heres my code example:

var lineGraph; // global variable
$(document).on('click','.BUTTON', function(e) {  
      (typeof lineGraph!= "undefined") ? lineGraph.destroy() : console.log("Line graph not loaded yet") ;
      lineGraph = document.getElementById("chart-area-lineGraph").getContext("2d");
      lineGraph = new Chart(lineGraph).Line(Data, lineOpt);
});

Regards, 
kevin


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions