I am trying to index a django object with a javascript variable. I would like to do something like {{ data.foo }} where var foo= this.x;
The idea is that when a user clicks on a datapoint in my chart, I will call the object that corresponds to the x-axis value.
Here is my code:
point: {
events: {
click: function (e) {
var x_pos= this.x;
var image= c[x_pos];
hs.htmlExpand(null, {
pageOrigin: {
x: e.pageX || e.clientX,
y: e.pageY || e.clientY
},
headingText: this.series.name,
maincontentText:
this.y + 'HU' + '<br/> ' + '{{ image_name }}'+ '<br/> ' + noise[0][x_pos] + '<br/> '
+ ':<br/> ' + '<a href="{{ data.${x_pos}.get_absolute_url }}"><img class="centered" src="' + image +'" height="500px"></a>',
width: 530,
height: 640
});
}
}}
Thanks in advance for your help!