mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-23 02:06:35 +08:00
项目结构调整
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<Page
|
||||
x:Class="UWP.CartesianChart.ScatterPlot.ScatterExample"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:UWP.CartesianChart.ScatterPlot"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:lvc="using:LiveCharts.Uwp"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Button Grid.Row="0" Margin="10" Click="RandomizeOnClick">Randomize</Button>
|
||||
<lvc:CartesianChart Grid.Row="1" LegendLocation="Bottom">
|
||||
<lvc:CartesianChart.Series>
|
||||
<lvc:ScatterSeries Title="Series A" Values="{Binding ValuesA}" />
|
||||
<lvc:ScatterSeries Title="Series B" Values="{Binding ValuesB}">
|
||||
<lvc:ScatterSeries.PointGeometry>
|
||||
<lvc:PointGeometry Data="M 1,0 L 2,1 1,2 0,1 z"/>
|
||||
</lvc:ScatterSeries.PointGeometry>
|
||||
</lvc:ScatterSeries>
|
||||
<lvc:ScatterSeries Title="Series C" Values="{Binding ValuesC}"
|
||||
StrokeThickness="2" Fill="Transparent">
|
||||
<lvc:ScatterSeries.PointGeometry>
|
||||
<lvc:PointGeometry Data="M 0,1 l 1,1 h -2 Z"/>
|
||||
</lvc:ScatterSeries.PointGeometry>
|
||||
</lvc:ScatterSeries>
|
||||
</lvc:CartesianChart.Series>
|
||||
</lvc:CartesianChart>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,53 @@
|
||||
using LiveCharts;
|
||||
using LiveCharts.Defaults;
|
||||
using System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace UWP.CartesianChart.ScatterPlot
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class ScatterExample : Page
|
||||
{
|
||||
public ScatterExample()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var r = new Random();
|
||||
ValuesA = new ChartValues<ObservablePoint>();
|
||||
ValuesB = new ChartValues<ObservablePoint>();
|
||||
ValuesC = new ChartValues<ObservablePoint>();
|
||||
|
||||
for (var i = 0; i < 20; i++)
|
||||
{
|
||||
ValuesA.Add(new ObservablePoint(r.NextDouble() * 10, r.NextDouble() * 10));
|
||||
ValuesB.Add(new ObservablePoint(r.NextDouble() * 10, r.NextDouble() * 10));
|
||||
ValuesC.Add(new ObservablePoint(r.NextDouble() * 10, r.NextDouble() * 10));
|
||||
}
|
||||
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
public ChartValues<ObservablePoint> ValuesA { get; set; }
|
||||
public ChartValues<ObservablePoint> ValuesB { get; set; }
|
||||
public ChartValues<ObservablePoint> ValuesC { get; set; }
|
||||
|
||||
private void RandomizeOnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var r = new Random();
|
||||
for (var i = 0; i < 20; i++)
|
||||
{
|
||||
ValuesA[i].X = r.NextDouble() * 10;
|
||||
ValuesA[i].Y = r.NextDouble() * 10;
|
||||
ValuesB[i].X = r.NextDouble() * 10;
|
||||
ValuesB[i].Y = r.NextDouble() * 10;
|
||||
ValuesC[i].X = r.NextDouble() * 10;
|
||||
ValuesC[i].Y = r.NextDouble() * 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user