cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
hcarr01
Level VI

Graphique

Bonjour à tous,

 

Dans un graphique j'aimerais pouvoir afficher que les 3 premiers éléments selon un critère de pourcentage -> afficher que les 3 items avec le pourcentage le plus élevé par quarter :

hcarr01_0-1749131247294.png

 

Vous trouverez la base de données en pièce-jointe.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
mmarchandFSLR
Level VI

Re: Graphique

@txnelson, I completely flaked on that and forgot that Col Rank chooses the lowest as number 1!  With a small edit, it works as it should.  Thanks for catching that.  Being hasty leads to mistakes.

 

Graph Builder(
	Transform Column(
		"Transform[POURCENTAGE]",
		Formula( Col Rank( 0 - :POURCENTAGE, :QUARTER ) )
	),
	Size( 731, 464 ),
	Show Control Panel( 0 ),
	Variables(
		X( :QUARTER ),
		X(
			:ITEM,
			Position( 1 ),
			Order By( :POURCENTAGE, Descending, Order Statistic( "Mean" ) )
		),
		Y( :POURCENTAGE ),
		Color( :ITEM )
	),
	Elements(
		Bar(
			X( 1 ),
			X( 2 ),
			Y,
			Legend( 14 ),
			Summary Statistic( "Sum" ),
			Label( "Label by Value" )
		)
	),
	Local Data Filter(
		Add Filter(
			columns( :"Transform[POURCENTAGE]"n ),
			Where( :"Transform[POURCENTAGE]"n <= 3 )
		)
	)
);

mmarchandFSLR_0-1749135744797.png

 

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Graphique

Here is how I created this chart

txnelson_0-1749132623450.png

I sorted the data table by Quarter and descending Pourcentage.

I then created a new column called Rank and set the formula to:

Col Cumulative Sum( 1, :QUARTER )

Then it was a simple matter to create the chart as specified, and to add a Local Data Filter and select the filter to use only the rank values of 1-3

txnelson_1-1749132866097.png

 

 

 

Jim
mmarchandFSLR
Level VI

Re: Graphique

Very similar to Jim's solution but with a temporary Transform Column:

 

Graph Builder(
	Transform Column(
		"Transform[POURCENTAGE]",
		Formula( Col Rank( :POURCENTAGE, :QUARTER ) )
	),
	Size( 731, 464 ),
	Show Control Panel( 0 ),
	Variables(
		X( :QUARTER ),
		X(
			:ITEM,
			Position( 1 ),
			Order By( :POURCENTAGE, Descending, Order Statistic( "Mean" ) )
		),
		Y( :POURCENTAGE ),
		Color( :ITEM )
	),
	Elements(
		Bar(
			X( 1 ),
			X( 2 ),
			Y,
			Legend( 14 ),
			Summary Statistic( "Sum" ),
			Label( "Label by Value" )
		)
	),
	Local Data Filter(
		Add Filter(
			columns( :"Transform[POURCENTAGE]"n ),
			Where( :"Transform[POURCENTAGE]"n <= 3 )
		)
	)
);
txnelson
Super User

Re: Graphique

@mmarchandFSLR your code produces a graph that is totally different from mine.

My Chart

txnelson_0-1749134894459.png

and the data table with the Rank column showing the rankings based upon Pourcentage

txnelson_1-1749135102881.png

Your chart run on the same data but very different results

txnelson_2-1749135176878.png

I believe the issue is that your rankings are ranking in ascending order.

 

 

Jim
mmarchandFSLR
Level VI

Re: Graphique

@txnelson, I completely flaked on that and forgot that Col Rank chooses the lowest as number 1!  With a small edit, it works as it should.  Thanks for catching that.  Being hasty leads to mistakes.

 

Graph Builder(
	Transform Column(
		"Transform[POURCENTAGE]",
		Formula( Col Rank( 0 - :POURCENTAGE, :QUARTER ) )
	),
	Size( 731, 464 ),
	Show Control Panel( 0 ),
	Variables(
		X( :QUARTER ),
		X(
			:ITEM,
			Position( 1 ),
			Order By( :POURCENTAGE, Descending, Order Statistic( "Mean" ) )
		),
		Y( :POURCENTAGE ),
		Color( :ITEM )
	),
	Elements(
		Bar(
			X( 1 ),
			X( 2 ),
			Y,
			Legend( 14 ),
			Summary Statistic( "Sum" ),
			Label( "Label by Value" )
		)
	),
	Local Data Filter(
		Add Filter(
			columns( :"Transform[POURCENTAGE]"n ),
			Where( :"Transform[POURCENTAGE]"n <= 3 )
		)
	)
);

mmarchandFSLR_0-1749135744797.png

 

Recommended Articles