增加ChartuseUtc参数设置显示时间是否用UTC时间

This commit is contained in:
monitor1394
2025-10-31 08:39:29 +08:00
parent 2cb82526bc
commit f1c9a3ac4b
12 changed files with 42 additions and 33 deletions

View File

@@ -485,10 +485,10 @@ namespace XCharts.Runtime
private static bool isDateFormatter = false;
private static string newFormatter = null;
public string GetFormatterDateTime(int labelIndex, int totalIndex, double value, double minValue, double maxValue)
public string GetFormatterDateTime(int labelIndex, int totalIndex, double value, double minValue, double maxValue, bool local)
{
var timestamp = value;
var dateTime = DateTimeUtil.GetDateTime(timestamp);
var dateTime = DateTimeUtil.GetDateTime(timestamp, local);
var dateString = string.Empty;
if (string.IsNullOrEmpty(numericFormatter) || numericFormatter.Equals("f2"))
{
@@ -501,7 +501,7 @@ namespace XCharts.Runtime
if (DateTimeUtil.IsDateOrTimeRegex(numericFormatter, ref isDateFormatter, ref newFormatter))
{
if (isDateFormatter)
dateString = ChartCached.NumberToDateStr(timestamp, newFormatter);
dateString = ChartCached.NumberToDateStr(timestamp, newFormatter, local);
else
dateString = ChartCached.NumberToTimeStr(timestamp, newFormatter);
}