add oxyplot
This commit is contained in:
@ -2,14 +2,29 @@
|
||||
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:kMeansGui="clr-namespace:KMeansGui" x:Name="LayoutRoot"
|
||||
xmlns:kMeansGui="clr-namespace:KMeansGui"
|
||||
xmlns:avalonia="http://oxyplot.org/avalonia"
|
||||
x:Name="LayoutRoot"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="KMeansGui.ShellView"
|
||||
Title="KMeansGui">
|
||||
<Window.DataContext>
|
||||
<kMeansGui:ShellViewModel />
|
||||
</Window.DataContext>
|
||||
<Grid RowDefinitions="*,*" ColumnDefinitions="*,*">
|
||||
<Button Command="{Binding OpenCsvFileAsync}" CommandParameter="{Binding ElementName=LayoutRoot}" >Load CSV file</Button>
|
||||
</Grid>
|
||||
</Window>
|
||||
<Window.DataContext>
|
||||
<kMeansGui:ShellViewModel />
|
||||
</Window.DataContext>
|
||||
<Grid ColumnDefinitions="*,*">
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Spacing="10">
|
||||
<Button HorizontalAlignment="Stretch" Command="{Binding OpenCsvFileAsync}"
|
||||
CommandParameter="{Binding ElementName=LayoutRoot}">
|
||||
Load CSV file
|
||||
</Button>
|
||||
<TextBox UseFloatingWatermark="True" Watermark="Hello" Text="{Binding CountOfCentroids}"></TextBox>
|
||||
</StackPanel>
|
||||
<avalonia:Plot Height="150" Grid.Column="1"
|
||||
PlotMargins="50 0 0 0"
|
||||
PlotAreaBorderColor="#999999">
|
||||
<avalonia:Plot.Series>
|
||||
<avalonia:ScatterSeries Items="{Binding Points}" />
|
||||
</avalonia:Plot.Series>
|
||||
</avalonia:Plot>
|
||||
</Grid>
|
||||
</Window>
|
@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using MvvmGen;
|
||||
|
||||
@ -7,13 +8,21 @@ namespace KMeansGui
|
||||
[ViewModel]
|
||||
public partial class ShellViewModel
|
||||
{
|
||||
|
||||
[Property] private int _countOfCentroids;
|
||||
[Property] private List<KMeansBase.Point> _points;
|
||||
|
||||
public async Task OpenCsvFileAsync(object parent)
|
||||
{
|
||||
if (parent is Window window)
|
||||
{
|
||||
var fileDialogFilter = new FileDialogFilter();
|
||||
fileDialogFilter.Extensions.Add("csv");
|
||||
fileDialogFilter.Name = "comma separated file";
|
||||
var fileDialog = new OpenFileDialog();
|
||||
fileDialog.AllowMultiple = false;
|
||||
|
||||
fileDialog.Filters.Add(fileDialogFilter);
|
||||
fileDialog.Title = "Select a csv file.";
|
||||
var result = await fileDialog.ShowAsync(window);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user