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
fb24a990
Commit
fb24a990
authored
Jun 13, 2012
by
David Schnur
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #46 from markrcote/master
Fix minTickSize for year units
parents
64e19c8c
fd809089
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
11 deletions
+35
-11
NEWS.txt
NEWS.txt
+2
-0
time.html
examples/time.html
+12
-0
jquery.flot.time.js
jquery.flot.time.js
+21
-11
No files found.
NEWS.txt
View file @
fb24a990
...
@@ -29,6 +29,8 @@ and "flot-overlay" to prevent accidental clashes (issue 540).
...
@@ -29,6 +29,8 @@ and "flot-overlay" to prevent accidental clashes (issue 540).
Changes:
Changes:
- Fixed display of year ticks (patch by Mark Cote, issue 195).
- Support for time series moved to plugin (patch by Mark Cote).
- Support for time series moved to plugin (patch by Mark Cote).
- Display time series in different time zones (patch by Knut Forkalsrud,
- Display time series in different time zones (patch by Knut Forkalsrud,
...
...
examples/time.html
View file @
fb24a990
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
<p>
Zoom to:
<button
id=
"whole"
>
Whole period
</button>
<p>
Zoom to:
<button
id=
"whole"
>
Whole period
</button>
<button
id=
"nineties"
>
1990-2000
</button>
<button
id=
"nineties"
>
1990-2000
</button>
<button
id=
"latenineties"
>
1996-2000
</button>
<button
id=
"ninetynine"
>
1999
</button></p>
<button
id=
"ninetynine"
>
1999
</button></p>
<p>
The timestamps must be specified as Javascript timestamps, as
<p>
The timestamps must be specified as Javascript timestamps, as
...
@@ -55,6 +56,17 @@ $(function () {
...
@@ -55,6 +56,17 @@ $(function () {
});
});
});
});
$
(
"#latenineties"
).
click
(
function
()
{
$
.
plot
(
$
(
"#placeholder"
),
[
d
],
{
xaxis
:
{
mode
:
"time"
,
minTickSize
:
[
1
,
"year"
],
min
:
(
new
Date
(
1996
,
1
,
1
)).
getTime
(),
max
:
(
new
Date
(
2000
,
1
,
1
)).
getTime
()
}
});
});
$
(
"#ninetynine"
).
click
(
function
()
{
$
(
"#ninetynine"
).
click
(
function
()
{
$
.
plot
(
$
(
"#placeholder"
),
[
d
],
{
$
.
plot
(
$
(
"#placeholder"
),
[
d
],
{
xaxis
:
{
xaxis
:
{
...
...
jquery.flot.time.js
View file @
fb24a990
...
@@ -163,6 +163,11 @@ for details.
...
@@ -163,6 +163,11 @@ for details.
// special-case the possibility of several years
// special-case the possibility of several years
if
(
unit
==
"year"
)
{
if
(
unit
==
"year"
)
{
// if given a minTickSize in years, just use it,
// ensuring that it's an integer
if
(
opts
.
minTickSize
!=
null
&&
opts
.
minTickSize
[
1
]
==
"year"
)
{
size
=
Math
.
floor
(
opts
.
minTickSize
[
0
]);
}
else
{
var
magn
=
Math
.
pow
(
10
,
Math
.
floor
(
Math
.
log
(
axis
.
delta
/
timeUnitSize
.
year
)
/
Math
.
LN10
));
var
magn
=
Math
.
pow
(
10
,
Math
.
floor
(
Math
.
log
(
axis
.
delta
/
timeUnitSize
.
year
)
/
Math
.
LN10
));
var
norm
=
(
axis
.
delta
/
timeUnitSize
.
year
)
/
magn
;
var
norm
=
(
axis
.
delta
/
timeUnitSize
.
year
)
/
magn
;
if
(
norm
<
1.5
)
if
(
norm
<
1.5
)
...
@@ -177,6 +182,11 @@ for details.
...
@@ -177,6 +182,11 @@ for details.
size
*=
magn
;
size
*=
magn
;
}
}
// minimum size for years is 1
if
(
size
<
1
)
size
=
1
;
}
axis
.
tickSize
=
opts
.
tickSize
||
[
size
,
unit
];
axis
.
tickSize
=
opts
.
tickSize
||
[
size
,
unit
];
var
tickSize
=
axis
.
tickSize
[
0
];
var
tickSize
=
axis
.
tickSize
[
0
];
unit
=
axis
.
tickSize
[
1
];
unit
=
axis
.
tickSize
[
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