Custom highlight to jqPlot stacked bar chart

谁都会走 提交于 2019-11-27 03:41:00

问题


When adding a custom highlight to the jqPlot chart, I simply use

$('#chart').bind('jqplotDataHighlight', function (ev, sIndex, pIndex, data) {
    var chart_top = $('#chart').offset().top,
        y = plot1.axes.yaxis.u2p(data[1]); // convert y axis units to pixels
    $('#tooltip').css({ top: chart_top + y });
}

as seen in the last example here. This works great on my simple bar chart. I then try the same on a stacked bar chart, and the x-values are off. Does anyone know how I can get these values or what I am doing wrong?


回答1:


Check out how I do a custom tooltip on my stacked bar chart.

The jsfiddle sample is available here.



来源:https://stackoverflow.com/questions/10578204/custom-highlight-to-jqplot-stacked-bar-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!