Vertex label size and color

Jun 1, 2011 at 4:56 PM

Hi,

It appears that I can set the edge label text size and color in the NodeXL spreadsheet, but can't set these for the vertex labels.

 

I can change the vertex label font from the Graph Options menu, but this doesn't get saved or recorded in the spreadsheet. I'd like to be able to populate a spreadsheet with this font information encoded so it doesn't need to be done manually every time. Is there a way to do that? Also (for my information), how do you set the default size for the vertex label text?

 

thanks

 

/patti

Jun 1, 2011 at 5:51 PM
Edited Jun 1, 2011 at 6:14 PM

Hi, Patti:

NodeXL has two types of vertex labels -- label shapes, where the vertex has its Shape set to Label and the label text gets shown inside a box, and label annotations, where the vertex Shape is some other shape (Disk, for example) and the label text gets shown next to the shape.  Which are you using?

-- Tony

Jun 1, 2011 at 6:09 PM

label annotations

Jun 1, 2011 at 6:28 PM

These instructions apply to version 1.0.1.165 or later of NodeXL.

To change the default font and font size for vertex label annotations:

1. Click Graph Options at the top of the graph pane.

2. In the Graph Options dialog box, click Labels.

3. In the Label Options dialog box, click Font.

4. In the Font dialog box, select a font and font size.

Starting with version 1.0.1.165 of NodeXL, these options get stored in the workbook, in a hidden table.  They will be there when you close and then reopen the workbook.

To apply these changes to all new NodeXL workbooks you create:

1. In the Excel Ribbon, select NodeXL, Options, Use Current for New.

To apply these changes to another NodeXL workbook you've already created:

1. In the Excel Ribbon, select NodeXL, Options, Export, and enter the name of a NodeXL options file.

2. Open another NodeXL workbook.

3. Select NodeXL, Options, Import, and select the NodeXL options file you exported to in step 1.

-- Tony

Jun 1, 2011 at 7:03 PM

Thanks, Tony,

You mean the hidden table is 'unhidden' when I re-open the notebook? Is there any way to see or modify this hidden table?

The "Use current" and options export are features I didn't know about; very helpful, thanks!

 

/patti

Jun 1, 2011 at 7:16 PM
Edited Jun 1, 2011 at 7:19 PM

Patti:

I shouldn't have confused the issue by mentioning the hidden table, because it's not anything people need to be aware of and it's in a format that is neither understandable nor editable.  Just know that anything you set in Graph Options, as well as in other NodeXL dialog boxes, gets saved with the workbook.  That means that if you set the font to Arial 10 in Graph Options, save the workbook, reopen the workbook, and open Graph Options again, the font for the workbook will still be Arial 10, regardless of what you've set the font to in other NodeXL workbooks.  Put another way, each workbook gets its own set of options, and the options "travel" with the workbook.  Give the workbook to someone else, and she'll get the Arial 10 in that workbook, too.

This was a major change in version 1.0.1.165.  Options didn't used to work this way, and the old way caused a number of problems.

-- Tony

Jun 1, 2011 at 10:08 PM

okay, I see now. What I was trying to figure out was, is there a way (like an api) to write a NodeXL workbook directly from a database, along with all the vertex and edge data, so that when someone opened it up, all the attributes would already be set. 

 

Is there a way to create a workbook without opening a template and importing data (or entering data directly)?

 

thanks again, you've been really great today.

 

.patti

Jun 1, 2011 at 11:24 PM
Edited Jun 1, 2011 at 11:28 PM

You didn't mention that you were a programmer.

The workbook options are stored in a hidden table called Per-Workbook Setting on a hidden worksheet called Misc.  The options are stored as XML, and unfortunately the XML string sometimes has to be split among multiple cells to work around a maximum cell size in Excel.  My comments still hold: you don't want to mess with any of this.

As to your main question, there are at least three ways to write to a NodeXL workbook directly from a database.  First, you could use any of several languages to program the Excel Object Model (http://msdn.microsoft.com/en-us/library/wss56bz7(v=VS.100).aspx).  Using this technique, you could tell Excel to create a workbook from the NodeXL template, then programmatically fill in the workbook with the data from your database.  I don't recommend this, because it requires intimate knowledge of the NodeXL workbook's structure -- worksheet names, table names, column names, and so on -- any of which could change in the future and therefore break your code.

A second, similar technique is to use the Open XML SDK (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0&DisplayLang=en to write to the workbook, the difference here being that you don't need Office to be installed to do this.  I don't recommend this technique, either, for the same reasons.

What I do recommend is to write a custom graph data provider for NodeXL.  When you do this, you get your own menu item in the NodeXL, Data, Import menu, and that custom menu item can get whatever data you want from your database and pass it to NodeXL, which populates the workbook for you.  The data format required by NodeXL is an industry standard called GraphML, which is easy to work with.  See "For Programmers: About NodeXL Plug-Ins" at http://nodexl.codeplex.com/discussions/71182 for details.

-- Tony

Jun 2, 2011 at 10:12 PM

Actually, Tony, I am not a programmer, which is probably why I didn't go to the programmer section of the docs to begin with!

 

I am an analyst, and need to be able to specify to a programmer how to create a workbook. He does not understand SNA (yet!) so I want to make it as easy as possible for him, and first need to be able to give him all the details about what to fill in for the vertex and edges worksheets. 

 

I hope that the documentation will be useful.

 

and (for the record): I  think that if you let people specify edge text font color and size, you should let people specify vertex text label color and size in the workbook.

 

thanks

 

/patti

Jul 18, 2011 at 8:45 PM

Hi, 

I still seem to be having problems with vertex label font size. When I first draw my graph, the labels are practically invisible. I use the 

Graph Options
> Labels..
>>>Font...
 and I have set the size all the way to 72, but still get only what appears to be 8-pt type for the labels.

 

Is there something else that interacts with the label size that could be happening? (Some of my labels are quite long, and I chose not to truncate them, for now).

 

/patti

Jul 19, 2011 at 12:34 AM

Patti:

Do you have the Scale slider at the top of the graph pane set all the way to the right?  If it is slid to the left, everything, including labels, gets shrunk.

-- Tony

Jul 19, 2011 at 12:48 PM

Hi, Tony,

 

ok, I see where that does make the labels visible/thanks.

 

now, is there  way to have different label sizes for different vertices?

 

/patti

Jul 19, 2011 at 5:15 PM

Patti:

For label annotations, which is what you are using, no.  All label annotations are shown using the font size you specify in Graph Options, Labels, Font.

If you were using label shapes, then the font size for each vertex could be controlled using the Size column on the Vertices worksheet.

-- Tony