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
40333060
You need to sign in or sign up before continuing.
Commit
40333060
authored
Jun 09, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pie.sort/donut/sort option to disable sorting - #328
parent
34bf061c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
0 deletions
+97
-0
c3.js
c3.js
+5
-0
c3.min.js
c3.min.js
+0
-0
index.html
htdocs/index.html
+3
-0
chart_pie_sort.html
htdocs/samples/chart_pie_sort.html
+89
-0
No files found.
c3.js
View file @
40333060
...
...
@@ -259,6 +259,7 @@
var
__pie_label_show
=
getConfig
([
'pie'
,
'label'
,
'show'
],
true
),
__pie_label_format
=
getConfig
([
'pie'
,
'label'
,
'format'
]),
__pie_label_threshold
=
getConfig
([
'pie'
,
'label'
,
'threshold'
],
0.05
),
__pie_sort
=
getConfig
([
'pie'
,
'sort'
],
true
),
__pie_expand
=
getConfig
([
'pie'
,
'expand'
],
true
),
__pie_onclick
=
getConfig
([
'pie'
,
'onclick'
],
function
()
{}),
__pie_onmouseover
=
getConfig
([
'pie'
,
'onmouseover'
],
function
()
{}),
...
...
@@ -280,6 +281,7 @@
var
__donut_label_show
=
getConfig
([
'donut'
,
'label'
,
'show'
],
true
),
__donut_label_format
=
getConfig
([
'donut'
,
'label'
,
'format'
]),
__donut_label_threshold
=
getConfig
([
'donut'
,
'label'
,
'threshold'
],
0.05
),
__donut_sort
=
getConfig
([
'donut'
,
'sort'
],
true
),
__donut_expand
=
getConfig
([
'donut'
,
'expand'
],
true
),
__donut_title
=
getConfig
([
'donut'
,
'title'
],
""
),
__donut_onclick
=
getConfig
([
'donut'
,
'onclick'
],
function
()
{}),
...
...
@@ -1010,6 +1012,9 @@
pie
=
d3
.
layout
.
pie
().
value
(
function
(
d
)
{
return
d
.
values
.
reduce
(
function
(
a
,
b
)
{
return
a
+
b
.
value
;
},
0
);
});
if
(
!
__pie_sort
||
!
__donut_sort
)
{
// TODO: this needs to be called by each type
pie
.
sort
(
null
);
}
function
updateAngle
(
d
)
{
var
found
=
false
;
...
...
c3.min.js
View file @
40333060
This source diff could not be displayed because it is too large. You can
view the blob
instead.
htdocs/index.html
View file @
40333060
...
...
@@ -58,6 +58,9 @@
<a
href=
"./samples/chart_pie.html"
>
Pie chart with ordinary data
</a>
<a
href=
"./samples/chart_pie_sort.html"
>
Pie chart with/without sort
</a>
</div>
<div
class=
"col-md-4"
>
<h3>
Donut Chart
</h3>
...
...
htdocs/samples/chart_pie_sort.html
0 → 100644
View file @
40333060
<html>
<head>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/css/c3.css"
>
</head>
<body>
<div
id=
"chart"
></div>
<script
src=
"http://d3js.org/d3.v3.min.js"
charset=
"utf-8"
></script>
<script
src=
"/js/c3.js"
></script>
<script>
var
sort
=
true
;
var
generate
=
function
()
{
return
c3
.
generate
({
data
:
{
columns
:
[
// ["setosa", 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, 0.2, 0.4, 0.2, 0.5, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, 0.1, 0.2, 0.2, 0.2, 0.2, 0.1, 0.2, 0.2, 0.3, 0.3, 0.2, 0.6, 0.4, 0.3, 0.2, 0.2, 0.2, 0.2],
[
"versicolor"
,
1.4
,
1.5
,
1.5
,
1.3
,
1.5
,
1.3
,
1.6
,
1.0
,
1.3
,
1.4
,
1.0
,
1.5
,
1.0
,
1.4
,
1.3
,
1.4
,
1.5
,
1.0
,
1.5
,
1.1
,
1.8
,
1.3
,
1.5
,
1.2
,
1.3
,
1.4
,
1.4
,
1.7
,
1.5
,
1.0
,
1.1
,
1.0
,
1.2
,
1.6
,
1.5
,
1.6
,
1.5
,
1.3
,
1.3
,
1.3
,
1.2
,
1.4
,
1.2
,
1.0
,
1.3
,
1.2
,
1.3
,
1.3
,
1.1
,
1.3
],
[
"virginica"
,
2.5
,
1.9
,
2.1
,
1.8
,
2.2
,
2.1
,
1.7
,
1.8
,
1.8
,
2.5
,
2.0
,
1.9
,
2.1
,
2.0
,
2.4
,
2.3
,
1.8
,
2.2
,
2.3
,
1.5
,
2.3
,
2.0
,
2.0
,
1.8
,
2.1
,
1.8
,
1.8
,
1.8
,
2.1
,
1.6
,
1.9
,
2.0
,
2.2
,
1.5
,
1.4
,
2.3
,
2.4
,
1.8
,
1.8
,
2.1
,
2.4
,
2.3
,
1.9
,
2.3
,
2.5
,
2.3
,
1.9
,
2.0
,
2.3
,
1.8
],
[
"setosa"
,
30
],
// ["versicolor", 40],
// ["virginica", 50],
],
type
:
'pie'
,
},
axis
:
{
x
:
{
label
:
'Sepal.Width'
},
y
:
{
label
:
'Petal.Width'
}
},
pie
:
{
sort
:
sort
,
onmouseover
:
function
(
d
,
i
)
{
console
.
log
(
d
,
i
);
},
onmouseout
:
function
(
d
,
i
)
{
console
.
log
(
d
,
i
);
},
onclick
:
function
(
d
,
i
)
{
console
.
log
(
d
,
i
);
},
}
});
},
chart
=
generate
();
setTimeout
(
function
()
{
chart
.
load
({
columns
:
[
[
"setosa"
,
130
],
]
});
},
1000
);
setTimeout
(
function
()
{
chart
.
unload
(
'virginica'
);
},
2000
);
setTimeout
(
function
()
{
chart
.
load
({
columns
:
[
[
"new data"
,
300
],
]
});
},
3000
);
setTimeout
(
function
()
{
sort
=
false
;
chart
=
generate
();
},
4000
);
setTimeout
(
function
()
{
chart
.
load
({
columns
:
[
[
"setosa"
,
130
],
]
});
},
5000
);
setTimeout
(
function
()
{
chart
.
unload
(
'virginica'
);
},
6000
);
setTimeout
(
function
()
{
chart
.
load
({
columns
:
[
[
"new data"
,
300
],
]
});
},
7000
);
</script>
</body>
</html>
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