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
07598593
Commit
07598593
authored
Apr 27, 2012
by
David Schnur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a grid.margin option
parent
4ee1e04e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
3 deletions
+29
-3
API.txt
API.txt
+12
-0
NEWS.txt
NEWS.txt
+5
-0
jquery.flot.js
jquery.flot.js
+12
-3
No files found.
API.txt
View file @
07598593
...
...
@@ -667,6 +667,7 @@ Customizing the grid
aboveData: boolean
color: color
backgroundColor: color/gradient or null
margin: number or margin object
labelMargin: number
axisMargin: number
markings: array of markings or (fn: axes -> array of markings)
...
...
@@ -694,6 +695,17 @@ You can turn off the whole grid including tick labels by setting
"show" to false. "aboveData" determines whether the grid is drawn
above the data or below (below is default).
"margin" is the space in pixels between the canvas edge and the grid,
which can be either a number or an object with individual margins for
each side, in the form:
margin: {
top: top margin in pixels
left: left margin in pixels
bottom: bottom margin in pixels
right: right margin in pixels
}
"labelMargin" is the space in pixels between tick labels and axis
line, and "axisMargin" is the space in pixels between axes when there
are two next to each other.
...
...
NEWS.txt
View file @
07598593
...
...
@@ -30,6 +30,11 @@ Changes:
- Tick generators now get the whole axis rather than just min/max.
- Added processOffset and drawBackground hooks (suggested in issue 639).
- Added a grid "margin" option to set the space between the canvas edge
and the grid.
Bug fixes
- Fix problem with null values and pie plugin (patch by gcruxifix,
...
...
jquery.flot.js
View file @
07598593
...
...
@@ -122,6 +122,7 @@
backgroundColor
:
null
,
// null for transparent, else color
borderColor
:
null
,
// set if different from the grid color
tickColor
:
null
,
// color for the ticks, e.g. "rgba(0,0,0,0.15)"
margin
:
0
,
// distance from the canvas edge to the grid
labelMargin
:
5
,
// in pixels
axisMargin
:
8
,
// in pixels
borderWidth
:
2
,
// in pixels
...
...
@@ -1023,12 +1024,20 @@
function
setupGrid
()
{
var
i
,
axes
=
allAxes
(),
showGrid
=
options
.
grid
.
show
;
// init plot offset
for
(
var
a
in
plotOffset
)
plotOffset
[
a
]
=
showGrid
?
options
.
grid
.
borderWidth
:
0
;
// Initialize the plot's offset from the edge of the canvas
for
(
var
a
in
plotOffset
)
{
var
margin
=
options
.
grid
.
margin
||
0
;
plotOffset
[
a
]
=
typeof
margin
==
"number"
?
margin
:
margin
[
a
]
||
0
;
}
executeHooks
(
hooks
.
processOffset
,
[
plotOffset
]);
// If the grid is visible, add its border width to the offset
for
(
var
a
in
plotOffset
)
plotOffset
[
a
]
+=
showGrid
?
options
.
grid
.
borderWidth
:
0
;
// init axes
$
.
each
(
axes
,
function
(
_
,
axis
)
{
axis
.
show
=
axis
.
options
.
show
;
...
...
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