New to Kendo UI for jQuery? Download free 30-day trial

Prevent Zoom in Diagram

Environment

Product Progress® Kendo UI® Diagram for jQuery
Created with version 2020.2.617

Description

I am trying to disable zoom on a diagram I am building. I set the zoom property to 0 and it works. Unfortunately, it crashes the PDF export with the following error:

Cannot output NAN to PDF

Solution

The issue seems to be with values that are equal to or less than zero. I logged a public issue so we can fix this internaly. Menawhile, you can use the zoomRate property set to 0 instead.

    <button id="exportBtn">Export</button>
    <div id="diagram"></div>
    <script>
        $("#exportBtn").on("click", function(){
            var diagram = $("#diagram").getKendoDiagram();
            diagram.exportPDF({
              paperSize: "A4",
              landscape: true
            }).done(function(data) {
              kendo.saveAs({
                dataURI: data,
                fileName: "diagram.pdf"
              });
            });
        });

        $("#diagram").kendoDiagram({
          dataSource: {
            data: [{ "items": [{ items: [{}] }] }],
            schema: { model: { children: "items" } }
          },
          zoomRate:0,
          layout: {
            type: "tree"
          }
        });
    </script>
In this article