Extend Legend Options

Issue #65 resolved
Daniel Marsh-Patrick repo owner created an issue

Meagan Longoria wrote a really nice post about the visual, and one of the things she did to improve readability was to overlay her own legend, explaining the points within the violin:

meagan-longoria_violin-plot-barcode.png

This could be really useful for end-users and we should try to incorporate such a feature.

Current behaviour is as follows:

  • If the plot contains categories, and the user opts to apply colours by category, then the Legend menu becomes available.
  • Legend will display colour and name of each category.
  • There is no interactivity or cross-filtering to consider at this time.

The intended solution is to use the existing legend space and functionality, so behaviour will be modified to the following logic:

  • Legend will be enabled by default.
  • Note that the legend utils do not support shapes other than circles very well; other visuals with different shapes do some post-processing on them prior to render. We'll do the same thing.
  • Category behaviour:
    • An option will be added to toggle categories on and off.
    • For a single category or multiple categories with the same colour, the legend will display the measure name and the colour as a normal legend item.
    • For multiple categories with individual colours, the legend will work as it does currently.
    • The category shape will be replaced with a simple 'violin' rather than a circle.
  • Statistical Data Indicators behaviour:
    • An option will be added to toggle stat indicators on and off.
    • Properties will be provided to customise the displayed text for each data point.
    • Only the intended data points for the relevant combo plot will be shown.
    • Barcode Data Point:
      • If the barcode plot is enabled, the barcode line stying will be used as the legend icon
      • We will use Individual Data Point as the default name, but we'll add a property to allow the user to override with their own description.
    • Mean:
      • If the mean is enabled, the circle will be replicated in the legend as formatted in the plot, i.e. circle with inner/outer colouring
      • The shape will be surrounded with a fill matching the fill of the box plot.
    • Median:
      • If the median is enabled, the legend icon will be the line and styling used for the median as per the properties
      • The shape will be surrounded with a fill matching the fill of the box plot. If using a barcode plot then this will be the fisrt used category colour for the violin.
    • Quartiles:
      • If quartiles are enabled, and both are the same colour and line style, then we will display 1st & 3rd Quartiles, with the line styling. Same rules for median in terms of background colour.
      • If quartiles have different styling to each other, then we'll display individual legend points for 1st Quartile and 3rd Quartile respectively.

Official response

Comments (8)

  1. Daniel Marsh-Patrick reporter

    I'm some way towards getting this done, but I'm going to bump it to 1.3.0, particularly given that #67 is ready to go and needs wrapping up

  2. Daniel Marsh-Patrick reporter

    Some examples of how this looks:

    Legend Oriented On Left

    65 - Barcode Left Legend One Colour.png

    Legend Oriented At Top (With Multiple Categories and Different Quartile Configuration)

    65 Barcode Top Legend Multiple Colour.png

    Editing Properties

    65 - Edited Properties.png

  3. Daniel Marsh-Patrick reporter

    I've passed to Meagan to have a look and she's had some suggestions which have been resolved, so this one's good to go.

  4. Log in to comment