2017-09-22 3 views
1

Dans un diagramme Google Google, je veux changer la couleur de l'indicateur dans la légende pour accéder aux résultats suivants. Ceci est maintenant bleu, et je ne peux pas sembler changer cela, bien que je puisse changer la couleur des tranches de tarte (faites) ou même du texte (pas nécessaire). Voici une capture d'écran: Google pie chart. Voici le code:Changement de la couleur de Google Pie Charts page suivante indicator

var options1 = { 
      legend: 'none', 
      pieSliceText: 'label', 
      width: '85%', 
      height: '85%', 
      chartArea: {'width': '80%', 'height': '80%'}, 
      legend: {'position': 'bottom'}, 
      backgroundColor: {fill:'transparent'}, 
      pieSliceBorderColor: 'transparent', 
      colors: ['#41ac89', '#2b9b38', '#b3b300', '#D9C022', '#bab673'] 
     }; 

Répondre

0

vous pouvez utiliser les options suivantes ...

texte: legend.pagingTextStyle
flèches: legend.scrollArrows

par exemple

legend: { 
    position: 'bottom', 

    // style paging text and arrows 
    pagingTextStyle: { 
    color: '#616161' 
    }, 
    scrollArrows:{ 
    activeColor: '#616161', 
    inactiveColor:'#e0e0e0' 
    } 
}, 

voir ci-dessous extrait de travail ...

google.charts.load('current', { 
 
    packages: ['corechart'] 
 
}).then(function() { 
 
    var data = google.visualization.arrayToDataTable([ 
 
    ['', 'Views'], 
 
    ['dat', 40], 
 
    ['nom', 10], 
 
    ['gen', 10], 
 
    ['hid1', 2], 
 
    ['hid2', 3] 
 
    ]); 
 

 
    var options = { 
 
    legend: 'none', 
 
    pieSliceText: 'label', 
 
    width: 200, 
 
    height: 200, 
 
    chartArea: {'width': '80%', 'height': '80%'}, 
 
    legend: { 
 
     position: 'bottom', 
 

 
     // style paging text and arrows 
 
     pagingTextStyle: { 
 
     color: '#616161' 
 
     }, 
 
     scrollArrows:{ 
 
     activeColor: '#616161', 
 
     inactiveColor:'#e0e0e0' 
 
     } 
 
    }, 
 
    backgroundColor: {fill: 'transparent'}, 
 
    pieSliceBorderColor: 'transparent', 
 
    colors: ['#41ac89', '#2b9b38', '#b3b300', '#D9C022', '#bab673'] 
 
    }; 
 

 
    var chart = new google.visualization.PieChart(document.getElementById('chart_div')); 
 
    chart.draw(data, options); 
 
});
<script src="https://www.gstatic.com/charts/loader.js"></script> 
 
<div id="chart_div"></div>

+0

fonctionne parfaitement, merci! – MarkD

+0

Merci, je ne le savais pas. Se rappellera pour le futur! – MarkD