$(function () {
var d1 = [[10,72.50],[9,71.00],[8,70.00],[7,70.00],[6,69.00],[5,69.00],[4,66.50],[3,67.00],[2,65.50],[1,65.50]
]
$.plot($("#wykres-gielda"), [
{ label: "", data: d1}
], {
lines: { show: true },
colors: ["#ffffff", "#fafafa"],
points: { show: false },
xaxis: {
ticks: [[10, "06 lut"],[9, ""],[8, "02 lut"],[7, ""],[6, "31 sty"],[5, ""],[4, "27 sty"],[3, ""],[2, "25 sty"],[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;
}
}
});
});