src/charts/legend.js
function splitInLines() {
            let legendEntries = svg.selectAll('.legend-entry');
            let numberOfEntries = legendEntries.size();
            let lineHeight = (chartHeight / 2) * 1.7;
            let newLine = svg.select('.legend-group')
              .append('g')
                .classed('legend-line', true)
                .attr('transform', `translate(0, ${lineHeight})`);
            let lastEntry = legendEntries.filter(`:nth-child(${numberOfEntries})`);

            lastEntry.attr('transform', `translate(${markerSize},0)`);
            newLine.append(() => lastEntry.node());
        }
function splitInLines() {
            let legendEntries = svg.selectAll('.legend-entry');
            let numberOfEntries = legendEntries.size();
            let lineHeight = (chartHeight / 2) * 1.7;
            let newLine = svg.select('.legend-group')
              .append('g')
                .classed('legend-line', true)
                .attr('transform', `translate(0, ${lineHeight})`);
            let lastEntry = legendEntries.filter(`:nth-child(${numberOfEntries})`);

            lastEntry.attr('transform', `translate(${markerSize},0)`);
            newLine.append(() => lastEntry.node());
        }
function splitInLines ( ) { let legendEntries = svg . selectAll ( '.legend-entry' ) ; let numberOfEntries = legendEntries . size ( ) ; let lineHeight = ( chartHeight / 2 ) * 1.7 ; let newLine = svg . select ( '.legend-group' ) . append ( 'g' ) . classed ( 'legend-line' , true ) . attr ( 'transform' , ` ${ lineHeight } ` ) ; let lastEntry = legendEntries . filter ( ` ${ numberOfEntries } ` ) ; lastEntry . attr ( 'transform' , ` ${ markerSize } ` ) ; newLine . append ( ( ) => lastEntry . node ( ) ) ; }
Simple method to move the last item of an overflowing legend into the next line
@return {void}
@private
Simple method to move the last item of an overflowing legend into the next line