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
charts
c3-closed
Commits
e65b7a62
Commit
e65b7a62
authored
Feb 20, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add arc.title option
parent
4a6304c4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
9 deletions
+34
-9
c3.css
c3.css
+6
-0
c3.js
c3.js
+26
-7
c3.min.js
c3.min.js
+0
-0
dount.html
htdocs/samples/dount.html
+2
-2
No files found.
c3.css
View file @
e65b7a62
...
...
@@ -70,6 +70,12 @@ text {
stroke-width
:
2px
;
}
/*-- Arc --*/
.chart-arcs-title
{
font-size
:
1.3em
;
}
/*-- Focus --*/
.target.focused
path
.-line
{
...
...
c3.js
View file @
e65b7a62
...
...
@@ -123,7 +123,8 @@
__point_onunselected
=
getConfig
([
'point'
,
'onunselected'
],
function
()
{});
// arc
var
__arc_label_fomat
=
getConfig
([
'arc'
,
'label'
,
'format'
],
function
(
d
,
ratio
)
{
return
ratio
.
toFixed
(
1
)
+
"%"
;
});
var
__arc_label_fomat
=
getConfig
([
'arc'
,
'label'
,
'format'
],
function
(
d
,
ratio
)
{
return
(
100
*
ratio
).
toFixed
(
1
)
+
"%"
;
}),
__arc_title
=
getConfig
([
'arc'
,
'title'
],
""
);
// region - region to change style
var
__regions
=
getConfig
([
'regions'
],
[]);
...
...
@@ -442,9 +443,11 @@
}
return
translate
;
}
function
getArcRatio
(
d
)
{
return
(
d
.
endAngle
-
d
.
startAngle
)
/
(
Math
.
PI
*
2
);
}
function
textForArcLable
(
d
)
{
var
ratio
=
100
*
(
d
.
endAngle
-
d
.
startAngle
)
/
(
Math
.
PI
*
2
);
return
__arc_label_fomat
(
d
,
ratio
);
return
__arc_label_fomat
(
d
,
getArcRatio
(
d
));
}
function
expandArc
(
targetId
,
withoutFadeOut
)
{
var
target
=
svg
.
selectAll
(
'.chart-arc.target'
+
(
targetId
?
'-'
+
targetId
:
''
)),
...
...
@@ -453,7 +456,12 @@
.
transition
().
duration
(
50
)
.
attr
(
"d"
,
svgArcExpanded
)
.
transition
().
duration
(
100
)
.
attr
(
"d"
,
svgArcExpandedSub
);
.
attr
(
"d"
,
svgArcExpandedSub
)
.
each
(
function
(
d
)
{
if
(
isDountType
(
d
.
data
))
{
// callback here
}
});
if
(
!
withoutFadeOut
)
{
noneTargets
.
style
(
"opacity"
,
0.3
);
}
...
...
@@ -1069,9 +1077,16 @@
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
return
__data_types
[
id
]
===
'scatter'
;
}
function
is
Arc
Type
(
d
)
{
function
is
Pie
Type
(
d
)
{
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
return
__data_types
[
id
]
===
'pie'
||
__data_types
[
id
]
===
'dount'
;
return
__data_types
[
id
]
===
'pie'
;
}
function
isDountType
(
d
)
{
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
return
__data_types
[
id
]
===
'dount'
;
}
function
isArcType
(
d
)
{
return
isPieType
(
d
)
||
isDountType
(
d
);
}
/* not used
function lineData(d) {
...
...
@@ -1581,7 +1596,11 @@
// Define g for arc chart area
main
.
select
(
".chart"
).
append
(
"g"
)
.
attr
(
"class"
,
"chart-arcs"
)
.
attr
(
"transform"
,
translate
.
arc
);
.
attr
(
"transform"
,
translate
.
arc
)
.
append
(
'text'
)
.
attr
(
'class'
,
'chart-arcs-title'
)
.
style
(
"text-anchor"
,
"middle"
)
.
text
(
__arc_title
);
if
(
__zoom_enabled
)
{
// TODO: __zoom_privileged here?
// if zoom privileged, insert rect to forefront
...
...
c3.min.js
View file @
e65b7a62
This diff is collapsed.
Click to expand it.
htdocs/samples/dount.html
View file @
e65b7a62
...
...
@@ -26,7 +26,6 @@
// ["versicolor", 40],
// ["virginica", 50],
],
// type : 'pie',
type
:
'dount'
,
},
axis
:
{
...
...
@@ -40,7 +39,8 @@
arc
:
{
label
:
{
format
:
function
(
d
,
ratio
)
{
return
""
;
}
}
},
title
:
"Iris Petal Width"
}
});
...
...
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