You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "petersonzilli (via GitHub)" <gi...@apache.org> on 2023/03/26 18:03:35 UTC

[GitHub] [echarts] petersonzilli opened a new issue, #18422: [Bug] minorTicks spacing for time series has unexpected behavior for the right and left-most intervals.

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

   ### Version
   
   5.4.3
   
   ### Link to Minimal Reproduction
   
   https://codepen.io/petersonzilli/pen/VwGgQgb
   
   ### Steps to Reproduce
   
   1. You can start from the "Dynamic Data + Time Axis" example
   2. then add the xAxis.minorTick = true configuration.
   3. (optionally) add the xAxis.minorSplit = true to the config too.
   4. then start to look into the right and left sides of the generated graph and see the not expected behavior for ticks/split lines of a time series.
   
   ### Current Behavior
   
   the number of intervals is made constant for the graph. there are always 5 minorTicks/minorSplits. thus the time ranges expressed by the ticks vary across the graph.
   
   ### Expected Behavior
   
   For a time series, one can expect that the minorTicks/minorSplits express allways the same time range, and the space between the minorTicks/minorSplits does not vary across the graph
   
   ### Environment
   
   ```markdown
   - OS: MacOS
   - Browser: Chrome 111.0.5563.110
   - Framework: pure javascript and echarts
   ```
   
   
   ### Any additional comments?
   
   _No response_


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


Re: [I] [Bug] minorTicks spacing for time series has unexpected behavior for the right and left-most intervals. [echarts]

Posted by "GordoRank (via GitHub)" <gi...@apache.org>.
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: 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


[GitHub] [echarts] kaatula commented on issue #18422: [Bug] minorTicks spacing for time series has unexpected behavior for the right and left-most intervals.

Posted by "kaatula (via GitHub)" <gi...@apache.org>.
kaatula commented on issue #18422:
URL: https://github.com/apache/echarts/issues/18422#issuecomment-1562751172

   I also met this issue in my project.


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


[GitHub] [echarts] ptandler commented on issue #18422: [Bug] minorTicks spacing for time series has unexpected behavior for the right and left-most intervals.

Posted by "ptandler (via GitHub)" <gi...@apache.org>.
ptandler commented on issue #18422:
URL: https://github.com/apache/echarts/issues/18422#issuecomment-1680226907

   If you turn on the alternating background (`xAxis.splitArea.show = true`) for the x-axis, I think you can see the reason why the minor ticks behave like this (I assume): the first and last segment are not as wide as all others - but also in this cases the same number of minor ticks are rendered.
   
   I also agree that this should be changed, the distance of minor ticks should be consistent all the time.


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


Re: [I] [Bug] minorTicks spacing for time series has unexpected behavior for the right and left-most intervals. [echarts]

Posted by "elnipa (via GitHub)" <gi...@apache.org>.
elnipa commented on issue #18422:
URL: https://github.com/apache/echarts/issues/18422#issuecomment-1934025811

   bump. any update on this? we are experiencing the same problems


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


Re: [I] [Bug] minorTicks spacing for time series has unexpected behavior for the right and left-most intervals. [echarts]

Posted by "elnipa (via GitHub)" <gi...@apache.org>.
elnipa commented on issue #18422:
URL: https://github.com/apache/echarts/issues/18422#issuecomment-2754245040

   bump. I think this bug is still unresolved. Any comment from the libs authors?


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


[GitHub] [echarts] petersonzilli commented on issue #18422: [Bug] minorTicks spacing for time series has unexpected behavior for the right and left-most intervals.

Posted by "petersonzilli (via GitHub)" <gi...@apache.org>.
petersonzilli commented on issue #18422:
URL: https://github.com/apache/echarts/issues/18422#issuecomment-1530542179

   ![image](https://user-images.githubusercontent.com/13674573/235547668-759dc72c-c96d-4c63-8817-c7cdf48835bc.png)
    In this image you can see the first 5 ticks and also the last 5 ticks are smaller than the regular ticks for the central time range.


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


[GitHub] [echarts] zckevin commented on issue #18422: [Bug] minorTicks spacing for time series has unexpected behavior for the right and left-most intervals.

Posted by "zckevin (via GitHub)" <gi...@apache.org>.
zckevin commented on issue #18422:
URL: https://github.com/apache/echarts/issues/18422#issuecomment-1571213875

   The split interval should be the same or it would be a quite wired graph.


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