饼图上的jqPlot mouseOver

时间:2013-06-05 14:35:53

标签: javascript hover jqplot

我正在使用jqplot版本1.0.8r1250,我无法弄清楚如何让mouseOver事件在饼图切片上工作。正常的seriesColors工作正常。

这是我的代码:

$.jqplot('pieChart', [pieChartData],
{
   seriesColors: [color1, color2, color3, color4],
    grid: {
             background:'#FFFFFF',
             borderWidth:0,
             shadow:0
           },

     seriesDefaults: {
                        renderer: $.jqplot.PieRenderer,
                        rendererOptions: {
                                           highlightMouseOver: true,
                                           highlightMouseDown: false,
                                           highlightColor:  [hoverColor1, 
                                                             hoverColor2,
                                                              hoverColor3,
                                                             hoverColor4],
                                                },
                                            },
                             legend: {
                                        show: true, 
                                        location: 'e'
                                    },

                        });

1 个答案:

答案 0 :(得分:2)

这可以帮到你:

//On mouseover
    $('.jqplot-target').bind('jqplotDataHighlight', function(evt, seriesIndex, pointIndex, data) {
          //place your logic here
    });

//On mouseout    
    $('.jqplot-target').bind('jqplotDataUnhighlight', function(evt, seriesIndex, pointIndex, data){
         //place your logic here
    });