variable background colors in google line chart

using a ComboChart with seriesType: ‘area’ and isStacked: true you can define as many ranges as needed visibleInLegend: false hides the area series from the legend then you can set a custom type: for the series you want to track, such as ‘line’, in the following working snippet… google.charts.load(‘current’, { callback: function () { var … Read more

Google Apps Script: How to set “Use column A as labels” in chart embedded in spreadsheet?

Found it! Set the option useFirstColumnAsDomain to true with EmbeddedChartBuilder.setOption. This option appears to be undocumented. I found it by going to “Publish chart” (click on the chart, then select from the drop-down in the top right) and inspecting the JavaScript data structure in the given code. To be exact, I created a chart with … Read more

How to write your own custom legends for google line chart/ Google line chart legend manipulation

Example: Build custom legend, which syncs with data and chart… google.charts.load(’44’, { callback: drawChart, packages: [‘controls’, ‘corechart’] }); function drawChart() { // adapted from a previous example var colorPallette = [‘#273746′,’#707B7C’,’#dc7633′,’#f1c40f’,’#1e8449′,’#2874a6′,’#6c3483′,’#922b21′]; var data = new google.visualization.DataTable(); data.addColumn(‘date’, ‘X’); data.addColumn(‘number’, ‘Y1’); data.addColumn(‘number’, ‘Y2’); data.addRow([new Date(2016, 0, 1), 1, 123]); data.addRow([new Date(2016, 1, 1), 6, 42]); data.addRow([new … Read more

Redraw google chart based on user input via AJAX request

recommend using php to get json in the form that google accepts following is a full example for using ajax to get json data from php and draw a google chart php <?php require(“dbconnect.php”); $db = mysql_connect($server, $user_name, $password); mysql_select_db($database); $sqlQuery = “SELECT * FROM “.$_GET[‘q’].” WHERE Date(Time + INTERVAL 10 HOUR) = Date(UTC_TIMESTAMP() + … Read more