а

Show Labels to Side (For Shorter Width Tasks)


#1

On the homepage demo, tasks that have long names shows to the right of the task bar instead of within it. How do I do the same?

We are an Enterprise customer, v6 or 6.1 I think.

Thank you.


#2

Hi @Osensnolf,
In order to do this you can use a few tools:

  1. Templates for rightside_text/leftside_text/task_text to show text in the right place. The code of templates may look like this fragment:
gantt.templates.task_text = function taskTextTemplate(start, end, task) {
  if (getTaskFitValue(task) === "center") {
    return task.text;
  }
  return "";
};
  1. Custom function to compare the task and text sizes.

After that, you will be able to show the text on the rightside/leftside/inside of the task.

Here is a demo:
http://snippet.dhtmlx.com/3663d9bd2

API list:
rightside_text:
https://docs.dhtmlx.com/gantt/api__gantt_rightside_text_template.html
leftside_text:
https://docs.dhtmlx.com/gantt/api__gantt_leftside_text_template.html
task_text:
https://docs.dhtmlx.com/gantt/api__gantt_task_text_template.html

Best regards.


#3

Awesome! I’ll ask my developer to give this a try and make sure it works. Much appreciation.