Is there a way to increase the length of the tooltip displayed in asp.net graphics?

I have a chart that displays a tooltip (line) when it hangs. Is there a way to control the delay / time when a tooltip is displayed to the user?

<asp:Chart runat="server" ID="Chart2" Width="340px" Height="265px">
        <!--Define Things in here-->
    </asp:Chart>

Backend:

    //define what rec is
    string tooltip = rec;
    Chart2.ToolTip = tooltip;
+3
source share
5 answers

Sorry, but probably not.

Most tooltips are a browser feature and display either the alt img tag or the title tag of most elements. Thus, the control of how long the tooltip will be displayed will vary from browser to browser.

, html, javascript , Flash Silverlight, , .

+3

Javascript, : http://bonrouge.com/~js_tooltip

Asp.NET title HTML-. , , , javascript.

function showTooltip(control) {
    var ttext = control.title;
    var tt = document.createElement('SPAN');
    var tnode = document.createTextNode(ttext);
    tt.appendChild(tnode);
    control.parentNode.insertBefore(tt, control.nextSibling);
    tt.className = "tooltipCss";
    control.title = "";
}
function hideTooltip(control) {
    var ttext = control.nextSibling.childNodes[0].nodeValue;
    control.parentNode.removeChild(control.nextSibling);
    control.title = ttext;
}

css :

position:absolute; 
border:1px solid gray; 
width:300px; 
margin:1em; 
padding:3px; 
background: Red;

, JavaScript

Chart2.Attributes.Add("onmouseover", "showTooltip(this)");
Chart2.Attributes.Add("onmouseout", "hideTooltip(this)");

, ... Asp.Net . - , . , - . , -.

+4

, , . , jQuery.

0

Ravendarksky : , mouseout , IE ( Chrome, Firefox):

0x800a138f - JavaScript Runtime Error: Unable to get nodeValue property from undefined or null reference

So I just wrapped the hideTooltip implementation in conditional check for null, and everything was fine in IE [and Chrome]:

function hideTooltip(control) {
    if (control.nextSibling.childNodes[0] != null) {
        var ttext = control.nextSibling.childNodes[0].nodeValue;
        control.parentNode.removeChild(control.nextSibling);
        control.title = ttext;
    }
0
source

Or you can use HoverMenuExtender asp.net. You can also change pop-up content / design.

Example code link here: http://asp-net-example.blogspot.com/2009/11/ajax-hovermenuextender-how-to-use.html

0
source

Source: https://habr.com/ru/post/1761413/


All Articles