Skip to main content

TimeBinningProperties

汇总

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. When set to 0, the time binning options will be calculated automatically based on the temporal range of the data.

Integer

intervalUnits

(可选)

Specifies the time unit that corresponds to the intervalSize value.

  • SECONDS—The time unit is seconds.

  • MINUTES—The time unit is minutes.

  • HOURS—The time unit is hours.

  • DAYS—The time unit is days.

  • WEEKS—The time unit is weeks.

  • MONTHS—The time unit is months.

  • YEARS—The time unit is years.

String

timeAggregationType

(可选)

Specifies the time interval alignment type.

  • equalIntervalsFromStartTime—The time interval is aligned with the start date.

  • equalIntervalsFromEndTime—The time interval is aligned with the end date.

  • referenceTime—The time interval is aligned to a reference time. This option is used in conjunction with the referenceTime value.

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.

  • True—Incomplete intervals are removed.

  • False—Incomplete intervals are not removed.

Boolean

referenceTime

(可选)

The date that binning is initiated.

DateTime

属性

名称 说明 数据类型

intervalSize

(读取和写入)

将分组或聚合在一起的时间跨度。 此属性必须与 intervalUnits 属性配合使用。 当设置为 0 时,将根据数据的时间范围自动计算时间分组选项。

Integer

intervalUnits

(读取和写入)

指定与 intervalSize 属性值对应的时间单位。

  • SECONDS—时间单位为秒。

  • MINUTES—时间单位为分钟。

  • HOURS—时间单位为小时。

  • DAYS—时间单位为天。

  • WEEKS—时间单位为周。

  • MONTHS—时间单位为月。

  • YEARS—时间单位为年。

String

referenceTime

(读取和写入)

启动分组的日期。

DateTime

timeAggregationType

(读取和写入)

指定时间间隔对齐类型。

  • equalIntervalsFromStartTime—时间间隔与开始日期对齐。

  • equalIntervalsFromEndTime—时间间隔与结束日期对齐。

  • referenceTime—时间间隔对齐到参考时间。 此选项必须与 referenceTime 属性配合使用。

String

trimIncompleteInterval

(读取和写入)

指定是否将从图表中移除(修剪)数据跨度开始或结束位置的不完整时间间隔(取决于 timeAggregationType 值)。 图表中的不完整间隔会导致令人误解的结果,其中,由于间隔时间不同,时间段问题会被低估或高估。

  • True—不完整间隔已移除。

  • False—不完整间隔未移除。

Boolean

代码示例

TimeBinningProperties 示例

可以使用 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)