Reputation: 1
How Do I Switch Axes on Embedded Chart using Google App Code. Currently I have the Column data showing on the h axis with the row day=ta (dates) on the V. I need them the other way around and can't find the method to switch them. Does anyone know? Sorry I'm a newbie!!
Upvotes: 0
Views: 113
Reputation: 8598
As an example, I have a column chart with X axis A and Y axis B. I switch it so X is B and Y is A.
function test() {
try {
let spread = SpreadsheetApp.getActiveSpreadsheet();
let sheet = spread.getSheetByName("Copy of Sheet3");
let chart = sheet.getCharts()[0];
chart = chart.modify().asColumnChart().reverseCategories().build();
sheet.updateChart(chart);
}
catch(err) {
console.log(err);
}
}
Reference
Upvotes: 1