Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Chart API - Pie legend.textStyle color

Starting from the official example for pie chart.
I'm not able the change the legend color.

'legend.textStyle': { 'color': 'gray' }  

Is not taken into account.
Please check out the fiddle
Am I doing something wrong ?

like image 721
Pierre de LESPINAY Avatar asked Feb 14 '12 16:02

Pierre de LESPINAY


People also ask

How do you show values in a Google pie chart?

How to display both Percentage and Values in Google Pie Chart ? You can't display both on the slice labels, but if you set the pieSliceText option to 'label' and the legend. position option to 'labeled' , you will see the value on the slice and the percent on the legend label.

How do I get rid of the legend in my Google Chart?

To hide the legend in Google Chart with JavaScript, we set the legend property to 'none' . const options = { //... legend: "none", }; to set legend to 'none' in the options object to hide the legend.


2 Answers

I wasn't actually able to get your answer to work either. Instead, I used the following:

legend: {textStyle: {color: 'gray'}}
like image 114
Whit Waldo Avatar answered Oct 18 '22 23:10

Whit Waldo


It is

legend: {textStyle: {color: 'gray'}}

instead of

'legend.textStyle': { 'color': 'gray' }
like image 22
Pierre de LESPINAY Avatar answered Oct 18 '22 23:10

Pierre de LESPINAY