D3 3.0 implementation of timeseries plugin that supports easy customization of bitmap / horizongraph / linechart or multiresolution layout self adaptive to display height.
The plugin is implemented as a closure that support method chaining.
Dependency: D3-timeseries requires D3 3.x version and jquery as dependency Installing: All the content of d3-timeseries plugin is in the folder libs/d3_timeseries. To use bitmap or horizon or linechart, you can just download the corresponding single file (and corresponding css, if it has) in the folder. Two different versions of linechart are provided that share the same css file.
Step1. Binding: use jquery to select a div, and bind a d3_linechart object to it with $("#"+divID).d3_linechart()
Step2. Style specification: customize it with method chaining, such as $("#"+divID).d3_linechart().height(200).data(data)
Step3. Render: Evoke (
var linechart = [{
label: "Data Set 1",
data: [
{x:0,y:0},
{x:1,y:1,color:"red"},
{x:2,y:2,color:"red"},
{x:3,y:-3},
{x:4,y:4,color:"red"},
{x:5,y:17},
{x:6,y:3},
{x:7,y:3}
]
}]
var renderer = $("#"+divID).d3_linechart()
.data([linechart])
.x_scale_type("linear")
.draw_xgrid(true)
.draw_ygrid(true)
.margin({top: 20, right: 80, bottom:20, left: 40})
.render()
renderer()
The Horizon Graph layout is credit to the layout in https://bl.ocks.org/mbostock/1483226