【问题标题】:Changing colour of Google Pie Charts next page indicator更改 Google 饼图下一页指示器的颜色
【发布时间】:2018-03-03 17:54:59
【问题描述】:

在 Google 饼图中,我想更改图例中指示器的颜色以转到下一个结果。这现在是蓝色的,我似乎无法改变它,尽管我可以改变饼片的颜色(完成)甚至文本的颜色(不是必需的)。这是截图:Google pie chart。 代码如下:

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']
        };

【问题讨论】:

    标签: javascript charts colors google-visualization


    【解决方案1】:

    您可以使用以下选项...

    文字:legend.pagingTextStyle
    箭头:legend.scrollArrows

    例如

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

    请参阅以下工作 sn-p...

    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>

    【讨论】:

    • 谢谢,我不知道。将来会记得!
    • 谢谢!我在文档中找不到这些属性。您是否必须挖掘源头才能找到它们?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 2012-10-12
    • 1970-01-01
    相关资源
    最近更新 更多