reduceMaxNumLines({ labels, min, max, gap, lineHeight, epsilon }) {
    const n = labels.length - 1;
    if (n < 0) {
      return;
    }
    let thisLabel;
    let nextLabel;
    [thisLabel] = labels;
    thisLabel.cMin = min;
    if (n === 0) {
      thisLabel.cMax = max;
      return;
    }
    for (let i = 0; i < n; i++) {
      thisLabel = labels[i];
      nextLabel = labels[i + 1];
      thisLabel.cMax = (thisLabel.center + nextLabel.center - gap) / 2;
      nextLabel.cMin = thisLabel.cMax + gap;
    }

    nextLabel.cMax = max;

    for (let i = 0; i < labels.length; i++) {
      const label = labels[i];
      const a = Math.floor((Math.max(0, label.cMax - label.cMin) + epsilon) / lineHeight);
      const b = Math.min(a, label.maxNumLines);
      label.maxNumLines = Math.max(b, 1);
    }
  }
// Reduce max num lines of a label if the vertical space is not enough
Reduce max num lines of a label if the vertical space is not enough
Reduce max num lines of a label if the vertical space is not enough
reduceMaxNumLines({ labels, min, max, gap, lineHeight, epsilon }) {
    const n = labels.length - 1;
    if (n < 0) {
      return;
    }
    let thisLabel;
    let nextLabel;
    [thisLabel] = labels;
    thisLabel.cMin = min;
    if (n === 0) {
      thisLabel.cMax = max;
      return;
    }
    for (let i = 0; i < n; i++) {
      thisLabel = labels[i];
      nextLabel = labels[i + 1];
      thisLabel.cMax = (thisLabel.center + nextLabel.center - gap) / 2;
      nextLabel.cMin = thisLabel.cMax + gap;
    }
    nextLabel.cMax = max;
    for (let i = 0; i < labels.length; i++) {
      const label = labels[i];
      const a = Math.floor((Math.max(0, label.cMax - label.cMin) + epsilon) / lineHeight);
      const b = Math.min(a, label.maxNumLines);
      label.maxNumLines = Math.max(b, 1);
    }
  }
reduceMaxNumLines ( { labels , min , max , gap , lineHeight , epsilon } ) { const n = labels . length - 1 ; if ( n < 0 ) { return ; } let thisLabel ; let nextLabel ; [ thisLabel ] = labels ; thisLabel . cMin = min ; if ( n === 0 ) { thisLabel . cMax = max ; return ; } for ( let i = 0 ; i < n ; i ++ ) { thisLabel = labels [ i ] ; nextLabel = labels [ i + 1 ] ; thisLabel . cMax = ( thisLabel . center + nextLabel . center - gap ) / 2 ; nextLabel . cMin = thisLabel . cMax + gap ; } nextLabel . cMax = max ; for ( let i = 0 ; i < labels . length ; i ++ ) { const label = labels [ i ] ; const a = Math . floor ( ( Math . max ( 0 , label . cMax - label . cMin ) + epsilon ) / lineHeight ) ; const b = Math . min ( a , label . maxNumLines ) ; label . maxNumLines = Math . max ( b , 1 ) ; } }
Reduce max num lines of a label if the vertical space is not enough
Reduce max num lines of a label if the vertical space is not enough