Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Chanty4u
MVP
MVP

RE:Size Reduce

hi all,

I have small issue:

I need to reduce the size of the label into two lines

means length of the label values.

Example: in my image i hve label name  pharmacy h/w replacement     it is in single line.

REQ: i need that in   two lines:  like:  pharmacy h/w

                                                                      replacement

Please refer the image .

size1.png

Thanks in advance.

Suresh

1 Solution

Accepted Solutions
settu_periasamy
Master III
Master III

May be try with Calculated Dimension. Like

=if(FindOneOf(Dim,' ',1)<10,Left(Dim,FindOneOf(Dim,' ',2))&chr(10)&Mid(Dim,FindOneOf(Dim,' ',2),Len(Dim)) ,

if(FindOneOf(Dim,' ',2)>=10,Left(Dim,FindOneOf(Dim,' ',1))&chr(10)&Mid(Dim,FindOneOf(Dim,' ',1),Len(Dim)),Dim))


Capture.JPG

View solution in original post

14 Replies
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Is it just this one label, or do you require a rule to split labels?

If it is just the one, you can do this in the load script:

LOAD

   MyField,

   Replace(MyField, 'pharmacy h/w replacement', 'pharmacy h/w' & chr(10) & 'replacement') as MyDimension,

This will give you two fields, with and without the line break, so you can use different in different places - you could just rename the field if you only need it once.

If it needs to be more general you could replace all spaces:

   Replace(MyField, ' ', chr(10)) as MyDimension,


But it looks like that could get messy for you.


Working out to only replace a space with a line break if it is in the middle of a long dimension could get quite tricky to achieve.


Hope that helps.


Steve

Gysbert_Wassenaar

I recommend changing the chart orientation on the Style tab so the bars are displayed horizontally. You can resize the chart so the labels show correctly. And you can insert line breaks like Steve‌ explained.


talk is cheap, supply exceeds demand
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Good call gwassenaar‌ - I set about answering the question, rather than engaging brain about whether there was a better way of showing the data.

HirisH_V7
Master
Master

Hi ,

By Horizontal orientation  and Control shift you can make your right view,

Bar chart Label.PNG

HTH,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
Chanty4u
MVP
MVP
Author

thnx alot fr ur reply dark.

I need for dimension level. not for single field.

Chanty4u
MVP
MVP
Author

thnx gysbert.

i need in vertically only....

Chanty4u
MVP
MVP
Author

i tried dat one bro...but  i need verical only.... that label names shud be in two lines.

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

In that case, you could do the thing of replacing all spaces or underscores with new line characters:

Replace(Replace(MyField, '_', ' '), ' ', chr(10)) as MyDimension,

This will result in many lines for some dimensions though.  Another approach is to create an ApplyMap table of original and replaced dimension names in Excel.  Here you can list all of the original names (which you can copy and paste from a LisBox) and then type into the next cell a new name, that can include line feeds.

You would then have the syntax:

Map_2LineDim:

LOAD

   Orig,

   New

FROM [.\RenameDims.xls]

(biff, embedded labels, header is 1 lines, table is [Rename$]);

LOAD

   MyField,

   ApplyMap('Map_2LineDim', MyField) as MyDimension,

   ...

This way you can control exactly what you have for each dimension.  Also, given that ApplyMap defaults to the original value when no lookup match is found, any values which you don't put in the lookup will appear as they did before.

This post gives a lot more information on ApplyMap:

http://www.quickintelligence.co.uk/applymap-is-it-so-wrong/

Steve

settu_periasamy
Master III
Master III

May be try with Calculated Dimension. Like

=if(FindOneOf(Dim,' ',1)<10,Left(Dim,FindOneOf(Dim,' ',2))&chr(10)&Mid(Dim,FindOneOf(Dim,' ',2),Len(Dim)) ,

if(FindOneOf(Dim,' ',2)>=10,Left(Dim,FindOneOf(Dim,' ',1))&chr(10)&Mid(Dim,FindOneOf(Dim,' ',1),Len(Dim)),Dim))


Capture.JPG