*<!DOCTYPE html>*
*<html>*
*<head>*
*<meta charset="ISO-8859-1">*
*<title>Insert title here</title>*
*</head>*
*<script type="text/javascript" 
src="https://www.google.com/jsapi";></script>*
*<script 
src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js";></script>*
*<script>*
*google.load('visualization', '1', {'packages':['corechart']});*

*// Set a callback to run when the Google Visualization API is loaded.*
*google.setOnLoadCallback(drawChart);*
  
*function drawChart() {*
*  var jsonData = $.ajax({*
*      url: 
"http://127.0.0.1:9001/jolokia/read/MineStar:type=Speedometer,name=Statistics/*",*
*      dataType:"json",*
*      async: false*
*      }).responseText;*
      
*  var parsed = JSON.parse(jsonData);*

*  var arr = [];*

*  for(var x in parsed){*
*    arr.push(parsed[x]);*
*  }*
  
  
 
*  // Create our data table out of JSON data loaded from server.*
*  var size = 0;*
*  for(var sizeCount in arr[3]){*
*      size++;*
*  }*
*  var dataArray = new Array(size+1);*
*  dataArray[3] = new Array();*
*  dataArray[3][0] = 'EPM';*
*  dataArray[3][1] = 'Buffered';*
*  dataArray[3][2] = 'ThreadCount';*
  
*  //dataArray[0][2] = {type:'string', role:'tooltip'};*
*  var i = 3;      *
  
*  while(i < size+1){*
*      dataArray[i] = new Array();*
*      //dataArray[i][1] = (jsonObj[i].siteIndicatorColor);*
*      dataArray[i][0] =(arr[i].EPM);*
*      dataArray[i][1] = (arr[i].Buffered);*
*      dataArray[i][2] = (arr[i].ThreadCount);*
*      i++;*
*  }*



*  var data = new google.visualization.arrayToDataTable(dataArray);*
*  var chart = new 
google.visualization.DataTable(document.getElementById('chart_div'));*
*  chart.draw(data, {width: 400, height: 240});*
*}*







*</script>*
*<body>*
*<div id="chart_div"></div>*
*</body>*
*</html>*

I have written this code. But its not working. It is saying as :* Uncaught 
TypeError: Array.prototype.map called on null or undefined *

On Tuesday, September 30, 2014 11:50:33 AM UTC+5:30, [email protected] 
wrote:
>
> I have a json format data. But I need to parse only "value" data from it 
> and show it in google visualisation api. How can I achieve this.
>
>
>
>
> Consider the following JSON data:
>
> {
> timestamp: 1412048041,
> status: 200,
>
>     request: {
>               mbean: "MineStar:name=Statistics,type=Speedometer",
>               type: "read"
>              },
>     value:   {
>               EPM: 1,
>               Buffered: 0,
>               ThreadCount: 142
>              }}
>
>  I have used jolokia jar to convert my jmx beans to json data.
>
> How can I parse only "value" to a UI using google visualisation api?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to