1

I'm working on lightning component for community and using Chartjs library. Bar chart was working fine on chrome , but today when chrome install last update ( Version 60.0.3112.90 (Official Build) (64-bit) )

it start crash with message of " Not enough memory" doughnut still works fine but bar is not

it seems happen when loading Chartjs resource also

please help.

this is sample example I create: component:

<aura:component controller="chartReportExtension" implements="lightning:actionOverride,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes"  access="global">

    <ltng:require  scripts="{! $Resource.Chart}"
          afterScriptsLoaded="{!c.jsLoaded}" />

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />

    <div aura:id="canvas-holder" style="width:40%">

      <canvas aura:id="chart-area" />

   </div>
</aura:component>

Controller:

   ({
      doInit: function(component, event, helper) {

},
    jsLoaded : function(component, event, helper) {
        console.log("1");
        var config = {

    type: 'bar',

      data: {

         datasets: [{

            data: [

                 100,

                   50,

                 20,

                 110,

                  10,

              ],

            backgroundColor: [

                '#18335C','#1FB1C9','#ADCDC1','#D7C77E', '#0066ff'

              ],

             label: 'Dataset 1'

          }],

         labels: [

               "Red",

            "Orange",

             "Yellow",

              "Green",

              "Blue"

          ]

   }
        };

        console.log("2");


       var ctx = component.find("chart-area").getElement().getContext("2d");
console.log("3");
        var myDoughnut = new Chart(ctx, config);
console.log("4");
    }

})
  • Same problem. No solution yet. – Gabe Sumner Aug 15 '17 at 17:06
0

I had the same problem and fixed it by disabling LockerService on that Lightning Component. Because LockerService is now mandatory, this was done by changing the API version of the Lightning Component to 38.0.

(Search LockerService in Setup and you'll see some instructions about how to disable LockerService on a Lightning Component).

Click the following link for instructions on changing the API version of a Lightning Component: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_versioning.htm

There is probably a better fix for this, but this is what made my chart work again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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