Notebook - Welcome to Notebook

Contact/Report Bugs
You can contact me at: bkenwright@xbdev.net












script src https code jquery com jquery 3 5 0 js script script type text javascript src https d3js org d3 v3 min js script style axis path axis line fill none stroke black shape rendering crispEdges axis text font family sans serif font size 10px timeline label font family sans serif font size 12px timeline2 axis transform translate 0px 40px ms transform translate 0px 40px IE 9 webkit transform translate 0px 40px Safari and Chrome o transform translate 0px 40px Opera moz transform translate 0px 40px Firefox coloredDiv height 20px width 20px float left style div h3 A simple timeline h3 div id timeline1 div div div h3 A simple timeline without Axis h3 div id timeline1_noaxis div div div h3 It works with circles too h3 div id timeline2 div div div h3 Combine circles and rectangles h3 div id timeline2_combine div div div h3 A stacked timeline with hover click and scroll events h3 div id timeline3 div div id hoverRes div class coloredDiv div div id name div div id scrolled_date div div div div h3 We can also use icons h3 div id timeline5 div div div h3 We can change colors and put labels h3 div id timeline6 div div div h3 We can also rotate tick mark labels h3 div id timeline7 div div div h3 A timeline with colors mapped from the data h3 div id timelineColors div div div h3 A timeline with colors mapped from the data for individual time objects h3 div id timelineColorsPerTime div div div h3 A timeline with relative timepoints h3 div width 100 id timelineRelativeTime div div div h3 A stacked timeline with axis on top h3 div width 100 id timelineAxisTop div div div h3 A stacked timeline with backgrounds h3 div width 100 id timelineBgnd div div div h3 A stacked timeline with backgrounds and ticks h3 div width 100 id timelineBgndTick div div div h3 A complex timeline h3 div width 100 id timelineComplex div div script function d3 timeline function var DISPLAY_TYPES circle rect var hover function mouseover function mouseout function click function scroll function labelFunction function label return label navigateLeft function navigateRight function orient bottom width null height null rowSeparatorsColor null backgroundColor null tickFormat format d3 time format I p tickTime d3 time hours tickInterval 1 tickSize 6 tickValues null colorCycle d3 scale category20 colorPropertyName null display rect beginning 0 labelMargin 0 ending 0 margin left 30 right 30 top 30 bottom 30 stacked false rotateTicks false timeIsRelative false fullLengthBackgrounds false itemHeight 20 itemMargin 5 navMargin 60 showTimeAxis true showAxisTop false showTodayLine false timeAxisTick false timeAxisTickFormat stroke stroke dasharray spacing 4 10 showTodayFormat marginTop 25 marginBottom 0 width 1 color colorCycle showBorderLine false showBorderFormat marginTop 25 marginBottom 0 width 1 color colorCycle showAxisHeaderBackground false showAxisNav false showAxisCalendarYear false axisBgColor white chartData var appendTimeAxis function g xAxis yPosition if showAxisHeaderBackground appendAxisHeaderBackground g 0 0 if showAxisNav appendTimeAxisNav g var axis g append g attr class axis attr transform translate 0 yPosition call xAxis var appendTimeAxisCalendarYear function nav var calendarLabel beginning getFullYear if beginning getFullYear ending getFullYear calendarLabel beginning getFullYear ending getFullYear nav append text attr transform translate 20 0 attr x 0 attr y 14 attr class calendarYear text calendarLabel var appendTimeAxisNav function g var timelineBlocks 6 var leftNavMargin margin left navMargin var incrementValue width margin left timelineBlocks var rightNavMargin width margin right incrementValue navMargin var nav g append g attr class axis attr transform translate 0 20 if showAxisCalendarYear appendTimeAxisCalendarYear nav nav append text attr transform translate leftNavMargin 0 attr x 0 attr y 14 attr class chevron text on click function return navigateLeft beginning chartData nav append text attr transform translate rightNavMargin 0 attr x 0 attr y 14 attr class chevron text on click function return navigateRight ending chartData var appendAxisHeaderBackground function g xAxis yAxis g insert rect attr class row green bar attr x xAxis attr width width attr y yAxis attr height itemHeight attr fill axisBgColor var appendTimeAxisTick function g xAxis maxStack g append g attr class axis attr transform translate 0 margin top itemHeight itemMargin maxStack attr timeAxisTickFormat stroke timeAxisTickFormat spacing call xAxis tickFormat tickSize margin top itemHeight itemMargin maxStack 1 3 0 0 var appendBackgroundBar function yAxisMapping index g data datum var greenbarYAxis itemHeight itemMargin yAxisMapping index margin top g selectAll svg data data enter insert rect attr class row green bar attr x fullLengthBackgrounds 0 margin left attr width fullLengthBackgrounds width width margin right margin left attr y greenbarYAxis attr height itemHeight attr fill backgroundColor instanceof Function backgroundColor datum index backgroundColor var appendLabel function gParent yAxisMapping index hasLabel datum var fullItemHeight itemHeight itemMargin var rowsDown margin top fullItemHeight 2 fullItemHeight yAxisMapping index 1 gParent append text attr class timeline label attr transform translate labelMargin rowsDown text hasLabel labelFunction datum label datum id on click function d i click d index datum function timeline gParent var g gParent append g var gParentSize gParent 0 0 getBoundingClientRect var gParentItem d3 select gParent 0 0 var yAxisMapping maxStack 1 minTime 0 maxTime 0 setWidth check if the user wants relative time if so substract the first timestamp from each subsequent timestamps if timeIsRelative g each function d i d forEach function datum index datum times forEach function time j if index 0 j 0 originTime time starting_time Store the timestamp that will serve as origin time starting_time 0 Set the origin time ending_time time ending_time originTime Store the relative time millis else time starting_time time starting_time originTime time ending_time time ending_time originTime check how many stacks we re gonna need do this here so that we can draw the axis before the graph if stacked ending 0 beginning 0 g each function d i d forEach function datum index create y mapping for stacked graph if stacked Object keys yAxisMapping indexOf index 1 yAxisMapping index maxStack maxStack figure out beginning and ending times if they are unspecified datum times forEach function time i if beginning 0 if time starting_time minTime minTime 0 timeIsRelative false minTime time starting_time if ending 0 if time ending_time maxTime maxTime time ending_time if ending 0 ending maxTime if beginning 0 beginning minTime var scaleFactor 1 ending beginning width margin left margin right draw the axis var xScale d3 time scale domain beginning ending range margin left width margin right var xAxis d3 svg axis scale xScale orient orient tickFormat tickFormat format tickSize tickFormat tickSize if tickFormat tickValues null xAxis tickValues tickFormat tickValues else xAxis ticks tickFormat numTicks tickFormat tickTime tickFormat tickInterval draw the chart g each function d i chartData d d forEach function datum index var data datum times var hasLabel typeof datum label undefined issue warning about using id per data set Ids should be individual to data elements if typeof datum id undefined console warn d3Timeline Warning Ids per dataset is deprecated in favor of a class key Ids are now per data element if backgroundColor appendBackgroundBar yAxisMapping index g data datum g selectAll svg data data enter append function d i return document createElementNS d3 ns prefix svg display in d d display display attr x getXPos attr y getStackPosition attr width function d i return d ending_time d starting_time scaleFactor attr cy function d i return getStackPosition d i itemHeight 2 attr cx getXPos attr r itemHeight 2 attr height itemHeight style fill function d i var dColorPropName if d color return d color if colorPropertyName dColorPropName d colorPropertyName if dColorPropName return colorCycle dColorPropName else return colorCycle datum colorPropertyName return colorCycle index on mousemove function d i hover d index datum on mouseover function d i mouseover d i datum on mouseout function d i mouseout d i datum on click function d i click d index datum attr class function d i return datum class timelineSeries_ datum class timelineSeries_ index attr id function d i use deprecated id field if datum id d id return timelineItem_ datum id return d id d id timelineItem_ index _ i g selectAll svg data data enter append text attr x getXTextPos attr y getStackTextPosition text function d return d label if rowSeparatorsColor var lineYAxis itemHeight itemMargin 2 margin top itemHeight itemMargin yAxisMapping index gParent append svg line attr class row separator attr x1 0 margin left attr x2 width margin right attr y1 lineYAxis attr y2 lineYAxis attr stroke width 1 attr stroke rowSeparatorsColor add the label if hasLabel appendLabel gParent yAxisMapping index hasLabel datum if typeof datum icon undefined gParent append image attr class timeline label attr transform translate 0 margin top itemHeight itemMargin yAxisMapping index attr xlink href datum icon attr width margin left attr height itemHeight function getStackPosition d i if stacked return margin top itemHeight itemMargin yAxisMapping index return margin top function getStackTextPosition d i if stacked return margin top itemHeight itemMargin yAxisMapping index itemHeight 0 75 return margin top itemHeight 0 75 var belowLastItem margin top itemHeight itemMargin maxStack var aboveFirstItem margin top var timeAxisYPosition showAxisTop aboveFirstItem belowLastItem if showTimeAxis appendTimeAxis g xAxis timeAxisYPosition if timeAxisTick appendTimeAxisTick g xAxis maxStack if width gParentSize width var move function var x Math min 0 Math max gParentSize width width d3 event translate 0 zoom translate x 0 g attr transform translate x 0 scroll x scaleFactor xScale var zoom d3 behavior zoom x xScale on zoom move gParent attr class scrollable call zoom if rotateTicks g selectAll tick text attr transform function d return rotate rotateTicks translate this getBBox width 2 10 TODO change this 10 this getBBox height 2 var gSize g 0 0 getBoundingClientRect setHeight if showBorderLine g each function d i d forEach function datum var times datum times times forEach function time appendLine xScale time starting_time showBorderFormat appendLine xScale time ending_time showBorderFormat if showTodayLine var todayLine xScale new Date appendLine todayLine showTodayFormat function getXPos d i return margin left d starting_time beginning scaleFactor function getXTextPos d i return margin left d starting_time beginning scaleFactor 5 function setHeight if height gParentItem attr height if itemHeight set height based off of item height height gSize height gSize top gParentSize top set bounding rectangle height d3 select gParent 0 0 attr height height else throw height of the timeline is not set else if height height gParentItem attr height else gParentItem attr height height function setWidth if width gParentSize width try width gParentItem attr width if width throw width of the timeline is not set As of Firefox 27 timeline with x needs to be explicitly set in order to render catch err console log err else if width gParentSize width try width gParentItem attr width catch err console log err if both are set do nothing function appendLine lineScale lineFormat gParent append svg line attr x1 lineScale attr y1 lineFormat marginTop attr x2 lineScale attr y2 height lineFormat marginBottom style stroke lineFormat color rgb 6 120 155 style stroke width lineFormat width SETTINGS timeline margin function p if arguments length return margin margin p return timeline timeline orient function orientation if arguments length return orient orient orientation return timeline timeline itemHeight function h if arguments length return itemHeight itemHeight h return timeline timeline itemMargin function h if arguments length return itemMargin itemMargin h return timeline timeline navMargin function h if arguments length return navMargin navMargin h return timeline timeline height function h if arguments length return height height h return timeline timeline width function w if arguments length return width width w return timeline timeline display function displayType if arguments length DISPLAY_TYPES indexOf displayType 1 return display display displayType return timeline timeline labelFormat function f if arguments length return labelFunction labelFunction f return timeline timeline tickFormat function format if arguments length return tickFormat tickFormat format return timeline timeline hover function hoverFunc if arguments length return hover hover hoverFunc return timeline timeline mouseover function mouseoverFunc if arguments length return mouseover mouseover mouseoverFunc return timeline timeline mouseout function mouseoutFunc if arguments length return mouseout mouseout mouseoutFunc return timeline timeline click function clickFunc if arguments length return click click clickFunc return timeline timeline scroll function scrollFunc if arguments length return scroll scroll scrollFunc return timeline timeline colors function colorFormat if arguments length return colorCycle colorCycle colorFormat return timeline timeline beginning function b if arguments length return beginning beginning b return timeline timeline ending function e if arguments length return ending ending e return timeline timeline labelMargin function m if arguments length return labelMargin labelMargin m return timeline timeline rotateTicks function degrees if arguments length return rotateTicks rotateTicks degrees return timeline timeline stack function stacked stacked return timeline timeline relativeTime function timeIsRelative timeIsRelative return timeline timeline showBorderLine function showBorderLine showBorderLine return timeline timeline showBorderFormat function borderFormat if arguments length return showBorderFormat showBorderFormat borderFormat return timeline timeline showToday function showTodayLine showTodayLine return timeline timeline showTodayFormat function todayFormat if arguments length return showTodayFormat showTodayFormat todayFormat return timeline timeline colorProperty function colorProp if arguments length return colorPropertyName colorPropertyName colorProp return timeline timeline rowSeparators function color if arguments length return rowSeparatorsColor rowSeparatorsColor color return timeline timeline background function color if arguments length return backgroundColor backgroundColor color return timeline timeline showTimeAxis function showTimeAxis showTimeAxis return timeline timeline showAxisTop function showAxisTop showAxisTop return timeline timeline showAxisCalendarYear function showAxisCalendarYear showAxisCalendarYear return timeline timeline showTimeAxisTick function timeAxisTick timeAxisTick return timeline timeline fullLengthBackgrounds function fullLengthBackgrounds fullLengthBackgrounds return timeline timeline showTimeAxisTickFormat function format if arguments length return timeAxisTickFormat timeAxisTickFormat format return timeline timeline showAxisHeaderBackground function bgColor showAxisHeaderBackground showAxisHeaderBackground if bgColor axisBgColor bgColor return timeline timeline navigate function navigateBackwards navigateForwards if arguments length return navigateLeft navigateRight navigateLeft navigateBackwards navigateRight navigateForwards showAxisNav showAxisNav return timeline return timeline console log var testData times starting_time 1355752800000 ending_time 1355759900000 starting_time 1355767900000 ending_time 1355774400000 times starting_time 1355759910000 ending_time 1355761900000 times starting_time 1355761910000 ending_time 1355763910000 var rectAndCircleTestData times starting_time 1355752800000 display circle starting_time 1355767900000 ending_time 1355774400000 times starting_time 1355759910000 display circle times starting_time 1355761910000 ending_time 1355763910000 var labelTestData label person a times starting_time 1355752800000 ending_time 1355759900000 starting_time 1355767900000 ending_time 1355774400000 label person b times starting_time 1355759910000 ending_time 1355761900000 label person c times starting_time 1355761910000 ending_time 1355763910000 var iconTestData class jackie icon https notebook xbdev net var images jackie png times starting_time 1355752800000 ending_time 1355759900000 starting_time 1355767900000 ending_time 1355774400000 class troll icon https notebook xbdev net var images troll png times starting_time 1355759910000 ending_time 1355761900000 display circle class wat icon https notebook xbdev net var images wat png times starting_time 1355761910000 ending_time 1355763910000 var labelColorTestData label person a times color green label Weeee starting_time 1355752800000 ending_time 1355759900000 color blue label Weeee starting_time 1355767900000 ending_time 1355774400000 label person b times color pink label Weeee starting_time 1355759910000 ending_time 1355761900000 label person c times color yellow label Weeee starting_time 1355761910000 ending_time 1355763910000 var testDataWithColor label fruit 1 fruit orange times starting_time 1355759910000 ending_time 1355761900000 label fruit 2 fruit apple times starting_time 1355752800000 ending_time 1355759900000 starting_time 1355767900000 ending_time 1355774400000 label fruit3 fruit lemon times starting_time 1355761910000 ending_time 1355763910000 var testDataWithColorPerTime label fruit 2 fruit apple times fruit orange starting_time 1355752800000 ending_time 1355759900000 starting_time 1355767900000 ending_time 1355774400000 fruit lemon starting_time 1355774400000 ending_time 1355775500000 var testDataRelative times starting_time 1355752800000 ending_time 1355759900000 starting_time 1355767900000 ending_time 1355774400000 times starting_time 1355759910000 ending_time 1355761900000 times starting_time 1355761910000 ending_time 1355763910000 var width 500 function timelineRect var chart d3 timeline var svg d3 select timeline1 append svg attr width width datum testData call chart function timelineRectNoAxis var chart d3 timeline showTimeAxis var svg d3 select timeline1_noaxis append svg attr width width datum testData call chart function timelineCircle var chart d3 timeline tickFormat format d3 time format I p tickTime d3 time hours tickInterval 1 tickSize 30 display circle toggle between rectangles and circles var svg d3 select timeline2 append svg attr width width datum testData call chart function timelineRectAndCircle var chart d3 timeline var svg d3 select timeline2_combine append svg attr width width datum rectAndCircleTestData call chart function timelineHover var chart d3 timeline width width 4 stack margin left 70 right 30 top 0 bottom 0 hover function d i datum d is the current rendering object i is the index during d3 rendering datum is the id object var div hoverRes var colors chart colors div find coloredDiv css background color colors i div find name text datum label click function d i datum alert datum label scroll function x scale scrolled_date text scale invert x to scale invert x width var svg d3 select timeline3 append svg attr width width datum labelTestData call chart function timelineStackedIcons var chart d3 timeline beginning 1355752800000 we can optionally add beginning and ending times to speed up rendering a little ending 1355774400000 showTimeAxisTick toggles tick marks stack toggles graph stacking margin left 70 right 30 top 0 bottom 0 var svg d3 select timeline5 append svg attr width width datum iconTestData call chart function timelineLabelColor var chart d3 timeline beginning 1355752800000 we can optionally add beginning and ending times to speed up rendering a little ending 1355774400000 stack toggles graph stacking margin left 70 right 30 top 0 bottom 0 var svg d3 select timeline6 append svg attr width width datum labelColorTestData call chart function timelineRotatedTicks var chart d3 timeline rotateTicks 45 var svg d3 select timeline7 append svg attr width width datum testData call chart function timelineRectColors var colorScale d3 scale ordinal range 6b0000 ef9b0f ffee00 domain apple orange lemon var chart d3 timeline colors colorScale colorProperty fruit var svg d3 select timelineColors append svg attr width width datum testDataWithColor call chart function timelineRectColorsPerTime var colorScale d3 scale ordinal range 6b0000 ef9b0f ffee00 domain apple orange lemon var chart d3 timeline colors colorScale colorProperty fruit var svg d3 select timelineColorsPerTime append svg attr width width datum testDataWithColorPerTime call chart function timelineRelativeTime This solution is for relative time is from http stackoverflow com questions 11286872 how do i make a custom axis formatter for hours minutes in d3 js var chart d3 timeline relativeTime tickFormat format function d return d3 time format H M d tickTime d3 time minutes tickInterval 30 tickSize 15 var svg d3 select timelineRelativeTime append svg attr width width datum testDataRelative call chart console log testDataRelative function timelineAxisTop var chart d3 timeline showAxisTop stack var svg d3 select timelineAxisTop append svg attr width width datum testData call chart function timelineBgndTick var chart d3 timeline stack showTimeAxisTick background grey var svg d3 select timelineBgndTick append svg attr width width datum testData call chart function timelineBgnd var chart d3 timeline stack background grey var svg d3 select timelineBgnd append svg attr width width datum testData call chart function timelineComplex var chart d3 timeline chart stack chart showTimeAxisTick chart showAxisTop chart showToday chart itemHeight 50 chart margin left 250 right 0 top 20 bottom 0 chart itemMargin 0 chart labelMargin 25 var backgroundColor FCFCFD var altBackgroundColor red chart background function datum i var odd i 2 0 return odd altBackgroundColor backgroundColor chart fullLengthBackgrounds var svg d3 select timelineComplex append svg attr width width datum labelTestData call chart timelineRect timelineRectNoAxis timelineCircle timelineRectAndCircle timelineHover timelineStackedIcons timelineLabelColor timelineRotatedTicks timelineRectColors timelineRectColorsPerTime timelineRelativeTime timelineAxisTop timelineBgndTick timelineBgnd timelineComplex script

if itemHeight set height based off of item height height gSize height gSize top gParentSize top set bounding rectangle height d3 select gParent 0 0 attr height height else throw height of the timeline is not set else if height height gParentItem attr height else gParentItem attr height height function setWidth if width gParentSize width try width gParentItem attr width if width throw width of the timeline is not set As of Firefox 27 timeline with x needs to be explicitly set in order to render catch err console log err else if width gParentSize width try width gParentItem attr width catch err console log err if both are set do nothing function appendLine lineScale lineFormat gParent append svg line attr x1 lineScale attr y1 lineFormat marginTop attr x2 lineScale attr y2 height lineFormat marginBottom style stroke lineFormat color rgb 6 120 155 style stroke width lineFormat width SETTINGS timeline margin function p if arguments length return margin margin p return timeline timeline orient function orientation if arguments length return orient orient orientation return timeline timeline itemHeight function h if arguments length return itemHeight itemHeight h return timeline timeline itemMargin function h if arguments length return itemMargin itemMargin h return timeline timeline navMargin function h if arguments length return navMargin navMargin h return timeline timeline height function h if arguments length return height height h return timeline timeline width function w if arguments length return width width w return timeline timeline display function displayType if arguments length DISPLAY_TYPES indexOf displayType 1 return display display displayType return timeline timeline labelFormat function f if arguments length return labelFunction labelFunction f return timeline timeline tickFormat function format if arguments length return tickFormat tickFormat format return timeline timeline hover function hoverFunc if arguments length return hover hover hoverFunc return timeline timeline mouseover function mouseoverFunc if arguments length return mouseover mouseover mouseoverFunc return timeline timeline mouseout function mouseoutFunc if arguments length return mouseout mouseout mouseoutFunc return timeline timeline click function clickFunc if arguments length return click click clickFunc return timeline timeline scroll function scrollFunc if arguments length return scroll scroll scrollFunc return timeline timeline colors function colorFormat if arguments length return colorCycle colorCycle colorFormat return timeline timeline beginning function b if arguments length return beginning beginning b return timeline timeline ending function e if arguments length return ending ending e return timeline timeline labelMargin function m if arguments length return labelMargin labelMargin m return timeline timeline rotateTicks function degrees if arguments length return rotateTicks rotateTicks degrees return timeline timeline stack function stacked stacked return timeline timeline relativeTime function timeIsRelative timeIsRelative return timeline timeline showBorderLine function showBorderLine showBorderLine return timeline timeline showBorderFormat function borderFormat if arguments length return showBorderFormat showBorderFormat borderFormat return timeline timeline showToday function showTodayLine showTodayLine return timeline timeline showTodayFormat function todayFormat if arguments length return showTodayFormat showTodayFormat todayFormat return timeline timeline colorProperty function colorProp if arguments length return colorPropertyName colorPropertyName colorProp return timeline timeline rowSeparators function color if arguments length return rowSeparatorsColor rowSeparatorsColor color return timeline timeline background function color if arguments length return backgroundColor backgroundColor color return timeline timeline showTimeAxis function showTimeAxis showTimeAxis return timeline timeline showAxisTop function showAxisTop showAxisTop return timeline timeline showAxisCalendarYear function showAxisCalendarYear showAxisCalendarYear return timeline timeline showTimeAxisTick function timeAxisTick timeAxisTick return timeline timeline fullLengthBackgrounds function fullLengthBackgrounds fullLengthBackgrounds return timeline timeline showTimeAxisTickFormat function format if arguments length return timeAxisTickFormat timeAxisTickFormat format return timeline timeline showAxisHeaderBackground function bgColor showAxisHeaderBackground showAxisHeaderBackground if bgColor axisBgColor bgColor return timeline timeline navigate function navigateBackwards navigateForwards if arguments length return navigateLeft navigateRight navigateLeft navigateBackwards navigateRight navigateForwards showAxisNav showAxisNav return timeline return timeline console log var testData times starting_time 1355752800000 ending_time 1355759900000 starting_time 1355767900000 ending_time 1355774400000 times starting_time 1355759910000 ending_time 1355761900000 times starting_time 1355761910000 ending_time 1355763910000 var rectAndCircleTestData times starting_time 1355752800000 display circle starting_time 1355767900000 ending_time 1355774400000 times starting_time 1355759910000 display circle times starting_time 1355761910000 ending_time 1355763910000 var labelTestData label person a times starting_time 1355752800000 ending_time 1355759900000 starting_time 1355767900000 ending_time 1355774400000 label person b times starting_time 1355759910000 ending_time 1355761900000 label person c times starting_time 1355761910000 ending_time 1355763910000 var iconTestData class jackie icon https notebook xbdev net var images jackie png times starting_time 1355752800000 ending_time 1355759900000 starting_time 1355767900000 ending_time 1355774400000 class troll icon https notebook xbdev net var images troll png times starting_time 1355759910000 ending_time 1355761900000 display circle class wat icon https notebook xbdev net var images wat png times starting_time 1355761910000 ending_time 1355763910000 var labelColorTestData label person a times color green label Weeee starting_time 1355752800000 ending_time 1355759900000 color blue label Weeee starting_time 1355767900000 ending_time 1355774400000 label person b times color pink label Weeee starting_time 1355759910000 ending_time 1355761900000 label person c times color yellow label Weeee starting_time 1355761910000 ending_time 1355763910000 var testDataWithColor label fruit 1 fruit orange times starting_time 1355759910000 ending_time 1355761900000 label fruit 2 fruit apple times starting_time 1355752800000 ending_time 1355759900000 starting_time 1355767900000 ending_time 1355774400000 label fruit3 fruit lemon times starting_time 1355761910000 ending_time 1355763910000 var testDataWithColorPerTime label fruit 2 fruit apple times fruit orange starting_time 1355752800000 ending_time 1355759900000 starting_time 1355767900000 ending_time 1355774400000 fruit lemon starting_time 1355774400000 ending_time 1355775500000 var testDataRelative times starting_time 1355752800000 ending_time 1355759900000 starting_time 1355767900000 ending_time 1355774400000 times starting_time 1355759910000 ending_time 1355761900000 times starting_time 1355761910000 ending_time 1355763910000 var width 500 function timelineRect var chart d3 timeline var svg d3 select timeline1 append svg attr width width datum testData call chart function timelineRectNoAxis var chart d3 timeline showTimeAxis var svg d3 select timeline1_noaxis append svg attr width width datum testData call chart function timelineCircle var chart d3 timeline tickFormat format d3 time format I p tickTime d3 time hours tickInterval 1 tickSize 30 display circle toggle between rectangles and circles var svg d3 select timeline2 append svg attr width width datum testData call chart function timelineRectAndCircle var chart d3 timeline var svg d3 select timeline2_combine append svg attr width width datum rectAndCircleTestData call chart function timelineHover var chart d3 timeline width width 4 stack margin left 70 right 30 top 0 bottom 0 hover function d i datum d is the current rendering object i is the index during d3 rendering datum is the id object var div hoverRes var colors chart colors div find coloredDiv css background color colors i div find name text datum label click function d i datum alert datum label scroll function x scale scrolled_date text scale invert x to scale invert x width var svg d3 select timeline3 append svg attr width width datum labelTestData call chart function timelineStackedIcons var chart d3 timeline beginning 1355752800000 we can optionally add beginning and ending times to speed up rendering a little ending 1355774400000 showTimeAxisTick toggles tick marks stack toggles graph stacking margin left 70 right 30 top 0 bottom 0 var svg d3 select timeline5 append svg attr width width datum iconTestData call chart function timelineLabelColor var chart d3 timeline beginning 1355752800000 we can optionally add beginning and ending times to speed up rendering a little ending 1355774400000 stack toggles graph stacking margin left 70 right 30 top 0 bottom 0 var svg d3 select timeline6 append svg attr width width datum labelColorTestData call chart function timelineRotatedTicks var chart d3 timeline rotateTicks 45 var svg d3 select timeline7 append svg attr width width datum testData call chart function timelineRectColors var colorScale d3 scale ordinal range 6b0000 ef9b0f ffee00 domain apple orange lemon var chart d3 timeline colors colorScale colorProperty fruit var svg d3 select timelineColors append svg attr width width datum testDataWithColor call chart function timelineRectColorsPerTime var colorScale d3 scale ordinal range 6b0000 ef9b0f ffee00 domain apple orange lemon var chart d3 timeline colors colorScale colorProperty fruit var svg d3 select timelineColorsPerTime append svg attr width width datum testDataWithColorPerTime call chart function timelineRelativeTime This solution is for relative time is from http stackoverflow com questions 11286872 how do i make a custom axis formatter for hours minutes in d3 js var chart d3 timeline relativeTime tickFormat format function d return d3 time format H M d tickTime d3 time minutes tickInterval 30 tickSize 15 var svg d3 select timelineRelativeTime append svg attr width width datum testDataRelative call chart console log testDataRelative function timelineAxisTop var chart d3 timeline showAxisTop stack var svg d3 select timelineAxisTop append svg attr width width datum testData call chart function timelineBgndTick var chart d3 timeline stack showTimeAxisTick background grey var svg d3 select timelineBgndTick append svg attr width width datum testData call chart function timelineBgnd var chart d3 timeline stack background grey var svg d3 select timelineBgnd append svg attr width width datum testData call chart function timelineComplex var chart d3 timeline chart stack chart showTimeAxisTick chart showAxisTop chart showToday chart itemHeight 50 chart margin left 250 right 0 top 20 bottom 0 chart itemMargin 0 chart labelMargin 25 var backgroundColor FCFCFD var altBackgroundColor red chart background function datum i var odd i 2 0 return odd altBackgroundColor backgroundColor chart fullLengthBackgrounds var svg d3 select timelineComplex append svg attr width width datum labelTestData call chart timelineRect timelineRectNoAxis timelineCircle timelineRectAndCircle timelineHover timelineStackedIcons timelineLabelColor timelineRotatedTicks timelineRectColors timelineRectColorsPerTime timelineRelativeTime timelineAxisTop timelineBgndTick timelineBgnd timelineComplex script

2dracecargame
3dplot
a4print
about
acejs
acejs2
acejs3
aessecurity
angularjs
animbackgroundimage
aseformat
assert
asteroidsjs
backgrounds01
backgrounds02
backgrounds03
barnsleyfern
base26
base64
bib
binary
bodypix
bouncy
box2dweb
breakoutjs
browserversion
buslanes
busybutton
bvhreader
calendar
candycrush
candycrush2
canvas
canvas2
canvas3
canvasmandelbrot
canvasmandelbrot2
canvasnumbers
canvaszoom
capsule
changingimages
chaosgame
chaosrandom
chaosrandomhisto
chaosrandomhisto2
chatgptusingopenai
chatgptusingopenai2
chatgptusingopenai3
checkboxtoggle
chinesetiles
classes
classfeatures
clipboardbutton
clonenode
codedropdown
codemirror
codemirror2
collada
colorpick
columnresizer
contextmenu
convnet
cookiebanner
countdown
countdown2
countdown3
crop
css3dbarchart
css3dbarchart2
css3dbook
css3dscene
csscube
csscube2
csscube3
csscubevideos
cssfilelist
csshas
csspulse
cssresizeaspect
cssspin
csszooming
csvtoarray
curleffect
customcheckbox
d3datamap
d3js
d3js10
d3js11
d3js2
d3js3
d3js4
d3js5
d3js6
d3js7
d3js8
d3js9
d3jsanimatedgrid
d3jsarctransition
d3jsarctransition2
d3jsaxis
d3jsaxischanging
d3jsbars
d3jsbrushing
d3jsbuslanes
d3jsbuslanes2
d3jscalendar
d3jscheat
d3jsclock
d3jscloudmap
d3jscogs
d3jscolors
d3jscovid
d3jscovid2
d3jscovid3
d3jsdashboard
d3jsdashboard2
d3jsdashboard3
d3jsdatakeyfunction
d3jsdensity
d3jsdragresizing
d3jsdragresizing2
d3jseach
d3jsease
d3jsevents
d3jsflower
d3jsforcegroups
d3jsforces
d3jsforces2
d3jsfractaltree
d3jsgeo
d3jsgroupbars
d3jsgroups
d3jsheatmap
d3jshex
d3jshierarchies
d3jshierarchies2
d3jshistogram
d3jshistogram2
d3jshistogram3
d3jshistogram4
d3jsinterpolate
d3jsjoin
d3jskmean
d3jskmean2
d3jsline
d3jsline2
d3jsline3
d3jsline4
d3jslinetransition
d3jslinetransition0
d3jslinetransition2
d3jsmaplocations
d3jsmaps
d3jsmaps2
d3jsmaps3
d3jsmisc
d3jsmisc2
d3jsmodule
d3jsmodulecolor
d3jsmultistyles
d3jsnobel
d3jsoverlappinggraphs
d3jspanel
d3jspie
d3jspieinterpolate
d3jssankey
d3jssankey2
d3jsscatter
d3jsshapes
d3jsslider
d3jsspending
d3jsspending2
d3jsspiralplot
d3jsspirograph
d3jssquare
d3jsstack
d3jsstackedbar
d3jsstackedbar2
d3jssunburst
d3jssunmoon
d3jssvglines
d3jssymbols
d3jstimelines
d3jsuk
d3jsvoronoi
d3scatterplot
d3timeline
d3timeline2
datalist
datamuse
date
dblclickhighlight
deviceorientation
dictionaryapi
dockermenu
doodlepad
downloadgif
dragdroplistitems
dragrotateresizediv
dragrotateresizediv2
dragrotateresizediv3
dragrotateresizediv4
dragrotateresizefontsize
dragselectbrush
drawlinesdiv
dropdown
dualquaternionimages
dynamicgrid
easefunctions
easeinterpolate3dplots
echart
echart2
echart3
encapsulation
epubviewer
errorstack
excalidraw
excalidraw2
excalidraw3
excalidraw5
expandable
faker
fetchplus
fileupload
fixedtopbar
fluiddynamics
fluiddynamics2
fluiddynamics3
fluidsmokedynamics
fluidsmokedynamics2
fonts
fonts2
footerbar
fractalmaze
fractalmaze2
fractalnoiseimage
fractals
fractals2
fractaltree
freesvg
fresnel
froggerjs
gantt
gifgiphyapi
gifhex
gltffromscratch
gradients
griditems
griditems2
griditems3
griditems4
gridworms
heat
hexview
hexview2
highlight
icons
icons2
iframes
ik
imagetracertosvg
imgur
inputfile
invadersjs
ipynb
ipynb2
ipynb3
ipynb4
isbn13
isbn2
jpghex
jquery
jquery2
jqueryui
jqueryui2
jsdraganddrop
jsfire
jslint
jsobfuscate
jsraytracer
jstree
jstree2
jszip
jszipimages
jszipread
keyframes
l2dwidget
lda
leftmenu
less
less2
lineargradientimage
linenumbers
loadimagefromfile
makepdf
maps
markdown
markdown2
markdownalerts
markdownalerts2
markdownbookmarks
markovimage
markovpixelblocks
mathjax
matrices
matsandvects
mazegamejs
md2tex
metrotiles
metrowindows
milestones
minkowski2dboxes
misc
misc2
modules
myipdetails
mymodplotly
neataptic
networkstructures
networkstructures2
neural_network_drawshape
neural_network_plot_in_vs_out
neuralnetworkarrays
neuralnetworkblocks
neuralnetworksinewave
neuralnetworksnolibs
neuralnetworkvisualization
number
obj
objtojson
openaiimages
opencv
opencv2
opencv3
opencv4
opencv5
outline
p2
p5fractalleaf
p5fractalshape
p5js
p5js2
p5js3
p5jsanimatedcover
p5mengercube
p5snowflakes
palindrome
panel
parallax
paste
paste2
pasteimgfromurl
pdfjs
pdfjs2
pdfkit
pdfkit2
pdfkit3
pdfkit4
pdfkit5
pdfkit6
pdfmake
pdfmake2
pdfmake3
pdfmake4
pdfmake5
pdfmake6
perlin
perlin2
perlin3
perspective
pexels
pixelgridpattern
playground
plotly
plotlynoise
plotlyranddist
plyloader
plyloader2
pngtxtencoder
pongjs
pptxgenjs
prettycode
prism
prn
problems
progress
pseudorandom
px2svg
python
quotes
racergame
random
randomcalcpie
randomgenerator
randomprofilepatterns
randomsinhistogram
randomstring
rating
rayambient
raymonte
raymonteprogressive
raymonteprogressive2
raymontewarmstart
reexpcross
reexpcross2
regex
regexbib
regexpfixbib
regexpmultiline
repeatwordsregexp
resizabletable
resizabletable2
revealjs
revealjs2
revealjsmulti
ritalanguage
ritalanguage2
ritalanguage3
rotateimg
rough
rsapublicprivatekeys
rss
rss2
sankey
scrappingsvg
scrolltext
scrolltext2
scrollwidth
sdf2dcanvas
sdfboxinboxtwist
sdfchessbishop
sdfchessking
sdfchessknight
sdfchesspawn
sdfchessqueen
sdfchessrook
sdfhollowbox
setintervalexception
shareurl
shuffle
sidecomment
similarity
simplehighlighter
simpleplatformgamejs
sinecanvas
sliderpopout
slides
smileys
snowfall
snowman
sound
soundsignal
sphererayintersection
springs
sqljs
steganography
stereogram
stringmatching
sudoku
sudoku2
sudoku3
svg
svgchaos
svgdragresize
svgdragresize2
svgdragresize3
svgdragrotate
svgdrawing
svglines
svglines2
svglines3
svglines4
svglines5
svglinesmandelbrot
svgpathsdragrotate
svgpathsdragrotateresize
svgpie
svgpie2
svgpie3
svgpiepath
svgpiepath2
svgrandomfaces
symbols
synaptic
synaptic2
synonyms
tablerotatecells
tablerotatecells2
tablerotatecells3
tablerotatecells3b
tablerotatecells4
tables
tablezebra
tabularjs
tabularjs2
tabulatordownload
tagcanvas
tensorflowgan
tensorflowjs
tensorflowjsbasic
tensorflowjscnn
tensorflowjssinewave
tensorflowjssound
tensorflowmobilenet
tetrahedronfractal
tetrahedronfractalfolding
tetris
textarea
textareaauto
textareadiv
textareadiv2
textmaskimage
theirorthere
thesaurus
threejs
threejs2
threejs3
threejs4
threejsgltf
threejstokyo
tiles
toaster
tooltip
transition
transitionexpandabledropdown
treeview
treeview2
tricks
tshirt
tshirt2
tshirt3
turningpages
unsplash
urlblob
urlblob2
userdefinepoints
vector
videos
videos2
visualsort
vue
w2ui
w2uientertextdialog
webcam
webgl
webgl2
webgl3
webgl4
webgl5
webglbasic1
webglbasic2
webglcube
webglfov
webglfrustum
webgljson
webglleaves
webgllighting
webglorthographic
webglpoints1
webglpoints2
webglpoints3
webglsquare
webgltexture1
webgltexture2
webgltexture3
webgltransforms
webgltriangle
webgpu
webgpu10
webgpu11
webgpu12
webgpu13
webgpu14
webgpu15
webgpu16
webgpu17
webgpu2
webgpu3
webgpu4
webgpu5
webgpu6
webgpu7
webgpu8
webgpu9
webgpubars
webgpubuffers
webgpubuffers2
webgpucellnoise
webgpuclouds
webgpuclydescope
webgpucompute
webgpucubemap
webgpucubemap2
webgpudeferred
webgpudepth
webgpudof
webgpudrops
webgpuetha
webgpufire
webgpufractalcubes
webgpuglassrain
webgpugltf
webgpugltf2
webgpugrass
webgpugrid
webgpukernel
webgpukleinian
webgpulabupdates
webgpulighting
webgpumandelbrot
webgpumeta3d
webgpumetaballs
webgpumouse
webgpunoise
webgpunormalmapping
webgpuobj
webgpuparallax
webgpuparallax2
webgpuparallax3
webgpuparallaxshadow
webgpuparallaxshadow2
webgpupixel
webgpuquad
webgpuray1
webgpuraytracing
webgpuraytracing2
webgpushadowmaps
webgpushadowmaps2
webgpusierpinski2d
webgpusierpinski3d
webgpusinusoid
webgpussao
webgpustadiumobj
webgpuswirl
webgputestpipe3
webgputoon
webgputopology
webgputt
webgpuvolcloud
webgpuwater
webgpuwireframe
webgpuwireframe2
webpcanvas
webworkers
webxr
webxr2
wiggly
wikipedia