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
a4805bcb
Commit
a4805bcb
authored
Apr 07, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add type and types param to load API
parent
3c8a8c4b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
c3.js
c3.js
+15
-7
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
a4805bcb
...
...
@@ -3537,7 +3537,13 @@
.
style
(
"opacity"
,
1
);
}
function
load
(
targets
,
done
)
{
function
load
(
targets
,
args
)
{
// set type if args.types || args.type specified
if
(
args
.
type
||
args
.
types
)
{
targets
.
forEach
(
function
(
t
)
{
args
.
types
?
setTargetType
(
t
.
id
,
args
.
types
[
t
.
id
])
:
setTargetType
(
t
.
id
,
args
.
type
);
});
}
// Update/Add data
c3
.
data
.
targets
.
forEach
(
function
(
d
)
{
for
(
var
i
=
0
;
i
<
targets
.
length
;
i
++
)
{
...
...
@@ -3556,23 +3562,25 @@
// Redraw with new targets
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
if
(
typeof
done
===
'function'
)
{
done
();
}
if
(
typeof
args
.
done
===
'function'
)
{
args
.
done
();
}
}
function
loadFromArgs
(
args
)
{
// load data
if
(
'data'
in
args
)
{
load
(
convertDataToTargets
(
args
.
data
),
args
.
done
);
load
(
convertDataToTargets
(
args
.
data
),
args
);
}
else
if
(
'url'
in
args
)
{
d3
.
csv
(
args
.
url
,
function
(
error
,
data
)
{
load
(
convertDataToTargets
(
data
),
args
.
done
);
load
(
convertDataToTargets
(
data
),
args
);
});
}
else
if
(
'rows'
in
args
)
{
load
(
convertDataToTargets
(
convertRowsToData
(
args
.
rows
)),
args
.
done
);
load
(
convertDataToTargets
(
convertRowsToData
(
args
.
rows
)),
args
);
}
else
if
(
'columns'
in
args
)
{
load
(
convertDataToTargets
(
convertColumnsToData
(
args
.
columns
)),
args
.
done
);
load
(
convertDataToTargets
(
convertColumnsToData
(
args
.
columns
)),
args
);
}
else
{
throw
Error
(
'url or rows or columns is required.'
);
...
...
@@ -3907,7 +3915,7 @@
};
c3
.
load
=
function
(
args
)
{
// update xs if
exists
// update xs if
specified
if
(
args
.
xs
)
{
addXs
(
args
.
xs
);
}
...
...
c3.min.js
View file @
a4805bcb
This diff is collapsed.
Click to expand it.
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