Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Update</h2> <p>As heatmap.js v1 has now been <a href="http://www.patrick-wied.at/static/heatmapjs/frequently-asked-questions.html" rel="nofollow noreferrer">retired</a> I have also included an example based on the current version, v2, here:</p> <p><a href="http://jsfiddle.net/Fresh/pz4usuLe/" rel="nofollow noreferrer">http://jsfiddle.net/Fresh/pz4usuLe/</a></p> <p>This is based on the <a href="http://www.patrick-wied.at/static/heatmapjs/plugin-gmaps-layer.html" rel="nofollow noreferrer">Google Maps example found on the heatmap website</a>.</p> <h2>Original Answer</h2> <p>I looked at this and it is definitely confusing. I took your code and got it to work here:</p> <p><a href="http://jsfiddle.net/Fresh/nRQbd/" rel="nofollow noreferrer">http://jsfiddle.net/Fresh/nRQbd/</a></p> <p>(Note that the original example above no longer works as v1 has been retired, to see this working with v2 see this <a href="http://jsfiddle.net/Fresh/pz4usuLe/" rel="nofollow noreferrer">http://jsfiddle.net/Fresh/pz4usuLe/</a>)</p> <p>Note how I modified the datapoints within testData to get a result drawn on the map:</p> <pre><code>var testData = { max: 3, data: [{ lat: 48.3333, lng: 16.35, count: 100 }, { lat: 51.465558, lng: 0.010986, count: 100 }, { lat: 33.5363, lng: -5.044, count: 100 }] }; </code></pre> <p>I also increased the count value for each of these points; a point value of 1 is not visible, but increasing it's value (e.g. to 100) increases the intensity of the colour of the rendered point (thereby making it visible!).</p> <p>The problem appears to occur when points are drawn outside of the visible map boundary. I deduced this by debugging:</p> <pre><code>heatmap.setDataSet(testData); </code></pre> <p>(uncomment "debugger;" in the fiddle to debug the code in the web console)</p> <p>The code within heatmap-gmaps.js which is causing the datapoints to not be rendered is here:</p> <pre><code>while(dlen--){ latlng = new google.maps.LatLng(d[dlen].lat, d[dlen].lng); if(!currentBounds.contains(latlng)) { continue; } me.latlngs.push({latlng: latlng, c: d[dlen].count}); point = me.pixelTransform(projection.fromLatLngToDivPixel(latlng)); mapdata.data.push({x: point.x, y: point.y, count: d[dlen].count}); } </code></pre> <p>It appears that none of the datapoints in your example are contained within the current bounds of the rendered map area. Hence "!currentBounds.contains(latlng)" is always true, causing no points to be added to the mapdata object.</p> <p>This assumption seems to be true because the first point in your dataSet (i.e. lat: 33.5363, lng:-117.044) is in fact in San Diego (use this to confirm <a href="http://itouchmap.com/latlong.html" rel="nofollow noreferrer">http://itouchmap.com/latlong.html</a>), which is not visible on the rendered map.</p>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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