Currently, all things depending on the time scale are big if/else trees, for each available time scale. This can make it tedious to add or modify view modes.
It would be nice to have a configuration object to get these settings from, so people can more easily add other time scales without the need to alter/search through the code.
The new option could look something like this:
var gantt = new Gantt(div, tasks, {
// ...
view_modes: [
{
name: 'Hour',
step: 3600, // in unix seconds
snap_interval: 300, // snap task dates to 5 minute intervals
upper_text: {
x: 10, // offset from the 'base position'
period: 3600 * 24, // repeat the upper text for each day
text: 'DD', // using date_utils or in some date format
column_width: 38 // using date_utils or in some date format
},
lower_text: {/* similar to upper_text */}
},
// ... more view modes
]
}
}
Currently, all things depending on the time scale are big if/else trees, for each available time scale. This can make it tedious to add or modify view modes.
It would be nice to have a configuration object to get these settings from, so people can more easily add other time scales without the need to alter/search through the code.
The new option could look something like this: