【问题标题】:I want to remove 1/5 and show all legends in google pie chart我想删除 1/5 并在谷歌饼图中显示所有图例
【发布时间】:2019-01-26 15:35:50
【问题描述】:

这里我总共有 10 个图例,但我想显示所有 10 个图例。

【问题讨论】:

  • 尝试将legend.position 向右移动,或在顶部增加maxLines...
  • 感谢 WhiteHat,但它对我不起作用..

标签: legend pie-chart google-visualization legend-properties


【解决方案1】:

正如WhiteHat在他的评论中提到的,你必须将legend.position移到顶部并增加maxLines

但另外,您必须将top 属性添加到chartArea,以便在图表顶部获得足够的空间。

    {
      width: '100%',
        height: '100%',
      legend: { 
         position: 'top',         // <--- top position
         alignment: 'center', 
         maxLines: 5             // <--- increase of max lines
      },
      chartArea: {
        height: "100%",
        width: "100%",
        top: "25%"           // <-- top space (you can use fix values as well. (e.x. 50))
      },
      sliceVisibilityThreshold: 0,
      pieHole: 0.4,
    }

【讨论】:

    猜你喜欢
    • 2011-10-29
    • 1970-01-01
    • 1970-01-01
    • 2023-03-20
    • 2023-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多