From d99c24e0dec76107fc08d4459908b3d68d0ca7e1 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Fri, 4 Feb 2022 01:40:41 +0300 Subject: [PATCH] burg temperature graph - clean up --- index.css | 2 +- modules/ui/temperature-graph.js | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/index.css b/index.css index 9946d1b2..17913cb4 100644 --- a/index.css +++ b/index.css @@ -2310,7 +2310,7 @@ svg.button { .epgrid line { stroke: lightgrey; - stroke-opacity: 0.7; + stroke-opacity: 0.5; shape-rendering: crispEdges; } diff --git a/modules/ui/temperature-graph.js b/modules/ui/temperature-graph.js index 507ea027..c8d51770 100644 --- a/modules/ui/temperature-graph.js +++ b/modules/ui/temperature-graph.js @@ -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"); - } } }