New options.grid.minBorderMargin for adjusting the minimum margin provided around the border (based on patch by corani, issue 188)

git-svn-id: https://flot.googlecode.com/svn/trunk@315 1e0a6537-2640-0410-bfb7-f154510ff394
pull/1/head
olau@iola.dk 15 years ago
parent 23316cfa63
commit fbe4273b6e

@ -657,6 +657,7 @@ Customizing the grid
markings: array of markings or (fn: axes -> array of markings)
borderWidth: number
borderColor: color or null
minBorderMargin: number or null
clickable: boolean
hoverable: boolean
autoHighlight: boolean
@ -678,9 +679,14 @@ above the data or below (below is default).
line, and "axisMargin" is the space in pixels between axes when there
are two next to each other. Note that you can style the tick labels
with CSS, e.g. to change the color. They have class "tickLabel".
"borderWidth" is the width of the border around the plot. Set it to 0
to disable the border. You can also set "borderColor" if you want the
border to have a different color than the grid lines.
"minBorderMargin" controls the default minimum margin around the
border - it's used to make sure that points aren't accidentally
clipped by the canvas edge so by default the value is computed from
the point radius.
"markings" is used to draw simple lines and rectangular areas in the
background of the plot. You can either specify an array of ranges on

@ -92,6 +92,8 @@ Changes:
isn't shown.
- New attribute $.plot.version with the Flot version as a string.
- The version comment is now included in the minified jquery.flot.min.js.
- New options.grid.minBorderMargin for adjusting the minimum margin
provided around the border (based on patch by corani, issue 188).
- New hooks: drawSeries

@ -121,6 +121,7 @@
labelMargin: 5, // in pixels
axisMargin: 8, // in pixels
borderWidth: 2, // in pixels
minBorderMargin: null, // in pixels, null means taken from points radius
markings: null, // array of ranges or fn: axes -> array of ranges
markingsColor: "#f4f4f4",
markingsLineWidth: 2,
@ -949,13 +950,16 @@
// make sure we've got enough space for things that
// might stick out
var maxOutset = 0;
for (i = 0; i < series.length; ++i)
maxOutset = Math.max(maxOutset, 2 * (series[i].points.radius + series[i].points.lineWidth/2));
var minMargin = options.grid.minBorderMargin;
if (minMargin == null) {
minMargin = 0;
for (i = 0; i < series.length; ++i)
minMargin = Math.max(minMargin, series[i].points.radius + series[i].points.lineWidth/2);
}
for (var a in plotOffset) {
plotOffset[a] += options.grid.borderWidth;
plotOffset[a] = Math.max(maxOutset, plotOffset[a]);
plotOffset[a] = Math.max(minMargin, plotOffset[a]);
}
}

Loading…
Cancel
Save