cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

Color on indicators

hcarr01
Level VI

Hello everyone,


I am trying to create a report in JMP to see drifts in certain processes.


For example, I study 6 items in my process and I would like to have an indicator with colors:

- if 5 consecutive points (or more) greater than 3sigma: red color

- if 3 consecutive points (or more) greater than 3sigma: yellow color

- otherwise green color


And then I would like to be able to display in a report something like this per item based on the indicator colors:

undefined


How could I go about having something similar on JMP?

Thank you for your reply.


This post originally written in French and has been translated for your convenience. When you reply, it will also be translated back to French .

12 REPLIES 12
hcarr01
Level VI

Re: Color on indicators

Thank you for your reply.


It works but not exactly as it should.

I tried to make modifications on the second if loop but I can't find the solution.

Below is the exact result I would like to achieve:

undefined


This post originally written in French and has been translated for your convenience. When you reply, it will also be translated back to French .

txnelson
Super User


Re: Couleur sur des indicateurs

My last script assumed you only wanted the last row in a series to retain the calculated color.  To accomplish what your latest specification, I just commented out the lines that reset the colors if the script determined it wasn't the last row in the series.

txnelson_0-1736771162139.png

names default to here(1);
dt = current data table();

// Créez une nouvelle colonne pour l'indicateur
dt << New Column("Indicateur", Character, Nominal);
	
one_color = "xyz";
icolor = 0;

For Each Row(
	// If the value of Article has changed set icolor to 0
	If( Lag( :Article ) != :Article,
		icolor = 0
	);
	// If status is red, increment icolor else set it back to zero
	If( :status == "red",
		icolor++,
		icolor = 0
	);
	// Check for the number of icolor
	// Set the value for the cell to the appropriate color
	// When a color is specified remove no longer correct cell colors
	// for previous rows
	If(
		icolor >= 5,
			dt:Indicateur << color cells("red",row());
			//dt:Indicateur << color cells("",row()-1);
			/*If( icolor == 5,
				dt:Indicateur << color cells("",row()-2);
			);*/,
		icolor >= 3,
			dt:Indicateur << color cells("yellow",row());
			//dt:Indicateur << color cells("",row()-1);
	);
);
Jim
jthi
Super User


Re: Couleur sur des indicateurs

I'm not sure how this is anymore related to the initial question, but there is a bit different option for creating the indicator column

dt = Current Data Table();
dt << New Column("Color", Character, Nominal, 
	Set Property(
		"Value Colors",
		{"Green" = "Green", "Red" = "Red", "Yellow" = "Yellow"}
	),
	Color Cell By Value,
	Formula(
		is_red = :status == "red";
		
		If(Row() == 1,
			red_count = is_red;
		);
		
		If(:Article != Lag(:Article, 1) | is_red == 0,
			red_count = is_red;
		,
			red_count = red_count + is_red;
		);
		If(red_count >= 5,
			"Red";
		, red_count >= 3,
			"Yellow"
		,
			"Green"
		);
	)
);

 

-Jarmo