Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: kiler40 on August 02, 2013, 11:51:50 AM

Title: visualization makes file too slow.
Post by: kiler40 on August 02, 2013, 11:51:50 AM
Hello Again.

For some time i`m making one complex shape that can handle all my needs.
but when i multiply this shape, it makes the file pretty heavy to work with.
Are there any optimization tricks that you can share :)
I have only one picture in the shape, and it is compressed.
But i have many shapes and several links and formulas.

Shape is approximately 50 kb by size...

Thanks,
Andrei
Title: Re: visualization makes file too slow.
Post by: JohnGoldsmith on August 02, 2013, 07:12:26 PM
When you say heavy to work with, are you referring to the performance when working with the open drawing or file size?

Have you created a master or are you duplicating single instances?

Is there a good reason to use an image?

Can you share the shape / image in this thread?

Best regards

John
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 05, 2013, 06:22:38 AM
Hello,
I`m talking about performance of the file.

Yes i have created a master that i use again and again.
I`ll attach it.

This is a file that have in total 36 identical shapes /positions/ side by side.
From number 28 to 45, the shape have option (shape data) "Empty" set to 1.
In this case there is white square with line inside. This square is the picture.

If i try to resize all of them in the same time, it becomes slow. And this is even not the biggest configuration of positions i have.

And i have many many sets like this... in one page.... it becomes really really hard to work with.
And one other thing.
If i want to make the group even smaller, i can`t shrink too much, because the text loses its order.
So i have to copy all shapes and paste them as Picture with enhanced metafile, so i can shrink them with the size i need... and this gives additional heaviness...
Title: Re: visualization makes file too slow.
Post by: JohnGoldsmith on August 05, 2013, 08:38:58 AM
Thanks for attaching the file - it makes it much easier to see what's going on.

Looking at the structure of the master, I would say the key problem is groups within groups, where the top level group shape (Sheet.5) contains other grouped shapes.  Each new group shape creates its own coordinate space that must be transformed as its parent is resized and that creates a lot of work. 

For example, if you use the Event Monitor in the SDK (http://visualsignals.typepad.co.uk/vislog/2013/03/visio-2013-sdk.html) you'll see that there are more than 300 hundred CellChanged events for a single resize operation.  If you multiply that across a number of shape instances on the page you can see the work involved.

The answer is to try and flatten your master shape so that it has as few groups (as sub-shapes) as possible and certainly no groups as sub-shapes of sub-shapes.  Currently there are places the the structure is four levels deep.

Other observations are:
Hope that helps.

Best regards

John
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 05, 2013, 10:52:15 AM
Hello John,
Thank you for your reply, unfortunately, I cannot say that I fully understand everything.
The reason is that i`m really basic user of Visio, and because I do what i do in the free time at work, this cost me too much time to figure out.
For example (please don`t laugh  :) ) i`m creating and "debugging" this single shape from last September... too much damn time...
And really i don`t understand where i can replace for example STRSAME for choosing color (because "R" and "r" means "red" ) and if nt using data graphics, how to choose from different colors for values

And i don`t know how to display text in a shape without using text callout

Other thing is... how to make this (the attachment)
can i make this in 2 levels only ?
is it possible, and everything to work as it is requested - changing colors and numbers..

Sorry for so much questions... but i`m really beginner user, and this is really important for me and my work

Wish you all the best,
Andrei
Title: Re: visualization makes file too slow.
Post by: JohnGoldsmith on August 05, 2013, 03:08:59 PM
Hello Andrei,

That's fine and if you're just a beginner then you're doing very well!

Can you explain a little more about the shape you're developing, in terms of what it represents, what data you're supplying it with and how you expect to change in reaction to that data?

Best regards

John
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 06, 2013, 07:21:12 AM
Hello John,
Thanks for the words :)

This shape generally represents position in a connector with wires.

In the main field you have position number (1,2,3...), witch can be only with number or with a prefix (A1,B1,S1... etc.)
This position number is a text callout that is linked to the field that combine number and prefix (if one)
(But i have problems with this callout field - when i shrink the whole shape, the text distorts and become in 2 rows..)

More of the connectors are with straight shape, so i added a auto-number option, to copy and repeat with "F4" to fill all position.

Other part is 2 color square - one main color and one secondary represented with line
Because the way we identify the color is like: R/W (Red + White), B/G (Black + Green)... firs used to separate them in excel and have 2 data rows to fill, but because this is additional work for me and it is not good I figure out a way to find the "/" symbol and by this to divide the color in 2


Main color: IFERROR(LEFT(Prop.testColor,FIND("/",Prop.testColor)-1),Prop.testColor)
Second Color: IFERROR(REPLACE(Prop.testColor,1,FIND("/",Prop.testColor),""),"")


Other part is "cross" wich is "cross section" and it is a text callout. This text need to change color because black text on black background.... you know :)

Next is Mark - because some positions are equal in color and cross sestion, so I need to make additional color to know witch one is witch...

And the last is Step - witch position is after the previous. again with a text callout.


I have and pre-configured output excel file, that uses data from my work files and transform it to what i need to fill the shape fields.
I use "Automatically Link" with 2 representing data fields - connector and kontakt. Because i have more than one Connector  in a page.

Basically i have 4 states of the shape

Empty - when the "empty" data field equals "1" - this is that picture a have said i use that covers everything

In use - when "empty" is different from "1"

In use but dual circuit - when "DC" field equals "1" - in this case a second color field appears in the shape. And additional shape data rows become visible. The first copy color and cross section from the main, and second is a new one again with 2 colors and text.

and last is Used in this case the "DC" field needs to be empty and "used" field equals "1". Here the color square become with a circle shape and cross section text is not visible. This field is not mentioned it the Excel file, because it is rarely used and i enter the data manually.

ALL this is represented up to 200 connectors, with variation of positions between 2 and 80 :) So you can imagine how much this single shape is repeated  :D

Hope this explains what i have trying to do for the past lots of months...

Best regards !
Andrei

Title: Re: visualization makes file too slow.
Post by: JohnGoldsmith on August 07, 2013, 02:36:39 PM
Thanks for that.  That helps.

Will have a proper read through and come back to you.

Best regards

John
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 08, 2013, 06:10:21 AM
Thank You !
That will be really helpful
:)


Wish You All The Best

Andrei
Title: Re: visualization makes file too slow.
Post by: JohnGoldsmith on August 08, 2013, 04:04:25 PM
 Hello Andrei, 
Well attached is an example of how to flatten the shape and you're welcome to use it (or not) as you like.
I've got it down to ten sub-shapes so have a look through and see if a) the logic in the group shape user cells is correct and b) if that improves the sizing performance on your system.

There's a few things to point out:
Color logic - In your original, you're using Data Graphics shapes to control the color logic and selection.  In this example I've opted for a single array of RGB values and this 'lookup' list is used by the 'Mark' circle, the main color blocks and the stripe overlays.  The RGB list (User.ColorValues) maps to User.ColorNames.  If your language uses a different RGB parameter delimiter you may need replace it before using it.  In English the separator is a comma (',') so that's what I've used for now.
The advantage of the ColorNames is that you can change them as you like and as long as they have a corresponding index in the ColorValues everything should work ok.
Font size - I saw your setf's via the context menu and that's a nice idea to allow you to change the font sizing.  In this example the main 'Label' font size can be set through the UI as normal (as this is now in the group shape) and there's a User cell (User.CrossToLabelFontRatio) that allows the 'cross' display text to track this as a percentage (currently 60%).  This means that you can make a selection of multiple instances and still change the font size in one go.
z-order - The stacking order within the shapes is significant in this shape (see attached image).  The circle shape for 'Used' is created by using a mask shape over the top of the square Block1 and Stripe1.  This saves creating another shape as the colour logic is already resident in Block/Stripe1.  You could attack this in a number of way, for example, by using another geometry section in Block1.  Of course you'd then need to deal with keeping the ends of the stripe circular as well.  In the end I went for the mask.

What's not in here:
I haven't included you auto-numbering system, or the floating yellow circle (I wasn't quite clear what that was tied to (data-wise).
Anyway I hope that helps.  I'm off on holiday this weekend so if you have any difficulties maybe post another question and others here will help out, otherwise I'll check back on this thread in a week or so.
Best regards
John
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 09, 2013, 06:41:12 AM
Dear John,
Thanks for the reply. You give me some great clues.
My issue is with the color.
It seems that it is not working at me. (I`m using visio 2010 if this matter)
Index function returns the value of the color, but the shape stays balck
Title: Re: visualization makes file too slow.
Post by: JohnGoldsmith on August 09, 2013, 07:58:30 AM
Hi,

What language are you using?

If you write and RGB formula into a cell what character is the argument separator?

For example, in English you use a comma. So 'RGB(200,25,50)'

Best regards

John
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 09, 2013, 08:11:13 AM
Hi,
Im using the file you have attached. And i`m using English.
and i have created a shape just to display the result of the formula when i type "y" returns RGB(255,255,0).
But if i link shape background color to the cell with the result, the shape turns black.
If i manually type RGB(255,255,0) the shape is yellow.

I have tried other thing
To make a user.cell and to link shape background to the user.cell
If i type 1 in the user.cell shape is white, 2 is red and so one.
But if i type RGB(anything) the shape becomes again black....

Don`t know what is the problem...
Title: Re: visualization makes file too slow.
Post by: JohnGoldsmith on August 09, 2013, 08:19:55 AM
Do you want to share the file and I'll have a look?
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 09, 2013, 08:23:25 AM
Outsource :)
Here you are !
if i link User.row_5 with user.search shape becomes black
Title: Re: visualization makes file too slow.
Post by: JohnGoldsmith on August 09, 2013, 09:35:03 AM
Hi,

This seems to work for me (see DualColor.png below).  To display two colors in the shape you need a different fill pattern.  Once that's set you can use both FillForegnd and FillBkgnd.

The color formulae (User.Search/2) have a default error value of '0', which is black. 

Re-reading your question it occurs to me that you're trying to use a number as the index in Prop.Color (or via User.Row_5 (stop using those default row names!  :) )) - is that right?

If that's the case then you would expect to get black as it should produce an error.

Let me explain about the index functions, just in case they're not clear.  These functions are trying to find the location of a string in an array of strings.  In our case this is a letter.

For example, given the following two list cells:

   User.value = "R|G|B"
   User.present = "RGB(255,0,0)|RGB(0,255,0)|RGB(0,0,255)"


If you look at IndexFunction.png below and set Prop.Color to 'G' then the formula would be evaluated as follows:
Now let's look at what happens if you set Prop.Color to '1':
You could break up the nested Index/Lookup formula to make it a little easier to see the intermediate values.  Have a look at how the 'Mark' color indexing works in my earlier file.

Also, you might want to have a look at the reference docs for Lookup (http://msdn.microsoft.com/en-us/library/ff768321.aspx) and Index (http://msdn.microsoft.com/en-us/library/ff768335.aspx) so you're clear on how they work.

Hope that helps.

Best regards

John
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 09, 2013, 10:23:54 AM
Hello again,

Mayby i`m not explayning it correct.
From the file you have made some post ago, with the tuned shape, when i change the color in the shape it turns black (the one shape you have made)

Then i have started try understaing why is not working.
And i have made this simple shape.

Made some thing so i can see what is happening.
first (in simple_color.png)

I`m linking the last user row -  user.color (ok with the default names :) ) with shape background. If you put 2 as shape background it will become red.
At the same time i have put text field to display the result from the 2 INDEX formulas.
The index formula works fine according what it should do.

y/r = RGB(255,255,0)/RGB(255,0,0)

Till this point i understand everything.

Next (yellow_color.png)  i want to change color of the shape to yello. At this point i will put RGB value -  RGB(255,255,0) The one user.search is returning.

The shape turns yellow. Great :)

Finally (end_result.png), i will link user.color to user.search...
In this case i have put the text to be white so it can be seen in the ... black box...

I really cant understand where is the problem.


I see that you use visio 2013.... is this where the difference comes from ...





Title: Re: visualization makes file too slow.
Post by: kiler40 on August 09, 2013, 10:24:36 AM
i can put only 2 attachments....

Here is the end result.
Title: Re: visualization makes file too slow.
Post by: JohnGoldsmith on August 09, 2013, 11:16:09 AM
Well that is odd.  At the moment I just can't reproduce what you're seeing.

It is possible that this is 2013 related.  I opened your original file in 2013 and saved it in compatibility mode and then opened it in 2010.  In 2013 the shapes get the THEMEVAL formulae from the 2013 themes model and this is lost (obviously) when opened in 2010.  In fact the cells that contained the THEMEVAL functions get their formulae wiped and just the value remains (you can see this persisted in the document if you save as xml (vdx).

I would try and reproduce your shape in 2010 from a brand new document and see if that fixes the problem.

Let me know how you get on.

Best regards

John
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 09, 2013, 11:35:02 AM
I have no idea.... to be honest :)
I have tried to transform the result somehow... but nothing happens
Title: Re: visualization makes file too slow.
Post by: JohnGoldsmith on August 09, 2013, 12:17:47 PM
Have you tried creating a new shape in a new document (not copy and paste)?
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 09, 2013, 12:22:19 PM
This was one of the first thing to try...
Title: Re: visualization makes file too slow.
Post by: JohnGoldsmith on August 09, 2013, 12:40:56 PM
ok, well can you share a new file when it's in the 'black' state?
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 09, 2013, 12:47:21 PM
Here you are.
Title: Re: visualization makes file too slow.
Post by: JohnGoldsmith on August 09, 2013, 02:06:16 PM
Thanks for that.

Yes, I can confirm that I'm seeing the same problem when i open the document.  Inspecting the ShapeSheet when opening the file you can see that the formulae are all correct (see FormulaView.png), but in ValuesView.png the FillForegnd cell has a value of 0.

I'm afraid I've run out of time on this for the moment.  My guess is that for some reason, on the first go the yellow RGB color has not been added to the document's colors collection and so it's failing to be interpreted correctly.  If you edit the cell (with no changes) and hit enter the yellow color is added to the colors collection and the cell value (and visual fill) updates accordingly.

For the time being, I would iterate through the color values in Prop.color so that each one has been used once and I believe that should deal with the problem.  I haven't had time to test this thoroughly, but that would be my approach.

Hope that helps.

Best regards

John
Title: Re: visualization makes file too slow.
Post by: JohnGoldsmith on August 09, 2013, 07:02:19 PM
As an alternative approach you might want to try push the RGB value into the FillForegnd cell as per the attached image.

Best regards

John
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 10, 2013, 11:21:52 AM
This looks unteresting, but for now I cant try it... because at my home i have visio 2013, and in work we are with 2010...
So on monday, I`ll share my experience with this matter :)
Thank you :)

Wish you all the best,
Andrei
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 11, 2013, 06:31:22 AM
Its strange... in visio 2013 at home, still cant make it work..
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 12, 2013, 07:33:23 AM
Dear John,

OK! I have found the solution... :)

When i put the color in RGB value by hand, i use RGB(r,g,b) syntax
But it seems that when color is linked to an active in some way field, (formula, shape data field.. etc) the value comes with  this  "  symbol "RGB(r,g,b)"

and in this case the field turns black.
The solution was to change with "RGB(r;g;b)"

"RGB(255;255;255)|RGB(255;0;0)|RGB(255;255;0)|RGB(64;191;96)|RGB(0;0;255)|RGB(0;0;0)
|RGB(112;48;160)|RGB(255;153;255)|RGB(145;70;9)|RGB(143;143;143)|RGB(255;204;153)|RGB(249;196;153)"


I know you mentioned something about different symbols for input in the beginning of the topic and i don`t know if this is what you were trying to explain... but you still have problems with the colors like me :)

It was a interesting and good lesson to me.

Thank you too for the support :)


Title: Re: visualization makes file too slow.
Post by: Jumpy on August 20, 2013, 07:32:32 AM
Had a similar problem once and it was language related, as I use a german Visio2007 Version. That was, what John was hinting at, in his first explanations. Some versions of Visio use "," others ";" as separators inside ShapeSheet functions (or at least the RGB-function).
And Visio uses black as default color, when it can't interpret the formula in cell (or there's an error in the formula and that get's interpreted as 1 and 1 is color black???), so it turned everything black for you.
Title: Re: visualization makes file too slow.
Post by: kiler40 on August 20, 2013, 08:28:38 AM
Yes :) But i`m using an English version of Visio... and if i put the RGB value directly with "," it is OK. But if the RGB value comes from a formula need be with ";"
That the was misunderstood by me...