摘要
TimeBinningProperties 类包含用于配置用于时间图表的时间图格的属性。
语法
TimeBinningProperties (intervalSize, intervalUnits, timeAggregationType, trimIncompleteInterval, referenceTime)
参数 | 说明 | 数据类型 |
intervalSize | The span of time that is binned or aggregated together. This value must be used in conjunction with the intervalUnits value. | Integer |
intervalUnits | Specifies the time unit that corresponds to the intervalSize value.
| String |
timeAggregationType | Specifies the time interval alignment type.
| String |
trimIncompleteInterval | Specifies whether incomplete time intervals at the start or end of the data span (depending on the timeAggregationType value) are removed (trimmed) from the chart. Incomplete intervals on a chart can cause misleading results in which the period in question is underreported or overreported due to a different amount of time in the interval.
| Boolean |
referenceTime | Specifies the time that binning is initiated. | DateTime |
属性
属性 | 说明 | 数据类型 |
intervalSize (可读写) | 将分组或聚合在一起的时间跨度。 此属性必须与 intervalUnits 属性配合使用。 | Integer |
intervalUnits (可读写) | 指定与 intervalSize 属性值对应的时间单位。
| String |
referenceTime (可读写) | 指定启动图格化的时间。 | DateTime |
timeAggregationType (可读写) | 指定时间间隔对齐类型。
| String |
trimIncompleteInterval (可读写) | 指定是否将从图表中移除(修剪)数据跨度开始或结束位置的不完整时间间隔(取决于 timeAggregationType 值)。 图表中的不完整间隔会导致令人误解的结果,其中,由于间隔时间不同,时间段问题会被低估或高估。
| Boolean |
代码示例
可以使用 TimeBinningProperties 创建时间条形图。
import arcpy
url = r"https://services1.arcgis.com/hLJbHVT9ZrDIzK0I/arcgis/rest/services/CrimesChiTheft/FeatureServer/0"
bins = arcpy.charts.TimeBinningProperties(intervalSize=1, intervalUnits='MONTHS')
bar = arcpy.charts.Bar(x="datetime", aggregation="count", title="Incidents by Month",
timeBinningProperties=bins, dataSource=url)
bar.exportToSVG('temporal_bar.svg', width=800, height=600)