Issue 81209 - create chart from filtered data
Summary: create chart from filtered data
Alias: None
Product: General
Classification: Code
Component: chart (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: kla
QA Contact: issues@graphics
Keywords: regression
Depends on:
Reported: 2007-09-02 19:22 UTC by gondwana
Modified: 2013-02-24 21:22 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

Testdocument (12.07 KB, application/vnd.oasis.opendocument.spreadsheet)
2007-09-03 13:08 UTC, frank
no flags Details
patch for chart2 (3.76 KB, patch)
2008-07-10 03:40 UTC, kyoshida
no flags Details | Diff
patch for sc (14.81 KB, patch)
2008-07-10 03:41 UTC, kyoshida
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description gondwana 2007-09-02 19:22:09 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.
Comment 1 frank 2007-09-03 13:07:01 UTC
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.

Comment 2 frank 2007-09-03 13:07:37 UTC
added bm and iha to cc list
Comment 3 frank 2007-09-03 13:08:59 UTC
Created attachment 47927 [details]
Comment 4 bjoern.milcke 2007-09-03 13:20:00 UTC
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

->IHA: Evaluate these properties to hide (== not create) the graphical objects
for hidden values in the view.
Comment 5 niklas.nebel 2007-12-04 18:25:38 UTC
Target 3.0
Comment 6 kyoshida 2008-07-10 03:40:47 UTC
Created attachment 55036 [details]
patch for chart2
Comment 7 kyoshida 2008-07-10 03:41:17 UTC
Created attachment 55037 [details]
patch for sc
Comment 8 kyoshida 2008-07-10 03:41:44 UTC
changing the issue type to PATCH.
Comment 9 kyoshida 2008-07-10 16:24:18 UTC
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.
Comment 10 IngridvdM 2008-07-10 21:32:36 UTC
@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?
Comment 11 kyoshida 2008-07-11 02:55:12 UTC
@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.
Comment 12 IngridvdM 2008-07-11 08:48:18 UTC
Would that allow to make a difference between charts from filtered data and well
charts from 'normal' data? Is that possible at all?
Comment 13 kyoshida 2008-07-11 12:49:30 UTC
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.
Comment 14 kyoshida 2008-07-11 12:53:52 UTC
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.
Comment 15 IngridvdM 2008-07-11 12:57:04 UTC
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?
Comment 16 IngridvdM 2008-07-11 13:06:30 UTC
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 ... .

Comment 17 kyoshida 2008-07-11 14:30:18 UTC
>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.
Comment 18 niklas.nebel 2008-07-11 15:30:32 UTC
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.
Comment 19 IngridvdM 2008-07-11 16:26:27 UTC
@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.
Comment 20 kyoshida 2008-10-02 03:13:06 UTC
taking this over.
Comment 21 kyoshida 2008-10-02 03:13:21 UTC
Comment 22 kyoshida 2008-12-01 21:09:22 UTC
This is now implemented in koheichart01.
Comment 23 IngridvdM 2009-03-04 12:36:21 UTC
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.
Comment 24 IngridvdM 2009-03-04 12:54:31 UTC
Both problems are fixed now in CWS koheichart01.
Comment 25 IngridvdM 2009-04-23 15:05:33 UTC
@kla, please verify in CWS koheichart01.
Comment 26 kla 2009-05-15 13:42:38 UTC
verified, TCS written and will added to issue 91578; Testcase 2 "Hide Cells by
using filter"
Comment 27 kla 2009-08-19 12:49:46 UTC
seen ok in master -> closed