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

Issue 502 visually distinguish forecasts from measurements #503

Merged

Conversation

Flix6x
Copy link
Contributor

@Flix6x Flix6x commented Sep 13, 2022

This PR creates a visual distinction between forecasts/schedules (dashed lines) and measurements (solid lines). It also expands the tooltip with timing info regarding the forecast/schedule horizon or measurement lag.

Closes #502.

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x Flix6x added the UI label Sep 13, 2022
@Flix6x Flix6x added this to the 0.12.0 milestone Sep 13, 2022
@Flix6x Flix6x self-assigned this Sep 13, 2022
@Flix6x Flix6x added this to In progress in Update UI views for Sensors and Assets via automation Sep 13, 2022
Signed-off-by: F.N. Claessen <felix@seita.nl>
@coveralls
Copy link
Collaborator

coveralls commented Sep 13, 2022

Pull Request Test Coverage Report for Build 3243005744

  • 0 of 2 (0.0%) changed or added relevant lines in 2 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.01%) to 64.989%

Changes Missing Coverage Covered Lines Changed/Added Lines %
flexmeasures/data/models/charts/belief_charts.py 0 1 0.0%
flexmeasures/data/models/generic_assets.py 0 1 0.0%
Files with Coverage Reduction New Missed Lines %
flexmeasures/data/models/charts/belief_charts.py 1 12.77%
flexmeasures/data/models/generic_assets.py 1 47.18%
Totals Coverage Status
Change from base Build 3230159004: -0.01%
Covered Lines: 6479
Relevant Lines: 9361

💛 - Coveralls

Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x Flix6x marked this pull request as ready for review September 13, 2022 15:57
Update UI views for Sensors and Assets automation moved this from In progress to Review in progress Sep 24, 2022
Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work, I tried it locally.

  • One wish to document function parameters
  • Any idea how to tell the user about what the dashed line means? My only idea was to mention it in the legend.

vega.expressionFunction('quantityWithUnitFormat', function(datum, params) {
return d3.format(params[0])(datum) + " " + params[1];
});
vega.expressionFunction('timedeltaFormat', function(timedelta, params) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we document here what I had to find out by myself?

params[0] is a D3 format identifier (.e.g "d" for days)
params[1] is a multiplier which decides from how many X on we format as Y (e.g. <=3 days means we format as "hours")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, d stands for decimal notation, rounded to integer. It's a d3-format rather than a d3-time-format. I'm expanding the inline documentation.

Signed-off-by: F.N. Claessen <felix@seita.nl>
…rs to show

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
…stinguish_forecasts_from_measurements

# Conflicts:
#	documentation/changelog.rst
Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x
Copy link
Contributor Author

Flix6x commented Oct 13, 2022

Any idea how to tell the user about what the dashed line means? My only idea was to mention it in the legend.

I added a legend. That took me some time, but it was an significant hiatus, so thanks for pointing me to it.

At the moment the legend uses the technical terms Recorded ex ante and Recorded ex post. An alternative like measurements and forecasts doesn't work very well, because they imply a belief horizon together with a specific (type of) source. For example, some ex-post beliefs are not measurements but rather still forecasts (such as a belief from a trader about day-ahead prices formed after gate closure but before publication by the exchange), while some ex-ante beliefs are not forecasts, but schedules. If we later start using more different strokes derived from a combination of belief horizon and source, we should probably reconsider the legend terms.

@Flix6x Flix6x requested a review from nhoening October 13, 2022 08:04
**{attr: getattr(asset, attr) for attr in attributes},
**{
"timerange_of_sensors_to_show": {
"start": datetime.datetime(2020, 12, 3, 14, 0, tzinfo=pytz.utc),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a hard-coded value used in development?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. I encountered significant page loading delay here. I'll make a new ticket to make this asynchronous.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #515.

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x Flix6x requested a review from nhoening October 13, 2022 14:03
Update UI views for Sensors and Assets automation moved this from Review in progress to Reviewer approved Oct 13, 2022
Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried the code out locally, and it works fine.

@Flix6x Flix6x merged commit 6b9d882 into main Oct 13, 2022
Update UI views for Sensors and Assets automation moved this from Reviewer approved to Done Oct 13, 2022
@Flix6x Flix6x deleted the issue-502_Visually_distinguish_forecasts_from_measurements branch October 13, 2022 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Visually distinguish forecasts from measurements
3 participants