Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Object: esri/styles/choropleth

require(["esri/styles/choropleth"], function(esriStylesChoropleth) { /* code goes here */ });

Description

(Added at v3.13)
This module contains a collection of themes suitable for unclassed and classed choropleth mapping.

Samples

Search for samples that use this class.

Methods

NameReturn typeSummary
getAvailableThemes(basemap?)Object[]Returns available themes.
getSchemes(params)ObjectReturns schemes matching the given parameters.
Method Details

getAvailableThemes(basemap?)

Returns available themes. See the Object Specifications table below for the returned Object[] properties.
Return type: Object[]
Parameters:
<String> basemap Optional Specify the basemap name if you only want themes applicable to a specific basemap, for example: Example: streets, gray, topo, terrain, national-geographic, oceans, osm, satellite, hybrid, dark-gray.
Object Specifications:
<Object[]>
<String[]> basemaps Required Basemaps that this theme has schemes for. Example: ["streets","gray","topo","terrain","national-geographic","oceans","osm","satellite","hybrid","dark-gray"].
<String> description Required Theme description. Example: "Default theme for basic visualization of features."
<String> label Required Display label for theme.
<String> name Required Name of the theme. The following themes are available: high-to-low, above-and-below, centered-on, or extremes.
Sample:
var map;

require([
  "esri/map",
  "esri/styles/choropleth", "dojo/domReady!"], function(Map, esriStylesChoropleth) {
  map = new Map("map", {
    basemap: "topo",
    center: [-122.45, 37.75], // longitude, latitude
    zoom: 13
  });

  map.on("load", function(){
    themes = esriStylesChoropleth.getAvailableThemes(map.getBasemap());
    console.log(JSON.stringify(themes[0]["basemaps"]));
  });
});

getSchemes(params)

Returns schemes matching the given parameters. See the Object Specifications table below for the returned Object properties.
Return type: Object
Parameters:
<Object> params Required Parameters used to determine the returned scheme type.
Object Specifications:
<params>
<String> basemap Required Name of the basemap. Example: streets, gray, topo, terrain, national-geographic, oceans, osm, satellite, hybrid, dark-gray.
<String> geometryType Required Geometry type of features in your dataset. Supported types: point, line, polygon.
<String> theme Required Name of the theme. Example: high-to-low, above-and-below, centered-on, or extremes.
<Object>
<Object> primaryScheme Required Primary scheme is an object with properties based on the feature geometry type.
  • For points: colors, colorsForClassBreaks, noDataColor, size, outline
    • outline has color and width
  • For lines: colors, colorsForClassBreaks, noDataColor, width
  • For polygons: colors, colorsForClassBreaks, noDataColor, outline
    • outline has color and width
colors: These are colors suitable for unclassed choropleth mapping.
colorsForClassBreaks: These are colors suitable for classed choropleth mapping, categorized based on the number of classes. It is an array of objects with the following properties:
PropertyTypeDescription
numClassesNumberNumber of class breaks
colorsColor[]Recommended colors
<Object[]> secondarySchemes Required Secondary schemes. It is an array of objects with properties identical to the primaryScheme.
Sample:
var map;

require([
  "esri/map",
  "esri/styles/choropleth", "dojo/domReady!"
], function (Map, esriStylesChoropleth){
  map = new Map("map", {
    basemap: "topo",
    center: [-122.45, 37.75], // longitude, latitude
    zoom: 13
  });

  map.on("load", function (){
    schemes = esriStylesChoropleth.getSchemes({theme: "high-to-low", basemap: map.getBasemap(), geometryType: "point"});
    console.log(JSON.stringify(schemes));
  });
});
Show Modal