Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
W
WidgetUI
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WuFeiyang
WidgetUI
Commits
e5401743
Commit
e5401743
authored
5 years ago
by
WuFeiyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
点击点同步完成
parent
dec1484c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
9 deletions
+36
-9
src/App.vue
src/App.vue
+1
-1
src/components/WaveView/setBasicParams.vue
src/components/WaveView/setBasicParams.vue
+35
-8
No files found.
src/App.vue
View file @
e5401743
...
...
@@ -209,7 +209,7 @@ export default class App extends Vue {
// fragment = fragment.substring(1,fragment.length);
// for (var wid of this.widgetList) {
// ((this.$refs[wid.ref] as Array
<
Widget
>
)[
0
]
as
Widget
).
replaceStartPath
(
fragment
as
string
);
// }
// }
//刷新值
this
.
importActiveWidgetList
();
// for (var wid of this.widgetList) {
...
...
This diff is collapsed.
Click to expand it.
src/components/WaveView/setBasicParams.vue
View file @
e5401743
...
...
@@ -190,7 +190,29 @@ export default class setBasicParams extends Vue {
}
findNearest
(
array
:
number
[],
start
:
number
,
end
:
number
,
num
:
number
):
number
{
var
midIndex
:
number
=
(
start
+
end
)
/
2
;
midIndex
=
Number
(
midIndex
.
toFixed
(
0
))
-
1
;
if
(
start
>=
end
){
return
start
}
var
mid
=
array
[
midIndex
];
var
left
=
array
[(
midIndex
-
1
)
<
start
?
start
:(
midIndex
-
1
)];
var
right
=
array
[(
midIndex
+
1
)
>
end
?
end
:(
midIndex
+
1
)];
var
sm
=
Math
.
abs
(
num
-
mid
);
var
sl
=
Math
.
abs
(
num
-
left
);
var
sr
=
Math
.
abs
(
num
-
right
);
if
(
sm
<
sl
&&
sm
<
sr
){
return
midIndex
;
}
else
{
var
li
=
this
.
findNearest
(
array
,
start
,
midIndex
-
1
,
num
);
var
ri
=
this
.
findNearest
(
array
,
midIndex
+
1
,
end
,
num
);
if
(
Math
.
abs
(
num
-
array
[
li
])
<
Math
.
abs
(
num
-
array
[
ri
])){
return
li
;
}
return
ri
;
}
}
async
viewLoad
(
Args
:
UpdatePayload
)
{
this
.
getConfig
.
data
.
position
.
x1
=
""
;
this
.
getConfig
.
data
.
position
.
x2
=
""
;
...
...
@@ -227,6 +249,8 @@ export default class setBasicParams extends Vue {
y
:
this
.
temp
.
data
}
];
console
.
log
(
"
data_initial:
"
);
console
.
log
(
data_initial
);
var
layout_initial
=
{
xaxis
:
{
range
:
[
this
.
config
.
data
.
position
.
x1
,
this
.
config
.
data
.
position
.
x2
]
...
...
@@ -235,7 +259,8 @@ export default class setBasicParams extends Vue {
range
:
[
this
.
config
.
data
.
position
.
y1
,
this
.
config
.
data
.
position
.
y2
]
},
hovermode
:
'
closest
'
,
clickmode
:
'
event
'
clickmode
:
'
event
'
,
autosize
:
true
};
console
.
log
(
layout_initial
);
this
.
createChannelChart
(
myPlot
,
data_initial
,
layout_initial
);
...
...
@@ -245,13 +270,16 @@ export default class setBasicParams extends Vue {
PubSub
.
subscribe
(
'
PlotlyClick
'
,(
messageName
:
string
,
Args
:
any
)
=>
{
console
.
log
(
"
subscribe
"
);
console
.
log
(
Args
);
var
nearestIndex
:
number
=
this
.
findNearest
(
data_initial
[
0
].
x
,
0
,
data_initial
[
0
].
x
.
length
-
1
,
Args
.
x
)
console
.
log
(
nearestIndex
);
console
.
log
(
data_initial
[
0
].
x
[
nearestIndex
]);
var
annotate_text
=
'
x =
'
+
Args
.
x
+
'
y =
'
+
Args
.
y
;
var
annotate_text
=
'
x =
'
+
data_initial
[
0
].
x
[
nearestIndex
]
+
'
y =
'
+
data_initial
[
0
].
y
[
nearestIndex
]
;
var
annotation
=
{
text
:
annotate_text
,
x
:
Args
.
x
,
y
:
Args
.
y
x
:
data_initial
[
0
].
x
[
nearestIndex
]
,
y
:
data_initial
[
0
].
y
[
nearestIndex
]
}
var
annotations
=
[];
annotations
.
push
(
annotation
);
...
...
@@ -312,6 +340,7 @@ export default class setBasicParams extends Vue {
//当前区域的范围
console
.
log
(
data
.
points
[
0
].
xaxis
.
range
);
console
.
log
(
data
.
points
[
0
].
yaxis
.
range
);
console
.
log
(
data
);
var
pts
=
''
;
for
(
var
i
=
0
;
i
<
data
.
points
.
length
;
i
++
){
var
annotate_text
=
'
x =
'
+
data
.
points
[
i
].
x
+
...
...
@@ -327,9 +356,7 @@ export default class setBasicParams extends Vue {
annotations
.
push
(
annotation
);
Plotly
.
relayout
(
myPlot
,{
annotations
:
annotations
});
PubSub
.
publish
(
'
PlotlyClick
'
,{
x
:
data
.
points
[
i
].
x
,
y
:
data
.
points
[
i
].
y
.
toPrecision
(
4
)});
PubSub
.
publish
(
'
SynchronizeXY
'
,{
xrange
:
data
.
points
[
0
].
xaxis
.
range
,
yrange
:
data
.
points
[
0
].
yaxis
.
range
});
}
});
...
...
This diff is collapsed.
Click to expand it.
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