2015-01-13 28 views

回答

3

你可以用drawHandles功能修改它以增加高度。

var height = 20; 

(function (H) { 
    H.wrap(H.Scroller.prototype, 'drawHandle', function (proceed, x, index) { 
     var scroller = this, 
      chart = scroller.chart, 
      renderer = chart.renderer, 
      elementsToDestroy = scroller.elementsToDestroy, 
      handles = scroller.handles, 
      handlesOptions = scroller.navigatorOptions.handles, 
      attr = { 
       fill: handlesOptions.backgroundColor, 
       stroke: handlesOptions.borderColor, 
        'stroke-width': 1 
      }, 
      tempElem; 

     // create the elements 
     if (!scroller.rendered) { 
      // the group 
      handles[index] = renderer.g('navigator-handle-' + ['left', 'right'][index]) 
       .css({ 
       cursor: 'e-resize' 
      }) 
       .attr({ 
       zIndex: 4 - index 
      }) // zIndex = 3 for right handle, 4 for left 
      .add(); 

      // the rectangle 
      tempElem = renderer.rect(-4.5, 0, 9, height, 0, 1) 
       .attr(attr) 
       .add(handles[index]); 
      elementsToDestroy.push(tempElem); 

      // the rifles 
      tempElem = renderer.path([ 
       'M', -1.5, 4, 
       'L', -1.5, 12, 
       'M', 
      0.5, 4, 
       'L', 
      0.5, 12]).attr(attr) 
       .add(handles[index]); 
      elementsToDestroy.push(tempElem); 
     } 

     // Place it 
     handles[index][chart.isResizing ? 'animate' : 'attr']({ 
      translateX: scroller.scrollerLeft + scroller.scrollbarHeight + parseInt(x, 10), 
      translateY: scroller.top + scroller.height/2 - 8 
     }); 

    }); 
}(Highcharts)); 

http://jsfiddle.net/za68w54r/

+0

非常感謝你塞巴斯蒂安!這裏有一個問題,當我把手柄高度增加到20以上時,它內部的2條線仍然朝向頂部。我該如何調整? http://jsfiddle.net/Yrygy/303/ – vikasrao

+0

我tempElem變量,有渲染器打印。修正了例子:http://jsfiddle.net/Yrygy/304/ –