src/charts/stacked-area.js
function drawEmptyDataLine() {
            let emptyDataLine = d3Shape.line()
                .x( (d) => xScale(d.date) )
                .y( () => yScale(0) - 1 );

            let chartGroup = svg.select('.chart-group');

            chartGroup
              .append('path')
                .attr('class', 'empty-data-line')
                .attr('d', emptyDataLine(dataByDateFormatted))
                .style('stroke', 'url(#empty-data-line-gradient)');

            chartGroup
              .append('linearGradient')
                .attr('id', 'empty-data-line-gradient')
                .attr('gradientUnits', 'userSpaceOnUse')
                .attr('x1', 0)
                .attr('x2', xScale(data[data.length - 1].date))
                .attr('y1', 0)
                .attr('y2', 0)
                .selectAll('stop')
                .data([
                    {offset: '0%', color: lineGradient[0]},
                    {offset: '100%', color: lineGradient[1]}
                ])
                .enter()
                  .append('stop')
                    .attr('offset', ({offset}) => offset)
                    .attr('stop-color', ({color}) => color);
        }
function drawEmptyDataLine() {
            let emptyDataLine = d3Shape.line()
                .x( (d) => xScale(d.date) )
                .y( () => yScale(0) - 1 );

            let chartGroup = svg.select('.chart-group');

            chartGroup
              .append('path')
                .attr('class', 'empty-data-line')
                .attr('d', emptyDataLine(dataByDateFormatted))
                .style('stroke', 'url(#empty-data-line-gradient)');

            chartGroup
              .append('linearGradient')
                .attr('id', 'empty-data-line-gradient')
                .attr('gradientUnits', 'userSpaceOnUse')
                .attr('x1', 0)
                .attr('x2', xScale(data[data.length - 1].date))
                .attr('y1', 0)
                .attr('y2', 0)
                .selectAll('stop')
                .data([
                    {offset: '0%', color: lineGradient[0]},
                    {offset: '100%', color: lineGradient[1]}
                ])
                .enter()
                  .append('stop')
                    .attr('offset', ({offset}) => offset)
                    .attr('stop-color', ({color}) => color);
        }
function drawEmptyDataLine ( ) { let emptyDataLine = d3Shape . line ( ) . x ( ( d ) => xScale ( d . date ) ) . y ( ( ) => yScale ( 0 ) - 1 ) ; let chartGroup = svg . select ( '.chart-group' ) ; chartGroup . append ( 'path' ) . attr ( 'class' , 'empty-data-line' ) . attr ( 'd' , emptyDataLine ( dataByDateFormatted ) ) . style ( 'stroke' , 'url(#empty-data-line-gradient)' ) ; chartGroup . append ( 'linearGradient' ) . attr ( 'id' , 'empty-data-line-gradient' ) . attr ( 'gradientUnits' , 'userSpaceOnUse' ) . attr ( 'x1' , 0 ) . attr ( 'x2' , xScale ( data [ data . length - 1 ] . date ) ) . attr ( 'y1' , 0 ) . attr ( 'y2' , 0 ) . selectAll ( 'stop' ) . data ( [ { offset : '0%' , color : lineGradient [ 0 ] } , { offset : '100%' , color : lineGradient [ 1 ] } ] ) . enter ( ) . append ( 'stop' ) . attr ( 'offset' , ( { offset } ) => offset ) . attr ( 'stop-color' , ( { color } ) => color ) ; }
Draws an empty line when the data is all zero
@private
Draws an empty line when the data is all zero