using LiveChartsCore.SkiaSharpView; using LiveChartsCore; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using static DyeingComputer.UserClass.SqliteHelper; using CommunityToolkit.Mvvm.ComponentModel; using LiveChartsCore.Kernel.Sketches; using LiveChartsCore.SkiaSharpView.Painting; using ScottPlot.Colormaps; using System.Drawing; using System.Windows.Media.TextFormatting; using System.Xml.Linq; using SkiaSharp; namespace DyeingComputer.ViewModel { public partial class CurveDiagramViewModel : ObservableObject//ViewModelBase { public ISeries[] Series { get; set; } = { new LineSeries { Name = Properties.Resources.Temperature +"1", Values = new double[] { 5, 0, 1000, 0, 5, 0 }, Fill = null, GeometrySize = 0, // use the line smoothness property to control the curve // it goes from 0 to 1 // where 0 is a straight line and 1 the most curved LineSmoothness = 1, ScalesYAt = 0, }, new LineSeries { Name = Properties.Resources.Temperature +"2", Values = new double[] { 7, 2, 7, 2, 7, 2 ,6,67,5,66,56,5}, Fill = null, GeometrySize = 0, LineSmoothness = 1, ScalesYAt = 0, }, new LineSeries { Name = Properties.Resources.Flowmeter, Values = new double[] { 7, 2, 7, 5467,6,67,5,66,56,5}, Fill = null, GeometrySize = 0, LineSmoothness = 1, ScalesYAt = 1, } }; // You can use the DateTimeAxis class to define a date time based axis // The first parameter is the time between each point, in this case 1 day // you can also use 1 year, 1 month, 1 hour, 1 minute, 1 second, 1 millisecond, etc // The second parameter is a function that receives the value and returns the label public Axis[] XAxes { get; set; } = { new DateTimeAxis(TimeSpan.FromSeconds(5) , date => date.ToString("yyyy-MM-dd HH:mm:ss")) }; private static readonly SKColor s_blue = new SKColor(25, 118, 210); private static readonly SKColor s_red = new SKColor(229, 57, 53); private static readonly SKColor s_yellow = new SKColor(198, 167, 0); public ICartesianAxis[] YAxes { get; set; } ={ new Axis //“units” 和 “tens” 系列将在此轴上缩放 { Name = Properties.Resources.Temperature +" ( °C )", NameTextSize = 24, NamePaint = new SolidColorPaint(s_blue), NamePadding = new LiveChartsCore.Drawing.Padding(0, 20), Padding = new LiveChartsCore.Drawing.Padding(0, 0, 20, 0), TextSize = 16, LabelsPaint = new SolidColorPaint(s_blue), TicksPaint = new SolidColorPaint(s_blue), SubticksPaint = new SolidColorPaint(s_blue), DrawTicksPath = true }, new Axis // the "hundreds" series will be scaled on this axis { Name = Properties.Resources.Flowmeter +" ( L )", NameTextSize = 24, NamePaint = new SolidColorPaint(s_red), NamePadding = new LiveChartsCore.Drawing.Padding(0, 20), Padding = new LiveChartsCore.Drawing.Padding(20, 0, 0, 0), TextSize = 16, LabelsPaint = new SolidColorPaint(s_red), TicksPaint = new SolidColorPaint(s_red), SubticksPaint = new SolidColorPaint(s_red), DrawTicksPath = true, ShowSeparatorLines = false, Position = LiveChartsCore.Measure.AxisPosition.End }, }; public CurveDiagramViewModel() { } } }