Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove space on edge on custom domain #715

Merged
merged 4 commits into from
Jul 22, 2020
Merged
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
11 changes: 9 additions & 2 deletions packages/core/src/components/axes/axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,23 @@ export class Axis extends Component {
"timeScale",
"addSpaceOnEdges"
);

const customDomain = Tools.getProperty(
options,
"axes",
axisPosition,
"domain"
);

let tickValues;
if (addSpaceOnEdges) {
if (addSpaceOnEdges && !customDomain) {
tickValues = scale.nice(numberOfTicks);
}
tickValues = scale.ticks(numberOfTicks);

// Remove labels on the edges
// If there are more than 2 labels to show
if (addSpaceOnEdges && tickValues.length > 2) {
if (addSpaceOnEdges && tickValues.length > 2 && !customDomain) {
tickValues.splice(tickValues.length - 1, 1);
tickValues.splice(0, 1);
}
Expand Down