Привет всем, я стараюсь избегать совпадений в метках данных, это наглядный пример
перекрывающихся меток данных ![overlapping data label](https://i.stack.imgur.com/KGn9f.png)
for (const fv of fields2Show) {
if (fv.data_type && fv.label_format) {
format[fv.name] = (value, id, i, j) => {
const x = j[i].x.baseVal[0].value;
const y = j[i].y.baseVal[0].value;
const current = j[i];
d3.selectAll('#' + this.graphid + ' .c3-chart-texts .c3-text').each(function(a) {
if (!(a.id === id && a.index === i)) {
if ((this.x.baseVal[0].value >= x && this.x.baseVal[0].value <= (x + 40))) {
if ((this.y.baseVal[0].value <= y && this.y.baseVal[0].value >= (y - 12))) {
console.log( current, this); // element actual and element above me
}
}
}
});
return this._formatGraph(value, fv);
};
}
}
В этой части У меня уже есть ярлык, на котором я сейчас нахожусь, и ярлык над мной