Developing pedigree chart using orgchart js

I have been ‘mucking around’ (kiwi expression for fiddling) with orgchart js. I am trying to use it to create a four generation animal pedigree chart. Its much like a family tree. My table has a herd_book_number, dam_code and sire_code. Approximately 4,000 animals. I want to be be able to nominate the root node and then the sql defines the subsequent generations.

Essentially orgchart js uses a json to load the nodes. I cant get it to select a root node (from which the subsequent child nodes are generated). Nor can I get it to place the root node at the top of the chart - it always puts the generation that has no more children at the top of the chart.

All suggestions appreciated
Regards
Doug Maclean

1 Like

you basically make an array in PHP and convert it into json using php functions,
json however is trikky , pay attention how it needs to be structured, this is however SC forum and orgchart is a very specific js library , but may be somebody used it here and knows the details, good luck.

Thanks for the help - its not so much the json that is my problem (I’m using json in a number of apps) its more the PHP or SQL code that will run under php that efficiently builds the child parent arrays. I can do it very manually by using a series of nested arrays but that is not very efficient.