cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar

Labels on Top of Graph Builder Bars

This question is very similar Display Values on Top of Graph Builder Bars , I am just asking a follow up question that went unanswered in the original post. 

 

I am creating a bar graph with the Graph Builder and I want to add labels to the top of bars. I am using Graph Builder because I am using the Wrap functionality. I found how to add labels to the bars, but they default to the center of the bars. Is there any way to automatically move the labels to the top of the bars?

 

To go into more detail, I am using JSL to create the graph. I found that you can move the labels with 

graphBuilderBox << Dispatch( {}, "Graph Builder", FrameBox, {DispatchSeg( BarSeg(1), Set Label Offset( { labelNum, xCoord, yCoord } )  ) } );

However, you move the label to the given coordinates on the current graph axis. On my graph, the Y axis is the Percent of Total Count, and I have the graph sorted by Count (essentially, a pareto graph), so it is impractical to try to get the heights of the bars to move each label individually.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Labels on Top of Graph Builder Bars

Hi,

Your comment helped me figure out what was going on. Basically, I am allowing the user of my JSL script to use most of the Graph Builder functionalities, including Wrap and Overlay. For overlayed bar graphs, I prefer the stacked bar style over the side-by-side style, so in JSL, I made the graph stacked style regardless of whether the user used the overlay. When I added the labels, I did not realize remember that I changed the bar style, and apparently the bar style changes the default label positions. I attached a couple of graphs that show that.

Side By Side.png     Stacked.png

                                        Side-by-side                                                                     Stacked

 

Thanks for the help,

Riley

 

TLDR: My bar style was stacked and not side-by-side (the default)

View solution in original post

3 REPLIES 3
Phil_Kay
Staff

Re: Labels on Top of Graph Builder Bars

Hi,

I'm not seeing the behaviour that you describe. When I plot a bar chart with Percent of Total Count as the Y and a Wrap variable, the labels are on the top of the bars by default:

Phil_Kay_0-1655195379660.png

Which version of JMP are you using (I used 16.2.0)? Can you provide some non-sensitive example data?

Regards,

Phil

Re: Labels on Top of Graph Builder Bars

Hi,

Your comment helped me figure out what was going on. Basically, I am allowing the user of my JSL script to use most of the Graph Builder functionalities, including Wrap and Overlay. For overlayed bar graphs, I prefer the stacked bar style over the side-by-side style, so in JSL, I made the graph stacked style regardless of whether the user used the overlay. When I added the labels, I did not realize remember that I changed the bar style, and apparently the bar style changes the default label positions. I attached a couple of graphs that show that.

Side By Side.png     Stacked.png

                                        Side-by-side                                                                     Stacked

 

Thanks for the help,

Riley

 

TLDR: My bar style was stacked and not side-by-side (the default)

Phil_Kay
Staff

Re: Labels on Top of Graph Builder Bars

Thanks! That makes sense because, of course, if you had stacked bars you would have to have the labels in the centre of each stacked bar.