Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

how to return dynamic array from web-services using ajax ?

$
0
0

Hi,

I need to return newData array from web-services which is in code. how could i get it?

below format i need to return from web-services.

var newData = [['Year', 'Sales', 'Expenses', 'Other'],
      ['2004', 1000, 400, 232],
      ['2005', 1170, 460, 421],
      ['2006', 660, 1120, 4324],
      ['2007', 1030, 540, 4234],
      ['2008', 1530, 50, 234]];

Please help me.......

function drawLineChart(dataValues, Header, xTitle, yTitle) {

    dataTable = new google.visualization.DataTable();

    var newData = [['Year', 'Sales', 'Expenses', 'Other'],
      ['2004', 1000, 400, 232],
      ['2005', 1170, 460, 421],
      ['2006', 660, 1120, 4324],
      ['2007', 1030, 540, 4234],
      ['2008', 1530, 50, 234]];

    // determine the number of rows and columns.
    var numRows = newData.length;
    var numCols = newData[0].length;

    // in this case the first column is of type 'string'.
    dataTable.addColumn('string', newData[0][0]);

    // all other columns are of type 'number'.
    for (var i = 1; i < numCols; i++) { dataTable.addColumn('number', newData[0][i]); }

    // now add the rows.
    for (var i = 1; i < numRows; i++) { dataTable.addRow(newData[i]); }

    //// redraw the chart.
    //chart.draw(dataTable, options);

    new google.visualization.LineChart(document.getElementById('visualization'))
            .draw(dataTable, { title: xTitle, hAxis: { title: yTitle, titleTextStyle: { color: 'green' } } });
}

Thanks in advance


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>