-$.plot(
- $("#dmg-graph"),
- [ { label: 'average', data: avgs, hoverable: true, clickable: false },
- { label: 'efficiency', data: dmgs, lines: {show:true}, points: {show:false}, hoverable: true, clickable: true }, ],
- { yaxis: {ticks: 10, min: 0 },
- xaxis: {ticks: games},
- grid: { hoverable: true, clickable: true },
- });
- }
-
- function showTooltip(x, y, contents) {
- $('<div id="tooltip">' + contents + '</div>').css( {
- position: 'absolute',
- display: 'none',
- top: y - 35,
- left: x + 10,
- border: '1px solid #fdd',
- padding: '2px',
- 'background-color': '#333333',
- opacity: 0.80
- }).appendTo("body").fadeIn(200);
- }
-
- var previousPoint = null;
- var previousLabel = null;
- $('#acc-graph').bind("plothover", function (event, pos, item) {
- if (item) {
- if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) {
- previousLabel = item.series.label;
- previousPoint = item.dataIndex;
-
- $("#tooltip").remove();
- var x = item.datapoint[0].toFixed(2),
- y = item.datapoint[1].toFixed(2);
-
- showTooltip(item.pageX, item.pageY, y + "%");
- }
- }
- else {
- $("#tooltip").remove();
- previousPoint = null;
- previousLabel = null;
- }
- });
-
- $('#dmg-graph').bind("plothover", function (event, pos, item) {
- if (item) {
- if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) {
- previousPoint = item.dataIndex;
- previousLabel = item.series.label;
-
- $("#tooltip").remove();
- var x = item.datapoint[0].toFixed(2),
- y = item.datapoint[1].toFixed(2);
-
- showTooltip(item.pageX, item.pageY, y);
- }
- }
- else {
- $("#tooltip").remove();
- previousPoint = null;
- previousLabel = null;
- }
- });
-
-// bind click events to the weapon images
-$(".acc-weap").click(function () {
- var dataurl = $(this).find('a').attr('href');
-
- $('.accuracy-nav').find('.weapon-active').removeClass('weapon-active');
- $(this).addClass('weapon-active');
-
- $.ajax({
- url: dataurl,
- method: 'GET',
- dataType: 'json',
- success: plot_acc_graph
- });