Page MenuHomePhabricator

Bar charts with year on x-axis disrespects different gaps between two consecutive years
Open, Stalled, MediumPublic

Description

Example: https://commons.wikimedia.org/wiki/Data:Rete_tranviaria_di_Bologna_Estensione.Bar.chart

The years are: 1899, 1906, 1921, 1924, 1932, 1939, 1943, 1944, 1945, 1948, 1952

The spacing on the x-axis does not respect the different gaps between two consecutive years.

Event Timeline

simon04 renamed this task from Bar charts with year on x-axis disrespects to Bar charts with year on x-axis disrespects different gaps between two consecutive years.May 4 2025, 9:36 AM
simon04 updated the task description. (Show Details)
Jdlrobson-WMF changed the task status from Open to Stalled.May 5 2025, 1:41 PM
Jdlrobson-WMF triaged this task as Medium priority.

Hi @simon04 hope you had a good hackathon and sorry I didn't get to hang out in person this time (I was meant to go but personal-circumstances made it impossible!)

I'm possibly misunderstanding this so I want to clarify - are you saying there should be a large gap between 1899 and 1906, since there are 7 years between them? If so, I'm curious if it needs to in this situation, given it is a bar chart? Gaps would make the charts less readable.

@CCiufo-WMF what do you think?

Hi @Jdlrobson-WMF, sorry that you couldn't come to the hackathon, I missed you. The hackathon was great. Today I started my adventure back home by bike – approx. 2500km to go.

I was looking through the created charts on itwiki and found plenty of bar charts, where the spacing/gaps of the years is not homogeneous.

I'm possibly misunderstanding this so I want to clarify - are you saying there should be a large gap between 1899 and 1906, since there are 7 years between them?

Yes, maybe. I'm not sure about the best approach. One idea would be to render small bars for the years that are present and leave gaps when no data is available. Would that make any sense? Or are line charts the preferred chart type for those cases?

I think the current behaviour does make sense if you're treating the years as "categories", which is typical of bar charts. It makes less sense when viewing the x-axis as a time series. This goes back to the fact that we don't actually know the x-axis in the example in the task description is for "years", so we treat it the same way we would any other type of generic sequence. There are a few options for a fix here. I'd probably start by recommending using a line chart instead.

I also don't see why this is a problem.

  1. It's the user's role to choose suitable chart types for whatever data they've got. Choosing an inappropriate chart type and then complaining that "it doesn't work" is not really the way to go.
  2. I think this would work fine if you added explicit zero values for the years {1900, 1901, 1902, 1903, 1904} etc.

A line chart also wouldn't work well here, unless you add the missing years, and it'd be better to use a step line chart. I'm not sure whether this is currently available as an option (I suspect not).