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

Some charts allow selecting entities for which there is no data #1341

Closed
danielgavrilov opened this issue Mar 30, 2022 · 6 comments · Fixed by #2763
Closed

Some charts allow selecting entities for which there is no data #1341

danielgavrilov opened this issue Mar 30, 2022 · 6 comments · Fixed by #2763

Comments

@danielgavrilov
Copy link
Contributor

Description

Some StackedArea charts show entities in select dialog that we seem to have no data for:

Expected behaviour

Entities without (plottable) data should not be listed in select dialog for StackedArea.

@larsyencken
Copy link
Contributor

Guesstimating at 1d, but it could be more complex than that.

@larsyencken
Copy link
Contributor

Reviewed again with @danyx23, we still think this is important to fix

@sophiamersmann
Copy link
Member

For reference, here is another example where this is an issue:

(The first example given above actually looks fine to me, the second one is a broken link)

@sophiamersmann
Copy link
Member

sophiamersmann commented Mar 16, 2023

I did an investigation into this one but can't actually fix it. I'll drop my findings here.

The gist is: The select dialog and the chart are based on two different tables – the chart is based on the transformed table, but the select dialog is based on the input table. The select dialog thus displays all entities that exist in the input table. But: In the case of stacked area charts, the transformTable function sometimes deletes all data that is available for a single entity – and no chart can be rendered. In such cases, an entity would show up in the select dialog that has in fact no plottable data.

In the examples I looked at, this function call often seemed to be the "offending" one in the transformTable function:

table = table.dropRowsWithErrorValuesForAnyColumn(this.yColumnSlugs)

It drops rows when any column is missing. If a stacked area charts displays, for example, four different variables and one happens to be missing for an entity, than all data would be discarded and no chart plotted. This is what happens here:

https://ourworldindata.org/grapher/population-breakdown-by-highest-level-of-education-achieved-for-those-aged-15-in?country=~ABW

Aruba comes with data for the variable "Population aged 0-14" only, which means that no stacked area chart can be plotted. (But Aruba shows up in the select dialog as it is does exist in the input table!)

@marcelgerber
Copy link
Member

For future reference: There's some discussion around this in this Slack thread.

@sophiamersmann sophiamersmann self-assigned this Mar 30, 2023
@sophiamersmann sophiamersmann removed their assignment May 4, 2023
@sophiamersmann sophiamersmann changed the title StackedArea allows selecting entities for which there is no data Some charts allow selecting entities for which there is no data Aug 14, 2023
@sophiamersmann
Copy link
Member

Note of a discussion in today's Grapher Hour (Marcel, Christian, Sophia):

  • Properly fixing this would involve changes to data processing in Grapher
    • There is proposal to pull data transformation out of chart components
    • The proposal is one piece of Modular Grapher
    • It's not clear if/when we would start implementing this
  • A dirty/temporary fix could involve:
    • Each chart (if necessary) filters the input table for entities that are actually available (i.e. have plottable data)
    • The table for selection could be passed to Grapher via a property on the manager
  • Might be good to wait for the entity picker redesign before working on this bug

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.

5 participants