morrisjs / morris.js

Pretty time-series line graphs
http://morrisjs.github.com/morris.js/
6.92k stars 1.23k forks source link

Crashed browser when use this code #784

Open Victorlerner opened 5 years ago

Victorlerner commented 5 years ago

Crashed browser when use this code


var line = new Morris.Line({
--
  | element: 'morris-line-chart',
  | resize: true,
  | data: [
  | {
  | y: '2018-9',
  | item1: 'INR 700'
  | },
  | {
  | y: '2019-2',
  | item1: 'INR 80.93'
  | },
  | {
  | y: '2019-3',
  | item1: 'INR 78'
  | },
  |  
  | ],
  | xkey: 'y',
  | ykeys: ['item1'],
  | labels: ['Item 1'],
  | gridLineColor: '#e0e0e0',
  | lineColors: ['#8d9498'],
  | lineWidth: 1,
  | hideHover: 'auto'
  | });

why this code breaks the browser? Google Chrome 75.0.3770.100 64bit

mosvhy commented 5 years ago

Just like me, it crashed when using Morris Line and Area. I implement this morris code using Promise and await inside a dynamic page that has different scripts that are loaded each page. It will be crashed if using await to load the script, and it was okay if does not use await to load the script. And the script that I mean is not the library, but the script to initialize the charts. I test it with 5 examples morris charts: Morris Donut, Bar, BarStacked, Line, and Area. I also have another example using jQuery Flot and jQuery Sparkline in that sample script and still okay without Morris LIne and Area in await mode.

Library version: morris.js v0.5.0, jquery.js v2.1.0; Browser version: Firefox ESR v60.7.2esr (64-bit);

pierresh commented 5 years ago

Hello, it would be great if you could provide any log that appears in the console.

pierresh commented 5 years ago

Actually, your values in item1 are not numeric. These should be numeric otherwise it is normal they cannot be shown on the Y-axis.