function legend(progress) {
    const svg = d3.create("svg")
        .attr("viewBox", [-width / 2, -height / 2, width, height])
        .attr("width", width)
        .attr("height", height);

    svg.append("g")
        .call(yearAxis);

    const yearIndex = Math.min(yearlyAttributes.length - 1, Math.floor(progress * yearlyAttributes.length));
    const year = yearlyTemparatureMesh[yearIndex].date;
    svg.append("text")
        .attr('class', 'year')
        .attr('x', 0)
        .attr('y', height * 0.35)
        .attr('font-size', 50)
        .attr('text-anchor', 'middle')
        .attr('fill', 'white')
        .text(year)

    const degreeScale = d3.scaleLinear()
        .domain([-3, 3])
        .range([0, width * 0.36]);
    const degreeAxis = d3.axisBottom()
        .scale(degreeScale)
        .ticks(6)
        .tickFormat(d => d <= 0 ? `${d}°` : `+${d}°`);

    svg.append("g")
        .attr("transform", `translate(${-width * 0.18},${height * 0.43})`)
        .call(degreeAxis)
        .call(g => g.select(".domain").remove())
        .selectAll(".tick text")
        .style('fill', 'white')
        .style("text-anchor", "middle")
        .attr("x", 0)
        .attr("y", 10);

    svg.append("image")
        .attr("xlink:href", twitterLogo)
        .attr("x", width * 0.3)
        .attr("y", height * 0.45)
        .attr("width", 20)

    svg.append("text")
        .attr('x', width * 0.34)
        .attr('y', height * 0.465)
        .attr('font-size', 14)
        .attr('text-anchor', 'start')
        .attr('fill', 'white')
        .text('@karim_douieb')

    return svg.node();
}
// Used to show scale and author's info on the site 

Used to show scale and author's info on the site
Used to show scale and author ' s info on the site
function legend(progress) {
    const svg = d3.create("svg")
        .attr("viewBox", [-width / 2, -height / 2, width, height])
        .attr("width", width)
        .attr("height", height);
    svg.append("g")
        .call(yearAxis);
    const yearIndex = Math.min(yearlyAttributes.length - 1, Math.floor(progress * yearlyAttributes.length));
    const year = yearlyTemparatureMesh[yearIndex].date;
    svg.append("text")
        .attr('class', 'year')
        .attr('x', 0)
        .attr('y', height * 0.35)
        .attr('font-size', 50)
        .attr('text-anchor', 'middle')
        .attr('fill', 'white')
        .text(year)
    const degreeScale = d3.scaleLinear()
        .domain([-3, 3])
        .range([0, width * 0.36]);
    const degreeAxis = d3.axisBottom()
        .scale(degreeScale)
        .ticks(6)
        .tickFormat(d => d <= 0 ? `${d}°` : `+${d}°`);
    svg.append("g")
        .attr("transform", `translate(${-width * 0.18},${height * 0.43})`)
        .call(degreeAxis)
        .call(g => g.select(".domain").remove())
        .selectAll(".tick text")
        .style('fill', 'white')
        .style("text-anchor", "middle")
        .attr("x", 0)
        .attr("y", 10);
    svg.append("image")
        .attr("xlink:href", twitterLogo)
        .attr("x", width * 0.3)
        .attr("y", height * 0.45)
        .attr("width", 20)
    svg.append("text")
        .attr('x', width * 0.34)
        .attr('y', height * 0.465)
        .attr('font-size', 14)
        .attr('text-anchor', 'start')
        .attr('fill', 'white')
        .text('@karim_douieb')
    return svg.node();
}
function legend ( progress ) { const svg = d3 . create ( "svg" ) . attr ( "viewBox" , [ - width / 2 , - height / 2 , width , height ] ) . attr ( "width" , width ) . attr ( "height" , height ) ; svg . append ( "g" ) . call ( yearAxis ) ; const yearIndex = Math . min ( yearlyAttributes . length - 1 , Math . floor ( progress * yearlyAttributes . length ) ) ; const year = yearlyTemparatureMesh [ yearIndex ] . date ; svg . append ( "text" ) . attr ( 'class' , 'year' ) . attr ( 'x' , 0 ) . attr ( 'y' , height * 0.35 ) . attr ( 'font-size' , 50 ) . attr ( 'text-anchor' , 'middle' ) . attr ( 'fill' , 'white' ) . text ( year ) const degreeScale = d3 . scaleLinear ( ) . domain ( [ - 3 , 3 ] ) . range ( [ 0 , width * 0.36 ] ) ; const degreeAxis = d3 . axisBottom ( ) . scale ( degreeScale ) . ticks ( 6 ) . tickFormat ( d => d <= 0 ? ` ${ d } + {d } ° ; svg . append ( "g" ) . attr ( "transform" , ` ${ - width * 0.18 } ${ height * 0.43 } ` ) . call ( degreeAxis ) . call ( g => g . select ( ".domain" ) . remove ( ) ) . selectAll ( ".tick text" ) . style ( 'fill' , 'white' ) . style ( "text-anchor" , "middle" ) . attr ( "x" , 0 ) . attr ( "y" , 10 ) ; svg . append ( "image" ) . attr ( "xlink:href" , twitterLogo ) . attr ( "x" , width * 0.3 ) . attr ( "y" , height * 0.45 ) . attr ( "width" , 20 ) svg . append ( "text" ) . attr ( 'x' , width * 0.34 ) . attr ( 'y' , height * 0.465 ) . attr ( 'font-size' , 14 ) . attr ( 'text-anchor' , 'start' ) . attr ( 'fill' , 'white' ) . text ( '@karim_douieb' ) return svg . node ( ) ; }
Used to show scale and author's info on the site
Used to show scale and author ' s info on the site