Knowledge Base

GANTT Chart with a legend

GANTT chart does not support automatically-generated legends. The reason for this is that on most GANTT setups, generating legend for every segment would not make a lot of sense, and it’s fairly difficult to deduct a color for a category, given big number of possible segments and their representations.

That being said, you can still add legend to GANTT chart using legend configuration block and its data property, which can contain custom list of legend items.

I.e.:

"legend": {
  "data": [{
    "title": "Module #1",
    "color": "#b9783f"
  }, {
    "title": "Module #2",
    "color": "#cc4748"
  }, {
    "title": "Module #3",
    "color": "#cd82ad"
  }, {
    "title": "Module #4",
    "color": "#2f4074"
  }, {
    "title": "Module #5",
    "color": "#448e4d"
  }]
}

This demo shows how you can use the above, to add a legend to a GANTT chart.