0
https://developers.google.com/chart/interactive/docs/gallery/ganttchart谷歌可视化,添加标签甘特图
是否有可能在甘特图的持续时间添加标签,如下面的截图?
https://developers.google.com/chart/interactive/docs/gallery/ganttchart谷歌可视化,添加标签甘特图
是否有可能在甘特图的持续时间添加标签,如下面的截图?
正如所说的WhiteHat,没有内置的选项。 对于我的特定情况下(我一直都在我的甘特图的结构相同),我做了以下(放置一些div上栏的顶端 - 这些资料核实,你可以做任何你想要的):
// callback after draw (afterDraw() function is called after chart is drawn)
google.visualization.events.addListener(图表,'ready',afterDraw);
功能afterDraw(){
// the container element to append our generated DIVs (with the labels)
// it has to be outside the SVG element, but inside the chart container
var toContainer = $('#chart_div > div > div');
// in order to create DIVs to place them on top of the bars, we first need to get bars SVG/RECTs positions and sizes
// in my case, the RECT elements with the necessary top/left/width/height are in the 6th G element
$("#chart_div g:eq(5) rect").each(function() {
toContainer.append("<div style='top:"+$(this).attr('y')+"px; left: "+$(this).attr('x')+"px; width: "+$(this).attr('width')+"px; height: "+$(this).attr('height')+"px;text-align: center;position:absolute;line-height:2' >Some text</div>");
});
}
不是通过标准的选项,你可以尝试加入自己一旦''ready''事件触发 - 或尝试[时间轴图表]( https://developers.google.com/chart/interactive/docs/gallery/timeline)改为... – WhiteHat