Assigning unique, fixed, colors to shapes based upon custom prop t

C

Chris Wiesner

I am trying to assign unique, fixed, colors to shapes based upon custom
property tags. When I drop the shape onto the page, I have it structured
such that it prompts for the, fixed list, value of that custom property
(e.g., property name = "Owner"). Based upon that selection, I'd like
specific "Owners" to be assigned specific colors (e.g., all shapes owned by
"John" are colored blue). I am not a neophyte to smart shapes, or to minimal
VBA programming, but I am having some difficulty here and any pointers to
instructional aids would be welcome (e.g., web pages, books, etc.).

I found this neat Add-On, "Colors by Value..." (Tools | Add-Ons | Building
Plans | Colors by Value), that almost seems to do what I want (it even
auto-creates a nice legend). Trouble is that the colors are always
auto-assigned at each invocation. They can be later changed, but this is
tedious and has to be done again for each new drawing. There is a feature in
that Add-On, "Import Data..." who's exact function hints at a way for me to
get that "fixed" color data into the objects (e.g., via an external MS Excel
spreadsheet), but the minimal instructions I've found on it is not very
detailed and is somewhat confusing. Any help in that arena would be equally
welcome (even if it's along the lines of "You don't want to use that Add-On
to achieve your goal" ;-).

Thanks in advance folks.
 
M

Mark Nelson [MS]

Take the legend and drag it over to a custom stencil (such as My Shapes).
Then when you drag it back out into a drawing, everything should be
configured already.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
C

Chris Wiesner

Thanks Mark,

Yes, I did this earlier and I can get 80% of the way there doing this.
However, a couple of things:
1) The Legend remains "fixed" in the sense that all "owners" are listed in
the legend even if the drawing that I dropped the Legend onto is only
displaying shapes from a few. Were I to use the AddOn directly (i.e., not
drop the legend from the stencil), only those Owners who had shapes on the
drawing would have been listed (but then, of course, the colors would be
reset). Selecting "Refresh" on the legend only seems to refresh the count of
objects, not the number of line items on the legend.
2) There seems to be some type of re-formatting that goes on, during certain
operations (which I have not been able to localize), in the "Description"
column of the legend where the text ends up getting severly left-justified
(i.e., hardly any indent space). By accessing the individual text boxes and
altering their paragraph indent value, I can correct for this, but as I say
some type of operation periodically reformats that column.
3) Ideally, I would like the object's color to change immediately after I
change it's Owner, although I admit this is much less of a concern and I can
live with the legend "Refresh" method.

Thanks again for your time.
 
M

Mark Nelson [MS]

I think you just need to chose which option gets you the closest to your
goal and offers the least rework.

It sounds like what you really want can be done using the Color By Value
feature in Data Graphics - coming later this year in Visio 2007.

http://blogs.msdn.com/eric_rockey/archive/2005/12/14/503483.aspx

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
C

Chris Wiesner

Yes, I am comming to this conclusion as well. (one of the other issues that
I encountered was the difficulties and rework required when a "new" owner is
added to the list). I'll look forward to seeing the new features of Visio
2007.

By the way, is there a better description of the "Import Data..." feature of
this add-on? Most of the help screens I've seen that refer to it say
something like "Use this button to import data" :-( The one, somewhat
detailed description that I found, gave the mechanics of how to use it but
not much info on *why* or *when* one should use it (i.e., what problem does
this *solve*?). It hinted that it could be used to add data to *other*
(pre-existing) custom property fields using the "Owner" as the key. I
thought that might be a good way to get color information into the object,
but when I tried to use it in that way, nothing appeared to happen. What I
was more interested in would be a small example that illustrated its
usefulness.

Any recoomendations on good (i.e., thorough and detailed) Visio "internals"
types of books?

Thanks again for the info, I appreciate your time and I'll try to make this
the last post for information on this subject.

Chris
 
M

Mark Nelson [MS]

Import Data in Visio 2003 is a flexible wizard for adding data to a diagram.
The data is added to custom properties on shapes. The wizard provides
several ways to add the data. You can add data to existing shapes using a
matching scheme to determine what data goes where. You can also add data to
new shapes. Finally you can add data to new shapes which drop on existing
shapes. Confusing? Basically you want the first option most of the time.

Why import data? You either use it to logically control your diagram or you
display it as part of the diagram. Color by Value is an example of using
the data to control the diagram - in this case the color of shapes. The
Label Shapes add-on is a way to display the data as part of the diagram.

For Visio 2007, we wanted not only to make importing data even easier, but
also to make displaying that data easier. We tried to emphasize the use of
the data as much as the connection to data.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top