dhtmlxgantt scales 以秒为单位
时间: 2023-11-02 11:05:37 浏览: 229
是的,dhtmlxGantt可以使用秒作为刻度单位。您可以通过设置以下属性来实现:
```javascript
gantt.config.scale_unit = "second";
gantt.config.date_scale = "%H:%i:%s";
gantt.config.step = 1;
gantt.config.subscales = [
{unit: "minute", step: 1, date: "%H:%i"},
{unit: "hour", step: 1, date: "%H"}
];
```
上述代码将刻度单位设置为秒,并使用"%H:%i:%s"格式显示时间。步长设置为1,以便每秒都有一个刻度线。还可以添加其他子刻度来进一步细化时间轴。
相关问题
dhtmlxgantt scales
dhtmlxGantt is a popular JavaScript library for building interactive Gantt charts and project management tools. It provides various scales that can be used to display different time periods on the chart, including:
1. Hour Scale: This scale shows the tasks and events on an hourly basis.
2. Day Scale: This scale shows the tasks and events on a daily basis.
3. Week Scale: This scale shows the tasks and events on a weekly basis.
4. Month Scale: This scale shows the tasks and events on a monthly basis.
5. Year Scale: This scale shows the tasks and events on a yearly basis.
Depending on the requirements of your project, you can choose the appropriate scale to display the tasks and events in a clear and organized manner. Additionally, dhtmlxGantt also allows you to customize the scales according to your specific needs.
dhtmlx-gantt配置
dhtmlxGantt是一款功能齐全的Gantt图表,可用于跨浏览器和跨平台应用程序,满足项目管理控件应用程序的需求。您可以通过更新start_date/end_date配置来重新计算比例范围,并且可以设置fit_tasks属性为true来强制重新渲染比例。
以下是一些示例代码来配置dhtmlxGantt:
1. 重新计算比例范围:
```javascript
gantt.attachEvent("onBeforeGanttRender", function(){
var range = gantt.getSubtaskDates();
var scaleUnit = gantt.getState().scale_unit;
if(range.start_date && range.end_date){
gantt.config.start_date = gantt.calculateEndDate(range.start_date, -4, scaleUnit);
gantt.config.end_date = gantt.calculateEndDate(range.end_date, 5, scaleUnit);
}
});
gantt.init("gantt_here");
```
2. 强制重新渲染比例:
```javascript
gantt.config.fit_tasks = true;
gantt.init("gantt_here");
```
3. 自定义比例:
```javascript
gantt.config.scales = [
{unit: "month", step: 1, format: "%F, %Y"},
{unit: "day", step: 1, format: "%j, %D"}
];
gantt.init("gantt_here");
```
阅读全文