Is it possible to programmatically create a graph image and save it using the API?

Feb 14, 2012 at 4:52 PM
Edited Feb 14, 2012 at 5:14 PM

Hi,

First I want to thank you guys for this great library.

In my application I need to run a clustering algorithm and then I want to generate the images of my clusters automatically to be displayed else where like in web page or used in PowerPoint,...etc. 

I couldn't figure out a way to do it using the API, it seems that there is no function. if there is not could you please point me to the code in NodeXL that saves images in the UI version, so I can modify it or make public. 

Thanks in advance.

:)

Feb 14, 2012 at 5:17 PM

Oh,

I looked in the code it seems that it is only possible to copy CopyGraphToBitmap from a control.

I'll first creat a hidden ctrl and use it to save my images, as first workaround, and see if it will work. :)

Feb 14, 2012 at 5:45 PM

If you are already using the NodeXLControl, then the CopyGraphToBitmap() method will work fine.  If your application does not have a UI, you can use the lower-level NodeXLVisual class instead.  You'll find sample code for saving an image within the NodeXLVisual topic in the NodeXLApi.chm help file.  The help file is contained in the latest "NodeXL Class Libraries" download at http://nodexl.codeplex.com/releases.  (You do not need the NodeXL source code, unless you plan to customize the source code.)

Note that laying out vertex groups in boxes (sometimes called "group-in-a-box") is not currently supported by NodeXLVisual.  Otherwise, you can do most things at the NodeXLVisual level that you can with the NodeXLControl.

-- Tony

Feb 15, 2012 at 1:38 AM

Hi Tony,

Thank you very much for the quick answer,

I'll give it a try :).