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
dd83fa72
You need to sign in or sign up before continuing.
Commit
dd83fa72
authored
Feb 20, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add dount chart - #10
parent
95b9b7c4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
15 deletions
+21
-15
c3.js
c3.js
+21
-15
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
dd83fa72
...
...
@@ -177,7 +177,7 @@
/*-- Set Chart Params --*/
var
margin
,
margin2
,
margin3
,
width
,
width2
,
height
,
height2
,
height3
,
currentWidth
,
currentHeight
;
var
radius
,
radiusExpanded
,
svgArc
,
svgArcExpanded
,
svgArcExpandedSub
,
pie
;
var
radius
,
radiusExpanded
,
innerRadius
,
svgArc
,
svgArcExpanded
,
svgArcExpandedSub
,
pie
;
var
xMin
,
xMax
,
yMin
,
yMax
,
subXMin
,
subXMax
,
subYMin
,
subYMax
;
var
x
,
y
,
y2
,
subX
,
subY
,
subY2
,
xAxis
,
yAxis
,
yAxis2
,
subXAxis
;
...
...
@@ -238,6 +238,7 @@
radiusExpanded
=
height
/
2
;
radius
=
radiusExpanded
*
0.95
;
innerRadius
=
hasDountType
(
c3
.
data
.
targets
)
?
radius
*
0.6
:
0
;
}
function
getCurrentWidth
()
{
return
__size_width
===
null
?
getParentWidth
()
:
__size_width
;
...
...
@@ -408,7 +409,7 @@
}
function
getSvgArc
()
{
var
arc
=
d3
.
svg
.
arc
().
outerRadius
(
radius
).
innerRadius
(
0
),
var
arc
=
d3
.
svg
.
arc
().
outerRadius
(
radius
).
innerRadius
(
innerRadius
),
newArc
=
function
(
d
,
withoutUpdate
)
{
var
updated
;
if
(
withoutUpdate
)
{
return
arc
(
d
);
}
// for interpolate
...
...
@@ -420,7 +421,7 @@
return
newArc
;
}
function
getSvgArcExpanded
(
rate
)
{
var
arc
=
d3
.
svg
.
arc
().
outerRadius
(
radiusExpanded
*
(
rate
?
rate
:
1
)).
innerRadius
(
0
);
var
arc
=
d3
.
svg
.
arc
().
outerRadius
(
radiusExpanded
*
(
rate
?
rate
:
1
)).
innerRadius
(
innerRadius
);
return
function
(
d
)
{
var
updated
=
updateAngle
(
d
);
return
updated
?
arc
(
updated
)
:
"M 0 0"
;
...
...
@@ -709,6 +710,11 @@
});
});
// set target types
if
(
__data_type
)
{
setTargetType
(
getTargetIds
(
targets
).
filter
(
function
(
id
)
{
return
!
(
id
in
__data_types
);
}),
__data_type
);
}
// cache as original id keyed
targets
.
forEach
(
function
(
d
)
{
addCache
(
d
.
id_org
,
d
);
...
...
@@ -1035,9 +1041,15 @@
function
hasScatterType
(
targets
)
{
return
hasType
(
targets
,
'scatter'
);
}
function
has
Arc
Type
(
targets
)
{
function
has
Pie
Type
(
targets
)
{
return
hasType
(
targets
,
'pie'
);
}
function
hasDountType
(
targets
)
{
return
hasType
(
targets
,
'dount'
);
}
function
hasArcType
(
targets
)
{
return
hasPieType
(
targets
)
||
hasDountType
(
targets
);
}
function
isLineType
(
d
)
{
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
return
!
(
id
in
__data_types
)
||
__data_types
[
id
]
===
'line'
||
__data_types
[
id
]
===
'spline'
||
__data_types
[
id
]
===
'area'
||
__data_types
[
id
]
===
'area-spline'
;
...
...
@@ -1056,7 +1068,7 @@
}
function
isArcType
(
d
)
{
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
return
__data_types
[
id
]
===
'pie'
;
return
__data_types
[
id
]
===
'pie'
||
__data_types
[
id
]
===
'dount'
;
}
/* not used
function lineData(d) {
...
...
@@ -1920,7 +1932,7 @@
var
barIndices
=
getBarIndices
(),
barTargetsNum
=
barIndices
.
__max__
+
1
,
maxDataCountTarget
;
var
rectX
,
rectW
;
var
withY
,
withSubchart
,
withTransition
,
withUpdateXDomain
,
withUpdateOrgXDomain
;
var
isPieChart
;
var
hideAxis
=
hasArcType
(
c3
.
data
.
targets
)
;
var
duration
;
options
=
isDefined
(
options
)
?
options
:
{};
...
...
@@ -1929,7 +1941,6 @@
withTransition
=
isDefined
(
options
.
withTransition
)
?
options
.
withTransition
:
true
;
withUpdateXDomain
=
isDefined
(
options
.
withUpdateXDomain
)
?
options
.
withUpdateXDomain
:
false
;
withUpdateOrgXDomain
=
isDefined
(
options
.
withUpdateOrgXDomain
)
?
options
.
withUpdateOrgXDomain
:
false
;
isPieChart
=
hasArcType
(
c3
.
data
.
targets
);
duration
=
withTransition
?
250
:
0
;
...
...
@@ -1950,9 +1961,9 @@
y2
.
domain
(
getYDomain
(
'y2'
));
// axis
main
.
select
(
".x.axis"
).
transition
().
duration
(
__axis_rotated
?
duration
:
0
).
call
(
__axis_rotated
?
yAxis
:
xAxis
).
style
(
"opacity"
,
isPieChart
?
0
:
1
);
main
.
select
(
".y.axis"
).
transition
().
duration
(
__axis_rotated
?
0
:
duration
).
call
(
__axis_rotated
?
xAxis
:
yAxis
).
style
(
"opacity"
,
isPieChart
?
0
:
1
);
main
.
select
(
".y2.axis"
).
transition
().
call
(
yAxis2
).
style
(
"opacity"
,
isPieChart
?
0
:
1
);
main
.
select
(
".x.axis"
).
transition
().
duration
(
__axis_rotated
?
duration
:
0
).
call
(
__axis_rotated
?
yAxis
:
xAxis
).
style
(
"opacity"
,
hideAxis
?
0
:
1
);
main
.
select
(
".y.axis"
).
transition
().
duration
(
__axis_rotated
?
0
:
duration
).
call
(
__axis_rotated
?
xAxis
:
yAxis
).
style
(
"opacity"
,
hideAxis
?
0
:
1
);
main
.
select
(
".y2.axis"
).
transition
().
call
(
yAxis2
).
style
(
"opacity"
,
hideAxis
?
0
:
1
);
// Update label position
main
.
select
(
".x.axis .-axis-x-label"
).
attr
(
"x"
,
width
);
...
...
@@ -2314,11 +2325,6 @@
/*-- Main --*/
// Set data type if data.type is specified
if
(
__data_type
)
{
setTargetType
(
getTargetIds
(
targets
).
filter
(
function
(
id
)
{
return
!
(
id
in
__data_types
);
}),
__data_type
);
}
//-- Bar --//
mainBarUpdate
=
main
.
select
(
'.chart-bars'
)
.
selectAll
(
'.chart-bar'
)
...
...
c3.min.js
View file @
dd83fa72
This diff is collapsed.
Click to expand it.
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