增加numericFormatterdatetime的支持

This commit is contained in:
monitor1394
2024-09-11 08:12:14 +08:00
parent 9a98d6a5df
commit 768cf8d404
10 changed files with 227 additions and 44 deletions

View File

@@ -1031,7 +1031,11 @@ A candlestick chart is a style of financial chart used to describe price movemen
|GetSerieLabelName()||public static string GetSerieLabelName(string prefix, int i, int j)|
|GetString()||public static string GetString(string prefix, int suffix)|
|IntToStr()||public static string IntToStr(int value, string numericFormatter = "")|
|NumberToDateStr()||public static string NumberToDateStr(double timestamp, string formatter)|
|NumberToDateTime()||public static DateTime NumberToDateTime(double timestamp)|
|NumberToStr()||public static string NumberToStr(double value, string formatter)|
|NumberToTimeSpan()||public static TimeSpan NumberToTimeSpan(double timestamp)|
|NumberToTimeStr()||public static string NumberToTimeStr(double timestamp, string formatter)|
## ChartConst
@@ -1361,12 +1365,13 @@ DataZoom component is used for zooming a specific area, which enables user to in
|public method|since|description|
|--|--|--|
|GetDateTime()||public static DateTime GetDateTime(double timestamp)|
|GetDateTime()||public static DateTime GetDateTime(int timestamp)|
|GetDateTime()||public static DateTime GetDateTime(double timestamp, bool local = true)|
|GetDefaultDateTimeString()||public static string GetDefaultDateTimeString(int timestamp, double range = 0)|
|GetTimestamp()||public static int GetTimestamp()|
|GetTimestamp()||public static int GetTimestamp(DateTime time)|
|GetTimestamp()||public static int GetTimestamp(string dateTime)|
|GetTimestamp()||public static int GetTimestamp(DateTime time, bool local = false)|
|GetTimestamp()||public static int GetTimestamp(string dateTime, bool local = false)|
|IsDateOrTimeRegex()||public static bool IsDateOrTimeRegex(string regex)|
|IsDateOrTimeRegex()||public static bool IsDateOrTimeRegex(string regex, ref bool date, ref string formatter)|
## DebugInfo

View File

@@ -1259,7 +1259,7 @@ The interface for serie data component.
|opacity|1||透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
|itemMarker|||提示框单项的字符标志。用在Tooltip中。
|itemFormatter|||提示框单项的字符串模版格式器。具体配置参考`Tooltip`的`formatter`
|numericFormatter|||Standard numeric format strings.
|numericFormatter|||Standard number and date format string. Used to format a Double value or a DateTime date as a string. numericFormatter is used as an argument to either `Double.ToString ()` or `DateTime.ToString()`. <br /> The number format uses the Axx format: A is a single-character format specifier that supports C currency, D decimal, E exponent, F fixed-point number, G regular, N digit, P percentage, R round trip, and X hexadecimal. xx is precision specification, from 0-99. E.g. F1, E2<br /> Date format: Starts with `date`, which is used to format DateTime. Common date formats are: yyyy year, MM month, dd day, HH hour, mm minute, ss second, fff millisecond. For example: date:yyyy-MM-dd HH:mm:ss<br /> Time format: Starts with `time`, which is used to format TimeSpan. Common time formats are: d day, HH hour, mm minute, ss second, fffffff fractional part. Only the version of Unity2018 or later can support formatting, and the characters inside should be escaped. For example: time:HH\:mm\:ss<br /> number format reference: https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings<br/> date format reference: https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings<br/> Note: The date and time formats are only supported by 'v3.12.0' or later.<br/>
|cornerRadius|||The radius of rounded corner. Its unit is px. Use array to respectively specify the 4 corner radiuses((clockwise upper left, upper right, bottom right and bottom left)).
```mdx-code-block
@@ -1320,7 +1320,7 @@ Text label of chart, to explain some data information about graphic item like va
|autoRotate|false|v3.6.0|auto rotate of label.
|distance|||the distance of label to axis line.
|formatter|||label content string template formatter. \n line wrapping is supported. Formatters for some components will not take effect. <br /> Template placeholder have the following, some of which apply only to fixed components: <br /> `{.}` : indicates the dot mark. <br /> `{a}` : indicates the series name. <br /> `{b}` : category value of x axis or data name. <br /> `{c}` : data value. <br /> `{d}` : percentage. <br /> `{e}` : indicates the data name. <br /> `{f}` : data sum. <br /> `{g}` : indicates the total number of data. <br /> `{h}` : hexadecimal color value. <br /> `{y}` : category value of y axis. <br /> `{value}` : The value of the axis or legend. <br /> The following placeholder apply to `UITable` components: <br /> `{name}` : indicates the row name of the table. <br /> `{index}` : indicates the row number of the table. <br /> The following placeholder apply to `UIStatistc` components: <br /> `{title}` : title text. <br /> `{dd}` : day. <br /> `{hh}` : hours. <br /> `{mm}` : minutes. <br /> `{ss}` : second. <br /> `{fff}` : milliseconds. <br /> `{d}` : day. <br /> `{h}` : hours. <br /> `{m}` : minutes. <br /> `{s}` : second. <br /> `{f}` : milliseconds. <br /> Example :{b}:{c}<br />
|numericFormatter|||Standard number and date format string. Used to format a Double value or a DateTime date as a string. numericFormatter is used as an argument to either `Double.ToString ()` or `DateTime.ToString()`. <br /> The number format uses the Axx format: A is a single-character format specifier that supports C currency, D decimal, E exponent, F fixed-point number, G regular, N digit, P percentage, R round trip, and X hexadecimal. xx is precision specification, from 0-99. E.g. F1, E2<br /> Date format Common date formats are: yyyy year, MM month, dd day, HH hour, mm minute, ss second, fff millisecond. For example: yyyy-MM-dd HH:mm:ss<br /> number format reference: https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings<br/> date format reference: https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings<br/>
|numericFormatter|||Standard number and date format string. Used to format a Double value or a DateTime date as a string. numericFormatter is used as an argument to either `Double.ToString ()` or `DateTime.ToString()`. <br /> The number format uses the Axx format: A is a single-character format specifier that supports C currency, D decimal, E exponent, F fixed-point number, G regular, N digit, P percentage, R round trip, and X hexadecimal. xx is precision specification, from 0-99. E.g. F1, E2<br /> Date format: Starts with `date`, which is used to format DateTime. Common date formats are: yyyy year, MM month, dd day, HH hour, mm minute, ss second, fff millisecond. For example: date:yyyy-MM-dd HH:mm:ss<br /> Time format: Starts with `time`, which is used to format TimeSpan. Common time formats are: d day, HH hour, mm minute, ss second, fffffff fractional part. Only the version of Unity2018 or later can support formatting, and the characters inside should be escaped. For example: time:HH\:mm\:ss<br /> number format reference: https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings<br/> date format reference: https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings<br/> Note: The date and time formats are only supported by 'v3.12.0' or later.<br/>
|width|0||the width of label. If set as default value 0, it means than the label width auto set as the text width.
|height|0||the height of label. If set as default value 0, it means than the label height auto set as the text height.
|icon|||the sytle of icon. [IconStyle](#iconstyle)|
@@ -1813,6 +1813,19 @@ Radial axis of polar coordinate.
> class in XCharts.Runtime / Inherits from: [Serie](#serie)
```mdx-code-block
<APITable name="Ring">
```
|field|default|since|comment|
|--|--|--|--|
|radiusGradient|false|v3.12.0|Whether to use gradient color in pie chart.
```mdx-code-block
</APITable>
```
## Scatter
> class in XCharts.Runtime / Inherits from: [BaseScatter](#basescatter)
@@ -2350,7 +2363,7 @@ Tooltip component.
|fixedHeight|0||Fixed height. Higher priority than minHeight.
|minWidth|0||Minimum width. If fixedWidth has a value, get fixedWidth first.
|minHeight|0||Minimum height. If fixedHeight has a value, take priority over fixedHeight.
|numericFormatter|||Standard number and date format string. Used to format a Double value or a DateTime date as a string. numericFormatter is used as an argument to either `Double.ToString ()` or `DateTime.ToString()`. <br /> The number format uses the Axx format: A is a single-character format specifier that supports C currency, D decimal, E exponent, F fixed-point number, G regular, N digit, P percentage, R round trip, and X hexadecimal. xx is precision specification, from 0-99. E.g. F1, E2<br /> Date format Common date formats are: yyyy year, MM month, dd day, HH hour, mm minute, ss second, fff millisecond. For example: yyyy-MM-dd HH:mm:ss<br /> number format reference: https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings<br/> date format reference: https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings<br/>
|numericFormatter|||Standard number and date format string. Used to format a Double value or a DateTime date as a string. numericFormatter is used as an argument to either `Double.ToString ()` or `DateTime.ToString()`. <br /> The number format uses the Axx format: A is a single-character format specifier that supports C currency, D decimal, E exponent, F fixed-point number, G regular, N digit, P percentage, R round trip, and X hexadecimal. xx is precision specification, from 0-99. E.g. F1, E2<br /> Date format: Starts with `date`, which is used to format DateTime. Common date formats are: yyyy year, MM month, dd day, HH hour, mm minute, ss second, fff millisecond. For example: date:yyyy-MM-dd HH:mm:ss<br /> Time format: Starts with `time`, which is used to format TimeSpan. Common time formats are: d day, HH hour, mm minute, ss second, fffffff fractional part. Only the version of Unity2018 or later can support formatting, and the characters inside should be escaped. For example: time:HH\:mm\:ss<br /> number format reference: https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings<br/> date format reference: https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings<br/> Note: The date and time formats are only supported by 'v3.12.0' or later.<br/>
|paddingLeftRight|10||the text padding of left and right. defaut:5.
|paddingTopBottom|10||the text padding of top and bottom. defaut:5.
|ignoreDataShow|false||Whether to show ignored data on tooltip.

View File

@@ -1031,7 +1031,11 @@ slug: /api
|GetSerieLabelName()||public static string GetSerieLabelName(string prefix, int i, int j)|
|GetString()||public static string GetString(string prefix, int suffix)|
|IntToStr()||public static string IntToStr(int value, string numericFormatter = "")|
|NumberToDateStr()||public static string NumberToDateStr(double timestamp, string formatter)|
|NumberToDateTime()||public static DateTime NumberToDateTime(double timestamp)|
|NumberToStr()||public static string NumberToStr(double value, string formatter)|
|NumberToTimeSpan()||public static TimeSpan NumberToTimeSpan(double timestamp)|
|NumberToTimeStr()||public static string NumberToTimeStr(double timestamp, string formatter)|
## ChartConst
@@ -1361,12 +1365,13 @@ DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息
|API|版本|描述|
|--|--|--|
|GetDateTime()||public static DateTime GetDateTime(double timestamp)|
|GetDateTime()||public static DateTime GetDateTime(int timestamp)|
|GetDateTime()||public static DateTime GetDateTime(double timestamp, bool local = true)|
|GetDefaultDateTimeString()||public static string GetDefaultDateTimeString(int timestamp, double range = 0)|
|GetTimestamp()||public static int GetTimestamp()|
|GetTimestamp()||public static int GetTimestamp(DateTime time)|
|GetTimestamp()||public static int GetTimestamp(string dateTime)|
|GetTimestamp()||public static int GetTimestamp(DateTime time, bool local = false)|
|GetTimestamp()||public static int GetTimestamp(string dateTime, bool local = false)|
|IsDateOrTimeRegex()||public static bool IsDateOrTimeRegex(string regex)|
|IsDateOrTimeRegex()||public static bool IsDateOrTimeRegex(string regex, ref bool date, ref string formatter)|
## DebugInfo

View File

@@ -76,6 +76,7 @@ slug: /changelog
## master
* (2024.09.09) 增加`numericFormatter``date``time`的支持
* (2024.09.03) 完善`AreaStyle``origin`参数设置区域填充起始位置
* (2024.09.01) 增加`Ring``radiusGradient`参数设置渐变方向
* (2024.09.01) 优化`Axis`为时间轴时首个Label的位置

View File

@@ -1223,7 +1223,7 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|opacity|1||透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
|itemMarker|||提示框单项的字符标志。用在Tooltip中。
|itemFormatter|||提示框单项的字符串模版格式器。具体配置参考`Tooltip`的`formatter`
|numericFormatter|||标准数字格式字符串。用于将数值格式化显示为字符串。 使用Axx的形式A是格式说明符的单字符支持C货币、D十进制、E指数、F定点数、G常规、N数字、P百分比、R往返、X十六进制的。xx是精度说明从0-99。 参考https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings
|numericFormatter|||标准数字和日期格式字符串。用于将Double数值或DateTime日期格式化显示为字符串。numericFormatter用来作为Double.ToString()或DateTime.ToString()的参数。<br/> 数字格式使用Axx的形式A是格式说明符的单字符支持C货币、D十进制、E指数、F定点数、G常规、N数字、P百分比、R往返、X十六进制的。xx是精度说明从0-99。如F1, E2<br/> 日期格式:以`date`开头用来格式化DateTime常见格式有yyyy年MM月dd日HH时mm分ss秒fff毫秒。如date:yyyy-MM-dd HH:mm:ss<br/> 时间格式:以`time`开头用来格式化TimeSpan常见格式有d日HH时mm分ss秒fffffff小数部分。 需要Unity2018以上版本才支持格式化并且里面的字符要转义。如time:d\.HH\:mm\:ss<br/> 数值格式化参考https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings <br/> 日期格式化参考https://learn.microsoft.com/zh-cn/dotnet/standard/base-types/standard-date-and-time-format-strings <br/> 时间格式化参考https://learn.microsoft.com/zh-cn/dotnet/standard/base-types/standard-timespan-format-strings <br/> 注意date和time格式需要`v3.12.0`以上版本才支持。
|cornerRadius|||圆角半径。用数组分别指定4个圆角半径顺时针左上右上右下左下
```mdx-code-block
@@ -1282,7 +1282,7 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|autoRotate|false|v3.6.0|是否自动旋转。
|distance|||距离轴线的距离。
|formatter|||标签内容字符串模版格式器。支持用 \n 换行。部分组件的格式器会不生效。<br/> 模板通配符有以下这些,部分只适用于固定的组件:<br/> `{.}`:圆点标记。<br/> `{a}`:系列名。<br/> `{b}`X轴类目名或数据名。<br/> `{c}`:数据值。<br/> `{d}`:百分比。<br/> `{e}`:数据名。<br/> `{f}`:数据和。<br/> `{g}`:数据总个数。<br/> `{h}`:十六进制颜色值。<br/> `{y}`Y轴的类目名。<br/> `{value}`:坐标轴或图例的值。<br/> 以下通配符适用UITable组件<br/> `{name}` 表格的行名。<br/> `{index}`:表格的行号。<br/> 以下通配符适用UIStatistc组件<br/> `{title}`:标题文本。<br/> `{dd}`:天。<br/> `{hh}`:小时。<br/> `{mm}`:分钟。<br/> `{ss}`:秒。<br/> `{fff}`:毫秒。<br/> `{d}`:天。<br/> `{h}`:小时。<br/> `{m}`:分钟。<br/> `{s}`:秒。<br/> `{f}`:毫秒。<br/> 示例:“{b}:{c}”
|numericFormatter|||标准数字和日期格式字符串。用于将Double数值或DateTime日期格式化显示为字符串。numericFormatter用来作为Double.ToString()或DateTime.ToString()的参数。<br/> 数字格式使用Axx的形式A是格式说明符的单字符支持C货币、D十进制、E指数、F定点数、G常规、N数字、P百分比、R往返、X十六进制的。xx是精度说明从0-99。如F1, E2<br/> 日期格式常见格式yyyy年MM月dd日HH时mm分ss秒fff毫秒。如yyyy-MM-dd HH:mm:ss<br/> 数值格式化参考https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings <br/> 日期格式化参考https://learn.microsoft.com/zh-cn/dotnet/standard/base-types/standard-date-and-time-format-strings
|numericFormatter|||标准数字和日期格式字符串。用于将Double数值或DateTime日期格式化显示为字符串。numericFormatter用来作为Double.ToString()或DateTime.ToString()的参数。<br/> 数字格式使用Axx的形式A是格式说明符的单字符支持C货币、D十进制、E指数、F定点数、G常规、N数字、P百分比、R往返、X十六进制的。xx是精度说明从0-99。如F1, E2<br/> 日期格式:以`date`开头用来格式化DateTime常见格式yyyy年MM月dd日HH时mm分ss秒fff毫秒。如date:yyyy-MM-dd HH:mm:ss<br/> 时间格式:以`time`开头用来格式化TimeSpan常见格式有d日HH时mm分ss秒fffffff小数部分。 需要Unity2018以上版本才支持格式化并且里面的字符要转义。如time:d\.HH\:mm\:ss<br/> 数值格式化参考https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings <br/> 日期格式化参考https://learn.microsoft.com/zh-cn/dotnet/standard/base-types/standard-date-and-time-format-strings <br/> 时间格式化参考https://learn.microsoft.com/zh-cn/dotnet/standard/base-types/standard-timespan-format-strings <br/> 注意date和time格式需要`v3.12.0`以上版本才支持。
|width|0||标签的宽度。一般不用指定,不指定时则自动是文字的宽度。
|height|0||标签的高度。一般不用指定,不指定时则自动是文字的高度。
|icon|||图标样式。 [IconStyle](#iconstyle)|
@@ -1757,6 +1757,18 @@ Radar coordinate conponnet for radar charts. 雷达图坐标系组件,只适
> class in XCharts.Runtime / 继承自: [Serie](#serie)
```mdx-code-block
<APITable name="Ring">
```
|参数|默认|版本|描述|
|--|--|--|--|
|radiusGradient|false|v3.12.0|是否开启半径方向的渐变效果。
```mdx-code-block
</APITable>
```
## Scatter
> class in XCharts.Runtime / 继承自: [BaseScatter](#basescatter)
@@ -2278,7 +2290,7 @@ Serie的状态样式。Serie的状态有正常高亮淡出选中四种
|fixedHeight|0||固定高度。比 minHeight 优先。
|minWidth|0||最小宽度。如若 fixedWidth 设有值,优先取 fixedWidth。
|minHeight|0||最小高度。如若 fixedHeight 设有值,优先取 fixedHeight。
|numericFormatter|||标准数字和日期格式字符串。用于将Double数值或DateTime日期格式化显示为字符串。numericFormatter用来作为Double.ToString()或DateTime.ToString()的参数。<br/> 数字格式使用Axx的形式A是格式说明符的单字符支持C货币、D十进制、E指数、F定点数、G常规、N数字、P百分比、R往返、X十六进制的。xx是精度说明从0-99。如F1, E2<br/> 日期格式常见格式yyyy年MM月dd日HH时mm分ss秒fff毫秒。如yyyy-MM-dd HH:mm:ss<br/> 数值格式化参考https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings <br/> 日期格式化参考https://learn.microsoft.com/zh-cn/dotnet/standard/base-types/standard-date-and-time-format-strings
|numericFormatter|||标准数字和日期格式字符串。用于将Double数值或DateTime日期格式化显示为字符串。numericFormatter用来作为Double.ToString()或DateTime.ToString()的参数。<br/> 数字格式使用Axx的形式A是格式说明符的单字符支持C货币、D十进制、E指数、F定点数、G常规、N数字、P百分比、R往返、X十六进制的。xx是精度说明从0-99。如F1, E2<br/> 日期格式:以`date`开头用来格式化DateTime常见格式yyyy年MM月dd日HH时mm分ss秒fff毫秒。如date:yyyy-MM-dd HH:mm:ss<br/> 时间格式:以`time`开头用来格式化TimeSpan常见格式有d日HH时mm分ss秒fffffff小数部分。 需要Unity2018以上版本才支持格式化并且里面的字符要转义。如time:d\.HH\:mm\:ss<br/> 数值格式化参考https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings <br/> 日期格式化参考https://learn.microsoft.com/zh-cn/dotnet/standard/base-types/standard-date-and-time-format-strings <br/> 时间格式化参考https://learn.microsoft.com/zh-cn/dotnet/standard/base-types/standard-timespan-format-strings <br/> 注意date和time格式需要`v3.12.0`以上版本才支持。
|paddingLeftRight|10||左右边距。
|paddingTopBottom|10||上下边距。
|ignoreDataShow|false||是否显示忽略数据在tooltip上。