How do i make the matrix like a tree, where column headings are laid out with a tidy tree, and the rows/sub-rows are laid out with an indented tree algorithm? the aim is to be able to collapse/expand the tree, since we need to use it for knowledge exploration. The process requires users to search through techniques till they find and select the one to suit their scenario.
I would probably model this as an HTML nested list so that you can use CSS grids and Flexbox to arrange the items, and let the browser handle most of the layout complexities for you. If you wrap your sublists in <details> you can probably even get away without any JS at all in the rendered markup.
hey thats a super interesting idea, thanks. I guess I’m more of a Python programmer, and hadn’t really thought it through from that angle, so thats a real insight, cheers.
I hadn’t considered this because i am guessing this is the way the current mitre navigator is done, and their current tech is really inflexible to use. Its a static table, and you cannot drill into any additional data using their current tool (i.e. select a box and drill into and expose more detail behind it). There are many layers of knowledge to this thing.
One thing i was looking for was flexible, expansion/collapse and knowledge drill-down mechanisms. Because I want to show a whole lot more data (i.e. close some boxes and open more), once any one of the blocks are clicked. This is why i was thinking of D3
Does this expanded use case change your mind back to D3? Or do you think this could also be handled using your approach? I am not sufficiently knowledgeable to tell.
In my mind the only argument that would speak for an SVG layout would be that you can export it as an image, and arguably you can do the same by converting an HTML DOM to SVG.
Trees by themselves aren’t difficult. It’s the nested layouts that make things tricky (propagate layout changes when dimensions of nested nodes change, calculate offsets and orientation, deal with long lines of text, etc). The browser can already handle all of these things for you. With <details> you also get the benefit that even collapsed nodes remain searchable through the browser’s in-page search and will automatically expand if they contain a match.
Wrap each <ul> in <details>, using the node title as <summary>
Add the node depth either as class or as data- attribute so that you can target each level via CSS
Start prototyping your CSS in a separate cell. That way you don’t have to invalidate the built DOM every time, and can even use the browser’s devtools to try different things before applying them.
You’re a genius and a very cool person @mootari it is greatly appreciated. Its given me a lot to think about. Let me cogitate on it and come back to you.
But thank you so much for helping me, you have great skill and i appreciate you spending time on me, cheers