Browse Source

Merge pull request #3 from Opsimize/fix-x-axis

Fix x axis
pull/789/head
Tony Aldridge 11 years ago
parent
commit
90cb93fb6a
  1. 23
      c3.js

23
c3.js

@ -332,7 +332,12 @@
main : function () { return "translate(" + margin.left + "," + margin.top + ")"; }, main : function () { return "translate(" + margin.left + "," + margin.top + ")"; },
context : function () { return "translate(" + margin2.left + "," + margin2.top + ")"; }, context : function () { return "translate(" + margin2.left + "," + margin2.top + ")"; },
legend : function () { return "translate(" + margin3.left + "," + margin3.top + ")"; }, legend : function () { return "translate(" + margin3.left + "," + margin3.top + ")"; },
x : function () { return "translate(0," + (__axis_rotated ? 0 : height) + ")"; }, x : function () {
if (__legend_show === true) {
return "translate(0," + (__axis_rotated ? 0 : height) + ")";
}
return "translate(0," + (__axis_rotated ? 0 : height + margin3.top) + ")";
},
y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; }, y : function () { return "translate(0," + (__axis_rotated ? height : 0) + ")"; },
y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; }, y2 : function () { return "translate(" + (__axis_rotated ? 0 : width) + "," + (__axis_rotated ? 1 : 0) + ")"; },
subx : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; }, subx : function () { return "translate(0," + (__axis_rotated ? 0 : height2) + ")"; },
@ -3811,7 +3816,7 @@
updateTargets(c3.data.targets); updateTargets(c3.data.targets);
// Redraw with new 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') { if (typeof args.done === 'function') {
args.done(); args.done();
@ -4157,7 +4162,7 @@
.style('opacity', 1); .style('opacity', 1);
} }
redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: __legend_show});
}; };
c3.hide = function (targetIds, options) { c3.hide = function (targetIds, options) {
@ -4178,7 +4183,7 @@
.style('opacity', legendOpacityForHidden); .style('opacity', legendOpacityForHidden);
} }
redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: __legend_show});
}; };
c3.toggle = function (targetId) { c3.toggle = function (targetId) {
@ -4224,7 +4229,7 @@
c3.unload = function (targetIds) { c3.unload = function (targetIds) {
unload(mapToTargetIds(targetIds), function () { unload(mapToTargetIds(targetIds), function () {
redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: __legend_show});
}); });
}; };
@ -4448,21 +4453,21 @@
legend.style('visibility', 'visible'); legend.style('visibility', 'visible');
} }
showLegend(mapToTargetIds(targetIds)); showLegend(mapToTargetIds(targetIds));
redraw({withLegend: true}); redraw({withLegend: __legend_show});
}; };
c3.legend.hide = function (targetIds) { c3.legend.hide = function (targetIds) {
hideLegend(mapToTargetIds(targetIds));
redraw({withLegend: true});
if (__legend_show && isEmpty(targetIds)) { if (__legend_show && isEmpty(targetIds)) {
__legend_show = false; __legend_show = false;
legend.style('visibility', 'hidden'); legend.style('visibility', 'hidden');
} }
hideLegend(mapToTargetIds(targetIds));
redraw({withLegend: __legend_show});
}; };
c3.resize = function (size) { c3.resize = function (size) {
__size_width = size ? size.width : null; __size_width = size ? size.width : null;
__size_height = size ? size.height : null; __size_height = size ? size.height : null;
updateAndRedraw({withLegend: true, withTransition: false, withTransitionForTransform: false}); updateAndRedraw({withLegend: __legend_show, withTransition: false, withTransitionForTransform: false});
}; };
c3.destroy = function () { c3.destroy = function () {

Loading…
Cancel
Save