2017-02-20 4 views

答えて

0

に行きます。あなたは、ロードイベントでそれを行うことができます。次に、すべての情報とスタイルを含むdivを作成する必要があります。

chart: { 
    events: { 
     load: function() { 
     const menu = document.createElement('div'); 
     menu.style.cssText = 'left:' + (this.plotLeft + this.plotWidth * 0.5) + 'px; top:' + (this.plotTop + this.plotHeight * 0.1) + 'px; position: absolute; display: none; background-color:white; padding: 20px'; 

     let str = ''; 

     this.series[0].data.forEach(point => { 
      str += '<p><div style="display:inline-block;padding-right: 10px;width:10px;height:10px;background-color:' + point.color + ';background-clip:content-box;"></div>' + point.name + '</p>' 
     }); 

     str += ''; 
     menu.innerHTML = str; 
     this.renderTo.appendChild(menu); 

     this.subtitle.on('mouseenter', function(e) { 
      menu.style.display = 'block'; 
     }) 
     } 
    } 
    }, 

例:http://jsfiddle.net/farucbbu/

+0

でサブタイトルである「すべてのラベル」の上でマウスホバーでツールチップを表示することですこれは私が望んでいたものですありがとうございました。しかし、私はthis.series [0] .data.forEachの値を得ることができません(ポイント=> {、.... this.series [0]は私がコンソールにチェックインしたときに私に未定義を与えています。 –

+0

チャートにシリーズをロードしましたか?コールバック内の参照先を確認してください – morganfree

+0

私のコードはフィーリングの例で見つけてください:http://jsfiddle.net/j43sr6hk/1/間違っています。chart.addSeries({...})メソッドを使用してシリーズを動的にロードしています。 –

0

使用ツールチップオプション。詳細については

tooltip: { 
    pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' 
    backgroundColor: '#FCFFC5', 
    borderColor: 'black', 
    borderRadius: 10, 
    borderWidth: 3 
} 

あなたは字幕/タイトル上のMouseEnterイベントを添付する必要が http://www.highcharts.com/docs/chart-concepts/tooltip

+0

私の要件は、添付された画像 –

関連する問題