cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
markschahl
Level V

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

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

View solution in original post

gzmorgan0
Super User (Alumni)

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 ) );

View solution in original post

7 REPLIES 7
txnelson
Super User

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
gzmorgan0
Super User (Alumni)

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
Level V

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] || "\!"" ) )

godfeatha
Level I

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

Hello, 

Is there an elegant way to add the value of each bar in the graph, prefereably vertically on the bar? 

 

Thanks!

txnelson
Super User

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

The value for each segment within each bar can be added by specifying to "Label by Value" in the control panel for Graph Builder. Other labeling could be done using JSL, and "<< Add Graphics Script".
Jim
godfeatha
Level I

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

Thanks! Guess I can't use "Bullet" and Value labels together. 

markschahl
Level V

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!