I have a list of data in javascript that looks like this:
[[152, 48, 'http://www.google.com'],
[198, 47, 'http://www.stackoverflow.com'],
[199, 45, 'http://www.apple.com']]
I am using flot to create a plot, and am trying to pass this third value to access a hyperlink from the point. As such, I am trying to lookup the third value of each list by using the first two as the lookup keys (i.e., [[x,y,hyperlink],[x2,y2,hyperlink2]]
, click on a point, then use the appropriate (x,y)
to find the corresponding hyperlink)
Is there anyway to do this, or do I need to pass some dictionaries for x and y to javascript, then find the common variable from the two lists that were looked up? In python I know you could do a filter of list on the x
value with itemgetter, then lookup a link corresponding to the y
value. But I know almost nothing about js, so could a solution to ID-ing with (x,y)
be given, or if not possible or advised, then a solution to taking two lists of (from x and y vals) and find a common value (if multiple, just one, anyone)?