mirror of https://github.com/masayuki0812/c3.git
Quite good looking graph derived from d3.js
http://c3js.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.4 KiB
33 lines
1.4 KiB
7 years ago
|
var chart = c3.generate({
|
||
|
data: {
|
||
|
// iris data from R
|
||
|
columns: [
|
||
|
['data1', 30],
|
||
|
['data2', 120],
|
||
|
],
|
||
|
type : 'pie',
|
||
|
onclick: function (d, i) { console.log("onclick", d, i); },
|
||
|
onmouseover: function (d, i) { console.log("onmouseover", d, i); },
|
||
|
onmouseout: function (d, i) { console.log("onmouseout", d, i); }
|
||
|
}
|
||
|
});
|
||
|
|
||
|
setTimeout(function () {
|
||
|
chart.load({
|
||
|
columns: [
|
||
|
["setosa", 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, 0.2, 0.4, 0.2, 0.5, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, 0.1, 0.2, 0.2, 0.2, 0.2, 0.1, 0.2, 0.2, 0.3, 0.3, 0.2, 0.6, 0.4, 0.3, 0.2, 0.2, 0.2, 0.2],
|
||
|
["versicolor", 1.4, 1.5, 1.5, 1.3, 1.5, 1.3, 1.6, 1.0, 1.3, 1.4, 1.0, 1.5, 1.0, 1.4, 1.3, 1.4, 1.5, 1.0, 1.5, 1.1, 1.8, 1.3, 1.5, 1.2, 1.3, 1.4, 1.4, 1.7, 1.5, 1.0, 1.1, 1.0, 1.2, 1.6, 1.5, 1.6, 1.5, 1.3, 1.3, 1.3, 1.2, 1.4, 1.2, 1.0, 1.3, 1.2, 1.3, 1.3, 1.1, 1.3],
|
||
|
["virginica", 2.5, 1.9, 2.1, 1.8, 2.2, 2.1, 1.7, 1.8, 1.8, 2.5, 2.0, 1.9, 2.1, 2.0, 2.4, 2.3, 1.8, 2.2, 2.3, 1.5, 2.3, 2.0, 2.0, 1.8, 2.1, 1.8, 1.8, 1.8, 2.1, 1.6, 1.9, 2.0, 2.2, 1.5, 1.4, 2.3, 2.4, 1.8, 1.8, 2.1, 2.4, 2.3, 1.9, 2.3, 2.5, 2.3, 1.9, 2.0, 2.3, 1.8],
|
||
|
]
|
||
|
});
|
||
|
}, 1500);
|
||
|
|
||
|
setTimeout(function () {
|
||
|
chart.unload({
|
||
|
ids: 'data1'
|
||
|
});
|
||
|
chart.unload({
|
||
|
ids: 'data2'
|
||
|
});
|
||
|
}, 2500);
|