techy2 opened a new issue, #20825:
URL: https://github.com/apache/echarts/issues/20825

   ### What problem does this feature solve?
   
   I have modified echarts.js to allow conditional pinning of the left or right 
end a chart (bar, candlestick, etc...)
   I am not sure how to modify the src code as it look slightly different from 
echarts.js
   here is the patch if someone would be good enough to integrate it into the 
right places
   
   --- ../echarts.js.orig  Thu Mar 13 18:33:05 2025
   +++ echarts.js  Thu Mar 13 18:36:09 2025
   @@ -71820,7 +71820,8 @@
         */
        function retrieveRawOption(option) {
          var ret = {};
   -      each(['start', 'end', 'startValue', 'endValue', 'throttle'], function 
(name) {
   +// MODIFIED, get anchor value for pinning chart to left or right end during 
dataZoom 
   +      each(['start', 'end', 'startValue', 'endValue', 'throttle', 
'anchor'], function (name) {
            option.hasOwnProperty(name) && (ret[name] = option[name]);
          });
          return ret;
   @@ -80120,8 +80121,14 @@
            var directionInfo = getDirectionInfo[coordSysMainType](null, 
[e.originX, e.originY], axisModel, controller, coordSysInfo);
            var percentPoint = (directionInfo.signal > 0 ? 
directionInfo.pixelStart + directionInfo.pixelLength - directionInfo.pixel : 
directionInfo.pixel - directionInfo.pixelStart) / directionInfo.pixelLength * 
(range[1] - range[0]) + range[0];
            var scale = Math.max(1 / e.scale, 0);
   -        range[0] = (range[0] - percentPoint) * scale + percentPoint;
   -        range[1] = (range[1] - percentPoint) * scale + percentPoint;
   +// MODIFIED, logic to conditionally pin the plot to the left or right side 
of the viewBox
   +       var anchor = this.__model?.option?.anchor || null;
   +       if (anchor !== 'start') { // pin zoom to left side of the X axis 
viewBox
   +            range[0] = (range[0] - percentPoint) * scale + percentPoint;
   +       }
   +       if (anchor !== 'end') { // pin zoom to the right side of the X axis 
viewBox
   +            range[1] = (range[1] - percentPoint) * scale + percentPoint;
   +       }
            // Restrict range.
            var minMaxSpan = 
this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();
            sliderMove(0, range, [0, 100], 0, minMaxSpan.minSpan, 
minMaxSpan.maxSpan);
   
   
   ### What does the proposed API look like?
   
                   dataZoom: [
                       {
                           type: 'inside',
                           xAxisIndex: [0, 1],
                           start: 10,
                           end: 100,
                           anchor: 'end',  // acceptable values 'start', 'end'
   
                       },
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to