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
d074ef8a
Commit
d074ef8a
authored
Mar 31, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix timeseries data loading
parent
951a78ac
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
7 deletions
+21
-7
c3.js
c3.js
+2
-7
c3.min.js
c3.min.js
+0
-0
timeseries.html
htdocs/samples/timeseries.html
+19
-0
No files found.
c3.js
View file @
d074ef8a
...
...
@@ -1253,7 +1253,7 @@
function
generateTargetX
(
rawX
,
id
,
index
)
{
var
x
;
if
(
isTimeSeries
)
{
x
=
rawX
?
rawX
instanceof
Date
?
rawX
:
parseDate
(
rawX
)
:
null
;
x
=
rawX
?
rawX
instanceof
Date
?
rawX
:
parseDate
(
rawX
)
:
parseDate
(
getXValue
(
id
,
index
))
;
}
else
if
(
isCustomX
&&
!
isCategorized
)
{
x
=
rawX
?
+
rawX
:
getXValue
(
id
,
index
);
...
...
@@ -1290,15 +1290,10 @@
function
convertDataToTargets
(
data
)
{
var
ids
=
d3
.
keys
(
data
[
0
]).
filter
(
isNotX
),
xs
=
d3
.
keys
(
data
[
0
]).
filter
(
isX
),
targets
;
// check "x" is defined if timeseries
if
(
isTimeSeries
&&
xs
.
length
===
0
)
{
throw
new
Error
(
'data.x or data.xs must be specified when axis.x.type == "timeseries"'
);
}
// save x for update data by load when custom x and c3.x API
ids
.
forEach
(
function
(
id
)
{
var
xKey
=
getXKey
(
id
);
if
(
isCustomX
)
{
if
(
isCustomX
||
isTimeSeries
)
{
if
(
xs
.
indexOf
(
xKey
)
>=
0
)
{
c3
.
data
.
x
[
id
]
=
data
.
map
(
function
(
d
)
{
return
d
[
xKey
];
});
}
...
...
c3.min.js
View file @
d074ef8a
This diff is collapsed.
Click to expand it.
htdocs/samples/timeseries.html
View file @
d074ef8a
...
...
@@ -30,6 +30,25 @@
}
}
});
setTimeout
(
function
()
{
chart
.
load
({
columns
:
[
[
'sample'
,
200
,
130
,
90
,
240
,
130
,
100
],
[
'sample2'
,
300
,
200
,
160
,
400
,
250
,
250
]
]
});
},
1000
);
setTimeout
(
function
()
{
chart
.
load
({
columns
:
[
[
'date'
,
'20140101'
,
'20140201'
,
'20140301'
,
'20140401'
,
'20140501'
,
'20140601'
],
[
'sample'
,
500
,
630
,
690
,
440
,
630
,
900
],
[
'sample2'
,
400
,
600
,
460
,
200
,
350
,
450
]
]
});
},
2000
);
</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