javascript - Tooltip plothover doesn't appear on modal -
i use flot chart library show graph on modal window.it works fine tooltip popover doesn't appear when plothover.
here .js code : $(document).on('click','a[data-target="#evolutieprodus"]',function(){
var route = 'http://www.fabricademagie.ro/metronic/comenzi/returnordersyear'; var productcode = $(this).data('productcode'); var productid = $(this).data('productid'); var data = { 'productcode': productcode, 'productid': productid }; $.post(route,data,function(response){ response = jquery.parsejson(response); //console.log(response); var obj = response.an ; var an_prezent = object.keys(obj).map(function(e){ return [number(e), obj[e]]; }); var obj2 = response.precedent ; var an_precedent = object.keys(obj2).map(function(e){ return [number(e), obj2[e]]; }); var obj3 = response.second ; var an_secund = object.keys(obj3).map(function(e){ return [number(e), obj3[e]]; }); function showcharttooltip(x, y, xvalue, yvalue, color) { var _item = $('<div id="tooltip" class="chart-tooltip2">' + yvalue + '<\/div>').css({ position: 'absolute', display: 'none', top: y, left: x, border: '0px solid #ccc', padding: '2px 6px', 'color' : color, 'border' : '1px solid #000', 'background-color': '#ccc !important' }).appendto("#evolutieprodus").fadein(300); _item.css('left',x - (_item.width() - -20)); } if ($('#chart_2').size() != 0) { //$('#orders_year_loading').hide(); //$('#orders_year_content').show(); var plot_statistics = $.plot($("#chart_2"), [{ data: an_prezent, lines: { show: true, fill: false, linewidth: 5 }, color: '#d91e18', shadowsize: 0, label: " anul <?=date('y');?>" },{ data: an_prezent, points: { show: true, fill: true, radius: 7, fillcolor: "#d91e18", linewidth: 5 }, color: '#fff', shadowsize: 1 },{ data: an_precedent, lines: { show: true, fill: false, linewidth: 3 }, color: '#00bcd4', shadowsize: 0, label: " anul <?=date('y') - 1;?>" },{ data: an_precedent, points: { show: true, fill: true, radius: 5, fillcolor: "#00bcd4", linewidth: 3 }, color: '#fff', shadowsize: 1 },{ data: an_secund, lines: { show: true, fill: false, linewidth: 3 }, color: '#ff9800', shadowsize: 0, label: " anul <?=date('y') - 2;?>" },{ data: an_secund, points: { show: true, fill: true, radius: 5, fillcolor: "#ff9800", linewidth: 3 }, color: '#fff', shadowsize: 1 }], { xaxis: { ticklength: 0, tickdecimals: 0, mode: "categories", min: 0, font: { lineheight: 34, style: "normal", variant: "small-caps", color: "#ff5722" } }, yaxis: { ticks: 5, tickdecimals: 0, tickcolor: "#eee", font: { lineheight: 34, style: "normal", variant: "small-caps", color: "#6f7b8a" } }, grid: { hoverable: true, borderwidth: 0, margin: 5 } }); var previouspoint = null; $("#chart_2").bind("plothover", function (event, pos, item) { $("#x").text(pos.x.tofixed(2)); $("#y").text(pos.y.tofixed(2)); if (item) { if (previouspoint != item.dataindex) { previouspoint = item.dataindex; $("#tooltip").remove(); var x = item.datapoint[0].tofixed(2), y = item.datapoint[1].tofixed(2); var _color = "#212121"; if(item.series.points.fillcolor !== undefined && item.series.points.fillcolor !== null && item.series.points.fillcolor.length){_color = item.series.points.fillcolor;} showcharttooltip(item.pagex, item.pagey, item.datapoint[0], item.datapoint[1] + ' bucati vandute',_color); } } else { $("#tooltip").remove(); previouspoint = null; } }); } }); });
i find solution.i put z-index property on tooltip class.
Comments
Post a Comment