1
votes

I have an issue with xAxis labels formatter. At this link "http://api.highcharts.com/highcharts#xAxis.labels.formatter" highchart api show some additional properties for "this" (chart, axis, value, isFirst, isLast) and get different by this.value. But in my case have many item in categories same value (http://jsfiddle.net/xfetaarL). So is possible for adding more additional properties (ex: id ) for separate item and then we can use that "id" in formatter function ?

function() {
  var id = this.id // this is my own property that I want to add
  return this.value;
}

Thanks for any your help. :wink:

1

1 Answers

2
votes

Yes, you can change format for xAxis.categories, see: http://jsfiddle.net/xfetaarL/2/

    xAxis: {
        categories: [{
            name: 'Foobar',
            id: '#1'
        }, {
            name: 'Foobar',
            id: '#2'
        }, {
            name: 'Foobar',
            id: '#3'
        }],

        labels: {
            formatter: function () {
                return '<a href="' + categoryLinks[this.value.name] + '">' + this.value.name + ' dhlId:' + this.value.id + '</a>';
            }
        }
    },

Let me know if something is not clear.