@ -57,8 +57,7 @@ var logRun = function(runObject, callback){
//Render circles
//var dateParser = d3.time.format("%Y-%m-%d %H:%M:%S.%L +00:00"); -- can use this if date format is not proper
varrender=function(){
d3.json('/runs',function(error,data){//get all run data
vargenerateCircles=function(error,data){
//bind circles with data
varcircles=d3.select('#points').selectAll('circle')//ghost selction of circles
.data(data,function(d){
@ -82,11 +81,11 @@ var render = function(){
//attach event handlers after circle creation
attachDragHandlers();//attach drag handlers
attachDeleteHandlers();//attach delete handlers
});
}
varrender=function(){
d3.json('/runs',generateCircles);
};
render();//render on page load
//Attach click handler to circles
varattachDeleteHandlers=function(){
d3.selectAll('circle').on('click',function(d){
@ -133,19 +132,38 @@ var attachDragHandlers = function(){
d3.selectAll('circle').call(drag);
};
//create axes
varxAxis=d3.axisBottom(xScale);//create axis, not yet applied
varyAxis=d3.axisLeft(yScale);//create axis, not yet applied
d3.select('svg').append('g').attr('id','x-axis').attr('transform','translate(0,'+HEIGHT+')').call(xAxis);//apply xAxis, also, x axis must be moved to bottom of svg
d3.select('svg').append('g').attr('id','y-axis').call(yAxis);//y axis is good as it is, apply it
varxAxis=d3.axisBottom(xScale);//create axis, not yet applied
varyAxis=d3.axisLeft(yScale);//create axis, not yet applied
d3.select('svg').append('g').attr('id','x-axis').attr('transform','translate(0,'+HEIGHT+')').call(xAxis);//apply xAxis, also, x axis must be moved to bottom of svg
d3.select('svg').append('g').attr('id','y-axis').call(yAxis);//y axis is good as it is, apply it
//callback for zooming
varzoomCallback=function(){
//callback for zooming
varzoomCallback=function(){
lastTransform=d3.event.transform;//save the transform for later inversion with clicks
d3.select('#points').attr("transform",d3.event.transform);//apply transform to g element containing circles