And... sorry, can't find the right Google Sheets/ Apps Script group, any hints please ?
Le vendredi 28 juillet 2017 01:50:19 UTC+2, JY_FR-DE-EN a écrit : > > Hello, > > I've been spending hours trying to figure out why the Exploding/Spliting > method of the > Chart Builder/Embedding > (eg. > https://stackoverflow.com/questions/38919329/using-the-slices-setoption-in-google-apps-script?rq=1 > ) > is not working at all in my "google sheet assigned script" > > *.setOption ('slices', Value)* > *e.g. {3: {offset : 0.3};* > > Any ideas/experience on that ? Is this deprecated somehow ? > (other .setOption methods works : Colors for example) > > My sheet has a 3 columns (therefore selecting B2:C5), 4 lines, simplified > for testing purposes. > > Here is the 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 is the title of my chart") > .setOption('slices', { > 0: {offset: 0.05}, > 1: {offset: 0.15}, > 2: {offset: 0.25}, > 3: {offset: 0.35} > }) > > .setOption('title', 'Updated!'); > > // another try > slicces[0] = '{offset: 0.2}'; > pie.setOption('slices', slicces); // wrapper is the 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 are welcome... > > Thank you ! > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/4679e57f-1fa2-4bed-8a2d-b933c05db09a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
