Bug 164111 - RFE: new chart type: 'stacked range'
Summary: RFE: new chart type: 'stacked range'
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Devansh Varshney
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Additional-Chart-Types
  Show dependency treegraph
 
Reported: 2024-11-30 21:23 UTC by Dave Gilbert
Modified: 2025-02-28 21:39 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example data and chart (32.34 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-02-26 09:28 UTC, Heiko Tietze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Gilbert 2024-11-30 21:23:41 UTC
Description:
The following video from 'minutephysics' makes the case for a modified stacked barchart they call a 'stacked range':

https://www.youtube.com/watch?v=5zBg9pH_6bE

It looks quite sensible to me.
I *think* it's basically just using the data as absolute Y values rather than summing them
Each colour in the chart runs from that cell value to the next cell value.
The range of a bar is the minimum..maximum values in the range.
There's an assumption I think that the values are sorted (?)

Perhaps this could be implemented with a 'summed' tick box in the barchart UI which defaults to on to give you the current behaviour and unticked to give the new type.

Steps to Reproduce:
1. Enter a column of data like '3,8,12,16,24' and another column -9,3,8,13,27
2. Create a bar chart from the two columns

Actual Results:
The height of each colour in the chart represents a value in the cell

Expected Results:
The lower Y value of each colour in the chart is the value in the cell, the upper Y value is the value in the next cell in the column.


Reproducible: Always


User Profile Reset: No

Additional Info:
charts are pretty.
Comment 1 Eyal Rozenberg 2025-02-25 22:25:16 UTC
I'm convinced this is a useful type of chart. I am not sure, however, whether it should be a different type altogether or a subtype of bar charts (and perhaps also of column charts).
Comment 2 Heiko Tietze 2025-02-26 09:28:39 UTC
Created attachment 199457 [details]
Example data and chart

Sounds desirable but I'm afraid we cannot do it as a chart type. Such new type needs to be standardized and available cross platform and application. Maybe Devansh has an idea.
Comment 3 Regina Henschel 2025-02-26 13:12:23 UTC
(In reply to Heiko Tietze from comment #2)
> Created attachment 199457 [details]
> Example data and chart
> 
> Sounds desirable but I'm afraid we cannot do it as a chart type. Such new
> type needs to be standardized and available cross platform and application.
> Maybe Devansh has an idea.

A chart type is determined by the chart:class attribute (19.15 ODF 1.3) of the <chart:chart> or <chart:series> element. The value of this attribute is a namespaced token. So it is easily possible to introduce a new chart type for "ODF extended". We could use chart:class="loext:min-max-bar", for example.

Introducing a new subtype of the column or bar chart would be possible too. That has been done for the bar-of-pie and pie-of-pie chart types. It has introduced the attributes loext:sub-bar and loext:split-position at the <chart:chart> element. I don't like that solution. I would prefer to have it in the <style:style> element and have a dedicated new chart type, see bug 163921.

We have already min-max bars as opening-closing bar in the stock chart type. Minimum and maximum values are given as separate <chart:series> elements and the fact that a min-max-bar has to be drawn is given by the chart:japanese-candle-stick="true" attribute in the style element of the chart in the ODF file markup. Internally the series are distinguished by the Role property, "values-min" and "values-max" for this case.

For the new proposed chart type, details of an ODF markup has to be discussed. But I see no principle problems with ODF.

I would not call it "stacked", because the term "stacked" includes a summing up. But in the proposed new chart type, several series use the same place on the category axis without summing up their values. Such placement is already possible by using "Overlap=100%" in a column/bar chart. So the only new aspect would be to describe a column/bar by minimum-maximum.

I thing, that the requested chart type is useful.
Comment 4 Devansh Varshney 2025-02-26 18:49:23 UTC
My immediate thought went for adding this as a new chart type when I skim read the request. Now, after looking at what this is and Regina's comment -


 < My Understanding >

'Stacked Range' Chart Type displays ranges (start and end values) for each category instead of stacking values on top of each other.
For example, if our data is [3, 8, 12], each segment of the bar would span from 3 → 8, then 8 → 12, showing the progression or range between consecutive values. Unlike traditional stacked bars (which sum values), this chart emphasizes the distance between data points.

 Key Points (Simplified):    

    1 New Chart Type vs. Subtype:    
        - A new chart type  (e.g., loext:min-max-bar) is better than a subtype.  
        - Subtypes risk compatibility issues (other office suite might misinterpret them).  
        - ODF allows custom extensions (via loext: namespace), so LibreOffice can define this chart type without breaking standards. (eg - loext:Histogram)
         

    2 How It Works in ODF:    
        - Use chart:class="loext:min-max-bar" to mark the chart type.  
        - Existing apps unaware of this type will default to a basic chart (no crashes).
         

    3 Avoid "Stacked" Terminology:    
        - The term "stacked" implies summed values. This chart shows ranges, so a new name is needed. "range bars"?


Likely requires a single series where each bar represents a range (e.g., [min, max] pairs) or multiple series with roles (e.g., values-start/values-end), similar to stock charts?
         

It could be added to the LO. I did ask with Quikee too, but his and my priority right now getting the Histogram Chart working.

After that being done, I can work on adding this.

Will later discuss the specifics of the ODF markup (e.g., using values-start/values-end roles or a single series with paired data) to finalize the implementation.
Comment 5 Dave Gilbert 2025-02-27 14:04:38 UTC
Once there's a prototype we might try running it past Henry Reich of Minute physics who did the video.
Comment 6 Devansh Varshney 2025-02-27 14:08:32 UTC
(In reply to Dave Gilbert from comment #5)
> Once there's a prototype we might try running it past Henry Reich of Minute
> physics who did the video.

Understood :)
Comment 7 Dave Gilbert 2025-02-27 14:09:04 UTC
(I sent a mail to his contact email notifying them about this RFE)
Comment 8 Devansh Varshney 2025-02-27 17:12:37 UTC
(In reply to Dave Gilbert from comment #7)
> (I sent a mail to his contact email notifying them about this RFE)

Henry (minutephysics) will love this <3
Comment 9 Dave Gilbert 2025-02-28 21:39:50 UTC
Henry says:

"
This is awesome and looks like it's all on a great trajectory.

A few supplemental thoughts:
- perhaps something like "multiple range bar chart" or "multi-range bar
chart" would be more descriptive than "stacked range"? (though I've seen
"stacked range" in the one or two other places I've actually seen this
chart mentioned:
https://data-xtractor.com/chart-types/how-to-create-a-stacked-range-bar-chart/
)
- not sure if I'm misinterpreting the thread, but I would HIGHLY advocate
for user input/experience to be a simple column or row of points, rather
than needing to separate out min/max.
- I have not thought about if someone inputs data out of order (say, -1,
-3, 5, 6, -2, 10, etc). Presumably it should auto-sort the data? Or suggest
that the user choose a waterfall chart instead if the data is not sorted?

"