cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

Additional Graph Builder Function: Order overlay values by descending order

What inspired this wish list request? Please describe the current issue that needs improvement or the problem to be solved that is not easy or possible right now, with an example use case. 

 

Hello, I am trying to put together some complex charts for my company and I have run into an issue. I have to show a certain value for multiple categories over the span of a dozen quarters (see image below). I want to be able to order the categories in my stacked bar chart by the value in my y-axis. In this example, I would want the non-fail category to be on the bottom of the stack followed by application category and so on and so forth.

 

I know that I can manually assign the stack order but that is not robust enough for my purposes. I have local data filters that, when used, will change the value of the categories and then they will need to be manually restacked again.

 

I have talked with the JMP experts assigned to my company and they told me that there wasn't a built in functionality for this yet which is why I am writing this post.

 

AttributedMouse_0-1726582590819.png

 

 

What is the improvement you would like to see? Please describe the idea for improving JMP. Please include mock-ups, wireframes, screenshots, scripts, other documents or examples from other software that help describe the change you would like to see. 

 

Just like how you are able to order the x axis bars of the bar chart by descending/ascending order of the overlay values (see below). I want to be able to order the overlay stack in the same manner.

 

AttributedMouse_1-1726583924959.png

 

 

Why is this idea important? Please describe the value to you and/or other users if the idea is implemented (for example, ease of use, must have,…).

 

This seems like a must have for a graph builder. Being able to order your data by values that are displayed on the graph should be easy to do and is something I would think a lot of people would expect JMP to have.

8 Comments
hogi
Level XII

By default, the values seem to appear in the bars by "row" order.

hogi_0-1726584842528.png

 


To specify an order, you can use the column property "value order" and force JMP to stick to that order. (is this what you call "manually?").
Then the values will show up from bottom to top in the bars - and from top to bottom in the legend ( Reverse order button in legend settings )

 

if you want to order "descending" at Overlay and ascending at another place, just use the descending order as default via the column properties.
Then Overlay will show the values as you want.
And for the second place use the "sort order and switch to "descending" (-> descending x descending will give you ascending order)


Alternatively: use a cloned column with reverse order for the second place.

Status changed to: Investigating

Hi! @hogi has some good ideas. Another option is to use Configure Levels in Graph Builder. You just set up your graph, then right click on the "Overlay" drop zone and you should see an option to "Configure Levels...". Please try that out and let me know if that fulfills your request. 

Configure Levels Example.png

AttributedMouse
Level II

Hey @Sarah-Sylvestre . I know of this functionality but it does not work for me. The values you can reorder your overlay by are the number of row entries it is in from the table and not the by the value of the y-axis. For example, look at the image below. I have highlighted the memory category. Its value shows 20, which means it has 20 rows from the table that are being used for the chart. Looking at the bar chart, you can see that the PPB value far exceeds 20. This is where the problem comes up. I may have a category that only calls on a single row but has a PPB value of 1000. i hope this explains the issue better.

 

AttributedMouse_0-1729629864272.png

 

AttributedMouse
Level II

Hey @hogi , thank you for responding. However, ordering the column on my table won't help either. My local data filter is filtering out a lot of data for this graph, therefore I need to be able to pull the PPB values straight from the chart as they are seen so that I can configure my overlay based on the sum of each category. You wouldn't happen to know how to do that would you?

hogi
Level XII

Ok, I think I understood now.

you want to use a data filter to dynamically select some subset.
Then, for the specific subset, you want to order the entries in the bar chart in descending order - to focus on the main contributors on top.

 

Hm, one issue with "order by": you have the PPB information for 16 Quarters, but just a single setting for the order.

How should the 16 datasets be combined to define the order? separate order for every pile of bars? and using the sum to specify the order for the legend?

Maybe good as starting point - other options could be selected from a list of options.
-> Kudo from my side.

 

Maybe, originally, this ambiguity was the reason why the developers did not provide a "order by" for the Overlay?

 

hogi
Level XII

Sort 20 values via "Configure Levels" is no fun.
I just checked the red triangle menu - there are options to sort by count and label, but for oyur case, I think we would need something like sum(value) ...

hogi_0-1729631701962.png

 

hogi
Level XII

As a workaround, you can implement this functionality using scripting (via filter change handler

 

Every time a user changes the settings in the local data filter, you can call a function that checks and adjusts the order.

 

 

[edited: In a previous version o this post I showed an issue with erronously stacked bars. after contacting JMP Support (TS-00171038), I could not reproduce the behavior in the video. Everything seems to be fine - see the new video]

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Profit by Product.jmp" );

:Product Line << Set Property(
	"Value Colors",
	{"Credit Products" = -4354269, "Deposit Products" = -13912408, "Fee Based Products" =
	-4042310, "Other Products" = -10628061, "Revolving Credit Products" = -13400361,
	"Third Party Products" = -2668175}
);

gb = dt << Graph Builder(
	Variables( X( :Quarter ), Y( :Revenue ), Overlay( :Product Line ) ),
	Elements( Bar( X, Y, Legend( 4 ), Bar Style( "Stacked" ), Summary Statistic( "Sum" ) ) ), 

);

ldf = gb << Local Data Filter(
	Add Filter(
		columns( :Country ),
		Where( :Country == "Switzerland" ),
		Display( :Country, N Items( 15 ), Find( Set Text( "" ) ) )
	)
);
	

adjust order = Function( {x},
	myRows = filter = ldf << Get Filtered Rows;
	
	sub = dt << subset( All rows, Selected columns only( 0 ), private( 1 ) );
	
	sub << select all rows << exclude() << clear select() << select rows( myRows ) << exclude();
	
	mySummary = sub << summary( group( :Product Line ), sum(:revenue), private( 1 ) );
	mySummary << Sort( By( :"sum(Revenue)"n ), Replace Table, Order( Descending ) );
	
	ordered = As List( mySummary[0, "Product Line"] );
	Close( sub, noSave );
	Print( ordered );
	
	Eval(
		Eval Expr(
			dt:Product Line << Set Property( "Value Order", {Custom Order( Expr( ordered ) )} )
		)
	);
	wait(0);
	
	
);

rs = ldf << Make filter change handler( adjust order );

adjust order( 1 );

 

hogi
Level XII

- deleted