Browse Source

Added margin configuration

pull/615/head
michalkop93 10 years ago
parent
commit
bb61a94039
  1. 20
      c3.js
  2. 8
      c3.min.js
  3. 4
      src/config.js
  4. 16
      src/core.js

20
c3.js

@ -333,15 +333,15 @@
// for main
$$.margin = config.axis_rotated ? {
top: $$.getHorizontalAxisHeight('y2') + $$.getCurrentPaddingTop(),
right: hasArc ? 0 : $$.getCurrentPaddingRight(),
bottom: $$.getHorizontalAxisHeight('y') + legendHeightForBottom + $$.getCurrentPaddingBottom(),
left: subchartHeight + (hasArc ? 0 : $$.getCurrentPaddingLeft())
top: config.margin_top ? config.margin.top : $$.getHorizontalAxisHeight('y2') + $$.getCurrentPaddingTop(),
right: hasArc ? 0 : config.margin_right ? config.margin_right : $$.getCurrentPaddingRight(),
bottom: config.margin_bottom ? config.margin_bottom : $$.getHorizontalAxisHeight('y') + legendHeightForBottom + $$.getCurrentPaddingBottom(),
left: subchartHeight + (hasArc ? 0 : config.margin_left ? config.margin_left : $$.getCurrentPaddingLeft())
} : {
top: 4 + $$.getCurrentPaddingTop(), // for top tick text
right: hasArc ? 0 : $$.getCurrentPaddingRight(),
bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),
left: hasArc ? 0 : $$.getCurrentPaddingLeft()
top: 4 + config.margin_top ? config.margin.top : $$.getCurrentPaddingTop(), // for top tick text
right: hasArc ? 0 : config.margin_right ? config.margin_right : $$.getCurrentPaddingRight(),
bottom: config.margin_bottom ? config.margin_bottom : xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),
left: hasArc ? 0 : config.margin_left ? config.margin_left : $$.getCurrentPaddingLeft()
};
// for subchart
@ -886,6 +886,10 @@
padding_right: undefined,
padding_top: undefined,
padding_bottom: undefined,
margin_left: undefined,
margin_right: undefined,
margin_top: undefined,
margin_bottom: undefined,
zoom_enabled: false,
zoom_extent: undefined,
zoom_privileged: false,

8
c3.min.js vendored

File diff suppressed because one or more lines are too long

4
src/config.js

@ -7,6 +7,10 @@ c3_chart_internal_fn.getDefaultConfig = function () {
padding_right: undefined,
padding_top: undefined,
padding_bottom: undefined,
margin_left: undefined,
margin_right: undefined,
margin_top: undefined,
margin_bottom: undefined,
zoom_enabled: false,
zoom_extent: undefined,
zoom_privileged: false,

16
src/core.js

@ -328,15 +328,15 @@ c3_chart_internal_fn.updateSizes = function () {
// for main
$$.margin = config.axis_rotated ? {
top: $$.getHorizontalAxisHeight('y2') + $$.getCurrentPaddingTop(),
right: hasArc ? 0 : $$.getCurrentPaddingRight(),
bottom: $$.getHorizontalAxisHeight('y') + legendHeightForBottom + $$.getCurrentPaddingBottom(),
left: subchartHeight + (hasArc ? 0 : $$.getCurrentPaddingLeft())
top: config.margin_top ? config.margin.top : $$.getHorizontalAxisHeight('y2') + $$.getCurrentPaddingTop(),
right: hasArc ? 0 : config.margin_right ? config.margin_right : $$.getCurrentPaddingRight(),
bottom: config.margin_bottom ? config.margin_bottom : $$.getHorizontalAxisHeight('y') + legendHeightForBottom + $$.getCurrentPaddingBottom(),
left: subchartHeight + (hasArc ? 0 : config.margin_left ? config.margin_left : $$.getCurrentPaddingLeft())
} : {
top: 4 + $$.getCurrentPaddingTop(), // for top tick text
right: hasArc ? 0 : $$.getCurrentPaddingRight(),
bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),
left: hasArc ? 0 : $$.getCurrentPaddingLeft()
top: 4 + config.margin_top ? config.margin.top : $$.getCurrentPaddingTop(), // for top tick text
right: hasArc ? 0 : config.margin_right ? config.margin_right : $$.getCurrentPaddingRight(),
bottom: config.margin_bottom ? config.margin_bottom : xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),
left: hasArc ? 0 : config.margin_left ? config.margin_left : $$.getCurrentPaddingLeft()
};
// for subchart

Loading…
Cancel
Save