Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a description of dot-grid maps to kartograph.js docs. #54

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion docs/kartograph.js/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,35 @@ To learn more about symbol maps, please check out the [symbol map documentation]

## Dot-Grids

???
Kartograph.js provides ``dotgrid`` as an easy API for creating [dot grid maps](/showcase/dotgrid/). You at least need to pass a dictionary with the following properties:

* ``data`` — an array of data objects of which each will be represented by a dot-grid
* ``gridsize`` — a number representing density of a dot-grid
* ``size`` — a function which determines the dot size depending on data
* ``style`` — a dictionary specifying the dot style

For example:

map.dotgrid({
data: dep_data,
gridsize: 11,
size: dotsize,
style: function(d) {
return {
fill: '#804',
stroke: '#fff',
}
}
});

In the above example, *dotsize* is a scale defined as:

scale = kartograph.scale.[scale_type](dep_data, [density]),
dotsize = function(d) {
return 1+Math.sqrt(scale(d.density))*[max_dot_size];
};

You can employ different scale types as shown in [dot grid maps example](/showcase/dotgrid/).

## SVG Filter

Expand Down