Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 204922

Summary: [Chart usability] Set table / chart to hide when no data
Product: z_Archived Reporter: Pierre Tessier <ptessier>
Component: BIRTAssignee: Yi Wang <yi.wang>
Status: VERIFIED FIXED QA Contact: Tianli Zhang <tzhang>
Severity: enhancement    
Priority: P3 CC: bluesoldier, hchristensen, jerlich, Lionel.wyl, zqian
Version: unspecifiedKeywords: plan
Target Milestone: 2.5.0 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard: Autoed

Description Pierre Tessier CLA 2007-09-28 11:53:08 EDT
A UI checkbox of some type would be nice, and very developer friendly to hide a table or chart when there is no data to display.  Right now this can be done with a small amount of scripting, but it would far easier for a developer to simply check a box and be done with it.

The script to do this manually, is set for the visible hide when expression:

(Total.count() < 1)
Comment 1 Hank Christensen CLA 2009-01-16 17:11:43 EST
We should add a checkbox to the Chart Area page called "Hide chart if there is no data to display".  By default, this checkbox is checked (so that it behaves the same way as charts do today).  

If the checkbox is unchecked, the user wants to show the chart instance when there is no data for that instance.  In this case, we should show the chart, but replace the plot area including axes (or pie for pie charts) with a white rectangle containing the message: "This chart contains no data".  This string needs to be internationalized, and also changeable through scripting.  That way a user can change the displayed message based on some input conditions.

Note that even when a chart displays this "no data" rectangle, it retains its properties unrelated to data such as background color, title, border, etc.  We can even display an empty legend.  The "no data" rectangle will replace all data points, axes, and axis labels.
Comment 2 Yulin Wang CLA 2009-01-18 21:47:51 EST
*** Bug 218034 has been marked as a duplicate of this bug. ***
Comment 3 Yulin Wang CLA 2009-01-18 21:50:37 EST
Will add two properties in chart model and UI.
The first property is to enable error message when data count is zero.
The second property is to customize error message, just like title, which supports i18n and font.
Comment 4 Yi Wang CLA 2009-01-20 23:08:15 EST
In case data empty, i.e. in case the series's data is bound with columns, but the row count of the dataset is zero, the chart will be hidden. Now there is a new choice, an empty message can be displayed on the plot area instead of chart graphics. 

1. Added Label element "EmptyMessage" to the model of Chart, which indicates the message text to be displayed in case data empty. This message text is externalized and by default it's "This chart contains no data".

2. The visible property of the Label "EmptyMessage" is used to select the behavior by data empty. If invisible(by default) the whole chart will be hidden just like before, otherwise the empty message will be displayed.

3. The UI to modify "EmptyMessage" is in the "Chart Area" tab under "Format Chart" task page. There is a new group.

4. Just for developer: Added new helper class LabelLimiter, it can modify the label text (wrapping or shortening with ellipsis) so that it can be fit in a rectangle area. The wrapping width can be correctly computed even if the label text is rotated.
Comment 5 Tianli Zhang CLA 2009-01-22 21:47:45 EST
The new feature works in 2.5.0 v20090123-0630 build. Mark as verified.
Comment 6 Hank Christensen CLA 2009-04-07 19:45:25 EDT
There are problems with the original fix.

1.  The UI does not contain the default message.  The default value for the empty message should be "This chart contains no data"  Right now when I uncheck the checkbox, the message text is blank.

2.  The display of the "empty" chart should still show the axes and chart plot area, just with no bars.  Since it knows the categories, we could show them, but this is no necessary.  Its okay not to display the y-axis labels in this case as well.  Centered in the chart drawing area should be the empty message label, displayed inside a white box with black border.  

3.  We should change the group name "Empty Message" in the UI to be "Conditional Visibility".
Comment 7 Hank Christensen CLA 2009-05-04 14:29:23 EDT
I can see there will be confusion with the way the UI is right now.  Here’s how we can clear it up:
•	Call the group name “Chart Visibility”.
•	Instead of a checkbox, create a radio set.  The first (and default) radio button will say “Hide the chart if there is no data to display.”
•	The second radio button will say “Show the chart with the following message:”
•	Inset the “Text” and “Font” UI slightly to the right so that it appears as if it is associated with the second radio button.
•	The “Text” and “Font” UI will be disabled when the first radio button is selected.
Comment 8 Yi Wang CLA 2009-05-08 02:33:49 EDT
1. Modified the UI according to Comment #7.
2. For ChartWithAxes in no data case, more things will be displayed in plot besides the empty message, include Axis Lines, Axis Titles and Axis walls for 2D+/3D. 
Comment 9 Tianli Zhang CLA 2009-05-12 05:06:04 EDT
Verified in 2.5.0 v20090512-0630 build.