chart = {
const width = 928;
const height = 200;
const svg = d3
.create("svg")
.attr("viewBox", [0, 0, width, height])
.attr("width", width)
.attr("height", height)
.attr("style", "max-width: 100%; height: auto;");
const gradient = svg
.append("defs")
.append("linearGradient")
.attr("id", "gradient")
.attr("x1", "0%")
.attr("x2", "0%")
.attr("y1", "100%")
.attr("y2", "0%");
gradient
.append("stop")
.attr("offset", "0%")
.attr("stop-color", "#FFFFFF")
.attr("stop-opacity", 1);
gradient
.append("stop")
.attr("offset", "100%")
.attr("stop-color", "#0000FF")
.attr("stop-opacity", 1);
svg
.append("rect")
.attr("x", 20)
.attr("y", 20)
.attr("width", 20)
.attr("height", 360)
.style("fill", "url(#gradient)");
gsap.to(gradient.selectAll("stop").nodes(), {
duration: 2,
attr: { "stop-color": "#FF0000" },
stagger: 0.2,
repeat: -1,
yoyo: true
});
return svg.node();
}