From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

resize xy graph axis text

Solved!
Go to solution

Hello, I have a question regarding XY graphs:

I want to have two XY-graphs with identical sizes aligned perfectly to have a nice comparison of separate data sets without plotting them on the same graph. However, I can't find out how to set the width of the y axis text. Because now when the width of the texts are not the same, even if the whole graph has the same area and starting point (the solid line on my pcture), the plot areas are a bit off (indicated by the arrows)

Can I somehow set the width of these texts, so the plot areas match up? Right now I am using "Position" and "Plot area size" properties of the XY graphs to make them equally sized.

Thanks

 

xygraph_resize.png

__________________
Engage! using LV2015
0 Kudos
Message 1 of 10
(3,624 Views)

rather than trying to affect the text size, try setting the plot area bounds and plot area size for both XY graphs.

0 Kudos
Message 2 of 10
(3,615 Views)

actually as I mentioned above, I use the "plot area size" and "position" property nodes and they both have the same width and same horizontal position, wired from the same wire, that's why I thought to go on with the axis label...

xygraph_resize2.png

__________________
Engage! using LV2015
0 Kudos
Message 3 of 10
(3,609 Views)

If you could attach your VI instead of the snippet, I might be able to play with it.  Unfortunately, the built-in LabVIEW snippet machine isn't that good and fails in dealing with property nodes and references.  It breaks the references and your actual graphs no longer exist.  (Code Capture Tool is much better and doesn't have this problem.)

 

I would take a look at the advanced display format for the Y-axis.  If you could set it to be a minimum field with, left justified, padded with spaces for both graphs, you should be able to equalize the space that the Y-axis takes up.  The format code would be something like %4.0f

0 Kudos
Message 4 of 10
(3,603 Views)

thank you, I tried it with %10.0f, however it seems that when there is a huge discrepancy in the order of the two graphs (e.g. one from 0-10k, another being -9 to 0), it seems to be still behaving strange

I attach my vi (without the format strings)

__________________
Engage! using LV2015
0 Kudos
Message 5 of 10
(3,595 Views)

Apologies for missing an important part of your original post.

 

It looks like you're using the property nodes to set the position of the graph control, not the plot area bounds.

 

Please see attached. 

0 Kudos
Message 6 of 10
(3,586 Views)
Solution
Accepted by topic author jeanlucpicard

Your VI doesn't have any data saved in it as default.

 

When I used %10.0f on your VI and set the scales, the results were better than nothing, just not perfect.

 

I don't know if that method would work perfectly.  With a font that is not fixed width, the actual width of the text could very slightly.  The width of the different digits could be different, and the width of a space character to pad the text when there are fewer digits can also be different.

 

Message 7 of 10
(3,572 Views)

Have you tried the Mixed Signal Graph?  It does a few things kind of wonky for my taste, but one thing it does do is line up the plot areas.

Message 8 of 10
(3,567 Views)
Solution
Accepted by topic author jeanlucpicard

Try this.  Same thing I suggested earlier, but in your context.

 

 

Message 9 of 10
(3,565 Views)

Thank you all for your help, the last VI seems to be fine. 

(Yes, I know I didn't have any data bundled as first I tried to do the aligning with manually changing the numbers).

 

I haven't tried the mixed signal graph, but might go on with it later, thanks for the suggestion.

__________________
Engage! using LV2015
0 Kudos
Message 10 of 10
(3,538 Views)