d3实现甘蔗图任务图效果
代码语言:html
所属分类:图表
代码描述:d3实现甘蔗图任务图效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> * { margin: 0; padding: 0; } body { background: #fff; font-family: 'Open-Sans',sans-serif; } #container{ margin: 0 auto; position: relative; width:800px; overflow: visible; } .svg { width:800px; height:400px; overflow: visible; position:absolute; } .grid .tick { stroke: lightgrey; opacity: 0.3; shape-rendering: crispEdges; } .grid path { stroke-width: 0; } #tag { color: white; background: #FA283D; width: 150px; position: absolute; display: none; padding:3px 6px; margin-left: -80px; font-size: 11px; } #tag:before { border: solid transparent; content: ' '; height: 0; left: 50%; margin-left: -5px; position: absolute; width: 0; border-width: 10px; border-bottom-color: #FA283D; top: -20px; } </style> </head> <body translate="no"> <div id="container"> <div class="svg"></div> <div id="tag"></div> </div> <script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/d3.v3.js"></script> <script > var w = 800; var h = 400; var svg = d3.selectAll(".svg") //.selectAll("svg") .append("svg") .attr("width", w) .attr("height", h) .attr("class", "svg"); var taskArray = [ { task: "conceptualize", type: "development", startTime: "2013-1-28", //year/month/day endTime: "2013-2-1", details: "This actually didn't take any conceptualization" }, { task: "sketch", type: "development", startTime: "2013-2-1", endTime: "2013-2-6", details: "No sketching either, really" }, { task: "color profiles", type: "development", startTime: "2013-2-6", endTime: "2013-2-9" }.........完整代码请登录后点击上方下载按钮下载查看
网友评论0