Commit fbe4273b authored by olau@iola.dk's avatar olau@iola.dk

New options.grid.minBorderMargin for adjusting the minimum margin provided...

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
parent 23316cfa
...@@ -657,6 +657,7 @@ Customizing the grid ...@@ -657,6 +657,7 @@ Customizing the grid
markings: array of markings or (fn: axes -> array of markings) markings: array of markings or (fn: axes -> array of markings)
borderWidth: number borderWidth: number
borderColor: color or null borderColor: color or null
minBorderMargin: number or null
clickable: boolean clickable: boolean
hoverable: boolean hoverable: boolean
autoHighlight: boolean autoHighlight: boolean
...@@ -678,9 +679,14 @@ above the data or below (below is default). ...@@ -678,9 +679,14 @@ above the data or below (below is default).
line, and "axisMargin" is the space in pixels between axes when there 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 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". 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 "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 to disable the border. You can also set "borderColor" if you want the
border to have a different color than the grid lines. 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 "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 background of the plot. You can either specify an array of ranges on
......
...@@ -92,6 +92,8 @@ Changes: ...@@ -92,6 +92,8 @@ Changes:
isn't shown. isn't shown.
- New attribute $.plot.version with the Flot version as a string. - New attribute $.plot.version with the Flot version as a string.
- The version comment is now included in the minified jquery.flot.min.js. - 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 - New hooks: drawSeries
......
...@@ -121,6 +121,7 @@ ...@@ -121,6 +121,7 @@
labelMargin: 5, // in pixels labelMargin: 5, // in pixels
axisMargin: 8, // in pixels axisMargin: 8, // in pixels
borderWidth: 2, // 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 markings: null, // array of ranges or fn: axes -> array of ranges
markingsColor: "#f4f4f4", markingsColor: "#f4f4f4",
markingsLineWidth: 2, markingsLineWidth: 2,
...@@ -949,13 +950,16 @@ ...@@ -949,13 +950,16 @@
// make sure we've got enough space for things that // make sure we've got enough space for things that
// might stick out // might stick out
var maxOutset = 0; var minMargin = options.grid.minBorderMargin;
if (minMargin == null) {
minMargin = 0;
for (i = 0; i < series.length; ++i) for (i = 0; i < series.length; ++i)
maxOutset = Math.max(maxOutset, 2 * (series[i].points.radius + series[i].points.lineWidth/2)); minMargin = Math.max(minMargin, series[i].points.radius + series[i].points.lineWidth/2);
}
for (var a in plotOffset) { for (var a in plotOffset) {
plotOffset[a] += options.grid.borderWidth; plotOffset[a] += options.grid.borderWidth;
plotOffset[a] = Math.max(maxOutset, plotOffset[a]); plotOffset[a] = Math.max(minMargin, plotOffset[a]);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment