fix: [crawler barchart] up/down colors
Some checks are pending
CI / ail_test (3.10) (push) Waiting to run
CI / ail_test (3.7) (push) Waiting to run
CI / ail_test (3.8) (push) Waiting to run
CI / ail_test (3.9) (push) Waiting to run

This commit is contained in:
terrtia 2024-09-18 10:39:42 +02:00
parent 3fe7c14478
commit aca877b6ab
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -29,6 +29,17 @@ const barchart_stack = (container_id, data, options) => {
let color = d3.scaleOrdinal(d3.schemeSet3);
function colorScale(name) {
if (name === 'down') {
return '#dc3545';
} else if (name === 'up') {
return '#28a745';
} else {
return color(name);
}
}
let svg = d3.select("#"+container_id).append("svg")
.attr("viewBox", "0 0 "+width_graph+" "+options.height)
.attr("width", options.width)
@ -112,7 +123,7 @@ const barchart_stack = (container_id, data, options) => {
.attr("width", x.bandwidth())
.attr("y", function (d) { return y(d.y1); })
.attr("height", function (d) { return y(d.y0) - y(d.y1); })
.style("fill", function (d) { return color(d.name); })
.style("fill", function (d) { return colorScale(d.name); })
.style("stroke", "grey")
.on("mouseover", mouseover)
.on("mouseout", mouseleave)
@ -139,7 +150,7 @@ const barchart_stack = (container_id, data, options) => {
.attr("x", width_graph)
.attr("width", 10)
.attr("height", 10)
.style("fill", color)
.style("fill", function(d) { return colorScale(d); })
.style("stroke", "grey");
legend.append("text")