Apache OpenOffice (AOO) Bugzilla – Issue 81209
create chart from filtered data
Last modified: 2013-02-24 21:22:42 UTC
1. create array data (records in rows) 2. records have sorting criteria in columns 3. define xy chart for the whole data array 4. autofilter using the sorting columns Up till OO0 v2.2 the chart would show only the records found by the filter. In OOG680_m2 the chart continues to show the whole array.
Hi Niklas, Björn told me this is an Issue for both Calc and Chart. So please get in contact with him to find out what is needed. Frank
added bm and iha to cc list
Created attachment 47927 [details] Testdocument
As the new chart no longer handles the data as a rectangular block, it is not sufficient to remove the data sequences that are hidden. Instead the chart must get all sequences that belong to the selected region, included hidden ones. For data that is entirely hidden there is the property "IsHidden" that denotes that all data of a data sequence is hidden. If only parts of a sequence are hidden, there is the property "HiddenValues", which is a sequence of indexes pointing to all values of the sequence that belong to hidden regions. ->NN: Make sure that the chart gets the correct data with the properties set correctly. ->IHA: Evaluate these properties to hide (== not create) the graphical objects for hidden values in the view.
Target 3.0
Created attachment 55036 [details] patch for chart2
Created attachment 55037 [details] patch for sc
changing the issue type to PATCH.
A couple of notes about my patches: 1. I treated the HiddenValues property as a read-only property since it seemed to make no sense to set this property externally. 2. I saw the chart2 already skips numerical data according to the HiddenValues property, but not with textual data. So I added that bit. 3. The source data gets flagged "dirty" whenever Calc's column/row size changes because currently rows/columns are considered hidden when their size is zero. There may be a better way to refresh the chart on hiding/unhiding of rows/columns.
@kohei: Would it be possible to change the default bDisplayHiddenCells within chart2 only for charts from filtered data? I could imagine a new property 'DisplayHiddenCells' at the diagram. This could be true per default to match the current behavior. But when a Chart from filtered data is created the Calc sets the property to true. Best would be if that property could be saved and also set by the user, but the file format does not allow for it at the moment. So the question is whether the Calc can set this property again and again at the chart when it is loaded?
@iha: Hello Ingrid. I imagine what you described can be done and is probably trivial to do. I can add additional read-only property DisplayHiddenCells (or should this be DisplayHiddenValues?) and hard-code its value to false for now, then have the chart2 code query this value to make the display of hidden values conditional on the chart2 side. Let me revise my patches to add that bit.
Would that allow to make a difference between charts from filtered data and well charts from 'normal' data? Is that possible at all?
Ah, ok. You mean you want to detect whether the source data is filtered or not filtered at all, to avoid even querying the HiddenValues property if the source data is not filtered ? If I'm understanding you correctly (let me know if I'm not), then, yes, it is possible. I can detect whether the source data is filtered or not during the BuildDataArray() call, and set that flag accordingly, much the same way I build the HiddenValues array. But it can also be detected by simply checking the size of the HiddenValues array. If it's zero, then the source data is not filtered at all.
Or if you mean 'filtered' as in filtered by autofilter or standard/advanced filter, then I would have to dig a little. As long as Calc distinguishes a filtered by the filter functionality or simply hidden, it's possible to reflect that to chart. But I'll have to dig up and see if that's the case. But there is a use case to skip data cells that are simply hidden, not filtered. So we need that functionality too if possible.
Considering following scenario. The user has hidden 3 columns. He creates a chart from a range which includes this hidden columns. Can this scenario be distinguished from the filter scenario?
I absolutely agree with you that we also need the possibility to skip 'simply hidden' cells. But it should be configurable. Users should be able to choose whether they want to display hidden values in the chart or not. It is also configurable in xcel for example. If you are interested in implementing this feature in Chart I would love to give you some hints. There is only the problem with the file format, but maybe we can do something there still ... .
>If you are interested in implementing this feature in Chart I would love to give you some hints. Please do. I'd like some hints. Regarding the required file format change, if it's just one additional boolean property, then it should not be too difficult to make a proposal to the ODF TC.
With the sc patch, all loaded charts are updated on any change to the document. Not just width or height changes, but also cell input outside of chart data ranges. That can be a big performance problem. The initial loading of a chart uses ScChartListenerCollection (mostly the old chart's update logic), which already handles the case when columns/rows are hidden. It would be better to extend that.
@kohei, cool :-) . I created feature issue 91578 for the option to display or not display values from hidden cells. I think it would be good to have that feature and this issue be implemented in the same CWS. I can offer CWS chart30. It's currently on dev300m23 with sc, chart2 and xmloff added.
taking this over.
started.
This is now implemented in koheichart01.
The described user scenario still does not work. What we need is that the chart is created without displaying values from hidden cells. As this is different from the file-format default it is not possible to simply change the property default in the model. In addition - when loading the attached example document a.ods the chart looses the currently hidden parts of the range, so switching the filter condition afterwards does not display the new data within the chart. I will fix both problems.
Both problems are fixed now in CWS koheichart01.
@kla, please verify in CWS koheichart01.
verified, TCS written and will added to issue 91578; Testcase 2 "Hide Cells by using filter"
seen ok in master -> closed