Skip to content

Commit

Permalink
fix(shape): line.step.type config not working
Browse files Browse the repository at this point in the history
- add d3 curveStepBefore and curveStepAfter api for check interpolate type

Ref naver#85
  • Loading branch information
joohwee-kim committed Aug 1, 2017
1 parent 4925845 commit 6585344
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions spec/shape.line-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ describe("SHAPE LINE", () => {
["data3", -150, 120, 110, 140, 115, 125]
],
type: "line"
},
line : {
step : {}
}
};
});
Expand All @@ -51,6 +54,13 @@ describe("SHAPE LINE", () => {
expect(true).to.be.ok;
});

it("should change line type to step-after", () => {
args.line.step.type = "step-after";

expect(true).to.be.ok;
});


it("should have shape-rendering = crispedges when it's step chart", () => {
chart.internal.main.selectAll(".bb-line").each(function() {
const style = d3.select(this).style("shape-rendering").toLowerCase();
Expand Down
6 changes: 5 additions & 1 deletion src/internals/shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* billboard.js project is licensed under the MIT license
*/
import {
curveStepBefore as d3CurveStepBefore,
curveStepAfter as d3CurveStepAfter,
curveBasisClosed as d3CurveBasisClosed,
curveBasisOpen as d3CurveBasisOpen,
curveBasis as d3CurveBasis,
Expand Down Expand Up @@ -157,7 +159,9 @@ extend(ChartInternal.prototype, {
"natural": d3CurveNatural,
"linear-closed": d3CurveLinearClosed,
"linear": d3CurveLinear,
"step": d3CurveStep
"step": d3CurveStep,
"step-after": d3CurveStepAfter,
"step-before": d3CurveStepBefore
}[interpolation];
},

Expand Down

0 comments on commit 6585344

Please sign in to comment.