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
5fcb64ff
Commit
5fcb64ff
authored
Nov 08, 2012
by
ara818
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support different border color, widths for each side of the chart
parent
4fd15472
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
14 deletions
+57
-14
API.md
API.md
+10
-8
jquery.flot.js
jquery.flot.js
+47
-6
No files found.
API.md
View file @
5fcb64ff
...
...
@@ -790,8 +790,8 @@ grid: {
labelMargin
:
number
axisMargin
:
number
markings
:
array
of
markings
or
(
fn
:
axes
->
array
of
markings
)
borderWidth
:
number
borderColor
:
color
or
null
borderWidth
:
number
or
object
with
"top"
,
"right"
,
"bottom"
and
"left"
properties
with
different
widths
borderColor
:
color
or
null
or
object
with
"top"
,
"right"
,
"bottom"
and
"left"
properties
with
different
colors
minBorderMargin
:
number
or
null
clickable
:
boolean
hoverable
:
boolean
...
...
@@ -833,12 +833,14 @@ line, and "axisMargin" is the space in pixels between axes when there
are two next to each other.
"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.
to disable the border. Set it to an object with "top", "right",
"bottom" and "left" properties to use different widths. You can
also set "borderColor" if you want the border to have a different color
than the grid lines. Set it to an object with "top", "right", "bottom"
and "left" properties to use different colors. "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
...
...
jquery.flot.js
View file @
5fcb64ff
...
...
@@ -1110,8 +1110,14 @@
// If the grid is visible, add its border width to the offset
for
(
var
a
in
plotOffset
)
plotOffset
[
a
]
+=
showGrid
?
options
.
grid
.
borderWidth
:
0
;
for
(
var
a
in
plotOffset
)
{
if
(
typeof
(
options
.
grid
.
borderWidth
)
==
"object"
)
{
plotOffset
[
a
]
=
showGrid
?
options
.
grid
.
borderWidth
[
a
]
:
0
;
}
else
{
plotOffset
[
a
]
=
showGrid
?
options
.
grid
.
borderWidth
:
0
;
}
}
// init axes
$
.
each
(
axes
,
function
(
_
,
axis
)
{
...
...
@@ -1573,7 +1579,8 @@
if
(
v
<
axis
.
min
||
v
>
axis
.
max
// skip those lying on the axes if we got a border
||
(
t
==
"full"
&&
bw
>
0
||
(
t
==
"full"
&&
((
typeof
bw
==
"object"
&&
bw
[
axis
.
position
]
>
0
)
||
bw
>
0
)
&&
(
v
==
axis
.
min
||
v
==
axis
.
max
)))
continue
;
...
...
@@ -1609,9 +1616,43 @@
// draw border
if
(
bw
)
{
ctx
.
lineWidth
=
bw
;
ctx
.
strokeStyle
=
options
.
grid
.
borderColor
;
ctx
.
strokeRect
(
-
bw
/
2
,
-
bw
/
2
,
plotWidth
+
bw
,
plotHeight
+
bw
);
// If either borderWidth or borderColor is an object, then draw the border
// line by line instead of as one rectangle
bc
=
options
.
grid
.
borderColor
;
if
(
typeof
bw
==
"object"
||
typeof
bc
==
"object"
)
{
ctx
.
beginPath
();
ctx
.
strokeStyle
=
(
typeof
bc
==
"object"
?
bc
.
top
:
bc
);
ctx
.
lineWidth
=
(
typeof
bw
==
"object"
?
bw
.
top
:
bw
);
ctx
.
moveTo
(
0
-
bw
.
left
,
0
-
bw
.
top
/
2
);
ctx
.
lineTo
(
plotWidth
,
0
-
bw
.
top
/
2
);
ctx
.
stroke
();
ctx
.
beginPath
();
ctx
.
strokeStyle
=
(
typeof
bc
==
"object"
?
bc
.
right
:
bc
);
ctx
.
lineWidth
=
(
typeof
bw
==
"object"
?
bw
.
right
:
bw
)
ctx
.
moveTo
(
plotWidth
+
bw
.
right
/
2
,
0
-
bw
.
top
);
ctx
.
lineTo
(
plotWidth
+
bw
.
right
/
2
,
plotHeight
);
ctx
.
stroke
();
ctx
.
beginPath
();
ctx
.
strokeStyle
=
(
typeof
bc
==
"object"
?
bc
.
bottom
:
bc
);
ctx
.
lineWidth
=
(
typeof
bw
==
"object"
?
bw
.
bottom
:
bw
)
ctx
.
moveTo
(
plotWidth
+
bw
.
right
,
plotHeight
+
bw
.
bottom
/
2
);
ctx
.
lineTo
(
0
,
plotHeight
+
bw
.
bottom
/
2
);
ctx
.
stroke
();
ctx
.
beginPath
();
ctx
.
strokeStyle
=
(
typeof
bc
==
"object"
?
bc
.
left
:
bc
);
ctx
.
lineWidth
=
(
typeof
bw
==
"object"
?
bw
.
left
:
bw
)
ctx
.
moveTo
(
0
-
bw
.
left
/
2
,
plotHeight
+
bw
.
bottom
);
ctx
.
lineTo
(
0
-
bw
.
left
/
2
,
0
);
ctx
.
stroke
();
}
else
{
ctx
.
lineWidth
=
bw
;
ctx
.
strokeStyle
=
options
.
grid
.
borderColor
;
ctx
.
strokeRect
(
-
bw
/
2
,
-
bw
/
2
,
plotWidth
+
bw
,
plotHeight
+
bw
);
}
}
ctx
.
restore
();
...
...
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