1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
function initGraph(response) {
if (response) {
data = response.data;
units = response.units;
if ("logic" == response.result_type) {
/** @type {boolean} */
steps = true;
/** @type {boolean} */
showlist = false;
} else {
/** @type {boolean} */
steps = false;
/** @type {boolean} */
showlist = false;
}
} else {
/** @type {!Array} */
var data = [];
/** @type {string} */
var units = "";
/** @type {boolean} */
var steps = false;
/** @type {boolean} */
var showlist = false;
}
var options = {
xaxis: {
mode: "time",
zoomRange: [3E4, 2592E6]
},
yaxis: {
tickFormatter: function (n) {
/** @type {string} */
var currElevationTxt = "";
return response && (currElevationTxt = Math.round(100 * n) / 100 + " " + units), currElevationTxt;
},
zoomRange: [0, 0],
panRange: false
},
selection: {
mode: "x"
},
crosshair: {
mode: "x"
},
lines: {
show: true,
lineWidth: 1,
fill: true,
fillColor: "rgba(43,130,212,0.3)",
steps: steps
},
series: {
lines: {
show: true
},
points: {
show: showlist,
radius: 1
}
},
colors: ["#2b82d4"],
grid: {
hoverable: true,
autoHighlight: true,
clickable: true
},
zoom: {
animate: true,
trigger: "dblclick",
amount: 3
},
pan: {
interactive: false,
animate: true
}
};
historyGraphPlot = $.plot($("#bottom_panel_graph_plot"), [data], options);
$("#bottom_panel_graph_plot").unbind("plothover");
$("#bottom_panel_graph_plot").bind("plothover", function (canCreateDiscussions, isSlidingUp, item) {
if (item) {
var fifth = item.datapoint[0];
var name = historyRouteData.graph.data_index[fifth];
var txtCountVal = historyRouteData.route[name].dt_tracker;
/** @type {string} */
document.getElementById("bottom_panel_graph_label").innerHTML = data[name][1] + " " + units + " - " + txtCountVal;
}
});
$("#bottom_panel_graph_plot").unbind("plotselected");
$("#bottom_panel_graph_plot").bind("plotselected", function (canCreateDiscussions, s) {
historyGraphPlot = $.plot($("#bottom_panel_graph_plot"), [data], $.extend(true, {}, options, {
xaxis: {
min: s.xaxis.from,
max: s.xaxis.to
}
}));
});
$("#bottom_panel_graph_plot").unbind("plotclick");
$("#bottom_panel_graph_plot").bind("plotclick", function (canCreateDiscussions, isSlidingUp, item) {
if (item) {
var fingerprint = item.datapoint[0];
var key = historyRouteData.graph.data_index[fingerprint];
var txtCountVal = historyRouteData.route[key].dt_tracker;
/** @type {string} */
document.getElementById("bottom_panel_graph_label").innerHTML = data[key][1] + " " + units + " - " + txtCountVal;
historyRouteData.play.position = key;
historyRoutePanToPoint(key);
historyRouteAddPointMarkerToMap(key);
if (0 == historyRouteData.play.status) {
historyRouteShowPoint(key, true);
}
}
});
} |
Partager