Description

This component will return a heat map based off the points from a query.  Using a program, timer, and a group with tags.

Completed Model (Basic)

Download: heatMap.zip

Download

Example: heatmap.min.js

Make sure to download this file to drag and drop into your workspace in the graphics builder

Video

Example: 


Program

var heat = query("heat");
var heatmap = h337.create({
  container: heat.view
});

finstack.eval('point and equipRef->lighting and temp and radius', function(data){
var heatPoints = data.result.toObj();
var datas = [];
for(var i=0; i<heatPoints.length; i++){
    datas.push({
      radius:(heatPoints[i].radius),
      value:(heatPoints[i].curVal),
      x:(heatPoints[i].x),
      y:(heatPoints[i].y)
    });
}
heatmap.setData({
  max: 100,
  data: datas
});
});

The first 4 lines is tell the program to display the heat map in the group.   In this example the query is point and equipRef->lighting and temp and radius.  Below the query it is setting up a loop to get all the points.  x and y will get the coordinates, radius is how big or small, and value is how red or blue the point is, lower numbers being blue and higher numbers red.

The query must contain an x, y, curVal, and radius value or have a different value set.  For example in value: (heatPoints[i].curVal), and something other than curVal wanted to be used as the value, curVal can be replaced with another value in the query.


How To Make your Own