Highcharts Donut Chart text in center change on hover

后端 未结 1 502
醉梦人生
醉梦人生 2020-12-19 11:06

I\'m looking for a way to have text in the center of a donut chart change on hover. When there is no hover state, the center will display the total amount (here I am represe

相关标签:
1条回答
  • 2020-12-19 11:42

    Use points.events.mouseOver/mouseOut, for example: http://jsfiddle.net/NVX3S/147/

    Code:

                point: {
                    events: {
                        mouseOver: function(){
                            this.series.chart.innerText.attr({text: this.y});
                        }, 
                        mouseOut: function(){
                            this.series.chart.innerText.attr({text: 112});
                        }
                    }
                }
    

    Where innerText is just custom property, created like this:

    chart.innerText = chart.renderer.text('112', 112, 125).css({ ... }).add();
    
    0 讨论(0)
提交回复
热议问题