How to display y axis label in multiple lines in RGraph?

196 Views Asked by At

Hi I am using RGraph in Angular 7 application. in the y axis i am showing names. instead of showing in one line i want to show in multiple lines. yaxisLabelsAngle: 25 is not working. enter image description here

1

There are 1 best solutions below

0
Richard On BEST ANSWER

From the 3D style it looks like you have an older set of libraries so you may well need to update to the latest version (v6.00, which I just released this past weekend).

You can add newlines in your labels by using \n like this example shows.

Here's a codepen of an example 3D HBar chart:

https://codepen.io/rgraph/pen/MWJQRvX

For which the code is:

<script>
    new RGraph.HBar({
        id:'cvs',
        data: [[8,2],[6,4], [2, 5]],
        options: {
            grouping: 'stacked',
            marginInner: 10,
            variant: '3d',
            xaxis: false,
            yaxis: false,
            yaxisLabels: ['Richard\nDawkins', 'Neil de-Grasse\nTyson','Bill\nNye'],
            yaxisTitle: 'The Y axis title',
            xaxisTitle: 'The X axis title',
            colors: ['purple', 'gold'],
            key: ['A purple bar','A gold bar'],
            keyPosition: 'margin',
            keyPositionY: 15 // Might need to remove this
        }
    }).draw();
</script>