The code is :
/**
* Created by Nagendra on 18-06-2017.
*/
google.charts.load('current', {packages: ['table']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
function drawChart() {
var jsonData = $.ajax({
url: "http://localhost:8989/getPMDResults",
dataType: "json",
crossDomain: true,
async: false
}).responseText;
var parsed = JSON.parse(jsonData);
var arr = [];
var reviewMap = {};
var dataArray = [['Class Name', 'Line Number', 'Code Review Result']];
/*for (var Key in parsed) {
//reviewMap[x] = parsed[x];
dataArray.push(['test'],['test'],['test']);
}*/
/*for (var x in parsed) {
arr.push(parsed[x]);
}
*/
/*var dataArray = [['Class Name', 'Line Number', 'Code Review Result']];
for (var i = 0; i < arr.length; i++) {
dataArray.push([arr[i]],[arr[i]],[arr[i]]);
}*/
var data = new google.visualization.arrayToDataTable(dataArray);
var chart = new
google.visualization.Table(document.getElementById('pmd_reviewResult_div'));
chart.draw(data, {width: 400, height: 240});
}
I get the result from the ajax call as the following map:
Object {Test1.cls: Array(80), Test2.cls: Array(33)}
1. Test1.cls:Array(33)
1. 0:Object
1. lineNumber:13
2. reviewFeedback:" Apex classes should declare a sharing model if
DML or SOQL is used"
How can I push the map object into data array with the 'Class Name 'as the
map's key and the 'Line Number', 'Code Review Result' as the values from the
map?
--
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 https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/79b208e5-2678-45cb-935b-64c054418f02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.