This documentation is archived and is not being maintained.

LegendItem.MapAreaAttributes Property

Gets or sets the map area attributes of a legend item.

Namespace:  System.Web.UI.DataVisualization.Charting
Assembly:  System.Web.DataVisualization (in System.Web.DataVisualization.dll)

public string MapAreaAttributes { get; set; }

Property Value

Type: System.String
A string value that represents the attributes of corresponding map area for the legend item.



If you set the MapAreaAttributes property, a client-side image map will automatically be created. A map area will also be created, with its attribute string appended to the <map> tag that corresponds to the chart object for which this property is being set.

For example, setting the Target attribute using this property and the Url property of the first data point will result in HTML code that is similar to the following code:

<img id="Chart1" usemap="#Chart1ImageMap" src="ChartPic_000002.jpg?6735e83b-f0cd-4225-8be4-047695a61040" border="0" />...<map name="Chart1ImageMap"><area shape="rect" href="" COORDS="69,120,106,309" target=_blank></map>

Because the entire string is appended to the <map> tag, multiple attributes should be separated with a space.

The MapAreaAttributes property can be used in conjunction with the Url property to specify map area attributes, for example, target= _blank, as well as client-side event handlers, for example, OnClick="MyEvent()".

Setting this property will have no effect if the IsMapEnabled property is set to false. Its default value is true.

Important   To create an image map in this manner, the RenderType property of the Chart object must be set to ImageTag. It is possible to create an image map when using binary streaming, but another technique must be used. For more information, see Chart Image Rendering (Chart Controls).

Special keywords may be used when setting this property; each keyword will be replaced with some type of data from the applicable chart element. Refer to the following table for a listing of all available keywords:


Replaced by


X-value of the data point.


Y-values of the data point.


Series name.


Data point label.


Data point index.


Percentage of the data point Y-value.


Total of all Y-values in the series.


Legend text.

To create image maps that have user-defined coordinates, use the MapAreas property of the root Chart object. For more information, see Chart Image Rendering (Chart Controls).


This property is applicable to the entire LegendItem.

.NET Framework

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.