ComponentOne Chart for .NET (2.0) Search HelpCentral 

Defining the ImageAreas Property

The ImageAreas: property is a collection of MapArea objects. Each MapArea object has properties that specify a tooltip to be displayed when the user moves the mouse over the area, and an action to be performed when the area is clicked.

The ImageAreas: property has a set of built-in areas, created automatically by the control:

·      ChartArea, PlotArea

·      AxisX, AxisY, AxisY2

·      ChartData (one <area> tag per data point or series)

·      ChartLabel (one <area> tag per label)

·      Header, Footer

·      Legend, LegendItem (one <area> tag per item)

You can add your own MapArea objects using the collection’s Add method. When you create new MapArea objects, specify their shape (circle, rectangle or polygon) and the coordinates of the area to be created. You can do this at design time, using the collection editor, or using code. For example:

MapArea a = new MapArea();

a.Shape = AreaShapeEnum.Rectangle;

a.Coords = new int[] { 169,225,175,240 };

a.Tooltip = "My Custom Area";

_c1wc.ImageAreas.Add(a);

The coordinates are specified as an array of integers. This array corresponds to the ‘coords’ attribute of the <area> tag. The meaning of the array elements depends on the shape of the area:

Shape

Coords

Description

Circle

"x1,y1,r"

x1,y2 are the coordinates of the center of the circle, and r is the radius of the circle.

Polygon

"x1,y1,x2,y2...xn,yn"

Each x,y pair contains the coordinates of one vertex of the polygon.

Rectangle

"x1,y1,x2,y2"

x1,y1 are the coordinates of the upper-left corner of the rectangle and x2,y2 are the coordinates of the lower-right coordinates of the rectangle.

You can obtain coordinate values for the various chart elements using methods and properties exposed by C1WebChart.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.