Discussion:
[visualization-api] Reading a CSV or JSON Formatted DATA FILE into the HTML5-based Chart instead of Embedding it into the CODE?
Lee Deneault
2016-09-01 22:16:54 UTC
Permalink
Dear Google Groups,

Instead of *EMBEDDING* the following *DATA*, seen below, into *HTML5 Code*
...

function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540]
]);


I would like to be able to actually *READ* this very same data from either a *CSV *or a *JSON *formatted *DATA FILE*!

Needless to say, any insight would be *GREATLY* appreciated!

Thanks, in advance, for your time and consideration!

Best Regards,

LEE
--
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 google-visualization-api+***@googlegroups.com.
To post to this group, send email to google-visualization-***@googlegroups.com.
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/b7dc6bda-75af-47a6-8797-e0492fe7a8e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Simon Roberts' via Google Visualization API
2016-09-09 09:14:03 UTC
Permalink
Hello Lee,

Maybe something like this -

$(document).ready(function () {

$.ajax({
url: "/Reporting/LeaveList",
data: "",
dataType: "json",
type: "POST",
contentType: "application/json; chartset=utf-8",
success: function (data) {
chartData = data;
},
error: function () {
alert("Error loading data! Please try again.");
}
}).done(function () {
// after complete loading data
google.setOnLoadCallback(drawChart);
drawChart();
});
});
Post by Lee Deneault
Dear Google Groups,
Instead of *EMBEDDING* the following *DATA*, seen below, into *HTML5 Code*
...
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540]
]);
I would like to be able to actually *READ* this very same data from either a *CSV *or a *JSON *formatted *DATA FILE*!
Needless to say, any insight would be *GREATLY* appreciated!
Thanks, in advance, for your time and consideration!
Best Regards,
LEE
--
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 google-visualization-api+***@googlegroups.com.
To post to this group, send email to google-visualization-***@googlegroups.com.
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/4d244bdd-b529-4b5c-a34e-48e0b3dc971b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...