Skip to content

Commit

Permalink
fix(arc): Correction on rendering 0 values
Browse files Browse the repository at this point in the history
- When data value is 0 make path to have zero dimension
- Split .redrawArc() to .bindArcEvent()/.redrawArcText() to decrease complexity

Fix #652
Close #656
  • Loading branch information
netil committed Nov 15, 2018
1 parent ad84a22 commit dcfa12c
Show file tree
Hide file tree
Showing 2 changed files with 184 additions and 137 deletions.
27 changes: 26 additions & 1 deletion spec/shape/shape.arc-spec.js
Expand Up @@ -324,7 +324,7 @@ describe("SHAPE ARC", () => {

const chartArc = chart.$.main.select(`.${CLASS.chartArcs}`);
const min = chartArc.select(`.${CLASS.chartArcsGaugeMin}`);
const max = chartArc.select(`.${CLASS.chartArcsGaugeMax}`)
const max = chartArc.select(`.${CLASS.chartArcsGaugeMax}`);

// check if gauge value text is centered
expect(+chartArc.select(`.${CLASS.gaugeValue}`).attr("dy")).to.be.above(0);
Expand Down Expand Up @@ -385,4 +385,29 @@ describe("SHAPE ARC", () => {
}, 500);
});
});

describe("check for 0 or null value rendering", () => {
let chart;

before(() => {
chart = util.generate({
data: {
columns: [["data1", 100], ["data2", 0], ["data3", null]],
type: "donut"
},
donut: {
title: "Iris Petal Width"
}
});
});

it("the dimension should be 0x0", () => {
["data1", "data2"].forEach(id => {
const rect = chart.$.arc.select(`.${CLASS.arc}-${id}`).node().getBBox();

expect(rect.width === 0).to.be.true;
expect(rect.height === 0).to.be.true;
});
});
});
});

0 comments on commit dcfa12c

Please sign in to comment.