From cdcae12502fe2e4a8714141f3c768c01da6b7c4f Mon Sep 17 00:00:00 2001 From: gekoukate <1670391937@qq.com> Date: Mon, 17 Apr 2023 19:53:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WpfApp1/App.config | 6 - WpfApp1/App.xaml | 9 -- WpfApp1/App.xaml.cs | 17 --- WpfApp1/MainWindow.xaml | 12 -- WpfApp1/MainWindow.xaml.cs | 28 ---- WpfApp1/Properties/AssemblyInfo.cs | 55 -------- WpfApp1/Properties/Resources.Designer.cs | 71 ---------- WpfApp1/Properties/Resources.resx | 117 ---------------- WpfApp1/Properties/Settings.Designer.cs | 30 ----- WpfApp1/Properties/Settings.settings | 7 - WpfApp1/WpfApp1.csproj | 102 -------------- mseedChart.MainModule/Models/WavesModel.cs | 51 ++++--- .../ViewModels/ChartPlotViewModel.cs | 126 ++++++++++-------- .../Views/ChartPlotView.xaml | 2 +- mseedChart.sln | 12 -- 15 files changed, 96 insertions(+), 549 deletions(-) delete mode 100644 WpfApp1/App.config delete mode 100644 WpfApp1/App.xaml delete mode 100644 WpfApp1/App.xaml.cs delete mode 100644 WpfApp1/MainWindow.xaml delete mode 100644 WpfApp1/MainWindow.xaml.cs delete mode 100644 WpfApp1/Properties/AssemblyInfo.cs delete mode 100644 WpfApp1/Properties/Resources.Designer.cs delete mode 100644 WpfApp1/Properties/Resources.resx delete mode 100644 WpfApp1/Properties/Settings.Designer.cs delete mode 100644 WpfApp1/Properties/Settings.settings delete mode 100644 WpfApp1/WpfApp1.csproj diff --git a/WpfApp1/App.config b/WpfApp1/App.config deleted file mode 100644 index 016d28f..0000000 --- a/WpfApp1/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/WpfApp1/App.xaml b/WpfApp1/App.xaml deleted file mode 100644 index 2e70522..0000000 --- a/WpfApp1/App.xaml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/WpfApp1/App.xaml.cs b/WpfApp1/App.xaml.cs deleted file mode 100644 index d58ebfa..0000000 --- a/WpfApp1/App.xaml.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; - -namespace WpfApp1 -{ - /// - /// App.xaml 的交互逻辑 - /// - public partial class App : Application - { - } -} diff --git a/WpfApp1/MainWindow.xaml b/WpfApp1/MainWindow.xaml deleted file mode 100644 index 1534e78..0000000 --- a/WpfApp1/MainWindow.xaml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - diff --git a/WpfApp1/MainWindow.xaml.cs b/WpfApp1/MainWindow.xaml.cs deleted file mode 100644 index 4a4aa8c..0000000 --- a/WpfApp1/MainWindow.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -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.Navigation; -using System.Windows.Shapes; - -namespace WpfApp1 -{ - /// - /// MainWindow.xaml 的交互逻辑 - /// - public partial class MainWindow : Window - { - public MainWindow() - { - InitializeComponent(); - } - } -} diff --git a/WpfApp1/Properties/AssemblyInfo.cs b/WpfApp1/Properties/AssemblyInfo.cs deleted file mode 100644 index 9fa2f3e..0000000 --- a/WpfApp1/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// 有关程序集的一般信息由以下 -// 控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("WpfApp1")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("WpfApp1")] -[assembly: AssemblyCopyright("Copyright © 2023")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 会使此程序集中的类型 -//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 -//请将此类型的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -//若要开始生成可本地化的应用程序,请设置 -//.csproj 文件中的 CultureYouAreCodingWith -//例如,如果您在源文件中使用的是美国英语, -//使用的是美国英语,请将 设置为 en-US。 然后取消 -//对以下 NeutralResourceLanguage 特性的注释。 更新 -//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //主题特定资源词典所处位置 - //(未在页面中找到资源时使用, - //或应用程序资源字典中找到时使用) - ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 - //(未在页面中找到资源时使用, - //、应用程序或任何主题专用资源字典中找到时使用) -)] - - -// 程序集的版本信息由下列四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 -//通过使用 "*",如下所示: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/WpfApp1/Properties/Resources.Designer.cs b/WpfApp1/Properties/Resources.Designer.cs deleted file mode 100644 index 3abd32b..0000000 --- a/WpfApp1/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本: 4.0.30319.42000 -// -// 对此文件的更改可能导致不正确的行为,如果 -// 重新生成代码,则所做更改将丢失。 -// -//------------------------------------------------------------------------------ - -namespace WpfApp1.Properties -{ - - - /// - /// 强类型资源类,用于查找本地化字符串等。 - /// - // 此类是由 StronglyTypedResourceBuilder - // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen - // (以 /str 作为命令选项),或重新生成 VS 项目。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// 返回此类使用的缓存 ResourceManager 实例。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfApp1.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// 重写当前线程的 CurrentUICulture 属性,对 - /// 使用此强类型资源类的所有资源查找执行重写。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/WpfApp1/Properties/Resources.resx b/WpfApp1/Properties/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/WpfApp1/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/WpfApp1/Properties/Settings.Designer.cs b/WpfApp1/Properties/Settings.Designer.cs deleted file mode 100644 index 6512fd0..0000000 --- a/WpfApp1/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace WpfApp1.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/WpfApp1/Properties/Settings.settings b/WpfApp1/Properties/Settings.settings deleted file mode 100644 index 033d7a5..0000000 --- a/WpfApp1/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/WpfApp1/WpfApp1.csproj b/WpfApp1/WpfApp1.csproj deleted file mode 100644 index 94ed4bc..0000000 --- a/WpfApp1/WpfApp1.csproj +++ /dev/null @@ -1,102 +0,0 @@ - - - - - Debug - AnyCPU - {92B5468F-C7FF-4295-A8D1-BE9B117C2287} - WinExe - WpfApp1 - WpfApp1 - v4.7 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\Toolbox\Wpf\Arction.Wpf.Charting.LightningChart.dll - - - - - - - - - - - 4.0 - - - - - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - MainWindow.xaml - Code - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - \ No newline at end of file diff --git a/mseedChart.MainModule/Models/WavesModel.cs b/mseedChart.MainModule/Models/WavesModel.cs index 9232ac1..6a1a805 100644 --- a/mseedChart.MainModule/Models/WavesModel.cs +++ b/mseedChart.MainModule/Models/WavesModel.cs @@ -19,35 +19,38 @@ namespace mseedChart.MainModule.Models { public List CreateYAxisChart(List stationModels, LightningChart curChart) { - List axisYList = new List(); + List axisYList = new List(); foreach (var item in stationModels) { - AxisY axisYZ = new AxisY(curChart.ViewXY); + int distancetoX= -(int)curChart.ActualWidth + 80; + AxisY axisY = new AxisY(curChart.ViewXY); //添加Z分量波形 if (item.dz.Count > 0) { - axisYZ.SetRange(item.dz.Min(), item.dz.Max()); + axisY.SetRange(item.dz.Min(), item.dz.Max()); } - axisYZ.Title.Text = string.Format("Ch{0}.Z", item.Name); - axisYList.Add(axisYZ); - + axisY.Title.Text = string.Format("Ch{0}.Z", item.Name); + axisY.Title.DistanceToAxis = distancetoX; + axisYList.Add(axisY); //添加N分量波形 - AxisY axisYN = new AxisY(curChart.ViewXY); + axisY = new AxisY(curChart.ViewXY); if (item.dn.Count > 0) { - axisYN.SetRange(item.dn.Min(), item.dn.Max()); + axisY.SetRange(item.dn.Min(), item.dn.Max()); } - axisYN.Title.Text = string.Format("Ch{0}.N", item.Name); - axisYList.Add(axisYN); + axisY.Title.Text = string.Format("Ch{0}.N", item.Name); + axisY.Title.DistanceToAxis = distancetoX; + axisYList.Add(axisY); //添加E分量波形 - AxisY axisYE = new AxisY(curChart.ViewXY); + axisY = new AxisY(curChart.ViewXY); if (item.de.Count > 0) { - axisYE.SetRange(item.de.Min(), item.de.Max()); + axisY.SetRange(item.de.Min(), item.de.Max()); } - axisYE.Title.Text = string.Format("Ch{0}.E", item.Name); - axisYList.Add(axisYE); + axisY.Title.Text = string.Format("Ch{0}.E", item.Name); + axisY.Title.DistanceToAxis = distancetoX; + axisYList.Add(axisY); } return axisYList; @@ -76,16 +79,14 @@ namespace mseedChart.MainModule.Models lineCollection.LineStyle.Color = System.Windows.Media.Colors.Red; lineCollection.Title.Text = chartV.YAxes[assignYAxisIndex].Title.Text + ph.atime.ToString(); lineCollection.Title.Visible = true; - lineCollection.Title.Font.Size = 8; + lineCollection.Title.Font.Size = 10; lineCollection.Title.Shadow.DropColor = System.Windows.Media.Colors.Transparent; - lineCollection.Title.Shadow.ContrastColor = System.Windows.Media.Colors.Transparent; + //lineCollection.Title.Shadow.ContrastColor = System.Windows.Media.Colors.Transparent; lineCollection.Title.AutoPlacement = false; lineCollection.Title.HorizontalAlign = AlignmentHorizontal.Left; - var b= (ph.atime- stationModels.First().BeginTime).TotalSeconds*100; - lineCollection.Title.Offset.SetValues((int)b, 0); - lineCollection.Title.Color = System.Windows.Media.Colors.Red; - - lineCollection.Title.AutoPlacement = false; + var b = chartV.XAxes[0].ValueToCoordD(chartV.XAxes[0].DateTimeToAxisValue(ph.atime))-80; + lineCollection.Title.Offset.SetValues((int)b, 3); + lineCollection.Title.Color = System.Windows.Media.Colors.Red; chartV.LineCollections.Add(lineCollection); } @@ -111,14 +112,12 @@ namespace mseedChart.MainModule.Models lineCollection.Title.Visible = true; lineCollection.Title.Font.Size = 10; lineCollection.Title.Shadow.DropColor = System.Windows.Media.Colors.Transparent; - lineCollection.Title.Shadow.ContrastColor = System.Windows.Media.Colors.Transparent; + // lineCollection.Title.Shadow.ContrastColor = System.Windows.Media.Colors.Transparent; lineCollection.Title.AutoPlacement = false; lineCollection.Title.HorizontalAlign = AlignmentHorizontal.Left; - - var b= chartV.XAxes[0].ValueToCoordD(chartV.XAxes[0].DateTimeToAxisValue(am.atime)); - lineCollection.Title.Offset = new PointIntXY((int)b, 0); + var b= chartV.XAxes[0].ValueToCoordD(chartV.XAxes[0].DateTimeToAxisValue(am.atime))-80; + lineCollection.Title.Offset.SetValues((int)b,3); lineCollection.Title.Color = System.Windows.Media.Colors.Red; - // lineCollection.Title.AllowDragging = false; chartV.LineCollections.Add(lineCollection); } return new List(); diff --git a/mseedChart.MainModule/ViewModels/ChartPlotViewModel.cs b/mseedChart.MainModule/ViewModels/ChartPlotViewModel.cs index cc8bb9c..c09fd85 100644 --- a/mseedChart.MainModule/ViewModels/ChartPlotViewModel.cs +++ b/mseedChart.MainModule/ViewModels/ChartPlotViewModel.cs @@ -187,6 +187,8 @@ namespace mseedChart.MainModule.ViewModels string asciiSavePath = openFileDialog.FileName.Replace("Mseed", "Txt"); asciiSavePath = Path.ChangeExtension(asciiSavePath, ".txt"); string JsonPath = Path.ChangeExtension(openFileDialog.FileName, "Json"); + Stopwatch st = new Stopwatch(); + st.Start(); //读取.json文件 CurrentEventTime = _wavesModel.ReadChartJsonFile(JsonPath); //读取.mseed文件 @@ -195,7 +197,9 @@ namespace mseedChart.MainModule.ViewModels CurrentTime = smList.First().BeginTime.ToShortDateString(); StationsName = smList.Select(a => new StationAxis{Name= a.Name,IsChecked=true,SelectCommand =new DelegateCommand(StationsNameVisible)}).ToList(); StartChart(); - FeedDatasToChart(); + st.Stop(); + Debug.WriteLine("统计时间StartChart************:{0}", st.Elapsed); + FeedDatasToChart(); } } @@ -429,9 +433,12 @@ namespace mseedChart.MainModule.ViewModels { DisposeAllAndClear(_chartAxisY); ViewXY v = LChartALL.ViewXY; + LChartALL.SizeChanged -= LChartALL_SizeChanged; + LChartALL.SizeChanged += LChartALL_SizeChanged; DisposeAllAndClear(v.YAxes); DisposeAllAndClear(v.SampleDataSeries); DisposeAllAndClear(v.LineCollections); + v.Margins=new Thickness(80, 30, 50, 60); v.YAxes.AddRange(_wavesModel.CreateYAxisChart(smList.ToList(), LChartALL)); v.LegendBoxes[0].Position = LegendBoxPositionXY.RightCenter; @@ -460,67 +467,74 @@ namespace mseedChart.MainModule.ViewModels double firstSampleTimeStamp = v.XAxes[0].DateTimeToAxisValue(beginTime); int count = stationModel.Dzne.Count; - int number= smList.Count; + int number= smList.Count*3; + for (int i = 0; i < number; i++) { - for (int k = 0; k 打开 - + diff --git a/mseedChart.sln b/mseedChart.sln index 55ed91c..06b1f5d 100644 --- a/mseedChart.sln +++ b/mseedChart.sln @@ -5,12 +5,8 @@ VisualStudioVersion = 17.3.32922.545 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mseedChart", "mseedChart\mseedChart.csproj", "{7A0008BD-0B8D-41AE-AB09-36DCDA7FAF93}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mseedChart.Main", "mseedChart.Main\mseedChart.Main.csproj", "{3F7895B1-A41A-4245-B54E-FE65440E070B}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mseedChart.Core", "mseedChart.Core\mseedChart.Core.csproj", "{4A973AC0-90A5-4652-8F8F-AB6DCA59D906}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApp1", "WpfApp1\WpfApp1.csproj", "{92B5468F-C7FF-4295-A8D1-BE9B117C2287}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mseedChart.MainModule", "mseedChart.MainModule\mseedChart.MainModule.csproj", "{6B5392C6-3D2D-4890-A0BF-F5F9F84CD867}" EndProject Global @@ -23,18 +19,10 @@ Global {7A0008BD-0B8D-41AE-AB09-36DCDA7FAF93}.Debug|Any CPU.Build.0 = Debug|Any CPU {7A0008BD-0B8D-41AE-AB09-36DCDA7FAF93}.Release|Any CPU.ActiveCfg = Release|Any CPU {7A0008BD-0B8D-41AE-AB09-36DCDA7FAF93}.Release|Any CPU.Build.0 = Release|Any CPU - {3F7895B1-A41A-4245-B54E-FE65440E070B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3F7895B1-A41A-4245-B54E-FE65440E070B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3F7895B1-A41A-4245-B54E-FE65440E070B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3F7895B1-A41A-4245-B54E-FE65440E070B}.Release|Any CPU.Build.0 = Release|Any CPU {4A973AC0-90A5-4652-8F8F-AB6DCA59D906}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4A973AC0-90A5-4652-8F8F-AB6DCA59D906}.Debug|Any CPU.Build.0 = Debug|Any CPU {4A973AC0-90A5-4652-8F8F-AB6DCA59D906}.Release|Any CPU.ActiveCfg = Release|Any CPU {4A973AC0-90A5-4652-8F8F-AB6DCA59D906}.Release|Any CPU.Build.0 = Release|Any CPU - {92B5468F-C7FF-4295-A8D1-BE9B117C2287}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {92B5468F-C7FF-4295-A8D1-BE9B117C2287}.Debug|Any CPU.Build.0 = Debug|Any CPU - {92B5468F-C7FF-4295-A8D1-BE9B117C2287}.Release|Any CPU.ActiveCfg = Release|Any CPU - {92B5468F-C7FF-4295-A8D1-BE9B117C2287}.Release|Any CPU.Build.0 = Release|Any CPU {6B5392C6-3D2D-4890-A0BF-F5F9F84CD867}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6B5392C6-3D2D-4890-A0BF-F5F9F84CD867}.Debug|Any CPU.Build.0 = Debug|Any CPU {6B5392C6-3D2D-4890-A0BF-F5F9F84CD867}.Release|Any CPU.ActiveCfg = Release|Any CPU