|
|
|
@ -8,7 +8,10 @@
|
|
|
|
|
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> |
|
|
|
|
<script src="/js/c3.js"></script> |
|
|
|
|
<script> |
|
|
|
|
var chart = c3.generate({ |
|
|
|
|
|
|
|
|
|
var axis_rotated = false, axis_x_type = ""; |
|
|
|
|
|
|
|
|
|
var generate = function () { return c3.generate({ |
|
|
|
|
bindto: '#chart', |
|
|
|
|
data: { |
|
|
|
|
columns: [ |
|
|
|
@ -16,46 +19,106 @@
|
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
axis: { |
|
|
|
|
// rotated: true, |
|
|
|
|
rotated: axis_rotated, |
|
|
|
|
x: { |
|
|
|
|
type: axis_x_type |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
grid: { |
|
|
|
|
x: { |
|
|
|
|
// lines: [{value: 3, text:'Label 3'}, {value: 4.5, text: 'Label 4.5'}] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); }, chart = generate(); |
|
|
|
|
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
var queue = [ |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids([{value: 1, text:'Label 1'}, {value: 4, text: 'Label 4'}]); |
|
|
|
|
}, 1000); |
|
|
|
|
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids([{value: 2, text:'Label 2'}]); |
|
|
|
|
}, 2000); |
|
|
|
|
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.add([{value: 3, text:'Label 3', class:'hoge'}]); |
|
|
|
|
}, 3000); |
|
|
|
|
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.remove({value:2}); |
|
|
|
|
}, 4000); |
|
|
|
|
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.remove({class:'hoge'}); |
|
|
|
|
}, 5000); |
|
|
|
|
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.remove([{value: 1}, {value: 4}]); |
|
|
|
|
}, 6000); |
|
|
|
|
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids([{value: 1, text:'Label 1'}, {value: 4, text: 'Label 4'}]); |
|
|
|
|
}, 7000); |
|
|
|
|
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.remove(); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
axis_rotated = true; |
|
|
|
|
chart = generate(); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids([{value: 1, text:'Label 1'}, {value: 4, text: 'Label 4'}]); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids([{value: 2, text:'Label 2'}]); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.add([{value: 3, text:'Label 3', class:'hoge'}]); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.remove({value:2}); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.remove({class:'hoge'}); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.remove([{value: 1}, {value: 4}]); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids([{value: 1, text:'Label 1'}, {value: 4, text: 'Label 4'}]); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.remove(); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
axis_rotated = false; |
|
|
|
|
axis_x_type = 'category'; |
|
|
|
|
chart = generate(); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids([{value: 1, text:'Label 1'}, {value: 4, text: 'Label 4'}]); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids([{value: 2, text:'Label 2'}]); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.add([{value: 3, text:'Label 3', class:'hoge'}]); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.remove({value:2}); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.remove({class:'hoge'}); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.remove([{value: 1}, {value: 4}]); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids([{value: 1, text:'Label 1'}, {value: 4, text: 'Label 4'}]); |
|
|
|
|
}, |
|
|
|
|
function () { |
|
|
|
|
chart.xgrids.remove(); |
|
|
|
|
}, 8000); |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
var i = 0; |
|
|
|
|
queue.forEach(function (f) { |
|
|
|
|
setTimeout(f, 1000 * i++); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
|
</body> |
|
|
|
|