cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
Introduction
In this post we will explain how to format the axis labels in charts, remove truncation, add new line etc.

Purpose/Benefits
Present long labels, break text to multiple line.
Example
Create chart widget

EDIT WIDGET SCRIPT

The following script will increase number of character which after the label will be truncated
widget.on('beforeviewloaded', function(widget, ev){
    var newMaxCharactersPerLabel = 25;
    ev.options.xAxis.labels.maxCharactersPerLabel = newMaxCharactersPerLabel;
})
The following script will break labels with space into multiple lines (new line for each space):
widget.on('beforeviewloaded', function(widget, ev){
    var newmaxCharactersPerLabel = 25;
    ev.options.xAxis.labels.maxCharactersPerLabel = newmaxCharactersPerLabel;
    ev.options.xAxis.labels.useHTML = true;
    ev.options.xAxis.labels.formatter = function(){
        return this.value.replace(' ','<br/>')
    }
})
Version history
Last update:
‎03-02-2023 09:23 AM
Updated by:
Contributors
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: