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.

109 lines
2.2 KiB

<html>
<head>
<link rel="stylesheet" type="text/css" href="/css/c3.css">
10 years ago
<style>
.c3-region-1 {
fill: #dd3333;
fill-opacity: 0.8
}
</style>
</head>
<body>
<div id="chart"></div>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="/js/c3.js"></script>
<script>
var chart = c3.generate({
data: {
columns: [
['data1', 30, 200, 100, 400, null, 250],
['data2', 310, 400, 200, 100, 450, 150],
// ['data3', 310, 400, 200, 100, null, 150],
],
types: {
data2: 'area',
data3: 'bar',
},
labels: true
},
bar: {
width: 10
},
axis: {
x: {
padding: {
left: 0,
right: 0,
}
},
y: {
/*
min: -100,
max: 1000
*/
}
10 years ago
},
grid: {
x: {
show: true,
lines: [{value: 3, text:'Label 3'}, {value: 4.5, text: 'Label 4.5'}]
10 years ago
},
y: {
show: true
}
10 years ago
},
regions: [
{start:2, end:4, class:'region1'},
{start:100, end:200, axis:'y'},
],
});
setTimeout(function () {
chart.flow({
columns: [
['data1', 500],
['data2', 100],
['data3', 200],
],
duration: 500,
onend: function () {
chart.flow({
columns: [
['data1', 200],
['data3', 100]
],
duration: 150,
length: 0
});
},
length: 2
});
}, 1000);
setTimeout(function () {
chart.flow({
columns: [
['data1', 200],
// ['data2', 100],
['data3', 100]
],
to: 5,
});
}, 3000);
setTimeout(function () {
chart.flow({
columns: [
['data1', 200],
['data2', 300],
['data3', 400]
]
});
}, 4000);
</script>
</body>
</html>