修改bug

master
gekoukate 1 year ago
parent d958cc372a
commit cdcae12502

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7" />
</startup>
</configuration>

@ -1,9 +0,0 @@
<Application x:Class="WpfApp1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApp1"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

@ -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
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
}
}

@ -1,12 +0,0 @@
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
</Grid>
</Window>

@ -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
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

@ -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 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
//例如,如果您在源文件中使用的是美国英语,
//使用的是美国英语,请将 <UICulture> 设置为 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")]

@ -1,71 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace WpfApp1.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 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()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[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;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -1,30 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
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;
}
}
}
}

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

@ -1,102 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{92B5468F-C7FF-4295-A8D1-BE9B117C2287}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>WpfApp1</RootNamespace>
<AssemblyName>WpfApp1</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Arction.Wpf.Charting.LightningChart, Version=10.4.1.4001, Culture=neutral, PublicKeyToken=6484d7bb14b95dd3, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\Toolbox\Wpf\Arction.Wpf.Charting.LightningChart.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -19,35 +19,38 @@ namespace mseedChart.MainModule.Models
{ {
public List<AxisY> CreateYAxisChart(List<StationModel> stationModels, LightningChart curChart) public List<AxisY> CreateYAxisChart(List<StationModel> stationModels, LightningChart curChart)
{ {
List<AxisY> axisYList = new List<AxisY>(); List<AxisY> axisYList = new List<AxisY>();
foreach (var item in stationModels) foreach (var item in stationModels)
{ {
AxisY axisYZ = new AxisY(curChart.ViewXY); int distancetoX= -(int)curChart.ActualWidth + 80;
AxisY axisY = new AxisY(curChart.ViewXY);
//添加Z分量波形 //添加Z分量波形
if (item.dz.Count > 0) 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); axisY.Title.Text = string.Format("Ch{0}.Z", item.Name);
axisYList.Add(axisYZ); axisY.Title.DistanceToAxis = distancetoX;
axisYList.Add(axisY);
//添加N分量波形 //添加N分量波形
AxisY axisYN = new AxisY(curChart.ViewXY); axisY = new AxisY(curChart.ViewXY);
if (item.dn.Count > 0) 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); axisY.Title.Text = string.Format("Ch{0}.N", item.Name);
axisYList.Add(axisYN); axisY.Title.DistanceToAxis = distancetoX;
axisYList.Add(axisY);
//添加E分量波形 //添加E分量波形
AxisY axisYE = new AxisY(curChart.ViewXY); axisY = new AxisY(curChart.ViewXY);
if (item.de.Count > 0) 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); axisY.Title.Text = string.Format("Ch{0}.E", item.Name);
axisYList.Add(axisYE); axisY.Title.DistanceToAxis = distancetoX;
axisYList.Add(axisY);
} }
return axisYList; return axisYList;
@ -76,16 +79,14 @@ namespace mseedChart.MainModule.Models
lineCollection.LineStyle.Color = System.Windows.Media.Colors.Red; lineCollection.LineStyle.Color = System.Windows.Media.Colors.Red;
lineCollection.Title.Text = chartV.YAxes[assignYAxisIndex].Title.Text + ph.atime.ToString(); lineCollection.Title.Text = chartV.YAxes[assignYAxisIndex].Title.Text + ph.atime.ToString();
lineCollection.Title.Visible = true; 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.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.AutoPlacement = false;
lineCollection.Title.HorizontalAlign = AlignmentHorizontal.Left; lineCollection.Title.HorizontalAlign = AlignmentHorizontal.Left;
var b= (ph.atime- stationModels.First().BeginTime).TotalSeconds*100; var b = chartV.XAxes[0].ValueToCoordD(chartV.XAxes[0].DateTimeToAxisValue(ph.atime))-80;
lineCollection.Title.Offset.SetValues((int)b, 0); lineCollection.Title.Offset.SetValues((int)b, 3);
lineCollection.Title.Color = System.Windows.Media.Colors.Red; lineCollection.Title.Color = System.Windows.Media.Colors.Red;
lineCollection.Title.AutoPlacement = false;
chartV.LineCollections.Add(lineCollection); chartV.LineCollections.Add(lineCollection);
} }
@ -111,14 +112,12 @@ namespace mseedChart.MainModule.Models
lineCollection.Title.Visible = true; lineCollection.Title.Visible = true;
lineCollection.Title.Font.Size = 10; lineCollection.Title.Font.Size = 10;
lineCollection.Title.Shadow.DropColor = System.Windows.Media.Colors.Transparent; 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.AutoPlacement = false;
lineCollection.Title.HorizontalAlign = AlignmentHorizontal.Left; lineCollection.Title.HorizontalAlign = AlignmentHorizontal.Left;
var b= chartV.XAxes[0].ValueToCoordD(chartV.XAxes[0].DateTimeToAxisValue(am.atime))-80;
var b= chartV.XAxes[0].ValueToCoordD(chartV.XAxes[0].DateTimeToAxisValue(am.atime)); lineCollection.Title.Offset.SetValues((int)b,3);
lineCollection.Title.Offset = new PointIntXY((int)b, 0);
lineCollection.Title.Color = System.Windows.Media.Colors.Red; lineCollection.Title.Color = System.Windows.Media.Colors.Red;
// lineCollection.Title.AllowDragging = false;
chartV.LineCollections.Add(lineCollection); chartV.LineCollections.Add(lineCollection);
} }
return new List<AxisY>(); return new List<AxisY>();

@ -187,6 +187,8 @@ namespace mseedChart.MainModule.ViewModels
string asciiSavePath = openFileDialog.FileName.Replace("Mseed", "Txt"); string asciiSavePath = openFileDialog.FileName.Replace("Mseed", "Txt");
asciiSavePath = Path.ChangeExtension(asciiSavePath, ".txt"); asciiSavePath = Path.ChangeExtension(asciiSavePath, ".txt");
string JsonPath = Path.ChangeExtension(openFileDialog.FileName, "Json"); string JsonPath = Path.ChangeExtension(openFileDialog.FileName, "Json");
Stopwatch st = new Stopwatch();
st.Start();
//读取.json文件 //读取.json文件
CurrentEventTime = _wavesModel.ReadChartJsonFile(JsonPath); CurrentEventTime = _wavesModel.ReadChartJsonFile(JsonPath);
//读取.mseed文件 //读取.mseed文件
@ -195,7 +197,9 @@ namespace mseedChart.MainModule.ViewModels
CurrentTime = smList.First().BeginTime.ToShortDateString(); CurrentTime = smList.First().BeginTime.ToShortDateString();
StationsName = smList.Select(a => new StationAxis{Name= a.Name,IsChecked=true,SelectCommand =new DelegateCommand<object>(StationsNameVisible)}).ToList(); StationsName = smList.Select(a => new StationAxis{Name= a.Name,IsChecked=true,SelectCommand =new DelegateCommand<object>(StationsNameVisible)}).ToList();
StartChart(); StartChart();
FeedDatasToChart(); st.Stop();
Debug.WriteLine("统计时间StartChart************{0}", st.Elapsed);
FeedDatasToChart();
} }
} }
@ -429,9 +433,12 @@ namespace mseedChart.MainModule.ViewModels
{ {
DisposeAllAndClear(_chartAxisY); DisposeAllAndClear(_chartAxisY);
ViewXY v = LChartALL.ViewXY; ViewXY v = LChartALL.ViewXY;
LChartALL.SizeChanged -= LChartALL_SizeChanged;
LChartALL.SizeChanged += LChartALL_SizeChanged;
DisposeAllAndClear(v.YAxes); DisposeAllAndClear(v.YAxes);
DisposeAllAndClear(v.SampleDataSeries); DisposeAllAndClear(v.SampleDataSeries);
DisposeAllAndClear(v.LineCollections); DisposeAllAndClear(v.LineCollections);
v.Margins=new Thickness(80, 30, 50, 60);
v.YAxes.AddRange(_wavesModel.CreateYAxisChart(smList.ToList(), LChartALL)); v.YAxes.AddRange(_wavesModel.CreateYAxisChart(smList.ToList(), LChartALL));
v.LegendBoxes[0].Position = LegendBoxPositionXY.RightCenter; v.LegendBoxes[0].Position = LegendBoxPositionXY.RightCenter;
@ -460,67 +467,74 @@ namespace mseedChart.MainModule.ViewModels
double firstSampleTimeStamp = v.XAxes[0].DateTimeToAxisValue(beginTime); double firstSampleTimeStamp = v.XAxes[0].DateTimeToAxisValue(beginTime);
int count = stationModel.Dzne.Count; int count = stationModel.Dzne.Count;
int number= smList.Count; int number= smList.Count*3;
for (int i = 0; i < number; i++) for (int i = 0; i < number; i++)
{ {
for (int k = 0; k <count; k++) int seriesIndex = i;
AxisY axisY = v.YAxes[seriesIndex];
axisY.LabelsColor = Colors.Black;
axisY.Title.Shadow.DropColor = Colors.Transparent;
// axisY.Title.Shadow.ContrastColor = Colors.Transparent;
axisY.Title.AllowDragging = false;
axisY.AllowAutoYFit = false;
axisY.Units.Visible = false;
axisY.LabelsFont.Size = 10;
axisY.Title.Angle = 0;
axisY.MinorGrid.Visible = false;
axisY.AutoDivSpacing = false;
axisY.MajorDivCount = 2;
axisY.MinorDivTickStyle.Visible = false;
axisY.MajorDivTickStyle.Alignment = seriesIndex % 2 == 0 ? Alignment.Near : Alignment.Far;
// axisY.MajorDivTickStyle.LineLength = 6;
axisY.MajorDivTickStyle.Color = Colors.Black;
axisY.Title.Color = Colors.Black;
axisY.Title.Font = new WpfFont("Segoe UI", 10, false, false);
axisY.PanningEnabled = false;
axisY.AllowScrolling = false;
axisY.AllowScaling = false;
SampleDataSeries series = new SampleDataSeries(v, v.XAxes[0], axisY);
series.ShowInLegendBox = false;
series.FirstSampleTimeStamp = firstSampleTimeStamp;
series.SamplingFrequency = _samplingFrequency;
series.Title.Text = axisY.Title.Text;
series.SampleFormat = SampleFormat.DoubleFloat;
if (seriesIndex % 3 == 0)
{ {
int seriesIndex = i * 3 + k; series.LineStyle.Color = System.Windows.Media.Colors.DeepSkyBlue;
AxisY axisY = v.YAxes[seriesIndex];
axisY.LabelsColor = Colors.Black;
axisY.Title.Shadow.DropColor = Colors.Transparent;
axisY.Title.Shadow.ContrastColor = Colors.Transparent;
axisY.AllowAutoYFit = false;
axisY.Units.Visible = false;
axisY.LabelsAngle = 0;
axisY.LabelsFont.Size = 8;
axisY.Title.Angle = 0;
// axisY.MajorGrid.Visible = true;
axisY.MinorGrid.Visible = false;
axisY.MajorGrid.Pattern = LinePattern.Solid;
axisY.AutoDivSpacing = false;
axisY.MajorDivCount = 2;
axisY.MajorDivTickStyle.Visible = true;
axisY.MinorDivTickStyle.Visible = false;
axisY.MajorDivTickStyle.Alignment = seriesIndex % 2 == 0 ? Alignment.Near : Alignment.Far;
axisY.MajorDivTickStyle.LineLength = 6;
axisY.MajorDivTickStyle.Color = Colors.Black;
axisY.Title.Color = Colors.Black;
axisY.Title.Font = new WpfFont("Segoe UI", 10, false, false);
axisY.PanningEnabled = false;
axisY.AllowScrolling = false;
axisY.AllowScaling = false;
SampleDataSeries series = new SampleDataSeries(v, v.XAxes[0], axisY);
series.ShowInLegendBox = true;
series.FirstSampleTimeStamp = firstSampleTimeStamp;
series.SamplingFrequency = _samplingFrequency;
series.Title.Text = axisY.Title.Text;
series.SampleFormat = SampleFormat.DoubleFloat;
if (k % 3 == 0)
{
series.LineStyle.Color = System.Windows.Media.Colors.Blue;
}
else if (k % 3 == 1)
{
series.LineStyle.Color = System.Windows.Media.Colors.Red;
}
else if (k % 3 == 2)
{
series.LineStyle.Color = System.Windows.Media.Colors.Green;
}
series.LineStyle.Width = 0.5;
series.LineStyle.AntiAliasing = LineAntialias.None;
series.ScrollModePointsKeepLevel = 1;
series.ScrollingStabilizing = true;
series.AllowUserInteraction = false;
v.SampleDataSeries.Add(series);
_chartAxisY.Add(axisY);
} }
else if (seriesIndex % 3 == 1)
{
series.LineStyle.Color = System.Windows.Media.Colors.OrangeRed;
}
else if (seriesIndex % 3 == 2)
{
series.LineStyle.Color = System.Windows.Media.Colors.ForestGreen;
}
series.LineStyle.Width = 0.2;
series.ScrollModePointsKeepLevel = 1;
//series.ScrollingStabilizing = true;
v.SampleDataSeries.Add(series);
_chartAxisY.Add(axisY);
}
}
private void LChartALL_SizeChanged(object sender, SizeChangedEventArgs e)
{
foreach (var item in LChartALL.ViewXY.YAxes)
{
//更新标题坐标
item.Title.DistanceToAxis = -(int)e.NewSize.Width+80;
}
foreach (var item in LChartALL.ViewXY.LineCollections)
{
double b = LChartALL.ViewXY.XAxes[0].ValueToCoordD(item.Lines[0].AX)-80;
item.Title.Offset.SetValues((int)b, 3);
} }
} }
private void FeedDatasToChart() private void FeedDatasToChart()
{ {
_data = new double[smList.Count * 3][]; _data = new double[smList.Count * 3][];

@ -48,7 +48,7 @@
<Button Grid.Column="1" Grid.Row="1" Command="{Binding FileSelectorCommand}" Margin="5,0,20,0" Background="#FF66B1FF" HorizontalAlignment="Right" Width="60" Height="20">打开</Button> <Button Grid.Column="1" Grid.Row="1" Command="{Binding FileSelectorCommand}" Margin="5,0,20,0" Background="#FF66B1FF" HorizontalAlignment="Right" Width="60" Height="20">打开</Button>
<CheckBox Command="{Binding RealTimeDataCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},Path=IsChecked}" Content="实时" VerticalContentAlignment="Center" FontSize="15" Foreground="Black" FontWeight="Bold" DockPanel.Dock="Right"></CheckBox> <CheckBox Command="{Binding RealTimeDataCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},Path=IsChecked}" Content="实时" VerticalContentAlignment="Center" FontSize="15" Foreground="Black" FontWeight="Bold" DockPanel.Dock="Right"></CheckBox>
</StackPanel> </StackPanel>
<ContentControl x:Name="contentControl" Content="{Binding ChildContent}" Grid.Row="1" /> <ContentControl x:Name="contentControl" Content="{Binding ChildContent}" Grid.Row="1"/>
<TextBlock Text="{Binding CurrentTime}" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0,0,0,46"></TextBlock> <TextBlock Text="{Binding CurrentTime}" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0,0,0,46"></TextBlock>
</Grid> </Grid>
</UserControl> </UserControl>

@ -5,12 +5,8 @@ VisualStudioVersion = 17.3.32922.545
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mseedChart", "mseedChart\mseedChart.csproj", "{7A0008BD-0B8D-41AE-AB09-36DCDA7FAF93}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mseedChart", "mseedChart\mseedChart.csproj", "{7A0008BD-0B8D-41AE-AB09-36DCDA7FAF93}"
EndProject 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}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mseedChart.Core", "mseedChart.Core\mseedChart.Core.csproj", "{4A973AC0-90A5-4652-8F8F-AB6DCA59D906}"
EndProject 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}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mseedChart.MainModule", "mseedChart.MainModule\mseedChart.MainModule.csproj", "{6B5392C6-3D2D-4890-A0BF-F5F9F84CD867}"
EndProject EndProject
Global Global
@ -23,18 +19,10 @@ Global
{7A0008BD-0B8D-41AE-AB09-36DCDA7FAF93}.Debug|Any CPU.Build.0 = Debug|Any CPU {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.ActiveCfg = Release|Any CPU
{7A0008BD-0B8D-41AE-AB09-36DCDA7FAF93}.Release|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{4A973AC0-90A5-4652-8F8F-AB6DCA59D906}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{4A973AC0-90A5-4652-8F8F-AB6DCA59D906}.Release|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{6B5392C6-3D2D-4890-A0BF-F5F9F84CD867}.Debug|Any CPU.Build.0 = 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 {6B5392C6-3D2D-4890-A0BF-F5F9F84CD867}.Release|Any CPU.ActiveCfg = Release|Any CPU

Loading…
Cancel
Save