Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's the solution I came up with. It does exactly what I need, while displaying the coordinates that are found in their proper places.</p> <p><a href="http://pastehtml.com/view/cowibn4bs.html" rel="nofollow">http://pastehtml.com/view/cowibn4bs.html</a> to see the fruits of my labour.</p> <pre><code>if(n==0){ for(var i=0; i &lt; data.length; i++) { var xs = 0; var xy = 0; xs = xPlot - data[i][0]; ys = yPlot - data[i][1]; xs = xs * xs; ys = ys * ys; distance = Math.sqrt(xs + ys); if (distance &lt;= 25){ display2(data[i][0] + ", " + data[i][1] + " - " + alliance); } else if(distance &lt;= 60){ display3(data[i][0] + ", " + data[i][1] + " - " + alliance); } else if(distance &lt;= 150){ display4(data[i][0] + ", " + data[i][1] + " - " + alliance); } } } else if(n&gt;0){ $('#msgs2').html(''); $('#msgs3').html(''); $('#msgs4').html(''); for(var i=0; i &lt; data.length; i++) { a = []; for(var j=0; j &lt; coords.length; j++) { var xs = 0; var ys = 0; xs = coords[j][1] - data[i][0]; ys = coords[j][2] - data[i][1]; xs = xs * xs; ys = ys * ys; distance = Math.sqrt(xs + ys); if (distance &lt;= 25){ a[j] = 'g'; } else if (distance &lt;= 60){ a[j] = 'b'; } else if (distance &lt;= 150){ a[j] = 'r'; } else{ a[j] = 0; } } if($.inArray(0, a) &gt; -1){ } else if($.inArray("g", a) &gt; -1 &amp;&amp; $.inArray("b", a) === -1){ if($.inArray("r", a) === -1){ display2(data[i][0] + ", " + data[i][1] + " - " + alliance); } } else if($.inArray("b", a) &gt; -1 &amp;&amp; $.inArray("r", a) === -1){ display3(data[i][0] + ", " + data[i][1] + " - " + alliance); } else if($.inArray("r", a) &gt; -1){ display4(data[i][0] + ", " + data[i][1] + " - " + alliance); } } } n++; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload