@redsift/d3-rs-schedule

Generates a calendar like schedule using D3v4.

Usage no npm install needed!

<script type="module">
  import redsiftD3RsSchedule from 'https://cdn.skypack.dev/@redsift/d3-rs-schedule';
</script>

README

d3-rs-schedule

Circle CI npm MIT

d3-rs-schedule generate a schedule / calander like presentation via the D3 reusable chart convention.

Example

View @redsift/d3-rs-schedule on Codepen

Empty

Empty

Single Entry

Single Entry

Usage

Browser

<script src="//static.redsift.io/reusable/d3-rs-schedule/latest/d3-rs-schedule.umd-es2015.min.js"></script>
<script>
    var chart = d3_rs_schedule.html();
    d3.select('body').datum([ { s: 1469723575941, e: 1469726870991, t: "Text to display", u: "proposed" } ]).call(chart);
</script>

ES6

import { chart } from "@redsift/d3-rs-schedule";
let eml = chart.html();
...

Require

var chart = require("@redsift/d3-rs-schedule");
var eml = chart.html();
...

Datum

[{ s: 1469723575941, e: 1469726870991, t: "Text to display", u: "proposed" } ...]

s start timestamp for the event (epoch UTC ms) e start timestamp for the event (epoch UTC ms) t text to display u status text for the event. This is used by the default fill function to highlight events. The known values are proposed, conflict and provisional.

Parameters

Property Description Transition Preview
classed String SVG custom class N
width, height, size, scale Integer SVG container sizes Y
style String Custom CSS to inject into chart N
indexFormat String, Function Change the time presentation on the axis. If string, utilises d3-time-format. If a function, must be a comptabile formatter. Default %Hh
language String Change the language, affects time formats. Typically auto detected from the browser.
timezone String Set the timezone for display e.g. Asia/Colombo
prefixDurationFormat String Prefix the event text with start and end time
tickInterval Array Interval of the ticks, typically an interval and a specifier e.g. d3.timeMinute.every(15)
eventWidth Integer Width to use for the event rects

Know isues

Timezones that differ from UTC with 30 or 45 min offsets do not present the correct boundaries.