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
9c3bc1e5
Commit
9c3bc1e5
authored
Mar 20, 2015
by
Matt Condon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add expand duration config for pie, gauge, and donut charts
parent
e83d0e78
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
14 deletions
+58
-14
c3.js
c3.js
+29
-7
c3.min.js
c3.min.js
+0
-0
arc.js
src/arc.js
+23
-4
config.js
src/config.js
+6
-3
No files found.
c3.js
View file @
9c3bc1e5
...
...
@@ -1175,22 +1175,25 @@
pie_label_show
:
true
,
pie_label_format
:
undefined
,
pie_label_threshold
:
0.05
,
pie_expand
:
true
,
pie_expand
:
{},
pie_expand_duration
:
50
,
// gauge
gauge_label_show
:
true
,
gauge_label_format
:
undefined
,
gauge_expand
:
true
,
gauge_min
:
0
,
gauge_max
:
100
,
gauge_units
:
undefined
,
gauge_width
:
undefined
,
gauge_expand
:
{},
gauge_expand_duration
:
50
,
// donut
donut_label_show
:
true
,
donut_label_format
:
undefined
,
donut_label_threshold
:
0.05
,
donut_width
:
undefined
,
donut_expand
:
true
,
donut_title
:
""
,
donut_expand
:
{},
donut_expand_duration
:
50
,
// region - region to change style
regions
:
[],
// tooltip - show when mouseover on each data
...
...
@@ -4733,9 +4736,9 @@
$$
.
svg
.
selectAll
(
$$
.
selectorTargets
(
targetIds
,
'.'
+
CLASS
.
chartArc
)).
each
(
function
(
d
)
{
if
(
!
$$
.
shouldExpand
(
d
.
data
.
id
))
{
return
;
}
$$
.
d3
.
select
(
this
).
selectAll
(
'path'
)
.
transition
().
duration
(
50
)
.
transition
().
duration
(
$$
.
expandDuration
(
d
.
data
.
id
)
)
.
attr
(
"d"
,
$$
.
svgArcExpanded
)
.
transition
().
duration
(
100
)
.
transition
().
duration
(
$$
.
expandDuration
(
d
.
data
.
id
)
*
2
)
.
attr
(
"d"
,
$$
.
svgArcExpandedSub
)
.
each
(
function
(
d
)
{
if
(
$$
.
isDonutType
(
d
.
data
))
{
...
...
@@ -4753,15 +4756,34 @@
targetIds
=
$$
.
mapToTargetIds
(
targetIds
);
$$
.
svg
.
selectAll
(
$$
.
selectorTargets
(
targetIds
,
'.'
+
CLASS
.
chartArc
)).
selectAll
(
'path'
)
.
transition
().
duration
(
50
)
.
transition
().
duration
(
function
(
d
)
{
return
$$
.
expandDuration
(
d
.
data
.
id
);
})
.
attr
(
"d"
,
$$
.
svgArc
);
$$
.
svg
.
selectAll
(
'.'
+
CLASS
.
arc
)
.
style
(
"opacity"
,
1
);
};
c3_chart_internal_fn
.
expandDuration
=
function
(
id
)
{
var
$$
=
this
,
config
=
$$
.
config
;
if
(
$$
.
isDonutType
(
id
))
{
return
config
.
donut_expand_duration
;
}
else
if
(
$$
.
isGaugeType
(
id
))
{
return
config
.
gauge_expand_duration
;
}
else
if
(
$$
.
isPieType
(
id
))
{
return
config
.
pie_expand_duration
;
}
else
{
return
50
;
}
};
c3_chart_internal_fn
.
shouldExpand
=
function
(
id
)
{
var
$$
=
this
,
config
=
$$
.
config
;
return
(
$$
.
isDonutType
(
id
)
&&
config
.
donut_expand
)
||
(
$$
.
isGaugeType
(
id
)
&&
config
.
gauge_expand
)
||
(
$$
.
isPieType
(
id
)
&&
config
.
pie_expand
);
return
(
$$
.
isDonutType
(
id
)
&&
config
.
donut_expand
)
||
(
$$
.
isGaugeType
(
id
)
&&
config
.
gauge_expand
)
||
(
$$
.
isPieType
(
id
)
&&
config
.
pie_expand
);
};
c3_chart_internal_fn
.
shouldShowArcLabel
=
function
()
{
...
...
c3.min.js
View file @
9c3bc1e5
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/arc.js
View file @
9c3bc1e5
...
...
@@ -143,9 +143,9 @@ c3_chart_internal_fn.expandArc = function (targetIds) {
$$
.
svg
.
selectAll
(
$$
.
selectorTargets
(
targetIds
,
'.'
+
CLASS
.
chartArc
)).
each
(
function
(
d
)
{
if
(
!
$$
.
shouldExpand
(
d
.
data
.
id
))
{
return
;
}
$$
.
d3
.
select
(
this
).
selectAll
(
'path'
)
.
transition
().
duration
(
50
)
.
transition
().
duration
(
$$
.
expandDuration
(
d
.
data
.
id
)
)
.
attr
(
"d"
,
$$
.
svgArcExpanded
)
.
transition
().
duration
(
100
)
.
transition
().
duration
(
$$
.
expandDuration
(
d
.
data
.
id
)
*
2
)
.
attr
(
"d"
,
$$
.
svgArcExpandedSub
)
.
each
(
function
(
d
)
{
if
(
$$
.
isDonutType
(
d
.
data
))
{
...
...
@@ -163,15 +163,34 @@ c3_chart_internal_fn.unexpandArc = function (targetIds) {
targetIds
=
$$
.
mapToTargetIds
(
targetIds
);
$$
.
svg
.
selectAll
(
$$
.
selectorTargets
(
targetIds
,
'.'
+
CLASS
.
chartArc
)).
selectAll
(
'path'
)
.
transition
().
duration
(
50
)
.
transition
().
duration
(
function
(
d
)
{
return
$$
.
expandDuration
(
d
.
data
.
id
);
})
.
attr
(
"d"
,
$$
.
svgArc
);
$$
.
svg
.
selectAll
(
'.'
+
CLASS
.
arc
)
.
style
(
"opacity"
,
1
);
};
c3_chart_internal_fn
.
expandDuration
=
function
(
id
)
{
var
$$
=
this
,
config
=
$$
.
config
;
if
(
$$
.
isDonutType
(
id
))
{
return
config
.
donut_expand_duration
;
}
else
if
(
$$
.
isGaugeType
(
id
))
{
return
config
.
gauge_expand_duration
;
}
else
if
(
$$
.
isPieType
(
id
))
{
return
config
.
pie_expand_duration
;
}
else
{
return
50
;
}
};
c3_chart_internal_fn
.
shouldExpand
=
function
(
id
)
{
var
$$
=
this
,
config
=
$$
.
config
;
return
(
$$
.
isDonutType
(
id
)
&&
config
.
donut_expand
)
||
(
$$
.
isGaugeType
(
id
)
&&
config
.
gauge_expand
)
||
(
$$
.
isPieType
(
id
)
&&
config
.
pie_expand
);
return
(
$$
.
isDonutType
(
id
)
&&
config
.
donut_expand
)
||
(
$$
.
isGaugeType
(
id
)
&&
config
.
gauge_expand
)
||
(
$$
.
isPieType
(
id
)
&&
config
.
pie_expand
);
};
c3_chart_internal_fn
.
shouldShowArcLabel
=
function
()
{
...
...
src/config.js
View file @
9c3bc1e5
...
...
@@ -161,22 +161,25 @@ c3_chart_internal_fn.getDefaultConfig = function () {
pie_label_show
:
true
,
pie_label_format
:
undefined
,
pie_label_threshold
:
0.05
,
pie_expand
:
true
,
pie_expand
:
{},
pie_expand_duration
:
50
,
// gauge
gauge_label_show
:
true
,
gauge_label_format
:
undefined
,
gauge_expand
:
true
,
gauge_min
:
0
,
gauge_max
:
100
,
gauge_units
:
undefined
,
gauge_width
:
undefined
,
gauge_expand
:
{},
gauge_expand_duration
:
50
,
// donut
donut_label_show
:
true
,
donut_label_format
:
undefined
,
donut_label_threshold
:
0.05
,
donut_width
:
undefined
,
donut_expand
:
true
,
donut_title
:
""
,
donut_expand
:
{},
donut_expand_duration
:
50
,
// region - region to change style
regions
:
[],
// tooltip - show when mouseover on each data
...
...
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