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.
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.
03-08-2015 10:47 AM - edited 03-08-2015 10:52 AM
Hello,
I am using histogram to draw several values and I want to use annotations to show the value of each bar.
I fit the Y scale to have space for the annotation value using the max value of data. But I can't fit the label offset to have same free space in all the bars. If you see the attached file, you can see the numbers cover the bar and they dont look ok. Do you know any way to fit to get all the values annotations with the same free space with the bar?.
Thanks for all.
Fred.
Solved! Go to Solution.
03-08-2015 11:00 AM - edited 03-08-2015 11:14 AM
03-08-2015 11:32 AM
Hi Ben,
Thanks for reply!.
Yes, I can to play with the closer value, but It is only one example. I use 7 histograms and its part of one sub-vi the values will vary. I need any way to programmatically fit the y offset value. It seems no sense.
Sometimes with 2 is ok all the values, if its > 10 i need 3... i dont understand.
03-08-2015 11:57 AM
03-08-2015 12:39 PM - edited 03-08-2015 12:42 PM
Ben,
No, You can check in the example vi. Change the input values and you will see that with diferent values the gap between label and bar is not the same.
Upper example, the first value is 15, and the offset label is 2. You can see is no look good. In the bottom example, with value 9, the same offset label and show good.
03-08-2015 12:53 PM - edited 03-08-2015 01:01 PM
There are many things wrong with your code and you are doing this way too complicated.
Here's a quick example. Modify as needed.
03-08-2015 01:16 PM - edited 03-08-2015 01:17 PM
Of course if certain elements are constant (e.g. the number of bars) many properties need to be written only once before the loop. Here's the code in action using generated random data.
03-08-2015 01:32 PM
thank you so much, altenbach!.
You are the man, it works very good. You are right my design was very complicate.
Yes I use a fixed value of 10 bar. I put interlace zeroes to do the bars thinner. So the number of annotation is more clear. But your code is better and easier.
Thank a lot!.
Fred
03-08-2015 02:10 PM
Fonsi wrote:Yes I use a fixed value of 10 bar.
Then just make the y scale from 0..14 and add 2 for the offset. No need to divide by the max. (might need to fine tune based on the exact font size).
03-08-2015 02:18 PM
Ok, thanks for help!.
Fred