最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - making title in highcharts clickable and work with bootstrap popover? - Stack Overflow

matteradmin8PV0评论

Hi I was wondering how to make the title in highcharts a link so that it would work with bootstrap's popover functionality. Here is a fiddle

/

$(function () {
         $('#container').highcharts({
             chart: {},
             title: {
                 text: 'Sales Funnel ' + '<a style="font-size:12px" id="popoverFunnel" data-toggle="popover" title="hello" data-content="hellooo">Hello</a>' 
             },
             xAxis: {
                 minPadding: 0.05,
                 maxPadding: 0.05
             },

             series: [{
                 data: [{
                     x: 0,
                     y: 29.9,
                     url: ''
                 }, {
                     x: 1,
                     y: 71.5,
                     url: ''
                 }]
             }],


             plotOptions: {
                 series: {
                     cursor: 'pointer',
                     point: {
                         events: {
                             click: function () {
                                 var url = this.options.url;
                                 window.open(url);
                             }
                         }
                     },
                 }
             },
         });
     });

    $('document').ready(function () {
        $('#popoverFunnel').popover();
    });

Thank you James

Hi I was wondering how to make the title in highcharts a link so that it would work with bootstrap's popover functionality. Here is a fiddle

http://jsfiddle/287JP/4/

$(function () {
         $('#container').highcharts({
             chart: {},
             title: {
                 text: 'Sales Funnel ' + '<a style="font-size:12px" id="popoverFunnel" data-toggle="popover" title="hello" data-content="hellooo">Hello</a>' 
             },
             xAxis: {
                 minPadding: 0.05,
                 maxPadding: 0.05
             },

             series: [{
                 data: [{
                     x: 0,
                     y: 29.9,
                     url: 'http://www.google.'
                 }, {
                     x: 1,
                     y: 71.5,
                     url: 'http://www.yahoo.'
                 }]
             }],


             plotOptions: {
                 series: {
                     cursor: 'pointer',
                     point: {
                         events: {
                             click: function () {
                                 var url = this.options.url;
                                 window.open(url);
                             }
                         }
                     },
                 }
             },
         });
     });

    $('document').ready(function () {
        $('#popoverFunnel').popover();
    });

Thank you James

Share Improve this question edited Apr 1, 2014 at 22:12 James asked Apr 1, 2014 at 22:05 JamesJames 5571 gold badge12 silver badges31 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

Set title.useHTML = true, see: http://jsfiddle/287JP/5/

     $('#container').highcharts({
         title: {
             useHTML: true,
             text: 'Sales Funnel ' + '<a style="font-size:12px" id="popoverFunnel" data-toggle="popover" title="hello" data-content="hellooo">Hello</a>' 
         },
         ...
     });

I took your example and made it work with Bootstrap. See http://jsfiddle/key2xanadu/zfsfz0c9/.

The solution involves ID tagging the puppies and then tooltipping them at the bottom:

$('document').ready(function () { 
    $("#text_title").tooltip({placement: 'bottom', title:"HELLO TITLE!"});
    $("#label_one").tooltip({placement: 'bottom', title:"HELLO ONE!"});
    $("#label_two").tooltip({placement: 'bottom', title:"HELLO TWO!"});
});

Example also shows how to add tooltips to the x-axis labels!

Post a comment

comment list (0)

  1. No comments so far