From 93d624160f6c77b0080a03b69d7ab10f69e3240a Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Tue, 19 Nov 2019 12:22:54 +0800 Subject: [PATCH] update Former-commit-id: 516b5244402aa19e84b16fe8d816b2ffff8e4fd8 --- .../IoTCenter/Controllers/AppController.cs | 4 +- projects/IoTCenter/Views/Home/Device.cshtml | 36 +- projects/IoTCenter/Views/Home/Node.cshtml | 2 +- .../StreamingAssets/wwwroot/js/device.js | 679 ++---------------- .../Assets/StreamingAssets/wwwroot/js/node.js | 175 +---- .../Assets/StreamingAssets/wwwroot/js/page.js | 248 ++++++- 6 files changed, 316 insertions(+), 828 deletions(-) diff --git a/projects/IoTCenter/Controllers/AppController.cs b/projects/IoTCenter/Controllers/AppController.cs index f6495c5f..8c3a0689 100644 --- a/projects/IoTCenter/Controllers/AppController.cs +++ b/projects/IoTCenter/Controllers/AppController.cs @@ -13,6 +13,7 @@ using Microsoft.Extensions.Hosting; using System; using System.Collections.Generic; using System.Drawing; +using System.Globalization; using System.IO; using System.Linq; using Vibrant.InfluxDB.Client; @@ -292,7 +293,8 @@ namespace IoTCenter.Controllers } if (rows != null) { - labels = rows.Select(o => o.Timestamp.Value).Select(o => o.AddHours(hours).ToString("MM-dd HH:mm:ss")).ToList(); + var format = time.StartsWith("1") ? "H:mm" : (time.StartsWith("7") ? "ddd" : "MMM-d"); + labels = rows.Select(o => o.Timestamp.Value).Select(o => o.AddHours(hours).ToString(format, new CultureInfo("zh-CN"))).ToList(); } } var model = new diff --git a/projects/IoTCenter/Views/Home/Device.cshtml b/projects/IoTCenter/Views/Home/Device.cshtml index e1c18e2a..1d2ddc48 100644 --- a/projects/IoTCenter/Views/Home/Device.cshtml +++ b/projects/IoTCenter/Views/Home/Device.cshtml @@ -137,6 +137,24 @@ }