What is the error you are getting? You mentioned above that the chart's don't load with '\n' in the join, but they do load if you have ',' - is that true? If so, I have no idea what is going on, as that code has nothing at all to do with drawing the charts. I could see how it may affect opening the CSV (it is possible you need to use '\r\n' instead of '\n' for opening the CSV in Windows, but I just ran the test code and downloaded the CSV which opened fine in Excel, so I don't think that's the issue).
On Wednesday, January 23, 2013 6:30:47 PM UTC-5, MTap1 wrote: > > If you use your example: http://jsfiddle.net/asgallant/MqERY/3/ The > error I am encountering occurs at line 206 in the script window. SO sorry > for the two attempts to explain. I am not sure what happened to the > tinkerbin info... > > On Friday, January 18, 2013 6:58:54 PM UTC-8, asgallant wrote: >> >> The tinkerbin link you sent doesn't contain any code. >> >> On Friday, January 18, 2013 8:10:28 PM UTC-5, MTap1 wrote: >>> >>> Thanks for the help! :) Like I mentioned, everything works fine on my >>> own computer (even your code). However, when I alter the table data to >>> support a .csv format, the "... var output = csvData.join('\n'); " line >>> from your example causes the map/charts/etc to fail to load on my localhost >>> port. Replacing the "\n" with anything else (e.g., ",") will sort of fix >>> the issue, but I fail to get the .csv in two column form. I had the same >>> problem when trying to print the data from a table to a textarea in the >>> body of my page. >>> >>> *Try running this code on your localhost:* >>> http://tinkerbin.com/IXRYVDkF. It's your code marked up where I am >>> having an issue. >>> >>> *Also, here is my code (printing to text area, but same issue occurs)*: >>> >>> function plotElevation(results) { >>> elevations = results; >>> var obj=document.getElementById('textlocation'); //This assigns the >>> textarea >>> >>> var path = []; >>> for (var i = 0; i < results.length; i++) { >>> path.push(elevations[i].location); >>> } >>> >>> if (polyline) { >>> polyline.setMap(null); >>> } >>> >>> polyline = new google.maps.Polyline({ >>> path: path, >>> strokeColor: "#79d6fe", >>> map: map}); >>> >>> data = new google.visualization.DataTable(); >>> data.addColumn('string', 'Resolution (m)'); >>> data.addColumn('number', 'Elevation (m)'); >>> var len= 0; >>> for (var i = 0; i < results.length; i++) { >>> len = len + elevations[i].resolution; >>> len1 = Math.round(len); >>> var print_len = len1.toString(); >>> data.addRow([print_len, elevations[i].elevation ]); >>> var txt=document.createTextNode(print_len+", >>> "+elevations[i].elevation+"\n") //This prescribes what to write in the >>> textarea >>> obj.appendChild(txt) /This adds text to the textarea >>> } >>> var endcode = document.createTextNode('Next City...'+"\n") >>> obj.appendChild(endcode) >>> document.getElementById('chart_div').style.display = 'block'; >>> chart.draw(data, { >>> width: 600, >>> height: 150, >>> legend: 'none', >>> titleY: 'Elevation (m)', >>> titleX: 'Resolution (m)', >>> focusBorderColor: '#00ff00', >>> colors: ['#cedfad'] >>> }); >>> } >>> >>> In my body: >>> >>> <textarea name= "textloc" id="textlocation" style="resize: none;" >>> cols="25" rows="20" ></textarea></td> >>> >>> On Tuesday, January 15, 2013 2:56:39 PM UTC-8, asgallant wrote: >>>> >>>> What do you mean when you say it causes the API not to load? That >>>> event listener shouldn't be created until after the API loaded. If you >>>> share the source code you are using on your local machine, I'll take a >>>> look >>>> and see what might be happening. >>>> >>>> On Tuesday, January 15, 2013 4:37:34 PM UTC-5, MTap1 wrote: >>>>> >>>>> Hi, I am attempting to export the elevation profiles from googles >>>>> elevation API to a CSV file using your hack example: >>>>> http://jsfiddle.net/asgallant/MqERY/3/. The code works wonderfully >>>>> in Dreamweaver, exporting to Google Chrome. However, when I run the code >>>>> on a localhost, the "var runOnce = ..." function causes the API not >>>>> to load. This occurs for my altered code as well as for the code you >>>>> provided in the hack. Is Google preventing this function for some reason? >>>>> >>>>> Any help would be great. :) >>>>> >>>>> On Thursday, September 13, 2012 10:53:34 AM UTC-7, asgallant wrote: >>>>>> >>>>>> There are limitations to what you can do (due to browser security >>>>>> issues), but you roll your own method. I wrote a hack to accomplish >>>>>> this a >>>>>> while back: http://jsfiddle.net/asgallant/MqERY/3/ (the relevant >>>>>> section of code is near the bottom, see the "var runOnce = ..." >>>>>> line). >>>>>> >>>>>> On Thursday, September 13, 2012 12:09:02 PM UTC-4, ben wrote: >>>>>>> >>>>>>> Hi, is there a way or do you know if it is planned to export the >>>>>>> data from hand-populated tables automatically (in CSV and preferable >>>>>>> also >>>>>>> in Excel)? We have seen that the documentation says >>>>>>> "To use a toolbar, your visualization must get its data from a URL; >>>>>>> you cannot pass in hand-populated DataTable or DataView objects. You >>>>>>> will >>>>>>> pass the URL of the data used to populate your visualization into the >>>>>>> drawToolbar() method." Would be great if Google could add this >>>>>>> functionality to export all data in a table automatically in those two >>>>>>> formats (as I bet we are not the only onces with this requirement?!). >>>>>>> >>>>>>> Thanks! >>>>>>> >>>>>>> ben >>>>>>> >>>>>> -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/XKyRpiFkCgkJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
