reports: Fix links from avail reports
[ninja.git] / application / views / histogram / js / histogram.js
blob859692bf8b414ff79179ed2d280ad4cedf7373ed
1 $(document).ready(function() {
2 $("#histogram_form").bind('submit', function() {
3 loopElements();
4 return check_form_values();
5 });
7 var previousPoint = null;
8 $("#histogram_graph").bind("plothover", function (event, pos, item) {
9 $("#x").text(pos.x.toFixed(2));
10 $("#y").text(pos.y.toFixed(2));
12 if (item) {
13 if (previousPoint != item.datapoint) {
14 previousPoint = item.datapoint;
16 $("#tooltip").remove();
17 var x = item.datapoint[0].toFixed(0),
18 y = item.datapoint[1].toFixed(0);
20 showTooltip(item.pageX, item.pageY,
21 item.series.label + ": " + y + " (" + get_label(x) + ")");
22 //item.series.label + " of " + get_label(x) + " = " + y);
24 } else {
25 $("#tooltip").remove();
26 previousPoint = null;
28 });
29 $("#report_period").bind('change', function() {
30 show_calendar($(this).attr('value'));
31 });
33 $('#show_all_objects').click(function() {
34 $('#all_objects').toggle('slow');
35 });
37 });
39 function get_label(x)
41 return graph_xlables[x];
44 function showTooltip(x, y, contents) {
45 $('<div id="tooltip">' + contents + '</div>').css( {
46 position: 'absolute',
47 display: 'none',
48 top: y + 5,
49 left: x + 5,
50 border: '1px solid #fdd',
51 padding: '2px',
52 'background-color': '#fee',
53 opacity: 0.80
54 }).appendTo("body").fadeIn(200);