user2733590
user2733590

Reputation: 17

Trendline is not working in Amcharts Gantt chart

I am trying to show a Trend line in amchart's Gantt Chart. my Code

    "trendLines": [{


    "finalValue": 'John',
    "initialValue": "Kendra",

    "initialDate": '2015-01-01',
    "finalDate": '2015-07-01',
    "lineColor": "#CC0000"
}],

The chart has date in X axis and categories in Y axis. Gantt Chart screen shot

Upvotes: 2

Views: 242

Answers (1)

xorspark
xorspark

Reputation: 16012

You need to use initialValue and finalValue for the value axis, even if the value axis is date-based. You'll have to convert the string-based date to a millisecond timestamp, which can be done using AmCharts.stringToDate. The Y axis in the Gantt chart is a category axis, so you need to use initialCategory and finalCategory.

"trendLines": [{
  "initialCategory": "John",
  "finalCategory": "Kendra",
  "initialValue": AmCharts.stringToDate("2015-01-01 07:00", "YYYY-MM-DD JJ:NN"),
  "finalValue": AmCharts.stringToDate("2015-01-01 10:00", "YYYY-MM-DD JJ:NN"),
}],

Codepen demo

Upvotes: 2

Related Questions