Amcharts - Ajax loaded data, clickable points like in highcharts

- 1 answer

Ad

I'm wondering if there is a way to implement "clicakble data points" on an amchart just like is avaialble in highcharts. Example - http://www.highcharts.com/demo/line-ajax

I'd want to be able to click on a data point & create a box, then also be able to drag the box tha gets created anywhere on the web page just like one can in the example at http://www.highcharts.com/demo/line-ajax

Ad

Answer

Ad

http://codepen.io/team/amcharts/pen/0697255066bdf0b572041ba8fcac553e -

You can look up the necessary field names in the event object provided by the clickGraphItem event - both the chart and the current graph object are provided i.e. e.chart and e.graph - the properties for the corresponding objects are set up exactly as in the documentation. You can do something like

var categoryField = e.chart.categoryField;
var valueField = e.graph.valueField;
var text = 'Date: ' +  e.item.dataContext[categoryField] + '<br>Value: ' + e.item.dataContext[valueField]; 
Ad
source: stackoverflow.com
Ad