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
08d5bfad
Commit
08d5bfad
authored
Nov 26, 2013
by
David Schnur
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1200 from dnschnur/xaxis-plot-size-fix
Don't add padding when there's no last tick.
parents
968271a4
1650c184
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
jquery.flot.js
jquery.flot.js
+25
-9
No files found.
jquery.flot.js
View file @
08d5bfad
...
...
@@ -1497,7 +1497,7 @@ Licensed under the MIT license.
// inside the canvas and isn't clipped off
var
minMargin
=
options
.
grid
.
minBorderMargin
,
margins
=
{
x
:
0
,
y
:
0
},
i
,
axis
;
axis
,
i
;
// check stuff from the plot (FIXME: this should just read
// a value from the series, otherwise it's impossible to
...
...
@@ -1508,21 +1508,37 @@ Licensed under the MIT license.
minMargin
=
Math
.
max
(
minMargin
,
2
*
(
series
[
i
].
points
.
radius
+
series
[
i
].
points
.
lineWidth
/
2
));
}
margins
.
x
=
margins
.
y
=
Math
.
ceil
(
minMargin
);
var
margins
=
{
left
:
minMargin
,
right
:
minMargin
,
top
:
minMargin
,
bottom
:
minMargin
};
// check axis labels, note we don't check the actual
// labels but instead use the overall width/height to not
// jump as much around with replots
$
.
each
(
allAxes
(),
function
(
_
,
axis
)
{
var
dir
=
axis
.
direction
;
if
(
axis
.
reserveSpace
)
margins
[
dir
]
=
Math
.
ceil
(
Math
.
max
(
margins
[
dir
],
(
dir
==
"x"
?
axis
.
labelWidth
:
axis
.
labelHeight
)
/
2
));
var
lastTick
=
axis
.
ticks
[
axis
.
ticks
.
length
-
1
];
if
(
axis
.
reserveSpace
&&
lastTick
)
{
if
(
axis
.
direction
===
"x"
)
{
margins
.
left
=
Math
.
max
(
margins
.
left
,
axis
.
labelWidth
/
2
);
if
(
lastTick
.
v
<=
axis
.
max
)
{
margins
.
right
=
Math
.
max
(
margins
.
right
,
axis
.
labelWidth
/
2
);
}
}
else
{
margins
.
bottom
=
Math
.
max
(
margins
.
bottom
,
axis
.
labelHeight
/
2
);
if
(
lastTick
.
v
<=
axis
.
max
)
{
margins
.
top
=
Math
.
max
(
margins
.
top
,
axis
.
labelHeight
/
2
);
}
}
}
});
plotOffset
.
left
=
Math
.
max
(
margins
.
x
,
plotOffset
.
left
);
plotOffset
.
right
=
Math
.
max
(
margins
.
x
,
plotOffset
.
right
);
plotOffset
.
top
=
Math
.
max
(
margins
.
y
,
plotOffset
.
top
);
plotOffset
.
bottom
=
Math
.
max
(
margins
.
y
,
plotOffset
.
bottom
);
plotOffset
.
left
=
Math
.
ceil
(
Math
.
max
(
margins
.
left
,
plotOffset
.
left
)
);
plotOffset
.
right
=
Math
.
ceil
(
Math
.
max
(
margins
.
right
,
plotOffset
.
right
)
);
plotOffset
.
top
=
Math
.
ceil
(
Math
.
max
(
margins
.
top
,
plotOffset
.
top
)
);
plotOffset
.
bottom
=
Math
.
ceil
(
Math
.
max
(
margins
.
bottom
,
plotOffset
.
bottom
)
);
}
function
setupGrid
()
{
...
...
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