配置设置
要动态更改比例的设置(例如步进、子比例)(在 dhtmlxGantt 初始化之后),请使用以下技术:
为相关配置选项设置新值。例如,要将刻度的单位从“月”更改为“日”,请使用scales属性的unit属性。
重新定义相关模板(如果需要)。例如,要在 scale 中突出显示周末,请使用scale_cell_class模板。
使用render方法重新绘制甘特图。
gantt.config.scales = [ {unit: "month", step: 1, format: "%F, %Y"}, ]; gantt.init("gantt_here"); gantt.config.scales = [ {unit: "day", step: 1, format: "%d %M, %D"} ]; gantt.templates.scale_cell_class = function(date){ if(date.getDay()==0||date.getDay()==6){ return "weekend"; } }; gantt.render();
dhtmlxGantt享有超十年声誉,支持跨浏览器和跨平台,性价比高,可满足项目管理控件应用的所有需求,是最完善的甘特图图表库。了解更多内容,欢迎在线咨询或者私信我获取正版试用版及报价。