Jump to content
MartinMcD

Text labels on x axis of plot?

Recommended Posts

Hello everyone,

I'm trying to think of a way of replacing the numerical values on the x axis of my plot below with text.

The graph can be resized by the user and the number of bars changes as well. I've thought of an array of fill slides instead of a plot but they don't resize as nicely.

My preferred option at the moment is an array of strings which I position under the x axis of the plot. This would work if there was a way of resizing the element width at runtime.

Does anyone know of a way of tackling this please? I'll keep searching and post back if I figure it out.

Thank you,

Martin

Perhaps I could use VI Scripting to the create/destroy the number of string controls that I need and then position the controls based on the width of the plot and the number of bars shown. I'm yet to try VI Scripting though...

post-13935-0-87782900-1295690506_thumb.p

Share this post


Link to post
Share on other sites

It is a bit inelegant but I have come up with a solution. I create 10 string controls (more than I think I'll need) and get references to them. I then position each of the ones I need based on the range of the x axis and then hide the ones I don't want. A bit messy but it works fine.

Share this post


Link to post
Share on other sites

It is a bit inelegant but I have come up with a solution. I create 10 string controls (more than I think I'll need) and get references to them. I then position each of the ones I need based on the range of the x axis and then hide the ones I don't want. A bit messy but it works fine.

You could draw your own axis using the 2D picture plot functions (2D picture plot). The downside is you don't get all the zoom candy etc.

Share this post


Link to post
Share on other sites

Ahh yes, thank you that is a nice idea and beats having hidden indicators floating around my front panel. Thank you for the tip!

Regards,

Martin

Share this post


Link to post
Share on other sites

You could also use graph cursors or annotations, and position them just under your bars. That would look decent enough if you set the Yscale min to -1 rather than zero, and then you could put the labels at Y = 0.5 or something. You'd fill the bars down to zero rather than down to -infinity. You would have a few compromises with the appearance, but the zooming &c.would all work.

post-1764-0-34706400-1295913147_thumb.pn

Bar Graph With X Labels.vi

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.