Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
c3-closed
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Evgeny
c3-closed
Commits
6ba6ce89
Commit
6ba6ce89
authored
May 27, 2014
by
Dominic Barnes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding label threshold for pie/donut
parent
21a6e05f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
c3.js
c3.js
+7
-0
No files found.
c3.js
View file @
6ba6ce89
...
@@ -242,6 +242,7 @@
...
@@ -242,6 +242,7 @@
// pie
// pie
var
__pie_label_show
=
getConfig
([
'pie'
,
'label'
,
'show'
],
true
),
var
__pie_label_show
=
getConfig
([
'pie'
,
'label'
,
'show'
],
true
),
__pie_label_format
=
getConfig
([
'pie'
,
'label'
,
'format'
]),
__pie_label_format
=
getConfig
([
'pie'
,
'label'
,
'format'
]),
__pie_label_threshold
=
getConfig
([
'pie'
,
'label'
,
'threshold'
],
0.05
),
__pie_expand
=
getConfig
([
'pie'
,
'expand'
],
true
),
__pie_expand
=
getConfig
([
'pie'
,
'expand'
],
true
),
__pie_onclick
=
getConfig
([
'pie'
,
'onclick'
],
function
()
{}),
__pie_onclick
=
getConfig
([
'pie'
,
'onclick'
],
function
()
{}),
__pie_onmouseover
=
getConfig
([
'pie'
,
'onmouseover'
],
function
()
{}),
__pie_onmouseover
=
getConfig
([
'pie'
,
'onmouseover'
],
function
()
{}),
...
@@ -250,6 +251,7 @@
...
@@ -250,6 +251,7 @@
// donut
// donut
var
__donut_label_show
=
getConfig
([
'donut'
,
'label'
,
'show'
],
true
),
var
__donut_label_show
=
getConfig
([
'donut'
,
'label'
,
'show'
],
true
),
__donut_label_format
=
getConfig
([
'donut'
,
'label'
,
'format'
]),
__donut_label_format
=
getConfig
([
'donut'
,
'label'
,
'format'
]),
__donut_label_threshold
=
getConfig
([
'donut'
,
'label'
,
'threshold'
],
0.05
),
__donut_expand
=
getConfig
([
'donut'
,
'expand'
],
true
),
__donut_expand
=
getConfig
([
'donut'
,
'expand'
],
true
),
__donut_title
=
getConfig
([
'donut'
,
'title'
],
""
),
__donut_title
=
getConfig
([
'donut'
,
'title'
],
""
),
__donut_onclick
=
getConfig
([
'donut'
,
'onclick'
],
function
()
{}),
__donut_onclick
=
getConfig
([
'donut'
,
'onclick'
],
function
()
{}),
...
@@ -1016,6 +1018,7 @@
...
@@ -1016,6 +1018,7 @@
updated
=
updateAngle
(
d
);
updated
=
updateAngle
(
d
);
value
=
updated
?
updated
.
value
:
null
;
value
=
updated
?
updated
.
value
:
null
;
ratio
=
getArcRatio
(
updated
);
ratio
=
getArcRatio
(
updated
);
if
(
!
meetsArcLabelThreshold
(
ratio
))
{
return
""
;
}
format
=
getArcLabelFormat
();
format
=
getArcLabelFormat
();
return
format
?
format
(
value
,
ratio
)
:
defaultArcValueFormat
(
value
,
ratio
);
return
format
?
format
(
value
,
ratio
)
:
defaultArcValueFormat
(
value
,
ratio
);
}
}
...
@@ -1050,6 +1053,10 @@
...
@@ -1050,6 +1053,10 @@
function
shouldShowArcLabel
()
{
function
shouldShowArcLabel
()
{
return
hasDonutType
(
c3
.
data
.
targets
)
?
__donut_label_show
:
__pie_label_show
;
return
hasDonutType
(
c3
.
data
.
targets
)
?
__donut_label_show
:
__pie_label_show
;
}
}
function
meetsArcLabelThreshold
(
ratio
)
{
var
threshold
=
hasDonutType
(
c3
.
data
.
targets
)
?
__donut_label_threshold
:
__pie_label_threshold
;
return
ratio
>=
threshold
;
}
function
getArcLabelFormat
()
{
function
getArcLabelFormat
()
{
return
hasDonutType
(
c3
.
data
.
targets
)
?
__donut_label_format
:
__pie_label_format
;
return
hasDonutType
(
c3
.
data
.
targets
)
?
__donut_label_format
:
__pie_label_format
;
}
}
...
...
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