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.
46 lines
1.4 KiB
46 lines
1.4 KiB
7 years ago
|
var chart = c3.generate({
|
||
|
data: {
|
||
|
json: {
|
||
|
data1: [30, 20, 50, 40, 60, 50],
|
||
|
data2: [200, 130, 90, 240, 130, 220],
|
||
|
data3: [300, 200, 160, 400, 250, 250]
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
setTimeout(function () {
|
||
|
chart = c3.generate({
|
||
|
data: {
|
||
|
json: [
|
||
|
{name: 'www.site1.com', upload: 200, download: 200, total: 400},
|
||
|
{name: 'www.site2.com', upload: 100, download: 300, total: 400},
|
||
|
{name: 'www.site3.com', upload: 300, download: 200, total: 500},
|
||
|
{name: 'www.site4.com', upload: 400, download: 100, total: 500},
|
||
|
],
|
||
|
keys: {
|
||
|
// x: 'name', // it's possible to specify 'x' when category axis
|
||
|
value: ['upload', 'download'],
|
||
|
}
|
||
|
},
|
||
|
axis: {
|
||
|
x: {
|
||
|
// type: 'category'
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}, 1000);
|
||
|
|
||
|
setTimeout(function () {
|
||
|
chart.load({
|
||
|
json: [
|
||
|
{name: 'www.site1.com', upload: 800, download: 500, total: 400},
|
||
|
{name: 'www.site2.com', upload: 600, download: 600, total: 400},
|
||
|
{name: 'www.site3.com', upload: 400, download: 800, total: 500},
|
||
|
{name: 'www.site4.com', upload: 400, download: 700, total: 500},
|
||
|
],
|
||
|
keys: {
|
||
|
value: ['upload', 'download'],
|
||
|
}
|
||
|
});
|
||
|
}, 2000);
|