- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Dynamic color
I use the chart builder in JMP.
From the columns of my database, I create measures (indicators) directly in the chart builder to display them.
For example with my column A and my column B, I create the measure with the formula AB.
This measurement refers to an indicator that I add to my graph just below the title.
The problem is that I would like to give a color to the measure I create based on the value of that measure.
I would like to be able to put the text in green if the measurement is > 0 and put the text in red if the measurement is < 0.
For the moment, I can associate a color with the measurement but the color is not dynamic it does not change depending on the values.
Is there a way to get around this problem?
This post originally written in French and has been translated for your convenience. When you reply, it will also be translated back to French .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Couleur dynamique
Hi @hcarr01 ,
I'm not exactly sure what it is you're wanting to do, but I think I understand. This is one way to do it by using the JSL code below -- you can see how it's done on the Big Class.jmp file. Here, I just chose to color :age <=14 red and >=15 green.
Names Default to here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
For(i=1, i<=NRows(), i++,
If(
:age[i]<=14,
:age<<Color Cells("red", i),
:age[i]>=15,
:age<<Color Cells("green", i),
)
);
Another option would be to set a Spec Limit for the column and use Analyze > Quality and Process > Manage Limits and then use the red hot-button to color out of spec cells. The default here is blue if > USL and red if < LSL, and I don't think you can edit this in the preferences.
One of these options should get you to where you want to go, I think. If you want to color the row state, then you could also try the Color by Column() command. See the Scripting Index example:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Color by Column( :Age );
Wait( 2 );
dt << Color Rows by Row State;
The last command will also color the rows according to how they've been assigned in Color by Column.
Definitely one of these options should get you what you're after.
Good luck!,
DS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Couleur dynamique
Dans le constructeur de graphique, je créé une mesure à partir de la capture ci-dessous :
Une fois que la nouvelle mesure est créé par exemple Transformation[B] = A - B je la rajoute dans le graphique comme dans capture ci-dessous :
Est-il possible de modifier la couleur de la mesure Transformation[B] en fonction des valeurs ?
J'ai essayé avec le script suivant mais rien ne se passe, aucune couleur ne s'affiche sur le graphique !
Graph Builder(
Transform Column(
"indicateurs (A-B)",
Formula( Col Sum( :A ) - Col Sum( :B ) )
),
Size( 534, 450 ),
Show Control Panel( 0 ),
If( indicateurs (A-B) < 0,
Title Fill Color( "Light Red" ),
Title Frame Color( "Light Red" ),
Level Fill Color( {255, 193, 202} ),
Level Frame Color( "Light Red" ),
Level Spacing Color( "Light Red" ),
,
Title Fill Color( "Light Green" ),
Title Frame Color( "Light Green" ),
Level Fill Color( {190, 255, 202} ),
Level Frame Color( "Light Green" ),
Level Spacing Color( "Light Green" ),
),
Variables(
X( :Mois ),
Y( :A ),
Y( :B, Position( 1 ) ),
Group X( :"indicateurs (A-B)"n )
),
Elements( Bar( X, Y( 1 ), Y( 2 ), Legend( 5 ), Label( "Label by Value" ) ) ),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
5,
Properties( 0, {Fill Color( 51 )}, Item ID( "A", 1 ) ),
Properties( 1, {Fill Color( 21 )}, Item ID( "B", 1 ) )
)}
)
)
);