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
4766795d
Commit
4766795d
authored
Feb 14, 2015
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix empty pie chart - #952
parent
35e5a63d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
30 deletions
+69
-30
.jshintrc
.jshintrc
+2
-1
c3.js
c3.js
+6
-0
c3.min.js
c3.min.js
+0
-0
arc-spec.js
spec/arc-spec.js
+48
-25
c3-helper.js
spec/c3-helper.js
+7
-4
arc.js
src/arc.js
+6
-0
No files found.
.jshintrc
View file @
4766795d
...
...
@@ -22,7 +22,8 @@
"describe": false,
"beforeEach": false,
"it": false,
"expect": false
"expect": false,
"d3": false
}
}
c3.js
View file @
4766795d
...
...
@@ -4568,6 +4568,9 @@
}
index
++
;
});
if
(
isNaN
(
d
.
startAngle
))
{
d
.
startAngle
=
0
;
}
if
(
isNaN
(
d
.
endAngle
))
{
d
.
endAngle
=
d
.
startAngle
;
}
...
...
@@ -4840,6 +4843,9 @@
// endAngle: Math.PI*2,
// };
// }
if
(
isNaN
(
this
.
_current
.
startAngle
))
{
this
.
_current
.
startAngle
=
0
;
}
if
(
isNaN
(
this
.
_current
.
endAngle
))
{
this
.
_current
.
endAngle
=
this
.
_current
.
startAngle
;
}
...
...
c3.min.js
View file @
4766795d
This source diff could not be displayed because it is too large. You can
view the blob
instead.
spec/arc-spec.js
View file @
4766795d
describe
(
'c3 chart axis'
,
function
()
{
describe
(
'c3 chart arc'
,
function
()
{
'use strict'
;
var
chart
,
d3
,
args
;
var
chart
,
args
;
beforeEach
(
function
(
done
)
{
if
(
typeof
chart
===
'undefined'
)
{
window
.
initDom
();
}
chart
=
window
.
c3
.
generate
(
args
);
d3
=
chart
.
internal
.
d3
;
chart
.
internal
.
d3
.
select
(
'.jasmine_html-reporter'
)
.
style
(
'position'
,
'absolute'
)
.
style
(
'right'
,
0
);
window
.
setTimeout
(
function
()
{
done
();
},
50
);
chart
=
window
.
initChart
(
chart
,
args
,
done
);
});
describe
(
'show pie chart'
,
function
()
{
args
=
{
data
:
{
columns
:
[
[
'data1'
,
30
],
[
'data2'
,
150
],
[
'data3'
,
120
]
],
type
:
'pie'
}
};
it
(
'should update args to have pie chart'
,
function
()
{
args
=
{
data
:
{
columns
:
[
[
'data1'
,
30
],
[
'data2'
,
150
],
[
'data3'
,
120
]
],
type
:
'pie'
}
};
expect
(
true
).
toBeTruthy
();
});
it
(
'should have correct classes'
,
function
()
{
var
chartArc
=
d3
.
select
(
'.c3-chart-arcs'
),
...
...
@@ -69,6 +60,38 @@ describe('c3 chart axis', function () {
expect
(
d3
.
select
(
'.c3-arc-black'
).
attr
(
'd'
)).
toMatch
(
/M-124
\.
.+,-171
\.
.+A211
\.
.+,211
\.
.+ 0 0,1 -3
\.
.+,-211
\.
.+L0,0Z/
);
});
it
(
'should update args to have empty pie chart'
,
function
()
{
args
=
{
data
:
{
columns
:
[
[
'data1'
,
null
],
[
'data2'
,
null
],
[
'data3'
,
null
]
],
type
:
'pie'
}
};
expect
(
true
).
toBeTruthy
();
});
it
(
'should have correct d attribute'
,
function
()
{
var
chartArc
=
d3
.
select
(
'.c3-chart-arcs'
),
arcs
=
{
data1
:
chartArc
.
select
(
'.c3-chart-arc.c3-target.c3-target-data1'
)
.
select
(
'g.c3-shapes.c3-shapes-data1.c3-arcs.c3-arcs-data1'
)
.
select
(
'path.c3-shape.c3-shape.c3-arc.c3-arc-data1'
),
data2
:
chartArc
.
select
(
'.c3-chart-arc.c3-target.c3-target-data2'
)
.
select
(
'g.c3-shapes.c3-shapes-data2.c3-arcs.c3-arcs-data2'
)
.
select
(
'path.c3-shape.c3-shape.c3-arc.c3-arc-data2'
),
data3
:
chartArc
.
select
(
'.c3-chart-arc.c3-target.c3-target-data3'
)
.
select
(
'g.c3-shapes.c3-shapes-data3.c3-arcs.c3-arcs-data3'
)
.
select
(
'path.c3-shape.c3-shape.c3-arc.c3-arc-data3'
)
};
expect
(
arcs
.
data1
.
attr
(
'd'
).
indexOf
(
'NaN'
)).
toBe
(
-
1
);
expect
(
arcs
.
data2
.
attr
(
'd'
).
indexOf
(
'NaN'
)).
toBe
(
-
1
);
expect
(
arcs
.
data3
.
attr
(
'd'
).
indexOf
(
'NaN'
)).
toBe
(
-
1
);
});
});
});
spec/c3-helper.js
View file @
4766795d
...
...
@@ -29,10 +29,13 @@ function initChart(chart, args, done) {
if
(
typeof
chart
===
'undefined'
)
{
window
.
initDom
();
}
chart
=
window
.
c3
.
generate
(
args
);
chart
.
internal
.
d3
.
select
(
'.jasmine_html-reporter'
)
.
style
(
'position'
,
'absolute'
)
.
style
(
'right'
,
0
);
if
(
args
)
{
chart
=
window
.
c3
.
generate
(
args
);
window
.
d3
=
chart
.
internal
.
d3
;
window
.
d3
.
select
(
'.jasmine_html-reporter'
)
.
style
(
'position'
,
'absolute'
)
.
style
(
'right'
,
0
);
}
window
.
setTimeout
(
function
()
{
done
();
...
...
src/arc.js
View file @
4766795d
...
...
@@ -36,6 +36,9 @@ c3_chart_internal_fn.updateAngle = function (d) {
}
index
++
;
});
if
(
isNaN
(
d
.
startAngle
))
{
d
.
startAngle
=
0
;
}
if
(
isNaN
(
d
.
endAngle
))
{
d
.
endAngle
=
d
.
startAngle
;
}
...
...
@@ -308,6 +311,9 @@ c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransf
// endAngle: Math.PI*2,
// };
// }
if
(
isNaN
(
this
.
_current
.
startAngle
))
{
this
.
_current
.
startAngle
=
0
;
}
if
(
isNaN
(
this
.
_current
.
endAngle
))
{
this
.
_current
.
endAngle
=
this
.
_current
.
startAngle
;
}
...
...
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