Skip to content
Advertisement

Building a variable covariance-table

I want to create a covariance-table that shows all possible combinations between 3-10 inputs.

The image below shows a 11×11 table for 10 inputs, and a 4×4 table for 3 inputs. The user can choose anywhere between 3 and 10 inputs, and the table can therefore be in any size between those pictured.

enter image description here.

Making this table using HTML-tables seem to be a poor strategy, which is why I decided to use DIVs and CSS Grid instead. As you can guess, it was a bothersome solution with a lot of repetitive code – and that was only for 10 inputs! I need to repeat the code 7 more times to make it possible for the user to combine less than 10 inputs, and then use PHP to calculate the number of inputs and exclude (with PHP) all the irrelevant tables and keep the one that matches the number of inputs. Which is a lot of work.

What is the best strategy for carrying this out?

JavaScript
JavaScript

.

Advertisement

Answer

I am guessing you want to create these things dynamically in php (given you have tagged php), although you could easily do the same in javascript

This will render your chart in a table, which is the simplest option in my mind.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement