Multicolor Number

Started by Decebal, September 14, 2017, 08:48:56 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Decebal

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.

Yacine

Yacine

wapperdude

#2
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
Visio 2019 Pro

Yacine

#3
@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.
Yacine

wapperdude

@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
Visio 2019 Pro

Decebal

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?

Yacine

Download my upload and test the smartshape. ???
Yacine

wapperdude

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
Visio 2019 Pro

Yacine

#8
Thank you Paperdude.  ;D
Yacine

wapperdude

Visio 2019 Pro

Decebal

#10
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.

wapperdude

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.  ::)
Visio 2019 Pro

Decebal

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?

wapperdude

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
Visio 2019 Pro

Visio Guy

Yeah, it sounds like one of the drawings has a Theme or Color Scheme set, and that might be messing with the colors...
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010