Skip to content

Commit

Permalink
doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
gka committed Nov 27, 2011
1 parent 6041adb commit 1e00277
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions doc/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
### loadMap(svgurl, callback)
Loads a SVG map file created with svgmap.py.

* _svgurl_ - SVG map url, must be on same server
* _callback_ - will be called after the svg is loaded
* **svgurl** - SVG map url, must be on same server
* **callback** - will be called after the svg is loaded

Example:

Expand All @@ -19,9 +19,9 @@ Example:
### addLayer(src, layerId, pathId)
SVG maps may contain several layers, but sometimes you don't need to display them all. In some cases it even makes sense to add the same layer more than once.

* _src_ - this is how the map layer is named in the SVG file, for instance: <g id="countries">...</g>
* _layerId_ - this is how you want the layer to be named in the map application. every path in this layer will get this as a CSS class name
* _pathId_ - if you want to add interactivity to the paths of this layer, you need to specify how to identify them. For instance, if your paths store attributes <path data-iso3="USA".. />, you want pathId to be "iso3".
* **src** - this is how the map layer is named in the SVG file, for instance: <g id="countries">...</g>
* **layerId** - this is how you want the layer to be named in the map application. every path in this layer will get this as a CSS class name
* **pathId** - if you want to add interactivity to the paths of this layer, you need to specify how to identify them. For instance, if your paths store attributes <path data-iso3="USA".. />, you want pathId to be "iso3".

Examples:

Expand All @@ -30,9 +30,9 @@ Examples:
map.addLayer('countries','countries','iso3')

### addLayerEvent(event, callback, layerId)
* _event_ - any valid jQuery event type, like "click" or "mouseover"
* _callback_ - the function that will be called when the event occurs
* _layerId_, the id of the layer the events shall be added to. defaults to the last added layer
* **event** - any valid jQuery event type, like "click" or "mouseover"
* **callback** - the function that will be called when the event occurs
* **layerId**, the id of the layer the events shall be added to. defaults to the last added layer

var onCountryClick = function(event) {
var path = event.target;
Expand All @@ -41,9 +41,9 @@ Examples:
map.addLayerEvent('click', onCountryClick, 'countries');

### choroplet(opts)
* _opts_ - a dictionary of options, which are:
* _layer_ - the id of the layer the choropleth shall be applied to. defaults to the last added layer
* _data_ - the data dictionary, with path ids as keys and numbers or dictionaries of numbers as values. In the latter case, you need to provide a key, see next parameter.
* **opts** - a dictionary of options, which are:
* **layer** - the id of the layer the choropleth shall be applied to. defaults to the last added layer
* **data** - the data dictionary, with path ids as keys and numbers or dictionaries of numbers as values. In the latter case, you need to provide a key, see next parameter.
map.choroplet({
data: {
Expand All @@ -52,7 +52,7 @@ Examples:
}
});

* _key_ - if the data dictionaries contains dictionaries of numbers, you need to specify the key.
* **key** - if the data dictionaries contains dictionaries of numbers, you need to specify the key.
map.choroplet({
data: {
Expand All @@ -62,19 +62,19 @@ Examples:
key: 'GDP'
});

* _colorscale_ - the colorscale, defaults to svgmap.color.scale.COOL
* **colorscale** - the colorscale, defaults to svgmap.color.scale.COOL

map.choroplet({
colorscale: new svgmap.color.scale.Ramp('#ffffff', '#883333')
});

* _noDataColor_ - the color that should be used for paths that have no entry or NaN in the data dictionary. Defaults to '#cccccc'
* **noDataColor** - the color that should be used for paths that have no entry or NaN in the data dictionary. Defaults to '#cccccc'

### tooltips(opts)
Activate tooltips for a layer. The tooltips will be managed using the [http://craigsworks.com/projects/qtip2/docs/](jQuery.qtip plugin). If you want to add tooltips to your maps, you also need to include the tooltip.css to your HTML page.
* _opts_ - a dictionary of options, which are:
* _layer_ - the id of the layer the choropleth shall be applied to. defaults to the last added layer
* _tooltips_ - either a dictionary with path ids as keys and tooltip HTML code as values or a function that returns the tooltip for a given path. The tooltip itself can be either a string or an array of two strings of which the first will be used as tooltip title and the second as tooltip body.
* **opts** - a dictionary of options, which are:
* **layer** - the id of the layer the choropleth shall be applied to. defaults to the last added layer
* **tooltips** - either a dictionary with path ids as keys and tooltip HTML code as values or a function that returns the tooltip for a given path. The tooltip itself can be either a string or an array of two strings of which the first will be used as tooltip title and the second as tooltip body.

Examples:

Expand Down

0 comments on commit 1e00277

Please sign in to comment.