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
be9f60d2
Commit
be9f60d2
authored
Feb 13, 2013
by
David Schnur
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #957 from dnschnur/legend-reverse
Added a legend 'reverse' sorting option.
parents
96965793
6bbce446
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
API.md
API.md
+5
-4
jquery.flot.js
jquery.flot.js
+2
-0
No files found.
API.md
View file @
be9f60d2
...
@@ -164,7 +164,7 @@ legend: {
...
@@ -164,7 +164,7 @@ legend: {
backgroundColor
:
null
or
color
backgroundColor
:
null
or
color
backgroundOpacity
:
number
between
0
and
1
backgroundOpacity
:
number
between
0
and
1
container
:
null
or
jQuery
object
/
DOM
element
/
jQuery
expression
container
:
null
or
jQuery
object
/
DOM
element
/
jQuery
expression
sorted
:
null
/
false
,
true
,
"ascending"
,
"descending"
or
a
comparator
sorted
:
null
/
false
,
true
,
"ascending"
,
"descending"
,
"reverse"
,
or
a
comparator
}
}
```
```
...
@@ -197,9 +197,10 @@ specify "container" as a jQuery object/expression to put the legend
...
@@ -197,9 +197,10 @@ specify "container" as a jQuery object/expression to put the legend
table into. The "position" and "margin" etc. options will then be
table into. The "position" and "margin" etc. options will then be
ignored. Note that Flot will overwrite the contents of the container.
ignored. Note that Flot will overwrite the contents of the container.
Legend entries appear in the same order as their series by default. To
Legend entries appear in the same order as their series by default. If "sorted"
sort them alphabetically, you can specify "sorted" as tue, "ascending"
is "reverse" then they appear in the opposite order from their series. To sort
or "descending", where true and "ascending" are equivalent.
them alphabetically, you can specify true, "ascending" or "descending", where
true and "ascending" are equivalent.
You can also provide your own comparator function that accepts two
You can also provide your own comparator function that accepts two
objects with "label" and "color" properties, and returns zero if they
objects with "label" and "color" properties, and returns zero if they
...
...
jquery.flot.js
View file @
be9f60d2
...
@@ -2315,6 +2315,8 @@ Licensed under the MIT license.
...
@@ -2315,6 +2315,8 @@ Licensed under the MIT license.
if
(
options
.
legend
.
sorted
)
{
if
(
options
.
legend
.
sorted
)
{
if
(
$
.
isFunction
(
options
.
legend
.
sorted
))
{
if
(
$
.
isFunction
(
options
.
legend
.
sorted
))
{
entries
.
sort
(
options
.
legend
.
sorted
);
entries
.
sort
(
options
.
legend
.
sorted
);
}
else
if
(
options
.
legend
.
sorted
==
"reverse"
)
{
entries
.
reverse
();
}
else
{
}
else
{
var
ascending
=
options
.
legend
.
sorted
!=
"descending"
;
var
ascending
=
options
.
legend
.
sorted
!=
"descending"
;
entries
.
sort
(
function
(
a
,
b
)
{
entries
.
sort
(
function
(
a
,
b
)
{
...
...
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