Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lam-station-visualization
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
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
data-analysis-and-ai
lam-station-visualization
Commits
9c1a8467
Commit
9c1a8467
authored
6 years ago
by
Janne Alatalo
Browse files
Options
Downloads
Patches
Plain Diff
Change data coloring to use the free flow speed
parent
6a6e1214
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#4037
passed
6 years ago
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/utils/lam-station.js
+50
-7
50 additions, 7 deletions
src/utils/lam-station.js
with
50 additions
and
7 deletions
src/utils/lam-station.js
+
50
−
7
View file @
9c1a8467
...
...
@@ -7,11 +7,21 @@ class LamStation {
this
.
coordinates
=
coordinates
;
this
.
avg_speed_dir1
=
avg_speed_dir1
;
this
.
avg_speed_dir2
=
avg_speed_dir2
;
this
.
traffic_vol_dir1
=
0
;
this
.
traffic_vol_dir2
=
0
;
this
.
free_flow_speed_dir1
=
null
;
this
.
free_flow_speed_dir2
=
null
;
this
.
traffic_vol_dir1
=
null
;
this
.
traffic_vol_dir2
=
null
;
this
.
rainbow
=
new
Rainbow
();
this
.
rainbow
.
setSpectrum
(
"
red
"
,
"
green
"
);
this
.
rainbow
.
setNumberRange
(
0
,
130
);
this
.
rainbow
.
setSpectrum
(
"
orange
"
,
"
yellow
"
,
"
green
"
);
this
.
rainbow
.
setNumberRange
(
0.0
,
1.0
);
}
set_free_flow_speed_dir1
(
free_flow_speed
)
{
this
.
free_flow_speed_dir2
=
free_flow_speed
;
}
set_free_flow_speed_dir2
(
free_flow_speed
)
{
this
.
free_flow_speed_dir1
=
free_flow_speed
;
}
set_avg_speed_dir1
(
avg_speed
)
{
...
...
@@ -39,10 +49,22 @@ class LamStation {
}
get_color
()
{
if
(
this
.
get_avg_speed
()
===
0
)
{
return
[
211
,
211
,
211
];
const
grey
=
[
211
,
211
,
211
];
const
free_flow1
=
this
.
get_free_flow_speed_dir1
();
const
free_flow2
=
this
.
get_free_flow_speed_dir2
();
const
avg_speed1
=
this
.
get_avg_speed_dir1
();
const
avg_speed2
=
this
.
get_avg_speed_dir2
();
if
(
avg_speed1
===
null
||
avg_speed2
===
null
)
{
return
grey
;
}
else
if
(
free_flow1
===
null
||
free_flow2
===
null
)
{
return
grey
;
}
else
if
(
Math
.
min
(
avg_speed1
,
avg_speed2
)
===
0
)
{
return
grey
;
}
let
hex
=
this
.
rainbow
.
colorAt
(
this
.
get_avg_speed
());
const
ratio1
=
free_flow1
/
avg_speed1
;
const
ratio2
=
free_flow2
/
avg_speed2
;
const
min_ratio
=
Math
.
min
(
ratio1
,
ratio2
);
let
hex
=
this
.
rainbow
.
colorAt
(
min_ratio
);
let
bigint
=
parseInt
(
hex
,
16
);
let
r
=
(
bigint
>>
16
)
&
255
;
let
g
=
(
bigint
>>
8
)
&
255
;
...
...
@@ -51,6 +73,11 @@ class LamStation {
}
get_avg_speed
()
{
const
avg_speed1
=
this
.
get_avg_speed_dir1
();
const
avg_speed2
=
this
.
get_avg_speed_dir2
();
if
(
avg_speed1
===
null
||
avg_speed2
===
null
)
{
return
0
;
}
return
(
this
.
avg_speed_dir1
+
this
.
avg_speed_dir1
)
/
2
;
}
...
...
@@ -58,6 +85,22 @@ class LamStation {
return
(
this
.
traffic_vol_dir1
+
this
.
traffic_vol_dir2
)
/
2
;
}
get_free_flow_speed_dir1
()
{
return
this
.
free_flow_speed_dir1
;
}
get_free_flow_speed_dir2
()
{
return
this
.
free_flow_speed_dir2
;
}
get_avg_speed_dir1
()
{
return
this
.
avg_speed_dir1
;
}
get_avg_speed_dir2
()
{
return
this
.
avg_speed_dir2
;
}
}
export
default
LamStation
;
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