JSON:
var obj = {
'itemA' : {
'x' : '300',
'y' : '200'
},
'itemB' : {
'x' : '305',
'y' : '210'
},
'itemC' : {
'x' : '442',
'y' : '210'
}
};
What I need to do is pick up these items and instead of displaying the 3, display only groups that group the items next to each other. For example, the x
and y
of the itemA and itemB are nearby so instead of displaying 2, it would only display 1 grouping. Since the itemC has the x
far away and the y
near, but since it has to be x
and y
that has to be close, then it would display it without grouping with the others would display 2 items on the screen.
I'm still not sure how to do this with Javascript
or jQuery
, and even PHP
if that's the case, but I'd like it in JS / jQuery.