2016-03-29 13 views
1

Birisi, sütun/çubuk tıklatıldığında yeni bir pencere açıldığında bir Highcharts Grafiği oluşturmama yardımcı olabileceğini umuyorum. Ben yeni bir pencere oluşturmadan bunu başarmış ve biri bana söylemek mümkün olabileceğini umuyordumBir Highchart grafiğindeki bir sütunu/çubuğunu tıklayarak yeni bir pencereyi/sekmeyi nasıl açarım?

<a target="_blank">test</a> 

ne yeni bir pencere açılır hitap ayarlamak gerekir: HTML eşdeğer gibi Çok ?

: Bunun yanlış olduğunu aşağıdaki gibi bir şey olabileceğini düşündüm

$(function() { 
 

 
    $('#container').highcharts({ 
 
     chart: { 
 
      type: 'column' 
 
     }, 
 
     title: { 
 
      text: 'Title' 
 
     }, 
 
     credits: { 
 
      enabled: false 
 
     }, 
 
     xAxis: { 
 
      categories: ["category_1", "category_2", "category_3", "category_4"], 
 
      crosshair: true 
 
     }, 
 
     yAxis: { 
 
      min: 0, 
 
      title: { 
 
       text: 'Count' 
 
      } 
 
     }, 
 
     tooltip: { 
 
      headerFormat: '<span style="font-size:10px">{point.key}</span><table>', 
 
      pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + 
 
        '<td style="padding:0"><b>{point.y:.1f}</b></td></tr>', 
 
      footerFormat: '</table>', 
 
      shared: true, 
 
      useHTML: true 
 
     }, 
 
     legend: { 
 
      labelFormatter: function() { 
 
       var total = 0; 
 
       for (var i = this.yData.length; i--;) { 
 
        total += this.yData[i]; 
 
       } 
 
       ; 
 
       return 'Total: ' + total; 
 
      }, 
 
      align: 'right', 
 
      verticalAlign: 'top', 
 
      x: -40, 
 
      y: 60, 
 
      floating: true 
 
     }, 
 
     plotOptions: {column: {pointPadding: 0.2, borderWidth: 0, dataLabels: {enabled: true}}, }, 
 
     series: [{ 
 
      name: 'Live Trial Lead Sources', 
 
      data: [{"y":111,"url":"http:\/\/www.google.ie"},{"y":44,"url":"http:\/\/www.google.ie"},{"y":22,"url":"http:\/\/www.google.ie"},{"y":10,"url":"http:\/\/www.google.ie"}], 
 
      cursor: 'pointer', 
 
      point: { 
 
       events: { 
 
        click: function() { 
 
         location.href = this.options.url; 
 
        } 
 
       } 
 
      } 
 
     }] 
 
    }); 
 

 
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
 
<script src="https://code.highcharts.com/modules/exporting.js"></script> 
 
<script src="https://code.highcharts.com/highcharts.js"></script> 
 

 
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>

:

ben Temelde aşağıdaki kodu jsfiddle

de bir örnek var

[{"y":111,"url":"http:\/\/www.google.ie","target"=>"_blank"} ... 

Şimdiden teşekkürler. (update JSFiddle) ile

location.href = this.options.url; 

: o zaman yeni bir pencerede URL açılacaktır

window.open(this.options.url, '_blank'); 

cevap

4

series.point.events.click size ifadenizi geçiş yapabilirsiniz.

İlgili konular