Browse Source

Prevent beginning of title from being clipped when title is centereed

pull/1867/head
Clayton Grassick 8 years ago
parent
commit
54fc6d3d47
  1. 2
      src/title.js

2
src/title.js

@ -15,7 +15,7 @@ c3_chart_internal_fn.xForTitle = function () {
if (position.indexOf('right') >= 0) { if (position.indexOf('right') >= 0) {
x = $$.currentWidth - $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).width - config.title_padding.right; x = $$.currentWidth - $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).width - config.title_padding.right;
} else if (position.indexOf('center') >= 0) { } else if (position.indexOf('center') >= 0) {
x = ($$.currentWidth - $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).width) / 2; x = Math.max(($$.currentWidth - $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).width) / 2, 0);
} else { // left } else { // left
x = config.title_padding.left; x = config.title_padding.left;
} }

Loading…
Cancel
Save