Ajdust of the Grid

Hello :slight_smile:

My Gantt Chart withis this configurations:

gantt.config.autosize = “x”;
gantt.config.scale_unit = “month”;
gantt.config.step = 1;
gantt.config.date_scale = “%F, %Y”;
gantt.config.min_column_width = 15;
gantt.config.scale_height = 90;

var weekScaleTemplate = function(date){
var dateToStr = gantt.date.date_to_str(“%d”);
var endDate = gantt.date.add(gantt.date.add(date, 1, “week”), -1, “day”);
return dateToStr(date) + " - " + dateToStr(endDate);
};

gantt.config.subscales = [
{unit:“week”, step:1, template:weekScaleTemplate},
{unit:“day”, step:1, date:“%D” }
];

And it render like appears in the picture.

It is possible to make the Gantt starts on the max left side?

Thanks


Hi,
try to specify “week” as a scale_unit, and define ‘month’ in subscales. Scales will be displayed in the same order, but the week will be used as a time unit for a displayed time-range calculation.
So the left offset before the earliest task will be one week

Can you write the code please?

Thanks

I did what you said, but the order has changed :X and now, the task width are too large :X

Hello,
I’m not sure how it is possible. The order of scales does not depends on order of their definitions, they always go descending.
Can you show the code or link to the demo?

To get the closest behavior that i want, i did this

gantt.config.autosize = “x”;
gantt.config.scale_unit = “week”;
gantt.config.step = 1;
gantt.config.date_scale = “%F, %Y”;
gantt.config.min_column_width = 15;
gantt.config.scale_height = 90;

var weekScaleTemplate = function(date){
var dateToStr = gantt.date.date_to_str(“%d”);
var endDate = gantt.date.add(gantt.date.add(date, 1, “week”), -1, “day”);
return dateToStr(date) + " - " + dateToStr(endDate);
};

gantt.config.subscales = [
{unit:“week”, step:1, template:weekScaleTemplate},
{unit:“day”, step:1, date:“%D” }
];

And i got the result shown in the picture. (it’s almost what i want :slight_smile: but will do)


Hi,
why don’t you add ‘month’ to the subscales?[code] gantt.config.scale_unit = “week”;
gantt.config.step = 1;
gantt.config.min_column_width = 50;
gantt.config.scale_height = 90;

gantt.config.subscales = [
	{unit:"month", step:1, date:"%F, %Y"},
	{unit:"day", step:1, date:"%D" }
];
gantt.attachEvent("onTemplatesReady", function(){
	var dateToStr = gantt.date.date_to_str("%d %M");
	gantt.templates.date_scale = function(date){
		var endDate = gantt.date.add(gantt.date.add(date, 1, "week"), -1, "day");
		return dateToStr(date) + " - " + dateToStr(endDate);
	};
});

gantt.init("gantt_here");[/code] However, the scales configuration shouldn't affect the task dates