Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
82eebf64
Commit
82eebf64
authored
Jul 13, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(graph): Fix so that zoom works even when no data exists, fixes #5570
parent
cc5c4511
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
13 deletions
+22
-13
public/vendor/flot/jquery.flot.selection.js
+22
-13
No files found.
public/vendor/flot/jquery.flot.selection.js
View file @
82eebf64
...
@@ -94,11 +94,11 @@ The plugin allso adds the following methods to the plot object:
...
@@ -94,11 +94,11 @@ The plugin allso adds the following methods to the plot object:
var
savedhandlers
=
{};
var
savedhandlers
=
{};
var
mouseUpHandler
=
null
;
var
mouseUpHandler
=
null
;
function
onMouseMove
(
e
)
{
function
onMouseMove
(
e
)
{
if
(
selection
.
active
)
{
if
(
selection
.
active
)
{
updateSelection
(
e
);
updateSelection
(
e
);
plot
.
getPlaceholder
().
trigger
(
"plotselecting"
,
[
getSelection
()
]);
plot
.
getPlaceholder
().
trigger
(
"plotselecting"
,
[
getSelection
()
]);
}
}
}
}
...
@@ -106,7 +106,7 @@ The plugin allso adds the following methods to the plot object:
...
@@ -106,7 +106,7 @@ The plugin allso adds the following methods to the plot object:
function
onMouseDown
(
e
)
{
function
onMouseDown
(
e
)
{
if
(
e
.
which
!=
1
)
// only accept left-click
if
(
e
.
which
!=
1
)
// only accept left-click
return
;
return
;
// cancel out any text selections
// cancel out any text selections
document
.
body
.
focus
();
document
.
body
.
focus
();
...
@@ -127,13 +127,13 @@ The plugin allso adds the following methods to the plot object:
...
@@ -127,13 +127,13 @@ The plugin allso adds the following methods to the plot object:
// this is a bit silly, but we have to use a closure to be
// this is a bit silly, but we have to use a closure to be
// able to whack the same handler again
// able to whack the same handler again
mouseUpHandler
=
function
(
e
)
{
onMouseUp
(
e
);
};
mouseUpHandler
=
function
(
e
)
{
onMouseUp
(
e
);
};
$
(
document
).
one
(
"mouseup"
,
mouseUpHandler
);
$
(
document
).
one
(
"mouseup"
,
mouseUpHandler
);
}
}
function
onMouseUp
(
e
)
{
function
onMouseUp
(
e
)
{
mouseUpHandler
=
null
;
mouseUpHandler
=
null
;
// revert drag stuff for old-school browsers
// revert drag stuff for old-school browsers
if
(
document
.
onselectstart
!==
undefined
)
if
(
document
.
onselectstart
!==
undefined
)
document
.
onselectstart
=
savedhandlers
.
onselectstart
;
document
.
onselectstart
=
savedhandlers
.
onselectstart
;
...
@@ -158,13 +158,22 @@ The plugin allso adds the following methods to the plot object:
...
@@ -158,13 +158,22 @@ The plugin allso adds the following methods to the plot object:
function
getSelection
()
{
function
getSelection
()
{
if
(
!
selectionIsSane
())
if
(
!
selectionIsSane
())
return
null
;
return
null
;
if
(
!
selection
.
show
)
return
null
;
if
(
!
selection
.
show
)
return
null
;
var
r
=
{},
c1
=
selection
.
first
,
c2
=
selection
.
second
;
var
r
=
{},
c1
=
selection
.
first
,
c2
=
selection
.
second
;
$
.
each
(
plot
.
getAxes
(),
function
(
name
,
axis
)
{
var
axes
=
plot
.
getAxes
();
if
(
axis
.
used
)
{
// look if no axis is used
var
p1
=
axis
.
c2p
(
c1
[
axis
.
direction
]),
p2
=
axis
.
c2p
(
c2
[
axis
.
direction
]);
var
noAxisInUse
=
true
;
$
.
each
(
axes
,
function
(
name
,
axis
)
{
if
(
axis
.
used
)
{
anyUsed
=
false
;
}
})
$
.
each
(
axes
,
function
(
name
,
axis
)
{
if
(
axis
.
used
||
noAxisInUse
)
{
var
p1
=
axis
.
c2p
(
c1
[
axis
.
direction
]),
p2
=
axis
.
c2p
(
c2
[
axis
.
direction
]);
r
[
name
]
=
{
from
:
Math
.
min
(
p1
,
p2
),
to
:
Math
.
max
(
p1
,
p2
)
};
r
[
name
]
=
{
from
:
Math
.
min
(
p1
,
p2
),
to
:
Math
.
max
(
p1
,
p2
)
};
}
}
});
});
...
@@ -252,10 +261,10 @@ The plugin allso adds the following methods to the plot object:
...
@@ -252,10 +261,10 @@ The plugin allso adds the following methods to the plot object:
from
=
to
;
from
=
to
;
to
=
tmp
;
to
=
tmp
;
}
}
return
{
from
:
from
,
to
:
to
,
axis
:
axis
};
return
{
from
:
from
,
to
:
to
,
axis
:
axis
};
}
}
function
setSelection
(
ranges
,
preventEvent
)
{
function
setSelection
(
ranges
,
preventEvent
)
{
var
axis
,
range
,
o
=
plot
.
getOptions
();
var
axis
,
range
,
o
=
plot
.
getOptions
();
...
@@ -333,11 +342,11 @@ The plugin allso adds the following methods to the plot object:
...
@@ -333,11 +342,11 @@ The plugin allso adds the following methods to the plot object:
ctx
.
restore
();
ctx
.
restore
();
}
}
});
});
plot
.
hooks
.
shutdown
.
push
(
function
(
plot
,
eventHolder
)
{
plot
.
hooks
.
shutdown
.
push
(
function
(
plot
,
eventHolder
)
{
eventHolder
.
unbind
(
"mousemove"
,
onMouseMove
);
eventHolder
.
unbind
(
"mousemove"
,
onMouseMove
);
eventHolder
.
unbind
(
"mousedown"
,
onMouseDown
);
eventHolder
.
unbind
(
"mousedown"
,
onMouseDown
);
if
(
mouseUpHandler
)
if
(
mouseUpHandler
)
$
(
document
).
unbind
(
"mouseup"
,
mouseUpHandler
);
$
(
document
).
unbind
(
"mouseup"
,
mouseUpHandler
);
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment