Jump to content
We've recently updated our Privacy Statement, available here ×
  • High Chart - How to prevent long axis labels from shortening with "..." suffix


    vchiem
    • Features: Charts Version: v6.4 Product: Jaspersoft® Studio

    Issue:

     

    The following HTML5 chart has the x-axis label name shortened with an ellipsis ("..."), highlighted in yellow. 

    We would like to display this label name fully without any truncation. How can this be achieved ?

    longlabeltruncated_0.png.14c6007934b8cfecb0e864b8e23cd303.png


     

    Solution:

    There are two properties that can be set depending on whether you want the label to be auto-rotated after a certain limit or not.

    Option 1:  Set the 'autoRotationLimit' property to a lower value such as 40 (default is 80 but you can set it to a value that works for you). The JRXML source code would contain this: 

    <hc:chartProperty name="xAxis.labels.autoRotationLimit" value="40"/> 

    The label names will not be auto rotated and the label will be word wrapped. The chart will look like this:

    longlabel_0.png.8058cfc06a26e92c067ffcde1ddcabe4.png

    Option 2: Set the 'style.textOverflow' property to "none". The JRXML source code would contain this:

    <hc:chartProperty name="xAxis.labels.style.textOverflow" value="none"/>

    The chart will look like this:

    rotatinglonglabelcapture_1.png.05d6c43e923b3e67845548ac0091ede7.png

    Note 1: The 'style.textOverflow' property is not listed in the Advanced Properties of the Chart Formatting tab, but can be effected through the xml code in the Source tab.

    Note 2: The details provided here pertains to the x-axis but there are similar properties for the y-axis.

     

    Definitions:

    autoRotationLimit - When each category width is more than this many pixels, we don't apply auto rotation. Instead, we lay out the axis label with word wrap. A lower limit makes sense when the label contains multiple short words that don't extend the available horizontal space for each label.

    style.textOverflow - From https://api.highcharts.com/highcharts/xAxis.labels.style, it states "Use textOverflow: 'none' to prevent ellipsis (dots)."

     


    ref: 01605211

    longlabeltruncated_0.png.e00cf7011b436e385befd3db938bb00b.png

    longlabel_0.png.536f7447780f7fac0b36d515d4a256ef.png

    rotatinglonglabelcapture_1.png.d4c09dd209cb1d78f1612242365e08a1.png


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...