How to go about debugging JavaScript in the HtmlService in Google Scripts

You can use your browser’s Developers Tools. In Chrome, press the f12 button, OR choose More Tools, Developer Tools, and window will open in your browser that looks like this: One of the tabs is labeled Console. You can print information to the console by using a: console.log(‘This is text: ‘ + myVariable); statement. When … Read more

Google Charts vertical axis in whole numbers

Simple answer: yes, but it’s complicated. If you just want numbers to display as whole numbers, then it’s easy: function drawVisualization() { // Create and populate the data table. var data = google.visualization.arrayToDataTable([ [‘x’, ‘Cats’, ‘Blanket 1’, ‘Blanket 2’], [‘A’, 1, 1, 0.5], [‘B’, 2, 0.5, 1], [‘C’, 4, 1, 0.5], [‘D’, 8, 0.5, 1], … Read more

Why does google.load cause my page to go blank?

Looks like google.load is adding the script to the page using a document.write(), which if used after the page loads, wipes out the html. This explains more in-depth: http://groups.google.com/group/google-ajax-search-api/browse_thread/thread/e07c2606498094e6 Using one of the ideas, you could use a callback for the load to force it use append rather than doc.write: setTimeout(function(){google.load(‘visualization’, ‘1’, {‘callback’:’alert(“2 sec wait”)’, … Read more

Google Charts: Drawing Multiple Bar Charts with dual axis in IE

Following is an example, with the changes needed, for multiple Material Charts google.charts.load(’41’, {packages: [‘bar’]}); google.charts.setOnLoadCallback(startChart); function startChart() { var data = new google.visualization.arrayToDataTable([ [‘Galaxy’, ‘Distance’, ‘Brightness’], [‘Canis Major Dwarf’, 8000, 23.3], [‘Sagittarius Dwarf’, 24000, 4.5], [‘Ursa Major II Dwarf’, 30000, 14.3], [‘Lg. Magellanic Cloud’, 50000, 0.9], [‘Bootes I’, 60000, 13.1] ]); var options = … Read more

How can I attach the image or icon on edge of google line chart

use the getChartLayoutInterface method var layout = chart.getChartLayoutInterface(); to find the (x, y) location of the point var xPos = layout.getXLocation(data.getValue(row, xColumn)); var yPos = layout.getYLocation(data.getValue(row, yColumn)); then add the image manually and adjust accordingly google.charts.load(‘current’, {packages: [‘corechart’, ‘line’]}); google.charts.setOnLoadCallback(drawBackgroundColor); function drawBackgroundColor() { var data = new google.visualization.DataTable(); data.addColumn(‘number’, ‘X’); data.addColumn(‘number’, ‘Y’); data.addRows([ [0, 0], … Read more

Google chart legends – Overlapping text

check that the chart is not being drawn while hidden see the following snippet, the chart is hidden by default, then shown once the chart’s ‘ready’ event fires notice, it produces the same result as posted in the question… google.charts.load(‘current’, { callback: function () { var dataTable = new google.visualization.DataTable(); dataTable.addColumn(“date”, “Data”); dataTable.addColumn(“number”, “Ton./Hora”); dataTable.addColumn(“number”, … Read more

vertical reference line in google timeline visualization

Create a first task to represent current date: dataTable.addRows([ [”, ‘Hoy’, new Date(2014,9,2), new Date(2014,9,2) ], Create a function with jQuery to make this task longer: function MarcarHoy (div, filas){ $(‘#’+div+’ text:contains(“Hoy”)’).css(‘font-size’,’11px’).attr(‘fill’,’#A6373C’).prev().first().attr(‘height’,filas*41+’px’).attr(‘width’,’1px’).attr(‘y’,’0′); } Call the function: chart.draw(dataTable, options); MarcarHoy(‘example1’,23); google.visualization.events.addListener(chart, ‘onmouseover’, function(obj) { MarcarHoy(‘example1’); }); } The result: Source: Viviendo en la Era de la … Read more

How to add colors to spefic columns in Google Charts

you could assign the color as a column property on the data table then build the colors array based on the visible columns see following working snippet… google.charts.load(‘current’, { callback: drawChart, packages: [‘corechart’] }); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn(‘string’, ‘Year’); data.addColumn(‘number’, ‘Q1’); data.addColumn(‘number’, ‘Q2’); data.addColumn(‘number’, ‘Q3’); data.addColumn(‘number’, ‘Q4’); data.addRow([‘January 2016’, 500, … Read more