mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-11-10 21:36:34 +01:00
parent
0015b28ef2
commit
acfec20bcf
@ -237,8 +237,10 @@ class Morris.Line
|
|||||||
.attr('font-size', @options.gridTextSize)
|
.attr('font-size', @options.gridTextSize)
|
||||||
.attr('fill', @options.gridTextColor)
|
.attr('fill', @options.gridTextColor)
|
||||||
labelBox = label.getBBox()
|
labelBox = label.getBBox()
|
||||||
# ensure a minimum of `xLabelMargin` pixels between labels
|
# ensure a minimum of `xLabelMargin` pixels between labels, and ensure
|
||||||
if prevLabelMargin is null or prevLabelMargin <= labelBox.x
|
# labels don't overflow the container
|
||||||
|
if (prevLabelMargin is null or prevLabelMargin <= labelBox.x) and
|
||||||
|
labelBox.x >= 0 and (labelBox.x + labelBox.width) < @el.width()
|
||||||
prevLabelMargin = labelBox.x + labelBox.width + xLabelMargin
|
prevLabelMargin = labelBox.x + labelBox.width + xLabelMargin
|
||||||
else
|
else
|
||||||
label.remove()
|
label.remove()
|
||||||
|
@ -271,7 +271,7 @@
|
|||||||
var label, labelBox;
|
var label, labelBox;
|
||||||
label = _this.r.text(_this.transX(xpos), ypos, labelText).attr('font-size', _this.options.gridTextSize).attr('fill', _this.options.gridTextColor);
|
label = _this.r.text(_this.transX(xpos), ypos, labelText).attr('font-size', _this.options.gridTextSize).attr('fill', _this.options.gridTextColor);
|
||||||
labelBox = label.getBBox();
|
labelBox = label.getBBox();
|
||||||
if (prevLabelMargin === null || prevLabelMargin <= labelBox.x) {
|
if ((prevLabelMargin === null || prevLabelMargin <= labelBox.x) && labelBox.x >= 0 && (labelBox.x + labelBox.width) < _this.el.width()) {
|
||||||
return prevLabelMargin = labelBox.x + labelBox.width + xLabelMargin;
|
return prevLabelMargin = labelBox.x + labelBox.width + xLabelMargin;
|
||||||
} else {
|
} else {
|
||||||
return label.remove();
|
return label.remove();
|
||||||
|
2
morris.min.js
vendored
2
morris.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user