Skip to content

Commit

Permalink
Don't draw empty labels as they generate a warning when rotated.
Browse files Browse the repository at this point in the history
  • Loading branch information
Menno van der Sman committed Apr 23, 2010
1 parent aaf09fa commit 9166fc8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions source/grafico.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,11 @@ Grafico.BaseGraph = Class.create(Grafico.Base, {
cursor.moveTo(parseInt(x, 10), parseInt(y, 10) + 0.5);
cursor.lineTo(parseInt(x, 10) + y_offset(5), parseInt(y, 10) + 0.5 + x_offset(5));
}
this.paper.text(x + font_offsets[0], y - 2 - font_offsets[1], label.toString()).attr(font_options);

if (label !== "") {
this.paper.text(x + font_offsets[0], y - 2 - font_offsets[1], label.toString()).attr(font_options);
}

x = x + x_offset(step);
y = y + y_offset(step);
}.bind(this));
Expand All @@ -702,12 +706,12 @@ Grafico.BaseGraph = Class.create(Grafico.Base, {
},

drawHorizontalLabels: function () {
var extra_options = this.options.label_rotation ? {rotation:this.options.label_rotation, translation: -this.options.font_size + " 0"} : {},
var extra_options = this.options.label_rotation ? {rotation: this.options.label_rotation, translation: -this.options.font_size + " 0"} : {},
labels = this.options.labels;

if (this.options.label_max_size) {
for (var i = 0; i < labels.length; i++) {
labels[i] = labels[i].truncate(this.options.label_max_size+1, "…");
labels[i] = labels[i].truncate(this.options.label_max_size + 1, "…");
}
}

Expand Down

0 comments on commit 9166fc8

Please sign in to comment.