mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-08 18:26:35 +08:00
项目结构调整
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<Page
|
||||
x:Class="UWP.CartesianChart.Bubbles.BubblesExample"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:UWP.CartesianChart.Bubbles"
|
||||
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" Height="30" Click="UpdateAllOnClick" HorizontalAlignment="Stretch">
|
||||
Move All
|
||||
</Button>
|
||||
<lvc:CartesianChart Grid.Row="1" Series="{Binding SeriesCollection}"/>
|
||||
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,71 @@
|
||||
using LiveCharts;
|
||||
using LiveCharts.Defaults;
|
||||
using LiveCharts.Uwp;
|
||||
using System;
|
||||
using System.Linq;
|
||||
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.Bubbles
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class BubblesExample : Page
|
||||
{
|
||||
public BubblesExample()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
SeriesCollection = new SeriesCollection
|
||||
{
|
||||
new ScatterSeries
|
||||
{
|
||||
Values = new ChartValues<ScatterPoint>
|
||||
{
|
||||
new ScatterPoint(5, 5, 20),
|
||||
new ScatterPoint(3, 4, 80),
|
||||
new ScatterPoint(7, 2, 20),
|
||||
new ScatterPoint(2, 6, 60),
|
||||
new ScatterPoint(8, 2, 70)
|
||||
},
|
||||
MinPointShapeDiameter = 15,
|
||||
MaxPointShapeDiameter = 45
|
||||
},
|
||||
new ScatterSeries
|
||||
{
|
||||
Values = new ChartValues<ScatterPoint>
|
||||
{
|
||||
new ScatterPoint(7, 5, 1),
|
||||
new ScatterPoint(2, 2, 1),
|
||||
new ScatterPoint(1, 1, 1),
|
||||
new ScatterPoint(6, 3, 1),
|
||||
new ScatterPoint(8, 8, 1)
|
||||
},
|
||||
PointGeometry = DefaultGeometries.Triangle,
|
||||
MinPointShapeDiameter = 15,
|
||||
MaxPointShapeDiameter = 45
|
||||
}
|
||||
};
|
||||
|
||||
DataContext = this;
|
||||
}
|
||||
public SeriesCollection SeriesCollection { get; set; }
|
||||
|
||||
private void UpdateAllOnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var r = new Random();
|
||||
foreach (var series in SeriesCollection)
|
||||
{
|
||||
foreach (var bubble in series.Values.Cast<ScatterPoint>())
|
||||
{
|
||||
bubble.X = r.NextDouble() * 10;
|
||||
bubble.Y = r.NextDouble() * 10;
|
||||
bubble.Weight = r.NextDouble() * 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user