Skip to main content

Series

汇总

Series 类包含的属性用于配置组合图表中所使用的系列。 将此类与 Combo 类配合使用。

语法

Series(y, seriesType, {aggregation})

名称 说明 数据类型

y

y 轴变量的字段名称。 如果指定了空字符串并将 aggregation 参数设置为 COUNT ,则系列将反映每个 x 轴位置的聚合行计数。

String

seriesType

指定系列类型。

  • bar—The series will be represented as bars.

  • line—The series will be represented as a line.

String

aggregation

(可选)

指定应用于聚合到每个条柱中的值的统计计算。

  • COUNT—The total number of records will be identified and applied.

  • SUM—The sum of all values will be calculated and applied.

  • MEAN—The mean of all values will be calculated and applied.

  • MEDIAN—The median of all values will be identified and applied.

  • MIN—The minimum value will be identified and applied.

  • MAX—The maximum value will be identified and applied.

String

属性

名称 说明 数据类型

aggregation

(读取和写入)

指定应用于聚合到每个条柱中的值的统计计算。

  • COUNT—将识别并应用总记录数。

  • SUM—将计算并应用所有值的总和。

  • MEAN—将计算并应用所有值的平均值。

  • MEDIAN—将识别并应用所有值的中值。

  • MIN—将识别并应用最小值。

  • MAX—将识别并应用最大值。

String

y

(读取和写入)

y 轴变量的字段名称。 如果指定了空字符串并将 aggregation 属性设置为 COUNT ,则系列将反映每个 x 轴位置的聚合行计数。

String

seriesType

(读取和写入)

指定系列类型。

  • bar—该系列将以条柱表示。

  • line—该系列将以线表示。

String

代码示例

系列示例

通过配置 Series 对象创建组合图表,并将图表导出至 .svg 文件。

import arcpy

seriesLeft = [arcpy.charts.Series(y="", aggregation="count", seriesType="bar")]
seriesRight = [arcpy.charts.Series(y="prcp", aggregation="mean", seriesType="line")]
chart = arcpy.charts.Combo(x="day_for_trips", seriesLeft=seriesLeft, seriesRight=seriesRight,
                           title="Bike Trips and Precipitation",
                           yTitleLeft="Total Rides", yTitleRight="Average Precipitation",
                           dataSource="BikeTripData")
chart.exportToSVG("combo.svg", width=900, height=500)