Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Scrollbars appear when mouse is placed over UltraChart
posted

Hi,

I'm using NetAdvantage 2008 Vol 1 and I'm having a problem with scrollbars appearing in the browser when I add a UltraChart and move my mouse over it.

Example code:

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<igchart:UltraChart ID="UltraChart1" runat="server">

</igchart:UltraChart>

</div>

</form>

</body>

</html>

 

I have no code-behind, no css, no data being bound to the chart, so all you get is the default image saying "data not available", but it demonstrates the problem.

If you create a page as above (I'm using Visual Studio 2005 SP1) and run it, and then resize your browser as small as possible without scrollbars appearing, and then put your mouse over the image... scrollbars appear... why?

Any ideas?

Parents
No Data
Reply
  • 35
    posted
    Better late than never!

    I managed to fix the issue by creating a javascript proxy function to wrap around the ShowToolTop, HideToolTip and onmousemove client script methods.

    The main chunk of the problem is because they have used the visibility='hidden' css property to hide the tooltip instead of display='none'.

    I've also made it so the tooltip will appear to the left of the mouse if it detects that it's going to fall off the right hand side of the page and cause the scroll bars to appear. This might need to be adapted if you want it to happen against the right edge of a different element.

    The charts ClientID is used as the name of the javascript object which represents each instance of the chart and is accessible as a global variable once the page has finnished loading.

    I've used jquery here but this can easily be adapted to another library or plain old javascript.

    // To get the correct ClientID, this code needs to be added
    // from code behind and after the control has been added to the page
    // (js method 'fixChartTooltip()' needs to be called once for each chart on the page)
    $(document).ready(function(){
    fixChartTooltip(" & MyChart.ClientID & ")
    });

    // Add this to the markup or .js file
    function fixChartTooltip(TrendObject)
    {
    var proxyShow = TrendObject.ShowTooltip;
    var proxyHide = TrendObject.HideTooltip;
    var proxyOnMouseMove = TrendObject.onmousemove;

    TrendObject.ShowTooltip = function(evt, id, args){
    proxyShow.apply(this,[evt, id, args]);
    $('#' + this.ID + '_IGTooltipBody').css('display','inline');
    ensureTooltipVisible.apply(this);
    };

    TrendObject.HideTooltip = function(evt, id, args){
    proxyHide.apply(this,[evt, id, args]);
    $('#' + this.ID + '_IGTooltipBody').css('display','none');
    };

    TrendObject.onmousemove = function(evt, id){
    proxyOnMouseMove.apply(this,[evt, id]);
    ensureTooltipVisible.apply(this);
    };

    function ensureTooltipVisible()
    {
    var tooltip_ref_body = $('#' + this.ID + '_IGTooltipBody');
    var width = tooltip_ref_body.width();
    var leftEdge = tooltip_ref_body.position().left;
    var rightEdge = leftEdge + width;

    if (rightEdge > $(window).width()) {
    tooltip_ref_body.css('left',leftEdge - width + 'px');
    }
    }
    }

Children
No Data