2013-06-05 142 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 
    });