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
645a034e
Commit
645a034e
authored
Jun 06, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix loading json with undefined data - #325
parent
a7cc082d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletion
+31
-1
c3.js
c3.js
+3
-1
c3.min.js
c3.min.js
+0
-0
data_json.html
htdocs/samples/data_json.html
+28
-0
No files found.
c3.js
View file @
645a034e
...
...
@@ -1499,7 +1499,9 @@
json
.
forEach
(
function
(
o
)
{
var
new_row
=
[];
targetKeys
.
forEach
(
function
(
key
)
{
new_row
.
push
(
o
[
key
]);
// convert undefined to null becuase undefined data will be removed in convertDataToTargets()
var
v
=
typeof
o
[
key
]
===
'undefined'
?
null
:
o
[
key
];
new_row
.
push
(
v
);
});
new_rows
.
push
(
new_row
);
});
...
...
c3.min.js
View file @
645a034e
This source diff could not be displayed because it is too large. You can
view the blob
instead.
htdocs/samples/data_json.html
View file @
645a034e
...
...
@@ -5,6 +5,7 @@
<body>
<div
id=
"chart1"
></div>
<div
id=
"chart2"
></div>
<div
id=
"chart3"
></div>
<script
src=
"http://d3js.org/d3.v3.min.js"
charset=
"utf-8"
></script>
<script
src=
"/js/c3.js"
></script>
...
...
@@ -43,6 +44,33 @@
}
});
var
chart3
=
c3
.
generate
({
bindto
:
'#chart3'
,
data
:
{
json
:
[{
"date"
:
"2014-06-03"
,
"443"
:
"3000"
,
"995"
:
"500"
},
{
"date"
:
"2014-06-04"
,
"443"
:
"1000"
,
},
{
"date"
:
"2014-06-05"
,
"443"
:
"5000"
,
"995"
:
"1000"
}],
keys
:
{
x
:
'date'
,
value
:
[
"443"
,
"995"
]
}
},
axis
:
{
x
:
{
type
:
"category"
}
}
});
</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