feat: Propagate squiggleString

This commit is contained in:
NunoSempere 2022-02-08 16:26:15 -05:00
parent f8fafb837f
commit b52ddbcfdf
2 changed files with 13 additions and 4 deletions

View File

@ -178,7 +178,7 @@ export default function ComparisonView({ listOfElementsForView }) {
let binaryComparisons2 = [];
links.shift();
for (let link of links) {
let { source, target, distance, reasoning } = link;
let { source, target, distance, reasoning, squiggleString } = link;
let searchByName = (name, candidate) => candidate.name == name;
let testForSource = (candidate) => searchByName(source, candidate);
let testForTarget = (candidate) => searchByName(target, candidate);
@ -190,7 +190,13 @@ export default function ComparisonView({ listOfElementsForView }) {
console.log(target);
throw new Error("Comparisons include unknown elements, please retry");
}
quantitativeComparisons2.push([element1, element2, distance, reasoning]);
quantitativeComparisons2.push([
element1,
element2,
distance,
reasoning,
squiggleString || distance,
]);
binaryComparisons2.push([element1, element2]);
}
// return ({quantitativeComparisons: quantitativeComparisons2, binaryComparisons: binaryComparisons2})
@ -315,6 +321,7 @@ export default function ComparisonView({ listOfElementsForView }) {
if (inputValue < 1 && inputValue > 0) {
inputValue = 1 / inputValue;
[element1, element2] = [element2, element1];
squiggleString = `(${squiggleString})^(-1)`;
}
console.log(`posList@nextStepInput:`);
console.log(posList);

View File

@ -122,9 +122,10 @@ function drawGraphInner({ nodes, links }) {
);
})
.style("fill", "none")
.attr("stroke", "black");
.attr("stroke", "green"); // black
// labels for links
// smaller font.
svg
.selectAll("mylinks")
.data(links)
@ -149,7 +150,8 @@ function drawGraphInner({ nodes, links }) {
if (d.distance == d.squiggleString || !d.squiggleString) {
return distanceFormatted;
} else {
return `${d.squiggleString}${distanceFormatted}`;
// return `${d.squiggleString} → ${distanceFormatted}`;
return `(${d.squiggleString})`;
}
// return (truncateValueForDisplay(Number(d.distance)))