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/29 15:33:41 UTC

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

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