Description: I'm plotting a series of values, scaled against their maximum. For example, the cell D2 contains "=B2/MAX($B$2:$B$27)", and the same repeated through D3:D27. The adjusted cell reference is B2, changed to B3-B27. The important point is that no cell value in column D is greater than 1. But if I try to plot column D on a chart, the upper bound of the chart is 1.2. No value in column D is greater than 1. Why is the chart-bounding algorithm adding that extra space? Steps to Reproduce: 1. Start a new spreadsheet. 2. In A1, enter "0", and in A2, enter "1". Select these two cells. 3. From the menu: "Insert"/"Chart..." 4. A dialog opens up, pertaining to the chart that's already added to the spreadsheet. It's a column chart. Move the dialog out of the way, so you can see the chart. Actual Results: The chart's maximum Y-value is 1.2, even though the actual maximum value in the data range is 1. Expected Results: The maximum Y-value on the chart should be 1, not something larger. Reproducible: Always User Profile Reset: No Additional Info: Slackware-current. I can confirm this on both 6.2.8.2 and 7.0.1 versions of LibreOffice.
Created attachment 166476 [details] The maximum on the chart isn't the true maximum value. This screenshot was done following the "steps to reproduce" I outlined above. LibreOffice version: 7.0.2.2
This is as designed. The automated axis configuration leaves a buffer around the value so that it is not too close to the boundaries of the chart. If you want to remove this buffer, you have to manually configure the axis minimum and maximum.
I would be very interested to read the design document, or the online discussion, about such a visual buffer. And as a counterpoint, the same two values (in the instructions to reproduce) can be plotted as a "percent stacked" chart, with no visual buffer, and it's just as effective. It's the 3rd type of vertical bar chart, in the same dialog. And, checking the "3D Look" box, with the regular vertical bar chart style, renders a 3D chart, with the chart maximum at 1, not 1.2. In fact, the 3D vertical bar and 3D stacked percentage charts look nearly identical, the only difference being the vertical axis values ("1" vs. "100%") and chart rendering adjustments related to the same text. I will attach screenshots to demonstrate all these.
Created attachment 168731 [details] Percent-stacked chart, max is correct at 100%
Created attachment 168732 [details] 3D look, chart max is 1 which is correct
Created attachment 168733 [details] Percent-stacked, 3D look, max is 1 which is correct, also looks very similar to previous attachment
The best way if you want to understand better what is going on is to look at the code: https://github.com/LibreOffice/core/blob/90cc24d4728dc94a30865d3b3af9409d5967b45a/chart2/source/view/axes/ScaleAutomatism.cxx#L923 You can see that the additional space is mentioned in the comment, it is explicitly calculated and not a side effect or a bug. When starting from 0, if the max value is more that the largest tick * 20/21 (so "too close" to the top), another gradation is added. In your example, if the largest value is more than 20/21=0.9539095... then the maximum will be 1.2 and not 1. It has been like this since at least 2007 (code history is more difficult to get before that).
Thanks for your quick reply. So this behavior is at least 13 years old. I've explored further with miscellaneous small values in A1 and B1. I'm guessing that I've never created a chart with sufficiently small values to expose it. As much as I'd like to consider some enhancement(s) for calculating the default min/max chart ranges, the user can already override the defaults with explicitly stated ranges, as you said. Therefore, I'm marking as WONTFIX since it's nothing that needs to be fixed.