Share via


Keywords (Chart Controls)

In the Chart control, a keyword is a character sequence that is replaced with an automatically calculated value at run time.

Applicable Chart Elements

Keywords apply to the following chart elements.

Element Applicable Properties

Series and DataPoint

  • Label

  • AxisLabel

  • ToolTip

  • Url

  • MapAreaAttributes

  • PostBackValue

  • LegendToolTip

  • LegendMapAreaAttributes

  • LegendPostBackValue

  • LegendUrl

  • LegendText

  • LabelToolTip

Annotation

  • ToolTip

  • Url

  • MapAreaAttributes

  • PostBackValue

  • Text (TextAnnotation only)

Legend

  • Text

  • Tooltip

  • Url

  • MapAreaAttributes

  • PostBackValue

Keyword Reference

The following table lists all keywords the Chart control accepts.

Keyword Description Multiple Y Values Formatting

#VALX

X value of data point.

No

Yes

#VAL

Y values of the data point.

Yes

Yes

#SERIESNAME

Series name.

No

No

#LABEL

Data point label.

No

No

#AXISLABEL

Axis data point label.

No

No

#INDEX

Data point index.

No

Yes

#PERCENT

Percentage of the data point Y value.

Yes

Yes

#LEGENDTEXT

Legend text.

No

No

#CUSTOMPROPERTY(customAttributeName)

Value of the named custom attribute.

No

No

#TOTAL

Total of all Y values in the series.

Yes

Yes

#AVG

Average of all Y values in the series.

Yes

Yes

#MIN

Minimum data point of all Y values in the series.

Yes

Yes

#MAX

Maximum data point of all Y values in the series.

Yes

Yes

#FIRST

First data point of all Y values in the series.

Yes

Yes

#LAST

Last data point of all Y values in the series.

Yes

Yes

Using Keywords with Multiple Y Values

When using chart types with more than one Y value, you can show calculation specific to a Y value in certain keywords. To do this, append the Y value position to the keyword. For example, to show the open, close, high, and low values in a stock chart, use the following string: "#VALY, #VALY2, #VALY3, #VALY4".

Formatting Keywords

Certain keywords allow formatting. To format the output of a keyword, at the end of the keyword, add a standard numeric format string or custom numeric format string encapsulated in curly brackets.

When you use a standard numeric format string, the Chart control uses the regional settings on your system to display the calculated values in the local format (such as the Japanese Yen for currency).

For example:

  • To represent Y values as currency, use "#VAL{C}".

  • To represent positive Y values as dollars with negative values shown as positive dollars encapsulated by parentheses, use "#VAL{$#,##0.00;($#,##0.00)}".

For more information, see Numeric Format Strings.

See Also

Reference

System.Windows.Forms.DataVisualization.Charting
System.Web.UI.DataVisualization.Charting

Other Resources

Technical Reference