|
Article relates to
|
RadChart v2.x "classic"
RadChart for ASP.NET AJAX
(Telerik.Web.UI 2008.1.x)
|
|
Created by
|
Ves, Telerik
|
|
Last modified
|
April 12 2008
|
|
Last modified by
|
Ves, Telerik
|
HOW TO
Disable click for items in chart image maps.
DESCRIPTION
Wiring Rad
chart’s OnClick event generates image map with all the items clickable. However, sometimes you may want not all of the chart series items to behave as image buttons.
SOLUTION
This example presents how to apply appropriate settings to the image map’s area so that clicks are disabled for some of the chart series items. The image map onclick attribute is hooked thus to prevent postback when certain items are clicked by chance. The mouse cursor is also customized not to change to ‘hand’ when you hover over a "non-postback" item.
The forthcoming code snippets illustrates how to support the schema depicted above:
VB:
| ' Define an item to apply the settings to |
| Dim i As Integer = 1 |
| ' Manage cursor: on mouse over - keep the default cursor, on mouse out - clear this setting to regain normal behavior for the rest of the map |
| RadChart1.Series(0).Items(i).ActiveRegion.Attributes = "onmouseover=""this.parentNode.parentNode.style.cursor = 'default';"" onmouseout=""this.parentNode.parentNode.style.cursor = '';"" onclick=""return false;""" |
| |
C#:
| // Define an item to apply the settings to |
| int i = 1; |
| // Manage cursor: on mouse over - keep the default cursor, on mouse out - clear this setting to regain normal behavior for the rest of the map |
| RadChart1.Series[0].Items[i].ActiveRegion.Attributes = "onmouseover=\"this.parentNode.parentNode.style.cursor = 'default';\" onmouseout=\"this.parentNode.parentNode.style.cursor = '';\" onclick=\"return false;\""; |
| |
VB:
| ' Define an item to apply the settings to |
| Dim i As Integer = 1 |
| ' Manage cursor: on mouse over - keep the default cursor, on mouse out - clear this setting to regain normal behavior for the rest of the map |
| RadChart1.ChartSeriesCollection(0).Items(i).ItemMap.Attributes = "onmouseover=""this.parentNode.parentNode.style.cursor = 'default';"" onmouseout=""this.parentNode.parentNode.style.cursor = '';"" onclick=""return false;""" |
| RadChart1.ChartSeriesCollection(0).Items(i).ItemMap.HRef = "" |
| |
C#:
| //Define an item to apply the settings to |
| int i = 1; |
| //Manage cursor: on mouse over - keep the default cursor, on mouse out - clear this setting to regain normal behavior for the rest of the map |
| RadChart1.ChartSeriesCollection[0].Items[i].ItemMap.Attributes = "onmouseover=\"this.parentNode.parentNode.style.cursor = 'default';\" onmouseout=\"this.parentNode.parentNode.style.cursor = '';\" onclick=\"return false;\""; |
| RadChart1.ChartSeriesCollection[0].Items[i].ItemMap.HRef = ""; |
| |
You can review the project attached at the bottom of this article for additional reference.
Please
Sign In
to rate this article.