Google Sheet Pie Chart JS : Slices offset method not working? -
i've been spending (lots of) time trying figure out how explode/split pie chart within google sheets / (eg. using slices setoption in google apps script) http://fiddle.jshell.net/6d5flwnm/4/ works outside google sheets using google visualisation
e.g. piechart .setoption ('slices', value) e.g. {3: {offset : 0.3};
but method of google chart builder/embedding not working @ in "google sheet assigned script" (see below code)
any ideas/experience on ? deprecated somehow ? (other .setoption methods works : colors example)
my sheet has 3 columns (therefore selecting b2:c5), 4 lines, simplified testing purposes. here code :
function generatepie() { var sheet = spreadsheetapp.getactivesheet(); var range = sheet.getrange("b2:c5"); var pie = sheet.newchart() .setcharttype(charts.charttype.pie) .addrange(range) .setposition(5,6 ,5, 5) //.settitle("this title of chart") .setoption('slices', { 0: {offset: 0.05}, 1: {offset: 0.15}, 2: {offset: 0.25}, 3: {offset: 0.35} }) .setoption('title', 'updated!'); // try slicces[0] = '{offset: 0.2}'; pie.setoption('slices', slicces); // wrapper chartwrapper */ pie.setoption('title', 'updated2!'); sheet.insertchart(pie.build()); var chart = sheet.getcharts()[1]; chart = chart.modify() .setoption('title', 'updated zzzzzzz!') .setposition(5,6,6,6) .setoption('slices', { 0: {offset: 0.05}, 1: {offset: 0.15}, 2: {offset: 0.25}, 3: {offset: 0.35} }) .build(); sheet.updatechart(chart); }
all comments welcome...
thank !
the codes visualization: pie chart of google charts api not interchangeable of app script version yet. don't think it's supported of in apps script.
reversecategories() apps script method related slicing isn't much.
Comments
Post a Comment