script.js 1.35 KB
Newer Older
1
(function ($) {
2 3 4 5 6 7 8 9 10
    $(function () {
        var westData = {
            'name': 'Cayman 1 LP',
            'wins': '1',
            'children': [
                {
                    'name': 'Cayman 2 Limited', 'wins': '2',
                    'children': [
                        {
11
                            'name': 'BVI 1 Limited', 'wins': '3'
12 13 14 15 16 17
                        },
                        {'name': 'Hong Kong 1 Limited', 'wins': '4'}
                    ]
                }
            ]
        };
18

19 20 21 22 23 24 25
        var ocWest = $('#chart-western').orgchart({
            'data': westData,
            'nodeContent': 'name',
            'direction': 't2b',
            'createNode': function ($node, data) {
                if (data.wins === "1") {
                    $node.children('.title').html('<img src="A.png" style="width:100%">');
26
                    // $node.hide();
27
                }
28 29 30
                else{
                    var rightMenu = '<div class="node-line-right"><span >' + 100 + '%</span>';
                    $node.append(rightMenu);
31
                    $node.children('.title').html('<img src="2.png" style="width:100%">');
32
                }
33 34
            },
            'initCompleted': function ($chart) {
35 36
                // console.log($chart);
                // $chart.children().children('.lines').hide();
37 38
            }
        });
39 40
    });
})(jQuery);