Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
F
flot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HS-public
flot
Commits
e7de8735
Commit
e7de8735
authored
Feb 24, 2013
by
David Schnur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor out text layer creation to its own method.
This sets the stage for allowing the use of multiple layers.
parent
a036aa96
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
16 deletions
+30
-16
jquery.flot.js
jquery.flot.js
+30
-16
No files found.
jquery.flot.js
View file @
e7de8735
...
@@ -171,7 +171,7 @@ Licensed under the MIT license.
...
@@ -171,7 +171,7 @@ Licensed under the MIT license.
var
cache
=
this
.
_textCache
,
var
cache
=
this
.
_textCache
,
cacheHasText
=
false
,
cacheHasText
=
false
,
info
,
key
;
key
;
// Check whether the cache actually has any entries.
// Check whether the cache actually has any entries.
...
@@ -188,23 +188,13 @@ Licensed under the MIT license.
...
@@ -188,23 +188,13 @@ Licensed under the MIT license.
// Create the HTML text layer, if it doesn't already exist.
// Create the HTML text layer, if it doesn't already exist.
if
(
!
this
.
text
)
{
var
layer
=
this
.
getTextLayer
(),
this
.
text
=
$
(
"<div></div>"
)
info
;
.
addClass
(
"flot-text"
)
.
css
({
position
:
"absolute"
,
top
:
0
,
left
:
0
,
bottom
:
0
,
right
:
0
})
.
insertAfter
(
this
.
element
);
}
// Add all the elements to the text layer, then add it to the DOM at
// Add all the elements to the text layer, then add it to the DOM at
// the end, so we only trigger a single redraw.
// the end, so we only trigger a single redraw.
this
.
text
.
hide
();
layer
.
hide
();
for
(
key
in
cache
)
{
for
(
key
in
cache
)
{
if
(
hasOwnProperty
.
call
(
cache
,
key
))
{
if
(
hasOwnProperty
.
call
(
cache
,
key
))
{
...
@@ -213,7 +203,7 @@ Licensed under the MIT license.
...
@@ -213,7 +203,7 @@ Licensed under the MIT license.
if
(
info
.
active
)
{
if
(
info
.
active
)
{
if
(
!
info
.
rendered
)
{
if
(
!
info
.
rendered
)
{
this
.
text
.
append
(
info
.
element
);
layer
.
append
(
info
.
element
);
info
.
rendered
=
true
;
info
.
rendered
=
true
;
}
}
}
else
{
}
else
{
...
@@ -225,7 +215,31 @@ Licensed under the MIT license.
...
@@ -225,7 +215,31 @@ Licensed under the MIT license.
}
}
}
}
this
.
text
.
show
();
layer
.
show
();
};
// Creates (if necessary) and returns the text overlay container.
//
// @return {object} The jQuery-wrapped text-layer div.
Canvas
.
prototype
.
getTextLayer
=
function
()
{
// Create the text layer if it doesn't exist
if
(
!
this
.
text
)
{
this
.
text
=
$
(
"<div></div>"
)
.
addClass
(
"flot-text"
)
.
css
({
position
:
"absolute"
,
top
:
0
,
left
:
0
,
bottom
:
0
,
right
:
0
})
.
insertAfter
(
this
.
element
);
}
return
this
.
text
;
};
};
// Creates (if necessary) and returns a text info object.
// Creates (if necessary) and returns a text info object.
...
...
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