<script>
function showTooltip(title, x, y, contents) {
$('<div id="tooltip" class="chart-tooltip"><div class="date">' + title + '<\/div><div class="label label-success">CTR: ' + x + '%<\/div><div class="label label-important">Imp: ' + x + '<\/div><\/div>').css({
position: 'absolute',
display: 'none',
top: y - 100,
width: 75,
left: x - 40,
border: '0px solid ##ccc',
padding: '2px 6px',
'background-color': '##fff',
}).appendTo("body").fadeIn(200);
}
$.plot($("##site_statistics"), [{
data: #finalTransList#,
label: "Transactions"
}, {
data: #finalListingsList#,
label: "Listings Posted"
}
], {
series: {
lines: {
show: true,
lineWidth: 2,
fill: true,
fillColor: {
colors: [{
opacity: 0.05
}, {
opacity: 0.01
}
]
}
},
points: {
show: true
},
shadowSize: 2
},
grid: {
hoverable: true,
clickable: true,
tickColor: "##eee",
borderWidth: 0
},
colors: ["##d12610", "##37b7f3", "##52e136"],
xaxis: {
ticks: 11,
tickDecimals: 0
},
yaxis: {
ticks: 11,
tickDecimals: 0
}
});
var previousPoint = null;
$("##site_statistics").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);
showTooltip('', item.pageX, item.pageY, item.series.label + " of " + x + " = " + y);
}
} else {
$("##tooltip").remove();
previousPoint = null;
}
});
</script>
data: [[30, 0],[29, 0],[28, 0],[27, 0],[26, 0],[25, 0],[24, 0],[23, 0],[22, 0],[21, 0],[20, 0],[19, 0],[18, 0],[17, 0],[16, 0],[15, 0],[14, 0],[13, 0],[12, 0],[11, 0],[10, 0],[9, 0],[8, 0],[7, 0],[6, 0],[5, 0],[4, 0],[3, 0],[2, 0],[1, 0]],
label: "Transactions"
}, {
data: [[30, 0],[29, 0],[28, 0],[27, 0],[26, 0],[25, 0],[24, 1],[23, 0],[22, 0],[21, 0],[20, 0],[19, 0],[18, 0],[17, 0],[16, 0],[15, 0],[14, 0],[13, 0],[12, 0],[11, 0],[10, 0],[9, 0],[8, 0],[7, 0],[6, 0],[5, 2],[4, 0],[3, 0],[2, 0],[1, 0]],
label: "Listings Posted"
}
JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.
TRUSTED BY
ASKER