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
3c54adf6
Commit
3c54adf6
authored
Nov 28, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix hasType when empty data - #757
parent
bfffa3c4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
21 deletions
+57
-21
c3.js
c3.js
+3
-1
c3.min.js
c3.min.js
+0
-0
type-spec.js
spec/type-spec.js
+51
-19
type.js
src/type.js
+3
-1
No files found.
c3.js
View file @
3c54adf6
...
@@ -3263,10 +3263,12 @@
...
@@ -3263,10 +3263,12 @@
has
=
true
;
has
=
true
;
}
}
});
});
}
else
{
}
else
if
(
Object
.
keys
(
types
).
length
)
{
Object
.
keys
(
types
).
forEach
(
function
(
id
)
{
Object
.
keys
(
types
).
forEach
(
function
(
id
)
{
if
(
types
[
id
]
===
type
)
{
has
=
true
;
}
if
(
types
[
id
]
===
type
)
{
has
=
true
;
}
});
});
}
else
{
has
=
$$
.
config
.
data_type
===
type
;
}
}
return
has
;
return
has
;
};
};
...
...
c3.min.js
View file @
3c54adf6
This source diff could not be displayed because it is too large. You can
view the blob
instead.
spec/type-spec.js
View file @
3c54adf6
...
@@ -20,39 +20,71 @@ describe('c3 chart types', function () {
...
@@ -20,39 +20,71 @@ describe('c3 chart types', function () {
};
};
beforeEach
(
function
(
done
)
{
beforeEach
(
function
(
done
)
{
if
(
typeof
chart
===
'undefined'
)
{
chart
=
window
.
initChart
(
chart
,
args
,
done
);
window
.
initDom
();
}
chart
=
window
.
c3
.
generate
(
args
);
d3
=
chart
.
internal
.
d3
;
d3
=
chart
.
internal
.
d3
;
chart
.
internal
.
d3
.
select
(
'.jasmine_html-reporter'
).
style
(
'display'
,
'none'
);
window
.
setTimeout
(
function
()
{
done
();
},
10
);
});
});
describe
(
'internal.hasArcType'
,
function
()
{
describe
(
'internal.hasArcType'
,
function
()
{
it
(
'should return true'
,
function
()
{
describe
(
'with data'
,
function
()
{
expect
(
chart
.
internal
.
hasArcType
()).
toBeTruthy
();
});
it
(
'should return true'
,
function
()
{
expect
(
chart
.
internal
.
hasArcType
()).
toBeTruthy
();
});
it
(
'should change chart type to "bar"'
,
function
()
{
args
.
data
.
type
=
'bar'
;
expect
(
true
).
toBeTruthy
();
});
it
(
'should return false'
,
function
()
{
expect
(
chart
.
internal
.
hasArcType
()).
toBeFalsy
();
});
it
(
'should change chart type to "bar" successfully'
,
function
()
{
args
.
data
.
type
=
'bar'
;
expect
(
true
).
toBeTruthy
();
});
});
it
(
'should return false'
,
function
()
{
describe
(
'with empty data'
,
function
()
{
expect
(
chart
.
internal
.
hasArcType
()).
toBeFalsy
();
it
(
'should update args to have empty data'
,
function
()
{
args
=
{
data
:
{
columns
:
[],
type
:
'pie'
}
};
expect
(
true
).
toBeTruthy
();
});
it
(
'should return true'
,
function
()
{
expect
(
chart
.
internal
.
hasArcType
()).
toBeTruthy
();
});
it
(
'should change chart type to "bar"'
,
function
()
{
args
.
data
.
type
=
'bar'
;
expect
(
true
).
toBeTruthy
();
});
it
(
'should return false'
,
function
()
{
expect
(
chart
.
internal
.
hasArcType
()).
toBeFalsy
();
});
});
});
});
});
describe
(
'internal.hasType'
,
function
()
{
describe
(
'internal.hasType'
,
function
()
{
it
(
'should change chart type to "pie" successfully'
,
function
()
{
it
(
'should update args'
,
function
()
{
args
.
data
.
type
=
'pie'
;
args
=
{
data
:
{
columns
:
[
[
'data1'
,
30
,
200
,
100
,
400
,
150
,
250
],
[
'data2'
,
50
,
20
,
10
,
40
,
15
,
25
],
[
'data3'
,
150
,
120
,
110
,
140
,
115
,
125
]
],
type
:
'pie'
}
};
expect
(
true
).
toBeTruthy
();
expect
(
true
).
toBeTruthy
();
});
});
...
...
src/type.js
View file @
3c54adf6
...
@@ -18,10 +18,12 @@ c3_chart_internal_fn.hasType = function (type, targets) {
...
@@ -18,10 +18,12 @@ c3_chart_internal_fn.hasType = function (type, targets) {
has
=
true
;
has
=
true
;
}
}
});
});
}
else
{
}
else
if
(
Object
.
keys
(
types
).
length
)
{
Object
.
keys
(
types
).
forEach
(
function
(
id
)
{
Object
.
keys
(
types
).
forEach
(
function
(
id
)
{
if
(
types
[
id
]
===
type
)
{
has
=
true
;
}
if
(
types
[
id
]
===
type
)
{
has
=
true
;
}
});
});
}
else
{
has
=
$$
.
config
.
data_type
===
type
;
}
}
return
has
;
return
has
;
};
};
...
...
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