|
|
|
@ -0,0 +1,91 @@ |
|
|
|
|
using LiveCharts; |
|
|
|
|
using LiveCharts.Defaults; |
|
|
|
|
using LiveCharts.Wpf; |
|
|
|
|
using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Text; |
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
using System.Windows; |
|
|
|
|
using System.Windows.Controls; |
|
|
|
|
using System.Windows.Data; |
|
|
|
|
using System.Windows.Documents; |
|
|
|
|
using System.Windows.Input; |
|
|
|
|
using System.Windows.Media; |
|
|
|
|
using System.Windows.Media.Imaging; |
|
|
|
|
using System.Windows.Shapes; |
|
|
|
|
|
|
|
|
|
namespace Tutorial.BasicPlots |
|
|
|
|
{ |
|
|
|
|
/// <summary> |
|
|
|
|
/// BubbleWindow.xaml에 대한 상호 작용 논리 |
|
|
|
|
/// </summary> |
|
|
|
|
public partial class BubbleWindow : Window |
|
|
|
|
{ |
|
|
|
|
public SeriesCollection SeriesCollection { get; set; } |
|
|
|
|
|
|
|
|
|
public BubbleWindow() |
|
|
|
|
{ |
|
|
|
|
InitializeComponent(); |
|
|
|
|
InitInstance(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void InitInstance() |
|
|
|
|
{ |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void btnUpdate_Click(object sender, RoutedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
Random rand = new Random(); |
|
|
|
|
foreach (var series in SeriesCollection.Cast<ScatterSeries>()) |
|
|
|
|
{ |
|
|
|
|
foreach (var bubble in series.Values.Cast<ScatterPoint>()) |
|
|
|
|
{ |
|
|
|
|
bubble.X = rand.NextDouble() * 10; |
|
|
|
|
bubble.Y = rand.NextDouble() * 10; |
|
|
|
|
bubble.Weight = rand.NextDouble() * 10; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
foreach (var series in SeriesCollection.Cast<ScatterSeries>()) |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < 10; i++) |
|
|
|
|
{ |
|
|
|
|
series.Values.Add(new ScatterPoint(rand.NextDouble() * 10, rand.NextDouble() * 10, rand.NextDouble() * 10)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |