ElicaInc commented on PR #16978:
URL: https://github.com/apache/echarts/pull/16978#issuecomment-2801389279

   This patch, made possible thanks to @andrearoota, worked perfectly in my 
setup while waiting for the official merge.
   ```
   diff --git a/node_modules/echarts/lib/component/dataZoom/SliderZoomView.js 
b/node_modules/echarts/lib/component/dataZoom/SliderZoomView.js
   index be21afa..25e561e 100644
   --- a/node_modules/echarts/lib/component/dataZoom/SliderZoomView.js
   +++ b/node_modules/echarts/lib/component/dataZoom/SliderZoomView.js
   @@ -281,22 +281,35 @@ var SliderZoomView = /** @class */function (_super) {
          var areaPoints_1 = [[size[0], 0], [0, 0]];
          var linePoints_1 = [];
          var step_1 = thisShadowExtent[1] / (data.count() - 1);
   -      var thisCoord_1 = 0;
   +        // Added: Variables to support time axis
   +      var thisDataExtent = data.getDataExtent(info.thisDim);
   +      var normalizationConstant = size[0] / (thisDataExtent[1] - 
thisDataExtent[0]);
   +      var isTimeAxis = info.thisAxis.type === 'time';
   +      var thisCoord_1 = -step_1;
          // Optimize for large data shadow
          var stride_1 = Math.round(data.count() / size[0]);
          var lastIsEmpty_1;
   -      data.each([otherDim], function (value, index) {
   -        if (stride_1 > 0 && index % stride_1) {
   -          thisCoord_1 += step_1;
   +      data.each([info.thisDim, otherDim], function (thisValue, otherValue, 
index) {
   +        if (stride_1 > 0 && (index % stride_1)) {
   +          // Added: Only increment step when not using a time axis
   +          if (!isTimeAxis) {
   +            thisCoord_1 += step_1;
   +          }
              return;
            }
   +        
   +        // Fix: Coordinate calculation split between time axis and non-time 
axis
   +        thisCoord_1 = isTimeAxis
   +          ? (+thisValue - thisDataExtent[0]) * normalizationConstant
   +          : thisCoord_1 + step_1;
   +    
            // FIXME
            // Should consider axis.min/axis.max when drawing dataShadow.
            // FIXME
            // 应该使用统一的空判断?还是在list里进行空判断?
   -        var isEmpty = value == null || isNaN(value) || value === '';
   +        var isEmpty = otherValue == null || isNaN(otherValue) || otherValue 
=== '';
            // See #4235.
   -        var otherCoord = isEmpty ? 0 : linearMap(value, otherDataExtent_1, 
otherShadowExtent_1, true);
   +        var otherCoord = isEmpty ? 0 : linearMap(otherValue, 
otherDataExtent_1, otherShadowExtent_1, true);
            // Attempt to draw data shadow precisely when there are empty value.
            if (isEmpty && !lastIsEmpty_1 && index) {
              areaPoints_1.push([areaPoints_1[areaPoints_1.length - 1][0], 0]);
   @@ -307,7 +320,7 @@ var SliderZoomView = /** @class */function (_super) {
            }
            areaPoints_1.push([thisCoord_1, otherCoord]);
            linePoints_1.push([thisCoord_1, otherCoord]);
   -        thisCoord_1 += step_1;
   +        
            lastIsEmpty_1 = isEmpty;
          });
          polygonPts = this._shadowPolygonPts = areaPoints_1;
   
   ```


-- 
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-unsubscr...@echarts.apache.org

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


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

Reply via email to