techy2 commented on issue #20825:
URL: https://github.com/apache/echarts/issues/20825#issuecomment-2723118150
I didn't expect the form to try and HTML format the diff, sigh.... here it
is without the attempted formatting
<pre>
--- ../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);
</pre>
### ### ###
--
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]