2

我正在使用 jqplotDataHighlight 选项在 MouseOver 上的图表上显示工具提示。

$("#"+sTargetId).bind('jqplotcustomDataHighlight', 
                       function (ev, seriesIndex, pointIndex, data) {    
                         var chart_left = $("#"+sTargetId).offset().left,
                         chart_right = ($(window).width() - ($("#"+sTargetId).offset().left + $("#"+sTargetId).outerWidth())),
                         chart_top = $("#"+sTargetId).offset().top,
                           x = oPlot.axes.xaxis.u2p(data[0]),  // convert x axis units to pixels
                           y = oPlot.axes.yaxis.u2p(data[1]);;
                           var tooltipData = data[1]*scale;
                          $('#tooltip').css({left:chart_left+x, top:chart_top+y, marginRight:chart_right});
                          $('#tooltip').html('<span style="font-family: Arial;font-size:'+sTooltip+';font:bold;color:#000000;">' +sXDisplay+': '+ tooltipData + '</span>');
                         $('#tooltip').show();
                       });

            $("#"+sTargetId).bind('jqplotcustomDataUnhighlight', 
                     function (ev, seriesIndex, pointIndex, data) {
                         $('#tooltip').empty();
                         $('#tooltip').hide();
                     });

它工作正常。在 iPad 上,我希望在某些触摸事件上显示工具提示。我该如何实现它?

        // prop: highlightMouseOver
        // True to highlight slice when moused over.
        // This must be false to enable highlightMouseDown to highlight when clicking on a slice.
this.highlightMouseOver = true;
        // prop: highlightMouseDown
        // True to highlight when a mouse button is pressed over a slice.
        // This will be disabled if highlightMouseOver is true.
this.highlightMouseDown = false;

我观察到只有上述两个选项可用。如何在 touchstart 上实现它?在双击或任何其他事件上显示工具提示也会有帮助

4

1 回答 1

0

也许你已经想通了。这对我有用。我正在使用jquerymobile,在jquery.jqplot.js 版本 0.9.7r635行号:2290 更改mousemovevmousemove. 如果您正在使用cursor: {followMouse: true},那么事情应该开箱即用,我的工具提示有一个固定位置,但是在 mousemove 上,顶部和左侧的值没有被应用,所以我硬编码顶部和左侧,以便工具提示 div.jqplot-cursor-tooltip出现在与点击时相同的位置。虽然它不是一个很好的解决方案,但到目前为止我还没有看到奇怪的行为。希望这可以帮助 !

于 2012-12-24T13:46:06.673 回答