I'm trying to alert/fetch the period value from SMA indicator series if the series is clicked.
series : [{
name: 'AAPL Stock Price',
type : 'line',
id: 'primary',
data : data
}, {
name: '15-day SMA',
linkedTo: 'primary',
showInLegend: true,
type: 'trendline',
algorithm: 'SMA',
periods: 15
}]
SMA technical indicators- http://jsfiddle.net/laff/WaEBc/
In the reference the period value is defined 15. just alert this value. Thanks in advance.
You can set event click directly in series options:
series : [{
name: 'AAPL Stock Price',
type : 'line',
id: 'primary',
data : data
}, {
name: '15-day SMA',
linkedTo: 'primary',
showInLegend: true,
type: 'trendline',
algorithm: 'SMA',
periods: 15,
events: {
click: function() {
console.log(this.options.periods);
}
}
}]