Vertical labels in matrix table | XM Community
Question

Vertical labels in matrix table

  • 1 February 2024
  • 10 replies
  • 102 views

Badge +5

We have a matrix table with a lot of labels on the top axis. Wondering if anyone out there knows the html to change the labels to vertical like you can do in Excel and in the image below. It would be much easier on the user so they wouldn’t have to scroll to the right to see the other options. Thank you. 

 

 


10 replies

Userlevel 6
Badge +27

Try the below code in the Matrix question JS:

	jQuery("#"+this.questionId+" .Answers th .LabelWrapper span").css({"writing-mode":"vertical-rl","text-orientation":"mixed","white-space":"nowrap"});

 

Badge +5

Unfortunately, it still is showing up horizontally after adding the JS …

 

 

Userlevel 6
Badge +27

Unfortunately, it still is showing up horizontally after adding the JS …

 

Which layout are you using?

 

Badge +5

Simple. Which one is best for the JS to take? Appreciate your assistance. 

Userlevel 6
Badge +27

  

Simple. Which one is best for the JS to take? Appreciate your assistance. 

You can try classic layout for JS to take but if you want Simple layout then use below CSS in the HTML view of Matrix question text.

<style>
.matrix .matrix-table .matrix-scale-points-item{
writing-mode: vertical-lr;
text-orientation: mixed;
white-space: nowrap;
align-items:center
}
</style>

 

Badge +5

Holy cow - that worked!!! Thank you so much. Any way to get them to orientate the other way so they read from bottom to top rather than top to bottom below? I thought it was maybe changing “vertical-lr” to “vertical-rl” but that didn’t work. If not, this will work. 

 

 

Userlevel 7
Badge +27

Holy cow - that worked!!! Thank you so much. Any way to get them to orientate the other way so they read from bottom to top rather than top to bottom below? I thought it was maybe changing “vertical-lr” to “vertical-rl” but that didn’t work. If not, this will work. 

 

 

Add transform: rotate(180deg); to your CSS rule.

Badge +5

Boom! Awesome. Thanks, Tom and Shashi! This will make a big difference.

 

Badge +5

Shashi -

To be able to move my entire survey to Simple, I have to undo a bunch of requirements and validations, which I’d rather not do since it is a long and complex survey. I’ve tried your JS in Classic and it isn’t taking. Do I need to change anything in the coding that points to the exact questionID or anything? Again, much thanks for your help.

-dj

Badge +3

How do I achieve vertical headings in the modern layout?

Both suggestions above unfortunately do not work…

Thanks!

Leave a Reply