Skip to content

Commit

Permalink
fix(radar): Correct display of indexed axis
Browse files Browse the repository at this point in the history
Typecast axis text value to be dispalyed from the helper function.

Fix #997
  • Loading branch information
netil authored Jul 26, 2019
1 parent b97558c commit 9bac296
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions spec/shape/shape.radar-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,23 @@ describe("SHAPE RADAR", () => {
});
});
});

describe("Axis", () => {
before(() => {
args = {
data: {
columns: [
["data1", 330, 350, 220, 400, 150, 330, 230, 390, 95, 195, 220]
],
type: "radar"
}
};
});

it("check if default indexed axis text are showing", () => {
chart.$.main.selectAll(`.${CLASS.chartRadars} .${CLASS.axis} text`).each(function(d, i) {
expect(+this.textContent).to.be.equal(i);
});
});
});
});
2 changes: 1 addition & 1 deletion src/shape/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ extend(ChartInternal.prototype, {
.attr("dy", ".5em")
.call(selection => {
selection.each(function(d) {
setTextValue(d3Select(this), d, [-1.2, 1.2], true);
setTextValue(d3Select(this), String(d), [-1.2, 1.2], true);
});
})
.datum((d, i) => ({index: i}))
Expand Down

0 comments on commit 9bac296

Please sign in to comment.