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
6e76ffff
Commit
6e76ffff
authored
Oct 22, 2013
by
David Schnur
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1168 from ameyms/0.9-use-jq-isNumeric
A new isNumeric function instead of typeof number
parents
7aeaf99c
77405d86
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
jquery.flot.js
jquery.flot.js
+17
-11
No files found.
jquery.flot.js
View file @
6e76ffff
...
@@ -7,6 +7,12 @@ Licensed under the MIT license.
...
@@ -7,6 +7,12 @@ Licensed under the MIT license.
(
function
(
$
)
{
(
function
(
$
)
{
// A jquery-esque isNumeric method since we currently support 1.4.4
// and $.isNumeric was introduced on in 1.7
var
isNumeric
=
$
.
isNumeric
||
function
(
obj
)
{
return
obj
-
parseFloat
(
obj
)
>=
0
;
};
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// The Canvas object is a wrapper around an HTML5 <canvas> tag.
// The Canvas object is a wrapper around an HTML5 <canvas> tag.
//
//
...
@@ -1012,7 +1018,7 @@ Licensed under the MIT license.
...
@@ -1012,7 +1018,7 @@ Licensed under the MIT license.
if
(
typeof
a
===
"object"
)
{
// if we got a real axis, extract number
if
(
typeof
a
===
"object"
)
{
// if we got a real axis, extract number
a
=
a
.
n
;
a
=
a
.
n
;
}
}
if
(
typeof
a
!==
"number"
)
{
if
(
!
isNumeric
(
a
)
)
{
a
=
1
;
// default to first axis
a
=
1
;
// default to first axis
}
}
return
a
;
return
a
;
...
@@ -1110,7 +1116,7 @@ Licensed under the MIT license.
...
@@ -1110,7 +1116,7 @@ Licensed under the MIT license.
var
sc
=
series
[
i
].
color
;
var
sc
=
series
[
i
].
color
;
if
(
sc
!=
null
)
{
if
(
sc
!=
null
)
{
neededColors
--
;
neededColors
--
;
if
(
typeof
sc
===
"number"
&&
sc
>
maxIndex
)
{
if
(
isNumeric
(
sc
)
&&
sc
>
maxIndex
)
{
maxIndex
=
sc
;
maxIndex
=
sc
;
}
}
}
}
...
@@ -1166,7 +1172,7 @@ Licensed under the MIT license.
...
@@ -1166,7 +1172,7 @@ Licensed under the MIT license.
if
(
s
.
color
==
null
)
{
if
(
s
.
color
==
null
)
{
s
.
color
=
colors
[
colori
].
toString
();
s
.
color
=
colors
[
colori
].
toString
();
++
colori
;
++
colori
;
}
else
if
(
typeof
s
.
color
===
"number"
)
{
}
else
if
(
isNumeric
(
s
.
color
)
)
{
s
.
color
=
colors
[
s
.
color
].
toString
();
s
.
color
=
colors
[
s
.
color
].
toString
();
}
}
...
@@ -1704,7 +1710,7 @@ Licensed under the MIT license.
...
@@ -1704,7 +1710,7 @@ Licensed under the MIT license.
for
(
a
in
plotOffset
)
{
for
(
a
in
plotOffset
)
{
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
plotOffset
,
a
))
{
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
plotOffset
,
a
))
{
plotOffset
[
a
]
=
typeof
margin
===
"number"
?
margin
:
margin
[
a
]
||
0
;
plotOffset
[
a
]
=
isNumeric
(
margin
)
?
margin
:
margin
[
a
]
||
0
;
}
}
}
}
...
@@ -1822,7 +1828,7 @@ Licensed under the MIT license.
...
@@ -1822,7 +1828,7 @@ Licensed under the MIT license.
// estimate number of ticks
// estimate number of ticks
var
noTicks
;
var
noTicks
;
if
(
typeof
opts
.
ticks
===
"number"
&&
opts
.
ticks
>
0
)
{
if
(
isNumeric
(
opts
.
ticks
)
&&
opts
.
ticks
>
0
)
{
noTicks
=
opts
.
ticks
;
noTicks
=
opts
.
ticks
;
}
else
{
}
else
{
// heuristic based on the model a*sqrt(x) fitted to
// heuristic based on the model a*sqrt(x) fitted to
...
@@ -1964,7 +1970,7 @@ Licensed under the MIT license.
...
@@ -1964,7 +1970,7 @@ Licensed under the MIT license.
function
setTicks
(
axis
)
{
function
setTicks
(
axis
)
{
var
oticks
=
axis
.
options
.
ticks
,
ticks
=
[];
var
oticks
=
axis
.
options
.
ticks
,
ticks
=
[];
if
(
oticks
==
null
||
(
typeof
oticks
===
"number"
&&
oticks
>
0
))
{
if
(
oticks
==
null
||
(
isNumeric
(
oticks
)
&&
oticks
>
0
))
{
ticks
=
axis
.
tickGenerator
(
axis
);
ticks
=
axis
.
tickGenerator
(
axis
);
}
else
if
(
oticks
)
{
}
else
if
(
oticks
)
{
if
(
$
.
isFunction
(
oticks
))
{
if
(
$
.
isFunction
(
oticks
))
{
...
@@ -2902,7 +2908,7 @@ Licensed under the MIT license.
...
@@ -2902,7 +2908,7 @@ Licensed under the MIT license.
}
}
var
c
=
$
.
color
.
parse
(
seriesColor
);
var
c
=
$
.
color
.
parse
(
seriesColor
);
c
.
a
=
typeof
fill
===
"number"
?
fill
:
0.4
;
c
.
a
=
isNumeric
(
fill
)
?
fill
:
0.4
;
c
.
normalize
();
c
.
normalize
();
return
c
.
toString
();
return
c
.
toString
();
}
}
...
@@ -3222,11 +3228,11 @@ Licensed under the MIT license.
...
@@ -3222,11 +3228,11 @@ Licensed under the MIT license.
}
}
function
highlight
(
s
,
point
,
auto
)
{
function
highlight
(
s
,
point
,
auto
)
{
if
(
typeof
s
===
"number"
)
{
if
(
isNumeric
(
s
)
)
{
s
=
series
[
s
];
s
=
series
[
s
];
}
}
if
(
typeof
point
===
"number"
)
{
if
(
isNumeric
(
point
)
)
{
var
ps
=
s
.
datapoints
.
pointsize
;
var
ps
=
s
.
datapoints
.
pointsize
;
point
=
s
.
datapoints
.
points
.
slice
(
ps
*
point
,
ps
*
(
point
+
1
));
point
=
s
.
datapoints
.
points
.
slice
(
ps
*
point
,
ps
*
(
point
+
1
));
}
}
...
@@ -3247,11 +3253,11 @@ Licensed under the MIT license.
...
@@ -3247,11 +3253,11 @@ Licensed under the MIT license.
return
;
return
;
}
}
if
(
typeof
s
===
"number"
)
{
if
(
isNumeric
(
s
)
)
{
s
=
series
[
s
];
s
=
series
[
s
];
}
}
if
(
typeof
point
===
"number"
)
{
if
(
isNumeric
(
point
)
)
{
var
ps
=
s
.
datapoints
.
pointsize
;
var
ps
=
s
.
datapoints
.
pointsize
;
point
=
s
.
datapoints
.
points
.
slice
(
ps
*
point
,
ps
*
(
point
+
1
));
point
=
s
.
datapoints
.
points
.
slice
(
ps
*
point
,
ps
*
(
point
+
1
));
}
}
...
...
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