Skip to content

Commit

Permalink
Merge pull request #1287 from palantir/hotfix-legend-classing
Browse files Browse the repository at this point in the history
[HOTFIX] Add classes to legend rows/entries
  • Loading branch information
jtlan committed Nov 4, 2014
2 parents 2a9cc57 + 339ef32 commit 366b9de
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plottable.js
Original file line number Diff line number Diff line change
Expand Up @@ -5470,6 +5470,9 @@ var Plottable;
var r = textHeight * 0.3;
var legend = this._content.selectAll("." + Legend.SUBELEMENT_CLASS).data(domain, function (d) { return d; });
var legendEnter = legend.enter().append("g").classed(Legend.SUBELEMENT_CLASS, true);
legendEnter.each(function (d) {
d3.select(this).classed(d.replace(" ", "-"), true);
});
legendEnter.append("circle");
legendEnter.append("g").classed("text-container", true);
legend.exit().remove();
Expand Down Expand Up @@ -5668,6 +5671,9 @@ var Plottable;
rows.attr("transform", function (d, i) { return "translate(0, " + (i * layout.textHeight + _this.padding) + ")"; });
var entries = rows.selectAll("g." + HorizontalLegend.LEGEND_ENTRY_CLASS).data(function (d) { return d; });
var entriesEnter = entries.enter().append("g").classed(HorizontalLegend.LEGEND_ENTRY_CLASS, true);
entries.each(function (d) {
d3.select(this).classed(d.replace(" ", "-"), true);
});
entriesEnter.append("circle");
entriesEnter.append("g").classed("text-container", true);
entries.exit().remove();
Expand Down
3 changes: 3 additions & 0 deletions src/components/horizontalLegend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ export module Component {

var entries = rows.selectAll("g." + HorizontalLegend.LEGEND_ENTRY_CLASS).data((d) => d);
var entriesEnter = entries.enter().append("g").classed(HorizontalLegend.LEGEND_ENTRY_CLASS, true);
entries.each(function(d: string) {
d3.select(this).classed(d.replace(" ", "-"), true);
});
entriesEnter.append("circle");
entriesEnter.append("g").classed("text-container", true);
entries.exit().remove();
Expand Down
4 changes: 4 additions & 0 deletions src/components/legend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ export module Component {
var legendEnter = legend.enter()
.append("g").classed(Legend.SUBELEMENT_CLASS, true);

legendEnter.each(function(d: String) {
d3.select(this).classed(d.replace(" ", "-"), true);
});

legendEnter.append("circle");
legendEnter.append("g").classed("text-container", true);

Expand Down

0 comments on commit 366b9de

Please sign in to comment.