Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts: Credits on multiple lines

I want to display the source of graphic data in the credits of various Highcharts charts. However the string for this source can at times be quite long and will not fit on a single line. I could manually set the y value of the credits and the spacingBottom of the chart, but since I have over 50 graphics with different sources/credits (some that will fit on a single line, some that won't), is there a way to set default options that would automatically cover all possibilities?

A simple Fiddle here that shows that extra text is cut off: http://jsfiddle.net/kFskZ/

like image 425
The Jakester Avatar asked Nov 04 '22 18:11

The Jakester


1 Answers

I don't know if that's what do you want.

Use Highcharts.setOptions.

var options = {
    credits: {
        text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam suscipit nulla a elit porta vitae condimentum eros vehicula. Nam rhoncus mattis turpis quis rhoncus. Fusce pulvinar faucibus odio, at ultricies diam dignissim et. Donec at nibh est, quis posuere purus.',
    style: {
        width: 300
    },
        position: {
            align: 'left',
            x: 10
        }
    }    
};

Highcharts.setOptions(options);

demo

Update:
There are many possibilities.
You can change legend position and increase your legend width. demo

like image 100
Ricardo Alvaro Lohmann Avatar answered Nov 09 '22 10:11

Ricardo Alvaro Lohmann