Ext Gantt Web甘特图--时间刻度和自定义
甘特图提供多种不同的时间刻度的定义,用户也可以自定义自己的时间刻度。系统内置的时间刻度包括以下六种:
1 hourAndDay 小时和天刻度
2 dayAndWeek 天和周刻度
3 weekAndDay 周和天刻度
4 weekAndMonth 周和月刻度
5 monthAndYear 月和年刻度
6 year 年刻度
以下是自定义时间刻度的代码。
1. Sch.PresetManager.registerPreset("test", {
2. timeColumnWidth : 20, // Time column width, only applicable when locked columns are used
3. displayDateFormat : "Y-m-d", // Controls how dates will be displayed in tooltips etc
4. shiftIncrement : 1, // Controls how much time to skip when calling shiftNext and shiftPrevious.
5. shiftUnit : "w", // Valid values are "MILLI", "SECOND", "MINUTE", "HOUR", "DAY", "WEEK", "MONTH", "QUARTER", "YEAR".
6. defaultSpan : 12, // By default, if no end date is supplied to a view it will show 12 hours
7. timeResolution : { // Dates will be snapped to this resolution
8. unit : "d", // Valid values are "MILLI", "SECOND", "MINUTE", "HOUR", "DAY", "WEEK", "MONTH", "QUARTER", "YEAR".
9. increment : 1
10. },
11. headerConfig : { // This defines your header, you must include a "middle" object, and top/bottom are optional. For each row you can define "unit", "increment", "dateFormat", "renderer", "align", and "scope"
12. middle : {
13. unit : "w",
14. dateFormat : "D d M Y"
15. },
16. /*top : {
17. unit : "Month",
18. dateFormat : 'D d/m'
19. },*/
20. bottom:{
21. increment:1,
22. unit:"d",
23. renderer:function(a, b, c, d){
24. return a.getDate();
25. }
26. }
27. }
28. });