Buen día, tengo un ejemplo parecido a lo que necesito:
<html>
<head>
<title>Google Charts Tutorial</title>
<script type = "text/javascript" src =
"https://www.gstatic.com/charts/loader.js">
</script>
<script type = "text/javascript">
google.charts.load('current', {packages: ['corechart']});
</script>
</head>
<body>
<div id = "container" style = "width: 550px; height: 400px; margin: 0
auto">
</div>
<script language = "JavaScript">
function drawChart() {
// Define the chart to be drawn.
var data = google.visualization.arrayToDataTable([
['Year', 'Asia', 'Europe'],
['2012', 900, 390],
['2013', 1000, 400],
['2014', 1170, 440],
['2015', 1250, 480],
['2016', 1530, 540]
]);
var options = {title: 'Population (in millions)',
isStacked:true};
// Instantiate and draw the chart.
var chart = new
google.visualization.BarChart(document.getElementById('container'));
chart.draw(data, options);
}
google.charts.setOnLoadCallback(drawChart);
</script>
</body>
</html>
Este ejemplo funciona correcto pero que pasa si mis datos, que los obtengo
de una base de datos postgres vienen así:
year continente valor
2012 Asia 900
2012 Europe 390
2013 Asia 1000
2013 Europe 400
2014 Asia 1170
...
...
2016 Europe 540
Hay una forma directa de trasponer los daos? o una forma de declarar que
los datos vienen de esta forma?
Espero sus recomendaciones y desde ya muchas gracias
Guillermo
--
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/6011b79a-28e1-4010-9456-bb1d47af6e79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.