0

I form charts and a have such series format:

series: {
                            id  : '001',
                            name: 'name,
                            data: [],
                            color: '#fff'
                        }

In plotOptions I created onClick event:

plotOptions: {
                series: {
                    stacking: 'normal',
                    cursor: 'pointer',
                    allowPointSelect: true,
                    marker: {
                        states: {
                            select: {
                                enabled: true
                            }
                        }
                    },
                    point: {
                        events: {
                            click: function () {
                                console.log('!!!!!', this);
                            }
                        }
                    }
                }
            }

After clock i get object in log. There is all information except id: '001'. How can I get it?

Sam Fisher
  • 746
  • 2
  • 10
  • 27

1 Answers1

2

You attached the click event to the point, so this inside the callback refer to the point object. Id is defined in series' options.

You can access it from series.options object:

point: {
  events: {
    click: function() {
      console.log('!!!!!', this.series.options.id);
    }
  }
}

live example: http://jsfiddle.net/4s3ayhfy/

morganfree
  • 12,254
  • 1
  • 14
  • 21