$(function () {
var d1 = [[10,112.3],[9,112.0],[8,111.9],[7,110.2],[6,112.0],[5,112.0],[4,112.0],[3,111.4],[2,110.0],[1,110.0]
]
$.plot($("#wykres-gielda"), [
{ label: "", data: d1}
], {
lines: { show: true },
colors: ["#ffffff", "#fafafa"],
points: { show: false },
xaxis: {
ticks: [[10, "30 lip"],[9, ""],[8, "28 lip"],[7, ""],[6, "23 lip"],[5, ""],[4, "21 lip"],[3, ""],[2, "19 lip"],[1, ""]] },
yaxis: {
tickDecimals: 1
},
grid: {
hoverable: true,
backgroundColor: null,
borderWidth: 0,
color: "#fdc179",
tickColor: "#fdc179"
}
});
function showTooltip(x, y, contents) {
$('
' + contents + '
').css( {
position: 'absolute',
display: 'none',
top: y + 5,
left: x + 5,
border: '1px solid #fdd',
padding: '2px',
'background-color': '#fee',
opacity: 0.80
}).appendTo("body").fadeIn(200);
}
var previousPoint = null;
$("#placeholder").bind("plothover", function (event, pos, item) {
$("#x").text(pos.x.toFixed(2));
$("#y").text(pos.y.toFixed(2));
if ($("#enableTooltip:checked").length > 0) {
if (item) {
if (previousPoint != item.datapoint) {
previousPoint = item.datapoint;
$("#tooltip").remove();
var x = item.datapoint[0].toFixed(2),
y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY,
item.series.label + " of " + x + " = " + y);
}
}
else {
$("#tooltip").remove();
previousPoint = null;
}
}
});
});