2018-06-15 11:03:24 -04:00
|
|
|
import { registerUnbound } from "discourse-common/lib/helpers";
|
2014-12-12 13:28:20 -05:00
|
|
|
|
2018-06-15 11:03:24 -04:00
|
|
|
registerUnbound("value-at-tl", function(data, params) {
|
2014-12-12 13:28:20 -05:00
|
|
|
var tl = parseInt(params.level, 10);
|
|
|
|
if (data) {
|
2018-06-15 11:03:24 -04:00
|
|
|
var item = data.find(function(d) {
|
|
|
|
return parseInt(d.x, 10) === tl;
|
|
|
|
});
|
2014-12-12 13:28:20 -05:00
|
|
|
if (item) {
|
|
|
|
return item.y;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|