This is an automated email from the ASF dual-hosted git repository. sushuang pushed a commit to branch axis-break-enhance in repository https://gitbox.apache.org/repos/asf/echarts-doc.git
commit df13f10d6efc48884d9c4c09998a2112d7249790 Author: 100pah <[email protected]> AuthorDate: Fri Aug 22 02:14:53 2025 +0800 enhance: useUTC --- README.md | 5 +++++ en/option/component/axis-common.md | 11 +++++++++++ en/option/option.md | 5 +++++ zh/option/component/axis-common.md | 10 ++++++++++ zh/option/option.md | 6 ++++++ 5 files changed, 37 insertions(+) diff --git a/README.md b/README.md index 9113c1cb..18040d3b 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,11 @@ Embed an example in doc (display the example directly in doc with an iframe. To ~[700x300](${galleryViewPath}doc-example/aria-pie&edit=1&reset=1) ``` +Insert an image: +```md +[600xauto](~axis-align-with-label.png) +``` + Provide an example link in doc: ```md [vertically scrollable legend](${galleryEditorPath}pie-legend&edit=1&reset=1) diff --git a/en/option/component/axis-common.md b/en/option/component/axis-common.md index 3ab91da3..6ba96d87 100644 --- a/en/option/component/axis-common.md +++ b/en/option/component/axis-common.md @@ -1240,6 +1240,17 @@ formatter: function (value, index) { } return texts.join('/'); } + +// Moreover, `echarts.time.format` can be used: +formatter: function (value, index) { + // Follow the template rules above. + const timeStrLocal = echarts.time.format(value, '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss}'); + // The third param `true` indicates that format time based on UTC. + const timeStrUTC = echarts.time.format(value, '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss}', true); + // Notice, if using UTC, ${optionDocPath}#useUTC need to be also set as `true` + // for consistency. + return timeStrLocal; +} ``` ** Cascading Templates ** diff --git a/en/option/option.md b/en/option/option.md index 2e867780..f90b7fd2 100644 --- a/en/option/option.md +++ b/en/option/option.md @@ -164,6 +164,11 @@ The default value of `useUTC` is false, for sake of considering: Notice: the setting only affects "display time", not "parse time". For how time value (like `1491339540396`, `'2013-01-04'`, ...) is parsed in echarts, see [the time part in date](~series-line.data). +Notice: if you set `useUTC: true` and use the helper method `echarts.time.format` (or other similar third-party methods), it should also be configured to format in UTC. For example, +```ts +// The third param `true` indicates that format time based on UTC. +const timeStrUTC = echarts.time.format(value, '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss}', true); +``` {{import: partial-rich-inherit-plain-label}} diff --git a/zh/option/component/axis-common.md b/zh/option/component/axis-common.md index e6fb9dc7..87fa0f3e 100644 --- a/zh/option/component/axis-common.md +++ b/zh/option/component/axis-common.md @@ -1232,6 +1232,16 @@ formatter: function (value, index) { } return texts.join('/'); } + +// 另外,`echarts.time.format` 也可以被使用: +formatter: function (value, index) { + // 时间模版的规则如上描述。 + const timeStrLocal = echarts.time.format(value, '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss}'); + // 第三个参数表示,基于 UTC 解析时间。 + const timeStrUTC = echarts.time.format(value, '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss}', true); + // 注意:如果使用 UTC,${optionDocPath}#useUTC 也要设置为 `true`,保持一致。 + return timeStrLocal; +} ``` ** 分级模板 ** diff --git a/zh/option/option.md b/zh/option/option.md index 77048280..685adc7b 100644 --- a/zh/option/option.md +++ b/zh/option/option.md @@ -164,6 +164,12 @@ ECharts 2 里是底层强制使用单独的层绘制高亮图形,但是会带 注意,这个参数实际影响的是『展示』,而非用户输入的时间值的解析。 关于用户输入的时间值(例如 `1491339540396`, `'2013-01-04'` 等)的解析,参见 [date 中时间相关部分](~series-line.data)。 +注意,如果设置了 `useUTC: true`,并且使用了帮助函数 `echarts.time.format`(或者其他第三方类似函数),它同样要设置成按照 UTC 运作。例如, +```ts +// 第三个参数 `true` 表示,按照 UTC 来解释时间。 +const timeStrUTC = echarts.time.format(value, '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss}', true); +``` + {{import: partial-rich-inherit-plain-label }} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
