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
fcd4bce6
Commit
fcd4bce6
authored
Jun 03, 2011
by
Ole Laursen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug when both label width and height is set (fix by Ara
Anjargolian)
parent
06c7d41a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
37 deletions
+35
-37
jquery.flot.js
jquery.flot.js
+35
-37
No files found.
jquery.flot.js
View file @
fcd4bce6
...
...
@@ -852,51 +852,49 @@
axisw
=
opts
.
labelWidth
||
0
,
axish
=
opts
.
labelHeight
||
0
,
f
=
axis
.
font
;
if
(
opts
.
labelWidth
==
null
||
opts
.
labelHeight
==
null
)
{
ctx
.
save
();
ctx
.
font
=
f
.
style
+
" "
+
f
.
variant
+
" "
+
f
.
weight
+
" "
+
f
.
size
+
"px '"
+
f
.
family
+
"'"
;
for
(
var
i
=
0
;
i
<
ticks
.
length
;
++
i
)
{
var
t
=
ticks
[
i
];
t
.
lines
=
[];
t
.
width
=
t
.
height
=
0
;
ctx
.
save
();
ctx
.
font
=
f
.
style
+
" "
+
f
.
variant
+
" "
+
f
.
weight
+
" "
+
f
.
size
+
"px '"
+
f
.
family
+
"'"
;
if
(
!
t
.
label
)
continue
;
for
(
var
i
=
0
;
i
<
ticks
.
length
;
++
i
)
{
var
t
=
ticks
[
i
];
t
.
lines
=
[];
t
.
width
=
t
.
height
=
0
;
// accept various kinds of newlines, including HTML ones
// (you can actually split directly on regexps in Javascript,
// but IE is unfortunately broken)
var
lines
=
t
.
label
.
replace
(
/<br
?\/?
>|
\r\n
|
\r
/g
,
"
\n
"
).
split
(
"
\n
"
);
for
(
var
j
=
0
;
j
<
lines
.
length
;
++
j
)
{
var
line
=
{
text
:
lines
[
j
]
},
m
=
ctx
.
measureText
(
line
.
text
);
line
.
width
=
m
.
width
;
// m.height might not be defined, not in the
// standard yet
line
.
height
=
m
.
height
!=
null
?
m
.
height
:
f
.
size
;
if
(
!
t
.
label
)
continue
;
// add a bit of margin since font rendering is
// not pixel perfect and cut off letters look
// bad, this also doubles as spacing between
// lines
line
.
height
+=
Math
.
round
(
f
.
size
*
0.15
);
// accept various kinds of newlines, including HTML ones
// (you can actually split directly on regexps in Javascript,
// but IE is unfortunately broken)
var
lines
=
t
.
label
.
replace
(
/<br
?\/?
>|
\r\n
|
\r
/g
,
"
\n
"
).
split
(
"
\n
"
);
for
(
var
j
=
0
;
j
<
lines
.
length
;
++
j
)
{
var
line
=
{
text
:
lines
[
j
]
},
m
=
ctx
.
measureText
(
line
.
text
);
line
.
width
=
m
.
width
;
// m.height might not be defined, not in the
// standard yet
line
.
height
=
m
.
height
!=
null
?
m
.
height
:
f
.
size
;
t
.
width
=
Math
.
max
(
line
.
width
,
t
.
width
);
t
.
height
+=
line
.
height
;
// add a bit of margin since font rendering is
// not pixel perfect and cut off letters look
// bad, this also doubles as spacing between
// lines
line
.
height
+=
Math
.
round
(
f
.
size
*
0.15
);
t
.
lines
.
push
(
line
);
}
t
.
width
=
Math
.
max
(
line
.
width
,
t
.
width
);
t
.
height
+=
line
.
height
;
if
(
opts
.
labelWidth
==
null
)
axisw
=
Math
.
max
(
axisw
,
t
.
width
);
if
(
opts
.
labelHeight
==
null
)
axish
=
Math
.
max
(
axish
,
t
.
height
);
t
.
lines
.
push
(
line
);
}
ctx
.
restore
();
if
(
opts
.
labelWidth
==
null
)
axisw
=
Math
.
max
(
axisw
,
t
.
width
);
if
(
opts
.
labelHeight
==
null
)
axish
=
Math
.
max
(
axish
,
t
.
height
);
}
ctx
.
restore
();
axis
.
labelWidth
=
Math
.
ceil
(
axisw
);
axis
.
labelHeight
=
Math
.
ceil
(
axish
);
...
...
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