Bug Hunting Session
Bug 117162 - REPORTBUILDER - Chart isn't shown in report
Summary: REPORTBUILDER - Chart isn't shown in report
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
Keywords: bibisected, bisected, regression
: 115410 117313 (view as bug list)
Depends on:
Blocks: 101016 107536 Database-Reports-Builder
  Show dependency treegraph
Reported: 2018-04-22 16:11 UTC by Robert Großkopf
Modified: 2019-12-13 08:41 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:

Execute the report "charttest" - no charts were shown. (38.39 KB, application/vnd.oasis.opendocument.database)
2018-04-22 16:11 UTC, Robert Großkopf
chart type dialog from generated odt file. (213.59 KB, image/png)
2018-04-22 18:41 UTC, Drew Jensen

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Großkopf 2018-04-22 16:11:00 UTC
Created attachment 141543 [details]
Execute the report "charttest" - no charts were shown.

Open the attached database.
Execute the report "charttest".
If you do this with LO and versions before two charts will be shown.
LO and all newer versions up to LO won't show the chart.

Its the same buggy behavior as it has been fixed since LO 4.3.6.

Tested with OpenSUSE 42.3 64bit rpm Linux
Comment 1 Drew Jensen 2018-04-22 18:40:48 UTC
Confirmed with both 
Build ID: 66c02d16dd078613e754dcc775f366413fad13f0
Version: Version:
Build ID: e58dc868a6ac0df24adf88f32f90a9e4fc6fdae9

The report does not display the chart and if you edit the odt file you find the chart objects are in the file, but display no parameter information. Chart type dialog is blank, Data range is all empty controls. 

I see a number of open issues dealing with charts in reports ie. https://bugs.documentfoundation.org/show_bug.cgi?id=87012

This looks perhaps different.
Comment 2 Drew Jensen 2018-04-22 18:41:51 UTC
Created attachment 141548 [details]
chart type dialog from generated odt file.
Comment 3 Xisco Faulí 2018-04-23 11:38:30 UTC
Regression introduced by:

author	Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>	2017-02-26 22:48:06 +0100
committer	Tomaž Vajngerl <quikee@gmail.com>	2017-04-04 13:39:29 +0000
commit	9009663deb8f0862f419fd99bf0b761c7f923eff (patch)
tree	ea25976de0919f9d2161037d83be0eace4c1070b
parent	1931b5b01c6fdaa204d26ec4b9675dad16373cf2 (diff)
tdf#83257 [API-CHANGE] Pivot chart implementation
This is a squashed commit of the pivot chart implementation.

Bisected with: bibisect-linux-64-5.4

Adding Cc: to Tomaž Vajngerl
Comment 4 Drew Jensen 2018-04-28 22:51:17 UTC
*** Bug 117313 has been marked as a duplicate of this bug. ***
Comment 5 Juan María 2018-04-29 18:00:55 UTC
Steps to Reproduce:
1. In LibreOffice Base create a table with some data (two fields at least) or a query.
2. Create a report with the ReportBuilder.
3. Insert a chart in the report body and choose the source data for the chart (the table or the query of point 1).
4. From menu: Edit -> Run the Report (at menu bottom).
5. It's expected the chart is OK in a Writer document.
6. Save the report.
7. Close the report.
8. Open the report from Base main screen to check that now there isn't any chart visible.
9. Edit the report.
10. Once more from menu: Edit -> Run the Report (it's in menu bottom) to check that there isn't any chart visible as well.
11. Doubleclick on the chart and select data range (Menu -> Format -> data ranges (at menu bottom)) to check now the data fields are missing.
12. Another check: from chart properties menu, choose match master fields and check that fields from chart data source are missing.

Because the chart is displayed correctly before saving the report, I think the issue could be in saving the report or in reading the chart data when the report is executed after it's been saved.
Comment 6 Julien Nabet 2019-06-26 15:00:40 UTC
On Win10 with master sources updated today, I could reproduce this.

I noticed these specific logs:
warn:legacy.osl:7248:34908:chart2/source/model/filter/XMLFilter.cxx:576: Exception caught!
warn:chart2:7248:34908:chart2/source/view/main/ChartView.cxx:1405: DBG_UNHANDLED_EXCEPTION in void __cdecl chart::`anonymous-namespace'::lcl_setDefaultWritingMode(const class std::shared_ptr<class chart::DrawModelWrapper> &,class chart::ChartModel &) exception: com.sun.star.beans.UnknownPropertyException message: PageStyle context: class reportdesign::OReportDefinition
warn:chart2:7248:34908:chart2/source/view/main/ChartView.cxx:495:  com.sun.star.lang.IndexOutOfBoundsException
warn:chart2.tools:7248:34908:chart2/source/tools/WrappedPropertySet.cxx:137: found no inner property set to map to
Comment 7 Julien Nabet 2019-12-08 12:51:18 UTC
noticing warn:legacy.osl:151246:151246:embeddedobj/source/commonembedding/persistence.cxx:209: Consider implementing interface XInitialization to avoid duplicate construction, I tried to implement this.
+ warn:legacy.osl:152196:152196:chart2/source/model/filter/XMLFilter.cxx:574: Exception caught!
I noticed this was due to:
   301     m_xDatabaseDataProvider.set(m_xModel->getDataProvider(),uno::UNO_QUERY_THROW);
    302     if ( !m_xDatabaseDataProvider->getActiveConnection().is() )
    303         throw uno::Exception("no active connection", nullptr);
See https://opengrok.libreoffice.org/xref/core/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx?r=f13c6ad5#303

I could confirm this when moving this block some lines after in following "if"
"if ( !sCommand.isEmpty() )"

Indeed, when creating a report with just by default chart, it doesn't create a command (since there's no SQL). However, when reopening the report, instead of 1 graph, I had 3.

So I thought about implementing "XInitialization" and retrieving the connection.
Here's the beginning:
diff --git a/reportdesign/inc/ReportDefinition.hxx b/reportdesign/inc/ReportDefinition.hxx
index 436550c9aa3f..1e4d9d663d4b 100644
--- a/reportdesign/inc/ReportDefinition.hxx
+++ b/reportdesign/inc/ReportDefinition.hxx
@@ -32,6 +32,7 @@
 #include <com/sun/star/frame/XTitle.hpp>
 #include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
 #include <com/sun/star/frame/XUntitledNumbers.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XTypeProvider.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -65,6 +66,7 @@ namespace reportdesign
                                                     ,   css::document::XDocumentEventBroadcaster
                                                     ,   css::lang::XServiceInfo
                                                     ,   css::frame::XModule
+                                                    ,   css::lang::XInitialization
                                                     ,   css::lang::XUnoTunnel
                                                     ,   css::util::XNumberFormatsSupplier
                                                     ,   css::frame::XTitle
@@ -171,6 +173,10 @@ namespace reportdesign
         /** this function is called upon disposing the component
         virtual void SAL_CALL disposing() override;
+        // css::lang::XInitialization
+        virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
         explicit OReportDefinition(css::uno::Reference< css::uno::XComponentContext > const & _xContext);
         explicit OReportDefinition(css::uno::Reference< css::uno::XComponentContext > const & _xContext

diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 296419e4f2db..aed2ec364a83 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -587,6 +587,17 @@ OReportDefinition::~OReportDefinition()
+void SAL_CALL OReportDefinition::initialize( const uno::Sequence< uno::Any >&  rArguments )
+    fprintf(stderr, "TODO OReportDefinition::initialize\n");
+    uno::Reference<sdbc::XConnection> xCon(getContext()->getValueByName("ActiveConnection") ,uno::UNO_QUERY);
+    setActiveConnection(xCon);
+    ::comphelper::NamedValueCollection aArguments( rArguments );
+    uno::Sequence< beans::PropertyValue > aProps;
+    aArguments >>= aProps;
+    attachResource("", aProps);

The pb is I don't know how to retrieve connection in brand new "OReportDefinition::initialize" method.
Any idea?
Comment 8 Buovjaga 2019-12-13 08:41:34 UTC
*** Bug 115410 has been marked as a duplicate of this bug. ***