【问题标题】:How to pass nodes to BalkanOrgchart js and how to apply colours for each node?如何将节点传递给 BalkanOrgchart js 以及如何为每个节点应用颜色?
【发布时间】:2019-08-30 16:03:52
【问题描述】:

我已将节点数据创建为 json 格式。但是,我需要通过 ajax 将节点数据传递给 BalkanOrgchart。但是,没有与此相关的文件。而且,我为每个节点设置了颜色。我的意思是不同的颜色。但是,它不会反映在 PDF 导出中。

【问题讨论】:

    标签: orgchart


    【解决方案1】:

    要在导出时添加 css,请设置 extrahtml 选项

    这是一个例子:

    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>
    

    【讨论】:

    • 我有一个问题,可以将您的“balkanorgchart-js”添加到 Angular cli 6 中吗?你有任何 npm 文件吗?
    猜你喜欢
    • 1970-01-01
    • 2014-07-10
    • 1970-01-01
    • 1970-01-01
    • 2017-01-02
    • 2020-03-10
    • 2018-11-14
    相关资源
    最近更新 更多