feat: comparison changer

This commit is contained in:
NunoSempere 2022-01-28 15:09:41 -05:00
parent c7ae6d6586
commit 216f704232
4 changed files with 16 additions and 6 deletions

View File

@ -373,17 +373,19 @@ export default function ComparisonView({ listOfElementsForView }) {
</div> </div>
{/* Results section */} {/* Results section */}
<div> <div className={isListOrdered ? "" : "hidden"}>
{/* Graph */} {/* Graph */}
<div className="flex items-center text-center ">
<DrawGraph <DrawGraph
isListOrdered={isListOrdered} isListOrdered={isListOrdered}
orderedList={orderedList} orderedList={orderedList}
listOfElements={listOfElements} listOfElements={listOfElements}
links={buildLinks(quantitativeComparisons)}> links={buildLinks(quantitativeComparisons)}>
</DrawGraph> </DrawGraph>
</div>
{/* Comparison table */} {/* Comparison table */}
<div className={isListOrdered ? "inline items-center text-center mt-10" : "hidden"}> <div className="flex items-center text-center ">
<CreateTable <CreateTable
isListOrdered={isListOrdered} isListOrdered={isListOrdered}
orderedList={orderedList} orderedList={orderedList}
@ -429,7 +431,7 @@ export default function ComparisonView({ listOfElementsForView }) {
<button <button
className="bg-transparent hover:bg-blue-500 text-blue-700 font-semibold hover:text-white py-2 px-4 border border-blue-500 hover:border-transparent rounded mt-5" className="bg-transparent hover:bg-blue-500 text-blue-700 font-semibold hover:text-white py-2 px-4 border border-blue-500 hover:border-transparent rounded mt-5"
onClick={() => changeShowLoadComparisons(!showLoadComparisons)}> onClick={() => changeShowLoadComparisons(!showLoadComparisons)}>
Show/edit comparisons Load comparisons
</button> </button>
</div> </div>
{/* Button: Change dataset */} {/* Button: Change dataset */}
@ -451,10 +453,11 @@ export default function ComparisonView({ listOfElementsForView }) {
<div className="text-left"> <div className="text-left">
<DisplayAsMarkdown <DisplayAsMarkdown
markdowntext={` markdowntext={`
${""/*
## Comparisons ## Comparisons
### Binary comparisons ### Binary comparisons
${JSON.stringify(binaryComparisons, null, 4)} ${JSON.stringify(binaryComparisons, null, 4)}
*/}
### Numerical comparisons ### Numerical comparisons
${JSON.stringify(nicelyFormatLinks(quantitativeComparisons, listOfElements), null, 4)} ${JSON.stringify(nicelyFormatLinks(quantitativeComparisons, listOfElements), null, 4)}
`} `}

View File

@ -67,7 +67,8 @@ Your old input was: ${value}`
} }
return ( return (
<form onSubmit={handleSubmitInner} className="inline"> <form onSubmit={handleSubmitInner} className="inline">
<br/> <p>Load comparisons in the same style as in "Show comparisons".</p>
<p>These will override your current comparisons.</p>
<br/> <br/>
<textarea <textarea
value={value} value={value}

View File

@ -248,7 +248,7 @@ export function CreateTable({ tableRows }) {
} }
return ( return (
<div> <div>
<table className=""> <table className="w-full">
<thead> <thead>
<tr > <tr >
<th >Id</th> <th >Id</th>

View File

@ -21,6 +21,12 @@ function drawGraphInner({ nodes, links }) {
// Calculate the dimensions // Calculate the dimensions
let margin = { top: 0, right: 30, bottom: 20, left: 30 }; let margin = { top: 0, right: 30, bottom: 20, left: 30 };
let width = 900 - margin.left - margin.right; let width = 900 - margin.left - margin.right;
let initialWindowWidth = window.innerWidth
let margin = { top: 0, right: 10, bottom: 30, left: 10 };
let width = initialWindowWidth*0.7 - margin.left - margin.right;
var x = d3.scalePoint() var x = d3.scalePoint()
.range([0, width]) .range([0, width])
.domain(nodeids) .domain(nodeids)