Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Siizer authored Jan 12, 2024
1 parent 84a3b11 commit 70c4199
Showing 1 changed file with 23 additions and 30 deletions.
53 changes: 23 additions & 30 deletions Inputs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,13 @@ export function Inputs (SelectInputFieldsID,classForTable,SelectInputFieldsClass
// Create table header
const header = table.append("thead").append("tr");
// Create a button in the first header cell
header.append("th")
.append("button")
.text("R/X")
.attr("class", "myButtonCurrentAndVoltagePanel") // optional: add a class for styling
.on("click", function() {

// code for button click event to switch to 0 1 2...
});
header.append("th").text("");
header.append("th").text("R");
header.append("th").text("X");

// Create table body
const tbody = table.append("tbody");

const inputFields = tbody.selectAll("."+SelectInputFieldsClass)
.data(data)
.enter().append("tr")
Expand All @@ -34,27 +27,27 @@ export function Inputs (SelectInputFieldsID,classForTable,SelectInputFieldsClass

// Add second column with real input fields
inputFields.append("td")
.append("input")
.style("width", "50px")
.attr("type", "number")
.attr("step", "0.01")
.attr("value", d => d.value.x)
.attr("placeholder", "x")
.attr("id", d => `${d.key}-real`)
.attr("class",d => d.key.charAt(0))
.on("input", onInputChanged);
// Add third column with imaginary input fields
inputFields.append("td")
.append("input")
.style("width", "50px")
.attr("type", "number")
.attr("step", "0.01")
.attr("value", d => d.value.y)
.attr("placeholder", "y")
.attr("id", d => `${d.key}-imaginary`)
.attr("class",d => d.key.charAt(0))
.on("input", onInputChanged);
.append("input")
.style("width", "50px")
.attr("type", "number")
.attr("step", "0.01")
.attr("value", d => d.value.x)
.attr("placeholder", "x")
.attr("id", d => `${d.key}-real`)
.attr("class",d => d.key.charAt(0))
.on("input", function(e,d) { onInputChanged(e,d);});

// Add third column with imaginary input fields
inputFields.append("td")
.append("input")
.style("width", "50px")
.attr("type", "number")
.attr("step", "0.01")
.attr("value", d => d.value.y)
.attr("placeholder", "y")
.attr("id", d => `${d.key}-imaginary`)
.attr("class",d => d.key.charAt(0))
.on("input", function(e,d) { onInputChanged(e,d);});

return inputDiv;
}

0 comments on commit 70c4199

Please sign in to comment.