Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
thick-casting
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
thick-casting
Commits
5601880d
Commit
5601880d
authored
Sep 19, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 即时扫描图 Y轴范围 不能及时修改
parent
6e772c72
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
61 deletions
+57
-61
TempScanGraphVm.cs
....FilmCasting.UI/UiModule/TempScanGraph/TempScanGraphVm.cs
+57
-61
No files found.
Project.FLY.Thick.FilmCasting/FLY.Thick.FilmCasting.UI/UiModule/TempScanGraph/TempScanGraphVm.cs
View file @
5601880d
...
...
@@ -36,6 +36,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
public
double
YMin
{
get
;
set
;
}
=
double
.
NaN
;
public
double
Target
{
get
;
set
;
}
=
double
.
NaN
;
public
double
TolerancePercent
{
get
;
set
;
}
=
0.05
;
public
double
Tolerance
{
get
;
set
;
}
=
MIN_TOLERANCE
;
public
double
ToleranceYMax
{
get
;
set
;
}
=
double
.
NaN
;
public
double
ToleranceYMin
{
get
;
set
;
}
=
double
.
NaN
;
public
double
Tolerance2YMax
{
get
;
set
;
}
=
double
.
NaN
;
...
...
@@ -240,12 +241,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
//更新平均值,它会引起 YFormatter 刷新
UpdateAverage
();
//更新Target
UpdateY
();
//必须先更新Y轴, X轴资料,最后再画线!!!!!!!
//不然 YAxisCrossing 会有机会无效
PropertyChanged_Average
();
Values
.
AddRange
(
datas
);
}
...
...
@@ -282,8 +278,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
//更新平均值,它会引起 YFormatter 刷新
UpdateAverage
();
//更新Target
UpdateY
();
PropertyChanged_Average
();
for
(
int
i
=
0
;
i
<
reponse
.
D
.
Count
();
i
++)
{
...
...
@@ -310,10 +305,8 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
if
(
e
.
PropertyName
==
nameof
(
Target
))
{
if
(
graphparam
.
IsPercent
)
{
NotifyPropertyChanged
(
nameof
(
YFormatter
));
}
}
if
(
propertyname_updateMaxMinText
.
Contains
(
e
.
PropertyName
))
UpdateMaxMinTextAsync
();
...
...
@@ -324,11 +317,11 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
{
if
(
e
.
PropertyName
==
nameof
(
profileParam
.
Target
))
{
UpdateY
();
PropertyChanged_ParamTarget
();
}
else
if
(
e
.
PropertyName
==
nameof
(
profileParam
.
TolerancePercent
))
{
UpdateY
();
PropertyChanged_ParamTolerancePercent
();
}
}
...
...
@@ -347,12 +340,11 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
{
if
(
e
.
PropertyName
==
nameof
(
graphparam
.
YRangePercent
))
{
UpdateY
();
PropertyChanged_YRangePercent
();
}
else
if
(
e
.
PropertyName
==
nameof
(
graphparam
.
IsPercent
))
{
NotifyPropertyChanged
(
nameof
(
YFormatter
));
UpdateY
();
UpdateMaxMinTextAsync
();
}
}
...
...
@@ -361,63 +353,69 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
protected
void
UpdateY
()
{
double
target
=
this
.
profileParam
.
Target
;
if
(
graphparam
.
IsAutoTarget
&&
(!
double
.
IsNaN
(
Average
)))
{
target
=
Average
;
}
Target
=
target
;
TolerancePercent
=
profileParam
.
TolerancePercent
;
Tolerance
=
Math
.
Max
(
TolerancePercent
*
Target
,
MIN_TOLERANCE
);
//使用 profileParam 的参数显示
UpdateY_profileParam
();
PropertyChanged_Target_Tolerance_YRangePercent
();
}
void
UpdateY_profileParam
()
{
bool
isAutoTarget
=
false
;
double
target
=
this
.
profileParam
.
Target
;
if
(
graphparam
.
IsAutoTarget
)
void
PropertyChanged_ParamTarget
()
{
if
(!
double
.
IsNaN
(
Average
))
//自动目标值模式 且 已经有平均值
if
(
graphparam
.
IsAutoTarget
&&
(!
double
.
IsNaN
(
Average
)))
{
target
=
Average
;
isAutoTarget
=
true
;
return
;
//现在 Y轴 与 产品中的目标值 无关
}
else
{
if
(!
double
.
IsNaN
(
Target
))
{
//没有数据 且之前能显示,不更新界面。
return
;
Target
=
profileParam
.
Target
;
PropertyChanged_Target_Tolerance_YRangePercent
();
}
void
PropertyChanged_ParamTolerancePercent
()
{
TolerancePercent
=
profileParam
.
TolerancePercent
;
Tolerance
=
Math
.
Max
(
TolerancePercent
*
Target
,
MIN_TOLERANCE
);
PropertyChanged_Target_Tolerance_YRangePercent
();
}
void
PropertyChanged_Target_Tolerance_YRangePercent
()
{
ToleranceYMax
=
Target
+
Tolerance
;
ToleranceYMin
=
Target
-
Tolerance
;
Tolerance2YMax
=
Target
+
Tolerance
*
2
;
Tolerance2YMin
=
Target
-
Tolerance
*
2
;
YMax
=
Target
+
Tolerance
*
graphparam
.
YRangePercent
;
YMin
=
Target
-
Tolerance
*
graphparam
.
YRangePercent
;
}
void
PropertyChanged_YRangePercent
()
{
YMax
=
Target
+
Tolerance
*
graphparam
.
YRangePercent
;
YMin
=
Target
-
Tolerance
*
graphparam
.
YRangePercent
;
}
void
PropertyChanged_Average
()
{
if
(!
graphparam
.
IsAutoTarget
)
return
;
if
(
isAutoTarget
)
if
(
double
.
IsNaN
(
Average
))
return
;
if
(!
double
.
IsNaN
(
Target
))
//之前有显示范围
{
if
(
!
double
.
IsNaN
(
Target
)
)
if
(
Average
<
ToleranceYMax
&&
Average
>
ToleranceYMin
)
{
if
(
profileParam
.
TolerancePercent
==
TolerancePercent
)
{
//公差没变
if
(
target
<
ToleranceYMax
&&
target
>
ToleranceYMin
)
{
//变化很小, 不调整显示
return
;
}
}
}
}
double
tolerance
=
this
.
profileParam
.
TolerancePercent
*
target
;
if
(
tolerance
<
MIN_TOLERANCE
)
tolerance
=
MIN_TOLERANCE
;
TolerancePercent
=
profileParam
.
TolerancePercent
;
Target
=
target
;
ToleranceYMax
=
target
+
tolerance
;
ToleranceYMin
=
target
-
tolerance
;
Tolerance2YMax
=
target
+
tolerance
*
2
;
Tolerance2YMin
=
target
-
tolerance
*
2
;
YMax
=
target
+
tolerance
*
graphparam
.
YRangePercent
;
YMin
=
target
-
tolerance
*
graphparam
.
YRangePercent
;
Target
=
Average
;
PropertyChanged_Target_Tolerance_YRangePercent
();
}
protected
void
UpdateX
()
...
...
@@ -493,8 +491,6 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
}
protected
void
NotifyPropertyChanged
(
string
propertyName
)
{
PropertyChanged
?.
Invoke
(
this
,
new
PropertyChangedEventArgs
(
propertyName
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment