This commit is contained in:
sc committed 2024-10-03 22:15:58 +08:00
commit 18196f8619
8 files changed
+343 -16

No files matched your search

+8 -4
View File
@@ -2,11 +2,15 @@
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:DyeingComputer.View"
mc:Ignorable="d"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
xmlns:viewmodel="clr-namespace:DyeingComputer.ViewModel"
d:DataContext="{d:DesignInstance Type=viewmodel:CurveDiagramViewModel}"
mc:Ignorable="d" Loaded="UserControl_Loaded"
d:DesignHeight="630" d:DesignWidth="1280" VerticalAlignment="Top">
<Grid>
<DataGrid HorizontalAlignment="Left" Height="152" Margin="69,315,0,0" VerticalAlignment="Top" Width="282" d:ItemsSource="{d:SampleData ItemCount=5}"/>
<lvc:PieChart x:Name="OscChart" Series="{Binding Series}">
</lvc:PieChart>
</Grid>
</UserControl>
+43 -1
View File
@@ -1,5 +1,9 @@
using System;
using DyeingComputer.ViewModel;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -12,6 +16,12 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using static DyeingComputer.UserClass.SqliteHelper;
using DyeingComputer.UserClass;
using LiveChartsCore.Kernel.Sketches;
using LiveChartsCore.Measure;
using ScottPlot.Plottables;
using System.Runtime.InteropServices;
namespace DyeingComputer.View
{
@@ -20,9 +30,41 @@ namespace DyeingComputer.View
/// </summary>
public partial class CurveDiagramView : UserControl
{
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
DataTable CDB = new DataTable();
public CurveDiagramView()
{
InitializeComponent();
DataContext = new CurveDiagramViewModel();
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
if (MainWindowViewModel.WorkNumder.ToString() != "----------")
{
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where DYELOT = '" + MainWindowViewModel.WorkNumder + "'", null).Tables[0];
SQLiteHelpers.Close();
}
OscChart.Series = new ISeries[] { new LineSeries<double>
{
Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
Fill = null
} };
}
}
}