diff --git a/README.md b/README.md index 4d4197f..a821ada 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Creates a new heatmap generator with the default configuration values and the sp Render the heatmap to the given *context*, which may be either a [selection](https://github.com/d3/d3-selection) of containers (either HTML, SVG or G elements) or a corresponding [transition](https://github.com/d3/d3-transition). Reads the data for the heatmap from the datum property on the container. This data should be in the following format: -```json +``` [ { height: 0.99, // height of the cell @@ -90,7 +90,7 @@ Render the heatmap to the given *context*, which may be either a [selection](htt ] ``` -D3 soccer provides two layouts to convert data to this format: # grid() and # rectbin(). +D3 soccer provides two layouts to convert data to this format: d3.grid() and d3.rectbin() . @@ -197,3 +197,41 @@ If _f_ is specified, dragging an action's marker will trigger execution of _f(da # scoreline.score([score]) # scoreline.clock([clock]) + +
+ +# d3.grid() + +Constructs a new default grid layout, which can be used to generate data for the heatmap. + +# grid(values) + +Evaluates the grid layout on the specified 2d array of *values*, returning a 1d array corresponding to the data format required by the heatmap. + +
+ +# d3.rectbin() + +Constructs a new default rectbin layout, which can be used to generate data for the heatmap. + +# rectbin(points) + +Evaluates the rectbin layout on the specified array of *points*, returning an array of rectangular *bins*. Each bin is an array containing the bin’s points, as well as some additional properties which are required by the heatmap. + +Bins that are empty are not omitted. The origin bin at ⟨0,0⟩ is in the top-left. + +# rectbin.x([accessor]) + +If *accessor* is specified, sets the *x*-accessor function and returns the rectbin layout; if *accessor* is not specified, returns the current *x*-accessor function, which defaults to `function(d) { return d[0]; }`. + +# rectbin.y([accessor]) + +If *accessor* is specified, sets the *y*-accessor function and returns the rectbin layout; if *accessor* is not specified, returns the current *y*-accessor function, which defaults to `function(d) { return d[1]; }`. + +# rectbin.dx([dx]) + +If *dx* is specified, sets the horizontal bin size to the specified value. If *dx* is not specified, returns the current value, which defaults to 0.1. + +# rectbin.dy([dy]) + +If *dy* is specified, sets the vertical bin size to the specified value. If *dy* is not specified, returns the current value, which defaults to 0.1.