You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2020/07/09 07:09:58 UTC

[GitHub] [incubator-echarts] Ovilia commented on pull request #12859: feat: time axis label formatter

Ovilia commented on pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#issuecomment-655945171


   @quillblue Thanks for your comments. Here are my thoughts on this.
   
   ## Primary & Secondary Ticks
   
   I think secondary ticks may not be a minor tick. Consider the following case:
   
   ```
       |_____________|_____________|_____________|__ ...
     2020           Feb           Mar           Apr
   ```
   
   By our definition, `2020` is a primary tick since it's in the year level, while others are secondary ticks because they are in the month level. But in most cases, the tick color of `2020` may not be different than others while text color may be different.
   
   Also, primary and secondary are two default rich text styles we provide. There may also be a tertiary level like week info in the above case. So major and minor ticks may not deal with situations like this.
   
   
   ## i18n
   
   First, we have to provide some frequently used formats like `'HH:mm:ss'`. It's unwise to ask users to install another library if they want simple time formats like this. On the other side, if we provide too many formats, it will increase package size while most people won't use it. So we should be prudent when deciding which formats to support.
   
   Here are my proposed formatters supported:
   
   | Group        | Template | Examples (EN)     | (ZH)       | [Moment.js](https://momentjs.com/docs/#/displaying/) | [date-fns](https://date-fns.org/v2.14.0/docs/format) |
   |--------------|----------|-------------------|------------|-----------|----------|
   | Year         | yyyy     | 2020, 1990        |            | YYYY      | SAME     |
   |              | yy       | 20, 90            |            | YY        | SAME     |
   | Quarter      | Q        | 1, 2              |            | SAME      | SAME     |
   | Month        | MMMM     | January, February | 一月、二月 | SAME      | SAME     |
   |              | MMM      | Jan, Feb          | 一、二     | SAME      | SAME     |
   |              | MM       | 01, 02            |            | SAME      | SAME     |
   |              | M        | 1, 2              |            | SAME      | SAME     |
   | Week of Year | ww       | 01, 02            |            | SAME      | SAME     |
   |              | w        | 1, 2              |            | SAME      | SAME     |
   | Day of Month | dd       | 01, 02            |            | DD        | SAME     |
   |              | d        | 1, 2              |            | D         | SAME     |
   | Day of Week  | eeee     | Monday, Tuesday   | 周一、周二 | dddd      | SAME     |
   |              | eee      | Mon, Tue          | 一、二     | ddd       | SAME     |
   |              | e        | 1, 2              |            | d         | SAME     |
   | Hour         | HH       | 00, 23            |            | SAME      | SAME     |
   |              | H        | 0, 23             |            | SAME      | SAME     |
   | Minute       | mm       | 00, 01            |            | SAME      | SAME     |
   |              | m        | 0, 1              |            | SAME      | SAME     |
   | Second       | ss       | 00, 01            |            | SAME      | SAME     |
   |              | s        | 0, 1              |            | SAME      | SAME     |
   | Millisecond  | SSS      | 000, 001          |            | SAME      | SAME     |
   |              | S        | 0, 1              |            | SAME      | SAME     |


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

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