function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Installer'); // Implicit domain label col. data.addColumn({type:'number',label: 'Percentuale'}, 'Percentuale Vendita'); data.addColumn({type:'number',role:'annotation'}); data.addColumn({type:'number',label: 'Percentuale 2'}, 'Percentuale Vendita 2'); data.addRows({$dato}); data.sort([{column: 1, desc:true}, {column: 0}]); var view = new google.visualization.DataView(data); view.setColumns([0, 1, 2,3,{ type: 'string', role: 'style', calc: function (dt, row) { var val = dt.getValue(row, 1); if (val < 10) { return 'red'; } else if (val < 20) { return 'yellow'; } else { return 'green'; } } }]);
I tried as you say it is wrong. where am I wrong? Il giorno giovedì 24 luglio 2014 18:53:53 UTC+2, Mirko Nulla ha scritto: > > Hello, > I need to make the bars colour change according to particular values > related to specific ranges. > For example every value between null and 10 must give the red colour, > between 10 and 20 the yellow one etc. > > I tried to use .view() with the calc function without any success. Was it > the right way? > Finally how can I do it? > -- 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 google-visualization-api+unsubscr...@googlegroups.com. To post to this group, send email to google-visualization-api@googlegroups.com. Visit this group at http://groups.google.com/group/google-visualization-api. For more options, visit https://groups.google.com/d/optout.