From 9bac296b650dac1be28c7d5b273a5cf9659831e9 Mon Sep 17 00:00:00 2001 From: Jae Sung Park Date: Fri, 26 Jul 2019 09:47:05 +0900 Subject: [PATCH] fix(radar): Correct display of indexed axis Typecast axis text value to be dispalyed from the helper function. Fix #997 --- spec/shape/shape.radar-spec.js | 19 +++++++++++++++++++ src/shape/radar.js | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/spec/shape/shape.radar-spec.js b/spec/shape/shape.radar-spec.js index 9a6d242b8..841d8f7b4 100644 --- a/spec/shape/shape.radar-spec.js +++ b/spec/shape/shape.radar-spec.js @@ -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); + }); + }); + }); }); diff --git a/src/shape/radar.js b/src/shape/radar.js index 0fa60c941..e129b4999 100644 --- a/src/shape/radar.js +++ b/src/shape/radar.js @@ -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}))