Organisational chart

0 votes
asked May 6, 2021 in Question / help by hendry (120 points)

I am trying to replicate this graphic generated by Google Sheets in PlantUML. The input is CSV like:

Bread,Products
Jam,Products
Products,Home
Privacy Policy,About Us
Sustainability statement,About Us
About Us,Home

2 Answers

0 votes
answered May 6, 2021 by The-Lu (64,340 points)

Hello H,

For that, you can use WBS, as:

@startwbs
* Home
** Products
*** Bread
*** Jam
** About Us
*** Privacy Policy
*** Sustainability statement
@endwbs

If that can help,
Regards,
Th.

commented May 6, 2021 by hendry (120 points)
Thank you Th, though how do I programatically get the CSV into that format you proposed? Ideally plantuml could take in the CSV.
0 votes
answered Mar 21 by caring-coder (580 points)

For a full Excel way to format your data:

First add a few columns:

ROOT        -> =ISBLANK([@Parent])
DEPTH       -> =IF([@ROOT],   0, VLOOKUP([@Parent], Table1, 4, FALSE) + 1) 
//                                                          ^ the DEPTH column index
PARENT_PATH -> =IF([@ROOT],  "", VLOOKUP([@Parent], Table1, 6, FALSE))
//                                                          ^ the PATH column index
PATH        -> =IF([@ROOT], "/", CONCAT([@PARENT_PATH],[@Item],"/"))
PLANTUML    -> =CONCAT(REPT("*",[@DEPTH]+1), " ", [@Item])

And then, sort the table by the PATH column

ItemParentIS_ROOTDEPTHPARENT_PATHPATHPLANTUML
HomeTRUE0/* Home
About UsHomeFALSE1//About Us/** About Us
Privacy PolicyAbout UsFALSE2/About Us//About Us/Privacy Policy/*** Privacy Policy
Sustainability statementAbout UsFALSE2/About Us//About Us/Sustainability statement/*** Sustainability statement
ProductsHomeFALSE1//Products/** Products
BreadProductsFALSE2/Products//Products/Bread/*** Bread
JamProductsFALSE2/Products//Products/Jam/*** Jam

Then you can copy-paste the PLANTUML column directly for plantuml usage.

...