The tick format provided by d3.time.scale is a multi-scale tick format, meaning that it formats times differently depending on the time. For example, the start of February is formatted as "February", while February second is formatted as "Feb 2". The format is implemented using an array of time formats, each with an associated filter. The first filter that returns true is used. (In the implementation below, the formats are processed in reverse order.) You can create your own custom multi-scale time format using the same technique with only a few lines of code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name EXAMPLE SCRIPT | |
// @version 0.9 | |
// @description This is an example showing Gist capability and how to auto update | |
// @author jbryson3 | |
// @match. https://www.google.com | |
// @grant none | |
// @updateURL https://gist.github.com/greglockwood/c39c9225a4b67f144703196f1959108a/raw/example.user.js | |
// @downloadURL https://gist.github.com/greglockwood/c39c9225a4b67f144703196f1959108a/raw/example.user.js | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> | |
<script> | |
// moment.js | |
// version : 1.6.0 | |
// author : Tim Wood |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Swimlane using d3.js</title> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script> | |
<script type="text/javascript" src="randomData.js"></script> | |
<style> | |
.chart { | |
shape-rendering: crispEdges; | |
} |