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

Add overriding of the display settings of indicators so that colors, the display name etc could be set #4040

Closed
Tracked by #3874 ...
danyx23 opened this issue Oct 8, 2024 · 3 comments · Fixed by #4460

Comments

@danyx23
Copy link
Contributor

danyx23 commented Oct 8, 2024

In the ETL every indicator has a few settings that are called the display settings (see the ETL docs). These are very old (they predate the metadata we have for indicators) but still used. One thing they do is e.g. that if you set the display.name of an indicator, this is what Grapher will use to label that indicator in a multi-indicator line chart. Similarly, you can set a color this way.

The display settings make their way into the dimensions object of a grapher config, but the dimensions array is the one part of the grapher config that we can't override with the partial grapher config of an MDim view (since it references indicators by id and is constructed only late in the process).

To make this work well, we'd like to be able to set the various display settings from the mdim yaml file. It's probably the nicest if, in addition to the current way of mapping the dimension to an array of etl path strings, we could also map the dimensions to an array of objects with an id for the etl path string and then a display setting, like so:

views:
  - dimensions:
      source: overview
      metric: per_capita
    indicators:
      y:
        - "grapher/energy/2024-06-20/energy_mix/energy_mix#coal_per_capita__kwh" # current use
        - id: "grapher/energy/2024-06-20/energy_mix/energy_mix#oil_per_capita__kwh" # new use
          display: 
            name: "Oil"
            color: "111111"
      $schema: https://files.ourworldindata.org/schemas/grapher-schema.005.json
      type: StackedArea

Doing things this way would also allow us in the future to add more indicator level overrides per view (e.g. if we want to support data tranform functions in the future or similar).

@rakyi
Copy link
Contributor

rakyi commented Oct 29, 2024

We are still not sure if using the view.config.dimensions instead of the proposed solution wouldn't be better.

@rakyi
Copy link
Contributor

rakyi commented Nov 5, 2024

This is blocking moving Covid charts to mdims, since we need to override color of indicators.

@rakyi
Copy link
Contributor

rakyi commented Jan 22, 2025

Previously, indicators could be specified either as a number (ID) or string (catalog path). Now there is a third option: an object, that contains either id or catalogPath and optionally display.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants