Guide

Synthèse

The Guide class contains properties for configuring chart guides.

Discussion

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.

Syntaxe

Guide (guideType, {name}, {label}, {valueFrom}, {valueTo}, {polyline}, {lineColor}, {lineWidth}, {lineDashStyle}, {fillColor})
ParamètreExplicationType de données
guideType

Specifies the type of guide that will be created.

  • lineA line guide will be created. Use this value in conjunction with the valueFrom property.
  • rangeA range guide will be created. Use this value in conjunction with the valueFrom and valueTo properties.
  • polylineA polyline guide will be created. Use this value in conjunction with the polyline property.
String
name

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

String
label

The guide label that will be displayed in the chart.

String
valueFrom

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

Object
valueTo

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

Object
polyline
[polyline,...]

A list of coordinates when creating a polyline guide. Coordinates are expected to be in row-major order.

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

The color of a line guide in hexadecimal format.

String
lineWidth

The width of a line guide.

Double
lineDashStyle

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

  • solidA solid dash style will be used.
  • dotA dot dash style will be used.
  • dashA dash style will be used.
  • dashDotA dash-dot style will be used.
  • longDashA long-dash style will be used.
  • longDashDotA long-dash-dot style will be used.
String
fillColor

The fill color of a range guide in hexadecimal format.

String

Propriétés

PropriétéExplicationType de données
fillColor
(Lecture et écriture)

The fill color of a range guide in hexadecimal format.

String
guideType
(Lecture et écriture)

Specifies the type of guide that will be created.

  • lineA line guide will be created. Use this value in conjunction with the valueFrom property.
  • rangeA range guide will be created. Use this value in conjunction with the valueFrom and valueTo properties.
  • polylineA polyline guide will be created. Use this value in conjunction with the polyline property.
String
label
(Lecture et écriture)

The guide label that will be displayed in the chart.

String
lineColor
(Lecture et écriture)

The color of a line guide in hexadecimal format.

String
lineDashStyle
(Lecture et écriture)

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

  • solidA solid dash style will be used.
  • dotA dot dash style will be used.
  • dashA dash style will be used.
  • dashDotA dash-dot style will be used.
  • longDashA long-dash style will be used.
  • longDashDotA long-dash-dot style will be used.
String
lineWidth
(Lecture et écriture)

The width of a line guide.

Double
name
(Lecture et écriture)

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

String
polyline
(Lecture et écriture)

A list of coordinates that will be used when creating a polyline guide. Coordinates are expected to be in row-major order.

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
(Lecture et écriture)

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

Object
valueTo
(Lecture et écriture)

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

Object

Exemple de code

Guide example

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")