BookmarkSubscribeRSS Feed
markschahl

Community Trekker

Joined:

Jun 18, 2012

Using a second column as value labels OR How to plot one variable and have another appear as label

Hi! 

 

I have two x-variables:

Meeting.# is numeric ordinal (just the Row())
Meeting.ID is character nominal (can be date or some other text descriptor)

I need to plot attendance (X_2-X_8) against Meeting.# so that I can get a trend. But I want to display Meeting.ID as the x-axis labels.

I tried this approach: https://community.jmp.com/t5/Discussions/How-to-Add-Value-Labels-to-a-Column-through-JSL/td-p/41604

But had issues with type-mismatch.

There are other applications of this problem: Experiment.# and Experiment.Description

 

  1. Is there a better way to do this?
  2. Should the be done with Column Property Value Label or as part of Graph Builder?
  3. Ditto Value Ordering
  4. Should I submit a feature request?

Thanks!

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Re: Using a second column as value labels OR How to plot one variable and have another appear as lab

Greetings Mark,

Here is what I did to get to the solution that I believe you need

  1. Create an new column which has a formula of:      :Meeting.ID || "[" || Char( :Meeting.# ) || "]"    This makes each entry as a unique entry
  2. Then for the new column, I set the Column Property "Row Order Levels".  This means that the order of this column will be the order within the data table that the value is found.

Below are the results I got using your Meeting Attendance BarChart with the column that I generated

attendance.PNG

I have attached the data table I used

 

Jim
Highlighted
gzmorgan0

Super User

Joined:

Jul 25, 2016

Solution

Re: Using a second column as value labels OR How to plot one variable and have another appear as lab

Mark, Jim's solution is a good one, and simpler to implement.

 

This is an FYI regarding your label script.  Below is a script that will provide you with the labels you want. The value labels are assigned to :Meeting.#. Note, since :Meeting.# is numeric it does not require the "1" = "V1_0" but 1 = "V1_0".

 

Names Default To Here( 1 );
meetID = column("Meeting.#");
textID = column("X__10");
NamesValuesList = {};
For( i = 1, i <= nitems(meetID << get values ), i++,
	Insert Into(
		NamesValuesList,
		Parse(
			Char( meetID[i] ) || " = \!"" || textID[i] || "\!""
			
		)
	)
);
meetID << Set Property( "Value Labels", Eval( NamesValuesList ) );
4 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Re: Using a second column as value labels OR How to plot one variable and have another appear as lab

Greetings Mark,

Here is what I did to get to the solution that I believe you need

  1. Create an new column which has a formula of:      :Meeting.ID || "[" || Char( :Meeting.# ) || "]"    This makes each entry as a unique entry
  2. Then for the new column, I set the Column Property "Row Order Levels".  This means that the order of this column will be the order within the data table that the value is found.

Below are the results I got using your Meeting Attendance BarChart with the column that I generated

attendance.PNG

I have attached the data table I used

 

Jim
Highlighted
gzmorgan0

Super User

Joined:

Jul 25, 2016

Solution

Re: Using a second column as value labels OR How to plot one variable and have another appear as lab

Mark, Jim's solution is a good one, and simpler to implement.

 

This is an FYI regarding your label script.  Below is a script that will provide you with the labels you want. The value labels are assigned to :Meeting.#. Note, since :Meeting.# is numeric it does not require the "1" = "V1_0" but 1 = "V1_0".

 

Names Default To Here( 1 );
meetID = column("Meeting.#");
textID = column("X__10");
NamesValuesList = {};
For( i = 1, i <= nitems(meetID << get values ), i++,
	Insert Into(
		NamesValuesList,
		Parse(
			Char( meetID[i] ) || " = \!"" || textID[i] || "\!""
			
		)
	)
);
meetID << Set Property( "Value Labels", Eval( NamesValuesList ) );
markschahl

Community Trekker

Joined:

Jun 18, 2012

Re: Using a second column as value labels OR How to plot one variable and have another appear as lab

Thanks! From your script I know see why mine did not work:

 

Parse( "\!"" || Char(ValuesList[i]) || "\!" = \!"" || LabelsList[i] || "\!"" ) )

markschahl

Community Trekker

Joined:

Jun 18, 2012

Re: Using a second column as value labels OR How to plot one variable and have another appear as lab

Jim:

 

Thanks for the elegant solution!