You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/11/17 14:19:28 UTC

[GitHub] [echarts] IndProgo commented on issue #15956: Datazoom可以支持两边提示文字位置的设置

IndProgo commented on issue #15956:
URL: https://github.com/apache/echarts/issues/15956#issuecomment-971625603


   Quick and dirty edit in echarts\lib\component\dataZoom\SliderZoomView.js file, appended to setLabel function after setStyle
   ```js
   if (orient === HORIZONTAL) {
     var width = handleLabels[handleIndex].getBoundingRect().width;
     var reminder = orderedHandleEnds[1] - orderedHandleEnds[0];
     if (reminder >= width) {
       var canvasWidth = this.api.getWidth();
       var parentX = handleLabels[handleIndex].parent.x;
       var start = parentX + orderedHandleEnds[0] - LABEL_GAP;
       var end = canvasWidth - (parentX + orderedHandleEnds[1]) - LABEL_GAP;
       if ((!handleIndex && start < width) || (handleIndex && end < width)) {
         var x = graphic.applyTransform([orderedHandleEnds[handleIndex] + (handleIndex !== 0 ? -offset : offset), this._size[1] / 2], barTransform)[0];
         var align = graphic.transformDirection(handleIndex !== 0 ? 'right' : 'left', barTransform);
         handleLabels[handleIndex].setStyle({
           x: x,
           align: align,
         });
       }
     }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org