Initialize display
var config = {
width: 512,
height: 512,
bandwidth: 6, //in pixels
k: 4, //control convolution kernel size, not affect bandwidth
colors: [{h: (228 / 360), s: 0.3, l: 0.2}, {h: (60 / 360), s: 1.0, l: 0.9}], //scalar color map obtained by interpolating two colors's hsl values
attentuation: 0.000003 //scale density
};
var kde = new KDE(canvasDomElement, config);
Draw data
kde.drawData(data, //2d data array in the form : [[x, y], [x, y] ...]
{
d0: [-60, 40], //data origin
sx: 5, //scale factor
sy: 8,
x0: 0, //screen space origin
y0: 0
});
Clear display
kde.clear();
Update parameters
kde.setKernel(bandwidth, k);
kde.setAttentuation(attentuation);
Update display with new parameters
kde.reDraw();