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
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.
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
Another Trick:
For lines, you can add labels and select which values will be displayed:
Together with the label, there will be the line:
one option to hide it:
adjust the color of the label (e.g. black) and use white for the line:
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 )}
)}
)
)}
)
)
);
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 regards
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.
Hi,
it's OK.
thanks !