I have a javascript string that contains all the data for "arrayToDataTable".
var pieData = "['Red', 3], ['Blue', 6] , ['Green', 8]";
My pie chart:
function drawPieChart() {
var data = google.visualization.arrayToDataTable([
['Team', 'Votes'],
pieData
]);
var options = {
sliceVisibilityThreshold: 0,
width: 620,
height: 300,
};
var chart = new google.visualization.PieChart(document.getElementById('pieChart'));
chart.draw(data, options);
}
When the function is run, the following error is rendered "Invalid type for row 0".
Is there some simple way to make the string pieData usable for arrayToDataTable?