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

OWScatterplotGraph: Use get_color_labels to return number formatter #3847

Merged

Conversation

janezd
Copy link
Contributor

@janezd janezd commented Jun 2, 2019

Issue

Fixes #3746 - displaying of datetime variables in visualization legends, as well as, probably, weird number of decimals for other numeric attributes.

Description of changes

Labels for color legend are created by palette, which is not aware of attributes. Palette is called by OWScatterplotGraph, which also doesn't know about attributes. On the other hand, the widget, which provides labels for discrete attributes (via get_color_labels), doesn't know how the graph will discretize continuous values, hence it can't provide a list.

A reasonable solution is that get_color_labels, which currently returns None for continuous variables, returns a formatter, that is, function that takes a number and returns a string. For most cases, this will be variables str_val. If it returns None, the widget uses the same formatter as it did before (a certain number of decimals, computed based on God knows what),

Includes
  • Code changes
  • Tests
  • Documentation

@janezd janezd force-pushed the scatterplotgraph-color-legend-formatting branch from 80c7add to b95ca83 Compare June 2, 2019 16:02
@codecov
Copy link

codecov bot commented Jun 2, 2019

Codecov Report

Merging #3847 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #3847      +/-   ##
==========================================
+ Coverage   84.94%   84.94%   +<.01%     
==========================================
  Files         376      376              
  Lines       70157    70164       +7     
==========================================
+ Hits        59595    59601       +6     
- Misses      10562    10563       +1

@ajdapretnar ajdapretnar removed their assignment Jun 7, 2019
@janezd janezd merged commit 21e36d2 into biolab:master Jun 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Legend in visualizations: display datetime as datetime
3 participants