cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
Françoise
Level VI

étiquettes dans un graphique

bonjour,

 

Est-ce qu'il ya une astuce vis jsl pour faire afficher les étiquettes à partir d'une certaine valeur qu'on pourrait choisir ? pour ce graphique, on ferait afficher que les étiquettes des valeurs les plus grandes.

 

cordialement

 

Capture3.PNG

1 ACCEPTED SOLUTION

Accepted Solutions

Re: étiquettes dans un graphique

I think the problem is that the setting for decimal points (it's 0 in this case) do not work in the custom label format. My workaround is to go full width (12) and round the value up to the preferred number of decimals.

 

Graph Builder(
	Variables( X( :Xcolumn ), Y( :YColumn ) ), //Replace with your columns
	Elements(
		Bar(X,Y,
			Label( "Label by Value" ),
			Label Format(
				"Custom",
				Formula( If( value > 1500, Round( value, 2 ), " " ) ), //here you can set your formula and Round the value to any number of decimal points
				12, // full width
				0
			)
		)
	)
);

 

 

I have also attached an example table with the script included. I hope that solves the issue.

View solution in original post

5 REPLIES 5

Re: étiquettes dans un graphique

Hi Françoise, 

A fast solution would be to change the format of the label. Either by clicking on the Label format on the Graph Builder (see attached image) and adding the formula that works for you or do the same using JSL. 

Graph Builder(
	Variables( X( :Xcolumn ), Y( :Ycolumn ) ), // Replace with your Columns
	Elements(
        Bar( X, Y,
			Label( "Label by Value" ),
			Label Format( "Custom", Formula( If( value > 17.5, value, " " ) ), 4, 0 ) // Here you can set your formula to change the label format
		)
	)
);

Another approach could be to create an extra column in your data table (:Label Col) and add this as well to the graph. 

I hope that helps.

Best,
Spyros

 

 

hogi
Level XII

Re: étiquettes dans un graphique

Another Trick:
For lines, you can add labels and select which values will be displayed:

hogi_1-1737587953908.png

 

Together with the label, there will be the line:

hogi_2-1737587990032.png


one option to hide it:
adjust the color of the label (e.g. black) and use white for the line:

hogi_3-1737588060722.png

 

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Graph Builder(
	Variables( X( :sex ), X( :name, Position( 1 ) ), Y( :height ) ),
	Elements(
		Line( X( 1 ), X( 2 ), Y, Legend( 1 ), Interval Style( "Arrow" ) ),
		Bar( X( 1 ), X( 2 ), Y )
	),
	SendToReport(
		Dispatch( {}, "400", ScaleBox,
			{Legend Model(
				1,
				Properties(
					0,
					{Line Color( 2 ),
					Line Label Properties(
						{Max Value Label( 1 ), Label Color( "Black" ), Width( 9 )}
					)}
				)
			)}
		)
	)
);

 

Françoise
Level VI

Re: étiquettes dans un graphique

hi,

 

thanks Spyros and Hogi for your answers.

 

but it's weird: when I use the spyros solution, the labels do not have the same format in the graph; see script copy and chart.

 

best regardsCapture 5.PNGCapture6.PNG

 

Re: étiquettes dans un graphique

I think the problem is that the setting for decimal points (it's 0 in this case) do not work in the custom label format. My workaround is to go full width (12) and round the value up to the preferred number of decimals.

 

Graph Builder(
	Variables( X( :Xcolumn ), Y( :YColumn ) ), //Replace with your columns
	Elements(
		Bar(X,Y,
			Label( "Label by Value" ),
			Label Format(
				"Custom",
				Formula( If( value > 1500, Round( value, 2 ), " " ) ), //here you can set your formula and Round the value to any number of decimal points
				12, // full width
				0
			)
		)
	)
);

 

 

I have also attached an example table with the script included. I hope that solves the issue.

Françoise
Level VI

Re: étiquettes dans un graphique

Hi,

 

it's OK.

thanks !Capture7.PNG

Recommended Articles