when I use fiscal year which starts at Oct 1 , the first year is calculated wrong. For example, if I have tasks starts at Oct 1 2018 , the chart will show like this:
FY 2017 FY 2017 FY 2018 …
I’m attaching a sample project here.
Has anyone had the same issue? any solution would be appreciated
FiscalYear.zip (1.1 MB)
guldmi
June 7, 2019, 1:43pm
#2
Hi @thao_trinh !
Your “fiscalYearLabel()” function is unused.
You need to use gantt.templates.date_scale
to set custom date values in the scale instead gantt.config.date_scale
. Here is a related article:
https://docs.dhtmlx.com/gantt/api__gantt_date_scale_template.html
Please remove gantt.config.date_scale
and set your “fiscalYearLabel()” function to the gantt.templates.date_scale
.
Please pay attention you need to set templates.date_scale
value in the “onTemplatesReady” event.
https://docs.dhtmlx.com/gantt/api__gantt_ontemplatesready_event.html .
So you need to add such code to your project:
gantt.attachEvent("onTemplatesReady", function(){
gantt.templates.date_scale = fiscalYearLabel
});
Here is a snippet with your full code modified:
http://snippet.dhtmlx.com/0efb316e6
You can use your “fiscalYearLabel()” function as a template for the subscale. Just add this object {unit:"fiscal_year", step:1, template:fiscalYearLabel}
to gantt.config.subscales
array. Here is a snippet you can see how it can be implemented:
http://snippet.dhtmlx.com/4b959a692
1 Like
ramil
August 20, 2019, 10:25am
#3
Hello Thao,
The dev team updated the scales API. Now you can specify the templates directly in the scale property and list all scales you need in one object:
https://docs.dhtmlx.com/gantt/desktop__configuring_time_scale.html
Originally, you had this configuration:
https://snippet.dhtmlx.com/39c34c239
Here is the updated configuration:
http://snippet.dhtmlx.com/528faf625
@ramil
Do you mind taking a look at the linked snippet? Using your code I am trying to get FY2021 but the scale is backdating to FY2020. Thanks!
http://snippet.dhtmlx.com/5/5d0d42dfd
ramil
August 9, 2021, 3:54pm
#5
Hello Dakota,
The scale depends on the task dates unless you manually specify it with the gantt.config.start_date
and gantt.config.end_date
parameters:
https://docs.dhtmlx.com/gantt/api__gantt_start_date_config.html
So, you can update the milestone date or set the displayed date range:
http://snippet.dhtmlx.com/5/c8268e83d
http://snippet.dhtmlx.com/5/40705fdf3
If you need something different, please, send me a picture of how you imagine it should look like.
1 Like