diff --git a/htdocs/samples/axes_x_tick_rotate.html b/htdocs/samples/axes_x_tick_rotate.html index c226455..2802232 100644 --- a/htdocs/samples/axes_x_tick_rotate.html +++ b/htdocs/samples/axes_x_tick_rotate.html @@ -20,7 +20,7 @@ x: { tick: { format: function () { return "hogehogehogehogehoge"; }, - rotate: 30, + rotate: -30, }, label: { text: 'Hogehoge', diff --git a/src/size.js b/src/size.js index 2a91b26..52f46a4 100644 --- a/src/size.js +++ b/src/size.js @@ -105,11 +105,11 @@ c3_chart_internal_fn.getHorizontalAxisHeight = function (axisId) { if (axisId === 'y2' && !config.axis_y2_show) { return $$.rotated_padding_top; } // Calculate x axis height when tick rotated if (axisId === 'x' && !config.axis_rotated && config.axis_x_tick_rotate) { - h = 30 + $$.axis.getMaxTickWidth(axisId) * Math.cos(Math.PI * (90 - config.axis_x_tick_rotate) / 180); + h = 30 + $$.axis.getMaxTickWidth(axisId) * Math.cos(Math.PI * (90 - Math.abs(config.axis_x_tick_rotate)) / 180); } // Calculate y axis height when tick rotated if (axisId === 'y' && config.axis_rotated && config.axis_y_tick_rotate) { - h = 30 + $$.axis.getMaxTickWidth(axisId) * Math.cos(Math.PI * (90 - config.axis_y_tick_rotate) / 180); + h = 30 + $$.axis.getMaxTickWidth(axisId) * Math.cos(Math.PI * (90 - Math.abs(config.axis_y_tick_rotate)) / 180); } return h + ($$.axis.getLabelPositionById(axisId).isInner ? 0 : 10) + (axisId === 'y2' ? -10 : 0); };