Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Bug/chart tick format #498

Merged
merged 2 commits into from
Jul 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/victory-chart/helper-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default {
const dataTicks = ["", ...dataNames, ""];
return (x) => dataTicks[x];
} else {
return calculatedProps.scale[currentAxis].tickFormat() || identity;
return undefined;
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ describe("victory-chart/helpers-methods", () => {
describe("getTickFormat", () => {
const stringMap = { x: { "a": 1, "b": 2, "c": 3 } };
const nullStringMap = { x: null };
const scale = { x: { tickFormat: () => () => "scaleFormatTick" } };

it("returns the identity function when tickValues are numerical", () => {
const props = { tickValues: [1, 2, 3] };
Expand All @@ -179,12 +178,12 @@ describe("victory-chart/helpers-methods", () => {
expect(formatResult(1)).to.equal("a");
});

it("returns the tickFormat function from scale", () => {
it("returns undefined if no tickValues or stringMaps exist", () => {
const victoryAxis = getVictoryAxis({});
const formatResult = Helpers.getTickFormat(
victoryAxis, "x", { stringMap: nullStringMap, scale }
victoryAxis, "x", { stringMap: nullStringMap }
);
expect(formatResult(1)).to.equal("scaleFormatTick");
expect(formatResult).to.equal(undefined);
});
});

Expand Down