Apache OpenOffice (AOO) Bugzilla – Issue 82971
Hierarchical axis labels
Last modified: 2015-11-09 17:30:01 UTC
If opened in MS Excel, the charts in this spreadsheet show proper labels/legends under the vertical bars along the x-axis. A small label for each bar, larger for bar sets. In OO 2.3.0.1.3, the bar labels are missing.
Created attachment 49156 [details] Performance Timings
wrong component, changed to chart and re-assigned
@DR: Pls have a look.
Confirming using m241 on WinXP - as described.
I've been looking into this. The reason for this bug is because Calc provides a structured (i.e. 2-dimensional) category label data to chart2 but chart2 renders the label serially. So, we would need to add a way to pass a structured label data from sc to chart2, and add support for rendering multi-layer category labels in chart2's view code.
Excel's behaviour is as follows (as far as I can see the system here...): ** Definitions: - Category = one label on the X axis, refering to a data point in a series. - Level = single row of category labels. May be stacked downwards. Level 1 is nearest to X axis, level N is outermost. - Category source = cell range(s) in spreadsheet used for category labels. - Series source = cell range(s) in spreadsheet used for data point values of a series. If the category source is 1-dimensional (means: contains one single row or one single column of cells), the cell values are applied category by category to the X axis, regardless of the orientation of the series source. If the category source is complex (means: 2-dimensional, or a list of cell ranges, even if this list forms a single row or column!), it is used depending on the orientation of the series source of the first series shown on the first axes set (or second axes set in case of the secondary X axis). - If the series source is horizontal (means: it contains at least one cell range with more than 1 column), the category source is divided into single columns. Each column represents one category on the X axis. - If the series source is vertical (means: it contains only single-column cell ranges and/or single cells), the category source is divided into single rows. Each row represents one category on the X axis. In case the category source is a range list, it is processed range by range from the beginning, and row by row or column by column for each range. The number of levels N on the X axis is the count of the largest row/column of the category source. For each category: Use the cells of the single rows/columns of the category source from last cell (right/bottom) to first cell (left/top), and set the category labels starting from level 1 (nearest X axis) toward level N, as long as there are cells left. If there are less than N cells, the outer levels remain empty. Inside of one cell range of the category source, empty cells are used to merge several categories in a level together. The merged range starts with a non-empty label in the current level, and ends before the next non-empty label in the current level or an higher level. The label is centered in the category range. - Categories are NOT merged in level 1. - Categories are NOT merged over different cell ranges in the category source, even if the cells of the first row/column of the next range are empty. Excel test document will be attached...
Created attachment 52051 [details] test document
Note that Excel 2007 has changed its behaviour in this area. The description above is for Excel 2003. If the attached document is loaded in Excel 2007, the charts in the second and third sheet will not show all X axis labels, or will show completely different labels...
More updates about Excel 2007: - Font spacing for axis labels has been changed, there is more space between the levels now. That is the reason that the last level is missing in some charts on the second sheet of the test document. - Excel does NOT consider the orientation of the series source anymore. If the category source is complex, it is ALWAYS processed horizontally, means column by column. Therefore, in the text document, second and third sheet, the charts in the right column are equal to the charts in the left column.
- Excel 2007 merges the category labels over different source ranges, if they contain empty cells or if some columns are shorter than others.
Ok, again, complete specification for Excel 2007. Different behaviour to Excel 2003 is marked with (**). If the category source is 1-dimensional (means: contains one single row or one single column cells), the cell values are applied category by category to the X axis, regardless of the orientation of the series source. If the category source is complex (means: 2-dimensional, or a list of cell ranges, even if this list forms a single row or column!), the category source is divided into single columns (**). Each column represents one category on the X axis. In case the category source is a range list, it is processed range by range from the beginning, and column by column for each range. The number of levels N on the X axis is the height of the largest column of the category source. For each category: Use the cells of the single columns of the category source from bottom cell to top cell, and set the category labels starting from level 1 (nearest X axis) toward level N, as long as there are cells left. If there are less than N cells, the outer levels remain empty. Empty cells are used to merge several categories in a level together. The merged range starts with a non-empty label in the current level, and ends before the next non-empty label in the current level or an higher level. The label is centered in the category range. - Categories are NOT merged in level 1. - Categories ARE merged over different cell ranges in the category source (**). even if the cells of the first row/column of the next range are empty. - Categories are NOT merged in the free area, if there is not enough data to fill all categories on the X axis (**). If a level is completely empty, it will be skipped. The X axis will not show an empty line beteeen other levels. New test document will be attached... I prefer the new behaviour, as it is not that complicated.
Created attachment 52052 [details] New test document showing differences between Excel 2003 and 2007
DR->IHA: Filter does work correctly, chart implementation needs to be fixed.
@dr: wow. You're very thorough, as always. :-)
Made summary more descriptive, adjusted target, type and keyword
started
Fixed in CWS chartmultiline. Added a new button to the charts own data table for creation of additional text columns: Changed specification http://specs.openoffice.org/chart/ChartDataDialog.odt Wrote issue 108777 and issue 108778 for adaption of the test scripts and documentation.
The algorithm implemented is straight forward: If the categories do span multiple rows and multiple columns, the direction of the first data series is detected. If the data for the first series comes from rows, the categories are split into multiple rows. Otherwise the categories are split into multiple columns. The split categories are then applied as different hierarchical levels at the x-axis. This algorithm does not produce exactly the same results for all the border cases shown in the attached example document chart_sourcedata_category_.... But at this state I assume that it is not worth the effort to make the algorithm extreme complex for those exotic scenarios. Future may tell more. I'll attach an example document showing more typical everyday examples 'HierarchicalAxesLabel.xls'.
Created attachment 67616 [details] example test document with typical cases
A new interface ::com::sun::star::chart::XComplexDescriptionAccess was introduced. It allows to set sequences of sequences of strings as row or column descriptions for the tabular chart data. You can obtain the new interface by method getData() at interface css.chart.XChartDocument.
@Thomas, please verify in CWS chartmultiline.
Seen ok in CWS chartmultiline -> verified
Wow. Lots of great work here guys. Many thanks on behalf of the user community!
integrated -> closed