File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -657,6 +657,7 @@ Customizing the grid
657657 markings: array of markings or (fn: axes -> array of markings)
658658 borderWidth: number
659659 borderColor: color or null
660+ minBorderMargin: number or null
660661 clickable: boolean
661662 hoverable: boolean
662663 autoHighlight: boolean
@@ -678,9 +679,14 @@ above the data or below (below is default).
678679line, and "axisMargin" is the space in pixels between axes when there
679680are two next to each other. Note that you can style the tick labels
680681with CSS, e.g. to change the color. They have class "tickLabel".
682+
681683"borderWidth" is the width of the border around the plot. Set it to 0
682684to disable the border. You can also set "borderColor" if you want the
683685border to have a different color than the grid lines.
686+ "minBorderMargin" controls the default minimum margin around the
687+ border - it's used to make sure that points aren't accidentally
688+ clipped by the canvas edge so by default the value is computed from
689+ the point radius.
684690
685691"markings" is used to draw simple lines and rectangular areas in the
686692background of the plot. You can either specify an array of ranges on
Original file line number Diff line number Diff line change @@ -92,6 +92,8 @@ Changes:
9292 isn't shown.
9393- New attribute $.plot.version with the Flot version as a string.
9494- The version comment is now included in the minified jquery.flot.min.js.
95+ - New options.grid.minBorderMargin for adjusting the minimum margin
96+ provided around the border (based on patch by corani, issue 188).
9597
9698- New hooks: drawSeries
9799
Original file line number Diff line number Diff line change 121121 labelMargin : 5 , // in pixels
122122 axisMargin : 8 , // in pixels
123123 borderWidth : 2 , // in pixels
124+ minBorderMargin : null , // in pixels, null means taken from points radius
124125 markings : null , // array of ranges or fn: axes -> array of ranges
125126 markingsColor : "#f4f4f4" ,
126127 markingsLineWidth : 2 ,
949950
950951 // make sure we've got enough space for things that
951952 // might stick out
952- var maxOutset = 0 ;
953- for ( i = 0 ; i < series . length ; ++ i )
954- maxOutset = Math . max ( maxOutset , 2 * ( series [ i ] . points . radius + series [ i ] . points . lineWidth / 2 ) ) ;
955-
953+ var minMargin = options . grid . minBorderMargin ;
954+ if ( minMargin == null ) {
955+ minMargin = 0 ;
956+ for ( i = 0 ; i < series . length ; ++ i )
957+ minMargin = Math . max ( minMargin , series [ i ] . points . radius + series [ i ] . points . lineWidth / 2 ) ;
958+ }
959+
956960 for ( var a in plotOffset ) {
957961 plotOffset [ a ] += options . grid . borderWidth ;
958- plotOffset [ a ] = Math . max ( maxOutset , plotOffset [ a ] ) ;
962+ plotOffset [ a ] = Math . max ( minMargin , plotOffset [ a ] ) ;
959963 }
960964 }
961965
You can’t perform that action at this time.
0 commit comments