Skip to content

Commit

Permalink
Merge pull request #330 from nsidc/line-thickness-legend
Browse files Browse the repository at this point in the history
Add a line thickness legend
  • Loading branch information
rmarow authored Oct 8, 2024
2 parents 825d679 + 75a95e0 commit 2d0c9ed
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 18 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## v2.3.0 (2024-10-02)

* Allow null link raings (db migration ea1181510e10)
* Allow null performance and criticality ratings on links (db migration ea1181510e10)
* Null performance is displayed as gray
* Null criticality is displayed as a thin line
* Display a legend for criticality rating


## v2.2.0 (2024-10-01)

Expand Down
4 changes: 2 additions & 2 deletions usaon_benefit_tool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _register_blueprints(app) -> None:
# TODO: Extract function register_blueprints
from usaon_benefit_tool.routes.assessment import assessment_bp
from usaon_benefit_tool.routes.assessments import assessments_bp
from usaon_benefit_tool.routes.colorbar import colorbar_bp
from usaon_benefit_tool.routes.legend import legend_bp
from usaon_benefit_tool.routes.login import google_bp, login_bp
from usaon_benefit_tool.routes.logout import logout_bp
from usaon_benefit_tool.routes.node import node_bp
Expand All @@ -181,7 +181,7 @@ def _register_blueprints(app) -> None:
from usaon_benefit_tool.routes.users import users_bp

app.register_blueprint(root_bp)
app.register_blueprint(colorbar_bp)
app.register_blueprint(legend_bp)

app.register_blueprint(user_bp)
app.register_blueprint(users_bp)
Expand Down
13 changes: 0 additions & 13 deletions usaon_benefit_tool/routes/colorbar.py

This file was deleted.

20 changes: 20 additions & 0 deletions usaon_benefit_tool/routes/legend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from flask import Blueprint, Response, send_file

from usaon_benefit_tool.constants.paths import PACKAGE_DIR
from usaon_benefit_tool.util.colormap import colormap_png_bytes

legend_bp = Blueprint('legend', __name__)


@legend_bp.route('/colorbar.png', methods=['GET'])
def get_colorbar_legend():
return Response(
colormap_png_bytes(),
mimetype="image/png",
)


@legend_bp.route('/line_thickness_legend.png', methods=['GET'])
def get_line_thickness_legend():
filepath = PACKAGE_DIR / "static" / "line_thickness_legend.png"
return send_file(filepath)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions usaon_benefit_tool/templates/assessment/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ <h3>Description</h3>

{{ display_sankey(sankey_series, assessment=assessment)}}
<div style="text-align: center;">
<img style="margin: auto" src={{ url_for("colorbar.get") }} />

<img style="margin: auto" src={{ url_for("legend.get_line_thickness_legend") }} />
<p>Criticality rating (a thicker line indicates a more critical input, a very thin line is unrated)</p>

<img style="margin: auto" src={{ url_for("legend.get_colorbar_legend") }} />
<!-- TODO: this label should be baked in to the legend! But was having trouble with the text getting cut off. -->
<p>Performance rating</p>
<p>Performance rating(grey lines are unrated) </p>

</div>

<div>
Expand Down

0 comments on commit 2d0c9ed

Please sign in to comment.