9 Replies Latest reply: Apr 4, 2017 6:18 AM by Pavan reddy RSS

    Loading data in Array

    Carlo Vruwink

      Hello all,


      I'm working on an extension based on Morris.js.

      It has to loop through the data and put all values of txt_dimension/txt_expression in an Array.

      I tried some things (see code beneath) but with this solution it only gives the selected value or when nothing

      is selected the last value of an record in the line-chart



      for(var rowIx = 0; rowIx < td.Rows.length; rowIx++) {
                  var row = td.Rows[rowIx];
                  var txt_dimension = row[0].text;
                  var txt_expression = row[1].text;


      The function of the line-chart where I call my variables.


      $(function() {
                  new Morris.Line({
                    element: 'line-chart',
                    data:[{year: txt_dimension, value:txt_expression}],
                    xkey: 'year',
                    ykeys: ['value'],
                    labels: ['Value']


      If I use the example and fill in the Array like the code beneath it works fine but I wan't it to be generated with my own data.


        data: [
          { year: '2010', value: 100 },
          { year: '2011', value: 120 },
      { year: '2012', value: 90 }


      screenshot of the value that is given:


      Schermafbeelding 2014-04-16 om 14.54.44.png

      Hopefully someone has an answer to get this working?