dc.js Class: geoChoroplethChart (original) (raw)

dc. geoChoroplethChart


new geoChoroplethChart(parent [, chartGroup])

Parameters:
Name Type Argument Description
parent String|node d3.selection
chartGroup String The name of the chart group this chart instance should be placed in. Interaction with a chart will only trigger events and redraws within the chart's group.

Mixes In:

Source:

Returns:

Type

dc.geoChoroplethChart

Example

// create a choropleth chart under '#us-chart' element using the default global chart group var chart1 = dc.geoChoroplethChart('#us-chart'); // create a choropleth chart under '#us-chart2' element using chart group A var chart2 = dc.compositeChart('#us-chart2', 'chartGroupA');

Methods


geoJsons()

Returns all GeoJson layers currently registered with this chart. The returned array is a reference to this chart's internal data structure, so any modification to this array will also modify this chart's internal registration.

Source:

Returns:

Type

Array.<{name:String, data: Object, accessor: function()}>


geoPath()

Returns the d3.geoPath object used to render the projection and features. Can be useful for figuring out the bounding box of the feature set and thus a way to calculate scale and translation for the projection.

Source:

See:

Returns:

Type

d3.geoPath


overlayGeoJson(json, name, keyAccessor)

mandatory

Use this function to insert a new GeoJson map layer. This function can be invoked multiple times if you have multiple GeoJson data layers to render on top of each other. If you overlay multiple layers with the same name the new overlay will override the existing one.

Parameters:
Name Type Description
json geoJson a geojson feed
name String name of the layer
keyAccessor function accessor function used to extract 'key' from the GeoJson data. The key extracted by this function should match the keys returned by the crossfilter groups.

Source:

See:

Returns:

Type

dc.geoChoroplethChart

Example

// insert a layer for rendering US states chart.overlayGeoJson(statesJson.features, 'state', function(d) { return d.properties.name; });


projection( [projection])

Parameters:
Name Type Argument Default Description
projection d3.projection d3.geoAlbersUsa()

Source:

See:

Returns:

Type

d3.projection|dc.geoChoroplethChart


removeGeoJson(name)

Remove a GeoJson layer from this chart by name

Parameters:
Name Type Description
name String

Source:

Returns:

Type

dc.geoChoroplethChart