title: How to reference yData from another series in each category of a highcharts column chart
body: <p>I have a column chart, which displays two series, with data for a number of years.</p>
  
  <p>Each year has a column for each of the two series.</p>
  
  <p>I want to create a data label for these columns that shows the percentage of the total sum of the value of the two columns (sum of yData) for each year. To do this I need to reference both the current y value and the sum of the two y values in a given category (year).</p>
  
  <p>I've tried something like this:</p>
  
  <pre><code>dataLabels:{
      enabled:true,
      formatter:function(e) {
          var mychart = $('#e_74').highcharts();
          var sum = parseInt(mychart .series[1].yData, 10) + parseInt(mychart .series[0].yData, 10);
          var pcnt = (this.y / sum * 100);
          return Highcharts.numberFormat(pcnt) + '%';                     
      }
  }
  </code></pre>
  
  <p><strong>The Problem:</strong></p>
  
  <p>This works for the first year / category, because the sum of the yData is always the sum of the first element of the two series - so it is correct in the first year. However subsequent years still reference the total of the sum of these first two elements - making subsequent data labels inaccurate.</p>
  
  <p>How can I reference the current sum of the yData for each individual category?</p>
  
  <p>Thanks in advance for your time.</p>
  
  <p>Here is a <a href="http://jsfiddle.net/RG8YT/12/" rel="nofollow">jsfiddle</a> of my work in progress</p>
  
  <p>And here is a copy of the complete code I'm trying to implement for this graph</p>
  
  <pre><code>$(function () {         
       $('#e_74').highcharts({
          chart: {
              type: 'column'
          },
          credits: {
          enabled: false
          },
          noData: {
              style: {
                  fontWeight: 'bold',
                  fontSize: '20px'
              }
          },
          title: {
              text: 'Title',
          },
          navigation: {
              buttonOptions:
              {
                  enabled: false
              }
          },
          xAxis: {
                categories: [2013, 2014]
          },
          yAxis: {
              min: 0,
              title: {
                  text: 'Number '
              }
          },
          tooltip: {
              headerFormat: '&lt;span style="font-size:10px"&gt;{point.key}&lt;/span&gt;&lt;table&gt;',
              pointFormat: '&lt;tr&gt;&lt;td style="color:{series.color};padding:0"&gt;{series.name}: &lt;/td&gt;' +
                  '&lt;td style="padding:0"&gt;&lt;b&gt;{point.y:,.0f} &lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;',
              footerFormat: '&lt;/table&gt;',
              shared: true,
              useHTML: true
          },
          plotOptions: {
              column: {
                  pointPadding: 0,
                  borderWidth: 0
                  },
              series: {
               dataLabels:{
                      enabled:true,
                      formatter:function(e) {
                          var mychart = $('#e_74').highcharts();    
                          var sum = parseInt(mychart.series[1].yData[1], 10) + parseInt(mychart.series[0].yData[1], 10);
                          var pcnt = (this.y /  sum * 100);
                          return Highcharts.numberFormat(pcnt) + '%';
                      }
                  }
                  }
              },
              series: [{showInLegend: true, name: 'With trained HW', data: [94426, 147615]}, {showInLegend: true, name: 'Without trained HW', data: [16863, 29198]}]
          });
      });
  </code></pre>