orgchart

How to pass nodes to BalkanOrgchart js and how to apply colours for each node?


I have created nodes data as json format. But, I need to pass nodes data to BalkanOrgchart by ajax. But, there is no document related to this. And, i have set colours for each node. I mean different colours. But, it is not reflected on PDF export.


Solution

  • To add css on export, set extrahtml option

    Here is an example:

    js

    menu: {
        exportPdf: {
            text: 'Export PDF',
            icon: OrgChart.icon.pdf(24,24),
            onClick: function(){chart.exportPDF({
                extraHtml: document.getElementById('myStyles').outerHTML
            })}
        }
    },
    

    css

    <style id="myStyles">
        .node{
            font-family: Helvetica;
        }
        .node.QA rect {
            fill: #ffffff;
        }
    
        .node.QA text {
            fill: #F57C00;
        }
    
    
        .node.Marketing rect {
            fill:#ffffff;
        }
    
        .node.Marketing text {
            fill: #FFCA28;
        }
    </style>