ASPxClientXYDiagram2D.ShowCrosshair(screenX, screenY) Method
Shows the Crosshair Cursor at the point with the specified coordinates.
Declaration
ShowCrosshair(
screenX: number,
screenY: number
): void
Parameters
Name | Type | Description |
---|---|---|
screenX | number | The horizontal coordinate that is related to the top-left angle of the chart. |
screenY | number | The vertical coordinate that is related to the top-left angle of the chart. |
Example
To programmatically show the Crosshair Cursor on the client side, call the ASPxClientXYDiagram2D.ShowCrosshair
method and specify the mouse position coordinates as this method’s parameters.
function OnChartObjectSelectionChanged(s, e) {
var x = e.absoluteX - e.htmlElement.offsetLeft;
var y = e.absoluteY - e.htmlElement.offsetTop;
var xyDiagram = s.GetChart().diagram;
xyDiagram.ShowCrosshair(x, y);
e.processOnServer = false;
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainPage.aspx.cs" Inherits="ShowCrosshairExample.MainPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>ShowCrosshair Example</title>
<script type="text/javascript" src="MainPageScripts.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:WebChartControl
ID="chartControl"
runat="server"
Height="720px"
Width="1280px"
ClientInstanceName="chartControl"
CrosshairEnabled="False"
EnableClientSideAPI="true">
<ClientSideEvents ObjectSelected="OnChartObjectSelectionChanged"/>
<CrosshairOptions
ShowOnlyInFocusedPane="False" />
<%-- ... --%>
</dx:WebChartControl>
</div>
</form>
</body>
</html>
See Also