show hidden button style + do not create div if hidden
This commit is contained in:
parent
2cb405abfd
commit
78492e20a7
@ -14,11 +14,11 @@
|
|||||||
|
|
||||||
<!--banner-->
|
<!--banner-->
|
||||||
<div class="banner">
|
<div class="banner">
|
||||||
<p>Lorem ipsum dolor sit amet</p>
|
<p></p>
|
||||||
<input id="additemid" type="text" placeholder="item id" pattern="[0-9]*">
|
<input id="additemid" type="text" placeholder="item id" pattern="[0-9]*">
|
||||||
<input id="addattributes" type="text" placeholder="attributes (comma separated)" pattern="[0-9a-zA-Z, ]*">
|
<input id="addattributes" type="text" placeholder="attributes (comma separated)" pattern="[0-9a-zA-Z, ]*">
|
||||||
<button id="addbutton" type="button">Add</button>
|
<button id="addbutton" type="button">Add</button>
|
||||||
<button id="global_toggleshow" type="button">show_hidden</button>
|
<button id="global_toggleshow" class="global_toggleshow" type="button">show hidden</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--popup confirmation window-->
|
<!--popup confirmation window-->
|
||||||
|
@ -18,6 +18,11 @@ const currentUrl = window.location.href;
|
|||||||
var show_hidden = false;
|
var show_hidden = false;
|
||||||
document.getElementById("global_toggleshow").addEventListener("click", function() {
|
document.getElementById("global_toggleshow").addEventListener("click", function() {
|
||||||
show_hidden = !show_hidden;
|
show_hidden = !show_hidden;
|
||||||
|
if (document.getElementById("global_toggleshow").innerHTML == "show hidden") {
|
||||||
|
document.getElementById("global_toggleshow").innerHTML = "hide";
|
||||||
|
} else {
|
||||||
|
document.getElementById("global_toggleshow").innerHTML = "show hidden";
|
||||||
|
}
|
||||||
refresh_graphs();
|
refresh_graphs();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
function render_graphs(items, history, show_hidden) {
|
function render_graphs(items, history, show_hidden) {
|
||||||
|
|
||||||
// Date domain (width)
|
// Date domain (width)
|
||||||
const x = d3.scaleTime()
|
const x = d3.scaleTime()
|
||||||
.domain(d3.extent(history, d => d.date))
|
.domain(d3.extent(history, d => d.date))
|
||||||
@ -8,10 +7,13 @@ function render_graphs(items, history, show_hidden) {
|
|||||||
// Group the data by (uuid)
|
// Group the data by (uuid)
|
||||||
const nestedData = d3.group(history, d => d.uuid);
|
const nestedData = d3.group(history, d => d.uuid);
|
||||||
// Create a div for each graph
|
// Create a div for each graph
|
||||||
|
console.log(nestedData.size)
|
||||||
const graphDivs = d3.select("#graphs")
|
const graphDivs = d3.select("#graphs")
|
||||||
.selectAll(".graph-container")
|
.selectAll(".graph-container")
|
||||||
.data(nestedData.keys())
|
.data(nestedData.keys())
|
||||||
.enter().append("div")
|
.enter()
|
||||||
|
.filter(key => items[key].show || show_hidden)
|
||||||
|
.append("div")
|
||||||
.attr("class", "graph-container");
|
.attr("class", "graph-container");
|
||||||
|
|
||||||
// Append SVG elements to each div
|
// Append SVG elements to each div
|
||||||
|
@ -23,6 +23,11 @@ body {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.global_toggleshow {
|
||||||
|
float: right;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.banner {
|
.banner {
|
||||||
background-color: #177013; /* background color */
|
background-color: #177013; /* background color */
|
||||||
color: #fff; /* text color */
|
color: #fff; /* text color */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user