How to add Data label to a series

34 views
Skip to first unread message

Root Fsociety

unread,
Jul 14, 2019, 10:45:29 PM7/14/19
to Google Chart API
I made a google Apps script to modify a chart and I would like to display the data label of the series number 0 but the line .setOption('series',{ 1:{color: '#2ecc71'}}) (where I change the color of the series 1) remove the data label of the series 0.

 
      var Vmax =1.1*ss.getRangeByName("D285").getValue(); //get max and min here (before, it's equal to 0)
var Vmin =0.9*ss.getRangeByName("C285").getValue(); var sheet = SpreadsheetApp.getActiveSheet(); var chart = sheet.getCharts()[46]; chart = chart.modify() .setChartType(Charts.ChartType.AREA) .setOption('title',string) .setOption('vAxes', {0: {textStyle: {fontSize: 10}, titleTextStyle: {fontSize : 8}, viewWindow: {min: Vmin, max:Vmax}}}) .setOption('series',{ 1:{color: '#2ecc71'}}) .setOption('titleTextStyle',{alignment:"center"}) .setOption('animation.startup',true) .setOption('animation.duration', 5000) .setOption('hAxis.slantedText',true) .setPosition(290,6,0,0) .build(); Logger.log(Vmax); Logger.log(Vmin); sheet.updateChart(chart);
Here is the link to the spreadsheet : https://docs.google.com/spreadsheets/d/1JBEcCQQrC8fHgnrLcyxmGFP-4BlIDFZgjlCHIAMeLNU/edit?usp=sharing

Reply all
Reply to author
Forward
0 new messages