悬停效果对圆环图的Inside / InnerSize?

时间:2015-09-18 07:11:28

标签: javascript jquery highcharts

我已经实现了悬停效果,但这只是在图表的边框上。我在这里要完成的是让哈弗效应也可以在图表内部工作。

JS小提琴:http://jsfiddle.net/amigoo/zwod86e1/

这是我的代码:

$(function() {
    Highcharts.setOptions({
        colors: ['#8edce7', '#e8ebeb']
    });

    // Create the chart for completion
    var chart_completion = new Highcharts.Chart({
        chart: {
            renderTo: 'container1',
            type: 'pie',
            margin: [0,0,0,0],
            height: 100,
            width: 100

        },
        tooltip: {
            enabled: false,
        },
        plotOptions: {
            pie: {
                slicedOffset: 0,
                size: '100%',
                dataLabels: {
                    enabled: false
                }
            },
            series: noBorder
        }, 
        title: {
            text: 'In Prog.',
            align: 'center',
            verticalAlign: 'middle',
            style: {
                fontSize: '9.5px'
            }

        },      
        credits: {
           enabled: false
        },
        series: [{
            name: 'Browsers',
            data: [["MSIE",10],[,2]],
            innerSize: '80%',
            showInLegend:false,
            dataLabels: {
                enabled: false
            },
            states:{
                hover: {
                    enabled: false
                }
            },
            point : {
                events: {
                    mouseOver: function(){
                       this.oldTitle = chart_completion.options.title.text;

                       chart_completion.setTitle({
                            text: 'New title '
                        });

                    },
                    mouseOut: function(){
                        chart_completion.setTitle({
                            text: this.oldTitle
                        });
                    }
                }
            }
        }]
    });

1 个答案:

答案 0 :(得分:1)

在plotOption.series

中使用
   series: {
               stickyTracking: true,
            events: {
                    mouseOver: function(){
                       alert("mouseOver");


                    },
                    mouseOut: function(){
                         alert("mouseOut");
                    }
            }
        }