gpt4 book ai didi

angularjs - Angular Gantt - 如何设置起始日期和截止日期范围以仅显示所需的分钟数?

转载 作者:行者123 更新时间:2023-12-02 10:02:54 28 4
gpt4 key购买 nike

我正在制作 Angular 甘特图。我将甘特图标题设置为仅显示分钟。我还想设置从分钟到分钟的范围。我的编码如下。但它总是将全天 View 显示为分钟。任何想法?仅显示以分钟为单位的范围?是否可以以毫秒为单位显示标题?

$scope.options = {
fromDate:new Date(2013, 10, 15, 14, 0, 0),
toDate:new Date(2013, 10, 15, 17, 50, 0)}

$scope.data = [
{name: 'row2', tasks: [
{name: 'task3', from: new Date(2013, 10, 15, 15, 0, 0), to: new Date(2013, 10, 15, 15, 10, 0)},
{name: 'task4', from: new Date(2013, 10, 15, 16, 20, 0), to: new Date(2013, 10, 15, 16, 50, 0)}
]
}
]
<div gantt data="data" from-date = "options.fromDate" to-date = "options.toDate" headers="['minute']" >
<gantt-tree> </gantt-tree> </div>

最佳答案

您可以在标题中添加毫秒。但似乎存在一个问题,即范围始终是从一天开始到一天结束。

将 headers 和 headersFormats 添加到您的 div

<div gantt data="data" from-date = "options.fromDate" to-date = "options.toDate" headers="['seconds', 'milliseconds']" headers-formats="headersFormats">
<gantt-tree> </gantt-tree> </div>

在您的 Controller 中定义 headerFormats 如下

$scope.headersFormats = {
seconds: function(column) {
return column.date.format('ss');
},
milliseconds: function(column) {
return column.date.format('SSS');
}
};

关于angularjs - Angular Gantt - 如何设置起始日期和截止日期范围以仅显示所需的分钟数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35507306/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com