ChartDirector 5.1 (PHP Edition)

JsChartViewer.showCrossHair


Usage

showCrossHair(x, y[, lineStyle[, leftMargin[, rightMargin[, topMargin[, bottomMargin[, centerOffset]]]]]]);

Description

Displays the crosshair cursor.

The crosshair cursor is a horizontal line and a vertical line that intersects at (x, y). By default, the end points of these lines terminate at the edges of the plot area. The position of the end points are configurable with the leftMargin, rightMargin, topMargin and bottomMargin arguments.

By default, the horizontal and vertical lines are not continuous, but are broken near (x, y). So there is gap around (x, y) where the lines are broken. The gap size is configurable with the centerOffset argument.

The reason for the gap is because the crosshair cursor is frequently used to track the mouse cursor in a JsChartViewer.MouseMovePlotArea event, in which (x, y) is the mouse cursor position. By leaving a gap at (x, y), the underlying chart can receive mouse events. Without the gap, the horizontal or vertical lines will be under the mouse cursor. The browsers may then send mouse events to the horizontal or vertical lines (which are themselves HTML elements) instead of the chart.

The crosshair cursor can be hidden using JsChartViewer.hideObj.

Arguments

ArgumentDefaultDescription
x(Mandatory)The x pixel coordinate of the crosshair, relative to the chart.
y(Mandatory)The y pixel coordinate of the crosshair, relative to the chart.
lineStyle"1pxdotted black" The line style of the crosshair in CSS border property format, like "1px solid black" or "2px dotted #FF0000".
leftMargin0The number of pixels that the crosshair cursor will extend outside the left side of the plot area. A negative number means that the crosshair cursor will be shortened instead of extended.
rightMargin0The number of pixels that the crosshair cursor will extend outside the right side of the plot area. A negative number means that the crosshair cursor will be shortened instead of extended.
topMargin0The number of pixels that the crosshair cursor will extend outside the top side of the plot area. A negative number means that the crosshair cursor will be shortened instead of extended.
bottomMargin0The number of pixels that the crosshair cursor will extend outside the bottom side of the plot area. A negative number means that the crosshair cursor will be shortened instead of extended.
centerOffset5The radius in pixels of the region around (x, y) where the crosshair cursor lines should be broken.

Return Value

None