From 54fc6d3d478dfea3e74592578a674cd89ffc76c4 Mon Sep 17 00:00:00 2001 From: Clayton Grassick Date: Tue, 25 Oct 2016 15:12:32 -0400 Subject: [PATCH] Prevent beginning of title from being clipped when title is centereed --- src/title.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/title.js b/src/title.js index a58b68e..18477b9 100644 --- a/src/title.js +++ b/src/title.js @@ -15,7 +15,7 @@ c3_chart_internal_fn.xForTitle = function () { if (position.indexOf('right') >= 0) { x = $$.currentWidth - $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).width - config.title_padding.right; } 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 x = config.title_padding.left; }