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/06/28 07:11:05 UTC

[GitHub] [incubator-echarts] Ovilia opened a new pull request #12859: feat: time axis label formatter

Ovilia opened a new pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859


   <!-- Please fill in the following information to help us review your PR more efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [ ] bug fixing
   - [x] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   <!-- USE ONCE SENTENCE TO DESCRIBE WHAT THIS PR DOES. -->
   
   Improves label formatting for time axes.
   
   ### Fixed issues
   
   <!--
   - #xxxx: ...
   -->
   
   
   ## Details
   
   ### Before: What was the problem?
   
   <!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   
   
   ### After: How is it fixed in this PR?
   
   <!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   
   
   ## Usage
   
   ### Are there any API changes?
   
   - [ ] The API has been changed.
   
   <!-- LIST THE API CHANGES HERE -->
   
   
   
   ### Related test cases or examples to use the new APIs
   
   NA.
   
   
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merge.
   
   ### Other information
   


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


[GitHub] [incubator-echarts] pissang commented on a change in pull request #12859: feat: time axis label formatter

Posted by GitBox <gi...@apache.org>.
pissang commented on a change in pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#discussion_r459188916



##########
File path: src/lang.ts
##########
@@ -22,6 +22,22 @@
  */
 
 export default {
+    time: {
+        month: [
+            'January', 'February', 'March', 'April', 'May', 'June',
+            'July', 'August', 'September', 'October', 'November', 'December'
+        ],
+        monthAbbr: [
+            'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+            'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
+        ],
+        dayOfWeek: [

Review comment:
       It should be Chinese month and monthAbbr?




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


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

Posted by GitBox <gi...@apache.org>.
100pah commented on pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#issuecomment-655947629


   @Ovilia 
   
   In the column of `(ZH)`
   Could 
   `Monday, Tuesday` <=> `星期一,星期二`
   `Mon, Tue` <=> `周一,周二`
   


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


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

Posted by GitBox <gi...@apache.org>.
Ovilia commented on pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#issuecomment-661758950


   Most of the functions above have been implemented, but not *week of year*. Leaving it for another PR.


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


[GitHub] [incubator-echarts] 100pah edited a comment on pull request #12859: feat: time axis label formatter

Posted by GitBox <gi...@apache.org>.
100pah edited a comment on pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#issuecomment-651196156


   @Ovilia Add something that could be considered:
   
   ## (I)
   The callback of `axisLabel.fomatter` may be also need to add some params?
   For example:
   ```js
   xAxis: {
       type: 'time'
       formatter: function (value, idx, params) {
           // need to know here:
           // (1) this label is on a primary level tick or a secondary level tick
           // (2) what the level is ('day' or 'month' or ...)
       }
   }
   ```
   
   ## (II)
   > The string can either be a plain text like '{hh}:{mm}:{ss}' or a rich text like strong | '{hh}:{mm}' and define the rich style strong in formatter.
   
   Follow the current way of "reference the variable" like `{strong|xxx{value}xxx}`, 
   I think the format would be: `{strong|xxx{hh}:{mm}xxx}` (no need quote mark)
   
   
   ## (III)
   > We can provide frequently used time formats like YYYY for full year, MM for month number and so on. Moment.js and can be served as references.
   
   If users intend to use `Moment.js`, do we prefer users to
   (a) "use Moment in the `formatter` callback"  ?
   or (b) "use Moment as a plugin for formatter pattern" ?
   
   If (a), nothing need to considered in this feature design.
   If (b), that means users can use Moment notations in our "formatter patterns". 
   Thus we need to consider the conflicts between the notation from third party libs and our existing notations.
   (for example, suppose the third party lib uses "a" to represent something, but in echarts "formatter patterns" `{a}` has been reserve to other meanings.)
   If we want to avoid this conflict, may be other time-specific prefix need to considered in formatter pattern.
   For example: `{%MM}:{%dd}`, where % is only used for time notation.
   
   ## (IV)
   For i18n, probably we could simply add some new built-in notations? (not sure)
   For example:
   + `{MMM}`:  represents: zh: `2月` , en: `Feb`
   + `{MMMM}`:  represents: zh: `二月`, en: `February`
   + `{do}`: represents: zh: `5日`, en: `5th`
   + `{ee}`: represents: zh: `二`, en: `Tu`
   + `{eee}`: represents: zh: `周二`, en: `Tue`
   + `{eeee}`: represents: zh: `星期二`, en: `Tuesday`
   
   
   
   
   


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


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

Posted by GitBox <gi...@apache.org>.
Ovilia edited a comment 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     |
   | <del>Week of Year</del> | <del>ww</del>       | <del>01, 02</del>            |            | SAME      | SAME     |
   |              | <del>w</del>        | <del>1, 2</del>              |            | SAME      | SAME     |
   | Day of Month | dd       | 01, 02            |            | DD        | SAME     |
   |              | d        | 1, 2              |            | D         | SAME     |
   | Day of Week  | eeee     | Monday, Tuesday   | <del>周一、周二</del><ins>星期一、星期二</ins> | dddd      | SAME     |
   |              | <del>eee</del><ins>ee</ins>      | M, T          |  一、二     | dd<del>d</del>       | 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


[GitHub] [incubator-echarts] 100pah edited a comment on pull request #12859: feat: time axis label formatter

Posted by GitBox <gi...@apache.org>.
100pah edited a comment on pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#issuecomment-655947629


   @Ovilia 
   
   In the column of `(ZH)`
   Could 
   `Monday, Tuesday` <=> `星期一,星期二`
   `Mon, Tue` <=> `周一,周二`
   `Mo, Tu` <=> `一,二`  


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


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

Posted by GitBox <gi...@apache.org>.
100pah commented on pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#issuecomment-651196156


   @Ovilia Add something that could be considered:
   
   ## (I)
   The callback of `axisLabel.fomatter` may be also need to add some params?
   For example:
   ```js
   xAxis: {
       type: 'time'
       formatter: function (value, idx, params) {
           // need to know here:
           // (1) this label is on a primary level tick or a secondary level tick
           // (2) what the level is ('day' or 'month' or ...)
       }
   }
   ```
   
   ## (II)
   > The string can either be a plain text like '{hh}:{mm}:{ss}' or a rich text like strong | '{hh}:{mm}' and define the rich style strong in formatter.
   
   Follow the current way of "reference the variable" like `{strong|xxx{value}xxx}`, 
   I think the format would be: `{strong|xxx{hh}:{mm}xxx}` (no need quote mark)
   
   
   ## (III)
   > We can provide frequently used time formats like YYYY for full year, MM for month number and so on. Moment.js and can be served as references.
   
   If users intend to use `Moment.js`, do we prefer users to
   (a) "use Moment in the `formatter` callback"  ?
   or (b) "use Moment as a plugin for formatter pattern" ?
   
   If (a), nothing need to considered in this feature design.
   If (b), that means users can use Moment notations in our "formatter patterns". 
   Thus we need to consider the conflicts between the notation from third party libs and our existing notations.
   (for example, suppose the third party lib uses "a" to represent something, but in echarts "formatter patterns" `{a}` has been reserve to other meanings.)
   If we want to avoid this conflict, may be other time-specific prefix need to considered in formatter pattern.
   For example: `{%MM}:{%dd}`, where % is only used for time notation.
   
   ## (IV)
   For i18n, probably we could simply add some new built-in notations? (not sure)
   For example:
   + `{MMM}`:  represents: zh: `2月` , en: `Feb`
   + `{MMMM}`:  represents: zh: `二月`, en: `February`
   + `{ddd}`: represents: zh: `5日`, en: `5th`
   + `{ee}`: represents: zh: `二`, en: `Tu`
   + `{eee}`: represents: zh: `星期二`, en: `Tue`
   + `{eeee}`: represents: zh: `星期二`, en: `Tuesday`
   
   
   
   
   


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


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

Posted by GitBox <gi...@apache.org>.
Ovilia commented on pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#issuecomment-655951837


   @100pah I think that makes sense. `一、二` should take `ee` if we have future feature requests.


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


[GitHub] [incubator-echarts] 100pah edited a comment on pull request #12859: feat: time axis label formatter

Posted by GitBox <gi...@apache.org>.
100pah edited a comment on pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#issuecomment-655947629


   @Ovilia 
   
   ### (1)
   In the column of `(ZH)`
   Could 
   `Monday, Tuesday` <=> `星期一,星期二`
   `Mon, Tue` <=> `周一,周二`
   `Mo, Tu` <=> `一,二`  
   
   ### (2)
   How about the current `h`,`hh` in `echarts.format.formatTime`.
   (A) Make it the same as `H`, `HH`, which will be different from `date-fns` and make it hard to modify the meaning in future.
   (B) Break change it to represent `1~12`, which might need to create a new util format method and deprecated `echarts.format.formatTime`.
   (I am not sure)
   
   


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


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

Posted by GitBox <gi...@apache.org>.
Ovilia edited a comment 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     |
   | <del>Week of Year</del> | <del>ww</del>       | <del>01, 02</del>            |            | <del>SAME</del>       | <del>SAME</del>      |
   |              | <del>w</del>        | <del>1, 2</del>              |            | <del>SAME</del>       | <del>SAME</del>      |
   | Day of Month | dd       | 01, 02            |            | DD        | SAME     |
   |              | d        | 1, 2              |            | D         | SAME     |
   | Day of Week  | eeee     | Monday, Tuesday   | <del>周一、周二</del><ins>星期一、星期二</ins> | dddd      | SAME     |
   |              | <del>eee</del><ins>ee</ins>      | M, T          |  一、二     | dd<del>d</del>       | SAME     |
   |              | e        | 1, 2              |            | d         | SAME     |
   | Hour (0-23)        | HH       | 00, 23            |            | SAME      | SAME     |
   |              | H        | 0, 23             |            | SAME      | SAME     |
   | <ins>Hour (1-12)</ins>        | <ins>hh</ins>       | <ins>01, 12</ins>            |            | <ins>SAME</ins>      | <ins>SAME</ins>     |
   |              | <ins>h</ins>        | <ins>1, 12</ins>             |            | <ins>SAME</ins>      | <ins>SAME</ins>     |
   | 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


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

Posted by GitBox <gi...@apache.org>.
quillblue commented on pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#issuecomment-655952030


   @Ovilia for the case you mention I treat 2020 as a major tick on the level of year (though from straight understanding it is on the same monthly level of Feb, Mar), and minor tick on the level of month.
   
   For i18n, I agree with that common and widely used date formatter is provided by ECharts self maybe in util since format will be used not only in axis but also maybe in series and etc.


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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by GitBox <gi...@apache.org>.
Ovilia edited a comment 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   | <del>周一、周二</del><ins>星期一、星期二</ins> | dddd      | SAME     |
   |              | <del>eee</del><ins>ee</ins>      | M, T          |  一、二     | dd<del>d</del>       | 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


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

Posted by GitBox <gi...@apache.org>.
Ovilia edited a comment on pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#issuecomment-655951837


   @100pah I think that makes sense. `一、二` should take `ee` if we have future feature requests. Or do you think we should provide `ee` for `Mo, Tu` and ` 一,二` for now?
   
   I would suggest break change it to 1~12 because it's more universal and it cannot provide extra help to `HH`.


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


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

Posted by GitBox <gi...@apache.org>.
Ovilia edited a comment on pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#issuecomment-655951837


   @100pah I think that makes sense. `一、二` should take `ee` if we have future feature requests.
   
   I would suggest break change it to 1~12 because it's more universal and it cannot provide extra help to `HH`.


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


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

Posted by GitBox <gi...@apache.org>.
Ovilia commented on a change in pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#discussion_r459190733



##########
File path: src/lang.ts
##########
@@ -22,6 +22,22 @@
  */
 
 export default {
+    time: {
+        month: [
+            'January', 'February', 'March', 'April', 'May', 'June',
+            'July', 'August', 'September', 'October', 'November', 'December'
+        ],
+        monthAbbr: [
+            'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+            'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
+        ],
+        dayOfWeek: [

Review comment:
       Yes.




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


[GitHub] [incubator-echarts] 100pah edited a comment on pull request #12859: feat: time axis label formatter

Posted by GitBox <gi...@apache.org>.
100pah edited a comment on pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#issuecomment-651196156


   @Ovilia Add something that could be considered:
   
   ## (I)
   The callback of `axisLabel.fomatter` may be also need to add some params?
   For example:
   ```js
   xAxis: {
       type: 'time'
       formatter: function (value, idx, params) {
           // need to know here:
           // (1) this label is on a primary level tick or a secondary level tick
           // (2) what the level is ('day' or 'month' or ...)
       }
   }
   ```
   
   ## (II)
   > The string can either be a plain text like '{hh}:{mm}:{ss}' or a rich text like strong | '{hh}:{mm}' and define the rich style strong in formatter.
   
   Follow the current way of "reference the variable" like `{strong|xxx{value}xxx}`, 
   I think the format would be: `{strong|xxx{hh}:{mm}xxx}` (no need quote mark)
   
   
   ## (III)
   > We can provide frequently used time formats like YYYY for full year, MM for month number and so on. Moment.js and can be served as references.
   
   If users intend to use `Moment.js`, do we prefer users to
   (a) "use Moment in the `formatter` callback"  ?
   or (b) "use Moment as a plugin for formatter pattern" ?
   
   If (a), nothing need to considered in this feature design.
   If (b), that means users can use Moment notations in our "formatter patterns". 
   Thus we need to consider the conflicts between the notation from third party libs and our existing notations.
   (for example, suppose the third party lib uses "a" to represent something, but in echarts "formatter patterns" `{a}` has been reserve to other meanings.)
   If we want to avoid this conflict, may be other time-specific prefix need to considered in formatter pattern.
   For example: `{%MM}:{%dd}`, where % is only used for time notation.
   
   ## (IV)
   For i18n, probably we could simply add some new built-in notations? (not sure)
   For example:
   + `{MMM}`:  represents: zh: `2月` , en: `Feb`
   + `{MMMM}`:  represents: zh: `二月`, en: `February`
   + `{ddd}`: represents: zh: `5日`, en: `5th`
   + `{ee}`: represents: zh: `二`, en: `Tu`
   + `{eee}`: represents: zh: `周二`, en: `Tue`
   + `{eeee}`: represents: zh: `星期二`, en: `Tuesday`
   
   
   
   
   


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


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

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#issuecomment-650708876


   Thanks for your contribution!
   The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/incubator-echarts/wiki/How-to-make-a-pull-request).


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


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

Posted by GitBox <gi...@apache.org>.
Ovilia edited a comment 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     |
   | <del>Week of Year</del> | <del>ww</del>       | <del>01, 02</del>            |            | <del>SAME</del>       | <del>SAME</del>      |
   |              | <del>w</del>        | <del>1, 2</del>              |            | <del>SAME</del>       | <del>SAME</del>      |
   | Day of Month | dd       | 01, 02            |            | DD        | SAME     |
   |              | d        | 1, 2              |            | D         | SAME     |
   | Day of Week  | eeee     | Monday, Tuesday   | <del>周一、周二</del><ins>星期一、星期二</ins> | dddd      | SAME     |
   |              | <del>eee</del><ins>ee</ins>      | M, T          |  一、二     | dd<del>d</del>       | SAME     |
   |              | e        | 1, 2              |            | d         | SAME     |
   | Hour (0-23)        | HH       | 00, 23            |            | SAME      | SAME     |
   |              | H        | 0, 23             |            | SAME      | SAME     |
   | <ins>Hour (0-11)</ins>        | <ins>hh</ins>       | <ins>01, 12</ins>            |            | <ins>SAME</ins>      | <ins>SAME</ins>     |
   |              | <ins>h</ins>        | <ins>1, 12</ins>             |            | <ins>SAME</ins>      | <ins>SAME</ins>     |
   | 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


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

Posted by GitBox <gi...@apache.org>.
quillblue commented on pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859#issuecomment-655922999


   @Ovilia Some additional thoughts based on this topic:
   ### Extend to Major/Minor axis ticks instead of use Primary/Secondary style
   This will help general customization on all geo coord axis ticks/labels not only simply specified to time axis. For time axis, user can use two formatter if they need. (more like the ways build charts in Microsoft Office)
   
   ### For i18n
   I would prefer to use any of external formatter (Moment for example) in callback, as various external time formatter have already provided enough functionality on culture/date preference/lanuange etc. This would also help seperate on format part and render part, which I think in axis component render is what need to be focused on. 
   For default formatter based on value, in my opinion may need to fully use of util to handle the transformation from date to text.


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


[GitHub] [incubator-echarts] pissang merged pull request #12859: [FEATURE] [5.0] time axis label formatter

Posted by GitBox <gi...@apache.org>.
pissang merged pull request #12859:
URL: https://github.com/apache/incubator-echarts/pull/12859


   


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