D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
bhandarisumit
Full window
Github gist
SO Question
<!DOCTYPE html> <meta charset="utf-8"> <style> body { font: 10px sans-serif; } .axis path, .axis line { fill: none; stroke: #000; shape-rendering: crispEdges; } .x.axis path { display: none; } .line { fill: none; stroke: steelblue; stroke-width: 2px; } rect { fill: #fff; } </style> <body> <script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.2/d3.js"></script> <script> var margin = {top: 15, right: 40, bottom: 20, left: 50}, width = 960 - margin.left - margin.right, height = 240 - margin.top - margin.bottom; var svg = d3.select("body").append("svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); var clip = svg.append("defs").append("svg:clipPath") .attr("id", "clip") .append("svg:rect") .attr("id", "clip-rect") .attr("x", "0") .attr("y", "0") .attr("width", width) .attr("height", height); var chartBody = svg.append("g") .attr("clip-path", "url(#clip)"); var rect = chartBody.append('svg:rect') .attr('width', width-20) .attr('height', height-20) .attr('fill', 'white'); var labeledRect = chartBody.append("rect") .attr("x", 0) .attr("y", 0) .attr("height", height-20) .attr("width", width-20) .style("stroke", "red") .attr("class", "labelbox") .style("fill", "none"); var closeArea = chartBody.append('text') .text('X') .attr("font-family", "sans-serif") .attr("font-size", "20px") .attr("fill", "red"); labeledRect.append('text').attr('color','black').text('X'); </script>
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.2/d3.js