2013-06-05 138 views
0

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

这里是我的代码:

$.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' 
            }, 

         }); 

回答

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 
    });