为曲线上的数据点添加自定义数据格式颜色字体大小线条粗度

This commit is contained in:
YONGYE 2025-10-10 17:49:48 +08:00
parent ec3c068817
commit db162f3be3
2 changed files with 25 additions and 7 deletions

View File

@ -279,7 +279,8 @@
<lvc:CartesianChart Grid.Row="1"
x:Name="myChart"
Margin="0,0,0,5"/>
Margin="0,0,0,5">
</lvc:CartesianChart>
</Grid>
<!-- 图2传感器2 -->
@ -352,13 +353,13 @@
<ComboBoxItem Content="中等" IsSelected="True"/>
<ComboBoxItem Content="高等"/>
</ComboBox>
<RadioButton Content="日志记录" VerticalAlignment="Center" Margin="10,0,0,0" Foreground="Black"/>
<!--<RadioButton Content="日志记录" VerticalAlignment="Center" Margin="10,0,0,0" Foreground="Black"/>-->
</StackPanel>
<!-- 中间状态显示 -->
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,10,0">
<Button Content="保存至Cg&amp;Cgk" Width="100" Height="30" Margin="5,0"/>
<Button Content="保存至R&amp;R" Width="80" Height="30" Margin="5,0"/>
<!--<Button Content="保存至Cg&amp;Cgk" Width="100" Height="30" Margin="5,0"/>
<Button Content="保存至R&amp;R" Width="80" Height="30" Margin="5,0"/>-->
</StackPanel>
<!-- 右侧按钮组 -->

View File

@ -52,6 +52,8 @@ namespace WpfApp
{
Title = "标准1",
Values = new ChartValues<double> { 5, 5, 5, 5, 5 },
DataLabels = true,
LabelPoint = value => value.Y.ToString("0.##") + " Hz",
StrokeThickness = 2,
Fill = System.Windows.Media.Brushes.Transparent
},
@ -60,6 +62,11 @@ namespace WpfApp
{
Title = "标准2",
Values = new ChartValues<double> { 10, 10, 10, 10, 10 },
DataLabels = true,
LabelPoint = value => value.Y.ToString("0.##") + " Hz",
//Foreground = System.Windows.Media.Brushes.Blue,// 标签颜色
//FontSize = 14,// 字体大小
// StrokeThickness = 2, // 线条粗细
StrokeThickness = 2,
Stroke = System.Windows.Media.Brushes.Green,
Fill = System.Windows.Media.Brushes.Transparent
@ -69,6 +76,8 @@ namespace WpfApp
{
Title = "标准3",
Values = new ChartValues<double> { 30, 30, 30, 30, 30 },
DataLabels = true,
LabelPoint = value => value.Y.ToString("0.##") + " Hz",
StrokeThickness = 2,
Stroke = System.Windows.Media.Brushes.Red,
Fill = System.Windows.Media.Brushes.Transparent
@ -211,6 +220,11 @@ namespace WpfApp
{
this.Title = newTitle;
}
#region
// 在 MainWindow 内部
/// <summary>
/// 按钮点击触发文件页面
@ -276,9 +290,9 @@ namespace WpfApp
{
StandardPage standardPage = new StandardPage();
NavigationWindow navWin = new NavigationWindow();
navWin.Width = 1440;
navWin.Height = 960;
navWin.ResizeMode = ResizeMode.NoResize;
navWin.Width = 972;
navWin.Height = 648;
//navWin.ResizeMode = ResizeMode.NoResize;
navWin.Content = standardPage;
navWin.ShowsNavigationUI = false;
navWin.Title = "主标定";
@ -368,7 +382,9 @@ namespace WpfApp
navWin.ShowDialog();
}
#endregion
#region
/// <summary>
/// 按钮点击触发关闭页面
/// </summary>
@ -391,5 +407,6 @@ namespace WpfApp
//LineBarChartDemo lineBarChartDemo = new LineBarChartDemo();
//lineBarChartDemo.Show();
}
#endregion
}
}