You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

192 lines
8.3 KiB

<reactive:ReactiveUserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:AuroraDesk.Presentation.ViewModels.Pages"
xmlns:reactive="using:ReactiveUI.Avalonia"
xmlns:scottplot="using:ScottPlot.Avalonia"
xmlns:converters="using:AuroraDesk.Presentation.Converters"
mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="800"
x:Class="AuroraDesk.Presentation.Views.Pages.ScottPlotPageView"
x:DataType="vm:ScottPlotPageViewModel">
<reactive:ReactiveUserControl.Resources>
<converters:InvertedBoolConverter x:Key="InvertedBoolConverter"/>
</reactive:ReactiveUserControl.Resources>
<Design.DataContext>
<vm:ScottPlotPageViewModel />
</Design.DataContext>
<Grid Margin="12">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- 第一行第一列:示例图表 -->
<Border Grid.Row="0" Grid.Column="0"
Background="White"
CornerRadius="8"
Padding="12"
Margin="0,0,6,6"
BorderThickness="1"
BorderBrush="#E0E0E0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Text="示例图表"
FontSize="16"
FontWeight="Bold"
Foreground="#2C3E50"
Margin="0,0,0,8"/>
<!-- 控制面板 -->
<Border Grid.Row="1"
Background="#F8F9FA"
CornerRadius="4"
Padding="8"
Margin="0,0,0,8">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Text="阈值:"
VerticalAlignment="Center"
Margin="0,0,8,0"/>
<NumericUpDown Grid.Column="1"
Value="{Binding Threshold}"
Minimum="0"
Maximum="20"
Increment="0.5"
FormatString="F1"
Margin="0,0,8,0"/>
<Button Grid.Column="2"
Content="Start"
Command="{Binding StartLineChartCommand}"
IsEnabled="{Binding IsLineChartRunning, Converter={StaticResource InvertedBoolConverter}}"
Padding="12,6"
Background="#27AE60"
Foreground="White"
BorderThickness="0"
CornerRadius="4"
Margin="0,0,6,0"/>
<Button Grid.Column="3"
Content="Stop"
Command="{Binding StopLineChartCommand}"
IsEnabled="{Binding IsLineChartRunning}"
Padding="12,6"
Background="#E74C3C"
Foreground="White"
BorderThickness="0"
CornerRadius="4"
Margin="0,0,6,0"/>
<Button Grid.Column="4"
Content="刷新"
Command="{Binding ResetLineChartCommand}"
Padding="12,6"
Background="#3498DB"
Foreground="White"
BorderThickness="0"
CornerRadius="4"/>
</Grid>
</Border>
<scottplot:AvaPlot Grid.Row="2"
x:Name="PlotControl1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"/>
</Grid>
</Border>
<!-- 第一行第二列:正弦波 -->
<Border Grid.Row="0" Grid.Column="1"
Background="White"
CornerRadius="8"
Padding="12"
Margin="6,0,0,6"
BorderThickness="1"
BorderBrush="#E0E0E0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Text="正弦波"
FontSize="16"
FontWeight="Bold"
Foreground="#2C3E50"
Margin="0,0,0,8"/>
<scottplot:AvaPlot Grid.Row="1"
x:Name="PlotControl2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"/>
</Grid>
</Border>
<!-- 第二行第一列:多系列 -->
<Border Grid.Row="1" Grid.Column="0"
Background="White"
CornerRadius="8"
Padding="12"
Margin="0,6,6,0"
BorderThickness="1"
BorderBrush="#E0E0E0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Text="多系列图表"
FontSize="16"
FontWeight="Bold"
Foreground="#2C3E50"
Margin="0,0,0,8"/>
<scottplot:AvaPlot Grid.Row="1"
x:Name="PlotControl3"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"/>
</Grid>
</Border>
<!-- 第二行第二列:柱状图 -->
<Border Grid.Row="1" Grid.Column="1"
Background="White"
CornerRadius="8"
Padding="12"
Margin="6,6,0,0"
BorderThickness="1"
BorderBrush="#E0E0E0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Text="柱状图"
FontSize="16"
FontWeight="Bold"
Foreground="#2C3E50"
Margin="0,0,0,8"/>
<scottplot:AvaPlot Grid.Row="1"
x:Name="PlotControl4"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"/>
</Grid>
</Border>
</Grid>
</reactive:ReactiveUserControl>