Add graph service
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="170"/>
|
||||
<RowDefinition Height="100"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ListView Name="FunctionList"
|
||||
@@ -120,7 +121,10 @@
|
||||
</ContextMenu>
|
||||
</ListView.ContextMenu>
|
||||
</ListView>
|
||||
<Grid Grid.Row="1" Grid.Column="0">
|
||||
<ContentControl Grid.Row="1"
|
||||
ContentTemplate="{StaticResource ResourceKey=LineVisualProperties}"
|
||||
Content="{Binding VisualProps}"/>
|
||||
<Grid Grid.Row="2" Grid.Column="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
@@ -153,7 +157,7 @@
|
||||
Command="{Binding TreeCommand}"
|
||||
Background="AntiqueWhite"/>
|
||||
</Grid>
|
||||
<lvc:CartesianChart Grid.Row="0" Grid.Column="1"
|
||||
<lvc:CartesianChart Grid.Row="0" Grid.Column="1" Grid.RowSpan="2"
|
||||
Series="{Binding SeriesCollection, UpdateSourceTrigger=PropertyChanged}" Margin="5"
|
||||
Zoom="Xy">
|
||||
<lvc:CartesianChart.AxisY>
|
||||
@@ -163,7 +167,7 @@
|
||||
<lvc:Axis Title="X" Labels="{Binding Labels, UpdateSourceTrigger=PropertyChanged}"></lvc:Axis>
|
||||
</lvc:CartesianChart.AxisX>
|
||||
</lvc:CartesianChart>
|
||||
<Grid Grid.Row="1" Grid.Column="1">
|
||||
<Grid Grid.Row="2" Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="70"/>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using LiveCharts;
|
||||
using LiveCharts.Wpf;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.Graphs;
|
||||
using StructureHelper.Windows.TreeGraph;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
@@ -17,15 +18,26 @@ namespace StructureHelper.Windows.MainGraph
|
||||
{
|
||||
public class GraphViewModel : ViewModelBase
|
||||
{
|
||||
private LineSeries lineSeries;
|
||||
private SeriesCollection seriesCollection;
|
||||
private List<string> labels;
|
||||
private GraphVisualProps visualProps = new();
|
||||
public LineSeries LineSeries
|
||||
{
|
||||
get => lineSeries;
|
||||
set
|
||||
{
|
||||
lineSeries = value;
|
||||
OnPropertyChanged(nameof(lineSeries));
|
||||
}
|
||||
}
|
||||
public SeriesCollection SeriesCollection
|
||||
{
|
||||
get => seriesCollection;
|
||||
set
|
||||
{
|
||||
seriesCollection = value;
|
||||
OnPropertyChanged(nameof(seriesCollection));
|
||||
OnPropertyChanged(nameof(SeriesCollection));
|
||||
}
|
||||
}
|
||||
public List<string> Labels
|
||||
@@ -37,6 +49,15 @@ namespace StructureHelper.Windows.MainGraph
|
||||
OnPropertyChanged(nameof(labels));
|
||||
}
|
||||
}
|
||||
public GraphVisualProps VisualProps
|
||||
{
|
||||
get => visualProps;
|
||||
set
|
||||
{
|
||||
visualProps = value;
|
||||
DrawGraph();
|
||||
}
|
||||
}
|
||||
private IOneVariableFunction selectedFunction;
|
||||
public IOneVariableFunction SelectedFuntion
|
||||
{
|
||||
@@ -219,7 +240,10 @@ namespace StructureHelper.Windows.MainGraph
|
||||
{
|
||||
var graphSettings = SelectedFuntion.GetGraphSettings();
|
||||
Labels = graphSettings.GetLabels();
|
||||
SeriesCollection = graphSettings.GetSeriesCollection();
|
||||
LineSeries = graphSettings.GetLineSeries();
|
||||
GraphService.SetVisualProps(LineSeries, VisualProps);
|
||||
SeriesCollection = new SeriesCollection();
|
||||
SeriesCollection.Add(LineSeries);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user