This is a migrated thread and some comments may be shown as answers.

Save Rad diagram as image

1 Answer 91 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 1
Ron asked on 15 Dec 2014, 04:41 AM
I am using Raddaigram to generate a network diagram. But I am not able to save that as image. I need to save that as image such as png or jpg, as I need to include that in  a pdf report.

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 16 Dec 2014, 02:52 PM
Hi Ron,

I have already answered you ticket on the subject, for convenience I will paste my answer here as well:

I afraid that I will need to disappoint you, but currently the desired expor-to-png functionality cannot be achieved out-of-the-box with RadDiagram.

A possible approach you can use could be to convert the Diagram SVG element to canvas, so you can use its base64 string after that and created the needed image. You can use a similar logic to achieve it:

<telerik:RadDiagram ID="brackets" runat="server" Width="900" Height="500">
    ...
    <ClientEvents OnLoad="diagram_load" />
</telerik:RadDiagram>
<script>
    function diagram_load(sender, args) {
        var diagram = sender.get_kendoWidget();
        draw_diagram(diagram, $telerik.$("#drawing"));
    }
    function draw_diagram(diagram, element) {
        var surface = kendo.dataviz.drawing.Surface.create(element, { type: "canvas" });
        surface.draw(diagram.canvas.drawingElement);
    }
</script>
Please note, that the RadDiagram API will be changed a lot in our up-coming Q1 release as a part of the control's improvement, so you will need to update the above provided logic when/if you upgrade to it.


Regards,
Vessy
Telerik
Tags
Diagram
Asked by
Ron
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or