src/charts/line.js
/**
         * Draws the line elements within the chart group
         * @private
         */
Draws the line elements within the chart group
@private
Draws the line elements within the chart group @private
function drawLines(){
            let lines,
                topicLine,
                maskingRectangle;
            topicLine = d3Shape.line()
                .x(({date}) => xScale(date))
                .y(({value}) => yScale(value));
            lines = svg.select('.chart-group').selectAll('.line')
                .data(dataByTopic);
            lines.enter()
              .append('g')
                .attr('class', 'topic')
              .append('path')
                .attr('class', 'line')
                .attr('d', ({dates}) => topicLine(dates))
                .style('stroke', (d) => (
                    dataByTopic.length === 1 ? `url(#${lineGradientId})` : getLineColor(d)
                ));
            lines
                .exit()
                .remove();
            maskingRectangle = svg.append('rect')
                .attr('class', 'masking-rectangle')
                .attr('width', width)
                .attr('height', height)
                .attr('x', 0)
                .attr('y', 0);
            maskingRectangle.transition()
                .duration(animationDuration)
                .ease(ease)
                .attr('x', width)
                .on('end', () => maskingRectangle.remove());
        }
function drawLines ( ) { let lines , topicLine , maskingRectangle ; topicLine = d3Shape . line ( ) . x ( ( { date } ) => xScale ( date ) ) . y ( ( { value } ) => yScale ( value ) ) ; lines = svg . select ( '.chart-group' ) . selectAll ( '.line' ) . data ( dataByTopic ) ; lines . enter ( ) . append ( 'g' ) . attr ( 'class' , 'topic' ) . append ( 'path' ) . attr ( 'class' , 'line' ) . attr ( 'd' , ( { dates } ) => topicLine ( dates ) ) . style ( 'stroke' , ( d ) => ( dataByTopic . length === 1 ? ` ${ lineGradientId } ` : getLineColor ( d ) ) ) ; lines . exit ( ) . remove ( ) ; maskingRectangle = svg . append ( 'rect' ) . attr ( 'class' , 'masking-rectangle' ) . attr ( 'width' , width ) . attr ( 'height' , height ) . attr ( 'x' , 0 ) . attr ( 'y' , 0 ) ; maskingRectangle . transition ( ) . duration ( animationDuration ) . ease ( ease ) . attr ( 'x' , width ) . on ( 'end' , ( ) => maskingRectangle . remove ( ) ) ; }
Draws the line elements within the chart group
 @private
Draws the line elements within the chart group @private
// We use a white rectangle to simulate the line drawing animation