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
cc0e2bab
Commit
cc0e2bab
authored
Jun 11, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix load API to accept unload without input - #342
parent
ded33770
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
55 deletions
+64
-55
c3.js
c3.js
+7
-8
c3.min.js
c3.min.js
+0
-0
data_load.html
htdocs/samples/data_load.html
+57
-47
No files found.
c3.js
View file @
cc0e2bab
...
@@ -4476,24 +4476,23 @@
...
@@ -4476,24 +4476,23 @@
}
}
}
}
function
loadFromArgs
(
args
)
{
function
loadFromArgs
(
args
)
{
// load data
if
(
args
.
data
)
{
if
(
'data'
in
args
)
{
load
(
convertDataToTargets
(
args
.
data
),
args
);
load
(
convertDataToTargets
(
args
.
data
),
args
);
}
}
else
if
(
'url'
in
args
)
{
else
if
(
args
.
url
)
{
d3
.
csv
(
args
.
url
,
function
(
error
,
data
)
{
d3
.
csv
(
args
.
url
,
function
(
error
,
data
)
{
load
(
convertDataToTargets
(
data
),
args
);
load
(
convertDataToTargets
(
data
),
args
);
});
});
}
}
else
if
(
'rows'
in
args
)
{
else
if
(
args
.
json
)
{
load
(
convertDataToTargets
(
convertJsonToData
(
args
.
json
,
args
.
keys
)),
args
);
}
else
if
(
args
.
rows
)
{
load
(
convertDataToTargets
(
convertRowsToData
(
args
.
rows
)),
args
);
load
(
convertDataToTargets
(
convertRowsToData
(
args
.
rows
)),
args
);
}
}
else
if
(
'columns'
in
arg
s
)
{
else
if
(
args
.
column
s
)
{
load
(
convertDataToTargets
(
convertColumnsToData
(
args
.
columns
)),
args
);
load
(
convertDataToTargets
(
convertColumnsToData
(
args
.
columns
)),
args
);
}
}
else
{
throw
Error
(
'url or rows or columns is required.'
);
}
}
}
function
unload
(
targetIds
,
done
)
{
function
unload
(
targetIds
,
done
)
{
...
...
c3.min.js
View file @
cc0e2bab
This source diff could not be displayed because it is too large. You can
view the blob
instead.
htdocs/samples/data_load.html
View file @
cc0e2bab
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
<script
src=
"http://d3js.org/d3.v3.min.js"
charset=
"utf-8"
></script>
<script
src=
"http://d3js.org/d3.v3.min.js"
charset=
"utf-8"
></script>
<script
src=
"/js/c3.js"
></script>
<script
src=
"/js/c3.js"
></script>
<script>
<script>
var
chart
=
c3
.
generate
({
var
chart
=
c3
.
generate
({
data
:
{
data
:
{
url
:
'/data/c3_test.csv'
,
url
:
'/data/c3_test.csv'
,
...
@@ -27,36 +28,19 @@
...
@@ -27,36 +28,19 @@
}
}
});
});
setTimeout
(
function
()
{
var
queue
=
[
function
()
{
chart
.
load
({
chart
.
load
({
url
:
'/data/c3_test2.csv'
,
url
:
'/data/c3_test2.csv'
,
filter
:
function
(
t
)
{
filter
:
function
(
t
)
{
return
t
.
id
!==
'data1'
;
return
t
.
id
!==
'data1'
;
}
}
});
});
},
1000
);
},
function
()
{
setTimeout
(
function
()
{
// chart.unload(['data1', 'data2']);
// chart.unload('data1');
chart
.
unload
(
'data2'
);
},
2000
);
setTimeout
(
function
()
{
chart
.
load
({
columns
:
[
[
'data1@test'
,
30
,
20
,
50
,
40
,
60
,
50
],
],
unload
:
true
,
// unload: ['data2', 'data3'],
// unload: ['data2']
});
},
3000
);
setTimeout
(
function
()
{
chart
.
load
({
chart
.
load
({
rows
:
[
rows
:
[
[
'data
1@test'
,
'data2'
,
'data3
'
],
[
'data
4'
,
'data5'
,
'data6
'
],
[
90
,
120
,
300
],
[
90
,
120
,
300
],
[
40
,
160
,
240
],
[
40
,
160
,
240
],
[
50
,
200
,
290
],
[
50
,
200
,
290
],
...
@@ -65,36 +49,57 @@
...
@@ -65,36 +49,57 @@
[
90
,
220
,
320
],
[
90
,
220
,
320
],
]
]
});
});
},
4000
);
},
function
()
{
setTimeout
(
function
()
{
chart
.
unload
([
'data4'
,
'data5'
]);
},
function
()
{
chart
.
unload
(
'data6'
);
},
function
()
{
chart
.
load
({
chart
.
load
({
columns
:[
columns
:[
[
'data1'
,
30
,
20
,
50
,
40
,
60
,
50
,
100
,
200
]
[
'data1'
,
30
,
20
,
50
,
40
,
60
,
50
,
100
,
200
],
[
'data7'
,
230
,
220
,
250
,
240
,
260
,
250
,
300
,
400
]
]
]
});
});
},
5000
);
},
function
()
{
setTimeout
(
function
()
{
chart
.
unload
(
'data1@test'
);
},
6000
);
setTimeout
(
function
()
{
chart
.
load
({
chart
.
load
({
columns
:[
json
:
{
[
'data2'
,
null
,
30
,
20
,
50
,
40
,
60
,
50
]
data1
:
[
1030
,
1020
,
1050
,
1040
,
1060
,
1050
,
1100
,
1200
],
]
data7
:
[
430
,
420
,
450
,
440
,
460
,
550
,
400
,
200
]
}
});
});
},
7000
);
},
function
()
{
setTimeout
(
function
()
{
chart
.
load
({
columns
:
[
[
'data8'
,
30
,
20
,
50
,
40
,
60
,
50
],
],
unload
:
true
,
});
},
function
()
{
chart
.
load
({
columns
:
[
[
'data9'
,
130
,
120
,
150
,
140
,
160
,
150
],
],
unload
:
[
'data7'
,
'data8'
],
});
},
function
()
{
chart
.
load
({
unload
:
[
'data1'
,
'data2'
],
});
},
function
()
{
chart
.
unload
();
chart
.
unload
();
},
8000
);
},
function
()
{
setTimeout
(
function
()
{
chart
.
load
({
chart
.
load
({
rows
:
[
rows
:
[
[
'data1
@test
'
,
'data2'
,
'data3'
],
[
'data1'
,
'data2'
,
'data3'
],
[
90
,
120
,
300
],
[
90
,
120
,
300
],
[
40
,
160
,
240
],
[
40
,
160
,
240
],
[
50
,
200
,
290
],
[
50
,
200
,
290
],
...
@@ -103,11 +108,16 @@
...
@@ -103,11 +108,16 @@
[
90
,
220
,
320
],
[
90
,
220
,
320
],
]
]
});
});
},
9000
);
},
function
()
{
setTimeout
(
function
()
{
chart
.
unload
([
'data2'
,
'data3'
]);
chart
.
unload
([
'data2'
,
'data3'
]);
},
10000
);
},
];
var
i
=
0
;
queue
.
forEach
(
function
(
f
)
{
setTimeout
(
f
,
1500
*
i
++
);
});
</script>
</script>
</body>
</body>
...
...
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