Topic: ERROR ReferenceError: Chart is not defined

yasser@rxcity.com free asked 4 years ago


Error: 'Chart' is undefined I got this error in IE , it works fine in google chrome


Bartłomiej Malanowski staff commented 4 years ago

how can we reproduce your issue?


yasser@rxcity.com free answered 4 years ago


Below is my code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<link href="/mdbbootstrap/css/bootstrap.min.css" rel="stylesheet" />
<link href="/mdbbootstrap/css/mdb.min.css" rel="stylesheet" />
<link href="/mdbbootstrap/css/style.css" rel="stylesheet" />

<script src="/mdbbootstrap/js/jquery-3.4.1.min.js"></script>
<script src="/mdbbootstrap/js/popper.min.js"></script>
<script src="/mdbbootstrap/js/bootstrap.min.js"></script>
<script src="/mdbbootstrap/js/mdb.min.js"></script>

    <table class="body-table">
        <tr>
            <td valign="top">

                <!--#include file="Parts/ContactBlock.aspx"-->    
                <!--#include file="Parts/NewsBlock.aspx"-->
                <!--#include file="Parts/FooterBlock.aspx"-->
            </td>
            <td width="300px" valign="top">
                <!--#include file="Parts/RightBlock.aspx"-->
            </td>
        </tr>

    </table>
</form>

const slabels = []; const svalues = [];

  function DisplayStoreStats() {

      var today = new Date();
      var ctx = document.getElementById("myChart").getContext('2d');
      var myChart = new Chart(ctx, {
          type: 'bar',
          data: {
              labels: slabels,
              datasets: [{
                  label: '',
                  data: svalues,
                  backgroundColor: [
                      'rgba(255, 99, 132, 0.2)',
                      'rgba(54, 162, 235, 0.2)',
                      'rgba(255, 206, 86, 0.2)',
                      'rgba(75, 192, 192, 0.2)',
                      'rgba(153, 102, 255, 0.2)',
                      'rgba(255, 159, 64, 0.2)',
                      'rgba(54, 100, 235, 0.2)',
                      'rgba(75, 192, 192, 0.2)'
                  ],
                  borderColor: [
                      'rgba(255,99,132,1)',
                      'rgba(54, 162, 235, 1)',
                      'rgba(255, 206, 86, 1)',
                      'rgba(75, 192, 192, 1)',
                      'rgba(153, 102, 255, 1)',
                      'rgba(255, 159, 64, 1)',
                      'rgba(54, 162, 235, 1)',
                      'rgba(75, 192, 192, 1)'
                  ],
                  borderWidth: 1
              }]
          },
          options: {
              scales: {
                  yAxes: [{
                      ticks: {
                          beginAtZero: true
                      }
                  }]
              }
          }
      });
  }


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.9
  • Device: Desktop
  • Browser: IE
  • OS: windows
  • Provided sample code: No
  • Provided link: No