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
e5f947b6
Commit
e5f947b6
authored
Mar 31, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix show/hide for pie/donut chart
parent
3ec3b83d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
17 deletions
+19
-17
c3.js
c3.js
+19
-17
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
e5f947b6
...
...
@@ -928,7 +928,7 @@
function
updateAngle
(
d
)
{
var
found
=
false
;
pie
(
c3
.
data
.
targets
).
forEach
(
function
(
t
)
{
pie
(
filterTargetsToShow
(
c3
.
data
.
targets
)
).
forEach
(
function
(
t
)
{
if
(
!
found
&&
t
.
data
.
id
===
d
.
data
.
id
)
{
found
=
true
;
d
=
t
;
...
...
@@ -970,7 +970,7 @@
return
translate
;
}
function
getArcRatio
(
d
)
{
return
(
d
.
endAngle
-
d
.
startAngle
)
/
(
Math
.
PI
*
2
)
;
return
d
?
(
d
.
endAngle
-
d
.
startAngle
)
/
(
Math
.
PI
*
2
)
:
null
;
}
function
convertToArcData
(
d
)
{
return
addName
({
...
...
@@ -980,11 +980,13 @@
});
}
function
textForArcLabel
(
d
)
{
var
ratio
,
format
;
var
updated
,
value
,
ratio
,
format
;
if
(
!
shouldShowArcLable
())
{
return
""
;
}
ratio
=
getArcRatio
(
d
);
updated
=
updateAngle
(
d
);
value
=
updated
?
updated
.
value
:
null
;
ratio
=
getArcRatio
(
updated
);
format
=
getArcLabelFormat
();
return
format
?
format
(
d
.
value
,
ratio
)
:
defaultArcValueFormat
(
d
.
v
,
ratio
);
return
format
?
format
(
value
,
ratio
)
:
defaultArcValueFormat
(
value
,
ratio
);
}
function
expandArc
(
id
,
withoutFadeOut
)
{
var
target
=
svg
.
selectAll
(
'.'
+
CLASS
.
chartArc
+
selectorTarget
(
id
)),
...
...
@@ -2986,7 +2988,7 @@
.
style
(
"opacity"
,
function
(
d
)
{
return
d
===
this
.
_current
?
0
:
1
;
})
.
transition
().
duration
(
duration
)
.
attrTween
(
"d"
,
function
(
d
)
{
var
updated
=
updateAngle
(
d
);
var
updated
=
updateAngle
(
d
)
,
interpolate
;
if
(
!
updated
)
{
return
function
()
{
return
"M 0 0"
;
};
}
...
...
@@ -2998,9 +3000,9 @@
};
}
*/
var
i
=
d3
.
interpolate
(
this
.
_current
,
updated
);
this
.
_current
=
i
(
0
);
return
function
(
t
)
{
return
getArc
(
i
(
t
),
true
);
};
interpolate
=
d3
.
interpolate
(
this
.
_current
,
updated
);
this
.
_current
=
i
nterpolate
(
0
);
return
function
(
t
)
{
return
getArc
(
i
nterpolate
(
t
),
true
);
};
})
.
attr
(
"transform"
,
withTransform
?
"scale(1)"
:
""
)
.
style
(
"opacity"
,
1
);
...
...
@@ -3009,7 +3011,7 @@
.
style
(
"opacity"
,
0
)
.
transition
().
duration
(
duration
)
.
text
(
textForArcLabel
)
.
style
(
"opacity"
,
function
(
d
)
{
return
isArcType
(
d
.
data
)
?
1
:
0
;
});
.
style
(
"opacity"
,
function
(
d
)
{
return
is
TargetToShow
(
d
.
data
.
id
)
&&
is
ArcType
(
d
.
data
)
?
1
:
0
;
});
main
.
select
(
'.'
+
CLASS
.
chartArcsTitle
)
.
style
(
"opacity"
,
hasDonutType
(
c3
.
data
.
targets
)
?
1
:
0
);
...
...
@@ -3276,24 +3278,24 @@
.
style
(
"cursor"
,
function
(
d
)
{
return
__data_selection_isselectable
(
d
)
?
"pointer"
:
null
;
})
.
each
(
function
(
d
)
{
this
.
_current
=
d
;
})
.
on
(
'mouseover'
,
function
(
d
,
i
)
{
var
arcData
=
convertToArcData
(
d
),
callback
=
getArcOnMouseOver
();
expandArc
(
d
.
data
.
id
);
focusLegend
(
d
.
data
.
id
);
var
updated
=
updateAngle
(
d
),
arcData
=
convertToArcData
(
update
d
),
callback
=
getArcOnMouseOver
();
expandArc
(
update
d
.
data
.
id
);
focusLegend
(
update
d
.
data
.
id
);
callback
(
arcData
,
i
);
})
.
on
(
'mousemove'
,
function
(
d
)
{
var
selectedData
=
[
convertToArcData
(
d
)];
var
updated
=
updateAngle
(
d
),
selectedData
=
[
convertToArcData
(
update
d
)];
showTooltip
(
selectedData
,
d3
.
mouse
(
this
));
})
.
on
(
'mouseout'
,
function
(
d
,
i
)
{
var
arcData
=
convertToArcData
(
d
),
callback
=
getArcOnMouseOut
();
unexpandArc
(
d
.
data
.
id
);
var
updated
=
updateAngle
(
d
),
arcData
=
convertToArcData
(
update
d
),
callback
=
getArcOnMouseOut
();
unexpandArc
(
update
d
.
data
.
id
);
revertLegend
();
hideTooltip
();
callback
(
arcData
,
i
);
})
.
on
(
'click'
,
function
(
d
,
i
)
{
var
arcData
=
convertToArcData
(
d
),
callback
=
getArcOnClick
();
var
updated
=
updateAngle
(
d
),
arcData
=
convertToArcData
(
update
d
),
callback
=
getArcOnClick
();
callback
(
arcData
,
i
);
});
mainPieEnter
.
append
(
"text"
)
...
...
c3.min.js
View file @
e5f947b6
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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