chart value (Y)s series and Category (Y)s series word wrap

hatra
edited February 11, 2022 in Analytics #1

Hi ,
Is there way to custom word warp (Y)s series and Category (Y)s series, by custom I mean controlling how many world/characters to wrap.

Thanks

Comments

  • jfranken
    edited October 28, 2019 #2

    The following code wraps the Y Axis labels if they are longer than 6 characters. If you wrap the labels, you might also need to change the Scale settings on the Format Chart tab to avoid overlapping text.

    function beforeDrawAxisLabel( axis, label, icsc )
    {
        var l1 = label.getCaption().getValue();
        var len = l1.length();
        var brk = 6
        if (len > brk) {
           label.getCaption().setValue(l1.substr(0,brk) + "\n" + l1.substr(brk,len));
        }
    }
    
    Warning No formatter is installed for the format ipb
  • thanks,
    I have applied the code on the chart > script tab but it make the chart disappear ( when I remove the code chart does appear
    thanks

  • Most likely the reason the chart is not displaying is because there is a syntax error in your code. I tested the code above and it works properly, so either it did not get copied correctly or there is a different issue with the code. Is there another beforeDrawAxisLabel function defined? Do all of the brackets match? Those are the most common issues.

    Warning No formatter is installed for the format ipb
  • I have tested it on a sample classic car database and it works thanks