Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dummy-vue-grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vig
provee
dummy-vue-grpc
Commits
c63f0b34
Commit
c63f0b34
authored
4 years ago
by
IsolatedSushi
Browse files
Options
Downloads
Patches
Plain Diff
Small chart alterations
parent
fe5f9512
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/server.js
+2
-3
2 additions, 3 deletions
backend/server.js
frontend/src/components/ScatterPlot.vue
+6
-3
6 additions, 3 deletions
frontend/src/components/ScatterPlot.vue
with
8 additions
and
6 deletions
backend/server.js
+
2
−
3
View file @
c63f0b34
...
@@ -28,12 +28,12 @@ function generatePoint(){
...
@@ -28,12 +28,12 @@ function generatePoint(){
var
xVal
=
Math
.
floor
(
Math
.
random
()
*
20
);
var
xVal
=
Math
.
floor
(
Math
.
random
()
*
20
);
var
yVal
=
Math
.
floor
(
Math
.
random
()
*
20
);
var
yVal
=
Math
.
floor
(
Math
.
random
()
*
20
);
count
++
;
count
++
;
console
.
log
(
"
Generated point. ID:
"
+
count
+
"
x:
"
+
xVal
+
"
y:
"
+
yVal
);
return
{
id
:
count
,
x
:
xVal
,
y
:
yVal
};
return
{
id
:
count
,
x
:
xVal
,
y
:
yVal
};
}
}
//SERVICE
//SERVICE
function
sendPoint
(
call
,
callback
)
{
function
sendPoint
(
call
,
callback
)
{
callback
(
null
,
generatePoint
());
callback
(
null
,
generatePoint
());
console
.
log
(
"
sent point!
"
);
}
}
/**
/**
* @param {!Object} call
* @param {!Object} call
...
@@ -43,13 +43,12 @@ function sendPointStream(call) {
...
@@ -43,13 +43,12 @@ function sendPointStream(call) {
function
sender
(
point
)
{
function
sender
(
point
)
{
return
(
callback
)
=>
{
return
(
callback
)
=>
{
call
.
write
(
point
);
call
.
write
(
point
);
_
.
delay
(
callback
,
500
);
// in ms
_
.
delay
(
callback
,
1
);
// in ms
};
};
}
}
var
senders
=
[];
var
senders
=
[];
var
count
=
10
;
var
count
=
10
;
console
.
log
(
"
Will send
"
+
count
);
for
(
var
i
=
0
;
i
<
count
;
i
++
)
{
for
(
var
i
=
0
;
i
<
count
;
i
++
)
{
senders
[
i
]
=
sender
(
generatePoint
());
senders
[
i
]
=
sender
(
generatePoint
());
}
}
...
...
This diff is collapsed.
Click to expand it.
frontend/src/components/ScatterPlot.vue
+
6
−
3
View file @
c63f0b34
<
template
>
<
template
>
<div
id=
"app"
class=
"my-10"
>
<div
id=
"app"
class=
"my-10"
>
<h3>
ScatterPlot in d3
</h3>
<h3>
ScatterPlot in d3
</h3>
<svg
id=
"chart"
viewBox=
"0 0 500
500
"
></svg>
<svg
id=
"chart"
width =
'500'
height =
'
500
'
></svg>
</div>
</div>
</
template
>
</
template
>
...
@@ -68,14 +68,17 @@ export default {
...
@@ -68,14 +68,17 @@ export default {
this
.
xAxis
.
call
(
d3
.
axisBottom
(
this
.
x
));
this
.
xAxis
.
call
(
d3
.
axisBottom
(
this
.
x
));
this
.
yAxis
.
call
(
d3
.
axisLeft
(
this
.
y
));
this
.
yAxis
.
call
(
d3
.
axisLeft
(
this
.
y
));
var
color
=
d3
.
scaleOrdinal
()
.
domain
([
-
1
,
0
,
1
])
.
range
([
"
#F8766D
"
,
"
#00BA38
"
,
"
#619CFF
"
])
this
.
chart
.
selectAll
(
"
.point
"
)
this
.
chart
.
selectAll
(
"
.point
"
)
.
data
(
this
.
dataPoints
)
.
data
(
this
.
dataPoints
)
.
join
(
"
g
"
)
.
join
(
"
g
"
)
.
attr
(
"
class
"
,
"
point
"
)
.
attr
(
"
class
"
,
"
point
"
)
.
attr
(
"
transform
"
,
d
=>
`translate(
${
this
.
x
(
d
.
x
)}
,
${
this
.
y
(
d
.
y
)}
)`
)
.
attr
(
"
transform
"
,
d
=>
`translate(
${
this
.
x
(
d
.
x
)}
,
${
this
.
y
(
d
.
y
)}
)`
)
.
append
(
"
circle
"
)
.
append
(
"
circle
"
)
.
attr
(
"
r
"
,
5
);
.
attr
(
"
r
"
,
8
)
.
style
(
'
fill
'
,
function
(
d
)
{
return
color
((
d
.
x
*
d
.
x
+
d
.
y
*
d
.
y
)
%
3
)
});
},
},
addPointToPlot
(
point
)
{
addPointToPlot
(
point
)
{
this
.
dataPoints
.
push
({
this
.
dataPoints
.
push
({
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment