using Aitex.Core.RT.IOCore; using SciChart.Charting.Visuals.Axes.LabelProviders; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MECF.Framework.UI.Client.Converter { public class MultiLineXAxisLabelProvider : NumericLabelProvider { private DateTime _firstTime=DateTime.MinValue; public MultiLineXAxisLabelProvider(DateTime time) { _firstTime = time; } public override string FormatLabel(IComparable dataValue) { if (dataValue is double xValue &&xValue>=0) { long t = Convert.ToInt64(xValue * 10);//保留1位小数 // 返回两行文本,用换行符分隔 return $"{t / 36000:D2}:{(t % 36000) / 600:D2}:{(t % 600) / 10d:00.#}\n{_firstTime.AddSeconds(t / 10d):HH:mm:ss.F}"; } return base.FormatLabel(dataValue); } } }