Uncaught TypeError: Cannot read properties of undefined (reading 'bbox')

2 Answers 1641 Views
Charts PDFViewer
sanjin
Top achievements
Rank 1
Iron
sanjin asked on 15 Mar 2022, 02:49 PM | edited on 15 Mar 2022, 06:29 PM

Hi!

I get Uncaught TypeError: Cannot read properties of undefined (reading 'bbox') when i want to save pie and donut as pdf in javascript but all other charts works fine what can the problem be?

 

Regards Sanjin

2 Answers, 1 is accepted

Sort by
1
Accepted
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 18 Mar 2022, 09:32 PM

Hello Sanjin,

First, thank you for providing the Progress Kendo UI Dojo as this helped determine the cause of the bbox error message.

Upon reviewing the onRender method, it appears at the end there's a label attempting to be added to a group.  For the Pie and Donut charts which do not have this line available, the error occurs.  To resolve this issue, conditionally check if the chart is not a pie or donut chart:

JavaScript

      // ritar målvärde per diagram
      function onRender(e) {

        //.....

        group = new kendo.drawing.Group();

        
        //Confirms the type is not a donut or pie
        if (e.sender.options.series[0].type != 'donut' && e.sender.options.series[0].type != 'pie'  ){
          
          //Will add line 
          group.append(line, label);
        }

        // Draw on chart surface
        //
        // https://docs.telerik.com/kendo-ui/framework/drawing/overview
        e.sender.surface.draw(group);

      }

Additionally, please make sure there is only one version of Kendo UI to make sure there are no conflicts with code.  I have created an updated Progress Kendo UI Dojo which demonstrates the above and allows the user to export to PDF the donut and pie charts.  Please let me know if you have any questions.

Regards,
Patrick | Technical Support Engineer, Senior
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

sanjin
Top achievements
Rank 1
Iron
commented on 21 Mar 2022, 10:00 AM

Thank you works fine now!
-1
Hetali
Telerik team
answered on 15 Mar 2022, 08:50 PM

Hi Sanjin,

The Kendo UI Pie and Donut Chart PDF export is working as expected as described in the Saving Chart in PDF article. Here is the StackBlitz example of the Pie Chart demonstrating the same.

Additionally, both the Pie Chart and the Donut Chart can be exported in the same PDF by using the PDF Export component. In this StackBlitz example, I have exported both the Pie Chart and the Donut Chart in the PDF.

To further assist you with this case, could you please update the StackBlitz example or share an isolated Angular application with additional details such that it replicates the error observed on your end?

I also recommend sharing a Fiddler Jam recording which can capture the logs and help me with the investigation.

Looking forward to hearing from you.

Regards,
Hetali
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

sanjin
Top achievements
Rank 1
Iron
commented on 16 Mar 2022, 07:49 AM

Hi Hetali, i'm not using Angular i'm using jQery but i send you code in the dojo and you can look, i have only problem whit the PDF for the Pie and Donut chart  Untitled | Kendo UI Dojo (telerik.com)

 

Regards

Tags
Charts PDFViewer
Asked by
sanjin
Top achievements
Rank 1
Iron
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
Hetali
Telerik team
Share this question
or