如何更改 Google 组织结构图 link 线条颜色和粗细?
How to change Google Organization Chart link line color & thickness?
我正在摆弄 javascript 中的 google's organization chart,但我不知道如何更改 link 线条的颜色和粗细。该文档只讨论了节点的样式,但没有关于连接它们的 links 的内容。
如何设置 link 的样式?
连接节点的线路没有配置选项
但您可以覆盖用于设置这些行样式的 css
这里,使用css border
属性更改粗细和颜色
#chart_div .google-visualization-orgchart-linebottom {
border-bottom: 4px solid magenta;
}
#chart_div .google-visualization-orgchart-lineleft {
border-left: 4px solid magenta;
}
#chart_div .google-visualization-orgchart-lineright {
border-right: 4px solid magenta;
}
#chart_div .google-visualization-orgchart-linetop {
border-top: 4px solid magenta;
}
请参阅以下工作片段...
google.charts.load('current', {
packages: ['orgchart']
}).then(function () {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Name');
data.addColumn('string', 'Manager');
data.addColumn('string', 'ToolTip');
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', '']
]);
var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
chart.draw(data, {allowHtml:true});
});
#chart_div .google-visualization-orgchart-linebottom {
border-bottom: 4px solid magenta;
}
#chart_div .google-visualization-orgchart-lineleft {
border-left: 4px solid magenta;
}
#chart_div .google-visualization-orgchart-lineright {
border-right: 4px solid magenta;
}
#chart_div .google-visualization-orgchart-linetop {
border-top: 4px solid magenta;
}
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>
我正在摆弄 javascript 中的 google's organization chart,但我不知道如何更改 link 线条的颜色和粗细。该文档只讨论了节点的样式,但没有关于连接它们的 links 的内容。
如何设置 link 的样式?
连接节点的线路没有配置选项
但您可以覆盖用于设置这些行样式的 css
这里,使用css border
属性更改粗细和颜色
#chart_div .google-visualization-orgchart-linebottom {
border-bottom: 4px solid magenta;
}
#chart_div .google-visualization-orgchart-lineleft {
border-left: 4px solid magenta;
}
#chart_div .google-visualization-orgchart-lineright {
border-right: 4px solid magenta;
}
#chart_div .google-visualization-orgchart-linetop {
border-top: 4px solid magenta;
}
请参阅以下工作片段...
google.charts.load('current', {
packages: ['orgchart']
}).then(function () {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Name');
data.addColumn('string', 'Manager');
data.addColumn('string', 'ToolTip');
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', '']
]);
var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
chart.draw(data, {allowHtml:true});
});
#chart_div .google-visualization-orgchart-linebottom {
border-bottom: 4px solid magenta;
}
#chart_div .google-visualization-orgchart-lineleft {
border-left: 4px solid magenta;
}
#chart_div .google-visualization-orgchart-lineright {
border-right: 4px solid magenta;
}
#chart_div .google-visualization-orgchart-linetop {
border-top: 4px solid magenta;
}
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>