Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split legends in case of vertically concatenated chart #1193

Merged
merged 4 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions documentation/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ v0.24.0 | October XX, 2024

New features
-------------
* The asset beliefs chart can now be configured to not combine legends, but show them per plot [see `PR #1176 <https://github.com/FlexMeasures/flexmeasures/pull/1176>`_]
* Speed up loading the users page, by making the pagination backend-based and adding support for that in the API [see `PR #1160 <https://github.com/FlexMeasures/flexmeasures/pull/1160>`_]
* The data chart on the asset page splits up its color-coded sensor legend when showing more than 7 sensors, becoming a legend per subplot [see `PR #1176 <https://github.com/FlexMeasures/flexmeasures/pull/1176>`_ and `PR #1193 <https://github.com/FlexMeasures/flexmeasures/pull/1193>`_
* Speed up loading the users page, by making the pagination backend-based and adding support for that in the API [see `PR #1160 <https://github.com/FlexMeasures/flexmeasures/pull/1160>`]
* X-axis labels in CLI plots show datetime values in a readable and informative format [see `PR #1172 <https://github.com/FlexMeasures/flexmeasures/pull/1172>`_]

Infrastructure / Support
Expand Down
6 changes: 5 additions & 1 deletion flexmeasures/ui/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@
}

async function embedAndLoad(chartSpecsPath, elementId, datasetName, previousResult, startDate, endDate) {
var combineLegend = 'true';

await vegaEmbed('#'+elementId, chartSpecsPath + 'dataset_name=' + datasetName + '&combine_legend='+ combineLegend + '&width=container&include_sensor_annotations=false&include_asset_annotations=false&chart_type=' + chartType, {{ chart_options | safe }})
.then(function (result) {
Expand Down Expand Up @@ -358,10 +357,15 @@
});
}

var combineLegend = 'true';
{% if active_page == "assets" %}
var dataPath = '/api/v3_0/assets/' + {{ asset.id }};
var dataDevPath = '/api/dev/asset/' + {{ asset.id }};
var datasetName = 'asset_' + {{ asset.id }};
{% set total_sensors = asset.sensors_to_show | map(attribute='sensors') | map('length') | sum %}
nhoening marked this conversation as resolved.
Show resolved Hide resolved
{% if total_sensors > 7 %}
combineLegend = 'false';
{% endif %}
{% elif active_page == "sensors" %}
var dataPath = '/api/dev/sensor/' + {{ sensor.id }};
var dataDevPath = '/api/dev/sensor/' + {{ sensor.id }};
Expand Down
Loading