添加台站的耶隐藏和显示

master
mzhifa 2 years ago
parent 30a0338e14
commit b159dcad47

@ -8,6 +8,7 @@ using mseedChart.MainModule.Models;
using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
using SharpDX.Direct2D1;
using SharpDX.DirectWrite;
using System;
using System.Collections;
@ -154,13 +155,42 @@ namespace mseedChart.MainModule.ViewModels
public StationEventJson CurrentEventTime
{
get { return _currentEventTime; }
set { _currentEventTime = value; }
}
private List<string> _stationYaxis;
public List<string> StationYaxis
{
get { return _stationYaxis; }
set {
SetProperty(ref _stationYaxis, value);
}
}
private int _selectStationYaxisIndex;
public int SelectStationYaxisIndex
{
get { return _selectStationYaxisIndex; }
set {
SetProperty(ref _selectStationYaxisIndex, value);
}
}
private bool _stationYaxisIsChecked;
public bool StationYaxisIsChecked
{
get { return _stationYaxisIsChecked; }
set {
StationYaxisVisible(value);
SetProperty(ref _stationYaxisIsChecked , value);
}
}
#endregion
#region 事件
@ -310,14 +340,36 @@ namespace mseedChart.MainModule.ViewModels
{
_lChartAll.ViewXY.XAxes[0].MajorDivCount = XaisInterval;
}
_lChartAll.EndUpdate();
}
}
private void StationYaxisVisible(bool visible)
{
if (_lChartAll != null)
{
_lChartAll.BeginUpdate();
bool yAxesVisible = ((bool)visible == true);
ViewXY v = _lChartAll.ViewXY;
for (int i = 0; i < v.YAxes.Count; i++)
{
AxisY axisY = v.YAxes[i];
if (axisY.Title.Text.Contains(StationYaxis[SelectStationYaxisIndex]))
{
axisY.Visible = !yAxesVisible;
v.SampleDataSeries[i].Visible = !yAxesVisible;
int index = v.LineCollections.FindIndex(a => a.AssignYAxisIndex == i);
if (index != -1)
{
v.LineCollections[index].Visible = !yAxesVisible;
}
}
}
_lChartAll.EndUpdate();
}
}
#endregion
public List<StationModel> UpdateWavesFromTxt(string fn)
{
@ -505,11 +557,11 @@ namespace mseedChart.MainModule.ViewModels
}
_channelCount = smList.Count * 3;
StationYaxis = smList.Select(a => a.Name).ToList();
UpdateChart();
UpdateChartData();
}
private void UpdateChart()
{
ViewXY v= LChartALL.ViewXY;

@ -19,6 +19,8 @@
VerticalAlignment="Top" Margin="0,162,0,0" Grid.Row="1" />
<DockPanel>
<CheckBox Command="{Binding AxesYVisibleCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},Path=IsChecked}" Content="Y轴显示" VerticalContentAlignment="Center" IsChecked="True" FontSize="15" Foreground="Black" Margin="5,0,5,0" FontWeight="Bold" />
<ComboBox ItemsSource="{Binding StationYaxis}" SelectedIndex="{Binding SelectStationYaxisIndex}"/>
<CheckBox IsChecked="{Binding StationYaxisIsChecked}" Content="台站" VerticalContentAlignment="Center" FontSize="15" Foreground="Black" Margin="5,0,5,0" FontWeight="Bold"></CheckBox>
<CheckBox Command="{Binding OtimeSortCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},Path=IsChecked}" Content="排序" VerticalContentAlignment="Center" FontSize="15" Foreground="Black" Margin="5,0,5,0" FontWeight="Bold"></CheckBox>
<ComboBox ItemsSource="{Binding YaxisItems}" SelectedIndex="{Binding SelectIndex}" />
<CheckBox Command="{Binding YasixZENVisibleCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},Path=IsChecked}" Content="ZEN" VerticalContentAlignment="Center" FontSize="15" Foreground="Black" Margin="5,0,5,0" FontWeight="Bold"></CheckBox>

Loading…
Cancel
Save