项目结构调整

This commit is contained in:
艾竹
2023-04-16 20:11:40 +08:00
parent cbfbf96033
commit 81f91f3f35
2124 changed files with 218 additions and 5516 deletions

View File

@@ -0,0 +1,21 @@
<UserControl x:Class="Wpf.CartesianChart.Bubbles.BubblesExample"
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:local="clr-namespace:Wpf.CartesianChart"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Button Grid.Row="0" Click="UpdateAllOnClick">
Move All
</Button>
<lvc:CartesianChart Grid.Row="1" Series="{Binding SeriesCollection}">
</lvc:CartesianChart>
</Grid>
</UserControl>

View File

@@ -0,0 +1,66 @@
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using LiveCharts;
using LiveCharts.Defaults;
using LiveCharts.Wpf;
namespace Wpf.CartesianChart.Bubbles
{
public partial class BubblesExample : UserControl
{
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;
}
}
}
}
}