Home

Awesome

NOTE: This package has been consolidated into the vega/vega repository, where future development and issues will be handled. This repository has been archived and is now read-only.

vega-projection

Projections for cartographic mapping.

This module provides a projection method for managing registered cartographic projections. By default, the projection registry includes all projection types provided by the d3-geo module.

API Reference

<a name="projection" href="#projection">#</a> vega.<b>projection</b>(<i>type</i>[, <i>projection</i>]) <>

Registry function for adding and accessing projection constructor functions. The type argument is a String indicating the name of the projection type. If the projection argument is not specified, this method returns the matching projection constructor in the registry, or null if not found. If the projection argument is provided, it must be a projection constructor function to add to the registry under the given type name.

By default, the projection registry includes entries for all projection types provided by the d3-geo module. Projections created using the constructor returned by this method are augmented with the following additional properties:

// mercator projection
var mercator = vega.projection('mercator');
var proj = mercator().translate([400, 200]);
scale.type; // 'mercator'
scale([0, 0]); // [400, 200] center point