Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

Fix #103 - cleanup x axis label offsets to avoid tie to chart offsets #111

Merged
merged 1 commit into from
Mar 18, 2017

Conversation

marzolfb
Copy link
Contributor

The original (broken) implementation uses a svg group around the x axis
text label. The x and y coordinates for that svg group are driven off
the chart's margin left and top offset values respectively. The
implication of this is that when specifying left and/or top offsets for
the entire chart, it inadvertently makes the labels either not aligned
with its corresponding bars (if the margin left value is too big) or
makes the labels appear way below the x axis or not at all (if the
margin top value is too big).

This fix removes the seemingly unnecessary svg grouping with incorrect
positioning around the label and modifies the y value for the label. The
x value (which is the center of the label) remains positioned at the
center of the bar above that it corresponds with. The y value has been
modified to add a configurable offset value to the minY value for the
chart. If no offset value is configured via the option props the default
offset value is 20 which seems to provide a reasonable amount of spacing
below the x axis.

The original (broken) implementation uses a svg group around the x axis
text label. The x and y coordinates for that svg group are driven off
the chart's margin left and top offset values respectively. The
implication of this is that when specifying left and/or top offsets for
the entire chart, it inadvertently makes the labels either not aligned
with its corresponding bars (if the margin left value is too big) or
makes the labels appear way below the x axis or not at all (if the
margin top value is too big).

This fix removes the seemingly unnecessary svg grouping with incorrect
positioning around the label and modifies the y value for the label. The
x value (which is the center of the label) remains positioned at the
center of the bar above that it corresponds with. The y value has been
modified to add a configurable offset value to the minY value for the
chart. If no offset value is configured via the option props the default
offset value is 20 which seems to provide a reasonable amount of spacing
below the x axis.
:
@marzolfb marzolfb merged commit 401ecdf into master Mar 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants