src/charts/brush.js
function buildGradient() {
            if (!chartGradientEl) {
                chartGradientEl = svg.select('.metadata-group')
                  .append('linearGradient')
                    .attr('id', gradientId)
                    .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: gradient[0]},
                        {offset: '100%', color: gradient[1]}
                    ])
                  .enter().append('stop')
                    .attr('offset', ({offset}) => offset)
                    .attr('stop-color', ({color}) => color);
            }
        }
function buildGradient() {
            if (!chartGradientEl) {
                chartGradientEl = svg.select('.metadata-group')
                  .append('linearGradient')
                    .attr('id', gradientId)
                    .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: gradient[0]},
                        {offset: '100%', color: gradient[1]}
                    ])
                  .enter().append('stop')
                    .attr('offset', ({offset}) => offset)
                    .attr('stop-color', ({color}) => color);
            }
        }
function buildGradient ( ) { if ( ! chartGradientEl ) { chartGradientEl = svg . select ( '.metadata-group' ) . append ( 'linearGradient' ) . attr ( 'id' , gradientId ) . 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 : gradient [ 0 ] } , { offset : '100%' , color : gradient [ 1 ] } ] ) . enter ( ) . append ( 'stop' ) . attr ( 'offset' , ( { offset } ) => offset ) . attr ( 'stop-color' , ( { color } ) => color ) ; } }
Creates the gradient on the area
@return {void}
Creates the gradient on the area