EleonoraRuffini
3 years agoQrew Member
Code Page for Google Chart
Hello,
I am trying to build a code page that would allow me to display some plots from Google Charts in which I feed some data from Quickbase. The idea is to then display the page in a form as iframe.
I am really a beginner for what concerns code pages, so I would need some help.
The following is one of the html pages where I would want to plug in my data.
I thought I could change the array passed in the data variable as follow, but it does not seem to work. Any thought?
------------------------------
Eleonora R.
------------------------------
I am trying to build a code page that would allow me to display some plots from Google Charts in which I feed some data from Quickbase. The idea is to then display the page in a form as iframe.
I am really a beginner for what concerns code pages, so I would need some help.
The following is one of the html pages where I would want to plug in my data.
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540]
]);
var options = {
title: 'Company Performance',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="curve_chart" style="width: 900px; height: 500px"></div>
</body>
</html>
I thought I could change the array passed in the data variable as follow, but it does not seem to work. Any thought?
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable();
var options = {
title: 'Company Performance',
curveType: 'function',
legend: { position: 'bottom' }
};
$.getScript("https://xxxxxx.quickbase.com/db/xxxxxx?a=API_GenResultsTable&apptoken=xxxxxx&query={20.EX.38}&clist=17&jsa=1",function(){
console.log(qdb_data);
});
data.addRows(qdb_data);
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="curve_chart" style="width: 900px; height: 500px"></div>
</body>
</html>
------------------------------
Eleonora R.
------------------------------