heatmap.js - Function to plot multiple data points from .csv

89 views
Skip to first unread message

vishnu sagar

unread,
Nov 2, 2016, 9:28:14 AM11/2/16
to d3-js
Hi,

I am trying to plot x1,y1 co-ordinates using heatmap.js, I read the values from .csv file using d3.csv() method. I tried with example in https://www.patrick-wied.at/static/heatmapjs/.  I just get a blank screen without any points plotted, nor do I get any errors. Kindly help.
In the code, Is there any error when I pass the array as 

heatmap.setData({ max : 5, data : data });


<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
<script src="heatmap.js"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script type="text/javascript">
function point() {
alert("alert");
var heatmap = h337.create({
container : domElement
});

d3.csv("files/trial5.csv", function(error, data) {

data.forEach(function(d) {
d.x1 = +d.x1;
d.y1 = +d.y1;
});
heatmap.setData({
max : 1000,
min : 100,
data : data
});

})

}
</script>
</head>
<body>
<div id="domElement"
style="width: 1000px; height: 1000px; border: solid;"></div>
<input type="button" value="Click" id="clickButton" onclick="point()" />
</body>
</html>
Reply all
Reply to author
Forward
0 new messages