Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
BPS 1133 BIRT ControlChartWhenDatasetIsEmpty FeatureSpecification
Contents
Project Summary
This project aims at improving the usability of the charting capabilities.
Requirements/Use Cases
The following requirements were selected from Bugzilla:-
- Set table / chart to hide when no data [Bugzilla id: 204922]
- Ability to warn when a chart is empty [Bugzilla id: 218034]
Feature Specification
Specification
This project requests control by the user to hide or show a chart when there is no data to be displayed. In the current product, the chart is always hidden in this case.
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 label 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" label, 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.
We will add a label element to the chart model. The label's visibility will hold the flag to enable the error message when data count is zero. The label can be used to customize error message, just like title, which supports i18n and font.
Implementation Details
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 developers: 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.