d3#GeoProjection TypeScript Examples

The following examples show how to use d3#GeoProjection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MapChart.ts    From anichart.js with MIT License 6 votes vote down vote up
setup(stage: Stage) {
    super.setup(stage);
    if (stage) {
      const map = recourse.data.get("map");
      let projection: GeoProjection;
      switch (this.projectionType) {
        case "orthographic":
          projection = geoOrthographic();
          break;
        case "natural":
          projection = geoNaturalEarth1();
          break;
        case "mercator":
          projection = geoMercator();
          break;
        case "equirectangular":
          projection = geoEquirectangular();
        default:
          projection = geoNaturalEarth1();
      }
      projection.fitExtent(
        [
          [this.margin.left, this.margin.top],
          [
            stage.canvas.width - this.margin.right,
            stage.canvas.height - this.margin.bottom,
          ],
        ],
        map
      );

      this.projection = projection;
      this.map = map;
      this.init(projection, map);
    }
  }
Example #2
Source File: MapChart.ts    From anichart.js with MIT License 5 votes vote down vote up
private init(projection: GeoProjection, map: any) {
    this.initGeoPath(projection, map);
    this.initComps();
  }
Example #3
Source File: MapChart.ts    From anichart.js with MIT License 5 votes vote down vote up
private initGeoPath(projection: GeoProjection, map: any) {
    const geoGener = geoPath(projection);
    this.geoGener = geoGener;
    this.pathMap = new Map<string, string>();
    this.initPathMap(map, geoGener);
  }
Example #4
Source File: MapChart.ts    From anichart.js with MIT License 5 votes vote down vote up
projection: GeoProjection;
Example #5
Source File: MapChart.d.ts    From anichart.js with MIT License 5 votes vote down vote up
projection: GeoProjection;