GordoRank commented on issue #18422:
URL: https://github.com/apache/echarts/issues/18422#issuecomment-2045929711

   I've just come up against the same issue and have quickly modified the 
source code to rectifiy it.  I don't have time to make a PR right now but the 
simplest solution is to modify the getMinorTicks function to the following:
   
   ` IntervalScale.prototype.getMinorTicks = function (splitNumber) {
         var ticks = this.getTicks(true);
         var minorTicks = [];
         var extent = this.getExtent();
         var largestTickInterval = null;
         for (var i = 1; i < ticks.length; i++) {
           var nextTick = ticks[i];
           var prevTick = ticks[i - 1];
           var interval = nextTick.value - prevTick.value;
           if(largestTickInterval === null || interval > largestTickInterval) {
             largestTickInterval = interval;
           }
         }
   
         for (var i = 1; i < ticks.length; i++) {
           var nextTick = ticks[i];
           var prevTick = ticks[i - 1];
           var count = 0;
           var minorTicksGroup = [];
           //var interval = nextTick.value - prevTick.value;
           var interval = largestTickInterval;
   
           var minorInterval = interval / splitNumber;
           while (count < splitNumber - 1) {
             var minorTick = roundNumber(prevTick.value + (count + 1) * 
minorInterval);
            // console.log('minortick: ' + minorTick +  'ex0: ' + extent[0] + ' 
ex1: ' + extent[1]);
             // For the first and last interval. The count may be less than 
splitNumber.
             if (minorTick > extent[0] && minorTick < extent[1]) {
               minorTicksGroup.push(minorTick);
             }
             count++;
           }
           minorTicks.push(minorTicksGroup);
         }
         return minorTicks;
       };`
   
   I'm sure there will be a more efficient way of doing it, but simply 
pre-calculating the largest **full** tickInterval first and using that to 
consitently calculate the minorTick distances does the trick.


-- 
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