score:13

Accepted answer

you could redefine the credits click handler after the plot is drawn in the charts load event:

    chart: {
        events:{
            load: function() {
                this.credits.element.onclick = function() {
                    window.open(
                      'http://www.example.com',
                      '_blank'
                    );
                 }
            }
        }                
    },

fiddle here.

score:3

http://jsfiddle.net/ptasdfmk/

// plugin to add support for credits.target in highcharts.
highcharts.wrap(highcharts.chart.prototype, 'showcredits', function (proceed, credits) {
    proceed.call(this, credits);

    if (credits.enabled && this.credits) {
        this.credits.element.onclick = function () {

            // dynamically create an anchor element and click it
            // use the settings defined in highcharts (credits.target)

            var link = document.createelement('a');
            link.href = credits.href;
            link.target = credits.target;
            link.click();

        }
    }
});

$('#container').highcharts({

    credits: {
        enabled: true,
        text: 'credits',
        href: 'http://example.com',
        target: '_blank'
    },  

});

using the highcharts configuration (credits section with target) a new link element is created on the fly and clicked, when you click "credits". chained events. this allows to reuse the code and act based on the configuration.

score:6

here is solution that worked for me.

credits: {
    enabled: true,
    text: 'text',
    href: 'javascript:window.open("http://www.example.com/", "_blank")'
},

Related Query

More Query from same tag