Skip to main content

Guide

Resumen

The Guide class contains properties for configuring chart guides.

Debate

When creating this object, optional arguments for the class constructor must be specified using the argument name; they cannot be specified by argument position. See the Code sample section for an example of how to specify arguments using keywords.

Sintaxis

Guide(guideType, {name}, {label}, {valueFrom}, {valueTo}, {valueFromField}, {valueFromFieldAggregationType}, {polyline}, {lineColor}, {lineWidth}, {lineDashStyle}, {fillColor})

Nombre Explicación Tipo de datos

guideType

Specifies the type of guide that will be created.

  • line—A line guide will be created. Use this value in conjunction with the valueFrom argument.

  • range—A range guide will be created. Use this value in conjunction with the valueFrom and valueTo arguments.

  • polyline—A polyline or point guide will be created. Use this value in conjunction with the polyline argument.

String

name

(Opcional)

The unique name for the guide that will appear in the Chart Properties pane.

String

label

(Opcional)

The guide label that will be displayed in the chart.

String

valueFrom

(Opcional)

The location of the guide when creating a line guide, or the start location of the range when creating a range guide. Use a double value for numeric axes and a datetime object for temporal axes.

Object

valueTo

(Opcional)

The end location of the range when creating a range guide. Use a double value for numeric axes and a datetime object for temporal axes.

Object

valueFromField

(Opcional)

The field name whose values will be used to calculate the location of a data-driven guide. Use this argument in conjunction with the valueFromFieldAggregationType argument.

String

valueFromFieldAggregationType

(Opcional)

Specifies the statistical calculation that will be used to determine the location of a data-driven guide. Use this argument in conjunction with the valueFromField argument.

  • 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

polyline

(Opcional)

A list of coordinates that will be used when creating a polyline guide. Coordinates should be in row-major order. Specifying a single coordinate pair will create a point guide.

Create a polyline guide.

# Coordinates will be: (0, 2), (10, 12), (20, 15)
coordinates = [0, 2, 10, 12, 20, 15]
guide = arcpy.charts.Guide(guideType="polyline", polyline=coordinates)

List

lineColor

(Opcional)

The color of a line guide in hexadecimal format.

String

lineWidth

(Opcional)

The width of a line guide.

Double

lineDashStyle

(Opcional)

Specifies the dash style that will be used for a line guide.

  • solid—A solid style will be used.

  • dot—A dot style will be used.

  • dash—A dash style will be used.

  • dashDot—A dash-dot style will be used.

  • longDash—A long-dash style will be used.

  • longDashDot—A long-dash-dot style will be used.

String

fillColor

(Opcional)

The fill color of a range guide in hexadecimal format.

String

Propiedades

Nombre Explicación Tipo de datos

fillColor

(Lectura y escritura)

The fill color of a range guide in hexadecimal format.

String

guideType

(Lectura y escritura)

Specifies the type of guide that will be created.

  • line—A line guide will be created. Use this value in conjunction with the valueFrom property.

  • range—A range guide will be created. Use this value in conjunction with the valueFrom and valueTo properties.

  • polyline—A polyline or point guide will be created. Use this value in conjunction with the polyline property.

String

label

(Lectura y escritura)

The guide label that will be displayed in the chart.

String

lineColor

(Lectura y escritura)

The color of a line guide in hexadecimal format.

String

lineDashStyle

(Lectura y escritura)

Specifies the dash style that will be used for a line guide.

  • solid—A solid style will be used.

  • dot—A dot style will be used.

  • dash—A dash style will be used.

  • dashDot—A dash-dot style will be used.

  • longDash—A long-dash style will be used.

  • longDashDot—A long-dash-dot style will be used.

String

lineWidth

(Lectura y escritura)

The width of a line guide.

Double

name

(Lectura y escritura)

The unique name for the guide that will appear in the Chart Properties pane.

String

polyline

(Lectura y escritura)

A list of coordinates that will be used when creating a polyline guide. Coordinates should be in row-major order. Specifying a single coordinate pair will create a point guide.

Create a polyline guide.

# Coordinates will be: (0, 2), (10, 12), (20, 15)
coordinates = [0, 2, 10, 12, 20, 15]
guide = arcpy.charts.Guide(guideType="polyline", polyline=coordinates)

List

valueFrom

(Lectura y escritura)

The location of the guide when creating a line guide, or the start location of the range when creating a range guide. Use a double value for numeric axes and a datetime object for temporal axes.

Object

valueFromField

(Lectura y escritura)

The field name whose values will be used to calculate the location of a data-driven guide. Use this property in conjunction with the valueFromFieldAggregationType property.

String

valueFromFieldAggregationType

(Lectura y escritura)

Specifies the statistical calculation that will be used to determine the location of a data-driven guide. Use this property in conjunction with the valueFromField property.

  • 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

valueTo

(Lectura y escritura)

The end location of the range when creating a range guide. Use a double value for numeric axes and a datetime object for temporal axes.

Object

Muestra de código

Guide example 1

Add two guides to a scatter plot showing the average value for each axis.

import arcpy

chart = arcpy.charts.Scatter(x="voter_turnout", y="per_capita_income", dataSource="VoterTurnout2020")

# Create and configure guides
guideX = arcpy.charts.Guide(guideType="line", valueFrom=65.6, label="Avg. Voter Turnout")
guideY = arcpy.charts.Guide(guideType="line", valueFrom=26823.8, label="Avg. Per Capita Income")

# Add guides to appropriate axis
chart.xAxis.addGuide(guideX)
chart.yAxis.addGuide(guideY)

chart.exportToSVG("chart_with_guides.svg")
Guide example 2

Add a data-driven guide to a bar chart to show the average value for the y-axis.

import arcpy

lyr = arcpy.mp.ArcGISProject("current").listMaps()[0].listLayers()[0]
chart = arcpy.charts.Bar(x="State", y="TotalPop", aggregation="MEAN")

# Create data-driven guide
guide = arcpy.charts.Guide("line", valueFromField="TotalPop", valueFromFieldAggregationType="MEAN")

# Add guide to y-axis
chart.yAxis.addGuide(guide)

chart.addToLayer(lyr)