Closed lucasrodes closed 10 months ago
Video-summary of the issue
https://github.com/owid/owid-grapher/assets/18101289/c7e8a573-69a3-40a3-bef1-6e022cbba7f0
@lucasrodes if we were to do this we'd do it as a new chart type but for that we'd need more motivation than just this one example. Do you know of other non-connected line chart cases? Closing this as wontfix for now but please reopen it if you think there are several other cases like this
Core problem
video-summary of the issue
Sometimes (not often), we want to build specific LineCharts, where the data points are disconnected from each other or coloured by a categorical variable.
This would allow us to quickly generate interactive charts from charts like this one:
The current workaround
Taking the example above, for each year, we plot the datapoint of the maximum life expectancy, coloured by the country it was registered in.
The result is this one, implemented in https://github.com/owid/etl/pull/1835:
This is achieved by using a ScatterPlot instead:
year
(index)country_year
(index) is the country's and year's concatenation. NOTE: We do this to avoid having interconnected data points in the scatterplot.life_expectancy
: maximum life expectancy registered for the given year.country
: Name of the country where the maximum value was registered. NOTE: This will be used to colour the data points.ScatterPlot
.life_expectancy
as the Y-axis indicator.country
.Note that we are forcing the ETL dataset into a specific structure to fit Grapher's needs. Also, we assume that there will only be one data point for a given year, which is not required from ScatterPlots (but from LineCharts).
Proposed solution
While we have a workaround, we could improve the experience so that we don't have to adapt ETL datasets to specific formats to generate the desired plot.
Instead, I think we should:
For my particular case, I think that just by implementing 1. it would suffice. However, I find 2. also valuable for other instances.