2014-02-25 21 views
0

我有一個由jqplot繪製的圖表,它由基於DataSeriesToPlot的動態行數組成。我希望所有行只能在Y軸上拖動,但是對Y屬性的約束不起作用。這是我的代碼,非常感謝,如果你能幫助我!JQPlot Dragable constrainTo屬性不起作用

$j.jqplot.config.enablePlugins = true; 

     plot1 = $j.jqplot('chart', DataSeriesToPlot, 

     { 
      animate : true, 

      title : 'Draggable Chart Demo', 
      neighborThreshold : -1, 
      legend : { 
       renderer : $j.jqplot.EnhancedLegendRenderer, 

       show : true, 
       labels : legendTypes, 
       showSwatch : true, 
       predraw : false, 
       placement : "outsideGrid", 
      }, 

      seriesDefaults : { 

       dragable : { 
        color : '#fffdf6', 
        constrainTo : 'y', 

       } 

      }, 

      axes : { 

       xaxis : { 

        pad : 1.1, 
        renderer : $j.jqplot.DateAxisRenderer, 

        labelRenderer : $j.jqplot.CanvasAxisLabelRenderer, 
        label : 'Month', 
        labelOptions : { 
         labelPosition : 'middle', 
         fontFamily : 'Helvetica', 
         fontSize : '14pt' 
        }, 
        tickRenderer : $j.jqplot.CanvasAxisTickRenderer, 
        tickOptions : { 
         mark : 'outside', 
         showMark : true, 
         showGridLine : true, 
         show : true, 
         showLabel : true, 
         fontWeight : 'normal', 

         angle : -30, 
         formatString : '%F' 

        }, 
        tickInterval : "4 months", 

        showTicks : true, 
        showTickMarks : true 

       }, 
       yaxis : { 
        min : mbMin * 0.8, 
        max : mbMax * 1.2, 

        tickRenderer : $j.jqplot.CanvasAxisTickRenderer, 
        tickOptions : { 
         mark : 'outside', 
         showMark : true, 
         showGridLine : true, 
         show : true, 
         showLabel : true, 
         fontWeight : 'normal', 
         formatString : '%.2f' 

        }, 
        labelRenderer : $j.jqplot.CanvasAxisLabelRenderer, 

        labelOptions : { 

         fontFamily : 'Helvetica', 
         fontSize : '14pt' 

        }, 
        label : 'MB Per Sub', 
       }, 

      }, 
      highlighter : { 
       sizeAdjust : 10, 
       showTooltip : true, 
       fadeTooltip : true, 
       tooltipFadeSpeed : "fast", 
       tooltipOffset : 2, 
       tooltipAxes : 'both', 
       tooltipLocation : 'n', 
       tooltipSeparator : ', ', 
       useAxesFormatters : true 
      }, 

      cursor : { 
       show : true, 
       showTooltip : true, 
       followMouse : true, 
       //showTooltipOutsideZoom : true, 
       constrainOutsideZoom : false, 
       showTooltipGridPosition : false, 
       showTooltipUnitPosition : false, 
       useAxesFormatters : true, 
       zoom : true, 
       looseZoom : true 

      } 
     }) 

    } 

回答

2

我有同樣的問題。嘗試將可拖動對象放在系列選項中。

series: [{ 
    dragable : { 
     color : '#fffdf6', 
     constrainTo : 'y', 
    } 
}] 

它應該工作。