Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: Decebal on September 14, 2017, 08:48:56 AM

Title: Multicolor Number
Post by: Decebal on September 14, 2017, 08:48:56 AM
Hi, all!

I've browsed around this forum in search of a way to have a number where each digit is displayed on specific background according to resistor color code.
The idea is to have a shape with a data property (number). When a number entered, regardless of how many digits, the shape would have each digit displayed on its corresponding background as in the file attached.

The company I work for provided Visio 2007. So compatibility with this version would be preferable.
Title: Re: Multicolor number
Post by: Yacine on September 14, 2017, 03:49:06 PM
 ;)
Title: Re: Multicolor number
Post by: wapperdude on September 14, 2017, 03:52:12 PM
Yacine was a little ahead of me...

Here's my solution.  I set it up so it uses a fixed list for the numbers and colors.  Double click the shape to allow user to enter a number.
The shape seems more complex than necessary.  It could be merely a single shape with the lists, and the value could be field inserted.

Wapperdude
Title: Re: Multicolor number
Post by: Yacine on September 14, 2017, 04:15:47 PM
@W., Your IF-formula is quite long, I prefer my "index(prop.number,user.colorList)". It is easier to maintain (only the list).
Otherwise same approach.
Cheers,Y.
Title: Re: Multicolor number
Post by: wapperdude on September 14, 2017, 04:31:14 PM
@Y:  LOL.  Actually, what you looked at was original "IF".  I just used the existing shape, added 2 User rows at bottom of the User section, modified the Prop statement, and that's about it.

I've updated the file, to show a simpler approach, using just a single shape without all of the additional embellishments.  If nothing else, it's easier to follow the development...

2 User rows.
1 Prop.row
Protect text
Field Insert
Character coloring for dark backgrounds.

So... much simpler overall.

Cheers.
Wapperdude
Title: Re: Multicolor number
Post by: Decebal on September 15, 2017, 09:40:37 AM
Thank you, Yacine and Paperdude, for your solution to my problem.

However I thought about entering a multiple digit number, let's say 8540 and have the result as
BLACK 8 on GREY background followed by
BLACK 5 on GREEN background followed by
BLACK 4 on YELLOW background followed by
WHITE 0 on BLACK background.

Another imput, let's say 123 would give
BLACK 1 on BROWN background followed by
BLACK 2 on RED background followed by
BLACK 3 on ORANGE background.

I didn't know how to do this. I could only do for 1 digit using "color by value" option in Data Graphic. I converted each shape to 1D behavior so I can easily put them on a connector representing a cable between different inputs and outputs of different peice of equipment.

Is it doable my request?
Title: Re: Multicolor number
Post by: Yacine on September 15, 2017, 11:07:07 AM
Download my upload and test the smartshape. ???
Title: Re: Multicolor number
Post by: wapperdude on September 15, 2017, 04:26:16 PM
Since Yacine did so much work, plus anticipated the "growth" need, I made some minor tweaks to his effort in response to last request.

One:  added dbl click to the main shape to bring up the shape data dialog.
Two:  modified the widths of the subshapes such that if their text is hidden, their width shrinks to zero;  otherwise, it's at a fixed, preset value.
Three:  modified the main shape width such that it is no wider than the visible subshapes.
Four:  set the text color to be either black or white
Five:  tweaked some of the background colors for a little improved contrast.

Thanks to Yacine for doing all of the hard work!

Wapperdude
Title: Re: Multicolor number
Post by: Yacine on September 15, 2017, 04:41:52 PM
Thank you Paperdude.  ;D
Title: Re: Multicolor number
Post by: wapperdude on September 15, 2017, 04:45:13 PM
 :D  :o.  ;D ;D ;D
Title: Re: Multicolor number
Post by: Decebal on September 16, 2017, 06:19:57 AM
Hi guys!
Thank you for the beautiful work on this project! It's really impressive what interesting things come up from Visio.
I've downloaded last shape from wapperdude (sorry for the funny misspell last post).
His modifications bring much value to the shape.
I've tested both Yacine and wapperdude's shapes. There are some bugs in functionality and maybe some room for improvements. But they fit my application for now.
I don't want to take too much time and effort from you. In case you find this project interesting enough we could continue dialogue.
Once again, thank you for the quick, good work.
Title: Re: Multicolor number
Post by: wapperdude on September 16, 2017, 02:00:51 PM
Feel free to keep the dialog open.  The worst that can happen is no additional responses.   :o

As this was a 1st cut try at solving your problem, there's bound to be potential improvements.  Hopefully, this evolves to a doorway that allows you to do more things on your own.

Weekends tend to be a little spotty for responses.  I'm not at my computer at the moment, will try to upload some good foundational links later.

Until then, the core to working with Visio are the shapesheet and VBA.  You can Google Visio shapesheet functions to get an idea of what's available without invoking macros.

Cheers,
The PaperWapper.  ::)
Title: Re: Multicolor number
Post by: Decebal on September 22, 2017, 04:02:28 AM
Hi guys,

I've chiseled a little wapperdude's shape.
I had auto-adjust width according to the number of digits, got the right order for all digits and I've added 2 connection points. It seems it's the shape I need.
However I found that when I have it on a new project of mine, the background color for numbers 1, 2 and 3 turn to black. When I move or copy&paste it in original drawing the shape's colors return to correct ones?
Looking in each digit shapesheet wouldn't give me any clue about it.

Can you help me with this?
Title: Re: Multicolor number
Post by: wapperdude on September 22, 2017, 04:10:04 PM
Not at my computer...

Initial reaction this has to do with Visio's color mapping.  It might be better to use formula "RGB(x,y,z)" rather than a number, e.g. "1", where x,y,z are values of your choosing.  This does two things:  provides an absolute definition for the desired color, and (2), allows subtle tweaking to the colors not available thru a simple 0,1,2, ..., mapping system. 

Wapperdude
Title: Re: Multicolor number
Post by: Visio Guy on October 26, 2017, 06:33:26 AM
Yeah, it sounds like one of the drawings has a Theme or Color Scheme set, and that might be messing with the colors...
Title: Re: Multicolor Number
Post by: Visio Guy on October 26, 2017, 06:44:26 AM
Is this intended for some sort of label-printing solution? I know that resistors have colored bands printed on them, but never really thought about what it all meant.
Title: Re: Multicolor Number
Post by: Visio Guy on October 26, 2017, 06:48:38 AM
Interesting note about the shape as it currently stands: you can enter RGB formulas in the color list.

I entered 39;27;28;5;9;rgb(0,255,0);6;16;1;0, and 5 did indeed turn a bright green:

Title: Re: Multicolor Number
Post by: Decebal on October 26, 2017, 11:47:17 AM
Thank you for your interest in this shape.
The coloured rings on regular old resistors have a very specific meaning. That's why it's called colors code.
Each color stands for a number from 1 (brown) to 9 (white) and 0 (black). Their sequence gives value of resistance and (sometimes) its tolerance. The same is for condensers. That's why I was so specific to each number background. And for conformity sake it has to be that way.
Nowadays there are similarly colored numbered rings that are used to mark various cables so as one can distinguish from two or more cables that sometimes run from one room to another or even from one building to another.
I intended to create this shape to add some "sex appeal" to an otherwise bothering document like a wiring diagram.
But it helps technicians a lot to read faster each cable number they have to make and use to connect whatever pieces of equipment required.
Since I'm not familiar with VBA the shape I offer is as is, without any guarantee. It works for me as I wanted to.
Enjoy this rainbow shape!