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.
50 lines
1.2 KiB
50 lines
1.2 KiB
<html> |
|
<head> |
|
<link rel="stylesheet" type="text/css" href="/css/c3.css"> |
|
</head> |
|
<body> |
|
<div id="chart"></div> |
|
|
|
<script src="http://d3js.org/d3.v5.min.js" charset="utf-8"></script> |
|
<script src="/js/c3.js"></script> |
|
<script> |
|
var chart = c3.generate({ |
|
bindto: '#chart', |
|
data: { |
|
columns: [ |
|
['sample', 30, 200, 100, 400, 150, 250] |
|
] |
|
}, |
|
axis: { |
|
// rotated: true, |
|
}, |
|
grid: { |
|
y: { |
|
lines: [{value: 30, text:'Label 30'}, {value: 250, text: 'Label 250'}] |
|
} |
|
} |
|
}); |
|
|
|
setTimeout(function () { |
|
chart.ygrids([{value: 130, text:'Label 130'}, {value: 50, text: 'Label 50'}]); |
|
}, 1000); |
|
|
|
setTimeout(function () { |
|
chart.ygrids([{value: 130, text:'Label 130', class: 'hoge'}]); |
|
}, 2000); |
|
|
|
setTimeout(function () { |
|
chart.ygrids.add([{value: 230, text:'Label 230', class: 'hoge'}]); |
|
}, 3000); |
|
|
|
setTimeout(function () { |
|
chart.ygrids.remove({value: 230}); |
|
}, 4000); |
|
|
|
setTimeout(function () { |
|
chart.ygrids.remove({class: 'hoge'}); |
|
}, 5000); |
|
|
|
</script> |
|
</body> |
|
</html>
|
|
|