diff --git a/index.html b/index.html index 03cc2dd..6ba7e5f 100644 --- a/index.html +++ b/index.html @@ -112,7 +112,7 @@ var today = new Date(data[data.length-1].datetime); var weekbefore = today.getTime() - 7* 24*3600*1000; console.log(new Date(weekbefore) + " - " + today); - setTimeout(function() {tempchart.zoomToDates(new Date(weekbefore), today);}, 10); + setTimeout(function() {tempchart.zoomToDates(new Date(weekbefore), today); adjustGroupHeight();}, 10); } }], "chartCursor": { @@ -328,11 +328,21 @@ cht.validateNow(); } + function adjustGroupHeight() { + var legend = document.getElementsByClassName("amcharts-legend-div"); + var group = [document.getElementById("tempgroup"), document.getElementById("humidgroup")]; + console.log(legend[0].style.height); + group[0].style.height = legend[0].style.height; + group[1].style.height = legend[0].style.height; + } + + function makeGroup(cht, idgroup, from, to, color) { var w = 19, unit=18; var path = document.createElementNS("http://www.w3.org/2000/svg", "path"); cht.locktoggle = null; + cht.current_path = null; path.setAttribute("stroke", color); path.setAttribute("stroke-width", 4); path.setAttribute("fill", "none"); @@ -352,10 +362,20 @@ if (cht.locktoggle == e.target) { path.setAttribute("stroke-width", 10); cht.locktoggle = null; + cht.current_path = null; } else if (!cht.locktoggle){ - path.setAttribute("stroke-width", 14); + path.setAttribute("stroke-width", 12); cht.locktoggle = e.target; - }}); + cht.current_path = path; + } else { + emphasize(cht, from, -to); + emphasize(cht, from, to); + cht.current_path.setAttribute("stroke-width", 4); + path.setAttribute("stroke-width", 12); + cht.locktoggle = e.target; + cht.current_path = path; + } + }); } makeGroup(tempchart, "tempgroup", 0, 2, "blue"); @@ -407,6 +427,7 @@ break; } }; +