How to add some text in google piechart pieHole

孤者浪人 提交于 2020-01-04 06:07:29

问题


visualization.PieChartwithpieHole, I just want to give some custom text insidepieHole` is this possible? Any idea how to do his? My code is

                 var chart6 = new google.visualization.PieChart(document.getElementById('chart6'));
                chart6.draw(data, {width: 650, height: 259, title: 'Browser bounce rate',
                    colors:['#058DC7','#50B432','#ED561B','#EDEF00','#24CBE5','#64E572'],
                    areaOpacity: 0.1,
                    pieHole: 0.4,
                    hAxis: {textPosition: 'in', showTextEvery: 5, slantedText: false, textStyle: { color: '#FFFFFF', fontSize: 10 } },
                    pointSize: 5,
                    chartArea:{left:0,top:30,width:"100%",height:"100%"}
                });

回答1:


There are no chart options that will let you put text in the hole; you have to layer other elements on top of your chart.

If you don't have to worry about older versions of IE, you can actually layer the HTML under the chart instead of on top, and set the chart's backgroundColor option to "transparent". This will let the text show through the hole, but won't block any mouse interactions with the chart. If you have to code for IE < 9 as well, you have to layer on top (at least in IE < 9), as the Visualization API does not support transparency in IE < 9.



来源:https://stackoverflow.com/questions/23930311/how-to-add-some-text-in-google-piechart-piehole

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!