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
4ee1e04e
Commit
4ee1e04e
authored
Apr 25, 2012
by
David Schnur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added processOffset and drawBackground hooks
parent
1a99246c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
6 deletions
+31
-6
API.txt
API.txt
+23
-4
jquery.flot.js
jquery.flot.js
+8
-2
No files found.
API.txt
View file @
4ee1e04e
...
@@ -919,8 +919,8 @@ can call:
...
@@ -919,8 +919,8 @@ can call:
- pointOffset({ x: xpos, y: ypos })
- pointOffset({ x: xpos, y: ypos })
Returns the calculated offset of the data point at (x, y) in data
Returns the calculated offset of the data point at (x, y) in data
space within the placeholder div. If you are working with multiple
axes, you
space within the placeholder div. If you are working with multiple
can specify the x and y axis references, e.g.
axes, you
can specify the x and y axis references, e.g.
o = pointOffset({ x: xpos, y: ypos, xaxis: 2, yaxis: 3 })
o = pointOffset({ x: xpos, y: ypos, xaxis: 2, yaxis: 3 })
// o.left and o.top now contains the offset within the div
// o.left and o.top now contains the offset within the div
...
@@ -1114,6 +1114,25 @@ hooks in the plugins bundled with Flot.
...
@@ -1114,6 +1114,25 @@ hooks in the plugins bundled with Flot.
doesn't check it or do any normalization on it afterwards.
doesn't check it or do any normalization on it afterwards.
- processOffset [phase 4]
function(plot, offset)
Called after Flot has initialized the plot's offset, but before it
draws any axes or plot elements. This hook is useful for customizing
the margins between the grid and the edge of the canvas. "offset" is
an object with attributes "top", "bottom", "left" and "right",
corresponding to the margins on the four sides of the plot.
- drawBackground [phase 5]
function(plot, canvascontext)
Called before all other drawing operations. Used to draw backgrounds
or other custom elements before the plot or axes have been draw.
- drawSeries [phase 5]
- drawSeries [phase 5]
function(plot, canvascontext, series)
function(plot, canvascontext, series)
...
@@ -1121,8 +1140,8 @@ hooks in the plugins bundled with Flot.
...
@@ -1121,8 +1140,8 @@ hooks in the plugins bundled with Flot.
Hook for custom drawing of a single series. Called just before the
Hook for custom drawing of a single series. Called just before the
standard drawing routine has been called in the loop that draws
standard drawing routine has been called in the loop that draws
each series.
each series.
- draw [phase 5]
- draw [phase 5]
function(plot, canvascontext)
function(plot, canvascontext)
...
...
jquery.flot.js
View file @
4ee1e04e
...
@@ -152,6 +152,8 @@
...
@@ -152,6 +152,8 @@
processOptions
:
[],
processOptions
:
[],
processRawData
:
[],
processRawData
:
[],
processDatapoints
:
[],
processDatapoints
:
[],
processOffset
:
[],
drawBackground
:
[],
drawSeries
:
[],
drawSeries
:
[],
draw
:
[],
draw
:
[],
bindEvents
:
[],
bindEvents
:
[],
...
@@ -1024,7 +1026,9 @@
...
@@ -1024,7 +1026,9 @@
// init plot offset
// init plot offset
for
(
var
a
in
plotOffset
)
for
(
var
a
in
plotOffset
)
plotOffset
[
a
]
=
showGrid
?
options
.
grid
.
borderWidth
:
0
;
plotOffset
[
a
]
=
showGrid
?
options
.
grid
.
borderWidth
:
0
;
executeHooks
(
hooks
.
processOffset
,
[
plotOffset
]);
// init axes
// init axes
$
.
each
(
axes
,
function
(
_
,
axis
)
{
$
.
each
(
axes
,
function
(
_
,
axis
)
{
axis
.
show
=
axis
.
options
.
show
;
axis
.
show
=
axis
.
options
.
show
;
...
@@ -1035,7 +1039,7 @@
...
@@ -1035,7 +1039,7 @@
setRange
(
axis
);
setRange
(
axis
);
});
});
if
(
showGrid
)
{
if
(
showGrid
)
{
// determine from the placeholder the font size ~ height of font ~ 1 em
// determine from the placeholder the font size ~ height of font ~ 1 em
var
fontDefaults
=
{
var
fontDefaults
=
{
...
@@ -1441,6 +1445,8 @@
...
@@ -1441,6 +1445,8 @@
function
draw
()
{
function
draw
()
{
ctx
.
clearRect
(
0
,
0
,
canvasWidth
,
canvasHeight
);
ctx
.
clearRect
(
0
,
0
,
canvasWidth
,
canvasHeight
);
executeHooks
(
hooks
.
drawBackground
,
[
ctx
]);
var
grid
=
options
.
grid
;
var
grid
=
options
.
grid
;
// draw background, if any
// draw background, if any
...
...
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