gantt: add a topAxis directive to allow per diagram configuration

This commit is contained in:
Nishanth Aravamudan 2021-03-24 11:21:39 -05:00
parent 6629061abd
commit 2d0aab223c
2 changed files with 14 additions and 0 deletions

View File

@ -16,6 +16,7 @@ let currentSection = '';
const tags = ['active', 'done', 'crit', 'milestone'];
let funs = [];
let inclusiveEndDates = false;
let topAxis = false;
// The serial order of the task in the script
let lastOrder = 0;
@ -39,6 +40,7 @@ export const clear = function() {
todayMarker = '';
excludes = [];
inclusiveEndDates = false;
topAxis = false;
lastOrder = 0;
};
@ -70,6 +72,14 @@ export const endDatesAreInclusive = function() {
return inclusiveEndDates;
};
export const enableTopAxis = function() {
topAxis = true;
};
export const topAxisEnabled = function() {
return topAxis;
};
export const getDateFormat = function() {
return dateFormat;
};
@ -594,6 +604,8 @@ export default {
getDateFormat,
enableInclusiveEndDates,
endDatesAreInclusive,
enableTopAxis,
topAxisEnabled,
setAxisFormat,
getAxisFormat,
setTodayMarker,

View File

@ -68,6 +68,7 @@ that id.
"gantt" return 'gantt';
"dateFormat"\s[^#\n;]+ return 'dateFormat';
"inclusiveEndDates" return 'inclusiveEndDates';
"topAxis" return 'topAxis';
"axisFormat"\s[^#\n;]+ return 'axisFormat';
"excludes"\s[^#\n;]+ return 'excludes';
"todayMarker"\s[^\n;]+ return 'todayMarker';
@ -108,6 +109,7 @@ line
statement
: dateFormat {yy.setDateFormat($1.substr(11));$$=$1.substr(11);}
| inclusiveEndDates {yy.enableInclusiveEndDates();$$=$1.substr(18);}
| topAxis {yy.TopAxis();$$=$1.substr(8);}
| axisFormat {yy.setAxisFormat($1.substr(11));$$=$1.substr(11);}
| excludes {yy.setExcludes($1.substr(9));$$=$1.substr(9);}
| todayMarker {yy.setTodayMarker($1.substr(12));$$=$1.substr(12);}