mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-06 17:26:35 +08:00
项目结构调整
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<UserControl x:Class="Wpf.CartesianChart.Customized_Line_Series.CustomizedLineSeries"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
|
||||
xmlns:customizedLineSeries="clr-namespace:Wpf.CartesianChart.Customized_Line_Series"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance customizedLineSeries:CustomizedLineSeries }">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Button Grid.Row="0" Margin="20" Click="MoveOnClick">Move</Button>
|
||||
<lvc:CartesianChart Grid.Row="2" Background="#222E31">
|
||||
<lvc:CartesianChart.Series>
|
||||
<lvc:LineSeries Values="{Binding Values1}" StrokeThickness="4" StrokeDashArray="2"
|
||||
Stroke="#6BBA45" Fill="Transparent" LineSmoothness="0" PointGeometrySize="20"
|
||||
PointGeometry="{x:Static lvc:DefaultGeometries.Diamond}"
|
||||
PointForeground="#6BBA45"/>
|
||||
<lvc:LineSeries Values="{Binding Values2}" StrokeThickness="2"
|
||||
Stroke="#1C8FC5" Fill="Transparent" LineSmoothness="1"
|
||||
PointGeometrySize="15" PointForeground="#222E31"/>
|
||||
</lvc:CartesianChart.Series>
|
||||
<lvc:CartesianChart.VisualElements>
|
||||
<lvc:VisualElement X="0.5" Y="8">
|
||||
<lvc:VisualElement.UIElement>
|
||||
<TextBlock Foreground="White">
|
||||
Hello!, this is a note merged in the chart.
|
||||
</TextBlock>
|
||||
</lvc:VisualElement.UIElement>
|
||||
</lvc:VisualElement>
|
||||
</lvc:CartesianChart.VisualElements>
|
||||
<lvc:CartesianChart.AxisX>
|
||||
<lvc:Axis IsMerged="True">
|
||||
<lvc:Axis.Separator>
|
||||
<lvc:Separator StrokeThickness="1" StrokeDashArray="2">
|
||||
<lvc:Separator.Stroke>
|
||||
<SolidColorBrush Color="#404F56" />
|
||||
</lvc:Separator.Stroke>
|
||||
</lvc:Separator>
|
||||
</lvc:Axis.Separator>
|
||||
</lvc:Axis>
|
||||
</lvc:CartesianChart.AxisX>
|
||||
<lvc:CartesianChart.AxisY>
|
||||
<lvc:Axis IsMerged="True">
|
||||
<lvc:Axis.Separator>
|
||||
<lvc:Separator StrokeThickness="1.5" StrokeDashArray="4">
|
||||
<lvc:Separator.Stroke>
|
||||
<SolidColorBrush Color="#404F56" />
|
||||
</lvc:Separator.Stroke>
|
||||
</lvc:Separator>
|
||||
</lvc:Axis.Separator>
|
||||
</lvc:Axis>
|
||||
</lvc:CartesianChart.AxisY>
|
||||
</lvc:CartesianChart>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using LiveCharts;
|
||||
using LiveCharts.Defaults;
|
||||
using LiveCharts.Wpf;
|
||||
|
||||
namespace Wpf.CartesianChart.Customized_Line_Series
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for CustomizedExample.xaml
|
||||
/// </summary>
|
||||
public partial class CustomizedLineSeries
|
||||
{
|
||||
public CustomizedLineSeries()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Values1 = new ChartValues<ObservableValue>
|
||||
{
|
||||
new ObservableValue(3),
|
||||
new ObservableValue(4),
|
||||
new ObservableValue(6),
|
||||
new ObservableValue(3),
|
||||
new ObservableValue(2),
|
||||
new ObservableValue(6)
|
||||
};
|
||||
Values2 = new ChartValues<ObservableValue>
|
||||
{
|
||||
new ObservableValue(5),
|
||||
new ObservableValue(3),
|
||||
new ObservableValue(5),
|
||||
new ObservableValue(7),
|
||||
new ObservableValue(3),
|
||||
new ObservableValue(9)
|
||||
};
|
||||
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
public ChartValues<ObservableValue> Values1 { get; set; }
|
||||
public ChartValues<ObservableValue> Values2 { get; set; }
|
||||
|
||||
private void MoveOnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var r = new Random();
|
||||
|
||||
foreach (var value in Values1)
|
||||
{
|
||||
value.Value = r.Next(0, 10);
|
||||
}
|
||||
foreach (var value in Values2)
|
||||
{
|
||||
value.Value = r.Next(0, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user