Skip to content

Instantly share code, notes, and snippets.

@roundrobin
Created December 28, 2012 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roundrobin/4403141 to your computer and use it in GitHub Desktop.
Save roundrobin/4403141 to your computer and use it in GitHub Desktop.
Another Inlet
{"description":"Another Inlet","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"tab":"edit","display_percent":0.49531249999999993,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"hidepanel":false}
var svg = d3.select("svg");
function Tooltip(x, y, width, height, appendTo, contentElements, onclickCallback){
this.x = x;
this.y = y;
this.paddingX = 10;
this.paddingY = 10;
this.onclickCallback = onclickCallback;
this.appendTo = appendTo;
this.dimensions = {"width":width, "height":height};
this.contentFill = contentElements;
//this.reponsiveTypes = ["fitToWidth","wrapText"];
this.bgRect = this.appendTo.append("svg:rect")
.attr("width", this.dimensions["width"])
.attr("height", this.dimensions["height"])
.attr("rx",25)
.attr("ry",25)
.attr("x",0)
.attr("y",0)
.attr("fill","#201F24")
.classed("bgRect",true);
this.arrow = this.appendTo.append('svg:path')
.attr("fill","#201F24")
.attr("d","m0,0 l35,0 l-17.5,20Z")
.attr("fill","#201F24")
.attr("transform","translate("+[(this.dimensions["width"]/2)-8,this.dimensions["height"]]+")");
contentElements(appendTo)();
}
Tooltip.prototype.render = function(){
};
Tooltip.prototype.show = function(){
};
Tooltip.prototype.destroy = function(){
};
Tooltip.prototype.hide = function(){
};
var content = function(appendTo){
return function(){
appendTo.append('svg:text')
.text(function(d,i){ return "Hello World";})
.attr("fill", "#FFFFFF")
.attr("x", 0)
.attr("y", 100)
.attr("font-size", 10)
.attr("font-family", "Arial")
.attr("text-anchor", "start");
}
}
var x = new Tooltip(100,100,200,200,svg,content);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment