时间

使用单一渲染方式、视觉变量和聚类来样式化事件,以显示要关闭的天数

什么是通过时间样式化?

包括涉及日期/时间数据的所有可视化效果。您可以使用这些样式来可视化事件发生的时间和地点。常见示例包括:

  1. 时间线
  2. 之前和之后
  3. 期限
  4. 时序过滤器
  5. 时序动画

时间样式的工作方式

以下示例描述了几种时间样式的工作方式。

示例

时间线

时间线可视化使用连续色带显示日期/时间数据。它提供了现象发生或相对于所有其他数据点记录值的即时视图。

以下示例可视化了 2000 年记录的大西洋飓风位置。这使用颜色视觉变量来显示哪些飓风发生在季节早期,哪些飓风发生在季节后期。

46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 47 48 49 50 51 52 53 54 55 56 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />

    <title> GeoScene Developer Guide: Hurricane location and timeline </title>

    <link rel="stylesheet" href="https://js.geoscene.cn/4.23/geoscene/themes/light/main.css" />
    <script src="https://js.geoscene.cn/4.23/"></script>

    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
    </style>

    <script>
      require([
        "geoscene/config",
        "geoscene/WebMap",
        "geoscene/views/MapView",
        "geoscene/layers/FeatureLayer",
        "geoscene/widgets/Legend",
        "geoscene/widgets/Expand"
      ], function (geosceneConfig,WebMap, MapView, FeatureLayer, Legend, Expand) {
        geosceneConfig.apiKey = "YOUR_API_KEY";
        const renderer = {
          type: "simple",
          label: "Observed hurricane location",
          symbol: {
            type: "simple-marker",
            size: 6,
            outline: {
              width: 0.5,
              color: [255,255,255,0.5]
          visualVariables: [{
            type: "color",
            field: "Date_Time",
            legendOptions: {
              title: "Date of observation"
            },
            stops: [
              { value: new Date(2000, 7, 3).getTime(), color: "#00ffff"},
              { value: new Date(2000, 9, 22).getTime(), color: "#2f3f56"}
            ]
          }]
        const layer = new FeatureLayer({
          url: "https://sampleserver6.geosceneonline.cn/arcgis/rest/services/Hurricanes/MapServer/0",
          renderer: renderer
        const map = new WebMap({
          portalItem: {
            id: "9cf503b654144873a8e33f996f91ba1d"
          layers: [ layer ]
        const view = new MapView({
          container: "viewDiv",
          map: map,
          scale: 36978595,
          center: [ -44.0632, 33.1567 ],
          constraints: {
            snapToZoom:false
        view.ui.add(new Expand({
          content: new Legend({
            view: view
          view: view,
          expanded: true
        }), "top-right");
    </script>
  </head>

  <body>
    <div id="viewDiv"></div>
  </body>
</html>

之前和之后

您可以使用具有发散色带的颜色视觉变量来可视化特定日期之前和之后发生的事件。

以下示例可视化了飓风位置的聚类,这些聚类按它们平均发生在 1977 年 1 月 1 日之前还是之后进行汇总。

44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 45 46 47 48 49 50 51 52 53 54 55 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />

    <title>GeoScene Developer Guide: Hurricane locations before or after 1977</title>

    <link rel="stylesheet" href="https://js.geoscene.cn/4.23/geoscene/themes/light/main.css" />
    <script src="https://js.geoscene.cn/4.23/"></script>

    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
    </style>

    <script>
      require([
        "geoscene/config",
        "geoscene/WebMap",
        "geoscene/views/MapView",
        "geoscene/layers/FeatureLayer",
        "geoscene/widgets/Legend",
        "geoscene/widgets/Expand"
      ], function (geosceneConfig,WebMap, MapView, FeatureLayer, Legend, Expand) {
        geosceneConfig.apiKey = "YOUR_API_KEY";
        const colors = [ "#54bebe", "#dedad2", "#c80064" ];
        const renderer = {
          type: "simple",
          label: "Observed hurricane location",
          symbol: {
            type: "simple-marker",
            size: 4,
            outline: null
          visualVariables: [{
            type: "color",
            field: "ISO_time",
            legendOptions: {
              title: "Before and after July 1"
            },
            stops: [
              { value: new Date(2013, 0, 1).getTime(), color: colors[0], label: "January 1" },
              { value: new Date(2013, 6, 1).getTime(), color: colors[1], label: "July 1" },
              { value: new Date(2013, 11, 31).getTime(), color: colors[2], label: "December 31" }
            ]
          }]
        // ISO_time
        const layer = new FeatureLayer({
          title: "2013 Hurricane season",
          portalItem: {
            id: "f14573e9c5ce4b41aecb199d5723209b"
          renderer: renderer,
          definitionExpression: "Season = 2013"
        const map = new WebMap({
          basemap: {
            portalItem: {
              id: "3967a92f547341e28636a8ac159666a3"
          layers: [ layer ]
        const view = new MapView({
          container: "viewDiv",
          map: map,
          scale: 136195673,
          constraints: {
            snapToZoom: false,
            rotationEnabled: false
        view.ui.add(new Expand({
          content: new Legend({
            view: view
          view: view,
          expanded: true
        }), "top-right");
    </script>
  </head>

  <body>
    <div id="viewDiv"></div>
  </body>
</html>

期限

期限可视化根据日期字段显示要素的期限(或到有意义日期或当前日期的已用时间)。期限可视化可应用于以下情景: 

  1. 资产使用了多久?
  2. 事件报告有多久了?
  3. 自上次检查以来多久了?
  4. 事件是否已超出了解决的期限?

期限通常使用 Arcade 表达式中的 DateDiff 函数进行定义,并使用颜色或大小变量进行映射。它使用所需的单位指定时间长度。

 
1
valueExpression = "DateDiff( Now(), $feature.date_created, 'hours' )"

以下示例根据相对于截止日期,事件关闭前所经过的时间,来可视化纽约市已聚类的街道状况投诉。

54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 55 56 57 58 59 60 61 62 63 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />

    <title> GeoScene Developer Guide: Street condition complaints</title>

    <link rel="stylesheet" href="https://js.geoscene.cn/4.23/geoscene/themes/light/main.css" />
    <script src="https://js.geoscene.cn/4.23/"></script>

    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
    </style>

    <script>
      require([
        "geoscene/config",
        "geoscene/WebMap",
        "geoscene/views/MapView",
        "geoscene/layers/FeatureLayer",
        "geoscene/widgets/Legend",
        "geoscene/widgets/Expand",
        "geoscene/smartMapping/labels/clusters",
        "geoscene/smartMapping/popup/clusters",
        "geoscene/core/promiseUtils"
      ], function (geosceneConfig,WebMap, MapView, FeatureLayer, Legend, Expand,
      ) {
        geosceneConfig.apiKey = "YOUR_API_KEY";
        const colors = [ "#2799ff", "#423a3a", "#ff3333" ];
        const renderer = {
          type: "simple",
          label: "Observed hurricane location",
          symbol: {
            type: "simple-marker",
            size: 6,
            outline: {
              width: 0.5,
              color: [255,255,255,0.5]
          visualVariables: [{
            type: "color",
            valueExpression: "DateDiff($feature['closed_time'], $feature['due_time'], 'days')",
            valueExpressionTitle: "Days it took to close incident",
            stops: [
              { value: -21, color: colors[0], label: "21 weeks early" },
              { value: 0, color: colors[1], label: "On time" },
              { value: 21, color: colors[2], label: "21 weeks late" }
            ]
          }]
        const layer = new FeatureLayer({
          portalItem: {
            id: "f624a9f4afa947fe98acd0ed38fbe436"
          title: "Street condition complaints",
          renderer: renderer,
          definitionExpression: "Complaint_Type = 'Street Condition'"
        const map = new WebMap({
          portalItem: {
            id: "75a3ce8990674a5ebd5b9ab66bdab893"
          layers: [ layer ]
        const view = new MapView({
          container: "viewDiv",
          map: map,
          scale: 144447,
          center: [ -73.863, 40.7 ],
          constraints: {
            snapToZoom:false
        view.ui.add(new Expand({
          content: new Legend({
            view: view
          view: view,
          expanded: true
        }), "top-right");
          .then(function(featureReduction){
          function generateClusterConfig() {
          // generates default popupTemplate
          const popupPromise = clusterPopupCreator
              layer: layer
            .then(function (popupTemplateResponse) {
              return popupTemplateResponse.primaryTemplate.value;
          // generates default labelingInfo
          const labelPromise = clusterLabelCreator
              layer: layer,
              view: view
            .then(function (labelSchemes) {
              return labelSchemes.primaryScheme;
          return promiseUtils
            .then(function (result) {
              const popupTemplate = result[0].value;
              const primaryLabelScheme = result[1].value;
              const labelingInfo = primaryLabelScheme.labelingInfo;
              // Ensures the clusters are large enough to fit labels
              const clusterMinSize = primaryLabelScheme.clusterMinSize;
              return {
                type: "cluster",
                popupTemplate: popupTemplate,
                labelingInfo: labelingInfo,
                clusterMinSize: clusterMinSize,
                clusterRadius: 50
            .catch(function (error) {
              console.error(error);
    </script>
  </head>

  <body>
    <div id="viewDiv"></div>
  </body>
</html>

API 支持

完全支持部分支持不支持
  • 1. 仅颜色
  • 2. 仅支持点符号按大小变化
  • 3. 不支持3D点符号按大小变化

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