Add caption to highcharts dinamically

I need to add something like this footer under the charts: http://jsfiddle.net/abenrob/ur02w4j5/

$('#container').highcharts({

chart: {
    type: 'column',
    events: {
        load: function () {
            var label = this.renderer.label("This text will adjust to chart resizing " +
                "and redraws and will be visible on exported images.")
            .css({
                width: '400px',
                fontSize: '9px'
            })
            .attr({
                'r': 2,
                'padding': 5
            })
            .add();

            label.align(Highcharts.extend(label.getBBox(), {
                align: 'center',
                x: 20, // offset
                verticalAlign: 'bottom',
                y: 0 // offset
            }), null, 'spacingBox');

        }
    },
    marginBottom: 120
},

But i need to do it dynamically, so everytime a chart is created a caption for that chart is set. Is there a way to achieve that? Like create a special field for that.

Read more here: Add caption to highcharts dinamically

Leave a Reply

Your email address will not be published. Required fields are marked *