i'm trying to generate a chart using Marrisjs which i have done a few times before with no issue. However for some reason this one is proving to be very annoying! Any ideas where i'm going wrong?
<h4 class="card-title">Pedigree Chart</h4>
<div id="morris-line-chart"></div>
$(function () {
"use strict";
// LINE CHART
Morris.Line({
element: 'morris-line-chart'
, resize: true
, data: [
{y: 'April',pedigrees_added: 1},
{y: 'March',pedigrees_added: 0},
{y: 'February',pedigrees_added: 3},
{y: 'January',pedigrees_added: 0},
{y: 'December',pedigrees_added: 0},
{y: 'November',pedigrees_added: 0},
{y: 'October',pedigrees_added: 0},
{y: 'September',pedigrees_added: 0},
{y: 'August',pedigrees_added: 0},
{y: 'July',pedigrees_added: 0},
{y: 'June',pedigrees_added: 0},
{y: 'May',pedigrees_added: 0},]
, xkey: 'y'
, ykeys: ['pedigrees_added']
, labels: ['New added']
, gridLineColor: '#eef0f2'
, lineColors: ['#009efb']
, lineWidth: 1
, hideHover: 'auto'
});
});
The problem is the information doesn't seem to be displaying properly. i'm guessing there is a syntax error somewhere.
this library only works with dates x-axis. (https://morrisjs.github.io/morris.js/lines.html) change yor data like that:
data: [
{y: '2019-04',pedigrees_added: 1},
{y: '2019-03',pedigrees_added: 0},
{y: '2019-02',pedigrees_added: 3},
{y: '2019-01',pedigrees_added: 0},
{y: '2018-12',pedigrees_added: 0},
{y: '2018-11',pedigrees_added: 0},
{y: '2018-10',pedigrees_added: 0},
{y: '2018-09',pedigrees_added: 0},
{y: '2018-08',pedigrees_added: 0},
{y: '2018-07',pedigrees_added: 0},
{y: '2018-06',pedigrees_added: 0},
{y: '2018-05',pedigrees_added: 0}]