Use of dataContext to display info in Gantt Amcharts

1.3k views Asked by At

I am trying to work out dataContext use in recently released Gantt charts.
I want some extra information to be displayed / an event to be fired when user clicks on a bar. I saw how it can be done with a serial graph but I can't make it work for my Gantt chart.

I have:

chart.addListener("clickGraphItem", function (event) {
    console.log(event.item.dataContext.property);  
});

and my dataProvider is like this:

"dataProvider": [ {
    "category": "John",
    "property": 122,
    "segments": [ {
        "start": 7,
        "duration": 2,
        "color": "#7B742C",
        "task": "Task #1"
    }, {
        "duration": 2,
        "color": "#7E585F",
        "task": "Task #2"
    }, {
        "duration": 2,
        "color": "#CF794A",
        "task": "Task #3"
    } ]
}];

Output is always "undefined", I must be missing something. I pasted my code in this jsfiddle: http://jsfiddle.net/tholz/ah0kcxjn/1/, it's the example taken from Gantt Demo of Amcharts site.

Any tip?

2

There are 2 answers

1
zeroin On

We added url property for GaugeBand which allows to add link on a band, also rollOverBand/rollOutBand/clickBand events for GaugeAxis. (version 3.14.5)

0
moh On
chart.addListener("clickGraphItem", function (event) {
    console.log(event.item.dataContext)
});

enter image description here