请帮助。我在Symfony 2.8项目中实现orgcharts时遇到问题。当我将示例代码放到twig文件中时,结果页面会绘制与层次结构无关的其他行。
下面的打印屏幕:
{% extends 'base.html.twig' %}
{% block title %}Example{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('bundles/href/css/home.css') }}"/>
{{ parent() }}
{% endblock %}
{% block body %}
<script type="text/javascript">
google.charts.load('current', {packages:["orgchart"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Name');
data.addColumn('string', 'Manager');
data.addColumn('string', 'ToolTip');
// For each orgchart box, provide the name, manager, and tooltip to show.
data.addRows([
[{v:'Mike', f:'Mike<div style="color:red; font-style:italic">President</div>'},
'', 'The President'],
[{v:'Jim', f:'Jim<div style="color:red; font-style:italic">Vice President</div>'},
'Mike', 'VP'],
['Alice', 'Mike', ''],
['Bob', 'Jim', 'Bob Sponge'],
['Carol', 'Bob', ''],
['Carol', 'Bob', '']
]);
// Create the chart.
var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
// Draw the chart, setting the allowHtml option to true for the tooltips.
chart.draw(data, {allowHtml:true});
}
</script>
<div id="chart_div"></div>
{% endblock %}
之前有人在树枝上实施过orgcharts吗?请帮忙。