点密度

尝试一下在线预览

 这个例子演示了如何创建一个 DotDensityRenderer 。点密度可视化专门用于可视化多边形图层中的密度值。 通过为所需属性的给定值随机放置一个点来可视化密度。 与等值线可视化不同,点密度可以使用总计数进行映射,因为多边形的大小在属性的感知密度中起着重要作用。

虽然点密度最常使用单个属性进行映射,但您最多可以指定 8 个字段和/或 Arcade 表达式来查看数据子集。 这些领域应该是一个共同类别的子集,或者相互竞争。

以下片段演示了如何创建按种族/民族细分的人口点密度可视化。

                                                          
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const dotDensityRenderer = new DotDensityRenderer({
  // The number of units per dot
  referenceDotValue: 100,
  outline: null,
  // When referenceScale is set, linearly scales the dot value
  // based on the referenceDotValue. The layer view will draw
  // dots using the value in referenceDotValue only at the scale
  // specified here.
  referenceScale: view.scale,
  legendOptions: {
    // Displays "1 dot = 100 people" in the legend
    unit: "people"
  },
  attributes: [
    {
      // One red dot will be drawn for every 100 White people
      field: "B03002_003E",
      color: "#f23c3f",
      label: "White (non-Hispanic)"
    },
    {
      // One yellow dot will be drawn for every 100 Hispanic people
      field: "B03002_012E",
      color: "#e8ca0d",
      label: "Hispanic"
    },
    {
      field: "B03002_004E",
      color: "#00b6f1",
      label: "Black or African American"
    },
    {
      field: "B03002_006E",
      color: "#32ef94",
      label: "Asian"
    },
    {
      field: "B03002_005E",
      color: "#ff7fe9",
      label: "American Indian/Alaskan Native"
    },
    {
      field: "B03002_007E",
      color: "#e2c4a5",
      label: "Pacific Islander/Hawaiian Native"
    },
    {
      field: "B03002_008E",
      color: "#ff6a00",
      label: "Other race"
    },
    {
      field: "B03002_009E",
      color: "#96f7ef",
      label: "Two or more races"
    }
  ]
});

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.