Browse Source

Update sample for custom x

pull/104/head
Masayuki Tanaka 11 years ago
parent
commit
bd02e0f14c
  1. 18
      htdocs/samples/custom_x_scale.html
  2. 49
      htdocs/samples/custom_xs_scale.html

18
htdocs/samples/custom_x_scale.html

@ -14,12 +14,28 @@
x : 'x', x : 'x',
columns: [ columns: [
['x', 100, 120, 130, 200, 240, 500], ['x', 100, 120, 130, 200, 240, 500],
['sample', 30, 200, 100, 400, 150, 250] ['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 100, 300, 200, 250, 350],
], ],
selection: {
enabled: true
},
onenter: function (d) { console.log("onenter", d); }, onenter: function (d) { console.log("onenter", d); },
onleave: function (d) { console.log("onleave", d); } onleave: function (d) { console.log("onleave", d); }
}, },
}); });
setTimeout(function () {
chart.load({
columns: [
['data1', 100, 210, 150, 200, 100, 150],
]
});
}, 1000);
setTimeout(function () {
chart.x([200, 210, 350, 400, 550, 750]);
}, 2000);
</script> </script>
</body> </body>
</html> </html>

49
htdocs/samples/custom_xs_scale.html

@ -0,0 +1,49 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="/css/c3.css">
</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({
bindto: '#chart',
data: {
xs : {
'data1': 'x1',
'data2': 'x2',
},
columns: [
['x1', 100, 120, 130, 200, 240, 500],
['x2', 150, 220, 230, 400, 540, 600, 800],
['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 100, 300, 200, 250, 350, 100],
],
selection: {
enabled: true
},
onenter: function (d) { console.log("onenter", d); },
onleave: function (d) { console.log("onleave", d); }
},
});
setTimeout(function () {
chart.load({
columns: [
['data1', 100, 210, 150, 200, 100, 150],
['data2', 200, 310, 50, 400, 120, 250, 10],
]
});
}, 1000);
setTimeout(function () {
chart.xs({
// 'data1': [200, 210, 350, 400, 550, 750]
'data2': [200, 210, 350, 400, 550, 750, 900]
});
}, 2000);
</script>
</body>
</html>
Loading…
Cancel
Save