2013-10-11 7 views
18

मैं हर स्तंभटूलटिप हाईचार्ट्स में एकाधिक श्रृंखला डेटा कैसे प्राप्त करें?

tooltip: { 
    formatter: function() { 
     return '<span style="color:#D31B22;font-weight:bold;">' +this.series.name +': '+ this.y +'<br/>'+ 
       '<b style="color:#D31B22;font-weight:bold;">'+this.x +'</b><span>'; 
    } 
}, 

और डाटा

series: [{ 
    showInLegend: false, 
    name: 'Total Click', 
    data: [3000,200,50,4000], 
    color: '#9D9D9D' 
}, { 
    showInLegend: false, 
    name: 'Total View', 
    data: [100,2000,3000,4000], 
    color: '#D8D8D8' 
}] 

मैं इस तरह लेकिन टूल टिप में केवल एक ही श्रृंखला डेटा एक बार में दिखाया जा रहा है उपयोग कर रहा हूँ पर टूलटिप में कई श्रृंखला डाटा प्रदर्शित करना चाहते हैं। मैं इस तरह के डेटा को प्रदर्शित करना चाहता हूं (कुल दृश्य: 100 और कुल क्लिक: 3000)

+0

अपने कोड जोड़ दें, तो मैं आपकी मदद कर सकता :) –

+0

हे, मोहित मेरी कोड की जाँच करें मुझे लगता है कि यह है कि तुम क्या जरूरत है http://jsfiddle.net/pintu31/AcNUM/2/ –

+0

अच्छा काम ............... Pragnesh –

उत्तर

29

तो किसी को भी scatterplot की तलाश में इस कोड को

updated DEMO

tooltip: { 
     formatter: function() { 
      var s = []; 

      $.each(this.points, function(i, point) { 
       s.push('<span style="color:#D31B22;font-weight:bold;">'+ point.series.name +' : '+ 
        point.y +'<span>'); 
      }); 

      return s.join(' and '); 
     }, 
     shared: true 
    }, 
+0

's.push (' '' – grantiago

12

आपको साझा पैरामीटर http://api.highcharts.com/highcharts#tooltip.shared और फिर प्रत्येक बिंदु पर फॉर्मेटर पुनरावर्तक का उपयोग करने की आवश्यकता है।

1

का उपयोग कर प्रयास करें, यहाँ साझा टूलटिप दिखाने के लिए solution है।

formatter: function(args) { 
    var this_point_index = this.series.data.indexOf(this.point); 
    var this_series_index = this.series.index; 
    var that_series_index = this.series.index == 0 ? 1 : 0; // assuming 2 series 
    var that_series = args.chart.series[that_series_index]; 
    var that_point = that_series.data[this_point_index]; 
    return 'Client: ' + this.point.name + 
      '<br/>Client Health: ' + this.x + 
      '<br/>' + this.series.name + ' Bandwidth: ' + this.y + 'Kbps' + 
      '<br/>' + that_series.name + ' Bandwidth: ' + that_point.y + 'Kbps'; 
} 

Jsfiddle link to Solution

+0

क्या कॉलम शर्ट्स के लिए ऐसा कोई समाधान है? – es3735746

संबंधित मुद्दे