如何使用angular 7在Google组织结构图中添加拖放功能?

时间:2019-08-28 04:52:19

标签: angular angular6 angular7

这是我如何绘制图表并添加节点单击功能的代码,现在我想添加拖放功能?可能吗 ?如果是,那怎么办?

var that = this;

function drawChart() {
    const data = 
    GoogleCharts.api.visualization.arrayToDataTable(that.allHierarchy);
    console.log('data')
    console.log(data);

    // Create the chart.
    const chart = new GoogleCharts.api.visualization.OrgChart(document.getElementById('org-chart'));
    // Draw the chart, setting the allowHtml option to true for the tooltips.
    chart.draw(data, {
        allowHtml: true
    });

    GoogleCharts.api.visualization.events.addListener(chart, 'select', function() {
        var selection = chart.getSelection();
        if (selection.length > 0) {
            //alert(data.getValue(selection[0].row, 0));
            that.selected = data.getValue(selection[0].row, 0)
            console.log('that')
            console.log(that.selected);
            var str = data.getValue(selection[0].row, 0);
            var n = str.indexOf("~");
            var res = str.substr(n + 1);
            //alert(res);
            that.prsProducer.AGENT_CODE = res;

            that.UpdateProducer(that.prsProducer, 3);
        }
    });
}

0 个答案:

没有答案