how to set label fillcolor, API

Feb 3, 2012 at 10:05 PM

The label fill color used to be transparent. Now I'm using the latest version and it change to a semitransparent white. So I thought it not a biggy an set the fill color explicite.

oVertex2.SetValue(

ReservedMetadataKeys.PerVertexLabelFillColor, System.Windows.Media.Colors

.Transparent);

 I'm using the labels not as the shape of  the vertice. In older post I found Primary and Secondary label attributes that distinguished between labels in addition to shapes or labels instead of shapes. So how can I change the fill color?

Thanks

Jan

Feb 4, 2012 at 5:41 AM
Edited Feb 4, 2012 at 5:41 AM

Jan:

The label background did indeed used to be transparent, but we found that that made the text difficult to read in densely populated graphs.  If the text landed on top of another vertex, it was sometimes illegible.  We fixed this by adding a semi-transparent rectangle behind the text.  The background rectangle is the same color as the graph's background (which is white by default), but with an alpha value of 220.  Now, if a label falls on an empty area of the graph, it looks just like it used to, but if it falls on top of another vertex, there is some background contrast that improves legibility.

This can't be changed without recompiling the source code, which is available as a separate download on the Downloads tab at http://nodexl.codeplex.com/releases if you ever need it.  The relevant constant is BackgroundAlpha in VertexLabelDrawer.cs.

As documented in the NodeXLApi.chm help file, the ReservedMetadataKeys.PerVertexLabelFillColor value is "used only if the vertex has the shape VertexShape.Label and PerVertexLabel is specified."  It is not used for label annotations, which is the type of label that you are using.

-- Tony

Feb 4, 2012 at 7:22 AM

Mmmh I found the opposite. The semitransparent labels ovelap the edges in very dense networks which looks like a white ball in the end. Ok then I will re-compile.

Many thansk for your great help!!!!!