mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
burg temperature graph - clean up
This commit is contained in:
parent
6beb262e91
commit
d99c24e0de
2 changed files with 13 additions and 13 deletions
|
|
@ -2310,7 +2310,7 @@ svg.button {
|
|||
|
||||
.epgrid line {
|
||||
stroke: lightgrey;
|
||||
stroke-opacity: 0.7;
|
||||
stroke-opacity: 0.5;
|
||||
shape-rendering: crispEdges;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -149,6 +149,18 @@ function showBurgTemperatureGraph(id) {
|
|||
grid.append("g").attr("transform", `translate(${xOffset}, ${yOffset})`).call(yGrid);
|
||||
grid.selectAll("text").remove();
|
||||
|
||||
//add zero degree line
|
||||
if (minT < 0 && maxT > 0) {
|
||||
chart
|
||||
.append("g")
|
||||
.append("line")
|
||||
.attr("x1", xscale(0) + xOffset)
|
||||
.attr("y1", yscale(0) + yOffset)
|
||||
.attr("x2", xscale(360) + xOffset)
|
||||
.attr("y2", yscale(0) + yOffset)
|
||||
.attr("stroke", "gray");
|
||||
}
|
||||
|
||||
const formatX = d => months[parseInt((d / 360) * 12)];
|
||||
const xAxis = d3.axisBottom(xscale).ticks(10).tickFormat(formatX);
|
||||
|
||||
|
|
@ -160,17 +172,5 @@ function showBurgTemperatureGraph(id) {
|
|||
.attr("transform", `translate(${xOffset}, ${chartHeight + yOffset})`)
|
||||
.call(xAxis);
|
||||
chart.append("g").attr("transform", `translate(${xOffset}, ${yOffset})`).call(yAxis);
|
||||
|
||||
if (minT < 0 && maxT > 0) {
|
||||
//add zero lv
|
||||
chart
|
||||
.append("g")
|
||||
.append("line")
|
||||
.attr("x1", xscale(0) + xOffset)
|
||||
.attr("y1", yscale(0) + yOffset)
|
||||
.attr("x2", xscale(360) + xOffset)
|
||||
.attr("y2", yscale(0) + yOffset)
|
||||
.attr("stroke", "black");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue