Skip to main content

TimeBinningProperties

Summary

The TimeBinningProperties class contains properties for configuring time binning used for temporal charts.

Syntax

TimeBinningProperties({intervalSize}, {intervalUnits}, {timeAggregationType}, {trimIncompleteInterval}, {referenceTime})

Name Explanation Data type

intervalSize

(Optional)

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

(Optional)

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

(Optional)

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

(Optional)

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

(Optional)

The date that binning is initiated.

DateTime

Properties

Name Explanation Data type

intervalSize

(Read and Write)

The span of time that is binned or aggregated together. This property must be used in conjunction with the intervalUnits property. When set to 0, the time binning options will be calculated automatically based on the temporal range of the data.

Integer

intervalUnits

(Read and Write)

Specifies the time unit that corresponds to the intervalSize property 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

referenceTime

(Read and Write)

The date that binning is initiated.

DateTime

timeAggregationType

(Read and Write)

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 property.

String

trimIncompleteInterval

(Read and Write)

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

Code sample

TimeBinningProperties example

Use TimeBinningProperties to create a temporal bar chart.

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)