Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
visualizer-embed
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Owen Graham
visualizer-embed
Commits
80cad764
Verified
Commit
80cad764
authored
Jun 22, 2022
by
Owen Graham
Browse files
Options
Downloads
Patches
Plain Diff
Add nav titles to plotters
parent
9c6a251e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
visualizer/plotting.py
+6
-6
6 additions, 6 deletions
visualizer/plotting.py
visualizer/templates/plot-views/embed.html
+2
-2
2 additions, 2 deletions
visualizer/templates/plot-views/embed.html
visualizer/templates/plot-views/page.html
+2
-2
2 additions, 2 deletions
visualizer/templates/plot-views/page.html
with
10 additions
and
10 deletions
visualizer/plotting.py
+
6
−
6
View file @
80cad764
...
@@ -17,21 +17,21 @@ plt.style.use('ggplot')
...
@@ -17,21 +17,21 @@ plt.style.use('ggplot')
plt
.
rcParams
[
'
axes.xmargin
'
]
=
0
plt
.
rcParams
[
'
axes.xmargin
'
]
=
0
matplotlib
.
use
(
'
Agg
'
)
matplotlib
.
use
(
'
Agg
'
)
Plotter
=
make_dataclass
(
'
Plotter
'
,
[
'
name
'
,
'
plot
'
])
Plotter
=
make_dataclass
(
'
Plotter
'
,
[
'
name
'
,
'
nav_title
'
,
'
plot
'
])
plotters
=
{}
plotters
=
{}
def
add_plotter
(
name
):
def
add_plotter
(
name
,
nav_title
):
"""
Decorator to register a plot type.
"""
"""
Decorator to register a plot type.
"""
def
decorator
(
f
):
def
decorator
(
f
):
plotters
[
name
]
=
Plotter
(
name
,
f
)
plotters
[
name
]
=
Plotter
(
name
,
nav_title
,
f
)
return
f
return
f
return
decorator
return
decorator
@add_plotter
(
'
index
'
)
@add_plotter
(
'
index
'
,
'
Time Series
'
)
def
plot_index
():
def
plot_index
():
"""
Plot one station/year/measurement.
"""
"""
Plot one station/year/measurement.
"""
station_id
=
get_param
(
'
station
'
)
station_id
=
get_param
(
'
station
'
)
...
@@ -64,7 +64,7 @@ def plot_index():
...
@@ -64,7 +64,7 @@ def plot_index():
return
savefig_response
(
fig
)
return
savefig_response
(
fig
)
@add_plotter
(
'
overlay
'
)
@add_plotter
(
'
overlay
'
,
'
Overlay
'
)
def
plot_overlay
():
def
plot_overlay
():
"""
Plot two station/years @ one measurement.
"""
"""
Plot two station/years @ one measurement.
"""
num_datasets
=
2
num_datasets
=
2
...
@@ -122,7 +122,7 @@ def plot_overlay():
...
@@ -122,7 +122,7 @@ def plot_overlay():
return
savefig_response
(
fig
)
return
savefig_response
(
fig
)
@add_plotter
(
'
boxplot
'
)
@add_plotter
(
'
boxplot
'
,
'
Boxplot
'
)
def
plot_boxplot
():
def
plot_boxplot
():
"""
Boxplot one station/measurement @ multiple years.
"""
"""
Boxplot one station/measurement @ multiple years.
"""
station_id
=
get_param
(
'
station
'
)
station_id
=
get_param
(
'
station
'
)
...
...
...
...
This diff is collapsed.
Click to expand it.
visualizer/templates/plot-views/embed.html
+
2
−
2
View file @
80cad764
...
@@ -18,11 +18,11 @@
...
@@ -18,11 +18,11 @@
<nav>
<nav>
{% for plotter in g.plotters.values() %}
{% for plotter in g.plotters.values() %}
{% if plotter is sameas g.plotter %}
{% if plotter is sameas g.plotter %}
<a>
{{ plotter.na
m
e }}
</a>
<a>
{{ plotter.na
v_titl
e }}
</a>
{% else %}
{% else %}
{% set url = url_for('plot_embed', name=plotter.name) %}
{% set url = url_for('plot_embed', name=plotter.name) %}
<a
onclick=
"location = {{ url | tojson | forceescape }}"
>
<a
onclick=
"location = {{ url | tojson | forceescape }}"
>
{{- plotter.na
m
e -}}
{{- plotter.na
v_titl
e -}}
</a>
</a>
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
...
...
...
...
This diff is collapsed.
Click to expand it.
visualizer/templates/plot-views/page.html
+
2
−
2
View file @
80cad764
...
@@ -25,10 +25,10 @@
...
@@ -25,10 +25,10 @@
<nav>
<nav>
{% for plotter in g.plotters.values() %}
{% for plotter in g.plotters.values() %}
{% if plotter is sameas g.plotter %}
{% if plotter is sameas g.plotter %}
<a>
{{ plotter.na
m
e }}
</a>
<a>
{{ plotter.na
v_titl
e }}
</a>
{% else %}
{% else %}
<a
href=
"{{ url_for('plot_page', name=plotter.name) }}"
>
<a
href=
"{{ url_for('plot_page', name=plotter.name) }}"
>
{{- plotter.na
m
e -}}
{{- plotter.na
v_titl
e -}}
</a>
</a>
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
...
...
...
...
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
sign in
to comment