centre of a bubble chart point - Javascript highcharts

Javascript examples for highcharts:Bubble Chart

Description

centre of a bubble chart point

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){//from   w w  w .j  av a2s. c  o  m
$(function() {
      $('#container').highcharts({
         chart: {
            type: 'bubble',
         },
         title: {
            text: 'Expanding Bubbles'
         },
         plotOptions: {
            bubble: {
               cursor: 'pointer',
               point: {
                  events: {
                     click: function() {
                        var renderer = this.series.chart.renderer,
                                    chart = this.series.chart,
                                    point = this,
                                    path;
                        path = renderer.path(['M',point.plotX + chart.plotLeft,point.plotY + chart.plotTop,'L',100,100])
                           .attr({
                              'stroke-width': 1,
                              stroke: 'red'
                           }).add();
                        this.graphic.animate({
                           opacity: 0.2
                        });
                     }
                  }
               }
            }
         },
         series: [{
            name: 'First',
            data: [{x:2.04, y:2.07, z:1},{x:0.82, y:1.03, z:1},{x:1.57, y:0.64, z:1},{x:0.7, y:0.41, z:1},{x:0.65, y:0.61, z:1},{x:1.02, y:0.97, z:1}]
         }, {
            name: 'Second',
            data: [{x:0.3, y:0.59, z:1},{x:0.06, y:0.64, z:1},{x:1.3, y:0.9, z:1},{x:0.76, y:0.38, z:1},{x:0.29, y:0.83, z:1},{x:0.23, y:1.06, z:1}]
         }, {
            name: 'Third',
            data: [{x:1.67, y:1.23, z:1},{x:0.93, y:1.02, z:1},{x:0.48, y:0.56, z:1},{x:1.52, y:1.03, z:1},{x:0.9, y:1.01, z:1},{x:0.88, y:1.02, z:1},{x:0.72, y:1.02, z:1}]
         }, {
            name: 'Fourth',
            data: [{x:1.52,y:1.82,z:1},{x:2.72,y:0.77,z:1}]
         }]
      });
   });
    });

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/highcharts-more.js"></script> 
      <div id="container" style="height: 400px; width: 500px;"></div>  
   </body>
</html>

Related Tutorials