function loadLabels(source) {
  getTableData(source, {t: 'maesarti', nivel:1, d: ['cod_articulo','nombre']}, [{source: 'PRODUCTO', target: 'cod_articulo'}], function(data) {
    data.forEach( function(it) {
      let item = it;
      let element = source.find( function(el) {
         return el.PRODUCTO == item.cod_articulo;
      });

      if ( element ) {
        element.nombre = item.nombre;
      }
    });
  });
}

function productLegendHandler(index,displayName) {
  let id = $(event.target).parents('.Kool__Root').attr('id');
  let item =kchartList[id].data.find( function(el) {
      return el.cod_articulo == displayName;
  });
  return item ? item.nombre : '';
}


function productTipHandler(seriesId, seriesName, index, xName, yName, data, values) {
  return '<div class="chart-datatip"><span class="datatip-item"><span class="datatip-label">'+data.PRODUCTO+ '</span><span class="datatip-value">' + parseFloat(values[0]).toLocaleString('es-ES',{style: 'currency', currency: 'EUR'}) + '(' + Math.round(values[1]*100) / 100 + '%)</span></span><span class="datatip-caption">'+data.nombre+'</span></div>';
}