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

   ### What problem does this feature solve?
   
   Since [v5](https://github.com/apache/echarts/pull/12859), the `interval` 
option of time axes is no long valid because the span of each two ticks are not 
always the same (e.g., Feburary has 28/29 days while March has 31 days). But 
it's a common requirement to set the interval level (or the minimium interval 
level) to be yearly/monthly/dayly/... and it can hardly be done with the 
current API.
   
   ### What does the proposed API look like?
   
   I'd suggest we support `interval`, `minInterval`, and `maxInterval` in the 
type of 
[`TimeUnit`](https://github.com/apache/echarts/blob/6ee5f7076d84b72dc65b4c53e92e5003b8624b2f/src/util/time.ts#L58).
   
   > The reason why `number` type should not be used instead is that each month 
has different days so using the interval of `1000 * 3600 * 24 * 30` is not 
accurate and unreasonable.
   
   For example, to display use ticks by month:
   
   ```ts
   xAxis: {
     type: 'time',
     interval: 'month',
     axisLabel: { // optional
       showMinLabel: true,
       formatter: {
         year: '{yyyy}',
         month: '{MMM}',
         day: '{yyyy} {MMM}'' // hack for the first day
       }
     }
   }
   ```
   
   The ticks will be at the first date of each month (excluding the first one 
because it's displaying only because `showMinLabel: true`):
   
   ```
       |_____________|__________________________|__________________________|__ 
...
       2019 Dec      2020                       Feb                        March
   ```
   
   `minInterval` and `maxInterval` works similarly.
   
   


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