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.

36 lines
1.7 KiB

2 years ago
<Window x:Class="ChartSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:local="clr-namespace:ChartSample"
xmlns:live="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<!--Code-->
<live:CartesianChart x:Name="chart" Grid.Row="0"
BorderBrush="Red" BorderThickness="2" LegendLocation="Top" Margin="15"/>
<!--Xaml-->
<live:CartesianChart x:Name="xamlChart" Grid.Row="1"
BorderBrush="Red" BorderThickness="2" LegendLocation="Top" Margin="15">
<live:CartesianChart.AxisY>
<live:Axis MinValue="0" MaxValue="1000"/>
</live:CartesianChart.AxisY>
<live:CartesianChart.AxisX>
<live:Axis Labels="1, 2, 3, 4, 5, 6, 7, 8, 9, 10"/>
</live:CartesianChart.AxisX>
<live:CartesianChart.Series>
<live:LineSeries Stroke="Green" Title="Sample1" Values="100, 20, 45, 45, 12, 33, 56, 45, 83, 88"/>
<live:LineSeries Stroke="Red" Title="Sample2" Values="33, 34, 443, 725, 162, 233, 46, 375, 93, 128"/>
</live:CartesianChart.Series>
</live:CartesianChart>
</Grid>
</Window>