Browse Source

Add bar with max width example

pull/1672/head
Rodrigo Wirth 9 years ago
parent
commit
1b62d17198
  1. 3
      htdocs/index.html
  2. 37
      htdocs/samples/chart_bar_max_width.html

3
htdocs/index.html

@ -50,6 +50,9 @@
<a href="./samples/chart_bar_stacked.html">
Stacked Bar chart with ordinary data
</a>
<a href="./samples/chart_bar_max_width.html">
Bar chart with max width
</a>
</div>
</div>
<div class="row">

37
htdocs/samples/chart_bar_max_width.html

@ -0,0 +1,37 @@
<html>
<head>
<link href="/css/c3.css" rel="stylesheet" type="text/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({
data: {
columns: [
['data1', 1030, 1200, 1100, 1400, 1150, 1250],
['data2', 2130, 2100, 2140, 2200, 2150, 1850]
// ['data1', 30, 200, 100, 400, 150, 250],
// ['data2', 130, 100, 140, 200, 150, 50]
],
type: 'bar',
onclick: function (d, element) { console.log("onclick", d, element); },
onmouseover: function (d) { console.log("onmouseover", d); },
onmouseout: function (d) { console.log("onmouseout", d); }
},
axis: {
x: {
type: 'categorized'
}
},
bar: {
width: {
max: 40
},
}
});
</script>
</body>
</html>
Loading…
Cancel
Save