添加资源,总览页面添加图表,其它逻辑修正
This commit is contained in:
commit
4449530bb7
14 files changed
+222
-57
No files matched your search
+19
-14
@@ -5,20 +5,25 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.UserControls"
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
mc:Ignorable="d"
|
||||
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
|
||||
mc:Ignorable="d"
|
||||
Loaded="UserControl_Loaded"
|
||||
d:DesignHeight="400" d:DesignWidth="300" Background="White">
|
||||
<Grid>
|
||||
<TextBlock x:Name="name" VerticalAlignment="Top" Height="50" Background="#FF646464" Text="-----" FontWeight="Bold" FontSize="36" />
|
||||
<TextBlock x:Name="temp" VerticalAlignment="Top" Height="50" Text="---.-°C" FontWeight="Bold" FontSize="36" HorizontalAlignment="Right" Padding="5,0,5,0"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.process}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,50,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.Step}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,100,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.message}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,150,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.orders}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,200,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<TextBlock x:Name="time" Text="----------------------------" Height="30" FontWeight="Bold" FontSize="24" Margin="5,250,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<local:RoilingTextBlock Foreground="Black" x:Name="Process" Text="NO Information" FontSize="21" Height="30" Margin="120,50,0,0" VerticalAlignment="Top"/>
|
||||
<local:RoilingTextBlock Foreground="Black" x:Name="Step" Text="NO Information" FontSize="21" Height="30" Margin="120,100,0,0" VerticalAlignment="Top"/>
|
||||
<local:RoilingTextBlock Foreground="Black" x:Name="Message" Text="NO Information" FontSize="21" Height="30" Margin="120,150,0,0" VerticalAlignment="Top"/>
|
||||
<local:RoilingTextBlock Foreground="Black" x:Name="Orders" Text="NO Information" FontSize="21" Height="30" Margin="120,200,0,0" VerticalAlignment="Top"/>
|
||||
<StackPanel x:Name="log" Margin="0,300,0,0"/>
|
||||
<Grid Background="#FFBFBFBF">
|
||||
<TextBlock x:Name="name" VerticalAlignment="Top" Height="50" Background="#FF646464" Text="-----" FontWeight="Bold" FontSize="36" />
|
||||
<TextBlock x:Name="temp" VerticalAlignment="Top" Height="50" Text="---.-°C" FontWeight="Bold" FontSize="36" HorizontalAlignment="Right" Padding="5,0,5,0"/>
|
||||
<Grid Margin="2,50,2,2" Background="White">
|
||||
<TextBlock Text="{x:Static lang:Resources.process}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,0,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.Step}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,50,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.message}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,100,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.orders}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,150,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<TextBlock x:Name="time" Text="----------------------------" Height="30" FontWeight="Bold" FontSize="24" Margin="5,180,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<local:RoilingTextBlock Foreground="Black" x:Name="Process" Text="NO Information" FontSize="21" Height="30" Margin="120,0,0,0" VerticalAlignment="Top"/>
|
||||
<local:RoilingTextBlock Foreground="Black" x:Name="Step" Text="NO Information" FontSize="21" Height="30" Margin="120,50,0,0" VerticalAlignment="Top"/>
|
||||
<local:RoilingTextBlock Foreground="Black" x:Name="Message" Text="NO Information" FontSize="21" Height="30" Margin="120,100,0,0" VerticalAlignment="Top"/>
|
||||
<local:RoilingTextBlock Foreground="Black" x:Name="Orders" Text="NO Information" FontSize="21" Height="30" Margin="120,150,0,0" VerticalAlignment="Top"/>
|
||||
<lvc:CartesianChart x:Name="OscChart" Margin="0,200 ,0,0" EasingFunction="{x:Null}" ZoomMode="PanX"
|
||||
Series="{Binding Series}" YAxes="{Binding YAxes}" XAxes="{Binding XAxes}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,8 +1,18 @@
|
||||
using ScottPlot.Plottables;
|
||||
using LiveChartsCore;
|
||||
using LiveChartsCore.Defaults;
|
||||
using LiveChartsCore.Kernel.Sketches;
|
||||
using LiveChartsCore.SkiaSharpView;
|
||||
using LiveChartsCore.SkiaSharpView.Painting;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using ScottPlot.Plottables;
|
||||
using SkiaSharp;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
@@ -28,10 +38,75 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserControls
|
||||
public info()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = this; //new infoModel();
|
||||
}
|
||||
|
||||
|
||||
public void DataAdd()
|
||||
{
|
||||
}
|
||||
private readonly Random _random = new Random();
|
||||
private readonly List<DateTimePoint> _values = new List<DateTimePoint>();
|
||||
private readonly DateTimeAxis _customAxis;
|
||||
public ObservableCollection<ISeries> Series { get; set; }
|
||||
public static ObservableCollection<ObservableValue> ObservableValues { get; set; }
|
||||
|
||||
//x轴时间格式
|
||||
public Axis[] XAxes { get; set; } =
|
||||
{
|
||||
new DateTimeAxis(TimeSpan.FromSeconds(5) , date => date.ToString("HH:mm"))
|
||||
{
|
||||
MinLimit = DateTime.Now.AddHours(-6).Ticks,
|
||||
MaxLimit = DateTime.Now.AddHours(0.5).Ticks,
|
||||
CrosshairLabelsBackground = SKColors.DarkGray.AsLvcColor(),
|
||||
CrosshairLabelsPaint = new SolidColorPaint(SKColors.DarkSlateBlue, 1),
|
||||
CrosshairPaint = new SolidColorPaint(SKColors.DarkSlateGray, 1),
|
||||
},
|
||||
};
|
||||
//颜色
|
||||
private static readonly SKColor s_blue = new SKColor(25, 118, 210);
|
||||
private static readonly SKColor s_red = new SKColor(229, 57, 53);
|
||||
public ICartesianAxis[] YAxes { get; set; } ={
|
||||
new Axis //y在此轴上缩放
|
||||
{
|
||||
MinLimit =0,
|
||||
MaxLimit =160,
|
||||
NamePadding = new LiveChartsCore.Drawing.Padding(0, 20),
|
||||
Padding = new LiveChartsCore.Drawing.Padding(0, 0, 20, 0),
|
||||
TextSize = 12,
|
||||
LabelsPaint = new SolidColorPaint(s_blue),
|
||||
TicksPaint = new SolidColorPaint(s_blue),
|
||||
SubticksPaint = new SolidColorPaint(s_blue),
|
||||
DrawTicksPath = true,
|
||||
CrosshairSnapEnabled = true,
|
||||
Position = LiveChartsCore.Measure.AxisPosition.Start
|
||||
},//温度轴
|
||||
|
||||
};
|
||||
|
||||
private static ObservableCollection<DateTimePoint> MTH_values;
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var MTH_items = new List<DateTimePoint>();
|
||||
MTH_values = new ObservableCollection<DateTimePoint>(MTH_items);
|
||||
|
||||
Series = new ObservableCollection<ISeries>
|
||||
{
|
||||
new LineSeries<DateTimePoint>
|
||||
{
|
||||
Name = Properties.Resources.Temperature,
|
||||
Values = MTH_values,
|
||||
Stroke = new SolidColorPaint(s_red, 2),
|
||||
GeometrySize = 0,
|
||||
GeometryStroke = new SolidColorPaint(s_red, 2),
|
||||
Fill = null,
|
||||
LineSmoothness = 0,
|
||||
ScalesYAt = 2,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user