BookmarkSubscribe
Choose Language Hide Translation Bar
david707
Community Trekker

Add secondary x-axis but don't sort by it

This is going to be hard to explain by text so please see images below. Basically I'd like to have grouped by category below the main x-axis without it messing up the sort order. Whilst it's possible to have category "above" the main x-axis, this doesn't look nice and causes category grid lines to be drawn every entry instead of only when it changes.

 

jmp request.png

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
vince_faller
Super User

Re: Add secondary x-axis but don't sort by it

So You could readd the desired order below that even, then turn off the third axis. 

2019-07-10_14-59-17.png

 

Names default to here(1);
dt = New Table( "Test",
	Add Rows( 6 ),
	New Column( "Desired Order",
		Numeric,
		"Nominal",
		Format( "Best", 12 ),
		Set Values( [1, 2, 3, 4, 5, 6] )
	),
	New Column( "Category",
		Character,
		"Nominal",
		Set Values( {"A", "B", "B", "A", "A", "B"} )
	),
	New Column( "Data",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [1, 2, 3, 4, 5, 6] )
	)
);

dt = Graph Builder(
	Variables(
		X( :Desired Order ),
		X( :Category, Position( 1 ) ),
		X( :Desired Order, Position( 1 ) ),
		Y( :Data ),
		Color( :Category )
	),
	Elements( Points( X( 1 ), X( 2 ), Y, Legend( 107 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Desired Order",
			ScaleBox,
			{Label Row(
				3,
				{Automatic Tick Marks( 0 ), Show Major Labels( 0 ),
				Show Major Ticks( 0 )}
			)}
		),
		Dispatch( {}, "400", LegendBox, {Set Title( "" )} )
	)
);

Hope that works for you.

 

2019-07-10_14-59-17.png  

Vince Faller - Predictum
1 REPLY 1
Highlighted
vince_faller
Super User

Re: Add secondary x-axis but don't sort by it

So You could readd the desired order below that even, then turn off the third axis. 

2019-07-10_14-59-17.png

 

Names default to here(1);
dt = New Table( "Test",
	Add Rows( 6 ),
	New Column( "Desired Order",
		Numeric,
		"Nominal",
		Format( "Best", 12 ),
		Set Values( [1, 2, 3, 4, 5, 6] )
	),
	New Column( "Category",
		Character,
		"Nominal",
		Set Values( {"A", "B", "B", "A", "A", "B"} )
	),
	New Column( "Data",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [1, 2, 3, 4, 5, 6] )
	)
);

dt = Graph Builder(
	Variables(
		X( :Desired Order ),
		X( :Category, Position( 1 ) ),
		X( :Desired Order, Position( 1 ) ),
		Y( :Data ),
		Color( :Category )
	),
	Elements( Points( X( 1 ), X( 2 ), Y, Legend( 107 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Desired Order",
			ScaleBox,
			{Label Row(
				3,
				{Automatic Tick Marks( 0 ), Show Major Labels( 0 ),
				Show Major Ticks( 0 )}
			)}
		),
		Dispatch( {}, "400", LegendBox, {Set Title( "" )} )
	)
);

Hope that works for you.

 

2019-07-10_14-59-17.png  

Vince Faller - Predictum