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
64b28faf
Commit
64b28faf
authored
Feb 27, 2013
by
David Schnur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid combining a single pie slice into 'other'.
Resolves #638.
parent
ab6e4a95
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
jquery.flot.pie.js
jquery.flot.pie.js
+11
-5
No files found.
jquery.flot.pie.js
View file @
64b28faf
...
...
@@ -195,23 +195,29 @@ More detail and specific examples can be found in the included HTML file.
data
[
i
].
data
=
[
value
];
}
//
Calculate the total of all slices, so we can show percentages
//
Sum up all the slices, so we can calculate percentages for each
for
(
var
i
=
0
;
i
<
data
.
length
;
++
i
)
{
total
+=
data
[
i
].
data
[
0
][
1
];
}
for
(
var
i
=
0
;
i
<
data
.
length
;
++
i
)
{
// Count the number of slices with percentages below the combine
// threshold; if it turns out to be just one, we won't combine.
for
(
var
i
=
0
;
i
<
data
.
length
;
++
i
)
{
var
value
=
data
[
i
].
data
[
0
][
1
];
if
(
value
/
total
<=
options
.
series
.
pie
.
combine
.
threshold
)
{
combined
+=
value
;
numCombined
++
;
if
(
!
color
)
{
color
=
data
[
i
].
color
;
}
}
else
{
}
}
for
(
var
i
=
0
;
i
<
data
.
length
;
++
i
)
{
var
value
=
data
[
i
].
data
[
0
][
1
];
if
(
numCombined
<
2
||
value
/
total
>
options
.
series
.
pie
.
combine
.
threshold
)
{
newdata
.
push
({
data
:
[[
1
,
value
]],
color
:
data
[
i
].
color
,
...
...
@@ -222,7 +228,7 @@ More detail and specific examples can be found in the included HTML file.
}
}
if
(
numCombined
>
0
)
{
if
(
numCombined
>
1
)
{
newdata
.
push
({
data
:
[[
1
,
combined
]],
color
:
color
,
...
...
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