el

Limiting legend characters in chart axis label-Qlikview

Monday, October 17, 2016

When comes to UI design, it’s important to show objects visually effective. If legend has too many characters, chart will automatically adjust to certain characters and rest will be truncated. Using the below load script will limit the legend till the character limit you specify, rest of the character comes in next line. We need to give input as field name which we need to truncate, on which table and length of character to be limited. 1.       Defining the input parameters SUB SplitString (vField, vTable, vSegLen, vSplitField) 2.       Split the string in "Field" at the first blank after segment length of "SplitLength" Split_temp: LOAD *, trim(mid($(vField), Start, Count-1)) as Split, RowNo() as SplitId ; LOAD *, index( mid($(vField) & ' ', Start+$(vSegLen)), ' ' )+$(vSegLen)  as Count ; LOAD $(vField), if($(vField) = Previous($(vField)) ,peek('Start')+peek('Count') ,1 )as Start RESIDENT $(vTable) WHILE IterNo() <= div(len(**_$(vField)_**),**_$(vSegLen)_**)+1 ; LEFT JOIN(**_$(vTable)_**) **LOAD** **_$(vField)_**, concat(Split, chr(10), SplitId) as **_$(vSplitField)_** RESIDENT Split_temp WHERE len(trim(Split)) > 0 GROUP BY Title ; DROP TABLE Split_temp; END SUB 3.       Table on which the split to be done MyTable: LOAD *, RecNo() as RecId INLINE [ Title This is script which limits the legend This needs input to be passed You can fix the length of characters ]; 4. Call parameters Field, Tablename, SplitLength, OutputSplitField        CALL SplitString('Title', 'MyTable', 15, 'SplitTitle');

No items found.