Browse Source

Added an example on how to set the min/max values for an axis.

pull/246/head
Edward van Kuik 11 years ago
parent
commit
30a04b326c
  1. 5
      htdocs/index.html
  2. 29
      htdocs/samples/axes_minmax.html

5
htdocs/index.html

@ -40,6 +40,11 @@
<p>Additional y axis can be added.</p>
<p><a class="btn btn-default" href="./samples/axes_y2.html" role="button">View details &raquo;</a></p>
</div>
<div class="col-md-4">
<h3>Specify Axis Min/Max Values</h3>
<p>You can specify your own min/max values for each axis.</p>
<p><a class="btn btn-default" href="./samples/axes_minmax.html" role="button">View details &raquo;</a></p>
</div>
</div>
</div>
</div>

29
htdocs/samples/axes_minmax.html

@ -0,0 +1,29 @@
<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: {
columns: [
['sample', 100, 200, 100, 400, 150, 250]
],
onclick: function (d, element) { console.log("onclick", d, element); },
onenter: function (d) { console.log("onenter", d); },
onleave: function (d) { console.log("onleave", d); },
},
axis: {
y: {
min: 0
}
},
});
</script>
</body>
</html>
Loading…
Cancel
Save