From 042b512438a7e61e4ce8654ec7ecc16f5ebbfd70 Mon Sep 17 00:00:00 2001 From: JakeSidSmith Date: Thu, 1 May 2014 14:42:18 +0100 Subject: [PATCH 01/13] test --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index b3d467f..fd83c5e 100644 --- a/c3.js +++ b/c3.js @@ -500,7 +500,7 @@ } function getHorizontalAxisHeight(axisId) { if (axisId === 'x' && !__axis_x_show) { return 0; } - if (axisId === 'x' && __axis_x_height) { return __axis_x_height; } + if (axisId === 'x' && __axis_x_height) { return 10; } if (axisId === 'y' && !__axis_y_show) { return __legend_show && !isLegendRight ? 10 : 1; } if (axisId === 'y2' && !__axis_y2_show) { return rotated_padding_top; } return (getAxisLabelPositionById(axisId).isInner ? 30 : 40) + (axisId === 'y2' ? -10 : 0); From e8bca5e385f99005c7ea41ef4ac0bd31d731239d Mon Sep 17 00:00:00 2001 From: JakeSidSmith Date: Thu, 1 May 2014 14:47:12 +0100 Subject: [PATCH 02/13] What does this do!?!? --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index fd83c5e..f3d2d31 100644 --- a/c3.js +++ b/c3.js @@ -500,7 +500,7 @@ } function getHorizontalAxisHeight(axisId) { if (axisId === 'x' && !__axis_x_show) { return 0; } - if (axisId === 'x' && __axis_x_height) { return 10; } + if (axisId === 'x' && __axis_x_height) { return 50; } if (axisId === 'y' && !__axis_y_show) { return __legend_show && !isLegendRight ? 10 : 1; } if (axisId === 'y2' && !__axis_y2_show) { return rotated_padding_top; } return (getAxisLabelPositionById(axisId).isInner ? 30 : 40) + (axisId === 'y2' ? -10 : 0); From d7ef870b5253b55880faf10632e1ee6991d77d31 Mon Sep 17 00:00:00 2001 From: JakeSidSmith Date: Thu, 1 May 2014 15:01:30 +0100 Subject: [PATCH 03/13] Actually hide the legend --- c3.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/c3.js b/c3.js index f3d2d31..eff1b6b 100644 --- a/c3.js +++ b/c3.js @@ -500,7 +500,7 @@ } function getHorizontalAxisHeight(axisId) { if (axisId === 'x' && !__axis_x_show) { return 0; } - if (axisId === 'x' && __axis_x_height) { return 50; } + if (axisId === 'x' && __axis_x_height) { return __axis_x_height; } if (axisId === 'y' && !__axis_y_show) { return __legend_show && !isLegendRight ? 10 : 1; } if (axisId === 'y2' && !__axis_y2_show) { return rotated_padding_top; } return (getAxisLabelPositionById(axisId).isInner ? 30 : 40) + (axisId === 'y2' ? -10 : 0); @@ -4451,12 +4451,12 @@ redraw({withLegend: true}); }; c3.legend.hide = function (targetIds) { - hideLegend(mapToTargetIds(targetIds)); - redraw({withLegend: true}); if (__legend_show && isEmpty(targetIds)) { __legend_show = false; legend.style('visibility', 'hidden'); } + hideLegend(mapToTargetIds(targetIds)); + redraw({withLegend: false}); }; c3.resize = function (size) { From b166475e4d0e2242f38bca789dd26cabb77b8700 Mon Sep 17 00:00:00 2001 From: JakeSidSmith Date: Thu, 1 May 2014 15:05:25 +0100 Subject: [PATCH 04/13] Hide legend completely? --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index eff1b6b..0dc53fc 100644 --- a/c3.js +++ b/c3.js @@ -4462,7 +4462,7 @@ c3.resize = function (size) { __size_width = size ? size.width : null; __size_height = size ? size.height : null; - updateAndRedraw({withLegend: true, withTransition: false, withTransitionForTransform: false}); + updateAndRedraw({withLegend: false, withTransition: false, withTransitionForTransform: false}); }; c3.destroy = function () { From 8677b93f6439d65f16f8e7932be191a60ac39018 Mon Sep 17 00:00:00 2001 From: JakeSidSmith Date: Thu, 1 May 2014 15:09:18 +0100 Subject: [PATCH 05/13] Hide legend according to __legend_show --- c3.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/c3.js b/c3.js index 0dc53fc..945d823 100644 --- a/c3.js +++ b/c3.js @@ -3811,7 +3811,7 @@ updateTargets(c3.data.targets); // Redraw with new targets - redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); + redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: __legend_show}); if (typeof args.done === 'function') { args.done(); @@ -4157,7 +4157,7 @@ .style('opacity', 1); } - redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); + redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: __legend_show}); }; c3.hide = function (targetIds, options) { @@ -4178,7 +4178,7 @@ .style('opacity', legendOpacityForHidden); } - redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); + redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: __legend_show}); }; c3.toggle = function (targetId) { @@ -4224,7 +4224,7 @@ c3.unload = function (targetIds) { unload(mapToTargetIds(targetIds), function () { - redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); + redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: __legend_show}); }); }; @@ -4448,7 +4448,7 @@ legend.style('visibility', 'visible'); } showLegend(mapToTargetIds(targetIds)); - redraw({withLegend: true}); + redraw({withLegend: __legend_show}); }; c3.legend.hide = function (targetIds) { if (__legend_show && isEmpty(targetIds)) { @@ -4456,13 +4456,13 @@ legend.style('visibility', 'hidden'); } hideLegend(mapToTargetIds(targetIds)); - redraw({withLegend: false}); + redraw({withLegend: __legend_show}); }; c3.resize = function (size) { __size_width = size ? size.width : null; __size_height = size ? size.height : null; - updateAndRedraw({withLegend: false, withTransition: false, withTransitionForTransform: false}); + updateAndRedraw({withLegend: __legend_show, withTransition: false, withTransitionForTransform: false}); }; c3.destroy = function () { From 16dd1acd8b1fc5b54c2399cb507467fed564640b Mon Sep 17 00:00:00 2001 From: JakeSidSmith Date: Thu, 1 May 2014 15:16:37 +0100 Subject: [PATCH 06/13] Offset x axis by 50 --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index 945d823..69df706 100644 --- a/c3.js +++ b/c3.js @@ -354,7 +354,7 @@ yAxis = (transitions && transitions.axisY) ? transitions.axisY : main.select('.' + CLASS.axisY).transition().duration(duration), y2Axis = (transitions && transitions.axisYs) ? transitions.axisY2 : main.select('.' + CLASS.axisY2).transition().duration(duration); main.attr("transform", translate.main); - xAxis.attr("transform", translate.x); + xAxis.attr("transform", 50); yAxis.attr("transform", translate.y); y2Axis.attr("transform", translate.y2); main.select('.' + CLASS.chartArcs).attr("transform", translate.arc); From c51846673864a3ee1008ea47550fc8b2641a9fda Mon Sep 17 00:00:00 2001 From: JakeSidSmith Date: Thu, 1 May 2014 15:21:02 +0100 Subject: [PATCH 07/13] Try height2 ? --- c3.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index 69df706..a07ee1f 100644 --- a/c3.js +++ b/c3.js @@ -332,7 +332,7 @@ main : function () { return "translate(" + margin.left + "," + margin.top + ")"; }, context : function () { return "translate(" + margin2.left + "," + margin2.top + ")"; }, legend : function () { return "translate(" + margin3.left + "," + margin3.top + ")"; }, - x : function () { return "translate(0," + (__axis_rotated ? 0 : height) + ")"; }, + x : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; }, y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; }, y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; }, subx : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; }, @@ -354,7 +354,7 @@ yAxis = (transitions && transitions.axisY) ? transitions.axisY : main.select('.' + CLASS.axisY).transition().duration(duration), y2Axis = (transitions && transitions.axisYs) ? transitions.axisY2 : main.select('.' + CLASS.axisY2).transition().duration(duration); main.attr("transform", translate.main); - xAxis.attr("transform", 50); + xAxis.attr("transform", translate.x); yAxis.attr("transform", translate.y); y2Axis.attr("transform", translate.y2); main.select('.' + CLASS.chartArcs).attr("transform", translate.arc); From 66b5413bbed542c0d1211340f50f83e9192937cb Mon Sep 17 00:00:00 2001 From: JakeSidSmith Date: Thu, 1 May 2014 15:23:20 +0100 Subject: [PATCH 08/13] Nope --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index a07ee1f..945d823 100644 --- a/c3.js +++ b/c3.js @@ -332,7 +332,7 @@ main : function () { return "translate(" + margin.left + "," + margin.top + ")"; }, context : function () { return "translate(" + margin2.left + "," + margin2.top + ")"; }, legend : function () { return "translate(" + margin3.left + "," + margin3.top + ")"; }, - x : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; }, + x : function () { return "translate(0," + (__axis_rotated ? 0 : height) + ")"; }, y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; }, y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; }, subx : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; }, From 56c8316c07b5619bb4da632ab0405121695705c1 Mon Sep 17 00:00:00 2001 From: JakeSidSmith Date: Thu, 1 May 2014 15:24:43 +0100 Subject: [PATCH 09/13] currentHeight --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index 945d823..22f2ab6 100644 --- a/c3.js +++ b/c3.js @@ -332,7 +332,7 @@ main : function () { return "translate(" + margin.left + "," + margin.top + ")"; }, context : function () { return "translate(" + margin2.left + "," + margin2.top + ")"; }, legend : function () { return "translate(" + margin3.left + "," + margin3.top + ")"; }, - x : function () { return "translate(0," + (__axis_rotated ? 0 : height) + ")"; }, + x : function () { return "translate(0," + (__axis_rotated ? 0 : currentHeight) + ")"; }, y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; }, y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; }, subx : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; }, From a465b8842a9fb811021a79d5e2572a575b4b8a24 Mon Sep 17 00:00:00 2001 From: JakeSidSmith Date: Thu, 1 May 2014 15:38:00 +0100 Subject: [PATCH 10/13] Minus margin bottom --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index 22f2ab6..7e939a3 100644 --- a/c3.js +++ b/c3.js @@ -332,7 +332,7 @@ main : function () { return "translate(" + margin.left + "," + margin.top + ")"; }, context : function () { return "translate(" + margin2.left + "," + margin2.top + ")"; }, legend : function () { return "translate(" + margin3.left + "," + margin3.top + ")"; }, - x : function () { return "translate(0," + (__axis_rotated ? 0 : currentHeight) + ")"; }, + x : function () { return "translate(0," + (__axis_rotated ? 0 : currentHeight - margin.bottom) + ")"; }, y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; }, y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; }, subx : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; }, From 9154fe7e8554c8029bc9912149c9e6c5a79308d5 Mon Sep 17 00:00:00 2001 From: JakeSidSmith Date: Thu, 1 May 2014 15:42:20 +0100 Subject: [PATCH 11/13] Blergh --- c3.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/c3.js b/c3.js index 7e939a3..fcb4a4c 100644 --- a/c3.js +++ b/c3.js @@ -332,7 +332,12 @@ main : function () { return "translate(" + margin.left + "," + margin.top + ")"; }, context : function () { return "translate(" + margin2.left + "," + margin2.top + ")"; }, legend : function () { return "translate(" + margin3.left + "," + margin3.top + ")"; }, - x : function () { return "translate(0," + (__axis_rotated ? 0 : currentHeight - margin.bottom) + ")"; }, + x : function () { + if (__legend_show) { + return "translate(0," + (__axis_rotated ? 0 : height) + ")"; + } + return "translate(0," + (__axis_rotated ? 0 : currentHeight - margin.top) + ")"; + }, y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; }, y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; }, subx : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; }, From 2bfd814ab57b5b961e1e2cb245828f5db6e709ae Mon Sep 17 00:00:00 2001 From: JakeSidSmith Date: Thu, 1 May 2014 15:44:38 +0100 Subject: [PATCH 12/13] trueeeee --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index fcb4a4c..a7f11d0 100644 --- a/c3.js +++ b/c3.js @@ -333,7 +333,7 @@ context : function () { return "translate(" + margin2.left + "," + margin2.top + ")"; }, legend : function () { return "translate(" + margin3.left + "," + margin3.top + ")"; }, x : function () { - if (__legend_show) { + if (__legend_show === true) { return "translate(0," + (__axis_rotated ? 0 : height) + ")"; } return "translate(0," + (__axis_rotated ? 0 : currentHeight - margin.top) + ")"; From 40953e13c5c20141313cfa5178ef72b6906e1f7a Mon Sep 17 00:00:00 2001 From: JakeSidSmith Date: Thu, 1 May 2014 15:54:45 +0100 Subject: [PATCH 13/13] Something borrowed something blue --- c3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.js b/c3.js index a7f11d0..5cb974b 100644 --- a/c3.js +++ b/c3.js @@ -336,7 +336,7 @@ if (__legend_show === true) { return "translate(0," + (__axis_rotated ? 0 : height) + ")"; } - return "translate(0," + (__axis_rotated ? 0 : currentHeight - margin.top) + ")"; + return "translate(0," + (__axis_rotated ? 0 : height + margin3.top) + ")"; }, y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; }, y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; },