标题基本上说明了一切,我需要向组织结构图/树的子“分支”添加超链接。下面是代码:
<html>
<head>
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {packages:['orgchart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Name');
data.addColumn('string', 'Manager');
data.addColumn('string', 'link');
data.addRows([
[{v:'Manager', f:'Manager<div style="color:red; font-style:italic">Manager</div>'}, '', ''],
[{v:'PS'}, 'Manager', 'https://developers.google.com/chart/interactive/docs/gallery/orgchart'],
[{v:'ES'}, 'Manager', ''],
[{v:'MSE'}, 'Manager', ''],
[{v:'OEP'}, 'Manager', ''],
['', '', ''],
['', '', '']
]);
var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
chart.draw(data, {allowHtml:true});
}
</script>
</head>
<body>
<div id='chart_div'></div>
</body>
</html>