2017-09-17 2 views
0

Ich habe gesucht und gesucht und gelesen und gelesen und versucht und versucht. Ich muss etwas vermissen, weil die Implementierung dieses Features mir entgeht. Deshalb poste ich, in der Hoffnung, einige Vorschläge zu erbitten. Mir ist auch klar, dass Morris Chart nicht mehr unterstützt wird, aber es wurde mir zugewiesen, also tue ich mein Bestes. Hier sind die Fehler:Kann meine Morris-Charts nicht ohne Fehler funktionieren

morris-0.5.1.min.js:6 Uncaught TypeError: Cannot read property 'length' of undefined 
    at d.<anonymous> (morris-0.5.1.min.js:6) 
    at d.<anonymous> (morris-0.5.1.min.js:6) 
    at d.b.Grid.d.setData (morris-0.5.1.min.js:6) 
    at d [as constructor] (morris-0.5.1.min.js:6) 
    at d.c [as constructor] (morris-0.5.1.min.js:6) 
    at new d (morris-0.5.1.min.js:6) 
    at Object.d [as Area] (morris-0.5.1.min.js:6) 
    at HTMLDocument.<anonymous> (proc-totals-chartX.php:194) 
    at j (jquery-2.1.1.js:2) 
    at Object.fireWith [as resolveWith] (jquery-2.1.1.js:2) 

Und hier ist meine Funktion:

$(document).ready(function() { 
    Morris.Area({ 
     element: 'ChartArea', 
     data: [ 
      { y: '2017/01', ortiz: 155, curiel: 32, covarrubias: 20, castillo: 3 }, 
      { y: '2017/02', ortiz: 130, curiel: 25, covarrubias: 20, castillo: 6 }, 
      { y: '2017/03', ortiz: 186, curiel: 44, covarrubias: 61, castillo: 4 }, 
      { y: '2017/04', ortiz: 165, curiel: 29, covarrubias: 60, castillo: 5 }, 
      { y: '2017/05', ortiz: 182, curiel: 11, covarrubias: 40, castillo: 8, montalvo: 12 }, 
      { y: '2017/06', ortiz: 198, curiel: 9, covarrubias: 58, castillo: 13, montalvo: 18 } 
     ], 
     xkey: ['y'], 
     ykey: ['ortize','curiel','covarrubias','castillo','montalvo'], 
     labels: ['Ortiz', 'Curiel', 'Covarrubias', 'Castillo', 'Montalvo'] 
    }); 
}); 

Und ich habe versucht, jede und jeder Beschreibung zu erforschen. Ich habe immer noch keine Antwort. So werden alle Hinweise, Vorschläge und Lösungen sehr geschätzt. Danke

Antwort

0

Set yKey im Plural - yKeys.

JS Bin Example

Ihr Code, der

Morris.Area({ 
 
    element: 'area-example', 
 
    data: [ 
 
     { y: '2017/01', ortiz: 155, curiel: 32, covarrubias: 20, castillo: 3 }, 
 
     { y: '2017/02', ortiz: 130, curiel: 25, covarrubias: 20, castillo: 6 }, 
 
     { y: '2017/03', ortiz: 186, curiel: 44, covarrubias: 61, castillo: 4 }, 
 
     { y: '2017/04', ortiz: 165, curiel: 29, covarrubias: 60, castillo: 5 }, 
 
     { y: '2017/05', ortiz: 182, curiel: 11, covarrubias: 40, castillo: 8, montalvo: 12 }, 
 
     { y: '2017/06', ortiz: 198, curiel: 9, covarrubias: 58, castillo: 13, montalvo: 18 } 
 
    ], 
 
    xkey: 'y', 
 
    ykeys: ['ortize','curiel','covarrubias','castillo','montalvo'], 
 
    labels: ['Ortiz', 'Curiel', 'Covarrubias', 'Castillo', 'Montalvo'] 
 
});
<!DOCTYPE html> 
 
<html> 
 
<head> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="width=device-width"> 
 
    <title>JS Bin</title> 
 
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css"> 
 
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> 
 
<script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script> 
 
<script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script> 
 
</head> 
 
<body> 
 
    <div id="area-example" style="height: 250px;"></div> 
 
</body> 
 
</html>

arbeitet
Verwandte Themen