javascript - d3 timeline make axis fragmented (color-code) based on time offset -
javascript - d3 timeline make axis fragmented (color-code) based on time offset -
i using d3-timeline.js (https://github.com/jiahuang/d3-timeline/blob/master/readme.md) build this:
currently, timeline's axis looks this:
now, want axis little broader able create this:
how can accomplish that?
this code:
var info = [ {label: "person a", "color": "red", times: [ {"starting_time": 1355752800000, "ending_time": 1355759900000}, {"starting_time": 1355767900000, "ending_time": 1355774400000} ]}, {label: "person b", "color": "green", times: [ {"starting_time": 1355759910000, "ending_time": 1355761900000} ]}, {label: "person c", "color": "blue", times: [ {"starting_time": 1355761910000, "ending_time": 1355763910000} ]}, ]; var chart = d3.timeline() .stack() // toggles graph stacking .margin({left:70, right:30, top:0, bottom:0}); var svg = d3.select(target) .append("svg") .attr("width", 500) .datum(data) .call(chart);
the easiest solution add background image svg element , position correctly.
javascript jquery d3.js timeline
Comments
Post a Comment