We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Get diagram image programmatically from data

I'm using your chart as elimination diagram in my asp app (https://www.syncfusion.com/forums/129993/play-off-chart-layout-generation) and it works well, but for now I need to get image from this diagram for my reports generation. For this purpose I need to generate image in memory from diagram editor object somehow. I have found several examples but all for windows forms and I also not sure if I could use it without show diagram control in win app.

So, I need (if object node types is different in ASP and Win, then ASP way preferable)
- Create diagram object in memory (without GUI)
- Generate nodes with my logic and add to diagram
- Get chart image from diagram object with generated nodes

How could I accomplish it?

4 Replies

SG Shyam G Syncfusion Team September 5, 2017 03:56 PM UTC

Hi Andrey, 
We can perform exporting only after the diagram is rendered. So currently it is not possible to export without rendering diagram in a browser. You can use third party tools such as phantomjs, nodejs to achieve your requirement. please refer to the below word document file in which we have explained step by step to work with phantomjs to convert diagram into SVG format. 

Please find the below link to know the step-by-step process of creating the npm package. 
Shyam G 

AK Andrey Kucher September 15, 2017 05:43 AM UTC

Hello, this is good idea as far as I can see.

I'm using my server instead of node.js to reuse my code and db connections. I have added aspx page to my site and add Diagram control there, but I have trouble with call $('diagram').ejDiagram('instance') (ejDiagram: methods/properties can be accessed only after plugin creation) in phantom.js till I call ejDiagram method without params. For now I get svg but it is looks void by some cause (I see some content in txt, but page show nothing).

I think problem in my way to get diagram in js, but can't found how to resolve this.

So, please review my files and tell me why does my output is void and how could I fix it?

Attachment: docs_548dc819.7z

AK Andrey Kucher September 15, 2017 07:08 AM UTC

I have found my problem. This is because I'm using wrong div name. After fixing it ot EliminationChart, I have successfully got my svg file. 

Thanks for your suggestion

SG Shyam G Syncfusion Team September 18, 2017 04:03 AM UTC

Hi Andrey, 
Please let us know if you need further assistance on this. 
Shyam G 

Live Chat Icon For mobile
Up arrow icon