Browse Source

Introduce bar.width.max - #174

pull/452/head
Masayuki Tanaka 11 years ago
parent
commit
05707358e5
  1. 4
      c3.js
  2. 6
      c3.min.js
  3. 3
      htdocs/samples/chart_bar.html

4
c3.js

@ -257,6 +257,7 @@
// bar
var __bar_width = getConfig(['bar', 'width']),
__bar_width_ratio = getConfig(['bar', 'width', 'ratio'], 0.6),
__bar_width_max = getConfig(['bar', 'width', 'max']),
__bar_zerobased = getConfig(['bar', 'zerobased'], true);
// area
@ -2166,7 +2167,8 @@
//-- Bar --//
function getBarW(axis, barTargetsNum) {
return typeof __bar_width === 'number' ? __bar_width : barTargetsNum ? (axis.tickOffset() * 2 * __bar_width_ratio) / barTargetsNum : 0;
var w = typeof __bar_width === 'number' ? __bar_width : barTargetsNum ? (axis.tickOffset() * 2 * __bar_width_ratio) / barTargetsNum : 0;
return __bar_width_ratio && w > __bar_width_max ? __bar_width_max : w;
}
//-- Type --//

6
c3.min.js vendored

File diff suppressed because one or more lines are too long

3
htdocs/samples/chart_bar.html

@ -28,7 +28,8 @@
},
bar: {
width: {
ratio: 0.3
ratio: 0.3,
// max: 30
},
}
});

Loading…
Cancel
Save